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 .
20 #ifndef INCLUDED_EXAMPLES_COMPLEXTOOLBARCONTROLS_LISTENERHELPER_H
21 #define INCLUDED_EXAMPLES_COMPLEXTOOLBARCONTROLS_LISTENERHELPER_H
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <com/sun/star/frame/XStatusListener.hpp>
28 #include <com/sun/star/frame/XDispatch.hpp>
30 #include <rtl/ustring.hxx>
31 #include <cppuhelper/implbase1.hxx>
33 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> > StatusListeners
;
35 typedef std::map
< ::rtl::OUString
, StatusListeners
> ListenerMap
;
37 // For every frame there is *one* Dispatch object for all possible commands
38 // this struct contains an array of listeners for every supported command
39 // these arrays are accessed by a std::map (with the command string as index)
42 ListenerMap aContainer
;
43 ::com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> xDispatch
;
44 ::com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> xFrame
;
47 typedef std::vector
< ListenerItem
> AllListeners
;
53 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
54 const com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> xControl
,
55 const ::rtl::OUString
& aCommand
);
57 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
58 const com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> xControl
,
59 const ::rtl::OUString
& aCommand
);
61 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
62 const ::rtl::OUString
& aCommand
,
63 com::sun::star::frame::FeatureStateEvent
& rEvent
);
64 com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> GetDispatch(
65 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
66 const ::rtl::OUString
& aCommand
);
68 const com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> xDispatch
,
69 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
70 const ::rtl::OUString
& aCommand
);
73 class ListenerItemEventListener
: public cppu::WeakImplHelper1
< ::com::sun::star::lang::XEventListener
>
75 ::com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> mxFrame
;
77 ListenerItemEventListener( const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
)
80 virtual void SAL_CALL
disposing( const com::sun::star::lang::EventObject
& aEvent
) throw (com::sun::star::uno::RuntimeException
);
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */