Kaydet (Commit) 872b5642 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) David Tardon

i123573 corrected reaction on ItemChanges for CustomShapes

Conflicts:
	svx/source/sdr/properties/customshapeproperties.cxx

Change-Id: I9f37893bab72b2d9b9f8874f6827ca6bee5dfbe1
üst d74fc692
...@@ -30,7 +30,8 @@ namespace sdr ...@@ -30,7 +30,8 @@ namespace sdr
{ {
class CustomShapeProperties : public TextProperties class CustomShapeProperties : public TextProperties
{ {
void UpdateTextFrameStatus(); private:
void UpdateTextFrameStatus(bool bInvalidateRenderGeometry);
protected: protected:
// create a new itemset // create a new itemset
......
...@@ -32,21 +32,32 @@ namespace sdr ...@@ -32,21 +32,32 @@ namespace sdr
{ {
namespace properties namespace properties
{ {
void CustomShapeProperties::UpdateTextFrameStatus() void CustomShapeProperties::UpdateTextFrameStatus(bool bInvalidateRenderGeometry)
{ {
SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject()); SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject());
const bool bOld(rObj.bTextFrame); 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(); rObj.bTextFrame = 0 != static_cast< const SdrTextAutoGrowHeightItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue();
// check if it did change
if(rObj.bTextFrame != bOld) 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 // #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(); 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) SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
...@@ -127,7 +138,7 @@ namespace sdr ...@@ -127,7 +138,7 @@ namespace sdr
TextProperties::ItemSetChanged(rSet); TextProperties::ItemSetChanged(rSet);
// update bTextFrame and RenderGeometry // update bTextFrame and RenderGeometry
UpdateTextFrameStatus(); UpdateTextFrameStatus(true);
} }
void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich) void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich)
...@@ -137,7 +148,7 @@ namespace sdr ...@@ -137,7 +148,7 @@ namespace sdr
case SDRATTR_TEXT_AUTOGROWHEIGHT: case SDRATTR_TEXT_AUTOGROWHEIGHT:
{ {
// #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize() // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize()
UpdateTextFrameStatus(); UpdateTextFrameStatus(false);
break; break;
} }
default: default:
...@@ -156,7 +167,7 @@ namespace sdr ...@@ -156,7 +167,7 @@ namespace sdr
TextProperties::ItemChange( nWhich, pNewItem ); TextProperties::ItemChange( nWhich, pNewItem );
// update bTextFrame and RenderGeometry // update bTextFrame and RenderGeometry
UpdateTextFrameStatus(); UpdateTextFrameStatus(true);
} }
void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
...@@ -165,13 +176,13 @@ namespace sdr ...@@ -165,13 +176,13 @@ namespace sdr
TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
// update bTextFrame and RenderGeometry // update bTextFrame and RenderGeometry
UpdateTextFrameStatus(); UpdateTextFrameStatus(true);
} }
void CustomShapeProperties::ForceDefaultAttributes() void CustomShapeProperties::ForceDefaultAttributes()
{ {
// update bTextFrame and RenderGeometry // 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 // 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... // This means: Do *not* call parent here is by purpose...
...@@ -219,11 +230,8 @@ namespace sdr ...@@ -219,11 +230,8 @@ namespace sdr
bRemoveRenderGeometry = sal_True; bRemoveRenderGeometry = sal_True;
} }
if ( bRemoveRenderGeometry )
{
// update bTextFrame and RenderGeometry // update bTextFrame and RenderGeometry
UpdateTextFrameStatus(); UpdateTextFrameStatus(bRemoveRenderGeometry);
}
} }
} // end of namespace properties } // end of namespace properties
} // end of namespace sdr } // end of namespace sdr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment