Updated core
[LibreOffice.git] / sdext / source / presenter / PresenterPaneBorderManager.hxx
blobe95147a5dfdd48dc9bc4525f4b8fe87b467d352d
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 SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX
21 #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX
23 // The body of this file is only used when PresenterWindowManager defines
24 // the preprocessor symbol ENABLE_PANE_RESIZING, which by default is not the
25 // case.
26 #ifdef ENABLE_PANE_RESIZING
28 #include <cppuhelper/basemutex.hxx>
29 #include <cppuhelper/compbase3.hxx>
30 #include <com/sun/star/awt/Point.hpp>
31 #include <com/sun/star/awt/Size.hpp>
32 #include <com/sun/star/awt/XGraphics.hpp>
33 #include <com/sun/star/awt/XMouseListener.hpp>
34 #include <com/sun/star/awt/XMouseMotionListener.hpp>
35 #include <com/sun/star/awt/XPointer.hpp>
36 #include <com/sun/star/awt/XWindowListener.hpp>
37 #include <com/sun/star/container/XChild.hpp>
38 #include <com/sun/star/drawing/XPresenterHelper.hpp>
39 #include <com/sun/star/drawing/framework/XPane.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/uno/XComponentContext.hpp>
42 #include <com/sun/star/rendering/XCanvas.hpp>
43 #include <rtl/ref.hxx>
44 #include <boost/noncopyable.hpp>
45 #include <boost/shared_ptr.hpp>
47 namespace sdext { namespace presenter {
49 class PresenterController;
51 namespace {
52 typedef ::cppu::WeakComponentImplHelper3 <
53 css::lang::XInitialization,
54 css::awt::XMouseListener,
55 css::awt::XMouseMotionListener
56 > PresenterPaneBorderManagerInterfaceBase;
59 /** Manage the interactive moving and resizing of panes.
61 class PresenterPaneBorderManager
62 : private ::boost::noncopyable,
63 protected ::cppu::BaseMutex,
64 public PresenterPaneBorderManagerInterfaceBase
66 public:
67 PresenterPaneBorderManager (
68 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
69 const ::rtl::Reference<PresenterController>& rpPresenterController);
70 virtual ~PresenterPaneBorderManager (void);
72 virtual void SAL_CALL disposing (void);
74 static OUString getImplementationName_static (void);
75 static css::uno::Sequence< OUString > getSupportedServiceNames_static (void);
76 static css::uno::Reference<css::uno::XInterface> Create(
77 const css::uno::Reference<css::uno::XComponentContext>& rxContext)
78 SAL_THROW((css::uno::Exception));
80 // XInitialization
82 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
83 throw (css::uno::Exception, css::uno::RuntimeException);
85 // XMouseListener
87 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
88 throw (css::uno::RuntimeException);
90 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
91 throw (css::uno::RuntimeException);
93 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
94 throw (css::uno::RuntimeException);
96 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
97 throw (css::uno::RuntimeException);
99 // XMouseMotionListener
101 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
102 throw (css::uno::RuntimeException);
104 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
105 throw (css::uno::RuntimeException);
107 // lang::XEventListener
108 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
109 throw (css::uno::RuntimeException);
111 private:
112 enum BorderElement { Top, TopLeft, TopRight, Left, Right, BottomLeft, BottomRight, Bottom,
113 Content, Outside };
115 ::rtl::Reference<PresenterController> mpPresenterController;
116 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
117 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
118 /** The parent window is stored so that it can be invalidated when one
119 of its children is resized or moved. It is assumed to be the parent
120 window of all outer windows stored in maWindowList.
122 css::uno::Reference<css::awt::XWindow> mxParentWindow;
123 typedef ::std::pair<css::uno::Reference<css::awt::XWindow>,
124 css::uno::Reference<css::awt::XWindow> > WindowDescriptor;
125 typedef ::std::vector<WindowDescriptor> WindowList;
126 WindowList maWindowList;
128 sal_Int32 mnPointerType;
129 css::awt::Point maDragAnchor;
130 BorderElement meDragType;
131 css::uno::Reference<css::awt::XWindow> mxOuterDragWindow;
132 css::uno::Reference<css::awt::XWindow> mxInnerDragWindow;
133 css::uno::Reference<css::awt::XPointer> mxPointer;
135 BorderElement ClassifyBorderElementUnderMouse (
136 const css::uno::Reference<css::awt::XWindow>& rxOuterDragWindow,
137 const css::uno::Reference<css::awt::XWindow>& rxInnerDragWindow,
138 const css::awt::Point aPosition) const;
139 void CreateWindows (const css::uno::Reference<css::awt::XWindow>& rxParentWindow);
140 void CaptureMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow);
141 void ReleaseMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow);
143 /** This method throws a DisposedException when the object has already been
144 disposed.
146 void ThrowIfDisposed (void)
147 throw (css::lang::DisposedException);
150 } } // end of namespace ::sd::presenter
152 #endif // ENABLE_PANE_RESIZING
154 #endif
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */