Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "GroupBox.hxx"
21 : #include "property.hxx"
22 : #include "property.hrc"
23 : #include "services.hxx"
24 : #include <tools/debug.hxx>
25 :
26 : //.........................................................................
27 : namespace frm
28 : {
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;
40 :
41 : //==================================================================
42 : // OGroupBoxModel
43 : //==================================================================
44 :
45 : //------------------------------------------------------------------
46 1 : InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
47 : {
48 1 : return *(new OGroupBoxModel(_rxFactory));
49 : }
50 :
51 : //------------------------------------------------------------------
52 : DBG_NAME( OGroupBoxModel )
53 : //------------------------------------------------------------------
54 1 : OGroupBoxModel::OGroupBoxModel(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
55 1 : :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
56 : {
57 : DBG_CTOR( OGroupBoxModel, NULL );
58 1 : m_nClassId = FormComponentType::GROUPBOX;
59 1 : }
60 :
61 : //------------------------------------------------------------------
62 0 : OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<starlang::XMultiServiceFactory>& _rxFactory )
63 0 : :OControlModel( _pOriginal, _rxFactory )
64 : {
65 : DBG_CTOR( OGroupBoxModel, NULL );
66 0 : }
67 :
68 : // XServiceInfo
69 : //------------------------------------------------------------------------------
70 0 : StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException)
71 : {
72 0 : StringSequence aSupported = OControlModel::getSupportedServiceNames();
73 0 : aSupported.realloc(aSupported.getLength() + 1);
74 :
75 0 : ::rtl::OUString* pArray = aSupported.getArray();
76 0 : pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
77 0 : return aSupported;
78 : }
79 :
80 : //------------------------------------------------------------------
81 2 : OGroupBoxModel::~OGroupBoxModel()
82 : {
83 : DBG_DTOR( OGroupBoxModel, NULL );
84 2 : }
85 :
86 : //------------------------------------------------------------------------------
87 0 : IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
88 :
89 : //------------------------------------------------------------------------------
90 1 : void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
91 : {
92 1 : OControlModel::describeAggregateProperties( _rAggregateProps );
93 : // don't want to have the TabStop property
94 1 : RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
95 1 : }
96 :
97 : //------------------------------------------------------------------------------
98 0 : ::rtl::OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException)
99 : {
100 0 : return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility !
101 : }
102 :
103 : //------------------------------------------------------------------------------
104 0 : void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
105 : throw(IOException, RuntimeException)
106 : {
107 0 : OControlModel::write(_rxOutStream);
108 :
109 : // Version
110 0 : _rxOutStream->writeShort(0x0002);
111 0 : writeHelpTextCompatibly(_rxOutStream);
112 0 : }
113 :
114 : //------------------------------------------------------------------------------
115 0 : void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
116 : {
117 0 : OControlModel::read( _rxInStream );
118 :
119 : // Version
120 0 : 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 ? ;)
123 :
124 0 : if (nVersion == 2)
125 0 : readHelpTextCompatibly(_rxInStream);
126 :
127 : if (nVersion > 0x0002)
128 : {
129 : OSL_FAIL("OGroupBoxModel::read : unknown version !");
130 : }
131 0 : };
132 :
133 : //==================================================================
134 : // OGroupBoxControl
135 : //==================================================================
136 :
137 : //------------------------------------------------------------------
138 0 : InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
139 : {
140 0 : return *(new OGroupBoxControl(_rxFactory));
141 : }
142 :
143 : //------------------------------------------------------------------------------
144 0 : OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory)
145 0 : :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
146 : {
147 0 : }
148 :
149 : //------------------------------------------------------------------------------
150 0 : StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException)
151 : {
152 0 : StringSequence aSupported = OControl::getSupportedServiceNames();
153 0 : aSupported.realloc(aSupported.getLength() + 1);
154 :
155 0 : ::rtl::OUString* pArray = aSupported.getArray();
156 0 : pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
157 0 : return aSupported;
158 : }
159 :
160 : //.........................................................................
161 : }
162 : //.........................................................................
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|