update emoji autocorrect entries from po-files
[LibreOffice.git] / sc / inc / fmtuno.hxx
blob3ee15f1dd216fdd0cba306ce6394f1bd9ba54e41
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_FMTUNO_HXX
21 #define INCLUDED_SC_INC_FMTUNO_HXX
23 #include <vector>
25 #include <formula/grammar.hxx>
26 #include <svl/itemprop.hxx>
27 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
28 #include <com/sun/star/sheet/XSheetCondition.hpp>
29 #include <com/sun/star/sheet/XSheetCondition2.hpp>
30 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/container/XEnumerationAccess.hpp>
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
38 #include <com/sun/star/sheet/FormulaToken.hpp>
39 #include <cppuhelper/implbase3.hxx>
40 #include <cppuhelper/implbase4.hxx>
41 #include <cppuhelper/implbase5.hxx>
42 #include <com/sun/star/sheet/ConditionOperator2.hpp>
44 #include "address.hxx"
45 #include "conditio.hxx"
47 class ScDocument;
48 class ScTableConditionalEntry;
49 class ScConditionalFormat;
50 class ScValidationData;
52 struct ScCondFormatEntryItem
54 css::uno::Sequence< css::sheet::FormulaToken > maTokens1;
55 css::uno::Sequence< css::sheet::FormulaToken > maTokens2;
56 OUString maExpr1;
57 OUString maExpr2;
58 OUString maExprNmsp1;
59 OUString maExprNmsp2;
60 OUString maPosStr; // formula position as text
61 OUString maStyle; // display name as stored in ScStyleSheet
62 ScAddress maPos;
63 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1
64 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2
65 ScConditionMode meMode;
67 // Make sure the grammar is initialized for API calls.
68 ScCondFormatEntryItem();
71 class ScTableConditionalFormat : public cppu::WeakImplHelper5<
72 com::sun::star::sheet::XSheetConditionalEntries,
73 com::sun::star::container::XNameAccess,
74 com::sun::star::container::XEnumerationAccess,
75 com::sun::star::lang::XUnoTunnel,
76 com::sun::star::lang::XServiceInfo >
78 private:
79 std::vector<ScTableConditionalEntry*> aEntries;
81 ScTableConditionalEntry* GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
82 void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
84 ScTableConditionalFormat(); // disable
85 public:
86 ScTableConditionalFormat(ScDocument* pDoc, sal_uLong nKey,
87 SCTAB nTab, formula::FormulaGrammar::Grammar eGrammar);
88 virtual ~ScTableConditionalFormat();
90 void FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc,
91 formula::FormulaGrammar::Grammar eGrammar) const;
93 // XSheetConditionalEntries
94 virtual void SAL_CALL addNew( const ::com::sun::star::uno::Sequence<
95 ::com::sun::star::beans::PropertyValue >& aConditionalEntry )
96 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 virtual void SAL_CALL removeByIndex( sal_Int32 nIndex )
98 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 virtual void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 // XIndexAccess
102 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
104 throw(::com::sun::star::lang::IndexOutOfBoundsException,
105 ::com::sun::star::lang::WrappedTargetException,
106 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 // XNameAccess
109 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
110 throw(::com::sun::star::container::NoSuchElementException,
111 ::com::sun::star::lang::WrappedTargetException,
112 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
114 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
116 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // XEnumerationAccess
119 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
120 createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 // XElementAccess
123 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
124 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 // XUnoTunnel
128 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
129 sal_Int8 >& aIdentifier )
130 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
133 static ScTableConditionalFormat* getImplementation(const css::uno::Reference<css::sheet::XSheetConditionalEntries>& rObj);
135 // XServiceInfo
136 virtual OUString SAL_CALL getImplementationName()
137 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
139 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
141 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 class ScTableConditionalEntry : public cppu::WeakImplHelper3<
145 com::sun::star::sheet::XSheetCondition2,
146 com::sun::star::sheet::XSheetConditionalEntry,
147 com::sun::star::lang::XServiceInfo >
149 private:
150 ScCondFormatEntryItem aData;
152 ScTableConditionalEntry(); // disabled
153 public:
154 ScTableConditionalEntry(const ScCondFormatEntryItem& aItem);
155 virtual ~ScTableConditionalEntry();
157 void GetData(ScCondFormatEntryItem& rData) const;
159 // XSheetCondition
160 virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
161 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 virtual sal_Int32 SAL_CALL getConditionOperator()
163 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
165 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator )
167 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 virtual OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 virtual void SAL_CALL setFormula1( const OUString& aFormula1 )
170 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 virtual OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 virtual void SAL_CALL setFormula2( const OUString& aFormula2 )
173 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition()
175 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition )
177 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 // XSheetConditionalEntry
180 virtual OUString SAL_CALL getStyleName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 virtual void SAL_CALL setStyleName( const OUString& aStyleName )
182 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 // XServiceInfo
185 virtual OUString SAL_CALL getImplementationName()
186 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
188 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
189 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
190 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
193 class ScTableValidationObj : public cppu::WeakImplHelper5<
194 com::sun::star::sheet::XSheetCondition2,
195 com::sun::star::sheet::XMultiFormulaTokens,
196 com::sun::star::beans::XPropertySet,
197 com::sun::star::lang::XUnoTunnel,
198 com::sun::star::lang::XServiceInfo >
200 private:
201 SfxItemPropertySet aPropSet;
202 sal_uInt16 nMode; // enum ScConditionMode
203 OUString aExpr1;
204 OUString aExpr2;
205 OUString maExprNmsp1;
206 OUString maExprNmsp2;
207 formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2
208 formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2
209 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens1;
210 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens2;
211 ScAddress aSrcPos;
212 OUString aPosString; // formula position as text
213 sal_uInt16 nValMode; // enum ScValidationMode
214 bool bIgnoreBlank;
215 sal_Int16 nShowList;
216 bool bShowInput;
217 OUString aInputTitle;
218 OUString aInputMessage;
219 bool bShowError;
220 sal_uInt16 nErrorStyle; // enum ScValidErrorStyle
221 OUString aErrorTitle;
222 OUString aErrorMessage;
224 void ClearData_Impl();
226 ScTableValidationObj(); // disabled
227 public:
228 ScTableValidationObj(ScDocument* pDoc, sal_uLong nKey,
229 const formula::FormulaGrammar::Grammar eGrammar);
230 virtual ~ScTableValidationObj();
232 ScValidationData* CreateValidationData( ScDocument* pDoc,
233 formula::FormulaGrammar::Grammar eGrammar ) const;
235 // XSheetCondition
236 virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
237 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
238 virtual sal_Int32 SAL_CALL getConditionOperator()
239 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
240 virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
241 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
242 virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator )
243 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
244 virtual OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
245 virtual void SAL_CALL setFormula1( const OUString& aFormula1 )
246 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
247 virtual OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
248 virtual void SAL_CALL setFormula2( const OUString& aFormula2 )
249 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
250 virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition()
251 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
252 virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition )
253 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 // XMultiFormulaTokens
256 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
257 SAL_CALL getTokens( sal_Int32 nIndex )
258 throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
259 virtual void SAL_CALL setTokens( sal_Int32 nIndex,
260 const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& aTokens )
261 throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
262 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
264 // XPropertySet
265 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
266 SAL_CALL getPropertySetInfo()
267 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
268 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
269 const ::com::sun::star::uno::Any& aValue )
270 throw(::com::sun::star::beans::UnknownPropertyException,
271 ::com::sun::star::beans::PropertyVetoException,
272 ::com::sun::star::lang::IllegalArgumentException,
273 ::com::sun::star::lang::WrappedTargetException,
274 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
275 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
276 const OUString& PropertyName )
277 throw(::com::sun::star::beans::UnknownPropertyException,
278 ::com::sun::star::lang::WrappedTargetException,
279 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
280 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
281 const ::com::sun::star::uno::Reference<
282 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
283 throw(::com::sun::star::beans::UnknownPropertyException,
284 ::com::sun::star::lang::WrappedTargetException,
285 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
286 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
287 const ::com::sun::star::uno::Reference<
288 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
289 throw(::com::sun::star::beans::UnknownPropertyException,
290 ::com::sun::star::lang::WrappedTargetException,
291 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
292 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
293 const ::com::sun::star::uno::Reference<
294 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
295 throw(::com::sun::star::beans::UnknownPropertyException,
296 ::com::sun::star::lang::WrappedTargetException,
297 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
298 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
299 const ::com::sun::star::uno::Reference<
300 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
301 throw(::com::sun::star::beans::UnknownPropertyException,
302 ::com::sun::star::lang::WrappedTargetException,
303 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
305 // XUnoTunnel
306 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
307 sal_Int8 >& aIdentifier )
308 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
311 static ScTableValidationObj* getImplementation(const css::uno::Reference<css::beans::XPropertySet>& rObj);
313 // XServiceInfo
314 virtual OUString SAL_CALL getImplementationName()
315 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
316 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
317 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
318 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
319 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
322 #endif
324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */