LibreOffice Module sd (master) 1
SlideSorterView.hxx
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 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
24#include <view/SlsLayouter.hxx>
26#include <o3tl/deleter.hxx>
27
28#include <View.hxx>
29#include <tools/gen.hxx>
30#include <vcl/region.hxx>
31#include <memory>
32
33namespace sd::slidesorter::cache { class PageCache; }
34namespace sd::slidesorter::model { class SlideSorterModel; }
35namespace sd { class Window; }
36namespace sd::slidesorter { class SlideSorter; }
37namespace sd::slidesorter::view {
38
39class LayeredDevice;
40class PageObjectPainter;
41class ToolTip;
42
43class SlideSorterView final
44 : public sd::View
45{
46public:
47
54 explicit SlideSorterView (SlideSorter& rSlideSorter);
55 void Init();
56
57 virtual ~SlideSorterView() override;
58 void Dispose();
59
62
66 bool SetOrientation (const Layouter::Orientation eOrientation);
68
69 void RequestRepaint();
70 void RequestRepaint (const model::SharedPageDescriptor& rDescriptor);
71 void RequestRepaint (const ::tools::Rectangle& rRepaintBox);
72 void RequestRepaint (const vcl::Region& rRepaintRegion);
73
75
83 sal_Int32 GetPageIndexAtPoint (const Point& rPosition) const;
84
86
87 virtual void ModelHasChanged() override;
88
95 void PreModelChange();
96
101 void PostModelChange();
102
106 void HandleModelChange();
107
109
110 void Resize();
111 virtual void CompleteRedraw (
112 OutputDevice* pDevice,
113 const vcl::Region& rPaintArea,
114 sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override;
115 void Paint (OutputDevice& rDevice, const ::tools::Rectangle& rRepaintArea);
116
117 virtual void ConfigurationChanged (
118 utl::ConfigurationBroadcaster* pBroadcaster,
119 ConfigurationHints nHint) override;
120
122
123 void Layout();
128
129 std::shared_ptr<cache::PageCache> const & GetPreviewCache();
130
137 Range const & GetVisiblePageRange();
138
142 // void AddSdrObject (SdrObject& rObject);
143
151
158
162 void UpdatePageUnderMouse ();
163 void UpdatePageUnderMouse (const Point& rMousePosition);
164 void SetPageUnderMouse (const model::SharedPageDescriptor& rpDescriptor);
165
166 bool SetState (
167 const model::SharedPageDescriptor& rpDescriptor,
168 const model::PageDescriptor::State eState,
169 const bool bStateValue);
170
171 void UpdateOrientation();
172
173 std::shared_ptr<PageObjectPainter> const & GetPageObjectPainter();
174 const std::shared_ptr<LayeredDevice>& GetLayeredDevice() const { return mpLayeredDevice;}
175
177 {
178 public:
179 DrawLock (SlideSorter const & rSlideSorter);
180 ~DrawLock();
184 void Dispose();
185 private:
188 };
189
190 ToolTip& GetToolTip() const;
191
192 virtual void DragFinished (sal_Int8 nDropAction) override;
193
194private:
198 ::std::unique_ptr<Layouter> mpLayouter;
200 std::shared_ptr<cache::PageCache> mpPreviewCache;
201 std::shared_ptr<LayeredDevice> mpLayeredDevice;
207 std::shared_ptr<PageObjectPainter> mpPageObjectPainter;
210 std::unique_ptr<ToolTip, o3tl::default_delete<ToolTip>> mpToolTip;
212 ::std::vector<Link<LinkParamNone*,void>> maVisibilityChangeListeners;
213
217
218 void UpdatePreciousFlags();
219 void RequestRearrange();
220 void Rearrange();
221};
222
223} // end of namespace ::sd::slidesorter::view
224
225/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
The model of the slide sorter gives access to the slides that are to be displayed in the slide sorter...
Calculate the size and position of page objects displayed by a slide sorter.
Definition: SlsLayouter.hxx:60
void Dispose()
When the DrawLock is disposed then it will not request a repaint on destruction.
void RemoveVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Remove a listener that is called when the set of visible slides changes.
Range const & GetVisiblePageRange()
Return the range of currently visible page objects including the first and last one in that range.
void InvalidatePageObjectVisibilities()
This tells the view that it has to re-determine the visibility of the page objects before painting th...
std::shared_ptr< LayeredDevice > mpLayeredDevice
SlideSorterView(SlideSorter &rSlideSorter)
Create a new view for the slide sorter.
std::unique_ptr< ToolTip, o3tl::default_delete< ToolTip > > mpToolTip
std::shared_ptr< PageObjectPainter > mpPageObjectPainter
virtual void CompleteRedraw(OutputDevice *pDevice, const vcl::Region &rPaintArea, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr) override
The event will be forwarded to the View.
SlideSorterView & operator=(const SlideSorterView &)=delete
Layouter::Orientation GetOrientation() const
sal_Int32 GetPageIndexAtPoint(const Point &rPosition) const
Return the index of the page that is rendered at the given position.
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *pBroadcaster, ConfigurationHints nHint) override
void HandleModelChange()
This method is a convenience function that simply calls PreModelChange() and then PostModelChange().
void SetPageUnderMouse(const model::SharedPageDescriptor &rpDescriptor)
bool SetState(const model::SharedPageDescriptor &rpDescriptor, const model::PageDescriptor::State eState, const bool bStateValue)
::std::vector< Link< LinkParamNone *, void > > maVisibilityChangeListeners
std::shared_ptr< cache::PageCache > mpPreviewCache
void DeterminePageObjectVisibilities()
Determine the visibility of all page objects.
SlideSorterView(const SlideSorterView &)=delete
std::shared_ptr< PageObjectPainter > const & GetPageObjectPainter()
const std::shared_ptr< LayeredDevice > & GetLayeredDevice() const
std::shared_ptr< cache::PageCache > const & GetPreviewCache()
void AddVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Add a shape to the page.
::std::unique_ptr< Layouter > mpLayouter
void Paint(OutputDevice &rDevice, const ::tools::Rectangle &rRepaintArea)
::tools::Rectangle GetModelArea() const
void PostModelChange()
This method is typically called after a model change took place.
bool SetOrientation(const Layouter::Orientation eOrientation)
Set the general way of layouting the page objects.
void PreModelChange()
This method is typically called before a model change takes place.
virtual void DragFinished(sal_Int8 nDropAction) override
void UpdatePageUnderMouse()
The page under the mouse is not highlighted in some contexts.
model::SharedPageDescriptor mpPageUnderMouse
Manage the display of tool tips.
Definition: SlsToolTip.hxx:40
std::shared_ptr< PageDescriptor > SharedPageDescriptor
std::shared_ptr< ILayerPainter > SharedILayerPainter
ConfigurationHints
signed char sal_Int8