LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - PaneDockingWindow.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 33 42 78.6 %
Date: 2012-08-25 Functions: 6 7 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 18 35 51.4 %

           Branch data     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                 :            : 
      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>
      33                 :            : 
      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;
      38                 :            : 
      39                 :            : namespace sd {
      40                 :            : 
      41                 :        156 : PaneDockingWindow::PaneDockingWindow(
      42                 :            :         SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent,
      43                 :            :         const ResId& rResId, const ::rtl::OUString& rsTitle )
      44                 :        156 :         :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId )
      45                 :            : {
      46 [ +  - ][ +  - ]:        156 :     SetTitle( rsTitle );
                 [ +  - ]
      47                 :        156 : }
      48                 :            : 
      49                 :        156 : PaneDockingWindow::~PaneDockingWindow (void)
      50                 :            : {
      51         [ -  + ]:        312 : }
      52                 :            : 
      53                 :        492 : void PaneDockingWindow::StateChanged( StateChangedType nType )
      54                 :            : {
      55      [ +  +  + ]:        492 :     switch (nType)
      56                 :            :     {
      57                 :            :         case STATE_CHANGE_INITSHOW:
      58                 :        156 :             Resize();
      59                 :        156 :             GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      60                 :        156 :             break;
      61                 :            : 
      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                 :        312 :                 GetBindings().GetDispatcher()->GetFrame());
      70         [ +  - ]:        312 :             if (pBase != NULL)
      71                 :            :             {
      72         [ +  - ]:        312 :                 framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
      73                 :            :             }
      74                 :        312 :             break;
      75                 :            :     }
      76                 :        492 :     SfxDockingWindow::StateChanged (nType);
      77                 :        492 : }
      78                 :            : 
      79                 :          0 : void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
      80                 :            : {
      81         [ #  # ]:          0 :     if (rEvent.GetButtons() == MOUSE_LEFT)
      82                 :            :     {
      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                 :          0 :         GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL);
      89                 :          0 :         GetContentWindow().GrabFocus();
      90                 :            :     }
      91                 :          0 :     SfxDockingWindow::MouseButtonDown(rEvent);
      92                 :          0 : }
      93                 :            : 
      94                 :            : 
      95                 :            : 
      96                 :            : 
      97                 :            : 
      98                 :            : 
      99                 :            : 
     100                 :            : 
     101                 :        126 : void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange)
     102                 :            : {
     103         [ -  + ]:        126 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     104         [ +  - ]:        126 :     if (pSplitWindow != NULL)
     105                 :            :     {
     106         [ +  - ]:        126 :         const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< ::Window*>(this)));
     107         [ +  - ]:        126 :         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                 :        126 :         const SvBorder aBorder (GetDecorationBorder());
     111                 :        126 :         sal_Int32 nCompensation (pSplitWindow->IsHorizontal()
     112                 :          0 :             ? mnTitleBarHeight + aBorder.Top() + aBorder.Bottom()
     113         [ -  + ]:        126 :             : aBorder.Left() + aBorder.Right());
     114                 :            :         pSplitWindow->SetItemSizeRange(
     115                 :            :             nSetId,
     116                 :            :             Range(
     117                 :        126 :                 aValidSizeRange.Min() + nCompensation,
     118         [ +  - ]:        252 :                 aValidSizeRange.Max() + nCompensation));
     119                 :            :     }
     120                 :        126 : }
     121                 :            : 
     122                 :            : 
     123                 :            : 
     124                 :            : 
     125                 :        299 : PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const
     126                 :            : {
     127         [ -  + ]:        299 :     SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent());
     128         [ -  + ]:        299 :     if (pSplitWindow == NULL)
     129                 :          0 :         return UnknownOrientation;
     130         [ -  + ]:        299 :     else if (pSplitWindow->IsHorizontal())
     131                 :          0 :         return HorizontalOrientation;
     132                 :            :     else
     133                 :        299 :         return VerticalOrientation;
     134                 :            : }
     135                 :            : 
     136                 :            : } // end of namespace ::sd
     137                 :            : 
     138                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10