Blob Blame History Raw
From 1c32b2e2f8e15a690b3645651253d85aee4040d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 21 Nov 2016 12:42:09 +0000
Subject: [PATCH] drawing shapes aren't tracking style name changes correctly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

in draw, create a box, enter some text, exit and select box
F11 for style navigator, new style, set font to e.g. 88
apply this style to the box. All ok.

If you modify the style and changes its font to e.g. bold
the text in the box tracks it as expected. All ok.

If you modify the style and change its name, the box resets
to something different and there's loads of warnings about
unknown styles. Not ok.

The style modification fires, but the style name gets overwritten
by the style stuck in a OutlinerParaObject that gets overlaid
over the editengine.

All the rTextProvider.getTextCount uses that don't iterate over all entries
look dubious to me, but I'll initially fix this one that I have hard evidence
for as broken.

All this is probably broken since...

commit 838c0fa8228f4ca656a264f6a5610c337ebf4fef
Author: RĂ¼diger Timm <rt@openoffice.org>
Date:   Wed Mar 12 08:47:30 2008 +0000

    INTEGRATION: CWS impresstables2 (1.14.72); FILE MERGED

Change-Id: Ib0dd2857ed26c49dcfa00aae923e36429a7f7862
---
 svx/source/sdr/properties/textproperties.cxx | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index de35ec3..09ebfc7 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -82,13 +82,13 @@ namespace sdr
         void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
         {
             SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
-            const svx::ITextProvider& rTextProvider(getTextProvider());
-            sal_Int32 nText = rTextProvider.getTextCount();
 
             // #i101556# ItemSet has changed -> new version
             maVersion++;
 
-            while( --nText >= 0 )
+            const svx::ITextProvider& rTextProvider(getTextProvider());
+            sal_Int32 nText = rTextProvider.getTextCount();
+            while (nText--)
             {
                 SdrText* pText = rTextProvider.getText( nText );
 
@@ -173,7 +173,7 @@ namespace sdr
 
                 const svx::ITextProvider& rTextProvider(getTextProvider());
                 sal_Int32 nCount = rTextProvider.getTextCount();
-                while( nCount-- )
+                while (nCount--)
                 {
                     SdrText* pText = rTextProvider.getText( nCount );
                     OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
@@ -246,8 +246,7 @@ namespace sdr
 
                 const svx::ITextProvider& rTextProvider(getTextProvider());
                 sal_Int32 nText = rTextProvider.getTextCount();
-
-                while( --nText >= 0 )
+                while (nText--)
                 {
                     SdrText* pText = rTextProvider.getText( nText );
 
@@ -408,8 +407,7 @@ namespace sdr
                 Outliner* pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, *rObj.GetModel());
                 const svx::ITextProvider& rTextProvider(getTextProvider());
                 sal_Int32 nText = rTextProvider.getTextCount();
-
-                while( --nText >= 0 )
+                while (nText--)
                 {
                     SdrText* pText = rTextProvider.getText( nText );
 
@@ -564,7 +562,7 @@ namespace sdr
                         rObj.SetPortionInfoChecked(false);
 
                         sal_Int32 nText = rTextProvider.getTextCount();
-                        while( --nText > 0 )
+                        while (nText--)
                         {
                             OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                             if( pParaObj )
@@ -587,7 +585,7 @@ namespace sdr
                     {
                         rObj.SetPortionInfoChecked(false);
                         sal_Int32 nText = rTextProvider.getTextCount();
-                        while( --nText > 0 )
+                        while (nText--)
                         {
                             OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                             if( pParaObj )
@@ -609,7 +607,7 @@ namespace sdr
                         if(aOldName != aNewName)
                         {
                             sal_Int32 nText = rTextProvider.getTextCount();
-                            while( --nText > 0 )
+                            while (nText--)
                             {
                                 OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                                 if( pParaObj )
-- 
2.9.3