1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableGrantCtrl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TABLEGRANTCONTROL_HXX
31 #define DBAUI_TABLEGRANTCONTROL_HXX
33 #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
34 #include <svtools/editbrowsebox.hxx>
36 #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
37 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
39 #ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_
40 #include <com/sun/star/sdbcx/XAuthorizable.hpp>
42 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #ifndef _COMPHELPER_STLTYPES_HXX_
46 #include <comphelper/stl_types.hxx>
48 #ifndef _DBAUI_MODULE_DBU_HXX_
49 #include "moduledbu.hxx"
56 class OTableGrantControl
: public ::svt::EditBrowseBox
64 DECLARE_STL_USTRINGACCESS_MAP(TPrivileges
,TTablePrivilegeMap
);
66 OModuleClient m_aModuleClient
;
68 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xUsers
;
69 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xTables
;
70 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xORB
;
71 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XAuthorizable
> m_xGrantUser
;
72 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> m_aTableNames
;
74 mutable TTablePrivilegeMap m_aPrivMap
;
75 ::rtl::OUString m_sUserName
;
76 ::svt::CheckBoxControl
* m_pCheckCell
;
80 ULONG m_nDeactivateEvent
;
83 OTableGrantControl( Window
* pParent
,const ResId
& _RsId
);
84 virtual ~OTableGrantControl();
86 void setUserName(const ::rtl::OUString _sUserName
);
87 void setGrantUser(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XAuthorizable
>& _xGrantUser
);
89 void setTablesSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XTablesSupplier
>& _xTablesSup
);
90 void setORB(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _xORB
);
94 // IAccessibleTableProvider
95 /** Creates the accessible object of a data table cell.
96 @param nRow The row index of the cell.
97 @param nColumnId The column ID of the cell.
98 @return The XAccessible interface of the specified cell. */
99 virtual ::com::sun::star::uno::Reference
<
100 ::com::sun::star::accessibility::XAccessible
>
101 CreateAccessibleCell( sal_Int32 nRow
, sal_uInt16 nColumnId
);
104 virtual void Resize();
106 virtual long PreNotify(NotifyEvent
& rNEvt
);
108 virtual BOOL
IsTabAllowed(BOOL bForward
) const;
109 virtual void InitController( ::svt::CellControllerRef
& rController
, long nRow
, USHORT nCol
);
110 virtual ::svt::CellController
* GetController( long nRow
, USHORT nCol
);
111 virtual void PaintCell( OutputDevice
& rDev
, const Rectangle
& rRect
, USHORT nColId
) const;
112 virtual BOOL
SeekRow( long nRow
);
113 virtual BOOL
SaveModified();
114 virtual String
GetCellText( long nRow
, USHORT nColId
) const;
116 virtual void CellModified();
119 DECL_LINK( AsynchActivate
, void* );
120 DECL_LINK( AsynchDeactivate
, void* );
122 sal_Bool
isAllowed(USHORT _nColumnId
,sal_Int32 _nPrivilege
) const;
123 void fillPrivilege(sal_Int32 _nRow
) const;
124 TTablePrivilegeMap::const_iterator
findPrivilege(sal_Int32 _nRow
) const;
129 #endif // DBAUI_TABLEGRANTCONTROL_HXX