1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdtxhdl.cxx,v $
* $Revision: 1.27 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include "svdtxhdl.hxx"
#include <limits.h>
#include "svditext.hxx"
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdotext.hxx>
#include "svdxout.hxx"
#include <svx/svdoutl.hxx>
#include <svx/outliner.hxx>
#include <svx/outlobj.hxx>
#include <svx/svxfont.hxx>
#include <svx/xlnclit.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/xflclit.hxx>
#include <vcl/metric.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
#endif
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <comphelper/processfactory.hxx>
#ifndef _COM_SUN_STAR_I18N_CHARACTERITERATORMODE_HDL_
#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
#endif
#include "unolingu.hxx"
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n;
////////////////////////////////////////////////////////////////////////////////////////////////////
ImpTextPortionHandler::ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj):
rOutliner(rOutln),
rTextObj(rTxtObj),
mpRecordPortions(0L)
{
pModel=rTextObj.GetModel();
MapMode aMap=aVDev.GetMapMode();
aMap.SetMapUnit(pModel->GetScaleUnit());
aMap.SetScaleX(pModel->GetScaleFraction());
aMap.SetScaleY(pModel->GetScaleFraction());
aVDev.SetMapMode(aMap);
}
void ImpTextPortionHandler::ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bPoly)
{
bToPoly=bPoly;
pGroup=&rGroup;
Rectangle aAnchorRect;
Rectangle aTextRect;
SdrFitToSizeType eFit=rTextObj.GetFitToSize();
FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
// Bei TakeTextRect wird u.a. auch der Text in
// den Outliner gesteckt
rTextObj.TakeTextRect(rOutliner,aTextRect,FALSE,&aAnchorRect);
aFormTextBoundRect=aTextRect; // Missbrauch von FormTextBoundRect
if (bFitToSize) aFormTextBoundRect=aAnchorRect;
rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,ConvertHdl));
rOutliner.StripPortions();
rOutliner.SetDrawPortionHdl(Link());
rOutliner.Clear();
if(bFitToSize)
{
Fraction nX(aAnchorRect.Right()-aAnchorRect.Left(),aTextRect.Right()-aTextRect.Left());
Fraction nY(aAnchorRect.Bottom()-aAnchorRect.Top(),aTextRect.Bottom()-aTextRect.Top());
// #95395# scale from top-right when vertical text
if(rOutliner.IsVertical())
pGroup->NbcResize(aAnchorRect.TopRight(),nX,nY);
else
pGroup->NbcResize(aAnchorRect.TopLeft(),nX,nY);
}
if (rTextObj.aGeo.nDrehWink!=0) { // #35825# Rotieren erst nach Resize (wg. FitToSize)
pGroup->NbcRotate(aFormTextBoundRect.TopLeft(),rTextObj.aGeo.nDrehWink,rTextObj.aGeo.nSin,rTextObj.aGeo.nCos);
}
}
void ImpTextPortionHandler::DrawTextToPath(XOutputDevice& rXOut, FASTBOOL bDrawEffect)
{
aFormTextBoundRect=Rectangle();
//const Rectangle& rBR = rTextObj.GetSnapRect();
bDraw = bDrawEffect;
OutlinerParaObject* pPara=rTextObj.GetOutlinerParaObject();
if (rTextObj.IsTextEditActive()) {
pPara=rTextObj.GetEditOutlinerParaObject();
}
if (pPara!=NULL) {
basegfx::B2DPolyPolygon aContourPolyPolygon(rTextObj.TakeXorPoly(FALSE));
pXOut=&rXOut;
Font aFont(rXOut.GetOutDev()->GetFont());
rOutliner.Clear();
rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX));
rOutliner.SetText(*pPara);
sal_uInt32 nCnt(Min(aContourPolyPolygon.count(),
static_cast<sal_uInt32>(rOutliner.GetParagraphCount())));
if ( nCnt == 1 ) bToLastPoint = TRUE;
else bToLastPoint = FALSE;
// #101498# completely different methodology needed here for making this BIDI-able
// iterate over paragraphs and Polygons, thus each paragraph will be put to
// one Polygon
const sal_uInt32 nSavedLayoutMode(rXOut.GetOutDev()->GetLayoutMode());
sal_uInt32 nLayoutMode(nSavedLayoutMode);
if(TRUE)
{
nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG);
}
else
{
nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL);
nLayoutMode |= ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG);
}
rXOut.GetOutDev()->SetLayoutMode(nLayoutMode);
for(nParagraph = 0; nParagraph < nCnt; nParagraph++)
{
basegfx::B2DPolygon aContourPolygon(aContourPolyPolygon.getB2DPolygon(nParagraph));
if(aContourPolygon.areControlPointsUsed())
{
aContourPolygon = basegfx::tools::adaptiveSubdivideByAngle(aContourPolygon);
}
rOutliner.SetDrawPortionHdl(LINK(this, ImpTextPortionHandler, FormTextRecordPortionHdl));
rOutliner.StripPortions();
DrawFormTextRecordPortions(Polygon(aContourPolygon));
ClearFormTextRecordPortions();
const Rectangle& rFTBR = rXOut.GetFormTextBoundRect();
aFormTextBoundRect.Union(rFTBR);
}
rXOut.GetOutDev()->SetLayoutMode(nSavedLayoutMode);
rXOut.GetOutDev()->SetFont(aFont);
rOutliner.Clear();
}
if (rTextObj.IsTextEditActive()) {
delete pPara;
}
}
// #101498# Record and sort all portions
IMPL_LINK(ImpTextPortionHandler, FormTextRecordPortionHdl, DrawPortionInfo*, pInfo)
{
if(pInfo->nPara == nParagraph)
{
SortedAddFormTextRecordPortion(pInfo);
}
return 0;
}
// #101498# Helper class to remember text portions in sorted manner
class ImpRecordPortion
{
public:
Point maPosition;
String maText;
xub_StrLen mnTextStart;
xub_StrLen mnTextLength;
sal_uInt16 mnPara;
xub_StrLen mnIndex;
// #102819# Here SvxFont needs to be used instead of Font
SvxFont maFont;
sal_Int32* mpDXArray;
sal_uInt8 mnBiDiLevel;
ImpRecordPortion(DrawPortionInfo* pInfo);
~ImpRecordPortion();
sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
};
ImpRecordPortion::ImpRecordPortion(DrawPortionInfo* pInfo)
: maPosition(pInfo->rStartPos),
maText(pInfo->rText),
mnTextStart((xub_StrLen)pInfo->nTextStart),
mnTextLength((xub_StrLen)pInfo->nTextLen),
mnPara(pInfo->nPara),
mnIndex(pInfo->nIndex),
maFont(pInfo->rFont),
mpDXArray(NULL),
mnBiDiLevel(pInfo->GetBiDiLevel())
{
if(pInfo->pDXArray)
{
mpDXArray = new sal_Int32[pInfo->nTextLen];
for(sal_uInt32 a(0L); a < pInfo->nTextLen; a++)
{
mpDXArray[a] = pInfo->pDXArray[a];
}
}
}
ImpRecordPortion::~ImpRecordPortion()
{
if(mpDXArray)
{
delete[] mpDXArray;
}
}
// #101498# List classes for recording portions
DECLARE_LIST(ImpRecordPortionList, ImpRecordPortion*)
DECLARE_LIST(ImpRecordPortionListList, ImpRecordPortionList*)
// #101498# Draw recorded formtext along Poly
void ImpTextPortionHandler::DrawFormTextRecordPortions(Polygon aPoly)
{
sal_Int32 nTextWidth = -((sal_Int32)GetFormTextPortionsLength(pXOut->GetOutDev()));
ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions;
if(pListList)
{
for(sal_uInt32 a(0L); a < pListList->Count(); a++)
{
ImpRecordPortionList* pList = pListList->GetObject(a);
for(sal_uInt32 b(0L); b < pList->Count(); b++)
{
ImpRecordPortion* pPortion = pList->GetObject(b);
DrawPortionInfo aNewInfo(
pPortion->maPosition,
pPortion->maText,
pPortion->mnTextStart,
pPortion->mnTextLength,
pPortion->maFont,
pPortion->mnPara,
pPortion->mnIndex,
pPortion->mpDXArray,
pPortion->mnBiDiLevel);
nTextWidth = pXOut->DrawFormText(&aNewInfo, aPoly, nTextWidth, bToLastPoint, bDraw);
}
}
}
}
// #101498# Insert new portion sorted
void ImpTextPortionHandler::SortedAddFormTextRecordPortion(DrawPortionInfo* pInfo)
{
// get ListList and create on demand
ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions;
if(!pListList)
{
mpRecordPortions = (void*)(new ImpRecordPortionListList(2, 2));
pListList = (ImpRecordPortionListList*)mpRecordPortions;
}
// create new portion
ImpRecordPortion* pNewPortion = new ImpRecordPortion(pInfo);
// look for the list where to insert new portion
ImpRecordPortionList* pList = 0L;
for(sal_uInt32 nListListIndex(0L); !pList && nListListIndex < pListList->Count(); nListListIndex++)
{
ImpRecordPortionList* pTmpList = pListList->GetObject(nListListIndex);
if(pTmpList->GetObject(0)->maPosition.Y() == pNewPortion->maPosition.Y())
pList = pTmpList;
}
if(!pList)
{
// no list for that Y-Coordinate yet, create a new one.
pList = new ImpRecordPortionList(8, 8);
pList->Insert(pNewPortion, LIST_APPEND);
pListList->Insert(pList, LIST_APPEND);
}
else
{
// found a list for that for that Y-Coordinate, sort in
sal_uInt32 nInsertInd(0L);
while(nInsertInd < pList->Count()
&& pList->GetObject(nInsertInd)->maPosition.X() < pNewPortion->maPosition.X())
{
nInsertInd++;
}
if(nInsertInd == pList->Count())
nInsertInd = LIST_APPEND;
pList->Insert(pNewPortion, nInsertInd);
}
}
// #101498# Calculate complete length of FormTextPortions
sal_uInt32 ImpTextPortionHandler::GetFormTextPortionsLength(OutputDevice* pOut)
{
sal_uInt32 nRetval(0L);
ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions;
if(pListList)
{
for(sal_uInt32 a(0L); a < pListList->Count(); a++)
{
ImpRecordPortionList* pList = pListList->GetObject(a);
for(sal_uInt32 b(0L); b < pList->Count(); b++)
{
ImpRecordPortion* pPortion = pList->GetObject(b);
if(pPortion->mpDXArray)
{
if(pPortion->maFont.IsVertical() && pOut)
nRetval += pOut->GetTextHeight() * pPortion->mnTextLength;
else
nRetval += pPortion->mpDXArray[pPortion->mnTextLength - 1];
}
}
}
}
return nRetval;
}
// #101498# Cleanup recorded portions
void ImpTextPortionHandler::ClearFormTextRecordPortions()
{
ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions;
if(pListList)
{
for(sal_uInt32 a(0L); a < pListList->Count(); a++)
{
ImpRecordPortionList* pList = pListList->GetObject(a);
for(sal_uInt32 b(0L); b < pList->Count(); b++)
{
delete pList->GetObject(b);
}
delete pList;
}
delete pListList;
mpRecordPortions = (void*)0L;
}
}
IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo)
{
// aFormTextBoundRect enthaelt den Ausgabebereich des Textobjekts
BOOL bIsVertical(rOutliner.IsVertical());
Point aPos2(aFormTextBoundRect.TopLeft() + pInfo->rStartPos);
Color aColor(pInfo->rFont.GetColor());
if(bIsVertical)
aPos2 = aFormTextBoundRect.TopRight() + pInfo->rStartPos;
Point aStartPos(aPos2);
SfxItemSet aAttrSet((SfxItemPool&)(*rTextObj.GetObjectItemPool()));
long nHochTief(pInfo->rFont.GetEscapement());
FontMetric aFontMetric(aVDev.GetFontMetric());
sal_Int32 nLineLen(0L);
Font aFont( pInfo->rFont );
if( nHochTief)
{
// shrink the font for sub-/superscripting
long nPercent(pInfo->rFont.GetPropr());
if(nPercent != 100)
{
Size aSize(aFont.GetSize());
aSize.Height() = (aSize.Height() * nPercent +50) / 100;
aSize.Width() = (aSize.Width() * nPercent +50) / 100;
aFont.SetSize(aSize);
}
sal_Bool bNeg(nHochTief < 0);
if(bNeg)
nHochTief = -nHochTief;
nHochTief = (nHochTief * pInfo->rFont.GetSize().Height() +50) /100;
if(bNeg)
nHochTief = -nHochTief;
}
aFont.SetOrientation( 0 );
aVDev.SetFont( aFont );
if(bIsVertical)
// #83068#
aPos2.X() += aFontMetric.GetAscent() + nHochTief;
else
aPos2.Y() -= aFontMetric.GetAscent() + nHochTief;
if (pInfo->rFont.IsOutline())
{
aAttrSet.Put(XLineColorItem(String(),aColor));
aAttrSet.Put(XLineStyleItem(XLINE_SOLID));
aAttrSet.Put(XLineWidthItem(0));
aAttrSet.Put(XFillStyleItem(XFILL_NONE));
}
else
{
aAttrSet.Put(XFillColorItem(String(),aColor));
aAttrSet.Put(XLineStyleItem(XLINE_NONE));
aAttrSet.Put(XFillStyleItem(XFILL_SOLID));
}
// #100318# convert in a single step
// #101499# Use GetTextOutlines and a PolyPolyVector now
PolyPolyVector aPolyPolyVector;
if(aVDev.GetTextOutlines(aPolyPolyVector, pInfo->rText, pInfo->nTextStart, pInfo->nTextStart, pInfo->nTextLen)
&& aPolyPolyVector.size())
{
for(sal_uInt32 a(0); a < aPolyPolyVector.size(); a++)
{
PolyPolygon aPolyPoly(aPolyPolyVector[a]);
if(aPolyPoly.Count() > 0 && aPolyPoly[0].GetSize() > 0)
{
basegfx::B2DPolyPolygon aPolyPolygon(aPolyPoly.getB2DPolyPolygon());
basegfx::B2DHomMatrix aMatrix;
// rotate 270 degree if vertical since result is unrotated
if(pInfo->rFont.GetOrientation())
{
double fAngle(F_PI * (pInfo->rFont.GetOrientation() % 3600) / 1800.0);
aMatrix.rotate(fAngle);
}
// result is baseline oriented, thus move one line height, too
if(bIsVertical)
{
aMatrix.translate(-aFontMetric.GetAscent(), 0.0);
}
else
{
aMatrix.translate(0.0, aFontMetric.GetAscent());
}
// move to output coordinates
aMatrix.translate(aPos2.X(), aPos2.Y());
// transform
aPolyPolygon.transform(aMatrix);
// create object
SdrObject* pObj = rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
pObj->SetMergedItemSet(aAttrSet);
pGroup->GetSubList()->InsertObject(pObj);
}
}
nLineLen = pInfo->pDXArray[pInfo->nTextLen - 1];
}
FontUnderline eUndl=pInfo->rFont.GetUnderline();
FontStrikeout eStrk=pInfo->rFont.GetStrikeout();
if (eUndl!=UNDERLINE_NONE) {
FASTBOOL bDouble=eUndl==UNDERLINE_DOUBLE;
long nDescent=aFontMetric.GetDescent();
long nAscend=aFontMetric.GetAscent();
long nDick=nDescent / (bDouble ? 5 : 3);
long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt
basegfx::B2DPolyPolygon aPolyPolygon;
if (eUndl!=UNDERLINE_DOTTED) {
Point aPoint(0,0);
XPolygon aXP(Rectangle(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick)));
if(bIsVertical)
aXP.Move(nAscend-nDist,0);
aPolyPolygon.append(aXP.getB2DPolygon());
if (bDouble) {
if(bIsVertical)
aXP.Move(-(nDick+nDist),0);
else
aXP.Move(0,nDick+nDist);
aPolyPolygon.append(aXP.getB2DPolygon());
}
} else {
Point aPoint(0,0);
XPolygon aXP(Rectangle(aPoint,Point(nDick,nDick)));
long n=0;
while (n<=nLineLen) {
if (n+nDick>nLineLen) { // ler letzte Dot ggf. etwas schmaler
aXP=XPolygon(Rectangle(
bIsVertical ? Point(0,n) : Point(n,0),
bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick)));
}
aPolyPolygon.append(aXP.getB2DPolygon());
if(bIsVertical)
aXP.Move(0,2*nDick);
else
aXP.Move(2*nDick,0);
n+=2*nDick;
}
}
long y=nDescent-nDick; // y-Position der Striche zur Baseline bestimmen
if (bDouble) y-=nDick+nDist;
y=(y+1)/2;
basegfx::B2DHomMatrix aMatrix;
if(bIsVertical)
{
aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y());
}
else
{
aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief);
}
aPolyPolygon.transform(aMatrix);
// aFormTextBoundRect enthaelt den Ausgabebereich des Textobjekts
SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
pObj->SetMergedItemSet(aAttrSet);
pGroup->GetSubList()->InsertObject(pObj);
}
if (eStrk!=STRIKEOUT_NONE) {
FASTBOOL bDouble=eStrk==STRIKEOUT_DOUBLE;
long nDescent=aFontMetric.GetDescent();
//long nAscend=aFontMetric.GetAscent();
long nDick=nDescent / (bDouble ? 5 : 3);
long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt
basegfx::B2DPolyPolygon aPolyPolygon;
const Point aPoint(0,0);
const Rectangle aRect(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick));
const basegfx::B2DRange aRectRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
basegfx::B2DPolygon aPolyFromRect(basegfx::tools::createPolygonFromRect(aRectRange));
aPolyPolygon.append(aPolyFromRect);
if (bDouble)
{
basegfx::B2DHomMatrix aMatrix;
if(bIsVertical)
aMatrix.translate(-(nDick+nDist), 0.0);
else
aMatrix.translate(0.0, nDick+nDist);
aPolyFromRect.transform(aMatrix);
aPolyPolygon.append(aPolyFromRect);
}
// y-Position der Striche zur Baseline bestimmen
long y=-(long)(aFontMetric.GetAscent()-aFontMetric.GetIntLeading()+1)/3;
if (!bDouble) y-=(nDick+1)/2;
else y-=nDick+(nDist+1)/2;
basegfx::B2DHomMatrix aMatrix;
if(bIsVertical)
{
aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y());
}
else
{
aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief);
}
aPolyPolygon.transform(aMatrix);
// aFormTextBoundRect enthaelt den Ausgabebereich des Textobjekts
SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True);
pObj->SetMergedItemSet(aAttrSet);
pGroup->GetSubList()->InsertObject(pObj);
}
return 0;
}
void ImpTextPortionHandler::DrawFitText(XOutputDevice& rXOut, const Point& rPos, const Fraction& rXFact)
{
pXOut=&rXOut;
aPos=rPos;
aXFact=rXFact;
rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,FitTextDrawHdl));
rOutliner.StripPortions();
rOutliner.SetDrawPortionHdl(Link());
}
IMPL_LINK(ImpTextPortionHandler,FitTextDrawHdl,DrawPortionInfo*,EMPTYARG)
{
return 0;
}
|