Update git submodules
[LibreOffice.git] / forms / source / component / GroupBox.cxx
blob9d979dc1d621a1ec7ee03ea6f171b074a63b9bc4
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 "GroupBox.hxx"
21 #include <frm_strings.hxx>
22 #include <services.hxx>
23 #include <comphelper/property.hxx>
24 #include <tools/debug.hxx>
25 #include <com/sun/star/form/FormComponentType.hpp>
27 namespace frm
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::sdb;
32 using namespace ::com::sun::star::sdbc;
33 using namespace ::com::sun::star::beans;
34 using namespace ::com::sun::star::form;
35 using namespace ::com::sun::star::io;
36 using namespace ::com::sun::star::util;
37 using namespace comphelper;
39 // OGroupBoxModel
42 OGroupBoxModel::OGroupBoxModel(const Reference<XComponentContext>& _rxFactory)
43 :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
45 m_nClassId = FormComponentType::GROUPBOX;
49 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
50 :OControlModel( _pOriginal, _rxFactory )
54 // XServiceInfo
56 css::uno::Sequence<OUString> SAL_CALL OGroupBoxModel::getSupportedServiceNames()
58 css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
59 aSupported.realloc(aSupported.getLength() + 2);
61 OUString* pArray = aSupported.getArray();
62 pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_GROUPBOX;
63 pArray[aSupported.getLength()-1] = FRM_COMPONENT_GROUPBOX;
64 return aSupported;
68 OGroupBoxModel::~OGroupBoxModel()
73 css::uno::Reference< css::util::XCloneable > SAL_CALL OGroupBoxModel::createClone()
75 rtl::Reference<OGroupBoxModel> pClone = new OGroupBoxModel(this, getContext());
76 pClone->clonedFrom(this);
77 return pClone;
81 void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
83 OControlModel::describeAggregateProperties( _rAggregateProps );
84 // don't want to have the TabStop property
85 RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
89 OUString SAL_CALL OGroupBoxModel::getServiceName()
91 return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility !
95 void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
97 OControlModel::write(_rxOutStream);
99 // Version
100 _rxOutStream->writeShort(0x0002);
101 writeHelpTextCompatibly(_rxOutStream);
105 void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream)
107 OControlModel::read( _rxInStream );
109 // Version
110 sal_uInt16 nVersion = _rxInStream->readShort();
111 DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
113 if (nVersion == 2)
114 readHelpTextCompatibly(_rxInStream);
116 if (nVersion > 0x0002)
118 OSL_FAIL("OGroupBoxModel::read : unknown version !");
123 // OGroupBoxControl
125 OGroupBoxControl::OGroupBoxControl(const Reference<XComponentContext>& _rxFactory)
126 :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
131 css::uno::Sequence<OUString> SAL_CALL OGroupBoxControl::getSupportedServiceNames()
133 css::uno::Sequence<OUString> aSupported = OControl::getSupportedServiceNames();
134 aSupported.realloc(aSupported.getLength() + 2);
136 OUString* pArray = aSupported.getArray();
137 pArray[aSupported.getLength()-2] = FRM_SUN_CONTROL_GROUPBOX;
138 pArray[aSupported.getLength()-1] = STARDIV_ONE_FORM_CONTROL_GROUPBOX;
139 return aSupported;
144 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
145 com_sun_star_form_OGroupBoxModel_get_implementation(css::uno::XComponentContext* component,
146 css::uno::Sequence<css::uno::Any> const &)
148 return cppu::acquire(new frm::OGroupBoxModel(component));
152 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
153 com_sun_star_form_OGroupBoxControl_get_implementation(css::uno::XComponentContext* component,
154 css::uno::Sequence<css::uno::Any> const &)
156 return cppu::acquire(new frm::OGroupBoxControl(component));
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */