update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / TableWindowData.hxx
blob61e480d564589de3c2067657de1ae19464d96cf8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableWindowData.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TABLEWINDOWDATA_HXX
31 #define DBAUI_TABLEWINDOWDATA_HXX
33 #ifndef _SV_GEN_HXX
34 #include <tools/gen.hxx>
35 #endif
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/container/XNameAccess.hpp>
38 #include <com/sun/star/container/XIndexAccess.hpp>
39 #include <com/sun/star/sdbc/XConnection.hpp>
40 #include <unotools/eventlisteneradapter.hxx>
41 #include <boost/shared_ptr.hpp>
42 #include <vector>
44 namespace dbaui
46 class OTableWindowData : public ::utl::OEventListenerAdapter
48 mutable ::osl::Mutex m_aMutex;
50 void listen();
51 protected:
52 // the columns of the table
53 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable; // can either be a table or a query
54 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xKeys;
55 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
57 ::rtl::OUString m_aTableName;
58 ::rtl::OUString m_aWinName;
59 ::rtl::OUString m_sComposedName;
60 Point m_aPosition;
61 Size m_aSize;
62 sal_Bool m_bShowAll;
63 bool m_bIsQuery;
64 bool m_bIsValid;
66 public:
67 explicit OTableWindowData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
68 ,const ::rtl::OUString& _rComposedName
69 ,const ::rtl::OUString& strTableName
70 ,const ::rtl::OUString& rWinName = ::rtl::OUString() );
71 virtual ~OTableWindowData();
73 /** late constructor
75 * \param _xConnection
76 * \param _bAllowQueries when true, queries are allowed
77 * \return false if the table was unaccessible otherwise true
79 bool init(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
80 ,bool _bAllowQueries);
82 inline ::rtl::OUString GetComposedName() const { return m_sComposedName; }
83 inline ::rtl::OUString GetTableName() const { return m_aTableName; }
84 inline ::rtl::OUString GetWinName() const { return m_aWinName; }
85 inline Point GetPosition() const { return m_aPosition; }
86 inline Size GetSize() const { return m_aSize; }
87 inline BOOL IsShowAll() const { return m_bShowAll; }
88 inline bool isQuery() const { return m_bIsQuery; }
89 inline bool isValid() const { return m_bIsValid; } // it is either a table or query but it is known
90 BOOL HasPosition() const;
91 BOOL HasSize() const;
93 inline void SetWinName( const ::rtl::OUString& rWinName ) { m_aWinName = rWinName; }
94 inline void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
95 inline void SetSize( const Size& rSize ) { m_aSize = rSize; }
96 inline void ShowAll( BOOL bAll ) { m_bShowAll = bAll; }
98 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; }
99 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; }
100 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; }
102 // OEventListenerAdapter
103 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
106 typedef ::std::vector< ::boost::shared_ptr<OTableWindowData> > TTableWindowData;
108 #endif // DBAUI_TABLEWINDOWDATA_HXX