LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - SidebarChildWindow.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 21 95.2 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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             : 
      20             : #include "TabBar.hxx"
      21             : #include <sfx2/bindings.hxx>
      22             : #include <sfx2/sidebar/SidebarChildWindow.hxx>
      23             : #include "SidebarDockingWindow.hxx"
      24             : #include <sfx2/sfxsids.hrc>
      25             : #include "helpid.hrc"
      26             : #include <sfx2/dockwin.hxx>
      27             : #include <sfx2/sidebar/ResourceDefinitions.hrc>
      28             : 
      29             : namespace sfx2 { namespace sidebar {
      30             : 
      31        6637 : SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
      32             : 
      33        3155 : SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 nId,
      34             :                                         SfxBindings* pBindings, SfxChildWinInfo* pInfo)
      35        3155 :     : SfxChildWindow(pParentWindow, nId)
      36             : {
      37             :     pWindow.reset(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, pParentWindow,
      38             :                                                        WB_STDDOCKWIN | WB_OWNERDRAWDECORATION |
      39             :                                                        WB_CLIPCHILDREN | WB_SIZEABLE |
      40        3155 :                                                        WB_3DLOOK | WB_ROLLABLE));
      41        3155 :     eChildAlignment = SfxChildAlignment::RIGHT;
      42             : 
      43        3155 :     pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
      44        3155 :     pWindow->SetOutputSizePixel(Size(GetDefaultWidth(pWindow), 450));
      45             : 
      46        3155 :     SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pWindow.get());
      47        3155 :     if (pDockingParent != NULL)
      48             :     {
      49        3155 :         if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw" && pInfo->aModule != "simpress")
      50             :         {
      51             :             // When this is the first start (never had the sidebar open yet),
      52             :             // default to non-expanded sidebars in Writer and Calc.
      53             :             //
      54             :             // HACK: unfortunately I haven't found a clean solution to do
      55             :             // this, so do it this way:
      56             :             //
      57          84 :             pDockingParent->SetSizePixel(Size(TabBar::GetDefaultWidth() * pWindow->GetDPIScaleFactor(),
      58         168 :                         pDockingParent->GetSizePixel().Height()));
      59             :         }
      60        3155 :         pDockingParent->Initialize(pInfo);
      61             :     }
      62        3155 :     SetHideNotDelete(true);
      63             : 
      64        3155 :     pWindow->Show();
      65        3155 : }
      66             : 
      67        3155 : sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window* pWindow)
      68             : {
      69        3155 :     if (pWindow != NULL)
      70             :     {
      71             :         // Width of the paragraph panel.
      72             :         const static sal_Int32 nMaxPropertyPageWidth (115);
      73             : 
      74        6310 :         return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MAP_APPFONT).X()
      75        3155 :             + TabBar::GetDefaultWidth() * pWindow->GetDPIScaleFactor();
      76             :     }
      77             :     else
      78           0 :         return 0;
      79             : }
      80             : 
      81             : } } // end of namespace sfx2::sidebar
      82             : 
      83             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11