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/.
10 #include <DrawViewShell.hxx>
11 #include <ViewShellBase.hxx>
14 #include <comphelper/lok.hxx>
15 #include <comphelper/servicehelper.hxx>
16 #include <sfx2/lokhelper.hxx>
17 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
18 #include <unomodel.hxx>
22 void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster
* pCb
, ConfigurationHints
)
24 svtools::ColorConfig
*pColorConfig
= dynamic_cast<svtools::ColorConfig
*>(pCb
);
25 ConfigureAppBackgroundColor(pColorConfig
);
26 if (comphelper::LibreOfficeKit::isActive())
28 SfxViewShell
* pCurrentShell
= SfxViewShell::Current();
29 ViewShellBase
* pShellBase
= dynamic_cast<ViewShellBase
*>(pCurrentShell
);
32 if (DrawViewShell
* pCurrentDrawShell
= dynamic_cast<DrawViewShell
*>(pShellBase
->GetMainViewShell().get()))
34 pCurrentDrawShell
->maViewOptions
.mnDocBackgroundColor
= pColorConfig
->GetColorValue(svtools::DOCCOLOR
).nColor
;
35 pCurrentDrawShell
->maViewOptions
.msColorSchemeName
= svtools::ColorConfig::GetCurrentSchemeName();
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());
45 void DrawViewShell::ConfigureAppBackgroundColor( svtools::ColorConfig
*pColorConfig
)
48 pColorConfig
= &SD_MOD()->GetColorConfig();
49 Color
aFillColor( pColorConfig
->GetColorValue( svtools::APPBACKGROUND
).nColor
);
50 if (comphelper::LibreOfficeKit::isActive())
51 aFillColor
= COL_TRANSPARENT
;
52 // tdf#87905 Use darker background color for master view
53 if (meEditMode
== EditMode::MasterPage
)
54 aFillColor
.DecreaseLuminance( 64 );
55 maViewOptions
.mnAppBackgroundColor
= aFillColor
;
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */