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

Generated by: LCOV version 1.10