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