1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10*2e2212a7SAndrew Rist * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2e2212a7SAndrew Rist * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19*2e2212a7SAndrew Rist * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBAUI_TABLEGRANTCONTROL_HXX 24cdf0e10cSrcweir #define DBAUI_TABLEGRANTCONTROL_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_ 27cdf0e10cSrcweir #include <svtools/editbrowsebox.hxx> 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ 30cdf0e10cSrcweir #include <com/sun/star/sdbcx/XTablesSupplier.hpp> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_ 33cdf0e10cSrcweir #include <com/sun/star/sdbcx/XAuthorizable.hpp> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ 36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_ 39cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_ 42cdf0e10cSrcweir #include "moduledbu.hxx" 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir 45cdf0e10cSrcweir class Edit; 46cdf0e10cSrcweir namespace dbaui 47cdf0e10cSrcweir { 48cdf0e10cSrcweir 49cdf0e10cSrcweir class OTableGrantControl : public ::svt::EditBrowseBox 50cdf0e10cSrcweir { 51cdf0e10cSrcweir typedef struct 52cdf0e10cSrcweir { 53cdf0e10cSrcweir sal_Int32 nRights; 54cdf0e10cSrcweir sal_Int32 nWithGrant; 55cdf0e10cSrcweir } TPrivileges; 56cdf0e10cSrcweir 57cdf0e10cSrcweir DECLARE_STL_USTRINGACCESS_MAP(TPrivileges,TTablePrivilegeMap); 58cdf0e10cSrcweir 59cdf0e10cSrcweir OModuleClient m_aModuleClient; 60cdf0e10cSrcweir 61cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers; 62cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables; 63cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xORB; 64cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable> m_xGrantUser; 65cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aTableNames; 66cdf0e10cSrcweir 67cdf0e10cSrcweir mutable TTablePrivilegeMap m_aPrivMap; 68cdf0e10cSrcweir ::rtl::OUString m_sUserName; 69cdf0e10cSrcweir ::svt::CheckBoxControl* m_pCheckCell; 70cdf0e10cSrcweir Edit* m_pEdit; 71cdf0e10cSrcweir long m_nDataPos; 72cdf0e10cSrcweir sal_Bool m_bEnable; 73cdf0e10cSrcweir sal_uLong m_nDeactivateEvent; 74cdf0e10cSrcweir 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir OTableGrantControl( Window* pParent,const ResId& _RsId); 77cdf0e10cSrcweir virtual ~OTableGrantControl(); 78cdf0e10cSrcweir void UpdateTables(); 79cdf0e10cSrcweir void setUserName(const ::rtl::OUString _sUserName); 80cdf0e10cSrcweir void setGrantUser(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable>& _xGrantUser); 81cdf0e10cSrcweir 82cdf0e10cSrcweir void setTablesSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >& _xTablesSup); 83cdf0e10cSrcweir void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB); 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual void Init(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir // IAccessibleTableProvider 88cdf0e10cSrcweir /** Creates the accessible object of a data table cell. 89cdf0e10cSrcweir @param nRow The row index of the cell. 90cdf0e10cSrcweir @param nColumnId The column ID of the cell. 91cdf0e10cSrcweir @return The XAccessible interface of the specified cell. */ 92cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 93cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > 94cdf0e10cSrcweir CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir protected: 97cdf0e10cSrcweir virtual void Resize(); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual long PreNotify(NotifyEvent& rNEvt ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir virtual sal_Bool IsTabAllowed(sal_Bool bForward) const; 102cdf0e10cSrcweir virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ); 103cdf0e10cSrcweir virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ); 104cdf0e10cSrcweir virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const; 105cdf0e10cSrcweir virtual sal_Bool SeekRow( long nRow ); 106cdf0e10cSrcweir virtual sal_Bool SaveModified(); 107cdf0e10cSrcweir virtual String GetCellText( long nRow, sal_uInt16 nColId ) const; 108cdf0e10cSrcweir 109cdf0e10cSrcweir virtual void CellModified(); 110cdf0e10cSrcweir 111cdf0e10cSrcweir private: 112cdf0e10cSrcweir DECL_LINK( AsynchActivate, void* ); 113cdf0e10cSrcweir DECL_LINK( AsynchDeactivate, void* ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir sal_Bool isAllowed(sal_uInt16 _nColumnId,sal_Int32 _nPrivilege) const; 116cdf0e10cSrcweir void fillPrivilege(sal_Int32 _nRow) const; 117cdf0e10cSrcweir TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const; 118cdf0e10cSrcweir }; 119cdf0e10cSrcweir 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir #endif // DBAUI_TABLEGRANTCONTROL_HXX 123