LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLConverter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_XMLCONVERTER_HXX
      30                 :            : #define SC_XMLCONVERTER_HXX
      31                 :            : 
      32                 :            : #include "global.hxx"
      33                 :            : #include "detfunc.hxx"
      34                 :            : #include "detdata.hxx"
      35                 :            : #include <rtl/ustrbuf.hxx>
      36                 :            : #include <com/sun/star/frame/XModel.hpp>
      37                 :            : #include <com/sun/star/sheet/ConditionOperator.hpp>
      38                 :            : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
      39                 :            : #include <com/sun/star/sheet/GeneralFunction.hpp>
      40                 :            : #include <com/sun/star/sheet/ValidationType.hpp>
      41                 :            : #include <com/sun/star/util/DateTime.hpp>
      42                 :            : 
      43                 :            : class ScDocument;
      44                 :            : class DateTime;
      45                 :            : 
      46                 :            : 
      47                 :            : //___________________________________________________________________
      48                 :            : 
      49                 :            : class ScXMLConverter
      50                 :            : {
      51                 :            : public:
      52                 :            :     inline              ScXMLConverter()    {}
      53                 :            :     inline              ~ScXMLConverter()   {}
      54                 :            : 
      55                 :            : // helper methods
      56                 :            :     static ScDocument*  GetScDocument(
      57                 :            :                             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel );
      58                 :            : 
      59                 :            : // IMPORT: GeneralFunction / ScSubTotalFunc
      60                 :            :     static ::com::sun::star::sheet::GeneralFunction
      61                 :            :                         GetFunctionFromString(
      62                 :            :                             const ::rtl::OUString& rString );
      63                 :            :     static ScSubTotalFunc GetSubTotalFuncFromString(
      64                 :            :                             const ::rtl::OUString& rString );
      65                 :            : 
      66                 :            : // EXPORT: GeneralFunction / ScSubTotalFunc
      67                 :            :     static void         GetStringFromFunction(
      68                 :            :                             ::rtl::OUString& rString,
      69                 :            :                             const ::com::sun::star::sheet::GeneralFunction eFunction,
      70                 :            :                             bool bAppendStr = false );
      71                 :            :     static void         GetStringFromFunction(
      72                 :            :                             ::rtl::OUString& rString,
      73                 :            :                             const ScSubTotalFunc eFunction,
      74                 :            :                             bool bAppendStr = false );
      75                 :            : 
      76                 :            : // IMPORT: DataPilotFieldOrientation
      77                 :            :     static ::com::sun::star::sheet::DataPilotFieldOrientation
      78                 :            :                         GetOrientationFromString(
      79                 :            :                             const ::rtl::OUString& rString );
      80                 :            : 
      81                 :            : // EXPORT: DataPilotFieldOrientation
      82                 :            :     static void         GetStringFromOrientation(
      83                 :            :                             ::rtl::OUString& rString,
      84                 :            :                             const ::com::sun::star::sheet::DataPilotFieldOrientation eOrientation,
      85                 :            :                             bool bAppendStr = false );
      86                 :            : 
      87                 :            : // IMPORT: Detective
      88                 :            :     static ScDetectiveObjType
      89                 :            :                         GetDetObjTypeFromString(
      90                 :            :                             const ::rtl::OUString& rString );
      91                 :            :     static bool         GetDetOpTypeFromString(
      92                 :            :                             ScDetOpType& rDetOpType,
      93                 :            :                             const ::rtl::OUString& rString );
      94                 :            : 
      95                 :            : // EXPORT: Detective
      96                 :            :     static void         GetStringFromDetObjType(
      97                 :            :                             ::rtl::OUString& rString,
      98                 :            :                             const ScDetectiveObjType eObjType,
      99                 :            :                             bool bAppendStr = false );
     100                 :            :     static void         GetStringFromDetOpType(
     101                 :            :                             ::rtl::OUString& rString,
     102                 :            :                             const ScDetOpType eOpType,
     103                 :            :                             bool bAppendStr = false );
     104                 :            : 
     105                 :            : // IMPORT: Formulas
     106                 :            :     static void         ParseFormula(
     107                 :            :                             ::rtl::OUString& sFormula,
     108                 :            :                             const bool bIsFormula = sal_True);
     109                 :            : // EXPORT: Core Date Time
     110                 :            :     static void         ConvertDateTimeToString(const DateTime& aDateTime, rtl::OUStringBuffer& sDate);
     111                 :            :     static void         ConvertCoreToAPIDateTime(const DateTime& aDateTime, com::sun::star::util::DateTime& rDateTime);
     112                 :            : 
     113                 :            :     static void         ConvertAPIToCoreDateTime(const com::sun::star::util::DateTime& aDateTime, DateTime& rDateTime);
     114                 :            : };
     115                 :            : 
     116                 :            : // ============================================================================
     117                 :            : 
     118                 :            : enum ScXMLConditionToken
     119                 :            : {
     120                 :            :     XML_COND_INVALID,                       /// Token not recognized.
     121                 :            :     XML_COND_AND,                           /// The 'and' token.
     122                 :            :     XML_COND_CELLCONTENT,                   /// The 'cell-content' token.
     123                 :            :     XML_COND_ISBETWEEN,                     /// The 'cell-content-is-between' token.
     124                 :            :     XML_COND_ISNOTBETWEEN,                  /// The 'cell-content-is-not-between' token.
     125                 :            :     XML_COND_ISWHOLENUMBER,                 /// The 'cell-content-is-whole-number' token.
     126                 :            :     XML_COND_ISDECIMALNUMBER,               /// The 'cell-content-is-decimal-number' token.
     127                 :            :     XML_COND_ISDATE,                        /// The 'cell-content-is-date' token.
     128                 :            :     XML_COND_ISTIME,                        /// The 'cell-content-is-time' token.
     129                 :            :     XML_COND_ISINLIST,                      /// The 'cell-content-is-in-list' token.
     130                 :            :     XML_COND_TEXTLENGTH,                    /// The 'cell-content-text-length' token.
     131                 :            :     XML_COND_TEXTLENGTH_ISBETWEEN,          /// The 'cell-content-text-length-is-between' token.
     132                 :            :     XML_COND_TEXTLENGTH_ISNOTBETWEEN,       /// The 'cell-content-text-length-is-not-between' token.
     133                 :            :     XML_COND_ISTRUEFORMULA                  /// The 'is-true-formula' token.
     134                 :            : };
     135                 :            : 
     136                 :            : // ----------------------------------------------------------------------------
     137                 :            : 
     138                 :            : /** Result of an attempt to parse a single condition in a 'condition' attribute
     139                 :            :     value of e.g. conditional formatting or data validation.
     140                 :            :  */
     141                 :         78 : struct ScXMLConditionParseResult
     142                 :            : {
     143                 :            :     ScXMLConditionToken meToken;            /// The leading condition token.
     144                 :            :     ::com::sun::star::sheet::ValidationType
     145                 :            :                         meValidation;       /// A data validation type if existing.
     146                 :            :     ::com::sun::star::sheet::ConditionOperator
     147                 :            :                         meOperator;         /// A comparison operator if existing.
     148                 :            :     ::rtl::OUString     maOperand1;         /// First operand of the token or comparison value.
     149                 :            :     ::rtl::OUString     maOperand2;         /// Second operand of 'between' conditions.
     150                 :            :     sal_Int32           mnEndIndex;         /// Index of first character following the condition.
     151                 :            : };
     152                 :            : 
     153                 :            : // ----------------------------------------------------------------------------
     154                 :            : 
     155                 :            : class ScXMLConditionHelper
     156                 :            : {
     157                 :            : public:
     158                 :            :     /** Parses the next condition in a 'condition' attribute value of e.g.
     159                 :            :         conditional formatting or data validation.
     160                 :            :      */
     161                 :            :     static void         parseCondition(
     162                 :            :                             ScXMLConditionParseResult& rParseResult,
     163                 :            :                             const ::rtl::OUString& rAttribute,
     164                 :            :                             sal_Int32 nStartIndex );
     165                 :            : 
     166                 :            :     static rtl::OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
     167                 :            : 
     168                 :            : private:
     169                 :            :                         ScXMLConditionHelper();
     170                 :            :                         ~ScXMLConditionHelper();
     171                 :            : };
     172                 :            : 
     173                 :            : // ============================================================================
     174                 :            : 
     175                 :            : #endif
     176                 :            : 
     177                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10