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 #ifndef SFX_SIDEBAR_PANEL_BASE_HXX 23 #define SFX_SIDEBAR_PANEL_BASE_HXX 24 25 #include "EnumContext.hxx" 26 27 #include <vcl/ctrl.hxx> 28 #include <cppuhelper/compbase3.hxx> 29 #include <cppuhelper/basemutex.hxx> 30 31 #include <com/sun/star/frame/XController.hpp> 32 #include <com/sun/star/ui/XContextChangeEventListener.hpp> 33 #include <com/sun/star/ui/XUIElement.hpp> 34 #include <com/sun/star/ui/XToolPanel.hpp> 35 #include <boost/noncopyable.hpp> 36 37 38 namespace css = ::com::sun::star; 39 namespace cssu = ::com::sun::star::uno; 40 41 42 namespace sfx2 { namespace sidebar { 43 44 namespace 45 { 46 typedef ::cppu::WeakComponentImplHelper3 < 47 css::ui::XContextChangeEventListener, 48 css::ui::XUIElement, 49 css::ui::XToolPanel 50 > SidebarPanelBaseInterfaceBase; 51 } 52 53 /** Base class for sidebar panels that provides some convenience 54 functionality. 55 */ 56 class SFX2_DLLPUBLIC SidebarPanelBase 57 : private ::boost::noncopyable, 58 private ::cppu::BaseMutex, 59 public SidebarPanelBaseInterfaceBase, 60 public Control 61 { 62 public: 63 // XContextChangeEventListener 64 virtual void SAL_CALL notifyContextChangeEvent ( 65 const css::ui::ContextChangeEventObject& rEvent); 66 67 // XEventListener 68 virtual void SAL_CALL disposing ( 69 const css::lang::EventObject& rEvent) 70 throw (cssu::RuntimeException); 71 72 // XUIElement 73 virtual cssu::Reference<css::frame::XFrame> SAL_CALL getFrame (void) 74 throw(cssu::RuntimeException); 75 virtual ::rtl::OUString SAL_CALL getResourceURL (void) 76 throw(cssu::RuntimeException); 77 virtual sal_Int16 SAL_CALL getType (void) 78 throw(cssu::RuntimeException); 79 virtual cssu::Reference<cssu::XInterface> SAL_CALL getRealInterface (void) 80 throw(cssu::RuntimeException); 81 82 // XToolPanel 83 virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible ( 84 const cssu::Reference<css::accessibility::XAccessible>& rxParentAccessible) 85 throw(cssu::RuntimeException); 86 virtual cssu::Reference<css::awt::XWindow> SAL_CALL getWindow (void) 87 throw(cssu::RuntimeException); 88 89 protected: 90 SidebarPanelBase ( 91 const ::rtl::OUString& rsResourceURL, 92 Window* pParentWindow, 93 const cssu::Reference<css::frame::XFrame>& rxFrame, 94 const ResId& rResId); 95 virtual ~SidebarPanelBase (void); 96 97 virtual void SAL_CALL disposing (void) 98 throw (cssu::RuntimeException); 99 100 virtual void HandleContextChange ( 101 const EnumContext aContext) = 0; 102 103 FontUnderline GetDefaultUnderline (void) const; 104 void SetDefaultUnderline (const FontUnderline eFontUnderline); 105 106 Image GetIcon (const ::rtl::OUString& rsURL); 107 108 private: 109 const ::rtl::OUString msResourceURL; 110 cssu::Reference<css::frame::XFrame> mxFrame; 111 FontUnderline meFontUnderline; 112 }; 113 114 } } // end of namespace sfx2::sidebar 115 116 #endif 117