1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <GraphicViewShell.hxx>
21 #include <LayerTabBar.hxx>
22 #include <FrameView.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <sfx2/viewfrm.hxx>
26 constexpr sal_Int32 TAB_HEIGHT_MARGIN
= 10;
30 GraphicViewShell::GraphicViewShell (
31 ViewShellBase
& rViewShellBase
,
32 vcl::Window
* pParentWindow
,
33 FrameView
* pFrameView
)
40 ConstructGraphicViewShell();
43 GraphicViewShell::~GraphicViewShell()
47 void GraphicViewShell::ConstructGraphicViewShell()
49 meShellType
= ST_DRAW
;
51 mpLayerTabBar
.reset (VclPtr
<LayerTabBar
>::Create(this, GetParentWindow()));
53 // #i67363# no layer tabbar in preview mode
54 if ( !GetObjectShell()->IsPreview() )
55 mpLayerTabBar
->Show();
58 void GraphicViewShell::ChangeEditMode (
62 // There is no page tab that could be shown instead of the layer tab.
63 // Therefore we have it always visible regardless of what the caller
64 // said. (We have to change the callers behaviour, of course.)
65 DrawViewShell::ChangeEditMode (eMode
, true);
68 void GraphicViewShell::ArrangeGUIElements()
70 if (mpLayerTabBar
&& mpLayerTabBar
->IsVisible())
72 Size aSize
= mpLayerTabBar
->GetSizePixel();
74 if (SfxViewFrame
* pViewFrame
= GetViewFrame())
75 aFrameSize
= pViewFrame
->GetWindow().GetOutputSizePixel();
77 aSize
.setHeight(GetParentWindow()->GetFont().GetFontHeight() + TAB_HEIGHT_MARGIN
);
78 aSize
.setWidth( aFrameSize
.Width() );
80 Point
aPos (0, maViewSize
.Height() - aSize
.Height());
82 mpLayerTabBar
->SetPosSizePixel (aPos
, aSize
);
85 DrawViewShell::ArrangeGUIElements();
88 } // end of namespace sd
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */