xref: /AOO41X/main/odk/examples/cpp/custompanel/ctp_panel.hxx (revision 760d135f8afd19fcd0a7a5c129fd5c6aca7fe70f)
1*760d135fSAriel Constenla-Haile /**************************************************************
2*760d135fSAriel Constenla-Haile  *
3*760d135fSAriel Constenla-Haile  * Licensed to the Apache Software Foundation (ASF) under one
4*760d135fSAriel Constenla-Haile  * or more contributor license agreements.  See the NOTICE file
5*760d135fSAriel Constenla-Haile  * distributed with this work for additional information
6*760d135fSAriel Constenla-Haile  * regarding copyright ownership.  The ASF licenses this file
7*760d135fSAriel Constenla-Haile  * to you under the Apache License, Version 2.0 (the
8*760d135fSAriel Constenla-Haile  * "License"); you may not use this file except in compliance
9*760d135fSAriel Constenla-Haile  * with the License.  You may obtain a copy of the License at
10*760d135fSAriel Constenla-Haile  *
11*760d135fSAriel Constenla-Haile  *   http://www.apache.org/licenses/LICENSE-2.0
12*760d135fSAriel Constenla-Haile  *
13*760d135fSAriel Constenla-Haile  * Unless required by applicable law or agreed to in writing,
14*760d135fSAriel Constenla-Haile  * software distributed under the License is distributed on an
15*760d135fSAriel Constenla-Haile  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*760d135fSAriel Constenla-Haile  * KIND, either express or implied.  See the License for the
17*760d135fSAriel Constenla-Haile  * specific language governing permissions and limitations
18*760d135fSAriel Constenla-Haile  * under the License.
19*760d135fSAriel Constenla-Haile  *
20*760d135fSAriel Constenla-Haile  *************************************************************/
21*760d135fSAriel Constenla-Haile 
22*760d135fSAriel Constenla-Haile 
23*760d135fSAriel Constenla-Haile 
24*760d135fSAriel Constenla-Haile #ifndef SD_WORKBENCH_CTP_PANEL_HXX
25*760d135fSAriel Constenla-Haile #define SD_WORKBENCH_CTP_PANEL_HXX
26*760d135fSAriel Constenla-Haile 
27*760d135fSAriel Constenla-Haile /** === begin UNO includes === **/
28*760d135fSAriel Constenla-Haile #include <com/sun/star/ui/XToolPanel.hpp>
29*760d135fSAriel Constenla-Haile #include <com/sun/star/uno/XComponentContext.hpp>
30*760d135fSAriel Constenla-Haile #include <com/sun/star/awt/XPaintListener.hpp>
31*760d135fSAriel Constenla-Haile #include <com/sun/star/awt/XWindow.hpp>
32*760d135fSAriel Constenla-Haile #include <com/sun/star/ui/XUIElement.hpp>
33*760d135fSAriel Constenla-Haile /** === end UNO includes === **/
34*760d135fSAriel Constenla-Haile 
35*760d135fSAriel Constenla-Haile #include <cppuhelper/compbase2.hxx>
36*760d135fSAriel Constenla-Haile #include <cppuhelper/compbase1.hxx>
37*760d135fSAriel Constenla-Haile #include <cppuhelper/basemutex.hxx>
38*760d135fSAriel Constenla-Haile 
39*760d135fSAriel Constenla-Haile #include <boost/scoped_ptr.hpp>
40*760d135fSAriel Constenla-Haile 
41*760d135fSAriel Constenla-Haile //......................................................................................................................
42*760d135fSAriel Constenla-Haile namespace sd { namespace colortoolpanel
43*760d135fSAriel Constenla-Haile {
44*760d135fSAriel Constenla-Haile //......................................................................................................................
45*760d135fSAriel Constenla-Haile 
46*760d135fSAriel Constenla-Haile 	//==================================================================================================================
47*760d135fSAriel Constenla-Haile 	//= SingleColorPanel
48*760d135fSAriel Constenla-Haile 	//==================================================================================================================
49*760d135fSAriel Constenla-Haile     typedef ::cppu::WeakComponentImplHelper2    <   ::com::sun::star::ui::XToolPanel
50*760d135fSAriel Constenla-Haile                                                 ,   ::com::sun::star::awt::XPaintListener
51*760d135fSAriel Constenla-Haile                                                 >   SingleColorPanel_Base;
52*760d135fSAriel Constenla-Haile     class SingleColorPanel  :public ::cppu::BaseMutex
53*760d135fSAriel Constenla-Haile                             ,public SingleColorPanel_Base
54*760d135fSAriel Constenla-Haile 	{
55*760d135fSAriel Constenla-Haile     public:
56*760d135fSAriel Constenla-Haile         SingleColorPanel(
57*760d135fSAriel Constenla-Haile             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
58*760d135fSAriel Constenla-Haile             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
59*760d135fSAriel Constenla-Haile             const ::sal_Int32 i_nPanelColor
60*760d135fSAriel Constenla-Haile         );
61*760d135fSAriel Constenla-Haile 
62*760d135fSAriel Constenla-Haile         // XToolPanel
63*760d135fSAriel Constenla-Haile         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
64*760d135fSAriel Constenla-Haile         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*760d135fSAriel Constenla-Haile 
66*760d135fSAriel Constenla-Haile         // XPaintListener
67*760d135fSAriel Constenla-Haile         virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
68*760d135fSAriel Constenla-Haile 
69*760d135fSAriel Constenla-Haile         // XEventListener
70*760d135fSAriel Constenla-Haile         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
71*760d135fSAriel Constenla-Haile 
72*760d135fSAriel Constenla-Haile         // XComponent equivalents
73*760d135fSAriel Constenla-Haile         virtual void SAL_CALL disposing();
74*760d135fSAriel Constenla-Haile 
75*760d135fSAriel Constenla-Haile     protected:
76*760d135fSAriel Constenla-Haile         ~SingleColorPanel();
77*760d135fSAriel Constenla-Haile 
78*760d135fSAriel Constenla-Haile     private:
79*760d135fSAriel Constenla-Haile         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >  m_xWindow;
80*760d135fSAriel Constenla-Haile         const sal_Int32                                                     m_nPanelColor;
81*760d135fSAriel Constenla-Haile 	};
82*760d135fSAriel Constenla-Haile 
83*760d135fSAriel Constenla-Haile 	//==================================================================================================================
84*760d135fSAriel Constenla-Haile 	//= PanelUIElement
85*760d135fSAriel Constenla-Haile 	//==================================================================================================================
86*760d135fSAriel Constenla-Haile     typedef ::cppu::WeakComponentImplHelper1    <   ::com::sun::star::ui::XUIElement
87*760d135fSAriel Constenla-Haile                                                 >   PanelUIElement_Base;
88*760d135fSAriel Constenla-Haile     class PanelUIElement    :public ::cppu::BaseMutex
89*760d135fSAriel Constenla-Haile                             ,public PanelUIElement_Base
90*760d135fSAriel Constenla-Haile     {
91*760d135fSAriel Constenla-Haile     public:
92*760d135fSAriel Constenla-Haile         PanelUIElement(
93*760d135fSAriel Constenla-Haile             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
94*760d135fSAriel Constenla-Haile             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
95*760d135fSAriel Constenla-Haile             const ::rtl::OUString& i_rResourceURL,
96*760d135fSAriel Constenla-Haile             const ::sal_Int32 i_nPanelColor
97*760d135fSAriel Constenla-Haile         );
98*760d135fSAriel Constenla-Haile 
99*760d135fSAriel Constenla-Haile         // XUIElement
100*760d135fSAriel Constenla-Haile         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
101*760d135fSAriel Constenla-Haile         virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
102*760d135fSAriel Constenla-Haile         virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
103*760d135fSAriel Constenla-Haile         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface(  ) throw (::com::sun::star::uno::RuntimeException);
104*760d135fSAriel Constenla-Haile 
105*760d135fSAriel Constenla-Haile         // OComponentHelper
106*760d135fSAriel Constenla-Haile         virtual void SAL_CALL disposing();
107*760d135fSAriel Constenla-Haile 
108*760d135fSAriel Constenla-Haile     protected:
109*760d135fSAriel Constenla-Haile         ~PanelUIElement();
110*760d135fSAriel Constenla-Haile 
111*760d135fSAriel Constenla-Haile     private:
112*760d135fSAriel Constenla-Haile         const ::rtl::OUString   m_sResourceURL;
113*760d135fSAriel Constenla-Haile         ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >
114*760d135fSAriel Constenla-Haile                                 m_xToolPanel;
115*760d135fSAriel Constenla-Haile     };
116*760d135fSAriel Constenla-Haile 
117*760d135fSAriel Constenla-Haile //......................................................................................................................
118*760d135fSAriel Constenla-Haile } } // namespace sd::colortoolpanel
119*760d135fSAriel Constenla-Haile //......................................................................................................................
120*760d135fSAriel Constenla-Haile 
121*760d135fSAriel Constenla-Haile #endif // SD_WORKBENCH_CTP_PANEL_HXX
122