diff options
author | Armin Le Grand <alg@apache.org> | 2013-09-19 10:11:03 +0000 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-03-23 06:57:05 +0100 |
commit | 120e469d176026ceb59abbf74d2ad255323cbc9a (patch) | |
tree | 9ed4fe3aeeddd3a7c6333f1305bfb5ce6cf48561 /svx/source/sdr | |
parent | 8931ab3fc27acb0665fa636eb6390034cbb3eec6 (diff) |
i#115391 better support for MinTextSize settings
... for TextShapes and CustomShapes
Conflicts:
include/svx/svdotext.hxx
svx/source/sdr/properties/customshapeproperties.cxx
svx/source/svdraw/svdoashp.cxx
svx/source/svdraw/svdotext.cxx
svx/source/svdraw/svdotxdr.cxx
svx/source/svdraw/svdotxtr.cxx
Change-Id: Ie6f490801b6887568135ed5f83c8bbe7ab6daa08
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/properties/customshapeproperties.cxx | 100 |
1 files changed, 52 insertions, 48 deletions
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index 13f167cf2a2d..35b4d07ec087 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -34,13 +34,19 @@ namespace sdr { void CustomShapeProperties::UpdateTextFrameStatus() { - SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - SdrTextAutoGrowHeightItem& rAutoGrowHeightItem = - (SdrTextAutoGrowHeightItem&)rObj.GetMergedItem( SDRATTR_TEXT_AUTOGROWHEIGHT ); - rObj.bTextFrame = rAutoGrowHeightItem.GetValue(); + SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject()); + const bool bOld(rObj.bTextFrame); - if ( rObj.bTextFrame ) - rObj.NbcAdjustTextFrameWidthAndHeight(); + rObj.bTextFrame = 0 != static_cast< const SdrTextAutoGrowHeightItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue(); + + if(rObj.bTextFrame != bOld) + { + rObj.InvalidateRenderGeometry(); + + // #115391# Potential recursion, since it calls SetObjectItemSet again, but rObj.bTextFrame + // will not change again, thus it will be only one level and terminate + rObj.AdaptTextMinSize(); + } } SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) @@ -67,6 +73,7 @@ namespace sdr // end 0, 0)); } + bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const { sal_Bool bAllowItemChange = sal_True; @@ -79,6 +86,7 @@ namespace sdr bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem ); return bAllowItemChange; } + void CustomShapeProperties::ClearObjectItem(const sal_uInt16 nWhich) { if ( !nWhich ) @@ -96,6 +104,7 @@ namespace sdr else TextProperties::ClearObjectItem( nWhich ); } + void CustomShapeProperties::ClearObjectItemDirect(const sal_uInt16 nWhich) { if ( !nWhich ) @@ -111,66 +120,63 @@ namespace sdr else TextProperties::ClearObjectItemDirect( nWhich ); } + void CustomShapeProperties::ItemSetChanged(const SfxItemSet& rSet) { - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); + // call parent + TextProperties::ItemSetChanged(rSet); + + // update bTextFrame and RenderGeometry + UpdateTextFrameStatus(); + } - if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) ) + void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich) + { + switch(nWhich) { - rObj.bTextFrame = ((SdrTextAutoGrowHeightItem&)rSet.Get( SDRATTR_TEXT_AUTOGROWHEIGHT )).GetValue(); + case SDRATTR_TEXT_AUTOGROWHEIGHT: + { + // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize() + UpdateTextFrameStatus(); + break; + } + default: + { + break; + } } // call parent - TextProperties::ItemSetChanged(rSet); - - // local changes, removing cached objects - rObj.InvalidateRenderGeometry(); + TextProperties::PostItemChange(nWhich); } + void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) { - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); - //OutlinerParaObject* pParaObj = rObj.GetOutlinerParaObject(); - - if( pNewItem && ( SDRATTR_TEXT_AUTOGROWHEIGHT == nWhich ) ) - { - rObj.bTextFrame = ((SdrTextAutoGrowHeightItem*)pNewItem)->GetValue(); - } // call parent TextProperties::ItemChange( nWhich, pNewItem ); - rObj.InvalidateRenderGeometry(); + // update bTextFrame and RenderGeometry + UpdateTextFrameStatus(); } + void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) { + // call parent TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); + + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); } + void CustomShapeProperties::ForceDefaultAttributes() { + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); -/* SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml - - SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - sal_Bool bTextFrame(rObj.IsTextFrame()); - - // force ItemSet - GetObjectItemSet(); - - if(bTextFrame) - { - mpItemSet->Put(XLineStyleItem(XLINE_NONE)); - mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE))); - mpItemSet->Put(XFillStyleItem(XFILL_NONE)); - } - else - { - mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); - mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); - mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); - } -*/ + // 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... } + CustomShapeProperties::CustomShapeProperties(SdrObject& rObj) : TextProperties(rObj) { @@ -189,14 +195,15 @@ namespace sdr { return *(new CustomShapeProperties(*this, rObj)); } + void CustomShapeProperties::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { TextProperties::Notify( rBC, rHint ); sal_Bool bRemoveRenderGeometry = sal_False; - const SfxStyleSheetHint *pStyleHint = PTR_CAST( SfxStyleSheetHint, &rHint ); const SfxSimpleHint *pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint ); + if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() ) { switch( pStyleHint->GetHint() ) @@ -211,15 +218,12 @@ namespace sdr { bRemoveRenderGeometry = sal_True; } + if ( bRemoveRenderGeometry ) { + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); - - // local changes, removing cached objects - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); - rObj.InvalidateRenderGeometry(); } - } } // end of namespace properties } // end of namespace sdr |