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

Generated by: LCOV version 1.10