tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / slideshow / source / engine / rehearsetimingsactivity.hxx
blob784ebfb2f584437f853bdeffc27e71dd10edb6ca
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 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
23 #include <activity.hxx>
24 #include <activitiesqueue.hxx>
25 #include <eventqueue.hxx>
26 #include <vieweventhandler.hxx>
28 #include <basegfx/range/b2drange.hxx>
29 #include <vcl/font.hxx>
31 #include <vector>
32 #include <utility>
33 #include <memory>
35 namespace vcl { class Font; }
36 namespace canvas::tools{ class ElapsedTime; }
37 namespace cppcanvas{ class CustomSprite; }
38 namespace basegfx
40 class B2IVector;
41 class B2DRange;
44 namespace slideshow::internal {
46 struct SlideShowContext;
47 class EventMultiplexer;
48 class ScreenUpdater;
49 class RehearseTimingsActivity : public Activity,
50 public ViewEventHandler
52 public:
53 /** Creates the activity.
55 static std::shared_ptr<RehearseTimingsActivity> create(
56 const SlideShowContext& rContext );
58 virtual ~RehearseTimingsActivity() override;
59 RehearseTimingsActivity(const RehearseTimingsActivity&) = delete;
60 RehearseTimingsActivity& operator=(const RehearseTimingsActivity&) = delete;
62 /** Starts and shows the timer; adds to activity queue.
64 void start();
66 /** Stops and hides the timer.
67 @return elapsed time
69 double stop();
71 /** Determines whether the timer button has been clicked.
73 bool hasBeenClicked() const;
75 // ViewEventHandler interface
76 virtual void viewAdded( const UnoViewSharedPtr& rView ) override;
77 virtual void viewRemoved( const UnoViewSharedPtr& rView ) override;
78 virtual void viewChanged( const UnoViewSharedPtr& rView ) override;
79 virtual void viewsChanged() override;
81 // Disposable:
82 virtual void dispose() override;
83 // Activity:
84 virtual double calcTimeLag() const override;
85 virtual bool perform() override;
86 virtual bool isActive() const override;
87 virtual void dequeued() override;
88 virtual void end() override;
90 private:
91 class WakeupEvent;
93 explicit RehearseTimingsActivity( const SlideShowContext& rContext );
95 void paint( ::cppcanvas::CanvasSharedPtr const & canvas ) const;
96 void paintAllSprites() const;
98 class MouseHandler;
99 friend class MouseHandler;
101 typedef std::vector<
102 std::pair<UnoViewSharedPtr,
103 std::shared_ptr<cppcanvas::CustomSprite> > > ViewsVecT;
105 template <typename func_type>
106 void for_each_sprite( func_type const & func ) const
108 ViewsVecT::const_iterator iPos( maViews.begin() );
109 const ViewsVecT::const_iterator iEnd( maViews.end() );
110 for ( ; iPos != iEnd; ++iPos )
111 func( iPos->second );
114 ::basegfx::B2DRange calcSpriteRectangle(
115 UnoViewSharedPtr const & rView ) const;
117 EventQueue& mrEventQueue;
118 ScreenUpdater& mrScreenUpdater;
119 EventMultiplexer& mrEventMultiplexer;
120 ActivitiesQueue& mrActivitiesQueue;
121 canvas::tools::ElapsedTime maElapsedTime;
123 ViewsVecT maViews;
125 /// screen rect of sprite (in view coordinates!)
126 ::basegfx::B2DRange maSpriteRectangle;
128 vcl::Font maFont;
129 std::shared_ptr<WakeupEvent> mpWakeUpEvent;
130 std::shared_ptr<MouseHandler> mpMouseHandler;
131 ::basegfx::B2IVector maSpriteSizePixel;
132 sal_Int32 mnYOffset;
133 bool mbActive;
134 bool mbDrawPressed;
137 } // namespace presentation::internal
139 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */