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

Generated by: LCOV version 1.10