LibreOffice Module dbaccess (master) 1
TableWindowData.hxx
Go to the documentation of this file.
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#pragma once
20
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>
27#include <memory>
28#include <vector>
29
30namespace dbaui
31{
33 {
34 mutable ::osl::Mutex m_aMutex;
35
36 void listen();
37
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;
42
43 OUString m_aTableName;
44 OUString m_aWinName;
51
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;
58
65 bool init(const css::uno::Reference< css::sdbc::XConnection >& _xConnection
66 ,bool _bAllowQueries);
67
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;
78
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; }
83
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; }
87
88 // OEventListenerAdapter
89 virtual void _disposing( const css::lang::EventObject& _rSource ) override;
90 };
91
92 typedef std::vector< std::shared_ptr<OTableWindowData> > TTableWindowData;
93}
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Point & GetPosition() const
const Size & GetSize() const
const OUString & GetTableName() const
css::uno::Reference< css::beans::XPropertySet > m_xTable
OTableWindowData(const css::uno::Reference< css::beans::XPropertySet > &_xTable, OUString _sComposedName, OUString strTableName, OUString sWinName)
css::uno::Reference< css::container::XIndexAccess > getKeys() const
css::uno::Reference< css::container::XNameAccess > getColumns() const
mutable::osl::Mutex m_aMutex
css::uno::Reference< css::container::XIndexAccess > m_xKeys
css::uno::Reference< css::beans::XPropertySet > getTable() const
void SetPosition(const Point &rPos)
void SetSize(const Size &rSize)
virtual void _disposing(const css::lang::EventObject &_rSource) override
css::uno::Reference< css::container::XNameAccess > m_xColumns
virtual ~OTableWindowData() override
void SetWinName(const OUString &rWinName)
bool init(const css::uno::Reference< css::sdbc::XConnection > &_xConnection, bool _bAllowQueries)
late constructor
const OUString & GetComposedName() const
const OUString & GetWinName() const
std::vector< std::shared_ptr< OTableWindowData > > TTableWindowData