1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "property.hxx"
22 #include "property.hrc"
23 #include "services.hxx"
24 #include <tools/debug.hxx>
25 #include <comphelper/processfactory.hxx>
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::sdbcx
;
34 using namespace ::com::sun::star::beans
;
35 using namespace ::com::sun::star::container
;
36 using namespace ::com::sun::star::form
;
37 using namespace ::com::sun::star::awt
;
38 using namespace ::com::sun::star::io
;
39 using namespace ::com::sun::star::lang
;
40 using namespace ::com::sun::star::util
;
46 OGroupBoxModel::OGroupBoxModel(const Reference
<XComponentContext
>& _rxFactory
)
47 :OControlModel(_rxFactory
, VCL_CONTROLMODEL_GROUPBOX
, VCL_CONTROL_GROUPBOX
)
49 m_nClassId
= FormComponentType::GROUPBOX
;
53 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel
* _pOriginal
, const Reference
<XComponentContext
>& _rxFactory
)
54 :OControlModel( _pOriginal
, _rxFactory
)
60 StringSequence SAL_CALL
OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
62 StringSequence aSupported
= OControlModel::getSupportedServiceNames();
63 aSupported
.realloc(aSupported
.getLength() + 2);
65 OUString
* pArray
= aSupported
.getArray();
66 pArray
[aSupported
.getLength()-2] = FRM_SUN_COMPONENT_GROUPBOX
;
67 pArray
[aSupported
.getLength()-1] = FRM_COMPONENT_GROUPBOX
;
72 OGroupBoxModel::~OGroupBoxModel()
77 IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel
)
80 void OGroupBoxModel::describeAggregateProperties( Sequence
< Property
>& _rAggregateProps
) const
82 OControlModel::describeAggregateProperties( _rAggregateProps
);
83 // don't want to have the TabStop property
84 RemoveProperty(_rAggregateProps
, PROPERTY_TABSTOP
);
88 OUString SAL_CALL
OGroupBoxModel::getServiceName() throw(RuntimeException
, std::exception
)
90 return OUString(FRM_COMPONENT_GROUPBOX
); // old (non-sun) name for compatibility !
94 void SAL_CALL
OGroupBoxModel::write(const Reference
< XObjectOutputStream
>& _rxOutStream
)
95 throw(IOException
, RuntimeException
, std::exception
)
97 OControlModel::write(_rxOutStream
);
100 _rxOutStream
->writeShort(0x0002);
101 writeHelpTextCompatibly(_rxOutStream
);
105 void SAL_CALL
OGroupBoxModel::read(const Reference
< XObjectInputStream
>& _rxInStream
) throw(IOException
, RuntimeException
, std::exception
)
107 OControlModel::read( _rxInStream
);
110 sal_uInt16 nVersion
= _rxInStream
->readShort();
111 DBG_ASSERT(nVersion
> 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
114 readHelpTextCompatibly(_rxInStream
);
116 if (nVersion
> 0x0002)
118 OSL_FAIL("OGroupBoxModel::read : unknown version !");
125 OGroupBoxControl::OGroupBoxControl(const Reference
<XComponentContext
>& _rxFactory
)
126 :OControl(_rxFactory
, VCL_CONTROL_GROUPBOX
)
131 StringSequence SAL_CALL
OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
133 StringSequence 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
;
144 extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface
* SAL_CALL
145 com_sun_star_form_OGroupBoxModel_get_implementation(::com::sun::star::uno::XComponentContext
* component
,
146 ::com::sun::star::uno::Sequence
<css::uno::Any
> const &)
148 return cppu::acquire(new frm::OGroupBoxModel(component
));
152 extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface
* SAL_CALL
153 com_sun_star_form_OGroupBoxControl_get_implementation(::com::sun::star::uno::XComponentContext
* component
,
154 ::com::sun::star::uno::Sequence
<css::uno::Any
> const &)
156 return cppu::acquire(new frm::OGroupBoxControl(component
));
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */