Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "GroupBox.hxx"
30 : : #include "property.hxx"
31 : : #include "property.hrc"
32 : : #include "services.hxx"
33 : : #include <tools/debug.hxx>
34 : :
35 : : //.........................................................................
36 : : namespace frm
37 : : {
38 : : using namespace ::com::sun::star::uno;
39 : : using namespace ::com::sun::star::sdb;
40 : : using namespace ::com::sun::star::sdbc;
41 : : using namespace ::com::sun::star::sdbcx;
42 : : using namespace ::com::sun::star::beans;
43 : : using namespace ::com::sun::star::container;
44 : : using namespace ::com::sun::star::form;
45 : : using namespace ::com::sun::star::awt;
46 : : using namespace ::com::sun::star::io;
47 : : using namespace ::com::sun::star::lang;
48 : : using namespace ::com::sun::star::util;
49 : :
50 : : //==================================================================
51 : : // OGroupBoxModel
52 : : //==================================================================
53 : :
54 : : //------------------------------------------------------------------
55 : 30 : InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
56 : : {
57 [ + - ]: 30 : return *(new OGroupBoxModel(_rxFactory));
58 : : }
59 : :
60 : : //------------------------------------------------------------------
61 : : DBG_NAME( OGroupBoxModel )
62 : : //------------------------------------------------------------------
63 : 30 : OGroupBoxModel::OGroupBoxModel(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
64 [ + - ][ + - ]: 30 : :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
65 : : {
66 : : DBG_CTOR( OGroupBoxModel, NULL );
67 : 30 : m_nClassId = FormComponentType::GROUPBOX;
68 : 30 : }
69 : :
70 : : //------------------------------------------------------------------
71 : 2 : OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<starlang::XMultiServiceFactory>& _rxFactory )
72 : 2 : :OControlModel( _pOriginal, _rxFactory )
73 : : {
74 : : DBG_CTOR( OGroupBoxModel, NULL );
75 : 2 : }
76 : :
77 : : // XServiceInfo
78 : : //------------------------------------------------------------------------------
79 : 10 : StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException)
80 : : {
81 : 10 : StringSequence aSupported = OControlModel::getSupportedServiceNames();
82 [ + - ]: 10 : aSupported.realloc(aSupported.getLength() + 1);
83 : :
84 [ + - ]: 10 : ::rtl::OUString* pArray = aSupported.getArray();
85 [ + - ]: 10 : pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
86 : 10 : return aSupported;
87 : : }
88 : :
89 : : //------------------------------------------------------------------
90 : 32 : OGroupBoxModel::~OGroupBoxModel()
91 : : {
92 : : DBG_DTOR( OGroupBoxModel, NULL );
93 [ - + ]: 64 : }
94 : :
95 : : //------------------------------------------------------------------------------
96 [ + - ][ + - ]: 2 : IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
97 : :
98 : : //------------------------------------------------------------------------------
99 : 33 : void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
100 : : {
101 : 33 : OControlModel::describeAggregateProperties( _rAggregateProps );
102 : : // don't want to have the TabStop property
103 [ + - ]: 33 : RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
104 : 33 : }
105 : :
106 : : //------------------------------------------------------------------------------
107 : 2 : ::rtl::OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException)
108 : : {
109 : 2 : return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility !
110 : : }
111 : :
112 : : //------------------------------------------------------------------------------
113 : 2 : void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
114 : : throw(IOException, RuntimeException)
115 : : {
116 : 2 : OControlModel::write(_rxOutStream);
117 : :
118 : : // Version
119 : 2 : _rxOutStream->writeShort(0x0002);
120 : 2 : writeHelpTextCompatibly(_rxOutStream);
121 : 2 : }
122 : :
123 : : //------------------------------------------------------------------------------
124 : 2 : void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
125 : : {
126 : 2 : OControlModel::read( _rxInStream );
127 : :
128 : : // Version
129 : 2 : sal_uInt16 nVersion = _rxInStream->readShort();
130 : : DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
131 : : // ups, ist das Englisch richtig ? ;)
132 : :
133 [ + - ]: 2 : if (nVersion == 2)
134 : 2 : readHelpTextCompatibly(_rxInStream);
135 : :
136 : : if (nVersion > 0x0002)
137 : : {
138 : : OSL_FAIL("OGroupBoxModel::read : unknown version !");
139 : : }
140 : 2 : };
141 : :
142 : : //==================================================================
143 : : // OGroupBoxControl
144 : : //==================================================================
145 : :
146 : : //------------------------------------------------------------------
147 : 24 : InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
148 : : {
149 [ + - ]: 24 : return *(new OGroupBoxControl(_rxFactory));
150 : : }
151 : :
152 : : //------------------------------------------------------------------------------
153 : 24 : OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
154 [ + - ]: 24 : :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
155 : : {
156 : 24 : }
157 : :
158 : : //------------------------------------------------------------------------------
159 : 0 : StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException)
160 : : {
161 : 0 : StringSequence aSupported = OControl::getSupportedServiceNames();
162 [ # # ]: 0 : aSupported.realloc(aSupported.getLength() + 1);
163 : :
164 [ # # ]: 0 : ::rtl::OUString* pArray = aSupported.getArray();
165 [ # # ]: 0 : pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
166 : 0 : return aSupported;
167 : : }
168 : :
169 : : //.........................................................................
170 : : }
171 : : //.........................................................................
172 : :
173 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|