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/svdraw/svdotext.cxx | |
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/svdraw/svdotext.cxx')
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 97 |
1 files changed, 78 insertions, 19 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 214f22af597f..5c24ec0848ea 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -542,39 +542,98 @@ bool SdrTextObj::NbcSetEckenradius(long nRad) return true; } -bool SdrTextObj::NbcSetMinTextFrameHeight(long nHgt) +bool SdrTextObj::NbcSetAutoGrowHeight(bool bAuto) { - if( bTextFrame && ( !pModel || !pModel->isLocked() ) ) // #i44922# + if(bTextFrame) { - SetObjectItem(SdrTextMinFrameHeightItem(nHgt)); - - // use bDisableAutoWidthOnDragging as - // bDisableAutoHeightOnDragging if vertical. - if(IsVerticalWriting() && bDisableAutoWidthOnDragging) - { - bDisableAutoWidthOnDragging = false; - SetObjectItem(SdrTextAutoGrowHeightItem(false)); - } + SetObjectItem(SdrTextAutoGrowHeightItem(bAuto)); + return true; + } + return false; +} +bool SdrTextObj::NbcSetMaxTextFrameHeight(long nHgt) +{ + if(bTextFrame) + { + SetObjectItem(SdrTextMaxFrameHeightItem(nHgt)); return true; } return false; } -bool SdrTextObj::NbcSetMinTextFrameWidth(long nWdt) +// #115391# This implementation is based on the object size (aRect) and the +// states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height +void SdrTextObj::AdaptTextMinSize() { - if( bTextFrame && ( !pModel || !pModel->isLocked() ) ) // #i44922# + if(bTextFrame && (!pModel || !pModel->isLocked())) { - SetObjectItem(SdrTextMinFrameWidthItem(nWdt)); + const bool bW(IsAutoGrowWidth()); + const bool bH(IsAutoGrowHeight()); - // use bDisableAutoWidthOnDragging only - // when not vertical. - if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) + if(bW || bH) { - bDisableAutoWidthOnDragging = false; - SetObjectItem(SdrTextAutoGrowWidthItem(false)); + SfxItemSet aSet(GetObjectItemSet()); + + if(bW) + { + const long nDist(GetTextLeftDistance() + GetTextRightDistance()); + const long nW(std::max(long(0), (long)(aRect.GetWidth() - 1 - nDist))); + + aSet.Put(SdrTextMinFrameWidthItem(nW)); + + if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) + { + bDisableAutoWidthOnDragging = true; + aSet.Put(SdrTextAutoGrowWidthItem(false)); + } + } + + if(bH) + { + const long nDist(GetTextUpperDistance() + GetTextLowerDistance()); + const long nH(std::max(long(0), (long)(aRect.GetHeight() - 1 - nDist))); + + aSet.Put(SdrTextMinFrameHeightItem(nH)); + + if(IsVerticalWriting() && bDisableAutoWidthOnDragging) + { + bDisableAutoWidthOnDragging = false; + SetObjectItem(SdrTextAutoGrowHeightItem(false)); + } + } + + SetObjectItemSet(aSet); + NbcAdjustTextFrameWidthAndHeight(); } + } +} +bool SdrTextObj::NbcSetAutoGrowWidth(bool bAuto) +{ + if(bTextFrame) + { + SetObjectItem(SdrTextAutoGrowWidthItem(bAuto)); + return true; + } + return false; +} + +bool SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt) +{ + if(bTextFrame) + { + SetObjectItem(SdrTextMaxFrameWidthItem(nWdt)); + return true; + } + return false; +} + +bool SdrTextObj::NbcSetFitToSize(SdrFitToSizeType eFit) +{ + if(bTextFrame) + { + SetObjectItem(SdrTextFitToSizeTypeItem(eFit)); return true; } return false; |