Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * The Contents of this file are made available subject to the terms of
5 : : * either of the following licenses
6 : : *
7 : : * - GNU Lesser General Public License Version 2.1
8 : : * - Sun Industry Standards Source License Version 1.1
9 : : *
10 : : * Sun Microsystems Inc., October, 2000
11 : : *
12 : : * GNU Lesser General Public License Version 2.1
13 : : * =============================================
14 : : * Copyright 2000 by Sun Microsystems, Inc.
15 : : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : : *
17 : : * This library is free software; you can redistribute it and/or
18 : : * modify it under the terms of the GNU Lesser General Public
19 : : * License version 2.1, as published by the Free Software Foundation.
20 : : *
21 : : * This library is distributed in the hope that it will be useful,
22 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : : * Lesser General Public License for more details.
25 : : *
26 : : * You should have received a copy of the GNU Lesser General Public
27 : : * License along with this library; if not, write to the Free Software
28 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : : * MA 02111-1307 USA
30 : : *
31 : : *
32 : : * Sun Industry Standards Source License Version 1.1
33 : : * =================================================
34 : : * The contents of this file are subject to the Sun Industry Standards
35 : : * Source License Version 1.1 (the "License"); You may not use this file
36 : : * except in compliance with the License. You may obtain a copy of the
37 : : * License at http://www.openoffice.org/license.html.
38 : : *
39 : : * Software provided under this License is provided on an "AS IS" basis,
40 : : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : : * See the License for the specific provisions governing your rights and
44 : : * obligations concerning the Software.
45 : : *
46 : : * The Initial Developer of the Original Code is: IBM Corporation
47 : : *
48 : : * Copyright: 2008 by IBM Corporation
49 : : *
50 : : * All Rights Reserved.
51 : : *
52 : : * Contributor(s): _______________________________________
53 : : *
54 : : *
55 : : ************************************************************************/
56 : : /*************************************************************************
57 : : * @file
58 : : * For LWP filter architecture prototype
59 : : ************************************************************************/
60 : : /*************************************************************************
61 : : * Change History
62 : : Jan 2005 Created
63 : : ************************************************************************/
64 : :
65 : : #include <memory>
66 : :
67 : : #include <boost/cast.hpp>
68 : :
69 : : #include "lwppara.hxx"
70 : : #include "lwpglobalmgr.hxx"
71 : : #include "lwpfilehdr.hxx"
72 : : #include "lwpparaproperty.hxx"
73 : : #include "lwptools.hxx"
74 : : #include "lwpparastyle.hxx"
75 : : #include "xfilter/xffont.hxx"
76 : : #include "xfilter/xftextstyle.hxx"
77 : : #include "xfilter/xfstylemanager.hxx"
78 : : #include "xfilter/xfparagraph.hxx"
79 : : #include "xfilter/xftextcontent.hxx"
80 : : #include "xfilter/xftextspan.hxx"
81 : : #include "xfilter/xfmargins.hxx"
82 : : #include "xfilter/xftabstop.hxx"
83 : : #include "xfilter/xflinebreak.hxx"
84 : : #include "xfilter/xfsection.hxx"
85 : : #include "xfilter/xfsectionstyle.hxx"
86 : : #include "xfilter/xfcolor.hxx"
87 : : #include "xfilter/xfhyperlink.hxx"
88 : : #include "lwpcharsetmgr.hxx"
89 : : #include "lwpsection.hxx"
90 : : #include "lwplayout.hxx"
91 : : #include "lwpusewhen.hxx"
92 : :
93 : : #include "lwpbulletstylemgr.hxx"
94 : : #include "lwpstory.hxx"
95 : : #include "lwpsilverbullet.hxx"
96 : : #include "xfilter/xflist.hxx"
97 : : #include "xfilter/xfframe.hxx"
98 : :
99 : : #include "lwpdivinfo.hxx"
100 : : #include "lwpdoc.hxx"
101 : : #include "lwpholder.hxx"
102 : : #include "lwppagehint.hxx"
103 : :
104 : : #include "lwpdropcapmgr.hxx"
105 : : #include "lwptable.hxx"
106 : : #include "lwpcelllayout.hxx"
107 : :
108 : : // boost::polymorphic_downcast checks and reports (using assert), if the
109 : : // cast is incorrect. We want this in debug builds.
110 : : #if OSL_DEBUG_LEVEL > 0
111 : : # undef NDEBUG
112 : : #elif !defined(NDEBUG)
113 : : # define NDEBUG 1
114 : : #endif
115 : :
116 : : using boost::polymorphic_downcast;
117 : :
118 : : /**
119 : : * @short get text of paragraph
120 : : */
121 : 0 : OUString LwpPara::GetContentText(sal_Bool bAllText)
122 : : {
123 : : // rFont = m_FontID;
124 [ # # ]: 0 : if (bAllText)
125 : : {
126 : 0 : m_Fribs.SetPara(this);
127 : 0 : m_Fribs.GatherAllText();
128 : 0 : return m_AllText;
129 : : }
130 : : else
131 : 0 : return m_Content;
132 : : }
133 : :
134 : : /**
135 : : * @short set text of paragraph
136 : : */
137 : 0 : void LwpPara::SetAllText(OUString sText)
138 : : {
139 : 0 : m_AllText+=sText;
140 : 0 : }
141 : :
142 : : /**
143 : : * @short set first frib content
144 : : */
145 : 282 : void LwpPara::SetFirstFrib(rtl::OUString Content,sal_uInt32 FontID)
146 : : {
147 : 282 : m_FontID= FontID;
148 : 282 : m_Content=Content;
149 : 282 : }
150 : : /**
151 : : * @short get paragraph xfstyle
152 : : */
153 : 945 : XFParaStyle* LwpPara::GetXFParaStyle()
154 : : {
155 : 945 : XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
156 [ + - ]: 945 : return pXFStyleManager->FindParaStyle(m_StyleName);
157 : : }
158 : : /**
159 : : * @short get drop cap info
160 : : */
161 : : #include "lwpframelayout.hxx"
162 : 0 : void LwpPara::GatherDropcapInfo()
163 : : {
164 : 0 : SetDropcapLines(m_pDropcapLayout->GetLines());
165 : 0 : SetDropcapChars(m_pDropcapLayout->GetChars());
166 : 0 : }
167 : : /**
168 : : * @short get parent paragraph
169 : : */
170 : 390 : LwpPara* LwpPara::GetParent()
171 : : {
172 : : LwpPara* pPara;
173 : : sal_uInt16 otherlevel;
174 : 390 : sal_uInt16 level = GetLevel();
175 : :
176 [ + + ]: 390 : if (level != 1)
177 : : {
178 [ - + ]: 12 : pPara = dynamic_cast<LwpPara*>(GetPrevious()->obj());
179 [ + - ]: 30 : while (pPara)
180 : : {
181 : 30 : otherlevel = pPara->GetLevel();
182 [ + - ][ - + ]: 30 : if ((otherlevel < level) || (otherlevel && (level == 0)))
[ + + ]
183 : 12 : return pPara;
184 [ - + ]: 18 : pPara = dynamic_cast<LwpPara*>(pPara->GetPrevious()->obj());
185 : : }
186 : : }
187 : 390 : return NULL;
188 : : }
189 : :
190 : : /**
191 : : * @short: Offer prefix, paranumber and suffix according to position.
192 : : * @param: nPosition index of wanted paranumbering in the style-list.
193 : : * @param: pParaNumbering a pointer to the structure which contains prefix, paranumber and
194 : : * suffix.
195 : : */
196 : 327 : void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
197 : : {
198 [ - + ]: 327 : if (nPosition > 9)
199 : : {
200 : 0 : return;
201 : : }
202 : 327 : sal_uInt16 nCurrentPos = 0;
203 : :
204 : 327 : LwpFrib* pPreFrib = NULL;
205 : 327 : LwpFrib* pFrib = m_Fribs.GetFribs();
206 [ - + ]: 327 : if (!pFrib)
207 : : {
208 : 0 : return;
209 : : }
210 : :
211 [ + - ]: 3354 : while (pFrib)
212 : : {
213 : 3027 : sal_uInt8 nFribType = pFrib->GetType();
214 [ + + ]: 3027 : if (nFribType == FRIB_TAG_PARANUMBER)
215 : : {
216 : 1623 : nCurrentPos++;
217 : 1623 : ModifierInfo* pModInfo = pFrib->GetModifiers();
218 [ + - ]: 1623 : if (pModInfo)
219 : : {
220 : 1623 : sal_uInt16 nHideLevels = pModInfo->aTxtAttrOverride.GetHideLevels();
221 [ + + ]: 1623 : if (nCurrentPos == nPosition)
222 : : {
223 : : //get prefix text frib
224 [ + + ]: 327 : if (pPreFrib)
225 : : {
226 [ + - + + ]: 576 : if ((pPreFrib->GetType() == FRIB_TAG_TEXT) &&
[ + + ]
227 : 288 : (pPreFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
228 : : {
229 : 204 : pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
230 : : }
231 : : }
232 : :
233 : : //get para numbering
234 : 327 : pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
235 : 327 : pParaNumbering->nNumLevel = nHideLevels;
236 : :
237 : : //get suffix text frib
238 [ + - ]: 327 : if ( (pFrib = pFrib->GetNext()) )
239 : : {
240 [ + + ]: 327 : if( pFrib->GetType() == FRIB_TAG_TEXT )
241 : : {
242 [ + + ][ + - : 876 : if (
+ + + + ]
243 : 600 : (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) ||
244 : 276 : (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)
245 : : )
246 : : {
247 : 120 : pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
248 : : }
249 : : }
250 : : }
251 : :
252 : 327 : break;
253 : : }
254 : : }
255 : : else
256 : : {
257 [ # # ]: 0 : if (nCurrentPos == nPosition)
258 : : {
259 : : //get prefix text frib
260 [ # # ]: 0 : if (pPreFrib)
261 : : {
262 [ # # ]: 0 : if (pPreFrib->GetType() == FRIB_TAG_TEXT)
263 : : {
264 : 0 : pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
265 : : }
266 : : }
267 : :
268 : : //get para numbering
269 : 0 : pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
270 : :
271 : : //get suffix text frib
272 [ # # ]: 0 : if ( (pFrib = pFrib->GetNext()) )
273 : : {
274 [ # # ]: 0 : if (pFrib->GetType() == FRIB_TAG_TEXT)
275 : : {
276 : 0 : pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
277 : : }
278 : : }
279 : :
280 : : }
281 : : }
282 : : }
283 : 2700 : pPreFrib = pFrib;
284 [ + - ]: 2700 : if (pFrib)
285 : : {
286 : 2700 : pFrib = pFrib->GetNext();
287 : : }
288 : : }
289 : : }
290 : : /**
291 : : * @short override alignment
292 : : */
293 : : //override style, add by 1-24
294 : 12 : void LwpPara::OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle)
295 : : {
296 [ + - ]: 12 : if (base)//the latter two parameter never be null
297 : : {
298 : 12 : over->Override(base);
299 : 12 : LwpParaStyle::ApplyAlignment(pOverStyle,base);
300 : : }
301 : : else
302 : 0 : LwpParaStyle::ApplyAlignment(pOverStyle,over);
303 : 12 : }
304 : : /**
305 : : * @short override indent attribute
306 : : */
307 : 390 : void LwpPara::OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle)
308 : : {
309 [ + + ]: 390 : if (base)//the latter two parameter never be null
310 : : {
311 : 303 : over->Override(base);
312 : 303 : LwpParaStyle::ApplyIndent(this,pOverStyle,base);
313 : : }
314 : : else
315 : : {
316 : 87 : LwpParaStyle::ApplyIndent(this,pOverStyle,over);
317 : : }
318 : 390 : }
319 : : /**
320 : : * @short override spacing
321 : : */
322 : 336 : void LwpPara::OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle)
323 : : {
324 [ + - ]: 336 : if (base)//the latter two parameter never be null
325 : : {
326 [ + - ]: 336 : if (over)
327 : 336 : over->Override(base);
328 : 336 : LwpParaStyle::ApplySpacing(this,pOverStyle,base);
329 : : }
330 : : else
331 : 0 : LwpParaStyle::ApplySpacing(this,pOverStyle,over);
332 : 336 : }
333 : :
334 : : /**
335 : : * @short: Get parastyle object according to the objID.
336 : : * @return: pointer to the parastyle.
337 : : */
338 : 3510 : LwpParaStyle* LwpPara::GetParaStyle()
339 : : {
340 [ + - ]: 3510 : return dynamic_cast<LwpParaStyle*>(m_ParaStyle.obj(VO_PARASTYLE));
341 : : }
342 : :
343 : : /**
344 : : * @short: Override paraborder style.
345 : : * @param: pProps pointer to the LwpParaProperty and we can get local breaks through it.
346 : : * @param: pOverStyle pointer to XFParaStyle which contains the parastyle for XFilter.
347 : : */
348 : 6 : void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
349 : : {
350 : : // get paraborder in parastyle
351 [ + - ]: 6 : LwpParaStyle* pParaStyle = this->GetParaStyle();
352 [ + - ]: 6 : if (!pParaStyle)
353 : : {
354 : 6 : return;
355 : : }
356 : :
357 [ + - ]: 6 : LwpOverride* pBorder = pParaStyle->GetParaBorder();
358 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
359 : : boost::scoped_ptr<LwpParaBorderOverride> pFinalBorder(
360 : : pBorder
361 [ + - ]: 6 : ? polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone())
362 [ + - ][ # # ]: 12 : : new LwpParaBorderOverride)
[ # # ]
363 : : ;
364 : : SAL_WNODEPRECATED_DECLARATIONS_POP
365 : :
366 : : // get local border
367 : 6 : pBorder = static_cast<LwpParaBorderProperty*>(pProps)->GetLocalParaBorder();
368 [ + - ]: 6 : if (pBorder)
369 : : {
370 : : boost::scoped_ptr<LwpParaBorderOverride> pLocalBorder(
371 [ + - ]: 6 : polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone()));
372 [ + - ][ + - ]: 6 : pLocalBorder->Override(pFinalBorder.get());
373 : : }
374 : :
375 [ + - ][ + - ]: 6 : pParaStyle->ApplyParaBorder(pOverStyle, pFinalBorder.get());
376 : : }
377 : : /**
378 : : * @short: Override parabreaks style.
379 : : * @param: pProps pointer to the LwpParaProperty and we can get local breaks through it.
380 : : * @param: pOverStyle pointer to XFParaStyle which contains the parastyle for XFilter.
381 : : */
382 : 381 : void LwpPara::OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
383 : : {
384 : : // get breaks in parastyle
385 [ + - ]: 381 : LwpParaStyle* pParaStyle = this->GetParaStyle();
386 [ + - ]: 381 : if (!pParaStyle)
387 : : {
388 : 381 : return;
389 : : }
390 : :
391 [ + - ]: 381 : LwpOverride* pBreaks = pParaStyle->GetBreaks();
392 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
393 : : std::auto_ptr<LwpBreaksOverride> pFinalBreaks(
394 : : pBreaks
395 [ + - ]: 381 : ? polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone())
396 [ + - ][ # # ]: 762 : : new LwpBreaksOverride)
[ # # ]
397 : : ;
398 : : SAL_WNODEPRECATED_DECLARATIONS_POP
399 : :
400 : : // get local breaks
401 : 381 : pBreaks = static_cast<LwpParaBreaksProperty*>(pProps)->GetLocalParaBreaks();
402 [ + - ]: 381 : if (pBreaks)
403 : : {
404 : : boost::scoped_ptr<LwpBreaksOverride> const pLocalBreaks(
405 [ + - ]: 381 : polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone()));
406 [ + - ][ + - ]: 381 : pLocalBreaks->Override(pFinalBreaks.get());
407 : : }
408 : :
409 : : // save the breaks
410 [ - + ][ # # ]: 381 : delete m_pBreaks;
411 : 381 : m_pBreaks = pFinalBreaks.release();
412 : :
413 : : //add by 1/31
414 [ + - ]: 381 : XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
415 [ - + ]: 381 : if (m_pBreaks->IsKeepWithNext())
416 : : {
417 : 0 : pOverStyle->SetBreaks(enumXFBreakKeepWithNext);
418 : : }
419 [ - + ]: 381 : if (m_pBreaks->IsPageBreakBefore())
420 : : {
421 [ # # ][ # # ]: 0 : XFParaStyle* pStyle = new XFParaStyle();
422 : 0 : pStyle->SetBreaks(enumXFBreakAftPage);
423 [ # # ][ # # ]: 0 : m_BefPageBreakName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
424 : : }
425 [ - + ]: 381 : if (m_pBreaks->IsPageBreakAfter())
426 : : {
427 [ # # ][ # # ]: 0 : XFParaStyle* pStyle = new XFParaStyle();
428 : 0 : pStyle->SetBreaks(enumXFBreakAftPage);
429 [ # # ][ # # ]: 0 : m_AftPageBreakName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
430 : : }
431 [ - + ]: 381 : if (m_pBreaks->IsColumnBreakBefore())
432 : : {
433 [ # # ][ # # ]: 0 : XFParaStyle* pStyle = new XFParaStyle();
434 : 0 : pStyle->SetBreaks(enumXFBreakAftColumn);//tmp after, should change when layout read,note by 1/31
435 [ # # ][ # # ]: 0 : m_BefColumnBreakName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
436 : : }
437 [ - + ]: 381 : if (m_pBreaks->IsColumnBreakAfter())
438 : : {
439 [ # # ][ # # ]: 0 : XFParaStyle* pStyle = new XFParaStyle();
440 : 0 : pStyle->SetBreaks(enumXFBreakAftColumn);
441 [ # # ][ # # ]: 0 : m_AftColumnBreakName = pXFStyleManager->AddStyle(pStyle)->GetStyleName();
442 [ + - ]: 381 : }
443 : : //add end
444 : :
445 : : // pParaStyle->ApplyBreaks(pOverStyle, &aFinalBreaks);
446 : : }
447 : :
448 : : /**
449 : : * @short: Override bullet styles.
450 : : * @param: pProps pointer to the LwpParaProperty and we can get local bullet through it.
451 : : */
452 : 786 : void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
453 : : {
454 : : // get bulletoverride in parastyle
455 : 786 : LwpParaStyle* pParaStyle = this->GetParaStyle();
456 [ - + ]: 786 : if (!pParaStyle)
457 : : {
458 : 0 : return;
459 : : }
460 : :
461 [ + + ]: 786 : if (pProps)
462 : : {
463 [ + - ][ + - ]: 12 : m_pBullOver = new LwpBulletOverride();
464 : : // get local bulletoverride
465 : 12 : LwpBulletOverride* pLocalBullet = static_cast<LwpParaBulletProperty*>(pProps)->GetLocalParaBullet();
466 [ + - ]: 12 : if (!pLocalBullet)
467 : : {
468 : : return;
469 : : }
470 : :
471 : 12 : LwpObjectID aSilverBulletID = pLocalBullet->GetSilverBullet();
472 [ + - ]: 12 : if (aSilverBulletID.IsNull())
473 : : {
474 : : return;
475 : : }
476 : : else
477 : : {
478 : 12 : m_bHasBullet = sal_True;
479 : :
480 [ + - ]: 12 : LwpOverride* pBullet= pParaStyle->GetBulletOverride();
481 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
482 : : std::auto_ptr<LwpBulletOverride> pFinalBullet(
483 : : pBullet
484 [ + - ]: 12 : ? polymorphic_downcast<LwpBulletOverride*>(pBullet->clone())
485 [ + - ][ # # ]: 24 : : new LwpBulletOverride)
[ # # ]
486 : : ;
487 : : SAL_WNODEPRECATED_DECLARATIONS_POP
488 : :
489 [ + - ]: 12 : boost::scoped_ptr<LwpBulletOverride> const pLocalBullet2(pLocalBullet->clone());
490 [ + - ]: 12 : pLocalBullet2->Override(pFinalBullet.get());
491 : :
492 : 12 : aSilverBulletID = pFinalBullet->GetSilverBullet();
493 [ + - ][ + - ]: 12 : delete m_pBullOver;
494 : 12 : m_pBullOver = pFinalBullet.release();
495 [ + - ]: 12 : if (!aSilverBulletID.IsNull())
496 : : {
497 [ + - ][ - + ]: 12 : m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET));
498 [ + - ]: 12 : if (m_pSilverBullet)
499 : 12 : m_pSilverBullet->SetFoundry(m_pFoundry);
500 : : }
501 : :
502 [ + - ][ + - ]: 12 : m_aSilverBulletID = aSilverBulletID;
503 : : }
504 : : }
505 : : else
506 : : {
507 : : // m_pBullOver = pParaStyle->GetBulletOverride();
508 : 774 : LwpBulletOverride* pBullOver = pParaStyle->GetBulletOverride();
509 [ + - ]: 774 : if (pBullOver)
510 : : {
511 : 774 : m_aSilverBulletID = pBullOver->GetSilverBullet();
512 [ + + ]: 774 : if (!m_aSilverBulletID.IsNull())
513 : : {
514 : 6 : m_bHasBullet = sal_True;
515 : :
516 [ + - ][ - + ]: 6 : m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(m_aSilverBulletID.obj(VO_SILVERBULLET));
517 [ + - ]: 6 : if (m_pSilverBullet)
518 : 6 : m_pSilverBullet->SetFoundry(m_pFoundry);
519 : : }
520 : :
521 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
522 [ + - ]: 774 : std::auto_ptr<LwpBulletOverride> pBulletOverride(pBullOver->clone());
523 : : SAL_WNODEPRECATED_DECLARATIONS_POP
524 [ # # ][ - + ]: 774 : delete m_pBullOver;
525 [ + - ]: 786 : m_pBullOver = pBulletOverride.release();
526 : : }
527 : : }
528 : : }
529 : : /**
530 : : * @short: Override paranumbering properties.
531 : : * @param: pProps pointer to the LwpParaProperty and we can get local paranumbering through it.
532 : : */
533 : 786 : void LwpPara::OverrideParaNumbering(LwpParaProperty* pProps)
534 : : {
535 : : // get numbering override in parastyle
536 [ + - ]: 786 : LwpParaStyle* pParaStyle = this->GetParaStyle();
537 [ + - ]: 786 : if (!pParaStyle)
538 : : {
539 : 786 : return;
540 : : }
541 : :
542 [ + - ]: 786 : LwpNumberingOverride* pParaNumbering = pParaStyle->GetNumberingOverride();
543 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
544 [ + - ][ + - ]: 786 : std::auto_ptr<LwpNumberingOverride> pOver(new LwpNumberingOverride);
545 : : SAL_WNODEPRECATED_DECLARATIONS_POP
546 : : //Override with the local numbering, if any
547 [ + + ]: 786 : if (pProps)
548 : : {
549 : 12 : LwpNumberingOverride* pPropNumbering = static_cast<LwpParaNumberingProperty*>(pProps)->GetLocalNumbering();
550 [ + - ]: 12 : if (pPropNumbering)
551 : : {
552 [ + - ]: 12 : pOver.reset(pPropNumbering->clone());
553 : : }
554 : : }
555 : : else
556 : : {
557 [ + + ]: 774 : if (pParaNumbering)
558 : : {
559 [ + - ]: 663 : pOver.reset(pParaNumbering->clone());
560 : : }
561 : : }
562 : :
563 [ + + ]: 786 : if (m_nFlags & VALID_LEVEL)
564 : : {
565 [ + - ]: 207 : pOver->OverrideLevel(m_nLevel);
566 : : }
567 : :
568 [ + - ][ + - ]: 786 : m_pParaNumbering.reset(pOver.release());
569 : : }
570 : :
571 : 0 : void LwpPara::FindLayouts()
572 : : {
573 : 0 : m_Fribs.SetPara(this);
574 : 0 : m_Fribs.FindLayouts();
575 [ # # ]: 0 : LwpPara* pNextPara = dynamic_cast<LwpPara*>(GetNext()->obj());
576 [ # # ]: 0 : if(pNextPara)
577 : : {
578 : 0 : pNextPara->FindLayouts();
579 : : }
580 : 0 : }
581 : :
582 : : /**************************************************************************
583 : : * @descr: Get property according to the property type
584 : : * @param:
585 : : * @param:
586 : : * @return:
587 : : **************************************************************************/
588 : 81 : LwpParaProperty* LwpPara::GetProperty(sal_uInt32 nPropType)
589 : : {
590 : 81 : LwpParaProperty* pProps = m_pProps;
591 [ + + ]: 225 : while(pProps)
592 : : {
593 [ + + ]: 150 : if(pProps->GetType() == nPropType)
594 : : {
595 : 6 : return pProps;
596 : : }
597 : 144 : pProps = pProps->GetNext();
598 : :
599 : : }
600 : 81 : return NULL;
601 : : }
602 : :
603 : : /**************************************************************************
604 : : * @descr: Get local tab rack
605 : : * @param:
606 : : * @param:
607 : : * @return:
608 : : **************************************************************************/
609 : 75 : LwpTabOverride* LwpPara::GetLocalTabOverride()
610 : : {
611 : 75 : LwpParaProperty* pProp = GetProperty(PP_LOCAL_TABRACK);
612 [ + + ]: 75 : if(pProp)
613 : : {
614 : 6 : return static_cast<LwpParaTabRackProperty*>(pProp)->GetTab();
615 : : }
616 : 75 : return NULL;
617 : : }
618 : :
619 : : /**
620 : : * @descr: Determined which para is earlier in position
621 : : *
622 : : */
623 : 0 : sal_Bool LwpPara::operator< (LwpPara& Other)
624 : : {
625 : 0 : return m_nOrdinal < Other.GetOrdinal();
626 : : }
627 : :
628 : : /**
629 : : * @descr: If the two layouts in the same para, compare which layout is earlied according to frib order
630 : : *
631 : : */
632 : 0 : sal_Bool LwpPara::ComparePagePosition(LwpVirtualLayout * pPreLayout, LwpVirtualLayout * pNextLayout)
633 : : {
634 : 0 : m_Fribs.SetPara(this);
635 : 0 : return m_Fribs.ComparePagePosition(pPreLayout, pNextLayout);
636 : : }
637 : :
638 : : /**
639 : : * @short check paragraph in cell or not
640 : : */
641 : 795 : sal_Bool LwpPara::IsInCell()
642 : : {
643 : 795 : LwpStory *pStory = GetStory();
644 [ + + ]: 795 : LwpVirtualLayout* pLayout = pStory ? pStory->GetLayout(NULL) : NULL;
645 [ + + ][ + + ]: 795 : if(pLayout && pLayout->IsCell())
[ + + ]
646 : 12 : return sal_True;
647 : 795 : return sal_False;
648 : : }
649 : :
650 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|