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