1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #ifndef SD_WORKBENCH_CTP_PANEL_HXX 28 #define SD_WORKBENCH_CTP_PANEL_HXX 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/ui/XToolPanel.hpp> 32 #include <com/sun/star/uno/XComponentContext.hpp> 33 #include <com/sun/star/awt/XPaintListener.hpp> 34 #include <com/sun/star/awt/XWindow.hpp> 35 #include <com/sun/star/ui/XUIElement.hpp> 36 /** === end UNO includes === **/ 37 38 #include <cppuhelper/compbase2.hxx> 39 #include <cppuhelper/compbase1.hxx> 40 #include <cppuhelper/basemutex.hxx> 41 42 #include <boost/scoped_ptr.hpp> 43 44 //...................................................................................................................... 45 namespace sd { namespace colortoolpanel 46 { 47 //...................................................................................................................... 48 49 //================================================================================================================== 50 //= SingleColorPanel 51 //================================================================================================================== 52 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::ui::XToolPanel 53 , ::com::sun::star::awt::XPaintListener 54 > SingleColorPanel_Base; 55 class SingleColorPanel :public ::cppu::BaseMutex 56 ,public SingleColorPanel_Base 57 { 58 public: 59 SingleColorPanel( 60 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, 61 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, 62 const ::sal_Int32 i_nPanelColor 63 ); 64 65 // XToolPanel 66 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); 67 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ) throw (::com::sun::star::uno::RuntimeException); 68 69 // XPaintListener 70 virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException); 71 72 // XEventListener 73 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 74 75 // XComponent equivalents 76 virtual void SAL_CALL disposing(); 77 78 protected: 79 ~SingleColorPanel(); 80 81 private: 82 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; 83 const sal_Int32 m_nPanelColor; 84 }; 85 86 //================================================================================================================== 87 //= PanelUIElement 88 //================================================================================================================== 89 typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement 90 > PanelUIElement_Base; 91 class PanelUIElement :public ::cppu::BaseMutex 92 ,public PanelUIElement_Base 93 { 94 public: 95 PanelUIElement( 96 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, 97 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, 98 const ::rtl::OUString& i_rResourceURL, 99 const ::sal_Int32 i_nPanelColor 100 ); 101 102 // XUIElement 103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); 104 virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); 105 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); 106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException); 107 108 // OComponentHelper 109 virtual void SAL_CALL disposing(); 110 111 protected: 112 ~PanelUIElement(); 113 114 private: 115 const ::rtl::OUString m_sResourceURL; 116 ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > 117 m_xToolPanel; 118 }; 119 120 //...................................................................................................................... 121 } } // namespace sd::colortoolpanel 122 //...................................................................................................................... 123 124 #endif // SD_WORKBENCH_CTP_PANEL_HXX 125