[ooo-build-commit] patches/dev300

Petr Mladek pmladek at kemper.freedesktop.org
Thu Dec 17 06:56:24 PST 2009


 patches/dev300/apply                    |    7 
 patches/dev300/fit-list-to-size-m7.diff | 1224 ++++++++++++++++++++++++++++++++
 patches/dev300/fit-list-to-size.diff    |    9 
 3 files changed, 1231 insertions(+), 9 deletions(-)

New commits:
commit 0f4f41a1a759d1764762ca3986ee93c87c6a4421
Author: Petr Mladek <pmladek at suse.cz>
Date:   Thu Dec 17 15:54:58 2009 +0100

    Update fit-list-to-size.diff for ooo320-m8
    
    * patches/dev300/fit-list-to-size-m7.diff:
    * patches/dev300/fit-list-to-size.diff:
    * patches/dev300/apply: update for ooo320-m8

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 8c9fa47..9402b03 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2730,10 +2730,17 @@ sd-view-zoom-fix.diff, n#380013, i#88939, thorsten
 
 sd-custom-show-fix.diff, n#355638, i#90145, thorsten
 
+[ Fixes > ooo320-m7 ]
 # have Impress outline text boxes shrink font automatically when text
 # starts to overflow
 fit-list-to-size.diff, i#94086, thorsten
 
+[ Fixes <= ooo320-m7 ]
+# have Impress outline text boxes shrink font automatically when text
+# starts to overflow
+fit-list-to-size-m7.diff, i#94086, thorsten
+
+[ Fixes ]
 fit-list-to-size-style-defaults.diff, i#94086, thorsten
 fit-list-to-size-popup.diff, i#94086, thorsten
 
diff --git a/patches/dev300/fit-list-to-size-m7.diff b/patches/dev300/fit-list-to-size-m7.diff
new file mode 100644
index 0000000..7315c33
--- /dev/null
+++ b/patches/dev300/fit-list-to-size-m7.diff
@@ -0,0 +1,1224 @@
+Auto-fit Impress outliner text to available shape size
+
+From: Thorsten Behrens <thb at openoffice.org>
+
+
+---
+
+ offapi/com/sun/star/drawing/TextFitToSizeType.idl  |    7 +
+ qadevOOo/runner/util/ValueChanger.java             |    2 
+ sd/sdi/_drvwsh.sdi                                 |   12 --
+ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx     |    3 
+ svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx |   41 ++++++
+ .../svx/sdr/primitive2d/svx_primitivetypes2d.hxx   |    1 
+ svx/inc/svx/sdtfsitm.hxx                           |   26 ++--
+ svx/inc/svx/svdotext.hxx                           |   16 ++
+ svx/source/cui/dbregisterednamesconfig.cxx         |    4 -
+ svx/source/cui/textattr.cxx                        |    3 
+ svx/source/editeng/editobj2.hxx                    |   10 +
+ svx/source/editeng/impedit3.cxx                    |   73 ++++++-----
+ svx/source/editeng/impedit4.cxx                    |    6 +
+ svx/source/outliner/outliner.cxx                   |   11 +-
+ svx/source/sdr/attribute/sdrtextattribute.cxx      |    5 +
+ svx/source/sdr/primitive2d/sdrattributecreator.cxx |    5 -
+ .../sdr/primitive2d/sdrdecompositiontools.cxx      |    5 +
+ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx  |   49 +++++++
+ svx/source/svdraw/svdedxv.cxx                      |   10 +
+ svx/source/svdraw/svdfppt.cxx                      |   12 ++
+ svx/source/svdraw/svdotext.cxx                     |  117 +++++++++++++++--
+ svx/source/svdraw/svdotextdecomposition.cxx        |  134 ++++++++++++++++++++
+ svx/source/svdraw/svdotxat.cxx                     |    3 
+ svx/source/svdraw/svdotxed.cxx                     |   17 ++-
+ svx/source/svdraw/svdotxtr.cxx                     |    9 -
+ svx/source/svdraw/svdview.cxx                      |    3 
+ xmloff/source/draw/sdpropls.cxx                    |    4 -
+ 27 files changed, 472 insertions(+), 116 deletions(-)
+
+
+diff --git offapi/com/sun/star/drawing/TextFitToSizeType.idl offapi/com/sun/star/drawing/TextFitToSizeType.idl
+index ddf0809..9fd075d 100644
+--- offapi/com/sun/star/drawing/TextFitToSizeType.idl
++++ offapi/com/sun/star/drawing/TextFitToSizeType.idl
+@@ -63,9 +63,10 @@ published enum TextFitToSizeType
+  
+     //------------------------------------------------------------------------- 
+ 
+-	/** if the shape is scaled, the font attributes are scaled and hard set
+-		on the text */
+-	RESIZEATTR 
++	/** if the shape is scaled, the font is scaled isotrophically to
++		fit the avaiable space. Auto line-breaks will keep working
++   */
++	AUTOFIT 
+  
+ }; 
+  
+diff --git qadevOOo/runner/util/ValueChanger.java qadevOOo/runner/util/ValueChanger.java
+index b0cdebf..3e605ce 100644
+--- qadevOOo/runner/util/ValueChanger.java
++++ qadevOOo/runner/util/ValueChanger.java
+@@ -386,7 +386,7 @@ public class ValueChanger {
+         com.sun.star.drawing.TextFitToSizeType TF1 = com.sun.star.drawing.TextFitToSizeType.ALLLINES;
+         com.sun.star.drawing.TextFitToSizeType TF2 = com.sun.star.drawing.TextFitToSizeType.NONE;
+         com.sun.star.drawing.TextFitToSizeType TF3 = com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL;
+-        com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.RESIZEATTR;
++        com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.AUTOFIT;
+         if (oldValue.equals(TF1)) newValue = TF2;
+         if (oldValue.equals(TF2)) newValue = TF3;
+         if (oldValue.equals(TF3)) newValue = TF4;
+diff --git sd/sdi/_drvwsh.sdi sd/sdi/_drvwsh.sdi
+index 27f7a05..a71ac04 100644
+--- sd/sdi/_drvwsh.sdi
++++ sd/sdi/_drvwsh.sdi
+@@ -28,18 +28,6 @@
+  *
+  ************************************************************************/
+ 
+-enum SdrFitToSizeType
+-{
+-    SDRTEXTFIT_NONE ,
+-    SDRTEXTFIT_PROPORTIONAL ,
+-    SDRTEXTFIT_ALLLINES ,
+-    SDRTEXTFIT_RESIZEATTR
+-}
+-item UINT32 SvxObjectItem ;
+-item BOOL SdrShadowItem ;
+-item SdrFitToSizeType SdrTextFitToSizeTypeItem ;
+-
+-
+ interface DrawView
+ {
+     SID_JUMPTOMARK // ole : no, status : ?
+diff --git svx/inc/svx/sdr/attribute/sdrtextattribute.hxx svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+index aaba362..3deab0e 100644
+--- svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+@@ -76,6 +76,7 @@ namespace drawinglayer
+             // bitfield
+             unsigned								mbContour : 1;
+             unsigned								mbFitToSize : 1;
++			unsigned								mbAutoFit : 1;
+             unsigned								mbHideContour : 1;
+             unsigned								mbBlink : 1;
+             unsigned								mbScroll : 1;
+@@ -95,6 +96,7 @@ namespace drawinglayer
+                 SdrTextVertAdjust aSdrTextVertAdjust,
+                 bool bContour, 
+                 bool bFitToSize, 
++                bool bAutoFit,
+                 bool bHideContour, 
+                 bool bBlink, 
+                 bool bScroll,
+@@ -114,6 +116,7 @@ namespace drawinglayer
+             const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
+             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; }
+diff --git svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+index b9f2751..842e70f 100644
+--- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
++++ svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+@@ -304,6 +304,47 @@ namespace drawinglayer
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ 
++namespace drawinglayer
++{
++	namespace primitive2d
++	{
++		class SdrAutoFitTextPrimitive2D : public SdrTextPrimitive2D
++		{
++		private:
++			::basegfx::B2DHomMatrix					maTextRangeTransform;	// text range transformation from unit range ([0.0 .. 1.0]) to text range
++
++			// bitfield
++            unsigned                                mbWordWrap : 1;         // for CustomShapes text layout
++
++		protected:
++			// local decomposition.
++			virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
++
++		public:
++			SdrAutoFitTextPrimitive2D(
++				const SdrText* pSdrText,
++                const OutlinerParaObject& rOutlinerParaObjectPtr,
++				const ::basegfx::B2DHomMatrix& rTextRangeTransform,
++                bool bWordWrap);
++
++			// get data
++			const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
++			bool getWordWrap() const { return mbWordWrap; }
++
++			// compare operator
++			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
++
++			// transformed clone operator
++			virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
++
++			// provide unique ID
++			DeclPrimitrive2DIDBlock()
++		};
++	} // end of namespace primitive2d
++} // end of namespace drawinglayer
++
++//////////////////////////////////////////////////////////////////////////////
++
+ #endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
+ 
+ // eof
+diff --git svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+index 70dc15c..d95eec6 100644
+--- svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
++++ svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+@@ -59,6 +59,7 @@
+ #define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20)
+ #define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D            (PRIMITIVE2D_ID_RANGE_SVX| 21)
+ #define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D         (PRIMITIVE2D_ID_RANGE_SVX| 22)
++#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D		(PRIMITIVE2D_ID_RANGE_SVX| 23)
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ 
+diff --git svx/inc/svx/sdtfsitm.hxx svx/inc/svx/sdtfsitm.hxx
+index 4b00f89..8674686 100644
+--- svx/inc/svx/sdtfsitm.hxx
++++ svx/inc/svx/sdtfsitm.hxx
+@@ -34,19 +34,21 @@
+ #include <svx/svddef.hxx>
+ #include "svx/svxdllapi.h"
+ 
+-enum SdrFitToSizeType {SDRTEXTFIT_NONE,         // - kein FitToSize
+-					   SDRTEXTFIT_PROPORTIONAL, // - Alle Buchstaben proportional umgroessern
+-					   SDRTEXTFIT_ALLLINES,     // - Zus. jede Zeile separat in der Breite stretchen
+-					   SDRTEXTFIT_RESIZEATTR};  // - Bei Rahmenumgroesserung (ausser Autogrow) wird
+-												//   die Schriftgroesse umattributiert (hart)
++enum SdrFitToSizeType {
++    SDRTEXTFIT_NONE,         // - no fit-to-size
++    SDRTEXTFIT_PROPORTIONAL, // - resize all glyhs proportionally
++                             //   (might scale anisotrophically)
++    SDRTEXTFIT_ALLLINES,     // - like SDRTEXTFIT_PROPORTIONAL, but
++                             //   scales each line separately
++    SDRTEXTFIT_AUTOFIT};     // - mimics PPT's automatic adaption of
++                             //   font size to text rect - comparable
++                             //   to SDRTEXTFIT_PROPORTIONAL, but
++                             //   scales isotrophically
+ 
+-// Bei SDRTEXTFIT_PROPORTIONAL und SDRTEXTFIT_ALLLINES gibt es kein AutoGrow und
+-// keine automatischen Umbrueche.
+-// Ist SDRTEXTFIT_RESIZEATTR gesetzt, so wird beim umgroessern des Textrahmens
+-// (ausser bei AutoGrow) die Schrift durch harte Attributierung ebenfalls
+-// umgegroessert.
+-// Bei AutoGrowingWidth gibt es ebenfalls keine automatischen Umbrueche (erst bei
+-// TextMaxFrameWidth).
++// No AutoGrow and no automatic line breaks for
++// SDRTEXTFIT_PROPORTIONAL and SDRTEXTFIT_ALLLINES.
++// No automatic line breaks for AutoGrowingWidth as well (only if
++// TextMaxFrameWidth is reached).
+ 
+ //--------------------------------
+ // class SdrTextFitToSizeTypeItem
+diff --git svx/inc/svx/svdotext.hxx svx/inc/svx/svdotext.hxx
+index 4744351..43cb6e7 100644
+--- svx/inc/svx/svdotext.hxx
++++ svx/inc/svx/svdotext.hxx
+@@ -62,6 +62,7 @@ namespace drawinglayer { namespace primitive2d {
+     class SdrContourTextPrimitive2D;
+     class SdrPathTextPrimitive2D;
+     class SdrBlockTextPrimitive2D;
++	class SdrAutoFitTextPrimitive2D;
+     class SdrStretchTextPrimitive2D;
+ }}
+ 
+@@ -259,6 +260,9 @@ protected:
+     // Flag for allowing text animation. Default is sal_true.
+     BOOL						mbTextAnimationAllowed : 1;
+ 
++    // flag for preventing recursive onEditOutlinerStatusEvent calls
++	BOOL					    mbInDownScale : 1;
++
+     SdrOutliner& ImpGetDrawOutliner() const;
+ 
+ private:
+@@ -272,6 +276,8 @@ private:
+                                        Rectangle& 		rAnchorRect, 
+                                        Rectangle& 		rPaintRect, 
+                                        Fraction& 		aFitXKorreg ) const;
++    void ImpAutoFitText( SdrOutliner& rOutliner ) const;
++    static void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting );
+     SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
+     SVX_DLLPRIVATE void ImpLinkAnmeldung();
+     SVX_DLLPRIVATE void ImpLinkAbmeldung();
+@@ -283,7 +289,7 @@ protected:
+     SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const;
+     SdrObject* ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const;
+     void ImpSetTextStyleSheetListeners();
+-	void ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const;
++    void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const;
+     void ImpJustifyRect(Rectangle& rRect) const;
+     void ImpCheckShear();
+     Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+@@ -345,6 +351,10 @@ public:
+     void NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact);
+     FASTBOOL IsTextFrame() const { return bTextFrame; }
+     FASTBOOL IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); }
++    /// returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false!
++	FASTBOOL IsAutoFit() const;
++    /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
++	FASTBOOL IsFitToSize() const;
+     SdrObjKind GetTextKind() const { return eTextKind; }
+ 
+     virtual bool HasText() const;
+@@ -587,6 +597,10 @@ public:
+         drawinglayer::primitive2d::Primitive2DSequence& rTarget, 
+         const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+         const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
++	void impDecomposeAutoFitTextPrimitive(
++		drawinglayer::primitive2d::Primitive2DSequence& rTarget, 
++		const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
++		const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+     void impDecomposeStretchTextPrimitive(
+         drawinglayer::primitive2d::Primitive2DSequence& rTarget, 
+         const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
+diff --git svx/source/cui/dbregisterednamesconfig.cxx svx/source/cui/dbregisterednamesconfig.cxx
+index d3646b7..c31448a 100644
+--- svx/source/cui/dbregisterednamesconfig.cxx
++++ svx/source/cui/dbregisterednamesconfig.cxx
+@@ -163,7 +163,7 @@ namespace svx
+                     }
+                     catch( const Exception& )
+                     {
+-                    	DBG_UNHANDLED_EXCEPTION();
++                    	//DBG_UNHANDLED_EXCEPTION();
+                     }
+                 }
+             }
+@@ -184,7 +184,7 @@ namespace svx
+                     }
+                     catch( const Exception& )
+                     {
+-                    	DBG_UNHANDLED_EXCEPTION();
++                    	//DBG_UNHANDLED_EXCEPTION();
+                     }
+                 }
+             }
+diff --git svx/source/cui/textattr.cxx svx/source/cui/textattr.cxx
+index 0631465..9c97499 100644
+--- svx/source/cui/textattr.cxx
++++ svx/source/cui/textattr.cxx
+@@ -460,8 +460,7 @@ BOOL SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs)
+             default: ; //prevent warning
+                 DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
+             case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break;
+-			//case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break;
+-			case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break;
++			case STATE_CHECK: eFTS = SDRTEXTFIT_AUTOFIT; break;
+         }
+         rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) );
+     }
+diff --git svx/source/editeng/editobj2.hxx svx/source/editeng/editobj2.hxx
+index 9419b92..66b1937 100644
+--- svx/source/editeng/editobj2.hxx
++++ svx/source/editeng/editobj2.hxx
+@@ -115,12 +115,16 @@ class XParaPortionList : public  XBaseParaPortionList
+     ULONG 		nRefDevPtr;
+     OutDevType	eRefDevType;
+     MapMode		aRefMapMode;
++	sal_uInt16	nStretchX;
++	sal_uInt16	nStretchY;
+     ULONG		nPaperWidth;
+ 
+ 
+ public:
+-			XParaPortionList( OutputDevice* pRefDev, ULONG nPW ) :
+-				aRefMapMode( pRefDev->GetMapMode() )
++    XParaPortionList( OutputDevice* pRefDev, ULONG nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY ) :
++        aRefMapMode( pRefDev->GetMapMode() ),
++        nStretchX(_nStretchX),
++        nStretchY(_nStretchY)
+                 {
+                     nRefDevPtr = (ULONG)pRefDev; nPaperWidth = nPW;
+                     eRefDevType = pRefDev->GetOutDevType();
+@@ -130,6 +134,8 @@ public:
+     ULONG			GetPaperWidth() const 		{ return nPaperWidth; }
+     OutDevType		GetRefDevType() const 		{ return eRefDevType; }
+     const MapMode&	GetRefMapMode() const		{ return aRefMapMode; }
++	sal_uInt16	GetStretchX() const         { return nStretchX; }
++	sal_uInt16	GetStretchY() const         { return nStretchY; }
+ };
+ 
+ /* cl removed because not needed anymore since binfilter
+diff --git svx/source/editeng/impedit3.cxx svx/source/editeng/impedit3.cxx
+index 39879b1..435721d 100644
+--- svx/source/editeng/impedit3.cxx
++++ svx/source/editeng/impedit3.cxx
+@@ -2677,38 +2677,46 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF
+                 aRealSz.Height() /= 100;
+             }
+             if ( nStretchX != 100 )
+-			{
+-				aRealSz.Width() *= nStretchX;
+-				aRealSz.Width() /= 100;
++            {
++                if ( nStretchX == nStretchY &&
++                     nRelWidth == 100 )
++                {
++                    aRealSz.Width() = 0;
++                }
++                else
++                {
++                    aRealSz.Width() *= nStretchX;
++                    aRealSz.Width() /= 100;
+ 
+-				// Auch das Kerning: (long wegen Zwischenergebnis)
+-				long nKerning = rFont.GetFixKerning();
++                    // Auch das Kerning: (long wegen Zwischenergebnis)
++                    long nKerning = rFont.GetFixKerning();
+ /*
+-				Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200
+-				=> Nicht das Kerning verdoppelt, also die Buchstaben weiter
+-				zusammenziehen
+-				---------------------------
+-				Kern	StretchX	=>Kern
+-				---------------------------
+-				 >0		<100		< (Proportional)
+-				 <0		<100		< (Proportional)
+-				 >0		>100		> (Proportional)
+-				 <0		>100		< (Der Betrag, also Antiprop)
++  Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200
++  => Nicht das Kerning verdoppelt, also die Buchstaben weiter
++  zusammenziehen
++  ---------------------------
++  Kern	StretchX	=>Kern
++  ---------------------------
++  >0		<100		< (Proportional)
++  <0		<100		< (Proportional)
++  >0		>100		> (Proportional)
++  <0		>100		< (Der Betrag, also Antiprop)
+ */
+-				if ( ( nKerning < 0  ) && ( nStretchX > 100 ) )
+-				{
+-					// Antiproportional
+-					nKerning *= 100;
+-					nKerning /= nStretchX;
+-				}
+-				else if ( nKerning )
+-				{
+-					// Proportional
+-					nKerning *= nStretchX;
+-					nKerning /= 100;
+-				}
+-				rFont.SetFixKerning( (short)nKerning );
+-			}
++                    if ( ( nKerning < 0  ) && ( nStretchX > 100 ) )
++                    {
++                        // Antiproportional
++                        nKerning *= 100;
++                        nKerning /= nStretchX;
++                    }
++                    else if ( nKerning )
++                    {
++                        // Proportional
++                        nKerning *= nStretchX;
++                        nKerning /= 100;
++                    }
++                    rFont.SetFixKerning( (short)nKerning );
++                }
++            }
+         }
+         if ( nRelWidth != 100 )
+         {
+@@ -4097,20 +4105,25 @@ void ImpEditEngine::SetFlatMode( sal_Bool bFlat )
+ 
+ void ImpEditEngine::SetCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+ {
++    bool bChanged(false);
+     if ( !IsVertical() )
+     {
++        bChanged = nStretchX!=nX || nStretchY!=nY;
+         nStretchX = nX;
+         nStretchY = nY;
+     }
+     else
+     {
++        bChanged = nStretchX!=nY || nStretchY!=nX;
+         nStretchX = nY;
+         nStretchY = nX;
+     }
+ 
+-	if ( aStatus.DoStretch() )
++	if (bChanged && aStatus.DoStretch())
+     {
+         FormatFullDoc();
++        // (potentially) need everything redrawn
++        aInvalidRec=Rectangle(0,0,1000000,1000000);
+         UpdateViews( GetActiveView() );
+     }
+ }
+diff --git svx/source/editeng/impedit4.cxx svx/source/editeng/impedit4.cxx
+index 6df4518..9138cd1 100644
+--- svx/source/editeng/impedit4.cxx
++++ svx/source/editeng/impedit4.cxx
+@@ -1169,7 +1169,7 @@ EditTextObject*	ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
+     // Schwelle rauf setzen, wenn Olli die Absaetze nicht mehr zerhackt!
+     if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && GetUpdateMode() && ( nTextPortions >= nBigObjectStart ) )
+     {
+-		XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width() );
++		XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY );
+         pTxtObj->SetPortionInfo( pXList );
+         for ( nNode = nStartNode; nNode <= nEndNode; nNode++  )
+         {
+@@ -1260,7 +1260,9 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
+     XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo();
+ 
+     if ( pPortionInfo && ( (long)pPortionInfo->GetPaperWidth() == aPaperSize.Width() )
+-			&& ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) )
++         && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) 
++         && ( pPortionInfo->GetStretchX() == nStretchX )
++         && ( pPortionInfo->GetStretchY() == nStretchY ) )
+     {
+         if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) ||
+              ( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
+diff --git svx/source/outliner/outliner.cxx svx/source/outliner/outliner.cxx
+index 3a9a55b..f739176 100644
+--- svx/source/outliner/outliner.cxx
++++ svx/source/outliner/outliner.cxx
+@@ -922,7 +922,10 @@ Font Outliner::ImpCalcBulletFont( USHORT nPara ) const
+     }
+ 
+     // #107508# Use original scale...
+-	USHORT nScale = /* pEditEngine->IsFlatMode() ? DEFAULT_SCALE : */ pFmt->GetBulletRelSize();
++    USHORT nStretchX, nStretchY;
++    const_cast<Outliner*>(this)->GetGlobalCharStretching(nStretchX, nStretchY);
++    
++	USHORT nScale = pFmt->GetBulletRelSize() * nStretchY / 100;
+     ULONG nScaledLineHeight = aStdFont.GetSize().Height();
+     nScaledLineHeight *= nScale*10;
+     nScaledLineHeight /= 1000;
+@@ -965,6 +968,12 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos,
+         BOOL bRightToLeftPara = pEditEngine->IsRightToLeft( nPara );
+ 
+         Rectangle aBulletArea( ImpCalcBulletArea( nPara, TRUE, FALSE ) );
++        USHORT nStretchX, nStretchY;
++        GetGlobalCharStretching(nStretchX, nStretchY);
++        aBulletArea = Rectangle( Point(aBulletArea.Left()*nStretchX/100,
++                                       aBulletArea.Top()),
++                                 Size(aBulletArea.GetWidth()*nStretchX/100,
++                                      aBulletArea.GetHeight()) );
+ 
+         Paragraph* pPara = pParaList->GetParagraph( nPara );
+         const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
+diff --git svx/source/sdr/attribute/sdrtextattribute.cxx svx/source/sdr/attribute/sdrtextattribute.cxx
+index 244946e..efd4e7f 100644
+--- svx/source/sdr/attribute/sdrtextattribute.cxx
++++ svx/source/sdr/attribute/sdrtextattribute.cxx
+@@ -61,6 +61,7 @@ namespace drawinglayer
+             SdrTextVertAdjust aSdrTextVertAdjust,
+             bool bContour, 
+             bool bFitToSize, 
++			bool bAutoFit, 
+             bool bHideContour, 
+             bool bBlink, 
+             bool bScroll,
+@@ -78,6 +79,7 @@ namespace drawinglayer
+             maSdrTextVertAdjust(aSdrTextVertAdjust),
+             mbContour(bContour),
+             mbFitToSize(bFitToSize),
++			mbAutoFit(bAutoFit),
+             mbHideContour(bHideContour),
+             mbBlink(bBlink),
+             mbScroll(bScroll),
+@@ -119,6 +121,7 @@ namespace drawinglayer
+             maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()),
+             mbContour(rCandidate.isContour()),
+             mbFitToSize(rCandidate.isFitToSize()),
++			mbAutoFit(rCandidate.mbAutoFit),
+             mbHideContour(rCandidate.isHideContour()),
+             mbBlink(rCandidate.isBlink()),
+             mbScroll(rCandidate.isScroll()),
+@@ -159,6 +162,7 @@ namespace drawinglayer
+ 
+             mbContour = rCandidate.isContour();
+             mbFitToSize = rCandidate.isFitToSize();
++			mbAutoFit = rCandidate.isAutoFit();
+             mbHideContour = rCandidate.isHideContour();
+             mbBlink = rCandidate.isBlink();
+             mbScroll = rCandidate.isScroll();
+@@ -193,6 +197,7 @@ namespace drawinglayer
+ 
+                 && isContour() == rCandidate.isContour()
+                 && isFitToSize() == rCandidate.isFitToSize()
++				&& isAutoFit() == rCandidate.isAutoFit()
+                 && isHideContour() == rCandidate.isHideContour()
+                 && isBlink() == rCandidate.isBlink()
+                 && isScroll() == rCandidate.isScroll()
+diff --git svx/source/sdr/primitive2d/sdrattributecreator.cxx svx/source/sdr/primitive2d/sdrattributecreator.cxx
+index 0fad6dd..617c676 100644
+--- svx/source/sdr/primitive2d/sdrattributecreator.cxx
++++ svx/source/sdr/primitive2d/sdrattributecreator.cxx
+@@ -534,7 +534,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,
+@@ -556,7 +557,7 @@ namespace drawinglayer
+                 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+                 const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
+                 const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
+-				const bool bCompletelyTransparent(0xff == nStartLuminance == nEndLuminance);
++				const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+ 
+                 if(!bCompletelyTransparent)
+                 {
+diff --git svx/source/sdr/primitive2d/sdrdecompositiontools.cxx svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+index 6204eba..925d37a 100644
+--- svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
++++ svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+@@ -286,6 +286,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 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+index bd8547c..d96e835 100644
+--- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
++++ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+@@ -442,6 +442,55 @@ namespace drawinglayer
+ {
+     namespace primitive2d
+     {
++		Primitive2DSequence SdrAutoFitTextPrimitive2D::createLocalDecomposition(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::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+         {
+             Primitive2DSequence aRetval;
+diff --git svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdedxv.cxx
+index c9f870b..f6c15b0 100644
+--- svx/source/svdraw/svdedxv.cxx
++++ svx/source/svdraw/svdedxv.cxx
+@@ -315,7 +315,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang
+     {
+         const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
+         bool bTextFrame(pText && pText->IsTextFrame());
+-		bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
++		bool bFitToSize(pText && pText->IsFitToSize());
+         bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
+         Rectangle aBlankRect(rOutlView.GetOutputArea());
+         aBlankRect.Union(aMinTextEditArea);
+@@ -384,7 +384,7 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
+     {
+         const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
+         bool bTextFrame(pText && pText->IsTextFrame());
+-		bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
++		bool bFitToSize(pText && pText->IsFitToSize());
+ 
+         if(bTextFrame && !bFitToSize) 
+         {
+@@ -650,8 +650,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit(
+             if ( !pTextObj->IsContourTextFrame() )
+             {
+                 // FitToSize erstmal nicht mit ContourFrame
+-        		SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+-        		if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
++        		if (pTextObj->IsFitToSize())
+                     aTextRect = aAnchorRect;
+             }
+ 
+@@ -719,8 +718,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit(
+                 // #71519#
+                 if(!bExtraInvalidate)
+                 {
+-        			SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+-					if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES)
++					if(pTextObj->IsFitToSize())
+                         bExtraInvalidate = sal_True;
+                 }
+ 
+diff --git svx/source/svdraw/svdfppt.cxx svx/source/svdraw/svdfppt.cxx
+index 8535262..380677c 100644
+--- svx/source/svdraw/svdfppt.cxx
++++ svx/source/svdraw/svdfppt.cxx
+@@ -1119,6 +1119,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+                 }
+                 aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance );
+ 
++                bool bAutoFit = false; // auto-scale text into shape box
+                 switch ( aTextObj.GetInstance() )
+                 {
+                     case TSS_TYPE_PAGETITLE :
+@@ -1126,7 +1127,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+                     case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break;
+                     case TSS_TYPE_BODY :
+                     case TSS_TYPE_HALFBODY :
+-					case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; break;
++					case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break;
+                 }
+                 if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE )
+                 {
+@@ -1181,6 +1182,15 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+                 }
+                 pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+ 
++                if (bAutoFit)
++                {
++                    // disable both, defeats purpose of autofit
++                    // otherwise
++                    bAutoGrowHeight = sal_False;
++                    bAutoGrowWidth = sal_False;
++                    pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
++                }
++
+             if ( !pTObj->ISA( SdrObjCustomShape ) )
+             {
+                  pTObj->SetMergedItem( SdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
+diff --git svx/source/svdraw/svdotext.cxx svx/source/svdraw/svdotext.cxx
+index 368ef8f..f92dba5 100644
+--- svx/source/svdraw/svdotext.cxx
++++ svx/source/svdraw/svdotext.cxx
+@@ -144,6 +144,7 @@ SdrTextObj::SdrTextObj()
+ 
+     // #i25616#
+     mbSupportTextIndentingOnLineWidthChange = sal_True;
++    mbInDownScale = sal_False;
+ }
+ 
+ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+@@ -169,6 +170,7 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+ 
+     // #111096#
+     mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+     // #108784#
+     maTextEditOffset = Point(0, 0);
+@@ -199,6 +201,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
+ 
+     // #111096#
+     mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+     // #108784#
+     maTextEditOffset = Point(0, 0);
+@@ -231,6 +234,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
+ 
+     // #111096#
+     mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+     // #108784#
+     maTextEditOffset = Point(0, 0);
+@@ -265,6 +269,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStr
+ 
+     // #111096#
+     mbTextAnimationAllowed = sal_True;
++    mbInDownScale = sal_False;
+ 
+     // #108784#
+     maTextEditOffset = Point(0, 0);
+@@ -841,8 +846,7 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS
+     SdrTextAniKind      eAniKind=GetTextAniKind();
+     SdrTextAniDirection eAniDirection=GetTextAniDirection();
+ 
+-	SdrFitToSizeType eFit=GetFitToSize();
+-	FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++    FASTBOOL bFitToSize(IsFitToSize());
+     FASTBOOL bContourFrame=IsContourTextFrame();
+ 
+     FASTBOOL bFrame=IsTextFrame();
+@@ -1003,7 +1007,7 @@ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
+     return pPara;
+ }
+ 
+-void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const
++void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const
+ {
+     OutputDevice* pOut = rOutliner.GetRefDevice();
+     BOOL bNoStretching(FALSE);
+@@ -1048,12 +1052,12 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& r
+     unsigned nLoopCount=0;
+     FASTBOOL bNoMoreLoop=FALSE;
+     long nXDiff0=0x7FFFFFFF;
+-	long nWantWdt=rAnchorRect.Right()-rAnchorRect.Left();
+-	long nIsWdt=rTextRect.Right()-rTextRect.Left();
++	long nWantWdt=rShapeSize.Width();
++	long nIsWdt=rTextSize.Width();
+     if (nIsWdt==0) nIsWdt=1;
+ 
+-	long nWantHgt=rAnchorRect.Bottom()-rAnchorRect.Top();
+-	long nIsHgt=rTextRect.Bottom()-rTextRect.Top();
++	long nWantHgt=rShapeSize.Height();
++	long nIsHgt=rTextSize.Height();
+     if (nIsHgt==0) nIsHgt=1;
+ 
+     long nXTolPl=nWantWdt/100; // Toleranz +1%
+@@ -1281,8 +1285,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
+         Rectangle aR;
+         TakeTextRect(rOutliner,aR,FALSE,&aAnchor2);
+         rOutliner.Clear();
+-		SdrFitToSizeType eFit=GetFitToSize();
+-		FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++        FASTBOOL bFitToSize(IsFitToSize());
+         if (bFitToSize) aR=aAnchor2;
+         Polygon aPol(aR);
+         if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
+@@ -1399,8 +1402,7 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL 		bContourFrame,
+     if (!bContourFrame)
+     {
+         // FitToSize erstmal nicht mit ContourFrame
+-        SdrFitToSizeType eFit=GetFitToSize();
+-        if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
++        if (IsFitToSize() || IsAutoFit())
+         {
+             ULONG nStat=rOutliner.GetControlWord();
+             nStat|=EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE;
+@@ -1414,13 +1416,73 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL 		bContourFrame,
+     if (!bContourFrame)
+     {
+         // FitToSize erstmal nicht mit ContourFrame
+-        SdrFitToSizeType eFit=GetFitToSize();
+-        if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
++        if (IsFitToSize())
+         {
+-            ImpSetCharStretching(rOutliner,rTextRect,rAnchorRect,rFitXKorreg);
++            ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXKorreg);
+             rPaintRect=rAnchorRect;
+         }
++        else if (IsAutoFit())
++        {
++            ImpAutoFitText(rOutliner);
++        }
++    }
++}
++
++void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
++{
++    const Size aShapeSize=GetSnapRect().GetSize();
++    ImpAutoFitText( rOutliner, 
++                    Size(aShapeSize.Width()-GetTextLeftDistance()-GetTextRightDistance(),
++                         aShapeSize.Height()-GetTextUpperDistance()-GetTextLowerDistance()), 
++                    IsVerticalWriting() );
++}
++
++void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting )
++{
++    // EditEngine formatting is unstable enough for
++    // line-breaking text that we need some more samples
++
++    // loop early-exits if we detect an already attained value
++    USHORT nMinStretchX=0, nMinStretchY=0;
++    USHORT aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
++    const size_t aStretchArySize=sizeof(aOldStretchXVals)/sizeof(*aOldStretchXVals);
++    for(int i=0; i<aStretchArySize; ++i)
++    {
++        const Size aCurrTextSize = rOutliner.CalcTextSize();
++        double fFactor(1.0);
++        if( bIsVerticalWriting )
++            fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
++        else
++            fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
++
++        USHORT nCurrStretchX, nCurrStretchY;
++        rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
++
++        if (fFactor >= 1.0 )
++        {
++            // resulting text area fits into available shape rect -
++            // err on the larger streching, to optimally fill area
++            nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
++            nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
++        }
++
++        aOldStretchXVals[i] = nCurrStretchX;
++        if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
++            break; // same value already attained once; algo is looping, exit
++
++        if (fFactor < 1.0 || (fFactor >= 1.0 && nCurrStretchX != 100))
++        {
++            nCurrStretchX = sal::static_int_cast<USHORT>(nCurrStretchX*fFactor);
++            nCurrStretchY = sal::static_int_cast<USHORT>(nCurrStretchY*fFactor);
++            rOutliner.SetGlobalCharStretching(std::min(USHORT(100),nCurrStretchX),
++                                              std::min(USHORT(100),nCurrStretchY));
++            OSL_TRACE("SdrTextObj::onEditOutlinerStatusEvent(): zoom is %d", nCurrStretchX);
++        }
+     }
++
++    OSL_TRACE("---- SdrTextObj::onEditOutlinerStatusEvent(): final zoom is %d ----", nMinStretchX);
++    rOutliner.SetGlobalCharStretching(std::min(USHORT(100),nMinStretchX),
++                                      std::min(USHORT(100),nMinStretchY));
+ }
+ 
+ void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const
+@@ -2018,6 +2080,17 @@ bool SdrTextObj::IsTextAnimationAllowed() const
+     return mbTextAnimationAllowed;
+ }
+ 
++FASTBOOL SdrTextObj::IsAutoFit() const
++{
++    return GetFitToSize()==SDRTEXTFIT_AUTOFIT;
++}
++
++FASTBOOL SdrTextObj::IsFitToSize() const
++{
++    const SdrFitToSizeType eFit=GetFitToSize();
++    return (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++}
++
+ void SdrTextObj::SetTextAnimationAllowed(sal_Bool bNew)
+ {
+     if(mbTextAnimationAllowed != bNew)
+@@ -2035,13 +2108,21 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
+     const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0;
+     if(bTextFrame && (bGrowX || bGrowY))
+     {
+-		const bool bAutoGrowHgt= bTextFrame && IsAutoGrowHeight();
+-		const bool bAutoGrowWdt= bTextFrame && IsAutoGrowWidth();
+-
+-	    if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
++	    if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
+         {
+             AdjustTextFrameWidthAndHeight();
+         }
++        else if (IsAutoFit() && !mbInDownScale)
++        {
++            OSL_ASSERT(pEdtOutl);
++            mbInDownScale = sal_True;
++
++            // sucks that we cannot disable paints via
++            // pEdtOutl->SetUpdateMode(FALSE) - but EditEngine skips
++            // formatting as well, then.
++            ImpAutoFitText(*pEdtOutl);
++            mbInDownScale = sal_False;
++        }
+     }
+ }
+ 
+diff --git svx/source/svdraw/svdotextdecomposition.cxx svx/source/svdraw/svdotextdecomposition.cxx
+index de1f8dd..7142351 100644
+--- svx/source/svdraw/svdotextdecomposition.cxx
++++ svx/source/svdraw/svdotextdecomposition.cxx
+@@ -765,6 +765,140 @@ void SdrTextObj::impDecomposeContourTextPrimitive(
+     rTarget = aConverter.getPrimitive2DSequence();
+ }
+ 
++void SdrTextObj::impDecomposeAutoFitTextPrimitive(
++	drawinglayer::primitive2d::Primitive2DSequence& rTarget, 
++	const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
++	const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
++{
++    // decompose matrix to have position and size of text
++	basegfx::B2DVector aScale, aTranslate;
++	double fRotate, fShearX;
++	rSdrAutofitTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
++
++	// use B2DRange aAnchorTextRange for calculations
++	basegfx::B2DRange aAnchorTextRange(aTranslate);
++	aAnchorTextRange.expand(aTranslate + aScale);
++
++	// prepare outliner
++	const SfxItemSet& rTextItemSet = rSdrAutofitTextPrimitive.getSdrText()->GetItemSet();
++	SdrOutliner& rOutliner = ImpGetDrawOutliner();
++	SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet);
++	SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet);
++	const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
++	const Size aNullSize;
++
++	// set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
++	rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
++
++	rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE|EE_CNTRL_STRETCHING);
++	rOutliner.SetMinAutoPaperSize(aNullSize);
++	rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
++
++	// add one to rage sizes to get back to the old Rectangle and outliner measurements
++	const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
++	const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
++	const OutlinerParaObject* pOutlinerParaObject = rSdrAutofitTextPrimitive.getSdrText()->GetOutlinerParaObject();
++	OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)");
++	const bool bVerticalWritintg(pOutlinerParaObject->IsVertical());
++	const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
++
++    if((rSdrAutofitTextPrimitive.getWordWrap() || IsTextFrame()))
++    {
++        rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
++    }
++
++    if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
++    {
++        rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
++    }
++
++    if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
++    {
++        rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
++    }
++
++    rOutliner.SetPaperSize(aNullSize);
++    rOutliner.SetUpdateMode(true);
++    rOutliner.SetText(*pOutlinerParaObject);
++    ImpAutoFitText(rOutliner,aAnchorTextSize,bVerticalWritintg);
++
++    // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
++    rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
++
++	// now get back the layouted text size from outliner
++	const Size aOutlinerTextSiz(rOutliner.GetPaperSize());
++	const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height());
++	basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
++
++	// correct horizontal translation using the now known text size
++	if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
++	{
++		const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
++
++		if(SDRTEXTHORZADJUST_CENTER == eHAdj)
++		{
++			aAdjustTranslate.setX(fFree / 2.0);
++		}
++
++		if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
++		{
++			aAdjustTranslate.setX(fFree);
++		}
++	}
++
++	// correct vertical translation using the now known text size
++	if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
++	{
++		const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
++
++		if(SDRTEXTVERTADJUST_CENTER == eVAdj)
++		{
++			aAdjustTranslate.setY(fFree / 2.0);
++		}
++		
++		if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
++		{
++			aAdjustTranslate.setY(fFree);
++		}
++	}
++
++	// prepare matrices to apply to newly created primitives. aNewTransformA
++	// will get coordinates in aOutlinerScale size and positive in X, Y.
++	basegfx::B2DHomMatrix aNewTransformA;
++	basegfx::B2DHomMatrix aNewTransformB;
++
++	// translate relative to given primitive to get same rotation and shear
++	// as the master shape we are working on. For vertical, use the top-right
++	// corner
++	const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
++	aNewTransformA.translate(fStartInX, aAdjustTranslate.getY());
++
++	// mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
++	// move the null point which was top left to bottom right.
++	const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
++	const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
++	aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
++
++	// in-between the translations of the single primitives will take place. Afterwards,
++	// the object's transformations need to be applied
++	aNewTransformB.shearX(fShearX);
++	aNewTransformB.rotate(fRotate);
++	aNewTransformB.translate(aTranslate.getX(), aTranslate.getY());
++
++	basegfx::B2DRange aClipRange;
++
++	// now break up text primitives.
++	impTextBreakupHandler aConverter(rOutliner);
++	aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB, aClipRange);
++
++	// cleanup outliner
++	rOutliner.Clear();
++	rOutliner.setVisualizedPage(0);
++    rOutliner.SetControlWord(nOriginalControlWord);
++
++	rTarget = aConverter.getPrimitive2DSequence();
++}
++
+ void SdrTextObj::impDecomposeBlockTextPrimitive(
+     drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+     const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+diff --git svx/source/svdraw/svdotxat.cxx svx/source/svdraw/svdotxat.cxx
+index c7c9b5f..b5f48d7 100644
+--- svx/source/svdraw/svdotxat.cxx
++++ svx/source/svdraw/svdotxat.cxx
+@@ -82,8 +82,7 @@ FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt,
+ {
+     if (bTextFrame && pModel!=NULL && !rR.IsEmpty())
+     {
+-		SdrFitToSizeType eFit=GetFitToSize();
+-		FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++        FASTBOOL bFitToSize(IsFitToSize());
+         FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth();
+         FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight();
+         SdrTextAniKind eAniKind=GetTextAniKind();
+diff --git svx/source/svdraw/svdotxed.cxx svx/source/svdraw/svdotxed.cxx
+index edae0f8..ac9eb40 100644
+--- svx/source/svdraw/svdotxed.cxx
++++ svx/source/svdraw/svdotxed.cxx
+@@ -76,15 +76,17 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
+     rOutl.Init( nOutlinerMode );
+     rOutl.SetRefDevice( pModel->GetRefDevice() );
+ 
+-	SdrFitToSizeType eFit=GetFitToSize();
+-	FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++    FASTBOOL bFitToSize(IsFitToSize());
+     FASTBOOL bContourFrame=IsContourTextFrame();
+     ImpSetTextEditParams();
+ 
+     if (!bContourFrame) {
+         ULONG nStat=rOutl.GetControlWord();
+         nStat|=EE_CNTRL_AUTOPAGESIZE;
+-		if (bFitToSize) nStat|=EE_CNTRL_STRETCHING; else nStat&=~EE_CNTRL_STRETCHING;
++		if (bFitToSize || IsAutoFit()) 
++            nStat|=EE_CNTRL_STRETCHING; 
++        else 
++            nStat&=~EE_CNTRL_STRETCHING;
+         rOutl.SetControlWord(nStat);
+     }
+ 
+@@ -122,7 +124,11 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
+         TakeTextRect(rOutl, aTextRect, FALSE, 
+             &aAnchorRect/* #97097# give TRUE here, not FALSE */);
+         Fraction aFitXKorreg(1,1);
+-		ImpSetCharStretching(rOutl,aTextRect,aAnchorRect,aFitXKorreg);
++		ImpSetCharStretching(rOutl,aTextRect.GetSize(),aAnchorRect.GetSize(),aFitXKorreg);
++    }
++    else if (IsAutoFit())
++    {
++        ImpAutoFitText(rOutl);
+     }
+ 
+     if(pOutlinerParaObject)
+@@ -149,8 +155,7 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
+ 
+ void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
+ {
+-	SdrFitToSizeType eFit=GetFitToSize();
+-	FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++    FASTBOOL bFitToSize(IsFitToSize());
+     Size aPaperMin,aPaperMax;
+     Rectangle aViewInit;
+     TakeTextAnchorRect(aViewInit);
+diff --git svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdotxtr.cxx
+index 2dbd2f3..e2bd85b 100644
+--- svx/source/svdraw/svdotxtr.cxx
++++ svx/source/svdraw/svdotxtr.cxx
+@@ -87,9 +87,6 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
+         if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
+             if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+             if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+-			if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+-				NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+-			}
+             NbcAdjustTextFrameWidthAndHeight();
+         }
+         ImpCheckShear();
+@@ -115,9 +112,6 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
+     if (bTextFrame) {
+         if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+         if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+-		if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+-			NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+-		}
+         NbcAdjustTextFrameWidthAndHeight();
+     }
+     SetRectsDirty();
+@@ -231,9 +225,6 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
+     if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
+         if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+         if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+-		if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+-			NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+-		}
+         NbcAdjustTextFrameWidthAndHeight();
+     }
+     ImpCheckShear();
+diff --git svx/source/svdraw/svdview.cxx svx/source/svdraw/svdview.cxx
+index d8e34e9..0005489 100644
+--- svx/source/svdraw/svdview.cxx
++++ svx/source/svdraw/svdview.cxx
+@@ -505,8 +505,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
+                 Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft());
+                 
+                 // FitToSize berueksichtigen
+-				SdrFitToSizeType eFit=pTextObj->GetFitToSize();
+-				BOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
++                BOOL bFitToSize(pTextObj->IsFitToSize());
+                 if (bFitToSize) {
+                     Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
+                     Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
+diff --git xmloff/source/draw/sdpropls.cxx xmloff/source/draw/sdpropls.cxx
+index df652fd..0a92168 100644
+--- xmloff/source/draw/sdpropls.cxx
++++ xmloff/source/draw/sdpropls.cxx
+@@ -627,8 +627,8 @@ SvXMLEnumMapEntry __READONLY_DATA pXML_FitToSize_Enum[] =
+ {
+     { XML_FALSE,		drawing::TextFitToSizeType_NONE },
+     { XML_TRUE, 		drawing::TextFitToSizeType_PROPORTIONAL },
+-	{ XML_TRUE,	    	drawing::TextFitToSizeType_ALLLINES },
+-	{ XML_TRUE,		    drawing::TextFitToSizeType_RESIZEATTR },
++	{ XML_ALL,	    	drawing::TextFitToSizeType_ALLLINES },
++	{ XML_SHRINK_TO_FIT,drawing::TextFitToSizeType_AUTOFIT },
+     { XML_TOKEN_INVALID, 0 }
+ };
+ 
diff --git a/patches/dev300/fit-list-to-size.diff b/patches/dev300/fit-list-to-size.diff
index 7315c33..34e8b2b 100644
--- a/patches/dev300/fit-list-to-size.diff
+++ b/patches/dev300/fit-list-to-size.diff
@@ -567,15 +567,6 @@ index 0fad6dd..617c676 100644
                      ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
                      SDRTEXTANI_BLINK == eAniKind, 
                      SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
-@@ -556,7 +557,7 @@ namespace drawinglayer
-                 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
-                 const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
-                 const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
--				const bool bCompletelyTransparent(0xff == nStartLuminance == nEndLuminance);
-+				const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
- 
-                 if(!bCompletelyTransparent)
-                 {
 diff --git svx/source/sdr/primitive2d/sdrdecompositiontools.cxx svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
 index 6204eba..925d37a 100644
 --- svx/source/sdr/primitive2d/sdrdecompositiontools.cxx


More information about the ooo-build-commit mailing list