LibreOffice Module sc (master) 1
fmtuno.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 <vector>
23
24#include <formula/grammar.hxx>
25#include <rtl/ref.hxx>
26#include <svl/itemprop.hxx>
27#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
28#include <com/sun/star/sheet/XSheetCondition2.hpp>
29#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
30#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <com/sun/star/container/XNameAccess.hpp>
32#include <com/sun/star/container/XEnumerationAccess.hpp>
33#include <com/sun/star/beans/XPropertySet.hpp>
34
35#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
36#include <com/sun/star/sheet/FormulaToken.hpp>
39
40#include "address.hxx"
41#include "conditio.hxx"
42
43class ScDocument;
46
48{
49 css::uno::Sequence< css::sheet::FormulaToken > maTokens1;
50 css::uno::Sequence< css::sheet::FormulaToken > maTokens2;
51 OUString maExpr1;
52 OUString maExpr2;
53 OUString maExprNmsp1;
54 OUString maExprNmsp2;
55 OUString maPosStr; // formula position as text
56 OUString maStyle; // display name as stored in ScStyleSheet
58 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1
59 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2
61
62 // Make sure the grammar is initialized for API calls.
64};
65
66class ScTableConditionalFormat final : public cppu::WeakImplHelper<
67 css::sheet::XSheetConditionalEntries,
68 css::container::XNameAccess,
69 css::container::XEnumerationAccess,
70 css::lang::XServiceInfo >
71{
72private:
73 std::vector<rtl::Reference<ScTableConditionalEntry>> maEntries;
74
75 ScTableConditionalEntry* GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
76 void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
77public:
81 virtual ~ScTableConditionalFormat() override;
82
83 void FillFormat( ScConditionalFormat& rFormat, ScDocument& rDoc,
85
86 // XSheetConditionalEntries
87 virtual void SAL_CALL addNew( const css::uno::Sequence< css::beans::PropertyValue >& aConditionalEntry ) override;
88 virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) override;
89 virtual void SAL_CALL clear() override;
90
91 // XIndexAccess
92 virtual sal_Int32 SAL_CALL getCount() override;
93 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
94
95 // XNameAccess
96 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
97 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
98 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
99
100 // XEnumerationAccess
101 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
102 createEnumeration() override;
103
104 // XElementAccess
105 virtual css::uno::Type SAL_CALL getElementType() override;
106 virtual sal_Bool SAL_CALL hasElements() override;
107
108 // XServiceInfo
109 virtual OUString SAL_CALL getImplementationName() override;
110 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
111 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
112};
113
114class ScTableConditionalEntry final : public cppu::WeakImplHelper<
115 css::sheet::XSheetCondition2,
116 css::sheet::XSheetConditionalEntry,
117 css::lang::XServiceInfo >
118{
119private:
121
122public:
125 virtual ~ScTableConditionalEntry() override;
126
127 void GetData(ScCondFormatEntryItem& rData) const;
128
129 // XSheetCondition
130 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
131 virtual sal_Int32 SAL_CALL getConditionOperator() override;
132 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
133 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
134 virtual OUString SAL_CALL getFormula1() override;
135 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
136 virtual OUString SAL_CALL getFormula2() override;
137 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
138 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
139 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
140
141 // XSheetConditionalEntry
142 virtual OUString SAL_CALL getStyleName() override;
143 virtual void SAL_CALL setStyleName( const OUString& aStyleName ) override;
144
145 // XServiceInfo
146 virtual OUString SAL_CALL getImplementationName() override;
147 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
148 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
149};
150
151class ScTableValidationObj final : public cppu::WeakImplHelper<
152 css::sheet::XSheetCondition2,
153 css::sheet::XMultiFormulaTokens,
154 css::beans::XPropertySet,
155 css::lang::XServiceInfo >
156{
157private:
160 OUString aExpr1;
161 OUString aExpr2;
162 OUString maExprNmsp1;
163 OUString maExprNmsp2;
164 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2
165 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2
166 css::uno::Sequence< css::sheet::FormulaToken > aTokens1;
167 css::uno::Sequence< css::sheet::FormulaToken > aTokens2;
169 OUString aPosString; // formula position as text
170 sal_uInt16 nValMode; // enum ScValidationMode
172 sal_Int16 nShowList;
174 OUString aInputTitle;
177 sal_uInt16 nErrorStyle; // enum ScValidErrorStyle
178 OUString aErrorTitle;
180
181 void ClearData_Impl();
182
183public:
184
186 ScTableValidationObj(const ScDocument& rDoc, sal_uInt32 nKey,
187 const formula::FormulaGrammar::Grammar eGrammar);
188 virtual ~ScTableValidationObj() override;
189
191 formula::FormulaGrammar::Grammar eGrammar ) const;
192
193 // XSheetCondition
194 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
195 virtual sal_Int32 SAL_CALL getConditionOperator() override;
196 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
197 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
198 virtual OUString SAL_CALL getFormula1() override;
199 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
200 virtual OUString SAL_CALL getFormula2() override;
201 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
202 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
203 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
204
205 // XMultiFormulaTokens
206 virtual css::uno::Sequence< css::sheet::FormulaToken >
207 SAL_CALL getTokens( sal_Int32 nIndex ) override;
208 virtual void SAL_CALL setTokens( sal_Int32 nIndex,
209 const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
210 virtual sal_Int32 SAL_CALL getCount() override;
211
212 // XPropertySet
213 virtual css::uno::Reference< css::beans::XPropertySetInfo >
214 SAL_CALL getPropertySetInfo() override;
215 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
216 const css::uno::Any& aValue ) override;
217 virtual css::uno::Any SAL_CALL getPropertyValue(
218 const OUString& PropertyName ) override;
219 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
220 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
221 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
222 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
223 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
224 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
225 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
226 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
227
228 // XServiceInfo
229 virtual OUString SAL_CALL getImplementationName() override;
230 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
231 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
232};
233
234/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Int32 SAL_CALL getConditionOperator() override
Definition: fmtuno.cxx:477
virtual void SAL_CALL setStyleName(const OUString &aStyleName) override
Definition: fmtuno.cxx:537
ScCondFormatEntryItem aData
Definition: fmtuno.hxx:120
virtual void SAL_CALL setSourcePosition(const css::table::CellAddress &aSourcePosition) override
Definition: fmtuno.cxx:523
virtual OUString SAL_CALL getFormula1() override
Definition: fmtuno.cxx:489
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ~ScTableConditionalEntry() override
Definition: fmtuno.cxx:454
virtual void SAL_CALL setOperator(css::sheet::ConditionOperator nOperator) override
Definition: fmtuno.cxx:471
virtual void SAL_CALL setFormula1(const OUString &aFormula1) override
Definition: fmtuno.cxx:495
virtual void SAL_CALL setFormula2(const OUString &aFormula2) override
Definition: fmtuno.cxx:507
virtual void SAL_CALL setConditionOperator(sal_Int32 nOperator) override
Definition: fmtuno.cxx:483
virtual OUString SAL_CALL getFormula2() override
Definition: fmtuno.cxx:501
virtual OUString SAL_CALL getStyleName() override
Definition: fmtuno.cxx:531
virtual css::table::CellAddress SAL_CALL getSourcePosition() override
Definition: fmtuno.cxx:513
virtual css::sheet::ConditionOperator SAL_CALL getOperator() override
Definition: fmtuno.cxx:465
ScTableConditionalEntry()=delete
void GetData(ScCondFormatEntryItem &rData) const
Definition: fmtuno.cxx:458
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL addNew(const css::uno::Sequence< css::beans::PropertyValue > &aConditionalEntry) override
Definition: fmtuno.cxx:251
std::vector< rtl::Reference< ScTableConditionalEntry > > maEntries
Definition: fmtuno.hxx:73
virtual OUString SAL_CALL getImplementationName() override
void FillFormat(ScConditionalFormat &rFormat, ScDocument &rDoc, formula::FormulaGrammar::Grammar eGrammar) const
Definition: fmtuno.cxx:196
virtual ~ScTableConditionalFormat() override
Definition: fmtuno.cxx:234
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: fmtuno.cxx:423
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: fmtuno.cxx:404
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: fmtuno.cxx:436
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: fmtuno.cxx:360
virtual void SAL_CALL clear() override
Definition: fmtuno.cxx:352
ScTableConditionalEntry * GetObjectByIndex_Impl(sal_uInt16 nIndex) const
Definition: fmtuno.cxx:246
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: fmtuno.cxx:374
void AddEntry_Impl(const ScCondFormatEntryItem &aEntry)
Definition: fmtuno.cxx:238
virtual sal_Int32 SAL_CALL getCount() override
Definition: fmtuno.cxx:368
virtual css::uno::Type SAL_CALL getElementType() override
Definition: fmtuno.cxx:384
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex) override
Definition: fmtuno.cxx:342
virtual sal_Bool SAL_CALL hasElements() override
Definition: fmtuno.cxx:389
ScTableConditionalFormat(const ScDocument *pDoc, sal_uLong nKey, SCTAB nTab, formula::FormulaGrammar::Grammar eGrammar)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
ScValidationData * CreateValidationData(ScDocument &rDoc, formula::FormulaGrammar::Grammar eGrammar) const
Definition: fmtuno.cxx:582
virtual css::sheet::ConditionOperator SAL_CALL getOperator() override
Definition: fmtuno.cxx:653
virtual void SAL_CALL setTokens(sal_Int32 nIndex, const css::uno::Sequence< css::sheet::FormulaToken > &aTokens) override
Definition: fmtuno.cxx:726
ScTableValidationObj()=delete
OUString maExprNmsp2
Definition: fmtuno.hxx:163
OUString aInputTitle
Definition: fmtuno.hxx:174
virtual void SAL_CALL setFormula1(const OUString &aFormula1) override
Definition: fmtuno.cxx:683
sal_uInt16 nValMode
Definition: fmtuno.hxx:170
OUString aInputMessage
Definition: fmtuno.hxx:175
ScAddress aSrcPos
Definition: fmtuno.hxx:168
OUString aErrorMessage
Definition: fmtuno.hxx:179
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Int32 SAL_CALL getConditionOperator() override
Definition: fmtuno.cxx:665
formula::FormulaGrammar::Grammar meGrammar1
Definition: fmtuno.hxx:164
virtual void SAL_CALL setSourcePosition(const css::table::CellAddress &aSourcePosition) override
Definition: fmtuno.cxx:711
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: fmtuno.cxx:757
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: fmtuno.cxx:866
virtual sal_Int32 SAL_CALL getCount() override
Definition: fmtuno.cxx:744
virtual ~ScTableValidationObj() override
Definition: fmtuno.cxx:647
OUString aErrorTitle
Definition: fmtuno.hxx:178
virtual css::table::CellAddress SAL_CALL getSourcePosition() override
Definition: fmtuno.cxx:701
sal_Int16 nShowList
Definition: fmtuno.hxx:172
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Sequence< css::sheet::FormulaToken > aTokens1
Definition: fmtuno.hxx:166
ScConditionMode nMode
Definition: fmtuno.hxx:159
virtual OUString SAL_CALL getFormula1() override
Definition: fmtuno.cxx:677
virtual OUString SAL_CALL getFormula2() override
Definition: fmtuno.cxx:689
virtual void SAL_CALL setConditionOperator(sal_Int32 nOperator) override
Definition: fmtuno.cxx:671
sal_uInt16 nErrorStyle
Definition: fmtuno.hxx:177
css::uno::Sequence< css::sheet::FormulaToken > aTokens2
Definition: fmtuno.hxx:167
OUString maExprNmsp1
Definition: fmtuno.hxx:162
virtual void SAL_CALL setFormula2(const OUString &aFormula2) override
Definition: fmtuno.cxx:695
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: fmtuno.cxx:749
virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens(sal_Int32 nIndex) override
Definition: fmtuno.cxx:717
formula::FormulaGrammar::Grammar meGrammar2
Definition: fmtuno.hxx:165
OUString aPosString
Definition: fmtuno.hxx:169
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual void SAL_CALL setOperator(css::sheet::ConditionOperator nOperator) override
Definition: fmtuno.cxx:659
SfxItemPropertySet aPropSet
Definition: fmtuno.hxx:158
ScConditionMode
Definition: conditio.hxx:60
sal_uIntPtr sal_uLong
formula::FormulaGrammar::Grammar meGrammar2
Definition: fmtuno.hxx:59
css::uno::Sequence< css::sheet::FormulaToken > maTokens2
Definition: fmtuno.hxx:50
css::uno::Sequence< css::sheet::FormulaToken > maTokens1
Definition: fmtuno.hxx:49
formula::FormulaGrammar::Grammar meGrammar1
Definition: fmtuno.hxx:58
OUString maExprNmsp2
Definition: fmtuno.hxx:54
ScConditionMode meMode
Definition: fmtuno.hxx:60
OUString maExprNmsp1
Definition: fmtuno.hxx:53
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22