LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/xml - xmllabri.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-12-27 Functions: 0 10 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             : 
      22             : //___________________________________________________________________
      23             : #include "xmllabri.hxx"
      24             : #include <xmloff/nmspmap.hxx>
      25             : #include <xmloff/xmltoken.hxx>
      26             : #include "xmlimprt.hxx"
      27             : 
      28             : using namespace ::com::sun::star;
      29             : using ::rtl::OUString;
      30             : using namespace xmloff::token;
      31             : 
      32             : 
      33             : //___________________________________________________________________
      34             : 
      35           0 : ScXMLLabelRangesContext::ScXMLLabelRangesContext(
      36             :         ScXMLImport& rImport,
      37             :         sal_uInt16 nPrefix,
      38             :         const OUString& rLName,
      39             :         const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ ):
      40           0 :     SvXMLImportContext( rImport, nPrefix, rLName )
      41             : {
      42           0 :     rImport.LockSolarMutex();
      43           0 : }
      44             : 
      45           0 : ScXMLLabelRangesContext::~ScXMLLabelRangesContext()
      46             : {
      47           0 :     GetScImport().UnlockSolarMutex();
      48           0 : }
      49             : 
      50           0 : SvXMLImportContext* ScXMLLabelRangesContext::CreateChildContext(
      51             :         sal_uInt16 nPrefix,
      52             :         const OUString& rLName,
      53             :         const uno::Reference< xml::sax::XAttributeList >& xAttrList )
      54             : {
      55           0 :     SvXMLImportContext*     pContext(NULL);
      56           0 :     const SvXMLTokenMap&    rTokenMap(GetScImport().GetLabelRangesElemTokenMap());
      57             : 
      58           0 :     switch( rTokenMap.Get( nPrefix, rLName ) )
      59             :     {
      60             :         case XML_TOK_LABEL_RANGE_ELEM:
      61           0 :             pContext = new ScXMLLabelRangeContext( GetScImport(), nPrefix, rLName, xAttrList );
      62           0 :         break;
      63             :     }
      64           0 :     if( !pContext )
      65           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
      66             : 
      67           0 :     return pContext;
      68             : }
      69             : 
      70           0 : void ScXMLLabelRangesContext::EndElement()
      71             : {
      72           0 : }
      73             : 
      74             : 
      75             : //___________________________________________________________________
      76             : 
      77           0 : ScXMLLabelRangeContext::ScXMLLabelRangeContext(
      78             :         ScXMLImport& rImport,
      79             :         sal_uInt16 nPrfx,
      80             :         const OUString& rLName,
      81             :         const uno::Reference< xml::sax::XAttributeList >& xAttrList ) :
      82             :     SvXMLImportContext( rImport, nPrfx, rLName ),
      83           0 :     bColumnOrientation( false )
      84             : {
      85           0 :     sal_Int16               nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
      86           0 :     const SvXMLTokenMap&    rAttrTokenMap(GetScImport().GetLabelRangeAttrTokenMap());
      87             : 
      88           0 :     for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
      89             :     {
      90           0 :         const rtl::OUString& sAttrName  (xAttrList->getNameByIndex( nIndex ));
      91           0 :         const rtl::OUString& sValue     (xAttrList->getValueByIndex( nIndex ));
      92           0 :         OUString    aLocalName;
      93           0 :         sal_uInt16      nPrefix     (GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ));
      94             : 
      95           0 :         switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
      96             :         {
      97             :             case XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE:
      98           0 :                 sLabelRangeStr = sValue;
      99           0 :             break;
     100             :             case XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE:
     101           0 :                 sDataRangeStr = sValue;
     102           0 :             break;
     103             :             case XML_TOK_LABEL_RANGE_ATTR_ORIENTATION:
     104           0 :                 bColumnOrientation = IsXMLToken(sValue, XML_COLUMN );
     105           0 :             break;
     106             :         }
     107           0 :     }
     108           0 : }
     109             : 
     110           0 : ScXMLLabelRangeContext::~ScXMLLabelRangeContext()
     111             : {
     112           0 : }
     113             : 
     114           0 : SvXMLImportContext* ScXMLLabelRangeContext::CreateChildContext(
     115             :         sal_uInt16 nPrefix,
     116             :         const OUString& rLName,
     117             :         const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ )
     118             : {
     119           0 :     return new SvXMLImportContext( GetImport(), nPrefix, rLName );
     120             : }
     121             : 
     122           0 : void ScXMLLabelRangeContext::EndElement()
     123             : {
     124             :     //  Label ranges must be stored as strings until all sheets are loaded
     125             :     //  (like named expressions).
     126             : 
     127           0 :     ScMyLabelRange* pLabelRange = new ScMyLabelRange;
     128             : 
     129           0 :     pLabelRange->sLabelRangeStr = sLabelRangeStr;
     130           0 :     pLabelRange->sDataRangeStr = sDataRangeStr;
     131           0 :     pLabelRange->bColumnOrientation = bColumnOrientation;
     132             : 
     133           0 :     GetScImport().AddLabelRange(pLabelRange);
     134           0 : }
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10