1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SD_PRESENTER_PRESENTER_SPRITE_PANE_HXX 25 #define SD_PRESENTER_PRESENTER_SPRITE_PANE_HXX 26 27 #include "PresenterPaneBase.hxx" 28 #include "PresenterSprite.hxx" 29 #include <com/sun/star/awt/Size.hpp> 30 #include <com/sun/star/awt/XMouseListener.hpp> 31 #include <com/sun/star/awt/XMouseMotionListener.hpp> 32 #include <com/sun/star/awt/XWindowListener.hpp> 33 #include <com/sun/star/container/XChild.hpp> 34 #include <com/sun/star/drawing/XPresenterHelper.hpp> 35 #include <com/sun/star/drawing/framework/XPane.hpp> 36 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp> 37 #include <com/sun/star/lang/XInitialization.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 #include <com/sun/star/rendering/XCanvas.hpp> 40 #include <com/sun/star/rendering/XSpriteCanvas.hpp> 41 #include <cppuhelper/basemutex.hxx> 42 #include <cppuhelper/compbase1.hxx> 43 #include <rtl/ref.hxx> 44 #include <boost/noncopyable.hpp> 45 #include <boost/shared_ptr.hpp> 46 47 namespace css = ::com::sun::star; 48 49 50 namespace sdext { namespace presenter { 51 52 /** Use a sprite to display the contents and the border of a pane. Windows 53 are still used to define the locations and sizes of both the border and 54 the pane content. Note that every resize results in a disposed canvas. 55 Therefore call getCanvas in every repaint or at least after every resize. 56 */ 57 class PresenterSpritePane : public PresenterPaneBase 58 { 59 public: 60 PresenterSpritePane ( 61 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 62 const ::rtl::Reference<PresenterController>& rpPresenterController); 63 virtual ~PresenterSpritePane (void); 64 65 virtual void SAL_CALL disposing (void); 66 67 using css::lang::XEventListener::disposing; 68 69 ::boost::shared_ptr<PresenterSprite> GetSprite (void); 70 71 static ::rtl::OUString getImplementationName_static (void); 72 static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void); 73 static css::uno::Reference<css::uno::XInterface> Create( 74 const css::uno::Reference<css::uno::XComponentContext>& rxContext); 75 76 void ShowTransparentBorder (void); 77 78 // XPane 79 80 virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow (void); 81 82 virtual css::uno::Reference<css::rendering::XCanvas> SAL_CALL getCanvas (void); 83 84 85 // XWindowListener 86 87 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent); 88 89 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent); 90 91 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent); 92 93 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent); 94 95 96 // XPaintListener 97 98 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent); 99 100 101 private: 102 css::uno::Reference<css::awt::XWindow> mxParentWindow; 103 css::uno::Reference<css::rendering::XSpriteCanvas> mxParentCanvas; 104 ::boost::shared_ptr<PresenterSprite> mpSprite; 105 106 virtual void CreateCanvases ( 107 const css::uno::Reference<css::awt::XWindow>& rxParentWindow, 108 const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas); 109 void UpdateCanvases (void); 110 }; 111 112 } } // end of namespace ::sd::presenter 113 114 #endif 115