diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2010-09-17 10:11:31 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-09-17 10:14:53 +0200 |
commit | e479f47f7d48dbd0d701bf347b6a2d5121ba3d34 (patch) | |
tree | 75bb4c012292178482dfab7dd052d9864121e230 /svx/source/sdr | |
parent | 1ea6792208820a5d1920b59ee895336beb994085 (diff) |
fit-list-to-size.diff: Shrink font automatically when text overflows.
i#94086
Scale-font-down if typing text in Impress and the text box becomes too small.
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/attribute/sdrtextattribute.cxx | 14 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrdecompositiontools.cxx | 5 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 49 |
4 files changed, 69 insertions, 2 deletions
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index a28430f127c1..1a7da6c24cdf 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -71,6 +71,7 @@ namespace drawinglayer // bitfield unsigned mbContour : 1; unsigned mbFitToSize : 1; + unsigned mbAutoFit : 1; unsigned mbHideContour : 1; unsigned mbBlink : 1; unsigned mbScroll : 1; @@ -91,6 +92,7 @@ namespace drawinglayer SdrTextVertAdjust aSdrTextVertAdjust, bool bContour, bool bFitToSize, + bool bAutoFit, bool bHideContour, bool bBlink, bool bScroll, @@ -110,6 +112,7 @@ namespace drawinglayer maSdrTextVertAdjust(aSdrTextVertAdjust), mbContour(bContour), mbFitToSize(bFitToSize), + mbAutoFit(bAutoFit), mbHideContour(bHideContour), mbBlink(bBlink), mbScroll(bScroll), @@ -147,6 +150,7 @@ namespace drawinglayer maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP), mbContour(false), mbFitToSize(false), + mbAutoFit(false), mbHideContour(false), mbBlink(false), mbScroll(false), @@ -177,6 +181,7 @@ namespace drawinglayer } bool isContour() const { return mbContour; } bool isFitToSize() const { return mbFitToSize; } + bool isAutoFit() const { return mbAutoFit; } bool isHideContour() const { return mbHideContour; } bool isBlink() const { return mbBlink; } bool isScroll() const { return mbScroll; } @@ -235,6 +240,7 @@ namespace drawinglayer && isContour() == rCandidate.isContour() && isFitToSize() == rCandidate.isFitToSize() + && isAutoFit() == rCandidate.isAutoFit() && isHideContour() == rCandidate.isHideContour() && isBlink() == rCandidate.isBlink() && isScroll() == rCandidate.isScroll() @@ -272,6 +278,7 @@ namespace drawinglayer SdrTextVertAdjust aSdrTextVertAdjust, bool bContour, bool bFitToSize, + bool bAutoFit, bool bHideContour, bool bBlink, bool bScroll, @@ -281,7 +288,7 @@ namespace drawinglayer : mpSdrTextAttribute(new ImpSdrTextAttribute( &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance, aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, - bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) + bFitToSize, bAutoFit, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) { } @@ -369,6 +376,11 @@ namespace drawinglayer return mpSdrTextAttribute->isFitToSize(); } + bool SdrTextAttribute::isAutoFit() const + { + return mpSdrTextAttribute->isAutoFit(); + } + bool SdrTextAttribute::isHideContour() const { return mpSdrTextAttribute->isHideContour(); diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 4ff335a04125..7e008ded3a61 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -544,7 +544,8 @@ namespace drawinglayer rTextObj.GetTextHorizontalAdjust(rSet), rTextObj.GetTextVerticalAdjust(rSet), ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), - (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), + rTextObj.IsFitToSize(), + rTextObj.IsAutoFit(), ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 76e6d81bb252..50bfd3e8b1d7 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -281,6 +281,11 @@ namespace drawinglayer aAnchorTransform, rText.isFixedCellHeight()); } + else if(rText.isAutoFit()) + { + // isotrophically scaled text in range + pNew = new SdrAutoFitTextPrimitive2D(&rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, bWordWrap); + } else // text in range { // build new primitive diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 089f75aa8ade..ac1573f68b8d 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -446,6 +446,55 @@ namespace drawinglayer { namespace primitive2d { + Primitive2DSequence SdrAutoFitTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + { + Primitive2DSequence aRetval; + getSdrText()->GetObject().impDecomposeAutoFitTextPrimitive(aRetval, *this, aViewInformation); + + return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval); + } + + SdrAutoFitTextPrimitive2D::SdrAutoFitTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rParaObj, + const ::basegfx::B2DHomMatrix& rTextRangeTransform, + bool bWordWrap) + : SdrTextPrimitive2D(pSdrText, rParaObj), + maTextRangeTransform(rTextRangeTransform), + mbWordWrap(bWordWrap) + { + } + + bool SdrAutoFitTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(SdrTextPrimitive2D::operator==(rPrimitive)) + { + const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive; + + return (getTextRangeTransform() == rCompare.getTextRangeTransform() + && getWordWrap() == rCompare.getWordWrap()); + } + + return false; + } + + SdrTextPrimitive2D* SdrAutoFitTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const + { + return new SdrAutoFitTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getWordWrap()); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(SdrAutoFitTextPrimitive2D, PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D) + + } // end of namespace primitive2d + } // end of namespace drawinglayer + + ////////////////////////////////////////////////////////////////////////////// + + namespace drawinglayer + { + namespace primitive2d + { Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; |