LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/xml - XMLConverter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 Functions: 2 2 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 SC_XMLCONVERTER_HXX
      21             : #define SC_XMLCONVERTER_HXX
      22             : 
      23             : #include "global.hxx"
      24             : #include "detfunc.hxx"
      25             : #include "detdata.hxx"
      26             : #include <rtl/ustrbuf.hxx>
      27             : #include <com/sun/star/frame/XModel.hpp>
      28             : #include <com/sun/star/sheet/ConditionOperator.hpp>
      29             : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
      30             : #include <com/sun/star/sheet/GeneralFunction.hpp>
      31             : #include <com/sun/star/sheet/ValidationType.hpp>
      32             : #include <com/sun/star/util/DateTime.hpp>
      33             : 
      34             : class ScDocument;
      35             : class DateTime;
      36             : 
      37             : 
      38             : //___________________________________________________________________
      39             : 
      40             : class ScXMLConverter
      41             : {
      42             : public:
      43             :     inline              ScXMLConverter()    {}
      44             :     inline              ~ScXMLConverter()   {}
      45             : 
      46             : // helper methods
      47             :     static ScDocument*  GetScDocument(
      48             :                             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel );
      49             : 
      50             : // IMPORT: GeneralFunction / ScSubTotalFunc
      51             :     static ::com::sun::star::sheet::GeneralFunction
      52             :                         GetFunctionFromString(
      53             :                             const ::rtl::OUString& rString );
      54             :     static ScSubTotalFunc GetSubTotalFuncFromString(
      55             :                             const ::rtl::OUString& rString );
      56             : 
      57             : // EXPORT: GeneralFunction / ScSubTotalFunc
      58             :     static void         GetStringFromFunction(
      59             :                             ::rtl::OUString& rString,
      60             :                             const ::com::sun::star::sheet::GeneralFunction eFunction,
      61             :                             bool bAppendStr = false );
      62             :     static void         GetStringFromFunction(
      63             :                             ::rtl::OUString& rString,
      64             :                             const ScSubTotalFunc eFunction,
      65             :                             bool bAppendStr = false );
      66             : 
      67             : // IMPORT: DataPilotFieldOrientation
      68             :     static ::com::sun::star::sheet::DataPilotFieldOrientation
      69             :                         GetOrientationFromString(
      70             :                             const ::rtl::OUString& rString );
      71             : 
      72             : // EXPORT: DataPilotFieldOrientation
      73             :     static void         GetStringFromOrientation(
      74             :                             ::rtl::OUString& rString,
      75             :                             const ::com::sun::star::sheet::DataPilotFieldOrientation eOrientation,
      76             :                             bool bAppendStr = false );
      77             : 
      78             : // IMPORT: Detective
      79             :     static ScDetectiveObjType
      80             :                         GetDetObjTypeFromString(
      81             :                             const ::rtl::OUString& rString );
      82             :     static bool         GetDetOpTypeFromString(
      83             :                             ScDetOpType& rDetOpType,
      84             :                             const ::rtl::OUString& rString );
      85             : 
      86             : // EXPORT: Detective
      87             :     static void         GetStringFromDetObjType(
      88             :                             ::rtl::OUString& rString,
      89             :                             const ScDetectiveObjType eObjType,
      90             :                             bool bAppendStr = false );
      91             :     static void         GetStringFromDetOpType(
      92             :                             ::rtl::OUString& rString,
      93             :                             const ScDetOpType eOpType,
      94             :                             bool bAppendStr = false );
      95             : 
      96             : // IMPORT: Formulas
      97             :     static void         ParseFormula(
      98             :                             ::rtl::OUString& sFormula,
      99             :                             const bool bIsFormula = sal_True);
     100             : // EXPORT: Core Date Time
     101             :     static void         ConvertDateTimeToString(const DateTime& aDateTime, rtl::OUStringBuffer& sDate);
     102             :     static void         ConvertCoreToAPIDateTime(const DateTime& aDateTime, com::sun::star::util::DateTime& rDateTime);
     103             : 
     104             :     static void         ConvertAPIToCoreDateTime(const com::sun::star::util::DateTime& aDateTime, DateTime& rDateTime);
     105             : };
     106             : 
     107             : // ============================================================================
     108             : 
     109             : enum ScXMLConditionToken
     110             : {
     111             :     XML_COND_INVALID,                       /// Token not recognized.
     112             :     XML_COND_AND,                           /// The 'and' token.
     113             :     XML_COND_CELLCONTENT,                   /// The 'cell-content' token.
     114             :     XML_COND_ISBETWEEN,                     /// The 'cell-content-is-between' token.
     115             :     XML_COND_ISNOTBETWEEN,                  /// The 'cell-content-is-not-between' token.
     116             :     XML_COND_ISWHOLENUMBER,                 /// The 'cell-content-is-whole-number' token.
     117             :     XML_COND_ISDECIMALNUMBER,               /// The 'cell-content-is-decimal-number' token.
     118             :     XML_COND_ISDATE,                        /// The 'cell-content-is-date' token.
     119             :     XML_COND_ISTIME,                        /// The 'cell-content-is-time' token.
     120             :     XML_COND_ISINLIST,                      /// The 'cell-content-is-in-list' token.
     121             :     XML_COND_TEXTLENGTH,                    /// The 'cell-content-text-length' token.
     122             :     XML_COND_TEXTLENGTH_ISBETWEEN,          /// The 'cell-content-text-length-is-between' token.
     123             :     XML_COND_TEXTLENGTH_ISNOTBETWEEN,       /// The 'cell-content-text-length-is-not-between' token.
     124             :     XML_COND_ISTRUEFORMULA                  /// The 'is-true-formula' token.
     125             : };
     126             : 
     127             : // ----------------------------------------------------------------------------
     128             : 
     129             : /** Result of an attempt to parse a single condition in a 'condition' attribute
     130             :     value of e.g. conditional formatting or data validation.
     131             :  */
     132          26 : struct ScXMLConditionParseResult
     133             : {
     134             :     ScXMLConditionToken meToken;            /// The leading condition token.
     135             :     ::com::sun::star::sheet::ValidationType
     136             :                         meValidation;       /// A data validation type if existing.
     137             :     ::com::sun::star::sheet::ConditionOperator
     138             :                         meOperator;         /// A comparison operator if existing.
     139             :     ::rtl::OUString     maOperand1;         /// First operand of the token or comparison value.
     140             :     ::rtl::OUString     maOperand2;         /// Second operand of 'between' conditions.
     141             :     sal_Int32           mnEndIndex;         /// Index of first character following the condition.
     142             : };
     143             : 
     144             : // ----------------------------------------------------------------------------
     145             : 
     146             : class ScXMLConditionHelper
     147             : {
     148             : public:
     149             :     /** Parses the next condition in a 'condition' attribute value of e.g.
     150             :         conditional formatting or data validation.
     151             :      */
     152             :     static void         parseCondition(
     153             :                             ScXMLConditionParseResult& rParseResult,
     154             :                             const ::rtl::OUString& rAttribute,
     155             :                             sal_Int32 nStartIndex );
     156             : 
     157             :     static rtl::OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
     158             : 
     159             : private:
     160             :                         ScXMLConditionHelper();
     161             :                         ~ScXMLConditionHelper();
     162             : };
     163             : 
     164             : // ============================================================================
     165             : 
     166             : #endif
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10