Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / TableWindowData.hxx
blob29775a40fd7ef47f7b4e1dfb88af876ff32ff874
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
22 #include <tools/gen.hxx>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/container/XIndexAccess.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <unotools/eventlisteneradapter.hxx>
28 #include <boost/shared_ptr.hpp>
29 #include <vector>
31 namespace dbaui
33 class OTableWindowData : public ::utl::OEventListenerAdapter
35 mutable ::osl::Mutex m_aMutex;
37 void listen();
38 protected:
39 // the columns of the table
40 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable; // can either be a table or a query
41 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xKeys;
42 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
44 OUString m_aTableName;
45 OUString m_aWinName;
46 OUString m_sComposedName;
47 Point m_aPosition;
48 Size m_aSize;
49 bool m_bShowAll;
50 bool m_bIsQuery;
51 bool m_bIsValid;
53 public:
54 explicit OTableWindowData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
55 ,const OUString& _rComposedName
56 ,const OUString& strTableName
57 ,const OUString& rWinName = OUString() );
58 virtual ~OTableWindowData();
60 /** late constructor
62 * \param _xConnection
63 * \param _bAllowQueries when true, queries are allowed
64 * \return false if the table was unaccessible otherwise true
66 bool init(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
67 ,bool _bAllowQueries);
69 inline OUString GetComposedName() const { return m_sComposedName; }
70 inline OUString GetTableName() const { return m_aTableName; }
71 inline OUString GetWinName() const { return m_aWinName; }
72 inline Point GetPosition() const { return m_aPosition; }
73 inline Size GetSize() const { return m_aSize; }
74 inline bool IsShowAll() const { return m_bShowAll; }
75 inline bool isQuery() const { return m_bIsQuery; }
76 inline bool isValid() const { return m_bIsValid; } // it is either a table or query but it is known
77 bool HasPosition() const;
78 bool HasSize() const;
80 inline void SetWinName( const OUString& rWinName ) { m_aWinName = rWinName; }
81 inline void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
82 inline void SetSize( const Size& rSize ) { m_aSize = rSize; }
83 inline void ShowAll( bool bAll ) { m_bShowAll = bAll; }
85 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; }
86 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; }
87 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; }
89 // OEventListenerAdapter
90 virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ) SAL_OVERRIDE;
93 typedef ::std::vector< ::boost::shared_ptr<OTableWindowData> > TTableWindowData;
95 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */