LCOV - code coverage report
Current view: top level - libreoffice/lotuswordpro/source/filter/xfilter - xffootnoteconfig.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 56 76 73.7 %
Date: 2012-12-27 Functions: 8 11 72.7 %
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             :  * Footnote config.
      59             :  ************************************************************************/
      60             : #ifndef     _XFFOOTNOTECONFIG_HXX
      61             : #define     _XFFOOTNOTECONFIG_HXX
      62             : 
      63             : #include    "xfstyle.hxx"
      64             : 
      65          12 : class XFFootnoteConfig : public XFStyle
      66             : {
      67             : public:
      68             :     XFFootnoteConfig();
      69             : 
      70             : public:
      71             :     void    SetBodyStyle(rtl::OUString style);
      72             : 
      73             :     void    SetCitationStyle(rtl::OUString style);
      74             : 
      75             :     void    SetDefaultStyle(rtl::OUString style);
      76             : 
      77             :     void    SetMasterPage(rtl::OUString masterPage);
      78             : 
      79             :     void    SetNumberFormat(rtl::OUString numberFormat);
      80             : 
      81             :     void    SetStartValue(sal_Int32 value=0);
      82             : 
      83             :     void    SetRestartOnPage();
      84             : 
      85             :     void    SetRestartOnChapter();
      86             : 
      87             :     void    SetInsertInPage(sal_Bool page=sal_True);
      88             : 
      89             :     void    SetNumPrefix(rtl::OUString numprefix);
      90             : 
      91             :     void    SetNumSuffix(rtl::OUString numsuffix);
      92             : 
      93             :     void    SetMessageOn(rtl::OUString message);
      94             : 
      95             :     void    SetMessageFrom(rtl::OUString message);
      96             : 
      97             :     virtual void    ToXml(IXFStream *pStrm);
      98             : 
      99             : protected:
     100             :     rtl::OUString   m_strBodyStyle;
     101             :     rtl::OUString   m_strCitationStyle;
     102             :     rtl::OUString   m_strDefaultStyle;
     103             :     rtl::OUString   m_strMasterPage;
     104             :     rtl::OUString   m_strNumFmt;
     105             :     rtl::OUString   m_strNumPrefix;
     106             :     rtl::OUString   m_strNumSuffix;
     107             :     rtl::OUString   m_strMessageFrom;
     108             :     rtl::OUString   m_strMessageOn;
     109             :     sal_Int32   m_nStartValue;
     110             :     sal_Int32   m_nRestartType;
     111             :     sal_Bool    m_bInsertInPage;
     112             :     sal_Bool    m_bIsFootnote;
     113             : };
     114             : 
     115           8 : inline XFFootnoteConfig::XFFootnoteConfig()
     116             : {
     117           8 :     m_nStartValue = 0;
     118           8 :     m_nRestartType = -1;
     119           8 :     m_strNumFmt = A2OUSTR("1");
     120           8 :     m_bInsertInPage = sal_True;
     121           8 :     m_strDefaultStyle = A2OUSTR("Footnote");
     122           8 :     m_strMasterPage = A2OUSTR("Footnote");
     123           8 :     m_strCitationStyle = A2OUSTR("Footnote Symbol");
     124           8 :     m_strBodyStyle = A2OUSTR("Footnote anchor");
     125           8 :     m_bIsFootnote = sal_True;
     126           8 : }
     127             : 
     128             : inline void XFFootnoteConfig::SetBodyStyle(rtl::OUString style)
     129             : {
     130             :     m_strBodyStyle = style;
     131             : }
     132             : 
     133             : inline void XFFootnoteConfig::SetCitationStyle(rtl::OUString style)
     134             : {
     135             :     m_strCitationStyle = style;
     136             : }
     137             : 
     138             : inline void XFFootnoteConfig::SetDefaultStyle(rtl::OUString style)
     139             : {
     140             :     m_strDefaultStyle = style;
     141             : }
     142             : 
     143           8 : inline void XFFootnoteConfig::SetMasterPage(rtl::OUString masterPage)
     144             : {
     145           8 :     m_strMasterPage = masterPage;
     146           8 : }
     147             : 
     148             : inline void XFFootnoteConfig::SetNumberFormat(rtl::OUString numberFormat)
     149             : {
     150             :     m_strNumFmt = numberFormat;
     151             : }
     152             : 
     153           8 : inline void XFFootnoteConfig::SetStartValue(sal_Int32 value)
     154             : {
     155           8 :     if( value<0 )
     156           8 :         return;
     157           8 :     m_nStartValue = value;
     158             : }
     159             : 
     160           0 : inline void XFFootnoteConfig::SetRestartOnPage()
     161             : {
     162           0 :     m_nRestartType = 0;
     163           0 : }
     164             : 
     165             : inline void XFFootnoteConfig::SetRestartOnChapter()
     166             : {
     167             :     m_nRestartType = 1;
     168             : }
     169             : 
     170             : inline void XFFootnoteConfig::SetInsertInPage(sal_Bool page)
     171             : {
     172             :     m_bInsertInPage = page;
     173             : }
     174             : 
     175           8 : inline void XFFootnoteConfig::SetNumPrefix(rtl::OUString numprefix)
     176             : {
     177           8 :     m_strNumPrefix = numprefix;
     178           8 : }
     179             : 
     180           8 : inline void XFFootnoteConfig::SetNumSuffix(rtl::OUString numsuffix)
     181             : {
     182           8 :     m_strNumSuffix = numsuffix;
     183           8 : }
     184             : 
     185           0 : inline void XFFootnoteConfig::SetMessageOn(rtl::OUString message)
     186             : {
     187           0 :     m_strMessageOn = message;
     188           0 : }
     189             : 
     190           0 : inline void XFFootnoteConfig::SetMessageFrom(rtl::OUString message)
     191             : {
     192           0 :     m_strMessageFrom = message;
     193           0 : }
     194             : 
     195           6 : inline void XFFootnoteConfig::ToXml(IXFStream *pStrm)
     196             : {
     197           6 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
     198           6 :     pAttrList->Clear();
     199             : 
     200           6 :     if( !m_strCitationStyle.isEmpty() )
     201           6 :         pAttrList->AddAttribute( A2OUSTR("text:citation-style-name"), m_strCitationStyle);
     202             : 
     203           6 :     if( !m_strBodyStyle.isEmpty() )
     204           6 :         pAttrList->AddAttribute( A2OUSTR("text:citation-body-style-name"), m_strBodyStyle);
     205             : 
     206           6 :     if( !m_strNumPrefix.isEmpty() )
     207           3 :         pAttrList->AddAttribute( A2OUSTR("style:num-prefix"), m_strNumPrefix);
     208             : 
     209           6 :     if( !m_strNumSuffix.isEmpty() )
     210           3 :         pAttrList->AddAttribute( A2OUSTR("style:num-suffix"), m_strNumSuffix);
     211             : 
     212           6 :     if( !m_strNumFmt.isEmpty() )
     213           6 :         pAttrList->AddAttribute( A2OUSTR("style:num-format"), m_strNumFmt);
     214             : 
     215           6 :     if( !m_strDefaultStyle.isEmpty() )
     216           6 :         pAttrList->AddAttribute( A2OUSTR("text:default-style-name"), m_strDefaultStyle);
     217             : 
     218           6 :     if( !m_strMasterPage.isEmpty() )
     219           6 :         pAttrList->AddAttribute( A2OUSTR("text:master-page-name"), m_strMasterPage);
     220             : 
     221             : 
     222           6 :     pAttrList->AddAttribute( A2OUSTR("text:start-value"), Int32ToOUString(m_nStartValue) );
     223             : 
     224           6 :     if( m_bIsFootnote )
     225             :     {
     226           3 :         if( m_nRestartType == -1 )
     227           3 :             pAttrList->AddAttribute( A2OUSTR("text:start-numbering-at"), A2OUSTR("document") );
     228           0 :         else if( m_nRestartType == 0 )
     229           0 :             pAttrList->AddAttribute( A2OUSTR("text:start-numbering-at"), A2OUSTR("page") );
     230           0 :         else if( m_nRestartType == 1 )
     231           0 :             pAttrList->AddAttribute( A2OUSTR("text:start-numbering-at"), A2OUSTR("chapter") );
     232             : 
     233           3 :         if( m_bInsertInPage )
     234           3 :             pAttrList->AddAttribute( A2OUSTR("text:footnotes-position"), A2OUSTR("page") );
     235             :         else
     236           0 :             pAttrList->AddAttribute( A2OUSTR("text:footnotes-position"), A2OUSTR("document") );
     237             :     }
     238             : 
     239           6 :     if(m_bIsFootnote)
     240             :     {
     241           3 :         pStrm->StartElement( A2OUSTR("text:footnotes-configuration") );
     242           3 :         if( !m_strMessageOn.isEmpty() )
     243             :         {
     244           0 :             pStrm->StartElement( A2OUSTR("text:footnote-continuation-notice-forward") );
     245           0 :             pStrm->Characters(m_strMessageOn);
     246           0 :             pStrm->EndElement( A2OUSTR("text:footnote-continuation-notice-forward") );
     247             :         }
     248             : 
     249           3 :         if( !m_strMessageFrom.isEmpty() )
     250             :         {
     251           0 :             pStrm->StartElement( A2OUSTR("text:footnote-continuation-notice-backward") );
     252           0 :             pStrm->Characters(m_strMessageFrom);
     253           0 :             pStrm->EndElement( A2OUSTR("text:footnote-continuation-notice-backward") );
     254             :         }
     255             : 
     256           3 :         pStrm->EndElement( A2OUSTR("text:footnotes-configuration") );
     257             :     }
     258             :     else
     259             :     {
     260           3 :         pStrm->StartElement( A2OUSTR("text:endnotes-configuration") );
     261           3 :         pStrm->EndElement( A2OUSTR("text:endnotes-configuration") );
     262             :     }
     263             : 
     264           6 : }
     265             : 
     266             : #endif
     267             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10