1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "PaneDockingWindow.hxx" 28cdf0e10cSrcweir #include "Window.hxx" 29cdf0e10cSrcweir #include "ViewShellBase.hxx" 30cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx" 31cdf0e10cSrcweir #include "sdresid.hxx" 32cdf0e10cSrcweir #include "res_bmp.hrc" 33cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 34cdf0e10cSrcweir #include <vcl/toolbox.hxx> 35cdf0e10cSrcweir #include <vcl/taskpanelist.hxx> 36cdf0e10cSrcweir #include <vcl/splitwin.hxx> 37cdf0e10cSrcweir #include <vcl/svapp.hxx> 38cdf0e10cSrcweir #include <tools/wintypes.hxx> 39cdf0e10cSrcweir #include <boost/bind.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir using namespace ::com::sun::star; 42cdf0e10cSrcweir using namespace ::com::sun::star::uno; 43cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 44cdf0e10cSrcweir using ::sfx2::TitledDockingWindow; 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace sd { 47cdf0e10cSrcweir 48cdf0e10cSrcweir PaneDockingWindow::PaneDockingWindow( 49cdf0e10cSrcweir SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent, 50cdf0e10cSrcweir const ResId& rResId, const ::rtl::OUString& rsTitle ) 51cdf0e10cSrcweir :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId ) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir SetTitle( rsTitle ); 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir PaneDockingWindow::~PaneDockingWindow (void) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir void PaneDockingWindow::StateChanged( StateChangedType nType ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir switch (nType) 63cdf0e10cSrcweir { 64cdf0e10cSrcweir case STATE_CHANGE_INITSHOW: 65cdf0e10cSrcweir Resize(); 66cdf0e10cSrcweir GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL); 67cdf0e10cSrcweir break; 68cdf0e10cSrcweir 69cdf0e10cSrcweir case STATE_CHANGE_VISIBLE: 70cdf0e10cSrcweir // The visibility of the docking window has changed. Tell the 71cdf0e10cSrcweir // ConfigurationController so that it can activate or deactivate 72cdf0e10cSrcweir // a/the view for the pane. 73cdf0e10cSrcweir // Without this the side panes remain empty after closing an 74cdf0e10cSrcweir // in-place slide show. 75cdf0e10cSrcweir ViewShellBase* pBase = ViewShellBase::GetViewShellBase( 76cdf0e10cSrcweir GetBindings().GetDispatcher()->GetFrame()); 77cdf0e10cSrcweir if (pBase != NULL) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration(); 80cdf0e10cSrcweir } 81cdf0e10cSrcweir break; 82cdf0e10cSrcweir } 83cdf0e10cSrcweir SfxDockingWindow::StateChanged (nType); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir if (rEvent.GetButtons() == MOUSE_LEFT) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir // For some strange reason we have to set the WB_DIALOGCONTROL at 91cdf0e10cSrcweir // the content window in order to have it pass focus to its content 92cdf0e10cSrcweir // window. Without setting this flag here that works only on views 93cdf0e10cSrcweir // that have not been taken from the cash and relocated to this pane 94cdf0e10cSrcweir // docking window. 95cdf0e10cSrcweir GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL); 96cdf0e10cSrcweir GetContentWindow().GrabFocus(); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir SfxDockingWindow::MouseButtonDown(rEvent); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir 108cdf0e10cSrcweir void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent()); 111cdf0e10cSrcweir if (pSplitWindow != NULL) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< ::Window*>(this))); 114cdf0e10cSrcweir const sal_uInt16 nSetId (pSplitWindow->GetSet(nId)); 115cdf0e10cSrcweir // Because the PaneDockingWindow paints its own decoration, we have 116cdf0e10cSrcweir // to compensate the valid size range for that. 117cdf0e10cSrcweir const SvBorder aBorder (GetDecorationBorder()); 118cdf0e10cSrcweir sal_Int32 nCompensation (pSplitWindow->IsHorizontal() 119cdf0e10cSrcweir ? mnTitleBarHeight + aBorder.Top() + aBorder.Bottom() 120cdf0e10cSrcweir : aBorder.Left() + aBorder.Right()); 121cdf0e10cSrcweir pSplitWindow->SetItemSizeRange( 122cdf0e10cSrcweir nSetId, 123cdf0e10cSrcweir Range( 124cdf0e10cSrcweir aValidSizeRange.Min() + nCompensation, 125cdf0e10cSrcweir aValidSizeRange.Max() + nCompensation)); 126cdf0e10cSrcweir } 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir 132cdf0e10cSrcweir PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const 133cdf0e10cSrcweir { 134cdf0e10cSrcweir SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent()); 135cdf0e10cSrcweir if (pSplitWindow == NULL) 136cdf0e10cSrcweir return UnknownOrientation; 137cdf0e10cSrcweir else if (pSplitWindow->IsHorizontal()) 138cdf0e10cSrcweir return HorizontalOrientation; 139cdf0e10cSrcweir else 140cdf0e10cSrcweir return VerticalOrientation; 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir } // end of namespace ::sd 144