xref: /aoo41x/main/sw/source/core/text/inftxt.cxx (revision dec99bbd)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
29cdf0e10cSrcweir #include <unotools/linguprops.hxx>
30cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
31cdf0e10cSrcweir #include <hintids.hxx>
32cdf0e10cSrcweir #include <sfx2/printer.hxx>
33cdf0e10cSrcweir #include <editeng/hyznitem.hxx>
34cdf0e10cSrcweir #include <editeng/escpitem.hxx>
35cdf0e10cSrcweir #include <editeng/hngpnctitem.hxx>
36cdf0e10cSrcweir #include <editeng/scriptspaceitem.hxx>
37cdf0e10cSrcweir #include <editeng/brshitem.hxx>
38cdf0e10cSrcweir #include <editeng/splwrap.hxx>
39cdf0e10cSrcweir #include <editeng/pgrditem.hxx>
40cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <SwSmartTagMgr.hxx>
43cdf0e10cSrcweir #include <linguistic/lngprops.hxx>
44cdf0e10cSrcweir #include <editeng/unolingu.hxx>
45cdf0e10cSrcweir #include <breakit.hxx>
46cdf0e10cSrcweir #include <editeng/forbiddenruleitem.hxx>
47cdf0e10cSrcweir #include <txatbase.hxx>
48cdf0e10cSrcweir #include <fmtinfmt.hxx>
49cdf0e10cSrcweir #include <swmodule.hxx>
50cdf0e10cSrcweir #include <vcl/svapp.hxx>
51cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
52cdf0e10cSrcweir #include <viewsh.hxx>	// ViewShell
53cdf0e10cSrcweir #include <viewopt.hxx>	// SwViewOptions
54cdf0e10cSrcweir #include <frmtool.hxx>	// DrawGraphic
55cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx>
56cdf0e10cSrcweir #include <IDocumentDeviceAccess.hxx>
57cdf0e10cSrcweir #include <paratr.hxx>	// SwFmtDrop
58cdf0e10cSrcweir #include <rootfrm.hxx>  // SwRootFrm
59cdf0e10cSrcweir #include <inftxt.hxx>	// SwTxtInfo
60cdf0e10cSrcweir #include <blink.hxx>	// SwBlink
61cdf0e10cSrcweir #include <noteurl.hxx>	// SwNoteURL
62cdf0e10cSrcweir #include <porftn.hxx>	// SwFtnPortion
63cdf0e10cSrcweir #include <porrst.hxx>		// SwHangingPortion
64cdf0e10cSrcweir #include <itratr.hxx>
65cdf0e10cSrcweir #include <accessibilityoptions.hxx>
66cdf0e10cSrcweir #include <wrong.hxx>
67cdf0e10cSrcweir #include <doc.hxx>
68cdf0e10cSrcweir #include <pam.hxx>
69cdf0e10cSrcweir #include <SwGrammarMarkUp.hxx>
70cdf0e10cSrcweir #include <cstdio>
71cdf0e10cSrcweir #include <EnhancedPDFExportHelper.hxx>
72cdf0e10cSrcweir 
73cdf0e10cSrcweir #include <unomid.h>
74cdf0e10cSrcweir 
75cdf0e10cSrcweir using namespace ::com::sun::star;
76cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2;
77cdf0e10cSrcweir using namespace ::com::sun::star::uno;
78cdf0e10cSrcweir using namespace ::com::sun::star::beans;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 
81cdf0e10cSrcweir #define CHAR_UNDERSCORE ((sal_Unicode)0x005F)
82cdf0e10cSrcweir #define CHAR_LEFT_ARROW ((sal_Unicode)0x25C0)
83cdf0e10cSrcweir #define CHAR_RIGHT_ARROW ((sal_Unicode)0x25B6)
84cdf0e10cSrcweir #define CHAR_TAB ((sal_Unicode)0x2192)
85cdf0e10cSrcweir #define CHAR_TAB_RTL ((sal_Unicode)0x2190)
86cdf0e10cSrcweir #define CHAR_LINEBREAK ((sal_Unicode)0x21B5)
87cdf0e10cSrcweir #define CHAR_LINEBREAK_RTL ((sal_Unicode)0x21B3)
88cdf0e10cSrcweir 
89cdf0e10cSrcweir #define DRAW_SPECIAL_OPTIONS_CENTER 1
90cdf0e10cSrcweir #define DRAW_SPECIAL_OPTIONS_ROTATE 2
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // --> OD 2006-06-27 #b6440955#
93cdf0e10cSrcweir // variable moved to class <numfunc:GetDefBulletConfig>
94cdf0e10cSrcweir //extern const sal_Char __FAR_DATA sBulletFntName[];
95cdf0e10cSrcweir namespace numfunc
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     extern const String& GetDefBulletFontname();
98cdf0e10cSrcweir     extern bool IsDefBulletFontUserDefined();
99cdf0e10cSrcweir }
100cdf0e10cSrcweir // <--
101cdf0e10cSrcweir 
102cdf0e10cSrcweir #ifdef DBG_UTIL
103cdf0e10cSrcweir // Test2: WYSIWYG++
104cdf0e10cSrcweir // Test4: WYSIWYG debug
105cdf0e10cSrcweir static sal_Bool bDbgLow = sal_False;
106cdf0e10cSrcweir #endif
107cdf0e10cSrcweir 
108cdf0e10cSrcweir #ifdef DBG_UTIL
109cdf0e10cSrcweir 
IsOptCalm() const110cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptCalm() const { return !GetOpt().IsTest3(); }
111cdf0e10cSrcweir 
IsOptLow() const112cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptLow() const { return bDbgLow; }
113cdf0e10cSrcweir 
IsOptDbg() const114cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptDbg() const { return GetOpt().IsTest4(); }
115cdf0e10cSrcweir 
IsOptTest1() const116cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest1() const { return GetOpt().IsTest1(); }
117cdf0e10cSrcweir 
IsOptTest2() const118cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest2() const { return GetOpt().IsTest2(); }
119cdf0e10cSrcweir 
IsOptTest3() const120cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest3() const { return GetOpt().IsTest3(); }
121cdf0e10cSrcweir 
IsOptTest4() const122cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest4() const { return GetOpt().IsTest4(); }
123cdf0e10cSrcweir 
IsOptTest5() const124cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest5() const { return GetOpt().IsTest5(); }
125cdf0e10cSrcweir 
IsOptTest6() const126cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest6() const { return GetOpt().IsTest6(); }
127cdf0e10cSrcweir 
IsOptTest7() const128cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest7() const { return GetOpt().IsTest7(); }
129cdf0e10cSrcweir 
IsOptTest8() const130cdf0e10cSrcweir sal_Bool SwTxtSizeInfo::IsOptTest8() const { return GetOpt().IsTest8(); }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir #endif
133cdf0e10cSrcweir 
134cdf0e10cSrcweir /*************************************************************************
135cdf0e10cSrcweir  *						SwLineInfo::SwLineInfo()
136cdf0e10cSrcweir  *************************************************************************/
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // --> OD 2008-01-17 #newlistlevelattrs#
SwLineInfo()139cdf0e10cSrcweir SwLineInfo::SwLineInfo()
140cdf0e10cSrcweir     : pRuler( 0 ),
141cdf0e10cSrcweir       pSpace( 0 ),
142cdf0e10cSrcweir       nVertAlign( 0 ),
143cdf0e10cSrcweir       nDefTabStop( 0 ),
144cdf0e10cSrcweir       bListTabStopIncluded( false ),
145cdf0e10cSrcweir       nListTabStopPosition( 0 )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
~SwLineInfo()149cdf0e10cSrcweir SwLineInfo::~SwLineInfo()
150cdf0e10cSrcweir {
151cdf0e10cSrcweir     delete pRuler;
152cdf0e10cSrcweir }
CtorInitLineInfo(const SwAttrSet & rAttrSet,const SwTxtNode & rTxtNode)153cdf0e10cSrcweir void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet,
154cdf0e10cSrcweir                                    const SwTxtNode& rTxtNode )
155cdf0e10cSrcweir // <--
156cdf0e10cSrcweir {
157cdf0e10cSrcweir     // --> OD 2008-01-17 #newlistlevelattrs#
158cdf0e10cSrcweir //    pRuler = &rAttrSet.GetTabStops();
159cdf0e10cSrcweir     delete pRuler;
160cdf0e10cSrcweir     pRuler = new SvxTabStopItem( rAttrSet.GetTabStops() );
161cdf0e10cSrcweir     if ( rTxtNode.GetListTabStopPosition( nListTabStopPosition ) )
162cdf0e10cSrcweir     {
163cdf0e10cSrcweir         bListTabStopIncluded = true;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir         // insert the list tab stop into SvxTabItem instance <pRuler>
166cdf0e10cSrcweir         const SvxTabStop aListTabStop( nListTabStopPosition,
167cdf0e10cSrcweir                                        SVX_TAB_ADJUST_LEFT );
168cdf0e10cSrcweir         pRuler->Insert( aListTabStop );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir         // remove default tab stops, which are before the inserted list tab stop
171cdf0e10cSrcweir         for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ )
172cdf0e10cSrcweir         {
173cdf0e10cSrcweir             if ( (*pRuler)[i].GetTabPos() < nListTabStopPosition &&
174cdf0e10cSrcweir                  (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT )
175cdf0e10cSrcweir             {
176cdf0e10cSrcweir                 pRuler->Remove(i);
177cdf0e10cSrcweir                 continue;
178cdf0e10cSrcweir             }
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir     // <--
182cdf0e10cSrcweir     // --> OD 2008-02-15 #newlistlevelattrs#
183cdf0e10cSrcweir     if ( !rTxtNode.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) )
184cdf0e10cSrcweir     {
185cdf0e10cSrcweir         // remove default tab stop at position 0
186cdf0e10cSrcweir         for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ )
187cdf0e10cSrcweir         {
188cdf0e10cSrcweir             if ( (*pRuler)[i].GetTabPos() == 0 &&
189cdf0e10cSrcweir                  (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT )
190cdf0e10cSrcweir             {
191cdf0e10cSrcweir                 pRuler->Remove(i);
192cdf0e10cSrcweir                 break;
193cdf0e10cSrcweir             }
194cdf0e10cSrcweir         }
195cdf0e10cSrcweir     }
196cdf0e10cSrcweir     // <--
197cdf0e10cSrcweir 	pSpace = &rAttrSet.GetLineSpacing();
198cdf0e10cSrcweir     nVertAlign = rAttrSet.GetParaVertAlign().GetValue();
199cdf0e10cSrcweir     nDefTabStop = MSHRT_MAX;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir /*************************************************************************
203cdf0e10cSrcweir  *						SwTxtInfo::CtorInitTxtInfo()
204cdf0e10cSrcweir  *************************************************************************/
205cdf0e10cSrcweir 
CtorInitTxtInfo(SwTxtFrm * pFrm)206cdf0e10cSrcweir void SwTxtInfo::CtorInitTxtInfo( SwTxtFrm *pFrm )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 	pPara = pFrm->GetPara();
209cdf0e10cSrcweir 	nTxtStart = pFrm->GetOfst();
210cdf0e10cSrcweir 	if( !pPara )
211cdf0e10cSrcweir 	{
212cdf0e10cSrcweir 		ASSERT( pPara, "+SwTxtInfo::CTOR: missing paragraph information" );
213cdf0e10cSrcweir 		pFrm->Format();
214cdf0e10cSrcweir 		pPara = pFrm->GetPara();
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
SwTxtInfo(const SwTxtInfo & rInf)218cdf0e10cSrcweir SwTxtInfo::SwTxtInfo( const SwTxtInfo &rInf )
219cdf0e10cSrcweir 	: pPara( ((SwTxtInfo&)rInf).GetParaPortion() ),
220cdf0e10cSrcweir 	  nTxtStart( rInf.GetTxtStart() )
221cdf0e10cSrcweir { }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 
224cdf0e10cSrcweir #ifdef DBG_UTIL
225cdf0e10cSrcweir /*************************************************************************
226cdf0e10cSrcweir  *						ChkOutDev()
227cdf0e10cSrcweir  *************************************************************************/
228cdf0e10cSrcweir 
ChkOutDev(const SwTxtSizeInfo & rInf)229cdf0e10cSrcweir void ChkOutDev( const SwTxtSizeInfo &rInf )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir     if ( !rInf.GetVsh() )
232cdf0e10cSrcweir         return;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     const OutputDevice* pOut = rInf.GetOut();
235cdf0e10cSrcweir     const OutputDevice* pRef = rInf.GetRefDev();
236cdf0e10cSrcweir     ASSERT( pOut && pRef, "ChkOutDev: invalid output devices" )
237cdf0e10cSrcweir }
238cdf0e10cSrcweir #endif	// PRODUCT
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 
GetMinLen(const SwTxtSizeInfo & rInf)241cdf0e10cSrcweir inline xub_StrLen GetMinLen( const SwTxtSizeInfo &rInf )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir 	const xub_StrLen nInfLen = rInf.GetIdx() + rInf.GetLen();
244cdf0e10cSrcweir 	return Min( rInf.GetTxt().Len(), nInfLen );
245cdf0e10cSrcweir }
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 
SwTxtSizeInfo(const SwTxtSizeInfo & rNew)248cdf0e10cSrcweir SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew )
249cdf0e10cSrcweir 	: SwTxtInfo( rNew ),
250cdf0e10cSrcweir       pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
251cdf0e10cSrcweir       pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
252cdf0e10cSrcweir       pOut(((SwTxtSizeInfo&)rNew).GetOut()),
253cdf0e10cSrcweir       pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
254cdf0e10cSrcweir 	  pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
255cdf0e10cSrcweir       pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
256cdf0e10cSrcweir 	  pFrm(rNew.pFrm),
257cdf0e10cSrcweir 	  pOpt(&rNew.GetOpt()),
258cdf0e10cSrcweir 	  pTxt(&rNew.GetTxt()),
259cdf0e10cSrcweir 	  nIdx(rNew.GetIdx()),
260cdf0e10cSrcweir 	  nLen(rNew.GetLen()),
261cdf0e10cSrcweir       nKanaIdx( rNew.GetKanaIdx() ),
262cdf0e10cSrcweir 	  bOnWin( rNew.OnWin() ),
263cdf0e10cSrcweir 	  bNotEOL( rNew.NotEOL() ),
264cdf0e10cSrcweir 	  bURLNotify( rNew.URLNotify() ),
265cdf0e10cSrcweir 	  bStopUnderFlow( rNew.StopUnderFlow() ),
266cdf0e10cSrcweir       bFtnInside( rNew.IsFtnInside() ),
267cdf0e10cSrcweir       bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ),
268cdf0e10cSrcweir 	  bMulti( rNew.IsMulti() ),
269cdf0e10cSrcweir 	  bFirstMulti( rNew.IsFirstMulti() ),
270cdf0e10cSrcweir 	  bRuby( rNew.IsRuby() ),
271cdf0e10cSrcweir 	  bHanging( rNew.IsHanging() ),
272cdf0e10cSrcweir 	  bScriptSpace( rNew.HasScriptSpace() ),
273cdf0e10cSrcweir 	  bForbiddenChars( rNew.HasForbiddenChars() ),
274cdf0e10cSrcweir       bSnapToGrid( rNew.SnapToGrid() ),
275cdf0e10cSrcweir 	  nDirection( rNew.GetDirection() )
276cdf0e10cSrcweir {
277cdf0e10cSrcweir #ifdef DBG_UTIL
278cdf0e10cSrcweir 	ChkOutDev( *this );
279cdf0e10cSrcweir #endif
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
CtorInitTxtSizeInfo(SwTxtFrm * pFrame,SwFont * pNewFnt,const xub_StrLen nNewIdx,const xub_StrLen nNewLen)282cdf0e10cSrcweir void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt,
283cdf0e10cSrcweir 				   const xub_StrLen nNewIdx, const xub_StrLen nNewLen )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir     pKanaComp = NULL;
286cdf0e10cSrcweir     nKanaIdx = 0;
287cdf0e10cSrcweir 	pFrm = pFrame;
288cdf0e10cSrcweir 	CtorInitTxtInfo( pFrm );
289cdf0e10cSrcweir     const SwTxtNode *pNd = pFrm->GetTxtNode();
290cdf0e10cSrcweir     pVsh = pFrm->getRootFrm()->GetCurrShell();
291cdf0e10cSrcweir 
292cdf0e10cSrcweir     // Get the output and reference device
293cdf0e10cSrcweir     if ( pVsh )
294cdf0e10cSrcweir     {
295cdf0e10cSrcweir         pOut = pVsh->GetOut();
296cdf0e10cSrcweir         pRef = &pVsh->GetRefDev();
297cdf0e10cSrcweir         bOnWin = pVsh->GetWin() || OUTDEV_WINDOW == pOut->GetOutDevType();
298cdf0e10cSrcweir     }
299cdf0e10cSrcweir     else
300cdf0e10cSrcweir     {
301cdf0e10cSrcweir         //Zugriff ueber StarONE, es muss keine Shell existieren oder aktiv sein.
302cdf0e10cSrcweir         if ( pNd->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE) )
303cdf0e10cSrcweir         {
304cdf0e10cSrcweir             //in Ermangelung eines Besseren kann hier ja wohl nur noch das
305cdf0e10cSrcweir             //AppWin genommen werden?
306cdf0e10cSrcweir             pOut = GetpApp()->GetDefaultDevice();
307cdf0e10cSrcweir         }
308cdf0e10cSrcweir         else
309cdf0e10cSrcweir             pOut = pNd->getIDocumentDeviceAccess()->getPrinter( false );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir         pRef = pOut;
312cdf0e10cSrcweir     }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir #ifdef DBG_UTIL
315cdf0e10cSrcweir     ChkOutDev( *this );
316cdf0e10cSrcweir #endif
317cdf0e10cSrcweir 
318cdf0e10cSrcweir     // Set default layout mode ( LTR or RTL ).
319cdf0e10cSrcweir     if ( pFrm->IsRightToLeft() )
320cdf0e10cSrcweir     {
321cdf0e10cSrcweir         pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
322cdf0e10cSrcweir         pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
323cdf0e10cSrcweir         nDirection = DIR_RIGHT2LEFT;
324cdf0e10cSrcweir     }
325cdf0e10cSrcweir     else
326cdf0e10cSrcweir     {
327cdf0e10cSrcweir         pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
328cdf0e10cSrcweir         pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
329cdf0e10cSrcweir         nDirection = DIR_LEFT2RIGHT;
330cdf0e10cSrcweir     }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir /*    LanguageType eLang;
333cdf0e10cSrcweir     const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
334cdf0e10cSrcweir     if ( SvtCTLOptions::NUMERALS_HINDI == rCTLOptions.GetCTLTextNumerals() )
335cdf0e10cSrcweir         eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
336cdf0e10cSrcweir     else if ( SvtCTLOptions::NUMERALS_ARABIC == rCTLOptions.GetCTLTextNumerals() )
337cdf0e10cSrcweir         eLang = LANGUAGE_ENGLISH;
338cdf0e10cSrcweir     else
339cdf0e10cSrcweir         eLang = (LanguageType)::GetAppLanguage();
340cdf0e10cSrcweir 
341cdf0e10cSrcweir     pOut->SetDigitLanguage( eLang );
342cdf0e10cSrcweir     pRef->SetDigitLanguage( eLang );*/
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     //
345cdf0e10cSrcweir     // The Options
346cdf0e10cSrcweir     //
347cdf0e10cSrcweir     pOpt = pVsh ?
348cdf0e10cSrcweir            pVsh->GetViewOptions() :
349cdf0e10cSrcweir            SW_MOD()->GetViewOption( pNd->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE) ); //Options vom Module wg. StarONE
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     // bURLNotify wird gesetzt, wenn MakeGraphic dies vorbereitet
352cdf0e10cSrcweir     // TODO: Aufdr?seln
353cdf0e10cSrcweir     bURLNotify = pNoteURL && !bOnWin;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir     SetSnapToGrid( pNd->GetSwAttrSet().GetParaGrid().GetValue() &&
356cdf0e10cSrcweir                    pFrm->IsInDocBody() );
357cdf0e10cSrcweir 
358cdf0e10cSrcweir     pFnt = pNewFnt;
359cdf0e10cSrcweir     pUnderFnt = 0;
360cdf0e10cSrcweir     pTxt = &pNd->GetTxt();
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	nIdx = nNewIdx;
363cdf0e10cSrcweir 	nLen = nNewLen;
364cdf0e10cSrcweir 	bNotEOL = sal_False;
365cdf0e10cSrcweir     bStopUnderFlow = bFtnInside = bOtherThanFtnInside = sal_False;
366cdf0e10cSrcweir 	bMulti = bFirstMulti = bRuby = bHanging = bScriptSpace =
367cdf0e10cSrcweir 		bForbiddenChars = sal_False;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 	SetLen( GetMinLen( *this ) );
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
SwTxtSizeInfo(const SwTxtSizeInfo & rNew,const XubString & rTxt,const xub_StrLen nIndex,const xub_StrLen nLength)372cdf0e10cSrcweir SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt,
373cdf0e10cSrcweir                               const xub_StrLen nIndex, const xub_StrLen nLength )
374cdf0e10cSrcweir 	: SwTxtInfo( rNew ),
375cdf0e10cSrcweir       pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
376cdf0e10cSrcweir 	  pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
377cdf0e10cSrcweir 	  pOut(((SwTxtSizeInfo&)rNew).GetOut()),
378cdf0e10cSrcweir       pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
379cdf0e10cSrcweir 	  pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
380cdf0e10cSrcweir       pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
381cdf0e10cSrcweir 	  pFrm( rNew.pFrm ),
382cdf0e10cSrcweir 	  pOpt(&rNew.GetOpt()),
383cdf0e10cSrcweir 	  pTxt(&rTxt),
384cdf0e10cSrcweir       nIdx(nIndex),
385cdf0e10cSrcweir       nLen(nLength),
386cdf0e10cSrcweir       nKanaIdx( rNew.GetKanaIdx() ),
387cdf0e10cSrcweir 	  bOnWin( rNew.OnWin() ),
388cdf0e10cSrcweir 	  bNotEOL( rNew.NotEOL() ),
389cdf0e10cSrcweir 	  bURLNotify( rNew.URLNotify() ),
390cdf0e10cSrcweir 	  bStopUnderFlow( rNew.StopUnderFlow() ),
391cdf0e10cSrcweir       bFtnInside( rNew.IsFtnInside() ),
392cdf0e10cSrcweir       bOtherThanFtnInside( rNew.IsOtherThanFtnInside() ),
393cdf0e10cSrcweir 	  bMulti( rNew.IsMulti() ),
394cdf0e10cSrcweir 	  bFirstMulti( rNew.IsFirstMulti() ),
395cdf0e10cSrcweir 	  bRuby( rNew.IsRuby() ),
396cdf0e10cSrcweir 	  bHanging( rNew.IsHanging() ),
397cdf0e10cSrcweir 	  bScriptSpace( rNew.HasScriptSpace() ),
398cdf0e10cSrcweir 	  bForbiddenChars( rNew.HasForbiddenChars() ),
399cdf0e10cSrcweir       bSnapToGrid( rNew.SnapToGrid() ),
400cdf0e10cSrcweir 	  nDirection( rNew.GetDirection() )
401cdf0e10cSrcweir {
402cdf0e10cSrcweir #ifdef DBG_UTIL
403cdf0e10cSrcweir 	ChkOutDev( *this );
404cdf0e10cSrcweir #endif
405cdf0e10cSrcweir 	SetLen( GetMinLen( *this ) );
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir /*************************************************************************
409cdf0e10cSrcweir  *						SwTxtSizeInfo::SelectFont()
410cdf0e10cSrcweir  *************************************************************************/
411cdf0e10cSrcweir 
SelectFont()412cdf0e10cSrcweir void SwTxtSizeInfo::SelectFont()
413cdf0e10cSrcweir {
414cdf0e10cSrcweir 	// 8731: Der Weg muss ueber ChgPhysFnt gehen, sonst geraet
415cdf0e10cSrcweir 	// der FontMetricCache durcheinander. In diesem Fall steht pLastMet
416cdf0e10cSrcweir 	// auf dem alten Wert.
417cdf0e10cSrcweir 	// Falsch: GetOut()->SetFont( GetFont()->GetFnt() );
418cdf0e10cSrcweir 	GetFont()->Invalidate();
419cdf0e10cSrcweir     GetFont()->ChgPhysFnt( pVsh, *GetOut() );
420cdf0e10cSrcweir }
421cdf0e10cSrcweir 
422cdf0e10cSrcweir /*************************************************************************
423cdf0e10cSrcweir  *                      SwTxtSizeInfo::NoteAnimation()
424cdf0e10cSrcweir  *************************************************************************/
425cdf0e10cSrcweir 
NoteAnimation() const426cdf0e10cSrcweir void SwTxtSizeInfo::NoteAnimation() const
427cdf0e10cSrcweir {
428cdf0e10cSrcweir     if( OnWin() )
429cdf0e10cSrcweir         SwRootFrm::FlushVout();
430cdf0e10cSrcweir 
431cdf0e10cSrcweir     ASSERT( pOut == pVsh->GetOut(),
432cdf0e10cSrcweir             "SwTxtSizeInfo::NoteAnimation() changed pOut" )
433cdf0e10cSrcweir }
434cdf0e10cSrcweir 
435cdf0e10cSrcweir /*************************************************************************
436cdf0e10cSrcweir  *                      SwTxtSizeInfo::GetTxtSize()
437cdf0e10cSrcweir  *************************************************************************/
438cdf0e10cSrcweir 
GetTxtSize(OutputDevice * pOutDev,const SwScriptInfo * pSI,const XubString & rTxt,const xub_StrLen nIndex,const xub_StrLen nLength,const sal_uInt16 nComp) const439cdf0e10cSrcweir SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
440cdf0e10cSrcweir                                      const SwScriptInfo* pSI,
441cdf0e10cSrcweir                                      const XubString& rTxt,
442cdf0e10cSrcweir                                      const xub_StrLen nIndex,
443cdf0e10cSrcweir                                      const xub_StrLen nLength,
444cdf0e10cSrcweir                                      const sal_uInt16 nComp ) const
445cdf0e10cSrcweir {
446cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pVsh, *pOutDev, pSI, rTxt, nIndex, nLength );
447cdf0e10cSrcweir     aDrawInf.SetFrm( pFrm );
448cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
449cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
450cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
451cdf0e10cSrcweir     SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
452cdf0e10cSrcweir     return aSize;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir /*************************************************************************
456cdf0e10cSrcweir  *                      SwTxtSizeInfo::GetTxtSize()
457cdf0e10cSrcweir  *************************************************************************/
458cdf0e10cSrcweir 
GetTxtSize() const459cdf0e10cSrcweir SwPosSize SwTxtSizeInfo::GetTxtSize() const
460cdf0e10cSrcweir {
461cdf0e10cSrcweir     const SwScriptInfo& rSI =
462cdf0e10cSrcweir                      ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
463cdf0e10cSrcweir 
464cdf0e10cSrcweir     // in some cases, compression is not allowed or surpressed for
465cdf0e10cSrcweir     // performance reasons
466cdf0e10cSrcweir     sal_uInt16 nComp =( SW_CJK == GetFont()->GetActual() &&
467cdf0e10cSrcweir                     rSI.CountCompChg() &&
468cdf0e10cSrcweir                     ! IsMulti() ) ?
469cdf0e10cSrcweir                     GetKanaComp() :
470cdf0e10cSrcweir                                 0 ;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pVsh, *pOut, &rSI, *pTxt, nIdx, nLen );
473cdf0e10cSrcweir     aDrawInf.SetFrm( pFrm );
474cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
475cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
476cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
477cdf0e10cSrcweir     return pFnt->_GetTxtSize( aDrawInf );
478cdf0e10cSrcweir }
479cdf0e10cSrcweir 
480cdf0e10cSrcweir /*************************************************************************
481cdf0e10cSrcweir  *                      SwTxtSizeInfo::GetTxtSize()
482cdf0e10cSrcweir  *************************************************************************/
483cdf0e10cSrcweir 
GetTxtSize(const SwScriptInfo * pSI,const xub_StrLen nIndex,const xub_StrLen nLength,const sal_uInt16 nComp,sal_uInt16 & nMinSize,sal_uInt16 & nMaxSizeDiff) const484cdf0e10cSrcweir void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex,
485cdf0e10cSrcweir                                 const xub_StrLen nLength, const sal_uInt16 nComp,
486cdf0e10cSrcweir                                 sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const
487cdf0e10cSrcweir {
488cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pVsh, *pOut, pSI, *pTxt, nIndex, nLength );
489cdf0e10cSrcweir     aDrawInf.SetFrm( pFrm );
490cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
491cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
492cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
493cdf0e10cSrcweir     SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
494cdf0e10cSrcweir     nMaxSizeDiff = (sal_uInt16)aDrawInf.GetKanaDiff();
495cdf0e10cSrcweir     nMinSize = aSize.Width();
496cdf0e10cSrcweir }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir /*************************************************************************
499cdf0e10cSrcweir  *                      SwTxtSizeInfo::GetTxtBreak()
500cdf0e10cSrcweir  *************************************************************************/
501cdf0e10cSrcweir 
GetTxtBreak(const long nLineWidth,const xub_StrLen nMaxLen,const sal_uInt16 nComp) const502cdf0e10cSrcweir xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
503cdf0e10cSrcweir                                        const xub_StrLen nMaxLen,
504cdf0e10cSrcweir                                        const sal_uInt16 nComp ) const
505cdf0e10cSrcweir {
506cdf0e10cSrcweir     const SwScriptInfo& rScriptInfo =
507cdf0e10cSrcweir                      ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
508cdf0e10cSrcweir 
509cdf0e10cSrcweir     ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" )
510cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
511cdf0e10cSrcweir                              *pTxt, GetIdx(), nMaxLen );
512cdf0e10cSrcweir     aDrawInf.SetFrm( pFrm );
513cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
514cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
515cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
516cdf0e10cSrcweir     aDrawInf.SetHyphPos( 0 );
517cdf0e10cSrcweir 
518cdf0e10cSrcweir     return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
519cdf0e10cSrcweir }
520cdf0e10cSrcweir 
521cdf0e10cSrcweir /*************************************************************************
522cdf0e10cSrcweir  *                      SwTxtSizeInfo::GetTxtBreak()
523cdf0e10cSrcweir  *************************************************************************/
524cdf0e10cSrcweir 
GetTxtBreak(const long nLineWidth,const xub_StrLen nMaxLen,const sal_uInt16 nComp,xub_StrLen & rExtraCharPos) const525cdf0e10cSrcweir xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
526cdf0e10cSrcweir                                        const xub_StrLen nMaxLen,
527cdf0e10cSrcweir                                        const sal_uInt16 nComp,
528cdf0e10cSrcweir                                        xub_StrLen& rExtraCharPos ) const
529cdf0e10cSrcweir {
530cdf0e10cSrcweir     const SwScriptInfo& rScriptInfo =
531cdf0e10cSrcweir                      ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" )
534cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
535cdf0e10cSrcweir                              *pTxt, GetIdx(), nMaxLen );
536cdf0e10cSrcweir     aDrawInf.SetFrm( pFrm );
537cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
538cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
539cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
540cdf0e10cSrcweir     aDrawInf.SetHyphPos( &rExtraCharPos );
541cdf0e10cSrcweir 
542cdf0e10cSrcweir     return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
543cdf0e10cSrcweir }
544cdf0e10cSrcweir 
545cdf0e10cSrcweir /*************************************************************************
546cdf0e10cSrcweir  *					   SwTxtPaintInfo::CtorInitTxtPaintInfo()
547cdf0e10cSrcweir  *************************************************************************/
548cdf0e10cSrcweir 
CtorInitTxtPaintInfo(SwTxtFrm * pFrame,const SwRect & rPaint)549cdf0e10cSrcweir void SwTxtPaintInfo::CtorInitTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPaint )
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	CtorInitTxtSizeInfo( pFrame );
552cdf0e10cSrcweir 	aTxtFly.CtorInitTxtFly( pFrame ),
553cdf0e10cSrcweir 	aPaintRect = rPaint;
554cdf0e10cSrcweir 	nSpaceIdx = 0;
555cdf0e10cSrcweir 	pSpaceAdd = NULL;
556cdf0e10cSrcweir 	pWrongList = NULL;
557cdf0e10cSrcweir     pGrammarCheckList = NULL;
558cdf0e10cSrcweir     pSmartTags = NULL;  // SMARTTAGS
559cdf0e10cSrcweir 
560cdf0e10cSrcweir #ifndef DBG_UTIL
561cdf0e10cSrcweir 	pBrushItem = 0;
562cdf0e10cSrcweir #else
563cdf0e10cSrcweir 	pBrushItem = ((SvxBrushItem*)-1);
564cdf0e10cSrcweir #endif
565cdf0e10cSrcweir }
566cdf0e10cSrcweir 
SwTxtPaintInfo(const SwTxtPaintInfo & rInf,const XubString & rTxt)567cdf0e10cSrcweir SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf, const XubString &rTxt )
568cdf0e10cSrcweir 	: SwTxtSizeInfo( rInf, rTxt ),
569cdf0e10cSrcweir       pWrongList( rInf.GetpWrongList() ),
570cdf0e10cSrcweir       pGrammarCheckList( rInf.GetGrammarCheckList() ),
571cdf0e10cSrcweir       pSmartTags( rInf.GetSmartTags() ),    // SMARTTAGS
572cdf0e10cSrcweir       pSpaceAdd( rInf.GetpSpaceAdd() ),
573cdf0e10cSrcweir       pBrushItem( rInf.GetBrushItem() ),
574cdf0e10cSrcweir       aTxtFly( *rInf.GetTxtFly() ),
575cdf0e10cSrcweir 	  aPos( rInf.GetPos() ),
576cdf0e10cSrcweir 	  aPaintRect( rInf.GetPaintRect() ),
577cdf0e10cSrcweir 	  nSpaceIdx( rInf.GetSpaceIdx() )
578cdf0e10cSrcweir { }
579cdf0e10cSrcweir 
SwTxtPaintInfo(const SwTxtPaintInfo & rInf)580cdf0e10cSrcweir SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf )
581cdf0e10cSrcweir 	: SwTxtSizeInfo( rInf ),
582cdf0e10cSrcweir       pWrongList( rInf.GetpWrongList() ),
583cdf0e10cSrcweir       pGrammarCheckList( rInf.GetGrammarCheckList() ),
584cdf0e10cSrcweir       pSmartTags( rInf.GetSmartTags() ),    // SMARTTAGS
585cdf0e10cSrcweir       pSpaceAdd( rInf.GetpSpaceAdd() ),
586cdf0e10cSrcweir       pBrushItem( rInf.GetBrushItem() ),
587cdf0e10cSrcweir       aTxtFly( *rInf.GetTxtFly() ),
588cdf0e10cSrcweir 	  aPos( rInf.GetPos() ),
589cdf0e10cSrcweir 	  aPaintRect( rInf.GetPaintRect() ),
590cdf0e10cSrcweir 	  nSpaceIdx( rInf.GetSpaceIdx() )
591cdf0e10cSrcweir { }
592cdf0e10cSrcweir 
593cdf0e10cSrcweir extern Color aGlobalRetoucheColor;
594cdf0e10cSrcweir 
595cdf0e10cSrcweir /*************************************************************************
596cdf0e10cSrcweir  *                          lcl_IsDarkBackground
597cdf0e10cSrcweir  *
598cdf0e10cSrcweir  * Returns if the current background color is dark.
599cdf0e10cSrcweir  *************************************************************************/
600cdf0e10cSrcweir 
lcl_IsDarkBackground(const SwTxtPaintInfo & rInf)601cdf0e10cSrcweir sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
602cdf0e10cSrcweir {
603cdf0e10cSrcweir     const Color* pCol = rInf.GetFont()->GetBackColor();
604cdf0e10cSrcweir     if( ! pCol || COL_TRANSPARENT == pCol->GetColor() )
605cdf0e10cSrcweir     {
606cdf0e10cSrcweir         const SvxBrushItem* pItem;
607cdf0e10cSrcweir         SwRect aOrigBackRect;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir         /// OD 21.08.2002
610cdf0e10cSrcweir         ///     consider, that [GetBackgroundBrush(...)] can set <pCol>
611cdf0e10cSrcweir         ///     - see implementation in /core/layout/paintfrm.cxx
612cdf0e10cSrcweir         /// OD 21.08.2002 #99657#
613cdf0e10cSrcweir         ///     There is a background color, if there is a background brush and
614cdf0e10cSrcweir         ///     its color is *not* "no fill"/"auto fill".
615cdf0e10cSrcweir         if( rInf.GetTxtFrm()->GetBackgroundBrush( pItem, pCol, aOrigBackRect, sal_False ) )
616cdf0e10cSrcweir         {
617cdf0e10cSrcweir             if ( !pCol )
618cdf0e10cSrcweir                 pCol = &pItem->GetColor();
619cdf0e10cSrcweir 
620cdf0e10cSrcweir             /// OD 30.08.2002 #99657#
621cdf0e10cSrcweir             /// determined color <pCol> can be <COL_TRANSPARENT>. Thus, check it.
622cdf0e10cSrcweir             if ( pCol->GetColor() == COL_TRANSPARENT)
623cdf0e10cSrcweir                 pCol = NULL;
624cdf0e10cSrcweir         }
625cdf0e10cSrcweir         else
626cdf0e10cSrcweir             pCol = NULL;
627cdf0e10cSrcweir     }
628cdf0e10cSrcweir 
629cdf0e10cSrcweir 
630cdf0e10cSrcweir     if( !pCol )
631cdf0e10cSrcweir         pCol = &aGlobalRetoucheColor;
632cdf0e10cSrcweir 
633cdf0e10cSrcweir     return pCol->IsDark();
634cdf0e10cSrcweir }
635cdf0e10cSrcweir 
636cdf0e10cSrcweir /*************************************************************************
637cdf0e10cSrcweir  *					   SwTxtPaintInfo::_DrawText()
638cdf0e10cSrcweir  *************************************************************************/
639cdf0e10cSrcweir 
_DrawText(const XubString & rText,const SwLinePortion & rPor,const xub_StrLen nStart,const xub_StrLen nLength,const sal_Bool bKern,const sal_Bool bWrong,const sal_Bool bSmartTag,const sal_Bool bGrammarCheck)640cdf0e10cSrcweir void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPor,
641cdf0e10cSrcweir                                 const xub_StrLen nStart, const xub_StrLen nLength,
642cdf0e10cSrcweir                                 const sal_Bool bKern, const sal_Bool bWrong,
643cdf0e10cSrcweir                                 const sal_Bool bSmartTag,
644cdf0e10cSrcweir                                 const sal_Bool bGrammarCheck )  // SMARTTAGS
645cdf0e10cSrcweir {
646cdf0e10cSrcweir     if( !nLength )
647cdf0e10cSrcweir 		return;
648cdf0e10cSrcweir 
649cdf0e10cSrcweir     if( GetFont()->IsBlink() && OnWin() && rPor.Width() )
650cdf0e10cSrcweir 	{
651cdf0e10cSrcweir         // check if accessibility options allow blinking portions:
652cdf0e10cSrcweir         const ViewShell* pSh = GetTxtFrm()->getRootFrm()->GetCurrShell();
653cdf0e10cSrcweir         if ( pSh && ! pSh->GetAccessibilityOptions()->IsStopAnimatedText() &&
654cdf0e10cSrcweir              ! pSh->IsPreView() )
655cdf0e10cSrcweir         {
656cdf0e10cSrcweir             if( !pBlink )
657cdf0e10cSrcweir                 pBlink = new SwBlink();
658cdf0e10cSrcweir 
659cdf0e10cSrcweir 			Point aPoint( aPos );
660cdf0e10cSrcweir 
661cdf0e10cSrcweir             if ( GetTxtFrm()->IsRightToLeft() )
662cdf0e10cSrcweir                 GetTxtFrm()->SwitchLTRtoRTL( aPoint );
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 			if ( TEXT_LAYOUT_BIDI_STRONG != GetOut()->GetLayoutMode() )
665cdf0e10cSrcweir                 aPoint.X() -= rPor.Width();
666cdf0e10cSrcweir 
667cdf0e10cSrcweir             if ( GetTxtFrm()->IsVertical() )
668cdf0e10cSrcweir                 GetTxtFrm()->SwitchHorizontalToVertical( aPoint );
669cdf0e10cSrcweir 
670cdf0e10cSrcweir             pBlink->Insert( aPoint, &rPor, GetTxtFrm(), pFnt->GetOrientation() );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir             if( !pBlink->IsVisible() )
673cdf0e10cSrcweir                 return;
674cdf0e10cSrcweir         }
675cdf0e10cSrcweir         else
676cdf0e10cSrcweir         {
677cdf0e10cSrcweir             delete pBlink;
678cdf0e10cSrcweir             pBlink = NULL;
679cdf0e10cSrcweir         }
680cdf0e10cSrcweir 	}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir     // The SwScriptInfo is useless if we are inside a field portion
683cdf0e10cSrcweir     SwScriptInfo* pSI = 0;
684cdf0e10cSrcweir     if ( ! rPor.InFldGrp() )
685cdf0e10cSrcweir         pSI = &GetParaPortion()->GetScriptInfo();
686cdf0e10cSrcweir 
687cdf0e10cSrcweir     // in some cases, kana compression is not allowed or surpressed for
688cdf0e10cSrcweir     // performance reasons
689cdf0e10cSrcweir     sal_uInt16 nComp = 0;
690cdf0e10cSrcweir     if ( ! IsMulti() )
691cdf0e10cSrcweir         nComp = GetKanaComp();
692cdf0e10cSrcweir 
693cdf0e10cSrcweir     sal_Bool bCfgIsAutoGrammar = sal_False;
694cdf0e10cSrcweir     SvtLinguConfig().GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bCfgIsAutoGrammar;
695cdf0e10cSrcweir 	const sal_Bool bBullet = OnWin() && GetOpt().IsBlank() && IsNoSymbol();
696cdf0e10cSrcweir     const sal_Bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell();
697cdf0e10cSrcweir     const sal_Bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell();
698cdf0e10cSrcweir     const sal_Bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); // SMARTTAGS
699cdf0e10cSrcweir 
700cdf0e10cSrcweir     ASSERT( GetParaPortion(), "No paragraph!");
701cdf0e10cSrcweir     SwDrawTextInfo aDrawInf( pFrm->getRootFrm()->GetCurrShell(), *pOut, pSI, rText, nStart, nLength,
702cdf0e10cSrcweir                              rPor.Width(), bBullet );
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 	aDrawInf.SetLeft( GetPaintRect().Left() );
705cdf0e10cSrcweir 	aDrawInf.SetRight( GetPaintRect().Right() );
706cdf0e10cSrcweir     aDrawInf.SetUnderFnt( pUnderFnt );
707cdf0e10cSrcweir 
708cdf0e10cSrcweir     const long nSpaceAdd = ( rPor.IsBlankPortion() || rPor.IsDropPortion() ||
709cdf0e10cSrcweir                              rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
710cdf0e10cSrcweir     if ( nSpaceAdd )
711cdf0e10cSrcweir     {
712cdf0e10cSrcweir         xub_StrLen nCharCnt;
713cdf0e10cSrcweir         // --> FME 2005-04-04 #i41860# Thai justified alignemt needs some
714cdf0e10cSrcweir         // additional information:
715cdf0e10cSrcweir         aDrawInf.SetNumberOfBlanks( rPor.InTxtGrp() ?
716cdf0e10cSrcweir                                     static_cast<const SwTxtPortion&>(rPor).GetSpaceCnt( *this, nCharCnt ) :
717cdf0e10cSrcweir                                     0 );
718cdf0e10cSrcweir         // <--
719cdf0e10cSrcweir     }
720cdf0e10cSrcweir 
721cdf0e10cSrcweir     aDrawInf.SetSpace( nSpaceAdd );
722cdf0e10cSrcweir     aDrawInf.SetKanaComp( nComp );
723cdf0e10cSrcweir 
724cdf0e10cSrcweir     // the font is used to identify the current script via nActual
725cdf0e10cSrcweir     aDrawInf.SetFont( pFnt );
726cdf0e10cSrcweir     // the frame is used to identify the orientation
727cdf0e10cSrcweir     aDrawInf.SetFrm( GetTxtFrm() );
728cdf0e10cSrcweir     // we have to know if the paragraph should snap to grid
729cdf0e10cSrcweir     aDrawInf.SetSnapToGrid( SnapToGrid() );
730cdf0e10cSrcweir     // for underlining we must know when not to add extra space behind
731cdf0e10cSrcweir     // a character in justified mode
732cdf0e10cSrcweir     aDrawInf.SetSpaceStop( ! rPor.GetPortion() ||
733cdf0e10cSrcweir                              rPor.GetPortion()->InFixMargGrp() ||
734cdf0e10cSrcweir                              rPor.GetPortion()->IsHolePortion() );
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	if( GetTxtFly()->IsOn() )
737cdf0e10cSrcweir 	{
738cdf0e10cSrcweir 		// aPos muss als TopLeft vorliegen, weil die ClipRects sonst
739cdf0e10cSrcweir 		// nicht berechnet werden koennen.
740cdf0e10cSrcweir 		const Point aPoint( aPos.X(), aPos.Y() - rPor.GetAscent() );
741cdf0e10cSrcweir 		const Size aSize( rPor.Width(), rPor.Height() );
742cdf0e10cSrcweir         aDrawInf.SetPos( aPoint );
743cdf0e10cSrcweir 		aDrawInf.SetSize( aSize );
744cdf0e10cSrcweir 		aDrawInf.SetAscent( rPor.GetAscent() );
745cdf0e10cSrcweir 		aDrawInf.SetKern( bKern ? rPor.Width() : 0 );
746cdf0e10cSrcweir         aDrawInf.SetWrong( bTmpWrong ? pWrongList : NULL );
747cdf0e10cSrcweir         aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? pGrammarCheckList : NULL );
748cdf0e10cSrcweir         aDrawInf.SetSmartTags( bTmpSmart ? pSmartTags : NULL );     // SMARTTAGS
749cdf0e10cSrcweir         GetTxtFly()->DrawTextOpaque( aDrawInf );
750cdf0e10cSrcweir 	}
751cdf0e10cSrcweir 	else
752cdf0e10cSrcweir 	{
753cdf0e10cSrcweir 		aDrawInf.SetPos( aPos );
754cdf0e10cSrcweir 		if( bKern )
755cdf0e10cSrcweir 			pFnt->_DrawStretchText( aDrawInf );
756cdf0e10cSrcweir 		else
757cdf0e10cSrcweir 		{
758cdf0e10cSrcweir 			aDrawInf.SetWrong( bTmpWrong ? pWrongList : NULL );
759cdf0e10cSrcweir             aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? pGrammarCheckList : NULL );
760cdf0e10cSrcweir             aDrawInf.SetSmartTags( bTmpSmart ? pSmartTags : NULL );  // SMARTTAGS
761cdf0e10cSrcweir             pFnt->_DrawText( aDrawInf );
762cdf0e10cSrcweir 		}
763cdf0e10cSrcweir 	}
764cdf0e10cSrcweir }
765cdf0e10cSrcweir 
766cdf0e10cSrcweir /*************************************************************************
767cdf0e10cSrcweir  *                          SwTxtPaintInfo::CalcRect()
768cdf0e10cSrcweir  *************************************************************************/
769cdf0e10cSrcweir 
CalcRect(const SwLinePortion & rPor,SwRect * pRect,SwRect * pIntersect) const770cdf0e10cSrcweir void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
771cdf0e10cSrcweir                                SwRect* pRect, SwRect* pIntersect ) const
772cdf0e10cSrcweir {
773cdf0e10cSrcweir 	Size aSize( rPor.Width(), rPor.Height() );
774cdf0e10cSrcweir 	if( rPor.IsHangingPortion() )
775cdf0e10cSrcweir 		aSize.Width() = ((SwHangingPortion&)rPor).GetInnerWidth();
776cdf0e10cSrcweir     if( rPor.InSpaceGrp() && GetSpaceAdd() )
777cdf0e10cSrcweir 	{
778cdf0e10cSrcweir         SwTwips nAdd = rPor.CalcSpacing( GetSpaceAdd(), *this );
779cdf0e10cSrcweir         if( rPor.InFldGrp() && GetSpaceAdd() < 0 && nAdd )
780cdf0e10cSrcweir             nAdd += GetSpaceAdd() / SPACING_PRECISION_FACTOR;
781cdf0e10cSrcweir 		aSize.Width() += nAdd;
782cdf0e10cSrcweir 	}
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 	Point aPoint;
785cdf0e10cSrcweir 
786cdf0e10cSrcweir     if( IsRotated() )
787cdf0e10cSrcweir 	{
788cdf0e10cSrcweir 		long nTmp = aSize.Width();
789cdf0e10cSrcweir 		aSize.Width() = aSize.Height();
790cdf0e10cSrcweir 		aSize.Height() = nTmp;
791cdf0e10cSrcweir         if ( 1 == GetDirection() )
792cdf0e10cSrcweir         {
793cdf0e10cSrcweir             aPoint.A() = X() - rPor.GetAscent();
794cdf0e10cSrcweir             aPoint.B() = Y() - aSize.Height();
795cdf0e10cSrcweir         }
796cdf0e10cSrcweir         else
797cdf0e10cSrcweir         {
798cdf0e10cSrcweir             aPoint.A() = X() - rPor.Height() + rPor.GetAscent();
799cdf0e10cSrcweir             aPoint.B() = Y();
800cdf0e10cSrcweir         }
801cdf0e10cSrcweir     }
802cdf0e10cSrcweir 	else
803cdf0e10cSrcweir 	{
804cdf0e10cSrcweir         aPoint.A() = X();
805cdf0e10cSrcweir         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
806cdf0e10cSrcweir         if ( GetTxtFrm()->IsVertLR() )
807cdf0e10cSrcweir 			aPoint.B() = Y() - rPor.Height() + rPor.GetAscent();
808cdf0e10cSrcweir 		else
809cdf0e10cSrcweir 			aPoint.B() = Y() - rPor.GetAscent();
810cdf0e10cSrcweir 	}
811cdf0e10cSrcweir 
812cdf0e10cSrcweir     // Adjust x coordinate if we are inside a bidi portion
813cdf0e10cSrcweir     const sal_Bool bFrmDir = GetTxtFrm()->IsRightToLeft();
814cdf0e10cSrcweir     sal_Bool bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == GetDirection() ) ||
815cdf0e10cSrcweir                        (   bFrmDir && DIR_LEFT2RIGHT == GetDirection() );
816cdf0e10cSrcweir 
817cdf0e10cSrcweir     if ( bCounterDir )
818cdf0e10cSrcweir         aPoint.A() -= aSize.Width();
819cdf0e10cSrcweir 
820cdf0e10cSrcweir     SwRect aRect( aPoint, aSize );
821cdf0e10cSrcweir 
822cdf0e10cSrcweir     if ( GetTxtFrm()->IsRightToLeft() )
823cdf0e10cSrcweir         GetTxtFrm()->SwitchLTRtoRTL( aRect );
824cdf0e10cSrcweir 
825cdf0e10cSrcweir     if ( GetTxtFrm()->IsVertical() )
826cdf0e10cSrcweir         GetTxtFrm()->SwitchHorizontalToVertical( aRect );
827cdf0e10cSrcweir 
828cdf0e10cSrcweir     if ( pRect )
829cdf0e10cSrcweir         *pRect = aRect;
830cdf0e10cSrcweir 
831cdf0e10cSrcweir     if( aRect.HasArea() && pIntersect )
832cdf0e10cSrcweir 	{
833cdf0e10cSrcweir         ::SwAlignRect( aRect, (ViewShell*)GetVsh() );
834cdf0e10cSrcweir 
835cdf0e10cSrcweir         if ( GetOut()->IsClipRegion() )
836cdf0e10cSrcweir 		{
837cdf0e10cSrcweir             SwRect aClip( GetOut()->GetClipRegion().GetBoundRect() );
838cdf0e10cSrcweir 			aRect.Intersection( aClip );
839cdf0e10cSrcweir 		}
840cdf0e10cSrcweir 
841cdf0e10cSrcweir         *pIntersect = aRect;
842cdf0e10cSrcweir 	}
843cdf0e10cSrcweir }
844cdf0e10cSrcweir 
845cdf0e10cSrcweir /*************************************************************************
846cdf0e10cSrcweir  *                          lcl_DrawSpecial
847cdf0e10cSrcweir  *
848cdf0e10cSrcweir  * Draws a special portion, e.g., line break portion, tab portion.
849cdf0e10cSrcweir  * rPor - The portion
850cdf0e10cSrcweir  * rRect - The rectangle surrounding the character
851cdf0e10cSrcweir  * pCol     - Specify a color for the character
852cdf0e10cSrcweir  * bCenter  - Draw the character centered, otherwise left aligned
853cdf0e10cSrcweir  * bRotate  - Rotate the character if character rotation is set
854cdf0e10cSrcweir  *************************************************************************/
855cdf0e10cSrcweir 
lcl_DrawSpecial(const SwTxtPaintInfo & rInf,const SwLinePortion & rPor,SwRect & rRect,const Color * pCol,sal_Unicode cChar,sal_uInt8 nOptions)856cdf0e10cSrcweir static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
857cdf0e10cSrcweir                       SwRect& rRect, const Color* pCol, sal_Unicode cChar,
858cdf0e10cSrcweir                       sal_uInt8 nOptions )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir     sal_Bool bCenter = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_CENTER );
861cdf0e10cSrcweir     sal_Bool bRotate = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_ROTATE );
862cdf0e10cSrcweir 
863cdf0e10cSrcweir     // rRect is given in absolute coordinates
864cdf0e10cSrcweir     if ( rInf.GetTxtFrm()->IsRightToLeft() )
865cdf0e10cSrcweir         rInf.GetTxtFrm()->SwitchRTLtoLTR( rRect );
866cdf0e10cSrcweir     if ( rInf.GetTxtFrm()->IsVertical() )
867cdf0e10cSrcweir         rInf.GetTxtFrm()->SwitchVerticalToHorizontal( rRect );
868cdf0e10cSrcweir 
869cdf0e10cSrcweir     const SwFont* pOldFnt = rInf.GetFont();
870cdf0e10cSrcweir 
871cdf0e10cSrcweir     // Font is generated only once:
872cdf0e10cSrcweir     static SwFont* pFnt = 0;
873cdf0e10cSrcweir     if ( ! pFnt )
874cdf0e10cSrcweir     {
875cdf0e10cSrcweir         pFnt = new SwFont( *pOldFnt );
876cdf0e10cSrcweir         pFnt->SetFamily( FAMILY_DONTKNOW, pFnt->GetActual() );
877cdf0e10cSrcweir         pFnt->SetName( numfunc::GetDefBulletFontname(), pFnt->GetActual() );
878cdf0e10cSrcweir         pFnt->SetStyleName( aEmptyStr, pFnt->GetActual() );
879cdf0e10cSrcweir         pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, pFnt->GetActual() );
880cdf0e10cSrcweir     }
881cdf0e10cSrcweir 
882cdf0e10cSrcweir     // Some of the current values are set at the font:
883cdf0e10cSrcweir     if ( ! bRotate )
884cdf0e10cSrcweir         pFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );
885cdf0e10cSrcweir     else
886cdf0e10cSrcweir         pFnt->SetVertical( pOldFnt->GetOrientation() );
887cdf0e10cSrcweir 
888cdf0e10cSrcweir     if ( pCol )
889cdf0e10cSrcweir         pFnt->SetColor( *pCol );
890cdf0e10cSrcweir     else
891cdf0e10cSrcweir         pFnt->SetColor( pOldFnt->GetColor() );
892cdf0e10cSrcweir 
893cdf0e10cSrcweir     Size aFontSize( 0, SPECIAL_FONT_HEIGHT );
894cdf0e10cSrcweir     pFnt->SetSize( aFontSize, pFnt->GetActual() );
895cdf0e10cSrcweir 
896cdf0e10cSrcweir     ((SwTxtPaintInfo&)rInf).SetFont( pFnt );
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     // The maximum width depends on the current orientation
899cdf0e10cSrcweir     const sal_uInt16 nDir = pFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() );
900cdf0e10cSrcweir     SwTwips nMaxWidth = 0;
901cdf0e10cSrcweir     switch ( nDir )
902cdf0e10cSrcweir     {
903cdf0e10cSrcweir     case 0 :
904cdf0e10cSrcweir         nMaxWidth = rRect.Width();
905cdf0e10cSrcweir         break;
906cdf0e10cSrcweir     case 900 :
907cdf0e10cSrcweir     case 2700 :
908cdf0e10cSrcweir         nMaxWidth = rRect.Height();
909cdf0e10cSrcweir         break;
910cdf0e10cSrcweir     default:
911cdf0e10cSrcweir         ASSERT( sal_False, "Unknown direction set at font" )
912cdf0e10cSrcweir         break;
913cdf0e10cSrcweir     }
914cdf0e10cSrcweir 
915cdf0e10cSrcweir     // check if char fits into rectangle
916cdf0e10cSrcweir     const XubString aTmp( cChar );
917cdf0e10cSrcweir     aFontSize = rInf.GetTxtSize( aTmp ).SvLSize();
918cdf0e10cSrcweir     while ( aFontSize.Width() > nMaxWidth )
919cdf0e10cSrcweir     {
920cdf0e10cSrcweir         SwTwips nFactor = ( 100 * aFontSize.Width() ) / nMaxWidth;
921cdf0e10cSrcweir         const SwTwips nOldWidth = aFontSize.Width();
922cdf0e10cSrcweir 
923cdf0e10cSrcweir         // new height for font
924cdf0e10cSrcweir         const sal_uInt8 nAct = pFnt->GetActual();
925cdf0e10cSrcweir         aFontSize.Height() = ( 100 * pFnt->GetSize( nAct ).Height() ) / nFactor;
926cdf0e10cSrcweir         aFontSize.Width() = ( 100 * pFnt->GetSize( nAct).Width() ) / nFactor;
927cdf0e10cSrcweir 
928cdf0e10cSrcweir         if ( !aFontSize.Width() && !aFontSize.Height() )
929cdf0e10cSrcweir             break;
930cdf0e10cSrcweir 
931cdf0e10cSrcweir         pFnt->SetSize( aFontSize, nAct );
932cdf0e10cSrcweir 
933cdf0e10cSrcweir         aFontSize = rInf.GetTxtSize( aTmp ).SvLSize();
934cdf0e10cSrcweir 
935cdf0e10cSrcweir         if ( aFontSize.Width() >= nOldWidth )
936cdf0e10cSrcweir             break;
937cdf0e10cSrcweir     }
938cdf0e10cSrcweir 
939cdf0e10cSrcweir     const Point aOldPos( rInf.GetPos() );
940cdf0e10cSrcweir 
941cdf0e10cSrcweir     // adjust values so that tab is vertically and horizontally centered
942cdf0e10cSrcweir     SwTwips nX = rRect.Left();
943cdf0e10cSrcweir     SwTwips nY = rRect.Top();
944cdf0e10cSrcweir     switch ( nDir )
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir     case 0 :
947cdf0e10cSrcweir         if ( bCenter )
948cdf0e10cSrcweir             nX += ( rRect.Width() - aFontSize.Width() ) / 2;
949cdf0e10cSrcweir         nY += ( rRect.Height() - aFontSize.Height() ) / 2 + rInf.GetAscent();
950cdf0e10cSrcweir         break;
951cdf0e10cSrcweir     case 900 :
952cdf0e10cSrcweir         if ( bCenter )
953cdf0e10cSrcweir             nX += ( rRect.Width() - aFontSize.Height() ) / 2 + rInf.GetAscent();
954cdf0e10cSrcweir         nY += ( rRect.Height() + aFontSize.Width() ) / 2;
955cdf0e10cSrcweir         break;
956cdf0e10cSrcweir     case 2700 :
957cdf0e10cSrcweir         if ( bCenter )
958cdf0e10cSrcweir             nX += ( rRect.Width() + aFontSize.Height() ) / 2 - rInf.GetAscent();
959cdf0e10cSrcweir         nY += ( rRect.Height() - aFontSize.Width() ) / 2;
960cdf0e10cSrcweir         break;
961cdf0e10cSrcweir     }
962cdf0e10cSrcweir 
963cdf0e10cSrcweir     Point aTmpPos( nX, nY );
964cdf0e10cSrcweir     ((SwTxtPaintInfo&)rInf).SetPos( aTmpPos );
965cdf0e10cSrcweir     sal_uInt16 nOldWidth = rPor.Width();
966cdf0e10cSrcweir     ((SwLinePortion&)rPor).Width( (sal_uInt16)aFontSize.Width() );
967cdf0e10cSrcweir     rInf.DrawText( aTmp, rPor );
968cdf0e10cSrcweir     ((SwLinePortion&)rPor).Width( nOldWidth );
969cdf0e10cSrcweir     ((SwTxtPaintInfo&)rInf).SetFont( (SwFont*)pOldFnt );
970cdf0e10cSrcweir     ((SwTxtPaintInfo&)rInf).SetPos( aOldPos );
971cdf0e10cSrcweir }
972cdf0e10cSrcweir 
973cdf0e10cSrcweir /*************************************************************************
974cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawRect()
975cdf0e10cSrcweir  *************************************************************************/
976cdf0e10cSrcweir 
DrawRect(const SwRect & rRect,sal_Bool bNoGraphic,sal_Bool bRetouche) const977cdf0e10cSrcweir void SwTxtPaintInfo::DrawRect( const SwRect &rRect, sal_Bool bNoGraphic,
978cdf0e10cSrcweir 							   sal_Bool bRetouche ) const
979cdf0e10cSrcweir {
980cdf0e10cSrcweir 	if ( OnWin() || !bRetouche )
981cdf0e10cSrcweir 	{
982cdf0e10cSrcweir 		if( aTxtFly.IsOn() )
983cdf0e10cSrcweir 			((SwTxtPaintInfo*)this)->GetTxtFly()->
984cdf0e10cSrcweir 				DrawFlyRect( pOut, rRect, *this, bNoGraphic );
985cdf0e10cSrcweir 		else if ( bNoGraphic )
986cdf0e10cSrcweir 			pOut->DrawRect( rRect.SVRect() );
987cdf0e10cSrcweir 		else
988cdf0e10cSrcweir 		{
989cdf0e10cSrcweir 			ASSERT( ((SvxBrushItem*)-1) != pBrushItem, "DrawRect: Uninitialized BrushItem!" );
990cdf0e10cSrcweir 			::DrawGraphic( pBrushItem, pOut, aItemRect, rRect );
991cdf0e10cSrcweir 		}
992cdf0e10cSrcweir 	}
993cdf0e10cSrcweir }
994cdf0e10cSrcweir 
995cdf0e10cSrcweir /*************************************************************************
996cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawTab()
997cdf0e10cSrcweir  *************************************************************************/
998cdf0e10cSrcweir 
DrawTab(const SwLinePortion & rPor) const999cdf0e10cSrcweir void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir 	if( OnWin() )
1002cdf0e10cSrcweir 	{
1003cdf0e10cSrcweir         SwRect aRect;
1004cdf0e10cSrcweir         CalcRect( rPor, &aRect );
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir         if ( ! aRect.HasArea() )
1007cdf0e10cSrcweir             return;
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir         const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
1010cdf0e10cSrcweir                                   CHAR_TAB_RTL : CHAR_TAB;
1011cdf0e10cSrcweir         const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER |
1012cdf0e10cSrcweir                               DRAW_SPECIAL_OPTIONS_ROTATE;
1013cdf0e10cSrcweir         lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
1014cdf0e10cSrcweir     }
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir /*************************************************************************
1018cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawLineBreak()
1019cdf0e10cSrcweir  *************************************************************************/
1020cdf0e10cSrcweir 
DrawLineBreak(const SwLinePortion & rPor) const1021cdf0e10cSrcweir void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
1022cdf0e10cSrcweir {
1023cdf0e10cSrcweir 	if( OnWin() )
1024cdf0e10cSrcweir 	{
1025cdf0e10cSrcweir 		KSHORT nOldWidth = rPor.Width();
1026cdf0e10cSrcweir         ((SwLinePortion&)rPor).Width( LINE_BREAK_WIDTH );
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir         SwRect aRect;
1029cdf0e10cSrcweir         CalcRect( rPor, &aRect );
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir 		if( aRect.HasArea() )
1032cdf0e10cSrcweir         {
1033cdf0e10cSrcweir             const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
1034cdf0e10cSrcweir                                       CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
1035cdf0e10cSrcweir             const sal_uInt8 nOptions = 0;
1036cdf0e10cSrcweir             lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
1037cdf0e10cSrcweir         }
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir         ((SwLinePortion&)rPor).Width( nOldWidth );
1040cdf0e10cSrcweir 	}
1041cdf0e10cSrcweir }
1042cdf0e10cSrcweir 
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir /*************************************************************************
1045cdf0e10cSrcweir  *                     SwTxtPaintInfo::DrawRedArrow()
1046cdf0e10cSrcweir  *************************************************************************/
1047cdf0e10cSrcweir 
DrawRedArrow(const SwLinePortion & rPor) const1048cdf0e10cSrcweir void SwTxtPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir     Size aSize( SPECIAL_FONT_HEIGHT, SPECIAL_FONT_HEIGHT );
1051cdf0e10cSrcweir     SwRect aRect( ((SwArrowPortion&)rPor).GetPos(), aSize );
1052cdf0e10cSrcweir     sal_Unicode cChar;
1053cdf0e10cSrcweir     if( ((SwArrowPortion&)rPor).IsLeft() )
1054cdf0e10cSrcweir 	{
1055cdf0e10cSrcweir 		aRect.Pos().Y() += 20 - GetAscent();
1056cdf0e10cSrcweir 		aRect.Pos().X() += 20;
1057cdf0e10cSrcweir         if( aSize.Height() > rPor.Height() )
1058cdf0e10cSrcweir             aRect.Height( rPor.Height() );
1059cdf0e10cSrcweir         cChar = CHAR_LEFT_ARROW;
1060cdf0e10cSrcweir 	}
1061cdf0e10cSrcweir 	else
1062cdf0e10cSrcweir 	{
1063cdf0e10cSrcweir         if( aSize.Height() > rPor.Height() )
1064cdf0e10cSrcweir             aRect.Height( rPor.Height() );
1065cdf0e10cSrcweir 		aRect.Pos().Y() -= aRect.Height() + 20;
1066cdf0e10cSrcweir 		aRect.Pos().X() -= aRect.Width() + 20;
1067cdf0e10cSrcweir         cChar = CHAR_RIGHT_ARROW;
1068cdf0e10cSrcweir 	}
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir     if ( GetTxtFrm()->IsVertical() )
1071cdf0e10cSrcweir         GetTxtFrm()->SwitchHorizontalToVertical( aRect );
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir 	Color aCol( COL_LIGHTRED );
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir     if( aRect.HasArea() )
1076cdf0e10cSrcweir     {
1077cdf0e10cSrcweir         const sal_uInt8 nOptions = 0;
1078cdf0e10cSrcweir         lcl_DrawSpecial( *this, rPor, aRect, &aCol, cChar, nOptions );
1079cdf0e10cSrcweir     }
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir /*************************************************************************
1084cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawPostIts()
1085cdf0e10cSrcweir  *************************************************************************/
1086cdf0e10cSrcweir 
DrawPostIts(const SwLinePortion &,sal_Bool bScript) const1087cdf0e10cSrcweir void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, sal_Bool bScript ) const
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir 	if( OnWin() && pOpt->IsPostIts() )
1090cdf0e10cSrcweir 	{
1091cdf0e10cSrcweir         Size aSize;
1092cdf0e10cSrcweir         Point aTmp;
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir         const sal_uInt16 nPostItsWidth = pOpt->GetPostItsWidth( GetOut() );
1095cdf0e10cSrcweir         const sal_uInt16 nFontHeight = pFnt->GetHeight( pVsh, *GetOut() );
1096cdf0e10cSrcweir         const sal_uInt16 nFontAscent = pFnt->GetAscent( pVsh, *GetOut() );
1097cdf0e10cSrcweir 
1098cdf0e10cSrcweir         switch ( pFnt->GetOrientation( GetTxtFrm()->IsVertical() ) )
1099cdf0e10cSrcweir         {
1100cdf0e10cSrcweir         case 0 :
1101cdf0e10cSrcweir             aSize.Width() = nPostItsWidth;
1102cdf0e10cSrcweir             aSize.Height() = nFontHeight;
1103cdf0e10cSrcweir             aTmp.X() = aPos.X();
1104cdf0e10cSrcweir             aTmp.Y() = aPos.Y() - nFontAscent;
1105cdf0e10cSrcweir             break;
1106cdf0e10cSrcweir         case 900 :
1107cdf0e10cSrcweir             aSize.Height() = nPostItsWidth;
1108cdf0e10cSrcweir             aSize.Width() = nFontHeight;
1109cdf0e10cSrcweir             aTmp.X() = aPos.X() - nFontAscent;
1110cdf0e10cSrcweir             aTmp.Y() = aPos.Y();
1111cdf0e10cSrcweir             break;
1112cdf0e10cSrcweir         case 2700 :
1113cdf0e10cSrcweir             aSize.Height() = nPostItsWidth;
1114cdf0e10cSrcweir             aSize.Width() = nFontHeight;
1115cdf0e10cSrcweir             aTmp.X() = aPos.X() - nFontHeight +
1116cdf0e10cSrcweir                                   nFontAscent;
1117cdf0e10cSrcweir             aTmp.Y() = aPos.Y();
1118cdf0e10cSrcweir             break;
1119cdf0e10cSrcweir         }
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir         SwRect aTmpRect( aTmp, aSize );
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir         if ( GetTxtFrm()->IsRightToLeft() )
1124cdf0e10cSrcweir             GetTxtFrm()->SwitchLTRtoRTL( aTmpRect );
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir         if ( GetTxtFrm()->IsVertical() )
1127cdf0e10cSrcweir             GetTxtFrm()->SwitchHorizontalToVertical( aTmpRect );
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir         const Rectangle aRect( aTmpRect.SVRect() );
1130cdf0e10cSrcweir 		pOpt->PaintPostIts( (OutputDevice*)GetOut(), aRect, bScript );
1131cdf0e10cSrcweir 	}
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir 
DrawCheckBox(const SwFieldFormPortion & rPor,bool checked) const1134cdf0e10cSrcweir void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir     SwRect aIntersect;
1137cdf0e10cSrcweir     CalcRect( rPor, &aIntersect, 0 );
1138cdf0e10cSrcweir     if ( aIntersect.HasArea() )
1139cdf0e10cSrcweir     {
1140cdf0e10cSrcweir 	    if (OnWin() && SwViewOption::IsFieldShadings() &&
1141cdf0e10cSrcweir                 !GetOpt().IsPagePreview())
1142cdf0e10cSrcweir         {
1143cdf0e10cSrcweir     	    OutputDevice* pOut_ = (OutputDevice*)GetOut();
1144cdf0e10cSrcweir 	        pOut_->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1145cdf0e10cSrcweir     	    pOut_->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1146cdf0e10cSrcweir 	        pOut_->SetLineColor();
1147cdf0e10cSrcweir 	        pOut_->DrawRect( aIntersect.SVRect() );
1148cdf0e10cSrcweir     	    pOut_->Pop();
1149cdf0e10cSrcweir         }
1150cdf0e10cSrcweir         const int delta=10;
1151cdf0e10cSrcweir         Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1152cdf0e10cSrcweir         pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1153cdf0e10cSrcweir         pOut->SetLineColor( Color(0, 0, 0));
1154cdf0e10cSrcweir         pOut->SetFillColor();
1155cdf0e10cSrcweir         pOut->DrawRect( r );
1156cdf0e10cSrcweir         if (checked) {
1157cdf0e10cSrcweir             pOut->DrawLine(r.TopLeft(), r.BottomRight());
1158cdf0e10cSrcweir             pOut->DrawLine(r.TopRight(), r.BottomLeft());
1159cdf0e10cSrcweir         }
1160cdf0e10cSrcweir 	    pOut->Pop();
1161cdf0e10cSrcweir 	}
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir /*************************************************************************
1164cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawBackGround()
1165cdf0e10cSrcweir  *************************************************************************/
DrawBackground(const SwLinePortion & rPor) const1166cdf0e10cSrcweir void SwTxtPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir 	ASSERT( OnWin(), "SwTxtPaintInfo::DrawBackground: printer polution ?" );
1169cdf0e10cSrcweir 
1170cdf0e10cSrcweir     SwRect aIntersect;
1171cdf0e10cSrcweir     CalcRect( rPor, 0, &aIntersect );
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir     if ( aIntersect.HasArea() )
1174cdf0e10cSrcweir 	{
1175cdf0e10cSrcweir         OutputDevice* pTmpOut = (OutputDevice*)GetOut();
1176cdf0e10cSrcweir         pTmpOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1177cdf0e10cSrcweir 
1178cdf0e10cSrcweir         // For dark background we do not want to have a filled rectangle
1179cdf0e10cSrcweir         if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
1180cdf0e10cSrcweir         {
1181cdf0e10cSrcweir             pTmpOut->SetLineColor( SwViewOption::GetFontColor().GetColor() );
1182cdf0e10cSrcweir         }
1183cdf0e10cSrcweir         else
1184cdf0e10cSrcweir         {
1185cdf0e10cSrcweir             pTmpOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1186cdf0e10cSrcweir             pTmpOut->SetLineColor();
1187cdf0e10cSrcweir         }
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir         DrawRect( aIntersect, sal_True );
1190cdf0e10cSrcweir         pTmpOut->Pop();
1191cdf0e10cSrcweir     }
1192cdf0e10cSrcweir }
1193cdf0e10cSrcweir 
_DrawBackBrush(const SwLinePortion & rPor) const1194cdf0e10cSrcweir void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
1195cdf0e10cSrcweir {
1196cdf0e10cSrcweir     {
1197cdf0e10cSrcweir         SwRect aIntersect;
1198cdf0e10cSrcweir         CalcRect( rPor, &aIntersect, 0 );
1199cdf0e10cSrcweir         if(aIntersect.HasArea())
1200cdf0e10cSrcweir         {
1201cdf0e10cSrcweir             SwTxtNode *pNd = pFrm->GetTxtNode();
1202*dec99bbdSOliver-Rainer Wittmann             const ::sw::mark::IMark* pFieldmark = NULL;
1203cdf0e10cSrcweir             if(pNd)
1204cdf0e10cSrcweir             {
1205cdf0e10cSrcweir                 const SwDoc *doc=pNd->GetDoc();
1206cdf0e10cSrcweir                 if(doc)
1207cdf0e10cSrcweir                 {
1208cdf0e10cSrcweir                     SwIndex aIndex(pNd, GetIdx());
1209cdf0e10cSrcweir                     SwPosition aPosition(*pNd, aIndex);
1210cdf0e10cSrcweir                     pFieldmark=doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
1211cdf0e10cSrcweir                 }
1212cdf0e10cSrcweir             }
1213cdf0e10cSrcweir             bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx()));
1214cdf0e10cSrcweir             if(pFieldmark) {
1215cdf0e10cSrcweir                 OSL_TRACE("Found Fieldmark");
1216cdf0e10cSrcweir #if DEBUG
1217cdf0e10cSrcweir                 rtl::OUString str = pFieldmark->ToString( );
1218cdf0e10cSrcweir                 fprintf( stderr, "%s\n", rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) );
1219cdf0e10cSrcweir #endif
1220cdf0e10cSrcweir             }
1221cdf0e10cSrcweir             if(bIsStartMark) OSL_TRACE("Found StartMark");
1222cdf0e10cSrcweir             if (OnWin() && (pFieldmark!=NULL || bIsStartMark) &&
1223cdf0e10cSrcweir                     SwViewOption::IsFieldShadings() &&
1224cdf0e10cSrcweir                     !GetOpt().IsPagePreview())
1225cdf0e10cSrcweir             {
1226cdf0e10cSrcweir                 OutputDevice* pOutDev = (OutputDevice*)GetOut();
1227cdf0e10cSrcweir                 pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1228*dec99bbdSOliver-Rainer Wittmann                 pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
1229cdf0e10cSrcweir                 pOutDev->SetLineColor( );
1230cdf0e10cSrcweir                 pOutDev->DrawRect( aIntersect.SVRect() );
1231cdf0e10cSrcweir                 pOutDev->Pop();
1232cdf0e10cSrcweir             }
1233cdf0e10cSrcweir         }
1234cdf0e10cSrcweir     }
1235cdf0e10cSrcweir     if( !pFnt->GetBackColor() ) return;
1236cdf0e10cSrcweir 
1237cdf0e10cSrcweir     ASSERT( pFnt->GetBackColor(), "DrawBackBrush: Lost Color" );
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir     SwRect aIntersect;
1240cdf0e10cSrcweir     CalcRect( rPor, 0, &aIntersect );
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir     if ( aIntersect.HasArea() )
1243cdf0e10cSrcweir     {
1244cdf0e10cSrcweir         OutputDevice* pTmpOut = (OutputDevice*)GetOut();
1245cdf0e10cSrcweir 
1246cdf0e10cSrcweir         // --> FME 2004-06-24 #i16816# tagged pdf support
1247cdf0e10cSrcweir         SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pTmpOut );
1248cdf0e10cSrcweir         // <--
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir         pTmpOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir         pTmpOut->SetFillColor( *pFnt->GetBackColor() );
1253cdf0e10cSrcweir         pTmpOut->SetLineColor();
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir         DrawRect( aIntersect, sal_True, sal_False );
1256cdf0e10cSrcweir 
1257cdf0e10cSrcweir         pTmpOut->Pop();
1258cdf0e10cSrcweir     }
1259cdf0e10cSrcweir }
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir /*************************************************************************
1262cdf0e10cSrcweir  *					   SwTxtPaintInfo::DrawViewOpt()
1263cdf0e10cSrcweir  *************************************************************************/
1264cdf0e10cSrcweir 
DrawViewOpt(const SwLinePortion & rPor,const MSHORT nWhich) const1265cdf0e10cSrcweir void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
126669a74367SOliver-Rainer Wittmann                                   const MSHORT nWhich ) const
1267cdf0e10cSrcweir {
126869a74367SOliver-Rainer Wittmann     if( OnWin() && !IsMulti() )
126969a74367SOliver-Rainer Wittmann     {
127069a74367SOliver-Rainer Wittmann         sal_Bool bDraw = sal_False;
127169a74367SOliver-Rainer Wittmann         switch( nWhich )
127269a74367SOliver-Rainer Wittmann         {
127369a74367SOliver-Rainer Wittmann         case POR_FTN:
127469a74367SOliver-Rainer Wittmann         case POR_QUOVADIS:
127569a74367SOliver-Rainer Wittmann         case POR_NUMBER:
127669a74367SOliver-Rainer Wittmann         case POR_FLD:
127769a74367SOliver-Rainer Wittmann         case POR_URL:
127869a74367SOliver-Rainer Wittmann         case POR_HIDDEN:
127969a74367SOliver-Rainer Wittmann         case POR_TOX:
128069a74367SOliver-Rainer Wittmann         case POR_REF:
128169a74367SOliver-Rainer Wittmann         case POR_META:
128269a74367SOliver-Rainer Wittmann         case POR_CONTROLCHAR:
128369a74367SOliver-Rainer Wittmann             if ( !GetOpt().IsPagePreview()
128469a74367SOliver-Rainer Wittmann                  && !GetOpt().IsReadonly()
128569a74367SOliver-Rainer Wittmann                  && SwViewOption::IsFieldShadings()
128669a74367SOliver-Rainer Wittmann                  && ( POR_NUMBER != nWhich
128769a74367SOliver-Rainer Wittmann                       || pFrm->GetTxtNode()->HasMarkedLabel())) // #i27615#
128869a74367SOliver-Rainer Wittmann             {
128969a74367SOliver-Rainer Wittmann                 bDraw = sal_True;
129069a74367SOliver-Rainer Wittmann             }
1291cdf0e10cSrcweir             break;
129269a74367SOliver-Rainer Wittmann         case POR_INPUTFLD:
129369a74367SOliver-Rainer Wittmann             // input field shading also in read-only mode
129469a74367SOliver-Rainer Wittmann             if ( !GetOpt().IsPagePreview()
129569a74367SOliver-Rainer Wittmann                  && SwViewOption::IsFieldShadings() )
129669a74367SOliver-Rainer Wittmann             {
129769a74367SOliver-Rainer Wittmann                 bDraw = sal_True;
129869a74367SOliver-Rainer Wittmann             }
129969a74367SOliver-Rainer Wittmann             break;
130069a74367SOliver-Rainer Wittmann         case POR_TAB:		if ( GetOpt().IsTab() )		bDraw = sal_True; break;
130169a74367SOliver-Rainer Wittmann         case POR_SOFTHYPH:	if ( GetOpt().IsSoftHyph() )bDraw = sal_True; break;
130269a74367SOliver-Rainer Wittmann         case POR_BLANK:     if ( GetOpt().IsHardBlank())bDraw = sal_True; break;
130369a74367SOliver-Rainer Wittmann         default:
130469a74367SOliver-Rainer Wittmann             {
130569a74367SOliver-Rainer Wittmann                 ASSERT( !this, "SwTxtPaintInfo::DrawViewOpt: don't know how to draw this" );
130669a74367SOliver-Rainer Wittmann                 break;
130769a74367SOliver-Rainer Wittmann             }
130869a74367SOliver-Rainer Wittmann         }
130969a74367SOliver-Rainer Wittmann         if ( bDraw )
131069a74367SOliver-Rainer Wittmann             DrawBackground( rPor );
131169a74367SOliver-Rainer Wittmann     }
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir /*************************************************************************
1315cdf0e10cSrcweir  *					   SwTxtPaintInfo::_NotifyURL()
1316cdf0e10cSrcweir  *************************************************************************/
1317cdf0e10cSrcweir 
_NotifyURL(const SwLinePortion & rPor) const1318cdf0e10cSrcweir void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir 	ASSERT( pNoteURL, "NotifyURL: pNoteURL gone with the wind!" );
1321cdf0e10cSrcweir 
1322cdf0e10cSrcweir     SwRect aIntersect;
1323cdf0e10cSrcweir     CalcRect( rPor, 0, &aIntersect );
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir     if( aIntersect.HasArea() )
1326cdf0e10cSrcweir 	{
1327cdf0e10cSrcweir 		SwTxtNode *pNd = (SwTxtNode*)GetTxtFrm()->GetTxtNode();
1328cdf0e10cSrcweir         SwTxtAttr *const pAttr =
1329cdf0e10cSrcweir             pNd->GetTxtAttrAt(GetIdx(), RES_TXTATR_INETFMT);
1330cdf0e10cSrcweir 		if( pAttr )
1331cdf0e10cSrcweir 		{
1332cdf0e10cSrcweir 			const SwFmtINetFmt& rFmt = pAttr->GetINetFmt();
1333cdf0e10cSrcweir 			pNoteURL->InsertURLNote( rFmt.GetValue(), rFmt.GetTargetFrame(),
1334cdf0e10cSrcweir                 aIntersect );
1335cdf0e10cSrcweir 		}
1336cdf0e10cSrcweir 	}
1337cdf0e10cSrcweir }
1338cdf0e10cSrcweir 
1339cdf0e10cSrcweir /*************************************************************************
1340cdf0e10cSrcweir  *					lcl_InitHyphValues()
1341cdf0e10cSrcweir  *************************************************************************/
1342cdf0e10cSrcweir 
lcl_InitHyphValues(PropertyValues & rVals,sal_Int16 nMinLeading,sal_Int16 nMinTrailing)1343cdf0e10cSrcweir static void lcl_InitHyphValues( PropertyValues &rVals,
1344cdf0e10cSrcweir 			sal_Int16 nMinLeading, sal_Int16 nMinTrailing )
1345cdf0e10cSrcweir {
1346cdf0e10cSrcweir 	sal_Int32 nLen = rVals.getLength();
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir 	if (0 == nLen)	// yet to be initialized?
1349cdf0e10cSrcweir 	{
1350cdf0e10cSrcweir 		rVals.realloc( 2 );
1351cdf0e10cSrcweir 		PropertyValue *pVal = rVals.getArray();
1352cdf0e10cSrcweir 
1353cdf0e10cSrcweir 		pVal[0].Name	= C2U( UPN_HYPH_MIN_LEADING );
1354cdf0e10cSrcweir 		pVal[0].Handle	= UPH_HYPH_MIN_LEADING;
1355cdf0e10cSrcweir 		pVal[0].Value	<<= nMinLeading;
1356cdf0e10cSrcweir 
1357cdf0e10cSrcweir 		pVal[1].Name	= C2U( UPN_HYPH_MIN_TRAILING );
1358cdf0e10cSrcweir 		pVal[1].Handle	= UPH_HYPH_MIN_TRAILING;
1359cdf0e10cSrcweir 		pVal[1].Value	<<= nMinTrailing;
1360cdf0e10cSrcweir 	}
1361cdf0e10cSrcweir 	else if (2 == nLen)	// already initialized once?
1362cdf0e10cSrcweir 	{
1363cdf0e10cSrcweir 		PropertyValue *pVal = rVals.getArray();
1364cdf0e10cSrcweir 		pVal[0].Value <<= nMinLeading;
1365cdf0e10cSrcweir 		pVal[1].Value <<= nMinTrailing;
1366cdf0e10cSrcweir 	}
1367cdf0e10cSrcweir 	else {
1368cdf0e10cSrcweir 		DBG_ERROR( "unxpected size of sequence" );
1369cdf0e10cSrcweir     }
1370cdf0e10cSrcweir }
1371cdf0e10cSrcweir 
1372cdf0e10cSrcweir /*************************************************************************
1373cdf0e10cSrcweir  *					SwTxtFormatInfo::GetHyphValues()
1374cdf0e10cSrcweir  *************************************************************************/
1375cdf0e10cSrcweir 
GetHyphValues() const1376cdf0e10cSrcweir const PropertyValues & SwTxtFormatInfo::GetHyphValues() const
1377cdf0e10cSrcweir {
1378cdf0e10cSrcweir 	DBG_ASSERT( 2 == aHyphVals.getLength(),
1379cdf0e10cSrcweir 			"hyphenation values not yet initialized" );
1380cdf0e10cSrcweir 	return aHyphVals;
1381cdf0e10cSrcweir }
1382cdf0e10cSrcweir 
1383cdf0e10cSrcweir /*************************************************************************
1384cdf0e10cSrcweir  *					SwTxtFormatInfo::InitHyph()
1385cdf0e10cSrcweir  *************************************************************************/
1386cdf0e10cSrcweir 
InitHyph(const sal_Bool bAutoHyphen)1387cdf0e10cSrcweir sal_Bool SwTxtFormatInfo::InitHyph( const sal_Bool bAutoHyphen )
1388cdf0e10cSrcweir {
1389cdf0e10cSrcweir 	const SwAttrSet& rAttrSet = GetTxtFrm()->GetTxtNode()->GetSwAttrSet();
1390cdf0e10cSrcweir 	SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1391cdf0e10cSrcweir 	SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1392cdf0e10cSrcweir 	SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1393cdf0e10cSrcweir 	const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1394cdf0e10cSrcweir 	MaxHyph() = rAttr.GetMaxHyphens();
1395cdf0e10cSrcweir     sal_Bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1396cdf0e10cSrcweir 	if( bAuto || bInterHyph )
1397cdf0e10cSrcweir 	{
1398cdf0e10cSrcweir 		nHyphStart = nHyphWrdStart = STRING_LEN;
1399cdf0e10cSrcweir 		nHyphWrdLen = 0;
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir         const sal_Int16 nMinimalLeading  = Max(rAttr.GetMinLead(), sal_uInt8(2));
1402cdf0e10cSrcweir         const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1403cdf0e10cSrcweir         lcl_InitHyphValues( aHyphVals, nMinimalLeading, nMinimalTrailing);
1404cdf0e10cSrcweir 	}
1405cdf0e10cSrcweir 	return bAuto;
1406cdf0e10cSrcweir }
1407cdf0e10cSrcweir 
1408cdf0e10cSrcweir /*************************************************************************
1409cdf0e10cSrcweir  *					SwTxtFormatInfo::CtorInitTxtFormatInfo()
1410cdf0e10cSrcweir  *************************************************************************/
1411cdf0e10cSrcweir 
CtorInitTxtFormatInfo(SwTxtFrm * pNewFrm,const sal_Bool bNewInterHyph,const sal_Bool bNewQuick,const sal_Bool bTst)1412cdf0e10cSrcweir void SwTxtFormatInfo::CtorInitTxtFormatInfo( SwTxtFrm *pNewFrm, const sal_Bool bNewInterHyph,
1413cdf0e10cSrcweir 								const sal_Bool bNewQuick, const sal_Bool bTst )
1414cdf0e10cSrcweir {
1415cdf0e10cSrcweir 	CtorInitTxtPaintInfo( pNewFrm, SwRect() );
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir 	bQuick = bNewQuick;
1418cdf0e10cSrcweir 	bInterHyph = bNewInterHyph;
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir 	//! needs to be done in this order
1421cdf0e10cSrcweir 	nMinLeading		= 2;
1422cdf0e10cSrcweir 	nMinTrailing	= 2;
1423cdf0e10cSrcweir 	nMinWordLength	= 0;
1424cdf0e10cSrcweir 	bAutoHyph = InitHyph();
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir 	bIgnoreFly = sal_False;
1427cdf0e10cSrcweir     bFakeLineStart = sal_False;
1428cdf0e10cSrcweir 	bShift = sal_False;
1429cdf0e10cSrcweir 	bDropInit = sal_False;
1430cdf0e10cSrcweir 	bTestFormat = bTst;
1431cdf0e10cSrcweir 	nLeft = 0;
1432cdf0e10cSrcweir 	nRight = 0;
1433cdf0e10cSrcweir 	nFirst = 0;
1434cdf0e10cSrcweir 	nRealWidth = 0;
1435cdf0e10cSrcweir 	nForcedLeftMargin = 0;
1436cdf0e10cSrcweir 	pRest = 0;
1437cdf0e10cSrcweir 	nLineHeight = 0;
1438cdf0e10cSrcweir     nLineNettoHeight = 0;
1439cdf0e10cSrcweir 	SetLineStart(0);
1440cdf0e10cSrcweir 	Init();
1441cdf0e10cSrcweir }
1442cdf0e10cSrcweir 
1443cdf0e10cSrcweir /*************************************************************************
1444cdf0e10cSrcweir  *					SwTxtFormatInfo::IsHyphenate()
1445cdf0e10cSrcweir  *************************************************************************/
1446cdf0e10cSrcweir // Trennen oder nicht trennen, das ist hier die Frage:
1447cdf0e10cSrcweir // - in keinem Fall trennen, wenn der Hyphenator ERROR zurueckliefert,
1448cdf0e10cSrcweir //	 oder wenn als Sprache NOLANGUAGE eingestellt ist.
1449cdf0e10cSrcweir // - ansonsten immer trennen, wenn interaktive Trennung vorliegt
1450cdf0e10cSrcweir // - wenn keine interakt. Trennung, dann nur trennen, wenn im ParaFmt
1451cdf0e10cSrcweir //	 automatische Trennung eingestellt ist.
1452cdf0e10cSrcweir 
IsHyphenate() const1453cdf0e10cSrcweir sal_Bool SwTxtFormatInfo::IsHyphenate() const
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir 	if( !bInterHyph && !bAutoHyph )
1456cdf0e10cSrcweir 		return sal_False;
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir 	LanguageType eTmp = GetFont()->GetLanguage();
1459cdf0e10cSrcweir 	if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
1460cdf0e10cSrcweir 		return sal_False;
1461cdf0e10cSrcweir 
1462cdf0e10cSrcweir 	uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1463cdf0e10cSrcweir 	if (bInterHyph && xHyph.is())
1464cdf0e10cSrcweir 		SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1465cdf0e10cSrcweir 
1466cdf0e10cSrcweir 	if( !xHyph.is() || !xHyph->hasLocale( pBreakIt->GetLocale(eTmp) ) )
1467cdf0e10cSrcweir 		return sal_False;
1468cdf0e10cSrcweir 	return sal_True;
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir /*************************************************************************
1472cdf0e10cSrcweir  *					SwTxtFormatInfo::GetDropFmt()
1473cdf0e10cSrcweir  *************************************************************************/
1474cdf0e10cSrcweir 
1475cdf0e10cSrcweir // Dropcaps vom SwTxtFormatter::CTOR gerufen.
GetDropFmt() const1476cdf0e10cSrcweir const SwFmtDrop *SwTxtFormatInfo::GetDropFmt() const
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir 	const SwFmtDrop *pDrop = &GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetDrop();
1479cdf0e10cSrcweir 	if( 1 >= pDrop->GetLines() ||
1480cdf0e10cSrcweir 		( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1481cdf0e10cSrcweir 		pDrop = 0;
1482cdf0e10cSrcweir 	return pDrop;
1483cdf0e10cSrcweir }
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir /*************************************************************************
1486cdf0e10cSrcweir  *						SwTxtFormatInfo::Init()
1487cdf0e10cSrcweir  *************************************************************************/
1488cdf0e10cSrcweir 
Init()1489cdf0e10cSrcweir void SwTxtFormatInfo::Init()
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir 	// Nicht initialisieren: pRest, nLeft, nRight, nFirst, nRealWidth
1492cdf0e10cSrcweir 	X(0);
1493cdf0e10cSrcweir 	bArrowDone = bFull = bFtnDone = bErgoDone = bNumDone = bNoEndHyph =
1494cdf0e10cSrcweir 		bNoMidHyph = bStop = bNewLine = bUnderFlow = sal_False;
1495cdf0e10cSrcweir 
1496cdf0e10cSrcweir     // generally we do not allow number portions in follows, except...
1497cdf0e10cSrcweir     if ( GetTxtFrm()->IsFollow() )
1498cdf0e10cSrcweir     {
1499cdf0e10cSrcweir         const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
1500cdf0e10cSrcweir         const SwLinePortion* pTmpPara = pMaster->GetPara();
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir         // there is a master for this follow and the master does not have
1503cdf0e10cSrcweir         // any contents (especially it does not have a number portion)
1504cdf0e10cSrcweir         bNumDone = ! pTmpPara ||
1505cdf0e10cSrcweir                    ! ((SwParaPortion*)pTmpPara)->GetFirstPortion()->IsFlyPortion();
1506cdf0e10cSrcweir     }
1507cdf0e10cSrcweir 
1508cdf0e10cSrcweir 	pRoot = 0;
1509cdf0e10cSrcweir 	pLast = 0;
1510cdf0e10cSrcweir 	pFly = 0;
1511cdf0e10cSrcweir 	pLastFld = 0;
1512cdf0e10cSrcweir 	pLastTab = 0;
1513cdf0e10cSrcweir 	pUnderFlow = 0;
1514cdf0e10cSrcweir 	cTabDecimal = 0;
1515cdf0e10cSrcweir 	nWidth = nRealWidth;
1516cdf0e10cSrcweir 	nForcedLeftMargin = 0;
1517cdf0e10cSrcweir 	nSoftHyphPos = 0;
1518cdf0e10cSrcweir     nUnderScorePos = STRING_LEN;
1519cdf0e10cSrcweir 	cHookChar = 0;
1520cdf0e10cSrcweir 	SetIdx(0);
1521cdf0e10cSrcweir 	SetLen( GetTxt().Len() );
1522cdf0e10cSrcweir 	SetPaintOfst(0);
1523cdf0e10cSrcweir }
1524cdf0e10cSrcweir 
1525cdf0e10cSrcweir /*-----------------16.10.00 11:39-------------------
1526cdf0e10cSrcweir  * There are a few differences between a copy constructor
1527cdf0e10cSrcweir  * and the following constructor for multi-line formatting.
1528cdf0e10cSrcweir  * The root is the first line inside the multi-portion,
1529cdf0e10cSrcweir  * the line start is the actual position in the text,
1530cdf0e10cSrcweir  * the line width is the rest width from the surrounding line
1531cdf0e10cSrcweir  * and the bMulti and bFirstMulti-flag has to be set correctly.
1532cdf0e10cSrcweir  * --------------------------------------------------*/
1533cdf0e10cSrcweir 
SwTxtFormatInfo(const SwTxtFormatInfo & rInf,SwLineLayout & rLay,SwTwips nActWidth)1534cdf0e10cSrcweir SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf,
1535cdf0e10cSrcweir 	SwLineLayout& rLay, SwTwips nActWidth ) : SwTxtPaintInfo( rInf )
1536cdf0e10cSrcweir {
1537cdf0e10cSrcweir 	pRoot = &rLay;
1538cdf0e10cSrcweir 	pLast = &rLay;
1539cdf0e10cSrcweir 	pFly = NULL;
1540cdf0e10cSrcweir 	pLastFld = NULL;
1541cdf0e10cSrcweir 	pUnderFlow = NULL;
1542cdf0e10cSrcweir 	pRest = NULL;
1543cdf0e10cSrcweir 	pLastTab = NULL;
1544cdf0e10cSrcweir 
1545cdf0e10cSrcweir 	nSoftHyphPos = 0;
1546cdf0e10cSrcweir     nUnderScorePos = STRING_LEN;
1547cdf0e10cSrcweir     nHyphStart = 0;
1548cdf0e10cSrcweir 	nHyphWrdStart = 0;
1549cdf0e10cSrcweir 	nHyphWrdLen = 0;
1550cdf0e10cSrcweir 	nLineStart = rInf.GetIdx();
1551cdf0e10cSrcweir 	nLeft = rInf.nLeft;
1552cdf0e10cSrcweir 	nRight = rInf.nRight;
1553cdf0e10cSrcweir 	nFirst = rInf.nLeft;
1554cdf0e10cSrcweir 	nRealWidth = KSHORT(nActWidth);
1555cdf0e10cSrcweir 	nWidth = nRealWidth;
1556cdf0e10cSrcweir 	nLineHeight = 0;
1557cdf0e10cSrcweir     nLineNettoHeight = 0;
1558cdf0e10cSrcweir 	nForcedLeftMargin = 0;
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir 	nMinLeading = 0;
1561cdf0e10cSrcweir 	nMinTrailing = 0;
1562cdf0e10cSrcweir 	nMinWordLength = 0;
1563cdf0e10cSrcweir 	bFull = sal_False;
1564cdf0e10cSrcweir 	bFtnDone = sal_True;
1565cdf0e10cSrcweir 	bErgoDone = sal_True;
1566cdf0e10cSrcweir 	bNumDone = sal_True;
1567cdf0e10cSrcweir     bArrowDone = sal_True;
1568cdf0e10cSrcweir     bStop = sal_False;
1569cdf0e10cSrcweir 	bNewLine = sal_True;
1570cdf0e10cSrcweir 	bShift	= sal_False;
1571cdf0e10cSrcweir 	bUnderFlow = sal_False;
1572cdf0e10cSrcweir 	bInterHyph = sal_False;
1573cdf0e10cSrcweir 	bAutoHyph = sal_False;
1574cdf0e10cSrcweir 	bDropInit = sal_False;
1575cdf0e10cSrcweir 	bQuick	= rInf.bQuick;
1576cdf0e10cSrcweir 	bNoEndHyph	= sal_False;
1577cdf0e10cSrcweir 	bNoMidHyph	= sal_False;
1578cdf0e10cSrcweir 	bIgnoreFly = sal_False;
1579cdf0e10cSrcweir     bFakeLineStart = sal_False;
1580cdf0e10cSrcweir 
1581cdf0e10cSrcweir 	cTabDecimal = 0;
1582cdf0e10cSrcweir 	cHookChar = 0;
1583cdf0e10cSrcweir 	nMaxHyph = 0;
1584cdf0e10cSrcweir 	bTestFormat = rInf.bTestFormat;
1585cdf0e10cSrcweir 	SetMulti( sal_True );
1586cdf0e10cSrcweir     SetFirstMulti( rInf.IsFirstMulti() );
1587cdf0e10cSrcweir }
1588cdf0e10cSrcweir 
1589cdf0e10cSrcweir /*************************************************************************
1590cdf0e10cSrcweir  *				   SwTxtFormatInfo::_CheckFtnPortion()
1591cdf0e10cSrcweir  *************************************************************************/
1592cdf0e10cSrcweir 
_CheckFtnPortion(SwLineLayout * pCurr)1593cdf0e10cSrcweir sal_Bool SwTxtFormatInfo::_CheckFtnPortion( SwLineLayout* pCurr )
1594cdf0e10cSrcweir {
1595cdf0e10cSrcweir 	KSHORT nHeight = pCurr->GetRealHeight();
1596cdf0e10cSrcweir 	SwLinePortion *pPor = pCurr->GetPortion();
1597cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1598cdf0e10cSrcweir 	while( pPor )
1599cdf0e10cSrcweir 	{
1600cdf0e10cSrcweir 		if( pPor->IsFtnPortion() && nHeight > ((SwFtnPortion*)pPor)->Orig() )
1601cdf0e10cSrcweir 		{
1602cdf0e10cSrcweir 			bRet = sal_True;
1603cdf0e10cSrcweir 			SetLineHeight( nHeight );
1604cdf0e10cSrcweir             SetLineNettoHeight( pCurr->Height() );
1605cdf0e10cSrcweir 			break;
1606cdf0e10cSrcweir 		}
1607cdf0e10cSrcweir 		pPor = pPor->GetPortion();
1608cdf0e10cSrcweir 	}
1609cdf0e10cSrcweir 	return bRet;
1610cdf0e10cSrcweir }
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir 
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir 
1615cdf0e10cSrcweir /*************************************************************************
1616cdf0e10cSrcweir  *				   SwTxtFormatInfo::ScanPortionEnd()
1617cdf0e10cSrcweir  *************************************************************************/
ScanPortionEnd(const xub_StrLen nStart,const xub_StrLen nEnd)1618cdf0e10cSrcweir xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart,
1619cdf0e10cSrcweir                                             const xub_StrLen nEnd )
1620cdf0e10cSrcweir {
1621cdf0e10cSrcweir 	cHookChar = 0;
1622cdf0e10cSrcweir     xub_StrLen i = nStart;
1623cdf0e10cSrcweir 
1624cdf0e10cSrcweir     //
1625cdf0e10cSrcweir     // Used for decimal tab handling:
1626cdf0e10cSrcweir     //
1627cdf0e10cSrcweir     const xub_Unicode cTabDec = GetLastTab() ? (sal_Unicode)GetTabDecimal() : 0;
1628cdf0e10cSrcweir     const xub_Unicode cThousandSep  = ',' == cTabDec ? '.' : ',';
1629cdf0e10cSrcweir     // --> FME 2006-01-23 #i45951# German (Switzerland) uses ' as thousand separator:
1630cdf0e10cSrcweir     const xub_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1631cdf0e10cSrcweir     // <--
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir     bool bNumFound = false;
1634cdf0e10cSrcweir     const bool bTabCompat = GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT);
1635cdf0e10cSrcweir 
1636cdf0e10cSrcweir     // Removed for i7288. bSkip used to be passed from SwFldPortion::Format
1637cdf0e10cSrcweir     // as IsFollow(). Therefore more than one special character was not
1638cdf0e10cSrcweir     // handled correctly at the beginning of follow fields.
1639cdf0e10cSrcweir //    if ( bSkip && i < nEnd )
1640cdf0e10cSrcweir //       ++i;
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir 	for( ; i < nEnd; ++i )
1643cdf0e10cSrcweir 	{
1644cdf0e10cSrcweir 		const xub_Unicode cPos = GetChar( i );
1645cdf0e10cSrcweir 		switch( cPos )
1646cdf0e10cSrcweir 		{
1647cdf0e10cSrcweir 		case CH_TXTATR_BREAKWORD:
1648cdf0e10cSrcweir 		case CH_TXTATR_INWORD:
1649cdf0e10cSrcweir 			if( !HasHint( i ))
1650cdf0e10cSrcweir 				break;
1651cdf0e10cSrcweir 			// no break;
1652cdf0e10cSrcweir 
1653cdf0e10cSrcweir 		case CHAR_SOFTHYPHEN:
1654cdf0e10cSrcweir 		case CHAR_HARDHYPHEN:
1655cdf0e10cSrcweir 		case CHAR_HARDBLANK:
1656cdf0e10cSrcweir 		case CH_TAB:
1657cdf0e10cSrcweir 		case CH_BREAK:
1658cdf0e10cSrcweir         case CHAR_ZWSP :
1659cdf0e10cSrcweir         case CHAR_ZWNBSP :
1660cdf0e10cSrcweir //        case CHAR_RLM :
1661cdf0e10cSrcweir //        case CHAR_LRM :
1662cdf0e10cSrcweir 			cHookChar = cPos;
1663cdf0e10cSrcweir 			return i;
1664cdf0e10cSrcweir 
1665cdf0e10cSrcweir         case CHAR_UNDERSCORE:
1666cdf0e10cSrcweir             if ( STRING_LEN == nUnderScorePos )
1667cdf0e10cSrcweir                 nUnderScorePos = i;
1668cdf0e10cSrcweir             break;
1669cdf0e10cSrcweir 
1670cdf0e10cSrcweir         default:
1671cdf0e10cSrcweir             if ( cTabDec )
1672cdf0e10cSrcweir             {
1673cdf0e10cSrcweir 			    if( cTabDec == cPos )
1674cdf0e10cSrcweir 			    {
1675cdf0e10cSrcweir     				ASSERT( cPos, "Unexpected end of string" );
1676cdf0e10cSrcweir 				    if( cPos ) // robust
1677cdf0e10cSrcweir 				    {
1678cdf0e10cSrcweir     					cHookChar = cPos;
1679cdf0e10cSrcweir 					    return i;
1680cdf0e10cSrcweir 				    }
1681cdf0e10cSrcweir 			    }
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir                 //
1684cdf0e10cSrcweir                 // Compatibility: First non-digit character behind a
1685cdf0e10cSrcweir                 // a digit character becomes the hook character
1686cdf0e10cSrcweir                 //
1687cdf0e10cSrcweir                 if ( bTabCompat )
1688cdf0e10cSrcweir                 {
1689cdf0e10cSrcweir                     if ( ( 0x2F < cPos && cPos < 0x3A ) ||
1690cdf0e10cSrcweir                          ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1691cdf0e10cSrcweir                     {
1692cdf0e10cSrcweir                         bNumFound = true;
1693cdf0e10cSrcweir                     }
1694cdf0e10cSrcweir                     else
1695cdf0e10cSrcweir                     {
1696cdf0e10cSrcweir                         if ( bNumFound )
1697cdf0e10cSrcweir                         {
1698cdf0e10cSrcweir     				    	cHookChar = cPos;
1699cdf0e10cSrcweir                             SetTabDecimal( cPos );
1700cdf0e10cSrcweir     					    return i;
1701cdf0e10cSrcweir                         }
1702cdf0e10cSrcweir                     }
1703cdf0e10cSrcweir 		        }
1704cdf0e10cSrcweir             }
1705cdf0e10cSrcweir         }
1706cdf0e10cSrcweir 	}
1707cdf0e10cSrcweir 
1708cdf0e10cSrcweir     // --> FME 2006-01-13 #130210# Check if character *behind* the portion has
1709cdf0e10cSrcweir     // to become the hook:
1710cdf0e10cSrcweir     if ( i == nEnd && i < GetTxt().Len() && bNumFound )
1711cdf0e10cSrcweir     {
1712cdf0e10cSrcweir 		const xub_Unicode cPos = GetChar( i );
1713cdf0e10cSrcweir         if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
1714cdf0e10cSrcweir         {
1715cdf0e10cSrcweir             cHookChar = GetChar( i );
1716cdf0e10cSrcweir             SetTabDecimal( cHookChar );
1717cdf0e10cSrcweir         }
1718cdf0e10cSrcweir     }
1719cdf0e10cSrcweir 
1720cdf0e10cSrcweir 	return i;
1721cdf0e10cSrcweir }
1722cdf0e10cSrcweir 
LastKernPortion()1723cdf0e10cSrcweir sal_Bool SwTxtFormatInfo::LastKernPortion()
1724cdf0e10cSrcweir {
1725cdf0e10cSrcweir 	if( GetLast() )
1726cdf0e10cSrcweir 	{
1727cdf0e10cSrcweir 	 	if( GetLast()->IsKernPortion() )
1728cdf0e10cSrcweir 			return sal_True;
1729cdf0e10cSrcweir 		if( GetLast()->Width() || ( GetLast()->GetLen() &&
1730cdf0e10cSrcweir 			!GetLast()->IsHolePortion() ) )
1731cdf0e10cSrcweir 			return sal_False;
1732cdf0e10cSrcweir 	}
1733cdf0e10cSrcweir 	SwLinePortion* pPor = GetRoot();
1734cdf0e10cSrcweir 	SwLinePortion *pKern = NULL;
1735cdf0e10cSrcweir 	while( pPor )
1736cdf0e10cSrcweir 	{
1737cdf0e10cSrcweir 		if( pPor->IsKernPortion() )
1738cdf0e10cSrcweir 			pKern = pPor;
1739cdf0e10cSrcweir 		else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
1740cdf0e10cSrcweir 			pKern = NULL;
1741cdf0e10cSrcweir 		pPor = pPor->GetPortion();
1742cdf0e10cSrcweir 	}
1743cdf0e10cSrcweir 	if( pKern )
1744cdf0e10cSrcweir 	{
1745cdf0e10cSrcweir 		SetLast( pKern );
1746cdf0e10cSrcweir 		return sal_True;
1747cdf0e10cSrcweir 	}
1748cdf0e10cSrcweir 	return sal_False;
1749cdf0e10cSrcweir }
1750cdf0e10cSrcweir 
1751cdf0e10cSrcweir /*************************************************************************
1752cdf0e10cSrcweir  *                      class SwTxtSlot
1753cdf0e10cSrcweir  *************************************************************************/
1754cdf0e10cSrcweir 
SwTxtSlot(const SwTxtSizeInfo * pNew,const SwLinePortion * pPor,bool bTxtLen,bool bExgLists,const sal_Char * pCh)175569a74367SOliver-Rainer Wittmann SwTxtSlot::SwTxtSlot(
175669a74367SOliver-Rainer Wittmann     const SwTxtSizeInfo *pNew,
175769a74367SOliver-Rainer Wittmann     const SwLinePortion *pPor,
175869a74367SOliver-Rainer Wittmann     bool bTxtLen,
175969a74367SOliver-Rainer Wittmann     bool bExgLists,
176069a74367SOliver-Rainer Wittmann     const sal_Char *pCh )
1761cdf0e10cSrcweir     : pOldTxt( 0 ),
1762cdf0e10cSrcweir       pOldSmartTagList( 0 ),
1763cdf0e10cSrcweir       pOldGrammarCheckList( 0 ),
1764cdf0e10cSrcweir       pTempList( 0 )
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir 	if( pCh )
1767cdf0e10cSrcweir 	{
1768cdf0e10cSrcweir 		aTxt = XubString( pCh, RTL_TEXTENCODING_MS_1252 );
1769cdf0e10cSrcweir 		bOn = sal_True;
1770cdf0e10cSrcweir 	}
1771cdf0e10cSrcweir 	else
1772cdf0e10cSrcweir 		bOn = pPor->GetExpTxt( *pNew, aTxt );
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir 	// Der Text wird ausgetauscht...
1775cdf0e10cSrcweir 	if( bOn )
1776cdf0e10cSrcweir 	{
1777cdf0e10cSrcweir 		pInf = (SwTxtSizeInfo*)pNew;
1778cdf0e10cSrcweir 		nIdx = pInf->GetIdx();
1779cdf0e10cSrcweir 		nLen = pInf->GetLen();
1780cdf0e10cSrcweir 		pOldTxt = &(pInf->GetTxt());
1781cdf0e10cSrcweir 		pInf->SetTxt( aTxt );
1782cdf0e10cSrcweir 		pInf->SetIdx( 0 );
1783cdf0e10cSrcweir         pInf->SetLen( bTxtLen ? pInf->GetTxt().Len() : pPor->GetLen() );
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir         // ST2
1786cdf0e10cSrcweir         if ( bExgLists )
1787cdf0e10cSrcweir         {
1788cdf0e10cSrcweir             pOldSmartTagList = static_cast<SwTxtPaintInfo*>(pInf)->GetSmartTags();
1789cdf0e10cSrcweir             if ( pOldSmartTagList )
1790cdf0e10cSrcweir             {
1791cdf0e10cSrcweir                 const sal_uInt16 nPos = pOldSmartTagList->GetWrongPos(nIdx);
1792cdf0e10cSrcweir                 const xub_StrLen nListPos = pOldSmartTagList->Pos(nPos);
1793cdf0e10cSrcweir                 if( nListPos == nIdx )
1794cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList->SubList( nPos ) );
1795cdf0e10cSrcweir                 else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && aTxt.Len() )
1796cdf0e10cSrcweir                 {
1797cdf0e10cSrcweir                     pTempList = new SwWrongList( WRONGLIST_SMARTTAG );
1798cdf0e10cSrcweir                     pTempList->Insert( rtl::OUString(), 0, 0, aTxt.Len(), 0 );
1799cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetSmartTags( pTempList );
1800cdf0e10cSrcweir                 }
1801cdf0e10cSrcweir                 else
1802cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetSmartTags( 0);
1803cdf0e10cSrcweir             }
1804cdf0e10cSrcweir             pOldGrammarCheckList = static_cast<SwTxtPaintInfo*>(pInf)->GetGrammarCheckList();
1805cdf0e10cSrcweir             if ( pOldGrammarCheckList )
1806cdf0e10cSrcweir             {
1807cdf0e10cSrcweir                 const sal_uInt16 nPos = pOldGrammarCheckList->GetWrongPos(nIdx);
1808cdf0e10cSrcweir                 const xub_StrLen nListPos = pOldGrammarCheckList->Pos(nPos);
1809cdf0e10cSrcweir                 if( nListPos == nIdx )
1810cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList->SubList( nPos ) );
1811cdf0e10cSrcweir                 else if( !pTempList && nPos < pOldGrammarCheckList->Count() && nListPos < nIdx && aTxt.Len() )
1812cdf0e10cSrcweir                 {
1813cdf0e10cSrcweir                     pTempList = new SwWrongList( WRONGLIST_GRAMMAR );
1814cdf0e10cSrcweir                     pTempList->Insert( rtl::OUString(), 0, 0, aTxt.Len(), 0 );
1815cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pTempList );
1816cdf0e10cSrcweir                 }
1817cdf0e10cSrcweir                 else
1818cdf0e10cSrcweir                     ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( 0);
1819cdf0e10cSrcweir             }
1820cdf0e10cSrcweir         }
1821cdf0e10cSrcweir     }
1822cdf0e10cSrcweir }
1823cdf0e10cSrcweir 
1824cdf0e10cSrcweir /*************************************************************************
1825cdf0e10cSrcweir  *                       SwTxtSlot::~SwTxtSlot()
1826cdf0e10cSrcweir  *************************************************************************/
1827cdf0e10cSrcweir 
~SwTxtSlot()1828cdf0e10cSrcweir SwTxtSlot::~SwTxtSlot()
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir 	if( bOn )
1831cdf0e10cSrcweir 	{
1832cdf0e10cSrcweir 		pInf->SetTxt( *pOldTxt );
1833cdf0e10cSrcweir 		pInf->SetIdx( nIdx );
1834cdf0e10cSrcweir 		pInf->SetLen( nLen );
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir         // ST2
1837cdf0e10cSrcweir         // Restore old smart tag list
1838cdf0e10cSrcweir         if ( pOldSmartTagList )
1839cdf0e10cSrcweir             ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList );
1840cdf0e10cSrcweir         if ( pOldGrammarCheckList )
1841cdf0e10cSrcweir             ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList );
1842cdf0e10cSrcweir         delete pTempList;
1843cdf0e10cSrcweir     }
1844cdf0e10cSrcweir }
1845cdf0e10cSrcweir 
1846cdf0e10cSrcweir /*************************************************************************
1847cdf0e10cSrcweir  *					   SwFontSave::SwFontSave()
1848cdf0e10cSrcweir  *************************************************************************/
1849cdf0e10cSrcweir 
SwFontSave(const SwTxtSizeInfo & rInf,SwFont * pNew,SwAttrIter * pItr)1850cdf0e10cSrcweir SwFontSave::SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pNew,
1851cdf0e10cSrcweir 		SwAttrIter* pItr )
1852cdf0e10cSrcweir 		: pFnt( pNew ? ((SwTxtSizeInfo&)rInf).GetFont() : 0 )
1853cdf0e10cSrcweir {
1854cdf0e10cSrcweir 	if( pFnt )
1855cdf0e10cSrcweir 	{
1856cdf0e10cSrcweir 		pInf = &((SwTxtSizeInfo&)rInf);
1857cdf0e10cSrcweir         // In these cases we temporarily switch to the new font:
1858cdf0e10cSrcweir         // 1. the fonts have a different magic number
1859cdf0e10cSrcweir         // 2. they have different script types
1860cdf0e10cSrcweir         // 3. their background colors differ (this is not covered by 1.)
1861cdf0e10cSrcweir 		if( pFnt->DifferentMagic( pNew, pFnt->GetActual() ) ||
1862cdf0e10cSrcweir             pNew->GetActual() != pFnt->GetActual() ||
1863cdf0e10cSrcweir             ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1864cdf0e10cSrcweir             ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1865cdf0e10cSrcweir             ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1866cdf0e10cSrcweir               ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1867cdf0e10cSrcweir 		{
1868cdf0e10cSrcweir 			pNew->SetTransparent( sal_True );
1869cdf0e10cSrcweir 			pNew->SetAlign( ALIGN_BASELINE );
1870cdf0e10cSrcweir 			pInf->SetFont( pNew );
1871cdf0e10cSrcweir 		}
1872cdf0e10cSrcweir 		else
1873cdf0e10cSrcweir 			pFnt = 0;
1874cdf0e10cSrcweir 		pNew->Invalidate();
1875cdf0e10cSrcweir         pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1876cdf0e10cSrcweir 		if( pItr && pItr->GetFnt() == pFnt )
1877cdf0e10cSrcweir 		{
1878cdf0e10cSrcweir 			pIter = pItr;
1879cdf0e10cSrcweir 			pIter->SetFnt( pNew );
1880cdf0e10cSrcweir 		}
1881cdf0e10cSrcweir 		else
1882cdf0e10cSrcweir 			pIter = NULL;
1883cdf0e10cSrcweir 	}
1884cdf0e10cSrcweir }
1885cdf0e10cSrcweir 
1886cdf0e10cSrcweir /*************************************************************************
1887cdf0e10cSrcweir  *					   SwFontSave::~SwFontSave()
1888cdf0e10cSrcweir  *************************************************************************/
1889cdf0e10cSrcweir 
~SwFontSave()1890cdf0e10cSrcweir SwFontSave::~SwFontSave()
1891cdf0e10cSrcweir {
1892cdf0e10cSrcweir 	if( pFnt )
1893cdf0e10cSrcweir 	{
1894cdf0e10cSrcweir 		// SwFont zurueckstellen
1895cdf0e10cSrcweir 		pFnt->Invalidate();
1896cdf0e10cSrcweir 		pInf->SetFont( pFnt );
1897cdf0e10cSrcweir 		if( pIter )
1898cdf0e10cSrcweir 		{
1899cdf0e10cSrcweir 			pIter->SetFnt( pFnt );
1900cdf0e10cSrcweir 			pIter->nPos = STRING_LEN;
1901cdf0e10cSrcweir 		}
1902cdf0e10cSrcweir 	}
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir 
1905cdf0e10cSrcweir /*************************************************************************
1906cdf0e10cSrcweir  *					   SwDefFontSave::SwDefFontSave()
1907cdf0e10cSrcweir  *************************************************************************/
1908cdf0e10cSrcweir 
SwDefFontSave(const SwTxtSizeInfo & rInf)1909cdf0e10cSrcweir SwDefFontSave::SwDefFontSave( const SwTxtSizeInfo &rInf )
1910cdf0e10cSrcweir 		: pFnt( ((SwTxtSizeInfo&)rInf).GetFont()  )
1911cdf0e10cSrcweir {
1912cdf0e10cSrcweir     const sal_Bool bTmpAlter = pFnt->GetFixKerning() ||
1913cdf0e10cSrcweir 		 ( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet(pFnt->GetActual()) )
1914cdf0e10cSrcweir 		;
1915cdf0e10cSrcweir 
1916cdf0e10cSrcweir     const sal_Bool bFamily = bTmpAlter &&
1917cdf0e10cSrcweir           pFnt->GetName( pFnt->GetActual() ) != numfunc::GetDefBulletFontname();
1918cdf0e10cSrcweir     const sal_Bool bRotation = (sal_Bool)pFnt->GetOrientation() &&
1919cdf0e10cSrcweir                                 ! rInf.GetTxtFrm()->IsVertical();
1920cdf0e10cSrcweir 
1921cdf0e10cSrcweir     if( bFamily || bRotation )
1922cdf0e10cSrcweir 	{
1923cdf0e10cSrcweir 		pNewFnt = new SwFont( *pFnt );
1924cdf0e10cSrcweir 
1925cdf0e10cSrcweir         if ( bFamily )
1926cdf0e10cSrcweir         {
1927cdf0e10cSrcweir             pNewFnt->SetFamily( FAMILY_DONTKNOW, pFnt->GetActual() );
1928cdf0e10cSrcweir             pNewFnt->SetName( numfunc::GetDefBulletFontname(), pFnt->GetActual() );
1929cdf0e10cSrcweir             pNewFnt->SetStyleName( aEmptyStr, pFnt->GetActual() );
1930cdf0e10cSrcweir             pNewFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, pFnt->GetActual() );
1931cdf0e10cSrcweir             pNewFnt->SetFixKerning( 0 );
1932cdf0e10cSrcweir         }
1933cdf0e10cSrcweir 
1934cdf0e10cSrcweir         if ( bRotation )
1935cdf0e10cSrcweir             pNewFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );
1936cdf0e10cSrcweir 
1937cdf0e10cSrcweir         pInf = &((SwTxtSizeInfo&)rInf);
1938cdf0e10cSrcweir 		pNewFnt->Invalidate();
1939cdf0e10cSrcweir 		pInf->SetFont( pNewFnt );
1940cdf0e10cSrcweir 	}
1941cdf0e10cSrcweir 	else
1942cdf0e10cSrcweir 	{
1943cdf0e10cSrcweir 		pFnt = 0;
1944cdf0e10cSrcweir 		pNewFnt = 0;
1945cdf0e10cSrcweir 	}
1946cdf0e10cSrcweir }
1947cdf0e10cSrcweir 
1948cdf0e10cSrcweir /*************************************************************************
1949cdf0e10cSrcweir  *					   SwDefFontSave::~SwDefFontSave()
1950cdf0e10cSrcweir  *************************************************************************/
1951cdf0e10cSrcweir 
~SwDefFontSave()1952cdf0e10cSrcweir SwDefFontSave::~SwDefFontSave()
1953cdf0e10cSrcweir {
1954cdf0e10cSrcweir 	if( pFnt )
1955cdf0e10cSrcweir 	{
1956cdf0e10cSrcweir 		delete pNewFnt;
1957cdf0e10cSrcweir 		// SwFont zurueckstellen
1958cdf0e10cSrcweir 		pFnt->Invalidate();
1959cdf0e10cSrcweir 		pInf->SetFont( pFnt );
1960cdf0e10cSrcweir 	}
1961cdf0e10cSrcweir }
1962cdf0e10cSrcweir 
1963cdf0e10cSrcweir /*************************************************************************
1964cdf0e10cSrcweir  *					SwTxtFormatInfo::ChgHyph()
1965cdf0e10cSrcweir  *************************************************************************/
1966cdf0e10cSrcweir 
ChgHyph(const sal_Bool bNew)1967cdf0e10cSrcweir sal_Bool SwTxtFormatInfo::ChgHyph( const sal_Bool bNew )
1968cdf0e10cSrcweir {
1969cdf0e10cSrcweir 	const sal_Bool bOld = bAutoHyph;
1970cdf0e10cSrcweir 	if( bAutoHyph != bNew )
1971cdf0e10cSrcweir 	{
1972cdf0e10cSrcweir 		bAutoHyph = bNew;
1973cdf0e10cSrcweir 		InitHyph( bNew );
1974cdf0e10cSrcweir 		// 5744: Sprache am Hyphenator einstellen.
1975cdf0e10cSrcweir 		if( pFnt )
1976cdf0e10cSrcweir             pFnt->ChgPhysFnt( pVsh, *pOut );
1977cdf0e10cSrcweir 	}
1978cdf0e10cSrcweir 	return bOld;
1979cdf0e10cSrcweir }
1980cdf0e10cSrcweir 
1981cdf0e10cSrcweir 
1982