1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SD_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX 25 #define SD_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX 26 27 #include "SlideSorter.hxx" 28 #include "model/SlsSharedPageDescriptor.hxx" 29 #include "tools/gen.hxx" 30 #include <vcl/image.hxx> 31 32 namespace sd { namespace slidesorter { namespace view { 33 34 35 /** In contrast to the Layouter that places page objects in the view, the 36 PageObjectLayouter places the parts of individual page objects like page 37 number area, borders, preview. 38 */ 39 class PageObjectLayouter 40 { 41 public: 42 /** Create a new PageObjectLayouter object. 43 @param rPageObjectSize 44 In general either the width or the height will be 0 in order to 45 signal that this size component has to be calculated from the other. 46 This calculation will make the preview as large as possible. 47 @param nPageCount 48 The page count is used to determine how wide the page number 49 area has to be, how many digits to except for the largest page number. 50 */ 51 PageObjectLayouter( 52 const ::boost::shared_ptr<Theme>& rpTheme, 53 const Size& rPageObjectWindowSize, 54 const Size& rPreviewModelSize, 55 const SharedSdWindow& rpWindow, 56 const sal_Int32 nPageCount); 57 ~PageObjectLayouter(void); 58 59 enum Part { 60 // The focus indicator is painted outside the actual page object. 61 FocusIndicator, 62 // This is the outer bounding box that includes the preview, page 63 // number, title. 64 PageObject, 65 // Bounding box of the actual preview. 66 Preview, 67 // Bounding box of the mouse indicator indicator frame. 68 MouseOverIndicator, 69 // Bounding box of the page number. 70 PageNumber, 71 // Bounding box of the pane name. 72 Name, 73 // Indicator whether or not there is a slide transition associated 74 // with this slide. 75 TransitionEffectIndicator 76 }; 77 /** Two coordinate systems are supported. They differ only in 78 translation not in scale. Both relate to pixel values in the window. 79 A position in the model coordinate system does not change when the window content is 80 scrolled up or down. In the window coordinate system (relative 81 to the top left point of the window)scrolling leads to different values. 82 */ 83 enum CoordinateSystem { 84 WindowCoordinateSystem, 85 ModelCoordinateSystem 86 }; 87 88 /** Return the bounding box of the page object or one of its graphical 89 parts. 90 @param rWindow 91 This device is used to translate between model and window 92 coordinates. 93 @param rpPageDescriptor 94 The page for which to calculate the bounding box. This may be 95 NULL. When it is NULL then a generic bounding box is calculated 96 for the location (0,0). 97 @param ePart 98 The part of the page object for which to return the bounding 99 box. 100 @param eCoodinateSystem 101 The bounding box can be returned in model and in pixel 102 (window) coordinates. 103 */ 104 Rectangle GetBoundingBox ( 105 const model::SharedPageDescriptor& rpPageDescriptor, 106 const Part ePart, 107 const CoordinateSystem eCoordinateSystem); 108 Rectangle GetBoundingBox ( 109 const Point& rPageObjectLocation, 110 const Part ePart, 111 const CoordinateSystem eCoordinateSystem); 112 Size GetSize ( 113 const Part ePart, 114 const CoordinateSystem eCoordinateSystem); 115 116 Image GetTransitionEffectIcon (void) const; 117 118 private: 119 SharedSdWindow mpWindow; 120 Size maPageObjectSize; 121 double mnModelToWindowScale; 122 Rectangle maFocusIndicatorBoundingBox; 123 Rectangle maPageObjectBoundingBox; 124 Rectangle maPageNumberAreaBoundingBox; 125 Rectangle maPreviewBoundingBox; 126 Rectangle maTransitionEffectBoundingBox; 127 const Image maTransitionEffectIcon; 128 const ::boost::shared_ptr<Font> mpPageNumberFont; 129 130 Size GetPageNumberAreaSize (const int nPageCount); 131 Rectangle CalculatePreviewBoundingBox ( 132 Size& rPageObjectSize, 133 const Size& rPreviewModelSize, 134 const sal_Int32 nPageNumberAreaWidth, 135 const sal_Int32 nFocusIndicatorWidth); 136 }; 137 138 139 } } } // end of namespace ::sd::slidesorter::view 140 141 #endif 142