LCOV - code coverage report
Current view: top level - include/xmloff - numehelp.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 4 100.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             : #ifndef INCLUDED_XMLOFF_NUMEHELP_HXX
      21             : #define INCLUDED_XMLOFF_NUMEHELP_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : #include <xmloff/xmlnmspe.hxx>
      25             : #include <xmloff/dllapi.h>
      26             : #include <sal/types.h>
      27             : #include <com/sun/star/frame/XModel.hpp>
      28             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      29             : 
      30             : #include <set>
      31             : 
      32             : class SvXMLExport;
      33             : 
      34        1914 : struct XMLNumberFormat
      35             : {
      36             :     OUString   sCurrency;
      37             :     sal_Int32  nNumberFormat;
      38             :     sal_Int16  nType;
      39             :     bool       bIsStandard : 1;
      40             :     XMLNumberFormat()
      41             :         : nNumberFormat(0)
      42             :         , nType(0)
      43             :         , bIsStandard(false)
      44             :     {
      45             :     }
      46             : 
      47        1208 :     XMLNumberFormat(const OUString& sTempCurrency, sal_Int32 nTempFormat, sal_Int16 nTempType)
      48             :         : sCurrency(sTempCurrency)
      49             :         , nNumberFormat(nTempFormat)
      50             :         , nType(nTempType)
      51        1208 :         , bIsStandard(false)
      52             :     {
      53        1208 :     }
      54             : };
      55             : 
      56             : struct LessNumberFormat
      57             : {
      58        3640 :     bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const
      59             :     {
      60        3640 :         return rValue1.nNumberFormat < rValue2.nNumberFormat;
      61             :     }
      62             : };
      63             : 
      64             : typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet;
      65             : 
      66             : class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
      67             : {
      68             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats;
      69             :     SvXMLExport*        pExport;
      70             :     const OUString sEmpty;
      71             :     const OUString sStandardFormat;
      72             :     const OUString sType;
      73             :     const OUString sAttrValue;
      74             :     const OUString sAttrDateValue;
      75             :     const OUString sAttrTimeValue;
      76             :     const OUString sAttrBooleanValue;
      77             :     const OUString sAttrStringValue;
      78             :     const OUString sAttrCurrency;
      79             :     const OUString msCurrencySymbol;
      80             :     const OUString msCurrencyAbbreviation;
      81             :     XMLNumberFormatSet  aNumberFormats;
      82             : public :
      83             :     XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier);
      84             :     XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier,
      85             :                                             SvXMLExport& rExport );
      86             :     ~XMLNumberFormatAttributesExportHelper();
      87             :     void SetExport(SvXMLExport* pExp) { this->pExport = pExp; }
      88             : 
      89             :     sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString& sCurrency, bool& bIsStandard);
      90             :     static void WriteAttributes(SvXMLExport& rXMLExport,
      91             :                                 const sal_Int16 nTypeKey,
      92             :                                 const double& rValue,
      93             :                                 const OUString& rCurrencySymbol,
      94             :                                 bool bExportValue = true);
      95             :     static bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol,
      96             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
      97             :     static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard,
      98             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
      99             :     static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
     100             :                                           const sal_Int32 nNumberFormat,
     101             :                                           const double& rValue,
     102             :                                           bool bExportValue = true);
     103             :     static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
     104             :                                           const OUString& rValue,
     105             :                                           const OUString& rCharacters,
     106             :                                           bool bExportValue = true,
     107             :                                           bool bExportTypeAttribute = true);
     108             : 
     109             :     bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol);
     110             :     sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard);
     111             :     void WriteAttributes(const sal_Int16 nTypeKey,
     112             :                                           const double& rValue,
     113             :                                           const OUString& rCurrencySymbol,
     114             :                                           bool bExportValue = true, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
     115             :     void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
     116             :                                           const double& rValue,
     117             :                                           bool bExportValue = true,
     118             :                                           sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true);
     119             :     void SetNumberFormatAttributes(const OUString& rValue,
     120             :                                           const OUString& rCharacters,
     121             :                                           bool bExportValue = true,
     122             :                                           bool bExportTypeAttribute = true,
     123             :                                           sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
     124             : };
     125             : 
     126             : #endif
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11