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_PANE_BASE_HXX 25 #define SD_PRESENTER_PRESENTER_PANE_BASE_HXX 26 27 #include "PresenterTheme.hxx" 28 #include <cppuhelper/basemutex.hxx> 29 #include <cppuhelper/compbase4.hxx> 30 #include <com/sun/star/awt/Point.hpp> 31 #include <com/sun/star/awt/XMouseListener.hpp> 32 #include <com/sun/star/awt/XMouseMotionListener.hpp> 33 #include <com/sun/star/awt/XWindowListener.hpp> 34 #include <com/sun/star/container/XChild.hpp> 35 #include <com/sun/star/drawing/XPresenterHelper.hpp> 36 #include <com/sun/star/drawing/framework/XPane.hpp> 37 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp> 38 #include <com/sun/star/lang/XInitialization.hpp> 39 #include <com/sun/star/uno/XComponentContext.hpp> 40 #include <com/sun/star/util/Color.hpp> 41 #include <com/sun/star/rendering/XCanvas.hpp> 42 #include <rtl/ref.hxx> 43 #include <boost/noncopyable.hpp> 44 45 namespace css = ::com::sun::star; 46 namespace cssu = ::com::sun::star::uno; 47 48 49 namespace sdext { namespace presenter { 50 51 class PresenterController; 52 class PresenterTextView; 53 54 namespace { 55 typedef ::cppu::WeakComponentImplHelper4 < 56 css::drawing::framework::XPane, 57 css::lang::XInitialization, 58 css::awt::XWindowListener, 59 css::awt::XPaintListener 60 > PresenterPaneBaseInterfaceBase; 61 } 62 63 64 /** Base class of the panes used by the presenter screen. Pane objects are 65 stored in the PresenterPaneContainer. Sizes and positions are 66 controlled by the PresenterWindowManager. Interactive positioning and 67 resizing is managed by the PresenterPaneBorderManager. Borders around 68 panes are painted by the PresenterPaneBorderPainter. 69 */ 70 class PresenterPaneBase 71 : protected ::cppu::BaseMutex, 72 private ::boost::noncopyable, 73 public PresenterPaneBaseInterfaceBase 74 { 75 public: 76 PresenterPaneBase ( 77 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 78 const ::rtl::Reference<PresenterController>& rpPresenterController); 79 virtual ~PresenterPaneBase (void); 80 81 virtual void SAL_CALL disposing (void); 82 83 css::uno::Reference<css::awt::XWindow> GetBorderWindow (void) const; 84 void SetBackground (const SharedBitmapDescriptor& rpBackground); 85 void SetTitle (const ::rtl::OUString& rsTitle); 86 ::rtl::OUString GetTitle (void) const; 87 css::uno::Reference<css::drawing::framework::XPaneBorderPainter> GetPaneBorderPainter (void) const; 88 void SetCalloutAnchor (const css::awt::Point& rAnchorPosition); 89 css::awt::Point GetCalloutAnchor (void) const; 90 91 ::boost::shared_ptr<PresenterTextView> GetTextViewForTitle (void); 92 93 // XInitialization 94 95 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) 96 throw (css::uno::Exception, css::uno::RuntimeException); 97 98 99 // XResourceId 100 101 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void) 102 throw (css::uno::RuntimeException); 103 104 virtual sal_Bool SAL_CALL isAnchorOnly (void) 105 throw (com::sun::star::uno::RuntimeException); 106 107 108 // XWindowListener 109 110 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 111 throw (css::uno::RuntimeException); 112 113 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 114 throw (css::uno::RuntimeException); 115 116 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 117 throw (css::uno::RuntimeException); 118 119 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 120 throw (css::uno::RuntimeException); 121 122 123 // lang::XEventListener 124 125 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 126 throw (css::uno::RuntimeException); 127 128 129 protected: 130 ::rtl::Reference<PresenterController> mpPresenterController; 131 css::uno::Reference<css::awt::XWindow> mxParentWindow; 132 css::uno::Reference<css::awt::XWindow> mxBorderWindow; 133 css::uno::Reference<css::rendering::XCanvas> mxBorderCanvas; 134 css::uno::Reference<css::awt::XWindow> mxContentWindow; 135 css::uno::Reference<css::rendering::XCanvas> mxContentCanvas; 136 css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId; 137 css::uno::Reference<css::drawing::framework::XPaneBorderPainter> mxBorderPainter; 138 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; 139 ::rtl::OUString msTitle; 140 css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 141 SharedBitmapDescriptor mpViewBackground; 142 bool mbHasCallout; 143 css::awt::Point maCalloutAnchor; 144 145 virtual void CreateCanvases ( 146 const css::uno::Reference<css::awt::XWindow>& rxParentWindow, 147 const css::uno::Reference<css::rendering::XSpriteCanvas>& rxParentCanvas) = 0; 148 149 void CreateWindows ( 150 const css::uno::Reference<css::awt::XWindow>& rxParentWindow, 151 const bool bIsWindowVisibleOnCreation); 152 void PaintBorderBackground ( 153 const css::awt::Rectangle& rCenterBox, 154 const css::awt::Rectangle& rUpdateBox); 155 void PaintBorder (const css::awt::Rectangle& rUpdateRectangle); 156 void ToTop (void); 157 void LayoutContextWindow (void); 158 bool IsVisible (void) const; 159 160 /** This method throws a DisposedException when the object has already been 161 disposed. 162 */ 163 void ThrowIfDisposed (void) 164 throw (css::lang::DisposedException); 165 }; 166 167 } } // end of namespace ::sd::presenter 168 169 #endif 170