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 : #include "FormsCollection.hxx"
21 : #include "services.hxx"
22 : #include <comphelper/sequence.hxx>
23 : #include <comphelper/processfactory.hxx>
24 : #include <cppuhelper/supportsservice.hxx>
25 : #include <com/sun/star/form/XForm.hpp>
26 :
27 : using namespace frm;
28 : using namespace ::com::sun::star::lang;
29 : using namespace ::com::sun::star::uno;
30 : using namespace ::com::sun::star::form;
31 : using namespace ::com::sun::star::container;
32 : using namespace ::com::sun::star::util;
33 :
34 0 : OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException, std::exception)
35 : {
36 0 : return OUString("com.sun.star.form.Forms");
37 : }
38 :
39 0 : Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( ) throw(RuntimeException, std::exception)
40 : {
41 0 : return css::uno::Sequence<sal_Int8>();
42 : }
43 :
44 0 : Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException, std::exception)
45 : {
46 0 : return concatSequences(OInterfaceContainer::getTypes(), FormsCollectionComponentBase::getTypes(), OFormsCollection_BASE::getTypes());
47 : }
48 :
49 402 : OFormsCollection::OFormsCollection(const Reference<XComponentContext>& _rxFactory)
50 : :FormsCollectionComponentBase( m_aMutex )
51 402 : ,OInterfaceContainer( _rxFactory, m_aMutex, cppu::UnoType<XForm>::get() )
52 804 : ,OFormsCollection_BASE()
53 : {
54 402 : }
55 :
56 0 : OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
57 : :FormsCollectionComponentBase( m_aMutex )
58 : ,OInterfaceContainer( m_aMutex, _cloneSource )
59 0 : ,OFormsCollection_BASE()
60 : {
61 0 : }
62 :
63 1203 : OFormsCollection::~OFormsCollection()
64 : {
65 401 : if (!FormsCollectionComponentBase::rBHelper.bDisposed)
66 : {
67 0 : acquire();
68 0 : dispose();
69 : }
70 802 : }
71 :
72 14048 : Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(RuntimeException, std::exception)
73 : {
74 14048 : Any aReturn = OFormsCollection_BASE::queryInterface(_rType);
75 14048 : if (!aReturn.hasValue())
76 : {
77 3514 : aReturn = OInterfaceContainer::queryInterface(_rType);
78 :
79 3514 : if (!aReturn.hasValue())
80 3514 : aReturn = FormsCollectionComponentBase::queryAggregation(_rType);
81 : }
82 :
83 14048 : return aReturn;
84 : }
85 :
86 1 : OUString SAL_CALL OFormsCollection::getImplementationName() throw(RuntimeException, std::exception)
87 : {
88 1 : return OUString("com.sun.star.form.OFormsCollection");
89 : }
90 :
91 8 : sal_Bool SAL_CALL OFormsCollection::supportsService( const OUString& _rServiceName ) throw(RuntimeException, std::exception)
92 : {
93 8 : return cppu::supportsService(this, _rServiceName);
94 : }
95 :
96 9 : StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(RuntimeException, std::exception)
97 : {
98 9 : StringSequence aReturn(2);
99 :
100 9 : aReturn[0] = "com.sun.star.form.Forms";
101 9 : aReturn[1] = "com.sun.star.form.FormComponents";
102 :
103 9 : return aReturn;
104 : }
105 :
106 : // XCloneable
107 0 : Reference< XCloneable > SAL_CALL OFormsCollection::createClone( ) throw (RuntimeException, std::exception)
108 : {
109 0 : OFormsCollection* pClone = new OFormsCollection( *this );
110 0 : osl_atomic_increment( &pClone->m_refCount );
111 0 : pClone->clonedFrom( *this );
112 0 : osl_atomic_decrement( &pClone->m_refCount );
113 0 : return static_cast<OInterfaceContainer*>(pClone);
114 : }
115 :
116 : // OComponentHelper
117 :
118 401 : void OFormsCollection::disposing()
119 : {
120 : {
121 : SAL_INFO( "forms.component", "forms::OFormsCollection::disposing" );
122 401 : OInterfaceContainer::disposing();
123 : }
124 401 : FormsCollectionComponentBase::disposing();
125 401 : m_xParent = NULL;
126 401 : }
127 :
128 : //XChild
129 :
130 400 : void OFormsCollection::setParent(const InterfaceRef& Parent) throw( NoSupportException, RuntimeException, std::exception )
131 : {
132 400 : ::osl::MutexGuard aGuard( m_aMutex );
133 400 : m_xParent = Parent;
134 400 : }
135 :
136 1043 : InterfaceRef OFormsCollection::getParent() throw( RuntimeException, std::exception )
137 : {
138 1043 : return m_xParent;
139 : }
140 :
141 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
142 402 : com_sun_star_form_OFormsCollection_get_implementation(css::uno::XComponentContext* context,
143 : css::uno::Sequence<css::uno::Any> const &)
144 : {
145 402 : return cppu::acquire(new frm::OFormsCollection(context));
146 : }
147 :
148 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|