LCOV - code coverage report
Current view: top level - sd/source/ui/view - grviewsh.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 47 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : 
      20             : 
      21             : #include "GraphicViewShell.hxx"
      22             : #include "LayerTabBar.hxx"
      23             : #include "FrameView.hxx"
      24             : #include <sfx2/objsh.hxx>
      25             : #include <sfx2/viewfrm.hxx>
      26             : #include <vcl/scrbar.hxx>
      27             : #include <vcl/settings.hxx>
      28             : 
      29             : #include <tools/helpers.hxx>
      30             : 
      31             : namespace sd {
      32             : 
      33             : static const int TABCONTROL_INITIAL_SIZE = 350;
      34             : 
      35             : 
      36           0 : GraphicViewShell::GraphicViewShell (
      37             :     SfxViewFrame* pFrame,
      38             :     ViewShellBase& rViewShellBase,
      39             :     ::Window* pParentWindow,
      40             :     FrameView* pFrameView)
      41             :     : DrawViewShell (
      42             :         pFrame,
      43             :         rViewShellBase,
      44             :         pParentWindow,
      45             :         PK_STANDARD,
      46           0 :         pFrameView)
      47             : {
      48           0 :     ConstructGraphicViewShell();
      49           0 : }
      50             : 
      51           0 : GraphicViewShell::~GraphicViewShell (void)
      52             : {
      53           0 : }
      54             : 
      55             : 
      56             : 
      57             : 
      58           0 : void GraphicViewShell::ConstructGraphicViewShell(void)
      59             : {
      60           0 :     meShellType = ST_DRAW;
      61             : 
      62           0 :     mpLayerTabBar.reset (new LayerTabBar(this,GetParentWindow()));
      63           0 :     mpLayerTabBar->SetSplitHdl(LINK(this,GraphicViewShell,TabBarSplitHandler));
      64             : 
      65             :     // pb: #i67363# no layer tabbar on preview mode
      66           0 :     if ( !GetObjectShell()->IsPreview() )
      67           0 :         mpLayerTabBar->Show();
      68           0 : }
      69             : 
      70             : 
      71             : 
      72             : 
      73           0 : void GraphicViewShell::ChangeEditMode (
      74             :     EditMode eMode,
      75             :     bool )
      76             : {
      77             :     // There is no page tab that could be shown instead of the layer tab.
      78             :     // Therefore we have it always visible regardless of what the caller
      79             :     // said. (We have to change the callers behaviour, of course.)
      80           0 :     DrawViewShell::ChangeEditMode (eMode, true);
      81           0 : }
      82             : 
      83             : 
      84             : 
      85             : 
      86           0 : void GraphicViewShell::ArrangeGUIElements (void)
      87             : {
      88           0 :     if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
      89             :     {
      90           0 :         Size aSize = mpLayerTabBar->GetSizePixel();
      91             :         const Size aFrameSize (
      92           0 :             GetViewFrame()->GetWindow().GetOutputSizePixel());
      93             : 
      94           0 :         if (aSize.Width() == 0)
      95             :         {
      96           0 :             if (mpFrameView->GetTabCtrlPercent() == 0.0)
      97           0 :                 aSize.Width() = TABCONTROL_INITIAL_SIZE;
      98             :             else
      99           0 :                 aSize.Width() = FRound(aFrameSize.Width()
     100           0 :                     * mpFrameView->GetTabCtrlPercent());
     101             :         }
     102           0 :         aSize.Height() = GetParentWindow()->GetSettings().GetStyleSettings()
     103           0 :             .GetScrollBarSize();
     104             : 
     105           0 :         Point aPos (0, maViewSize.Height() - aSize.Height());
     106             : 
     107           0 :         mpLayerTabBar->SetPosSizePixel (aPos, aSize);
     108             : 
     109           0 :         if (aFrameSize.Width() > 0)
     110             :             mpFrameView->SetTabCtrlPercent (
     111           0 :                 (double) maTabControl.GetSizePixel().Width()
     112           0 :                 / aFrameSize.Width());
     113             :         else
     114           0 :             mpFrameView->SetTabCtrlPercent( 0.0 );
     115             :     }
     116             : 
     117           0 :     DrawViewShell::ArrangeGUIElements();
     118           0 : }
     119             : 
     120             : 
     121             : 
     122             : 
     123           0 : IMPL_LINK(GraphicViewShell, TabBarSplitHandler, TabBar*, pTabBar)
     124             : {
     125           0 :     const long int nMax = maViewSize.Width()
     126           0 :         - maScrBarWH.Width()
     127           0 :         - pTabBar->GetPosPixel().X();
     128             : 
     129           0 :     Size aTabSize = pTabBar->GetSizePixel();
     130           0 :     aTabSize.Width() = std::min(pTabBar->GetSplitSize(), (long)(nMax-1));
     131             : 
     132           0 :     pTabBar->SetSizePixel (aTabSize);
     133             : 
     134           0 :     Point aPos = pTabBar->GetPosPixel();
     135           0 :     aPos.X() += aTabSize.Width();
     136             : 
     137           0 :     Size aScrSize (nMax - aTabSize.Width(), maScrBarWH.Height());
     138           0 :     mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
     139             : 
     140           0 :     return 0;
     141             : }
     142             : 
     143             : } // end of namespace sd
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10