diff options
author | Armin Le Grand <alg@apache.org> | 2013-10-31 11:53:29 +0000 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-03-23 06:57:06 +0100 |
commit | 872b5642f9c81f7e09b5fe592d9f92b9367d337c (patch) | |
tree | 6c08bde15ffe43c32fc022194de46c012605b8b6 | |
parent | d74fc692a9ee403851b29bb93b252a79404ba007 (diff) |
i123573 corrected reaction on ItemChanges for CustomShapes
Conflicts:
svx/source/sdr/properties/customshapeproperties.cxx
Change-Id: I9f37893bab72b2d9b9f8874f6827ca6bee5dfbe1
-rw-r--r-- | include/svx/sdr/properties/customshapeproperties.hxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/properties/customshapeproperties.cxx | 32 |
2 files changed, 22 insertions, 13 deletions
diff --git a/include/svx/sdr/properties/customshapeproperties.hxx b/include/svx/sdr/properties/customshapeproperties.hxx index d92db87fe39a..f28c90f9a893 100644 --- a/include/svx/sdr/properties/customshapeproperties.hxx +++ b/include/svx/sdr/properties/customshapeproperties.hxx @@ -30,7 +30,8 @@ namespace sdr { class CustomShapeProperties : public TextProperties { - void UpdateTextFrameStatus(); + private: + void UpdateTextFrameStatus(bool bInvalidateRenderGeometry); protected: // create a new itemset diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index 35b4d07ec087..729709eac1f4 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -32,21 +32,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 recursion, since it calls SetObjectItemSet again, but rObj.bTextFrame - // will not change again, thus it will be only one level and terminate + // 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) @@ -127,7 +138,7 @@ namespace sdr TextProperties::ItemSetChanged(rSet); // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); } void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich) @@ -137,7 +148,7 @@ namespace sdr case SDRATTR_TEXT_AUTOGROWHEIGHT: { // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize() - UpdateTextFrameStatus(); + UpdateTextFrameStatus(false); break; } default: @@ -156,7 +167,7 @@ namespace sdr TextProperties::ItemChange( nWhich, pNewItem ); // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); + UpdateTextFrameStatus(true); } void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) @@ -165,13 +176,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... @@ -219,11 +230,8 @@ namespace sdr bRemoveRenderGeometry = sal_True; } - if ( bRemoveRenderGeometry ) - { // update bTextFrame and RenderGeometry - UpdateTextFrameStatus(); - } + UpdateTextFrameStatus(bRemoveRenderGeometry); } } // end of namespace properties } // end of namespace sdr |