1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
33 class OTableWindowData
: public ::utl::OEventListenerAdapter
35 mutable ::osl::Mutex m_aMutex
;
39 // the columns of the table
40 css::uno::Reference
< css::beans::XPropertySet
> m_xTable
; // can either be a table or a query
41 css::uno::Reference
< css::container::XIndexAccess
> m_xKeys
;
42 css::uno::Reference
< css::container::XNameAccess
> m_xColumns
;
44 OUString m_aTableName
;
46 OUString m_sComposedName
;
54 explicit OTableWindowData( const css::uno::Reference
< css::beans::XPropertySet
>& _xTable
55 ,const OUString
& _rComposedName
56 ,const OUString
& strTableName
57 ,const OUString
& rWinName
= OUString() );
58 virtual ~OTableWindowData();
63 * \param _bAllowQueries when true, queries are allowed
64 * \return false if the table was unaccessible otherwise true
66 bool init(const css::uno::Reference
< css::sdbc::XConnection
>& _xConnection
67 ,bool _bAllowQueries
);
69 const OUString
& GetComposedName() const { return m_sComposedName
; }
70 const OUString
& GetTableName() const { return m_aTableName
; }
71 const OUString
& GetWinName() const { return m_aWinName
; }
72 const Point
& GetPosition() const { return m_aPosition
; }
73 const 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;
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 css::uno::Reference
< css::beans::XPropertySet
> getTable() const { ::osl::MutexGuard
aGuard( m_aMutex
); return m_xTable
; }
86 inline css::uno::Reference
< css::container::XIndexAccess
> getKeys() const { ::osl::MutexGuard
aGuard( m_aMutex
); return m_xKeys
; }
87 inline css::uno::Reference
< css::container::XNameAccess
> getColumns() const { ::osl::MutexGuard
aGuard( m_aMutex
); return m_xColumns
; }
89 // OEventListenerAdapter
90 virtual void _disposing( const css::lang::EventObject
& _rSource
) override
;
93 typedef ::std::vector
< std::shared_ptr
<OTableWindowData
> > TTableWindowData
;
95 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */