LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter/xfilter - xfindex.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 32 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 16 0.0 %

           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                 :            :  * Represente index source,index body and index index entry.
      59                 :            :  ************************************************************************/
      60                 :            : #ifndef     _XFINDEX_HXX
      61                 :            : #define     _XFINDEX_HXX
      62                 :            : #include <map>
      63                 :            : #include <vector>
      64                 :            : 
      65                 :            : #include    "xfcontent.hxx"
      66                 :            : #include    "ixfproperty.hxx"
      67                 :            : #include    "xfcontentcontainer.hxx"
      68                 :            : #include    "xftabstop.hxx"
      69                 :            : 
      70                 :            : class XFIndex;
      71                 :            : class XFIndexTemplate;
      72                 :            : class XFParagraph;
      73                 :            : 
      74                 :            : /**
      75                 :            :  * @brief
      76                 :            :  * Index template.
      77                 :            :  * When index update, the template is used to decide the index body.
      78                 :            :  */
      79         [ #  # ]:          0 : class XFIndexTemplate : public XFContent
      80                 :            : {
      81                 :            : public:
      82                 :            :     XFIndexTemplate();
      83                 :            : 
      84                 :            : public:
      85                 :            :     /**
      86                 :            :      * @descr   Set template level.
      87                 :            :      */
      88                 :            :     void    SetLevel(rtl::OUString level);
      89                 :            :     /**
      90                 :            :      * @descr   Set style.
      91                 :            :      */
      92                 :            :     void    SetStyleName(rtl::OUString style);
      93                 :            :     /**
      94                 :            :      * @descr   Add a entry in the template.
      95                 :            :      */
      96                 :            :     void    AddEntry(enumXFIndexTemplate entry, rtl::OUString styleName = A2OUSTR(""));
      97                 :            : 
      98                 :            :     /**
      99                 :            :      * @descr   Add a tab entry in the template.
     100                 :            :      */
     101                 :            :     void    AddTabEntry(enumXFTab type, double len, sal_Unicode leader = '*', sal_Unicode delimiter='.', rtl::OUString styleName = A2OUSTR(""));
     102                 :            : 
     103                 :            :     /**
     104                 :            :      * @descr   Add a entry in the template.
     105                 :            :      */
     106                 :            :     void    AddTextEntry(rtl::OUString sSpan, rtl::OUString styleName = A2OUSTR(""));
     107                 :            : 
     108                 :            :     /**
     109                 :            :      * @descr   clear all index template parts.
     110                 :            :      */
     111                 :            :     void    Clear();
     112                 :            :     virtual void    ToXml(IXFStream *pStrm);
     113                 :            : 
     114                 :            : private:
     115                 :            :     /**
     116                 :            :      * @descr   Helper function.
     117                 :            :      */
     118                 :            :     void    SetTagName(rtl::OUString tag);
     119                 :            : 
     120                 :            :     friend class XFIndex;
     121                 :            : private:
     122                 :            :     rtl::OUString   m_nLevel;
     123                 :            :     rtl::OUString   m_strStyle;
     124                 :            :     enumXFTab   m_eTabType;
     125                 :            :     double      m_fTabLength;
     126                 :            :     rtl::OUString   m_strTabDelimiter;
     127                 :            :     rtl::OUString   m_strTabLeader;
     128                 :            :     rtl::OUString   m_strTagName;
     129                 :            :     typedef std::pair<enumXFIndexTemplate, rtl::OUString> TOCTEMPLATE_ENTRY_TYPE;
     130                 :            :     std::vector<TOCTEMPLATE_ENTRY_TYPE> m_aEntries; // template entry + text style
     131                 :            :     std::map<sal_uInt16, rtl::OUString> m_aTextEntries;
     132                 :            : 
     133                 :            :     rtl::OUString m_strChapterTextStyle;
     134                 :            : };
     135                 :            : 
     136                 :            : /**
     137                 :            :  * @brief
     138                 :            :  * Index, include index template, index body.
     139                 :            :  */
     140                 :            : class XFIndex : public XFContentContainer
     141                 :            : {
     142                 :            : public:
     143                 :            :     XFIndex();
     144                 :            : 
     145                 :            :     virtual ~XFIndex();
     146                 :            : 
     147                 :            : public:
     148                 :            :     /**
     149                 :            :      * @descr   Set index type.
     150                 :            :      */
     151                 :            :     void    SetIndexType(enumXFIndex type);
     152                 :            : 
     153                 :            :     /**
     154                 :            :      * @descr   Add index templaet entry.
     155                 :            :      */
     156                 :            :     void    AddTemplate(rtl::OUString level, rtl::OUString style, XFIndexTemplate* templ);
     157                 :            : 
     158                 :            :     /**
     159                 :            :      * @descr   Set if protected index to prevent handly-revise.
     160                 :            :      */
     161                 :            :     void    SetProtected(sal_Bool protect);
     162                 :            : 
     163                 :            :     /**
     164                 :            :      * @descr   Set separator.
     165                 :            :      */
     166                 :            :     void    SetSeparator(sal_Bool sep);
     167                 :            : 
     168                 :            :     virtual void    ToXml(IXFStream *pStrm);
     169                 :            : 
     170                 :            :     void AddTocSource(sal_uInt16 nLevel, const rtl::OUString sStyleName);
     171                 :            : 
     172                 :            : private:
     173                 :            :     enumXFIndex     m_eType;
     174                 :            :     rtl::OUString       m_strTitle;
     175                 :            :     rtl::OUString       m_strSectStyle;
     176                 :            :     bool                m_bProtect;
     177                 :            :     bool            m_bSeparator;
     178                 :            :     XFParagraph     *m_pTitle;
     179                 :            : 
     180                 :            :     std::vector<XFIndexTemplate *>  m_aTemplates; // template entry + style
     181                 :            : 
     182                 :            :     #define MAX_TOC_LEVEL 10
     183                 :            :     std::vector<rtl::OUString> m_aTOCSource[MAX_TOC_LEVEL+1];
     184                 :            : 
     185                 :            :     sal_uInt32      m_nMaxLevel;
     186                 :            : };
     187                 :            : 
     188 [ #  # ][ #  # ]:          0 : inline XFIndexTemplate::XFIndexTemplate()
     189                 :            : {
     190         [ #  # ]:          0 :     m_nLevel = Int32ToOUString(0);
     191                 :          0 : }
     192                 :            : 
     193                 :          0 : inline void XFIndexTemplate::SetLevel(rtl::OUString level)
     194                 :            : {
     195                 :          0 :     m_nLevel = level;
     196                 :          0 : }
     197                 :          0 : inline void XFIndexTemplate::SetStyleName(rtl::OUString style)
     198                 :            : {
     199                 :          0 :     m_strStyle = style;
     200                 :          0 : }
     201                 :            : 
     202                 :          0 : inline void XFIndexTemplate::SetTagName(rtl::OUString tag)
     203                 :            : {
     204                 :          0 :     m_strTagName = tag;
     205                 :          0 : }
     206                 :            : 
     207                 :          0 : inline void XFIndexTemplate::AddEntry(enumXFIndexTemplate entry, rtl::OUString styleName)
     208                 :            : {
     209                 :          0 :     std::pair<enumXFIndexTemplate, rtl::OUString> pair(entry, styleName);
     210         [ #  # ]:          0 :     m_aEntries.push_back(pair);
     211                 :          0 : }
     212                 :            : 
     213                 :          0 : inline void XFIndexTemplate::AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, rtl::OUString styleName)
     214                 :            : {
     215                 :          0 :     m_eTabType = type;
     216                 :          0 :     m_strTabLeader = rtl::OUString( leader );
     217                 :          0 :     m_strTabDelimiter = rtl::OUString( delimiter );
     218                 :          0 :     m_fTabLength = len;
     219                 :            : 
     220         [ #  # ]:          0 :     AddEntry(enumXFIndexTemplateTab, styleName);
     221                 :          0 : }
     222                 :            : 
     223                 :          0 : inline void XFIndexTemplate::AddTextEntry(rtl::OUString sText, rtl::OUString styleName)
     224                 :            : {
     225                 :          0 :     sal_uInt16 nLen = m_aEntries.size();
     226         [ #  # ]:          0 :     AddEntry(enumXFIndexTemplateSpan, styleName);
     227                 :            : 
     228         [ #  # ]:          0 :     m_aTextEntries[nLen] = sText;
     229                 :          0 : }
     230                 :            : 
     231                 :            : 
     232                 :            : inline void XFIndexTemplate::Clear()
     233                 :            : {
     234                 :            :     m_aEntries.clear();
     235                 :            : }
     236                 :            : 
     237                 :          0 : inline void XFIndex::SetIndexType(enumXFIndex type)
     238                 :            : {
     239                 :          0 :     m_eType = type;
     240                 :          0 : }
     241                 :            : 
     242                 :            : #endif
     243                 :            : 
     244                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10