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) throw (RuntimeException)
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() throw(RuntimeException)
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() throw(RuntimeException)
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 throw(IOException, RuntimeException)
114 {
115 OControlModel::write(_rxOutStream);
116
117 // Version
118 _rxOutStream->writeShort(0x0002);
119 writeHelpTextCompatibly(_rxOutStream);
120 }
121
122 //------------------------------------------------------------------------------
read(const Reference<XObjectInputStream> & _rxInStream)123 void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
124 {
125 OControlModel::read( _rxInStream );
126
127 // Version
128 sal_uInt16 nVersion = _rxInStream->readShort();
129 DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
130 // ups, ist das Englisch richtig ? ;)
131
132 if (nVersion == 2)
133 readHelpTextCompatibly(_rxInStream);
134
135 if (nVersion > 0x0002)
136 {
137 DBG_ERROR("OGroupBoxModel::read : unknown version !");
138 }
139 };
140
141 //==================================================================
142 // OGroupBoxControl
143 //==================================================================
144
145 //------------------------------------------------------------------
OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory> & _rxFactory)146 InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
147 {
148 return *(new OGroupBoxControl(_rxFactory));
149 }
150
151 //------------------------------------------------------------------------------
OGroupBoxControl(const Reference<starlang::XMultiServiceFactory> & _rxFactory)152 OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
153 :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
154 {
155 }
156
157 //------------------------------------------------------------------------------
getSupportedServiceNames()158 StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException)
159 {
160 StringSequence aSupported = OControl::getSupportedServiceNames();
161 aSupported.realloc(aSupported.getLength() + 1);
162
163 ::rtl::OUString* pArray = aSupported.getArray();
164 pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
165 return aSupported;
166 }
167
168 //.........................................................................
169 }
170 //.........................................................................
171
172