diff options
author | Gulsah Kose <gulsah.1004@gmail.com> | 2017-11-02 13:06:48 +0300 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-20 22:27:34 +0100 |
commit | 5fccf17f33aa7e97314c14a5a4616b2f2643614c (patch) | |
tree | 77d3f0eda2d03002207204ea3790a4dc997fb0b0 /svtools | |
parent | d1f783aff7cfe42f3e4819d42d5b7e9ae31733d2 (diff) |
tdf#95880 Add a lock mark on protected sheet tab.
Change-Id: Ic9ec598d9bfdf98336cc4a11af21502ca7a1e4fb
Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/44558
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/tabbar.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 70894367ba82..c25b7c07c536 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -126,6 +126,17 @@ public: mrRenderContext.DrawCtrlText(aPos, aText, 0, aText.getLength(), (DrawTextFlags::Disable | DrawTextFlags::Mnemonic)); } + void drawProtectionSymbol(const OUString &aProtectionSymbol) + { + tools::Rectangle aRect = maRect; + long nSymbolHeight = mrRenderContext.GetTextHeight(); + Point aPos = aRect.TopLeft(); + aPos.X() += 2; + aPos.Y() += (aRect.getHeight() - nSymbolHeight) / 2; + + mrRenderContext.DrawText(aPos, aProtectionSymbol); + } + void drawOverTopBorder() { Point aTopLeft = maRect.TopLeft() + Point(1, 0); @@ -205,6 +216,7 @@ struct ImplTabBarItem OString maHelpId; bool mbShort : 1; bool mbSelect : 1; + bool mbProtect : 1; Color maTabBgColor; Color maTabTextColor; @@ -215,6 +227,7 @@ struct ImplTabBarItem , mnWidth(0) , mbShort(false) , mbSelect(false) + , mbProtect(false) , maTabBgColor(Color(COL_AUTO)) , maTabTextColor(Color(COL_AUTO)) { @@ -779,6 +792,7 @@ void TabBar::ImplInitControls() mpImpl->mpAddButton->Show(); } + Link<Button*,void> aLink = LINK( this, TabBar, ImplClickHdl ); if (mnWinStyle & (WB_MINSCROLL | WB_SCROLL)) @@ -1218,6 +1232,13 @@ void TabBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& r aDrawer.drawText(aText); + if (pItem->mbProtect) + { + constexpr sal_uInt32 cLockChar = 0x1F512; + OUString aLockSymbol( &cLockChar, 1); + aDrawer.drawProtectionSymbol(aLockSymbol); + } + if (bCurrent) { rRenderContext.SetLineColor(); @@ -2038,6 +2059,16 @@ bool TabBar::IsPageSelected(sal_uInt16 nPageId) const return false; } +void TabBar::SetProtectionSymbol(sal_uInt16 nPageId, bool bProtection) +{ + sal_uInt16 nPos = GetPagePos(nPageId); + if (nPos != PAGE_NOT_FOUND) + { + mpImpl->mpItemList[nPos]->mbProtect = bProtection; + Invalidate(mpImpl->mpItemList[nPos]->maRect); + } +} + bool TabBar::StartEditMode(sal_uInt16 nPageId) { sal_uInt16 nPos = GetPagePos( nPageId ); |