1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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
;
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
51 css::uno::Any m_aWidth
; // column width
52 css::uno::Any m_aAlign
; // column alignment
53 css::uno::Any m_aHidden
; // column hidden?
56 OUString m_aModelName
;
59 OUString m_aLabel
; // Column name
63 OGridColumn(const css::uno::Reference
<css::uno::XComponentContext
>& _rContext
, const OUString
& _sModelName
);
64 explicit OGridColumn(const OGridColumn
* _pOriginal
);
65 virtual ~OGridColumn() override
;
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();
73 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
<sal_Int8
>& _rIdentifier
) override
;
76 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() override
;
77 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
80 virtual void SAL_CALL
disposing() override
;
83 virtual void SAL_CALL
disposing(const css::lang::EventObject
& _rSource
) override
;
86 void write(const css::uno::Reference
< css::io::XObjectOutputStream
>& _rxOutStream
);
87 void read(const css::uno::Reference
< css::io::XObjectInputStream
>& _rxInStream
);
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
;
102 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
104 const OUString
& getModelName() const { return m_aModelName
; }
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;
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
);
130 class TextFieldColumn
132 ,public OAggregationArrayUsageHelper
< TextFieldColumn
>
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
146 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
149 class PatternFieldColumn
151 ,public OAggregationArrayUsageHelper
< PatternFieldColumn
>
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
165 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
168 class DateFieldColumn
170 ,public OAggregationArrayUsageHelper
< DateFieldColumn
>
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
184 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
187 class TimeFieldColumn
189 ,public OAggregationArrayUsageHelper
< TimeFieldColumn
>
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
203 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
206 class NumericFieldColumn
208 ,public OAggregationArrayUsageHelper
< NumericFieldColumn
>
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
222 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
225 class CurrencyFieldColumn
227 ,public OAggregationArrayUsageHelper
< CurrencyFieldColumn
>
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
241 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
246 ,public OAggregationArrayUsageHelper
< CheckBoxColumn
>
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
260 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
265 ,public OAggregationArrayUsageHelper
< ComboBoxColumn
>
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
279 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
284 ,public OAggregationArrayUsageHelper
< ListBoxColumn
>
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
298 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
301 class FormattedFieldColumn
303 ,public OAggregationArrayUsageHelper
< FormattedFieldColumn
>
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
317 virtual rtl::Reference
<OGridColumn
> createCloneColumn() const override
;
322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */