Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / forms / source / component / GroupBox.cxx
blobfab26e2e7fb834012b72cf415127bb341d8f4a6a
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::container;
35 using namespace ::com::sun::star::form;
36 using namespace ::com::sun::star::awt;
37 using namespace ::com::sun::star::io;
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::util;
40 using namespace comphelper;
42 // OGroupBoxModel
45 OGroupBoxModel::OGroupBoxModel(const Reference<XComponentContext>& _rxFactory)
46 :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
48 m_nClassId = FormComponentType::GROUPBOX;
52 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
53 :OControlModel( _pOriginal, _rxFactory )
57 // XServiceInfo
59 css::uno::Sequence<OUString> SAL_CALL OGroupBoxModel::getSupportedServiceNames()
61 css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
62 aSupported.realloc(aSupported.getLength() + 2);
64 OUString* pArray = aSupported.getArray();
65 pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_GROUPBOX;
66 pArray[aSupported.getLength()-1] = FRM_COMPONENT_GROUPBOX;
67 return aSupported;
71 OGroupBoxModel::~OGroupBoxModel()
76 css::uno::Reference< css::util::XCloneable > SAL_CALL OGroupBoxModel::createClone()
78 rtl::Reference<OGroupBoxModel> pClone = new OGroupBoxModel(this, getContext());
79 pClone->clonedFrom(this);
80 return pClone;
84 void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
86 OControlModel::describeAggregateProperties( _rAggregateProps );
87 // don't want to have the TabStop property
88 RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
92 OUString SAL_CALL OGroupBoxModel::getServiceName()
94 return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility !
98 void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
100 OControlModel::write(_rxOutStream);
102 // Version
103 _rxOutStream->writeShort(0x0002);
104 writeHelpTextCompatibly(_rxOutStream);
108 void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream)
110 OControlModel::read( _rxInStream );
112 // Version
113 sal_uInt16 nVersion = _rxInStream->readShort();
114 DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
116 if (nVersion == 2)
117 readHelpTextCompatibly(_rxInStream);
119 if (nVersion > 0x0002)
121 OSL_FAIL("OGroupBoxModel::read : unknown version !");
126 // OGroupBoxControl
128 OGroupBoxControl::OGroupBoxControl(const Reference<XComponentContext>& _rxFactory)
129 :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
134 css::uno::Sequence<OUString> SAL_CALL OGroupBoxControl::getSupportedServiceNames()
136 css::uno::Sequence<OUString> aSupported = OControl::getSupportedServiceNames();
137 aSupported.realloc(aSupported.getLength() + 2);
139 OUString* pArray = aSupported.getArray();
140 pArray[aSupported.getLength()-2] = FRM_SUN_CONTROL_GROUPBOX;
141 pArray[aSupported.getLength()-1] = STARDIV_ONE_FORM_CONTROL_GROUPBOX;
142 return aSupported;
147 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
148 com_sun_star_form_OGroupBoxModel_get_implementation(css::uno::XComponentContext* component,
149 css::uno::Sequence<css::uno::Any> const &)
151 return cppu::acquire(new frm::OGroupBoxModel(component));
155 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
156 com_sun_star_form_OGroupBoxControl_get_implementation(css::uno::XComponentContext* component,
157 css::uno::Sequence<css::uno::Any> const &)
159 return cppu::acquire(new frm::OGroupBoxControl(component));
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */