LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpfootnote.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 128 225 56.9 %
Date: 2012-08-25 Functions: 23 30 76.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 44 173 25.4 %

           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                 :            :  *  footnote
      59                 :            :  */
      60                 :            : /*************************************************************************
      61                 :            :  * Change History
      62                 :            :  Mar 2005           Created
      63                 :            :  ************************************************************************/
      64                 :            : #include "lwpfootnote.hxx"
      65                 :            : #include "lwpstory.hxx"
      66                 :            : #include "xfilter/xffootnote.hxx"
      67                 :            : #include "xfilter/xfendnote.hxx"
      68                 :            : #include "xfilter/xffootnoteconfig.hxx"
      69                 :            : #include "xfilter/xfendnoteconfig.hxx"
      70                 :            : #include "xfilter/xfstylemanager.hxx"
      71                 :            : #include "xfilter/xftextspan.hxx"
      72                 :            : #include "lwppara.hxx"
      73                 :            : #include "lwpdoc.hxx"
      74                 :            : #include "lwpfnlayout.hxx"
      75                 :            : #include "lwpglobalmgr.hxx"
      76                 :            : 
      77         [ +  - ]:          3 : LwpFribFootnote::LwpFribFootnote(LwpPara* pPara ):LwpFrib(pPara)
      78                 :            : {
      79                 :          3 : }
      80                 :            : 
      81                 :            : /**
      82                 :            :  * @descr  read footnote frib information
      83                 :            :  */
      84                 :          3 : void LwpFribFootnote::Read(LwpObjectStream * pObjStrm, sal_uInt16 /*len*/)
      85                 :            : {
      86                 :          3 :     m_Footnote.ReadIndexed(pObjStrm);
      87                 :          3 : }
      88                 :            : 
      89                 :            : /**
      90                 :            :  * @descr  Register footnote style by calling LwpFootnote::RegisterStyle()
      91                 :            :  */
      92                 :          3 : void LwpFribFootnote::RegisterNewStyle()
      93                 :            : {
      94                 :          3 :     LwpFootnote* pFootnote = GetFootnote();
      95         [ +  - ]:          3 :     if(pFootnote)
      96                 :            :     {
      97                 :            :         //register footnote number font style
      98                 :          3 :         LwpFrib::RegisterStyle(m_pPara->GetFoundry());
      99                 :            :         //register footnote content style
     100                 :          3 :         pFootnote->SetFoundry(m_pPara->GetFoundry());
     101                 :          3 :         pFootnote->RegisterStyle();
     102                 :            :     }
     103                 :          3 : }
     104                 :            : 
     105                 :            : /**
     106                 :            :  * @descr  Parse footnote  by calling LwpFootnote::XFConvert()
     107                 :            :  */
     108                 :          3 : void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
     109                 :            : {
     110                 :          3 :     LwpFootnote* pFootnote = GetFootnote();
     111         [ +  - ]:          3 :     if(pFootnote)
     112                 :            :     {
     113                 :          3 :         XFContentContainer* pContent = NULL;
     114         [ +  - ]:          3 :         if(pFootnote->GetType() == FN_FOOTNOTE)
     115                 :            :         {
     116         [ +  - ]:          3 :             pContent = new XFFootNote();
     117                 :            :         }
     118                 :            :         else
     119                 :            :         {
     120         [ #  # ]:          0 :             pContent = new XFEndNote();
     121                 :            :         }
     122                 :          3 :         pFootnote->XFConvert(pContent);
     123         [ +  - ]:          3 :         if(m_ModFlag)
     124                 :            :         {
     125                 :            :             //set footnote number font style
     126         [ +  - ]:          3 :             XFTextSpan *pSpan = new XFTextSpan();
     127         [ +  - ]:          3 :             pSpan->SetStyleName(GetStyleName());
     128                 :            :             //add the xffootnote into the content container
     129                 :          3 :             pSpan->Add(pContent);
     130                 :          3 :             pCont->Add(pSpan);
     131                 :            :         }
     132                 :            :         else
     133                 :            :         {
     134                 :          0 :             pCont->Add(pContent);
     135                 :            :         }
     136                 :            :     }
     137                 :          3 : }
     138                 :            : 
     139                 :            : /**
     140                 :            :  * @descr  Get foonote object
     141                 :            :  */
     142                 :          6 : LwpFootnote* LwpFribFootnote::GetFootnote()
     143                 :            : {
     144         [ +  - ]:          6 :     return dynamic_cast<LwpFootnote*>(m_Footnote.obj());
     145                 :            : }
     146                 :            : 
     147                 :            : 
     148                 :          3 : LwpFootnote::LwpFootnote(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
     149         [ +  - ]:          3 :     : LwpOrderedObject(objHdr, pStrm)
     150                 :            : {
     151                 :          3 : }
     152                 :            : 
     153                 :          3 : LwpFootnote::~LwpFootnote()
     154                 :            : {
     155                 :            : 
     156         [ -  + ]:          6 : }
     157                 :            : 
     158                 :            : /**
     159                 :            :  * @descr  Read foonote object
     160                 :            :  */
     161                 :          3 : void LwpFootnote::Read()
     162                 :            : {
     163                 :          3 :     LwpOrderedObject::Read();
     164                 :          3 :     m_nType = m_pObjStrm->QuickReaduInt16();
     165                 :          3 :     m_nRow = m_pObjStrm->QuickReaduInt16();
     166                 :          3 :     m_Content.ReadIndexed(m_pObjStrm);
     167                 :          3 :     m_pObjStrm->SkipExtra();
     168                 :          3 : }
     169                 :            : 
     170                 :            : /**
     171                 :            :  * @descr  Register footnote style
     172                 :            :  */
     173                 :          3 : void LwpFootnote::RegisterStyle()
     174                 :            : {
     175                 :            :     //Only register footnote contents style,
     176                 :            :     //Endnote contents style registers in LwpEnSuperTableLayout::RegisterStyle
     177         [ +  - ]:          3 :     if(m_nType == FN_FOOTNOTE)
     178                 :            :     {
     179                 :          3 :         LwpContent* pContent = FindFootnoteContent();
     180         [ +  - ]:          3 :         if(pContent)
     181                 :            :         {
     182                 :          3 :             pContent->SetFoundry(m_pFoundry);
     183                 :          3 :             pContent->RegisterStyle();
     184                 :            :         }
     185                 :            :     }
     186                 :          3 : }
     187                 :            : 
     188                 :            : /**
     189                 :            :  * @descr  Parse footnote
     190                 :            :  */
     191                 :          3 : void LwpFootnote::XFConvert(XFContentContainer * pCont)
     192                 :            : {
     193                 :          3 :     LwpContent* pContent = FindFootnoteContent();
     194         [ +  - ]:          3 :     if(pContent)
     195                 :            :     {
     196                 :          3 :         pContent->XFConvert(pCont);
     197                 :            :     }
     198                 :          3 : }
     199                 :            : 
     200                 :            : /**
     201                 :            :  * @descr  Get endnote cell layout which contains current endnote content
     202                 :            :  */
     203                 :          0 : LwpCellLayout* LwpFootnote::GetCellLayout()
     204                 :            : {
     205                 :          0 :     LwpEnSuperTableLayout* pEnSuperLayout = FindFootnoteTableLayout();
     206         [ #  # ]:          0 :     if(pEnSuperLayout)
     207                 :            :     {
     208                 :          0 :         LwpTableLayout* pTableLayout = static_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
     209         [ #  # ]:          0 :         if(pTableLayout)
     210                 :            :         {
     211                 :          0 :             LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
     212         [ #  # ]:          0 :             if(pRowLayout)
     213                 :            :             {
     214         [ #  # ]:          0 :                 return dynamic_cast<LwpCellLayout*>(pRowLayout->GetChildHead()->obj());
     215                 :            :             }
     216                 :            :         }
     217                 :            :     }
     218                 :          0 :     return NULL;
     219                 :            : }
     220                 :            : 
     221                 :            : /**
     222                 :            :  * @descr  Get division which footnote table contains current footnote content, copy from lwp source code
     223                 :            :  */
     224                 :          0 : LwpDocument* LwpFootnote::GetFootnoteTableDivision()
     225                 :            : {
     226         [ #  # ]:          0 :     if(!m_pFoundry)
     227                 :          0 :         return NULL;
     228                 :            : 
     229                 :          0 :     LwpDocument* pPrev =NULL;
     230                 :          0 :     LwpDocument* pDivision = NULL;
     231                 :          0 :     LwpDocument* pFootnoteDivision =NULL;
     232                 :            : 
     233                 :            :     // Make sure the footnote does belong to some division
     234                 :            :     // The division might not have a DivisionInfo if it's being Destruct()ed
     235                 :          0 :     pPrev = m_pFoundry->GetDocument();
     236                 :          0 :     pFootnoteDivision = pPrev;
     237 [ #  # ][ #  # ]:          0 :     if (!pPrev || pPrev->GetDivInfoID()->IsNull())
                 [ #  # ]
     238                 :          0 :         return NULL;
     239                 :            : 
     240   [ #  #  #  #  :          0 :     switch (m_nType)
                   #  # ]
     241                 :            :     {
     242                 :            :         case FN_FOOTNOTE:
     243                 :            :         {
     244                 :            :             // Footnotes always use the source division
     245                 :          0 :             return pFootnoteDivision;
     246                 :            :         }
     247                 :            :         case FN_DIVISION:
     248                 :            :         {
     249                 :            :             // Start with the footnote's division
     250                 :          0 :             pDivision = pPrev;
     251                 :          0 :             break;
     252                 :            :         }
     253                 :            :         case FN_DIVISION_SEPARATE:
     254                 :            :         {
     255                 :            :             // It had better be the next division
     256                 :          0 :             pDivision = pPrev->GetNextDivision();
     257                 :          0 :             break;
     258                 :            :         }
     259                 :            :         case FN_DIVISIONGROUP:
     260                 :            :         case FN_DIVISIONGROUP_SEPARATE:
     261                 :            :         {
     262                 :          0 :             pDivision = pPrev->GetLastInGroupWithContents();
     263                 :          0 :             pPrev = pDivision;
     264                 :          0 :             break;
     265                 :            :         }
     266                 :            :         case FN_DOCUMENT:
     267                 :            :         case FN_DOCUMENT_SEPARATE:
     268                 :            :         {
     269                 :          0 :             pDivision = pFootnoteDivision->GetRootDocument();
     270         [ #  # ]:          0 :             if (pDivision)
     271                 :          0 :                 pDivision = pDivision->GetLastDivisionWithContents();
     272                 :          0 :             pPrev = pDivision;
     273                 :          0 :             break;
     274                 :            :         }
     275                 :            : 
     276                 :            :     }
     277                 :            : 
     278                 :            :     // Make sure we're using the proper endnote division, if it's separate
     279         [ #  # ]:          0 :     if (m_nType & FN_MASK_SEPARATE)
     280                 :          0 :         pDivision = GetEndnoteDivision(pDivision);
     281                 :            :     // Don't use a division that's specifically for endnotes
     282                 :            :     else
     283                 :            :     {
     284         [ #  # ]:          0 :         while (pDivision)
     285                 :            :         {
     286         [ #  # ]:          0 :             if (pDivision->GetEndnoteType() == FN_DONTCARE)
     287                 :          0 :                 break;
     288         [ #  # ]:          0 :             if (m_nType == FN_DIVISIONGROUP)
     289                 :          0 :                 pDivision = pDivision->GetPreviousInGroup();
     290                 :            :             else
     291                 :          0 :                 pDivision = pDivision->GetPreviousDivisionWithContents();
     292                 :            :         }
     293                 :            :     }
     294         [ #  # ]:          0 :     if (pDivision)
     295                 :          0 :         return pDivision;
     296                 :          0 :     return NULL;
     297                 :            : }
     298                 :            : 
     299                 :            : /**
     300                 :            :  * @descr  Get division which endnote table contains current endnote content, copy from lwp source code
     301                 :            :  */
     302                 :          0 : LwpDocument* LwpFootnote::GetEndnoteDivision(LwpDocument* pPossible)
     303                 :            : {
     304                 :          0 :     LwpDocument*  pDivision = pPossible;
     305                 :            :     sal_uInt16 nDivType;
     306                 :            : 
     307                 :            :     // In case we have multiple endnote divisions, walk backwards until
     308                 :            :     // we find one.
     309         [ #  # ]:          0 :     while (pDivision)
     310                 :            :     {
     311                 :            :         // Do we already have the right division?
     312                 :          0 :         nDivType = pDivision->GetEndnoteType();
     313         [ #  # ]:          0 :         if (nDivType == m_nType)
     314                 :          0 :             return pDivision;
     315                 :            :         // When we hit the first non-endnote division, stop looking.
     316                 :            :         // -- SDC 10/8/96
     317         [ #  # ]:          0 :         if (nDivType == FN_DONTCARE)
     318                 :          0 :             break;
     319                 :          0 :         pDivision = pDivision->GetPreviousDivision();
     320                 :            :     }
     321                 :          0 :     return NULL;
     322                 :            : }
     323                 :            : 
     324                 :            : /**
     325                 :            :  * @descr  Get footnote table class name
     326                 :            :  */
     327                 :          0 : OUString LwpFootnote::GetTableClass()
     328                 :            : {
     329                 :          0 :     OUString strClassName;
     330   [ #  #  #  #  :          0 :     switch (GetType() & FN_MASK_BASE)
                      # ]
     331                 :            :     {
     332                 :            :         case FN_BASE_FOOTNOTE:
     333                 :            :         {
     334                 :          0 :             strClassName = A2OUSTR(STR_DivisionFootnote);
     335                 :          0 :             break;
     336                 :            :         }
     337                 :            :         case FN_BASE_DOCUMENT:
     338                 :            :         {
     339                 :          0 :             strClassName = A2OUSTR(STR_DocumentEndnote);
     340                 :          0 :             break;
     341                 :            :         }
     342                 :            :         case FN_BASE_DIVISION:
     343                 :            :         {
     344                 :          0 :             strClassName = A2OUSTR(STR_DivisionEndnote);
     345                 :          0 :             break;
     346                 :            :         }
     347                 :            :         case FN_BASE_DIVISIONGROUP:
     348                 :            :         {
     349                 :          0 :             strClassName = A2OUSTR(STR_DivisionGroupEndnote);
     350                 :          0 :             break;
     351                 :            :         }
     352                 :            :     }
     353                 :          0 :     return strClassName;
     354                 :            : }
     355                 :            : 
     356                 :            : /**
     357                 :            :  * @descr  Find footnote tablelayout, copy from lwp source code
     358                 :            :  */
     359                 :          0 : LwpEnSuperTableLayout* LwpFootnote::FindFootnoteTableLayout()
     360                 :            : {
     361         [ #  # ]:          0 :     LwpDocument* pDivision = GetFootnoteTableDivision();
     362         [ #  # ]:          0 :     if(!pDivision)
     363                 :          0 :         return NULL;
     364                 :            : 
     365                 :          0 :     LwpFoundry* pFoundry = pDivision->GetFoundry();
     366                 :          0 :     OUString strClassName = GetTableClass();
     367         [ #  # ]:          0 :     if(strClassName.isEmpty() )
     368                 :          0 :         return NULL;
     369                 :            : 
     370                 :          0 :     LwpContent* pContent = NULL;
     371                 :            : 
     372 [ #  # ][ #  # ]:          0 :     while ((pContent = pFoundry->EnumContents(pContent)) != NULL)
     373 [ #  # ][ #  # ]:          0 :         if (pContent->IsTable() && (strClassName.equals(pContent->GetClassName())) &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     374         [ #  # ]:          0 :             pContent->IsActive() && pContent->GetLayout(NULL))
     375                 :            :         {
     376                 :            :             // Found it!
     377                 :            :             return (LwpEnSuperTableLayout *)
     378         [ #  # ]:          0 :                 ((LwpTable*)pContent)->GetSuperTableLayout();
     379                 :            :         }
     380                 :            : 
     381                 :          0 :     return NULL;
     382                 :            : }
     383                 :            : 
     384                 :            : /**
     385                 :            :  * @descr  Find footnote contents
     386                 :            :  */
     387                 :          6 : LwpContent* LwpFootnote::FindFootnoteContent()
     388                 :            : {
     389         [ -  + ]:          6 :     LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj());
     390                 :            :     //if the content has layout, the content has footnote contents;
     391                 :            :     //or looking for the celllayout and return the footnote contents.
     392 [ +  - ][ +  - ]:          6 :     if(pContent && pContent->GetLayout(NULL))
                 [ +  - ]
     393                 :          6 :         return pContent;
     394                 :            : 
     395                 :          0 :     LwpCellLayout* pCellLayout = GetCellLayout();
     396         [ #  # ]:          0 :     if(pCellLayout)
     397                 :            :     {
     398         [ #  # ]:          0 :         pContent = dynamic_cast<LwpContent*>(pCellLayout->GetContent()->obj());
     399                 :            :     }
     400                 :            : 
     401                 :          6 :     return pContent;
     402                 :            : }
     403                 :            : 
     404                 :          3 : LwpFootnoteTable::LwpFootnoteTable(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
     405                 :          3 :     : LwpTable(objHdr, pStrm)
     406                 :            : {
     407                 :          3 : }
     408                 :            : 
     409                 :          3 : void LwpFootnoteTable::Read()
     410                 :            : {
     411                 :          3 :     LwpTable::Read();
     412                 :          3 :     m_pObjStrm->SkipExtra();
     413                 :          3 : }
     414                 :            : 
     415                 :            : /**
     416                 :            :  * @descr  Read footnote number options information
     417                 :            :  */
     418                 :         48 : void LwpFootnoteNumberOptions::Read(LwpObjectStream *pObjStrm)
     419                 :            : {
     420                 :         48 :     m_nFlag = pObjStrm->QuickReaduInt16();
     421                 :         48 :     m_nStartingNumber = pObjStrm->QuickReaduInt16();
     422                 :         48 :     m_LeadingText.Read(pObjStrm);
     423                 :         48 :     m_TrailingText.Read(pObjStrm);
     424                 :         48 :     pObjStrm->SkipExtra();
     425                 :         48 : }
     426                 :            : 
     427                 :            : /**
     428                 :            :  * @descr  Read footnote seperator options information
     429                 :            :  */
     430                 :         24 : void LwpFootnoteSeparatorOptions::Read(LwpObjectStream *pObjStrm)
     431                 :            : {
     432                 :         24 :     m_nFlag = pObjStrm->QuickReaduInt16();
     433                 :         24 :     m_nLength = pObjStrm->QuickReaduInt32();
     434                 :         24 :     m_nIndent = pObjStrm->QuickReaduInt32();
     435                 :         24 :     m_nAbove = pObjStrm->QuickReaduInt32();
     436                 :         24 :     m_nBelow = pObjStrm->QuickReaduInt32();
     437                 :         24 :     m_BorderStuff.Read(pObjStrm);
     438                 :         24 :     pObjStrm->SkipExtra();
     439                 :         24 : }
     440                 :            : 
     441                 :            : 
     442                 :         12 : LwpFootnoteOptions::LwpFootnoteOptions(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
     443 [ +  - ][ +  - ]:         12 :     : LwpObject(objHdr, pStrm)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     444                 :            : {
     445                 :         12 : }
     446                 :            : 
     447 [ +  - ][ +  - ]:         12 : LwpFootnoteOptions::~LwpFootnoteOptions()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     448                 :            : {
     449                 :            : 
     450         [ -  + ]:         24 : }
     451                 :            : 
     452                 :            : /**
     453                 :            :  * @descr  Register footnote options object
     454                 :            :  */
     455                 :         12 : void LwpFootnoteOptions::Read()
     456                 :            : {
     457                 :         12 :     m_nFlag = m_pObjStrm->QuickReaduInt16();
     458                 :         12 :     m_FootnoteNumbering.Read(m_pObjStrm);
     459                 :         12 :     m_EndnoteDivisionNumbering.Read(m_pObjStrm);
     460                 :         12 :     m_EndnoteDivisionGroupNumbering.Read(m_pObjStrm);
     461                 :         12 :     m_EndnoteDocNumbering.Read(m_pObjStrm);
     462                 :         12 :     m_FootnoteSeparator.Read(m_pObjStrm);
     463                 :         12 :     m_FootnoteContinuedSeparator.Read(m_pObjStrm);
     464                 :         12 :     m_ContinuedOnMessage.Read(m_pObjStrm);
     465                 :         12 :     m_ContinuedFromMessage.Read(m_pObjStrm);
     466                 :         12 :     m_pObjStrm->SkipExtra();
     467                 :         12 : }
     468                 :            : 
     469                 :            : /**
     470                 :            :  * @descr  Register footnote options style
     471                 :            :  */
     472                 :         12 : void LwpFootnoteOptions::RegisterStyle()
     473                 :            : {
     474                 :         12 :     RegisterFootnoteStyle();
     475                 :         12 :     RegisterEndnoteStyle();
     476                 :         12 : }
     477                 :            : 
     478                 :            : /**
     479                 :            :  * @descr  Register footnote configuration information
     480                 :            :  */
     481                 :         12 : void LwpFootnoteOptions::RegisterFootnoteStyle()
     482                 :            : {
     483         [ +  - ]:         12 :     XFFootnoteConfig* pFootnoteConfig = new XFFootnoteConfig();
     484                 :         12 :     pFootnoteConfig->SetStartValue(m_FootnoteNumbering.GetStartingNumber() -1);
     485                 :         12 :     pFootnoteConfig->SetNumPrefix(m_FootnoteNumbering.GetLeadingText());
     486                 :         12 :     pFootnoteConfig->SetNumSuffix(m_FootnoteNumbering.GetTrailingText());
     487         [ -  + ]:         12 :     if(m_FootnoteNumbering.GetReset() == LwpFootnoteNumberOptions::RESET_PAGE)
     488                 :            :     {
     489                 :          0 :         pFootnoteConfig->SetRestartOnPage();
     490                 :            :     }
     491         [ -  + ]:         12 :     if(GetContinuedFrom())
     492                 :            :     {
     493                 :          0 :         pFootnoteConfig->SetMessageFrom(GetContinuedFromMessage());
     494                 :            :     }
     495         [ -  + ]:         12 :     if(GetContinuedOn())
     496                 :            :     {
     497                 :          0 :         pFootnoteConfig->SetMessageOn(GetContinuedOnMessage());
     498                 :            :     }
     499                 :            : 
     500                 :         12 :     pFootnoteConfig->SetMasterPage( m_strMasterPage);
     501                 :         12 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     502                 :         12 :     pXFStyleManager->SetFootnoteConfig(pFootnoteConfig);
     503                 :            : 
     504                 :         12 : }
     505                 :            : 
     506                 :            : /**
     507                 :            :  * @descr  Register endnote configuration information
     508                 :            :  */
     509                 :         12 : void LwpFootnoteOptions::RegisterEndnoteStyle()
     510                 :            : {
     511 [ +  - ][ +  - ]:         12 :     XFEndnoteConfig* pEndnoteConfig = new XFEndnoteConfig();
     512                 :         12 :     pEndnoteConfig->SetStartValue(m_EndnoteDocNumbering.GetStartingNumber() -1);
     513                 :         12 :     OUString message = m_EndnoteDocNumbering.GetLeadingText();
     514         [ +  - ]:         12 :     if(message.isEmpty())
     515                 :            :     {
     516                 :         12 :         message = A2OUSTR("[");//default prefix
     517                 :            :     }
     518                 :         12 :     pEndnoteConfig->SetNumPrefix(message);
     519                 :         12 :     message = m_EndnoteDocNumbering.GetTrailingText();
     520         [ +  - ]:         12 :     if(message.isEmpty())
     521                 :            :     {
     522                 :         12 :         message = A2OUSTR("]");//default suffix
     523                 :            :     }
     524                 :         12 :     pEndnoteConfig->SetNumSuffix(message);
     525         [ -  + ]:         12 :     if(m_EndnoteDocNumbering.GetReset() == LwpFootnoteNumberOptions::RESET_PAGE)
     526                 :            :     {
     527                 :          0 :         pEndnoteConfig->SetRestartOnPage();
     528                 :            :     }
     529                 :            : 
     530                 :         12 :     pEndnoteConfig->SetMasterPage( m_strMasterPage);
     531                 :            : 
     532         [ +  - ]:         12 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     533         [ +  - ]:         12 :     pXFStyleManager->SetEndnoteConfig(pEndnoteConfig);
     534                 :         12 : }
     535                 :            : 
     536                 :            : 
     537                 :            : /**
     538                 :            :  * @descr  Get continue on message
     539                 :            :  */
     540                 :          0 : OUString LwpFootnoteOptions::GetContinuedOnMessage()
     541                 :            : {
     542         [ #  # ]:          0 :     if(m_ContinuedOnMessage.HasValue())
     543                 :            :     {
     544                 :          0 :         return m_ContinuedOnMessage.str();
     545                 :            :     }
     546                 :            :     // else reture defauls message
     547                 :          0 :     return A2OUSTR(STRID_FOOTCONTINUEDON);
     548                 :            : }
     549                 :            : 
     550                 :            : /**
     551                 :            :  * @descr  Get continue from message
     552                 :            :  */
     553                 :          0 : OUString LwpFootnoteOptions::GetContinuedFromMessage()
     554                 :            : {
     555         [ #  # ]:          0 :     if(m_ContinuedFromMessage.HasValue())
     556                 :            :     {
     557                 :          0 :         return m_ContinuedFromMessage.str();
     558                 :            :     }
     559                 :            :     // else reture defauls message
     560                 :          0 :     return A2OUSTR(STRID_FOOTCONTINUEDFROM);
     561                 :            : }
     562                 :            : 
     563                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10