Kaydet (Commit) df399523 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Reduce scope level & Annotate the code a bit.

Change-Id: I6ebf849243000920b1c1f7e67d2dc81fcee9e16b
üst 96554f05
...@@ -548,51 +548,59 @@ bool SdrTextObj::NbcSetEckenradius(long nRad) ...@@ -548,51 +548,59 @@ bool SdrTextObj::NbcSetEckenradius(long nRad)
// states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height // states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height
void SdrTextObj::AdaptTextMinSize() void SdrTextObj::AdaptTextMinSize()
{ {
if(bTextFrame && (!pModel || !pModel->IsPasteResize())) if (!bTextFrame)
{ // Only do this for text frame.
const bool bW(IsAutoGrowWidth()); return;
const bool bH(IsAutoGrowHeight());
if(bW || bH) if (pModel && pModel->IsPasteResize())
{ // Don't do this during paste resize.
SfxItemSet aSet( return;
*GetObjectItemSet().GetPool(),
SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH
0, 0);
if(bW) const bool bW = IsAutoGrowWidth();
{ const bool bH = IsAutoGrowHeight();
const long nDist(GetTextLeftDistance() + GetTextRightDistance());
const long nW(std::max(long(0), (long)(aRect.GetWidth() - 1 - nDist)));
aSet.Put(makeSdrTextMinFrameWidthItem(nW)); if (!bW && !bH)
// No auto grow requested. Bail out.
return;
if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) SfxItemSet aSet(
{ *GetObjectItemSet().GetPool(),
bDisableAutoWidthOnDragging = true; SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
aSet.Put(makeSdrTextAutoGrowWidthItem(false)); SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH
} 0, 0);
}
if(bH) if(bW)
{ {
const long nDist(GetTextUpperDistance() + GetTextLowerDistance()); // Set minimum width.
const long nH(std::max(long(0), (long)(aRect.GetHeight() - 1 - nDist))); const long nDist = GetTextLeftDistance() + GetTextRightDistance();
const long nW = std::max<long>(0, aRect.GetWidth() - 1 - nDist); // text width without margins
aSet.Put(makeSdrTextMinFrameHeightItem(nH)); aSet.Put(makeSdrTextMinFrameWidthItem(nW));
if(IsVerticalWriting() && bDisableAutoWidthOnDragging) if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
{ {
bDisableAutoWidthOnDragging = false; bDisableAutoWidthOnDragging = true;
aSet.Put(makeSdrTextAutoGrowHeightItem(false)); aSet.Put(makeSdrTextAutoGrowWidthItem(false));
} }
} }
SetObjectItemSet(aSet); if(bH)
NbcAdjustTextFrameWidthAndHeight(); {
// Set Minimum height.
const long nDist = GetTextUpperDistance() + GetTextLowerDistance();
const long nH = std::max<long>(0, aRect.GetHeight() - 1 - nDist); // text height without margins
aSet.Put(makeSdrTextMinFrameHeightItem(nH));
if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
{
bDisableAutoWidthOnDragging = false;
aSet.Put(makeSdrTextAutoGrowHeightItem(false));
} }
} }
SetObjectItemSet(aSet);
NbcAdjustTextFrameWidthAndHeight();
} }
void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, bool bLineWidth ) const void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, bool bLineWidth ) const
......
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