Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "FormsCollection.hxx"
31 : : #include "services.hxx"
32 : : #include <comphelper/sequence.hxx>
33 : : #include <tools/debug.hxx>
34 : : #include <com/sun/star/form/XForm.hpp>
35 : : #include <rtl/logfile.hxx>
36 : :
37 : : //.........................................................................
38 : : namespace frm
39 : : {
40 : : //.........................................................................
41 : : using namespace ::com::sun::star::lang;
42 : : using namespace ::com::sun::star::uno;
43 : : using namespace ::com::sun::star::form;
44 : : using namespace ::com::sun::star::container;
45 : : using namespace ::com::sun::star::util;
46 : :
47 : : //------------------------------------------------------------------
48 : : DBG_NAME(OFormsCollection)
49 : : //------------------------------------------------------------------
50 : 333 : InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
51 : : {
52 [ + - ]: 333 : return *(new OFormsCollection(_rxFactory));
53 : : }
54 : :
55 : : //------------------------------------------------------------------------------
56 : 0 : ::rtl::OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException)
57 : : {
58 : 0 : return FRM_SUN_FORMS_COLLECTION;
59 : : }
60 : :
61 : : //------------------------------------------------------------------------------
62 : 0 : Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( ) throw(RuntimeException)
63 : : {
64 [ # # ]: 0 : return OImplementationIds::getImplementationId(getTypes());
65 : : }
66 : :
67 : : //------------------------------------------------------------------------------
68 : 0 : Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException)
69 : : {
70 [ # # ][ # # ]: 0 : return concatSequences(OInterfaceContainer::getTypes(), FormsCollectionComponentBase::getTypes(), OFormsCollection_BASE::getTypes());
[ # # ][ # # ]
[ # # ]
71 : : }
72 : :
73 : : //------------------------------------------------------------------
74 : 333 : OFormsCollection::OFormsCollection(const Reference<XMultiServiceFactory>& _rxFactory)
75 : : :FormsCollectionComponentBase( m_aMutex )
76 [ + - ]: 333 : ,OInterfaceContainer( _rxFactory, m_aMutex, XForm::static_type() )
77 [ + - ][ + - ]: 666 : ,OFormsCollection_BASE()
[ + - ]
78 : : {
79 : : DBG_CTOR(OFormsCollection, NULL);
80 : 333 : }
81 : :
82 : : //------------------------------------------------------------------------------
83 : 0 : OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
84 : : :FormsCollectionComponentBase( m_aMutex )
85 : : ,OInterfaceContainer( m_aMutex, _cloneSource )
86 [ # # ][ # # ]: 0 : ,OFormsCollection_BASE()
[ # # ]
87 : : {
88 : : DBG_CTOR( OFormsCollection, NULL );
89 : 0 : }
90 : :
91 : : //------------------------------------------------------------------------------
92 [ + - ][ + - ]: 322 : OFormsCollection::~OFormsCollection()
[ + - ]
93 : : {
94 : : DBG_DTOR(OFormsCollection, NULL);
95 [ - + ]: 322 : if (!FormsCollectionComponentBase::rBHelper.bDisposed)
96 : : {
97 : 0 : acquire();
98 [ # # ]: 0 : dispose();
99 : : }
100 [ - + ]: 644 : }
101 : :
102 : : //------------------------------------------------------------------------------
103 : 14636 : Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(RuntimeException)
104 : : {
105 : 14636 : Any aReturn = OFormsCollection_BASE::queryInterface(_rType);
106 [ + + ]: 14636 : if (!aReturn.hasValue())
107 : : {
108 [ + - ]: 9851 : aReturn = OInterfaceContainer::queryInterface(_rType);
109 : :
110 [ + + ]: 9851 : if (!aReturn.hasValue())
111 [ + - ]: 4340 : aReturn = FormsCollectionComponentBase::queryAggregation(_rType);
112 : : }
113 : :
114 : 14636 : return aReturn;
115 : : }
116 : :
117 : : //------------------------------------------------------------------------------
118 : 0 : ::rtl::OUString SAL_CALL OFormsCollection::getImplementationName() throw(RuntimeException)
119 : : {
120 : 0 : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.forms.OFormsCollection") );
121 : : }
122 : :
123 : : //------------------------------------------------------------------------------
124 : 0 : sal_Bool SAL_CALL OFormsCollection::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
125 : : {
126 [ # # ]: 0 : Sequence<rtl::OUString> aSupported = getSupportedServiceNames();
127 : 0 : const rtl::OUString* pSupported = aSupported.getConstArray();
128 [ # # ]: 0 : for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported)
129 [ # # ]: 0 : if (pSupported->equals(_rServiceName))
130 : 0 : return sal_True;
131 [ # # ]: 0 : return sal_False;
132 : : }
133 : :
134 : : //------------------------------------------------------------------------------
135 : 0 : StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(RuntimeException)
136 : : {
137 : 0 : StringSequence aReturn(2);
138 : :
139 [ # # ][ # # ]: 0 : aReturn.getArray()[0] = FRM_SUN_FORMS_COLLECTION;
140 [ # # ][ # # ]: 0 : aReturn.getArray()[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.FormComponents") );
141 : :
142 : 0 : return aReturn;
143 : : }
144 : :
145 : : // XCloneable
146 : : //------------------------------------------------------------------------------
147 : 0 : Reference< XCloneable > SAL_CALL OFormsCollection::createClone( ) throw (RuntimeException)
148 : : {
149 [ # # ]: 0 : OFormsCollection* pClone = new OFormsCollection( *this );
150 : 0 : osl_incrementInterlockedCount( &pClone->m_refCount );
151 : 0 : pClone->clonedFrom( *this );
152 : 0 : osl_decrementInterlockedCount( &pClone->m_refCount );
153 [ # # ]: 0 : return pClone;
154 : : }
155 : :
156 : : // OComponentHelper
157 : : //------------------------------------------------------------------------------
158 : 322 : void OFormsCollection::disposing()
159 : : {
160 : : {
161 : : RTL_LOGFILE_CONTEXT( aLogger, "forms::OFormsCollection::disposing" );
162 : 322 : OInterfaceContainer::disposing();
163 : : }
164 : 322 : FormsCollectionComponentBase::disposing();
165 : 322 : m_xParent = NULL;
166 : 322 : }
167 : :
168 : : //XChild
169 : : //------------------------------------------------------------------------------
170 : 330 : void OFormsCollection::setParent(const InterfaceRef& Parent) throw( NoSupportException, RuntimeException )
171 : : {
172 [ + - ]: 330 : ::osl::MutexGuard aGuard( m_aMutex );
173 [ + - ][ + - ]: 330 : m_xParent = Parent;
174 : 330 : }
175 : :
176 : : //------------------------------------------------------------------------------
177 : 1606 : InterfaceRef OFormsCollection::getParent() throw( RuntimeException )
178 : : {
179 : 1606 : return m_xParent;
180 : : }
181 : :
182 : : //.........................................................................
183 : : } // namespace frm
184 : : //.........................................................................
185 : :
186 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|