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

Generated by: LCOV version 1.10