xref: /trunk/main/sc/inc/miscuno.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_MISCUNO_HXX
25cdf0e10cSrcweir #define SC_MISCUNO_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
29cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
30cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
33cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
34cdf0e10cSrcweir #include "scdllapi.h"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii )            \
37cdf0e10cSrcweir ::rtl::OUString SAL_CALL ClassName::getImplementationName()                      \
38cdf0e10cSrcweir     throw(::com::sun::star::uno::RuntimeException)                                   \
39cdf0e10cSrcweir {                                                                                    \
40cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii(ClassNameAscii);                         \
41cdf0e10cSrcweir }                                                                                    \
42cdf0e10cSrcweir sal_Bool SAL_CALL ClassName::supportsService( const ::rtl::OUString& ServiceName ) \
43cdf0e10cSrcweir     throw(::com::sun::star::uno::RuntimeException)                                   \
44cdf0e10cSrcweir {                                                                                    \
45cdf0e10cSrcweir     return !ServiceName.compareToAscii(ServiceAscii);                                \
46cdf0e10cSrcweir }                                                                                    \
47cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >                                   \
48cdf0e10cSrcweir     SAL_CALL ClassName::getSupportedServiceNames(void)                           \
49cdf0e10cSrcweir     throw(::com::sun::star::uno::RuntimeException)                                   \
50cdf0e10cSrcweir {                                                                                    \
51cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);                      \
52cdf0e10cSrcweir     ::rtl::OUString* pArray = aRet.getArray();                                       \
53cdf0e10cSrcweir     pArray[0] = ::rtl::OUString::createFromAscii(ServiceAscii);                  \
54cdf0e10cSrcweir     return aRet;                                                                     \
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #define SC_IMPL_DUMMY_PROPERTY_LISTENER( ClassName )                                \
58cdf0e10cSrcweir     void SAL_CALL ClassName::addPropertyChangeListener( const rtl::OUString&,       \
59cdf0e10cSrcweir                             const uno::Reference<beans::XPropertyChangeListener>&)  \
60cdf0e10cSrcweir                             throw(beans::UnknownPropertyException,                  \
61cdf0e10cSrcweir                             lang::WrappedTargetException, uno::RuntimeException)    \
62cdf0e10cSrcweir     { DBG_ERROR("not implemented"); }                                               \
63cdf0e10cSrcweir     void SAL_CALL ClassName::removePropertyChangeListener( const rtl::OUString&,    \
64cdf0e10cSrcweir                             const uno::Reference<beans::XPropertyChangeListener>&)  \
65cdf0e10cSrcweir                             throw(beans::UnknownPropertyException,                  \
66cdf0e10cSrcweir                             lang::WrappedTargetException, uno::RuntimeException)    \
67cdf0e10cSrcweir     { DBG_ERROR("not implemented"); }                                               \
68cdf0e10cSrcweir     void SAL_CALL ClassName::addVetoableChangeListener( const rtl::OUString&,       \
69cdf0e10cSrcweir                             const uno::Reference<beans::XVetoableChangeListener>&)  \
70cdf0e10cSrcweir                             throw(beans::UnknownPropertyException,                  \
71cdf0e10cSrcweir                             lang::WrappedTargetException, uno::RuntimeException)    \
72cdf0e10cSrcweir     { DBG_ERROR("not implemented"); }                                               \
73cdf0e10cSrcweir     void SAL_CALL ClassName::removeVetoableChangeListener( const rtl::OUString&,    \
74cdf0e10cSrcweir                             const uno::Reference<beans::XVetoableChangeListener>&)  \
75cdf0e10cSrcweir                             throw(beans::UnknownPropertyException,                  \
76cdf0e10cSrcweir                             lang::WrappedTargetException, uno::RuntimeException)    \
77cdf0e10cSrcweir     { DBG_ERROR("not implemented"); }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 
80cdf0e10cSrcweir #define SC_QUERYINTERFACE(x)    \
81cdf0e10cSrcweir     if (rType == getCppuType((const uno::Reference<x>*)0))  \
82cdf0e10cSrcweir     { return uno::makeAny(uno::Reference<x>(this)); }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir // SC_QUERY_MULTIPLE( XElementAccess, XIndexAccess ):
85cdf0e10cSrcweir //  use if interface is used several times in one class
86cdf0e10cSrcweir 
87cdf0e10cSrcweir #define SC_QUERY_MULTIPLE(x,y)  \
88cdf0e10cSrcweir     if (rType == getCppuType((const uno::Reference<x>*)0))  \
89cdf0e10cSrcweir     { uno::Any aR; aR <<= uno::Reference<x>(static_cast<y*>(this)); return aR; }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 
92cdf0e10cSrcweir class ScIndexEnumeration : public cppu::WeakImplHelper2<
93cdf0e10cSrcweir                                 com::sun::star::container::XEnumeration,
94cdf0e10cSrcweir                                 com::sun::star::lang::XServiceInfo >
95cdf0e10cSrcweir {
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> xIndex;
98cdf0e10cSrcweir     rtl::OUString           sServiceName;
99cdf0e10cSrcweir     sal_Int32               nPos;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir public:
102cdf0e10cSrcweir                             ScIndexEnumeration(const com::sun::star::uno::Reference<
103cdf0e10cSrcweir                                 com::sun::star::container::XIndexAccess>& rInd, const rtl::OUString& rServiceName);
104cdf0e10cSrcweir     virtual                 ~ScIndexEnumeration();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir                             // XEnumeration
107cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException);
108cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
109cdf0e10cSrcweir                                 throw(::com::sun::star::container::NoSuchElementException,
110cdf0e10cSrcweir                                         ::com::sun::star::lang::WrappedTargetException,
111cdf0e10cSrcweir                                         ::com::sun::star::uno::RuntimeException);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir                             // XServiceInfo
114cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
115cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
117cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
119cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir };
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //UNUSED2008-05  class ScEmptyEnumerationAccess : public cppu::WeakImplHelper2<
123cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::container::XEnumerationAccess,
124cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::lang::XServiceInfo >
125cdf0e10cSrcweir //UNUSED2008-05  {
126cdf0e10cSrcweir //UNUSED2008-05  public:
127cdf0e10cSrcweir //UNUSED2008-05                              ScEmptyEnumerationAccess();
128cdf0e10cSrcweir //UNUSED2008-05      virtual                 ~ScEmptyEnumerationAccess();
129cdf0e10cSrcweir //UNUSED2008-05
130cdf0e10cSrcweir //UNUSED2008-05                              // XEnumerationAccess
131cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
132cdf0e10cSrcweir //UNUSED2008-05                              createEnumeration() throw(::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir //UNUSED2008-05
134cdf0e10cSrcweir //UNUSED2008-05                              // XElementAccess
135cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
136cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
137cdf0e10cSrcweir //UNUSED2008-05      virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir //UNUSED2008-05
139cdf0e10cSrcweir //UNUSED2008-05                              // XServiceInfo
140cdf0e10cSrcweir //UNUSED2008-05      virtual ::rtl::OUString SAL_CALL getImplementationName(  )
141cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir //UNUSED2008-05      virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
143cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
145cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir //UNUSED2008-05  };
147cdf0e10cSrcweir 
148cdf0e10cSrcweir //UNUSED2008-05  class ScEmptyEnumeration : public cppu::WeakImplHelper2<
149cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::container::XEnumeration,
150cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::lang::XServiceInfo >
151cdf0e10cSrcweir //UNUSED2008-05  {
152cdf0e10cSrcweir //UNUSED2008-05  public:
153cdf0e10cSrcweir //UNUSED2008-05                              ScEmptyEnumeration();
154cdf0e10cSrcweir //UNUSED2008-05      virtual                 ~ScEmptyEnumeration();
155cdf0e10cSrcweir //UNUSED2008-05
156cdf0e10cSrcweir //UNUSED2008-05                              // XEnumeration
157cdf0e10cSrcweir //UNUSED2008-05      virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
159cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::container::NoSuchElementException,
160cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::lang::WrappedTargetException,
161cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir //UNUSED2008-05
163cdf0e10cSrcweir //UNUSED2008-05                              // XServiceInfo
164cdf0e10cSrcweir //UNUSED2008-05      virtual ::rtl::OUString SAL_CALL getImplementationName(  )
165cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir //UNUSED2008-05      virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
167cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
169cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
170cdf0e10cSrcweir //UNUSED2008-05  };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir //  new (uno 3) variant
173cdf0e10cSrcweir class ScNameToIndexAccess : public cppu::WeakImplHelper2<
174cdf0e10cSrcweir                                 com::sun::star::container::XIndexAccess,
175cdf0e10cSrcweir                                 com::sun::star::lang::XServiceInfo >
176cdf0e10cSrcweir {
177cdf0e10cSrcweir private:
178cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> xNameAccess;
179cdf0e10cSrcweir     com::sun::star::uno::Sequence<rtl::OUString> aNames;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir public:
182cdf0e10cSrcweir                             ScNameToIndexAccess(
183cdf0e10cSrcweir                                 const com::sun::star::uno::Reference<
184cdf0e10cSrcweir                                     com::sun::star::container::XNameAccess>& rNameObj );
185cdf0e10cSrcweir     virtual                 ~ScNameToIndexAccess();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir                             // XIndexAccess
188cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCount(  ) throw(::com::sun::star::uno::RuntimeException);
189cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
190cdf0e10cSrcweir                                 throw(::com::sun::star::lang::IndexOutOfBoundsException,
191cdf0e10cSrcweir                                         ::com::sun::star::lang::WrappedTargetException,
192cdf0e10cSrcweir                                         ::com::sun::star::uno::RuntimeException);
193cdf0e10cSrcweir 
194cdf0e10cSrcweir                             // XElementAccess
195cdf0e10cSrcweir     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  )
196cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
197cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
198cdf0e10cSrcweir 
199cdf0e10cSrcweir                             // XServiceInfo
200cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
201cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
202cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
203cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
204cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
205cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
206cdf0e10cSrcweir };
207cdf0e10cSrcweir 
208cdf0e10cSrcweir //UNUSED2008-05  class ScPrintSettingsObj : public cppu::WeakImplHelper2<
209cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::beans::XPropertySet,
210cdf0e10cSrcweir //UNUSED2008-05                                  com::sun::star::lang::XServiceInfo >
211cdf0e10cSrcweir //UNUSED2008-05  {
212cdf0e10cSrcweir //UNUSED2008-05  public:
213cdf0e10cSrcweir //UNUSED2008-05                              ScPrintSettingsObj();
214cdf0e10cSrcweir //UNUSED2008-05      virtual                 ~ScPrintSettingsObj();
215cdf0e10cSrcweir //UNUSED2008-05
216cdf0e10cSrcweir //UNUSED2008-05                              // XPropertySet
217cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
218cdf0e10cSrcweir //UNUSED2008-05                              SAL_CALL getPropertySetInfo()
219cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir //UNUSED2008-05      virtual void SAL_CALL   setPropertyValue( const ::rtl::OUString& aPropertyName,
221cdf0e10cSrcweir //UNUSED2008-05                                      const ::com::sun::star::uno::Any& aValue )
222cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
223cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::beans::PropertyVetoException,
224cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::IllegalArgumentException,
225cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
226cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
227cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
228cdf0e10cSrcweir //UNUSED2008-05                                      const ::rtl::OUString& PropertyName )
229cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
230cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
231cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
232cdf0e10cSrcweir //UNUSED2008-05      virtual void SAL_CALL   addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
233cdf0e10cSrcweir //UNUSED2008-05                                      const ::com::sun::star::uno::Reference<
234cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::beans::XPropertyChangeListener >& xListener )
235cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
236cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
237cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
238cdf0e10cSrcweir //UNUSED2008-05      virtual void SAL_CALL   removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
239cdf0e10cSrcweir //UNUSED2008-05                                      const ::com::sun::star::uno::Reference<
240cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::beans::XPropertyChangeListener >& aListener )
241cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
242cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
243cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
244cdf0e10cSrcweir //UNUSED2008-05      virtual void SAL_CALL   addVetoableChangeListener( const ::rtl::OUString& PropertyName,
245cdf0e10cSrcweir //UNUSED2008-05                                      const ::com::sun::star::uno::Reference<
246cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::beans::XVetoableChangeListener >& aListener )
247cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
248cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
249cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
250cdf0e10cSrcweir //UNUSED2008-05      virtual void SAL_CALL   removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
251cdf0e10cSrcweir //UNUSED2008-05                                      const ::com::sun::star::uno::Reference<
252cdf0e10cSrcweir //UNUSED2008-05                                          ::com::sun::star::beans::XVetoableChangeListener >& aListener )
253cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::beans::UnknownPropertyException,
254cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::lang::WrappedTargetException,
255cdf0e10cSrcweir //UNUSED2008-05                                      ::com::sun::star::uno::RuntimeException);
256cdf0e10cSrcweir //UNUSED2008-05
257cdf0e10cSrcweir //UNUSED2008-05                              // XServiceInfo
258cdf0e10cSrcweir //UNUSED2008-05      virtual ::rtl::OUString SAL_CALL getImplementationName(  )
259cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
260cdf0e10cSrcweir //UNUSED2008-05      virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
261cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
262cdf0e10cSrcweir //UNUSED2008-05      virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
263cdf0e10cSrcweir //UNUSED2008-05                                  throw(::com::sun::star::uno::RuntimeException);
264cdf0e10cSrcweir //UNUSED2008-05  };
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 
267cdf0e10cSrcweir class SC_DLLPUBLIC ScUnoHelpFunctions
268cdf0e10cSrcweir {
269cdf0e10cSrcweir public:
270cdf0e10cSrcweir     static com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
271cdf0e10cSrcweir                             AnyToInterface( const com::sun::star::uno::Any& rAny );
272cdf0e10cSrcweir     static sal_Bool         GetBoolProperty( const com::sun::star::uno::Reference<
273cdf0e10cSrcweir                                                 com::sun::star::beans::XPropertySet>& xProp,
274cdf0e10cSrcweir                                             const ::rtl::OUString& rName, sal_Bool bDefault = sal_False );
275cdf0e10cSrcweir     static sal_Int32        GetLongProperty( const com::sun::star::uno::Reference<
276cdf0e10cSrcweir                                                 com::sun::star::beans::XPropertySet>& xProp,
277cdf0e10cSrcweir                                             const ::rtl::OUString& rName, long nDefault = 0 );
278cdf0e10cSrcweir     static sal_Int32        GetEnumProperty( const com::sun::star::uno::Reference<
279cdf0e10cSrcweir                                                 com::sun::star::beans::XPropertySet>& xProp,
280cdf0e10cSrcweir                                             const ::rtl::OUString& rName, long nDefault );
281cdf0e10cSrcweir     static ::rtl::OUString  GetStringProperty(
282cdf0e10cSrcweir         const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xProp,
283cdf0e10cSrcweir         const ::rtl::OUString& rName, const ::rtl::OUString& rDefault );
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     static sal_Bool         GetBoolFromAny( const com::sun::star::uno::Any& aAny );
286cdf0e10cSrcweir     static sal_Int16        GetInt16FromAny( const com::sun::star::uno::Any& aAny );
287cdf0e10cSrcweir     static sal_Int32        GetInt32FromAny( const com::sun::star::uno::Any& aAny );
288cdf0e10cSrcweir     static sal_Int32        GetEnumFromAny( const com::sun::star::uno::Any& aAny );
289cdf0e10cSrcweir     static void             SetBoolInAny( com::sun::star::uno::Any& rAny, sal_Bool bValue );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     static void             SetOptionalPropertyValue(
292cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rPropSet,
293cdf0e10cSrcweir         const sal_Char* pPropName, const ::com::sun::star::uno::Any& rVal );
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     template<typename ValueType>
SetOptionalPropertyValue(::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> & rPropSet,const sal_Char * pPropName,const ValueType & rVal)296cdf0e10cSrcweir     static void             SetOptionalPropertyValue(
297cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rPropSet,
298cdf0e10cSrcweir         const sal_Char* pPropName, const ValueType& rVal )
299cdf0e10cSrcweir     {
300cdf0e10cSrcweir         ::com::sun::star::uno::Any any;
301cdf0e10cSrcweir         any <<= rVal;
302cdf0e10cSrcweir         SetOptionalPropertyValue(rPropSet, pPropName, any);
303cdf0e10cSrcweir     }
304cdf0e10cSrcweir };
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 
308cdf0e10cSrcweir #endif
309