1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SDEXT_PRESENTER_PRESENTER_PAINT_MANAGER_HXX
29 #define SDEXT_PRESENTER_PRESENTER_PAINT_MANAGER_HXX
30 
31 #include <com/sun/star/awt/XWindow.hpp>
32 #include <com/sun/star/awt/XWindowPeer.hpp>
33 #include <com/sun/star/drawing/XPresenterHelper.hpp>
34 #include <rtl/ref.hxx>
35 #include <boost/function.hpp>
36 
37 namespace css = ::com::sun::star;
38 
39 namespace sdext { namespace presenter {
40 
41 class PresenterPaneContainer;
42 
43 /** Synchronize painting of windows and canvases.  At the moment there is
44     just some processing of invalidate calls.
45     This could be extended to process incoming windowPaint() calls.
46 */
47 class PresenterPaintManager
48 {
49 public:
50     /** Create paint manager with the window that is the top node in the
51         local window hierarchy.
52     */
53     PresenterPaintManager (
54         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
55         const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
56         const rtl::Reference<PresenterPaneContainer>& rpPaneContainer);
57 
58     ::boost::function<void(const css::awt::Rectangle& rRepaintBox)>
59         GetInvalidator (
60             const css::uno::Reference<css::awt::XWindow>& rxWindow,
61             const bool bSynchronous = false);
62 
63     /** Request a repaint of the whole window.
64         @param rxWindow
65             May be the parent window or one of its descendents.
66     */
67     void Invalidate (
68         const css::uno::Reference<css::awt::XWindow>& rxWindow,
69         const bool bSynchronous = false);
70     void Invalidate (
71         const css::uno::Reference<css::awt::XWindow>& rxWindow,
72         const sal_Int16 nInvalidateFlags);
73 
74     /** Request a repaint of a part of a window.
75         @param rxWindow
76             May be the parent window or one of its descendents.
77     */
78     void Invalidate (
79         const css::uno::Reference<css::awt::XWindow>& rxWindow,
80         const css::awt::Rectangle& rRepaintBox,
81         const bool bSynchronous = false);
82     void Invalidate (
83         const css::uno::Reference<css::awt::XWindow>& rxWindow,
84         const css::awt::Rectangle& rRepaintBox,
85         const sal_Int16 nInvalidateFlags);
86 
87 private:
88     css::uno::Reference<css::awt::XWindow> mxParentWindow;
89     css::uno::Reference<css::awt::XWindowPeer> mxParentWindowPeer;
90     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
91     ::rtl::Reference<PresenterPaneContainer> mpPaneContainer;
92 };
93 
94 } }
95 
96 #endif
97