1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <cppuhelper/typeprovider.hxx>
22 #include <com/sun/star/uno/Any.hxx>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <comphelper/servicehelper.hxx>
26 #include <cppuhelper/supportsservice.hxx>
27 #include <cppuhelper/weakref.hxx>
28 #include <editeng/unopracc.hxx>
29 #include <editeng/unoedsrc.hxx>
30 #include <osl/mutex.hxx>
32 using namespace ::com::sun::star
;
35 SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource
* pEditSrc
, const SvxItemPropertySet
* pPropSet
)
36 : SvxUnoTextRangeBase( pEditSrc
, pPropSet
)
40 SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
44 uno::Reference
< text::XText
> SAL_CALL
SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException
, std::exception
)
47 return uno::Reference
< text::XText
> ();
50 uno::Any SAL_CALL
SvxAccessibleTextPropertySet::queryInterface( const uno::Type
& rType
)
51 throw(uno::RuntimeException
, std::exception
)
53 return OWeakObject::queryInterface(rType
);
56 void SAL_CALL
SvxAccessibleTextPropertySet::acquire()
59 OWeakObject::acquire();
62 void SAL_CALL
SvxAccessibleTextPropertySet::release()
65 OWeakObject::release();
69 uno::Sequence
< uno::Type
> SAL_CALL
SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException
, std::exception
)
71 static ::cppu::OTypeCollection
* pTypeCollection
= NULL
;
73 // double-checked locking pattern.
74 if ( pTypeCollection
== NULL
)
76 osl::MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
78 // Control these pointer again ... it can be, that another instance will be faster then these!
79 if ( pTypeCollection
== NULL
)
81 // Create a static typecollection ...
82 static ::cppu::OTypeCollection
aTypeCollection(
83 ::cppu::UnoType
<beans::XPropertySet
>::get(),
84 ::cppu::UnoType
<beans::XMultiPropertySet
>::get(),
85 ::cppu::UnoType
<beans::XPropertyState
>::get(),
86 ::cppu::UnoType
<lang::XServiceInfo
>::get(),
87 ::cppu::UnoType
<lang::XTypeProvider
>::get() );
89 // ... and set his address to static pointer!
90 pTypeCollection
= &aTypeCollection
;
94 return pTypeCollection
->getTypes() ;
97 uno::Sequence
< sal_Int8
> SAL_CALL
SvxAccessibleTextPropertySet::getImplementationId()
98 throw (uno::RuntimeException
, std::exception
)
100 return css::uno::Sequence
<sal_Int8
>();
104 OUString SAL_CALL SAL_CALL
SvxAccessibleTextPropertySet::getImplementationName() throw (uno::RuntimeException
, std::exception
)
106 return OUString("SvxAccessibleTextPropertySet");
109 sal_Bool SAL_CALL
SvxAccessibleTextPropertySet::supportsService (const OUString
& sServiceName
) throw (uno::RuntimeException
, std::exception
)
111 return cppu::supportsService(this, sServiceName
);
114 uno::Sequence
< OUString
> SAL_CALL
SvxAccessibleTextPropertySet::getSupportedServiceNames() throw (uno::RuntimeException
, std::exception
)
117 return SvxUnoTextRangeBase::getSupportedServiceNames();
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */