21#include <core_resource.hxx>
22#include <com/sun/star/sdbc/SQLException.hpp>
23#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
24#include <com/sun/star/sdbcx/Privilege.hpp>
25#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
26#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
27#include <com/sun/star/sdbcx/XAuthorizable.hpp>
31#include <osl/diagnose.h>
39using namespace ::
dbaui;
53OTableGrantControl::OTableGrantControl(
const css::uno::Reference<css::awt::XWindow> &rParent)
55 ,m_pCheckCell( nullptr )
58 ,m_nDeactivateEvent(nullptr)
110 OSL_ENSURE(
m_xUsers.is(),
"No user access supported!");
111 OSL_ENSURE(
m_xTables.is(),
"No tables supported!");
146 BrowserMode const nMode = BrowserMode::COLUMNSELECTION | BrowserMode::HLINES | BrowserMode::VLINES |
147 BrowserMode::HIDECURSOR | BrowserMode::HIDESELECT;
154 if (rNEvt.
GetType() == NotifyEventType::LOSEFOCUS)
155 if (!HasChildPathFocus())
161 if (rNEvt.
GetType() == NotifyEventType::GETFOCUS)
172 m_nDeactivateEvent =
nullptr;
178 m_nDeactivateEvent =
nullptr;
187 if (bForward && (nCol == 2) && (nRow ==
GetRowCount() - 1))
190 if (!bForward && (nCol == 1) && (nRow == 0))
262 catch(SQLException& e)
281 TTablePrivilegeMap::const_iterator aFind =
findPrivilege(nRow);
283 nPriv = aFind->second.nRights;
285 return OUString::number(
isAllowed(nColId,nPriv) ? 1 :0);
293 m_pEdit->get_widget().set_text(sTablename);
297 TTablePrivilegeMap::const_iterator aFind =
findPrivilege(nRow);
324 catch(SQLException& e)
335 bool bAllowed =
false;
339 bAllowed = (Privilege::INSERT & _nPrivilege) == Privilege::INSERT;
342 bAllowed = (Privilege::DELETE & _nPrivilege) == Privilege::DELETE;
345 bAllowed = (Privilege::UPDATE & _nPrivilege) == Privilege::UPDATE;
348 bAllowed = (Privilege::ALTER & _nPrivilege) == Privilege::ALTER;
351 bAllowed = (Privilege::SELECT & _nPrivilege) == Privilege::SELECT;
354 bAllowed = (Privilege::REFERENCE & _nPrivilege) == Privilege::REFERENCE;
357 bAllowed = (Privilege::DROP & _nPrivilege) == Privilege::DROP;
371 OSL_ENSURE(_xGrantUser.is(),
"OTableGrantControl::setGrantUser: GrantUser is null!");
391 TTablePrivilegeMap::const_iterator aFind =
findPrivilege(nRow);
427 if( aPos.
X() < rRect.
Left() || aPos.
X() + nWidth > rRect.
Right() ||
428 aPos.
Y() < rRect.
Top() || aPos.
Y() + nHeight > rRect.
Bottom() )
463 TTablePrivilegeMap::const_iterator aFind =
findPrivilege(_nRow);
const sal_uInt16 COL_TABLE_NAME
const sal_uInt16 COL_DELETE
const sal_uInt16 COL_UPDATE
const sal_uInt16 COL_DROP
const sal_uInt16 COL_ALTER
const sal_uInt16 COL_INSERT
const sal_uInt16 COL_SELECT
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
sal_uInt16 GetColumnId(sal_uInt16 nPos) const
BrowserDataWin & GetDataWindow() const
void InsertDataColumn(sal_uInt16 nItemId, const OUString &rText, tools::Long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnPos) override
sal_Int32 GetCurRow() const
void FreezeColumn(sal_uInt16 nColumnId)
void SetMode(BrowserMode nMode)
void SetColumnWidth(sal_uInt16 nColumnId, sal_uLong nWidth)
sal_uInt16 GetCurColumnId() const
void RowInserted(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true, bool bKeepSelection=false)
virtual sal_Int32 GetRowCount() const override
NotifyEventType GetType() const
bool IsClipRegion() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
constexpr tools::Long Y() const
constexpr tools::Long X() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static VclPtr< reference_type > Create(Arg &&... arg)
css::uno::Reference< css::sdbcx::XAuthorizable > m_xGrantUser
void fillPrivilege(sal_Int32 _nRow) const
virtual bool IsTabAllowed(bool bForward) const override
css::uno::Reference< css::container::XNameAccess > m_xTables
std::map< OUString, TPrivileges > TTablePrivilegeMap
void setGrantUser(const css::uno::Reference< css::sdbcx::XAuthorizable > &_xGrantUser)
void setComponentContext(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
VclPtr<::svt::EditControl > m_pEdit
css::uno::Sequence< OUString > m_aTableNames
void setTablesSupplier(const css::uno::Reference< css::sdbcx::XTablesSupplier > &_xTablesSup)
virtual ~OTableGrantControl() override
static bool isAllowed(sal_uInt16 _nColumnId, sal_Int32 _nPrivilege)
TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const
ImplSVEvent * m_nDeactivateEvent
void setUserName(const OUString &_sUserName)
css::uno::Reference< css::container::XNameAccess > m_xUsers
virtual void Init() override
TTablePrivilegeMap m_aPrivMap
virtual bool SaveModified() override
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual bool PreNotify(NotifyEvent &rNEvt) override
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override
Creates the accessible object of a data table cell.
VclPtr<::svt::CheckBoxControl > m_pCheckCell
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
virtual void dispose() override
virtual bool SeekRow(sal_Int32 nRow) override
virtual void CellModified() override
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColId) const override
css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos, const TriState &eState)
sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId)
virtual bool IsTabAllowed(bool bForward) const
const CellControllerRef & Controller() const
virtual void RemoveRows()
virtual bool PreNotify(NotifyEvent &rNEvt) override
void PaintTristate(const tools::Rectangle &rRect, const TriState &eState, bool _bEnabled=true) const
virtual void dispose() override
virtual void CellModified()
virtual void set_editable(bool bEditable)=0
@ NO_HANDLE_COLUMN_CONTENT
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)