Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / TableWindowData.hxx
blob0160ea723316a5723ce480aebe323de01c386f7c
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 #pragma once
21 #include <tools/gen.hxx>
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/container/XIndexAccess.hpp>
25 #include <com/sun/star/sdbc/XConnection.hpp>
26 #include <unotools/eventlisteneradapter.hxx>
27 #include <memory>
28 #include <vector>
30 namespace dbaui
32 class OTableWindowData : public ::utl::OEventListenerAdapter
34 mutable ::osl::Mutex m_aMutex;
36 void listen();
38 // the columns of the table
39 css::uno::Reference< css::beans::XPropertySet > m_xTable; // can either be a table or a query
40 css::uno::Reference< css::container::XIndexAccess> m_xKeys;
41 css::uno::Reference< css::container::XNameAccess > m_xColumns;
43 OUString m_aTableName;
44 OUString m_aWinName;
45 OUString m_sComposedName;
46 Point m_aPosition;
47 Size m_aSize;
48 bool m_bShowAll;
49 bool m_bIsQuery;
50 bool m_bIsValid;
52 public:
53 explicit OTableWindowData( const css::uno::Reference< css::beans::XPropertySet>& _xTable
54 ,OUString _sComposedName
55 ,OUString strTableName
56 ,OUString sWinName );
57 virtual ~OTableWindowData() override;
59 /** late constructor
61 * \param _xConnection
62 * \param _bAllowQueries when true, queries are allowed
63 * \return false if the table was unaccessible otherwise true
65 bool init(const css::uno::Reference< css::sdbc::XConnection >& _xConnection
66 ,bool _bAllowQueries);
68 const OUString& GetComposedName() const { return m_sComposedName; }
69 const OUString& GetTableName() const { return m_aTableName; }
70 const OUString& GetWinName() const { return m_aWinName; }
71 const Point& GetPosition() const { return m_aPosition; }
72 const Size& GetSize() const { return m_aSize; }
73 bool IsShowAll() const { return m_bShowAll; }
74 bool isQuery() const { return m_bIsQuery; }
75 bool isValid() const { return m_bIsValid; } // it is either a table or query but it is known
76 bool HasPosition() const;
77 bool HasSize() const;
79 void SetWinName( const OUString& rWinName ) { m_aWinName = rWinName; }
80 void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
81 void SetSize( const Size& rSize ) { m_aSize = rSize; }
82 void ShowAll( bool bAll ) { m_bShowAll = bAll; }
84 css::uno::Reference< css::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; }
85 css::uno::Reference< css::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; }
86 css::uno::Reference< css::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; }
88 // OEventListenerAdapter
89 virtual void _disposing( const css::lang::EventObject& _rSource ) override;
92 typedef std::vector< std::shared_ptr<OTableWindowData> > TTableWindowData;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */