LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLIndexTemplateContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 77 88 87.5 %
Date: 2012-08-25 Functions: 7 12 58.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 70 147 47.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "XMLIndexTemplateContext.hxx"
      21                 :            : #include "XMLIndexSimpleEntryContext.hxx"
      22                 :            : #include "XMLIndexSpanEntryContext.hxx"
      23                 :            : #include "XMLIndexTabStopEntryContext.hxx"
      24                 :            : #include "XMLIndexBibliographyEntryContext.hxx"
      25                 :            : #include "XMLIndexChapterInfoEntryContext.hxx"
      26                 :            : #include <xmloff/xmlictxt.hxx>
      27                 :            : #include <xmloff/xmlimp.hxx>
      28                 :            : #include <xmloff/txtimp.hxx>
      29                 :            : #include <xmloff/nmspmap.hxx>
      30                 :            : #include "xmloff/xmlnmspe.hxx"
      31                 :            : #include <xmloff/xmltoken.hxx>
      32                 :            : #include <xmloff/xmluconv.hxx>
      33                 :            : #include <tools/debug.hxx>
      34                 :            : #include <rtl/ustring.hxx>
      35                 :            : #include <rtl/ustrbuf.hxx>
      36                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      37                 :            : 
      38                 :            : 
      39                 :            : using namespace ::std;
      40                 :            : using namespace ::xmloff::token;
      41                 :            : 
      42                 :            : using ::rtl::OUString;
      43                 :            : using ::rtl::OUStringBuffer;
      44                 :            : using ::com::sun::star::beans::XPropertySet;
      45                 :            : using ::com::sun::star::beans::PropertyValue;
      46                 :            : using ::com::sun::star::beans::PropertyValues;
      47                 :            : using ::com::sun::star::uno::Reference;
      48                 :            : using ::com::sun::star::uno::Sequence;
      49                 :            : using ::com::sun::star::uno::Any;
      50                 :            : using ::com::sun::star::xml::sax::XAttributeList;
      51                 :            : using ::com::sun::star::container::XIndexReplace;
      52                 :            : 
      53                 :            : const sal_Char sAPI_TokenEntryNumber[] =    "TokenEntryNumber";
      54                 :            : const sal_Char sAPI_TokenEntryText[] =      "TokenEntryText";
      55                 :            : const sal_Char sAPI_TokenTabStop[] =        "TokenTabStop";
      56                 :            : const sal_Char sAPI_TokenText[] =           "TokenText";
      57                 :            : const sal_Char sAPI_TokenPageNumber[] =     "TokenPageNumber";
      58                 :            : const sal_Char sAPI_TokenChapterInfo[] =    "TokenChapterInfo";
      59                 :            : const sal_Char sAPI_TokenHyperlinkStart[] = "TokenHyperlinkStart";
      60                 :            : const sal_Char sAPI_TokenHyperlinkEnd[] =   "TokenHyperlinkEnd";
      61                 :            : const sal_Char sAPI_TokenBibliographyDataField[] =
      62                 :            :                                             "TokenBibliographyDataField";
      63                 :            : 
      64                 :            : 
      65 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLIndexTemplateContext, SvXMLImportContext);
      66                 :            : 
      67                 :        196 : XMLIndexTemplateContext::XMLIndexTemplateContext(
      68                 :            :     SvXMLImport& rImport,
      69                 :            :     Reference<XPropertySet> & rPropSet,
      70                 :            :     sal_uInt16 nPrfx,
      71                 :            :     const OUString& rLocalName,
      72                 :            :     const SvXMLEnumMapEntry* pLevelNameMap,
      73                 :            :     enum XMLTokenEnum eLevelAttrName,
      74                 :            :     const sal_Char** pLevelStylePropMap,
      75                 :            :     const sal_Bool* pAllowedTokenTypes,
      76                 :            :     sal_Bool bT )
      77                 :            : :   SvXMLImportContext(rImport, nPrfx, rLocalName)
      78                 :            : ,   pOutlineLevelNameMap(pLevelNameMap)
      79                 :            : ,   eOutlineLevelAttrName(eLevelAttrName)
      80                 :            : ,   pOutlineLevelStylePropMap(pLevelStylePropMap)
      81                 :            : ,   pAllowedTokenTypesMap(pAllowedTokenTypes)
      82                 :            : ,   nOutlineLevel(1)    // all indices have level 1 (0 is for header)
      83                 :            : ,   bStyleNameOK(sal_False)
      84                 :            : ,   bOutlineLevelOK(sal_False)
      85                 :            : ,   bTOC( bT )
      86                 :            : ,   rPropertySet(rPropSet)
      87                 :            : ,   sTokenEntryNumber(sAPI_TokenEntryNumber)
      88                 :            : ,   sTokenEntryText(sAPI_TokenEntryText)
      89                 :            : ,   sTokenTabStop(sAPI_TokenTabStop)
      90                 :            : ,   sTokenText(sAPI_TokenText)
      91                 :            : ,   sTokenPageNumber(sAPI_TokenPageNumber)
      92                 :            : ,   sTokenChapterInfo(sAPI_TokenChapterInfo)
      93                 :            : ,   sTokenHyperlinkStart(sAPI_TokenHyperlinkStart)
      94                 :            : ,   sTokenHyperlinkEnd(sAPI_TokenHyperlinkEnd)
      95                 :            : ,   sTokenBibliographyDataField(sAPI_TokenBibliographyDataField)
      96                 :            : 
      97                 :            : ,   sCharacterStyleName("CharacterStyleName")
      98                 :            : ,   sTokenType("TokenType")
      99                 :            : ,   sText("Text")
     100                 :            : ,   sTabStopRightAligned("TabStopRightAligned")
     101                 :            : ,   sTabStopPosition("TabStopPosition")
     102                 :            : ,   sTabStopFillCharacter("TabStopFillCharacter")
     103                 :            : ,   sBibliographyDataField("BibliographyDataField")
     104                 :            : ,   sChapterFormat("ChapterFormat")
     105                 :            : ,   sChapterLevel("ChapterLevel") //#i53420
     106                 :            : 
     107                 :            : ,   sLevelFormat("LevelFormat")
     108         [ +  - ]:        196 : ,   sParaStyleLevel("ParaStyleLevel")
     109                 :            : {
     110                 :            :     DBG_ASSERT( ((XML_TOKEN_INVALID != eLevelAttrName) &&  (NULL != pLevelNameMap))
     111                 :            :                 || ((XML_TOKEN_INVALID == eLevelAttrName) &&  (NULL == pLevelNameMap)),
     112                 :            :                 "need both, attribute name and value map, or neither" );
     113                 :            :     DBG_ASSERT( NULL != pOutlineLevelStylePropMap, "need property name map" );
     114                 :            :     DBG_ASSERT( NULL != pAllowedTokenTypes, "need allowed tokens map" );
     115                 :            : 
     116                 :            :     // no map for outline-level? then use 1
     117         [ +  + ]:        196 :     if (NULL == pLevelNameMap)
     118                 :            :     {
     119                 :         12 :         nOutlineLevel = 1;
     120                 :         12 :         bOutlineLevelOK = sal_True;
     121                 :            :     }
     122                 :        196 : }
     123                 :            : 
     124                 :        196 : XMLIndexTemplateContext::~XMLIndexTemplateContext()
     125                 :            : {
     126         [ -  + ]:        392 : }
     127                 :            : 
     128                 :            : 
     129                 :        980 : void XMLIndexTemplateContext::addTemplateEntry(
     130                 :            :     const PropertyValues& aValues)
     131                 :            : {
     132                 :        980 :     aValueVector.push_back(aValues);
     133                 :        980 : }
     134                 :            : 
     135                 :            : 
     136                 :        196 : void XMLIndexTemplateContext::StartElement(
     137                 :            :         const Reference<XAttributeList> & xAttrList)
     138                 :            : {
     139                 :            :     // process two attributes: style-name, outline-level
     140                 :        196 :     sal_Int16 nLength = xAttrList->getLength();
     141         [ +  + ]:        576 :     for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
     142                 :            :     {
     143                 :        380 :         OUString sLocalName;
     144                 :        380 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
     145         [ +  - ]:        380 :             GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
     146   [ +  -  +  - ]:        760 :                               &sLocalName );
     147         [ +  - ]:        380 :         if (XML_NAMESPACE_TEXT == nPrefix)
     148                 :            :         {
     149 [ +  - ][ +  + ]:        380 :             if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
     150                 :            :             {
     151                 :            :                 // style name
     152 [ +  - ][ +  - ]:        196 :                 sStyleName = xAttrList->getValueByIndex(nAttr);
     153                 :        196 :                 bStyleNameOK = sal_True;
     154                 :            :             }
     155         [ +  - ]:        184 :             else if (eOutlineLevelAttrName != XML_TOKEN_INVALID)
     156                 :            :             {
     157                 :            :                 // we have an attr name! Then see if we have the attr, too.
     158 [ +  - ][ +  - ]:        184 :                 if (IsXMLToken(sLocalName, eOutlineLevelAttrName))
     159                 :            :                 {
     160                 :            :                     // outline level
     161                 :            :                     sal_uInt16 nTmp;
     162         [ +  - ]:        184 :                     if (SvXMLUnitConverter::convertEnum(
     163         [ +  - ]:        184 :                         nTmp, xAttrList->getValueByIndex(nAttr),
     164 [ +  - ][ +  - ]:        184 :                         pOutlineLevelNameMap))
     165                 :            :                     {
     166                 :        184 :                         nOutlineLevel = nTmp;
     167                 :        184 :                         bOutlineLevelOK = sal_True;
     168                 :            :                     }
     169                 :            :                     // else: illegal value -> ignore
     170                 :            :                 }
     171                 :            :                 // else: unknown attribute -> ignore
     172                 :            :             }
     173                 :            :             // else: we don't care about outline-level -> ignore
     174                 :            :         }
     175                 :            :         // else: attribute not in text namespace -> ignore
     176                 :        380 :     }
     177                 :        196 : }
     178                 :            : 
     179                 :        196 : void XMLIndexTemplateContext::EndElement()
     180                 :            : {
     181         [ +  - ]:        196 :     if (bOutlineLevelOK)
     182                 :            :     {
     183                 :        196 :         const sal_Int32 nCount = aValueVector.size();
     184         [ +  - ]:        196 :         Sequence<PropertyValues> aValueSequence(nCount);
     185         [ +  + ]:       1176 :         for(sal_Int32 i = 0; i<nCount; i++)
     186                 :            :         {
     187 [ +  - ][ +  - ]:        980 :             aValueSequence[i] = aValueVector[i];
     188                 :            :         }
     189                 :            : 
     190                 :            :         // get LevelFormat IndexReplace ...
     191 [ +  - ][ +  - ]:        196 :         Any aAny = rPropertySet->getPropertyValue(sLevelFormat);
     192                 :        196 :         Reference<XIndexReplace> xIndexReplace;
     193         [ +  - ]:        196 :         aAny >>= xIndexReplace;
     194                 :            : 
     195                 :            :         // ... and insert
     196         [ +  - ]:        196 :         aAny <<= aValueSequence;
     197 [ +  - ][ +  - ]:        196 :         xIndexReplace->replaceByIndex(nOutlineLevel, aAny);
     198                 :            : 
     199         [ +  - ]:        196 :         if (bStyleNameOK)
     200                 :            :         {
     201                 :            :             const sal_Char* pStyleProperty =
     202                 :        196 :                 pOutlineLevelStylePropMap[nOutlineLevel];
     203                 :            : 
     204                 :            :             DBG_ASSERT(NULL != pStyleProperty, "need property name");
     205         [ +  - ]:        196 :             if (NULL != pStyleProperty)
     206                 :            :             {
     207                 :            :                 OUString sDisplayStyleName =
     208                 :        196 :                         GetImport().GetStyleDisplayName(
     209                 :            :                         XML_STYLE_FAMILY_TEXT_PARAGRAPH,
     210         [ +  - ]:        196 :                         sStyleName );
     211                 :            :                 // #i50288#: Check if style exists
     212                 :            :                 const Reference < ::com::sun::star::container::XNameContainer > & rStyles =
     213 [ +  - ][ +  - ]:        196 :                     GetImport().GetTextImport()->GetParaStyles();
         [ +  - ][ +  - ]
     214 [ +  - ][ -  + ]:        392 :                 if( rStyles.is() &&
                 [ -  + ]
     215 [ +  - ][ +  - ]:        196 :                     rStyles->hasByName( sDisplayStyleName ) )
     216                 :            :                 {
     217         [ #  # ]:          0 :                     aAny <<= sDisplayStyleName;
     218         [ #  # ]:          0 :                     rPropertySet->setPropertyValue(
     219         [ #  # ]:          0 :                         OUString::createFromAscii(pStyleProperty), aAny);
     220                 :        196 :                 }
     221                 :            :             }
     222         [ +  - ]:        196 :         }
     223                 :            :     }
     224                 :        196 : }
     225                 :            : 
     226                 :            : 
     227                 :            : 
     228                 :            : /// template token types; used for aTokenTypeMap parameter
     229                 :            : enum TemplateTokenType
     230                 :            : {
     231                 :            :     XML_TOK_INDEX_TYPE_ENTRY_TEXT = 0,
     232                 :            :     XML_TOK_INDEX_TYPE_TAB_STOP,
     233                 :            :     XML_TOK_INDEX_TYPE_TEXT,
     234                 :            :     XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     235                 :            :     XML_TOK_INDEX_TYPE_CHAPTER,
     236                 :            :     XML_TOK_INDEX_TYPE_LINK_START,
     237                 :            :     XML_TOK_INDEX_TYPE_LINK_END,
     238                 :            :     XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     239                 :            : };
     240                 :            : 
     241                 :            : 
     242                 :            : SvXMLEnumMapEntry aTemplateTokenTypeMap[] =
     243                 :            : {
     244                 :            :     { XML_INDEX_ENTRY_TEXT,         XML_TOK_INDEX_TYPE_ENTRY_TEXT },
     245                 :            :     { XML_INDEX_ENTRY_TAB_STOP,     XML_TOK_INDEX_TYPE_TAB_STOP },
     246                 :            :     { XML_INDEX_ENTRY_SPAN,         XML_TOK_INDEX_TYPE_TEXT },
     247                 :            :     { XML_INDEX_ENTRY_PAGE_NUMBER,  XML_TOK_INDEX_TYPE_PAGE_NUMBER },
     248                 :            :     { XML_INDEX_ENTRY_CHAPTER,      XML_TOK_INDEX_TYPE_CHAPTER },
     249                 :            :     { XML_INDEX_ENTRY_LINK_START,   XML_TOK_INDEX_TYPE_LINK_START },
     250                 :            :     { XML_INDEX_ENTRY_LINK_END,     XML_TOK_INDEX_TYPE_LINK_END },
     251                 :            :     { XML_INDEX_ENTRY_BIBLIOGRAPHY, XML_TOK_INDEX_TYPE_BIBLIOGRAPHY },
     252                 :            :     { XML_TOKEN_INVALID, 0 }
     253                 :            : };
     254                 :            : 
     255                 :        980 : SvXMLImportContext *XMLIndexTemplateContext::CreateChildContext(
     256                 :            :     sal_uInt16 nPrefix,
     257                 :            :     const OUString& rLocalName,
     258                 :            :     const Reference<XAttributeList> & xAttrList )
     259                 :            : {
     260                 :        980 :     SvXMLImportContext* pContext = NULL;
     261                 :            : 
     262         [ +  - ]:        980 :     if (XML_NAMESPACE_TEXT == nPrefix)
     263                 :            :     {
     264                 :            :         sal_uInt16 nToken;
     265         [ +  - ]:        980 :         if (SvXMLUnitConverter::convertEnum(nToken, rLocalName,
     266         [ +  - ]:        980 :                                             aTemplateTokenTypeMap))
     267                 :            :         {
     268                 :            :             // can this index accept this kind of token?
     269         [ +  - ]:        980 :             if (pAllowedTokenTypesMap[nToken])
     270                 :            :             {
     271   [ +  +  -  -  :        980 :                 switch ((TemplateTokenType)nToken)
             +  +  +  +  
                      - ]
     272                 :            :                 {
     273                 :            :                     case XML_TOK_INDEX_TYPE_ENTRY_TEXT:
     274                 :            :                         pContext = new XMLIndexSimpleEntryContext(
     275                 :        108 :                             GetImport(), sTokenEntryText, *this,
     276 [ +  - ][ +  - ]:        108 :                             nPrefix, rLocalName);
     277                 :        108 :                         break;
     278                 :            : 
     279                 :            :                     case XML_TOK_INDEX_TYPE_PAGE_NUMBER:
     280                 :            :                         pContext = new XMLIndexSimpleEntryContext(
     281                 :        104 :                             GetImport(), sTokenPageNumber, *this,
     282 [ +  - ][ +  - ]:        104 :                             nPrefix, rLocalName);
     283                 :        104 :                         break;
     284                 :            : 
     285                 :            :                     case XML_TOK_INDEX_TYPE_LINK_START:
     286                 :            :                         pContext = new XMLIndexSimpleEntryContext(
     287                 :          0 :                             GetImport(), sTokenHyperlinkStart, *this,
     288 [ #  # ][ #  # ]:          0 :                             nPrefix, rLocalName);
     289                 :          0 :                         break;
     290                 :            : 
     291                 :            :                     case XML_TOK_INDEX_TYPE_LINK_END:
     292                 :            :                         pContext = new XMLIndexSimpleEntryContext(
     293                 :          0 :                             GetImport(), sTokenHyperlinkEnd, *this,
     294 [ #  # ][ #  # ]:          0 :                             nPrefix, rLocalName);
     295                 :          0 :                         break;
     296                 :            : 
     297                 :            :                     case XML_TOK_INDEX_TYPE_TEXT:
     298                 :            :                         pContext = new XMLIndexSpanEntryContext(
     299 [ +  - ][ +  - ]:        268 :                             GetImport(), *this, nPrefix, rLocalName);
     300                 :        268 :                         break;
     301                 :            : 
     302                 :            :                     case XML_TOK_INDEX_TYPE_TAB_STOP:
     303                 :            :                         pContext = new XMLIndexTabStopEntryContext(
     304 [ +  - ][ +  - ]:        104 :                             GetImport(), *this, nPrefix, rLocalName);
     305                 :        104 :                         break;
     306                 :            : 
     307                 :            :                     case XML_TOK_INDEX_TYPE_BIBLIOGRAPHY:
     308                 :            :                         pContext = new XMLIndexBibliographyEntryContext(
     309 [ +  - ][ +  - ]:        356 :                             GetImport(), *this, nPrefix, rLocalName);
     310                 :        356 :                         break;
     311                 :            : 
     312                 :            :                     case XML_TOK_INDEX_TYPE_CHAPTER:
     313                 :            :                         pContext = new XMLIndexChapterInfoEntryContext(
     314 [ +  - ][ +  - ]:         40 :                             GetImport(), *this, nPrefix, rLocalName, bTOC );
     315                 :         40 :                         break;
     316                 :            : 
     317                 :            :                     default:
     318                 :            :                         // ignore!
     319                 :        980 :                         break;
     320                 :            :                 }
     321                 :            :             }
     322                 :            :         }
     323                 :            :     }
     324                 :            : 
     325                 :            :     // ignore unknown
     326         [ -  + ]:        980 :     if (NULL == pContext)
     327                 :            :     {
     328                 :            :         return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
     329                 :          0 :                                                       xAttrList);
     330                 :            :     }
     331                 :            : 
     332                 :        980 :     return pContext;
     333                 :            : }
     334                 :            : 
     335                 :            : 
     336                 :            : 
     337                 :            : //
     338                 :            : // maps for the XMLIndexTemplateContext constructor
     339                 :            : //
     340                 :            : 
     341                 :            : 
     342                 :            : // table of content and user defined index:
     343                 :            : 
     344                 :            : const SvXMLEnumMapEntry aLevelNameTOCMap[] =
     345                 :            : {
     346                 :            :     { XML_1, 1 },
     347                 :            :     { XML_2, 2 },
     348                 :            :     { XML_3, 3 },
     349                 :            :     { XML_4, 4 },
     350                 :            :     { XML_5, 5 },
     351                 :            :     { XML_6, 6 },
     352                 :            :     { XML_7, 7 },
     353                 :            :     { XML_8, 8 },
     354                 :            :     { XML_9, 9 },
     355                 :            :     { XML_10, 10 },
     356                 :            :     { XML_TOKEN_INVALID, 0 }
     357                 :            : };
     358                 :            : 
     359                 :            : const sal_Char* aLevelStylePropNameTOCMap[] =
     360                 :            :     { NULL, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3",
     361                 :            :           "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6",
     362                 :            :           "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9",
     363                 :            :           "ParaStyleLevel10", NULL };
     364                 :            : 
     365                 :            : const sal_Bool aAllowedTokenTypesTOC[] =
     366                 :            : {
     367                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
     368                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TAB_STOP,
     369                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TEXT,
     370                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     371                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_CHAPTER,
     372                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_LINK_START,
     373                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_LINK_END,
     374                 :            :     sal_False       // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     375                 :            : };
     376                 :            : 
     377                 :            : const sal_Bool aAllowedTokenTypesUser[] =
     378                 :            : {
     379                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
     380                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TAB_STOP,
     381                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TEXT,
     382                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     383                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_CHAPTER,
     384                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_START,
     385                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_END,
     386                 :            :     sal_False       // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     387                 :            : };
     388                 :            : 
     389                 :            : 
     390                 :            : // alphabetical index
     391                 :            : 
     392                 :            : const SvXMLEnumMapEntry aLevelNameAlphaMap[] =
     393                 :            : {
     394                 :            :     { XML_SEPARATOR, 1 },
     395                 :            :     { XML_1, 2 },
     396                 :            :     { XML_2, 3 },
     397                 :            :     { XML_3, 4 },
     398                 :            :     { XML_TOKEN_INVALID, 0 }
     399                 :            : };
     400                 :            : 
     401                 :            : const sal_Char* aLevelStylePropNameAlphaMap[] =
     402                 :            :     { NULL, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2",
     403                 :            :           "ParaStyleLevel3", NULL };
     404                 :            : 
     405                 :            : const sal_Bool aAllowedTokenTypesAlpha[] =
     406                 :            : {
     407                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
     408                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TAB_STOP,
     409                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TEXT,
     410                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     411                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_CHAPTER,
     412                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_START,
     413                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_END,
     414                 :            :     sal_False       // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     415                 :            : };
     416                 :            : 
     417                 :            : 
     418                 :            : // bibliography index:
     419                 :            : 
     420                 :            : const SvXMLEnumMapEntry aLevelNameBibliographyMap[] =
     421                 :            : {
     422                 :            :     { XML_ARTICLE, 1 },
     423                 :            :     { XML_BOOK, 2 },
     424                 :            :     { XML_BOOKLET, 3 },
     425                 :            :     { XML_CONFERENCE, 4 },
     426                 :            :     { XML_CUSTOM1, 5 },
     427                 :            :     { XML_CUSTOM2, 6 },
     428                 :            :     { XML_CUSTOM3, 7 },
     429                 :            :     { XML_CUSTOM4, 8 },
     430                 :            :     { XML_CUSTOM5, 9 },
     431                 :            :     { XML_EMAIL, 10 },
     432                 :            :     { XML_INBOOK, 11 },
     433                 :            :     { XML_INCOLLECTION, 12 },
     434                 :            :     { XML_INPROCEEDINGS, 13 },
     435                 :            :     { XML_JOURNAL, 14 },
     436                 :            :     { XML_MANUAL, 15 },
     437                 :            :     { XML_MASTERSTHESIS, 16 },
     438                 :            :     { XML_MISC, 17 },
     439                 :            :     { XML_PHDTHESIS, 18 },
     440                 :            :     { XML_PROCEEDINGS, 19 },
     441                 :            :     { XML_TECHREPORT, 20 },
     442                 :            :     { XML_UNPUBLISHED, 21 },
     443                 :            :     { XML_WWW, 22 },
     444                 :            :     { XML_TOKEN_INVALID, 0 }
     445                 :            : };
     446                 :            : 
     447                 :            : // TODO: replace with real property names, when available
     448                 :            : const sal_Char* aLevelStylePropNameBibliographyMap[] =
     449                 :            : {
     450                 :            :     NULL, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     451                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     452                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     453                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     454                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     455                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     456                 :            :     "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1",
     457                 :            :     "ParaStyleLevel1", NULL };
     458                 :            : 
     459                 :            : const sal_Bool aAllowedTokenTypesBibliography[] =
     460                 :            : {
     461                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
     462                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TAB_STOP,
     463                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TEXT,
     464                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     465                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_CHAPTER,
     466                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_START,
     467                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_END,
     468                 :            :     sal_True        // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     469                 :            : };
     470                 :            : 
     471                 :            : 
     472                 :            : // table, illustration and object index
     473                 :            : 
     474                 :            : // no name map
     475                 :            : const SvXMLEnumMapEntry* aLevelNameTableMap = NULL;
     476                 :            : 
     477                 :            : const sal_Char* aLevelStylePropNameTableMap[] =
     478                 :            :     { NULL, "ParaStyleLevel1", NULL };
     479                 :            : 
     480                 :            : const sal_Bool aAllowedTokenTypesTable[] =
     481                 :            : {
     482                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
     483                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TAB_STOP,
     484                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_TEXT,
     485                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
     486                 :            :     sal_True,       // XML_TOK_INDEX_TYPE_CHAPTER,
     487                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_START,
     488                 :            :     sal_False,      // XML_TOK_INDEX_TYPE_LINK_END,
     489                 :            :     sal_False       // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
     490                 :            : };
     491                 :            : 
     492                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10