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