You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/10/31 12:53:29 UTC

svn commit: r1537454 - in /openoffice/trunk/main/svx: inc/svx/sdr/properties/customshapeproperties.hxx source/sdr/properties/customshapeproperties.cxx

Author: alg
Date: Thu Oct 31 11:53:29 2013
New Revision: 1537454

URL: http://svn.apache.org/r1537454
Log:
i123573 corrected reaction on ItemChanges for CustomShapes

Modified:
    openoffice/trunk/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx
    openoffice/trunk/main/svx/source/sdr/properties/customshapeproperties.cxx

Modified: openoffice/trunk/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx?rev=1537454&r1=1537453&r2=1537454&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx Thu Oct 31 11:53:29 2013
@@ -34,7 +34,8 @@ namespace sdr
 	{
 		class CustomShapeProperties : public TextProperties
 		{
-			void UpdateTextFrameStatus();
+        private:
+			void UpdateTextFrameStatus(bool bInvalidateRenderGeometry);
 
 		protected:
 			// create a new itemset

Modified: openoffice/trunk/main/svx/source/sdr/properties/customshapeproperties.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sdr/properties/customshapeproperties.cxx?rev=1537454&r1=1537453&r2=1537454&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sdr/properties/customshapeproperties.cxx (original)
+++ openoffice/trunk/main/svx/source/sdr/properties/customshapeproperties.cxx Thu Oct 31 11:53:29 2013
@@ -39,21 +39,32 @@ namespace sdr
 {
     namespace properties
     {
-        void CustomShapeProperties::UpdateTextFrameStatus()
+        void CustomShapeProperties::UpdateTextFrameStatus(bool bInvalidateRenderGeometry)
         {
             SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject());
             const bool bOld(rObj.bTextFrame);
 
+            // change TextFrame flag when bResizeShapeToFitText changes (which is mapped 
+            // on the item SDRATTR_TEXT_AUTOGROWHEIGHT for custom shapes, argh)
             rObj.bTextFrame = 0 != static_cast< const SdrTextAutoGrowHeightItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue();
 
+            // check if it did change
             if(rObj.bTextFrame != bOld)
             {
-                rObj.InvalidateRenderGeometry();
+                // on change also invalidate render geometry
+                bInvalidateRenderGeometry = true;
 
-                // #115391# Potential recursuin, since it calls SetObjectItemSet again, but rObj.bTextFrame 
-                // will not change again, thus it will be only one level and terminate
+                // #115391# Potential recursion, since it calls SetObjectItemSet again, but rObj.bTextFrame 
+                // will not change again. Thus it will be only one level and terminate safely
                 rObj.AdaptTextMinSize(); 
             }
+
+            if(bInvalidateRenderGeometry)
+            {
+                // if asked for or bResizeShapeToFitText changed, make sure that
+                // the render geometry is reconstructed using changed parameters
+                rObj.InvalidateRenderGeometry();
+            }
         }
 
         SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
@@ -134,7 +145,7 @@ namespace sdr
             TextProperties::ItemSetChanged(rSet);
 
             // update bTextFrame and RenderGeometry
-            UpdateTextFrameStatus();
+            UpdateTextFrameStatus(true);
         }
 
         void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich)
@@ -144,7 +155,7 @@ namespace sdr
                 case SDRATTR_TEXT_AUTOGROWHEIGHT:
                 {
                     // #115391#  update bTextFrame and RenderGeometry using AdaptTextMinSize()
-                    UpdateTextFrameStatus();
+                    UpdateTextFrameStatus(false);
                     break;
                 }
                 default:
@@ -163,7 +174,7 @@ namespace sdr
             TextProperties::ItemChange( nWhich, pNewItem );
 
             // update bTextFrame and RenderGeometry
-            UpdateTextFrameStatus();
+            UpdateTextFrameStatus(true);
         }
 
         void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
@@ -172,13 +183,13 @@ namespace sdr
             TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
 
             // update bTextFrame and RenderGeometry
-            UpdateTextFrameStatus();
+            UpdateTextFrameStatus(true);
         }
 
         void CustomShapeProperties::ForceDefaultAttributes()
         {
             // update bTextFrame and RenderGeometry
-            UpdateTextFrameStatus();
+            UpdateTextFrameStatus(true);
 
             // SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
             // This means: Do *not* call parent here is by purpose...
@@ -226,11 +237,8 @@ namespace sdr
                 bRemoveRenderGeometry = sal_True;
             }
 
-            if ( bRemoveRenderGeometry )
-            {
-                // update bTextFrame and RenderGeometry
-                UpdateTextFrameStatus();
-            }
+            // update bTextFrame and RenderGeometry
+            UpdateTextFrameStatus(bRemoveRenderGeometry);
         }
     } // end of namespace properties
 } // end of namespace sdr