1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
22 #include "ObjectHierarchy.hxx"
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <cppuhelper/implbase1.hxx>
25 #include <svtools/toolboxcontroller.hxx>
27 #include <vcl/lstbox.hxx>
28 #include <cppuhelper/weakref.hxx>
30 #include <boost/scoped_ptr.hpp>
35 struct ListBoxEntryData
38 ObjectHierarchy::tOID OID
;
39 sal_Int32 nHierarchyDepth
;
41 ListBoxEntryData() : nHierarchyDepth(0)
46 class SelectorListBox
: public ListBox
49 SelectorListBox( vcl::Window
* pParent
, WinBits nStyle
);
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
;
55 void ReleaseFocus_Impl();
57 void SetChartController( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
>& xChartController
);
58 void UpdateChartElementsListAndSelection();
61 ::com::sun::star::uno::WeakReference
<
62 ::com::sun::star::frame::XController
> m_xChartController
;
64 ::std::vector
< ListBoxEntryData
> m_aEntries
;
69 typedef ::cppu::ImplHelper1
< ::com::sun::star::lang::XServiceInfo
> ElementSelectorToolbarController_BASE
;
71 class ElementSelectorToolbarController
: public ::svt::ToolboxController
72 , ElementSelectorToolbarController_BASE
75 ElementSelectorToolbarController( ::com::sun::star::uno::Reference
<
76 ::com::sun::star::uno::XComponentContext
> const & xContext
);
77 virtual ~ElementSelectorToolbarController();
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
;
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
)
92 return (::cppu::OWeakObject
*)new ElementSelectorToolbarController( xContext
);
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
;
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
;
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
;
108 //no default constructor
109 ElementSelectorToolbarController(){}
112 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xCC
;
113 VclPtr
< SelectorListBox
> m_apSelectorListBox
;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */