Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _CHART_ELEMENTSELECTOR_HXX
20 : #define _CHART_ELEMENTSELECTOR_HXX
21 :
22 : #include "ServiceMacros.hxx"
23 : #include "ObjectHierarchy.hxx"
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <cppuhelper/implbase1.hxx>
26 : #include <svtools/toolboxcontroller.hxx>
27 :
28 : #include <vcl/lstbox.hxx>
29 : #include <cppuhelper/weakref.hxx>
30 :
31 : #include <memory>
32 :
33 : //.............................................................................
34 : namespace chart
35 : {
36 : //.............................................................................
37 :
38 0 : struct ListBoxEntryData
39 : {
40 : rtl::OUString UIName;
41 : ObjectHierarchy::tOID OID;
42 : sal_Int32 nHierarchyDepth;
43 :
44 0 : ListBoxEntryData() : nHierarchyDepth(0)
45 : {
46 0 : }
47 : };
48 :
49 : class SelectorListBox : public ListBox
50 : {
51 : public:
52 : SelectorListBox( Window* pParent, WinBits nStyle );
53 : virtual ~SelectorListBox();
54 :
55 : virtual void Select();
56 : virtual long Notify( NotifyEvent& rNEvt );
57 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
58 :
59 : void ReleaseFocus_Impl();
60 :
61 : void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
62 : void UpdateChartElementsListAndSelection();
63 :
64 : private:
65 : ::com::sun::star::uno::WeakReference<
66 : ::com::sun::star::frame::XController > m_xChartController;
67 :
68 : ::std::vector< ListBoxEntryData > m_aEntries;
69 :
70 : bool m_bReleaseFocus;
71 : };
72 :
73 : // ------------------------------------------------------------------
74 : // ------------------------------------------------------------------
75 :
76 : typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
77 :
78 : class ElementSelectorToolbarController : public ::svt::ToolboxController
79 : , ElementSelectorToolbarController_BASE
80 : {
81 : public:
82 : ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
83 : ::com::sun::star::uno::XComponentContext > const & xContext );
84 : virtual ~ElementSelectorToolbarController();
85 :
86 : // XServiceInfo
87 : APPHELPER_XSERVICEINFO_DECL()
88 0 : APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController)
89 :
90 : // XInterface
91 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
92 : virtual void SAL_CALL acquire() throw ();
93 : virtual void SAL_CALL release() throw ();
94 :
95 : // XInitialization
96 : 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);
97 : // XStatusListener
98 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
99 : // XToolbarController
100 : 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);
101 :
102 : private:
103 : //no default constructor
104 : ElementSelectorToolbarController(){}
105 :
106 : private:
107 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
108 : ::std::auto_ptr< SelectorListBox > m_apSelectorListBox;
109 : };
110 :
111 : //.............................................................................
112 : } //namespace chart
113 : //.............................................................................
114 :
115 : #endif
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|