1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef DBAUI_TABLEWINDOWDATA_HXX 24 #define DBAUI_TABLEWINDOWDATA_HXX 25 26 #ifndef _SV_GEN_HXX 27 #include <tools/gen.hxx> 28 #endif 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 #include <com/sun/star/container/XNameAccess.hpp> 31 #include <com/sun/star/container/XIndexAccess.hpp> 32 #include <com/sun/star/sdbc/XConnection.hpp> 33 #include <unotools/eventlisteneradapter.hxx> 34 #include <boost/shared_ptr.hpp> 35 #include <vector> 36 37 namespace dbaui 38 { 39 class OTableWindowData : public ::utl::OEventListenerAdapter 40 { 41 mutable ::osl::Mutex m_aMutex; 42 43 void listen(); 44 protected: 45 // the columns of the table 46 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable; // can either be a table or a query 47 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xKeys; 48 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; 49 50 ::rtl::OUString m_aTableName; 51 ::rtl::OUString m_aWinName; 52 ::rtl::OUString m_sComposedName; 53 Point m_aPosition; 54 Size m_aSize; 55 sal_Bool m_bShowAll; 56 bool m_bIsQuery; 57 bool m_bIsValid; 58 59 public: 60 explicit OTableWindowData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable 61 ,const ::rtl::OUString& _rComposedName 62 ,const ::rtl::OUString& strTableName 63 ,const ::rtl::OUString& rWinName = ::rtl::OUString() ); 64 virtual ~OTableWindowData(); 65 66 /** late constructor 67 * 68 * \param _xConnection 69 * \param _bAllowQueries when true, queries are allowed 70 * \return false if the table was unaccessible otherwise true 71 */ 72 bool init(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection 73 ,bool _bAllowQueries); 74 GetComposedName() const75 inline ::rtl::OUString GetComposedName() const { return m_sComposedName; } GetTableName() const76 inline ::rtl::OUString GetTableName() const { return m_aTableName; } GetWinName() const77 inline ::rtl::OUString GetWinName() const { return m_aWinName; } GetPosition() const78 inline Point GetPosition() const { return m_aPosition; } GetSize() const79 inline Size GetSize() const { return m_aSize; } IsShowAll() const80 inline sal_Bool IsShowAll() const { return m_bShowAll; } isQuery() const81 inline bool isQuery() const { return m_bIsQuery; } isValid() const82 inline bool isValid() const { return m_bIsValid; } // it is either a table or query but it is known 83 sal_Bool HasPosition() const; 84 sal_Bool HasSize() const; 85 SetWinName(const::rtl::OUString & rWinName)86 inline void SetWinName( const ::rtl::OUString& rWinName ) { m_aWinName = rWinName; } SetPosition(const Point & rPos)87 inline void SetPosition( const Point& rPos ) { m_aPosition=rPos; } SetSize(const Size & rSize)88 inline void SetSize( const Size& rSize ) { m_aSize = rSize; } ShowAll(sal_Bool bAll)89 inline void ShowAll( sal_Bool bAll ) { m_bShowAll = bAll; } 90 getTable() const91 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; } getKeys() const92 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; } getColumns() const93 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; } 94 95 // OEventListenerAdapter 96 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ); 97 }; 98 99 typedef ::std::vector< ::boost::shared_ptr<OTableWindowData> > TTableWindowData; 100 } 101 #endif // DBAUI_TABLEWINDOWDATA_HXX 102 103