Branch libreoffice-5-0-4
[LibreOffice.git] / odk / examples / cpp / custompanel / ctp_panel.hxx
blob098faba050f3f69a14b467e59a1acb740e0efe3e
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>
35 namespace sd { namespace colortoolpanel
38 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::ui::XToolPanel
39 , ::com::sun::star::awt::XPaintListener
40 > SingleColorPanel_Base;
41 class SingleColorPanel :public ::cppu::BaseMutex
42 ,public SingleColorPanel_Base
44 public:
45 SingleColorPanel(
46 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
47 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
48 const ::sal_Int32 i_nPanelColor
51 // XToolPanel
52 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
53 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);
55 // XPaintListener
56 virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
58 // XEventListener
59 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
61 // XComponent equivalents
62 virtual void SAL_CALL disposing();
64 protected:
65 ~SingleColorPanel();
67 private:
68 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
69 const sal_Int32 m_nPanelColor;
72 typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
73 > PanelUIElement_Base;
74 class PanelUIElement :public ::cppu::BaseMutex
75 ,public PanelUIElement_Base
77 public:
78 PanelUIElement(
79 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
80 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
81 const OUString& i_rResourceURL,
82 const ::sal_Int32 i_nPanelColor
85 // XUIElement
86 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
87 virtual OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
88 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
89 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException);
91 // OComponentHelper
92 virtual void SAL_CALL disposing();
94 protected:
95 ~PanelUIElement();
97 private:
98 const OUString m_sResourceURL;
99 ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >
100 m_xToolPanel;
104 } } // namespace sd::colortoolpanel
107 #endif // INCLUDED_EXAMPLES_CUSTOMPANEL_CTP_PANEL_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */