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
31namespace com::sun::star::frame { class XModel; }
32
33class ScDocument;
34class DateTime;
35enum class ScGeneralFunction;
36
38{
39public:
40 ScXMLConverter() = delete;
41
42// helper methods
44 const css::uno::Reference< css::frame::XModel >& xModel );
45
46// IMPORT: GeneralFunction / ScSubTotalFunc
47 static css::sheet::GeneralFunction
49 std::u16string_view rString );
52 std::u16string_view rString );
53
55 std::u16string_view rString );
56
57// EXPORT: GeneralFunctio2 / ScSubTotalFunc
58 static OUString GetStringFromFunction(
59 const sal_Int16 eFunction );
60 static OUString GetStringFromFunction(
61 const ScSubTotalFunc eFunction );
62
63// IMPORT: DataPilotFieldOrientation
64 static css::sheet::DataPilotFieldOrientation
66 std::u16string_view rString );
67
68// EXPORT: DataPilotFieldOrientation
69 static OUString GetStringFromOrientation(
70 const css::sheet::DataPilotFieldOrientation eOrientation );
71
72// IMPORT: Detective
75 std::u16string_view rString );
76 static bool GetDetOpTypeFromString(
77 ScDetOpType& rDetOpType,
78 std::u16string_view rString );
79
80// EXPORT: Detective
81 static OUString GetStringFromDetObjType(
82 const ScDetectiveObjType eObjType );
83 static OUString GetStringFromDetOpType(
84 const ScDetOpType eOpType );
85
86// IMPORT: Formulas
87 static void ConvertCellRangeAddress(
88 OUString& sFormula);
89// EXPORT: Core Date Time
90 static void ConvertDateTimeToString(const DateTime& aDateTime, OUStringBuffer& sDate);
91
92};
93
95{
111
116{
118 css::sheet::ValidationType
120 css::sheet::ConditionOperator
122 OUString maOperand1;
123 OUString maOperand2;
124 sal_Int32 mnEndIndex;
125
128 , meValidation(css::sheet::ValidationType_ANY)
129 , meOperator(css::sheet::ConditionOperator_NONE)
130 , mnEndIndex(-1)
131 {
132 }
133};
134
136{
140 void parseCondition(
141 ScXMLConditionParseResult& rParseResult,
142 const OUString& rAttribute,
143 sal_Int32 nStartIndex );
144
145 OUString getExpression(const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar );
146}
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScXMLConditionToken
@ XML_COND_ISNOTBETWEEN
The 'cell-content-is-between' token.
@ XML_COND_ISTIME
The 'cell-content-is-date' token.
@ XML_COND_AND
Token not recognized.
@ XML_COND_CELLCONTENT
The 'and' token.
@ XML_COND_TEXTLENGTH
The 'cell-content-is-in-list' token.
@ XML_COND_TEXTLENGTH_ISBETWEEN
The 'cell-content-text-length' token.
@ XML_COND_ISTRUEFORMULA
The 'cell-content-text-length-is-not-between' token.
@ XML_COND_ISWHOLENUMBER
The 'cell-content-is-not-between' token.
@ XML_COND_ISINLIST
The 'cell-content-is-time' token.
@ XML_COND_ISBETWEEN
The 'cell-content' token.
@ XML_COND_ISDATE
The 'cell-content-is-decimal-number' token.
@ XML_COND_INVALID
@ XML_COND_ISDECIMALNUMBER
The 'cell-content-is-whole-number' token.
@ XML_COND_TEXTLENGTH_ISNOTBETWEEN
The 'cell-content-text-length-is-between' token.
static ScSubTotalFunc GetSubTotalFuncFromString(std::u16string_view rString)
static OUString GetStringFromOrientation(const css::sheet::DataPilotFieldOrientation eOrientation)
static OUString GetStringFromFunction(const sal_Int16 eFunction)
static void ConvertDateTimeToString(const DateTime &aDateTime, OUStringBuffer &sDate)
static css::sheet::GeneralFunction GetFunctionFromString(std::u16string_view rString)
static void ConvertCellRangeAddress(OUString &sFormula)
static css::sheet::DataPilotFieldOrientation GetOrientationFromString(std::u16string_view rString)
static ScDocument * GetScDocument(const css::uno::Reference< css::frame::XModel > &xModel)
static bool GetDetOpTypeFromString(ScDetOpType &rDetOpType, std::u16string_view rString)
ScXMLConverter()=delete
static OUString GetStringFromDetObjType(const ScDetectiveObjType eObjType)
static ScGeneralFunction GetFunctionFromString2(std::u16string_view rString)
static OUString GetStringFromDetOpType(const ScDetOpType eOpType)
static ScDetectiveObjType GetDetObjTypeFromString(std::u16string_view rString)
ScDetOpType
Definition: detdata.hxx:27
ScDetectiveObjType
Definition: detfunc.hxx:39
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
ScSubTotalFunc
Definition: global.hxx:844
void parseCondition(ScXMLConditionParseResult &rParseResult, const OUString &rAttribute, sal_Int32 nStartIndex)
Parses the next condition in a 'condition' attribute value of e.g.
OUString getExpression(const sal_Unicode *&rpcString, const sal_Unicode *pcEnd, sal_Unicode cEndChar)
Result of an attempt to parse a single condition in a 'condition' attribute value of e....
OUString maOperand2
First operand of the token or comparison value.
css::sheet::ValidationType meValidation
The leading condition token.
OUString maOperand1
A comparison operator if existing.
css::sheet::ConditionOperator meOperator
A data validation type if existing.
sal_Int32 mnEndIndex
Second operand of 'between' conditions.
ScXMLConditionParseResult()
Index of first character following the condition.
ScXMLConditionToken meToken
sal_uInt16 sal_Unicode