[Libreoffice-commits] core.git: Branch 'feature/perfwork2' - 5 commits - include/svx svx/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Oct 14 14:51:16 PDT 2014
include/svx/svdotext.hxx | 5 ++
include/svx/svdtrans.hxx | 4 +-
svx/source/svdraw/svdotext.cxx | 78 ++++++++++++++++++++++-------------------
svx/source/svdraw/svdotxtr.cxx | 26 ++++---------
4 files changed, 57 insertions(+), 56 deletions(-)
New commits:
commit e595874c9ae71831bf6306beafa37a430172a618
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 14 17:40:40 2014 -0400
AdoptTextMinSize() calls NbcAdjustTextFrameWidthAndHeight() at the end.
No need to call this again in the caller.
Change-Id: Ib36853cf5a0720082275e0490b4443cd9e0bd007
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index dc533d6..1108817 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -63,11 +63,6 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
// #115391#
AdaptTextMinSize();
- if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize()))
- {
- NbcAdjustTextFrameWidthAndHeight();
- }
-
ImpCheckShear();
SetRectsDirty();
}
@@ -92,11 +87,6 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
// #115391#
AdaptTextMinSize();
- if(bTextFrame)
- {
- NbcAdjustTextFrameWidthAndHeight();
- }
-
SetRectsDirty();
}
commit 261703bc241760ccaf4abf3bac3625f3246de2e9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 14 17:19:56 2014 -0400
Reduce scope level & Annotate the code a bit.
Change-Id: I6ebf849243000920b1c1f7e67d2dc81fcee9e16b
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index bdf85d0..a96efe9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -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
commit 16543faa7035480c37c30b7441981ede0e85e349
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 14 16:29:04 2014 -0400
Remove local variables that are no longer used.
Armin removed their uses in 120e469d176026ceb59abbf74d2ad255323cbc9a.
Change-Id: Id620466929ca3a66dd1c261e81aacd533a44cd76
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index b627d59..dc533d6 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -42,7 +42,9 @@ using namespace com::sun::star;
void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
{
- if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) {
+ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0)
+ {
+ // Either the rotation or shear angle exists.
Rectangle aSR0(GetSnapRect());
long nWdt0=aSR0.Right()-aSR0.Left();
long nHgt0=aSR0.Bottom()-aSR0.Top();
@@ -50,13 +52,11 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
long nHgt1=rRect.Bottom()-rRect.Top();
SdrTextObj::NbcResize(maSnapRect.TopLeft(),boost::rational<long>(nWdt1,nWdt0),boost::rational<long>(nHgt1,nHgt0));
SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
- } else {
- long nHDist=GetTextLeftDistance()+GetTextRightDistance();
- long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
- long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
- long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
- long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
- long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
+ }
+ else
+ {
+ // No rotation or shear.
+
aRect=rRect;
ImpJustifyRect(aRect);
commit fe6c9ea32b07bd91fcae1343872180490593933e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 14 16:14:41 2014 -0400
Method descriptions.
Change-Id: Iece61424e09fc36768889fde2c848ed2b0722701
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 94a032c..42eac31 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -417,10 +417,13 @@ public:
SdrTextVertAdjust GetTextVerticalAdjust(const SfxItemSet& rSet) const;
SdrTextVertAdjust GetTextVerticalAdjust() const;
- // Textrahmenabstaende
+ /** Left inner spacing to borders */
long GetTextLeftDistance() const;
+ /** Right inner spacing to borders */
long GetTextRightDistance() const;
+ /** Top inner spacing to borders */
long GetTextUpperDistance() const;
+ /** Bottom inner spacing to borders */
long GetTextLowerDistance() const;
SdrTextAniKind GetTextAniKind() const;
SdrTextAniDirection GetTextAniDirection() const;
commit 4862b37e69951e81585d738611370455dfe2f874
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 14 15:37:14 2014 -0400
Explain what these are.
Change-Id: Ibb7b830c4216967a5877224c702ad4b3e1fe0b34
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index d29ab1f..4f6f220 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -197,8 +197,8 @@ long GetLen(const Point& rPnt);
class GeoStat { // Geometrischer Status fuer ein Rect
public:
- long nDrehWink;
- long nShearWink;
+ long nDrehWink; /// rotation angle
+ long nShearWink; /// shear angle
double nTan; // tan(nShearWink)
double nSin; // sin(nDrehWink)
double nCos; // cos(nDrehWink)
More information about the Libreoffice-commits
mailing list