update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterPaneBorderManager.hxx
blobbce952a6497ec7c384df3e9e2e635040965f4598
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterPaneBorderManager.hxx,v $
11 * $Revision: 1.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX
33 #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX
35 // The body of this file is only used when PresenterWindowManager defines
36 // the preprocessor symbol ENABLE_PANE_RESIZING, which by default is not the
37 // case.
38 #ifdef ENABLE_PANE_RESIZING
40 #include <cppuhelper/basemutex.hxx>
41 #include <cppuhelper/compbase3.hxx>
42 #include <com/sun/star/awt/Point.hpp>
43 #include <com/sun/star/awt/Size.hpp>
44 #include <com/sun/star/awt/XGraphics.hpp>
45 #include <com/sun/star/awt/XMouseListener.hpp>
46 #include <com/sun/star/awt/XMouseMotionListener.hpp>
47 #include <com/sun/star/awt/XPointer.hpp>
48 #include <com/sun/star/awt/XWindowListener.hpp>
49 #include <com/sun/star/container/XChild.hpp>
50 #include <com/sun/star/drawing/XPresenterHelper.hpp>
51 #include <com/sun/star/drawing/framework/XPane.hpp>
52 #include <com/sun/star/lang/XInitialization.hpp>
53 #include <com/sun/star/uno/XComponentContext.hpp>
54 #include <com/sun/star/rendering/XCanvas.hpp>
55 #include <rtl/ref.hxx>
56 #include <tools/svborder.hxx>
57 #include <boost/noncopyable.hpp>
58 #include <boost/shared_ptr.hpp>
60 namespace css = ::com::sun::star;
63 namespace sdext { namespace presenter {
65 class PresenterController;
67 namespace {
68 typedef ::cppu::WeakComponentImplHelper3 <
69 css::lang::XInitialization,
70 css::awt::XMouseListener,
71 css::awt::XMouseMotionListener
72 > PresenterPaneBorderManagerInterfaceBase;
76 /** Manage the interactive moving and resizing of panes.
78 class PresenterPaneBorderManager
79 : private ::boost::noncopyable,
80 protected ::cppu::BaseMutex,
81 public PresenterPaneBorderManagerInterfaceBase
83 public:
84 PresenterPaneBorderManager (
85 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
86 const ::rtl::Reference<PresenterController>& rpPresenterController);
87 virtual ~PresenterPaneBorderManager (void);
89 virtual void SAL_CALL disposing (void);
92 static ::rtl::OUString getImplementationName_static (void);
93 static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
94 static css::uno::Reference<css::uno::XInterface> Create(
95 const css::uno::Reference<css::uno::XComponentContext>& rxContext)
96 SAL_THROW((css::uno::Exception));
99 // XInitialization
101 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
102 throw (css::uno::Exception, css::uno::RuntimeException);
105 // XMouseListener
107 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
108 throw (css::uno::RuntimeException);
110 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
111 throw (css::uno::RuntimeException);
113 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
114 throw (css::uno::RuntimeException);
116 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
117 throw (css::uno::RuntimeException);
120 // XMouseMotionListener
122 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
123 throw (css::uno::RuntimeException);
125 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
126 throw (css::uno::RuntimeException);
129 // lang::XEventListener
130 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
131 throw (css::uno::RuntimeException);
134 private:
135 enum BorderElement { Top, TopLeft, TopRight, Left, Right, BottomLeft, BottomRight, Bottom,
136 Content, Outside };
138 ::rtl::Reference<PresenterController> mpPresenterController;
139 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
140 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
141 /** The parent window is stored so that it can be invalidated when one
142 of its children is resized or moved. It is assumed to be the parent
143 window of all outer windows stored in maWindowList.
145 css::uno::Reference<css::awt::XWindow> mxParentWindow;
146 typedef ::std::pair<css::uno::Reference<css::awt::XWindow>,
147 css::uno::Reference<css::awt::XWindow> > WindowDescriptor;
148 typedef ::std::vector<WindowDescriptor> WindowList;
149 WindowList maWindowList;
151 sal_Int32 mnPointerType;
152 css::awt::Point maDragAnchor;
153 BorderElement meDragType;
154 css::uno::Reference<css::awt::XWindow> mxOuterDragWindow;
155 css::uno::Reference<css::awt::XWindow> mxInnerDragWindow;
156 css::uno::Reference<css::awt::XPointer> mxPointer;
158 BorderElement ClassifyBorderElementUnderMouse (
159 const css::uno::Reference<css::awt::XWindow>& rxOuterDragWindow,
160 const css::uno::Reference<css::awt::XWindow>& rxInnerDragWindow,
161 const css::awt::Point aPosition) const;
162 void CreateWindows (const css::uno::Reference<css::awt::XWindow>& rxParentWindow);
163 void CaptureMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow);
164 void ReleaseMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow);
166 /** This method throws a DisposedException when the object has already been
167 disposed.
169 void ThrowIfDisposed (void)
170 throw (css::lang::DisposedException);
173 } } // end of namespace ::sd::presenter
175 #endif // ENABLE_PANE_RESIZING
177 #endif