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