sync master with lastest vba changes
[ooovba.git] / sc / inc / fmtuno.hxx
blob5809bad8112ee3418a0647a0e25a7df6eb41927e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmtuno.hxx,v $
10 * $Revision: 1.10.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_FMTUNO_HXX
32 #define SC_FMTUNO_HXX
34 #include "address.hxx"
35 #include "formula/grammar.hxx"
36 #include <tools/list.hxx>
37 #include <svtools/itemprop.hxx>
38 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
39 #include <com/sun/star/sheet/XSheetCondition.hpp>
40 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/container/XNameAccess.hpp>
43 #include <com/sun/star/container/XEnumerationAccess.hpp>
44 #include <com/sun/star/lang/XUnoTunnel.hpp>
45 #include <com/sun/star/beans/XPropertySet.hpp>
47 #include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
48 #include <com/sun/star/sheet/FormulaToken.hpp>
49 #include <cppuhelper/implbase3.hxx>
50 #include <cppuhelper/implbase4.hxx>
51 #include <cppuhelper/implbase5.hxx>
54 class ScDocument;
55 class ScTableConditionalEntry;
56 class ScConditionalFormat;
57 class ScValidationData;
60 struct ScCondFormatEntryItem
62 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens1;
63 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens2;
64 String maExpr1;
65 String maExpr2;
66 String maPosStr; // formula position as text
67 String maStyle; // display name as stored in ScStyleSheet
68 ScAddress maPos;
69 formula::FormulaGrammar::Grammar meGrammar; // grammar used with maExpr1 and maExpr2
70 USHORT mnMode; // stores enum ScConditionMode
72 // Make sure the grammar is initialized for API calls.
73 ScCondFormatEntryItem() : meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ) {}
76 class ScTableConditionalFormat : public cppu::WeakImplHelper5<
77 com::sun::star::sheet::XSheetConditionalEntries,
78 com::sun::star::container::XNameAccess,
79 com::sun::star::container::XEnumerationAccess,
80 com::sun::star::lang::XUnoTunnel,
81 com::sun::star::lang::XServiceInfo >
83 private:
84 List aEntries;
86 ScTableConditionalEntry* GetObjectByIndex_Impl(USHORT nIndex) const;
87 void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
89 ScTableConditionalFormat(); // disable
90 public:
91 ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
92 const formula::FormulaGrammar::Grammar eGrammar);
93 virtual ~ScTableConditionalFormat();
95 void FillFormat( ScConditionalFormat& rFormat,
96 ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const;
97 void DataChanged();
99 // XSheetConditionalEntries
100 virtual void SAL_CALL addNew( const ::com::sun::star::uno::Sequence<
101 ::com::sun::star::beans::PropertyValue >& aConditionalEntry )
102 throw(::com::sun::star::uno::RuntimeException);
103 virtual void SAL_CALL removeByIndex( sal_Int32 nIndex )
104 throw(::com::sun::star::uno::RuntimeException);
105 virtual void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException);
107 // XIndexAccess
108 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
109 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
110 throw(::com::sun::star::lang::IndexOutOfBoundsException,
111 ::com::sun::star::lang::WrappedTargetException,
112 ::com::sun::star::uno::RuntimeException);
114 // XNameAccess
115 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
116 throw(::com::sun::star::container::NoSuchElementException,
117 ::com::sun::star::lang::WrappedTargetException,
118 ::com::sun::star::uno::RuntimeException);
119 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
120 throw(::com::sun::star::uno::RuntimeException);
121 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
122 throw(::com::sun::star::uno::RuntimeException);
124 // XEnumerationAccess
125 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
126 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
128 // XElementAccess
129 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
130 throw(::com::sun::star::uno::RuntimeException);
131 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
133 // XUnoTunnel
134 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
135 sal_Int8 >& aIdentifier )
136 throw(::com::sun::star::uno::RuntimeException);
138 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
139 static ScTableConditionalFormat* getImplementation( const com::sun::star::uno::Reference<
140 com::sun::star::sheet::XSheetConditionalEntries> xObj );
142 // XServiceInfo
143 virtual ::rtl::OUString SAL_CALL getImplementationName()
144 throw(::com::sun::star::uno::RuntimeException);
145 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
146 throw(::com::sun::star::uno::RuntimeException);
147 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
148 throw(::com::sun::star::uno::RuntimeException);
153 class ScTableConditionalEntry : public cppu::WeakImplHelper3<
154 com::sun::star::sheet::XSheetCondition,
155 com::sun::star::sheet::XSheetConditionalEntry,
156 com::sun::star::lang::XServiceInfo >
158 private:
159 ScTableConditionalFormat* pParent;
160 ScCondFormatEntryItem aData;
162 ScTableConditionalEntry(); // disabled
163 public:
164 ScTableConditionalEntry(ScTableConditionalFormat* pPar,
165 const ScCondFormatEntryItem& aItem);
166 virtual ~ScTableConditionalEntry();
168 void GetData(ScCondFormatEntryItem& rData) const;
170 // XSheetCondition
171 virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
172 throw(::com::sun::star::uno::RuntimeException);
173 virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
174 throw(::com::sun::star::uno::RuntimeException);
175 virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException);
176 virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 )
177 throw(::com::sun::star::uno::RuntimeException);
178 virtual ::rtl::OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException);
179 virtual void SAL_CALL setFormula2( const ::rtl::OUString& aFormula2 )
180 throw(::com::sun::star::uno::RuntimeException);
181 virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition()
182 throw(::com::sun::star::uno::RuntimeException);
183 virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition )
184 throw(::com::sun::star::uno::RuntimeException);
186 // XSheetConditionalEntry
187 virtual ::rtl::OUString SAL_CALL getStyleName() throw(::com::sun::star::uno::RuntimeException);
188 virtual void SAL_CALL setStyleName( const ::rtl::OUString& aStyleName )
189 throw(::com::sun::star::uno::RuntimeException);
191 // XServiceInfo
192 virtual ::rtl::OUString SAL_CALL getImplementationName()
193 throw(::com::sun::star::uno::RuntimeException);
194 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
195 throw(::com::sun::star::uno::RuntimeException);
196 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
197 throw(::com::sun::star::uno::RuntimeException);
202 class ScTableValidationObj : public cppu::WeakImplHelper5<
203 com::sun::star::sheet::XSheetCondition,
204 com::sun::star::sheet::XMultiFormulaTokens,
205 com::sun::star::beans::XPropertySet,
206 com::sun::star::lang::XUnoTunnel,
207 com::sun::star::lang::XServiceInfo >
209 private:
210 SfxItemPropertySet aPropSet;
211 USHORT nMode; // enum ScConditionMode
212 String aExpr1;
213 String aExpr2;
214 formula::FormulaGrammar::Grammar meGrammar; // grammar used with aExpr1 and aExpr2
215 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens1;
216 ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens2;
217 ScAddress aSrcPos;
218 String aPosString; // formula position as text
219 USHORT nValMode; // enum ScValidationMode
220 BOOL bIgnoreBlank;
221 sal_Int16 nShowList;
222 BOOL bShowInput;
223 String aInputTitle;
224 String aInputMessage;
225 BOOL bShowError;
226 USHORT nErrorStyle; // enum ScValidErrorStyle
227 String aErrorTitle;
228 String aErrorMessage;
230 void ClearData_Impl();
232 ScTableValidationObj(); // disabled
233 public:
234 ScTableValidationObj(ScDocument* pDoc, ULONG nKey,
235 const formula::FormulaGrammar::Grammar eGrammar);
236 virtual ~ScTableValidationObj();
238 ScValidationData* CreateValidationData( ScDocument* pDoc,
239 formula::FormulaGrammar::Grammar eGrammar ) const;
240 void DataChanged();
242 // XSheetCondition
243 virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
244 throw(::com::sun::star::uno::RuntimeException);
245 virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
246 throw(::com::sun::star::uno::RuntimeException);
247 virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException);
248 virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 )
249 throw(::com::sun::star::uno::RuntimeException);
250 virtual ::rtl::OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException);
251 virtual void SAL_CALL setFormula2( const ::rtl::OUString& aFormula2 )
252 throw(::com::sun::star::uno::RuntimeException);
253 virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition()
254 throw(::com::sun::star::uno::RuntimeException);
255 virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition )
256 throw(::com::sun::star::uno::RuntimeException);
258 // XMultiFormulaTokens
259 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
260 SAL_CALL getTokens( sal_Int32 nIndex )
261 throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException);
262 virtual void SAL_CALL setTokens( sal_Int32 nIndex,
263 const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& aTokens )
264 throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException);
265 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
267 // XPropertySet
268 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
269 SAL_CALL getPropertySetInfo()
270 throw(::com::sun::star::uno::RuntimeException);
271 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
272 const ::com::sun::star::uno::Any& aValue )
273 throw(::com::sun::star::beans::UnknownPropertyException,
274 ::com::sun::star::beans::PropertyVetoException,
275 ::com::sun::star::lang::IllegalArgumentException,
276 ::com::sun::star::lang::WrappedTargetException,
277 ::com::sun::star::uno::RuntimeException);
278 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
279 const ::rtl::OUString& PropertyName )
280 throw(::com::sun::star::beans::UnknownPropertyException,
281 ::com::sun::star::lang::WrappedTargetException,
282 ::com::sun::star::uno::RuntimeException);
283 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
284 const ::com::sun::star::uno::Reference<
285 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
286 throw(::com::sun::star::beans::UnknownPropertyException,
287 ::com::sun::star::lang::WrappedTargetException,
288 ::com::sun::star::uno::RuntimeException);
289 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
290 const ::com::sun::star::uno::Reference<
291 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
292 throw(::com::sun::star::beans::UnknownPropertyException,
293 ::com::sun::star::lang::WrappedTargetException,
294 ::com::sun::star::uno::RuntimeException);
295 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
296 const ::com::sun::star::uno::Reference<
297 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
298 throw(::com::sun::star::beans::UnknownPropertyException,
299 ::com::sun::star::lang::WrappedTargetException,
300 ::com::sun::star::uno::RuntimeException);
301 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
302 const ::com::sun::star::uno::Reference<
303 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
304 throw(::com::sun::star::beans::UnknownPropertyException,
305 ::com::sun::star::lang::WrappedTargetException,
306 ::com::sun::star::uno::RuntimeException);
308 // XUnoTunnel
309 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
310 sal_Int8 >& aIdentifier )
311 throw(::com::sun::star::uno::RuntimeException);
313 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
314 static ScTableValidationObj* getImplementation( const com::sun::star::uno::Reference<
315 com::sun::star::beans::XPropertySet> xObj );
317 // XServiceInfo
318 virtual ::rtl::OUString SAL_CALL getImplementationName()
319 throw(::com::sun::star::uno::RuntimeException);
320 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
321 throw(::com::sun::star::uno::RuntimeException);
322 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
323 throw(::com::sun::star::uno::RuntimeException);
327 #endif