bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / dlg / docprev.cxx
blobdca7a4798402fd1a45a6ad2797d3c89509c43ed9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <slideshow.hxx>
21 #include <vcl/ctrl.hxx>
22 #include <vcl/settings.hxx>
24 #include <docprev.hxx>
25 #include <ViewShell.hxx>
26 #include <vcl/svapp.hxx>
27 #include <vcl/builderfactory.hxx>
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::uno;
32 const int SdDocPreviewWin::FRAME = 4;
34 VCL_BUILDER_FACTORY_CONSTRUCTOR(SdDocPreviewWin, 0)
36 SdDocPreviewWin::SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle )
37 : Control(pParent, nStyle)
39 SetBorderStyle( WindowBorderStyle::MONO );
40 svtools::ColorConfig aColorConfig;
41 Wallpaper aEmpty;
42 SetBackground( aEmpty );
45 SdDocPreviewWin::~SdDocPreviewWin()
47 disposeOnce();
50 void SdDocPreviewWin::dispose()
52 if (mxSlideShow.is())
54 mxSlideShow->end();
55 mxSlideShow.clear();
57 Control::dispose();
60 Size SdDocPreviewWin::GetOptimalSize() const
62 return LogicToPixel(Size(122, 96), MapMode(MapUnit::MapAppFont));
65 void SdDocPreviewWin::Resize()
67 Invalidate();
68 if( mxSlideShow.is() )
69 mxSlideShow->resize( GetSizePixel() );
72 void SdDocPreviewWin::ImpPaint( OutputDevice* pVDev )
74 svtools::ColorConfig aColorConfig;
76 pVDev->SetLineColor();
77 pVDev->SetFillColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
78 pVDev->DrawRect(::tools::Rectangle( Point(0,0 ), pVDev->GetOutputSize()));
81 void SdDocPreviewWin::Paint( vcl::RenderContext& /*rRenderContext*/, const ::tools::Rectangle& /*rRect*/ )
83 if( (!mxSlideShow.is()) || (!mxSlideShow->isRunning() ) )
85 SvtAccessibilityOptions aAccOptions;
86 bool bUseContrast = aAccOptions.GetIsForPagePreviews() && Application::GetSettings().GetStyleSettings().GetHighContrastMode();
87 SetDrawMode( bUseContrast
88 ? ::sd::OUTPUT_DRAWMODE_CONTRAST
89 : ::sd::OUTPUT_DRAWMODE_COLOR );
91 ImpPaint( this );
93 else
95 mxSlideShow->paint();
99 void SdDocPreviewWin::Notify(SfxBroadcaster&, const SfxHint& rHint)
101 if( rHint.GetId() == SfxHintId::ColorsChanged )
103 Invalidate();
106 void SdDocPreviewWin::DataChanged( const DataChangedEvent& rDCEvt )
108 Control::DataChanged( rDCEvt );
110 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
112 Invalidate();
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */