Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : //------------------------------------------------------------------------
22 : //
23 : // Global header
24 : //
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>
33 :
34 :
35 : //------------------------------------------------------------------------
36 : //
37 : // Project-local header
38 : //
39 : //------------------------------------------------------------------------
40 :
41 : #include <editeng/unopracc.hxx>
42 : #include <editeng/unoedsrc.hxx>
43 :
44 : using namespace ::com::sun::star;
45 :
46 : //------------------------------------------------------------------------
47 : //
48 : // SvxAccessibleTextPropertySet implementation
49 : //
50 : //------------------------------------------------------------------------
51 :
52 0 : SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SvxItemPropertySet* pPropSet )
53 0 : : SvxUnoTextRangeBase( pEditSrc, pPropSet )
54 : {
55 0 : }
56 :
57 0 : SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
58 : {
59 0 : }
60 :
61 0 : uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException)
62 : {
63 : // TODO (empty?)
64 0 : return uno::Reference< text::XText > ();
65 : }
66 :
67 0 : uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException)
68 : {
69 : // TODO (empty?)
70 0 : return uno::Any();
71 : }
72 :
73 0 : uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType )
74 : throw(uno::RuntimeException)
75 : {
76 0 : return OWeakObject::queryInterface(rType);
77 : }
78 :
79 0 : void SAL_CALL SvxAccessibleTextPropertySet::acquire()
80 : throw()
81 : {
82 0 : OWeakObject::acquire();
83 0 : }
84 :
85 0 : void SAL_CALL SvxAccessibleTextPropertySet::release()
86 : throw()
87 : {
88 0 : OWeakObject::release();
89 0 : }
90 :
91 : // XTypeProvider
92 0 : uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException )
93 : {
94 : static ::cppu::OTypeCollection* pTypeCollection = NULL ;
95 :
96 : // double-checked locking pattern.
97 0 : if ( pTypeCollection == NULL )
98 : {
99 0 : osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
100 :
101 : // Control these pointer again ... it can be, that another instance will be faster then these!
102 0 : if ( pTypeCollection == NULL )
103 : {
104 : // Create a static typecollection ...
105 : static ::cppu::OTypeCollection aTypeCollection(
106 0 : ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ),
107 0 : ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ),
108 0 : ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ),
109 0 : ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ),
110 0 : ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) );
111 :
112 : // ... and set his address to static pointer!
113 0 : pTypeCollection = &aTypeCollection ;
114 0 : }
115 : }
116 :
117 0 : return pTypeCollection->getTypes() ;
118 : }
119 :
120 : namespace
121 : {
122 : class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {};
123 : }
124 :
125 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()
126 : throw (uno::RuntimeException)
127 : {
128 0 : return theSvxAccessibleTextPropertySetImplementationId::get().getSeq();
129 : }
130 :
131 : // XServiceInfo
132 0 : ::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException)
133 : {
134 0 : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("SvxAccessibleTextPropertySet"));
135 : }
136 :
137 0 : sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
138 : {
139 : // Iterate over all supported service names and return true if on of them
140 : // matches the given name.
141 : uno::Sequence< ::rtl::OUString> aSupportedServices (
142 0 : getSupportedServiceNames ());
143 0 : for (int i=0; i<aSupportedServices.getLength(); i++)
144 0 : if (sServiceName == aSupportedServices[i])
145 0 : return sal_True;
146 0 : return sal_False;
147 : }
148 :
149 0 : uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException)
150 : {
151 : // TODO
152 0 : return SvxUnoTextRangeBase::getSupportedServiceNames();
153 : }
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|