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