summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/SidebarChildWindow.cxx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-02-01 10:55:05 -0500
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-26 20:26:00 +0200
commitd13e036ddc56bfdc9decccfa58e2e2b57eac765b (patch)
tree91cd19e52ecb691df42aeaa647a022e38d603d96 /sfx2/source/sidebar/SidebarChildWindow.cxx
parent8ac95e67872d8834c12adf67f833d92b06dc3d70 (diff)
sfx2: avoid unnecessary dynamic_cast
And reformat. Change-Id: If8a3dd4d16dfd51f8006d2d5d47951db30390fd8 Reviewed-on: https://gerrit.libreoffice.org/73522 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/sidebar/SidebarChildWindow.cxx')
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx68
1 files changed, 33 insertions, 35 deletions
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index ac0a68852ea9..678c5538aa0b 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -30,50 +30,48 @@ namespace sfx2 { namespace sidebar {
SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
-SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 nId,
- SfxBindings* pBindings, SfxChildWinInfo* pInfo)
- : SfxChildWindow(pParentWindow, nId),
- mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
+SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo)
+ : SfxChildWindow(pParentWindow, nId)
+ , mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
{
- SetWindow(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, pParentWindow,
- WB_STDDOCKWIN | WB_OWNERDRAWDECORATION |
- WB_CLIPCHILDREN | WB_SIZEABLE |
- WB_3DLOOK | WB_ROLLABLE));
+ auto pDockWin = VclPtr<SidebarDockingWindow>::Create(
+ pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN
+ | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
+ SetWindow(pDockWin);
SetAlignment(SfxChildAlignment::RIGHT);
- GetWindow()->SetHelpId(HID_SIDEBAR_WINDOW);
- GetWindow()->SetOutputSizePixel(Size(GetDefaultWidth(GetWindow()), 450));
+ pDockWin->SetHelpId(HID_SIDEBAR_WINDOW);
+ pDockWin->SetOutputSizePixel(Size(GetDefaultWidth(pDockWin), 450));
- SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetWindow());
- if (pDockingParent != nullptr)
+ if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw"
+ && pInfo->aModule != "simpress")
{
- if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw" && pInfo->aModule != "simpress")
- {
- // When this is the first start (never had the sidebar open yet),
- // default to non-expanded sidebars in Writer and Calc.
- //
- // HACK: unfortunately I haven't found a clean solution to do
- // this, so do it this way:
- //
- pDockingParent->SetSizePixel(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
- pDockingParent->GetSizePixel().Height()));
- }
- pDockingParent->Initialize(pInfo);
+ // When this is the first start (never had the sidebar open yet),
+ // default to non-expanded sidebars in Writer and Calc.
+ //
+ // HACK: unfortunately I haven't found a clean solution to do
+ // this, so do it this way:
+ //
+ pDockWin->SetSizePixel(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
+ pDockWin->GetSizePixel().Height()));
+ }
+
+ pDockWin->Initialize(pInfo);
- if (comphelper::LibreOfficeKit::isActive())
- {
- // Undock sidebar in LOK to allow for resizing freely
- // (i.e. when the client window is resized) and collapse
- // it so the client can open it on demand.
- pDockingParent->SetFloatingSize(
- Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
- pDockingParent->GetSizePixel().Height()));
- pDockingParent->SetFloatingMode(true);
- }
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // Undock sidebar in LOK to allow for resizing freely
+ // (i.e. when the client window is resized) and collapse
+ // it so the client can open it on demand.
+ pDockWin->SetFloatingSize(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
+ pDockWin->GetSizePixel().Height()));
+ pDockWin->SetFloatingMode(true);
}
+
SetHideNotDelete(true);
- GetWindow()->Show();
+ pDockWin->Show();
}
sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window const * pWindow)