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 #pragma once
21 
22 #include <global.hxx>
23 #include <detfunc.hxx>
24 #include <detdata.hxx>
25 #include <rtl/ustrbuf.hxx>
26 #include <com/sun/star/sheet/ConditionOperator.hpp>
27 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
28 #include <com/sun/star/sheet/GeneralFunction.hpp>
29 #include <com/sun/star/sheet/ValidationType.hpp>
30 
31 namespace com::sun::star::frame { class XModel; }
32 
33 class ScDocument;
34 class DateTime;
35 enum class ScGeneralFunction;
36 
38 {
39 public:
40  ScXMLConverter() = delete;
41 
42 // helper methods
43  static ScDocument* GetScDocument(
44  const css::uno::Reference< css::frame::XModel >& xModel );
45 
46 // IMPORT: GeneralFunction / ScSubTotalFunc
47  static css::sheet::GeneralFunction
49  std::u16string_view rString );
50  static ScGeneralFunction
52  std::u16string_view rString );
53 
55  std::u16string_view rString );
56 
57 // EXPORT: GeneralFunctio2 / ScSubTotalFunc
58  static void GetStringFromFunction(
59  OUString& rString,
60  const sal_Int16 eFunction );
61  static void GetStringFromFunction(
62  OUString& rString,
63  const ScSubTotalFunc eFunction );
64 
65 // IMPORT: DataPilotFieldOrientation
66  static css::sheet::DataPilotFieldOrientation
68  std::u16string_view rString );
69 
70 // EXPORT: DataPilotFieldOrientation
71  static void GetStringFromOrientation(
72  OUString& rString,
73  const css::sheet::DataPilotFieldOrientation eOrientation );
74 
75 // IMPORT: Detective
76  static ScDetectiveObjType
78  std::u16string_view rString );
79  static bool GetDetOpTypeFromString(
80  ScDetOpType& rDetOpType,
81  std::u16string_view rString );
82 
83 // EXPORT: Detective
84  static void GetStringFromDetObjType(
85  OUString& rString,
86  const ScDetectiveObjType eObjType );
87  static void GetStringFromDetOpType(
88  OUString& rString,
89  const ScDetOpType eOpType );
90 
91 // IMPORT: Formulas
92  static void ConvertCellRangeAddress(
93  OUString& sFormula);
94 // EXPORT: Core Date Time
95  static void ConvertDateTimeToString(const DateTime& aDateTime, OUStringBuffer& sDate);
96 
97 };
98 
100 {
115 };
116 
121 {
123  css::sheet::ValidationType
125  css::sheet::ConditionOperator
127  OUString maOperand1;
128  OUString maOperand2;
129  sal_Int32 mnEndIndex;
130 };
131 
133 {
137  void parseCondition(
138  ScXMLConditionParseResult& rParseResult,
139  const OUString& rAttribute,
140  sal_Int32 nStartIndex );
141 
142  OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
143 }
144 
145 /* 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:38
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:27
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:844
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)