1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEBORDERMANAGER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEBORDERMANAGER_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
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>
46 namespace sdext
{ namespace presenter
{
48 class PresenterController
;
51 typedef ::cppu::WeakComponentImplHelper3
<
52 css::lang::XInitialization
,
53 css::awt::XMouseListener
,
54 css::awt::XMouseMotionListener
55 > PresenterPaneBorderManagerInterfaceBase
;
58 /** Manage the interactive moving and resizing of panes.
60 class PresenterPaneBorderManager
61 : private ::boost::noncopyable
,
62 protected ::cppu::BaseMutex
,
63 public PresenterPaneBorderManagerInterfaceBase
66 PresenterPaneBorderManager (
67 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
68 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
69 virtual ~PresenterPaneBorderManager();
71 virtual void SAL_CALL
disposing();
73 static OUString
getImplementationName_static();
74 static css::uno::Sequence
< OUString
> getSupportedServiceNames_static();
75 static css::uno::Reference
<css::uno::XInterface
> Create(
76 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
80 virtual void SAL_CALL
initialize (const css::uno::Sequence
<css::uno::Any
>& rArguments
)
81 throw (css::uno::Exception
, css::uno::RuntimeException
);
85 virtual void SAL_CALL
mousePressed (const css::awt::MouseEvent
& rEvent
)
86 throw (css::uno::RuntimeException
);
88 virtual void SAL_CALL
mouseReleased (const css::awt::MouseEvent
& rEvent
)
89 throw (css::uno::RuntimeException
);
91 virtual void SAL_CALL
mouseEntered (const css::awt::MouseEvent
& rEvent
)
92 throw (css::uno::RuntimeException
);
94 virtual void SAL_CALL
mouseExited (const css::awt::MouseEvent
& rEvent
)
95 throw (css::uno::RuntimeException
);
97 // XMouseMotionListener
99 virtual void SAL_CALL
mouseMoved (const css::awt::MouseEvent
& rEvent
)
100 throw (css::uno::RuntimeException
);
102 virtual void SAL_CALL
mouseDragged (const css::awt::MouseEvent
& rEvent
)
103 throw (css::uno::RuntimeException
);
105 // lang::XEventListener
106 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
)
107 throw (css::uno::RuntimeException
);
110 enum BorderElement
{ Top
, TopLeft
, TopRight
, Left
, Right
, BottomLeft
, BottomRight
, Bottom
,
113 ::rtl::Reference
<PresenterController
> mpPresenterController
;
114 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
115 css::uno::Reference
<css::drawing::XPresenterHelper
> mxPresenterHelper
;
116 /** The parent window is stored so that it can be invalidated when one
117 of its children is resized or moved. It is assumed to be the parent
118 window of all outer windows stored in maWindowList.
120 css::uno::Reference
<css::awt::XWindow
> mxParentWindow
;
121 typedef ::std::pair
<css::uno::Reference
<css::awt::XWindow
>,
122 css::uno::Reference
<css::awt::XWindow
> > WindowDescriptor
;
123 typedef ::std::vector
<WindowDescriptor
> WindowList
;
124 WindowList maWindowList
;
126 sal_Int32 mnPointerType
;
127 css::awt::Point maDragAnchor
;
128 BorderElement meDragType
;
129 css::uno::Reference
<css::awt::XWindow
> mxOuterDragWindow
;
130 css::uno::Reference
<css::awt::XWindow
> mxInnerDragWindow
;
131 css::uno::Reference
<css::awt::XPointer
> mxPointer
;
133 BorderElement
ClassifyBorderElementUnderMouse (
134 const css::uno::Reference
<css::awt::XWindow
>& rxOuterDragWindow
,
135 const css::uno::Reference
<css::awt::XWindow
>& rxInnerDragWindow
,
136 const css::awt::Point aPosition
) const;
137 void CreateWindows (const css::uno::Reference
<css::awt::XWindow
>& rxParentWindow
);
138 void CaptureMouse (const css::uno::Reference
<css::awt::XWindow
>& rxWindow
);
139 void ReleaseMouse (const css::uno::Reference
<css::awt::XWindow
>& rxWindow
);
141 /** This method throws a DisposedException when the object has already been
144 void ThrowIfDisposed()
145 throw (css::lang::DisposedException
);
148 } } // end of namespace ::sd::presenter
150 #endif // ENABLE_PANE_RESIZING
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */