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

Generated by: LCOV version 1.10