update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / TableGrantCtrl.hxx
blob0da75a235a44cfd4baab15a53699505736121188
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableGrantCtrl.hxx,v $
10 * $Revision: 1.11 $
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>
35 #endif
36 #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
37 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_
40 #include <com/sun/star/sdbcx/XAuthorizable.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 #endif
45 #ifndef _COMPHELPER_STLTYPES_HXX_
46 #include <comphelper/stl_types.hxx>
47 #endif
48 #ifndef _DBAUI_MODULE_DBU_HXX_
49 #include "moduledbu.hxx"
50 #endif
52 class Edit;
53 namespace dbaui
56 class OTableGrantControl : public ::svt::EditBrowseBox
58 typedef struct
60 sal_Int32 nRights;
61 sal_Int32 nWithGrant;
62 } TPrivileges;
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;
77 Edit* m_pEdit;
78 long m_nDataPos;
79 BOOL m_bEnable;
80 ULONG m_nDeactivateEvent;
82 public:
83 OTableGrantControl( Window* pParent,const ResId& _RsId);
84 virtual ~OTableGrantControl();
85 void UpdateTables();
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);
92 virtual void Init();
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 );
103 protected:
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();
118 private:
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