Branch data 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 __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_
21 : : #define __FRAMEWORK_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 : :
31 : : #include <vcl/toolbox.hxx>
32 : :
33 : : namespace framework
34 : : {
35 : :
36 [ + - ][ + - ]: 4 : struct ExecuteInfo
37 : : {
38 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
39 : : ::com::sun::star::util::URL aTargetURL;
40 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
41 : : };
42 : :
43 [ # # ][ # # ]: 0 : struct NotifyInfo
44 : : {
45 : : ::rtl::OUString aEventName;
46 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XControlNotificationListener > xNotifyListener;
47 : : ::com::sun::star::util::URL aSourceURL;
48 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aInfoSeq;
49 : : };
50 : :
51 : : class ToolBar;
52 : :
53 : : class ComplexToolbarController : public svt::ToolboxController
54 : :
55 : : {
56 : : public:
57 : : ComplexToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
58 : : const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
59 : : ToolBox* pToolBar,
60 : : sal_uInt16 nID,
61 : : const rtl::OUString& aCommand );
62 : : virtual ~ComplexToolbarController();
63 : :
64 : : // XComponent
65 : : virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
66 : :
67 : : // XToolbarController
68 : : virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
69 : :
70 : : // XStatusListener
71 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
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 Window* pWindow );
78 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommand( const rtl::OUString& aCommand ) const;
79 : : void addNotifyInfo( const ::rtl::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 ::rtl::OUString& aText );
89 : :
90 : : ToolBox* m_pToolbar;
91 : : sal_uInt16 m_nID;
92 : : sal_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 // __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|