1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c45d927aSAndrew Rist  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19c45d927aSAndrew Rist  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER
25cdf0e10cSrcweir #define SD_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "SlideSorter.hxx"
28cdf0e10cSrcweir #include "model/SlsPageDescriptor.hxx"
29cdf0e10cSrcweir #include "view/SlsLayouter.hxx"
30cdf0e10cSrcweir #include "view/SlsTheme.hxx"
31cdf0e10cSrcweir #include <boost/scoped_ptr.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace sd { namespace slidesorter { namespace cache {
34cdf0e10cSrcweir class PageCache;
35cdf0e10cSrcweir } } }
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace sd { namespace slidesorter { namespace view {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class ButtonBar;
40cdf0e10cSrcweir class Layouter;
41cdf0e10cSrcweir class PageObjectLayouter;
42cdf0e10cSrcweir class FramePainter;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class PageObjectPainter
45cdf0e10cSrcweir {
46cdf0e10cSrcweir public:
47cdf0e10cSrcweir     PageObjectPainter (const SlideSorter& rSlideSorter);
48cdf0e10cSrcweir     ~PageObjectPainter (void);
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     void PaintPageObject (
51cdf0e10cSrcweir         OutputDevice& rDevice,
52cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     void NotifyResize (const bool bForce = false);
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     /** Called when the theme changes, either because it is replaced with
57cdf0e10cSrcweir         another or because the system colors have changed.  So, even when
58cdf0e10cSrcweir         the given theme is the same object as the one already in use by this
59cdf0e10cSrcweir         painter everything that depends on the theme is updated.
60cdf0e10cSrcweir     */
61cdf0e10cSrcweir     void SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     /** Return a preview bitmap for the given page descriptor.  When the
64cdf0e10cSrcweir         page is excluded from the show then the preview is marked
65cdf0e10cSrcweir         accordingly.
66cdf0e10cSrcweir         @rpDescriptor
67cdf0e10cSrcweir             Defines the page for which to return the preview.
68cdf0e10cSrcweir         @pReferenceDevice
69cdf0e10cSrcweir             When not <NULL/> then this reference device is used to created a
70cdf0e10cSrcweir             compatible bitmap.
71cdf0e10cSrcweir         @return
72cdf0e10cSrcweir             The returned bitmap may have a different size then the preview area.
73cdf0e10cSrcweir     */
74cdf0e10cSrcweir     Bitmap GetPreviewBitmap (
75cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor,
76cdf0e10cSrcweir         const OutputDevice* pReferenceDevice) const;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir     const Layouter& mrLayouter;
80cdf0e10cSrcweir     ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
81cdf0e10cSrcweir     ::boost::shared_ptr<cache::PageCache> mpCache;
82cdf0e10cSrcweir     ::boost::shared_ptr<controller::Properties> mpProperties;
83cdf0e10cSrcweir     ::boost::shared_ptr<view::Theme> mpTheme;
84cdf0e10cSrcweir     ::boost::shared_ptr<Font> mpPageNumberFont;
85cdf0e10cSrcweir     ::boost::scoped_ptr<FramePainter> mpShadowPainter;
86cdf0e10cSrcweir     ::boost::scoped_ptr<FramePainter> mpFocusBorderPainter;
87cdf0e10cSrcweir     Bitmap maNormalBackground;
88cdf0e10cSrcweir     Bitmap maSelectionBackground;
89cdf0e10cSrcweir     Bitmap maFocusedSelectionBackground;
90cdf0e10cSrcweir     Bitmap maFocusedBackground;
91cdf0e10cSrcweir     Bitmap maMouseOverBackground;
92cdf0e10cSrcweir     Bitmap maMouseOverFocusedBackground;
93cdf0e10cSrcweir     Bitmap maMouseOverSelectedAndFocusedBackground;
94cdf0e10cSrcweir     ::rtl::OUString msUnhideString;
95cdf0e10cSrcweir     ButtonBar& mrButtonBar;
966194c063SMichael Stahl     Size maSize;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     void PaintBackground (
99cdf0e10cSrcweir         OutputDevice& rDevice,
100cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor);
101cdf0e10cSrcweir     void PaintPreview (
102cdf0e10cSrcweir         OutputDevice& rDevice,
103cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor) const;
104cdf0e10cSrcweir     void PaintPageNumber (
105cdf0e10cSrcweir         OutputDevice& rDevice,
106cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor) const;
107cdf0e10cSrcweir     void PaintTransitionEffect (
108cdf0e10cSrcweir         OutputDevice& rDevice,
109cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor) const;
110cdf0e10cSrcweir     void PaintBorder (
111cdf0e10cSrcweir         OutputDevice& rDevice,
112cdf0e10cSrcweir         const Theme::GradientColorType eColorType,
113cdf0e10cSrcweir         const Rectangle& rBox) const;
114cdf0e10cSrcweir     Bitmap& GetBackgroundForState (
115cdf0e10cSrcweir         const model::SharedPageDescriptor& rpDescriptor,
116cdf0e10cSrcweir         const OutputDevice& rTemplateDevice);
117cdf0e10cSrcweir     Bitmap& GetBackground(
118cdf0e10cSrcweir         Bitmap& rBackground,
119cdf0e10cSrcweir         Theme::GradientColorType eType,
120cdf0e10cSrcweir         const OutputDevice& rTemplateDevice,
121cdf0e10cSrcweir         const bool bHasFocusBorder);
122cdf0e10cSrcweir     Bitmap CreateBackgroundBitmap(
123cdf0e10cSrcweir         const OutputDevice& rReferenceDevice,
124cdf0e10cSrcweir         const Theme::GradientColorType eType,
125cdf0e10cSrcweir         const bool bHasFocusBorder) const;
126cdf0e10cSrcweir     Bitmap CreateMarkedPreview(
127cdf0e10cSrcweir         const Size& rSize,
128cdf0e10cSrcweir         const Bitmap& rPreview,
129cdf0e10cSrcweir         const BitmapEx& rOverlay,
130cdf0e10cSrcweir         const OutputDevice* pReferenceDevice) const;
1316194c063SMichael Stahl     void InvalidateBitmaps (void);
132*053b1516SAndre Fischer 
133*053b1516SAndre Fischer     /** Update the local pointer to the page object layouter to the
134*053b1516SAndre Fischer         one owned by the general layouter.
135*053b1516SAndre Fischer         Return <TRUE/> when after the call we have a valid page object layouter.
136*053b1516SAndre Fischer     */
137*053b1516SAndre Fischer     bool UpdatePageObjectLayouter (void);
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir } } } // end of namespace sd::slidesorter::view
141cdf0e10cSrcweir 
142cdf0e10cSrcweir #endif
143