fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / dlg / PaneDockingWindow.cxx
blob9136af906e1f61daf606a072972fae9634412c30
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 .
21 #include "PaneDockingWindow.hxx"
22 #include "Window.hxx"
23 #include "ViewShellBase.hxx"
24 #include "framework/FrameworkHelper.hxx"
25 #include "sdresid.hxx"
26 #include "res_bmp.hrc"
27 #include <sfx2/dispatch.hxx>
28 #include <vcl/toolbox.hxx>
29 #include <vcl/taskpanelist.hxx>
30 #include <vcl/splitwin.hxx>
31 #include <vcl/svapp.hxx>
32 #include <tools/wintypes.hxx>
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::drawing::framework;
37 using ::sfx2::TitledDockingWindow;
39 namespace sd {
41 PaneDockingWindow::PaneDockingWindow(
42 SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent,
43 const ResId& rResId, const OUString& rsTitle )
44 :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId )
46 SetTitle( rsTitle );
49 PaneDockingWindow::~PaneDockingWindow (void)
53 void PaneDockingWindow::StateChanged( StateChangedType nType )
55 switch (nType)
57 case STATE_CHANGE_INITSHOW:
58 Resize();
59 GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
60 break;
62 case STATE_CHANGE_VISIBLE:
63 // The visibility of the docking window has changed. Tell the
64 // ConfigurationController so that it can activate or deactivate
65 // a/the view for the pane.
66 // Without this the side panes remain empty after closing an
67 // in-place slide show.
68 ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
69 GetBindings().GetDispatcher()->GetFrame());
70 if (pBase != NULL)
72 framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
74 break;
76 SfxDockingWindow::StateChanged (nType);
79 void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
81 if (rEvent.GetButtons() == MOUSE_LEFT)
83 // For some strange reason we have to set the WB_DIALOGCONTROL at
84 // the content window in order to have it pass focus to its content
85 // window. Without setting this flag here that works only on views
86 // that have not been taken from the cash and relocated to this pane
87 // docking window.
88 GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
89 GetContentWindow().GrabFocus();
91 SfxDockingWindow::MouseButtonDown(rEvent);
101 void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange)
103 SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
104 if (pSplitWindow != NULL)
106 const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< ::Window*>(this)));
107 const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
108 // Because the PaneDockingWindow paints its own decoration, we have
109 // to compensate the valid size range for that.
110 const SvBorder aBorder (GetDecorationBorder());
111 sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
112 ? aBorder.Top() + aBorder.Bottom()
113 : aBorder.Left() + aBorder.Right());
114 pSplitWindow->SetItemSizeRange(
115 nSetId,
116 Range(
117 aValidSizeRange.Min() + nCompensation,
118 aValidSizeRange.Max() + nCompensation));
125 PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const
127 SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
128 if (pSplitWindow == NULL)
129 return UnknownOrientation;
130 else if (pSplitWindow->IsHorizontal())
131 return HorizontalOrientation;
132 else
133 return VerticalOrientation;
136 } // end of namespace ::sd
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */