tdf#85428: Clip strokes
[LibreOffice.git] / sd / source / ui / slidesorter / inc / controller / SlsVisibleAreaManager.hxx
blobd9f5845af6bd94c2d0072539d2ea874682d4e263
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 #pragma once
22 #include <model/SlsSharedPageDescriptor.hxx>
23 #include <optional>
24 #include <tools/gen.hxx>
25 #include <vector>
27 namespace sd::slidesorter
29 class SlideSorter;
32 namespace sd::slidesorter::controller
34 /** Manage requests for scrolling page objects into view.
36 class VisibleAreaManager
38 public:
39 explicit VisibleAreaManager(SlideSorter& rSlideSorter);
40 ~VisibleAreaManager();
41 VisibleAreaManager(const VisibleAreaManager&) = delete;
42 VisibleAreaManager& operator=(const VisibleAreaManager&) = delete;
44 void ActivateCurrentSlideTracking();
45 void DeactivateCurrentSlideTracking();
46 bool IsCurrentSlideTrackingActive() const { return mbIsCurrentSlideTrackingActive; }
48 /** Request the current slide to be moved into the visible area.
49 This request is only obeyed when the current slide tracking is
50 active.
51 @see ActivateCurrentSlideTracking() and DeactivateCurrentSlideTracking()
53 void RequestCurrentSlideVisible();
55 /** Request to make the specified page object visible.
57 void RequestVisible(const model::SharedPageDescriptor& rpDescriptor, const bool bForce = false);
59 /** Temporarily disable the update of the visible area.
61 class TemporaryDisabler
63 public:
64 explicit TemporaryDisabler(SlideSorter const& rSlideSorter);
65 ~TemporaryDisabler();
67 private:
68 VisibleAreaManager& mrVisibleAreaManager;
71 private:
72 SlideSorter& mrSlideSorter;
74 /** List of rectangle that someone wants to be moved into the visible
75 area.
76 Cleared on every call to ForgetVisibleRequests() and MakeVisible().
78 ::std::vector<::tools::Rectangle> maVisibleRequests;
80 Point maRequestedVisibleTopLeft;
81 bool mbIsCurrentSlideTrackingActive;
82 int mnDisableCount;
84 void MakeVisible();
85 ::std::optional<Point> GetRequestedTopLeft() const;
88 } // end of namespace ::sd::slidesorter::view
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */