update credits
[LibreOffice.git] / editeng / source / uno / unopracc.cxx
blob37600abdfce49728290a4b6a0ff25342795167b6
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 .
21 //------------------------------------------------------------------------
23 // Global header
25 //------------------------------------------------------------------------
26 #include <osl/mutex.hxx>
27 #include <com/sun/star/uno/Any.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <cppuhelper/weakref.hxx>
30 #include <com/sun/star/lang/XComponent.hpp>
31 #include <cppuhelper/typeprovider.hxx>
32 #include <comphelper/servicehelper.hxx>
35 //------------------------------------------------------------------------
37 // Project-local header
39 //------------------------------------------------------------------------
41 #include <editeng/unopracc.hxx>
42 #include <editeng/unoedsrc.hxx>
44 using namespace ::com::sun::star;
46 //------------------------------------------------------------------------
48 // SvxAccessibleTextPropertySet implementation
50 //------------------------------------------------------------------------
52 SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SvxItemPropertySet* pPropSet )
53 : SvxUnoTextRangeBase( pEditSrc, pPropSet )
57 SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
61 uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException)
63 // TODO (empty?)
64 return uno::Reference< text::XText > ();
67 uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException)
69 // TODO (empty?)
70 return uno::Any();
73 uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType )
74 throw(uno::RuntimeException)
76 return OWeakObject::queryInterface(rType);
79 void SAL_CALL SvxAccessibleTextPropertySet::acquire()
80 throw()
82 OWeakObject::acquire();
85 void SAL_CALL SvxAccessibleTextPropertySet::release()
86 throw()
88 OWeakObject::release();
91 // XTypeProvider
92 uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException )
94 static ::cppu::OTypeCollection* pTypeCollection = NULL ;
96 // double-checked locking pattern.
97 if ( pTypeCollection == NULL )
99 osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
101 // Control these pointer again ... it can be, that another instance will be faster then these!
102 if ( pTypeCollection == NULL )
104 // Create a static typecollection ...
105 static ::cppu::OTypeCollection aTypeCollection(
106 ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ),
107 ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ),
108 ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ),
109 ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ),
110 ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) );
112 // ... and set his address to static pointer!
113 pTypeCollection = &aTypeCollection ;
117 return pTypeCollection->getTypes() ;
120 namespace
122 class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {};
125 uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()
126 throw (uno::RuntimeException)
128 return theSvxAccessibleTextPropertySetImplementationId::get().getSeq();
131 // XServiceInfo
132 OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException)
134 return OUString("SvxAccessibleTextPropertySet");
137 sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const OUString& sServiceName) throw (uno::RuntimeException)
139 // Iterate over all supported service names and return true if on of them
140 // matches the given name.
141 uno::Sequence< OUString> aSupportedServices (
142 getSupportedServiceNames ());
143 for (int i=0; i<aSupportedServices.getLength(); i++)
144 if (sServiceName == aSupportedServices[i])
145 return sal_True;
146 return sal_False;
149 uno::Sequence< OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException)
151 // TODO
152 return SvxUnoTextRangeBase::getSupportedServiceNames();
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */