merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / main / ElementSelector.hxx
blobbca4769a4daad111e45e982770788bb35f7cc98e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ElementSelector.hxx,v $
10 * $Revision: 1.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART_ELEMENTSELECTOR_HXX
31 #define _CHART_ELEMENTSELECTOR_HXX
33 #include "ServiceMacros.hxx"
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <cppuhelper/implbase1.hxx>
36 #include <svtools/toolboxcontroller.hxx>
38 #include <vcl/lstbox.hxx>
39 #include <cppuhelper/weakref.hxx>
41 #include <memory>
43 //.............................................................................
44 namespace chart
46 //.............................................................................
48 struct ListBoxEntryData
50 rtl::OUString UIName;
51 rtl::OUString CID;
52 sal_Int32 nHierarchyDepth;
54 ListBoxEntryData() : nHierarchyDepth(0)
59 class SelectorListBox : public ListBox
61 public:
62 SelectorListBox( Window* pParent, WinBits nStyle );
63 virtual ~SelectorListBox();
65 virtual void Select();
66 virtual long Notify( NotifyEvent& rNEvt );
67 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
69 void ReleaseFocus_Impl();
71 void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
72 void UpdateChartElementsListAndSelection();
74 private:
75 ::com::sun::star::uno::WeakReference<
76 ::com::sun::star::frame::XController > m_xChartController;
78 ::std::vector< ListBoxEntryData > m_aEntries;
80 bool m_bReleaseFocus;
83 // ------------------------------------------------------------------
84 // ------------------------------------------------------------------
86 typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
88 class ElementSelectorToolbarController : public ::svt::ToolboxController
89 , ElementSelectorToolbarController_BASE
91 public:
92 ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
93 ::com::sun::star::uno::XComponentContext > const & xContext );
94 virtual ~ElementSelectorToolbarController();
96 // XServiceInfo
97 APPHELPER_XSERVICEINFO_DECL()
98 APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController)
100 // XInterface
101 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
102 virtual void SAL_CALL acquire() throw ();
103 virtual void SAL_CALL release() throw ();
105 // XInitialization
106 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
107 // XStatusListener
108 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
109 // XToolbarController
110 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
112 private:
113 //no default constructor
114 ElementSelectorToolbarController(){}
116 private:
117 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
118 ::std::auto_ptr< SelectorListBox > m_apSelectorListBox;
121 //.............................................................................
122 } //namespace chart
123 //.............................................................................
125 #endif