LCOV - code coverage report
Current view: top level - libreoffice/lotuswordpro/source/filter - lwppara1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 165 216 76.4 %
Date: 2012-12-27 Functions: 15 21 71.4 %
Legend: Lines: hit not hit

          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          94 : void LwpPara::SetFirstFrib(rtl::OUString Content,sal_uInt32 FontID)
     146             : {
     147          94 :     m_FontID= FontID;
     148          94 :     m_Content=Content;
     149          94 : }
     150             : /**
     151             :  * @short   get paragraph xfstyle
     152             :  */
     153         315 : XFParaStyle* LwpPara::GetXFParaStyle()
     154             : {
     155         315 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     156         315 :     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         130 : LwpPara* LwpPara::GetParent()
     171             : {
     172             :     LwpPara* pPara;
     173             :     sal_uInt16 otherlevel;
     174         130 :     sal_uInt16 level = GetLevel();
     175             : 
     176         130 :     if (level != 1)
     177             :     {
     178           4 :         pPara = dynamic_cast<LwpPara*>(GetPrevious()->obj());
     179          14 :         while (pPara)
     180             :         {
     181          10 :             otherlevel = pPara->GetLevel();
     182          10 :             if ((otherlevel < level) || (otherlevel && (level == 0)))
     183           4 :                 return pPara;
     184           6 :             pPara = dynamic_cast<LwpPara*>(pPara->GetPrevious()->obj());
     185             :         }
     186             :     }
     187         126 :     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         109 : void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
     197             : {
     198         109 :     if (nPosition > 9)
     199             :     {
     200           0 :         return;
     201             :     }
     202         109 :     sal_uInt16 nCurrentPos = 0;
     203             : 
     204         109 :     LwpFrib* pPreFrib = NULL;
     205         109 :     LwpFrib* pFrib = m_Fribs.GetFribs();
     206         109 :     if (!pFrib)
     207             :     {
     208           0 :         return;
     209             :     }
     210             : 
     211        1118 :     while (pFrib)
     212             :     {
     213        1009 :         sal_uInt8 nFribType = pFrib->GetType();
     214        1009 :         if (nFribType == FRIB_TAG_PARANUMBER)
     215             :         {
     216         541 :             nCurrentPos++;
     217         541 :             ModifierInfo* pModInfo = pFrib->GetModifiers();
     218         541 :             if (pModInfo)
     219             :             {
     220         541 :                 sal_uInt16 nHideLevels = pModInfo->aTxtAttrOverride.GetHideLevels();
     221         541 :                 if (nCurrentPos == nPosition)
     222             :                 {
     223             :                     //get prefix text frib
     224         109 :                     if (pPreFrib)
     225             :                     {
     226         192 :                         if ((pPreFrib->GetType() == FRIB_TAG_TEXT) &&
     227          96 :                             (pPreFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
     228             :                         {
     229          68 :                             pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
     230             :                         }
     231             :                     }
     232             : 
     233             :                     //get para numbering
     234         109 :                     pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
     235         109 :                     pParaNumbering->nNumLevel = nHideLevels;
     236             : 
     237             :                     //get suffix text frib
     238         109 :                     if ( (pFrib = pFrib->GetNext()) )
     239             :                     {
     240         109 :                         if( pFrib->GetType() == FRIB_TAG_TEXT )
     241             :                         {
     242         292 :                             if (
     243         200 :                                  (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) ||
     244          92 :                                  (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)
     245             :                                )
     246             :                             {
     247          40 :                                 pParaNumbering->pSuffix = static_cast<LwpFribText*>(pFrib);
     248             :                             }
     249             :                         }
     250             :                     }
     251             : 
     252         109 :                     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         900 :         pPreFrib = pFrib;
     284         900 :         if (pFrib)
     285             :         {
     286         900 :             pFrib = pFrib->GetNext();
     287             :         }
     288             :     }
     289             : }
     290             : /**
     291             :  * @short   override alignment
     292             :  */
     293             : //override style, add by  1-24
     294           4 : void LwpPara::OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle)
     295             : {
     296           4 :     if (base)//the latter two parameter never be null
     297             :     {
     298           4 :         over->Override(base);
     299           4 :         LwpParaStyle::ApplyAlignment(pOverStyle,base);
     300             :     }
     301             :     else
     302           0 :         LwpParaStyle::ApplyAlignment(pOverStyle,over);
     303           4 : }
     304             : /**
     305             :  * @short   override indent attribute
     306             :  */
     307         130 : void LwpPara::OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle)
     308             : {
     309         130 :     if (base)//the latter two parameter never be null
     310             :     {
     311         101 :             over->Override(base);
     312         101 :             LwpParaStyle::ApplyIndent(this,pOverStyle,base);
     313             :     }
     314             :     else
     315             :     {
     316          29 :             LwpParaStyle::ApplyIndent(this,pOverStyle,over);
     317             :         }
     318         130 : }
     319             : /**
     320             :  * @short   override spacing
     321             :  */
     322         112 : void LwpPara::OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle)
     323             : {
     324         112 :     if (base)//the latter two parameter never be null
     325             :     {
     326         112 :         if (over)
     327         112 :             over->Override(base);
     328         112 :         LwpParaStyle::ApplySpacing(this,pOverStyle,base);
     329             :     }
     330             :     else
     331           0 :         LwpParaStyle::ApplySpacing(this,pOverStyle,over);
     332         112 : }
     333             : 
     334             : /**
     335             :  * @short:   Get parastyle object according to the objID.
     336             :  * @return:  pointer to the parastyle.
     337             :  */
     338        1170 : LwpParaStyle* LwpPara::GetParaStyle()
     339             : {
     340        1170 :     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           2 : void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
     349             : {
     350             :     // get paraborder in parastyle
     351           2 :     LwpParaStyle* pParaStyle = this->GetParaStyle();
     352           2 :     if (!pParaStyle)
     353             :     {
     354           2 :         return;
     355             :     }
     356             : 
     357           2 :     LwpOverride* pBorder = pParaStyle->GetParaBorder();
     358             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     359             :     boost::scoped_ptr<LwpParaBorderOverride> pFinalBorder(
     360             :         pBorder
     361           2 :             ? polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone())
     362           4 :             : new LwpParaBorderOverride)
     363             :         ;
     364             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     365             : 
     366             :     // get local border
     367           2 :     pBorder = static_cast<LwpParaBorderProperty*>(pProps)->GetLocalParaBorder();
     368           2 :     if (pBorder)
     369             :     {
     370             :         boost::scoped_ptr<LwpParaBorderOverride> pLocalBorder(
     371           2 :                 polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone()));
     372           2 :         pLocalBorder->Override(pFinalBorder.get());
     373             :     }
     374             : 
     375           2 :     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         127 : void LwpPara::OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle)
     383             : {
     384             :     // get breaks in parastyle
     385         127 :     LwpParaStyle* pParaStyle = this->GetParaStyle();
     386         127 :     if (!pParaStyle)
     387             :     {
     388         127 :         return;
     389             :     }
     390             : 
     391         127 :     LwpOverride* pBreaks = pParaStyle->GetBreaks();
     392             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     393             :     std::auto_ptr<LwpBreaksOverride> pFinalBreaks(
     394             :         pBreaks
     395         127 :             ? polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone())
     396         254 :             : new LwpBreaksOverride)
     397             :         ;
     398             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     399             : 
     400             :     // get local breaks
     401         127 :     pBreaks = static_cast<LwpParaBreaksProperty*>(pProps)->GetLocalParaBreaks();
     402         127 :     if (pBreaks)
     403             :     {
     404             :         boost::scoped_ptr<LwpBreaksOverride> const pLocalBreaks(
     405         127 :                 polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone()));
     406         127 :         pLocalBreaks->Override(pFinalBreaks.get());
     407             :     }
     408             : 
     409             :     // save the breaks
     410         127 :     delete m_pBreaks;
     411         127 :     m_pBreaks = pFinalBreaks.release();
     412             : 
     413             : //add by  1/31
     414         127 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     415         127 :     if (m_pBreaks->IsKeepWithNext())
     416             :     {
     417           0 :         pOverStyle->SetBreaks(enumXFBreakKeepWithNext);
     418             :     }
     419         127 :     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         127 :     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         127 :     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         127 :     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         127 :     }
     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         262 : void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
     453             : {
     454             :     // get bulletoverride in parastyle
     455         262 :     LwpParaStyle* pParaStyle = this->GetParaStyle();
     456         262 :     if (!pParaStyle)
     457             :     {
     458           0 :         return;
     459             :     }
     460             : 
     461         262 :     if (pProps)
     462             :     {
     463           4 :         m_pBullOver = new LwpBulletOverride();
     464             :         // get local bulletoverride
     465           4 :         LwpBulletOverride* pLocalBullet  = static_cast<LwpParaBulletProperty*>(pProps)->GetLocalParaBullet();
     466           4 :         if (!pLocalBullet)
     467             :         {
     468             :             return;
     469             :         }
     470             : 
     471           4 :         LwpObjectID aSilverBulletID = pLocalBullet->GetSilverBullet();
     472           4 :         if (aSilverBulletID.IsNull())
     473             :         {
     474             :             return;
     475             :         }
     476             :         else
     477             :         {
     478           4 :             m_bHasBullet = sal_True;
     479             : 
     480           4 :             LwpOverride* pBullet= pParaStyle->GetBulletOverride();
     481             :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     482             :             std::auto_ptr<LwpBulletOverride> pFinalBullet(
     483             :                 pBullet
     484           4 :                     ? polymorphic_downcast<LwpBulletOverride*>(pBullet->clone())
     485           8 :                     : new LwpBulletOverride)
     486             :                 ;
     487             :             SAL_WNODEPRECATED_DECLARATIONS_POP
     488             : 
     489           4 :             boost::scoped_ptr<LwpBulletOverride> const pLocalBullet2(pLocalBullet->clone());
     490           4 :             pLocalBullet2->Override(pFinalBullet.get());
     491             : 
     492           4 :             aSilverBulletID = pFinalBullet->GetSilverBullet();
     493           4 :             delete m_pBullOver;
     494           4 :             m_pBullOver = pFinalBullet.release();
     495           4 :             if (!aSilverBulletID.IsNull())
     496             :             {
     497           4 :                 m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET));
     498           4 :                 if (m_pSilverBullet)
     499           4 :                     m_pSilverBullet->SetFoundry(m_pFoundry);
     500             :             }
     501             : 
     502           4 :             m_aSilverBulletID = aSilverBulletID;
     503             :         }
     504             :     }
     505             :     else
     506             :     {
     507             : //      m_pBullOver = pParaStyle->GetBulletOverride();
     508         258 :         LwpBulletOverride* pBullOver = pParaStyle->GetBulletOverride();
     509         258 :         if (pBullOver)
     510             :         {
     511         258 :             m_aSilverBulletID = pBullOver->GetSilverBullet();
     512         258 :             if (!m_aSilverBulletID.IsNull())
     513             :             {
     514           2 :                 m_bHasBullet = sal_True;
     515             : 
     516           2 :                 m_pSilverBullet = dynamic_cast<LwpSilverBullet*>(m_aSilverBulletID.obj(VO_SILVERBULLET));
     517           2 :                 if (m_pSilverBullet)
     518           2 :                     m_pSilverBullet->SetFoundry(m_pFoundry);
     519             :             }
     520             : 
     521             :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     522         258 :             std::auto_ptr<LwpBulletOverride> pBulletOverride(pBullOver->clone());
     523             :             SAL_WNODEPRECATED_DECLARATIONS_POP
     524         258 :             delete m_pBullOver;
     525         258 :             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         262 : void LwpPara::OverrideParaNumbering(LwpParaProperty* pProps)
     534             : {
     535             :     // get numbering override in parastyle
     536         262 :     LwpParaStyle* pParaStyle = this->GetParaStyle();
     537         262 :     if (!pParaStyle)
     538             :     {
     539         262 :         return;
     540             :     }
     541             : 
     542         262 :     LwpNumberingOverride* pParaNumbering = pParaStyle->GetNumberingOverride();
     543             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     544         262 :     std::auto_ptr<LwpNumberingOverride> pOver(new LwpNumberingOverride);
     545             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     546             :     //Override with the local numbering, if any
     547         262 :     if (pProps)
     548             :     {
     549           4 :         LwpNumberingOverride* pPropNumbering = static_cast<LwpParaNumberingProperty*>(pProps)->GetLocalNumbering();
     550           4 :         if (pPropNumbering)
     551             :         {
     552           4 :             pOver.reset(pPropNumbering->clone());
     553             :         }
     554             :     }
     555             :     else
     556             :     {
     557         258 :         if (pParaNumbering)
     558             :         {
     559         221 :             pOver.reset(pParaNumbering->clone());
     560             :         }
     561             :     }
     562             : 
     563         262 :     if (m_nFlags & VALID_LEVEL)
     564             :     {
     565          69 :         pOver->OverrideLevel(m_nLevel);
     566             :     }
     567             : 
     568         262 :     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          27 : LwpParaProperty* LwpPara::GetProperty(sal_uInt32 nPropType)
     589             : {
     590          27 :     LwpParaProperty* pProps = m_pProps;
     591         102 :     while(pProps)
     592             :     {
     593          50 :         if(pProps->GetType() == nPropType)
     594             :         {
     595           2 :             return pProps;
     596             :         }
     597          48 :         pProps = pProps->GetNext();
     598             : 
     599             :     }
     600          25 :     return NULL;
     601             : }
     602             : 
     603             : /**************************************************************************
     604             :  * @descr:  Get local tab rack
     605             :  * @param:
     606             :  * @param:
     607             :  * @return:
     608             : **************************************************************************/
     609          25 : LwpTabOverride* LwpPara::GetLocalTabOverride()
     610             : {
     611          25 :     LwpParaProperty* pProp = GetProperty(PP_LOCAL_TABRACK);
     612          25 :     if(pProp)
     613             :     {
     614           2 :         return static_cast<LwpParaTabRackProperty*>(pProp)->GetTab();
     615             :     }
     616          23 :     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         265 : sal_Bool LwpPara::IsInCell()
     642             : {
     643         265 :     LwpStory *pStory = GetStory();
     644         265 :     LwpVirtualLayout* pLayout = pStory ? pStory->GetLayout(NULL) : NULL;
     645         265 :     if(pLayout && pLayout->IsCell())
     646           4 :         return sal_True;
     647         261 :     return sal_False;
     648             : }
     649             : 
     650             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10