LibreOffice Module sfx2 (master) 1
SidebarChildWindow.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21#include <sfx2/bindings.hxx>
24#include <sfx2/sfxsids.hrc>
25#include <helpids.h>
26#include <comphelper/lok.hxx>
27
28namespace sfx2::sidebar {
29
31
33 SfxBindings* pBindings, SfxChildWinInfo* pInfo)
34 : SfxChildWindow(pParentWindow, nId)
35{
37 pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN
39 SetWindow(pDockWin);
41
42 pDockWin->SetHelpId(HID_SIDEBAR_WINDOW);
43 pDockWin->SetOutputSizePixel(Size(GetDefaultWidth(pDockWin), 450));
44
45 if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw"
46 && pInfo->aModule != "simpress" && pInfo->aModule != "smath")
47 {
48 // When this is the first start (never had the sidebar open yet),
49 // default to non-expanded sidebars in Writer and Calc.
50 //
51 // HACK: unfortunately I haven't found a clean solution to do
52 // this, so do it this way:
53 //
55 {
56 pDockWin->SetSizePixel(
58 pDockWin->GetSizePixel().Height()));
59 }
60 }
61
62 pDockWin->Initialize(pInfo);
63
65 {
66 // Undock sidebar in LOK to allow for resizing freely
67 // (i.e. when the client window is resized) and collapse
68 // it so the client can open it on demand.
69 pDockWin->SetFloatingSize(Size(pDockWin->GetSizePixel().Width(),
70 pDockWin->GetSizePixel().Height()));
71 pDockWin->SetFloatingMode(true);
72 }
73
74 SetHideNotDelete(true);
75
76 pDockWin->Show();
77}
78
80{
81 if (pWindow != nullptr)
82 {
83 // Width of the paragraph panel.
84 const static sal_Int32 nMaxPropertyPageWidth(146);
85
86 return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MapMode(MapUnit::MapAppFont)).X()
88 }
89 else
90 return 0;
91}
92
93} // end of namespace sfx2::sidebar
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAlignment(SfxChildAlignment eAlign)
Definition: childwin.cxx:299
VclPtr< vcl::Window > pWindow
Definition: childwin.hxx:102
void SetWindow(const VclPtr< vcl::Window > &p)
Definition: childwin.hxx:111
void SetHideNotDelete(bool bOn)
Definition: childwin.cxx:431
static VclPtr< reference_type > Create(Arg &&... arg)
Outer container of the sidebar window.
static sal_Int32 GetDefaultWidth(vcl::Window const *pWindow)
SidebarChildWindow(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
static sal_Int32 GetDefaultWidth()
Definition: TabBar.cxx:109
constexpr OUStringLiteral HID_SIDEBAR_WINDOW
Definition: helpids.h:53
SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR)
sal_Int16 nId
OUString aModule
Definition: childwin.hxx:64
OUString aExtraString
Definition: childwin.hxx:63
WinBits const WB_OWNERDRAWDECORATION
WinBits const WB_SIZEABLE
WinBits const WB_3DLOOK
WinBits const WB_STDDOCKWIN
WinBits const WB_CLIPCHILDREN