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 30 : InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<css::lang::XMultiServiceFactory>& _rxFactory)
48 : {
49 30 : return *(new OGroupBoxModel( comphelper::getComponentContext(_rxFactory) ));
50 : }
51 :
52 :
53 :
54 30 : OGroupBoxModel::OGroupBoxModel(const Reference<XComponentContext>& _rxFactory)
55 30 : :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
56 : {
57 30 : m_nClassId = FormComponentType::GROUPBOX;
58 30 : }
59 :
60 :
61 2 : OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
62 2 : :OControlModel( _pOriginal, _rxFactory )
63 : {
64 2 : }
65 :
66 : // XServiceInfo
67 :
68 10 : StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException, std::exception)
69 : {
70 10 : StringSequence aSupported = OControlModel::getSupportedServiceNames();
71 10 : aSupported.realloc(aSupported.getLength() + 1);
72 :
73 10 : OUString* pArray = aSupported.getArray();
74 10 : pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
75 10 : return aSupported;
76 : }
77 :
78 :
79 64 : OGroupBoxModel::~OGroupBoxModel()
80 : {
81 64 : }
82 :
83 :
84 2 : IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel )
85 :
86 :
87 32 : void OGroupBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
88 : {
89 32 : OControlModel::describeAggregateProperties( _rAggregateProps );
90 : // don't want to have the TabStop property
91 32 : RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
92 32 : }
93 :
94 :
95 2 : OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException, std::exception)
96 : {
97 2 : return OUString(FRM_COMPONENT_GROUPBOX); // old (non-sun) name for compatibility !
98 : }
99 :
100 :
101 2 : void SAL_CALL OGroupBoxModel::write(const Reference< XObjectOutputStream>& _rxOutStream)
102 : throw(IOException, RuntimeException, std::exception)
103 : {
104 2 : OControlModel::write(_rxOutStream);
105 :
106 : // Version
107 2 : _rxOutStream->writeShort(0x0002);
108 2 : writeHelpTextCompatibly(_rxOutStream);
109 2 : }
110 :
111 :
112 2 : void SAL_CALL OGroupBoxModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException, std::exception)
113 : {
114 2 : OControlModel::read( _rxInStream );
115 :
116 : // Version
117 2 : sal_uInt16 nVersion = _rxInStream->readShort();
118 : DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
119 :
120 2 : if (nVersion == 2)
121 2 : readHelpTextCompatibly(_rxInStream);
122 :
123 : if (nVersion > 0x0002)
124 : {
125 : OSL_FAIL("OGroupBoxModel::read : unknown version !");
126 : }
127 2 : };
128 :
129 :
130 : // OGroupBoxControl
131 :
132 :
133 :
134 24 : InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<css::lang::XMultiServiceFactory>& _rxFactory)
135 : {
136 24 : return *(new OGroupBoxControl( comphelper::getComponentContext(_rxFactory) ));
137 : }
138 :
139 :
140 24 : OGroupBoxControl::OGroupBoxControl(const Reference<XComponentContext>& _rxFactory)
141 24 : :OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
142 : {
143 24 : }
144 :
145 :
146 0 : StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException, std::exception)
147 : {
148 0 : StringSequence aSupported = OControl::getSupportedServiceNames();
149 0 : aSupported.realloc(aSupported.getLength() + 1);
150 :
151 0 : OUString* pArray = aSupported.getArray();
152 0 : pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
153 0 : return aSupported;
154 : }
155 :
156 :
157 : }
158 :
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|