LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / component / Columns.hxx
blobfd2caa3b979df00f02715918532e8b4610632b71
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <cloneable.hxx>
24 #include <com/sun/star/io/XObjectInputStream.hpp>
25 #include <com/sun/star/io/XObjectOutputStream.hpp>
26 #include <com/sun/star/lang/XUnoTunnel.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/util/XCloneable.hpp>
30 #include <comphelper/propagg.hxx>
31 #include <comphelper/proparrhlp.hxx>
32 #include <comphelper/uno3.hxx>
33 #include <cppuhelper/basemutex.hxx>
34 #include <cppuhelper/compbase2.hxx>
35 #include <rtl/ref.hxx>
37 using namespace comphelper;
40 namespace frm
43 typedef ::cppu::WeakAggComponentImplHelper2 < css::lang::XUnoTunnel
44 , css::util::XCloneable > OGridColumn_BASE;
45 class OGridColumn :public ::cppu::BaseMutex
46 ,public OGridColumn_BASE
47 ,public OPropertySetAggregationHelper
48 ,public OCloneableAggregation
50 // [properties]
51 css::uno::Any m_aWidth; // column width
52 css::uno::Any m_aAlign; // column alignment
53 css::uno::Any m_aHidden; // column hidden?
54 // [properties]
56 OUString m_aModelName;
58 // [properties]
59 OUString m_aLabel; // Column name
60 // [properties]
62 public:
63 OGridColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext, const OUString& _sModelName);
64 explicit OGridColumn(const OGridColumn* _pOriginal );
65 virtual ~OGridColumn() override;
67 // UNO binding
68 DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE)
69 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
71 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
72 // XUnoTunnel
73 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<sal_Int8>& _rIdentifier) override;
75 // XTypeProvider
76 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
77 virtual css::uno::Sequence< css::uno::Type> SAL_CALL getTypes() override;
79 // OComponentHelper
80 virtual void SAL_CALL disposing() override;
82 // XEventListener
83 virtual void SAL_CALL disposing(const css::lang::EventObject& _rSource) override;
85 // XPersistObject
86 void write(const css::uno::Reference< css::io::XObjectOutputStream>& _rxOutStream);
87 void read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream);
89 // XPropertySet
90 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override = 0;
91 virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle ) const override;
92 virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any& rConvertedValue, css::uno::Any& rOldValue,
93 sal_Int32 nHandle, const css::uno::Any& rValue ) override;
94 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any& rValue) override;
96 using OPropertySetAggregationHelper::getFastPropertyValue;
98 // css::beans::XPropertyState
99 virtual css::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const override;
101 // XCloneable
102 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
104 const OUString& getModelName() const { return m_aModelName; }
106 protected:
107 static void clearAggregateProperties(css::uno::Sequence< css::beans::Property>& seqProps, bool bAllowDropDown);
108 static void setOwnProperties(css::uno::Sequence< css::beans::Property>& seqProps);
110 virtual rtl::Reference<OGridColumn> createCloneColumn() const = 0;
113 // column type ids
114 #define TYPE_CHECKBOX 0
115 #define TYPE_COMBOBOX 1
116 #define TYPE_CURRENCYFIELD 2
117 #define TYPE_DATEFIELD 3
118 #define TYPE_FORMATTEDFIELD 4
119 #define TYPE_LISTBOX 5
120 #define TYPE_NUMERICFIELD 6
121 #define TYPE_PATTERNFIELD 7
122 #define TYPE_TEXTFIELD 8
123 #define TYPE_TIMEFIELD 9
125 // List of all known columns
126 const css::uno::Sequence<OUString>& getColumnTypes();
127 sal_Int32 getColumnTypeByModelName(const OUString& aModelName);
129 // Columns
130 class TextFieldColumn
131 :public OGridColumn
132 ,public OAggregationArrayUsageHelper< TextFieldColumn >
134 public:
135 explicit TextFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
136 explicit TextFieldColumn(const TextFieldColumn* _pCloneFrom);
138 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
139 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
141 virtual void fillProperties(
142 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
143 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
144 ) const override;
146 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
149 class PatternFieldColumn
150 :public OGridColumn
151 ,public OAggregationArrayUsageHelper< PatternFieldColumn >
153 public:
154 explicit PatternFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
155 explicit PatternFieldColumn(const PatternFieldColumn* _pCloneFrom);
157 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
158 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
160 virtual void fillProperties(
161 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
162 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
163 ) const override;
165 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
168 class DateFieldColumn
169 :public OGridColumn
170 ,public OAggregationArrayUsageHelper< DateFieldColumn >
172 public:
173 explicit DateFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
174 explicit DateFieldColumn(const DateFieldColumn* _pCloneFrom);
176 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
177 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
179 virtual void fillProperties(
180 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
181 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
182 ) const override;
184 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
187 class TimeFieldColumn
188 :public OGridColumn
189 ,public OAggregationArrayUsageHelper< TimeFieldColumn >
191 public:
192 explicit TimeFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
193 explicit TimeFieldColumn(const TimeFieldColumn* _pCloneFrom);
195 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
196 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
198 virtual void fillProperties(
199 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
200 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
201 ) const override;
203 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
206 class NumericFieldColumn
207 :public OGridColumn
208 ,public OAggregationArrayUsageHelper< NumericFieldColumn >
210 public:
211 explicit NumericFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
212 explicit NumericFieldColumn(const NumericFieldColumn* _pCloneFrom);
214 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
215 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
217 virtual void fillProperties(
218 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
219 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
220 ) const override;
222 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
225 class CurrencyFieldColumn
226 :public OGridColumn
227 ,public OAggregationArrayUsageHelper< CurrencyFieldColumn >
229 public:
230 explicit CurrencyFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
231 explicit CurrencyFieldColumn(const CurrencyFieldColumn* _pCloneFrom);
233 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
234 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
236 virtual void fillProperties(
237 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
238 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
239 ) const override;
241 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
244 class CheckBoxColumn
245 :public OGridColumn
246 ,public OAggregationArrayUsageHelper< CheckBoxColumn >
248 public:
249 explicit CheckBoxColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
250 explicit CheckBoxColumn(const CheckBoxColumn* _pCloneFrom);
252 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
253 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
255 virtual void fillProperties(
256 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
257 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
258 ) const override;
260 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
263 class ComboBoxColumn
264 :public OGridColumn
265 ,public OAggregationArrayUsageHelper< ComboBoxColumn >
267 public:
268 explicit ComboBoxColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
269 explicit ComboBoxColumn(const ComboBoxColumn* _pCloneFrom);
271 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
272 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
274 virtual void fillProperties(
275 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
276 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
277 ) const override;
279 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
282 class ListBoxColumn
283 :public OGridColumn
284 ,public OAggregationArrayUsageHelper< ListBoxColumn >
286 public:
287 explicit ListBoxColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
288 explicit ListBoxColumn(const ListBoxColumn* _pCloneFrom);
290 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
291 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
293 virtual void fillProperties(
294 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
295 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
296 ) const override;
298 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
301 class FormattedFieldColumn
302 :public OGridColumn
303 ,public OAggregationArrayUsageHelper< FormattedFieldColumn >
305 public:
306 explicit FormattedFieldColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext );
307 explicit FormattedFieldColumn(const FormattedFieldColumn* _pCloneFrom);
309 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
310 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
312 virtual void fillProperties(
313 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps,
314 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
315 ) const override;
317 virtual rtl::Reference<OGridColumn> createCloneColumn() const override;
320 } // namespace frm
322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */