Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/uno/Sequence.h>
30 : : #include <unotools/linguprops.hxx>
31 : : #include <unotools/lingucfg.hxx>
32 : : #include <hintids.hxx>
33 : : #include <sfx2/printer.hxx>
34 : : #include <editeng/hyznitem.hxx>
35 : : #include <editeng/escpitem.hxx>
36 : : #include <editeng/hngpnctitem.hxx>
37 : : #include <editeng/scriptspaceitem.hxx>
38 : : #include <editeng/brshitem.hxx>
39 : : #include <editeng/splwrap.hxx>
40 : : #include <editeng/pgrditem.hxx>
41 : : #include <editeng/tstpitem.hxx>
42 : : #include <xmloff/odffields.hxx>
43 : :
44 : : #include <SwSmartTagMgr.hxx>
45 : : #include <linguistic/lngprops.hxx>
46 : : #include <editeng/unolingu.hxx>
47 : : #include <breakit.hxx>
48 : : #include <editeng/forbiddenruleitem.hxx>
49 : : #include <txatbase.hxx>
50 : : #include <fmtinfmt.hxx>
51 : : #include <fmtfld.hxx>
52 : : #include <fldbas.hxx>
53 : : #include <PostItMgr.hxx>
54 : : #include <swmodule.hxx>
55 : : #include <vcl/svapp.hxx>
56 : : #include <vcl/wrkwin.hxx>
57 : : #include <viewsh.hxx> // ViewShell
58 : : #include <viewopt.hxx> // SwViewOptions
59 : : #include <frmtool.hxx> // DrawGraphic
60 : : #include <IDocumentSettingAccess.hxx>
61 : : #include <IDocumentDeviceAccess.hxx>
62 : : #include <paratr.hxx> // SwFmtDrop
63 : : #include <rootfrm.hxx> // SwRootFrm
64 : : #include <inftxt.hxx> // SwTxtInfo
65 : : #include <blink.hxx> // SwBlink
66 : : #include <noteurl.hxx> // SwNoteURL
67 : : #include <porftn.hxx> // SwFtnPortion
68 : : #include <porrst.hxx> // SwHangingPortion
69 : : #include <itratr.hxx>
70 : : #include <accessibilityoptions.hxx>
71 : : #include <wrong.hxx>
72 : : #include <doc.hxx>
73 : : #include <pam.hxx>
74 : : #include <SwGrammarMarkUp.hxx>
75 : : #include <cstdio>
76 : : // #i12836# enhanced pdf export
77 : : #include <EnhancedPDFExportHelper.hxx>
78 : :
79 : : #include <unomid.h>
80 : :
81 : : #if OSL_DEBUG_LEVEL > 1
82 : : #include <stdio.h>
83 : : #endif
84 : :
85 : : using namespace ::com::sun::star;
86 : : using namespace ::com::sun::star::linguistic2;
87 : : using namespace ::com::sun::star::uno;
88 : : using namespace ::com::sun::star::beans;
89 : :
90 : :
91 : : #define CHAR_UNDERSCORE ((sal_Unicode)0x005F)
92 : : #define CHAR_LEFT_ARROW ((sal_Unicode)0x25C0)
93 : : #define CHAR_RIGHT_ARROW ((sal_Unicode)0x25B6)
94 : : #define CHAR_TAB ((sal_Unicode)0x2192)
95 : : #define CHAR_TAB_RTL ((sal_Unicode)0x2190)
96 : : #define CHAR_LINEBREAK ((sal_Unicode)0x21B5)
97 : : #define CHAR_LINEBREAK_RTL ((sal_Unicode)0x21B3)
98 : :
99 : : #define DRAW_SPECIAL_OPTIONS_CENTER 1
100 : : #define DRAW_SPECIAL_OPTIONS_ROTATE 2
101 : :
102 : : // variable moved to class <numfunc:GetDefBulletConfig>
103 : : //extern const sal_Char sBulletFntName[];
104 : : namespace numfunc
105 : : {
106 : : extern const String& GetDefBulletFontname();
107 : : extern bool IsDefBulletFontUserDefined();
108 : : }
109 : :
110 : : #ifdef DBG_UTIL
111 : : sal_Bool SwTxtSizeInfo::IsOptDbg() const { return GetOpt().IsTest4(); }
112 : : #endif
113 : :
114 : 94498 : SwLineInfo::SwLineInfo()
115 : : : pRuler( 0 ),
116 : : pSpace( 0 ),
117 : : nVertAlign( 0 ),
118 : : nDefTabStop( 0 ),
119 : : bListTabStopIncluded( false ),
120 : 94498 : nListTabStopPosition( 0 )
121 : : {
122 : 94498 : }
123 : :
124 : 94498 : SwLineInfo::~SwLineInfo()
125 : : {
126 [ + - ]: 94498 : delete pRuler;
127 : 94498 : }
128 : 94498 : void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet,
129 : : const SwTxtNode& rTxtNode )
130 : : {
131 [ - + ]: 94498 : delete pRuler;
132 [ + - ]: 94498 : pRuler = new SvxTabStopItem( rAttrSet.GetTabStops() );
133 [ + + ]: 94498 : if ( rTxtNode.GetListTabStopPosition( nListTabStopPosition ) )
134 : : {
135 : 450 : bListTabStopIncluded = true;
136 : :
137 : : // insert the list tab stop into SvxTabItem instance <pRuler>
138 : : const SvxTabStop aListTabStop( nListTabStopPosition,
139 [ + - ]: 450 : SVX_TAB_ADJUST_LEFT );
140 [ + - ]: 450 : pRuler->Insert( aListTabStop );
141 : :
142 : : // remove default tab stops, which are before the inserted list tab stop
143 [ + + ]: 1155 : for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ )
144 : : {
145 [ + - ]: 705 : if ( (*pRuler)[i].GetTabPos() < nListTabStopPosition &&
[ - + # # ]
[ - + ]
146 [ # # ]: 0 : (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT )
147 : : {
148 [ # # ]: 0 : pRuler->Remove(i);
149 : 0 : continue;
150 : : }
151 : : }
152 : : }
153 : :
154 [ + + ]: 94498 : if ( !rTxtNode.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) )
155 : : {
156 : : // remove default tab stop at position 0
157 [ + + ]: 22967 : for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ )
158 : : {
159 [ + + - + ]: 13045 : if ( (*pRuler)[i].GetTabPos() == 0 &&
[ - + ]
160 : 411 : (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT )
161 : : {
162 : 0 : pRuler->Remove(i);
163 : 0 : break;
164 : : }
165 : : }
166 : : }
167 : :
168 : 94498 : pSpace = &rAttrSet.GetLineSpacing();
169 : 94498 : nVertAlign = rAttrSet.GetParaVertAlign().GetValue();
170 : 94498 : nDefTabStop = MSHRT_MAX;
171 : 94498 : }
172 : :
173 : 94498 : void SwTxtInfo::CtorInitTxtInfo( SwTxtFrm *pFrm )
174 : : {
175 : 94498 : pPara = pFrm->GetPara();
176 : 94498 : nTxtStart = pFrm->GetOfst();
177 [ - + ]: 94498 : if( !pPara )
178 : : {
179 : : OSL_ENSURE( pPara, "+SwTxtInfo::CTOR: missing paragraph information" );
180 : 0 : pFrm->Format();
181 : 0 : pPara = pFrm->GetPara();
182 : : }
183 : 94498 : }
184 : :
185 : 72548 : SwTxtInfo::SwTxtInfo( const SwTxtInfo &rInf )
186 : 72548 : : pPara( ((SwTxtInfo&)rInf).GetParaPortion() ),
187 : 72548 : nTxtStart( rInf.GetTxtStart() )
188 : 72548 : { }
189 : :
190 : :
191 : : #if OSL_DEBUG_LEVEL > 0
192 : :
193 : : void ChkOutDev( const SwTxtSizeInfo &rInf )
194 : : {
195 : : if ( !rInf.GetVsh() )
196 : : return;
197 : :
198 : : const OutputDevice* pOut = rInf.GetOut();
199 : : const OutputDevice* pRef = rInf.GetRefDev();
200 : : OSL_ENSURE( pOut && pRef, "ChkOutDev: invalid output devices" );
201 : : }
202 : : #endif
203 : :
204 : :
205 : 149338 : inline xub_StrLen GetMinLen( const SwTxtSizeInfo &rInf )
206 : : {
207 : 149338 : const xub_StrLen nInfLen = rInf.GetIdx() + rInf.GetLen();
208 : 149338 : return Min( rInf.GetTxt().Len(), nInfLen );
209 : : }
210 : :
211 : :
212 : 17545 : SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew )
213 : : : SwTxtInfo( rNew ),
214 : 17545 : pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
215 : 17545 : pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
216 : 17545 : pOut(((SwTxtSizeInfo&)rNew).GetOut()),
217 : 17545 : pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
218 : 17545 : pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
219 : 17545 : pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
220 : : pFrm(rNew.pFrm),
221 : 17545 : pOpt(&rNew.GetOpt()),
222 : 17545 : pTxt(&rNew.GetTxt()),
223 : 17545 : nIdx(rNew.GetIdx()),
224 : 17545 : nLen(rNew.GetLen()),
225 : 17545 : nKanaIdx( rNew.GetKanaIdx() ),
226 : 17545 : bOnWin( rNew.OnWin() ),
227 : 17545 : bNotEOL( rNew.NotEOL() ),
228 : 17545 : bURLNotify( rNew.URLNotify() ),
229 : 17545 : bStopUnderFlow( rNew.StopUnderFlow() ),
230 : 17545 : bFtnInside( rNew.IsFtnInside() ),
231 : 17545 : bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ),
232 : 17545 : bMulti( rNew.IsMulti() ),
233 : 17545 : bFirstMulti( rNew.IsFirstMulti() ),
234 : 17545 : bRuby( rNew.IsRuby() ),
235 : 17545 : bHanging( rNew.IsHanging() ),
236 : 17545 : bScriptSpace( rNew.HasScriptSpace() ),
237 : 17545 : bForbiddenChars( rNew.HasForbiddenChars() ),
238 : 17545 : bSnapToGrid( rNew.SnapToGrid() ),
239 : 35090 : nDirection( rNew.GetDirection() )
240 : : {
241 : : #if OSL_DEBUG_LEVEL > 0
242 : : ChkOutDev( *this );
243 : : #endif
244 : 17545 : }
245 : :
246 : 94335 : void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt,
247 : : const xub_StrLen nNewIdx, const xub_StrLen nNewLen )
248 : : {
249 : 94335 : pKanaComp = NULL;
250 : 94335 : nKanaIdx = 0;
251 : 94335 : pFrm = pFrame;
252 : 94335 : CtorInitTxtInfo( pFrm );
253 : 94335 : const SwTxtNode *pNd = pFrm->GetTxtNode();
254 : 94335 : pVsh = pFrm->getRootFrm()->GetCurrShell();
255 : :
256 : : // Get the output and reference device
257 [ + - ]: 94335 : if ( pVsh )
258 : : {
259 : 94335 : pOut = pVsh->GetOut();
260 : 94335 : pRef = &pVsh->GetRefDev();
261 [ - + ][ + + ]: 94335 : bOnWin = pVsh->GetWin() || OUTDEV_WINDOW == pOut->GetOutDevType();
262 : : }
263 : : else
264 : : {
265 : : // Access via StarONE. We do not need a Shell or an active one.
266 [ # # ]: 0 : if ( pNd->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE) )
267 : : {
268 : : // We can only pick the AppWin here? (there's nothing better to pick?)
269 : 0 : pOut = GetpApp()->GetDefaultDevice();
270 : : }
271 : : else
272 : 0 : pOut = pNd->getIDocumentDeviceAccess()->getPrinter( false );
273 : :
274 : 0 : pRef = pOut;
275 : : }
276 : :
277 : : #if OSL_DEBUG_LEVEL > 0
278 : : ChkOutDev( *this );
279 : : #endif
280 : :
281 : : // Set default layout mode ( LTR or RTL ).
282 [ - + ]: 94335 : if ( pFrm->IsRightToLeft() )
283 : : {
284 : 0 : pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
285 : 0 : pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
286 : 0 : nDirection = DIR_RIGHT2LEFT;
287 : : }
288 : : else
289 : : {
290 : 94335 : pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
291 : 94335 : pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
292 : 94335 : nDirection = DIR_LEFT2RIGHT;
293 : : }
294 : :
295 : : //
296 : : // The Options
297 : : //
298 : : pOpt = pVsh ?
299 : 94335 : pVsh->GetViewOptions() :
300 [ + - ]: 94335 : SW_MOD()->GetViewOption( pNd->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE) ); // Options from Module, due to StarONE
301 : :
302 : : // bURLNotify is set if MakeGraphic prepares it
303 : : // TODO: Unwind
304 [ - + ][ # # ]: 94335 : bURLNotify = pNoteURL && !bOnWin;
305 : :
306 : 94335 : SetSnapToGrid( pNd->GetSwAttrSet().GetParaGrid().GetValue() &&
307 [ + + ][ + - ]: 94335 : pFrm->IsInDocBody() );
308 : :
309 : 94335 : pFnt = pNewFnt;
310 : 94335 : pUnderFnt = 0;
311 : 94335 : pTxt = &pNd->GetTxt();
312 : :
313 : 94335 : nIdx = nNewIdx;
314 : 94335 : nLen = nNewLen;
315 : 94335 : bNotEOL = sal_False;
316 : 94335 : bStopUnderFlow = bFtnInside = bOtherThanFtnInside = sal_False;
317 : : bMulti = bFirstMulti = bRuby = bHanging = bScriptSpace =
318 : 94335 : bForbiddenChars = sal_False;
319 : :
320 : 94335 : SetLen( GetMinLen( *this ) );
321 : 94335 : }
322 : :
323 : 55003 : SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt,
324 : : const xub_StrLen nIndex, const xub_StrLen nLength )
325 : : : SwTxtInfo( rNew ),
326 : 55003 : pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
327 : 55003 : pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
328 : 55003 : pOut(((SwTxtSizeInfo&)rNew).GetOut()),
329 : 55003 : pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
330 : 55003 : pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
331 : 55003 : pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
332 : : pFrm( rNew.pFrm ),
333 : 55003 : pOpt(&rNew.GetOpt()),
334 : : pTxt(&rTxt),
335 : : nIdx(nIndex),
336 : : nLen(nLength),
337 : 55003 : nKanaIdx( rNew.GetKanaIdx() ),
338 : 55003 : bOnWin( rNew.OnWin() ),
339 : 55003 : bNotEOL( rNew.NotEOL() ),
340 : 55003 : bURLNotify( rNew.URLNotify() ),
341 : 55003 : bStopUnderFlow( rNew.StopUnderFlow() ),
342 : 55003 : bFtnInside( rNew.IsFtnInside() ),
343 : 55003 : bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ),
344 : 55003 : bMulti( rNew.IsMulti() ),
345 : 55003 : bFirstMulti( rNew.IsFirstMulti() ),
346 : 55003 : bRuby( rNew.IsRuby() ),
347 : 55003 : bHanging( rNew.IsHanging() ),
348 : 55003 : bScriptSpace( rNew.HasScriptSpace() ),
349 : 55003 : bForbiddenChars( rNew.HasForbiddenChars() ),
350 : 55003 : bSnapToGrid( rNew.SnapToGrid() ),
351 : 110006 : nDirection( rNew.GetDirection() )
352 : : {
353 : : #if OSL_DEBUG_LEVEL > 0
354 : : ChkOutDev( *this );
355 : : #endif
356 [ + - ]: 55003 : SetLen( GetMinLen( *this ) );
357 : 55003 : }
358 : :
359 : 795 : void SwTxtSizeInfo::SelectFont()
360 : : {
361 : : // The path needs to go via ChgPhysFnt or the FontMetricCache gets confused.
362 : : // In this case pLastMet has it's old value.
363 : : // Wrong: GetOut()->SetFont( GetFont()->GetFnt() );
364 : 795 : GetFont()->Invalidate();
365 : 795 : GetFont()->ChgPhysFnt( pVsh, *GetOut() );
366 : 795 : }
367 : :
368 : 0 : void SwTxtSizeInfo::NoteAnimation() const
369 : : {
370 [ # # ]: 0 : if( OnWin() )
371 : 0 : SwRootFrm::FlushVout();
372 : :
373 : : OSL_ENSURE( pOut == pVsh->GetOut(),
374 : : "SwTxtSizeInfo::NoteAnimation() changed pOut" );
375 : 0 : }
376 : :
377 : 833 : SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
378 : : const SwScriptInfo* pSI,
379 : : const XubString& rTxt,
380 : : const xub_StrLen nIndex,
381 : : const xub_StrLen nLength,
382 : : const sal_uInt16 nComp ) const
383 : : {
384 : 833 : SwDrawTextInfo aDrawInf( pVsh, *pOutDev, pSI, rTxt, nIndex, nLength );
385 : 833 : aDrawInf.SetFrm( pFrm );
386 : 833 : aDrawInf.SetFont( pFnt );
387 : 833 : aDrawInf.SetSnapToGrid( SnapToGrid() );
388 : 833 : aDrawInf.SetKanaComp( nComp );
389 [ + - ]: 833 : SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
390 : 833 : return aSize;
391 : : }
392 : :
393 : 3329 : SwPosSize SwTxtSizeInfo::GetTxtSize() const
394 : : {
395 : : const SwScriptInfo& rSI =
396 : 3329 : ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
397 : :
398 : : // in some cases, compression is not allowed or suppressed for
399 : : // performance reasons
400 : 3329 : sal_uInt16 nComp =( SW_CJK == GetFont()->GetActual() &&
401 : 0 : rSI.CountCompChg() &&
402 : 0 : ! IsMulti() ) ?
403 : : GetKanaComp() :
404 [ # # ][ - + : 3329 : 0 ;
# # # # ]
405 : :
406 : 3329 : SwDrawTextInfo aDrawInf( pVsh, *pOut, &rSI, *pTxt, nIdx, nLen );
407 : 3329 : aDrawInf.SetFrm( pFrm );
408 : 3329 : aDrawInf.SetFont( pFnt );
409 : 3329 : aDrawInf.SetSnapToGrid( SnapToGrid() );
410 : 3329 : aDrawInf.SetKanaComp( nComp );
411 [ + - ]: 3329 : return pFnt->_GetTxtSize( aDrawInf );
412 : : }
413 : :
414 : 50278 : void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex,
415 : : const xub_StrLen nLength, const sal_uInt16 nComp,
416 : : sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const
417 : : {
418 : 50278 : SwDrawTextInfo aDrawInf( pVsh, *pOut, pSI, *pTxt, nIndex, nLength );
419 : 50278 : aDrawInf.SetFrm( pFrm );
420 : 50278 : aDrawInf.SetFont( pFnt );
421 : 50278 : aDrawInf.SetSnapToGrid( SnapToGrid() );
422 : 50278 : aDrawInf.SetKanaComp( nComp );
423 [ + - ]: 50278 : SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
424 : 50278 : nMaxSizeDiff = (sal_uInt16)aDrawInf.GetKanaDiff();
425 : 50278 : nMinSize = aSize.Width();
426 : 50278 : }
427 : :
428 : 42491 : xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
429 : : const xub_StrLen nMaxLen,
430 : : const sal_uInt16 nComp ) const
431 : : {
432 : : const SwScriptInfo& rScriptInfo =
433 : 42491 : ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
434 : :
435 : : OSL_ENSURE( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" );
436 : : SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
437 : 42491 : *pTxt, GetIdx(), nMaxLen );
438 : 42491 : aDrawInf.SetFrm( pFrm );
439 : 42491 : aDrawInf.SetFont( pFnt );
440 : 42491 : aDrawInf.SetSnapToGrid( SnapToGrid() );
441 : 42491 : aDrawInf.SetKanaComp( nComp );
442 : 42491 : aDrawInf.SetHyphPos( 0 );
443 : :
444 [ + - ]: 42491 : return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
445 : : }
446 : :
447 : 0 : xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
448 : : const xub_StrLen nMaxLen,
449 : : const sal_uInt16 nComp,
450 : : xub_StrLen& rExtraCharPos ) const
451 : : {
452 : : const SwScriptInfo& rScriptInfo =
453 : 0 : ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
454 : :
455 : : OSL_ENSURE( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" );
456 : : SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
457 : 0 : *pTxt, GetIdx(), nMaxLen );
458 : 0 : aDrawInf.SetFrm( pFrm );
459 : 0 : aDrawInf.SetFont( pFnt );
460 : 0 : aDrawInf.SetSnapToGrid( SnapToGrid() );
461 : 0 : aDrawInf.SetKanaComp( nComp );
462 : 0 : aDrawInf.SetHyphPos( &rExtraCharPos );
463 : :
464 [ # # ]: 0 : return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
465 : : }
466 : :
467 : 28680 : void SwTxtPaintInfo::CtorInitTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPaint )
468 : : {
469 : 28680 : CtorInitTxtSizeInfo( pFrame );
470 : 28680 : aTxtFly.CtorInitTxtFly( pFrame ),
471 : 28680 : aPaintRect = rPaint;
472 : 28680 : nSpaceIdx = 0;
473 : 28680 : pSpaceAdd = NULL;
474 : 28680 : pWrongList = NULL;
475 : 28680 : pGrammarCheckList = NULL;
476 : 28680 : pSmartTags = NULL; // SMARTTAGS
477 : :
478 : : #if OSL_DEBUG_LEVEL > 1
479 : : pBrushItem = ((SvxBrushItem*)-1);
480 : : #else
481 : 28680 : pBrushItem = 0;
482 : : #endif
483 : 28680 : }
484 : :
485 : 0 : SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf, const XubString &rTxt )
486 : : : SwTxtSizeInfo( rInf, rTxt ),
487 : 0 : pWrongList( rInf.GetpWrongList() ),
488 : 0 : pGrammarCheckList( rInf.GetGrammarCheckList() ),
489 : 0 : pSmartTags( rInf.GetSmartTags() ), // SMARTTAGS
490 : 0 : pSpaceAdd( rInf.GetpSpaceAdd() ),
491 : 0 : pBrushItem( rInf.GetBrushItem() ),
492 : 0 : aTxtFly( *rInf.GetTxtFly() ),
493 : 0 : aPos( rInf.GetPos() ),
494 : 0 : aPaintRect( rInf.GetPaintRect() ),
495 [ # # ]: 0 : nSpaceIdx( rInf.GetSpaceIdx() )
496 : 0 : { }
497 : :
498 : 17545 : SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf )
499 : : : SwTxtSizeInfo( rInf ),
500 : 17545 : pWrongList( rInf.GetpWrongList() ),
501 : 17545 : pGrammarCheckList( rInf.GetGrammarCheckList() ),
502 : 17545 : pSmartTags( rInf.GetSmartTags() ), // SMARTTAGS
503 : 17545 : pSpaceAdd( rInf.GetpSpaceAdd() ),
504 : 17545 : pBrushItem( rInf.GetBrushItem() ),
505 : 17545 : aTxtFly( *rInf.GetTxtFly() ),
506 : 17545 : aPos( rInf.GetPos() ),
507 : 17545 : aPaintRect( rInf.GetPaintRect() ),
508 [ + - ]: 70180 : nSpaceIdx( rInf.GetSpaceIdx() )
509 : 17545 : { }
510 : :
511 : : extern Color aGlobalRetoucheColor;
512 : :
513 : : /*************************************************************************
514 : : * lcl_IsDarkBackground
515 : : *
516 : : * Returns if the current background color is dark.
517 : : *************************************************************************/
518 : :
519 : 2613 : sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
520 : : {
521 : 2613 : const Color* pCol = rInf.GetFont()->GetBackColor();
522 [ # # ][ + - ]: 2613 : if( ! pCol || COL_TRANSPARENT == pCol->GetColor() )
[ - + ]
523 : : {
524 : : const SvxBrushItem* pItem;
525 : 2613 : SwRect aOrigBackRect;
526 : :
527 : : // Consider, that [GetBackgroundBrush(...)] can set <pCol>
528 : : // See implementation in /core/layout/paintfrm.cxx
529 : : // There is a background color, if there is a background brush and
530 : : // its color is *not* "no fill"/"auto fill".
531 [ - + ][ + - ]: 2613 : if( rInf.GetTxtFrm()->GetBackgroundBrush( pItem, pCol, aOrigBackRect, sal_False ) )
532 : : {
533 [ # # ]: 0 : if ( !pCol )
534 : 0 : pCol = &pItem->GetColor();
535 : :
536 : : // Determined color <pCol> can be <COL_TRANSPARENT>. Thus, check it.
537 [ # # ]: 0 : if ( pCol->GetColor() == COL_TRANSPARENT)
538 : 0 : pCol = NULL;
539 : : }
540 : : else
541 : 2613 : pCol = NULL;
542 : : }
543 : :
544 : :
545 [ + - ]: 2613 : if( !pCol )
546 : 2613 : pCol = &aGlobalRetoucheColor;
547 : :
548 [ + - ]: 2613 : return pCol->IsDark();
549 : : }
550 : :
551 : : /*************************************************************************
552 : : * SwTxtPaintInfo::_DrawText()
553 : : *************************************************************************/
554 : :
555 : 26479 : void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPor,
556 : : const xub_StrLen nStart, const xub_StrLen nLength,
557 : : const sal_Bool bKern, const sal_Bool bWrong,
558 : : const sal_Bool bSmartTag,
559 : : const sal_Bool bGrammarCheck ) // SMARTTAGS
560 : : {
561 [ + - ]: 26479 : if( !nLength )
562 : : return;
563 : :
564 [ + + ][ + - ]: 26479 : if( GetFont()->IsBlink() && OnWin() && rPor.Width() )
[ + - ][ + + ]
565 : : {
566 : : // check if accessibility options allow blinking portions:
567 : 240 : const ViewShell* pSh = GetTxtFrm()->getRootFrm()->GetCurrShell();
568 [ + - + - ]: 480 : if ( pSh && ! pSh->GetAccessibilityOptions()->IsStopAnimatedText() &&
[ + - ][ + - ]
569 : 240 : ! pSh->IsPreView() )
570 : : {
571 [ + + ]: 240 : if( !pBlink )
572 [ + - ][ + - ]: 2 : pBlink = new SwBlink();
573 : :
574 : 240 : Point aPoint( aPos );
575 : :
576 [ + - ][ - + ]: 240 : if ( GetTxtFrm()->IsRightToLeft() )
577 [ # # ]: 0 : GetTxtFrm()->SwitchLTRtoRTL( aPoint );
578 : :
579 [ + + ]: 240 : if ( TEXT_LAYOUT_BIDI_STRONG != GetOut()->GetLayoutMode() )
580 : 108 : aPoint.X() -= rPor.Width();
581 : :
582 [ + - ][ - + ]: 240 : if ( GetTxtFrm()->IsVertical() )
583 [ # # ]: 0 : GetTxtFrm()->SwitchHorizontalToVertical( aPoint );
584 : :
585 [ + - ][ + - ]: 240 : pBlink->Insert( aPoint, &rPor, GetTxtFrm(), pFnt->GetOrientation() );
586 : :
587 [ + + ]: 240 : if( !pBlink->IsVisible() )
588 : : return;
589 : : }
590 : : else
591 : : {
592 [ # # ][ # # ]: 0 : delete pBlink;
593 : 0 : pBlink = NULL;
594 : : }
595 : : }
596 : :
597 : : // The SwScriptInfo is useless if we are inside a field portion
598 : 26423 : SwScriptInfo* pSI = 0;
599 [ + + ]: 26423 : if ( ! rPor.InFldGrp() )
600 : 24695 : pSI = &GetParaPortion()->GetScriptInfo();
601 : :
602 : : // in some cases, kana compression is not allowed or suppressed for
603 : : // performance reasons
604 : 26423 : sal_uInt16 nComp = 0;
605 [ + - ]: 26423 : if ( ! IsMulti() )
606 [ + - ]: 26423 : nComp = GetKanaComp();
607 : :
608 : 26423 : sal_Bool bCfgIsAutoGrammar = sal_False;
609 [ + - ][ + - ]: 26423 : SvtLinguConfig().GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bCfgIsAutoGrammar;
[ + - ]
610 [ - + ][ # # ]: 26423 : const sal_Bool bBullet = OnWin() && GetOpt().IsBlank() && IsNoSymbol();
[ # # ][ + + ]
611 [ + + ][ + + ]: 26423 : const sal_Bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell();
[ + - ]
612 [ + + ][ + + ]: 26423 : const sal_Bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell();
[ + - ][ + - ]
613 [ - + ][ # # ]: 26423 : const sal_Bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); // SMARTTAGS
[ # # ][ # # ]
[ # # ]
614 : :
615 : : OSL_ENSURE( GetParaPortion(), "No paragraph!");
616 : : SwDrawTextInfo aDrawInf( pFrm->getRootFrm()->GetCurrShell(), *pOut, pSI, rText, nStart, nLength,
617 : 26423 : rPor.Width(), bBullet );
618 : :
619 : 26423 : aDrawInf.SetLeft( GetPaintRect().Left() );
620 : 26423 : aDrawInf.SetRight( GetPaintRect().Right() );
621 : 26423 : aDrawInf.SetUnderFnt( pUnderFnt );
622 : :
623 : 52792 : const long nSpaceAdd = ( rPor.IsBlankPortion() || rPor.IsDropPortion() ||
624 [ + + ][ + - ]: 52792 : rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
[ + + + - ]
625 [ - + ]: 26423 : if ( nSpaceAdd )
626 : : {
627 : : xub_StrLen nCharCnt;
628 : : // #i41860# Thai justified alignment needs some
629 : : // additional information:
630 : 0 : aDrawInf.SetNumberOfBlanks( rPor.InTxtGrp() ?
631 [ # # ]: 0 : static_cast<const SwTxtPortion&>(rPor).GetSpaceCnt( *this, nCharCnt ) :
632 [ # # ]: 0 : 0 );
633 : : }
634 : :
635 : 26423 : aDrawInf.SetSpace( nSpaceAdd );
636 : 26423 : aDrawInf.SetKanaComp( nComp );
637 : :
638 : : // the font is used to identify the current script via nActual
639 : 26423 : aDrawInf.SetFont( pFnt );
640 : : // the frame is used to identify the orientation
641 : 26423 : aDrawInf.SetFrm( GetTxtFrm() );
642 : : // we have to know if the paragraph should snap to grid
643 : 26423 : aDrawInf.SetSnapToGrid( SnapToGrid() );
644 : : // for underlining we must know when not to add extra space behind
645 : : // a character in justified mode
646 : 26423 : aDrawInf.SetSpaceStop( ! rPor.GetPortion() ||
647 : 3240 : rPor.GetPortion()->InFixMargGrp() ||
648 [ + + ]: 29663 : rPor.GetPortion()->IsHolePortion() );
[ + + + + ]
649 : :
650 [ + + ]: 26423 : if( GetTxtFly()->IsOn() )
651 : : {
652 : : // aPos needs to be the TopLeft, because we cannot calculate the
653 : : // ClipRects otherwise
654 : 206 : const Point aPoint( aPos.X(), aPos.Y() - rPor.GetAscent() );
655 : 206 : const Size aSize( rPor.Width(), rPor.Height() );
656 : 206 : aDrawInf.SetPos( aPoint );
657 : 206 : aDrawInf.SetSize( aSize );
658 : 206 : aDrawInf.SetAscent( rPor.GetAscent() );
659 [ - + ]: 206 : aDrawInf.SetKern( bKern ? rPor.Width() : 0 );
660 [ + + ]: 206 : aDrawInf.SetWrong( bTmpWrong ? pWrongList : NULL );
661 [ + + ]: 206 : aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? pGrammarCheckList : NULL );
662 [ - + ]: 206 : aDrawInf.SetSmartTags( bTmpSmart ? pSmartTags : NULL ); // SMARTTAGS
663 [ + - ]: 206 : GetTxtFly()->DrawTextOpaque( aDrawInf );
664 : : }
665 : : else
666 : : {
667 : 26217 : aDrawInf.SetPos( aPos );
668 [ + + ]: 26217 : if( bKern )
669 [ + - ]: 4 : pFnt->_DrawStretchText( aDrawInf );
670 : : else
671 : : {
672 [ + + ]: 26213 : aDrawInf.SetWrong( bTmpWrong ? pWrongList : NULL );
673 [ + + ]: 26213 : aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? pGrammarCheckList : NULL );
674 [ - + ]: 26213 : aDrawInf.SetSmartTags( bTmpSmart ? pSmartTags : NULL ); // SMARTTAGS
675 [ + - ]: 26479 : pFnt->_DrawText( aDrawInf );
676 : : }
677 : : }
678 : : }
679 : :
680 : 29343 : void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
681 : : SwRect* pRect, SwRect* pIntersect ) const
682 : : {
683 : 29343 : Size aSize( rPor.Width(), rPor.Height() );
684 [ - + ]: 29343 : if( rPor.IsHangingPortion() )
685 : 0 : aSize.Width() = ((SwHangingPortion&)rPor).GetInnerWidth();
686 [ + - ][ + + ]: 29343 : if( rPor.InSpaceGrp() && GetSpaceAdd() )
[ + - ][ - + ]
[ - + ]
687 : : {
688 [ # # ][ # # ]: 0 : SwTwips nAdd = rPor.CalcSpacing( GetSpaceAdd(), *this );
689 [ # # ][ # # ]: 0 : if( rPor.InFldGrp() && GetSpaceAdd() < 0 && nAdd )
[ # # ][ # # ]
[ # # ]
690 [ # # ]: 0 : nAdd += GetSpaceAdd() / SPACING_PRECISION_FACTOR;
691 : 0 : aSize.Width() += nAdd;
692 : : }
693 : :
694 : 29343 : Point aPoint;
695 : :
696 [ - + ]: 29343 : if( IsRotated() )
697 : : {
698 : 0 : long nTmp = aSize.Width();
699 : 0 : aSize.Width() = aSize.Height();
700 : 0 : aSize.Height() = nTmp;
701 [ # # ]: 0 : if ( 1 == GetDirection() )
702 : : {
703 : 0 : aPoint.A() = X() - rPor.GetAscent();
704 : 0 : aPoint.B() = Y() - aSize.Height();
705 : : }
706 : : else
707 : : {
708 : 0 : aPoint.A() = X() - rPor.Height() + rPor.GetAscent();
709 : 0 : aPoint.B() = Y();
710 : : }
711 : : }
712 : : else
713 : : {
714 : 29343 : aPoint.A() = X();
715 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
716 [ - + ]: 29343 : if ( GetTxtFrm()->IsVertLR() )
717 : 0 : aPoint.B() = Y() - rPor.Height() + rPor.GetAscent();
718 : : else
719 : 29343 : aPoint.B() = Y() - rPor.GetAscent();
720 : : }
721 : :
722 : : // Adjust x coordinate if we are inside a bidi portion
723 [ + - ]: 29343 : const sal_Bool bFrmDir = GetTxtFrm()->IsRightToLeft();
724 : 29343 : sal_Bool bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == GetDirection() ) ||
725 [ + - + - ]: 58686 : ( bFrmDir && DIR_LEFT2RIGHT == GetDirection() );
[ - + ][ # # ]
726 : :
727 [ - + ]: 29343 : if ( bCounterDir )
728 : 0 : aPoint.A() -= aSize.Width();
729 : :
730 : 29343 : SwRect aRect( aPoint, aSize );
731 : :
732 [ - + ][ + - ]: 29343 : if ( GetTxtFrm()->IsRightToLeft() )
733 [ # # ]: 0 : GetTxtFrm()->SwitchLTRtoRTL( aRect );
734 : :
735 [ + - ][ - + ]: 29343 : if ( GetTxtFrm()->IsVertical() )
736 [ # # ]: 0 : GetTxtFrm()->SwitchHorizontalToVertical( aRect );
737 : :
738 [ + + ]: 29343 : if ( pRect )
739 : 26471 : *pRect = aRect;
740 : :
741 [ + - ][ + - ]: 29343 : if( aRect.HasArea() && pIntersect )
[ + + ][ + + ]
742 : : {
743 [ + - ]: 2872 : ::SwAlignRect( aRect, (ViewShell*)GetVsh() );
744 : :
745 [ + + ]: 2872 : if ( GetOut()->IsClipRegion() )
746 : : {
747 [ + - ][ + - ]: 147 : SwRect aClip( GetOut()->GetClipRegion().GetBoundRect() );
[ + - ][ + - ]
748 [ + - ]: 147 : aRect.Intersection( aClip );
749 : : }
750 : :
751 : 2872 : *pIntersect = aRect;
752 : : }
753 : 29343 : }
754 : :
755 : : /*************************************************************************
756 : : * lcl_DrawSpecial
757 : : *
758 : : * Draws a special portion, e.g., line break portion, tab portion.
759 : : * rPor - The portion
760 : : * rRect - The rectangle surrounding the character
761 : : * pCol - Specify a color for the character
762 : : * bCenter - Draw the character centered, otherwise left aligned
763 : : * bRotate - Rotate the character if character rotation is set
764 : : *************************************************************************/
765 : :
766 : 14 : static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
767 : : SwRect& rRect, const Color* pCol, sal_Unicode cChar,
768 : : sal_uInt8 nOptions )
769 : : {
770 : 14 : sal_Bool bCenter = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_CENTER );
771 : 14 : sal_Bool bRotate = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_ROTATE );
772 : :
773 : : // rRect is given in absolute coordinates
774 [ + - ][ - + ]: 14 : if ( rInf.GetTxtFrm()->IsRightToLeft() )
775 [ # # ]: 0 : rInf.GetTxtFrm()->SwitchRTLtoLTR( rRect );
776 [ + - ][ - + ]: 14 : if ( rInf.GetTxtFrm()->IsVertical() )
777 [ # # ]: 0 : rInf.GetTxtFrm()->SwitchVerticalToHorizontal( rRect );
778 : :
779 : 14 : const SwFont* pOldFnt = rInf.GetFont();
780 : :
781 : : // Font is generated only once:
782 : : static SwFont* pFnt = 0;
783 [ + + ]: 14 : if ( ! pFnt )
784 : : {
785 [ + - ][ + - ]: 3 : pFnt = new SwFont( *pOldFnt );
786 [ + - ]: 3 : pFnt->SetFamily( FAMILY_DONTKNOW, pFnt->GetActual() );
787 [ + - ][ + - ]: 3 : pFnt->SetName( numfunc::GetDefBulletFontname(), pFnt->GetActual() );
788 [ + - ]: 3 : pFnt->SetStyleName( aEmptyStr, pFnt->GetActual() );
789 [ + - ]: 3 : pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, pFnt->GetActual() );
790 : : }
791 : :
792 : : // Some of the current values are set at the font:
793 [ + - ]: 14 : if ( ! bRotate )
794 [ + - ][ + - ]: 14 : pFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );
795 : : else
796 [ # # ][ # # ]: 0 : pFnt->SetVertical( pOldFnt->GetOrientation() );
797 : :
798 [ + - ]: 14 : if ( pCol )
799 [ + - ]: 14 : pFnt->SetColor( *pCol );
800 : : else
801 [ # # ][ # # ]: 0 : pFnt->SetColor( pOldFnt->GetColor() );
802 : :
803 : 14 : Size aFontSize( 0, SPECIAL_FONT_HEIGHT );
804 [ + - ]: 14 : pFnt->SetSize( aFontSize, pFnt->GetActual() );
805 : :
806 : 14 : ((SwTxtPaintInfo&)rInf).SetFont( pFnt );
807 : :
808 : : // The maximum width depends on the current orientation
809 [ + - ][ + - ]: 14 : const sal_uInt16 nDir = pFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() );
810 : 14 : SwTwips nMaxWidth = 0;
811 [ + - - ]: 14 : switch ( nDir )
812 : : {
813 : : case 0 :
814 : 14 : nMaxWidth = rRect.Width();
815 : 14 : break;
816 : : case 900 :
817 : : case 2700 :
818 : 0 : nMaxWidth = rRect.Height();
819 : 0 : break;
820 : : default:
821 : : OSL_FAIL( "Unknown direction set at font" );
822 : 0 : break;
823 : : }
824 : :
825 : : // check if char fits into rectangle
826 : 14 : const rtl::OUString aTmp( cChar );
827 [ + - ][ + - ]: 14 : aFontSize = rInf.GetTxtSize( aTmp ).SvLSize();
[ + - ]
828 [ - + ]: 14 : while ( aFontSize.Width() > nMaxWidth )
829 : : {
830 : 0 : SwTwips nFactor = ( 100 * aFontSize.Width() ) / nMaxWidth;
831 : 0 : const SwTwips nOldWidth = aFontSize.Width();
832 : :
833 : : // new height for font
834 : 0 : const sal_uInt8 nAct = pFnt->GetActual();
835 : 0 : aFontSize.Height() = ( 100 * pFnt->GetSize( nAct ).Height() ) / nFactor;
836 : 0 : aFontSize.Width() = ( 100 * pFnt->GetSize( nAct).Width() ) / nFactor;
837 : :
838 [ # # ][ # # ]: 0 : if ( !aFontSize.Width() && !aFontSize.Height() )
[ # # ]
839 : 0 : break;
840 : :
841 [ # # ]: 0 : pFnt->SetSize( aFontSize, nAct );
842 : :
843 [ # # ][ # # ]: 0 : aFontSize = rInf.GetTxtSize( aTmp ).SvLSize();
[ # # ]
844 : :
845 [ # # ]: 0 : if ( aFontSize.Width() >= nOldWidth )
846 : 0 : break;
847 : : }
848 : :
849 : 14 : const Point aOldPos( rInf.GetPos() );
850 : :
851 : : // adjust values so that tab is vertically and horizontally centered
852 : 14 : SwTwips nX = rRect.Left();
853 : 14 : SwTwips nY = rRect.Top();
854 [ + - - - ]: 14 : switch ( nDir )
855 : : {
856 : : case 0 :
857 [ - + ]: 14 : if ( bCenter )
858 : 0 : nX += ( rRect.Width() - aFontSize.Width() ) / 2;
859 [ + - ]: 14 : nY += ( rRect.Height() - aFontSize.Height() ) / 2 + rInf.GetAscent();
860 : 14 : break;
861 : : case 900 :
862 [ # # ]: 0 : if ( bCenter )
863 [ # # ]: 0 : nX += ( rRect.Width() - aFontSize.Height() ) / 2 + rInf.GetAscent();
864 : 0 : nY += ( rRect.Height() + aFontSize.Width() ) / 2;
865 : 0 : break;
866 : : case 2700 :
867 [ # # ]: 0 : if ( bCenter )
868 [ # # ]: 0 : nX += ( rRect.Width() + aFontSize.Height() ) / 2 - rInf.GetAscent();
869 : 0 : nY += ( rRect.Height() - aFontSize.Width() ) / 2;
870 : 0 : break;
871 : : }
872 : :
873 : 14 : Point aTmpPos( nX, nY );
874 : 14 : ((SwTxtPaintInfo&)rInf).SetPos( aTmpPos );
875 : 14 : sal_uInt16 nOldWidth = rPor.Width();
876 : 14 : ((SwLinePortion&)rPor).Width( (sal_uInt16)aFontSize.Width() );
877 [ + - ][ + - ]: 14 : rInf.DrawText( aTmp, rPor );
[ + - ]
878 : 14 : ((SwLinePortion&)rPor).Width( nOldWidth );
879 : 14 : ((SwTxtPaintInfo&)rInf).SetFont( (SwFont*)pOldFnt );
880 : 14 : ((SwTxtPaintInfo&)rInf).SetPos( aOldPos );
881 : 14 : }
882 : :
883 : 2785 : void SwTxtPaintInfo::DrawRect( const SwRect &rRect, sal_Bool bNoGraphic,
884 : : sal_Bool bRetouche ) const
885 : : {
886 [ - + ][ # # ]: 2785 : if ( OnWin() || !bRetouche )
[ + - ]
887 : : {
888 [ + + ]: 2785 : if( aTxtFly.IsOn() )
889 : : ((SwTxtPaintInfo*)this)->GetTxtFly()->
890 : 80 : DrawFlyRect( pOut, rRect, *this, bNoGraphic );
891 [ + - ]: 2705 : else if ( bNoGraphic )
892 [ + - ]: 2705 : pOut->DrawRect( rRect.SVRect() );
893 : : else
894 : : {
895 : : OSL_ENSURE( ((SvxBrushItem*)-1) != pBrushItem, "DrawRect: Uninitialized BrushItem!" );
896 : 0 : ::DrawGraphic( pBrushItem, pOut, aItemRect, rRect );
897 : : }
898 : : }
899 : 2785 : }
900 : :
901 : 0 : void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
902 : : {
903 [ # # ]: 0 : if( OnWin() )
904 : : {
905 : 0 : SwRect aRect;
906 [ # # ]: 0 : CalcRect( rPor, &aRect );
907 : :
908 [ # # ][ # # ]: 0 : if ( ! aRect.HasArea() )
909 : 0 : return;
910 : :
911 [ # # ]: 0 : const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
912 [ # # ]: 0 : CHAR_TAB_RTL : CHAR_TAB;
913 : : const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER |
914 : 0 : DRAW_SPECIAL_OPTIONS_ROTATE;
915 [ # # ]: 0 : lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
916 : : }
917 : : }
918 : :
919 : 0 : void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
920 : : {
921 [ # # ]: 0 : if( OnWin() )
922 : : {
923 : 0 : KSHORT nOldWidth = rPor.Width();
924 : 0 : ((SwLinePortion&)rPor).Width( LINE_BREAK_WIDTH );
925 : :
926 : 0 : SwRect aRect;
927 [ # # ]: 0 : CalcRect( rPor, &aRect );
928 : :
929 [ # # ][ # # ]: 0 : if( aRect.HasArea() )
930 : : {
931 [ # # ]: 0 : const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
932 [ # # ]: 0 : CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
933 : 0 : const sal_uInt8 nOptions = 0;
934 [ # # ]: 0 : lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
935 : : }
936 : :
937 : 0 : ((SwLinePortion&)rPor).Width( nOldWidth );
938 : : }
939 : 0 : }
940 : :
941 : 14 : void SwTxtPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
942 : : {
943 : 14 : Size aSize( SPECIAL_FONT_HEIGHT, SPECIAL_FONT_HEIGHT );
944 : 14 : SwRect aRect( ((SwArrowPortion&)rPor).GetPos(), aSize );
945 : : sal_Unicode cChar;
946 [ - + ]: 14 : if( ((SwArrowPortion&)rPor).IsLeft() )
947 : : {
948 [ # # ]: 0 : aRect.Pos().Y() += 20 - GetAscent();
949 : 0 : aRect.Pos().X() += 20;
950 [ # # ]: 0 : if( aSize.Height() > rPor.Height() )
951 : 0 : aRect.Height( rPor.Height() );
952 : 0 : cChar = CHAR_LEFT_ARROW;
953 : : }
954 : : else
955 : : {
956 [ + + ]: 14 : if( aSize.Height() > rPor.Height() )
957 : 2 : aRect.Height( rPor.Height() );
958 : 14 : aRect.Pos().Y() -= aRect.Height() + 20;
959 : 14 : aRect.Pos().X() -= aRect.Width() + 20;
960 : 14 : cChar = CHAR_RIGHT_ARROW;
961 : : }
962 : :
963 [ + - ][ - + ]: 14 : if ( GetTxtFrm()->IsVertical() )
964 [ # # ]: 0 : GetTxtFrm()->SwitchHorizontalToVertical( aRect );
965 : :
966 : 14 : Color aCol( COL_LIGHTRED );
967 : :
968 [ + - ][ + - ]: 14 : if( aRect.HasArea() )
969 : : {
970 : 14 : const sal_uInt8 nOptions = 0;
971 [ + - ]: 14 : lcl_DrawSpecial( *this, rPor, aRect, &aCol, cChar, nOptions );
972 : : }
973 : 14 : }
974 : :
975 : 3 : void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, sal_Bool bScript ) const
976 : : {
977 [ + - ][ + - ]: 3 : if( OnWin() && pOpt->IsPostIts() )
[ + - ]
978 : : {
979 : 3 : Size aSize;
980 : 3 : Point aTmp;
981 : :
982 [ + - ]: 3 : const sal_uInt16 nPostItsWidth = pOpt->GetPostItsWidth( GetOut() );
983 [ + - ]: 3 : const sal_uInt16 nFontHeight = pFnt->GetHeight( pVsh, *GetOut() );
984 [ + - ]: 3 : const sal_uInt16 nFontAscent = pFnt->GetAscent( pVsh, *GetOut() );
985 : :
986 [ + - ][ + - ]: 3 : switch ( pFnt->GetOrientation( GetTxtFrm()->IsVertical() ) )
[ + - - - ]
987 : : {
988 : : case 0 :
989 : 3 : aSize.Width() = nPostItsWidth;
990 : 3 : aSize.Height() = nFontHeight;
991 : 3 : aTmp.X() = aPos.X();
992 : 3 : aTmp.Y() = aPos.Y() - nFontAscent;
993 : 3 : break;
994 : : case 900 :
995 : 0 : aSize.Height() = nPostItsWidth;
996 : 0 : aSize.Width() = nFontHeight;
997 : 0 : aTmp.X() = aPos.X() - nFontAscent;
998 : 0 : aTmp.Y() = aPos.Y();
999 : 0 : break;
1000 : : case 2700 :
1001 : 0 : aSize.Height() = nPostItsWidth;
1002 : 0 : aSize.Width() = nFontHeight;
1003 : 0 : aTmp.X() = aPos.X() - nFontHeight +
1004 : 0 : nFontAscent;
1005 : 0 : aTmp.Y() = aPos.Y();
1006 : 0 : break;
1007 : : }
1008 : :
1009 : 3 : SwRect aTmpRect( aTmp, aSize );
1010 : :
1011 [ - + ][ + - ]: 3 : if ( GetTxtFrm()->IsRightToLeft() )
1012 [ # # ]: 0 : GetTxtFrm()->SwitchLTRtoRTL( aTmpRect );
1013 : :
1014 [ + - ][ - + ]: 3 : if ( GetTxtFrm()->IsVertical() )
1015 [ # # ]: 0 : GetTxtFrm()->SwitchHorizontalToVertical( aTmpRect );
1016 : :
1017 [ + - ]: 3 : const Rectangle aRect( aTmpRect.SVRect() );
1018 [ + - ][ + - ]: 3 : pOpt->PaintPostIts( (OutputDevice*)GetOut(), aRect, bScript );
1019 : : }
1020 : 3 : }
1021 : :
1022 : 0 : void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const
1023 : : {
1024 : 0 : SwRect aIntersect;
1025 [ # # ]: 0 : CalcRect( rPor, &aIntersect, 0 );
1026 [ # # ][ # # ]: 0 : if ( aIntersect.HasArea() )
1027 : : {
1028 [ # # ][ # # ]: 0 : if (OnWin() && SwViewOption::IsFieldShadings() &&
[ # # # # ]
[ # # ]
1029 : 0 : !GetOpt().IsPagePreview())
1030 : : {
1031 : 0 : OutputDevice* pOut_ = (OutputDevice*)GetOut();
1032 [ # # ]: 0 : pOut_->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1033 [ # # ][ # # ]: 0 : pOut_->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1034 [ # # ]: 0 : pOut_->SetLineColor();
1035 [ # # ][ # # ]: 0 : pOut_->DrawRect( aIntersect.SVRect() );
1036 [ # # ]: 0 : pOut_->Pop();
1037 : : }
1038 : 0 : const int delta=10;
1039 [ # # ]: 0 : Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1040 [ # # ]: 0 : pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1041 [ # # ]: 0 : pOut->SetLineColor( Color(0, 0, 0));
1042 [ # # ]: 0 : pOut->SetFillColor();
1043 [ # # ]: 0 : pOut->DrawRect( r );
1044 [ # # ]: 0 : if (checked) {
1045 [ # # ][ # # ]: 0 : pOut->DrawLine(r.TopLeft(), r.BottomRight());
1046 [ # # ][ # # ]: 0 : pOut->DrawLine(r.TopRight(), r.BottomLeft());
[ # # ]
1047 : : }
1048 [ # # ]: 0 : pOut->Pop();
1049 : : }
1050 : 0 : }
1051 : :
1052 : 2688 : void SwTxtPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
1053 : : {
1054 : : OSL_ENSURE( OnWin(), "SwTxtPaintInfo::DrawBackground: printer pollution ?" );
1055 : :
1056 : 2688 : SwRect aIntersect;
1057 [ + - ]: 2688 : CalcRect( rPor, 0, &aIntersect );
1058 : :
1059 [ + - ][ + + ]: 2688 : if ( aIntersect.HasArea() )
1060 : : {
1061 : 2613 : OutputDevice* pTmpOut = (OutputDevice*)GetOut();
1062 [ + - ]: 2613 : pTmpOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1063 : :
1064 : : // For dark background we do not want to have a filled rectangle
1065 [ + - ][ + - ]: 2613 : if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
[ + - ][ - + ]
[ - + ]
1066 : : {
1067 [ # # ][ # # ]: 0 : pTmpOut->SetLineColor( SwViewOption::GetFontColor().GetColor() );
1068 : : }
1069 : : else
1070 : : {
1071 [ + - ][ + - ]: 2613 : pTmpOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1072 [ + - ]: 2613 : pTmpOut->SetLineColor();
1073 : : }
1074 : :
1075 [ + - ]: 2613 : DrawRect( aIntersect, sal_True );
1076 [ + - ]: 2613 : pTmpOut->Pop();
1077 : : }
1078 : 2688 : }
1079 : :
1080 : 26471 : void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
1081 : : {
1082 : : {
1083 : 26471 : SwRect aIntersect;
1084 [ + - ]: 26471 : CalcRect( rPor, &aIntersect, 0 );
1085 [ + - ][ + - ]: 26471 : if(aIntersect.HasArea())
1086 : : {
1087 : 26471 : SwTxtNode *pNd = pFrm->GetTxtNode();
1088 : 26471 : const ::sw::mark::IFieldmark* pFieldmark = NULL;
1089 [ + - ]: 26471 : if(pNd)
1090 : : {
1091 : 26471 : const SwDoc *doc=pNd->GetDoc();
1092 [ + - ]: 26471 : if(doc)
1093 : : {
1094 [ + - ][ + - ]: 26471 : SwIndex aIndex(pNd, GetIdx());
1095 [ + - ][ + - ]: 26471 : SwPosition aPosition(*pNd, aIndex);
[ + - ]
1096 [ + - ][ + - ]: 26471 : pFieldmark=doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
[ + - ][ + - ]
1097 : : }
1098 : : }
1099 [ + + ][ - + ]: 26471 : bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx()));
1100 : : if(pFieldmark) {
1101 : : OSL_TRACE("Found Fieldmark");
1102 : : #if OSL_DEBUG_LEVEL > 1
1103 : : rtl::OUString str = pFieldmark->ToString( );
1104 : : fprintf( stderr, "%s\n", rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) );
1105 : : #endif
1106 : : }
1107 : : if(bIsStartMark) OSL_TRACE("Found StartMark");
1108 [ + + ][ + + ]: 26477 : if (OnWin() && (pFieldmark!=NULL || bIsStartMark) &&
[ - + ]
[ + - + - ]
[ + + ]
1109 [ + - ]: 3 : SwViewOption::IsFieldShadings() &&
1110 : 3 : !GetOpt().IsPagePreview())
1111 : : {
1112 : 3 : OutputDevice* pOutDev = (OutputDevice*)GetOut();
1113 [ + - ]: 3 : pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1114 : 3 : bool bFilled = false;
1115 : : // If this is a comment range, need to look up the color of the comment author.
1116 [ + - ][ + - ]: 3 : if (pFieldmark->GetFieldname() == ODF_COMMENTRANGE)
1117 : : {
1118 : : // Search for the position of the postit field
1119 : 3 : const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 };
1120 [ + - ]: 3 : xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx());
1121 [ + - ]: 3 : if (nEndIdx != STRING_NOTFOUND)
1122 : : {
1123 [ + - ]: 3 : SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD);
1124 : 3 : const SwFmtFld& rPostItField = pTxtAttr->GetFld();
1125 : : // Look up the author name
1126 [ + - ]: 3 : const rtl::OUString& rAuthor = rPostItField.GetFld()->GetPar1();
1127 [ + - ][ + - ]: 3 : sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
[ + - ]
1128 [ + - ][ + - ]: 3 : pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
1129 [ + - ][ + - ]: 3 : pOutDev->SetLineColor( SwPostItMgr::GetColorAnchor(nIndex) );
1130 : 3 : bFilled = true;
1131 : : }
1132 : : }
1133 [ - + ]: 3 : if (!bFilled)
1134 : : {
1135 [ # # ][ # # ]: 0 : pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1136 [ # # ]: 0 : pOutDev->SetLineColor( );
1137 : : }
1138 [ + - ][ + - ]: 3 : pOutDev->DrawRect( aIntersect.SVRect() );
1139 [ + - ]: 3 : pOutDev->Pop();
1140 : : }
1141 : : }
1142 : : }
1143 [ + + ]: 52942 : if( !pFnt->GetBackColor() ) return;
1144 : :
1145 : : OSL_ENSURE( pFnt->GetBackColor(), "DrawBackBrush: Lost Color" );
1146 : :
1147 : 184 : SwRect aIntersect;
1148 [ + - ]: 184 : CalcRect( rPor, 0, &aIntersect );
1149 : :
1150 [ + - ][ + + ]: 184 : if ( aIntersect.HasArea() )
1151 : : {
1152 : 172 : OutputDevice* pTmpOut = (OutputDevice*)GetOut();
1153 : :
1154 : : // #i16816# tagged pdf support
1155 [ + - ]: 172 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pTmpOut );
1156 : :
1157 [ + - ]: 172 : pTmpOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1158 : :
1159 [ + - ]: 172 : pTmpOut->SetFillColor( *pFnt->GetBackColor() );
1160 [ + - ]: 172 : pTmpOut->SetLineColor();
1161 : :
1162 [ + - ]: 172 : DrawRect( aIntersect, sal_True, sal_False );
1163 : :
1164 [ + - ][ + - ]: 26471 : pTmpOut->Pop();
1165 : : }
1166 : : }
1167 : :
1168 : 2865 : void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
1169 : : const MSHORT nWhich ) const
1170 : : {
1171 [ + + ][ + - ]: 2865 : if( OnWin() && !IsMulti() )
[ + + ]
1172 : : {
1173 : 2793 : sal_Bool bDraw = sal_False;
1174 [ + - + + : 2793 : switch( nWhich )
- ]
1175 : : {
1176 : : case POR_FTN:
1177 : : case POR_QUOVADIS:
1178 : : case POR_NUMBER:
1179 : : case POR_FLD:
1180 : : case POR_URL:
1181 : : case POR_HIDDEN:
1182 : : case POR_TOX:
1183 : : case POR_REF:
1184 : : case POR_META:
1185 : : case POR_CONTROLCHAR:
1186 [ + - + - : 8394 : if ( !GetOpt().IsPagePreview() &&
+ - ]
[ + + - + ]
[ + + ]
1187 : 2763 : !GetOpt().IsReadonly() &&
1188 : 2763 : SwViewOption::IsFieldShadings() &&
1189 : : (POR_NUMBER != nWhich ||
1190 : 105 : pFrm->GetTxtNode()->HasMarkedLabel())) // #i27615#
1191 : 2658 : bDraw = sal_True;
1192 : 2763 : break;
1193 [ # # ]: 0 : case POR_TAB: if ( GetOpt().IsTab() ) bDraw = sal_True; break;
1194 [ + - ]: 12 : case POR_SOFTHYPH: if ( GetOpt().IsSoftHyph() )bDraw = sal_True; break;
1195 [ + - ]: 18 : case POR_BLANK: if ( GetOpt().IsHardBlank())bDraw = sal_True; break;
1196 : : default:
1197 : : {
1198 : : OSL_ENSURE( !this, "SwTxtPaintInfo::DrawViewOpt: don't know how to draw this" );
1199 : 0 : break;
1200 : : }
1201 : : }
1202 [ + + ]: 2793 : if ( bDraw )
1203 : 2688 : DrawBackground( rPor );
1204 : : }
1205 : 2865 : }
1206 : :
1207 : 0 : void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const
1208 : : {
1209 : : OSL_ENSURE( pNoteURL, "NotifyURL: pNoteURL gone with the wind!" );
1210 : :
1211 : 0 : SwRect aIntersect;
1212 [ # # ]: 0 : CalcRect( rPor, 0, &aIntersect );
1213 : :
1214 [ # # ][ # # ]: 0 : if( aIntersect.HasArea() )
1215 : : {
1216 : 0 : SwTxtNode *pNd = (SwTxtNode*)GetTxtFrm()->GetTxtNode();
1217 : : SwTxtAttr *const pAttr =
1218 [ # # ]: 0 : pNd->GetTxtAttrAt(GetIdx(), RES_TXTATR_INETFMT);
1219 [ # # ]: 0 : if( pAttr )
1220 : : {
1221 : 0 : const SwFmtINetFmt& rFmt = pAttr->GetINetFmt();
1222 : 0 : pNoteURL->InsertURLNote( rFmt.GetValue(), rFmt.GetTargetFrame(),
1223 [ # # ]: 0 : aIntersect );
1224 : : }
1225 : : }
1226 : 0 : }
1227 : :
1228 : 18 : static void lcl_InitHyphValues( PropertyValues &rVals,
1229 : : sal_Int16 nMinLeading, sal_Int16 nMinTrailing )
1230 : : {
1231 : 18 : sal_Int32 nLen = rVals.getLength();
1232 : :
1233 [ + - ]: 18 : if (0 == nLen) // yet to be initialized?
1234 : : {
1235 : 18 : rVals.realloc( 2 );
1236 : 18 : PropertyValue *pVal = rVals.getArray();
1237 : :
1238 : 18 : pVal[0].Name = UPN_HYPH_MIN_LEADING;
1239 : 18 : pVal[0].Handle = UPH_HYPH_MIN_LEADING;
1240 : 18 : pVal[0].Value <<= nMinLeading;
1241 : :
1242 : 18 : pVal[1].Name = UPN_HYPH_MIN_TRAILING;
1243 : 18 : pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
1244 : 18 : pVal[1].Value <<= nMinTrailing;
1245 : : }
1246 [ # # ]: 0 : else if (2 == nLen) // already initialized once?
1247 : : {
1248 : 0 : PropertyValue *pVal = rVals.getArray();
1249 : 0 : pVal[0].Value <<= nMinLeading;
1250 : 0 : pVal[1].Value <<= nMinTrailing;
1251 : : }
1252 : : else {
1253 : : OSL_FAIL( "unexpected size of sequence" );
1254 : : }
1255 : 18 : }
1256 : :
1257 : 0 : const PropertyValues & SwTxtFormatInfo::GetHyphValues() const
1258 : : {
1259 : : OSL_ENSURE( 2 == aHyphVals.getLength(),
1260 : : "hyphenation values not yet initialized" );
1261 : 0 : return aHyphVals;
1262 : : }
1263 : :
1264 : 14873 : sal_Bool SwTxtFormatInfo::InitHyph( const sal_Bool bAutoHyphen )
1265 : : {
1266 : 14873 : const SwAttrSet& rAttrSet = GetTxtFrm()->GetTxtNode()->GetSwAttrSet();
1267 : 14873 : SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1268 : 14873 : SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1269 : 14873 : SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1270 : 14873 : const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1271 : 14873 : MaxHyph() = rAttr.GetMaxHyphens();
1272 [ + + ][ + - ]: 14873 : sal_Bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1273 [ + + ][ - + ]: 14873 : if( bAuto || bInterHyph )
1274 : : {
1275 : 18 : nHyphStart = nHyphWrdStart = STRING_LEN;
1276 : 18 : nHyphWrdLen = 0;
1277 : :
1278 : 18 : const sal_Int16 nMinimalLeading = Max(rAttr.GetMinLead(), sal_uInt8(2));
1279 : 18 : const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1280 : 18 : lcl_InitHyphValues( aHyphVals, nMinimalLeading, nMinimalTrailing);
1281 : : }
1282 : 14873 : return bAuto;
1283 : : }
1284 : :
1285 : 14873 : void SwTxtFormatInfo::CtorInitTxtFormatInfo( SwTxtFrm *pNewFrm, const sal_Bool bNewInterHyph,
1286 : : const sal_Bool bNewQuick, const sal_Bool bTst )
1287 : : {
1288 [ + - ]: 14873 : CtorInitTxtPaintInfo( pNewFrm, SwRect() );
1289 : :
1290 : 14873 : bQuick = bNewQuick;
1291 : 14873 : bInterHyph = bNewInterHyph;
1292 : :
1293 : : //! needs to be done in this order
1294 : 14873 : nMinLeading = 2;
1295 : 14873 : nMinTrailing = 2;
1296 : 14873 : nMinWordLength = 0;
1297 : 14873 : bAutoHyph = InitHyph();
1298 : :
1299 : 14873 : bIgnoreFly = sal_False;
1300 : 14873 : bFakeLineStart = sal_False;
1301 : 14873 : bShift = sal_False;
1302 : 14873 : bDropInit = sal_False;
1303 : 14873 : bTestFormat = bTst;
1304 : 14873 : nLeft = 0;
1305 : 14873 : nRight = 0;
1306 : 14873 : nFirst = 0;
1307 : 14873 : nRealWidth = 0;
1308 : 14873 : nForcedLeftMargin = 0;
1309 : 14873 : pRest = 0;
1310 : 14873 : nLineHeight = 0;
1311 : 14873 : nLineNettoHeight = 0;
1312 : 14873 : SetLineStart(0);
1313 : 14873 : Init();
1314 : 14873 : }
1315 : :
1316 : : /*************************************************************************
1317 : : * SwTxtFormatInfo::IsHyphenate()
1318 : : * If the Hyphenator returns ERROR or the language is set to NOLANGUAGE
1319 : : * we do not hyphenate.
1320 : : * Else, we always hyphenate if we do interactive hyphenation.
1321 : : * If we do not do interactive hyphenation, we only hyphenate if ParaFmt is
1322 : : * set to automatic hyphenation.
1323 : : *************************************************************************/
1324 : 42491 : sal_Bool SwTxtFormatInfo::IsHyphenate() const
1325 : : {
1326 [ + - ][ + - ]: 42491 : if( !bInterHyph && !bAutoHyph )
1327 : 42491 : return sal_False;
1328 : :
1329 : 0 : LanguageType eTmp = GetFont()->GetLanguage();
1330 [ # # ][ # # ]: 0 : if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
1331 : 0 : return sal_False;
1332 : :
1333 [ # # ]: 0 : uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1334 [ # # ][ # # ]: 0 : if (bInterHyph && xHyph.is())
[ # # ]
1335 [ # # ]: 0 : SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1336 : :
1337 [ # # ][ # # ]: 0 : if( !xHyph.is() || !xHyph->hasLocale( pBreakIt->GetLocale(eTmp) ) )
[ # # ][ # # ]
[ # # ][ # # ]
1338 : 0 : return sal_False;
1339 : 42491 : return sal_True;
1340 : : }
1341 : :
1342 : : /*************************************************************************
1343 : : * SwTxtFormatInfo::GetDropFmt()
1344 : : * Dropcaps called by the SwTxtFormatter::CTOR
1345 : : *************************************************************************/
1346 : :
1347 : 14873 : const SwFmtDrop *SwTxtFormatInfo::GetDropFmt() const
1348 : : {
1349 : 14873 : const SwFmtDrop *pDrop = &GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetDrop();
1350 [ + - ][ - + : 14873 : if( 1 >= pDrop->GetLines() ||
# # # # ]
1351 : 0 : ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1352 : 14873 : pDrop = 0;
1353 : 14873 : return pDrop;
1354 : : }
1355 : :
1356 : 68241 : void SwTxtFormatInfo::Init()
1357 : : {
1358 : : // Not initialized: pRest, nLeft, nRight, nFirst, nRealWidth
1359 : 68241 : X(0);
1360 : : bArrowDone = bFull = bFtnDone = bErgoDone = bNumDone = bNoEndHyph =
1361 : 68241 : bNoMidHyph = bStop = bNewLine = bUnderFlow = bTabOverflow = sal_False;
1362 : :
1363 : : // generally we do not allow number portions in follows, except...
1364 [ + + ]: 68241 : if ( GetTxtFrm()->IsFollow() )
1365 : : {
1366 : 18604 : const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
1367 : : OSL_ENSURE(pMaster, "pTxtFrm without Master");
1368 [ + - ]: 18604 : const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL;
1369 : :
1370 : : // there is a master for this follow and the master does not have
1371 : : // any contents (especially it does not have a number portion)
1372 : : bNumDone = ! pTmpPara ||
1373 [ + - ][ + - ]: 18604 : ! ((SwParaPortion*)pTmpPara)->GetFirstPortion()->IsFlyPortion();
1374 : : }
1375 : :
1376 : 68241 : pRoot = 0;
1377 : 68241 : pLast = 0;
1378 : 68241 : pFly = 0;
1379 : 68241 : pLastFld = 0;
1380 : 68241 : pLastTab = 0;
1381 : 68241 : pUnderFlow = 0;
1382 : 68241 : cTabDecimal = 0;
1383 : 68241 : nWidth = nRealWidth;
1384 : 68241 : nForcedLeftMargin = 0;
1385 : 68241 : nSoftHyphPos = 0;
1386 : 68241 : nUnderScorePos = STRING_LEN;
1387 : 68241 : cHookChar = 0;
1388 : 68241 : SetIdx(0);
1389 : 68241 : SetLen( GetTxt().Len() );
1390 : 68241 : SetPaintOfst(0);
1391 : 68241 : }
1392 : :
1393 : : /*--------------------------------------------------
1394 : : * There are a few differences between a copy constructor
1395 : : * and the following constructor for multi-line formatting.
1396 : : * The root is the first line inside the multi-portion,
1397 : : * the line start is the actual position in the text,
1398 : : * the line width is the rest width from the surrounding line
1399 : : * and the bMulti and bFirstMulti-flag has to be set correctly.
1400 : : * --------------------------------------------------*/
1401 : :
1402 : 772 : SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf,
1403 : : SwLineLayout& rLay, SwTwips nActWidth ) : SwTxtPaintInfo( rInf ),
1404 [ + - ]: 772 : bTabOverflow( sal_False )
1405 : : {
1406 : 772 : pRoot = &rLay;
1407 : 772 : pLast = &rLay;
1408 : 772 : pFly = NULL;
1409 : 772 : pLastFld = NULL;
1410 : 772 : pUnderFlow = NULL;
1411 : 772 : pRest = NULL;
1412 : 772 : pLastTab = NULL;
1413 : :
1414 : 772 : nSoftHyphPos = 0;
1415 : 772 : nUnderScorePos = STRING_LEN;
1416 : 772 : nHyphStart = 0;
1417 : 772 : nHyphWrdStart = 0;
1418 : 772 : nHyphWrdLen = 0;
1419 : 772 : nLineStart = rInf.GetIdx();
1420 : 772 : nLeft = rInf.nLeft;
1421 : 772 : nRight = rInf.nRight;
1422 : 772 : nFirst = rInf.nLeft;
1423 : 772 : nRealWidth = KSHORT(nActWidth);
1424 : 772 : nWidth = nRealWidth;
1425 : 772 : nLineHeight = 0;
1426 : 772 : nLineNettoHeight = 0;
1427 : 772 : nForcedLeftMargin = 0;
1428 : :
1429 : 772 : nMinLeading = 0;
1430 : 772 : nMinTrailing = 0;
1431 : 772 : nMinWordLength = 0;
1432 : 772 : bFull = sal_False;
1433 : 772 : bFtnDone = sal_True;
1434 : 772 : bErgoDone = sal_True;
1435 : 772 : bNumDone = sal_True;
1436 : 772 : bArrowDone = sal_True;
1437 : 772 : bStop = sal_False;
1438 : 772 : bNewLine = sal_True;
1439 : 772 : bShift = sal_False;
1440 : 772 : bUnderFlow = sal_False;
1441 : 772 : bInterHyph = sal_False;
1442 : 772 : bAutoHyph = sal_False;
1443 : 772 : bDropInit = sal_False;
1444 : 772 : bQuick = rInf.bQuick;
1445 : 772 : bNoEndHyph = sal_False;
1446 : 772 : bNoMidHyph = sal_False;
1447 : 772 : bIgnoreFly = sal_False;
1448 : 772 : bFakeLineStart = sal_False;
1449 : :
1450 : 772 : cTabDecimal = 0;
1451 : 772 : cHookChar = 0;
1452 : 772 : nMaxHyph = 0;
1453 : 772 : bTestFormat = rInf.bTestFormat;
1454 : 772 : SetMulti( sal_True );
1455 : 772 : SetFirstMulti( rInf.IsFirstMulti() );
1456 : 772 : }
1457 : 108 : sal_Bool SwTxtFormatInfo::_CheckFtnPortion( SwLineLayout* pCurr )
1458 : : {
1459 : 108 : KSHORT nHeight = pCurr->GetRealHeight();
1460 : 108 : SwLinePortion *pPor = pCurr->GetPortion();
1461 : 108 : sal_Bool bRet = sal_False;
1462 [ + + ]: 455 : while( pPor )
1463 : : {
1464 [ + + ][ - + ]: 347 : if( pPor->IsFtnPortion() && nHeight > ((SwFtnPortion*)pPor)->Orig() )
[ - + ]
1465 : : {
1466 : 0 : bRet = sal_True;
1467 : 0 : SetLineHeight( nHeight );
1468 : 0 : SetLineNettoHeight( pCurr->Height() );
1469 : 0 : break;
1470 : : }
1471 : 347 : pPor = pPor->GetPortion();
1472 : : }
1473 : 108 : return bRet;
1474 : : }
1475 : :
1476 : 41421 : xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart,
1477 : : const xub_StrLen nEnd )
1478 : : {
1479 : 41421 : cHookChar = 0;
1480 : 41421 : xub_StrLen i = nStart;
1481 : :
1482 : : //
1483 : : // Used for decimal tab handling:
1484 : : //
1485 [ + + ]: 41421 : const xub_Unicode cTabDec = GetLastTab() ? (sal_Unicode)GetTabDecimal() : 0;
1486 [ - + ]: 41421 : const xub_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
1487 : : // #i45951# German (Switzerland) uses ' as thousand separator
1488 [ - + ]: 41421 : const xub_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1489 : :
1490 : 41421 : bool bNumFound = false;
1491 : 41421 : const bool bTabCompat = GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT);
1492 : :
1493 [ + + ]: 3569939 : for( ; i < nEnd; ++i )
1494 : : {
1495 : 3528896 : const xub_Unicode cPos = GetChar( i );
1496 [ - + + + ]: 3528896 : switch( cPos )
1497 : : {
1498 : : case CH_TXTATR_BREAKWORD:
1499 : : case CH_TXTATR_INWORD:
1500 [ # # ]: 0 : if( !HasHint( i ))
1501 : 0 : break;
1502 : : // no break;
1503 : :
1504 : : case CHAR_SOFTHYPHEN:
1505 : : case CHAR_HARDHYPHEN:
1506 : : case CHAR_HARDBLANK:
1507 : : case CH_TAB:
1508 : : case CH_BREAK:
1509 : : case CHAR_ZWSP :
1510 : : case CHAR_ZWNBSP :
1511 : 378 : cHookChar = cPos;
1512 : 378 : return i;
1513 : :
1514 : : case CHAR_UNDERSCORE:
1515 [ + + ]: 5796 : if ( STRING_LEN == nUnderScorePos )
1516 : 154 : nUnderScorePos = i;
1517 : 5796 : break;
1518 : :
1519 : : default:
1520 [ - + ]: 3522722 : if ( cTabDec )
1521 : : {
1522 [ # # ]: 0 : if( cTabDec == cPos )
1523 : : {
1524 : : OSL_ENSURE( cPos, "Unexpected end of string" );
1525 [ # # ]: 0 : if( cPos ) // robust
1526 : : {
1527 : 0 : cHookChar = cPos;
1528 : 0 : return i;
1529 : : }
1530 : : }
1531 : :
1532 : : //
1533 : : // Compatibility: First non-digit character behind a
1534 : : // a digit character becomes the hook character
1535 : : //
1536 [ # # ]: 0 : if ( bTabCompat )
1537 : : {
1538 [ # # ][ # # ]: 0 : if ( ( 0x2F < cPos && cPos < 0x3A ) ||
[ # # ][ # # ]
[ # # ]
1539 : : ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1540 : : {
1541 : 0 : bNumFound = true;
1542 : : }
1543 : : else
1544 : : {
1545 [ # # ]: 0 : if ( bNumFound )
1546 : : {
1547 : 0 : cHookChar = cPos;
1548 : 0 : SetTabDecimal( cPos );
1549 : 0 : return i;
1550 : : }
1551 : : }
1552 : : }
1553 : : }
1554 : : }
1555 : : }
1556 : :
1557 : : // Check if character *behind* the portion has
1558 : : // to become the hook:
1559 [ + - ][ + + ]: 41043 : if ( i == nEnd && i < GetTxt().Len() && bNumFound )
[ - + ][ - + ]
1560 : : {
1561 : 0 : const xub_Unicode cPos = GetChar( i );
1562 [ # # ][ # # ]: 0 : if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
[ # # ][ # # ]
[ # # ]
1563 : : {
1564 : 0 : cHookChar = GetChar( i );
1565 : 0 : SetTabDecimal( cHookChar );
1566 : : }
1567 : : }
1568 : :
1569 : 41421 : return i;
1570 : : }
1571 : :
1572 : 53782 : sal_Bool SwTxtFormatInfo::LastKernPortion()
1573 : : {
1574 [ + - ]: 53782 : if( GetLast() )
1575 : : {
1576 [ + + ]: 53782 : if( GetLast()->IsKernPortion() )
1577 : 256 : return sal_True;
1578 [ + + ]: 55166 : if( GetLast()->Width() || ( GetLast()->GetLen() &&
[ + + + + ]
[ + + ]
1579 : 1640 : !GetLast()->IsHolePortion() ) )
1580 : 50269 : return sal_False;
1581 : : }
1582 : 3257 : SwLinePortion* pPor = GetRoot();
1583 : 3257 : SwLinePortion *pKern = NULL;
1584 [ + + ]: 9305 : while( pPor )
1585 : : {
1586 [ - + ]: 6048 : if( pPor->IsKernPortion() )
1587 : 0 : pKern = pPor;
1588 [ + + ][ + + ]: 6048 : else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
[ + + ][ + + ]
1589 : 2623 : pKern = NULL;
1590 : 6048 : pPor = pPor->GetPortion();
1591 : : }
1592 [ - + ]: 3257 : if( pKern )
1593 : : {
1594 : 0 : SetLast( pKern );
1595 : 0 : return sal_True;
1596 : : }
1597 : 53782 : return sal_False;
1598 : : }
1599 : :
1600 : 1840 : SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
1601 : : bool bTxtLen, bool bExgLists, const sal_Char *pCh )
1602 : : : pOldTxt( 0 ),
1603 : : pOldSmartTagList( 0 ),
1604 : : pOldGrammarCheckList( 0 ),
1605 : 1840 : pTempList( 0 )
1606 : : {
1607 [ - + ]: 1840 : if( pCh )
1608 : : {
1609 [ # # ][ # # ]: 0 : aTxt = XubString( pCh, RTL_TEXTENCODING_MS_1252 );
[ # # ]
1610 : 0 : bOn = sal_True;
1611 : : }
1612 : : else
1613 [ + - ]: 1840 : bOn = pPor->GetExpTxt( *pNew, aTxt );
1614 : :
1615 : : // Teh text is replaced ...
1616 [ + - ]: 1840 : if( bOn )
1617 : : {
1618 : 1840 : pInf = (SwTxtSizeInfo*)pNew;
1619 : 1840 : nIdx = pInf->GetIdx();
1620 : 1840 : nLen = pInf->GetLen();
1621 : 1840 : pOldTxt = &(pInf->GetTxt());
1622 : 1840 : pInf->SetTxt( aTxt );
1623 : 1840 : pInf->SetIdx( 0 );
1624 [ + - ]: 1840 : pInf->SetLen( bTxtLen ? pInf->GetTxt().Len() : pPor->GetLen() );
1625 : :
1626 : : // ST2
1627 [ + + ]: 1840 : if ( bExgLists )
1628 : : {
1629 : 1822 : pOldSmartTagList = static_cast<SwTxtPaintInfo*>(pInf)->GetSmartTags();
1630 [ - + ]: 1822 : if ( pOldSmartTagList )
1631 : : {
1632 [ # # ]: 0 : const sal_uInt16 nPos = pOldSmartTagList->GetWrongPos(nIdx);
1633 [ # # ]: 0 : const xub_StrLen nListPos = pOldSmartTagList->Pos(nPos);
1634 [ # # ]: 0 : if( nListPos == nIdx )
1635 [ # # ]: 0 : ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList->SubList( nPos ) );
1636 [ # # ][ # # ]: 0 : else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && aTxt.Len() )
[ # # ][ # # ]
[ # # ]
1637 : : {
1638 [ # # ][ # # ]: 0 : pTempList = new SwWrongList( WRONGLIST_SMARTTAG );
1639 [ # # ][ # # ]: 0 : pTempList->Insert( rtl::OUString(), 0, 0, aTxt.Len(), 0 );
1640 : 0 : ((SwTxtPaintInfo*)pInf)->SetSmartTags( pTempList );
1641 : : }
1642 : : else
1643 : 0 : ((SwTxtPaintInfo*)pInf)->SetSmartTags( 0);
1644 : : }
1645 : 1822 : pOldGrammarCheckList = static_cast<SwTxtPaintInfo*>(pInf)->GetGrammarCheckList();
1646 [ + + ]: 1822 : if ( pOldGrammarCheckList )
1647 : : {
1648 [ + - ]: 319 : const sal_uInt16 nPos = pOldGrammarCheckList->GetWrongPos(nIdx);
1649 [ + - ]: 319 : const xub_StrLen nListPos = pOldGrammarCheckList->Pos(nPos);
1650 [ + + ]: 319 : if( nListPos == nIdx )
1651 [ + - ]: 176 : ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList->SubList( nPos ) );
1652 [ + - ][ - + ]: 143 : else if( !pTempList && nPos < pOldGrammarCheckList->Count() && nListPos < nIdx && aTxt.Len() )
[ # # ][ # # ]
[ - + ]
1653 : : {
1654 [ # # ][ # # ]: 0 : pTempList = new SwWrongList( WRONGLIST_GRAMMAR );
1655 [ # # ][ # # ]: 0 : pTempList->Insert( rtl::OUString(), 0, 0, aTxt.Len(), 0 );
1656 : 0 : ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pTempList );
1657 : : }
1658 : : else
1659 : 143 : ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( 0);
1660 : : }
1661 : : }
1662 : : }
1663 : 1840 : }
1664 : :
1665 : 1840 : SwTxtSlot::~SwTxtSlot()
1666 : : {
1667 [ + - ]: 1840 : if( bOn )
1668 : : {
1669 : 1840 : pInf->SetTxt( *pOldTxt );
1670 : 1840 : pInf->SetIdx( nIdx );
1671 : 1840 : pInf->SetLen( nLen );
1672 : :
1673 : : // ST2
1674 : : // Restore old smart tag list
1675 [ - + ]: 1840 : if ( pOldSmartTagList )
1676 : 0 : ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList );
1677 [ + + ]: 1840 : if ( pOldGrammarCheckList )
1678 : 319 : ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList );
1679 [ - + ][ # # ]: 1840 : delete pTempList;
1680 : : }
1681 : 1840 : }
1682 : :
1683 : 5239 : SwFontSave::SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pNew,
1684 : : SwAttrIter* pItr )
1685 [ + + ]: 5239 : : pFnt( pNew ? ((SwTxtSizeInfo&)rInf).GetFont() : 0 )
1686 : : {
1687 [ + + ]: 5239 : if( pFnt )
1688 : : {
1689 : 2675 : pInf = &((SwTxtSizeInfo&)rInf);
1690 : : // In these cases we temporarily switch to the new font:
1691 : : // 1. the fonts have a different magic number
1692 : : // 2. they have different script types
1693 : : // 3. their background colors differ (this is not covered by 1.)
1694 [ + + + - : 6540 : if( pFnt->DifferentMagic( pNew, pFnt->GetActual() ) ||
+ + + + +
+ + - + +
+ - - + ]
[ + + ]
1695 : 789 : pNew->GetActual() != pFnt->GetActual() ||
1696 : 1550 : ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1697 : 749 : ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1698 : 749 : ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1699 : 28 : ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1700 : : {
1701 : 1954 : pNew->SetTransparent( sal_True );
1702 : 1954 : pNew->SetAlign( ALIGN_BASELINE );
1703 : 1954 : pInf->SetFont( pNew );
1704 : : }
1705 : : else
1706 : 721 : pFnt = 0;
1707 : 2675 : pNew->Invalidate();
1708 : 2675 : pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1709 [ + - ][ + + ]: 2675 : if( pItr && pItr->GetFnt() == pFnt )
[ + + ]
1710 : : {
1711 : 48 : pIter = pItr;
1712 : 48 : pIter->SetFnt( pNew );
1713 : : }
1714 : : else
1715 : 2627 : pIter = NULL;
1716 : : }
1717 : 5239 : }
1718 : :
1719 : 5239 : SwFontSave::~SwFontSave()
1720 : : {
1721 [ + + ]: 5239 : if( pFnt )
1722 : : {
1723 : : // Reset SwFont
1724 : 1954 : pFnt->Invalidate();
1725 : 1954 : pInf->SetFont( pFnt );
1726 [ + + ]: 1954 : if( pIter )
1727 : : {
1728 : 48 : pIter->SetFnt( pFnt );
1729 : 48 : pIter->nPos = STRING_LEN;
1730 : : }
1731 : : }
1732 : 5239 : }
1733 : :
1734 : 0 : SwDefFontSave::SwDefFontSave( const SwTxtSizeInfo &rInf )
1735 : 0 : : pFnt( ((SwTxtSizeInfo&)rInf).GetFont() )
1736 : : {
1737 : 0 : const sal_Bool bTmpAlter = pFnt->GetFixKerning() ||
1738 [ # # ][ # # ]: 0 : ( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet(pFnt->GetActual()) )
1739 : : ;
1740 : :
1741 : : const sal_Bool bFamily = bTmpAlter &&
1742 [ # # ][ # # ]: 0 : pFnt->GetName( pFnt->GetActual() ) != numfunc::GetDefBulletFontname();
1743 : 0 : const sal_Bool bRotation = (sal_Bool)pFnt->GetOrientation() &&
1744 [ # # ][ # # ]: 0 : ! rInf.GetTxtFrm()->IsVertical();
1745 : :
1746 [ # # ][ # # ]: 0 : if( bFamily || bRotation )
1747 : : {
1748 [ # # ]: 0 : pNewFnt = new SwFont( *pFnt );
1749 : :
1750 [ # # ]: 0 : if ( bFamily )
1751 : : {
1752 : 0 : pNewFnt->SetFamily( FAMILY_DONTKNOW, pFnt->GetActual() );
1753 : 0 : pNewFnt->SetName( numfunc::GetDefBulletFontname(), pFnt->GetActual() );
1754 : 0 : pNewFnt->SetStyleName( aEmptyStr, pFnt->GetActual() );
1755 : 0 : pNewFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, pFnt->GetActual() );
1756 : 0 : pNewFnt->SetFixKerning( 0 );
1757 : : }
1758 : :
1759 [ # # ]: 0 : if ( bRotation )
1760 : 0 : pNewFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );
1761 : :
1762 : 0 : pInf = &((SwTxtSizeInfo&)rInf);
1763 : 0 : pNewFnt->Invalidate();
1764 : 0 : pInf->SetFont( pNewFnt );
1765 : : }
1766 : : else
1767 : : {
1768 : 0 : pFnt = 0;
1769 : 0 : pNewFnt = 0;
1770 : : }
1771 : 0 : }
1772 : :
1773 : 0 : SwDefFontSave::~SwDefFontSave()
1774 : : {
1775 [ # # ]: 0 : if( pFnt )
1776 : : {
1777 [ # # ]: 0 : delete pNewFnt;
1778 : : // Reset SwFont
1779 : 0 : pFnt->Invalidate();
1780 : 0 : pInf->SetFont( pFnt );
1781 : : }
1782 : 0 : }
1783 : :
1784 : 0 : sal_Bool SwTxtFormatInfo::ChgHyph( const sal_Bool bNew )
1785 : : {
1786 : 0 : const sal_Bool bOld = bAutoHyph;
1787 [ # # ]: 0 : if( bAutoHyph != bNew )
1788 : : {
1789 : 0 : bAutoHyph = bNew;
1790 : 0 : InitHyph( bNew );
1791 : : // Set language in the Hyphenator
1792 [ # # ]: 0 : if( pFnt )
1793 : 0 : pFnt->ChgPhysFnt( pVsh, *pOut );
1794 : : }
1795 : 0 : return bOld;
1796 : : }
1797 : :
1798 : :
1799 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|