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_TABLEGRANTCTRL_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEGRANTCTRL_HXX
22 #include <sal/config.h>
26 #include <svtools/editbrowsebox.hxx>
27 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
28 #include <com/sun/star/sdbcx/XAuthorizable.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include "moduledbu.hxx"
36 class OTableGrantControl
: public ::svt::EditBrowseBox
44 typedef std::map
<OUString
, TPrivileges
> TTablePrivilegeMap
;
46 OModuleClient m_aModuleClient
;
48 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xUsers
;
49 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xTables
;
50 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
51 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XAuthorizable
> m_xGrantUser
;
52 ::com::sun::star::uno::Sequence
< OUString
> m_aTableNames
;
54 mutable TTablePrivilegeMap m_aPrivMap
;
56 VclPtr
< ::svt::CheckBoxControl
> m_pCheckCell
;
59 ImplSVEvent
* m_nDeactivateEvent
;
62 OTableGrantControl( vcl::Window
* pParent
, WinBits nBits
);
63 virtual ~OTableGrantControl();
64 virtual void dispose() SAL_OVERRIDE
;
66 void setUserName(const OUString
& _sUserName
);
67 void setGrantUser(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XAuthorizable
>& _xGrantUser
);
69 void setTablesSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XTablesSupplier
>& _xTablesSup
);
70 void setComponentContext(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxContext
);
72 virtual void Init() SAL_OVERRIDE
;
74 // IAccessibleTableProvider
75 /** Creates the accessible object of a data table cell.
76 @param nRow The row index of the cell.
77 @param nColumnId The column ID of the cell.
78 @return The XAccessible interface of the specified cell. */
79 virtual ::com::sun::star::uno::Reference
<
80 ::com::sun::star::accessibility::XAccessible
>
81 CreateAccessibleCell( sal_Int32 nRow
, sal_uInt16 nColumnId
) SAL_OVERRIDE
;
84 virtual void Resize() SAL_OVERRIDE
;
86 virtual bool PreNotify(NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
88 virtual bool IsTabAllowed(bool bForward
) const SAL_OVERRIDE
;
89 virtual void InitController( ::svt::CellControllerRef
& rController
, long nRow
, sal_uInt16 nCol
) SAL_OVERRIDE
;
90 virtual ::svt::CellController
* GetController( long nRow
, sal_uInt16 nCol
) SAL_OVERRIDE
;
91 virtual void PaintCell( OutputDevice
& rDev
, const Rectangle
& rRect
, sal_uInt16 nColId
) const SAL_OVERRIDE
;
92 virtual bool SeekRow( long nRow
) SAL_OVERRIDE
;
93 virtual bool SaveModified() SAL_OVERRIDE
;
94 virtual OUString
GetCellText( long nRow
, sal_uInt16 nColId
) const SAL_OVERRIDE
;
96 virtual void CellModified() SAL_OVERRIDE
;
99 DECL_LINK( AsynchActivate
, void* );
100 DECL_LINK( AsynchDeactivate
, void* );
102 static bool isAllowed(sal_uInt16 _nColumnId
,sal_Int32 _nPrivilege
);
103 void fillPrivilege(sal_Int32 _nRow
) const;
104 TTablePrivilegeMap::const_iterator
findPrivilege(sal_Int32 _nRow
) const;
109 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEGRANTCTRL_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */