1*06bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06bcd5d2SAndrew Rist * distributed with this work for additional information 6*06bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 9*06bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*06bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*06bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06bcd5d2SAndrew Rist * software distributed under the License is distributed on an 15*06bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 17*06bcd5d2SAndrew Rist * specific language governing permissions and limitations 18*06bcd5d2SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*06bcd5d2SAndrew Rist *************************************************************/ 21*06bcd5d2SAndrew Rist 22*06bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_MANAGER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir // The body of this file is only used when PresenterWindowManager defines 28cdf0e10cSrcweir // the preprocessor symbol ENABLE_PANE_RESIZING, which by default is not the 29cdf0e10cSrcweir // case. 30cdf0e10cSrcweir #ifdef ENABLE_PANE_RESIZING 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 33cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx> 34cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp> 35cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 36cdf0e10cSrcweir #include <com/sun/star/awt/XGraphics.hpp> 37cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp> 38cdf0e10cSrcweir #include <com/sun/star/awt/XMouseMotionListener.hpp> 39cdf0e10cSrcweir #include <com/sun/star/awt/XPointer.hpp> 40cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp> 41cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 42cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp> 43cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 44cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 45cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 46cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp> 47cdf0e10cSrcweir #include <rtl/ref.hxx> 48cdf0e10cSrcweir #include <tools/svborder.hxx> 49cdf0e10cSrcweir #include <boost/noncopyable.hpp> 50cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 51cdf0e10cSrcweir 52cdf0e10cSrcweir namespace css = ::com::sun::star; 53cdf0e10cSrcweir 54cdf0e10cSrcweir 55cdf0e10cSrcweir namespace sdext { namespace presenter { 56cdf0e10cSrcweir 57cdf0e10cSrcweir class PresenterController; 58cdf0e10cSrcweir 59cdf0e10cSrcweir namespace { 60cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper3 < 61cdf0e10cSrcweir css::lang::XInitialization, 62cdf0e10cSrcweir css::awt::XMouseListener, 63cdf0e10cSrcweir css::awt::XMouseMotionListener 64cdf0e10cSrcweir > PresenterPaneBorderManagerInterfaceBase; 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir 68cdf0e10cSrcweir /** Manage the interactive moving and resizing of panes. 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir class PresenterPaneBorderManager 71cdf0e10cSrcweir : private ::boost::noncopyable, 72cdf0e10cSrcweir protected ::cppu::BaseMutex, 73cdf0e10cSrcweir public PresenterPaneBorderManagerInterfaceBase 74cdf0e10cSrcweir { 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir PresenterPaneBorderManager ( 77cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 78cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 79cdf0e10cSrcweir virtual ~PresenterPaneBorderManager (void); 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir static ::rtl::OUString getImplementationName_static (void); 85cdf0e10cSrcweir static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void); 86cdf0e10cSrcweir static css::uno::Reference<css::uno::XInterface> Create( 87cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext) 88cdf0e10cSrcweir SAL_THROW((css::uno::Exception)); 89cdf0e10cSrcweir 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XInitialization 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) 94cdf0e10cSrcweir throw (css::uno::Exception, css::uno::RuntimeException); 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir // XMouseListener 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 100cdf0e10cSrcweir throw (css::uno::RuntimeException); 101cdf0e10cSrcweir 102cdf0e10cSrcweir virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) 103cdf0e10cSrcweir throw (css::uno::RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) 106cdf0e10cSrcweir throw (css::uno::RuntimeException); 107cdf0e10cSrcweir 108cdf0e10cSrcweir virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 109cdf0e10cSrcweir throw (css::uno::RuntimeException); 110cdf0e10cSrcweir 111cdf0e10cSrcweir 112cdf0e10cSrcweir // XMouseMotionListener 113cdf0e10cSrcweir 114cdf0e10cSrcweir virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 115cdf0e10cSrcweir throw (css::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 118cdf0e10cSrcweir throw (css::uno::RuntimeException); 119cdf0e10cSrcweir 120cdf0e10cSrcweir 121cdf0e10cSrcweir // lang::XEventListener 122cdf0e10cSrcweir virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 123cdf0e10cSrcweir throw (css::uno::RuntimeException); 124cdf0e10cSrcweir 125cdf0e10cSrcweir 126cdf0e10cSrcweir private: 127cdf0e10cSrcweir enum BorderElement { Top, TopLeft, TopRight, Left, Right, BottomLeft, BottomRight, Bottom, 128cdf0e10cSrcweir Content, Outside }; 129cdf0e10cSrcweir 130cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 131cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 132cdf0e10cSrcweir css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; 133cdf0e10cSrcweir /** The parent window is stored so that it can be invalidated when one 134cdf0e10cSrcweir of its children is resized or moved. It is assumed to be the parent 135cdf0e10cSrcweir window of all outer windows stored in maWindowList. 136cdf0e10cSrcweir */ 137cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxParentWindow; 138cdf0e10cSrcweir typedef ::std::pair<css::uno::Reference<css::awt::XWindow>, 139cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> > WindowDescriptor; 140cdf0e10cSrcweir typedef ::std::vector<WindowDescriptor> WindowList; 141cdf0e10cSrcweir WindowList maWindowList; 142cdf0e10cSrcweir 143cdf0e10cSrcweir sal_Int32 mnPointerType; 144cdf0e10cSrcweir css::awt::Point maDragAnchor; 145cdf0e10cSrcweir BorderElement meDragType; 146cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxOuterDragWindow; 147cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxInnerDragWindow; 148cdf0e10cSrcweir css::uno::Reference<css::awt::XPointer> mxPointer; 149cdf0e10cSrcweir 150cdf0e10cSrcweir BorderElement ClassifyBorderElementUnderMouse ( 151cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxOuterDragWindow, 152cdf0e10cSrcweir const css::uno::Reference<css::awt::XWindow>& rxInnerDragWindow, 153cdf0e10cSrcweir const css::awt::Point aPosition) const; 154cdf0e10cSrcweir void CreateWindows (const css::uno::Reference<css::awt::XWindow>& rxParentWindow); 155cdf0e10cSrcweir void CaptureMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow); 156cdf0e10cSrcweir void ReleaseMouse (const css::uno::Reference<css::awt::XWindow>& rxWindow); 157cdf0e10cSrcweir 158cdf0e10cSrcweir /** This method throws a DisposedException when the object has already been 159cdf0e10cSrcweir disposed. 160cdf0e10cSrcweir */ 161cdf0e10cSrcweir void ThrowIfDisposed (void) 162cdf0e10cSrcweir throw (css::lang::DisposedException); 163cdf0e10cSrcweir }; 164cdf0e10cSrcweir 165cdf0e10cSrcweir } } // end of namespace ::sd::presenter 166cdf0e10cSrcweir 167cdf0e10cSrcweir #endif // ENABLE_PANE_RESIZING 168cdf0e10cSrcweir 169cdf0e10cSrcweir #endif 170cdf0e10cSrcweir 171