fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / source / fwe / classes / actiontriggercontainer.cxx
blob187bf24ab6200566a39640a59d29a1484feb115f
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 .
20 #include <classes/actiontriggercontainer.hxx>
21 #include <classes/actiontriggerpropertyset.hxx>
22 #include <classes/actiontriggerseparatorpropertyset.hxx>
23 #include <cppuhelper/queryinterface.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <cppuhelper/typeprovider.hxx>
27 using namespace cppu;
28 using namespace com::sun::star::uno;
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::container;
32 namespace framework
35 ActionTriggerContainer::ActionTriggerContainer() :
36 PropertySetContainer()
40 ActionTriggerContainer::~ActionTriggerContainer()
44 // XInterface
45 Any SAL_CALL ActionTriggerContainer::queryInterface( const Type& aType )
46 throw ( RuntimeException, std::exception )
48 Any a = ::cppu::queryInterface(
49 aType ,
50 (static_cast< XMultiServiceFactory* >(this)),
51 (static_cast< XServiceInfo* >(this)),
52 (static_cast< XTypeProvider* >(this)));
54 if( a.hasValue() )
56 return a;
59 return PropertySetContainer::queryInterface( aType );
62 void ActionTriggerContainer::acquire() throw()
64 PropertySetContainer::acquire();
67 void ActionTriggerContainer::release() throw()
69 PropertySetContainer::release();
72 // XMultiServiceFactory
73 Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstance( const OUString& aServiceSpecifier )
74 throw ( ::com::sun::star::uno::Exception, RuntimeException, std::exception)
76 if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGER )
77 return (OWeakObject *)( new ActionTriggerPropertySet());
78 else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERCONTAINER )
79 return (OWeakObject *)( new ActionTriggerContainer());
80 else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERSEPARATOR )
81 return (OWeakObject *)( new ActionTriggerSeparatorPropertySet());
82 else
83 throw com::sun::star::uno::RuntimeException("Unknown service specifier!", (OWeakObject *)this );
86 Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstanceWithArguments( const OUString& ServiceSpecifier, const Sequence< Any >& /*Arguments*/ )
87 throw ( Exception, RuntimeException, std::exception)
89 return createInstance( ServiceSpecifier );
92 Sequence< OUString > SAL_CALL ActionTriggerContainer::getAvailableServiceNames()
93 throw ( RuntimeException, std::exception )
95 Sequence< OUString > aSeq( 3 );
97 aSeq[0] = SERVICENAME_ACTIONTRIGGER;
98 aSeq[1] = SERVICENAME_ACTIONTRIGGERCONTAINER;
99 aSeq[2] = SERVICENAME_ACTIONTRIGGERSEPARATOR;
101 return aSeq;
104 // XServiceInfo
105 OUString SAL_CALL ActionTriggerContainer::getImplementationName()
106 throw ( RuntimeException, std::exception )
108 return OUString( IMPLEMENTATIONNAME_ACTIONTRIGGERCONTAINER );
111 sal_Bool SAL_CALL ActionTriggerContainer::supportsService( const OUString& ServiceName )
112 throw ( RuntimeException, std::exception )
114 return cppu::supportsService(this, ServiceName);
117 Sequence< OUString > SAL_CALL ActionTriggerContainer::getSupportedServiceNames()
118 throw ( RuntimeException, std::exception )
120 Sequence< OUString > seqServiceNames( 1 );
122 seqServiceNames[0] = SERVICENAME_ACTIONTRIGGERCONTAINER;
123 return seqServiceNames;
126 // XTypeProvider
127 Sequence< Type > SAL_CALL ActionTriggerContainer::getTypes() throw ( RuntimeException, std::exception )
129 // Optimize this method !
130 // We initialize a static variable only one time. And we don't must use a mutex at every call!
131 // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
132 static ::cppu::OTypeCollection* pTypeCollection = NULL;
134 if ( pTypeCollection == NULL )
136 // Ready for multithreading; get global mutex for first call of this method only! see before
137 osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
139 // Control these pointer again ... it can be, that another instance will be faster then these!
140 if ( pTypeCollection == NULL )
142 // Create a static typecollection ...
143 static ::cppu::OTypeCollection aTypeCollection(
144 cppu::UnoType<XMultiServiceFactory>::get(),
145 cppu::UnoType<XIndexContainer>::get(),
146 cppu::UnoType<XServiceInfo>::get(),
147 cppu::UnoType<XTypeProvider>::get());
149 // ... and set his address to static pointer!
150 pTypeCollection = &aTypeCollection;
154 return pTypeCollection->getTypes();
157 Sequence< sal_Int8 > SAL_CALL ActionTriggerContainer::getImplementationId() throw ( RuntimeException, std::exception )
159 return css::uno::Sequence<sal_Int8>();
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */