bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / dlg / PaneDockingWindow.cxx
blobd2d5e4a70a71df43d58d01d0b457b97b6f898a52
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <PaneDockingWindow.hxx>
21 #include <ViewShellBase.hxx>
22 #include <framework/FrameworkHelper.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <vcl/splitwin.hxx>
26 #include <tools/wintypes.hxx>
28 using namespace ::com::sun::star;
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::drawing::framework;
31 using ::sfx2::TitledDockingWindow;
33 namespace sd {
35 PaneDockingWindow::PaneDockingWindow(
36 SfxBindings *_pBindings, SfxChildWindow *pChildWindow, vcl::Window* pParent,
37 const OUString& rsTitle )
38 : TitledDockingWindow(_pBindings, pChildWindow, pParent)
40 SetTitle(rsTitle);
41 SetSizePixel(LogicToPixel(Size(80,200), MapMode(MapUnit::MapAppFont)));
44 PaneDockingWindow::~PaneDockingWindow()
48 void PaneDockingWindow::StateChanged( StateChangedType nType )
50 switch (nType)
52 case StateChangedType::InitShow:
53 Resize();
54 GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
55 break;
57 case StateChangedType::Visible:
59 // The visibility of the docking window has changed. Tell the
60 // ConfigurationController so that it can activate or deactivate
61 // a/the view for the pane.
62 // Without this the side panes remain empty after closing an
63 // in-place slide show.
64 ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
65 GetBindings().GetDispatcher()->GetFrame());
66 if (pBase != nullptr)
68 framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
71 break;
73 default:;
75 SfxDockingWindow::StateChanged (nType);
78 void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
80 if (rEvent.GetButtons() == MOUSE_LEFT)
82 // For some strange reason we have to set the WB_DIALOGCONTROL at
83 // the content window in order to have it pass focus to its content
84 // window. Without setting this flag here that works only on views
85 // that have not been taken from the cash and relocated to this pane
86 // docking window.
87 GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
88 GetContentWindow().GrabFocus();
90 SfxDockingWindow::MouseButtonDown(rEvent);
93 void PaneDockingWindow::SetValidSizeRange (const Range& rValidSizeRange)
95 SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
96 if (pSplitWindow == nullptr)
97 return;
99 const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< vcl::Window*>(this)));
100 const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
101 // Because the PaneDockingWindow paints its own decoration, we have
102 // to compensate the valid size range for that.
103 const SvBorder aBorder (GetDecorationBorder());
104 sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
105 ? aBorder.Top() + aBorder.Bottom()
106 : aBorder.Left() + aBorder.Right());
107 pSplitWindow->SetItemSizeRange(
108 nSetId,
109 Range(
110 rValidSizeRange.Min() + nCompensation,
111 rValidSizeRange.Max() + nCompensation));
114 PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation() const
116 SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
117 if (pSplitWindow == nullptr)
118 return UnknownOrientation;
119 else if (pSplitWindow->IsHorizontal())
120 return HorizontalOrientation;
121 else
122 return VerticalOrientation;
125 } // end of namespace ::sd
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */