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 : #include <comphelper/processfactory.hxx>
26 :
27 : //.........................................................................
28 : namespace frm
29 : {
30 : using namespace ::com::sun::star::uno;
31 : using namespace ::com::sun::star::sdb;
32 : using namespace ::com::sun::star::sdbc;
33 : using namespace ::com::sun::star::sdbcx;
34 : using namespace ::com::sun::star::beans;
35 : using namespace ::com::sun::star::container;
36 : using namespace ::com::sun::star::form;
37 : using namespace ::com::sun::star::awt;
38 : using namespace ::com::sun::star::io;
39 : using namespace ::com::sun::star::lang;
40 : using namespace ::com::sun::star::util;
41 :
42 : //==================================================================
43 : // OGroupBoxModel
44 : //==================================================================
45 :
46 : //------------------------------------------------------------------
47 15 : InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
48 : {
49 15 : return *(new OGroupBoxModel( comphelper::getComponentContext(_rxFactory) ));
50 : }
51 :
52 : //------------------------------------------------------------------
53 : DBG_NAME( OGroupBoxModel )
54 : //------------------------------------------------------------------
55 15 : OGroupBoxModel::OGroupBoxModel(const Reference<XComponentContext>& _rxFactory)
56 15 : :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
57 : {
58 : DBG_CTOR( OGroupBoxModel, NULL );
59 15 : m_nClassId = FormComponentType::GROUPBOX;
60 15 : }
61 :
62 : //------------------------------------------------------------------
63 1 : OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
64 1 : :OControlModel( _pOriginal, _rxFactory )
65 : {
66 : DBG_CTOR( OGroupBoxModel, NULL );
67 1 : }
68 :
69 : // XServiceInfo
70 : //------------------------------------------------------------------------------
71 5 : StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException)
72 : {
73 5 : StringSequence aSupported = OControlModel::getSupportedServiceNames();
74 5 : aSupported.realloc(aSupported.getLength() + 1);
75 :
76 5 : OUString* pArray = aSupported.getArray();
77 5 : pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
78 5 : return aSupported;
79 : }
80 :
81 : //------------------------------------------------------------------
82 32 : OGroupBoxModel::~OGroupBoxModel()
83 : {
84 : DBG_DTOR( OGroupBoxModel, NULL );
85 32 : }
86 :
87 : //------------------------------------------------------------------------------
88 1 : IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
89 :
90 : //------------------------------------------------------------------------------
91 16 : void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
92 : {
93 16 : OControlModel::describeAggregateProperties( _rAggregateProps );
94 : // don't want to have the TabStop property
95 16 : RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
96 16 : }
97 :
98 : //------------------------------------------------------------------------------
99 1 : OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException)
100 : {
101 1 : return OUString(FRM_COMPONENT_GROUPBOX); // old (non-sun) name for compatibility !
102 : }
103 :
104 : //------------------------------------------------------------------------------
105 1 : void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
106 : throw(IOException, RuntimeException)
107 : {
108 1 : OControlModel::write(_rxOutStream);
109 :
110 : // Version
111 1 : _rxOutStream->writeShort(0x0002);
112 1 : writeHelpTextCompatibly(_rxOutStream);
113 1 : }
114 :
115 : //------------------------------------------------------------------------------
116 1 : void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
117 : {
118 1 : OControlModel::read( _rxInStream );
119 :
120 : // Version
121 1 : sal_uInt16 nVersion = _rxInStream->readShort();
122 : DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
123 : // ups, ist das Englisch richtig ? ;)
124 :
125 1 : if (nVersion == 2)
126 1 : readHelpTextCompatibly(_rxInStream);
127 :
128 : if (nVersion > 0x0002)
129 : {
130 : OSL_FAIL("OGroupBoxModel::read : unknown version !");
131 : }
132 1 : };
133 :
134 : //==================================================================
135 : // OGroupBoxControl
136 : //==================================================================
137 :
138 : //------------------------------------------------------------------
139 12 : InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
140 : {
141 12 : return *(new OGroupBoxControl( comphelper::getComponentContext(_rxFactory) ));
142 : }
143 :
144 : //------------------------------------------------------------------------------
145 12 : OGroupBoxControl::OGroupBoxControl(const Reference<XComponentContext>& _rxFactory)
146 12 : :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
147 : {
148 12 : }
149 :
150 : //------------------------------------------------------------------------------
151 0 : StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException)
152 : {
153 0 : StringSequence aSupported = OControl::getSupportedServiceNames();
154 0 : aSupported.realloc(aSupported.getLength() + 1);
155 :
156 0 : OUString* pArray = aSupported.getArray();
157 0 : pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
158 0 : return aSupported;
159 : }
160 :
161 : //.........................................................................
162 : }
163 : //.........................................................................
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|