LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - PaneDockingWindow.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 35 44 79.5 %
Date: 2015-06-13 12:38:46 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          66 : PaneDockingWindow::PaneDockingWindow(
      41             :         SfxBindings *_pBindings, SfxChildWindow *pChildWindow, vcl::Window* pParent,
      42             :         const OUString& rsTitle )
      43          66 :         : TitledDockingWindow(_pBindings, pChildWindow, pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_HIDE|WB_3DLOOK)
      44             : {
      45          66 :     SetTitle(rsTitle);
      46          66 :     SetSizePixel(LogicToPixel(Size(80,200), MAP_APPFONT));
      47          66 : }
      48             : 
      49         132 : PaneDockingWindow::~PaneDockingWindow()
      50             : {
      51         132 : }
      52             : 
      53         202 : void PaneDockingWindow::StateChanged( StateChangedType nType )
      54             : {
      55         202 :     switch (nType)
      56             :     {
      57             :         case StateChangedType::InitShow:
      58          66 :             Resize();
      59          66 :             GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      60          66 :             break;
      61             : 
      62             :         case StateChangedType::Visible:
      63             :         {
      64             :             // The visibility of the docking window has changed.  Tell the
      65             :             // ConfigurationController so that it can activate or deactivate
      66             :             // a/the view for the pane.
      67             :             // Without this the side panes remain empty after closing an
      68             :             // in-place slide show.
      69             :             ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
      70         132 :                 GetBindings().GetDispatcher()->GetFrame());
      71         132 :             if (pBase != NULL)
      72             :             {
      73         132 :                 framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
      74             :             }
      75             :         }
      76         132 :         break;
      77             : 
      78             :         default:;
      79             :     }
      80         202 :     SfxDockingWindow::StateChanged (nType);
      81         202 : }
      82             : 
      83           0 : void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
      84             : {
      85           0 :     if (rEvent.GetButtons() == MOUSE_LEFT)
      86             :     {
      87             :         // For some strange reason we have to set the WB_DIALOGCONTROL at
      88             :         // the content window in order to have it pass focus to its content
      89             :         // window.  Without setting this flag here that works only on views
      90             :         // that have not been taken from the cash and relocated to this pane
      91             :         // docking window.
      92           0 :         GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      93           0 :         GetContentWindow().GrabFocus();
      94             :     }
      95           0 :     SfxDockingWindow::MouseButtonDown(rEvent);
      96           0 : }
      97             : 
      98          66 : void PaneDockingWindow::SetValidSizeRange (const Range& rValidSizeRange)
      99             : {
     100          66 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     101          66 :     if (pSplitWindow != NULL)
     102             :     {
     103          66 :         const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< vcl::Window*>(this)));
     104          66 :         const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
     105             :         // Because the PaneDockingWindow paints its own decoration, we have
     106             :         // to compensate the valid size range for that.
     107          66 :         const SvBorder aBorder (GetDecorationBorder());
     108          66 :         sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
     109           0 :             ? aBorder.Top() + aBorder.Bottom()
     110          66 :             : aBorder.Left() + aBorder.Right());
     111             :         pSplitWindow->SetItemSizeRange(
     112             :             nSetId,
     113             :             Range(
     114          66 :                 rValidSizeRange.Min() + nCompensation,
     115         132 :                 rValidSizeRange.Max() + nCompensation));
     116             :     }
     117          66 : }
     118             : 
     119         141 : PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation() const
     120             : {
     121         141 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     122         141 :     if (pSplitWindow == NULL)
     123           0 :         return UnknownOrientation;
     124         141 :     else if (pSplitWindow->IsHorizontal())
     125           0 :         return HorizontalOrientation;
     126             :     else
     127         141 :         return VerticalOrientation;
     128             : }
     129             : 
     130          66 : } // end of namespace ::sd
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11