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_SLSPAGEOBJECTLAYOUTER_HXX
21 : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_VIEW_SLSPAGEOBJECTLAYOUTER_HXX
22 :
23 : #include "SlideSorter.hxx"
24 : #include "model/SlsSharedPageDescriptor.hxx"
25 : #include "tools/gen.hxx"
26 : #include <vcl/image.hxx>
27 :
28 : namespace vcl { class Font; }
29 :
30 : namespace sd { namespace slidesorter { namespace view {
31 :
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.
35 : */
36 : class PageObjectLayouter
37 : {
38 : public:
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.
44 : @param nPageCount
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.
47 : */
48 : PageObjectLayouter(
49 : const Size& rPageObjectWindowSize,
50 : const Size& rPreviewModelSize,
51 : sd::Window *pWindow,
52 : const sal_Int32 nPageCount);
53 : ~PageObjectLayouter();
54 :
55 : enum Part {
56 : // The focus indicator is painted outside the actual page object.
57 : FocusIndicator,
58 : // This is the outer bounding box that includes the preview, page
59 : // number, title.
60 : PageObject,
61 : // Bounding box of the actual preview.
62 : Preview,
63 : // Bounding box of the mouse indicator indicator frame.
64 : MouseOverIndicator,
65 : // Bounding box of the page number.
66 : PageNumber,
67 : // Bounding box of the pane name.
68 : Name,
69 : // Indicator whether or not there is a slide transition associated
70 : // with this slide.
71 : TransitionEffectIndicator,
72 : // Indicator whether or not there is a custom animation associated
73 : // with this slide.
74 : CustomAnimationEffectIndicator
75 : };
76 : /** Two coordinate systems are supported. They differ only in
77 : translation not in scale. Both relate to pixel values in the window.
78 : A position in the model coordinate system does not change when the window content is
79 : scrolled up or down. In the window coordinate system (relative
80 : to the top left point of the window)scrolling leads to different values.
81 : */
82 : enum CoordinateSystem {
83 : WindowCoordinateSystem,
84 : ModelCoordinateSystem
85 : };
86 :
87 : /** Return the bounding box of the page object or one of its graphical
88 : parts.
89 : @param rWindow
90 : This device is used to translate between model and window
91 : coordinates.
92 : @param rpPageDescriptor
93 : The page for which to calculate the bounding box. This may be
94 : NULL. When it is NULL then a generic bounding box is calculated
95 : for the location (0,0).
96 : @param ePart
97 : The part of the page object for which to return the bounding
98 : box.
99 : @param eCoodinateSystem
100 : The bounding box can be returned in model and in pixel
101 : (window) coordinates.
102 : @param bIgnoreLocation
103 : Return a position ignoring the slides' location, ie. as if
104 : we were the first slide.
105 : */
106 : Rectangle GetBoundingBox (
107 : const model::SharedPageDescriptor& rpPageDescriptor,
108 : const Part ePart,
109 : const CoordinateSystem eCoordinateSystem,
110 : bool bIgnoreLocation = false);
111 :
112 : /// the size of the embedded preview: position independent
113 : Size GetPreviewSize(const CoordinateSystem eCoordinateSystem);
114 :
115 : /// the maximum size of each tile, also position independent
116 : Size GetGridMaxSize(const CoordinateSystem eCoordinateSystem);
117 :
118 0 : Image GetTransitionEffectIcon() const { return maTransitionEffectIcon;}
119 0 : Image GetCustomAnimationEffectIcon() const { return maCustomAnimationEffectIcon;}
120 :
121 : private:
122 : Rectangle GetBoundingBox (
123 : const Point& rPageObjectLocation,
124 : const Part ePart,
125 : const CoordinateSystem eCoordinateSystem);
126 :
127 : private:
128 : VclPtr<sd::Window> mpWindow;
129 : Size maPageObjectSize;
130 : Rectangle maFocusIndicatorBoundingBox;
131 : Rectangle maPageObjectBoundingBox;
132 : Rectangle maPageNumberAreaBoundingBox;
133 : Rectangle maPreviewBoundingBox;
134 : Rectangle maTransitionEffectBoundingBox;
135 : Rectangle maCustomAnimationEffectBoundingBox;
136 : const Image maTransitionEffectIcon;
137 : const Image maCustomAnimationEffectIcon;
138 : const boost::shared_ptr<vcl::Font> mpPageNumberFont;
139 :
140 : Size GetPageNumberAreaSize (const int nPageCount);
141 : Rectangle CalculatePreviewBoundingBox (
142 : Size& rPageObjectSize,
143 : const Size& rPreviewModelSize,
144 : const sal_Int32 nPageNumberAreaWidth,
145 : const sal_Int32 nFocusIndicatorWidth);
146 : };
147 :
148 : } } } // end of namespace ::sd::slidesorter::view
149 :
150 : #endif
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|