Line data Source code
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 : #ifndef INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSINSERTIONINDICATOROVERLAY_HXX
21 : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSINSERTIONINDICATOROVERLAY_HXX
22 :
23 : #include "model/SlsSharedPageDescriptor.hxx"
24 : #include "view/SlsILayerPainter.hxx"
25 : #include "controller/SlsTransferableData.hxx"
26 : #include "sdxfer.hxx"
27 :
28 : #include <tools/gen.hxx>
29 : #include <vcl/bitmapex.hxx>
30 : #include <boost/scoped_ptr.hpp>
31 : #include <boost/enable_shared_from_this.hpp>
32 : #include <vector>
33 :
34 : class OutputDevice;
35 :
36 : namespace sd { namespace slidesorter {
37 : class SlideSorter;
38 : } }
39 :
40 : namespace sd { namespace slidesorter { namespace controller {
41 : class Transferable;
42 : } } }
43 :
44 : namespace sd { namespace slidesorter { namespace view {
45 :
46 : class FramePainter;
47 :
48 : /** The insertion indicator is painted as a vertical or horizonal bar
49 : in the space between slides.
50 : */
51 : class InsertionIndicatorOverlay
52 : : public ILayerPainter,
53 : public ::boost::enable_shared_from_this<InsertionIndicatorOverlay>
54 : {
55 : public:
56 : InsertionIndicatorOverlay (SlideSorter& rSlideSorter);
57 : virtual ~InsertionIndicatorOverlay();
58 :
59 : virtual void SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator) SAL_OVERRIDE;
60 :
61 : void Create (const SdTransferable* pTransferable);
62 :
63 : /** Given a position in model coordinates this method calculates the
64 : insertion marker both as an index in the document and as a location
65 : used for drawing the insertion indicator.
66 : */
67 : void SetLocation (const Point& rPosition);
68 :
69 : Size GetSize() const;
70 :
71 : virtual void Paint (
72 : OutputDevice& rDevice,
73 : const Rectangle& rRepaintArea) SAL_OVERRIDE;
74 :
75 0 : bool IsVisible() const { return mbIsVisible;}
76 : void Hide();
77 : void Show();
78 :
79 : Rectangle GetBoundingBox() const;
80 :
81 : private:
82 : SlideSorter& mrSlideSorter;
83 : bool mbIsVisible;
84 : const sal_Int32 mnLayerIndex;
85 : SharedILayerInvalidator mpLayerInvalidator;
86 : // Center of the insertion indicator.
87 : Point maLocation;
88 : BitmapEx maIcon;
89 : Point maIconOffset;
90 : ::boost::scoped_ptr<FramePainter> mpShadowPainter;
91 :
92 : void SetPositionAndSize (const Rectangle& rBoundingBox);
93 : Point PaintRepresentatives (
94 : OutputDevice& rContent,
95 : const Size& rPreviewSize,
96 : const sal_Int32 nOffset,
97 : const ::std::vector<controller::TransferableData::Representative>& rPages) const;
98 : void PaintPageCount (
99 : OutputDevice& rDevice,
100 : const sal_Int32 nSelectionCount,
101 : const Size& rPreviewSize,
102 : const Point& rFirstPageOffset) const;
103 : /** Setup the insertion indicator by creating the icon. It consists of
104 : scaled down previews of some of the selected pages.
105 : */
106 : void Create (
107 : const ::std::vector<controller::TransferableData::Representative>& rPages,
108 : const sal_Int32 nSelectionCount);
109 : };
110 :
111 : } } } // end of namespace ::sd::slidesorter::view
112 :
113 : #endif
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|