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 #include "errorbroadcaster.hxx" 25cdf0e10cSrcweir #include "FormComponent.hxx" 26cdf0e10cSrcweir #include "formcontrolfont.hxx" 27cdf0e10cSrcweir #include "InterfaceContainer.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir /** === begin UNO includes === **/ 30cdf0e10cSrcweir #include <com/sun/star/form/XGridColumnFactory.hpp> 31cdf0e10cSrcweir #include <com/sun/star/form/XLoadable.hpp> 32cdf0e10cSrcweir #include <com/sun/star/sdb/XRowSetSupplier.hpp> 33cdf0e10cSrcweir #include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp> 34cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp> 35cdf0e10cSrcweir /** === end UNO includes === **/ 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 38cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx> 39cdf0e10cSrcweir #include <tools/link.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir //......................................................................... 42cdf0e10cSrcweir namespace frm 43cdf0e10cSrcweir { 44cdf0e10cSrcweir //......................................................................... 45cdf0e10cSrcweir 46cdf0e10cSrcweir class OGridColumn; 47cdf0e10cSrcweir 48cdf0e10cSrcweir //================================================================== 49cdf0e10cSrcweir // ColumnDescription 50cdf0e10cSrcweir //================================================================== 51cdf0e10cSrcweir 52cdf0e10cSrcweir struct ColumnDescription : public ElementDescription 53cdf0e10cSrcweir { 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir OGridColumn* pColumn; // not owned by this instance! only to prevent duplicate XUnoTunnel usage 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir //================================================================== 59cdf0e10cSrcweir // OGridControlModel 60cdf0e10cSrcweir //================================================================== 61cdf0e10cSrcweir typedef ::cppu::ImplHelper7 < ::com::sun::star::awt::XControlModel 62cdf0e10cSrcweir , ::com::sun::star::form::XGridColumnFactory 63cdf0e10cSrcweir , ::com::sun::star::form::XReset 64cdf0e10cSrcweir , ::com::sun::star::view::XSelectionSupplier 65cdf0e10cSrcweir , ::com::sun::star::sdb::XSQLErrorListener 66cdf0e10cSrcweir , ::com::sun::star::sdb::XRowSetSupplier 67cdf0e10cSrcweir , ::com::sun::star::sdb::XRowSetChangeBroadcaster 68cdf0e10cSrcweir > OGridControlModel_BASE; 69cdf0e10cSrcweir 70cdf0e10cSrcweir class OGridControlModel :public OControlModel 71cdf0e10cSrcweir ,public OInterfaceContainer 72cdf0e10cSrcweir ,public OErrorBroadcaster 73cdf0e10cSrcweir ,public FontControlModel 74cdf0e10cSrcweir ,public OGridControlModel_BASE 75cdf0e10cSrcweir { 76cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper m_aSelectListeners, 77cdf0e10cSrcweir m_aResetListeners, 78cdf0e10cSrcweir m_aRowSetChangeListeners; 79cdf0e10cSrcweir 80cdf0e10cSrcweir // [properties] 81cdf0e10cSrcweir ::com::sun::star::uno::Any m_aRowHeight; // Zeilenhoehe 82cdf0e10cSrcweir ::com::sun::star::uno::Any m_aTabStop; 83cdf0e10cSrcweir ::com::sun::star::uno::Any m_aBackgroundColor; 84cdf0e10cSrcweir ::com::sun::star::uno::Any m_aCursorColor; // transient 85cdf0e10cSrcweir ::com::sun::star::uno::Any m_aBorderColor; 86cdf0e10cSrcweir ::rtl::OUString m_aDefaultControl; 87cdf0e10cSrcweir ::rtl::OUString m_sHelpText; 88cdf0e10cSrcweir // [properties] 89cdf0e10cSrcweir 90cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection; 91cdf0e10cSrcweir 92cdf0e10cSrcweir // [properties] 93cdf0e10cSrcweir ::rtl::OUString m_sHelpURL; // URL 94cdf0e10cSrcweir sal_Int16 m_nBorder; 95cdf0e10cSrcweir sal_Int16 m_nWritingMode; 96cdf0e10cSrcweir sal_Int16 m_nContextWritingMode; 97cdf0e10cSrcweir sal_Bool m_bEnableVisible : 1; 98cdf0e10cSrcweir sal_Bool m_bEnable : 1; 99cdf0e10cSrcweir sal_Bool m_bNavigation : 1; 100cdf0e10cSrcweir sal_Bool m_bRecordMarker : 1; 101cdf0e10cSrcweir sal_Bool m_bPrintable : 1; 102cdf0e10cSrcweir sal_Bool m_bAlwaysShowCursor : 1; // transient 103cdf0e10cSrcweir sal_Bool m_bDisplaySynchron : 1; // transient 104cdf0e10cSrcweir // [properties] 105cdf0e10cSrcweir 106cdf0e10cSrcweir protected: 107cdf0e10cSrcweir void _reset(); 108cdf0e10cSrcweir 109cdf0e10cSrcweir public: 110cdf0e10cSrcweir DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // UNO Anbindung 113cdf0e10cSrcweir DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel); 114cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir // XChild 117cdf0e10cSrcweir virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // XServiceInfo 120cdf0e10cSrcweir IMPLEMENTATION_NAME(OGridControlModel); 121cdf0e10cSrcweir virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir 123cdf0e10cSrcweir // XTypeProvider 124cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir 126cdf0e10cSrcweir // OComponentHelper 127cdf0e10cSrcweir virtual void SAL_CALL disposing(); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // XEventListener 130cdf0e10cSrcweir virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // XReset 133cdf0e10cSrcweir virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException); 134cdf0e10cSrcweir virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); 135cdf0e10cSrcweir virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); 136cdf0e10cSrcweir 137cdf0e10cSrcweir // XSelectionSupplier 138cdf0e10cSrcweir virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 139cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException); 142cdf0e10cSrcweir 143cdf0e10cSrcweir // XGridColumnFactory 144cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> SAL_CALL createColumn(const ::rtl::OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 145cdf0e10cSrcweir virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException); 146cdf0e10cSrcweir 147cdf0e10cSrcweir // XPersistObject 148cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); 149cdf0e10cSrcweir virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 150cdf0e10cSrcweir virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 151cdf0e10cSrcweir 152cdf0e10cSrcweir // XPropertySet 153cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 154cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, 155cdf0e10cSrcweir sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 156cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException); 157cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); 158cdf0e10cSrcweir 159cdf0e10cSrcweir // XPropertyState 160cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; 161cdf0e10cSrcweir 162cdf0e10cSrcweir // XSQLErrorListener 163cdf0e10cSrcweir virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); 164cdf0e10cSrcweir 165cdf0e10cSrcweir // XRowSetSupplier 166cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet( ) throw (::com::sun::star::uno::RuntimeException); 167cdf0e10cSrcweir virtual void SAL_CALL setRowSet( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource ) throw (::com::sun::star::uno::RuntimeException); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // XRowSetChangeBroadcaster 170cdf0e10cSrcweir virtual void SAL_CALL addRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException); 171cdf0e10cSrcweir virtual void SAL_CALL removeRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException); 172cdf0e10cSrcweir 173cdf0e10cSrcweir // OControlModel's property handling 174cdf0e10cSrcweir virtual void describeFixedProperties( 175cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps 176cdf0e10cSrcweir ) const; 177cdf0e10cSrcweir 178cdf0e10cSrcweir // prevent method hiding 179cdf0e10cSrcweir using OControlModel::disposing; 180cdf0e10cSrcweir using OControlModel::getFastPropertyValue; 181cdf0e10cSrcweir 182cdf0e10cSrcweir protected: 183cdf0e10cSrcweir DECLARE_XCLONEABLE(); 184cdf0e10cSrcweir 185cdf0e10cSrcweir protected: 186cdf0e10cSrcweir virtual void approveNewElement( 187cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, 188cdf0e10cSrcweir ElementDescription* _pElement 189cdf0e10cSrcweir ); 190cdf0e10cSrcweir 191cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const; 192cdf0e10cSrcweir 193cdf0e10cSrcweir OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const; 194cdf0e10cSrcweir 195cdf0e10cSrcweir virtual ElementDescription* createElementMetaData( ); 196cdf0e10cSrcweir 197cdf0e10cSrcweir protected: 198cdf0e10cSrcweir virtual void implRemoved(const InterfaceRef& _rxObject); 199cdf0e10cSrcweir virtual void implInserted( const ElementDescription* _pElement ); 200cdf0e10cSrcweir virtual void impl_replacedElement( 201cdf0e10cSrcweir const ::com::sun::star::container::ContainerEvent& _rEvent, 202cdf0e10cSrcweir ::osl::ClearableMutexGuard& _rInstanceLock 203cdf0e10cSrcweir ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); 206cdf0e10cSrcweir void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); 207cdf0e10cSrcweir 208cdf0e10cSrcweir void cloneColumns( const OGridControlModel* _pOriginalContainer ); 209cdf0e10cSrcweir }; 210cdf0e10cSrcweir 211cdf0e10cSrcweir //......................................................................... 212cdf0e10cSrcweir } // namespace frm 213cdf0e10cSrcweir //......................................................................... 214cdf0e10cSrcweir 215cdf0e10cSrcweir 216