update dev300-m58
[ooovba.git] / applied_patches / 0510-fit-list-to-size.diff
blob68b1376c9e0903c59b2c436d1b8bb65098066b89
1 --- offapi/com/sun/star/drawing/TextFitToSizeType.idl.old 2009-04-02 10:51:28.000000000 +0000
2 +++ offapi/com/sun/star/drawing/TextFitToSizeType.idl 2009-04-06 16:42:18.000000000 +0000
3 @@ -63,9 +63,10 @@ published enum TextFitToSizeType
5 //-------------------------------------------------------------------------
7 - /** if the shape is scaled, the font attributes are scaled and hard set
8 - on the text */
9 - RESIZEATTR
10 + /** if the shape is scaled, the font is scaled isotrophically to
11 + fit the avaiable space. Auto line-breaks will keep working
12 + */
13 + AUTOFIT
15 };
17 --- qadevOOo/runner/util/ValueChanger.java.old 2009-04-02 10:57:39.000000000 +0000
18 +++ qadevOOo/runner/util/ValueChanger.java 2009-04-06 16:42:18.000000000 +0000
19 @@ -389,7 +389,7 @@ public class ValueChanger {
20 com.sun.star.drawing.TextFitToSizeType TF1 = com.sun.star.drawing.TextFitToSizeType.ALLLINES;
21 com.sun.star.drawing.TextFitToSizeType TF2 = com.sun.star.drawing.TextFitToSizeType.NONE;
22 com.sun.star.drawing.TextFitToSizeType TF3 = com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL;
23 - com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.RESIZEATTR;
24 + com.sun.star.drawing.TextFitToSizeType TF4 = com.sun.star.drawing.TextFitToSizeType.AUTOFIT;
25 if (oldValue.equals(TF1)) newValue = TF2;
26 if (oldValue.equals(TF2)) newValue = TF3;
27 if (oldValue.equals(TF3)) newValue = TF4;
28 --- sd/sdi/_drvwsh.sdi.old 2009-04-02 10:45:43.000000000 +0000
29 +++ sd/sdi/_drvwsh.sdi 2009-04-06 16:42:18.000000000 +0000
30 @@ -28,18 +28,6 @@
32 ************************************************************************/
34 -enum SdrFitToSizeType
36 - SDRTEXTFIT_NONE ,
37 - SDRTEXTFIT_PROPORTIONAL ,
38 - SDRTEXTFIT_ALLLINES ,
39 - SDRTEXTFIT_RESIZEATTR
41 -item UINT32 SvxObjectItem ;
42 -item BOOL SdrShadowItem ;
43 -item SdrFitToSizeType SdrTextFitToSizeTypeItem ;
46 interface DrawView
48 SID_JUMPTOMARK // ole : no, status : ?
49 --- svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
50 +++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
51 @@ -65,6 +65,7 @@ namespace drawinglayer
52 // bitfield
53 unsigned mbContour : 1;
54 unsigned mbFitToSize : 1;
55 + unsigned mbAutoFit : 1;
56 unsigned mbHideContour : 1;
57 unsigned mbBlink : 1;
58 unsigned mbScroll : 1;
59 @@ -81,6 +82,7 @@ namespace drawinglayer
60 sal_Int32 aTextLowerDistance,
61 bool bContour,
62 bool bFitToSize,
63 + bool bAutoFit,
64 bool bHideContour,
65 bool bBlink,
66 bool bScroll,
67 @@ -93,6 +95,7 @@ namespace drawinglayer
68 const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
69 bool isContour() const { return mbContour; }
70 bool isFitToSize() const { return mbFitToSize; }
71 + bool isAutoFit() const { return mbAutoFit; }
72 bool isHideContour() const { return mbHideContour; }
73 bool isBlink() const { return mbBlink; }
74 bool isScroll() const { return mbScroll; }
75 --- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx.old 2009-04-02 11:03:37.000000000 +0000
76 +++ svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx 2009-04-06 16:42:18.000000000 +0000
77 @@ -265,6 +265,47 @@ namespace drawinglayer
79 //////////////////////////////////////////////////////////////////////////////
81 +namespace drawinglayer
83 + namespace primitive2d
84 + {
85 + class SdrAutoFitTextPrimitive2D : public SdrTextPrimitive2D
86 + {
87 + private:
88 + ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
90 + // bitfield
91 + unsigned mbWordWrap : 1; // for CustomShapes text layout
93 + protected:
94 + // local decomposition.
95 + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
97 + public:
98 + SdrAutoFitTextPrimitive2D(
99 + const SdrText* pSdrText,
100 + const OutlinerParaObject& rOutlinerParaObjectPtr,
101 + const ::basegfx::B2DHomMatrix& rTextRangeTransform,
102 + bool bWordWrap);
104 + // get data
105 + const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
106 + bool getWordWrap() const { return mbWordWrap; }
108 + // compare operator
109 + virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
111 + // transformed clone operator
112 + virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
114 + // provide unique ID
115 + DeclPrimitrive2DIDBlock()
116 + };
117 + } // end of namespace primitive2d
118 +} // end of namespace drawinglayer
120 +//////////////////////////////////////////////////////////////////////////////
122 #endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
124 // eof
125 --- svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
126 +++ svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
127 @@ -52,6 +52,7 @@
128 #define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20)
129 #define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21)
130 #define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22)
131 +#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 23)
133 //////////////////////////////////////////////////////////////////////////////
135 --- svx/inc/svx/sdtfsitm.hxx.old 2009-04-02 11:03:40.000000000 +0000
136 +++ svx/inc/svx/sdtfsitm.hxx 2009-04-06 16:42:18.000000000 +0000
137 @@ -34,19 +34,21 @@
138 #include <svx/svddef.hxx>
139 #include "svx/svxdllapi.h"
141 -enum SdrFitToSizeType {SDRTEXTFIT_NONE, // - kein FitToSize
142 - SDRTEXTFIT_PROPORTIONAL, // - Alle Buchstaben proportional umgroessern
143 - SDRTEXTFIT_ALLLINES, // - Zus. jede Zeile separat in der Breite stretchen
144 - SDRTEXTFIT_RESIZEATTR}; // - Bei Rahmenumgroesserung (ausser Autogrow) wird
145 - // die Schriftgroesse umattributiert (hart)
146 +enum SdrFitToSizeType {
147 + SDRTEXTFIT_NONE, // - no fit-to-size
148 + SDRTEXTFIT_PROPORTIONAL, // - resize all glyhs proportionally
149 + // (might scale anisotrophically)
150 + SDRTEXTFIT_ALLLINES, // - like SDRTEXTFIT_PROPORTIONAL, but
151 + // scales each line separately
152 + SDRTEXTFIT_AUTOFIT}; // - mimics PPT's automatic adaption of
153 + // font size to text rect - comparable
154 + // to SDRTEXTFIT_PROPORTIONAL, but
155 + // scales isotrophically
157 -// Bei SDRTEXTFIT_PROPORTIONAL und SDRTEXTFIT_ALLLINES gibt es kein AutoGrow und
158 -// keine automatischen Umbrueche.
159 -// Ist SDRTEXTFIT_RESIZEATTR gesetzt, so wird beim umgroessern des Textrahmens
160 -// (ausser bei AutoGrow) die Schrift durch harte Attributierung ebenfalls
161 -// umgegroessert.
162 -// Bei AutoGrowingWidth gibt es ebenfalls keine automatischen Umbrueche (erst bei
163 -// TextMaxFrameWidth).
164 +// No AutoGrow and no automatic line breaks for
165 +// SDRTEXTFIT_PROPORTIONAL and SDRTEXTFIT_ALLLINES.
166 +// No automatic line breaks for AutoGrowingWidth as well (only if
167 +// TextMaxFrameWidth is reached).
169 //--------------------------------
170 // class SdrTextFitToSizeTypeItem
171 --- svx/inc/svx/svdotext.hxx
172 +++ svx/inc/svx/svdotext.hxx
173 @@ -62,6 +62,7 @@ namespace drawinglayer { namespace primi
174 class SdrContourTextPrimitive2D;
175 class SdrPathTextPrimitive2D;
176 class SdrBlockTextPrimitive2D;
177 + class SdrAutoFitTextPrimitive2D;
178 class SdrStretchTextPrimitive2D;
181 @@ -259,6 +260,9 @@ protected:
182 // Flag for allowing text animation. Default is sal_true.
183 BOOL mbTextAnimationAllowed : 1;
185 + // flag for preventing recursive onEditOutlinerStatusEvent calls
186 + BOOL mbInDownScale : 1;
188 SdrOutliner& ImpGetDrawOutliner() const;
190 private:
191 @@ -272,6 +276,8 @@ private:
192 Rectangle& rAnchorRect,
193 Rectangle& rPaintRect,
194 Fraction& aFitXKorreg ) const;
195 + void ImpAutoFitText( SdrOutliner& rOutliner ) const;
196 + static void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting );
197 SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
198 SVX_DLLPRIVATE void ImpLinkAnmeldung();
199 SVX_DLLPRIVATE void ImpLinkAbmeldung();
200 @@ -283,7 +289,7 @@ protected:
201 SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const;
202 SdrObject* ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const;
203 void ImpSetTextStyleSheetListeners();
204 - void ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const;
205 + void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const;
206 void ImpJustifyRect(Rectangle& rRect) const;
207 void ImpCheckShear();
208 Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
209 @@ -345,6 +351,10 @@ public:
210 void NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact);
211 FASTBOOL IsTextFrame() const { return bTextFrame; }
212 FASTBOOL IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); }
213 + /// returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false!
214 + FASTBOOL IsAutoFit() const;
215 + /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
216 + FASTBOOL IsFitToSize() const;
217 SdrObjKind GetTextKind() const { return eTextKind; }
219 virtual bool HasText() const;
220 @@ -590,6 +600,10 @@ public:
221 drawinglayer::primitive2d::Primitive2DSequence& rTarget,
222 const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
223 const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
224 + bool impDecomposeAutoFitTextPrimitive(
225 + drawinglayer::primitive2d::Primitive2DSequence& rTarget,
226 + const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
227 + const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
228 bool impDecomposeStretchTextPrimitive(
229 drawinglayer::primitive2d::Primitive2DSequence& rTarget,
230 const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
231 --- svx/source/cui/dbregisterednamesconfig.cxx
232 +++ svx/source/cui/dbregisterednamesconfig.cxx
233 @@ -163,7 +163,7 @@ namespace svx
235 catch( const Exception& )
237 - DBG_UNHANDLED_EXCEPTION();
238 + //DBG_UNHANDLED_EXCEPTION();
242 @@ -184,7 +184,7 @@ namespace svx
244 catch( const Exception& )
246 - DBG_UNHANDLED_EXCEPTION();
247 + //DBG_UNHANDLED_EXCEPTION();
251 --- svx/source/cui/textattr.cxx
252 +++ svx/source/cui/textattr.cxx
253 @@ -460,7 +460,6 @@ BOOL SvxTextAttrPage::FillItemSet( SfxIt
254 default: ; //prevent warning
255 DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
256 case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break;
257 - //case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break;
258 case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break;
260 rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) );
261 --- svx/source/editeng/editobj2.hxx.old 2009-04-02 11:03:02.000000000 +0000
262 +++ svx/source/editeng/editobj2.hxx 2009-04-06 16:42:18.000000000 +0000
263 @@ -115,12 +115,16 @@ class XParaPortionList : public XBasePa
264 ULONG nRefDevPtr;
265 OutDevType eRefDevType;
266 MapMode aRefMapMode;
267 + sal_uInt16 nStretchX;
268 + sal_uInt16 nStretchY;
269 ULONG nPaperWidth;
272 public:
273 - XParaPortionList( OutputDevice* pRefDev, ULONG nPW ) :
274 - aRefMapMode( pRefDev->GetMapMode() )
275 + XParaPortionList( OutputDevice* pRefDev, ULONG nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY ) :
276 + aRefMapMode( pRefDev->GetMapMode() ),
277 + nStretchX(_nStretchX),
278 + nStretchY(_nStretchY)
280 nRefDevPtr = (ULONG)pRefDev; nPaperWidth = nPW;
281 eRefDevType = pRefDev->GetOutDevType();
282 @@ -130,6 +134,8 @@ public:
283 ULONG GetPaperWidth() const { return nPaperWidth; }
284 OutDevType GetRefDevType() const { return eRefDevType; }
285 const MapMode& GetRefMapMode() const { return aRefMapMode; }
286 + sal_uInt16 GetStretchX() const { return nStretchX; }
287 + sal_uInt16 GetStretchY() const { return nStretchY; }
290 /* cl removed because not needed anymore since binfilter
291 --- svx/source/editeng/impedit3.cxx.old 2009-04-06 16:42:16.000000000 +0000
292 +++ svx/source/editeng/impedit3.cxx 2009-04-06 16:42:18.000000000 +0000
293 @@ -2665,38 +2665,46 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF
294 aRealSz.Height() /= 100;
296 if ( nStretchX != 100 )
298 - aRealSz.Width() *= nStretchX;
299 - aRealSz.Width() /= 100;
301 + if ( nStretchX == nStretchY &&
302 + nRelWidth == 100 )
304 + aRealSz.Width() = 0;
306 + else
308 + aRealSz.Width() *= nStretchX;
309 + aRealSz.Width() /= 100;
311 - // Auch das Kerning: (long wegen Zwischenergebnis)
312 - long nKerning = rFont.GetFixKerning();
313 + // Auch das Kerning: (long wegen Zwischenergebnis)
314 + long nKerning = rFont.GetFixKerning();
316 - Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200
317 - => Nicht das Kerning verdoppelt, also die Buchstaben weiter
318 - zusammenziehen
319 - ---------------------------
320 - Kern StretchX =>Kern
321 - ---------------------------
322 - >0 <100 < (Proportional)
323 - <0 <100 < (Proportional)
324 - >0 >100 > (Proportional)
325 - <0 >100 < (Der Betrag, also Antiprop)
326 + Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200
327 + => Nicht das Kerning verdoppelt, also die Buchstaben weiter
328 + zusammenziehen
329 + ---------------------------
330 + Kern StretchX =>Kern
331 + ---------------------------
332 + >0 <100 < (Proportional)
333 + <0 <100 < (Proportional)
334 + >0 >100 > (Proportional)
335 + <0 >100 < (Der Betrag, also Antiprop)
337 - if ( ( nKerning < 0 ) && ( nStretchX > 100 ) )
339 - // Antiproportional
340 - nKerning *= 100;
341 - nKerning /= nStretchX;
343 - else if ( nKerning )
345 - // Proportional
346 - nKerning *= nStretchX;
347 - nKerning /= 100;
349 - rFont.SetFixKerning( (short)nKerning );
351 + if ( ( nKerning < 0 ) && ( nStretchX > 100 ) )
353 + // Antiproportional
354 + nKerning *= 100;
355 + nKerning /= nStretchX;
357 + else if ( nKerning )
359 + // Proportional
360 + nKerning *= nStretchX;
361 + nKerning /= 100;
363 + rFont.SetFixKerning( (short)nKerning );
367 if ( nRelWidth != 100 )
369 @@ -4085,20 +4085,25 @@ void ImpEditEngine::SetFlatMode( sal_Boo
371 void ImpEditEngine::SetCharStretching( sal_uInt16 nX, sal_uInt16 nY )
373 + bool bChanged(false);
374 if ( !IsVertical() )
376 + bChanged = nStretchX!=nX || nStretchY!=nY;
377 nStretchX = nX;
378 nStretchY = nY;
380 else
382 + bChanged = nStretchX!=nY || nStretchY!=nX;
383 nStretchX = nY;
384 nStretchY = nX;
387 - if ( aStatus.DoStretch() )
388 + if (bChanged && aStatus.DoStretch())
390 FormatFullDoc();
391 + // (potentially) need everything redrawn
392 + aInvalidRec=Rectangle(0,0,1000000,1000000);
393 UpdateViews( GetActiveView() );
396 --- svx/source/editeng/impedit4.cxx.old 2009-04-02 11:03:02.000000000 +0000
397 +++ svx/source/editeng/impedit4.cxx 2009-04-06 16:42:18.000000000 +0000
398 @@ -1169,7 +1169,7 @@ EditTextObject* ImpEditEngine::CreateBin
399 // Schwelle rauf setzen, wenn Olli die Absaetze nicht mehr zerhackt!
400 if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && GetUpdateMode() && ( nTextPortions >= nBigObjectStart ) )
402 - XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width() );
403 + XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY );
404 pTxtObj->SetPortionInfo( pXList );
405 for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
407 @@ -1260,7 +1260,9 @@ EditSelection ImpEditEngine::InsertBinTe
408 XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo();
410 if ( pPortionInfo && ( (long)pPortionInfo->GetPaperWidth() == aPaperSize.Width() )
411 - && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) )
412 + && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() )
413 + && ( pPortionInfo->GetStretchX() == nStretchX )
414 + && ( pPortionInfo->GetStretchY() == nStretchY ) )
416 if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) ||
417 ( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
418 --- svx/source/outliner/outliner.cxx.old 2009-04-02 11:02:55.000000000 +0000
419 +++ svx/source/outliner/outliner.cxx 2009-04-06 16:42:18.000000000 +0000
420 @@ -922,7 +922,10 @@ Font Outliner::ImpCalcBulletFont( USHORT
423 // #107508# Use original scale...
424 - USHORT nScale = /* pEditEngine->IsFlatMode() ? DEFAULT_SCALE : */ pFmt->GetBulletRelSize();
425 + USHORT nStretchX, nStretchY;
426 + const_cast<Outliner*>(this)->GetGlobalCharStretching(nStretchX, nStretchY);
428 + USHORT nScale = pFmt->GetBulletRelSize() * nStretchY / 100;
429 ULONG nScaledLineHeight = aStdFont.GetSize().Height();
430 nScaledLineHeight *= nScale*10;
431 nScaledLineHeight /= 1000;
432 @@ -965,6 +968,12 @@ void Outliner::PaintBullet( USHORT nPara
433 BOOL bRightToLeftPara = pEditEngine->IsRightToLeft( nPara );
435 Rectangle aBulletArea( ImpCalcBulletArea( nPara, TRUE, FALSE ) );
436 + USHORT nStretchX, nStretchY;
437 + GetGlobalCharStretching(nStretchX, nStretchY);
438 + aBulletArea = Rectangle( Point(aBulletArea.Left()*nStretchX/100,
439 + aBulletArea.Top()),
440 + Size(aBulletArea.GetWidth()*nStretchX/100,
441 + aBulletArea.GetHeight()) );
443 Paragraph* pPara = pParaList->GetParagraph( nPara );
444 const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
445 --- svx/source/sdr/attribute/sdrtextattribute.cxx.old 2009-04-02 11:02:53.000000000 +0000
446 +++ svx/source/sdr/attribute/sdrtextattribute.cxx 2009-04-06 16:42:18.000000000 +0000
447 @@ -52,6 +52,7 @@ namespace drawinglayer
448 sal_Int32 aTextLowerDistance,
449 bool bContour,
450 bool bFitToSize,
451 + bool bAutoFit,
452 bool bHideContour,
453 bool bBlink,
454 bool bScroll,
455 @@ -65,6 +66,7 @@ namespace drawinglayer
456 maTextLowerDistance(aTextLowerDistance),
457 mbContour(bContour),
458 mbFitToSize(bFitToSize),
459 + mbAutoFit(bAutoFit),
460 mbHideContour(bHideContour),
461 mbBlink(bBlink),
462 mbScroll(bScroll),
463 @@ -82,6 +84,7 @@ namespace drawinglayer
464 && getTextLowerDistance() == rCandidate.getTextLowerDistance()
465 && isContour() == rCandidate.isContour()
466 && isFitToSize() == rCandidate.isFitToSize()
467 + && isAutoFit() == rCandidate.isAutoFit()
468 && isHideContour() == rCandidate.isHideContour()
469 && isBlink() == rCandidate.isBlink()
470 && isScroll() == rCandidate.isScroll()
471 --- svx/source/sdr/primitive2d/sdrattributecreator.cxx.old 2009-04-02 11:02:54.000000000 +0000
472 +++ svx/source/sdr/primitive2d/sdrattributecreator.cxx 2009-04-06 16:42:18.000000000 +0000
473 @@ -521,7 +521,8 @@ namespace drawinglayer
474 rTextObj.GetTextRightDistance(),
475 rTextObj.GetTextLowerDistance(),
476 ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
477 - (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit),
478 + rTextObj.IsFitToSize(),
479 + rTextObj.IsAutoFit(),
480 ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
481 SDRTEXTANI_BLINK == eAniKind,
482 SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
483 @@ -542,7 +543,7 @@ namespace drawinglayer
484 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
485 const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
486 const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
487 - const bool bCompletelyTransparent(0xff == nStartLuminance == nEndLuminance);
488 + const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
490 if(!bCompletelyTransparent)
492 --- svx/source/sdr/primitive2d/sdrdecompositiontools.cxx.old 2009-04-02 11:02:54.000000000 +0000
493 +++ svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 2009-04-06 16:42:18.000000000 +0000
494 @@ -269,6 +269,11 @@ namespace drawinglayer
495 // streched text in range
496 pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform);
498 + else if(rText.isAutoFit())
500 + // isotrophically scaled text in range
501 + pNew = new SdrAutoFitTextPrimitive2D(&rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, bWordWrap);
503 else // text in range
505 // build new primitive
506 --- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx.old 2009-04-02 11:02:54.000000000 +0000
507 +++ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx 2009-04-06 16:42:18.000000000 +0000
508 @@ -305,6 +305,61 @@ namespace drawinglayer
510 namespace primitive2d
512 + Primitive2DSequence SdrAutoFitTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
514 + Primitive2DSequence aRetval;
515 + const bool bCurrentSpellCheck(getSdrText()->GetObject().impDecomposeAutoFitTextPrimitive(aRetval, *this, aViewInformation));
517 + if(getLastSpellCheck() != bCurrentSpellCheck)
519 + // remember last spell check state; this is part of the decomposition source data definition
520 + const_cast< SdrAutoFitTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck);
523 + return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
526 + SdrAutoFitTextPrimitive2D::SdrAutoFitTextPrimitive2D(
527 + const SdrText* pSdrText,
528 + const OutlinerParaObject& rParaObj,
529 + const ::basegfx::B2DHomMatrix& rTextRangeTransform,
530 + bool bWordWrap)
531 + : SdrTextPrimitive2D(pSdrText, rParaObj),
532 + maTextRangeTransform(rTextRangeTransform),
533 + mbWordWrap(bWordWrap)
537 + bool SdrAutoFitTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
539 + if(SdrTextPrimitive2D::operator==(rPrimitive))
541 + const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
543 + return (getTextRangeTransform() == rCompare.getTextRangeTransform()
544 + && getWordWrap() == rCompare.getWordWrap());
547 + return false;
550 + SdrTextPrimitive2D* SdrAutoFitTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
552 + return new SdrAutoFitTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getWordWrap());
555 + // provide unique ID
556 + ImplPrimitrive2DIDBlock(SdrAutoFitTextPrimitive2D, PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D)
558 + } // end of namespace primitive2d
559 +} // end of namespace drawinglayer
561 +//////////////////////////////////////////////////////////////////////////////
563 +namespace drawinglayer
565 + namespace primitive2d
567 Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
569 Primitive2DSequence aRetval;
570 --- svx/source/svdraw/svdedxv.cxx.old 2009-04-06 16:42:16.000000000 +0000
571 +++ svx/source/svdraw/svdedxv.cxx 2009-04-06 16:42:18.000000000 +0000
572 @@ -315,7 +315,7 @@ void SdrObjEditView::ImpPaintOutlinerVie
574 const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
575 bool bTextFrame(pText && pText->IsTextFrame());
576 - bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
577 + bool bFitToSize(pText && pText->IsFitToSize());
578 bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
579 Rectangle aBlankRect(rOutlView.GetOutputArea());
580 aBlankRect.Union(aMinTextEditArea);
581 @@ -384,7 +384,7 @@ void SdrObjEditView::ImpInvalidateOutlin
583 const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
584 bool bTextFrame(pText && pText->IsTextFrame());
585 - bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
586 + bool bFitToSize(pText && pText->IsFitToSize());
588 if(bTextFrame && !bFitToSize)
590 @@ -692,8 +692,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdi
591 if ( !pTextObj->IsContourTextFrame() )
593 // FitToSize erstmal nicht mit ContourFrame
594 - SdrFitToSizeType eFit = pTextObj->GetFitToSize();
595 - if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
596 + if (pTextObj->IsFitToSize())
597 aTextRect = aAnchorRect;
600 @@ -761,8 +760,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdi
601 // #71519#
602 if(!bExtraInvalidate)
604 - SdrFitToSizeType eFit = pTextObj->GetFitToSize();
605 - if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES)
606 + if(pTextObj->IsFitToSize())
607 bExtraInvalidate = sal_True;
610 --- svx/source/svdraw/svdfppt.cxx
611 +++ svx/source/svdraw/svdfppt.cxx
612 @@ -1113,6 +1113,7 @@ SdrObject* SdrEscherImport::ProcessObj(
614 aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance );
616 + bool bAutoFit = false; // auto-scale text into shape box
617 switch ( aTextObj.GetInstance() )
619 case TSS_TYPE_PAGETITLE :
620 @@ -1120,7 +1121,7 @@ SdrObject* SdrEscherImport::ProcessObj(
621 case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break;
622 case TSS_TYPE_BODY :
623 case TSS_TYPE_HALFBODY :
624 - case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; break;
625 + case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break;
627 if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE )
629 @@ -1175,6 +1176,15 @@ SdrObject* SdrEscherImport::ProcessObj(
631 pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
633 + if (bAutoFit)
635 + // disable both, defeats purpose of autofit
636 + // otherwise
637 + bAutoGrowHeight = sal_False;
638 + bAutoGrowWidth = sal_False;
639 + pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
642 if ( !pTObj->ISA( SdrObjCustomShape ) )
644 pTObj->SetMergedItem( SdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
645 --- svx/source/svdraw/svdotext.cxx.old 2009-04-02 11:03:00.000000000 +0000
646 +++ svx/source/svdraw/svdotext.cxx 2009-04-06 16:42:18.000000000 +0000
647 @@ -145,6 +145,7 @@ SdrTextObj::SdrTextObj()
649 // #i25616#
650 mbSupportTextIndentingOnLineWidthChange = sal_True;
651 + mbInDownScale = sal_False;
654 SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
655 @@ -170,6 +171,7 @@ SdrTextObj::SdrTextObj(const Rectangle&
657 // #111096#
658 mbTextAnimationAllowed = sal_True;
659 + mbInDownScale = sal_False;
661 // #108784#
662 maTextEditOffset = Point(0, 0);
663 @@ -200,6 +202,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTe
665 // #111096#
666 mbTextAnimationAllowed = sal_True;
667 + mbInDownScale = sal_False;
669 // #108784#
670 maTextEditOffset = Point(0, 0);
671 @@ -232,6 +235,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTe
673 // #111096#
674 mbTextAnimationAllowed = sal_True;
675 + mbInDownScale = sal_False;
677 // #108784#
678 maTextEditOffset = Point(0, 0);
679 @@ -266,6 +270,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTe
681 // #111096#
682 mbTextAnimationAllowed = sal_True;
683 + mbInDownScale = sal_False;
685 // #108784#
686 maTextEditOffset = Point(0, 0);
687 @@ -842,8 +847,7 @@ void SdrTextObj::TakeTextRect( SdrOutlin
688 SdrTextAniKind eAniKind=GetTextAniKind();
689 SdrTextAniDirection eAniDirection=GetTextAniDirection();
691 - SdrFitToSizeType eFit=GetFitToSize();
692 - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
693 + FASTBOOL bFitToSize(IsFitToSize());
694 FASTBOOL bContourFrame=IsContourTextFrame();
696 FASTBOOL bFrame=IsTextFrame();
697 @@ -1004,7 +1008,7 @@ OutlinerParaObject* SdrTextObj::GetEditO
698 return pPara;
701 -void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const
702 +void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const
704 OutputDevice* pOut = rOutliner.GetRefDevice();
705 BOOL bNoStretching(FALSE);
706 @@ -1049,12 +1053,12 @@ void SdrTextObj::ImpSetCharStretching(Sd
707 unsigned nLoopCount=0;
708 FASTBOOL bNoMoreLoop=FALSE;
709 long nXDiff0=0x7FFFFFFF;
710 - long nWantWdt=rAnchorRect.Right()-rAnchorRect.Left();
711 - long nIsWdt=rTextRect.Right()-rTextRect.Left();
712 + long nWantWdt=rShapeSize.Width();
713 + long nIsWdt=rTextSize.Width();
714 if (nIsWdt==0) nIsWdt=1;
716 - long nWantHgt=rAnchorRect.Bottom()-rAnchorRect.Top();
717 - long nIsHgt=rTextRect.Bottom()-rTextRect.Top();
718 + long nWantHgt=rShapeSize.Height();
719 + long nIsHgt=rTextSize.Height();
720 if (nIsHgt==0) nIsHgt=1;
722 long nXTolPl=nWantWdt/100; // Toleranz +1%
723 # FIXME: 2009-08-14: No CheckHit() method any longer --tml
725 # @@ -1143,8 +1147,7 @@ SdrObject* SdrTextObj::CheckHit(const Po
727 # INT32 nMyTol=nTol;
728 # FASTBOOL bFontwork=IsFontwork();
729 # - SdrFitToSizeType eFit=GetFitToSize();
730 # - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
731 # + FASTBOOL bFitToSize(IsFitToSize());
732 # Rectangle aR(aRect);
733 # Rectangle aAnchor2(aR);
734 # Rectangle aTextRect(aR);
735 @@ -1377,8 +1380,7 @@ basegfx::B2DPolyPolygon SdrTextObj::Take
736 Rectangle aR;
737 TakeTextRect(rOutliner,aR,FALSE,&aAnchor2);
738 rOutliner.Clear();
739 - SdrFitToSizeType eFit=GetFitToSize();
740 - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
741 + FASTBOOL bFitToSize(IsFitToSize());
742 if (bFitToSize) aR=aAnchor2;
743 Polygon aPol(aR);
744 if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
745 @@ -1495,8 +1497,7 @@ void SdrTextObj::ImpSetupDrawOutlinerFor
746 if (!bContourFrame)
748 // FitToSize erstmal nicht mit ContourFrame
749 - SdrFitToSizeType eFit=GetFitToSize();
750 - if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
751 + if (IsFitToSize() || IsAutoFit())
753 ULONG nStat=rOutliner.GetControlWord();
754 nStat|=EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE;
755 @@ -1510,13 +1511,73 @@ void SdrTextObj::ImpSetupDrawOutlinerFor
756 if (!bContourFrame)
758 // FitToSize erstmal nicht mit ContourFrame
759 - SdrFitToSizeType eFit=GetFitToSize();
760 - if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
761 + if (IsFitToSize())
763 - ImpSetCharStretching(rOutliner,rTextRect,rAnchorRect,rFitXKorreg);
764 + ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXKorreg);
765 rPaintRect=rAnchorRect;
767 + else if (IsAutoFit())
769 + ImpAutoFitText(rOutliner);
774 +void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
776 + const Size aShapeSize=GetSnapRect().GetSize();
777 + ImpAutoFitText( rOutliner,
778 + Size(aShapeSize.Width()-GetTextLeftDistance()-GetTextRightDistance(),
779 + aShapeSize.Height()-GetTextUpperDistance()-GetTextLowerDistance()),
780 + IsVerticalWriting() );
783 +void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting )
785 + // EditEngine formatting is unstable enough for
786 + // line-breaking text that we need some more samples
788 + // loop early-exits if we detect an already attained value
789 + USHORT nMinStretchX=0, nMinStretchY=0;
790 + USHORT aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
791 + const size_t aStretchArySize=sizeof(aOldStretchXVals)/sizeof(*aOldStretchXVals);
792 + for(int i=0; i<aStretchArySize; ++i)
794 + const Size aCurrTextSize = rOutliner.CalcTextSize();
795 + double fFactor(1.0);
796 + if( bIsVerticalWriting )
797 + fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
798 + else
799 + fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
801 + USHORT nCurrStretchX, nCurrStretchY;
802 + rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
804 + if (fFactor >= 1.0 )
806 + // resulting text area fits into available shape rect -
807 + // err on the larger streching, to optimally fill area
808 + nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
809 + nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
812 + aOldStretchXVals[i] = nCurrStretchX;
813 + if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
814 + break; // same value already attained once; algo is looping, exit
816 + if (fFactor < 1.0 || (fFactor >= 1.0 && nCurrStretchX != 100))
818 + nCurrStretchX = sal::static_int_cast<USHORT>(nCurrStretchX*fFactor);
819 + nCurrStretchY = sal::static_int_cast<USHORT>(nCurrStretchY*fFactor);
820 + rOutliner.SetGlobalCharStretching(std::min(USHORT(100),nCurrStretchX),
821 + std::min(USHORT(100),nCurrStretchY));
822 + OSL_TRACE("SdrTextObj::onEditOutlinerStatusEvent(): zoom is %d", nCurrStretchX);
826 + OSL_TRACE("---- SdrTextObj::onEditOutlinerStatusEvent(): final zoom is %d ----", nMinStretchX);
827 + rOutliner.SetGlobalCharStretching(std::min(USHORT(100),nMinStretchX),
828 + std::min(USHORT(100),nMinStretchY));
831 void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const
832 @@ -2114,6 +2175,17 @@ bool SdrTextObj::IsTextAnimationAllowed(
833 return mbTextAnimationAllowed;
836 +FASTBOOL SdrTextObj::IsAutoFit() const
838 + return GetFitToSize()==SDRTEXTFIT_AUTOFIT;
841 +FASTBOOL SdrTextObj::IsFitToSize() const
843 + const SdrFitToSizeType eFit=GetFitToSize();
844 + return (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
847 void SdrTextObj::SetTextAnimationAllowed(sal_Bool bNew)
849 if(mbTextAnimationAllowed != bNew)
850 @@ -2131,13 +2203,21 @@ void SdrTextObj::onEditOutlinerStatusEve
851 const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0;
852 if(bTextFrame && (bGrowX || bGrowY))
854 - const bool bAutoGrowHgt= bTextFrame && IsAutoGrowHeight();
855 - const bool bAutoGrowWdt= bTextFrame && IsAutoGrowWidth();
857 - if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
858 + if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
860 AdjustTextFrameWidthAndHeight();
862 + else if (IsAutoFit() && !mbInDownScale)
864 + OSL_ASSERT(pEdtOutl);
865 + mbInDownScale = sal_True;
867 + // sucks that we cannot disable paints via
868 + // pEdtOutl->SetUpdateMode(FALSE) - but EditEngine skips
869 + // formatting as well, then.
870 + ImpAutoFitText(*pEdtOutl);
871 + mbInDownScale = sal_False;
876 --- svx/source/svdraw/svdotextdecomposition.cxx.old 2009-04-02 11:03:00.000000000 +0000
877 +++ svx/source/svdraw/svdotextdecomposition.cxx 2009-04-06 16:42:18.000000000 +0000
878 @@ -927,11 +927,11 @@ bool SdrTextObj::impDecomposeStretchText
879 basegfx::B2DHomMatrix aNewTransformA;
880 basegfx::B2DHomMatrix aNewTransformB;
882 - // calculate global char stretching scale parameters. Use non-mirrored sizes
883 - // to layout without mirroring
884 - const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
885 - const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
886 - rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
887 + // calculate global char stretching scale parameters. Use non-mirrored sizes
888 + // to layout without mirroring. Scale anisotrophically
889 + const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
890 + const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
891 + rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
893 // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
894 // move the null point which was top left to bottom right.
895 @@ -956,6 +956,136 @@ bool SdrTextObj::impDecomposeStretchText
897 rTarget = aConverter.getPrimitive2DSequence();
898 return false;
901 +bool SdrTextObj::impDecomposeAutoFitTextPrimitive(
902 + drawinglayer::primitive2d::Primitive2DSequence& rTarget,
903 + const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
904 + const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
906 + // decompose matrix to have position and size of text
907 + basegfx::B2DVector aScale, aTranslate;
908 + double fRotate, fShearX;
909 + rSdrAutofitTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
911 + // use B2DRange aAnchorTextRange for calculations
912 + basegfx::B2DRange aAnchorTextRange(aTranslate);
913 + aAnchorTextRange.expand(aTranslate + aScale);
915 + // prepare outliner
916 + const SfxItemSet& rTextItemSet = rSdrAutofitTextPrimitive.getSdrText()->GetItemSet();
917 + SdrOutliner& rOutliner = ImpGetDrawOutliner();
918 + SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet);
919 + SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet);
920 + const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
921 + const Size aNullSize;
923 + // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
924 + rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
926 + rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE|EE_CNTRL_STRETCHING);
927 + rOutliner.SetMinAutoPaperSize(aNullSize);
928 + rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
930 + // add one to rage sizes to get back to the old Rectangle and outliner measurements
931 + const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
932 + const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
933 + const OutlinerParaObject* pOutlinerParaObject = rSdrAutofitTextPrimitive.getSdrText()->GetOutlinerParaObject();
934 + OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)");
935 + const bool bVerticalWritintg(pOutlinerParaObject->IsVertical());
936 + const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
938 + if((rSdrAutofitTextPrimitive.getWordWrap() || IsTextFrame()))
940 + rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
943 + if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
945 + rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
948 + if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
950 + rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
953 + rOutliner.SetPaperSize(aNullSize);
954 + rOutliner.SetUpdateMode(true);
955 + rOutliner.SetText(*pOutlinerParaObject);
956 + ImpAutoFitText(rOutliner,aAnchorTextSize,bVerticalWritintg);
958 + // now get back the layouted text size from outliner
959 + const Size aOutlinerTextSiz(rOutliner.GetPaperSize());
960 + const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height());
961 + basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
963 + // correct horizontal translation using the now known text size
964 + if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
966 + const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
968 + if(SDRTEXTHORZADJUST_CENTER == eHAdj)
970 + aAdjustTranslate.setX(fFree / 2.0);
973 + if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
975 + aAdjustTranslate.setX(fFree);
979 + // correct vertical translation using the now known text size
980 + if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
982 + const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
984 + if(SDRTEXTVERTADJUST_CENTER == eVAdj)
986 + aAdjustTranslate.setY(fFree / 2.0);
989 + if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
991 + aAdjustTranslate.setY(fFree);
995 + // prepare matrices to apply to newly created primitives. aNewTransformA
996 + // will get coordinates in aOutlinerScale size and positive in X, Y.
997 + basegfx::B2DHomMatrix aNewTransformA;
998 + basegfx::B2DHomMatrix aNewTransformB;
1000 + // translate relative to given primitive to get same rotation and shear
1001 + // as the master shape we are working on. For vertical, use the top-right
1002 + // corner
1003 + const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
1004 + aNewTransformA.translate(fStartInX, aAdjustTranslate.getY());
1006 + // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
1007 + // move the null point which was top left to bottom right.
1008 + const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
1009 + const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
1010 + aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
1012 + // in-between the translations of the single primitives will take place. Afterwards,
1013 + // the object's transformations need to be applied
1014 + aNewTransformB.shearX(fShearX);
1015 + aNewTransformB.rotate(fRotate);
1016 + aNewTransformB.translate(aTranslate.getX(), aTranslate.getY());
1018 + // now break up text primitives.
1019 + impTextBreakupHandler aConverter(rOutliner);
1020 + aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB);
1022 + // cleanup outliner
1023 + rOutliner.Clear();
1024 + rOutliner.setVisualizedPage(0);
1025 + rOutliner.SetControlWord(nOriginalControlWord);
1027 + rTarget = aConverter.getPrimitive2DSequence();
1028 + return false;
1031 //////////////////////////////////////////////////////////////////////////////
1032 --- svx/source/svdraw/svdotxat.cxx.old 2009-04-02 11:03:00.000000000 +0000
1033 +++ svx/source/svdraw/svdotxat.cxx 2009-04-06 16:42:18.000000000 +0000
1034 @@ -82,8 +82,7 @@ FASTBOOL SdrTextObj::AdjustTextFrameWidt
1036 if (bTextFrame && pModel!=NULL && !rR.IsEmpty())
1038 - SdrFitToSizeType eFit=GetFitToSize();
1039 - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
1040 + FASTBOOL bFitToSize(IsFitToSize());
1041 FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth();
1042 FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight();
1043 SdrTextAniKind eAniKind=GetTextAniKind();
1044 --- svx/source/svdraw/svdotxed.cxx.old 2009-04-02 11:03:00.000000000 +0000
1045 +++ svx/source/svdraw/svdotxed.cxx 2009-04-06 16:42:18.000000000 +0000
1046 @@ -76,15 +76,17 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutl
1047 rOutl.Init( nOutlinerMode );
1048 rOutl.SetRefDevice( pModel->GetRefDevice() );
1050 - SdrFitToSizeType eFit=GetFitToSize();
1051 - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
1052 + FASTBOOL bFitToSize(IsFitToSize());
1053 FASTBOOL bContourFrame=IsContourTextFrame();
1054 ImpSetTextEditParams();
1056 if (!bContourFrame) {
1057 ULONG nStat=rOutl.GetControlWord();
1058 nStat|=EE_CNTRL_AUTOPAGESIZE;
1059 - if (bFitToSize) nStat|=EE_CNTRL_STRETCHING; else nStat&=~EE_CNTRL_STRETCHING;
1060 + if (bFitToSize || IsAutoFit())
1061 + nStat|=EE_CNTRL_STRETCHING;
1062 + else
1063 + nStat&=~EE_CNTRL_STRETCHING;
1064 rOutl.SetControlWord(nStat);
1067 @@ -122,8 +124,12 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutl
1068 TakeTextRect(rOutl, aTextRect, FALSE,
1069 &aAnchorRect/* #97097# give TRUE here, not FALSE */);
1070 Fraction aFitXKorreg(1,1);
1071 - ImpSetCharStretching(rOutl,aTextRect,aAnchorRect,aFitXKorreg);
1072 + ImpSetCharStretching(rOutl,aTextRect.GetSize(),aAnchorRect.GetSize(),aFitXKorreg);
1074 + else if (IsAutoFit())
1076 + ImpAutoFitText(rOutl);
1079 if(pOutlinerParaObject)
1081 @@ -149,8 +155,7 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutl
1083 void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
1085 - SdrFitToSizeType eFit=GetFitToSize();
1086 - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
1087 + FASTBOOL bFitToSize(IsFitToSize());
1088 Size aPaperMin,aPaperMax;
1089 Rectangle aViewInit;
1090 TakeTextAnchorRect(aViewInit);
1091 --- svx/source/svdraw/svdotxtr.cxx.old 2009-04-02 11:03:00.000000000 +0000
1092 +++ svx/source/svdraw/svdotxtr.cxx 2009-04-06 16:42:18.000000000 +0000
1093 @@ -83,9 +83,6 @@ void SdrTextObj::NbcSetSnapRect(const Re
1094 if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
1095 if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
1096 if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
1097 - if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
1098 - NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
1100 NbcAdjustTextFrameWidthAndHeight();
1102 ImpCheckShear();
1103 @@ -111,9 +108,6 @@ void SdrTextObj::NbcSetLogicRect(const R
1104 if (bTextFrame) {
1105 if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
1106 if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
1107 - if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
1108 - NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
1110 NbcAdjustTextFrameWidthAndHeight();
1112 SetRectsDirty();
1113 @@ -227,9 +221,6 @@ void SdrTextObj::NbcResize(const Point&
1114 if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
1115 if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
1116 if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
1117 - if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
1118 - NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
1120 NbcAdjustTextFrameWidthAndHeight();
1122 ImpCheckShear();
1123 # FIXME: 2009-08-14: No such file any longer, in fact no
1124 # ImpTextPortionHandler class any longer. --tml
1126 # --- svx/source/svdraw/svdtxhdl.cxx.old 2009-04-02 11:03:00.000000000 +0000
1127 # +++ svx/source/svdraw/svdtxhdl.cxx 2009-04-06 16:42:18.000000000 +0000
1128 # @@ -85,8 +85,7 @@ void ImpTextPortionHandler::ConvertToPat
1130 # Rectangle aAnchorRect;
1131 # Rectangle aTextRect;
1132 # - SdrFitToSizeType eFit=rTextObj.GetFitToSize();
1133 # - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
1134 # + FASTBOOL bFitToSize(rTextObj.IsFitToSize());
1135 # // Bei TakeTextRect wird u.a. auch der Text in
1136 # // den Outliner gesteckt
1137 # rTextObj.TakeTextRect(rOutliner,aTextRect,FALSE,&aAnchorRect);
1138 --- svx/source/svdraw/svdview.cxx.old 2009-04-02 11:03:00.000000000 +0000
1139 +++ svx/source/svdraw/svdview.cxx 2009-04-06 16:42:18.000000000 +0000
1140 @@ -504,8 +504,7 @@ SdrHitKind SdrView::PickAnything(const P
1141 Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft());
1143 // FitToSize berueksichtigen
1144 - SdrFitToSizeType eFit=pTextObj->GetFitToSize();
1145 - BOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
1146 + BOOL bFitToSize(pTextObj->IsFitToSize());
1147 if (bFitToSize) {
1148 Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
1149 Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
1150 --- xmloff/source/draw/sdpropls.cxx.old 2009-04-02 10:36:08.000000000 +0000
1151 +++ xmloff/source/draw/sdpropls.cxx 2009-04-06 16:42:18.000000000 +0000
1152 @@ -627,8 +627,8 @@ SvXMLEnumMapEntry __READONLY_DATA pXML_F
1154 { XML_FALSE, drawing::TextFitToSizeType_NONE },
1155 { XML_TRUE, drawing::TextFitToSizeType_PROPORTIONAL },
1156 - { XML_TRUE, drawing::TextFitToSizeType_ALLLINES },
1157 - { XML_TRUE, drawing::TextFitToSizeType_RESIZEATTR },
1158 + { XML_ALL, drawing::TextFitToSizeType_ALLLINES },
1159 + { XML_SHRINK_TO_FIT,drawing::TextFitToSizeType_AUTOFIT },
1160 { XML_TOKEN_INVALID, 0 }