1*190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*190118d0SAndrew Rist * distributed with this work for additional information 6*190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9*190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*190118d0SAndrew Rist * software distributed under the License is distributed on an 15*190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17*190118d0SAndrew Rist * specific language governing permissions and limitations 18*190118d0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*190118d0SAndrew Rist *************************************************************/ 21*190118d0SAndrew Rist 22*190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_editeng.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir //------------------------------------------------------------------------ 28cdf0e10cSrcweir // 29cdf0e10cSrcweir // Global header 30cdf0e10cSrcweir // 31cdf0e10cSrcweir //------------------------------------------------------------------------ 32cdf0e10cSrcweir #include <vos/mutex.hxx> 33cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 34cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 35cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 36cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 37cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir //------------------------------------------------------------------------ 41cdf0e10cSrcweir // 42cdf0e10cSrcweir // Project-local header 43cdf0e10cSrcweir // 44cdf0e10cSrcweir //------------------------------------------------------------------------ 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <editeng/unopracc.hxx> 47cdf0e10cSrcweir #include <editeng/unoedsrc.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir using namespace ::com::sun::star; 50cdf0e10cSrcweir 51cdf0e10cSrcweir //------------------------------------------------------------------------ 52cdf0e10cSrcweir // 53cdf0e10cSrcweir // SvxAccessibleTextPropertySet implementation 54cdf0e10cSrcweir // 55cdf0e10cSrcweir //------------------------------------------------------------------------ 56cdf0e10cSrcweir 57cdf0e10cSrcweir SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SvxItemPropertySet* pPropSet ) 58cdf0e10cSrcweir : SvxUnoTextRangeBase( pEditSrc, pPropSet ) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw() 63cdf0e10cSrcweir { 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir // TODO (empty?) 69cdf0e10cSrcweir return uno::Reference< text::XText > (); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir // TODO (empty?) 75cdf0e10cSrcweir return uno::Any(); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType ) 79cdf0e10cSrcweir throw(uno::RuntimeException) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir return OWeakObject::queryInterface(rType); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir void SAL_CALL SvxAccessibleTextPropertySet::acquire() 85cdf0e10cSrcweir throw() 86cdf0e10cSrcweir { 87cdf0e10cSrcweir OWeakObject::acquire(); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir void SAL_CALL SvxAccessibleTextPropertySet::release() 91cdf0e10cSrcweir throw() 92cdf0e10cSrcweir { 93cdf0e10cSrcweir OWeakObject::release(); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XTypeProvider 97cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir static ::cppu::OTypeCollection* pTypeCollection = NULL ; 100cdf0e10cSrcweir 101cdf0e10cSrcweir // double-checked locking pattern. 102cdf0e10cSrcweir if ( pTypeCollection == NULL ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; 105cdf0e10cSrcweir 106cdf0e10cSrcweir // Control these pointer again ... it can be, that another instance will be faster then these! 107cdf0e10cSrcweir if ( pTypeCollection == NULL ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir // Create a static typecollection ... 110cdf0e10cSrcweir static ::cppu::OTypeCollection aTypeCollection( 111cdf0e10cSrcweir ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ), 112cdf0e10cSrcweir ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ), 113cdf0e10cSrcweir ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ), 114cdf0e10cSrcweir ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ), 115cdf0e10cSrcweir ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir // ... and set his address to static pointer! 118cdf0e10cSrcweir pTypeCollection = &aTypeCollection ; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir return pTypeCollection->getTypes() ; 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId() 126cdf0e10cSrcweir throw (uno::RuntimeException) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId; 129cdf0e10cSrcweir if( aId.getLength() == 0 ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir aId.realloc( 16 ); 132cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* > (aId.getArray()), 0, sal_True ); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir return aId; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir // XServiceInfo 138cdf0e10cSrcweir ::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("SvxAccessibleTextPropertySet")); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir // Iterate over all supported service names and return true if on of them 146cdf0e10cSrcweir // matches the given name. 147cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> aSupportedServices ( 148cdf0e10cSrcweir getSupportedServiceNames ()); 149cdf0e10cSrcweir for (int i=0; i<aSupportedServices.getLength(); i++) 150cdf0e10cSrcweir if (sServiceName == aSupportedServices[i]) 151cdf0e10cSrcweir return sal_True; 152cdf0e10cSrcweir return sal_False; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir // TODO 158cdf0e10cSrcweir return SvxUnoTextRangeBase::getSupportedServiceNames(); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir // XServiceName 162cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxAccessibleTextPropertySet::getServiceName() throw (uno::RuntimeException) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyValue")); 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir 168