Update git submodules
[LibreOffice.git] / sd / source / ui / slidesorter / inc / view / SlsPageObjectLayouter.hxx
blob8bb77a988fef4a3972b66325d8295a35689cac93
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 <tools/gen.hxx>
24 #include <vcl/image.hxx>
26 namespace vcl { class Font; }
27 namespace sd { class Window; }
29 namespace sd::slidesorter::view {
31 /** In contrast to the Layouter that places page objects in the view, the
32 PageObjectLayouter places the parts of individual page objects like page
33 number area, borders, preview.
35 class PageObjectLayouter
37 public:
38 /** Create a new PageObjectLayouter object.
39 @param rPageObjectSize
40 In general either the width or the height will be 0 in order to
41 signal that this size component has to be calculated from the other.
42 This calculation will make the preview as large as possible.
43 @param nPageCount
44 The page count is used to determine how wide the page number
45 area has to be, how many digits to except for the largest page number.
47 PageObjectLayouter(
48 const Size& rPageObjectWindowSize,
49 const Size& rPreviewModelSize,
50 sd::Window *pWindow,
51 const sal_Int32 nPageCount);
52 ~PageObjectLayouter();
54 enum class Part {
55 // The focus indicator is painted outside the actual page object.
56 FocusIndicator,
57 // This is the outer bounding box that includes the preview, page
58 // number, title.
59 PageObject,
60 // Bounding box of the actual preview.
61 Preview,
62 // Bounding box of the page number.
63 PageNumber,
64 // Indicator whether or not there is a slide transition associated
65 // with this slide.
66 TransitionEffectIndicator,
67 // Indicator whether or not there is a custom animation associated
68 // with this slide.
69 CustomAnimationEffectIndicator
71 /** Two coordinate systems are supported. They differ only in
72 translation not in scale. Both relate to pixel values in the window.
73 A position in the model coordinate system does not change when the window content is
74 scrolled up or down. In the window coordinate system (relative
75 to the top left point of the window)scrolling leads to different values.
77 enum CoordinateSystem {
78 WindowCoordinateSystem,
79 ModelCoordinateSystem
82 /** Return the bounding box of the page object or one of its graphical
83 parts.
84 @param rWindow
85 This device is used to translate between model and window
86 coordinates.
87 @param rpPageDescriptor
88 The page for which to calculate the bounding box. This may be
89 NULL. When it is NULL then a generic bounding box is calculated
90 for the location (0,0).
91 @param ePart
92 The part of the page object for which to return the bounding
93 box.
94 @param eCoordinateSystem
95 The bounding box can be returned in model and in pixel
96 (window) coordinates.
97 @param bIgnoreLocation
98 Return a position ignoring the slides' location, ie. as if
99 we were the first slide.
101 ::tools::Rectangle GetBoundingBox (
102 const model::SharedPageDescriptor& rpPageDescriptor,
103 const Part ePart,
104 const CoordinateSystem eCoordinateSystem,
105 bool bIgnoreLocation = false);
107 /// the size of the embedded preview: position independent, in window coordinate system
108 Size GetPreviewSize();
110 /// the maximum size of each tile, also position independent, in window coordinate system
111 Size GetGridMaxSize();
113 const Image& GetTransitionEffectIcon() const { return maTransitionEffectIcon;}
114 const Image& GetCustomAnimationEffectIcon() const { return maCustomAnimationEffectIcon;}
116 private:
117 ::tools::Rectangle GetBoundingBox (
118 const Point& rPageObjectLocation,
119 const Part ePart,
120 const CoordinateSystem eCoordinateSystem);
122 private:
123 VclPtr<sd::Window> mpWindow;
124 ::tools::Rectangle maFocusIndicatorBoundingBox;
125 ::tools::Rectangle maPageObjectBoundingBox;
126 ::tools::Rectangle maPageNumberAreaBoundingBox;
127 ::tools::Rectangle maPreviewBoundingBox;
128 ::tools::Rectangle maTransitionEffectBoundingBox;
129 ::tools::Rectangle maCustomAnimationEffectBoundingBox;
130 const Image maTransitionEffectIcon;
131 const Image maCustomAnimationEffectIcon;
132 const std::shared_ptr<vcl::Font> mpPageNumberFont;
134 Size GetPageNumberAreaSize (const int nPageCount);
135 ::tools::Rectangle CalculatePreviewBoundingBox (
136 Size& rPageObjectSize,
137 const Size& rPreviewModelSize,
138 const sal_Int32 nPageNumberAreaWidth,
139 const sal_Int32 nFocusIndicatorWidth);
142 } // end of namespace ::sd::slidesorter::view
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */