1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef DBAUI_TABLEGRANTCONTROL_HXX 28*cdf0e10cSrcweir #define DBAUI_TABLEGRANTCONTROL_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_ 31*cdf0e10cSrcweir #include <svtools/editbrowsebox.hxx> 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ 34*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XTablesSupplier.hpp> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_ 37*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XAuthorizable.hpp> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ 40*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_ 43*cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_ 46*cdf0e10cSrcweir #include "moduledbu.hxx" 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir class Edit; 50*cdf0e10cSrcweir namespace dbaui 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir class OTableGrantControl : public ::svt::EditBrowseBox 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir typedef struct 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir sal_Int32 nRights; 58*cdf0e10cSrcweir sal_Int32 nWithGrant; 59*cdf0e10cSrcweir } TPrivileges; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir DECLARE_STL_USTRINGACCESS_MAP(TPrivileges,TTablePrivilegeMap); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir OModuleClient m_aModuleClient; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers; 66*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables; 67*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xORB; 68*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable> m_xGrantUser; 69*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aTableNames; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir mutable TTablePrivilegeMap m_aPrivMap; 72*cdf0e10cSrcweir ::rtl::OUString m_sUserName; 73*cdf0e10cSrcweir ::svt::CheckBoxControl* m_pCheckCell; 74*cdf0e10cSrcweir Edit* m_pEdit; 75*cdf0e10cSrcweir long m_nDataPos; 76*cdf0e10cSrcweir sal_Bool m_bEnable; 77*cdf0e10cSrcweir sal_uLong m_nDeactivateEvent; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir OTableGrantControl( Window* pParent,const ResId& _RsId); 81*cdf0e10cSrcweir virtual ~OTableGrantControl(); 82*cdf0e10cSrcweir void UpdateTables(); 83*cdf0e10cSrcweir void setUserName(const ::rtl::OUString _sUserName); 84*cdf0e10cSrcweir void setGrantUser(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable>& _xGrantUser); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir void setTablesSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >& _xTablesSup); 87*cdf0e10cSrcweir void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual void Init(); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // IAccessibleTableProvider 92*cdf0e10cSrcweir /** Creates the accessible object of a data table cell. 93*cdf0e10cSrcweir @param nRow The row index of the cell. 94*cdf0e10cSrcweir @param nColumnId The column ID of the cell. 95*cdf0e10cSrcweir @return The XAccessible interface of the specified cell. */ 96*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 97*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > 98*cdf0e10cSrcweir CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir protected: 101*cdf0e10cSrcweir virtual void Resize(); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir virtual long PreNotify(NotifyEvent& rNEvt ); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir virtual sal_Bool IsTabAllowed(sal_Bool bForward) const; 106*cdf0e10cSrcweir virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ); 107*cdf0e10cSrcweir virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ); 108*cdf0e10cSrcweir virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const; 109*cdf0e10cSrcweir virtual sal_Bool SeekRow( long nRow ); 110*cdf0e10cSrcweir virtual sal_Bool SaveModified(); 111*cdf0e10cSrcweir virtual String GetCellText( long nRow, sal_uInt16 nColId ) const; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir virtual void CellModified(); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir private: 116*cdf0e10cSrcweir DECL_LINK( AsynchActivate, void* ); 117*cdf0e10cSrcweir DECL_LINK( AsynchDeactivate, void* ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir sal_Bool isAllowed(sal_uInt16 _nColumnId,sal_Int32 _nPrivilege) const; 120*cdf0e10cSrcweir void fillPrivilege(sal_Int32 _nRow) const; 121*cdf0e10cSrcweir TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const; 122*cdf0e10cSrcweir }; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir #endif // DBAUI_TABLEGRANTCONTROL_HXX 127