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 INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
20 : #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_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 <boost/scoped_ptr.hpp>
32 :
33 : namespace chart
34 : {
35 :
36 0 : struct ListBoxEntryData
37 : {
38 : OUString UIName;
39 : ObjectHierarchy::tOID OID;
40 : sal_Int32 nHierarchyDepth;
41 :
42 0 : ListBoxEntryData() : nHierarchyDepth(0)
43 : {
44 0 : }
45 : };
46 :
47 : class SelectorListBox : public ListBox
48 : {
49 : public:
50 : SelectorListBox( Window* pParent, WinBits nStyle );
51 : virtual ~SelectorListBox();
52 :
53 : virtual void Select() SAL_OVERRIDE;
54 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
55 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
56 :
57 : void ReleaseFocus_Impl();
58 :
59 : void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
60 : void UpdateChartElementsListAndSelection();
61 :
62 : private:
63 : ::com::sun::star::uno::WeakReference<
64 : ::com::sun::star::frame::XController > m_xChartController;
65 :
66 : ::std::vector< ListBoxEntryData > m_aEntries;
67 :
68 : bool m_bReleaseFocus;
69 : };
70 :
71 : typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
72 :
73 : class ElementSelectorToolbarController : public ::svt::ToolboxController
74 : , ElementSelectorToolbarController_BASE
75 : {
76 : public:
77 : ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
78 : ::com::sun::star::uno::XComponentContext > const & xContext );
79 : virtual ~ElementSelectorToolbarController();
80 :
81 : // XServiceInfo
82 : APPHELPER_XSERVICEINFO_DECL()
83 0 : APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController)
84 :
85 : // XInterface
86 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
88 : virtual void SAL_CALL release() throw () SAL_OVERRIDE;
89 :
90 : // XInitialization
91 : 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, std::exception) SAL_OVERRIDE;
92 : // XStatusListener
93 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
94 : // XToolbarController
95 : 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, std::exception) SAL_OVERRIDE;
96 :
97 : private:
98 : //no default constructor
99 : ElementSelectorToolbarController(){}
100 :
101 : private:
102 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
103 : boost::scoped_ptr< SelectorListBox > m_apSelectorListBox;
104 : };
105 :
106 : } //namespace chart
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|