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