update credits
[LibreOffice.git] / forms / source / component / GroupBox.cxx
blobc97a5e70f5dc76e369344e0dd4bef163c3e2cb3a
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 "property.hxx"
22 #include "property.hrc"
23 #include "services.hxx"
24 #include <tools/debug.hxx>
26 //.........................................................................
27 namespace frm
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::sdb;
31 using namespace ::com::sun::star::sdbc;
32 using namespace ::com::sun::star::sdbcx;
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;
41 //==================================================================
42 // OGroupBoxModel
43 //==================================================================
45 //------------------------------------------------------------------
46 InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
48 return *(new OGroupBoxModel(_rxFactory));
51 //------------------------------------------------------------------
52 DBG_NAME( OGroupBoxModel )
53 //------------------------------------------------------------------
54 OGroupBoxModel::OGroupBoxModel(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
55 :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
57 DBG_CTOR( OGroupBoxModel, NULL );
58 m_nClassId = FormComponentType::GROUPBOX;
61 //------------------------------------------------------------------
62 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<starlang::XMultiServiceFactory>& _rxFactory )
63 :OControlModel( _pOriginal, _rxFactory )
65 DBG_CTOR( OGroupBoxModel, NULL );
68 // XServiceInfo
69 //------------------------------------------------------------------------------
70 StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException)
72 StringSequence aSupported = OControlModel::getSupportedServiceNames();
73 aSupported.realloc(aSupported.getLength() + 1);
75 OUString* pArray = aSupported.getArray();
76 pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
77 return aSupported;
80 //------------------------------------------------------------------
81 OGroupBoxModel::~OGroupBoxModel()
83 DBG_DTOR( OGroupBoxModel, NULL );
86 //------------------------------------------------------------------------------
87 IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
89 //------------------------------------------------------------------------------
90 void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
92 OControlModel::describeAggregateProperties( _rAggregateProps );
93 // don't want to have the TabStop property
94 RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
97 //------------------------------------------------------------------------------
98 OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException)
100 return OUString(FRM_COMPONENT_GROUPBOX); // old (non-sun) name for compatibility !
103 //------------------------------------------------------------------------------
104 void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
105 throw(IOException, RuntimeException)
107 OControlModel::write(_rxOutStream);
109 // Version
110 _rxOutStream->writeShort(0x0002);
111 writeHelpTextCompatibly(_rxOutStream);
114 //------------------------------------------------------------------------------
115 void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
117 OControlModel::read( _rxInStream );
119 // Version
120 sal_uInt16 nVersion = _rxInStream->readShort();
121 DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
122 // ups, ist das Englisch richtig ? ;)
124 if (nVersion == 2)
125 readHelpTextCompatibly(_rxInStream);
127 if (nVersion > 0x0002)
129 OSL_FAIL("OGroupBoxModel::read : unknown version !");
133 //==================================================================
134 // OGroupBoxControl
135 //==================================================================
137 //------------------------------------------------------------------
138 InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
140 return *(new OGroupBoxControl(_rxFactory));
143 //------------------------------------------------------------------------------
144 OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
145 :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
149 //------------------------------------------------------------------------------
150 StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException)
152 StringSequence aSupported = OControl::getSupportedServiceNames();
153 aSupported.realloc(aSupported.getLength() + 1);
155 OUString* pArray = aSupported.getArray();
156 pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
157 return aSupported;
160 //.........................................................................
162 //.........................................................................
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */