xref: /trunk/main/forms/source/component/GroupBox.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_forms.hxx"
26 #include "GroupBox.hxx"
27 #include "property.hxx"
28 #ifndef _FRM_PROPERTY_HRC_
29 #include "property.hrc"
30 #endif
31 #include "services.hxx"
32 #include <tools/debug.hxx>
33 
34 //.........................................................................
35 namespace frm
36 {
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::sdb;
39 using namespace ::com::sun::star::sdbc;
40 using namespace ::com::sun::star::sdbcx;
41 using namespace ::com::sun::star::beans;
42 using namespace ::com::sun::star::container;
43 using namespace ::com::sun::star::form;
44 using namespace ::com::sun::star::awt;
45 using namespace ::com::sun::star::io;
46 using namespace ::com::sun::star::lang;
47 using namespace ::com::sun::star::util;
48 
49 //==================================================================
50 // OGroupBoxModel
51 //==================================================================
52 
53 //------------------------------------------------------------------
OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory> & _rxFactory)54 InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
55 {
56     return *(new OGroupBoxModel(_rxFactory));
57 }
58 
59 //------------------------------------------------------------------
DBG_NAME(OGroupBoxModel)60 DBG_NAME( OGroupBoxModel )
61 //------------------------------------------------------------------
62 OGroupBoxModel::OGroupBoxModel(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
63     :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
64 {
65     DBG_CTOR( OGroupBoxModel, NULL );
66     m_nClassId = FormComponentType::GROUPBOX;
67 }
68 
69 //------------------------------------------------------------------
OGroupBoxModel(const OGroupBoxModel * _pOriginal,const Reference<starlang::XMultiServiceFactory> & _rxFactory)70 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<starlang::XMultiServiceFactory>& _rxFactory )
71     :OControlModel( _pOriginal, _rxFactory )
72 {
73     DBG_CTOR( OGroupBoxModel, NULL );
74 }
75 
76 // XServiceInfo
77 //------------------------------------------------------------------------------
getSupportedServiceNames()78 StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames()
79 {
80     StringSequence aSupported = OControlModel::getSupportedServiceNames();
81     aSupported.realloc(aSupported.getLength() + 1);
82 
83     ::rtl::OUString* pArray = aSupported.getArray();
84     pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
85     return aSupported;
86 }
87 
88 //------------------------------------------------------------------
~OGroupBoxModel()89 OGroupBoxModel::~OGroupBoxModel()
90 {
91     DBG_DTOR( OGroupBoxModel, NULL );
92 }
93 
94 //------------------------------------------------------------------------------
IMPLEMENT_DEFAULT_CLONING(OGroupBoxModel)95 IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
96 
97 //------------------------------------------------------------------------------
98 void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
99 {
100     OControlModel::describeAggregateProperties( _rAggregateProps );
101     // don't want to have the TabStop property
102     RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
103 }
104 
105 //------------------------------------------------------------------------------
getServiceName()106 ::rtl::OUString SAL_CALL OGroupBoxModel::getServiceName()
107 {
108     return FRM_COMPONENT_GROUPBOX;  // old (non-sun) name for compatibility !
109 }
110 
111 //------------------------------------------------------------------------------
write(const Reference<XObjectOutputStream> & _rxOutStream)112 void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
113 {
114     OControlModel::write(_rxOutStream);
115 
116     // Version
117     _rxOutStream->writeShort(0x0002);
118     writeHelpTextCompatibly(_rxOutStream);
119 }
120 
121 //------------------------------------------------------------------------------
read(const Reference<XObjectInputStream> & _rxInStream)122 void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream)
123 {
124     OControlModel::read( _rxInStream );
125 
126     // Version
127     sal_uInt16 nVersion = _rxInStream->readShort();
128     DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
129         // ups, ist das Englisch richtig ? ;)
130 
131     if (nVersion == 2)
132         readHelpTextCompatibly(_rxInStream);
133 
134     if (nVersion > 0x0002)
135     {
136         DBG_ERROR("OGroupBoxModel::read : unknown version !");
137     }
138 };
139 
140 //==================================================================
141 // OGroupBoxControl
142 //==================================================================
143 
144 //------------------------------------------------------------------
OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory> & _rxFactory)145 InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
146 {
147     return *(new OGroupBoxControl(_rxFactory));
148 }
149 
150 //------------------------------------------------------------------------------
OGroupBoxControl(const Reference<starlang::XMultiServiceFactory> & _rxFactory)151 OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
152                    :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
153 {
154 }
155 
156 //------------------------------------------------------------------------------
getSupportedServiceNames()157 StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames()
158 {
159     StringSequence aSupported = OControl::getSupportedServiceNames();
160     aSupported.realloc(aSupported.getLength() + 1);
161 
162     ::rtl::OUString* pArray = aSupported.getArray();
163     pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
164     return aSupported;
165 }
166 
167 //.........................................................................
168 }
169 //.........................................................................
170