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 "ObjectHierarchy.hxx"
23 : #include <com/sun/star/lang/XServiceInfo.hpp>
24 : #include <cppuhelper/implbase1.hxx>
25 : #include <svtools/toolboxcontroller.hxx>
26 :
27 : #include <vcl/lstbox.hxx>
28 : #include <cppuhelper/weakref.hxx>
29 :
30 : #include <boost/scoped_ptr.hpp>
31 :
32 : namespace chart
33 : {
34 :
35 23220 : struct ListBoxEntryData
36 : {
37 : OUString UIName;
38 : ObjectHierarchy::tOID OID;
39 : sal_Int32 nHierarchyDepth;
40 :
41 7570 : ListBoxEntryData() : nHierarchyDepth(0)
42 : {
43 7570 : }
44 : };
45 :
46 34 : class SelectorListBox : public ListBox
47 : {
48 : public:
49 : SelectorListBox( vcl::Window* pParent, WinBits nStyle );
50 :
51 : virtual void Select() SAL_OVERRIDE;
52 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
53 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
54 :
55 : void ReleaseFocus_Impl();
56 :
57 : void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
58 : void UpdateChartElementsListAndSelection();
59 :
60 : private:
61 : ::com::sun::star::uno::WeakReference<
62 : ::com::sun::star::frame::XController > m_xChartController;
63 :
64 : ::std::vector< ListBoxEntryData > m_aEntries;
65 :
66 : bool m_bReleaseFocus;
67 : };
68 :
69 : typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
70 :
71 : class ElementSelectorToolbarController : public ::svt::ToolboxController
72 : , ElementSelectorToolbarController_BASE
73 : {
74 : public:
75 : explicit ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
76 : ::com::sun::star::uno::XComponentContext > const & xContext );
77 : virtual ~ElementSelectorToolbarController();
78 :
79 : // XServiceInfo
80 : virtual OUString SAL_CALL getImplementationName()
81 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
83 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
84 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
85 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
86 :
87 : static OUString getImplementationName_Static();
88 : static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
89 : static css::uno::Reference< css::uno::XInterface > SAL_CALL create( css::uno::Reference< css::uno::XComponentContext > const & xContext)
90 : throw(css::uno::Exception)
91 : {
92 : return static_cast<cppu::OWeakObject *>(new ElementSelectorToolbarController( xContext ));
93 : }
94 :
95 : // XInterface
96 : 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;
97 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
98 : virtual void SAL_CALL release() throw () SAL_OVERRIDE;
99 :
100 : // XInitialization
101 : 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;
102 : // XStatusListener
103 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 : // XToolbarController
105 : 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;
106 :
107 : private:
108 : //no default constructor
109 : ElementSelectorToolbarController(){}
110 :
111 : private:
112 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
113 : VclPtr< SelectorListBox > m_apSelectorListBox;
114 : };
115 :
116 : } //namespace chart
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|