lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / sfx2 / request.hxx
blob90058a5b1f7fcb5100469784980b402c9dd21167
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SFX2_REQUEST_HXX
20 #define INCLUDED_SFX2_REQUEST_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sal/types.h>
25 #include <svl/itemset.hxx>
26 #include <svl/hint.hxx>
28 #include <memory>
30 class SfxPoolItem;
31 class SfxItemPool;
32 class SfxShell;
33 class SfxSlot;
34 class SfxViewFrame;
35 struct SfxRequest_Impl;
36 enum class SfxCallMode : sal_uInt16;
38 namespace com::sun::star::beans { struct PropertyValue; }
39 namespace com::sun::star::frame { class XDispatchRecorder; }
40 namespace com::sun::star::uno { template <class E> class Sequence; }
41 namespace vcl { class Window; }
42 namespace weld { class Window; }
44 class SFX2_DLLPUBLIC SfxRequest final : public SfxHint
46 friend struct SfxRequest_Impl;
48 sal_uInt16 nSlot;
49 std::unique_ptr<SfxAllItemSet> pArgs;
50 std::unique_ptr< SfxRequest_Impl > pImpl;
52 public:
53 SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
54 const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder,
55 SfxViewFrame* );
56 private:
57 SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
59 public:
60 SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId );
61 SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, SfxItemPool &rPool );
62 SfxRequest( const SfxSlot* pSlot, const css::uno::Sequence < css::beans::PropertyValue >& rArgs,
63 SfxCallMode nCallMode, SfxItemPool &rPool );
64 SfxRequest(sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs);
65 SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs );
66 SfxRequest( const SfxRequest& rOrig );
67 virtual ~SfxRequest() override;
69 sal_uInt16 GetSlot() const { return nSlot; }
70 void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
72 sal_uInt16 GetModifier() const;
73 void SetModifier( sal_uInt16 nModi );
74 void SetInternalArgs_Impl( const SfxAllItemSet& rArgs );
75 SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const;
76 const SfxItemSet* GetArgs() const { return pArgs.get(); }
77 void SetArgs( const SfxAllItemSet& rArgs );
78 void AppendItem(const SfxPoolItem &);
79 void RemoveItem( sal_uInt16 nSlotId );
81 /** Templatized access to the individual parameters of the SfxRequest.
83 Use like: const SfxInt32Item *pPosItem = rReq.GetArg<SfxInt32Item>(SID_POS);
85 template<class T> const T* GetArg(sal_uInt16 nSlotId) const
87 if (pArgs)
88 return pArgs->GetItem<T>(nSlotId, false);
90 return nullptr;
93 void ReleaseArgs();
94 void SetReturnValue(const SfxPoolItem &);
95 const SfxPoolItem* GetReturnValue() const;
97 static css::uno::Reference< css::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame const * pFrame );
98 static bool HasMacroRecorder( SfxViewFrame const * pFrame );
99 SfxCallMode GetCallMode() const;
100 void AllowRecording( bool );
101 bool AllowsRecording() const;
102 bool IsAPI() const;
103 bool IsSynchronCall() const;
104 void SetSynchronCall( bool bSynchron );
106 bool IsDone() const;
107 void Done( bool bRemove = false );
109 void Ignore();
110 void Cancel();
111 bool IsCancelled() const;
112 void Done(const SfxItemSet &);
114 void ForgetAllArgs();
116 /** Return the window that should be used as the parent for any dialogs this request creates
118 vcl::Window* GetFrameWindow() const;
119 weld::Window* GetFrameWeld() const;
120 private:
121 const SfxRequest& operator=(const SfxRequest &) = delete;
124 #endif
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */