nss: upgrade to release 3.73
[LibreOffice.git] / forms / source / component / Columns.hxx
blob010252615930846a1891b6bc5ea6e23aba2de1c6
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>
36 using namespace comphelper;
39 namespace frm
42 typedef ::cppu::WeakAggComponentImplHelper2 < css::lang::XUnoTunnel
43 , css::util::XCloneable > OGridColumn_BASE;
44 class OGridColumn :public ::cppu::BaseMutex
45 ,public OGridColumn_BASE
46 ,public OPropertySetAggregationHelper
47 ,public OCloneableAggregation
49 // [properties]
50 css::uno::Any m_aWidth; // column width
51 css::uno::Any m_aAlign; // column alignment
52 css::uno::Any m_aHidden; // column hidden?
53 // [properties]
55 OUString m_aModelName;
57 // [properties]
58 OUString m_aLabel; // Column name
59 // [properties]
61 public:
62 OGridColumn(const css::uno::Reference<css::uno::XComponentContext>& _rContext, const OUString& _sModelName);
63 explicit OGridColumn(const OGridColumn* _pOriginal );
64 virtual ~OGridColumn() override;
66 // UNO binding
67 DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE)
68 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
70 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
71 // XUnoTunnel
72 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<sal_Int8>& _rIdentifier) override;
74 // XTypeProvider
75 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
76 virtual css::uno::Sequence< css::uno::Type> SAL_CALL getTypes() override;
78 // OComponentHelper
79 virtual void SAL_CALL disposing() override;
81 // XEventListener
82 virtual void SAL_CALL disposing(const css::lang::EventObject& _rSource) override;
84 // XPersistObject
85 void write(const css::uno::Reference< css::io::XObjectOutputStream>& _rxOutStream);
86 void read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream);
88 // XPropertySet
89 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override = 0;
90 virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle ) const override;
91 virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any& rConvertedValue, css::uno::Any& rOldValue,
92 sal_Int32 nHandle, const css::uno::Any& rValue ) override;
93 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any& rValue) override;
95 using OPropertySetAggregationHelper::getFastPropertyValue;
97 // css::beans::XPropertyState
98 virtual css::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const override;
100 // XCloneable
101 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
103 const OUString& getModelName() const { return m_aModelName; }
105 protected:
106 static void clearAggregateProperties(css::uno::Sequence< css::beans::Property>& seqProps, bool bAllowDropDown);
107 static void setOwnProperties(css::uno::Sequence< css::beans::Property>& seqProps);
109 virtual OGridColumn* createCloneColumn() const = 0;
112 #define DECL_COLUMN(ClassName) \
113 class ClassName \
114 :public OGridColumn \
115 ,public OAggregationArrayUsageHelper< ClassName > \
117 public: \
118 explicit ClassName(const css::uno::Reference<css::uno::XComponentContext>& _rContext ); \
119 explicit ClassName(const ClassName* _pCloneFrom); \
121 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; \
122 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; \
124 virtual void fillProperties( \
125 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps, \
126 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps \
127 ) const override; \
129 virtual OGridColumn* createCloneColumn() const override; \
133 #define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \
134 ClassName::ClassName( const css::uno::Reference<css::uno::XComponentContext>& _rContext ) \
135 :OGridColumn(_rContext, Model) \
138 ClassName::ClassName( const ClassName* _pCloneFrom ) \
139 :OGridColumn( _pCloneFrom ) \
142 css::uno::Reference< css::beans::XPropertySetInfo> ClassName::getPropertySetInfo() \
144 css::uno::Reference< css::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \
145 return xInfo; \
147 ::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \
149 return *getArrayHelper(); \
151 void ClassName::fillProperties( \
152 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps, \
153 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps \
154 ) const \
156 if (m_xAggregateSet.is()) \
158 _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \
159 clearAggregateProperties(_rAggregateProps, bAllowDropDown); \
160 setOwnProperties(_rProps); \
163 OGridColumn* ClassName::createCloneColumn() const \
165 return new ClassName( this ); \
168 // column type ids
169 #define TYPE_CHECKBOX 0
170 #define TYPE_COMBOBOX 1
171 #define TYPE_CURRENCYFIELD 2
172 #define TYPE_DATEFIELD 3
173 #define TYPE_FORMATTEDFIELD 4
174 #define TYPE_LISTBOX 5
175 #define TYPE_NUMERICFIELD 6
176 #define TYPE_PATTERNFIELD 7
177 #define TYPE_TEXTFIELD 8
178 #define TYPE_TIMEFIELD 9
180 // List of all known columns
181 const css::uno::Sequence<OUString>& getColumnTypes();
182 sal_Int32 getColumnTypeByModelName(const OUString& aModelName);
184 // Columns
185 DECL_COLUMN(TextFieldColumn)
186 DECL_COLUMN(PatternFieldColumn)
187 DECL_COLUMN(DateFieldColumn)
188 DECL_COLUMN(TimeFieldColumn)
189 DECL_COLUMN(NumericFieldColumn)
190 DECL_COLUMN(CurrencyFieldColumn)
191 DECL_COLUMN(CheckBoxColumn)
192 DECL_COLUMN(ComboBoxColumn)
193 DECL_COLUMN(ListBoxColumn)
194 DECL_COLUMN(FormattedFieldColumn)
196 } // namespace frm
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */