Update git submodules
[LibreOffice.git] / sd / source / ui / slidesorter / inc / view / SlsInsertionIndicatorOverlay.hxx
blob3f4cc221862aebec04c83cc1097dd865bb8216fa
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 <view/SlsILayerPainter.hxx>
23 #include <controller/SlsTransferableData.hxx>
25 #include <tools/gen.hxx>
26 #include <vcl/bitmapex.hxx>
27 #include <memory>
28 #include <vector>
30 class OutputDevice;
31 class SdTransferable;
33 namespace sd::slidesorter { class SlideSorter; }
35 namespace sd::slidesorter::view {
37 class FramePainter;
39 /** The insertion indicator is painted as a vertical or horizontal bar
40 in the space between slides.
42 class InsertionIndicatorOverlay final
43 : public ILayerPainter,
44 public std::enable_shared_from_this<InsertionIndicatorOverlay>
46 public:
47 InsertionIndicatorOverlay (SlideSorter& rSlideSorter);
48 virtual ~InsertionIndicatorOverlay() override;
50 virtual void SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator) override;
52 void Create (const SdTransferable* pTransferable);
54 /** Given a position in model coordinates this method calculates the
55 insertion marker both as an index in the document and as a location
56 used for drawing the insertion indicator.
58 void SetLocation (const Point& rPosition);
60 Size GetSize() const;
62 virtual void Paint (
63 OutputDevice& rDevice,
64 const ::tools::Rectangle& rRepaintArea) override;
66 bool IsVisible() const { return mbIsVisible;}
67 void Hide();
68 void Show();
70 ::tools::Rectangle GetBoundingBox() const;
72 private:
73 SlideSorter& mrSlideSorter;
74 bool mbIsVisible;
75 SharedILayerInvalidator mpLayerInvalidator;
76 // Center of the insertion indicator.
77 Point maLocation;
78 BitmapEx maIcon;
79 std::unique_ptr<FramePainter> mpShadowPainter;
81 Point PaintRepresentatives (
82 OutputDevice& rContent,
83 const Size& rPreviewSize,
84 const sal_Int32 nOffset,
85 const ::std::vector<controller::TransferableData::Representative>& rPages) const;
86 void PaintPageCount (
87 OutputDevice& rDevice,
88 const sal_Int32 nSelectionCount,
89 const Size& rPreviewSize,
90 const Point& rFirstPageOffset) const;
91 /** Setup the insertion indicator by creating the icon. It consists of
92 scaled down previews of some of the selected pages.
94 void Create (
95 const ::std::vector<controller::TransferableData::Representative>& rPages,
96 const sal_Int32 nSelectionCount);
99 } // end of namespace ::sd::slidesorter::view
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */