1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * For LWP filter architecture prototype
59 ************************************************************************/
63 #include "lwpparastyle.hxx"
64 #include "lwpfilehdr.hxx"
65 #include "lwpoverride.hxx"
66 #include "lwpparaborderoverride.hxx"
67 #include "lwpbreaksoverride.hxx"
68 #include "lwpnumberingoverride.hxx"
69 #include "lwptaboverride.hxx"
70 #include "lwpbackgroundoverride.hxx"
71 #include "xfilter/xfdefs.hxx"
72 #include "xfilter/xfparastyle.hxx"
73 #include "xfilter/xfborders.hxx"
74 #include "lwpfont.hxx"
75 #include "lwpfoundry.hxx"
76 #include "lwppiece.hxx"
77 #include "lwpshadow.hxx"
78 #include "lwpborderstuff.hxx"
79 #include "lwpmargins.hxx"
80 #include "lwptabrack.hxx"
82 #include "lwpsilverbullet.hxx"
84 LwpParaStyle::LwpParaStyle(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
) :
85 LwpTextStyle(objHdr
, pStrm
), m_pKinsokuOptsOverride(new LwpKinsokuOptsOverride
),
86 m_pBulletOverride(new LwpBulletOverride
)
90 LwpParaStyle::~LwpParaStyle()
92 if (m_pKinsokuOptsOverride
)
94 delete m_pKinsokuOptsOverride
;
97 if (m_pBulletOverride
)
99 delete m_pBulletOverride
;
103 void LwpParaStyle::Read()
105 LwpTextStyle::Read();
107 if (LwpFileHeader::m_nFileRevision
< 0x000B)
109 // read many overrides
110 LwpAlignmentOverride aAlignOverride
;
111 aAlignOverride
.Read(m_pObjStrm
.get());
113 LwpSpacingOverride aSpacingOverride
;
114 aSpacingOverride
.Read(m_pObjStrm
.get());
116 LwpIndentOverride aIndentOverride
;
117 aIndentOverride
.Read(m_pObjStrm
.get());
119 LwpParaBorderOverride aPBOverride
;
120 aPBOverride
.Read(m_pObjStrm
.get());
122 LwpBreaksOverride aBreaksOverride
;
123 aBreaksOverride
.Read(m_pObjStrm
.get());
125 LwpNumberingOverride aNumberingOverride
;
126 aNumberingOverride
.Read(m_pObjStrm
.get());
128 LwpTabOverride aTabOverride
;
129 aTabOverride
.Read(m_pObjStrm
.get());
134 m_AlignmentStyle
.ReadIndexed(m_pObjStrm
.get());
135 m_SpacingStyle
.ReadIndexed(m_pObjStrm
.get());
136 m_IndentStyle
.ReadIndexed(m_pObjStrm
.get());
137 m_BorderStyle
.ReadIndexed(m_pObjStrm
.get());
138 m_BreaksStyle
.ReadIndexed(m_pObjStrm
.get());
139 m_NumberingStyle
.ReadIndexed(m_pObjStrm
.get());
140 m_TabStyle
.ReadIndexed(m_pObjStrm
.get());
142 m_pKinsokuOptsOverride
->Read(m_pObjStrm
.get());
143 m_pBulletOverride
->Read(m_pObjStrm
.get());
145 if (m_pObjStrm
->CheckExtra())
147 m_BackgroundStyle
.ReadIndexed(m_pObjStrm
.get());
148 m_pObjStrm
->SkipExtra();
154 void LwpParaStyle::Apply(XFParaStyle
*pParaStyle
)
158 LwpVirtualPiece
*pPiece
= nullptr;
160 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_AlignmentStyle
.obj().get());
163 LwpAlignmentOverride
*pAlign
= dynamic_cast<LwpAlignmentOverride
*>(pPiece
->GetOverride());
165 ApplyAlignment(pParaStyle
,pAlign
);
168 //don't known top and bottom indent now.
169 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_IndentStyle
.obj().get());
172 LwpIndentOverride
*pIndent
= dynamic_cast<LwpIndentOverride
*>(pPiece
->GetOverride());
175 if (!m_pBulletOverride
->IsInValid())// for remove bullet indent in named bullet style
177 std::unique_ptr
<LwpIndentOverride
> pNewIndent(pIndent
->clone());
178 pNewIndent
->SetMFirst(0);
179 pNewIndent
->SetMRest(0);
180 ApplyIndent(nullptr, pParaStyle
, pNewIndent
.get());
183 ApplyIndent(nullptr,pParaStyle
,pIndent
);
187 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_BorderStyle
.obj().get());
190 LwpParaBorderOverride
*pBorder
= dynamic_cast<LwpParaBorderOverride
*>(pPiece
->GetOverride());
193 ApplyParaBorder(pParaStyle
, pBorder
);
197 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_SpacingStyle
.obj().get());
200 LwpSpacingOverride
*pSpacing
= dynamic_cast<LwpSpacingOverride
*>(pPiece
->GetOverride());
202 ApplySpacing(nullptr,pParaStyle
,pSpacing
);
205 //paragraph background.
206 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_BackgroundStyle
.obj().get());
209 LwpBackgroundOverride
*pBack
= dynamic_cast<LwpBackgroundOverride
*>(pPiece
->GetOverride());
212 LwpColor color
= pBack
->GetBackColor();
213 XFColor
aXFColor( color
.To24Color() );
214 pParaStyle
->SetBackColor( aXFColor
);
219 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_TabStyle
.obj().get());
222 LwpTabOverride
*pTab
= dynamic_cast<LwpTabOverride
*>(pPiece
->GetOverride());
225 ApplyTab(pParaStyle
,pTab
);
228 pPiece
= dynamic_cast<LwpVirtualPiece
*>(m_BreaksStyle
.obj().get());
231 LwpBreaksOverride
*pBreak
= dynamic_cast<LwpBreaksOverride
*>(pPiece
->GetOverride());
234 ApplyBreaks(pParaStyle
,pBreak
);
240 void LwpParaStyle::ApplySubBorder(LwpBorderStuff
* pBorderStuff
, LwpBorderStuff::BorderType eType
, XFBorders
* pXFBorders
)
242 enumXFBorder eXFBorderSide
= enumXFBorderNone
;
245 case LwpBorderStuff::LEFT
:
246 eXFBorderSide
= enumXFBorderLeft
;
248 case LwpBorderStuff::RIGHT
:
249 eXFBorderSide
= enumXFBorderRight
;
251 case LwpBorderStuff::TOP
:
252 eXFBorderSide
= enumXFBorderTop
;
254 case LwpBorderStuff::BOTTOM
:
255 eXFBorderSide
= enumXFBorderBottom
;
261 LwpColor aColor
= pBorderStuff
->GetSideColor(eType
);
262 float fWidth
= pBorderStuff
->GetSideWidth(eType
);
263 sal_uInt16 nType
= pBorderStuff
->GetSideType(eType
);
267 default://fall through!
268 case 0x14: //single fall through!
270 pXFBorders
->SetWidth(eXFBorderSide
, fWidth
);
272 case 0x15: //double , fall through!
273 case 0x16: //thick double
274 pXFBorders
->SetDoubleLine(eXFBorderSide
);
275 pXFBorders
->SetWidthOuter(eXFBorderSide
, static_cast<float>(fWidth
*0.333));
276 pXFBorders
->SetWidthSpace(eXFBorderSide
, static_cast<float>(fWidth
*0.334));
277 pXFBorders
->SetWidthInner(eXFBorderSide
, static_cast<float>(fWidth
*0.333));
278 // pXFBorders->SetWidth(eXFBorderSide, fWidth);
280 case 0x18: //thick-thin
281 pXFBorders
->SetDoubleLine(eXFBorderSide
);
282 pXFBorders
->SetWidthOuter(eXFBorderSide
, static_cast<float>(fWidth
*0.5));
283 pXFBorders
->SetWidthInner(eXFBorderSide
, static_cast<float>(fWidth
*0.25));
284 pXFBorders
->SetWidthSpace(eXFBorderSide
, static_cast<float>(fWidth
*0.25));
286 case 0x19: //thin-thick
287 pXFBorders
->SetDoubleLine(eXFBorderSide
);
288 pXFBorders
->SetWidthInner(eXFBorderSide
, static_cast<float>(fWidth
*0.7));
289 pXFBorders
->SetWidthOuter(eXFBorderSide
, static_cast<float>(fWidth
*0.15));
290 pXFBorders
->SetWidthSpace(eXFBorderSide
, static_cast<float>(fWidth
*0.15));
294 if (aColor
.IsValidColor())
296 XFColor
aXFColor(aColor
.To24Color());
297 pXFBorders
->SetColor(eXFBorderSide
, aXFColor
);
301 void LwpParaStyle::ApplyParaBorder(XFParaStyle
* pParaStyle
, LwpParaBorderOverride
* pBorder
)
304 LwpShadow
*pShadow
= pBorder
->GetShadow();
307 LwpColor color
= pShadow
->GetColor();
308 float offsetX
= pShadow
->GetOffsetX();
309 float offsetY
= pShadow
->GetOffsetY();
311 if( offsetX
&& offsetY
&& color
.IsValidColor() )
313 XFColor
aXFColor(color
.To24Color());
323 pParaStyle
->SetShadow(enumXFShadowLeftTop
,-offsetX
,aXFColor
);
325 pParaStyle
->SetShadow(enumXFShadowLeftBottom
,-offsetX
,aXFColor
);
330 pParaStyle
->SetShadow(enumXFShadowRightTop
,offsetX
,aXFColor
);
332 pParaStyle
->SetShadow(enumXFShadowRightBottom
,offsetX
,aXFColor
);
337 //convert to XFBorders object:
338 LwpBorderStuff
*pBorderStuff
= pBorder
->GetBorderStuff();
339 if( pBorderStuff
&& pBorderStuff
->GetSide() != 0 )
341 XFBorders
*pXFBorders
= new XFBorders();
342 pParaStyle
->SetBorders(pXFBorders
);
344 LwpMargins
* pMargins
= pBorder
->GetMargins();
346 // apply 4 borders respectively
347 LwpBorderStuff::BorderType pType
[] = { LwpBorderStuff::LEFT
, LwpBorderStuff::RIGHT
,
348 LwpBorderStuff::TOP
, LwpBorderStuff::BOTTOM
};
349 float pMarginValue
[4];
351 for (sal_uInt8 nC
= 0; nC
< 4; nC
++)
353 if (pBorderStuff
->HasSide(pType
[nC
]))
355 ApplySubBorder(pBorderStuff
, pType
[nC
], pXFBorders
);
357 //get border spacing to text content
360 pMarginValue
[nC
] = static_cast<float>(pMargins
->GetMarginsValue(nC
));
366 //apply border spacing to text content
367 pParaStyle
->SetPadding(pMarginValue
[0], pMarginValue
[1], pMarginValue
[2], pMarginValue
[3]);
372 void LwpParaStyle::ApplyBreaks(XFParaStyle
* pParaStyle
, LwpBreaksOverride
* pBreaks
)
374 if (pBreaks
->IsKeepWithNext())
376 pParaStyle
->SetBreaks(enumXFBreakKeepWithNext
);
378 if (pBreaks
->IsPageBreakBefore())
380 pParaStyle
->SetBreaks(enumXFBreakBefPage
);
382 if (pBreaks
->IsPageBreakAfter())
384 pParaStyle
->SetBreaks(enumXFBreakAftPage
);
386 if (pBreaks
->IsColumnBreakBefore())
388 pParaStyle
->SetBreaks(enumXFBreakBefColumn
);
390 if (pBreaks
->IsColumnBreakAfter())
392 pParaStyle
->SetBreaks(enumXFBreakAftColumn
);
396 void LwpParaStyle::ApplyAlignment(XFParaStyle
* pParaStyle
, LwpAlignmentOverride
* pAlign
)
398 enumXFAlignType alignType
= enumXFAlignStart
;
399 LwpAlignmentOverride::AlignType type
;
401 type
= pAlign
->GetAlignType();
402 pParaStyle
->SetNumberRight(false);//to identify its align attribute
405 case LwpAlignmentOverride::ALIGN_LEFT
:
406 alignType
= enumXFAlignStart
;
408 case LwpAlignmentOverride::ALIGN_RIGHT
:
409 alignType
= enumXFAlignEnd
;
411 case LwpAlignmentOverride::ALIGN_CENTER
:
412 alignType
= enumXFAlignCenter
;
414 case LwpAlignmentOverride::ALIGN_NUMERICLEFT
://if non-number in table,ALIGN_NUMERICLEFT/RIGHT are useless
415 alignType
= enumXFAlignStart
; //note by 1/28
417 case LwpAlignmentOverride::ALIGN_JUSTIFY
:
418 case LwpAlignmentOverride::ALIGN_JUSTIFYALL
:
419 alignType
= enumXFAlignJustify
;
421 case LwpAlignmentOverride::ALIGN_NUMERICRIGHT
:
422 pParaStyle
->SetNumberRight(true);//to identify its align attribute
423 alignType
= enumXFAlignEnd
;
428 pParaStyle
->SetAlignType(alignType
);
431 void LwpParaStyle::ApplyIndent(LwpPara
* pPara
, XFParaStyle
* pParaStyle
, LwpIndentOverride
* pIndent
)
433 LwpPara
* pParentPara
;
435 pParentPara
= pPara
->GetParent();
437 pParentPara
= nullptr;
439 std::unique_ptr
<LwpIndentOverride
> pTotalIndent(new LwpIndentOverride
);
440 if (pIndent
->IsUseRelative() && pParentPara
)
442 LwpIndentOverride
* pParentIndent
= pParentPara
->GetIndent();
445 pTotalIndent
.reset(pIndent
->clone());
450 if (pPara
->GetBulletFlag())
452 pTotalIndent
->SetMAll(pParentIndent
->GetMAll() + pTotalIndent
->GetMAll());
453 pTotalIndent
->SetMRight(pParentIndent
->GetMRight()+ pTotalIndent
->GetMRight());
454 pParaStyle
->SetMargins(LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(
455 pTotalIndent
->GetMAll())), pTotalIndent
->GetRight());
456 pPara
->SetIndent(pTotalIndent
.release());
460 sal_uInt16 relative
= pParentIndent
->GetRelative();
462 sal_Int32 Amount
= pParentIndent
->GetMAll();
464 if (relative
== LwpIndentOverride::RELATIVE_FIRST
)
465 Amount
+= pParentIndent
->GetMFirst();
466 else if (relative
== LwpIndentOverride::RELATIVE_REST
)
467 Amount
+= pParentIndent
->GetMRest();
468 pTotalIndent
->SetMAll(Amount
+ pTotalIndent
->GetMAll());
469 pTotalIndent
->SetMRight(pParentIndent
->GetMRight()+ pTotalIndent
->GetMRight());
471 pParaStyle
->SetIndent(pTotalIndent
->GetFirst());
472 pParaStyle
->SetMargins(pTotalIndent
->GetLeft(), pTotalIndent
->GetRight());
473 pPara
->SetIndent(pTotalIndent
.release());
478 pTotalIndent
.reset(pIndent
->clone());
481 if (pPara
->GetBulletFlag())
483 pParaStyle
->SetMargins(LwpTools::ConvertToMetric(
484 LwpTools::ConvertFromUnits(pIndent
->GetMAll())), pIndent
->GetRight());
485 pPara
->SetIndent(pTotalIndent
.release());
490 pParaStyle
->SetIndent(pIndent
->GetFirst());
491 pParaStyle
->SetMargins(pIndent
->GetLeft(), pIndent
->GetRight());
494 pPara
->SetIndent(pTotalIndent
.release());
499 void LwpParaStyle::ApplySpacing(LwpPara
* pPara
, XFParaStyle
* pParaStyle
, LwpSpacingOverride
* pSpacing
)
501 LwpSpacingCommonOverride
* spacing
= pSpacing
->GetSpacing();
502 LwpSpacingCommonOverride
* abovepara
= pSpacing
->GetAboveSpacing();
503 LwpSpacingCommonOverride
* belowpara
= pSpacing
->GetBelowSpacing();
505 LwpSpacingCommonOverride::SpacingType type
= spacing
->GetType();
506 sal_Int32 amount
= spacing
->GetAmount();
507 sal_Int32 multiple
= spacing
->GetMultiple();
513 case LwpSpacingCommonOverride::SPACING_DYNAMIC
:
515 xftype
= enumLHPercent
;
516 height
= double(multiple
)/65536L*100;
517 pParaStyle
->SetLineHeight(xftype
,height
);
520 case LwpSpacingCommonOverride::SPACING_LEADING
:
522 xftype
= enumLHSpace
;
523 height
= LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(amount
));
524 pParaStyle
->SetLineHeight(xftype
,height
);
527 case LwpSpacingCommonOverride::SPACING_CUSTOM
:
529 xftype
= enumLHHeight
;
530 height
= LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple
)/65536L*amount
)));
531 pParaStyle
->SetLineHeight(xftype
,height
);
534 case LwpSpacingCommonOverride::SPACING_NONE
:
538 //TO DO: Above Line need to be processed!!!!!!! what it means?????? 1-26
540 type
= abovepara
->GetType();
541 amount
= abovepara
->GetAmount();
542 multiple
= abovepara
->GetMultiple();
543 double above_val
=-1;
546 case LwpSpacingCommonOverride::SPACING_DYNAMIC
:
548 case LwpSpacingCommonOverride::SPACING_LEADING
:
550 case LwpSpacingCommonOverride::SPACING_CUSTOM
:
551 above_val
= LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple
)/65536L*amount
)));
553 case LwpSpacingCommonOverride::SPACING_NONE
:
557 type
= belowpara
->GetType();
558 amount
= belowpara
->GetAmount();
559 multiple
= belowpara
->GetMultiple();
563 case LwpSpacingCommonOverride::SPACING_DYNAMIC
:
565 case LwpSpacingCommonOverride::SPACING_LEADING
:
567 case LwpSpacingCommonOverride::SPACING_CUSTOM
:
568 below_val
= LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(sal_Int32(float(multiple
)/65536L*amount
)));
570 case LwpSpacingCommonOverride::SPACING_NONE
:
577 pPara
->SetBelowSpacing(below_val
);
578 LwpPara
* pPrePara
= dynamic_cast<LwpPara
*>(pPara
->GetPrevious().obj().get());
579 if (pPrePara
&& above_val
!= -1)
581 above_val
+= pPrePara
->GetBelowSpacing();
586 pParaStyle
->SetMargins(-1,-1,above_val
,below_val
);
589 void LwpParaStyle::ApplyTab(XFParaStyle
*pParaStyle
, LwpTabOverride
*pTabOverRide
)
591 LwpObjectID
& rTabRackID
= pTabOverRide
->GetTabRackID();
592 if(rTabRackID
.IsNull())
597 LwpTabRack
* pTabRack
= dynamic_cast<LwpTabRack
*>(rTabRackID
.obj().get());
603 pParaStyle
->ClearTabStyles();
604 //Get margin left value
605 double dMarginLeft
= pParaStyle
->GetMargins().GetLeft();
607 sal_uInt16 nNumTabs
= pTabRack
->GetNumTabs();
608 for(sal_uInt16 nIndex
=0; nIndex
<nNumTabs
; nIndex
++)
611 LwpTab
* pTab
= pTabRack
->Lookup(nIndex
);
615 enumXFTab eType
= enumXFTabNone
;
616 LwpTab::TabType type
= pTab
->GetTabType();
619 case LwpTab::TT_LEFT
:
620 eType
= enumXFTabLeft
;
622 case LwpTab::TT_CENTER
:
623 eType
= enumXFTabCenter
;
625 case LwpTab::TT_RIGHT
:
626 eType
= enumXFTabRight
;
628 case LwpTab::TT_NUMERIC
:
629 eType
= enumXFTabChar
;
634 sal_uInt32 nPos
= pTab
->GetPosition();
635 //different feature between SODC and lwp, the tab length must minus the margin left of para.
636 double fLen
= LwpTools::ConvertFromUnitsToMetric(nPos
) - dMarginLeft
;
639 sal_Unicode cLeader
= 0x00;
640 LwpTab::LeaderType leader
= pTab
->GetLeaderType();
643 case LwpTab::TL_NONE
:
644 cLeader
= 0x20; //space
646 case LwpTab::TL_HYPHEN
: //'-'
649 case LwpTab::TL_DOT
: //'.'
652 case LwpTab::TL_LINE
: //'_'
657 sal_Unicode cAlignChar
= static_cast<sal_Unicode
>(pTab
->GetAlignChar());
659 pParaStyle
->AddTabStyle(eType
,fLen
,cLeader
,cAlignChar
);
664 void LwpParaStyle::RegisterStyle()
667 throw std::runtime_error("missing Foundry");
669 XFParaStyle
* pStyle
= new XFParaStyle();
672 OUString styleName
= GetName().str();
673 pStyle
->SetStyleName(styleName
);
676 LwpFontManager
& rFontMgr
= m_pFoundry
->GetFontManger();
677 rtl::Reference
<XFFont
> pFont
= rFontMgr
.CreateFont(m_nFinalFontID
);
678 pStyle
->SetFont(pFont
);
680 //Set other paragraph properties...
684 LwpStyleManager
* pStyleMgr
= m_pFoundry
->GetStyleManager();
685 pStyleMgr
->AddStyle(GetObjectID(), pStyle
);
688 LwpAlignmentOverride
* LwpParaStyle::GetAlignment()
690 if (m_AlignmentStyle
.obj() == nullptr)
693 LwpAlignmentPiece
*pPiece
= dynamic_cast<LwpAlignmentPiece
*>(m_AlignmentStyle
.obj().get());
695 return dynamic_cast<LwpAlignmentOverride
*>(pPiece
->GetOverride());
699 LwpIndentOverride
* LwpParaStyle::GetIndent()
701 if (m_IndentStyle
.obj() == nullptr)
704 LwpIndentPiece
*pPiece
= dynamic_cast<LwpIndentPiece
*>(m_IndentStyle
.obj().get());
706 return dynamic_cast<LwpIndentOverride
*>(pPiece
->GetOverride());
710 LwpSpacingOverride
* LwpParaStyle::GetSpacing()
712 if (m_SpacingStyle
.obj() == nullptr)
715 LwpSpacingPiece
*pPiece
= dynamic_cast<LwpSpacingPiece
*>(m_SpacingStyle
.obj().get());
717 return dynamic_cast<LwpSpacingOverride
*>(pPiece
->GetOverride());
721 LwpParaBorderOverride
* LwpParaStyle::GetParaBorder() const
723 if(m_BorderStyle
.IsNull())
726 LwpParaBorderPiece
*pPiece
= dynamic_cast<LwpParaBorderPiece
*>(m_BorderStyle
.obj(VO_PARABORDERPIECE
).get());
728 return dynamic_cast<LwpParaBorderOverride
*>(pPiece
->GetOverride());
732 LwpBreaksOverride
* LwpParaStyle::GetBreaks() const
734 if(m_BreaksStyle
.IsNull())
737 LwpBreaksPiece
*pPiece
= dynamic_cast<LwpBreaksPiece
*>(m_BreaksStyle
.obj(VO_BREAKSPIECE
).get());
739 return dynamic_cast<LwpBreaksOverride
*>(pPiece
->GetOverride());
744 LwpNumberingOverride
* LwpParaStyle::GetNumberingOverride() const
746 if(m_NumberingStyle
.IsNull())
749 LwpNumberingPiece
*pPiece
= dynamic_cast<LwpNumberingPiece
*>(m_NumberingStyle
.obj(VO_NUMBERINGPIECE
).get());
751 return dynamic_cast<LwpNumberingOverride
*>(pPiece
->GetOverride());
755 LwpTabOverride
* LwpParaStyle::GetTabOverride() const
757 if(m_TabStyle
.obj() == nullptr)
759 LwpTabPiece
*pPiece
= dynamic_cast<LwpTabPiece
*>(m_TabStyle
.obj().get());
761 return dynamic_cast<LwpTabOverride
*>(pPiece
->GetOverride());
765 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */