update dev300-m58
[ooovba.git] / svx / source / unoedit / unopracc.cxx
blob16656bba3689263b7eba2552bd51616e7d74ce41
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: unopracc.cxx,v $
10 * $Revision: 1.6 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 //------------------------------------------------------------------------
36 // Global header
38 //------------------------------------------------------------------------
39 #include <vos/mutex.hxx>
40 #include <com/sun/star/uno/Any.hxx>
41 #include <com/sun/star/uno/Reference.hxx>
42 #include <cppuhelper/weakref.hxx>
43 #include <com/sun/star/lang/XComponent.hpp>
44 #include <cppuhelper/typeprovider.hxx>
47 //------------------------------------------------------------------------
49 // Project-local header
51 //------------------------------------------------------------------------
53 #ifndef _SVX_UNOPRACC_HXX_
54 #include "unopracc.hxx"
55 #endif
56 #include <svx/unoedsrc.hxx>
58 using namespace ::com::sun::star;
60 //------------------------------------------------------------------------
62 // SvxAccessibleTextPropertySet implementation
64 //------------------------------------------------------------------------
66 SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SvxItemPropertySet* pPropSet )
67 : SvxUnoTextRangeBase( pEditSrc, pPropSet )
71 SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
75 uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException)
77 // TODO (empty?)
78 return uno::Reference< text::XText > ();
81 uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException)
83 // TODO (empty?)
84 return uno::Any();
87 uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType )
88 throw(uno::RuntimeException)
90 return OWeakObject::queryInterface(rType);
93 void SAL_CALL SvxAccessibleTextPropertySet::acquire()
94 throw()
96 OWeakObject::acquire();
99 void SAL_CALL SvxAccessibleTextPropertySet::release()
100 throw()
102 OWeakObject::release();
105 // XTypeProvider
106 uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException )
108 static ::cppu::OTypeCollection* pTypeCollection = NULL ;
110 // double-checked locking pattern.
111 if ( pTypeCollection == NULL )
113 osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
115 // Control these pointer again ... it can be, that another instance will be faster then these!
116 if ( pTypeCollection == NULL )
118 // Create a static typecollection ...
119 static ::cppu::OTypeCollection aTypeCollection(
120 ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ),
121 ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ),
122 ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ),
123 ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ),
124 ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) );
126 // ... and set his address to static pointer!
127 pTypeCollection = &aTypeCollection ;
131 return pTypeCollection->getTypes() ;
134 uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()
135 throw (uno::RuntimeException)
137 static uno::Sequence< sal_Int8 > aId;
138 if( aId.getLength() == 0 )
140 aId.realloc( 16 );
141 rtl_createUuid( reinterpret_cast< sal_uInt8* > (aId.getArray()), 0, sal_True );
143 return aId;
146 // XServiceInfo
147 ::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException)
149 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("SvxAccessibleTextPropertySet"));
152 sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
154 // Iterate over all supported service names and return true if on of them
155 // matches the given name.
156 uno::Sequence< ::rtl::OUString> aSupportedServices (
157 getSupportedServiceNames ());
158 for (int i=0; i<aSupportedServices.getLength(); i++)
159 if (sServiceName == aSupportedServices[i])
160 return sal_True;
161 return sal_False;
164 uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException)
166 // TODO
167 return SvxUnoTextRangeBase::getSupportedServiceNames();
170 // XServiceName
171 ::rtl::OUString SAL_CALL SvxAccessibleTextPropertySet::getServiceName() throw (uno::RuntimeException)
173 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyValue"));