fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / xml / XMLConverter.hxx
blobcac22847bc0adaa4fcb6e99a45d597b1cdd1f47f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLCONVERTER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLCONVERTER_HXX
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>
34 class ScDocument;
35 class DateTime;
37 class ScXMLConverter
39 public:
40 inline ScXMLConverter() {}
41 inline ~ScXMLConverter() {}
43 // helper methods
44 static ScDocument* GetScDocument(
45 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel );
47 // IMPORT: GeneralFunction / ScSubTotalFunc
48 static ::com::sun::star::sheet::GeneralFunction
49 GetFunctionFromString(
50 const OUString& rString );
51 static ScSubTotalFunc GetSubTotalFuncFromString(
52 const OUString& rString );
54 // EXPORT: GeneralFunction / ScSubTotalFunc
55 static void GetStringFromFunction(
56 OUString& rString,
57 const ::com::sun::star::sheet::GeneralFunction eFunction,
58 bool bAppendStr = false );
59 static void GetStringFromFunction(
60 OUString& rString,
61 const ScSubTotalFunc eFunction,
62 bool bAppendStr = false );
64 // IMPORT: DataPilotFieldOrientation
65 static ::com::sun::star::sheet::DataPilotFieldOrientation
66 GetOrientationFromString(
67 const OUString& rString );
69 // EXPORT: DataPilotFieldOrientation
70 static void GetStringFromOrientation(
71 OUString& rString,
72 const ::com::sun::star::sheet::DataPilotFieldOrientation eOrientation,
73 bool bAppendStr = false );
75 // IMPORT: Detective
76 static ScDetectiveObjType
77 GetDetObjTypeFromString(
78 const OUString& rString );
79 static bool GetDetOpTypeFromString(
80 ScDetOpType& rDetOpType,
81 const OUString& rString );
83 // EXPORT: Detective
84 static void GetStringFromDetObjType(
85 OUString& rString,
86 const ScDetectiveObjType eObjType,
87 bool bAppendStr = false );
88 static void GetStringFromDetOpType(
89 OUString& rString,
90 const ScDetOpType eOpType,
91 bool bAppendStr = false );
93 // IMPORT: Formulas
94 static void ParseFormula(
95 OUString& sFormula,
96 const bool bIsFormula = true);
97 // EXPORT: Core Date Time
98 static void ConvertDateTimeToString(const DateTime& aDateTime, OUStringBuffer& sDate);
102 enum ScXMLConditionToken
104 XML_COND_INVALID, /// Token not recognized.
105 XML_COND_AND, /// The 'and' token.
106 XML_COND_CELLCONTENT, /// The 'cell-content' token.
107 XML_COND_ISBETWEEN, /// The 'cell-content-is-between' token.
108 XML_COND_ISNOTBETWEEN, /// The 'cell-content-is-not-between' token.
109 XML_COND_ISWHOLENUMBER, /// The 'cell-content-is-whole-number' token.
110 XML_COND_ISDECIMALNUMBER, /// The 'cell-content-is-decimal-number' token.
111 XML_COND_ISDATE, /// The 'cell-content-is-date' token.
112 XML_COND_ISTIME, /// The 'cell-content-is-time' token.
113 XML_COND_ISINLIST, /// The 'cell-content-is-in-list' token.
114 XML_COND_TEXTLENGTH, /// The 'cell-content-text-length' token.
115 XML_COND_TEXTLENGTH_ISBETWEEN, /// The 'cell-content-text-length-is-between' token.
116 XML_COND_TEXTLENGTH_ISNOTBETWEEN, /// The 'cell-content-text-length-is-not-between' token.
117 XML_COND_ISTRUEFORMULA /// The 'is-true-formula' token.
120 /** Result of an attempt to parse a single condition in a 'condition' attribute
121 value of e.g. conditional formatting or data validation.
123 struct ScXMLConditionParseResult
125 ScXMLConditionToken meToken; /// The leading condition token.
126 ::com::sun::star::sheet::ValidationType
127 meValidation; /// A data validation type if existing.
128 ::com::sun::star::sheet::ConditionOperator
129 meOperator; /// A comparison operator if existing.
130 OUString maOperand1; /// First operand of the token or comparison value.
131 OUString maOperand2; /// Second operand of 'between' conditions.
132 sal_Int32 mnEndIndex; /// Index of first character following the condition.
135 namespace ScXMLConditionHelper
137 /** Parses the next condition in a 'condition' attribute value of e.g.
138 conditional formatting or data validation.
140 void parseCondition(
141 ScXMLConditionParseResult& rParseResult,
142 const OUString& rAttribute,
143 sal_Int32 nStartIndex );
145 OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
148 #endif
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */