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/lang/XUnoTunnel.hpp>
34#include <com/sun/star/beans/XPropertySet.hpp>
35
36#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
37#include <com/sun/star/sheet/FormulaToken.hpp>
40
41#include "address.hxx"
42#include "conditio.hxx"
43
44class ScDocument;
47
49{
50 css::uno::Sequence< css::sheet::FormulaToken > maTokens1;
51 css::uno::Sequence< css::sheet::FormulaToken > maTokens2;
52 OUString maExpr1;
53 OUString maExpr2;
54 OUString maExprNmsp1;
55 OUString maExprNmsp2;
56 OUString maPosStr; // formula position as text
57 OUString maStyle; // display name as stored in ScStyleSheet
59 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1
60 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2
62
63 // Make sure the grammar is initialized for API calls.
65};
66
67class ScTableConditionalFormat final : public cppu::WeakImplHelper<
68 css::sheet::XSheetConditionalEntries,
69 css::container::XNameAccess,
70 css::container::XEnumerationAccess,
71 css::lang::XUnoTunnel,
72 css::lang::XServiceInfo >
73{
74private:
75 std::vector<rtl::Reference<ScTableConditionalEntry>> maEntries;
76
77 ScTableConditionalEntry* GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
78 void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
79public:
83 virtual ~ScTableConditionalFormat() override;
84
85 void FillFormat( ScConditionalFormat& rFormat, ScDocument& rDoc,
87
88 // XSheetConditionalEntries
89 virtual void SAL_CALL addNew( const css::uno::Sequence< css::beans::PropertyValue >& aConditionalEntry ) override;
90 virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) override;
91 virtual void SAL_CALL clear() override;
92
93 // XIndexAccess
94 virtual sal_Int32 SAL_CALL getCount() override;
95 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
96
97 // XNameAccess
98 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
99 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
100 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
101
102 // XEnumerationAccess
103 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
104 createEnumeration() override;
105
106 // XElementAccess
107 virtual css::uno::Type SAL_CALL getElementType() override;
108 virtual sal_Bool SAL_CALL hasElements() override;
109
110 // XUnoTunnel
112
113 // XServiceInfo
114 virtual OUString SAL_CALL getImplementationName() override;
115 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
116 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
117};
118
119class ScTableConditionalEntry final : public cppu::WeakImplHelper<
120 css::sheet::XSheetCondition2,
121 css::sheet::XSheetConditionalEntry,
122 css::lang::XServiceInfo >
123{
124private:
126
127public:
130 virtual ~ScTableConditionalEntry() override;
131
132 void GetData(ScCondFormatEntryItem& rData) const;
133
134 // XSheetCondition
135 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
136 virtual sal_Int32 SAL_CALL getConditionOperator() override;
137 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
138 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
139 virtual OUString SAL_CALL getFormula1() override;
140 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
141 virtual OUString SAL_CALL getFormula2() override;
142 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
143 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
144 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
145
146 // XSheetConditionalEntry
147 virtual OUString SAL_CALL getStyleName() override;
148 virtual void SAL_CALL setStyleName( const OUString& aStyleName ) override;
149
150 // XServiceInfo
151 virtual OUString SAL_CALL getImplementationName() override;
152 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
153 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
154};
155
156class ScTableValidationObj final : public cppu::WeakImplHelper<
157 css::sheet::XSheetCondition2,
158 css::sheet::XMultiFormulaTokens,
159 css::beans::XPropertySet,
160 css::lang::XUnoTunnel,
161 css::lang::XServiceInfo >
162{
163private:
166 OUString aExpr1;
167 OUString aExpr2;
168 OUString maExprNmsp1;
169 OUString maExprNmsp2;
170 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2
171 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2
172 css::uno::Sequence< css::sheet::FormulaToken > aTokens1;
173 css::uno::Sequence< css::sheet::FormulaToken > aTokens2;
175 OUString aPosString; // formula position as text
176 sal_uInt16 nValMode; // enum ScValidationMode
178 sal_Int16 nShowList;
180 OUString aInputTitle;
183 sal_uInt16 nErrorStyle; // enum ScValidErrorStyle
184 OUString aErrorTitle;
186
187 void ClearData_Impl();
188
189public:
190
192 ScTableValidationObj(const ScDocument& rDoc, sal_uLong nKey,
193 const formula::FormulaGrammar::Grammar eGrammar);
194 virtual ~ScTableValidationObj() override;
195
196 ScValidationData* CreateValidationData( ScDocument& rDoc,
197 formula::FormulaGrammar::Grammar eGrammar ) const;
198
199 // XSheetCondition
200 virtual css::sheet::ConditionOperator SAL_CALL getOperator() override;
201 virtual sal_Int32 SAL_CALL getConditionOperator() override;
202 virtual void SAL_CALL setOperator( css::sheet::ConditionOperator nOperator ) override;
203 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) override;
204 virtual OUString SAL_CALL getFormula1() override;
205 virtual void SAL_CALL setFormula1( const OUString& aFormula1 ) override;
206 virtual OUString SAL_CALL getFormula2() override;
207 virtual void SAL_CALL setFormula2( const OUString& aFormula2 ) override;
208 virtual css::table::CellAddress SAL_CALL getSourcePosition() override;
209 virtual void SAL_CALL setSourcePosition( const css::table::CellAddress& aSourcePosition ) override;
210
211 // XMultiFormulaTokens
212 virtual css::uno::Sequence< css::sheet::FormulaToken >
213 SAL_CALL getTokens( sal_Int32 nIndex ) override;
214 virtual void SAL_CALL setTokens( sal_Int32 nIndex,
215 const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
216 virtual sal_Int32 SAL_CALL getCount() override;
217
218 // XPropertySet
219 virtual css::uno::Reference< css::beans::XPropertySetInfo >
220 SAL_CALL getPropertySetInfo() override;
221 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
222 const css::uno::Any& aValue ) override;
223 virtual css::uno::Any SAL_CALL getPropertyValue(
224 const OUString& PropertyName ) override;
225 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
226 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
227 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
228 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
229 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
230 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
231 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
232 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
233
234 // XUnoTunnel
236
237 // XServiceInfo
238 virtual OUString SAL_CALL getImplementationName() override;
239 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
240 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
241};
242
243/* 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
ScCondFormatEntryItem aData
Definition: fmtuno.hxx:125
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
ScTableConditionalEntry()=delete
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:75
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
ScTableValidationObj()=delete
OUString maExprNmsp2
Definition: fmtuno.hxx:169
OUString aInputTitle
Definition: fmtuno.hxx:180
sal_uInt16 nValMode
Definition: fmtuno.hxx:176
OUString aInputMessage
Definition: fmtuno.hxx:181
ScAddress aSrcPos
Definition: fmtuno.hxx:174
OUString aErrorMessage
Definition: fmtuno.hxx:185
formula::FormulaGrammar::Grammar meGrammar1
Definition: fmtuno.hxx:170
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
OUString aErrorTitle
Definition: fmtuno.hxx:184
sal_Int16 nShowList
Definition: fmtuno.hxx:178
css::uno::Sequence< css::sheet::FormulaToken > aTokens1
Definition: fmtuno.hxx:172
ScConditionMode nMode
Definition: fmtuno.hxx:165
sal_uInt16 nErrorStyle
Definition: fmtuno.hxx:183
css::uno::Sequence< css::sheet::FormulaToken > aTokens2
Definition: fmtuno.hxx:173
OUString maExprNmsp1
Definition: fmtuno.hxx:168
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
formula::FormulaGrammar::Grammar meGrammar2
Definition: fmtuno.hxx:171
OUString aPosString
Definition: fmtuno.hxx:175
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
SfxItemPropertySet aPropSet
Definition: fmtuno.hxx:164
ScConditionMode
Definition: conditio.hxx:60
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
#define UNO3_GETIMPLEMENTATION_DECL(classname)
sal_uIntPtr sal_uLong
formula::FormulaGrammar::Grammar meGrammar2
Definition: fmtuno.hxx:60
css::uno::Sequence< css::sheet::FormulaToken > maTokens2
Definition: fmtuno.hxx:51
css::uno::Sequence< css::sheet::FormulaToken > maTokens1
Definition: fmtuno.hxx:50
formula::FormulaGrammar::Grammar meGrammar1
Definition: fmtuno.hxx:59
OUString maExprNmsp2
Definition: fmtuno.hxx:55
ScConditionMode meMode
Definition: fmtuno.hxx:61
OUString maExprNmsp1
Definition: fmtuno.hxx:54
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22