LibreOffice Module sd (master) 1
drviewsk.cxx
Go to the documentation of this file.
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
10#include <DrawViewShell.hxx>
11#include <ViewShellBase.hxx>
12#include <sdmod.hxx>
13
14#include <comphelper/lok.hxx>
16#include <sfx2/lokhelper.hxx>
17#include <LibreOfficeKit/LibreOfficeKitEnums.h>
18#include <unomodel.hxx>
19
20namespace sd {
21
23{
24 svtools::ColorConfig *pColorConfig = dynamic_cast<svtools::ColorConfig*>(pCb);
25 ConfigureAppBackgroundColor(pColorConfig);
27 {
28 SfxViewShell* pCurrentShell = SfxViewShell::Current();
29 ViewShellBase* pShellBase = dynamic_cast<ViewShellBase*>(pCurrentShell);
30 if (!pShellBase)
31 return;
32 if (DrawViewShell* pCurrentDrawShell = dynamic_cast<DrawViewShell*>(pShellBase->GetMainViewShell().get()))
33 {
34 pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor;
35 pCurrentDrawShell->maViewOptions.msColorSchemeName = svtools::ColorConfig::GetCurrentSchemeName();
36 }
37 SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(pCurrentShell->GetCurrentDocument());
38 SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc);
39 Color aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor);
40 pCurrentShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
41 aFillColor.AsRGBHexString().toUtf8());
42 }
43}
44
46{
47 if (!pColorConfig)
48 pColorConfig = &SD_MOD()->GetColorConfig();
49 Color aFillColor( pColorConfig->GetColorValue( svtools::APPBACKGROUND ).nColor );
51 aFillColor = COL_TRANSPARENT;
52 // tdf#87905 Use darker background color for master view
54 aFillColor.DecreaseLuminance( 64 );
56}
57
58}
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
void DecreaseLuminance(sal_uInt8 cLumDec)
OUString AsRGBHexString() const
static void notifyViewRenderState(SfxViewShell const *pViewShell, vcl::ITiledRenderable *pDoc)
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
SdViewOptions maViewOptions
void ConfigureAppBackgroundColor(svtools::ColorConfig *pColorConfig=nullptr)
Definition: drviewsk.cxx:45
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *pCb, ConfigurationHints) override
Definition: drviewsk.cxx:22
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
static const OUString & GetCurrentSchemeName()
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
ConfigurationHints
#define SD_MOD()
Definition: sdmod.hxx:184
Color mnAppBackgroundColor
Definition: viewopt.hxx:27