nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / filter / xml / XMLConverter.hxx
blobcbe5ec8b4b0f9b9839601bc3be52233d4024fe4d
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/sheet/ConditionOperator.hpp>
28 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29 #include <com/sun/star/sheet/GeneralFunction.hpp>
30 #include <com/sun/star/sheet/ValidationType.hpp>
32 namespace com::sun::star::frame { class XModel; }
34 class ScDocument;
35 class DateTime;
36 enum class ScGeneralFunction;
38 class ScXMLConverter
40 public:
41 ScXMLConverter() = delete;
43 // helper methods
44 static ScDocument* GetScDocument(
45 const css::uno::Reference< css::frame::XModel >& xModel );
47 // IMPORT: GeneralFunction / ScSubTotalFunc
48 static css::sheet::GeneralFunction
49 GetFunctionFromString(
50 const OUString& rString );
51 static ScGeneralFunction
52 GetFunctionFromString2(
53 const OUString& rString );
55 static ScSubTotalFunc GetSubTotalFuncFromString(
56 const OUString& rString );
58 // EXPORT: GeneralFunctio2 / ScSubTotalFunc
59 static void GetStringFromFunction(
60 OUString& rString,
61 const sal_Int16 eFunction );
62 static void GetStringFromFunction(
63 OUString& rString,
64 const ScSubTotalFunc eFunction );
66 // IMPORT: DataPilotFieldOrientation
67 static css::sheet::DataPilotFieldOrientation
68 GetOrientationFromString(
69 const OUString& rString );
71 // EXPORT: DataPilotFieldOrientation
72 static void GetStringFromOrientation(
73 OUString& rString,
74 const css::sheet::DataPilotFieldOrientation eOrientation );
76 // IMPORT: Detective
77 static ScDetectiveObjType
78 GetDetObjTypeFromString(
79 const OUString& rString );
80 static bool GetDetOpTypeFromString(
81 ScDetOpType& rDetOpType,
82 const OUString& rString );
84 // EXPORT: Detective
85 static void GetStringFromDetObjType(
86 OUString& rString,
87 const ScDetectiveObjType eObjType );
88 static void GetStringFromDetOpType(
89 OUString& rString,
90 const ScDetOpType eOpType );
92 // IMPORT: Formulas
93 static void ConvertCellRangeAddress(
94 OUString& sFormula);
95 // EXPORT: Core Date Time
96 static void ConvertDateTimeToString(const DateTime& aDateTime, OUStringBuffer& sDate);
100 enum ScXMLConditionToken
102 XML_COND_INVALID, /// Token not recognized.
103 XML_COND_AND, /// The 'and' token.
104 XML_COND_CELLCONTENT, /// The 'cell-content' token.
105 XML_COND_ISBETWEEN, /// The 'cell-content-is-between' token.
106 XML_COND_ISNOTBETWEEN, /// The 'cell-content-is-not-between' token.
107 XML_COND_ISWHOLENUMBER, /// The 'cell-content-is-whole-number' token.
108 XML_COND_ISDECIMALNUMBER, /// The 'cell-content-is-decimal-number' token.
109 XML_COND_ISDATE, /// The 'cell-content-is-date' token.
110 XML_COND_ISTIME, /// The 'cell-content-is-time' token.
111 XML_COND_ISINLIST, /// The 'cell-content-is-in-list' token.
112 XML_COND_TEXTLENGTH, /// The 'cell-content-text-length' token.
113 XML_COND_TEXTLENGTH_ISBETWEEN, /// The 'cell-content-text-length-is-between' token.
114 XML_COND_TEXTLENGTH_ISNOTBETWEEN, /// The 'cell-content-text-length-is-not-between' token.
115 XML_COND_ISTRUEFORMULA /// The 'is-true-formula' token.
118 /** Result of an attempt to parse a single condition in a 'condition' attribute
119 value of e.g. conditional formatting or data validation.
121 struct ScXMLConditionParseResult
123 ScXMLConditionToken meToken; /// The leading condition token.
124 css::sheet::ValidationType
125 meValidation; /// A data validation type if existing.
126 css::sheet::ConditionOperator
127 meOperator; /// A comparison operator if existing.
128 OUString maOperand1; /// First operand of the token or comparison value.
129 OUString maOperand2; /// Second operand of 'between' conditions.
130 sal_Int32 mnEndIndex; /// Index of first character following the condition.
132 ScXMLConditionParseResult()
133 : meToken(XML_COND_INVALID)
134 , meValidation(css::sheet::ValidationType_ANY)
135 , meOperator(css::sheet::ConditionOperator_NONE)
136 , mnEndIndex(-1)
141 namespace ScXMLConditionHelper
143 /** Parses the next condition in a 'condition' attribute value of e.g.
144 conditional formatting or data validation.
146 void parseCondition(
147 ScXMLConditionParseResult& rParseResult,
148 const OUString& rAttribute,
149 sal_Int32 nStartIndex );
151 OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
154 #endif
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */