/src/libreoffice/sd/source/ui/view/drviewsk.cxx
Line | Count | Source |
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 <com/sun/star/presentation/SlideShow.hpp> |
15 | | |
16 | | #include <comphelper/lok.hxx> |
17 | | #include <comphelper/diagnose_ex.hxx> |
18 | | #include <comphelper/processfactory.hxx> |
19 | | #include <comphelper/servicehelper.hxx> |
20 | | #include <sfx2/lokhelper.hxx> |
21 | | #include <LibreOfficeKit/LibreOfficeKitEnums.h> |
22 | | #include <unomodel.hxx> |
23 | | |
24 | | using namespace css; |
25 | | |
26 | | namespace sd { |
27 | | |
28 | | void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, ConfigurationHints ) |
29 | 0 | { |
30 | 0 | svtools::ColorConfig *pColorConfig = dynamic_cast<svtools::ColorConfig*>(pCb); |
31 | 0 | ConfigureAppBackgroundColor(pColorConfig); |
32 | 0 | if (!comphelper::LibreOfficeKit::isActive()) |
33 | 0 | { |
34 | 0 | SdViewOptions aViewOptions = GetViewOptions(); |
35 | 0 | aViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; |
36 | 0 | SetViewOptions(aViewOptions); |
37 | 0 | } |
38 | 0 | else |
39 | 0 | { |
40 | 0 | SfxViewShell* pCurrentShell = SfxViewShell::Current(); |
41 | 0 | ViewShellBase* pShellBase = dynamic_cast<ViewShellBase*>(pCurrentShell); |
42 | 0 | if (!pShellBase) |
43 | 0 | return; |
44 | 0 | SdViewOptions aViewOptions = pShellBase->GetViewOptions(); |
45 | 0 | aViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; |
46 | 0 | aViewOptions.msColorSchemeName = svtools::ColorConfig::GetCurrentSchemeName(); |
47 | 0 | pShellBase->SetViewOptions(aViewOptions); |
48 | 0 | SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(pCurrentShell->GetCurrentDocument()); |
49 | 0 | SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc); |
50 | 0 | Color aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor); |
51 | 0 | pCurrentShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, |
52 | 0 | aFillColor.AsRGBHexString().toUtf8()); |
53 | 0 | } |
54 | 0 | } |
55 | | |
56 | | void DrawViewShell::ConfigureAppBackgroundColor( svtools::ColorConfig *pColorConfig ) |
57 | 0 | { |
58 | 0 | if (!pColorConfig) |
59 | 0 | pColorConfig = &SdModule::get()->GetColorConfig(); |
60 | 0 | Color aFillColor( pColorConfig->GetColorValue( svtools::APPBACKGROUND ).nColor ); |
61 | 0 | if (comphelper::LibreOfficeKit::isActive()) |
62 | 0 | aFillColor = COL_TRANSPARENT; |
63 | | // tdf#87905 Use darker background color for master view |
64 | 0 | if (meEditMode == EditMode::MasterPage) |
65 | 0 | aFillColor.DecreaseLuminance( 64 ); |
66 | 0 | SdViewOptions aViewOptions = GetViewOptions(); |
67 | 0 | aViewOptions.mnAppBackgroundColor = aFillColor; |
68 | 0 | SetViewOptions(aViewOptions); |
69 | 0 | } |
70 | | |
71 | | void DrawViewShell::destroyXSlideShowInstance() |
72 | 0 | { |
73 | 0 | if (!mxSlideShow.is()) |
74 | 0 | return; |
75 | | |
76 | 0 | try |
77 | 0 | { |
78 | 0 | uno::Reference<lang::XComponent> xComponent(mxSlideShow, uno::UNO_QUERY); |
79 | 0 | if (xComponent.is()) |
80 | 0 | xComponent->dispose(); |
81 | 0 | } |
82 | 0 | catch (uno::Exception&) |
83 | 0 | { |
84 | 0 | TOOLS_WARN_EXCEPTION( "sd", "DrawViewShell::destroyXSlideShowInstance dispose"); |
85 | 0 | } |
86 | | |
87 | 0 | mxSlideShow.clear(); |
88 | 0 | } |
89 | | |
90 | | } |
91 | | |
92 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |