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 "GraphicViewShell.hxx"
21 : #include "LayerTabBar.hxx"
22 : #include "FrameView.hxx"
23 : #include <sfx2/objsh.hxx>
24 : #include <sfx2/viewfrm.hxx>
25 : #include <vcl/scrbar.hxx>
26 : #include <vcl/settings.hxx>
27 :
28 : #include <tools/helpers.hxx>
29 :
30 : namespace sd {
31 :
32 160 : GraphicViewShell::GraphicViewShell (
33 : SfxViewFrame* pFrame,
34 : ViewShellBase& rViewShellBase,
35 : vcl::Window* pParentWindow,
36 : FrameView* pFrameView)
37 : : DrawViewShell (
38 : pFrame,
39 : rViewShellBase,
40 : pParentWindow,
41 : PK_STANDARD,
42 160 : pFrameView)
43 : {
44 160 : ConstructGraphicViewShell();
45 160 : }
46 :
47 320 : GraphicViewShell::~GraphicViewShell (void)
48 : {
49 320 : }
50 :
51 160 : void GraphicViewShell::ConstructGraphicViewShell(void)
52 : {
53 160 : meShellType = ST_DRAW;
54 :
55 160 : mpLayerTabBar.reset (new LayerTabBar(this, GetParentWindow()));
56 :
57 : // #i67363# no layer tabbar in preview mode
58 160 : if ( !GetObjectShell()->IsPreview() )
59 160 : mpLayerTabBar->Show();
60 160 : }
61 :
62 774 : void GraphicViewShell::ChangeEditMode (
63 : EditMode eMode,
64 : bool )
65 : {
66 : // There is no page tab that could be shown instead of the layer tab.
67 : // Therefore we have it always visible regardless of what the caller
68 : // said. (We have to change the callers behaviour, of course.)
69 774 : DrawViewShell::ChangeEditMode (eMode, true);
70 774 : }
71 :
72 483 : void GraphicViewShell::ArrangeGUIElements (void)
73 : {
74 483 : if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
75 : {
76 483 : Size aSize = mpLayerTabBar->GetSizePixel();
77 483 : const Size aFrameSize (GetViewFrame()->GetWindow().GetOutputSizePixel());
78 :
79 483 : aSize.Height() = GetParentWindow()->GetFont().GetHeight() + 4;
80 483 : aSize.Width() = aFrameSize.Width();
81 :
82 483 : Point aPos (0, maViewSize.Height() - aSize.Height());
83 :
84 483 : mpLayerTabBar->SetPosSizePixel (aPos, aSize);
85 : }
86 :
87 483 : DrawViewShell::ArrangeGUIElements();
88 483 : }
89 :
90 114 : } // end of namespace sd
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|