LibreOffice Module sc (master)  1
XMLConverter.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_FILTER_XML_XMLCONVERTER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_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/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>
31 
32 namespace com::sun::star::frame { class XModel; }
33 
34 class ScDocument;
35 class DateTime;
36 enum class ScGeneralFunction;
37 
39 {
40 public:
41  ScXMLConverter() = delete;
42 
43 // helper methods
44  static ScDocument* GetScDocument(
45  const css::uno::Reference< css::frame::XModel >& xModel );
46 
47 // IMPORT: GeneralFunction / ScSubTotalFunc
48  static css::sheet::GeneralFunction
50  std::u16string_view rString );
51  static ScGeneralFunction
53  std::u16string_view rString );
54 
56  std::u16string_view rString );
57 
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 );
65 
66 // IMPORT: DataPilotFieldOrientation
67  static css::sheet::DataPilotFieldOrientation
69  std::u16string_view rString );
70 
71 // EXPORT: DataPilotFieldOrientation
72  static void GetStringFromOrientation(
73  OUString& rString,
74  const css::sheet::DataPilotFieldOrientation eOrientation );
75 
76 // IMPORT: Detective
77  static ScDetectiveObjType
79  std::u16string_view rString );
80  static bool GetDetOpTypeFromString(
81  ScDetOpType& rDetOpType,
82  std::u16string_view rString );
83 
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 );
91 
92 // IMPORT: Formulas
93  static void ConvertCellRangeAddress(
94  OUString& sFormula);
95 // EXPORT: Core Date Time
96  static void ConvertDateTimeToString(const DateTime& aDateTime, OUStringBuffer& sDate);
97 
98 };
99 
101 {
116 };
117 
122 {
124  css::sheet::ValidationType
126  css::sheet::ConditionOperator
128  OUString maOperand1;
129  OUString maOperand2;
130  sal_Int32 mnEndIndex;
131 };
132 
134 {
138  void parseCondition(
139  ScXMLConditionParseResult& rParseResult,
140  const OUString& rAttribute,
141  sal_Int32 nStartIndex );
142 
143  OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
144 }
145 
146 #endif
147 
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Token not recognized.
The 'cell-content-is-whole-number' token.
The 'cell-content-text-length' token.
static void ConvertDateTimeToString(const DateTime &aDateTime, OUStringBuffer &sDate)
static ScSubTotalFunc GetSubTotalFuncFromString(std::u16string_view rString)
The 'cell-content-is-in-list' token.
ScXMLConditionToken
static ScDocument * GetScDocument(const css::uno::Reference< css::frame::XModel > &xModel)
css::sheet::ConditionOperator meOperator
A data validation type if existing.
Result of an attempt to parse a single condition in a 'condition' attribute value of e...
static void GetStringFromDetObjType(OUString &rString, const ScDetectiveObjType eObjType)
sal_uInt16 sal_Unicode
The 'cell-content-text-length-is-between' token.
The 'cell-content-is-decimal-number' token.
The 'cell-content-text-length-is-not-between' token.
ScXMLConditionToken meToken
ScDetectiveObjType
Definition: detfunc.hxx:39
static css::sheet::DataPilotFieldOrientation GetOrientationFromString(std::u16string_view rString)
static void ConvertCellRangeAddress(OUString &sFormula)
static ScDetectiveObjType GetDetObjTypeFromString(std::u16string_view rString)
The 'cell-content-is-time' token.
OUString maOperand2
First operand of the token or comparison value.
static bool GetDetOpTypeFromString(ScDetOpType &rDetOpType, std::u16string_view rString)
The 'cell-content' token.
OUString maOperand1
A comparison operator if existing.
static void GetStringFromDetOpType(OUString &rString, const ScDetOpType eOpType)
static css::sheet::GeneralFunction GetFunctionFromString(std::u16string_view rString)
void parseCondition(ScXMLConditionParseResult &rParseResult, const OUString &rAttribute, sal_Int32 nStartIndex)
Parses the next condition in a 'condition' attribute value of e.g.
ScDetOpType
Definition: detdata.hxx:28
static ScGeneralFunction GetFunctionFromString2(std::u16string_view rString)
OUString getExpression(const sal_Unicode *&rpcString, const sal_Unicode *pcEnd, sal_Unicode cEndChar)
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
ScXMLConverter()=delete
The 'cell-content-is-not-between' token.
The 'cell-content-is-date' token.
static void GetStringFromFunction(OUString &rString, const sal_Int16 eFunction)
Reference< XModel > xModel
The 'and' token.
The 'cell-content-is-between' token.
ScSubTotalFunc
Definition: global.hxx:846
sal_Int32 mnEndIndex
Second operand of 'between' conditions.
css::sheet::ValidationType meValidation
The leading condition token.
static void GetStringFromOrientation(OUString &rString, const css::sheet::DataPilotFieldOrientation eOrientation)