Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
21 :
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>
30 :
31 : namespace dbaui
32 : {
33 : class OTableWindowData : public ::utl::OEventListenerAdapter
34 : {
35 : mutable ::osl::Mutex m_aMutex;
36 :
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;
43 :
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;
52 :
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();
59 :
60 : /** late constructor
61 : *
62 : * \param _xConnection
63 : * \param _bAllowQueries when true, queries are allowed
64 : * \return false if the table was unaccessible otherwise true
65 : */
66 : bool init(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
67 : ,bool _bAllowQueries);
68 :
69 0 : inline OUString GetComposedName() const { return m_sComposedName; }
70 0 : inline OUString GetTableName() const { return m_aTableName; }
71 0 : inline OUString GetWinName() const { return m_aWinName; }
72 0 : inline Point GetPosition() const { return m_aPosition; }
73 0 : inline Size GetSize() const { return m_aSize; }
74 0 : inline bool IsShowAll() const { return m_bShowAll; }
75 0 : inline bool isQuery() const { return m_bIsQuery; }
76 0 : 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;
79 :
80 0 : inline void SetWinName( const OUString& rWinName ) { m_aWinName = rWinName; }
81 0 : inline void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
82 0 : inline void SetSize( const Size& rSize ) { m_aSize = rSize; }
83 0 : inline void ShowAll( bool bAll ) { m_bShowAll = bAll; }
84 :
85 0 : inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; }
86 0 : inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; }
87 0 : inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; }
88 :
89 : // OEventListenerAdapter
90 : virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ) SAL_OVERRIDE;
91 : };
92 :
93 : typedef ::std::vector< ::boost::shared_ptr<OTableWindowData> > TTableWindowData;
94 : }
95 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWDATA_HXX
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|