Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _FRM_COLUMNS_HXX
30 : : #define _FRM_COLUMNS_HXX
31 : :
32 : : #include "cloneable.hxx"
33 : : #include "frm_strings.hxx"
34 : :
35 : : #include <com/sun/star/io/XObjectInputStream.hpp>
36 : : #include <com/sun/star/io/XObjectOutputStream.hpp>
37 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
38 : : #include <com/sun/star/util/XCloneable.hpp>
39 : :
40 : : #include <comphelper/broadcasthelper.hxx>
41 : : #include <comphelper/componentcontext.hxx>
42 : : #include <comphelper/propagg.hxx>
43 : : #include <comphelper/proparrhlp.hxx>
44 : : #include <comphelper/uno3.hxx>
45 : : #include <cppuhelper/compbase2.hxx>
46 : : #include <cppuhelper/component.hxx>
47 : :
48 : : using namespace comphelper;
49 : :
50 : : //.........................................................................
51 : : namespace frm
52 : : {
53 : : //.........................................................................
54 : :
55 : : //==================================================================
56 : : // OGridColumn
57 : : //==================================================================
58 : : typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::lang::XUnoTunnel
59 : : , ::com::sun::star::util::XCloneable > OGridColumn_BASE;
60 : : class OGridColumn :public ::comphelper::OBaseMutex
61 : : ,public OGridColumn_BASE
62 : : ,public OPropertySetAggregationHelper
63 : : ,public OCloneableAggregation
64 : : {
65 : : protected:
66 : : // [properties]
67 : : ::com::sun::star::uno::Any m_aWidth; // column width
68 : : ::com::sun::star::uno::Any m_aAlign; // column alignment
69 : : ::com::sun::star::uno::Any m_aHidden; // column hidden?
70 : : // [properties]
71 : :
72 : : ::comphelper::ComponentContext m_aContext;
73 : : ::rtl::OUString m_aModelName;
74 : :
75 : : // [properties]
76 : : ::rtl::OUString m_aLabel; // Column name
77 : : // [properties]
78 : :
79 : : public:
80 : : OGridColumn(const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName = ::rtl::OUString());
81 : : OGridColumn(const OGridColumn* _pOriginal );
82 : : virtual ~OGridColumn();
83 : :
84 : : // UNO binding
85 : 505938 : DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE);
86 : : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
87 : :
88 : : static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelImplementationId();
89 : : // XUnoTunnel
90 : : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<sal_Int8>& _rIdentifier) throw(::com::sun::star::uno::RuntimeException);
91 : :
92 : : // XTypeProvider
93 : : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
94 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
95 : :
96 : : // OComponentHelper
97 : : virtual void SAL_CALL disposing();
98 : :
99 : : // XEventListener
100 : : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
101 : :
102 : : // XPersistObject
103 : : virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
104 : : virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
105 : :
106 : : // XPropertySet
107 : : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
108 : : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
109 : : virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
110 : : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
111 : : throw(::com::sun::star::lang::IllegalArgumentException);
112 : : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
113 : :
114 : : using OPropertySetAggregationHelper::getFastPropertyValue;
115 : :
116 : : // ::com::sun::star::beans::XPropertyState
117 : : virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
118 : :
119 : : // XCloneable
120 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
121 : :
122 : 4 : const ::rtl::OUString& getModelName() const { return m_aModelName; }
123 : :
124 : : protected:
125 : : static void clearAggregateProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps, sal_Bool bAllowDropDown);
126 : : static void setOwnProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps);
127 : :
128 : : virtual OGridColumn* createCloneColumn() const = 0;
129 : : };
130 : :
131 : : #define DECL_COLUMN(ClassName) \
132 : : class ClassName \
133 : : :public OGridColumn \
134 : : ,public OAggregationArrayUsageHelper< ClassName > \
135 : : { \
136 : : public: \
137 : : ClassName(const ::comphelper::ComponentContext& _rContext ); \
138 : : ClassName(const ClassName* _pCloneFrom); \
139 : : \
140 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \
141 : : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \
142 : : \
143 : : virtual void fillProperties( \
144 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \
145 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \
146 : : ) const; \
147 : : \
148 : : virtual OGridColumn* createCloneColumn() const; \
149 : : };
150 : :
151 : :
152 : : #define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \
153 : : ClassName::ClassName( const ::comphelper::ComponentContext& _rContext ) \
154 : : :OGridColumn(_rContext, Model) \
155 : : { \
156 : : } \
157 : : ClassName::ClassName( const ClassName* _pCloneFrom ) \
158 : : :OGridColumn( _pCloneFrom ) \
159 : : { \
160 : : } \
161 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> ClassName::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) \
162 : : { \
163 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \
164 : : return xInfo; \
165 : : } \
166 : : ::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \
167 : : { \
168 : : return *const_cast<ClassName*>(this)->getArrayHelper(); \
169 : : } \
170 : : void ClassName::fillProperties( \
171 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \
172 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \
173 : : ) const \
174 : : { \
175 : : if (m_xAggregateSet.is()) \
176 : : { \
177 : : _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \
178 : : clearAggregateProperties(_rAggregateProps, bAllowDropDown); \
179 : : setOwnProperties(_rProps); \
180 : : } \
181 : : } \
182 : : OGridColumn* ClassName::createCloneColumn() const \
183 : : { \
184 : : return new ClassName( this ); \
185 : : } \
186 : : \
187 : : // column type ids
188 : : #define TYPE_CHECKBOX 0
189 : : #define TYPE_COMBOBOX 1
190 : : #define TYPE_CURRENCYFIELD 2
191 : : #define TYPE_DATEFIELD 3
192 : : #define TYPE_FORMATTEDFIELD 4
193 : : #define TYPE_LISTBOX 5
194 : : #define TYPE_NUMERICFIELD 6
195 : : #define TYPE_PATTERNFIELD 7
196 : : #define TYPE_TEXTFIELD 8
197 : : #define TYPE_TIMEFIELD 9
198 : :
199 : : // List of all known columns
200 : : const StringSequence& getColumnTypes();
201 : : sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName);
202 : :
203 : : // Columns
204 [ + - ][ - + ]: 132 : DECL_COLUMN(TextFieldColumn)
205 [ # # ][ # # ]: 0 : DECL_COLUMN(PatternFieldColumn)
206 [ + - ][ - + ]: 20 : DECL_COLUMN(DateFieldColumn)
207 [ # # ][ # # ]: 0 : DECL_COLUMN(TimeFieldColumn)
208 [ # # ][ # # ]: 0 : DECL_COLUMN(NumericFieldColumn)
209 [ # # ][ # # ]: 0 : DECL_COLUMN(CurrencyFieldColumn)
210 [ # # ][ # # ]: 0 : DECL_COLUMN(CheckBoxColumn)
211 [ # # ][ # # ]: 0 : DECL_COLUMN(ComboBoxColumn)
212 [ # # ][ # # ]: 0 : DECL_COLUMN(ListBoxColumn)
213 [ + - ][ - + ]: 56 : DECL_COLUMN(FormattedFieldColumn)
214 : :
215 : : #endif // _FRM_COLUMNS_HXX
216 : :
217 : : //.........................................................................
218 : : } // namespace frm
219 : : //.........................................................................
220 : :
221 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|