tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / forms / source / component / FormsCollection.cxx
blob0b5b2f0e1eb64b65875166d26182ef1909b96bd4
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 "FormsCollection.hxx"
21 #include <comphelper/sequence.hxx>
22 #include <cppuhelper/supportsservice.hxx>
23 #include <sal/log.hxx>
24 #include <com/sun/star/form/XForm.hpp>
25 #include <rtl/ref.hxx>
27 using namespace frm;
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::form;
30 using namespace ::com::sun::star::util;
32 OUString SAL_CALL OFormsCollection::getServiceName()
34 return u"com.sun.star.form.Forms"_ustr;
37 Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( )
39 return css::uno::Sequence<sal_Int8>();
42 Sequence<Type> SAL_CALL OFormsCollection::getTypes()
44 return concatSequences(OInterfaceContainer::getTypes(), ::cppu::OComponentHelper::getTypes(), OFormsCollection_BASE::getTypes());
47 OFormsCollection::OFormsCollection(const Reference<XComponentContext>& _rxFactory)
48 : ::cppu::OComponentHelper( m_aMutex )
49 ,OInterfaceContainer( _rxFactory, m_aMutex, cppu::UnoType<XForm>::get() )
50 ,OFormsCollection_BASE()
54 OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
55 : ::cppu::OComponentHelper( m_aMutex )
56 ,OInterfaceContainer( m_aMutex, _cloneSource )
57 ,OFormsCollection_BASE()
61 OFormsCollection::~OFormsCollection()
63 if (!::cppu::OComponentHelper::rBHelper.bDisposed)
65 acquire();
66 dispose();
70 Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType)
72 Any aReturn = OFormsCollection_BASE::queryInterface(_rType);
73 if (!aReturn.hasValue())
75 aReturn = OInterfaceContainer::queryInterface(_rType);
77 if (!aReturn.hasValue())
78 aReturn = ::cppu::OComponentHelper::queryAggregation(_rType);
81 return aReturn;
84 OUString SAL_CALL OFormsCollection::getImplementationName()
86 return u"com.sun.star.form.OFormsCollection"_ustr;
89 sal_Bool SAL_CALL OFormsCollection::supportsService( const OUString& _rServiceName )
91 return cppu::supportsService(this, _rServiceName);
94 css::uno::Sequence<OUString> SAL_CALL OFormsCollection::getSupportedServiceNames()
96 return { u"com.sun.star.form.Forms"_ustr, u"com.sun.star.form.FormComponents"_ustr };
99 // XCloneable
100 Reference< XCloneable > SAL_CALL OFormsCollection::createClone( )
102 rtl::Reference<OFormsCollection> pClone = new OFormsCollection( *this );
103 pClone->clonedFrom( *this );
104 return static_cast<OInterfaceContainer*>(pClone.get());
107 // OComponentHelper
109 void OFormsCollection::disposing()
112 SAL_INFO( "forms.component", "forms::OFormsCollection::disposing" );
113 OInterfaceContainer::disposing();
115 ::cppu::OComponentHelper::disposing();
116 m_xParent = nullptr;
119 //XChild
121 void OFormsCollection::setParent(const css::uno::Reference<css::uno::XInterface>& Parent)
123 ::osl::MutexGuard aGuard( m_aMutex );
124 m_xParent = Parent;
127 css::uno::Reference<css::uno::XInterface> OFormsCollection::getParent()
129 return m_xParent;
132 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
133 com_sun_star_form_OFormsCollection_get_implementation(css::uno::XComponentContext* context,
134 css::uno::Sequence<css::uno::Any> const &)
136 return cppu::acquire(new frm::OFormsCollection(context));
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */