LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - SidebarDockingWindow.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 7 0.0 %
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             : #include "SidebarDockingWindow.hxx"
      20             : #include <sfx2/sidebar/SidebarChildWindow.hxx>
      21             : #include "SidebarController.hxx"
      22             : 
      23             : #include <sfx2/bindings.hxx>
      24             : #include <sfx2/dispatch.hxx>
      25             : #include <tools/link.hxx>
      26             : 
      27             : using namespace css;
      28             : using namespace cssu;
      29             : 
      30             : 
      31             : namespace sfx2 { namespace sidebar {
      32             : 
      33             : 
      34           0 : SidebarDockingWindow::SidebarDockingWindow(
      35             :     SfxBindings* pSfxBindings,
      36             :     SidebarChildWindow& rChildWindow,
      37             :     Window* pParentWindow,
      38             :     WinBits nBits)
      39             :     : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits),
      40           0 :       mpSidebarController()
      41             : {
      42             :     // Get the XFrame from the bindings.
      43           0 :     if (pSfxBindings==NULL || pSfxBindings->GetDispatcher()==NULL)
      44             :     {
      45             :         OSL_ASSERT(pSfxBindings!=NULL);
      46             :         OSL_ASSERT(pSfxBindings->GetDispatcher()!=NULL);
      47             :     }
      48             :     else
      49             :     {
      50           0 :         const SfxViewFrame* pViewFrame = pSfxBindings->GetDispatcher()->GetFrame();
      51           0 :         const SfxFrame& rFrame = pViewFrame->GetFrame();
      52           0 :         mpSidebarController.set(new sfx2::sidebar::SidebarController(this, rFrame.GetFrameInterface()));
      53             :     }
      54           0 : }
      55             : 
      56             : 
      57             : 
      58             : 
      59           0 : SidebarDockingWindow::~SidebarDockingWindow (void)
      60             : {
      61           0 :     DoDispose();
      62           0 : }
      63             : 
      64             : 
      65             : 
      66             : 
      67           0 : void SidebarDockingWindow::DoDispose (void)
      68             : {
      69           0 :     Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpSidebarController.get()), UNO_QUERY);
      70           0 :     mpSidebarController.clear();
      71           0 :     if (xComponent.is())
      72             :     {
      73           0 :         xComponent->dispose();
      74           0 :     }
      75           0 : }
      76             : 
      77             : 
      78             : 
      79             : 
      80           0 : void SidebarDockingWindow::GetFocus()
      81             : {
      82           0 :     mpSidebarController->GetFocusManager().GrabFocus();
      83           0 : }
      84             : 
      85             : 
      86             : 
      87             : 
      88           0 : bool SidebarDockingWindow::Close (void)
      89             : {
      90           0 :     if (mpSidebarController.is())
      91             :     {
      92             :         // Do not close the floating window.
      93             :         // Dock it and close just the deck instead.
      94           0 :         SetFloatingMode(false);
      95           0 :         mpSidebarController->RequestCloseDeck();
      96           0 :         mpSidebarController->NotifyResize();
      97           0 :         return false;
      98             :     }
      99             :     else
     100           0 :         return SfxDockingWindow::Close();
     101             : }
     102             : 
     103             : 
     104             : 
     105             : 
     106           0 : SfxChildAlignment SidebarDockingWindow::CheckAlignment (
     107             :     SfxChildAlignment eCurrentAlignment,
     108             :     SfxChildAlignment eRequestedAlignment)
     109             : {
     110           0 :     switch (eRequestedAlignment)
     111             :     {
     112             :         case SFX_ALIGN_TOP:
     113             :         case SFX_ALIGN_HIGHESTTOP:
     114             :         case SFX_ALIGN_LOWESTTOP:
     115             :         case SFX_ALIGN_BOTTOM:
     116             :         case SFX_ALIGN_LOWESTBOTTOM:
     117             :         case SFX_ALIGN_HIGHESTBOTTOM:
     118           0 :             return eCurrentAlignment;
     119             : 
     120             :         case SFX_ALIGN_LEFT:
     121             :         case SFX_ALIGN_RIGHT:
     122             :         case SFX_ALIGN_FIRSTLEFT:
     123             :         case SFX_ALIGN_LASTLEFT:
     124             :         case SFX_ALIGN_FIRSTRIGHT:
     125             :         case SFX_ALIGN_LASTRIGHT:
     126           0 :             return eRequestedAlignment;
     127             : 
     128             :         default:
     129           0 :             return eRequestedAlignment;
     130             :     }
     131             : }
     132             : 
     133             : 
     134             : } } // end of namespace sfx2::sidebar
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10