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_WORKBENCH_CTP_PANEL_HXX
25 #define SD_WORKBENCH_CTP_PANEL_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/ui/XToolPanel.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/awt/XPaintListener.hpp>
31 #include <com/sun/star/awt/XWindow.hpp>
32 #include <com/sun/star/ui/XUIElement.hpp>
33 /** === end UNO includes === **/
34 
35 #include <cppuhelper/compbase2.hxx>
36 #include <cppuhelper/compbase1.hxx>
37 #include <cppuhelper/basemutex.hxx>
38 
39 
40 //......................................................................................................................
41 namespace sd { namespace colortoolpanel
42 {
43 //......................................................................................................................
44 
45 	//==================================================================================================================
46 	//= SingleColorPanel
47 	//==================================================================================================================
48     typedef ::cppu::WeakComponentImplHelper2    <   ::com::sun::star::ui::XToolPanel
49                                                 ,   ::com::sun::star::awt::XPaintListener
50                                                 >   SingleColorPanel_Base;
51     class SingleColorPanel  :public ::cppu::BaseMutex
52                             ,public SingleColorPanel_Base
53 	{
54     public:
55         SingleColorPanel(
56             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
57             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
58             const ::sal_Int32 i_nPanelColor
59         );
60 
61         // XToolPanel
62         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
63         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);
64 
65         // XPaintListener
66         virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
67 
68         // XEventListener
69         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
70 
71         // XComponent equivalents
72         virtual void SAL_CALL disposing();
73 
74     protected:
75         ~SingleColorPanel();
76 
77     private:
78         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >  m_xWindow;
79         const sal_Int32                                                     m_nPanelColor;
80 	};
81 
82 	//==================================================================================================================
83 	//= PanelUIElement
84 	//==================================================================================================================
85     typedef ::cppu::WeakComponentImplHelper1    <   ::com::sun::star::ui::XUIElement
86                                                 >   PanelUIElement_Base;
87     class PanelUIElement    :public ::cppu::BaseMutex
88                             ,public PanelUIElement_Base
89     {
90     public:
91         PanelUIElement(
92             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
93             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
94             const ::rtl::OUString& i_rResourceURL,
95             const ::sal_Int32 i_nPanelColor
96         );
97 
98         // XUIElement
99         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
100         virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
101         virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
102         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface(  ) throw (::com::sun::star::uno::RuntimeException);
103 
104         // OComponentHelper
105         virtual void SAL_CALL disposing();
106 
107     protected:
108         ~PanelUIElement();
109 
110     private:
111         const ::rtl::OUString   m_sResourceURL;
112         ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >
113                                 m_xToolPanel;
114     };
115 
116 //......................................................................................................................
117 } } // namespace sd::colortoolpanel
118 //......................................................................................................................
119 
120 #endif // SD_WORKBENCH_CTP_PANEL_HXX
121