xref: /AOO41X/main/svx/source/svdraw/svdotextdecomposition.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svx/svdotext.hxx>
32*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
33*cdf0e10cSrcweir #include <basegfx/vector/b2dvector.hxx>
34*cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
35*cdf0e10cSrcweir #include <drawinglayer/primitive2d/textprimitive2d.hxx>
36*cdf0e10cSrcweir #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
37*cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx>
38*cdf0e10cSrcweir #include <editeng/editstat.hxx>
39*cdf0e10cSrcweir #include <vcl/salbtype.hxx>
40*cdf0e10cSrcweir #include <svx/sdtfchim.hxx>
41*cdf0e10cSrcweir #include <svl/itemset.hxx>
42*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
43*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
44*cdf0e10cSrcweir #include <drawinglayer/animation/animationtiming.hxx>
45*cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx>
46*cdf0e10cSrcweir #include <vcl/svapp.hxx>
47*cdf0e10cSrcweir #include <editeng/eeitemid.hxx>
48*cdf0e10cSrcweir #include <editeng/escpitem.hxx>
49*cdf0e10cSrcweir #include <editeng/svxenum.hxx>
50*cdf0e10cSrcweir #include <editeng/flditem.hxx>
51*cdf0e10cSrcweir #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
52*cdf0e10cSrcweir #include <vcl/metaact.hxx>
53*cdf0e10cSrcweir #include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
54*cdf0e10cSrcweir #include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
55*cdf0e10cSrcweir #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
56*cdf0e10cSrcweir #include <svx/unoapi.hxx>
57*cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation2d.hxx>
58*cdf0e10cSrcweir #include <editeng/outlobj.hxx>
59*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
62*cdf0e10cSrcweir // helpers
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir namespace
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence impConvertVectorToPrimitive2DSequence(const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rPrimitiveVector)
67*cdf0e10cSrcweir     {
68*cdf0e10cSrcweir         const sal_Int32 nCount(rPrimitiveVector.size());
69*cdf0e10cSrcweir         drawinglayer::primitive2d::Primitive2DSequence aRetval(nCount);
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir         for(sal_Int32 a(0L); a < nCount; a++)
72*cdf0e10cSrcweir         {
73*cdf0e10cSrcweir             aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(rPrimitiveVector[a]);
74*cdf0e10cSrcweir         }
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir         return aRetval;
77*cdf0e10cSrcweir     }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     class impTextBreakupHandler
80*cdf0e10cSrcweir     {
81*cdf0e10cSrcweir     private:
82*cdf0e10cSrcweir         std::vector< drawinglayer::primitive2d::BasePrimitive2D* >  maTextPortionPrimitives;
83*cdf0e10cSrcweir         std::vector< drawinglayer::primitive2d::BasePrimitive2D* >  maLinePrimitives;
84*cdf0e10cSrcweir         std::vector< drawinglayer::primitive2d::BasePrimitive2D* >  maParagraphPrimitives;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir         SdrOutliner&                                                mrOutliner;
87*cdf0e10cSrcweir         basegfx::B2DHomMatrix                                       maNewTransformA;
88*cdf0e10cSrcweir         basegfx::B2DHomMatrix                                       maNewTransformB;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir         // the visible area for contour text decomposition
91*cdf0e10cSrcweir         basegfx::B2DVector                                          maScale;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir         // #SJ# ClipRange for BlockText decomposition; only text portions completely
94*cdf0e10cSrcweir         // inside are to be accepted, so this is different from geometric clipping
95*cdf0e10cSrcweir         // (which would allow e.g. upper parts of portions to remain). Only used for
96*cdf0e10cSrcweir         // BlockText (see there)
97*cdf0e10cSrcweir         basegfx::B2DRange                                           maClipRange;
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir         DECL_LINK(decomposeContourTextPrimitive, DrawPortionInfo* );
100*cdf0e10cSrcweir         DECL_LINK(decomposeBlockTextPrimitive, DrawPortionInfo* );
101*cdf0e10cSrcweir         DECL_LINK(decomposeStretchTextPrimitive, DrawPortionInfo* );
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir         DECL_LINK(decomposeContourBulletPrimitive, DrawBulletInfo* );
104*cdf0e10cSrcweir         DECL_LINK(decomposeBlockBulletPrimitive, DrawBulletInfo* );
105*cdf0e10cSrcweir         DECL_LINK(decomposeStretchBulletPrimitive, DrawBulletInfo* );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir         bool impIsUnderlineAbove(const Font& rFont) const;
108*cdf0e10cSrcweir         void impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo);
109*cdf0e10cSrcweir         drawinglayer::primitive2d::BasePrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const;
110*cdf0e10cSrcweir         void impFlushTextPortionPrimitivesToLinePrimitives();
111*cdf0e10cSrcweir         void impFlushLinePrimitivesToParagraphPrimitives();
112*cdf0e10cSrcweir         void impHandleDrawPortionInfo(const DrawPortionInfo& rInfo);
113*cdf0e10cSrcweir         void impHandleDrawBulletInfo(const DrawBulletInfo& rInfo);
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     public:
116*cdf0e10cSrcweir         impTextBreakupHandler(SdrOutliner& rOutliner)
117*cdf0e10cSrcweir         :   maTextPortionPrimitives(),
118*cdf0e10cSrcweir             maLinePrimitives(),
119*cdf0e10cSrcweir             maParagraphPrimitives(),
120*cdf0e10cSrcweir             mrOutliner(rOutliner),
121*cdf0e10cSrcweir             maNewTransformA(),
122*cdf0e10cSrcweir             maNewTransformB(),
123*cdf0e10cSrcweir             maScale(),
124*cdf0e10cSrcweir             maClipRange()
125*cdf0e10cSrcweir         {
126*cdf0e10cSrcweir         }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         void decomposeContourTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB, const basegfx::B2DVector& rScale)
129*cdf0e10cSrcweir         {
130*cdf0e10cSrcweir             maScale = rScale;
131*cdf0e10cSrcweir             maNewTransformA = rNewTransformA;
132*cdf0e10cSrcweir             maNewTransformB = rNewTransformB;
133*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeContourTextPrimitive));
134*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeContourBulletPrimitive));
135*cdf0e10cSrcweir             mrOutliner.StripPortions();
136*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(Link());
137*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(Link());
138*cdf0e10cSrcweir         }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir         void decomposeBlockTextPrimitive(
141*cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rNewTransformA,
142*cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rNewTransformB,
143*cdf0e10cSrcweir             const basegfx::B2DRange& rClipRange)
144*cdf0e10cSrcweir         {
145*cdf0e10cSrcweir             maNewTransformA = rNewTransformA;
146*cdf0e10cSrcweir             maNewTransformB = rNewTransformB;
147*cdf0e10cSrcweir             maClipRange = rClipRange;
148*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeBlockTextPrimitive));
149*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeBlockBulletPrimitive));
150*cdf0e10cSrcweir             mrOutliner.StripPortions();
151*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(Link());
152*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(Link());
153*cdf0e10cSrcweir         }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir         void decomposeStretchTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB)
156*cdf0e10cSrcweir         {
157*cdf0e10cSrcweir             maNewTransformA = rNewTransformA;
158*cdf0e10cSrcweir             maNewTransformB = rNewTransformB;
159*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeStretchTextPrimitive));
160*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeStretchBulletPrimitive));
161*cdf0e10cSrcweir             mrOutliner.StripPortions();
162*cdf0e10cSrcweir             mrOutliner.SetDrawPortionHdl(Link());
163*cdf0e10cSrcweir             mrOutliner.SetDrawBulletHdl(Link());
164*cdf0e10cSrcweir         }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir         drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence();
167*cdf0e10cSrcweir     };
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     bool impTextBreakupHandler::impIsUnderlineAbove(const Font& rFont) const
170*cdf0e10cSrcweir     {
171*cdf0e10cSrcweir         if(!rFont.IsVertical())
172*cdf0e10cSrcweir         {
173*cdf0e10cSrcweir             return false;
174*cdf0e10cSrcweir         }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir         if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()))
177*cdf0e10cSrcweir         {
178*cdf0e10cSrcweir             // the underline is right for Japanese only
179*cdf0e10cSrcweir             return true;
180*cdf0e10cSrcweir         }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir         return false;
183*cdf0e10cSrcweir     }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     void impTextBreakupHandler::impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo)
186*cdf0e10cSrcweir     {
187*cdf0e10cSrcweir         if(rInfo.mrText.Len() && rInfo.mnTextLen)
188*cdf0e10cSrcweir         {
189*cdf0e10cSrcweir             basegfx::B2DVector aFontScaling;
190*cdf0e10cSrcweir             drawinglayer::attribute::FontAttribute aFontAttribute(
191*cdf0e10cSrcweir                 drawinglayer::primitive2d::getFontAttributeFromVclFont(
192*cdf0e10cSrcweir                     aFontScaling,
193*cdf0e10cSrcweir                     rInfo.mrFont,
194*cdf0e10cSrcweir                     rInfo.IsRTL(),
195*cdf0e10cSrcweir                     false));
196*cdf0e10cSrcweir             basegfx::B2DHomMatrix aNewTransform;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir             // add font scale to new transform
199*cdf0e10cSrcweir             aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY());
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir             // look for proportional font scaling, evtl scale accordingly
202*cdf0e10cSrcweir             if(100 != rInfo.mrFont.GetPropr())
203*cdf0e10cSrcweir             {
204*cdf0e10cSrcweir                 const double fFactor(rInfo.mrFont.GetPropr() / 100.0);
205*cdf0e10cSrcweir                 aNewTransform.scale(fFactor, fFactor);
206*cdf0e10cSrcweir             }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir             // apply font rotate
209*cdf0e10cSrcweir             if(rInfo.mrFont.GetOrientation())
210*cdf0e10cSrcweir             {
211*cdf0e10cSrcweir                 aNewTransform.rotate(-rInfo.mrFont.GetOrientation() * F_PI1800);
212*cdf0e10cSrcweir             }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir             // look for escapement, evtl translate accordingly
215*cdf0e10cSrcweir             if(rInfo.mrFont.GetEscapement())
216*cdf0e10cSrcweir             {
217*cdf0e10cSrcweir                 sal_Int16 nEsc(rInfo.mrFont.GetEscapement());
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir                 if(DFLT_ESC_AUTO_SUPER == nEsc)
220*cdf0e10cSrcweir                 {
221*cdf0e10cSrcweir                     nEsc = 33;
222*cdf0e10cSrcweir                 }
223*cdf0e10cSrcweir                 else if(DFLT_ESC_AUTO_SUB == nEsc)
224*cdf0e10cSrcweir                 {
225*cdf0e10cSrcweir                     nEsc = -20;
226*cdf0e10cSrcweir                 }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir                 if(nEsc > 100)
229*cdf0e10cSrcweir                 {
230*cdf0e10cSrcweir                     nEsc = 100;
231*cdf0e10cSrcweir                 }
232*cdf0e10cSrcweir                 else if(nEsc < -100)
233*cdf0e10cSrcweir                 {
234*cdf0e10cSrcweir                     nEsc = -100;
235*cdf0e10cSrcweir                 }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir                 const double fEscapement(nEsc / -100.0);
238*cdf0e10cSrcweir                 aNewTransform.translate(0.0, fEscapement * aFontScaling.getY());
239*cdf0e10cSrcweir             }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir             // apply transformA
242*cdf0e10cSrcweir             aNewTransform *= maNewTransformA;
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir             // apply local offset
245*cdf0e10cSrcweir             aNewTransform.translate(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y());
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir             // also apply embedding object's transform
248*cdf0e10cSrcweir             aNewTransform *= maNewTransformB;
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir             // prepare DXArray content. To make it independent from font size (and such from
251*cdf0e10cSrcweir             // the text transformation), scale it to unit coordinates
252*cdf0e10cSrcweir             ::std::vector< double > aDXArray;
253*cdf0e10cSrcweir             static bool bDisableTextArray(false);
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir             if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen)
256*cdf0e10cSrcweir             {
257*cdf0e10cSrcweir                 aDXArray.reserve(rInfo.mnTextLen);
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir                 for(xub_StrLen a(0); a < rInfo.mnTextLen; a++)
260*cdf0e10cSrcweir                 {
261*cdf0e10cSrcweir                     aDXArray.push_back((double)rInfo.mpDXArray[a]);
262*cdf0e10cSrcweir                 }
263*cdf0e10cSrcweir             }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir             // create complex text primitive and append
266*cdf0e10cSrcweir             const Color aFontColor(rInfo.mrFont.GetColor());
267*cdf0e10cSrcweir             const basegfx::BColor aBFontColor(aFontColor.getBColor());
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir             // prepare wordLineMode (for underline and strikeout)
270*cdf0e10cSrcweir             // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
271*cdf0e10cSrcweir             // to be splitted which would not look like the original
272*cdf0e10cSrcweir             const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir             // prepare new primitive
275*cdf0e10cSrcweir             drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0;
276*cdf0e10cSrcweir             const bool bDecoratedIsNeeded(
277*cdf0e10cSrcweir                    UNDERLINE_NONE != rInfo.mrFont.GetOverline()
278*cdf0e10cSrcweir                 || UNDERLINE_NONE != rInfo.mrFont.GetUnderline()
279*cdf0e10cSrcweir                 || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout()
280*cdf0e10cSrcweir                 || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
281*cdf0e10cSrcweir                 || RELIEF_NONE != rInfo.mrFont.GetRelief()
282*cdf0e10cSrcweir                 || rInfo.mrFont.IsShadow()
283*cdf0e10cSrcweir                 || bWordLineMode);
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir             if(bDecoratedIsNeeded)
286*cdf0e10cSrcweir             {
287*cdf0e10cSrcweir                 // TextDecoratedPortionPrimitive2D needed, prepare some more data
288*cdf0e10cSrcweir                 // get overline and underline color. If it's on automatic (0xffffffff) use FontColor instead
289*cdf0e10cSrcweir                 const Color aUnderlineColor(rInfo.maTextLineColor);
290*cdf0e10cSrcweir                 const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor());
291*cdf0e10cSrcweir                 const Color aOverlineColor(rInfo.maOverlineColor);
292*cdf0e10cSrcweir                 const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor());
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir                 // prepare overline and underline data
295*cdf0e10cSrcweir                 const drawinglayer::primitive2d::TextLine eFontOverline(
296*cdf0e10cSrcweir                     drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetOverline()));
297*cdf0e10cSrcweir                 const drawinglayer::primitive2d::TextLine eFontUnderline(
298*cdf0e10cSrcweir                     drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetUnderline()));
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir                 // check UndelineAbove
301*cdf0e10cSrcweir                 const bool bUnderlineAbove(
302*cdf0e10cSrcweir                     drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont));
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir                 // prepare strikeout data
305*cdf0e10cSrcweir                 const drawinglayer::primitive2d::TextStrikeout eTextStrikeout(
306*cdf0e10cSrcweir                     drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout()));
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir                 // prepare emphasis mark data
309*cdf0e10cSrcweir                 drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE);
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir                 switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
312*cdf0e10cSrcweir                 {
313*cdf0e10cSrcweir                     case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break;
314*cdf0e10cSrcweir                     case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break;
315*cdf0e10cSrcweir                     case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break;
316*cdf0e10cSrcweir                     case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break;
317*cdf0e10cSrcweir                 }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir                 const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE);
320*cdf0e10cSrcweir                 const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW);
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir                 // prepare font relief data
323*cdf0e10cSrcweir                 drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE);
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir                 switch(rInfo.mrFont.GetRelief())
326*cdf0e10cSrcweir                 {
327*cdf0e10cSrcweir                     case RELIEF_EMBOSSED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break;
328*cdf0e10cSrcweir                     case RELIEF_ENGRAVED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break;
329*cdf0e10cSrcweir                     default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE
330*cdf0e10cSrcweir                 }
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir                 // prepare shadow/outline data
333*cdf0e10cSrcweir                 const bool bShadow(rInfo.mrFont.IsShadow());
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir                 // TextDecoratedPortionPrimitive2D is needed, create one
336*cdf0e10cSrcweir                 pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir                     // attributes for TextSimplePortionPrimitive2D
339*cdf0e10cSrcweir                     aNewTransform,
340*cdf0e10cSrcweir                     rInfo.mrText,
341*cdf0e10cSrcweir                     rInfo.mnTextStart,
342*cdf0e10cSrcweir                     rInfo.mnTextLen,
343*cdf0e10cSrcweir                     aDXArray,
344*cdf0e10cSrcweir                     aFontAttribute,
345*cdf0e10cSrcweir                     rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
346*cdf0e10cSrcweir                     aBFontColor,
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir                     // attributes for TextDecoratedPortionPrimitive2D
349*cdf0e10cSrcweir                     aBOverlineColor,
350*cdf0e10cSrcweir                     aBUnderlineColor,
351*cdf0e10cSrcweir                     eFontOverline,
352*cdf0e10cSrcweir                     eFontUnderline,
353*cdf0e10cSrcweir                     bUnderlineAbove,
354*cdf0e10cSrcweir                     eTextStrikeout,
355*cdf0e10cSrcweir                     bWordLineMode,
356*cdf0e10cSrcweir                     eTextEmphasisMark,
357*cdf0e10cSrcweir                     bEmphasisMarkAbove,
358*cdf0e10cSrcweir                     bEmphasisMarkBelow,
359*cdf0e10cSrcweir                     eTextRelief,
360*cdf0e10cSrcweir                     bShadow);
361*cdf0e10cSrcweir             }
362*cdf0e10cSrcweir             else
363*cdf0e10cSrcweir             {
364*cdf0e10cSrcweir                 // TextSimplePortionPrimitive2D is enough
365*cdf0e10cSrcweir                 pNewPrimitive = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
366*cdf0e10cSrcweir                     aNewTransform,
367*cdf0e10cSrcweir                     rInfo.mrText,
368*cdf0e10cSrcweir                     rInfo.mnTextStart,
369*cdf0e10cSrcweir                     rInfo.mnTextLen,
370*cdf0e10cSrcweir                     aDXArray,
371*cdf0e10cSrcweir                     aFontAttribute,
372*cdf0e10cSrcweir                     rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
373*cdf0e10cSrcweir                     aBFontColor);
374*cdf0e10cSrcweir             }
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir             if(rInfo.mbEndOfBullet)
377*cdf0e10cSrcweir             {
378*cdf0e10cSrcweir                 // embed in TextHierarchyBulletPrimitive2D
379*cdf0e10cSrcweir                 const drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
380*cdf0e10cSrcweir                 const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(&aNewReference, 1);
381*cdf0e10cSrcweir                 pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
382*cdf0e10cSrcweir             }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir             if(rInfo.mpFieldData)
385*cdf0e10cSrcweir             {
386*cdf0e10cSrcweir                 pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive, rInfo);
387*cdf0e10cSrcweir             }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir             maTextPortionPrimitives.push_back(pNewPrimitive);
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir             // support for WrongSpellVector. Create WrongSpellPrimitives as needed
392*cdf0e10cSrcweir             if(rInfo.mpWrongSpellVector && !aDXArray.empty())
393*cdf0e10cSrcweir             {
394*cdf0e10cSrcweir                 const sal_uInt32 nSize(rInfo.mpWrongSpellVector->size());
395*cdf0e10cSrcweir                 const sal_uInt32 nDXCount(aDXArray.size());
396*cdf0e10cSrcweir                 const basegfx::BColor aSpellColor(1.0, 0.0, 0.0); // red, hard coded
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir                 for(sal_uInt32 a(0); a < nSize; a++)
399*cdf0e10cSrcweir                 {
400*cdf0e10cSrcweir                     const EEngineData::WrongSpellClass& rCandidate = (*rInfo.mpWrongSpellVector)[a];
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir                     if(rCandidate.nStart >= rInfo.mnTextStart && rCandidate.nEnd >= rInfo.mnTextStart && rCandidate.nEnd > rCandidate.nStart)
403*cdf0e10cSrcweir                     {
404*cdf0e10cSrcweir                         const sal_uInt32 nStart(rCandidate.nStart - rInfo.mnTextStart);
405*cdf0e10cSrcweir                         const sal_uInt32 nEnd(rCandidate.nEnd - rInfo.mnTextStart);
406*cdf0e10cSrcweir                         double fStart(0.0);
407*cdf0e10cSrcweir                         double fEnd(0.0);
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir                         if(nStart > 0 && nStart - 1 < nDXCount)
410*cdf0e10cSrcweir                         {
411*cdf0e10cSrcweir                             fStart = aDXArray[nStart - 1];
412*cdf0e10cSrcweir                         }
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir                         if(nEnd > 0 && nEnd - 1 < nDXCount)
415*cdf0e10cSrcweir                         {
416*cdf0e10cSrcweir                             fEnd = aDXArray[nEnd - 1];
417*cdf0e10cSrcweir                         }
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir                         if(!basegfx::fTools::equal(fStart, fEnd))
420*cdf0e10cSrcweir                         {
421*cdf0e10cSrcweir                             if(rInfo.IsRTL())
422*cdf0e10cSrcweir                             {
423*cdf0e10cSrcweir                                 // #i98523#
424*cdf0e10cSrcweir                                 // When the portion is RTL, mirror the redlining using the
425*cdf0e10cSrcweir                                 // full portion width
426*cdf0e10cSrcweir                                 const double fTextWidth(aDXArray[aDXArray.size() - 1]);
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir                                 fStart = fTextWidth - fStart;
429*cdf0e10cSrcweir                                 fEnd = fTextWidth - fEnd;
430*cdf0e10cSrcweir                             }
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir                             // need to take FontScaling out of values; it's already part of
433*cdf0e10cSrcweir                             // aNewTransform and would be double applied
434*cdf0e10cSrcweir                             const double fFontScaleX(aFontScaling.getX());
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir                             if(!basegfx::fTools::equal(fFontScaleX, 1.0)
437*cdf0e10cSrcweir                                 && !basegfx::fTools::equalZero(fFontScaleX))
438*cdf0e10cSrcweir                             {
439*cdf0e10cSrcweir                                 fStart /= fFontScaleX;
440*cdf0e10cSrcweir                                 fEnd /= fFontScaleX;
441*cdf0e10cSrcweir                             }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir                             maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D(
444*cdf0e10cSrcweir                                 aNewTransform,
445*cdf0e10cSrcweir                                 fStart,
446*cdf0e10cSrcweir                                 fEnd,
447*cdf0e10cSrcweir                                 aSpellColor));
448*cdf0e10cSrcweir                         }
449*cdf0e10cSrcweir                     }
450*cdf0e10cSrcweir                 }
451*cdf0e10cSrcweir             }
452*cdf0e10cSrcweir         }
453*cdf0e10cSrcweir     }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir     drawinglayer::primitive2d::BasePrimitive2D* impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const
456*cdf0e10cSrcweir     {
457*cdf0e10cSrcweir         if(rInfo.mpFieldData)
458*cdf0e10cSrcweir         {
459*cdf0e10cSrcweir             // Support for FIELD_SEQ_BEGIN, FIELD_SEQ_END. If used, create a TextHierarchyFieldPrimitive2D
460*cdf0e10cSrcweir             // which holds the field type and evtl. the URL
461*cdf0e10cSrcweir             const SvxURLField* pURLField = dynamic_cast< const SvxURLField* >(rInfo.mpFieldData);
462*cdf0e10cSrcweir             const SvxPageField* pPageField = dynamic_cast< const SvxPageField* >(rInfo.mpFieldData);
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir             // embed current primitive to a sequence
465*cdf0e10cSrcweir             drawinglayer::primitive2d::Primitive2DSequence aSequence;
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir             if(pPrimitive)
468*cdf0e10cSrcweir             {
469*cdf0e10cSrcweir                 aSequence.realloc(1);
470*cdf0e10cSrcweir                 aSequence[0] = drawinglayer::primitive2d::Primitive2DReference(pPrimitive);
471*cdf0e10cSrcweir             }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir             if(pURLField)
474*cdf0e10cSrcweir             {
475*cdf0e10cSrcweir                 pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_URL, pURLField->GetURL());
476*cdf0e10cSrcweir             }
477*cdf0e10cSrcweir             else if(pPageField)
478*cdf0e10cSrcweir             {
479*cdf0e10cSrcweir                 pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_PAGE, String());
480*cdf0e10cSrcweir             }
481*cdf0e10cSrcweir             else
482*cdf0e10cSrcweir             {
483*cdf0e10cSrcweir                 pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_COMMON, String());
484*cdf0e10cSrcweir             }
485*cdf0e10cSrcweir         }
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir         return pPrimitive;
488*cdf0e10cSrcweir     }
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir     void impTextBreakupHandler::impFlushTextPortionPrimitivesToLinePrimitives()
491*cdf0e10cSrcweir     {
492*cdf0e10cSrcweir         // only create a line primitive when we had content; there is no need for
493*cdf0e10cSrcweir         // empty line primitives (contrary to paragraphs, see below).
494*cdf0e10cSrcweir         if(!maTextPortionPrimitives.empty())
495*cdf0e10cSrcweir         {
496*cdf0e10cSrcweir             drawinglayer::primitive2d::Primitive2DSequence aLineSequence(impConvertVectorToPrimitive2DSequence(maTextPortionPrimitives));
497*cdf0e10cSrcweir             maTextPortionPrimitives.clear();
498*cdf0e10cSrcweir             maLinePrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyLinePrimitive2D(aLineSequence));
499*cdf0e10cSrcweir         }
500*cdf0e10cSrcweir     }
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     void impTextBreakupHandler::impFlushLinePrimitivesToParagraphPrimitives()
503*cdf0e10cSrcweir     {
504*cdf0e10cSrcweir         // ALWAYS create a paragraph primitive, even when no content was added. This is done to
505*cdf0e10cSrcweir         // have the correct paragraph count even with empty paragraphs. Those paragraphs will
506*cdf0e10cSrcweir         // have an empty sub-PrimitiveSequence.
507*cdf0e10cSrcweir         drawinglayer::primitive2d::Primitive2DSequence aParagraphSequence(impConvertVectorToPrimitive2DSequence(maLinePrimitives));
508*cdf0e10cSrcweir         maLinePrimitives.clear();
509*cdf0e10cSrcweir         maParagraphPrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyParagraphPrimitive2D(aParagraphSequence));
510*cdf0e10cSrcweir     }
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir     void impTextBreakupHandler::impHandleDrawPortionInfo(const DrawPortionInfo& rInfo)
513*cdf0e10cSrcweir     {
514*cdf0e10cSrcweir         impCreateTextPortionPrimitive(rInfo);
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir         if(rInfo.mbEndOfLine || rInfo.mbEndOfParagraph)
517*cdf0e10cSrcweir         {
518*cdf0e10cSrcweir             impFlushTextPortionPrimitivesToLinePrimitives();
519*cdf0e10cSrcweir         }
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir         if(rInfo.mbEndOfParagraph)
522*cdf0e10cSrcweir         {
523*cdf0e10cSrcweir             impFlushLinePrimitivesToParagraphPrimitives();
524*cdf0e10cSrcweir         }
525*cdf0e10cSrcweir     }
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir     void impTextBreakupHandler::impHandleDrawBulletInfo(const DrawBulletInfo& rInfo)
528*cdf0e10cSrcweir     {
529*cdf0e10cSrcweir         basegfx::B2DHomMatrix aNewTransform;
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir         // add size to new transform
532*cdf0e10cSrcweir         aNewTransform.scale(rInfo.maBulletSize.getWidth(), rInfo.maBulletSize.getHeight());
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir         // apply transformA
535*cdf0e10cSrcweir         aNewTransform *= maNewTransformA;
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir         // apply local offset
538*cdf0e10cSrcweir         aNewTransform.translate(rInfo.maBulletPosition.X(), rInfo.maBulletPosition.Y());
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir         // also apply embedding object's transform
541*cdf0e10cSrcweir         aNewTransform *= maNewTransformB;
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir         // prepare empty GraphicAttr
544*cdf0e10cSrcweir         const GraphicAttr aGraphicAttr;
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir         // create GraphicPrimitive2D
547*cdf0e10cSrcweir         const drawinglayer::primitive2d::Primitive2DReference aNewReference(new drawinglayer::primitive2d::GraphicPrimitive2D(
548*cdf0e10cSrcweir             aNewTransform,
549*cdf0e10cSrcweir             rInfo.maBulletGraphicObject,
550*cdf0e10cSrcweir             aGraphicAttr));
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir         // embed in TextHierarchyBulletPrimitive2D
553*cdf0e10cSrcweir         const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(&aNewReference, 1);
554*cdf0e10cSrcweir         drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir         // add to output
557*cdf0e10cSrcweir         maTextPortionPrimitives.push_back(pNewPrimitive);
558*cdf0e10cSrcweir     }
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeContourTextPrimitive, DrawPortionInfo*, pInfo)
561*cdf0e10cSrcweir     {
562*cdf0e10cSrcweir         // for contour text, ignore (clip away) all portions which are below
563*cdf0e10cSrcweir         // the visible area given by maScale
564*cdf0e10cSrcweir         if(pInfo && (double)pInfo->mrStartPos.Y() < maScale.getY())
565*cdf0e10cSrcweir         {
566*cdf0e10cSrcweir             impHandleDrawPortionInfo(*pInfo);
567*cdf0e10cSrcweir         }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir         return 0;
570*cdf0e10cSrcweir     }
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeBlockTextPrimitive, DrawPortionInfo*, pInfo)
573*cdf0e10cSrcweir     {
574*cdf0e10cSrcweir         if(pInfo)
575*cdf0e10cSrcweir         {
576*cdf0e10cSrcweir             // #SJ# Is clipping wanted? This is text clipping; only accept a portion
577*cdf0e10cSrcweir             // if it's completely in the range
578*cdf0e10cSrcweir             if(!maClipRange.isEmpty())
579*cdf0e10cSrcweir             {
580*cdf0e10cSrcweir                 // Test start position first; this allows to not get the text range at
581*cdf0e10cSrcweir                 // all if text is far outside
582*cdf0e10cSrcweir                 const basegfx::B2DPoint aStartPosition(pInfo->mrStartPos.X(), pInfo->mrStartPos.Y());
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir                 if(!maClipRange.isInside(aStartPosition))
585*cdf0e10cSrcweir                 {
586*cdf0e10cSrcweir                     return 0;
587*cdf0e10cSrcweir                 }
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir                 // Start position is inside. Get TextBoundRect and TopLeft next
590*cdf0e10cSrcweir                 drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
591*cdf0e10cSrcweir                 aTextLayouterDevice.setFont(pInfo->mrFont);
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir                 const basegfx::B2DRange aTextBoundRect(
594*cdf0e10cSrcweir                     aTextLayouterDevice.getTextBoundRect(
595*cdf0e10cSrcweir                         pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextLen));
596*cdf0e10cSrcweir                 const basegfx::B2DPoint aTopLeft(aTextBoundRect.getMinimum() + aStartPosition);
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir                 if(!maClipRange.isInside(aTopLeft))
599*cdf0e10cSrcweir                 {
600*cdf0e10cSrcweir                     return 0;
601*cdf0e10cSrcweir                 }
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir                 // TopLeft is inside. Get BottomRight and check
604*cdf0e10cSrcweir                 const basegfx::B2DPoint aBottomRight(aTextBoundRect.getMaximum() + aStartPosition);
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir                 if(!maClipRange.isInside(aBottomRight))
607*cdf0e10cSrcweir                 {
608*cdf0e10cSrcweir                     return 0;
609*cdf0e10cSrcweir                 }
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir                 // all inside, clip was successful
612*cdf0e10cSrcweir             }
613*cdf0e10cSrcweir             impHandleDrawPortionInfo(*pInfo);
614*cdf0e10cSrcweir         }
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir         return 0;
617*cdf0e10cSrcweir     }
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeStretchTextPrimitive, DrawPortionInfo*, pInfo)
620*cdf0e10cSrcweir     {
621*cdf0e10cSrcweir         if(pInfo)
622*cdf0e10cSrcweir         {
623*cdf0e10cSrcweir             impHandleDrawPortionInfo(*pInfo);
624*cdf0e10cSrcweir         }
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir         return 0;
627*cdf0e10cSrcweir     }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeContourBulletPrimitive, DrawBulletInfo*, pInfo)
630*cdf0e10cSrcweir     {
631*cdf0e10cSrcweir         if(pInfo)
632*cdf0e10cSrcweir         {
633*cdf0e10cSrcweir             impHandleDrawBulletInfo(*pInfo);
634*cdf0e10cSrcweir         }
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir         return 0;
637*cdf0e10cSrcweir     }
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeBlockBulletPrimitive, DrawBulletInfo*, pInfo)
640*cdf0e10cSrcweir     {
641*cdf0e10cSrcweir         if(pInfo)
642*cdf0e10cSrcweir         {
643*cdf0e10cSrcweir             impHandleDrawBulletInfo(*pInfo);
644*cdf0e10cSrcweir         }
645*cdf0e10cSrcweir 
646*cdf0e10cSrcweir         return 0;
647*cdf0e10cSrcweir     }
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir     IMPL_LINK(impTextBreakupHandler, decomposeStretchBulletPrimitive, DrawBulletInfo*, pInfo)
650*cdf0e10cSrcweir     {
651*cdf0e10cSrcweir         if(pInfo)
652*cdf0e10cSrcweir         {
653*cdf0e10cSrcweir             impHandleDrawBulletInfo(*pInfo);
654*cdf0e10cSrcweir         }
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir         return 0;
657*cdf0e10cSrcweir     }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence impTextBreakupHandler::getPrimitive2DSequence()
660*cdf0e10cSrcweir     {
661*cdf0e10cSrcweir         if(!maTextPortionPrimitives.empty())
662*cdf0e10cSrcweir         {
663*cdf0e10cSrcweir             // collect non-closed lines
664*cdf0e10cSrcweir             impFlushTextPortionPrimitivesToLinePrimitives();
665*cdf0e10cSrcweir         }
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir         if(!maLinePrimitives.empty())
668*cdf0e10cSrcweir         {
669*cdf0e10cSrcweir             // collect non-closed paragraphs
670*cdf0e10cSrcweir             impFlushLinePrimitivesToParagraphPrimitives();
671*cdf0e10cSrcweir         }
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir         return impConvertVectorToPrimitive2DSequence(maParagraphPrimitives);
674*cdf0e10cSrcweir     }
675*cdf0e10cSrcweir } // end of anonymous namespace
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
678*cdf0e10cSrcweir // primitive decompositions
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir void SdrTextObj::impDecomposeContourTextPrimitive(
681*cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence& rTarget,
682*cdf0e10cSrcweir     const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive,
683*cdf0e10cSrcweir     const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
684*cdf0e10cSrcweir {
685*cdf0e10cSrcweir     // decompose matrix to have position and size of text
686*cdf0e10cSrcweir     basegfx::B2DVector aScale, aTranslate;
687*cdf0e10cSrcweir     double fRotate, fShearX;
688*cdf0e10cSrcweir     rSdrContourTextPrimitive.getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX);
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir     // prepare contour polygon, force to non-mirrored for layouting
691*cdf0e10cSrcweir     basegfx::B2DPolyPolygon aPolyPolygon(rSdrContourTextPrimitive.getUnitPolyPolygon());
692*cdf0e10cSrcweir     aPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(fabs(aScale.getX()), fabs(aScale.getY())));
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir     // prepare outliner
695*cdf0e10cSrcweir     SdrOutliner& rOutliner = ImpGetDrawOutliner();
696*cdf0e10cSrcweir     const Size aNullSize;
697*cdf0e10cSrcweir     rOutliner.SetPaperSize(aNullSize);
698*cdf0e10cSrcweir     rOutliner.SetPolygon(aPolyPolygon);
699*cdf0e10cSrcweir     rOutliner.SetUpdateMode(true);
700*cdf0e10cSrcweir     rOutliner.SetText(rSdrContourTextPrimitive.getOutlinerParaObject());
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir     // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
703*cdf0e10cSrcweir     rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir     // prepare matrices to apply to newly created primitives
706*cdf0e10cSrcweir     basegfx::B2DHomMatrix aNewTransformA;
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir     // mirroring. We are now in the polygon sizes. When mirroring in X and Y,
709*cdf0e10cSrcweir     // move the null point which was top left to bottom right.
710*cdf0e10cSrcweir     const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
711*cdf0e10cSrcweir     const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir     // in-between the translations of the single primitives will take place. Afterwards,
714*cdf0e10cSrcweir     // the object's transformations need to be applied
715*cdf0e10cSrcweir     const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
716*cdf0e10cSrcweir         bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
717*cdf0e10cSrcweir         fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir     // now break up text primitives.
720*cdf0e10cSrcweir     impTextBreakupHandler aConverter(rOutliner);
721*cdf0e10cSrcweir     aConverter.decomposeContourTextPrimitive(aNewTransformA, aNewTransformB, aScale);
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir     // cleanup outliner
724*cdf0e10cSrcweir     rOutliner.Clear();
725*cdf0e10cSrcweir     rOutliner.setVisualizedPage(0);
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir     rTarget = aConverter.getPrimitive2DSequence();
728*cdf0e10cSrcweir }
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir void SdrTextObj::impDecomposeBlockTextPrimitive(
731*cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence& rTarget,
732*cdf0e10cSrcweir     const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
733*cdf0e10cSrcweir     const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
734*cdf0e10cSrcweir {
735*cdf0e10cSrcweir     // decompose matrix to have position and size of text
736*cdf0e10cSrcweir     basegfx::B2DVector aScale, aTranslate;
737*cdf0e10cSrcweir     double fRotate, fShearX;
738*cdf0e10cSrcweir     rSdrBlockTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
739*cdf0e10cSrcweir 
740*cdf0e10cSrcweir     // use B2DRange aAnchorTextRange for calculations
741*cdf0e10cSrcweir     basegfx::B2DRange aAnchorTextRange(aTranslate);
742*cdf0e10cSrcweir     aAnchorTextRange.expand(aTranslate + aScale);
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir     // prepare outliner
745*cdf0e10cSrcweir     const bool bIsCell(rSdrBlockTextPrimitive.getCellText());
746*cdf0e10cSrcweir     SdrOutliner& rOutliner = ImpGetDrawOutliner();
747*cdf0e10cSrcweir     SdrTextHorzAdjust eHAdj = rSdrBlockTextPrimitive.getSdrTextHorzAdjust();
748*cdf0e10cSrcweir     SdrTextVertAdjust eVAdj = rSdrBlockTextPrimitive.getSdrTextVertAdjust();
749*cdf0e10cSrcweir     const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
750*cdf0e10cSrcweir     const Size aNullSize;
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir     // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
753*cdf0e10cSrcweir     rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
754*cdf0e10cSrcweir     rOutliner.SetFixedCellHeight(rSdrBlockTextPrimitive.isFixedCellHeight());
755*cdf0e10cSrcweir     rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE);
756*cdf0e10cSrcweir     rOutliner.SetMinAutoPaperSize(aNullSize);
757*cdf0e10cSrcweir     rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir     // add one to rage sizes to get back to the old Rectangle and outliner measurements
760*cdf0e10cSrcweir     const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
761*cdf0e10cSrcweir     const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
762*cdf0e10cSrcweir     const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical());
763*cdf0e10cSrcweir     const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir     if(bIsCell)
766*cdf0e10cSrcweir     {
767*cdf0e10cSrcweir         // cell text is formated neither like a text object nor like a object
768*cdf0e10cSrcweir         // text, so use a special setup here
769*cdf0e10cSrcweir         rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir         // #i106214# To work with an unchangeable PaperSize (CellSize in
772*cdf0e10cSrcweir         // this case) Set(Min|Max)AutoPaperSize and SetPaperSize have to be used.
773*cdf0e10cSrcweir         // #i106214# This was not completely correct; to still measure the real
774*cdf0e10cSrcweir         // text height to allow vertical adjust (and vice versa for VerticalWritintg)
775*cdf0e10cSrcweir         // only one aspect has to be set, but the other one to zero
776*cdf0e10cSrcweir         if(bVerticalWritintg)
777*cdf0e10cSrcweir         {
778*cdf0e10cSrcweir             // measure the horizontal text size
779*cdf0e10cSrcweir             rOutliner.SetMinAutoPaperSize(Size(0, aAnchorTextSize.Height()));
780*cdf0e10cSrcweir         }
781*cdf0e10cSrcweir         else
782*cdf0e10cSrcweir         {
783*cdf0e10cSrcweir             // measure the vertical text size
784*cdf0e10cSrcweir             rOutliner.SetMinAutoPaperSize(Size(aAnchorTextSize.Width(), 0));
785*cdf0e10cSrcweir         }
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir         rOutliner.SetPaperSize(aAnchorTextSize);
788*cdf0e10cSrcweir         rOutliner.SetUpdateMode(true);
789*cdf0e10cSrcweir         rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
790*cdf0e10cSrcweir     }
791*cdf0e10cSrcweir     else
792*cdf0e10cSrcweir     {
793*cdf0e10cSrcweir         // check if block text is used (only one of them can be true)
794*cdf0e10cSrcweir         const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg);
795*cdf0e10cSrcweir         const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg);
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir         // set minimal paper size hor/ver if needed
798*cdf0e10cSrcweir         if(bHorizontalIsBlock)
799*cdf0e10cSrcweir         {
800*cdf0e10cSrcweir             rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
801*cdf0e10cSrcweir         }
802*cdf0e10cSrcweir         else if(bVerticalIsBlock)
803*cdf0e10cSrcweir         {
804*cdf0e10cSrcweir             rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
805*cdf0e10cSrcweir         }
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir         if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
808*cdf0e10cSrcweir         {
809*cdf0e10cSrcweir             // #i103454# maximal paper size hor/ver needs to be limited to text
810*cdf0e10cSrcweir             // frame size. If it's block text, still allow the 'other' direction
811*cdf0e10cSrcweir             // to grow to get a correct real text size when using GetPaperSize().
812*cdf0e10cSrcweir             // When just using aAnchorTextSize as maximum, GetPaperSize()
813*cdf0e10cSrcweir             // would just return aAnchorTextSize again: this means, the wanted
814*cdf0e10cSrcweir             // 'measurement' of the real size of block text would not work
815*cdf0e10cSrcweir             Size aMaxAutoPaperSize(aAnchorTextSize);
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir             if(bHorizontalIsBlock)
818*cdf0e10cSrcweir             {
819*cdf0e10cSrcweir                 // allow to grow vertical for horizontal blocks
820*cdf0e10cSrcweir                 aMaxAutoPaperSize.setHeight(1000000);
821*cdf0e10cSrcweir             }
822*cdf0e10cSrcweir             else if(bVerticalIsBlock)
823*cdf0e10cSrcweir             {
824*cdf0e10cSrcweir                 // allow to grow horizontal for vertical blocks
825*cdf0e10cSrcweir                 aMaxAutoPaperSize.setWidth(1000000);
826*cdf0e10cSrcweir             }
827*cdf0e10cSrcweir 
828*cdf0e10cSrcweir             rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize);
829*cdf0e10cSrcweir         }
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir         rOutliner.SetPaperSize(aNullSize);
832*cdf0e10cSrcweir         rOutliner.SetUpdateMode(true);
833*cdf0e10cSrcweir         rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
834*cdf0e10cSrcweir     }
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir     rOutliner.SetControlWord(nOriginalControlWord);
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir     // now get back the layouted text size from outliner
839*cdf0e10cSrcweir     const Size aOutlinerTextSiz(rOutliner.GetPaperSize());
840*cdf0e10cSrcweir     const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height());
841*cdf0e10cSrcweir     basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir     // For draw objects containing text correct hor/ver alignment if text is bigger
844*cdf0e10cSrcweir     // than the object itself. Without that correction, the text would always be
845*cdf0e10cSrcweir     // formatted to the left edge (or top edge when vertical) of the draw object.
846*cdf0e10cSrcweir     if(!IsTextFrame() && !bIsCell)
847*cdf0e10cSrcweir     {
848*cdf0e10cSrcweir         if(aAnchorTextRange.getWidth() < aOutlinerScale.getX() && !bVerticalWritintg)
849*cdf0e10cSrcweir         {
850*cdf0e10cSrcweir             // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
851*cdf0e10cSrcweir             // else the alignment is wanted.
852*cdf0e10cSrcweir             if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
853*cdf0e10cSrcweir             {
854*cdf0e10cSrcweir                 eHAdj = SDRTEXTHORZADJUST_CENTER;
855*cdf0e10cSrcweir             }
856*cdf0e10cSrcweir         }
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir         if(aAnchorTextRange.getHeight() < aOutlinerScale.getY() && bVerticalWritintg)
859*cdf0e10cSrcweir         {
860*cdf0e10cSrcweir             // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
861*cdf0e10cSrcweir             // else the alignment is wanted.
862*cdf0e10cSrcweir             if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
863*cdf0e10cSrcweir             {
864*cdf0e10cSrcweir                 eVAdj = SDRTEXTVERTADJUST_CENTER;
865*cdf0e10cSrcweir             }
866*cdf0e10cSrcweir         }
867*cdf0e10cSrcweir     }
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir     // correct horizontal translation using the now known text size
870*cdf0e10cSrcweir     if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
871*cdf0e10cSrcweir     {
872*cdf0e10cSrcweir         const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir         if(SDRTEXTHORZADJUST_CENTER == eHAdj)
875*cdf0e10cSrcweir         {
876*cdf0e10cSrcweir             aAdjustTranslate.setX(fFree / 2.0);
877*cdf0e10cSrcweir         }
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir         if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
880*cdf0e10cSrcweir         {
881*cdf0e10cSrcweir             aAdjustTranslate.setX(fFree);
882*cdf0e10cSrcweir         }
883*cdf0e10cSrcweir     }
884*cdf0e10cSrcweir 
885*cdf0e10cSrcweir     // correct vertical translation using the now known text size
886*cdf0e10cSrcweir     if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
887*cdf0e10cSrcweir     {
888*cdf0e10cSrcweir         const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir         if(SDRTEXTVERTADJUST_CENTER == eVAdj)
891*cdf0e10cSrcweir         {
892*cdf0e10cSrcweir             aAdjustTranslate.setY(fFree / 2.0);
893*cdf0e10cSrcweir         }
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir         if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
896*cdf0e10cSrcweir         {
897*cdf0e10cSrcweir             aAdjustTranslate.setY(fFree);
898*cdf0e10cSrcweir         }
899*cdf0e10cSrcweir     }
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir     // prepare matrices to apply to newly created primitives. aNewTransformA
902*cdf0e10cSrcweir     // will get coordinates in aOutlinerScale size and positive in X, Y.
903*cdf0e10cSrcweir     // Translate relative to given primitive to get same rotation and shear
904*cdf0e10cSrcweir     // as the master shape we are working on. For vertical, use the top-right
905*cdf0e10cSrcweir     // corner
906*cdf0e10cSrcweir     const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
907*cdf0e10cSrcweir     const basegfx::B2DTuple aAdjOffset(fStartInX, aAdjustTranslate.getY());
908*cdf0e10cSrcweir     basegfx::B2DHomMatrix aNewTransformA(basegfx::tools::createTranslateB2DHomMatrix(aAdjOffset.getX(), aAdjOffset.getY()));
909*cdf0e10cSrcweir 
910*cdf0e10cSrcweir     // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
911*cdf0e10cSrcweir     // move the null point which was top left to bottom right.
912*cdf0e10cSrcweir     const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
913*cdf0e10cSrcweir     const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir     // in-between the translations of the single primitives will take place. Afterwards,
916*cdf0e10cSrcweir     // the object's transformations need to be applied
917*cdf0e10cSrcweir     const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
918*cdf0e10cSrcweir         bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
919*cdf0e10cSrcweir         fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir     // #SJ# create ClipRange (if needed)
922*cdf0e10cSrcweir     basegfx::B2DRange aClipRange;
923*cdf0e10cSrcweir 
924*cdf0e10cSrcweir     if(rSdrBlockTextPrimitive.getClipOnBounds())
925*cdf0e10cSrcweir     {
926*cdf0e10cSrcweir         aClipRange.expand(-aAdjOffset);
927*cdf0e10cSrcweir         aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset);
928*cdf0e10cSrcweir     }
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir     // now break up text primitives.
931*cdf0e10cSrcweir     impTextBreakupHandler aConverter(rOutliner);
932*cdf0e10cSrcweir     aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB, aClipRange);
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir     // cleanup outliner
935*cdf0e10cSrcweir     rOutliner.Clear();
936*cdf0e10cSrcweir     rOutliner.setVisualizedPage(0);
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir     rTarget = aConverter.getPrimitive2DSequence();
939*cdf0e10cSrcweir }
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir void SdrTextObj::impDecomposeStretchTextPrimitive(
942*cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence& rTarget,
943*cdf0e10cSrcweir     const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
944*cdf0e10cSrcweir     const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
945*cdf0e10cSrcweir {
946*cdf0e10cSrcweir     // decompose matrix to have position and size of text
947*cdf0e10cSrcweir     basegfx::B2DVector aScale, aTranslate;
948*cdf0e10cSrcweir     double fRotate, fShearX;
949*cdf0e10cSrcweir     rSdrStretchTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir     // use non-mirrored B2DRange aAnchorTextRange for calculations
952*cdf0e10cSrcweir     basegfx::B2DRange aAnchorTextRange(aTranslate);
953*cdf0e10cSrcweir     aAnchorTextRange.expand(aTranslate + aScale);
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir     // prepare outliner
956*cdf0e10cSrcweir     SdrOutliner& rOutliner = ImpGetDrawOutliner();
957*cdf0e10cSrcweir     const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
958*cdf0e10cSrcweir     const Size aNullSize;
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir     rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE);
961*cdf0e10cSrcweir     rOutliner.SetFixedCellHeight(rSdrStretchTextPrimitive.isFixedCellHeight());
962*cdf0e10cSrcweir     rOutliner.SetMinAutoPaperSize(aNullSize);
963*cdf0e10cSrcweir     rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
964*cdf0e10cSrcweir     rOutliner.SetPaperSize(aNullSize);
965*cdf0e10cSrcweir     rOutliner.SetUpdateMode(true);
966*cdf0e10cSrcweir     rOutliner.SetText(rSdrStretchTextPrimitive.getOutlinerParaObject());
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir     // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
969*cdf0e10cSrcweir     rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir     // now get back the layouted text size from outliner
972*cdf0e10cSrcweir     const Size aOutlinerTextSiz(rOutliner.CalcTextSize());
973*cdf0e10cSrcweir     const basegfx::B2DVector aOutlinerScale(
974*cdf0e10cSrcweir         basegfx::fTools::equalZero(aOutlinerTextSiz.Width()) ? 1.0 : aOutlinerTextSiz.Width(),
975*cdf0e10cSrcweir         basegfx::fTools::equalZero(aOutlinerTextSiz.Height()) ? 1.0 : aOutlinerTextSiz.Height());
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir     // prepare matrices to apply to newly created primitives
978*cdf0e10cSrcweir     basegfx::B2DHomMatrix aNewTransformA;
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir     // #i101957# Check for vertical text. If used, aNewTransformA
981*cdf0e10cSrcweir     // needs to translate the text initially around object width to orient
982*cdf0e10cSrcweir     // it relative to the topper right instead of the topper left
983*cdf0e10cSrcweir     const bool bVertical(rSdrStretchTextPrimitive.getOutlinerParaObject().IsVertical());
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir     if(bVertical)
986*cdf0e10cSrcweir     {
987*cdf0e10cSrcweir         aNewTransformA.translate(aScale.getX(), 0.0);
988*cdf0e10cSrcweir     }
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir     // calculate global char stretching scale parameters. Use non-mirrored sizes
991*cdf0e10cSrcweir     // to layout without mirroring
992*cdf0e10cSrcweir     const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
993*cdf0e10cSrcweir     const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
994*cdf0e10cSrcweir     rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir     // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
997*cdf0e10cSrcweir     // move the null point which was top left to bottom right.
998*cdf0e10cSrcweir     const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
999*cdf0e10cSrcweir     const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir     // in-between the translations of the single primitives will take place. Afterwards,
1002*cdf0e10cSrcweir     // the object's transformations need to be applied
1003*cdf0e10cSrcweir     const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
1004*cdf0e10cSrcweir         bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
1005*cdf0e10cSrcweir         fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir     // now break up text primitives.
1008*cdf0e10cSrcweir     impTextBreakupHandler aConverter(rOutliner);
1009*cdf0e10cSrcweir     aConverter.decomposeStretchTextPrimitive(aNewTransformA, aNewTransformB);
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir     // cleanup outliner
1012*cdf0e10cSrcweir     rOutliner.SetControlWord(nOriginalControlWord);
1013*cdf0e10cSrcweir     rOutliner.Clear();
1014*cdf0e10cSrcweir     rOutliner.setVisualizedPage(0);
1015*cdf0e10cSrcweir 
1016*cdf0e10cSrcweir     rTarget = aConverter.getPrimitive2DSequence();
1017*cdf0e10cSrcweir }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1020*cdf0e10cSrcweir // timing generators
1021*cdf0e10cSrcweir #define ENDLESS_LOOP    (0xffffffff)
1022*cdf0e10cSrcweir #define ENDLESS_TIME    ((double)0xffffffff)
1023*cdf0e10cSrcweir #define PIXEL_DPI       (96.0)
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
1026*cdf0e10cSrcweir {
1027*cdf0e10cSrcweir     if(SDRTEXTANI_BLINK == GetTextAniKind())
1028*cdf0e10cSrcweir     {
1029*cdf0e10cSrcweir         // get values
1030*cdf0e10cSrcweir         const SfxItemSet& rSet = GetObjectItemSet();
1031*cdf0e10cSrcweir         const sal_uInt32 nRepeat((sal_uInt32)((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
1032*cdf0e10cSrcweir         bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
1033*cdf0e10cSrcweir         double fDelay((double)((SdrTextAniDelayItem&)rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
1034*cdf0e10cSrcweir 
1035*cdf0e10cSrcweir         if(0.0 == fDelay)
1036*cdf0e10cSrcweir         {
1037*cdf0e10cSrcweir             // use default
1038*cdf0e10cSrcweir             fDelay = 250.0;
1039*cdf0e10cSrcweir         }
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir         // prepare loop and add
1042*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLoop  aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
1043*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryFixed aStart(fDelay, 0.0);
1044*cdf0e10cSrcweir         aLoop.append(aStart);
1045*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryFixed aEnd(fDelay, 1.0);
1046*cdf0e10cSrcweir         aLoop.append(aEnd);
1047*cdf0e10cSrcweir         rAnimList.append(aLoop);
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir         // add stopped state if loop is not endless
1050*cdf0e10cSrcweir         if(0L != nRepeat)
1051*cdf0e10cSrcweir         {
1052*cdf0e10cSrcweir             drawinglayer::animation::AnimationEntryFixed aStop(ENDLESS_TIME, bVisisbleWhenStopped ? 0.0 : 1.0);
1053*cdf0e10cSrcweir             rAnimList.append(aStop);
1054*cdf0e10cSrcweir         }
1055*cdf0e10cSrcweir     }
1056*cdf0e10cSrcweir }
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir void impCreateScrollTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, bool bForward, double fTimeFullPath, double fFrequency)
1059*cdf0e10cSrcweir {
1060*cdf0e10cSrcweir     bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
1061*cdf0e10cSrcweir     bool bVisisbleWhenStarted(((SdrTextAniStartInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE )).GetValue());
1062*cdf0e10cSrcweir     const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir     if(bVisisbleWhenStarted)
1065*cdf0e10cSrcweir     {
1066*cdf0e10cSrcweir         // move from center to outside
1067*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aInOut(fTimeFullPath * 0.5, fFrequency, 0.5, bForward ? 1.0 : 0.0);
1068*cdf0e10cSrcweir         rAnimList.append(aInOut);
1069*cdf0e10cSrcweir     }
1070*cdf0e10cSrcweir 
1071*cdf0e10cSrcweir     // loop. In loop, move through
1072*cdf0e10cSrcweir     if(nRepeat || 0L == nRepeat)
1073*cdf0e10cSrcweir     {
1074*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
1075*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aThrough(fTimeFullPath, fFrequency, bForward ? 0.0 : 1.0, bForward ? 1.0 : 0.0);
1076*cdf0e10cSrcweir         aLoop.append(aThrough);
1077*cdf0e10cSrcweir         rAnimList.append(aLoop);
1078*cdf0e10cSrcweir     }
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir     if(0L != nRepeat && bVisisbleWhenStopped)
1081*cdf0e10cSrcweir     {
1082*cdf0e10cSrcweir         // move from outside to center
1083*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, bForward ? 0.0 : 1.0, 0.5);
1084*cdf0e10cSrcweir         rAnimList.append(aOutIn);
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir         // add timing for staying at the end
1087*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
1088*cdf0e10cSrcweir         rAnimList.append(aEnd);
1089*cdf0e10cSrcweir     }
1090*cdf0e10cSrcweir }
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir void impCreateAlternateTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, double fRelativeTextLength, bool bForward, double fTimeFullPath, double fFrequency)
1093*cdf0e10cSrcweir {
1094*cdf0e10cSrcweir     if(basegfx::fTools::more(fRelativeTextLength, 0.5))
1095*cdf0e10cSrcweir     {
1096*cdf0e10cSrcweir         // this is the case when fTextLength > fFrameLength, text is bigger than animation frame.
1097*cdf0e10cSrcweir         // In that case, correct direction
1098*cdf0e10cSrcweir         bForward = !bForward;
1099*cdf0e10cSrcweir     }
1100*cdf0e10cSrcweir 
1101*cdf0e10cSrcweir     const double fStartPosition(bForward ? fRelativeTextLength : 1.0 - fRelativeTextLength);
1102*cdf0e10cSrcweir     const double fEndPosition(bForward ? 1.0 - fRelativeTextLength : fRelativeTextLength);
1103*cdf0e10cSrcweir     bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
1104*cdf0e10cSrcweir     bool bVisisbleWhenStarted(((SdrTextAniStartInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE )).GetValue());
1105*cdf0e10cSrcweir     const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir     if(!bVisisbleWhenStarted)
1108*cdf0e10cSrcweir     {
1109*cdf0e10cSrcweir         // move from outside to center
1110*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, bForward ? 0.0 : 1.0, 0.5);
1111*cdf0e10cSrcweir         rAnimList.append(aOutIn);
1112*cdf0e10cSrcweir     }
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir     // loop. In loop, move out and in again. fInnerMovePath may be negative when text is bigger then frame,
1115*cdf0e10cSrcweir     // so use absolute value
1116*cdf0e10cSrcweir     const double fInnerMovePath(fabs(1.0 - (fRelativeTextLength * 2.0)));
1117*cdf0e10cSrcweir     const double fTimeForInnerPath(fTimeFullPath * fInnerMovePath);
1118*cdf0e10cSrcweir     const double fHalfInnerPath(fTimeForInnerPath * 0.5);
1119*cdf0e10cSrcweir     const sal_uInt32 nDoubleRepeat(nRepeat / 2L);
1120*cdf0e10cSrcweir 
1121*cdf0e10cSrcweir     if(nDoubleRepeat || 0L == nRepeat)
1122*cdf0e10cSrcweir     {
1123*cdf0e10cSrcweir         // double forth and back loop
1124*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLoop aLoop(nDoubleRepeat ? nDoubleRepeat : ENDLESS_LOOP);
1125*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime0(fHalfInnerPath, fFrequency, 0.5, fEndPosition);
1126*cdf0e10cSrcweir         aLoop.append(aTime0);
1127*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime1(fTimeForInnerPath, fFrequency, fEndPosition, fStartPosition);
1128*cdf0e10cSrcweir         aLoop.append(aTime1);
1129*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime2(fHalfInnerPath, fFrequency, fStartPosition, 0.5);
1130*cdf0e10cSrcweir         aLoop.append(aTime2);
1131*cdf0e10cSrcweir         rAnimList.append(aLoop);
1132*cdf0e10cSrcweir     }
1133*cdf0e10cSrcweir 
1134*cdf0e10cSrcweir     if(nRepeat % 2L)
1135*cdf0e10cSrcweir     {
1136*cdf0e10cSrcweir         // repeat is uneven, so we need one more forth and back to center
1137*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime0(fHalfInnerPath, fFrequency, 0.5, fEndPosition);
1138*cdf0e10cSrcweir         rAnimList.append(aTime0);
1139*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime1(fHalfInnerPath, fFrequency, fEndPosition, 0.5);
1140*cdf0e10cSrcweir         rAnimList.append(aTime1);
1141*cdf0e10cSrcweir     }
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir     if(0L != nRepeat)
1144*cdf0e10cSrcweir     {
1145*cdf0e10cSrcweir         if(bVisisbleWhenStopped)
1146*cdf0e10cSrcweir         {
1147*cdf0e10cSrcweir             // add timing for staying at the end
1148*cdf0e10cSrcweir             drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
1149*cdf0e10cSrcweir             rAnimList.append(aEnd);
1150*cdf0e10cSrcweir         }
1151*cdf0e10cSrcweir         else
1152*cdf0e10cSrcweir         {
1153*cdf0e10cSrcweir             // move from center to outside
1154*cdf0e10cSrcweir             drawinglayer::animation::AnimationEntryLinear aInOut(fTimeFullPath * 0.5, fFrequency, 0.5, bForward ? 1.0 : 0.0);
1155*cdf0e10cSrcweir             rAnimList.append(aInOut);
1156*cdf0e10cSrcweir         }
1157*cdf0e10cSrcweir     }
1158*cdf0e10cSrcweir }
1159*cdf0e10cSrcweir 
1160*cdf0e10cSrcweir void impCreateSlideTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, bool bForward, double fTimeFullPath, double fFrequency)
1161*cdf0e10cSrcweir {
1162*cdf0e10cSrcweir     // move in from outside, start outside
1163*cdf0e10cSrcweir     const double fStartPosition(bForward ? 0.0 : 1.0);
1164*cdf0e10cSrcweir     const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir     // move from outside to center
1167*cdf0e10cSrcweir     drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, fStartPosition, 0.5);
1168*cdf0e10cSrcweir     rAnimList.append(aOutIn);
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir     // loop. In loop, move out and in again
1171*cdf0e10cSrcweir     if(nRepeat > 1L || 0L == nRepeat)
1172*cdf0e10cSrcweir     {
1173*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat - 1L : ENDLESS_LOOP);
1174*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime0(fTimeFullPath * 0.5, fFrequency, 0.5, fStartPosition);
1175*cdf0e10cSrcweir         aLoop.append(aTime0);
1176*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryLinear aTime1(fTimeFullPath * 0.5, fFrequency, fStartPosition, 0.5);
1177*cdf0e10cSrcweir         aLoop.append(aTime1);
1178*cdf0e10cSrcweir         rAnimList.append(aLoop);
1179*cdf0e10cSrcweir     }
1180*cdf0e10cSrcweir 
1181*cdf0e10cSrcweir     // always visible when stopped, so add timing for staying at the end when not endless
1182*cdf0e10cSrcweir     if(0L != nRepeat)
1183*cdf0e10cSrcweir     {
1184*cdf0e10cSrcweir         drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
1185*cdf0e10cSrcweir         rAnimList.append(aEnd);
1186*cdf0e10cSrcweir     }
1187*cdf0e10cSrcweir }
1188*cdf0e10cSrcweir 
1189*cdf0e10cSrcweir void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const
1190*cdf0e10cSrcweir {
1191*cdf0e10cSrcweir     const SdrTextAniKind eAniKind(GetTextAniKind());
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir     if(SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind)
1194*cdf0e10cSrcweir     {
1195*cdf0e10cSrcweir         // get data. Goal is to calculate fTimeFullPath which is the time needed to
1196*cdf0e10cSrcweir         // move animation from (0.0) to (1.0) state
1197*cdf0e10cSrcweir         const SfxItemSet& rSet = GetObjectItemSet();
1198*cdf0e10cSrcweir         double fAnimationDelay((double)((SdrTextAniDelayItem&)rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
1199*cdf0e10cSrcweir         double fSingleStepWidth((double)((SdrTextAniAmountItem&)rSet.Get(SDRATTR_TEXT_ANIAMOUNT)).GetValue());
1200*cdf0e10cSrcweir         const SdrTextAniDirection eDirection(GetTextAniDirection());
1201*cdf0e10cSrcweir         const bool bForward(SDRTEXTANI_RIGHT == eDirection || SDRTEXTANI_DOWN == eDirection);
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir         if(basegfx::fTools::equalZero(fAnimationDelay))
1204*cdf0e10cSrcweir         {
1205*cdf0e10cSrcweir             // default to 1/20 second
1206*cdf0e10cSrcweir             fAnimationDelay = 50.0;
1207*cdf0e10cSrcweir         }
1208*cdf0e10cSrcweir 
1209*cdf0e10cSrcweir         if(basegfx::fTools::less(fSingleStepWidth, 0.0))
1210*cdf0e10cSrcweir         {
1211*cdf0e10cSrcweir             // data is in pixels, convert to logic. Imply PIXEL_DPI dpi.
1212*cdf0e10cSrcweir             // It makes no sense to keep the view-transformation centered
1213*cdf0e10cSrcweir             // definitions, so get rid of them here.
1214*cdf0e10cSrcweir             fSingleStepWidth = (-fSingleStepWidth * (2540.0 / PIXEL_DPI));
1215*cdf0e10cSrcweir         }
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir         if(basegfx::fTools::equalZero(fSingleStepWidth))
1218*cdf0e10cSrcweir         {
1219*cdf0e10cSrcweir             // default to 1 milimeter
1220*cdf0e10cSrcweir             fSingleStepWidth = 100.0;
1221*cdf0e10cSrcweir         }
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir         // use the length of the full animation path and the number of steps
1224*cdf0e10cSrcweir         // to get the full path time
1225*cdf0e10cSrcweir         const double fFullPathLength(fFrameLength + fTextLength);
1226*cdf0e10cSrcweir         const double fNumberOfSteps(fFullPathLength / fSingleStepWidth);
1227*cdf0e10cSrcweir         double fTimeFullPath(fNumberOfSteps * fAnimationDelay);
1228*cdf0e10cSrcweir 
1229*cdf0e10cSrcweir         if(fTimeFullPath < fAnimationDelay)
1230*cdf0e10cSrcweir         {
1231*cdf0e10cSrcweir             fTimeFullPath = fAnimationDelay;
1232*cdf0e10cSrcweir         }
1233*cdf0e10cSrcweir 
1234*cdf0e10cSrcweir         switch(eAniKind)
1235*cdf0e10cSrcweir         {
1236*cdf0e10cSrcweir             case SDRTEXTANI_SCROLL :
1237*cdf0e10cSrcweir             {
1238*cdf0e10cSrcweir                 impCreateScrollTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
1239*cdf0e10cSrcweir                 break;
1240*cdf0e10cSrcweir             }
1241*cdf0e10cSrcweir             case SDRTEXTANI_ALTERNATE :
1242*cdf0e10cSrcweir             {
1243*cdf0e10cSrcweir                 double fRelativeTextLength(fTextLength / (fFrameLength + fTextLength));
1244*cdf0e10cSrcweir                 impCreateAlternateTiming(rSet, rAnimList, fRelativeTextLength, bForward, fTimeFullPath, fAnimationDelay);
1245*cdf0e10cSrcweir                 break;
1246*cdf0e10cSrcweir             }
1247*cdf0e10cSrcweir             case SDRTEXTANI_SLIDE :
1248*cdf0e10cSrcweir             {
1249*cdf0e10cSrcweir                 impCreateSlideTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
1250*cdf0e10cSrcweir                 break;
1251*cdf0e10cSrcweir             }
1252*cdf0e10cSrcweir             default : break; // SDRTEXTANI_NONE, SDRTEXTANI_BLINK
1253*cdf0e10cSrcweir         }
1254*cdf0e10cSrcweir     }
1255*cdf0e10cSrcweir }
1256*cdf0e10cSrcweir 
1257*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1258*cdf0e10cSrcweir // eof
1259