Updated core
[LibreOffice.git] / sdext / source / presenter / PresenterPaneBase.hxx
blob170a743c299c58b5d6987eff006949d064724288
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SD_PRESENTER_PRESENTER_PANE_BASE_HXX
21 #define SD_PRESENTER_PRESENTER_PANE_BASE_HXX
23 #include "PresenterTheme.hxx"
24 #include <cppuhelper/basemutex.hxx>
25 #include <cppuhelper/compbase4.hxx>
26 #include <com/sun/star/awt/Point.hpp>
27 #include <com/sun/star/awt/XMouseListener.hpp>
28 #include <com/sun/star/awt/XMouseMotionListener.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/container/XChild.hpp>
31 #include <com/sun/star/drawing/XPresenterHelper.hpp>
32 #include <com/sun/star/drawing/framework/XPane.hpp>
33 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/util/Color.hpp>
37 #include <com/sun/star/rendering/XCanvas.hpp>
38 #include <rtl/ref.hxx>
39 #include <boost/noncopyable.hpp>
41 namespace cssu = ::com::sun::star::uno;
43 namespace sdext { namespace presenter {
45 class PresenterController;
47 namespace {
48 typedef ::cppu::WeakComponentImplHelper4 <
49 css::drawing::framework::XPane,
50 css::lang::XInitialization,
51 css::awt::XWindowListener,
52 css::awt::XPaintListener
53 > PresenterPaneBaseInterfaceBase;
56 /** Base class of the panes used by the presenter screen. Pane objects are
57 stored in the PresenterPaneContainer. Sizes and positions are
58 controlled by the PresenterWindowManager. Interactive positioning and
59 resizing is managed by the PresenterPaneBorderManager. Borders around
60 panes are painted by the PresenterPaneBorderPainter.
62 class PresenterPaneBase
63 : protected ::cppu::BaseMutex,
64 private ::boost::noncopyable,
65 public PresenterPaneBaseInterfaceBase
67 public:
68 PresenterPaneBase (
69 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
70 const ::rtl::Reference<PresenterController>& rpPresenterController);
71 virtual ~PresenterPaneBase (void);
73 virtual void SAL_CALL disposing (void);
75 css::uno::Reference<css::awt::XWindow> GetBorderWindow (void) const;
76 void SetBackground (const SharedBitmapDescriptor& rpBackground);
77 void SetTitle (const OUString& rsTitle);
78 OUString GetTitle (void) const;
79 css::uno::Reference<css::drawing::framework::XPaneBorderPainter> GetPaneBorderPainter (void) const;
80 void SetCalloutAnchor (const css::awt::Point& rAnchorPosition);
81 css::awt::Point GetCalloutAnchor (void) const;
83 // XInitialization
85 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
86 throw (css::uno::Exception, css::uno::RuntimeException);
88 // XResourceId
90 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
91 throw (css::uno::RuntimeException);
93 virtual sal_Bool SAL_CALL isAnchorOnly (void)
94 throw (com::sun::star::uno::RuntimeException);
96 // XWindowListener
98 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
99 throw (css::uno::RuntimeException);
101 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
102 throw (css::uno::RuntimeException);
104 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
105 throw (css::uno::RuntimeException);
107 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
108 throw (css::uno::RuntimeException);
110 // lang::XEventListener
112 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
113 throw (css::uno::RuntimeException);
115 protected:
116 ::rtl::Reference<PresenterController> mpPresenterController;
117 css::uno::Reference<css::awt::XWindow> mxParentWindow;
118 css::uno::Reference<css::awt::XWindow> mxBorderWindow;
119 css::uno::Reference<css::rendering::XCanvas> mxBorderCanvas;
120 css::uno::Reference<css::awt::XWindow> mxContentWindow;
121 css::uno::Reference<css::rendering::XCanvas> mxContentCanvas;
122 css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
123 css::uno::Reference<css::drawing::framework::XPaneBorderPainter> mxBorderPainter;
124 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
125 OUString msTitle;
126 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
127 SharedBitmapDescriptor mpViewBackground;
128 bool mbHasCallout;
129 css::awt::Point maCalloutAnchor;
131 virtual void CreateCanvases (
132 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
133 const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas) = 0;
135 void CreateWindows (
136 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
137 const bool bIsWindowVisibleOnCreation);
138 void PaintBorderBackground (
139 const css::awt::Rectangle& rCenterBox,
140 const css::awt::Rectangle& rUpdateBox);
141 void PaintBorder (const css::awt::Rectangle& rUpdateRectangle);
142 void ToTop (void);
143 void LayoutContextWindow (void);
144 bool IsVisible (void) const;
146 /** This method throws a DisposedException when the object has already been
147 disposed.
149 void ThrowIfDisposed (void)
150 throw (css::lang::DisposedException);
153 } } // end of namespace ::sd::presenter
155 #endif
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */