28#include <osl/diagnose.h>
42 virtual void AddRun (
const std::shared_ptr<PageObjectRun>& rRun) = 0;
43 virtual void RemoveRun (
const std::shared_ptr<PageObjectRun>& rRun) = 0;
44 virtual model::SlideSorterModel& GetModel ()
const = 0;
45 virtual view::SlideSorterView& GetView ()
const = 0;
46 virtual std::shared_ptr<controller::Animator> GetAnimator () = 0;
50 ~AnimatorAccess() COVERITY_NOEXCEPT_FALSE {}
56class PageObjectRun :
public std::enable_shared_from_this<PageObjectRun>
60 AnimatorAccess& rAnimatorAccess,
61 const sal_Int32 nRunIndex,
62 const sal_Int32 nStartIndex,
63 const sal_Int32 nEndIndex);
65 void operator () (
const double nTime);
68 const InsertPosition& rInsertPosition,
69 const view::Layouter& GetLayouter);
90 public:
bool operator() (
91 const std::shared_ptr<PageObjectRun>& rpRunA,
92 const std::shared_ptr<PageObjectRun>& rpRunB)
const
94 return rpRunA->mnRunIndex < rpRunB->mnRunIndex;
102 void RestartAnimation();
104typedef std::shared_ptr<PageObjectRun> SharedPageObjectRun;
109 sal_Int32(rPointA.
X() * (1-nT) + rPointB.
X() * nT),
110 sal_Int32(rPointA.
Y() * (1-nT) + rPointB.
Y() * nT));
125 virtual void AddRun (
const std::shared_ptr<PageObjectRun>& rRun)
override;
126 virtual void RemoveRun (
const std::shared_ptr<PageObjectRun>& rRun)
override;
138 typedef ::std::set<SharedPageObjectRun, PageObjectRun::Comparator>
RunContainer;
142 SharedPageObjectRun
GetRun (
145 RunContainer::const_iterator
FindRun (
const sal_Int32 nRunIndex)
const;
168 :
mrModel(rSlideSorter.GetModel()),
169 mrView(rSlideSorter.GetView()),
184 if (maInsertPosition == rInsertPosition)
187 SharedPageObjectRun pOldRun (GetRun(
mrView.GetLayouter(), maInsertPosition));
188 SharedPageObjectRun pCurrentRun (GetRun(
mrView.GetLayouter(), rInsertPosition));
189 maInsertPosition = rInsertPosition;
193 if (pOldRun != pCurrentRun && pOldRun)
194 pOldRun->ResetOffsets(
eMode);
198 pCurrentRun->UpdateOffsets(rInsertPosition,
mrView.GetLayouter());
206 const sal_Int32 nRow (rInsertPosition.
GetRow());
208 return SharedPageObjectRun();
210 RunContainer::const_iterator iRun (maRuns.end());
215 maRuns.insert(std::make_shared<PageObjectRun>(
220 iRun = maRuns.begin();
224 iRun = FindRun(nRow);
225 if (iRun == maRuns.end())
228 const sal_Int32 nStartIndex (rLayouter.
GetIndex(nRow, 0));
230 if (nStartIndex <= nEndIndex)
232 iRun = maRuns.insert(std::make_shared<PageObjectRun>(
237 OSL_ASSERT(iRun != maRuns.end());
242 if (iRun != maRuns.end())
245 return SharedPageObjectRun();
248InsertAnimator::Implementation::RunContainer::const_iterator
254 [nRunIndex] (std::shared_ptr<PageObjectRun>
const& rRun)
255 { return rRun->mnRunIndex == nRunIndex; });
275 if (rRun->mnLocalInsertIndex == -1)
277 InsertAnimator::Implementation::RunContainer::const_iterator iRun (FindRun(rRun->mnRunIndex));
278 if (iRun != maRuns.end())
280 OSL_ASSERT(*iRun == rRun);
293PageObjectRun::PageObjectRun (
294 AnimatorAccess& rAnimatorAccess,
295 const sal_Int32 nRunIndex,
296 const sal_Int32 nStartIndex,
297 const sal_Int32 nEndIndex)
306 controller::AnimationParametricFunction(
307 controller::AnimationBezierFunction (0.1,0.7)))
313void PageObjectRun::UpdateOffsets(
318 const sal_Int32 nLocalInsertIndex(bIsVertical
319 ? rInsertPosition.
GetRow()
359 const ::tools::Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
360 pDescriptor->GetVisualState().SetLocationOffset(
Point(0,0));
361 rView.RequestRepaint(aOldBoundingBox);
362 rView.RequestRepaint(pDescriptor);
373void PageObjectRun::RestartAnimation()
383 auto sharedThis(shared_from_this());
385 [
this] (
double const val) { (*this)(val); },
386 [sharedThis] () { sharedThis->mrAnimatorAccess.RemoveRun(sharedThis); }
390void PageObjectRun::operator () (
const double nGlobalTime)
396 if (nLocalTime > 1.0)
407 const ::tools::Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
408 pDescriptor->GetVisualState().SetLocationOffset(
415 rView.RequestRepaint(aOldBoundingBox);
416 rView.RequestRepaint(pDescriptor);
sal_Int32 mnEndIndex
Index of the last page in the run.
double mnStartTime
Time at which the current animation started.
sal_Int32 mnLocalInsertIndex
The index at which to make place for the insertion indicator (-1 for no indicator).
sal_Int32 mnRunIndex
Index of the row or column that this run represents.
::std::vector< Point > maEndOffset
Target offset of each item in the run at the end of the current animation.
::std::function< double(double)> maAccelerationFunction
AnimatorAccess & mrAnimatorAccess
sal_Int32 mnStartIndex
Index of the first page in the run.
::std::vector< Point > maStartOffset
Offset of each item in the run at the start of the current animation.
controller::Animator::AnimationId mnAnimationId
SlideSorter & mrSlideSorter
constexpr tools::Long Y() const
constexpr tools::Long X() const
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
const VclPtr< sd::Window > & GetContentWindow() const
Return the content window.
static const AnimationId NotAnAnimationId
AnimationMode
In some circumstances we have to avoid animation and jump to the final animation state immediately.
The model of the slide sorter gives access to the slides that are to be displayed in the slide sorter...
Implementation(SlideSorter &rSlideSorter)
virtual VclPtr< sd::Window > GetContentWindow() override
void SetInsertPosition(const InsertPosition &rInsertPosition, const controller::Animator::AnimationMode eAnimationMode)
virtual model::SlideSorterModel & GetModel() const override
virtual void RemoveRun(const std::shared_ptr< PageObjectRun > &rRun) override
virtual void AddRun(const std::shared_ptr< PageObjectRun > &rRun) override
virtual ~Implementation()
::std::set< SharedPageObjectRun, PageObjectRun::Comparator > RunContainer
InsertPosition maInsertPosition
virtual std::shared_ptr< controller::Animator > GetAnimator() override
SharedPageObjectRun GetRun(view::Layouter const &rLayouter, const InsertPosition &rInsertPosition)
view::SlideSorterView & mrView
model::SlideSorterModel & mrModel
std::shared_ptr< controller::Animator > mpAnimator
SlideSorter & mrSlideSorter
virtual view::SlideSorterView & GetView() const override
RunContainer::const_iterator FindRun(const sal_Int32 nRunIndex) const
void Reset(const controller::Animator::AnimationMode eMode)
Restore the normal position of all page objects.
InsertAnimator(SlideSorter &rSlideSorter)
std::shared_ptr< Implementation > mpImplementation
void SetInsertPosition(const InsertPosition &rInsertPosition)
Set the position at which we have to make room for the display of an icon.
Collect all values concerning the logical and visual properties of the insertion position that is use...
sal_Int32 GetColumn() const
const Point & GetLeadingOffset() const
const Point & GetTrailingOffset() const
Calculate the size and position of page objects displayed by a slide sorter.
sal_Int32 GetIndex(const sal_Int32 nRow, const sal_Int32 nColumn) const
sal_Int32 GetColumnCount() const
Return the number of columns.
virtual std::shared_ptr< SfxDialogController > GetController() override
std::shared_ptr< T > make_shared(Args &&... args)
std::shared_ptr< PageDescriptor > SharedPageDescriptor