LibreOffice Module dbaccess (master) 1
TableGrantCtrl.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 <sal/config.h>
22
23#include <map>
24
26#include <com/sun/star/awt/XWindow.hpp>
27#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
28#include <com/sun/star/sdbcx/XAuthorizable.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30
31class Edit;
32namespace dbaui
33{
34
36{
37 typedef struct
38 {
39 sal_Int32 nRights;
40 sal_Int32 nWithGrant;
42
43 typedef std::map<OUString, TPrivileges> TTablePrivilegeMap;
44
45 css::uno::Reference< css::container::XNameAccess > m_xUsers;
46 css::uno::Reference< css::container::XNameAccess > m_xTables;
47 css::uno::Reference< css::uno::XComponentContext> m_xContext;
48 css::uno::Reference< css::sdbcx::XAuthorizable> m_xGrantUser;
49 css::uno::Sequence< OUString> m_aTableNames;
50
52 OUString m_sUserName;
57
58public:
59 OTableGrantControl(const css::uno::Reference<css::awt::XWindow> &rParent);
60 virtual ~OTableGrantControl() override;
61 virtual void dispose() override;
62 void UpdateTables();
63 void setUserName(const OUString& _sUserName);
64 void setGrantUser(const css::uno::Reference< css::sdbcx::XAuthorizable>& _xGrantUser);
65
66 void setTablesSupplier(const css::uno::Reference< css::sdbcx::XTablesSupplier >& _xTablesSup);
67 void setComponentContext(const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
68
69 virtual void Init() override;
70
71 // IAccessibleTableProvider
76 virtual css::uno::Reference<
77 css::accessibility::XAccessible >
78 CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
79
80protected:
81 virtual bool PreNotify(NotifyEvent& rNEvt ) override;
82
83 virtual bool IsTabAllowed(bool bForward) const override;
84 virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
85 virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
86 virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
87 virtual bool SeekRow( sal_Int32 nRow ) override;
88 virtual bool SaveModified() override;
89 virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
90
91 virtual void CellModified() override;
92
93private:
94 DECL_LINK( AsynchActivate, void*, void );
95 DECL_LINK( AsynchDeactivate, void*, void );
96
97 static bool isAllowed(sal_uInt16 _nColumnId,sal_Int32 _nPrivilege);
98 void fillPrivilege(sal_Int32 _nRow) const;
99 TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const;
100};
101
102}
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::sdbcx::XAuthorizable > m_xGrantUser
void fillPrivilege(sal_Int32 _nRow) const
virtual bool IsTabAllowed(bool bForward) const override
css::uno::Reference< css::container::XNameAccess > m_xTables
std::map< OUString, TPrivileges > TTablePrivilegeMap
void setGrantUser(const css::uno::Reference< css::sdbcx::XAuthorizable > &_xGrantUser)
OTableGrantControl(const css::uno::Reference< css::awt::XWindow > &rParent)
void setComponentContext(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
VclPtr<::svt::EditControl > m_pEdit
DECL_LINK(AsynchDeactivate, void *, void)
css::uno::Sequence< OUString > m_aTableNames
void setTablesSupplier(const css::uno::Reference< css::sdbcx::XTablesSupplier > &_xTablesSup)
virtual ~OTableGrantControl() override
static bool isAllowed(sal_uInt16 _nColumnId, sal_Int32 _nPrivilege)
TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const
ImplSVEvent * m_nDeactivateEvent
void setUserName(const OUString &_sUserName)
css::uno::Reference< css::container::XNameAccess > m_xUsers
virtual void Init() override
TTablePrivilegeMap m_aPrivMap
virtual bool SaveModified() override
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual bool PreNotify(NotifyEvent &rNEvt) override
DECL_LINK(AsynchActivate, void *, void)
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override
Creates the accessible object of a data table cell.
VclPtr<::svt::CheckBoxControl > m_pCheckCell
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
virtual void dispose() override
virtual bool SeekRow(sal_Int32 nRow) override
virtual void CellModified() override
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColId) const override
long Long