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