LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - PaneDockingWindow.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 34 43 79.1 %
Date: 2014-11-03 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      20             : #include "PaneDockingWindow.hxx"
      21             : #include "Window.hxx"
      22             : #include "ViewShellBase.hxx"
      23             : #include "framework/FrameworkHelper.hxx"
      24             : #include "sdresid.hxx"
      25             : #include "res_bmp.hrc"
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <vcl/toolbox.hxx>
      28             : #include <vcl/taskpanelist.hxx>
      29             : #include <vcl/splitwin.hxx>
      30             : #include <vcl/svapp.hxx>
      31             : #include <tools/wintypes.hxx>
      32             : 
      33             : using namespace ::com::sun::star;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::drawing::framework;
      36             : using ::sfx2::TitledDockingWindow;
      37             : 
      38             : namespace sd {
      39             : 
      40         126 : PaneDockingWindow::PaneDockingWindow(
      41             :         SfxBindings *_pBindings, SfxChildWindow *pChildWindow, vcl::Window* pParent,
      42             :         const ResId& rResId, const OUString& rsTitle )
      43         126 :         :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId )
      44             : {
      45         126 :     SetTitle( rsTitle );
      46         126 : }
      47             : 
      48         252 : PaneDockingWindow::~PaneDockingWindow (void)
      49             : {
      50         252 : }
      51             : 
      52         386 : void PaneDockingWindow::StateChanged( StateChangedType nType )
      53             : {
      54         386 :     switch (nType)
      55             :     {
      56             :         case StateChangedType::INITSHOW:
      57         126 :             Resize();
      58         126 :             GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      59         126 :             break;
      60             : 
      61             :         case StateChangedType::VISIBLE:
      62             :         {
      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         252 :                 GetBindings().GetDispatcher()->GetFrame());
      70         252 :             if (pBase != NULL)
      71             :             {
      72         252 :                 framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
      73             :             }
      74             :         }
      75         252 :         break;
      76             : 
      77             :         default:;
      78             :     }
      79         386 :     SfxDockingWindow::StateChanged (nType);
      80         386 : }
      81             : 
      82           0 : void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
      83             : {
      84           0 :     if (rEvent.GetButtons() == MOUSE_LEFT)
      85             :     {
      86             :         // For some strange reason we have to set the WB_DIALOGCONTROL at
      87             :         // the content window in order to have it pass focus to its content
      88             :         // window.  Without setting this flag here that works only on views
      89             :         // that have not been taken from the cash and relocated to this pane
      90             :         // docking window.
      91           0 :         GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      92           0 :         GetContentWindow().GrabFocus();
      93             :     }
      94           0 :     SfxDockingWindow::MouseButtonDown(rEvent);
      95           0 : }
      96             : 
      97         109 : void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange)
      98             : {
      99         109 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     100         109 :     if (pSplitWindow != NULL)
     101             :     {
     102         109 :         const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< vcl::Window*>(this)));
     103         109 :         const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
     104             :         // Because the PaneDockingWindow paints its own decoration, we have
     105             :         // to compensate the valid size range for that.
     106         109 :         const SvBorder aBorder (GetDecorationBorder());
     107         109 :         sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
     108           0 :             ? aBorder.Top() + aBorder.Bottom()
     109         109 :             : aBorder.Left() + aBorder.Right());
     110             :         pSplitWindow->SetItemSizeRange(
     111             :             nSetId,
     112             :             Range(
     113         109 :                 aValidSizeRange.Min() + nCompensation,
     114         218 :                 aValidSizeRange.Max() + nCompensation));
     115             :     }
     116         109 : }
     117             : 
     118         271 : PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const
     119             : {
     120         271 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     121         271 :     if (pSplitWindow == NULL)
     122           0 :         return UnknownOrientation;
     123         271 :     else if (pSplitWindow->IsHorizontal())
     124           0 :         return HorizontalOrientation;
     125             :     else
     126         271 :         return VerticalOrientation;
     127             : }
     128             : 
     129         114 : } // end of namespace ::sd
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10