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