tabview.hxx included drawview.hxx for a std::unique_ptr<ScDrawView> member and an accessor that returns the raw pointer. Neither needs the complete type, and the destructor of ScTabView is already out of line. The include dragged svx/fmview.hxx, svx/view3d.hxx, svx/svdview.hxx and the rest of the svx view class chain into the 200 translation units that include the view shell headers. tabvwsh.hxx and tabview.hxx now include the small headers they used through that chain, and the files that call into the draw view include drawview.hxx themselves. clang -ftime-trace says around 2% of the module build time saved here. Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Change-Id: I198b19e74f6ad56090b987880a063dc9ee677cda Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12683 Tested-by: Jenkins CPCI <releng@collaboraoffice.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit a7fd69666ea5fb4d26dfad0d286f6c1f3bcd3144) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211884 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
128 lines
4.9 KiB
C++
128 lines
4.9 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#include <tabsplit.hxx>
|
|
#include <vcl/ptrstyle.hxx>
|
|
#include <viewdata.hxx>
|
|
|
|
#include <vcl/ptrstyle.hxx>
|
|
#include <vcl/settings.hxx>
|
|
|
|
ScTabSplitter::ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle, ScViewData& rData ) :
|
|
Splitter(pParent, nWinStyle),
|
|
rViewData(rData)
|
|
{
|
|
SetFixed(false);
|
|
EnableRTL(false);
|
|
}
|
|
|
|
ScTabSplitter::~ScTabSplitter()
|
|
{
|
|
}
|
|
|
|
void ScTabSplitter::MouseButtonDown( const MouseEvent& rMEvt )
|
|
{
|
|
if (bFixed)
|
|
Window::MouseButtonDown( rMEvt );
|
|
else
|
|
Splitter::MouseButtonDown( rMEvt );
|
|
}
|
|
|
|
void ScTabSplitter::SetFixed(bool bSet)
|
|
{
|
|
bFixed = bSet;
|
|
if (bSet)
|
|
SetPointer(PointerStyle::Arrow);
|
|
else if (IsHorizontal())
|
|
SetPointer(PointerStyle::HSplit);
|
|
else
|
|
SetPointer(PointerStyle::VSplit);
|
|
}
|
|
|
|
void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect )
|
|
{
|
|
auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR);
|
|
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
|
|
|
|
if (IsHorizontal())
|
|
{
|
|
switch (rViewData.GetHSplitMode())
|
|
{
|
|
case SC_SPLIT_NONE:
|
|
{
|
|
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.DrawRect(tools::Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
|
|
|
|
// Draw handle
|
|
rRenderContext.SetLineColor(COL_BLACK);
|
|
rRenderContext.SetFillColor(COL_BLACK);
|
|
const tools::Long xc = rRect.Right() + rRect.Left();
|
|
const tools::Long h4 = rRect.GetHeight() / 4;
|
|
// First xc fraction is truncated, second one is rounded. This will draw a centered line
|
|
// in handles with odd width and a centered rectangle in those with even width.
|
|
rRenderContext.DrawRect(tools::Rectangle(Point(xc / 2, rRect.Top() + h4),
|
|
Point((xc + 1) / 2, rRect.Bottom() - h4)));
|
|
break;
|
|
}
|
|
case SC_SPLIT_NORMAL:
|
|
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.DrawRect(tools::Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
|
|
break;
|
|
case SC_SPLIT_FIX:
|
|
// Nothing to draw
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (rViewData.GetVSplitMode())
|
|
{
|
|
case SC_SPLIT_NONE:
|
|
{
|
|
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.DrawRect(tools::Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
|
|
|
|
// Draw handle
|
|
rRenderContext.SetLineColor(COL_BLACK);
|
|
rRenderContext.SetFillColor(COL_BLACK);
|
|
const tools::Long yc = rRect.Top() + rRect.Bottom();
|
|
const tools::Long w4 = rRect.GetWidth() / 4;
|
|
// First yc fraction is truncated, second one is rounded. This will draw a centered line
|
|
// in handles with odd height and a centered rectangle in those with even height.
|
|
GetOutDev()->DrawRect(tools::Rectangle(Point(rRect.Left() + w4, yc / 2),
|
|
Point(rRect.Right() - w4, (yc + 1) / 2)));
|
|
break;
|
|
}
|
|
case SC_SPLIT_NORMAL:
|
|
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
|
|
rRenderContext.DrawRect(tools::Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
|
|
break;
|
|
case SC_SPLIT_FIX:
|
|
// Nothing to draw
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|