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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSPAGEOBJECTLAYOUTER_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSPAGEOBJECTLAYOUTER_HXX
23 #include <model/SlsSharedPageDescriptor.hxx>
24 #include <tools/gen.hxx>
25 #include <vcl/image.hxx>
27 namespace vcl
{ class Font
; }
28 namespace sd
{ class Window
; }
30 namespace sd
{ namespace slidesorter
{ namespace view
{
32 /** In contrast to the Layouter that places page objects in the view, the
33 PageObjectLayouter places the parts of individual page objects like page
34 number area, borders, preview.
36 class PageObjectLayouter
39 /** Create a new PageObjectLayouter object.
40 @param rPageObjectSize
41 In general either the width or the height will be 0 in order to
42 signal that this size component has to be calculated from the other.
43 This calculation will make the preview as large as possible.
45 The page count is used to determine how wide the page number
46 area has to be, how many digits to except for the largest page number.
49 const Size
& rPageObjectWindowSize
,
50 const Size
& rPreviewModelSize
,
52 const sal_Int32 nPageCount
);
53 ~PageObjectLayouter();
56 // The focus indicator is painted outside the actual page object.
58 // This is the outer bounding box that includes the preview, page
61 // Bounding box of the actual preview.
63 // Bounding box of the page number.
65 // Indicator whether or not there is a slide transition associated
67 TransitionEffectIndicator
,
68 // Indicator whether or not there is a custom animation associated
70 CustomAnimationEffectIndicator
72 /** Two coordinate systems are supported. They differ only in
73 translation not in scale. Both relate to pixel values in the window.
74 A position in the model coordinate system does not change when the window content is
75 scrolled up or down. In the window coordinate system (relative
76 to the top left point of the window)scrolling leads to different values.
78 enum CoordinateSystem
{
79 WindowCoordinateSystem
,
83 /** Return the bounding box of the page object or one of its graphical
86 This device is used to translate between model and window
88 @param rpPageDescriptor
89 The page for which to calculate the bounding box. This may be
90 NULL. When it is NULL then a generic bounding box is calculated
91 for the location (0,0).
93 The part of the page object for which to return the bounding
95 @param eCoodinateSystem
96 The bounding box can be returned in model and in pixel
98 @param bIgnoreLocation
99 Return a position ignoring the slides' location, ie. as if
100 we were the first slide.
102 ::tools::Rectangle
GetBoundingBox (
103 const model::SharedPageDescriptor
& rpPageDescriptor
,
105 const CoordinateSystem eCoordinateSystem
,
106 bool bIgnoreLocation
= false);
108 /// the size of the embedded preview: position independent, in window coordinate system
109 Size
GetPreviewSize();
111 /// the maximum size of each tile, also position independent, in window coordinate system
112 Size
GetGridMaxSize();
114 const Image
& GetTransitionEffectIcon() const { return maTransitionEffectIcon
;}
115 const Image
& GetCustomAnimationEffectIcon() const { return maCustomAnimationEffectIcon
;}
118 ::tools::Rectangle
GetBoundingBox (
119 const Point
& rPageObjectLocation
,
121 const CoordinateSystem eCoordinateSystem
);
124 VclPtr
<sd::Window
> mpWindow
;
125 ::tools::Rectangle maFocusIndicatorBoundingBox
;
126 ::tools::Rectangle maPageObjectBoundingBox
;
127 ::tools::Rectangle maPageNumberAreaBoundingBox
;
128 ::tools::Rectangle maPreviewBoundingBox
;
129 ::tools::Rectangle maTransitionEffectBoundingBox
;
130 ::tools::Rectangle maCustomAnimationEffectBoundingBox
;
131 const Image maTransitionEffectIcon
;
132 const Image maCustomAnimationEffectIcon
;
133 const std::shared_ptr
<vcl::Font
> mpPageNumberFont
;
135 Size
GetPageNumberAreaSize (const int nPageCount
);
136 ::tools::Rectangle
CalculatePreviewBoundingBox (
137 Size
& rPageObjectSize
,
138 const Size
& rPreviewModelSize
,
139 const sal_Int32 nPageNumberAreaWidth
,
140 const sal_Int32 nFocusIndicatorWidth
);
143 } } } // end of namespace ::sd::slidesorter::view
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */