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 .
23 #include <com/sun/star/frame/XFrame.hpp>
24 #include <com/sun/star/frame/XStatusListener.hpp>
25 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <rtl/ustring.hxx>
28 #include <cppuhelper/implbase1.hxx>
30 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> > StatusListeners
;
32 typedef std::map
< ::rtl::OUString
, StatusListeners
> ListenerMap
;
34 // For every frame there is *one* Dispatch object for all possible commands
35 // this struct contains an array of listeners for every supported command
36 // these arrays are accessed by a std::map (with the command string as index)
39 ListenerMap aContainer
;
40 ::com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> xDispatch
;
41 ::com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> xFrame
;
44 typedef std::vector
< ListenerItem
> AllListeners
;
50 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
51 const com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> xControl
,
52 const ::rtl::OUString
& aCommand
);
54 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
55 const com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> xControl
,
56 const ::rtl::OUString
& aCommand
);
58 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
59 const ::rtl::OUString
& aCommand
,
60 com::sun::star::frame::FeatureStateEvent
& rEvent
);
61 com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> GetDispatch(
62 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
63 const ::rtl::OUString
& aCommand
);
65 const com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> xDispatch
,
66 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
,
67 const ::rtl::OUString
& aCommand
);
70 class ListenerItemEventListener
: public cppu::WeakImplHelper1
< ::com::sun::star::lang::XEventListener
>
72 ::com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> mxFrame
;
74 ListenerItemEventListener( const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
)
77 virtual void SAL_CALL
disposing( const com::sun::star::lang::EventObject
& aEvent
) throw (com::sun::star::uno::RuntimeException
);
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */