Kaydet (Commit) 7c3ba6b5 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Jan Holesovsky

sfx2: avoid unnecessary dynamic_cast

And reformat.

Change-Id: If8a3dd4d16dfd51f8006d2d5d47951db30390fd8
üst e4f212db
...@@ -30,50 +30,48 @@ namespace sfx2 { namespace sidebar { ...@@ -30,50 +30,48 @@ namespace sfx2 { namespace sidebar {
SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR); SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 nId, SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId,
SfxBindings* pBindings, SfxChildWinInfo* pInfo) SfxBindings* pBindings, SfxChildWinInfo* pInfo)
: SfxChildWindow(pParentWindow, nId), : SfxChildWindow(pParentWindow, nId)
mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress") , mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
{ {
SetWindow(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, pParentWindow, SfxDockingWindow* pDockWin = VclPtr<SidebarDockingWindow>::Create(
WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN
WB_CLIPCHILDREN | WB_SIZEABLE | | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
WB_3DLOOK | WB_ROLLABLE)); SetWindow(pDockWin);
SetAlignment(SfxChildAlignment::RIGHT); SetAlignment(SfxChildAlignment::RIGHT);
GetWindow()->SetHelpId(HID_SIDEBAR_WINDOW); pDockWin->SetHelpId(HID_SIDEBAR_WINDOW);
GetWindow()->SetOutputSizePixel(Size(GetDefaultWidth(GetWindow()), 450)); pDockWin->SetOutputSizePixel(Size(GetDefaultWidth(pDockWin), 450));
SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetWindow()); if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw"
if (pDockingParent != nullptr) && 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.
// 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:
// 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()));
pDockingParent->SetSizePixel(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), }
pDockingParent->GetSizePixel().Height()));
} pDockWin->Initialize(pInfo);
pDockingParent->Initialize(pInfo);
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
{ {
// Undock sidebar in LOK to allow for resizing freely // Undock sidebar in LOK to allow for resizing freely
// (i.e. when the client window is resized) and collapse // (i.e. when the client window is resized) and collapse
// it so the client can open it on demand. // it so the client can open it on demand.
pDockingParent->SetFloatingSize( pDockWin->SetFloatingSize(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), pDockWin->GetSizePixel().Height()));
pDockingParent->GetSizePixel().Height())); pDockWin->SetFloatingMode(true);
pDockingParent->SetFloatingMode(true);
}
} }
SetHideNotDelete(true); SetHideNotDelete(true);
GetWindow()->Show(); pDockWin->Show();
} }
sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window const * pWindow) sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window const * pWindow)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment