Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / odk / examples / cpp / custompanel / ctp_panel.hxx
blobc811f24e6fb1b8825084bdcad4da287e2a5dd8a9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXAMPLES_CUSTOMPANEL_CTP_PANEL_HXX
21 #define INCLUDED_EXAMPLES_CUSTOMPANEL_CTP_PANEL_HXX
23 #include <com/sun/star/ui/XToolPanel.hpp>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/awt/XPaintListener.hpp>
26 #include <com/sun/star/awt/XWindow.hpp>
27 #include <com/sun/star/ui/XUIElement.hpp>
29 #include <cppuhelper/compbase2.hxx>
30 #include <cppuhelper/compbase1.hxx>
31 #include <cppuhelper/basemutex.hxx>
34 namespace sd { namespace colortoolpanel
37 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::ui::XToolPanel
38 , ::com::sun::star::awt::XPaintListener
39 > SingleColorPanel_Base;
40 class SingleColorPanel :public ::cppu::BaseMutex
41 ,public SingleColorPanel_Base
43 public:
44 SingleColorPanel(
45 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
46 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
47 const ::sal_Int32 i_nPanelColor
50 // XToolPanel
51 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
52 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);
54 // XPaintListener
55 virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
57 // XEventListener
58 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
60 // XComponent equivalents
61 virtual void SAL_CALL disposing();
63 protected:
64 ~SingleColorPanel();
66 private:
67 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
68 const sal_Int32 m_nPanelColor;
71 typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
72 > PanelUIElement_Base;
73 class PanelUIElement :public ::cppu::BaseMutex
74 ,public PanelUIElement_Base
76 public:
77 PanelUIElement(
78 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
79 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
80 const OUString& i_rResourceURL,
81 const ::sal_Int32 i_nPanelColor
84 // XUIElement
85 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
86 virtual OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
87 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
88 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException);
90 // OComponentHelper
91 virtual void SAL_CALL disposing();
93 protected:
94 ~PanelUIElement();
96 private:
97 const OUString m_sResourceURL;
98 ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >
99 m_xToolPanel;
103 } } // namespace sd::colortoolpanel
106 #endif // INCLUDED_EXAMPLES_CUSTOMPANEL_CTP_PANEL_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */