1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <view/SlsILayerPainter.hxx>
23 #include <controller/SlsTransferableData.hxx>
25 #include <tools/gen.hxx>
26 #include <vcl/bitmapex.hxx>
33 namespace sd::slidesorter
{ class SlideSorter
; }
35 namespace sd::slidesorter::view
{
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
>
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
);
63 OutputDevice
& rDevice
,
64 const ::tools::Rectangle
& rRepaintArea
) override
;
66 bool IsVisible() const { return mbIsVisible
;}
70 ::tools::Rectangle
GetBoundingBox() const;
73 SlideSorter
& mrSlideSorter
;
75 SharedILayerInvalidator mpLayerInvalidator
;
76 // Center of the insertion indicator.
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;
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.
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: */