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 :
20 : #ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX
21 : #define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX
22 :
23 : #include <com/sun/star/util/URL.hpp>
24 : #include <com/sun/star/beans/NamedValue.hpp>
25 : #include <com/sun/star/frame/XDispatch.hpp>
26 : #include <com/sun/star/frame/ControlCommand.hpp>
27 : #include <com/sun/star/frame/XControlNotificationListener.hpp>
28 :
29 : #include <svtools/toolboxcontroller.hxx>
30 : #include <tools/link.hxx>
31 :
32 : class ToolBox;
33 : namespace vcl { class Window; }
34 :
35 : namespace framework
36 : {
37 :
38 8 : struct ExecuteInfo
39 : {
40 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
41 : ::com::sun::star::util::URL aTargetURL;
42 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
43 : };
44 :
45 0 : struct NotifyInfo
46 : {
47 : OUString aEventName;
48 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XControlNotificationListener > xNotifyListener;
49 : ::com::sun::star::util::URL aSourceURL;
50 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aInfoSeq;
51 : };
52 :
53 : class ComplexToolbarController : public svt::ToolboxController
54 :
55 : {
56 : public:
57 : ComplexToolbarController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
58 : const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
59 : ToolBox* pToolBar,
60 : sal_uInt16 nID,
61 : const OUString& aCommand );
62 : virtual ~ComplexToolbarController();
63 :
64 : // XComponent
65 : virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
66 :
67 : // XToolbarController
68 : virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 :
70 : // XStatusListener
71 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
72 :
73 : DECL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo* );
74 : DECL_STATIC_LINK( ComplexToolbarController, Notify_Impl, NotifyInfo* );
75 :
76 : protected:
77 : static sal_Int32 getFontSizePixel( const vcl::Window* pWindow );
78 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommand( const OUString& aCommand ) const;
79 : void addNotifyInfo( const OUString& aEventName,
80 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& xDispatch,
81 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rInfo );
82 :
83 : virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ) = 0;
84 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
85 : const ::com::sun::star::util::URL& getInitializedURL();
86 : void notifyFocusGet();
87 : void notifyFocusLost();
88 : void notifyTextChanged( const OUString& aText );
89 :
90 : ToolBox* m_pToolbar;
91 : sal_uInt16 m_nID;
92 : bool m_bMadeInvisible;
93 : mutable ::com::sun::star::util::URL m_aURL;
94 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
95 : };
96 :
97 : }
98 :
99 : #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|