1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _FRM_COLUMNS_HXX 25cdf0e10cSrcweir #define _FRM_COLUMNS_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "cloneable.hxx" 28cdf0e10cSrcweir #include "frm_strings.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** === begin UNO includes === **/ 31cdf0e10cSrcweir #include <com/sun/star/io/XObjectInputStream.hpp> 32cdf0e10cSrcweir #include <com/sun/star/io/XObjectOutputStream.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 34cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp> 35cdf0e10cSrcweir /** === end UNO includes === **/ 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 38cdf0e10cSrcweir #include <comphelper/componentcontext.hxx> 39cdf0e10cSrcweir #include <comphelper/propagg.hxx> 40cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 41cdf0e10cSrcweir #include <comphelper/uno3.hxx> 42cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx> 43cdf0e10cSrcweir #include <cppuhelper/component.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir using namespace comphelper; 46cdf0e10cSrcweir 47cdf0e10cSrcweir //......................................................................... 48cdf0e10cSrcweir namespace frm 49cdf0e10cSrcweir { 50cdf0e10cSrcweir //......................................................................... 51cdf0e10cSrcweir 52cdf0e10cSrcweir //================================================================== 53cdf0e10cSrcweir // OGridColumn 54cdf0e10cSrcweir //================================================================== 55cdf0e10cSrcweir typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::lang::XUnoTunnel 56cdf0e10cSrcweir , ::com::sun::star::util::XCloneable > OGridColumn_BASE; 57cdf0e10cSrcweir class OGridColumn :public ::comphelper::OBaseMutex 58cdf0e10cSrcweir ,public OGridColumn_BASE 59cdf0e10cSrcweir ,public OPropertySetAggregationHelper 60cdf0e10cSrcweir ,public OCloneableAggregation 61cdf0e10cSrcweir { 62cdf0e10cSrcweir protected: 63cdf0e10cSrcweir // [properties] 64cdf0e10cSrcweir ::com::sun::star::uno::Any m_aWidth; // column width 65cdf0e10cSrcweir ::com::sun::star::uno::Any m_aAlign; // column alignment 66cdf0e10cSrcweir ::com::sun::star::uno::Any m_aHidden; // column hidden? 67cdf0e10cSrcweir // [properties] 68cdf0e10cSrcweir 69cdf0e10cSrcweir ::comphelper::ComponentContext m_aContext; 70cdf0e10cSrcweir ::rtl::OUString m_aModelName; 71cdf0e10cSrcweir 72cdf0e10cSrcweir // [properties] 73cdf0e10cSrcweir ::rtl::OUString m_aLabel; // Name der Spalte 74cdf0e10cSrcweir // [properties] 75cdf0e10cSrcweir 76cdf0e10cSrcweir public: 77cdf0e10cSrcweir OGridColumn(const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName = ::rtl::OUString()); 78cdf0e10cSrcweir OGridColumn(const OGridColumn* _pOriginal ); 79cdf0e10cSrcweir virtual ~OGridColumn(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir // UNO Anbindung 82cdf0e10cSrcweir DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE); 83cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir 85cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelImplementationId(); 86cdf0e10cSrcweir // XUnoTunnel 87cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<sal_Int8>& _rIdentifier) throw(::com::sun::star::uno::RuntimeException); 88cdf0e10cSrcweir 89cdf0e10cSrcweir // XTypeProvider 90cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 91cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir // OComponentHelper 94cdf0e10cSrcweir virtual void SAL_CALL disposing(); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XEventListener 97cdf0e10cSrcweir virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); 98cdf0e10cSrcweir 99cdf0e10cSrcweir // XPersistObject 100cdf0e10cSrcweir virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); 101cdf0e10cSrcweir virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XPropertySet 104cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0; 105cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 106cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, 107cdf0e10cSrcweir sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 108cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException); 109cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); 110cdf0e10cSrcweir 111cdf0e10cSrcweir using OPropertySetAggregationHelper::getFastPropertyValue; 112cdf0e10cSrcweir 113cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyState 114cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; 115cdf0e10cSrcweir 116cdf0e10cSrcweir // XCloneable 117cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir getModelName() const119cdf0e10cSrcweir const ::rtl::OUString& getModelName() const { return m_aModelName; } 120cdf0e10cSrcweir 121cdf0e10cSrcweir protected: 122cdf0e10cSrcweir static void clearAggregateProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps, sal_Bool bAllowDropDown); 123cdf0e10cSrcweir static void setOwnProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps); 124cdf0e10cSrcweir 125cdf0e10cSrcweir virtual OGridColumn* createCloneColumn() const = 0; 126cdf0e10cSrcweir }; 127cdf0e10cSrcweir 128cdf0e10cSrcweir #define DECL_COLUMN(ClassName) \ 129cdf0e10cSrcweir class ClassName \ 130cdf0e10cSrcweir :public OGridColumn \ 131cdf0e10cSrcweir ,public OAggregationArrayUsageHelper< ClassName > \ 132cdf0e10cSrcweir { \ 133cdf0e10cSrcweir public: \ 134cdf0e10cSrcweir ClassName(const ::comphelper::ComponentContext& _rContext ); \ 135cdf0e10cSrcweir ClassName(const ClassName* _pCloneFrom); \ 136cdf0e10cSrcweir \ 137cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \ 138cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ 139cdf0e10cSrcweir \ 140cdf0e10cSrcweir virtual void fillProperties( \ 141cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ 142cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ 143cdf0e10cSrcweir ) const; \ 144cdf0e10cSrcweir \ 145cdf0e10cSrcweir virtual OGridColumn* createCloneColumn() const; \ 146cdf0e10cSrcweir }; 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir #define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \ 150cdf0e10cSrcweir ClassName::ClassName( const ::comphelper::ComponentContext& _rContext ) \ 151cdf0e10cSrcweir :OGridColumn(_rContext, Model) \ 152cdf0e10cSrcweir { \ 153cdf0e10cSrcweir } \ 154cdf0e10cSrcweir ClassName::ClassName( const ClassName* _pCloneFrom ) \ 155cdf0e10cSrcweir :OGridColumn( _pCloneFrom ) \ 156cdf0e10cSrcweir { \ 157cdf0e10cSrcweir } \ 158cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> ClassName::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) \ 159cdf0e10cSrcweir { \ 160cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \ 161cdf0e10cSrcweir return xInfo; \ 162cdf0e10cSrcweir } \ 163cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \ 164cdf0e10cSrcweir { \ 165cdf0e10cSrcweir return *const_cast<ClassName*>(this)->getArrayHelper(); \ 166cdf0e10cSrcweir } \ 167cdf0e10cSrcweir void ClassName::fillProperties( \ 168cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ 169cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ 170cdf0e10cSrcweir ) const \ 171cdf0e10cSrcweir { \ 172cdf0e10cSrcweir if (m_xAggregateSet.is()) \ 173cdf0e10cSrcweir { \ 174cdf0e10cSrcweir _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \ 175cdf0e10cSrcweir clearAggregateProperties(_rAggregateProps, bAllowDropDown); \ 176cdf0e10cSrcweir setOwnProperties(_rProps); \ 177cdf0e10cSrcweir } \ 178cdf0e10cSrcweir } \ 179cdf0e10cSrcweir OGridColumn* ClassName::createCloneColumn() const \ 180cdf0e10cSrcweir { \ 181cdf0e10cSrcweir return new ClassName( this ); \ 182cdf0e10cSrcweir } \ 183cdf0e10cSrcweir \ 184cdf0e10cSrcweir // column type ids 185cdf0e10cSrcweir #define TYPE_CHECKBOX 0 186cdf0e10cSrcweir #define TYPE_COMBOBOX 1 187cdf0e10cSrcweir #define TYPE_CURRENCYFIELD 2 188cdf0e10cSrcweir #define TYPE_DATEFIELD 3 189cdf0e10cSrcweir #define TYPE_FORMATTEDFIELD 4 190cdf0e10cSrcweir #define TYPE_LISTBOX 5 191cdf0e10cSrcweir #define TYPE_NUMERICFIELD 6 192cdf0e10cSrcweir #define TYPE_PATTERNFIELD 7 193cdf0e10cSrcweir #define TYPE_TEXTFIELD 8 194cdf0e10cSrcweir #define TYPE_TIMEFIELD 9 195cdf0e10cSrcweir 196cdf0e10cSrcweir // liste aller bekannten columns 197cdf0e10cSrcweir const StringSequence& getColumnTypes(); 198cdf0e10cSrcweir sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName); 199cdf0e10cSrcweir 200cdf0e10cSrcweir // Columns 201cdf0e10cSrcweir DECL_COLUMN(TextFieldColumn) 202cdf0e10cSrcweir DECL_COLUMN(PatternFieldColumn) 203cdf0e10cSrcweir DECL_COLUMN(DateFieldColumn) 204cdf0e10cSrcweir DECL_COLUMN(TimeFieldColumn) 205cdf0e10cSrcweir DECL_COLUMN(NumericFieldColumn) 206cdf0e10cSrcweir DECL_COLUMN(CurrencyFieldColumn) 207cdf0e10cSrcweir DECL_COLUMN(CheckBoxColumn) 208cdf0e10cSrcweir DECL_COLUMN(ComboBoxColumn) 209cdf0e10cSrcweir DECL_COLUMN(ListBoxColumn) 210cdf0e10cSrcweir DECL_COLUMN(FormattedFieldColumn) 211cdf0e10cSrcweir 212cdf0e10cSrcweir #endif // _FRM_COLUMNS_HXX 213cdf0e10cSrcweir 214cdf0e10cSrcweir //......................................................................... 215cdf0e10cSrcweir } // namespace frm 216cdf0e10cSrcweir //......................................................................... 217cdf0e10cSrcweir 218