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 SDEXT_PRESENTER_PRESENTER_PAINT_MANAGER_HXX
25 #define SDEXT_PRESENTER_PRESENTER_PAINT_MANAGER_HXX
26 
27 #include <com/sun/star/awt/XWindow.hpp>
28 #include <com/sun/star/awt/XWindowPeer.hpp>
29 #include <com/sun/star/drawing/XPresenterHelper.hpp>
30 #include <rtl/ref.hxx>
31 #include <boost/function.hpp>
32 
33 namespace css = ::com::sun::star;
34 
35 namespace sdext { namespace presenter {
36 
37 class PresenterPaneContainer;
38 
39 /** Synchronize painting of windows and canvases.  At the moment there is
40     just some processing of invalidate calls.
41     This could be extended to process incoming windowPaint() calls.
42 */
43 class PresenterPaintManager
44 {
45 public:
46     /** Create paint manager with the window that is the top node in the
47         local window hierarchy.
48     */
49     PresenterPaintManager (
50         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
51         const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
52         const rtl::Reference<PresenterPaneContainer>& rpPaneContainer);
53 
54     ::boost::function<void(const css::awt::Rectangle& rRepaintBox)>
55         GetInvalidator (
56             const css::uno::Reference<css::awt::XWindow>& rxWindow,
57             const bool bSynchronous = false);
58 
59     /** Request a repaint of the whole window.
60         @param rxWindow
61             May be the parent window or one of its descendents.
62     */
63     void Invalidate (
64         const css::uno::Reference<css::awt::XWindow>& rxWindow,
65         const bool bSynchronous = false);
66     void Invalidate (
67         const css::uno::Reference<css::awt::XWindow>& rxWindow,
68         const sal_Int16 nInvalidateFlags);
69 
70     /** Request a repaint of a part of a window.
71         @param rxWindow
72             May be the parent window or one of its descendents.
73     */
74     void Invalidate (
75         const css::uno::Reference<css::awt::XWindow>& rxWindow,
76         const css::awt::Rectangle& rRepaintBox,
77         const bool bSynchronous = false);
78     void Invalidate (
79         const css::uno::Reference<css::awt::XWindow>& rxWindow,
80         const css::awt::Rectangle& rRepaintBox,
81         const sal_Int16 nInvalidateFlags);
82 
83 private:
84     css::uno::Reference<css::awt::XWindow> mxParentWindow;
85     css::uno::Reference<css::awt::XWindowPeer> mxParentWindowPeer;
86     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
87     ::rtl::Reference<PresenterPaneContainer> mpPaneContainer;
88 };
89 
90 } }
91 
92 #endif
93