LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLIndexObjectSourceContext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 47 0.0 %
Date: 2014-04-14 Functions: 0 11 0.0 %
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             :  * 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             : 
      21             : #include "XMLIndexObjectSourceContext.hxx"
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : 
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : #include <com/sun/star/container/XIndexReplace.hpp>
      27             : 
      28             : #include <sax/tools/converter.hxx>
      29             : 
      30             : #include "XMLIndexTemplateContext.hxx"
      31             : #include "XMLIndexTitleTemplateContext.hxx"
      32             : #include "XMLIndexTOCStylesContext.hxx"
      33             : #include <xmloff/xmlictxt.hxx>
      34             : #include <xmloff/xmlimp.hxx>
      35             : #include <xmloff/txtimp.hxx>
      36             : #include <xmloff/xmlnmspe.hxx>
      37             : #include <xmloff/nmspmap.hxx>
      38             : #include <xmloff/xmltoken.hxx>
      39             : 
      40             : 
      41             : using ::com::sun::star::beans::XPropertySet;
      42             : using ::com::sun::star::uno::Reference;
      43             : using ::com::sun::star::uno::Any;
      44             : using ::com::sun::star::xml::sax::XAttributeList;
      45             : using ::xmloff::token::IsXMLToken;
      46             : using ::xmloff::token::XML_OBJECT_INDEX_ENTRY_TEMPLATE;
      47             : using ::xmloff::token::XML_TOKEN_INVALID;
      48             : 
      49             : const sal_Char sAPI_CreateFromStarCalc[] = "CreateFromStarCalc";
      50             : const sal_Char sAPI_CreateFromStarChart[] = "CreateFromStarChart";
      51             : const sal_Char sAPI_CreateFromStarDraw[] = "CreateFromStarDraw";
      52             : const sal_Char sAPI_CreateFromStarMath[] = "CreateFromStarMath";
      53             : const sal_Char sAPI_CreateFromOtherEmbeddedObjects[] = "CreateFromOtherEmbeddedObjects";
      54             : 
      55             : 
      56           0 : TYPEINIT1( XMLIndexObjectSourceContext, XMLIndexSourceBaseContext );
      57             : 
      58           0 : XMLIndexObjectSourceContext::XMLIndexObjectSourceContext(
      59             :     SvXMLImport& rImport,
      60             :     sal_uInt16 nPrfx,
      61             :     const OUString& rLocalName,
      62             :     Reference<XPropertySet> & rPropSet) :
      63             :         XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName,
      64             :                                   rPropSet, sal_False),
      65             :         sCreateFromStarCalc(sAPI_CreateFromStarCalc),
      66             :         sCreateFromStarChart(sAPI_CreateFromStarChart),
      67             :         sCreateFromStarDraw(sAPI_CreateFromStarDraw),
      68             :         sCreateFromStarMath(sAPI_CreateFromStarMath),
      69             :         sCreateFromOtherEmbeddedObjects(sAPI_CreateFromOtherEmbeddedObjects),
      70             :         bUseCalc(sal_False),
      71             :         bUseChart(sal_False),
      72             :         bUseDraw(sal_False),
      73             :         bUseMath(sal_False),
      74           0 :         bUseOtherObjects(sal_False)
      75             : {
      76           0 : }
      77             : 
      78           0 : XMLIndexObjectSourceContext::~XMLIndexObjectSourceContext()
      79             : {
      80           0 : }
      81             : 
      82           0 : void XMLIndexObjectSourceContext::ProcessAttribute(
      83             :     enum IndexSourceParamEnum eParam,
      84             :     const OUString& rValue)
      85             : {
      86           0 :     bool bTmp(false);
      87             : 
      88           0 :     switch (eParam)
      89             :     {
      90             :         case XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS:
      91           0 :             if (::sax::Converter::convertBool(bTmp, rValue))
      92             :             {
      93           0 :                 bUseOtherObjects = bTmp;
      94             :             }
      95           0 :             break;
      96             : 
      97             :         case XML_TOK_INDEXSOURCE_USE_SHEET:
      98           0 :             if (::sax::Converter::convertBool(bTmp, rValue))
      99             :             {
     100           0 :                 bUseCalc = bTmp;
     101             :             }
     102           0 :             break;
     103             : 
     104             :         case XML_TOK_INDEXSOURCE_USE_CHART:
     105           0 :             if (::sax::Converter::convertBool(bTmp, rValue))
     106             :             {
     107           0 :                 bUseChart = bTmp;
     108             :             }
     109           0 :             break;
     110             : 
     111             :         case XML_TOK_INDEXSOURCE_USE_DRAW:
     112           0 :             if (::sax::Converter::convertBool(bTmp, rValue))
     113             :             {
     114           0 :                 bUseDraw = bTmp;
     115             :             }
     116           0 :             break;
     117             : 
     118             :         case XML_TOK_INDEXSOURCE_USE_MATH:
     119           0 :             if (::sax::Converter::convertBool(bTmp, rValue))
     120             :             {
     121           0 :                 bUseMath = bTmp;
     122             :             }
     123           0 :             break;
     124             : 
     125             :         default:
     126           0 :             XMLIndexSourceBaseContext::ProcessAttribute(eParam, rValue);
     127           0 :             break;
     128             :     }
     129           0 : }
     130             : 
     131           0 : void XMLIndexObjectSourceContext::EndElement()
     132             : {
     133           0 :     Any aAny;
     134             : 
     135           0 :     aAny.setValue(&bUseCalc, ::getBooleanCppuType());
     136           0 :     rIndexPropertySet->setPropertyValue(sCreateFromStarCalc, aAny);
     137             : 
     138           0 :     aAny.setValue(&bUseChart, ::getBooleanCppuType());
     139           0 :     rIndexPropertySet->setPropertyValue(sCreateFromStarChart, aAny);
     140             : 
     141           0 :     aAny.setValue(&bUseDraw, ::getBooleanCppuType());
     142           0 :     rIndexPropertySet->setPropertyValue(sCreateFromStarDraw, aAny);
     143             : 
     144           0 :     aAny.setValue(&bUseMath, ::getBooleanCppuType());
     145           0 :     rIndexPropertySet->setPropertyValue(sCreateFromStarMath, aAny);
     146             : 
     147           0 :     aAny.setValue(&bUseOtherObjects, ::getBooleanCppuType());
     148           0 :     rIndexPropertySet->setPropertyValue(sCreateFromOtherEmbeddedObjects, aAny);
     149             : 
     150           0 :     XMLIndexSourceBaseContext::EndElement();
     151           0 : }
     152             : 
     153           0 : SvXMLImportContext* XMLIndexObjectSourceContext::CreateChildContext(
     154             :     sal_uInt16 nPrefix,
     155             :     const OUString& rLocalName,
     156             :     const Reference<XAttributeList> & xAttrList )
     157             : {
     158           0 :     if ( (XML_NAMESPACE_TEXT == nPrefix) &&
     159           0 :          (IsXMLToken(rLocalName, XML_OBJECT_INDEX_ENTRY_TEMPLATE)) )
     160             :     {
     161           0 :         return new XMLIndexTemplateContext(GetImport(), rIndexPropertySet,
     162             :                                            nPrefix, rLocalName,
     163             :                                            aLevelNameTableMap,
     164             :                                            XML_TOKEN_INVALID, // no outline-level attr
     165             :                                            aLevelStylePropNameTableMap,
     166           0 :                                            aAllowedTokenTypesTable);
     167             :     }
     168             :     else
     169             :     {
     170             :         return XMLIndexSourceBaseContext::CreateChildContext(nPrefix,
     171             :                                                              rLocalName,
     172           0 :                                                              xAttrList);
     173             :     }
     174             : 
     175             : }
     176             : 
     177             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10