LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpstory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 132 215 61.4 %
Date: 2012-08-25 Functions: 16 22 72.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 108 247 43.7 %

           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                 :            :  *  LwpStory:
      59                 :            :         1. Word Pro object for paragraph list;
      60                 :            :         2. the content of layout object
      61                 :            :  ************************************************************************/
      62                 :            : /*************************************************************************
      63                 :            :  * Change History
      64                 :            :  Jan 2005           Created
      65                 :            :  ************************************************************************/
      66                 :            : #include "lwpglobalmgr.hxx"
      67                 :            : #include "lwpstory.hxx"
      68                 :            : #include "xfilter/xfstylemanager.hxx"
      69                 :            : 
      70                 :        153 : LwpStory::LwpStory(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
      71                 :            :     : LwpContent(objHdr, pStrm),m_bPMModified(sal_False),m_pCurrentLayout(NULL),
      72 [ +  - ][ +  - ]:        153 :     m_pTabLayout(NULL),m_bDropcap(sal_False), m_pHyperlinkMgr(new LwpHyperlinkMgr)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      73                 :        153 : {}
      74                 :            : 
      75                 :        153 : LwpStory::~LwpStory()
      76                 :            : {
      77         [ +  - ]:        153 :     if (m_pHyperlinkMgr)
      78 [ +  - ][ +  - ]:        153 :         delete m_pHyperlinkMgr;
      79         [ -  + ]:        306 : }
      80                 :        153 : void LwpStory::Read()
      81                 :            : {
      82                 :        153 :     LwpContent::Read();
      83                 :        153 :     m_ParaList.Read(m_pObjStrm);
      84                 :        153 :     m_FirstParaStyle.ReadIndexed(m_pObjStrm);
      85                 :        153 :     m_pObjStrm->SkipExtra();
      86                 :        153 : }
      87                 :            : 
      88                 :            : #include "lwppara.hxx"
      89                 :            : #include "lwpobjfactory.hxx"
      90                 :            : /**************************************************************************
      91                 :            :  * @descr:   Convert all the contents in current story
      92                 :            :  * @param:
      93                 :            :  * @param:
      94                 :            :  * @return:
      95                 :            : **************************************************************************/
      96                 :         69 : void LwpStory::XFConvert(XFContentContainer* pCont)
      97                 :            : {
      98                 :            :     //process frame which anchor frame
      99                 :         69 :     XFConvertFrameInFrame(pCont);
     100                 :            :     //process para list
     101                 :         69 :     XFContentContainer* pParaCont = pCont;
     102         [ -  + ]:         69 :     LwpPara* pPara = dynamic_cast<LwpPara*> ( GetFirstPara()->obj() );
     103         [ +  + ]:        516 :     while(pPara)
     104                 :            :     {
     105                 :        447 :         pPara->SetFoundry(m_pFoundry);
     106                 :        447 :         pPara->XFConvert(pParaCont);
     107                 :            : 
     108                 :            :         //Get the xfcontainer for the next para
     109                 :        447 :         pParaCont = pPara->GetXFContainer();
     110         [ +  + ]:        447 :         pPara = dynamic_cast<LwpPara*> ( pPara->GetNext()->obj() );
     111                 :            :     }
     112                 :            : 
     113                 :            :     //process frame which anchor is to cell after converter all the para
     114                 :         69 :     XFConvertFrameInCell(pCont);
     115                 :         69 :     XFConvertFrameInHeaderFooter(pCont);
     116                 :            : 
     117                 :            :     //Release Lwp Objects
     118         [ -  + ]:         69 :     LwpPara* pCur = dynamic_cast<LwpPara*> (GetFirstPara()->obj());
     119                 :            :     LwpPara* pNext;
     120         [ +  + ]:        516 :     while(pCur)
     121                 :            :     {
     122                 :        447 :         pCur->Release();
     123         [ +  + ]:        447 :         pNext = dynamic_cast<LwpPara*> ( pCur->GetNext()->obj() );
     124                 :        447 :         LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
     125                 :        447 :         LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
     126                 :        447 :         pObjMgr->ReleaseObject(*pCur->GetObjectID());
     127                 :        447 :         pCur = pNext;
     128                 :            :     }
     129                 :         69 : }
     130                 :            : 
     131                 :        180 : void LwpStory::RegisterStyle()
     132                 :            : {
     133         [ +  + ]:        180 :     LwpPara* pPara = dynamic_cast<LwpPara*>( GetFirstPara()->obj() );
     134         [ +  + ]:        963 :     while(pPara)
     135                 :            :     {
     136                 :        786 :         pPara->SetFoundry(m_pFoundry);
     137                 :        786 :         pPara->RegisterStyle();
     138         [ +  + ]:        783 :         pPara = dynamic_cast<LwpPara*>(pPara->GetNext()->obj());
     139                 :            :     }
     140                 :        177 : }
     141                 :            : 
     142                 :          9 : void LwpStory::Parse(IXFStream* pOutputStream)
     143                 :            : {
     144         [ +  - ]:          9 :     m_pXFContainer = new XFContentContainer;
     145                 :          9 :     XFConvert(m_pXFContainer);
     146                 :          9 :     m_pXFContainer->ToXml(pOutputStream);
     147         [ +  - ]:          9 :     delete m_pXFContainer;
     148                 :          9 :     m_pXFContainer = NULL;
     149                 :            : 
     150                 :            :     //It seems that, currently, we do not need to process the child story
     151                 :            :     /*LwpObject* pChildStory = GetFirstStory()->obj();
     152                 :            :     if(pChildStory)
     153                 :            :     {
     154                 :            :         pChildStory->SetFoundry(m_pFoundry);
     155                 :            :         pChildStory->Parse(pOutputStream);
     156                 :            :     }*/
     157                 :            : 
     158                 :            :     //Don't process the next story
     159                 :            : /*  LwpObject* pNextStory = GetNextStory()->obj();
     160                 :            :     if(pNextStory)
     161                 :            :     {
     162                 :            :         pNextStory->SetFoundry(m_pFoundry);
     163                 :            :         pNextStory->Parse(pOutputStream);
     164                 :            :     }*/
     165                 :            : 
     166                 :          9 : }
     167                 :            : 
     168                 :            : #include "lwppagelayout.hxx"
     169                 :            : /**************************************************************************
     170                 :            :  * @descr:   Set current page layout. If pPageLayout is a mirro page layout,
     171                 :            :              use odd child page layout as current page layout.
     172                 :            :  * @param:
     173                 :            :  * @param:
     174                 :            :  * @return:
     175                 :            : **************************************************************************/
     176                 :         12 : void LwpStory::SetCurrentLayout(LwpPageLayout *pPageLayout)
     177                 :            : {
     178                 :         12 :     LwpPageLayout* pLayout = pPageLayout->GetOddChildLayout();
     179         [ -  + ]:         12 :     if(pLayout)
     180                 :            :     {
     181                 :          0 :         m_pCurrentLayout = pLayout;
     182                 :          0 :         m_pTabLayout = pLayout;
     183                 :            :     }
     184                 :            :     else
     185                 :            :     {
     186                 :         12 :         m_pCurrentLayout = pPageLayout;
     187                 :         12 :         m_pTabLayout = pPageLayout;
     188                 :            :     }
     189                 :         12 :     m_bPMModified = sal_True;
     190                 :         12 : }
     191                 :            : 
     192                 :          0 : void LwpStory::AddPageLayout(LwpPageLayout * pObject)
     193                 :            : {
     194                 :          0 :     m_LayoutList.push_back(pObject);
     195                 :          0 : }
     196                 :            : /**************************************************************************
     197                 :            :  * @descr:   Get the next page layout relative to m_pCurrentLayout
     198                 :            :  * @param:
     199                 :            :  * @param:
     200                 :            :  * @return:
     201                 :            : **************************************************************************/
     202                 :          0 : LwpPageLayout* LwpStory::GetNextPageLayout()
     203                 :            : {
     204                 :          0 :     std::vector<LwpPageLayout*>::iterator it;
     205 [ #  # ][ #  # ]:          0 :     for( it = m_LayoutList.begin(); it != m_LayoutList.end(); ++it )
     206                 :            :     {
     207         [ #  # ]:          0 :         if(m_pCurrentLayout == *it)
     208                 :            :         {
     209 [ #  # ][ #  # ]:          0 :             if((it+1) !=m_LayoutList.end())
                 [ #  # ]
     210                 :            :             {
     211         [ #  # ]:          0 :                 return *(it+1);
     212                 :            :             }
     213                 :            :         }
     214                 :            :     }
     215                 :          0 :     return NULL;
     216                 :            : }
     217                 :            : /**************************************************************************
     218                 :            :  * @descr:   Sort the pagelayout according to their position
     219                 :            :  * @param:
     220                 :            :  * @param:
     221                 :            :  * @return:
     222                 :            : **************************************************************************/
     223                 :         12 : void LwpStory::SortPageLayout()
     224                 :            : {
     225                 :            :     //Get all the pagelayout and store in list
     226         [ +  - ]:         12 :     std::vector<LwpPageLayout*>  aLayoutList;
     227         [ +  - ]:         12 :     LwpVirtualLayout* pLayout = GetLayout(NULL);
     228         [ +  + ]:         24 :     while(pLayout)
     229                 :            :     {
     230 [ +  - ][ +  - ]:         12 :         if(pLayout->IsPage())
     231                 :            :         {
     232         [ +  - ]:         12 :             LwpLayout::UseWhenType eSectionType = static_cast<LwpPageLayout*>(pLayout)->GetUseWhenType();
     233                 :            :             //for mirror page, the child  is pagelayout
     234         [ +  - ]:         12 :             LwpVirtualLayout* pParent = pLayout->GetParentLayout();
     235 [ +  - ][ +  - ]:         12 :             if(eSectionType != LwpLayout::StartWithinColume && pParent && !pParent->IsPage())
         [ +  - ][ +  - ]
                 [ +  - ]
     236                 :            :             {
     237         [ +  - ]:         12 :                 aLayoutList.push_back(static_cast<LwpPageLayout*>(pLayout));
     238                 :            :             }
     239                 :            :         }
     240         [ +  - ]:         12 :         pLayout = GetLayout(pLayout);
     241                 :            :     }
     242                 :            :     // sort the pagelayout according to their position
     243                 :         12 :     std::vector<LwpPageLayout*>::iterator aIt;
     244         [ +  - ]:         12 :     if (!aLayoutList.empty())
     245                 :            :     {
     246 [ +  - ][ +  - ]:         12 :         for( aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt)
                 [ -  + ]
     247                 :            :         {
     248 [ #  # ][ #  # ]:          0 :             for( std::vector<LwpPageLayout*>::iterator bIt = aIt +1; bIt != aLayoutList.end(); ++bIt )
                 [ #  # ]
     249                 :            :             {
     250 [ #  # ][ #  # ]:          0 :                 if(**aIt < **bIt)
     251                 :            :                 {
     252                 :          0 :                     continue;
     253                 :            :                 }
     254                 :            :                 else
     255                 :            :                 {
     256                 :          0 :                     LwpPageLayout* pTemp = *aIt;
     257                 :          0 :                     *aIt = *bIt;
     258                 :          0 :                     *bIt = pTemp;
     259                 :            :                 }
     260                 :            :             }
     261                 :            :         }
     262                 :            :     }
     263                 :            : 
     264                 :            :     //put all the sorted  layouts into list
     265                 :         12 :     m_LayoutList.clear();
     266                 :            : 
     267 [ +  - ][ +  + ]:         24 :     for( aIt = aLayoutList.begin(); aIt != aLayoutList.end(); ++aIt)
     268                 :            :     {
     269         [ +  - ]:         12 :         m_LayoutList.push_back(*aIt);
     270                 :         12 :     }
     271                 :         12 : }
     272                 :            : 
     273                 :            : /**************************************************************************
     274                 :            :  * @descr:  whether need create a new section and reset column in current page layout
     275                 :            :  * @param:
     276                 :            :  * @param:
     277                 :            :  * @return:  sal_True if need create a new section
     278                 :            : **************************************************************************/
     279                 :         12 : sal_Bool LwpStory::IsNeedSection()
     280                 :            : {
     281                 :         12 :     sal_Bool bColumns = sal_False;
     282                 :         12 :     sal_Bool bNewSection = sal_False;
     283         [ +  - ]:         12 :     if(m_pCurrentLayout)
     284                 :            :     {
     285         [ -  + ]:         12 :         if(m_pCurrentLayout->HasColumns())
     286                 :            :         {
     287                 :            :             //get the following pagelayout and its type
     288                 :          0 :             bColumns = sal_True;
     289                 :          0 :             LwpPageLayout* pNextLayout = GetNextPageLayout();
     290         [ #  # ]:          0 :             if(pNextLayout)
     291                 :            :             {
     292                 :            :                 //get layout type
     293                 :          0 :                 LwpLayout::UseWhenType eWhenType = pNextLayout->GetUseWhenType();
     294      [ #  #  # ]:          0 :                 switch(eWhenType)
     295                 :            :                 {
     296                 :            :                 case LwpLayout::StartWithinColume://not support now
     297                 :            :                 case LwpLayout::StartWithinPage:
     298                 :            :                 {
     299                 :          0 :                     bColumns =sal_False;
     300                 :          0 :                     bNewSection = sal_True;
     301                 :          0 :                     break;
     302                 :            :                 }
     303                 :            :                 case LwpLayout::StartOnNextPage:
     304                 :            :                 case LwpLayout::StartOnOddPage://not support now
     305                 :            :                 case LwpLayout::StartOnEvenPage://not support now
     306                 :            :                 {
     307                 :          0 :                     bColumns =sal_True;
     308                 :          0 :                     bNewSection = sal_False;
     309                 :          0 :                     break;
     310                 :            :                 }
     311                 :            :                 default:
     312                 :          0 :                     break;
     313                 :            :                 }
     314                 :            :             }
     315                 :            : 
     316                 :            :             //if bColumns is ture, the page layout doesn't need columns, set the xfcolumns to NULL in page master
     317         [ #  # ]:          0 :             if(!bColumns)
     318                 :            :             {
     319                 :          0 :                 m_pCurrentLayout->ResetXFColumns();
     320                 :            :             }
     321                 :            :         }
     322                 :         12 :         SetPMModified(sal_False);
     323                 :            :     }
     324                 :         12 :     return bNewSection;
     325                 :            : }
     326                 :            : /**************************************************************************
     327                 :            :  * @descr:  process frame which anchor type is to cell
     328                 :            :  * @param:
     329                 :            :  * @param:
     330                 :            :  * @return:
     331                 :            : **************************************************************************/
     332                 :         69 : void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
     333                 :            : {
     334                 :         69 :     LwpVirtualLayout* pLayout = GetLayout(NULL);
     335         [ +  + ]:        138 :     while(pLayout)
     336                 :            :     {
     337         [ +  + ]:         69 :         LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
     338         [ +  + ]:         87 :         while(pFrameLayout)
     339                 :            :         {
     340                 :            : 
     341                 :            :             //if(pFrameLayout->IsAnchorCell())
     342 [ -  + ][ #  # ]:         18 :             if(pFrameLayout->IsAnchorCell() && pFrameLayout->HasContent())
                 [ -  + ]
     343                 :            :             {
     344                 :            :                 //get the first xfpara
     345                 :          0 :                 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(pCont->FindFirstContent(enumXFContentPara));
     346         [ #  # ]:          0 :                 if(pXFFirtPara)
     347                 :          0 :                     pFrameLayout->XFConvert(pXFFirtPara);
     348                 :            :             }
     349         [ +  + ]:         18 :             pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
     350                 :            :         }
     351                 :         69 :         pLayout = GetLayout(pLayout);
     352                 :            :     }
     353                 :         69 : }
     354                 :            : 
     355                 :            : /**************************************************************************
     356                 :            :  * @descr:  process frame which anchor type is to page
     357                 :            :  * @param:
     358                 :            :  * @param:
     359                 :            :  * @return:
     360                 :            : **************************************************************************/
     361                 :          9 : void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
     362                 :            : {
     363                 :          9 :     LwpVirtualLayout* pLayout = GetLayout(NULL);
     364         [ +  + ]:         18 :     while(pLayout)
     365                 :            :     {
     366         [ -  + ]:          9 :         LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
     367         [ +  + ]:         27 :         while(pFrameLayout)
     368                 :            :         {
     369   [ +  -  +  -  :         72 :             if((pFrameLayout->IsAnchorPage()
             +  -  -  + ]
                 [ -  + ]
     370                 :         18 :                 &&(pFrameLayout->IsFrame()
     371                 :         18 :                       ||pFrameLayout->IsSuperTable()
     372                 :         18 :                       ||pFrameLayout->IsGroupHead())))
     373                 :            :             {
     374                 :          0 :                 pFrameLayout->XFConvert(pCont);
     375                 :            :             }
     376         [ +  + ]:         18 :             pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
     377                 :            :         }
     378                 :          9 :         pLayout = GetLayout(pLayout);
     379                 :            :     }
     380                 :          9 : }
     381                 :            : /**************************************************************************
     382                 :            :  * @descr:  process frame which anchor type is to frame
     383                 :            :  * @param:
     384                 :            :  * @param:
     385                 :            :  * @return:
     386                 :            : **************************************************************************/
     387                 :         69 : void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
     388                 :            : {
     389                 :         69 :     LwpVirtualLayout* pLayout = GetLayout(NULL);
     390         [ +  + ]:        138 :     while(pLayout)
     391                 :            :     {
     392         [ +  + ]:         69 :         LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
     393         [ +  + ]:         87 :         while(pFrameLayout)
     394                 :            :         {
     395         [ -  + ]:         18 :             if(pFrameLayout->IsAnchorFrame())
     396                 :            :             {
     397                 :          0 :                 pFrameLayout->XFConvert(pCont);
     398                 :            :             }
     399         [ +  + ]:         18 :             pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
     400                 :            :         }
     401                 :         69 :         pLayout = GetLayout(pLayout);
     402                 :            :     }
     403                 :         69 : }
     404                 :            : /**************************************************************************
     405                 :            :  * @descr:  process frame which anchor type is to page and the frame is contained by header or footer
     406                 :            :  * @param:
     407                 :            :  * @param:
     408                 :            :  * @return:
     409                 :            : **************************************************************************/
     410                 :         69 : void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
     411                 :            : {
     412                 :         69 :     LwpVirtualLayout* pLayout = GetLayout(NULL);
     413         [ +  + ]:        138 :     while(pLayout)
     414                 :            :     {
     415         [ +  + ]:         69 :         LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead()->obj());
     416         [ +  + ]:         87 :         while(pFrameLayout)
     417                 :            :         {
     418 [ +  - ][ +  - ]:         18 :             if(pFrameLayout->IsAnchorPage() && (pLayout->IsHeader() || pLayout->IsFooter()))
         [ -  + ][ -  + ]
     419                 :            :             {
     420                 :            :                 //The frame must be included by <text:p>
     421                 :          0 :                 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(pCont->FindFirstContent(enumXFContentPara));
     422         [ #  # ]:          0 :                 if(pXFFirtPara)
     423                 :          0 :                     pFrameLayout->XFConvert(pXFFirtPara);
     424                 :            :             }
     425         [ +  + ]:         18 :             pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext()->obj());
     426                 :            :         }
     427                 :         69 :         pLayout = GetLayout(pLayout);
     428                 :            :     }
     429                 :         69 : }
     430                 :            : 
     431                 :          0 : void LwpStory::AddXFContent(XFContent* pContent)
     432                 :            : {
     433         [ #  # ]:          0 :     if(m_pXFContainer)
     434                 :          0 :         m_pXFContainer->Add(pContent);
     435                 :          0 : }
     436                 :            : 
     437                 :          0 : XFContentContainer* LwpStory::GetXFContent()
     438                 :            : {
     439         [ #  # ]:          0 :     if(m_pXFContainer)
     440                 :          0 :         return m_pXFContainer;
     441                 :            :     else
     442                 :          0 :         return NULL;
     443                 :            : }
     444                 :            : 
     445                 :          6 : LwpPara* LwpStory::GetLastParaOfPreviousStory()
     446                 :            : {
     447                 :          6 :     LwpVirtualLayout* pVLayout = this->GetLayout(NULL);
     448         [ +  + ]:          6 :     if (pVLayout)
     449                 :            :     {
     450                 :          3 :         return pVLayout->GetLastParaOfPreviousStory();
     451                 :            :     }
     452                 :            : 
     453                 :          6 :     return NULL;
     454                 :            : }
     455                 :            : /**************************************************************************
     456                 :            :  * @descr:  get text from story
     457                 :            :  * @param:
     458                 :            :  * @param:
     459                 :            :  * @return:
     460                 :            : **************************************************************************/
     461                 :          0 : OUString LwpStory::GetContentText(sal_Bool bAllText)
     462                 :            : {
     463         [ #  # ]:          0 :     if (bAllText)//convert all text fribs
     464                 :            :     {
     465                 :          0 :         OUString sText = A2OUSTR("");
     466                 :            :         //process para list
     467 [ #  # ][ #  # ]:          0 :         LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara()->obj());
     468         [ #  # ]:          0 :         while (pPara)
     469                 :            :         {
     470                 :          0 :             pPara->SetFoundry(m_pFoundry);
     471         [ #  # ]:          0 :             sText += pPara->GetContentText(sal_True);
     472 [ #  # ][ #  # ]:          0 :             pPara = dynamic_cast<LwpPara*>(pPara->GetNext()->obj());
     473                 :            :         }
     474                 :          0 :         return sText;
     475                 :            :     }
     476                 :            :     else //only the first text frib
     477                 :            :     {
     478                 :          0 :         LwpObject* pObj = GetFirstPara()->obj();
     479         [ #  # ]:          0 :         if(pObj)
     480                 :            :         {
     481         [ #  # ]:          0 :             LwpPara* pPara = dynamic_cast<LwpPara*>(pObj);
     482         [ #  # ]:          0 :             if (pPara->GetNext()->obj() != NULL)
     483                 :          0 :                 return A2OUSTR("");
     484                 :          0 :             pPara->SetFoundry(m_pFoundry);
     485                 :          0 :             return pPara->GetContentText();
     486                 :            :         }
     487                 :          0 :         return  A2OUSTR("");
     488                 :            :     }
     489                 :            : 
     490                 :            : }
     491                 :          0 : OUString LwpStory::RegisterFirstFribStyle()
     492                 :            : {
     493         [ #  # ]:          0 :     LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara()->obj());
     494                 :          0 :     pPara->SetFoundry(m_pFoundry);
     495                 :          0 :     LwpFribPtr* pFribs = pPara->GetFribs();
     496         [ #  # ]:          0 :     if (pFribs)
     497                 :            :     {
     498                 :          0 :         LwpFrib* pFirstFrib = pFribs->GetFribs();
     499         [ #  # ]:          0 :         pFirstFrib->RegisterStyle(m_pFoundry);
     500         [ #  # ]:          0 :         XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     501         [ #  # ]:          0 :         XFTextStyle* pBaseStyle = pXFStyleManager->FindTextStyle(pFirstFrib->GetStyleName());
     502         [ #  # ]:          0 :         if (pBaseStyle == NULL)
     503                 :          0 :             return A2OUSTR("");
     504 [ #  # ][ #  # ]:          0 :         XFTextStyle* pStyle = new XFTextStyle;
     505                 :          0 :         *pStyle = *pBaseStyle;
     506                 :          0 :         OUString sName = A2OUSTR("Ruby") + pFirstFrib->GetStyleName();
     507         [ #  # ]:          0 :         pStyle->SetStyleName(sName);
     508         [ #  # ]:          0 :         pXFStyleManager->AddStyle(pStyle);
     509                 :          0 :         return sName;
     510                 :            :     }
     511                 :          0 :     return A2OUSTR("");
     512                 :            : }
     513                 :            : 
     514                 :         18 : sal_Bool LwpStory::IsBullStyleUsedBefore(const rtl::OUString& rStyleName, const sal_uInt8& nPos)
     515                 :            : {
     516                 :         18 :     std::vector <NamePosPair>::reverse_iterator rIter;
     517 [ #  # ][ +  - ]:         27 :     for (rIter = m_vBulletStyleNameList.rbegin(); rIter != m_vBulletStyleNameList.rend(); ++rIter)
                 [ +  + ]
     518                 :            :     {
     519         [ +  - ]:          9 :         rtl::OUString aName = (*rIter).first;
     520         [ +  - ]:          9 :         sal_uInt8 nPosition = (*rIter).second;
     521 [ +  - ][ +  - ]:          9 :         if (aName == rStyleName && nPosition == nPos)
                 [ +  - ]
     522                 :            :         {
     523                 :          9 :             return sal_True;
     524                 :            :         }
     525         [ -  + ]:          9 :     }
     526                 :         18 :     return sal_False;
     527                 :            : }
     528                 :            : 
     529                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10