i123573 corrected reaction on ItemChanges for CustomShapes

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

Change-Id: I9f37893bab72b2d9b9f8874f6827ca6bee5dfbe1
This commit is contained in:
Armin Le Grand 2013-10-31 11:53:29 +00:00 committed by David Tardon
parent d74fc692a9
commit 872b5642f9
2 changed files with 22 additions and 13 deletions

View File

@ -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

View File

@ -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
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
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
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
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
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