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 .
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 <com/sun/star/uno/Sequence.hxx>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/frame/XDispatchRecorder.hpp>
39 struct SfxRequest_Impl
;
40 enum class SfxCallMode
: sal_uInt16
;
44 class SFX2_DLLPUBLIC SfxRequest
: public SfxHint
46 friend struct SfxRequest_Impl
;
50 SfxRequest_Impl
* pImp
;
54 SAL_DLLPRIVATE
void Record_Impl( SfxShell
&rSh
, const SfxSlot
&rSlot
,
55 com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchRecorder
> xRecorder
,
58 SAL_DLLPRIVATE
void Done_Impl( const SfxItemSet
*pSet
);
63 SfxRequest( SfxViewFrame
*, sal_uInt16 nSlotId
);
64 SfxRequest( sal_uInt16 nSlot
, SfxCallMode nCallMode
, SfxItemPool
&rPool
);
65 SfxRequest( const SfxSlot
* pSlot
, const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rArgs
,
66 SfxCallMode nCallMode
, SfxItemPool
&rPool
);
67 SfxRequest( sal_uInt16 nSlot
, SfxCallMode nCallMode
, const SfxAllItemSet
& rSfxArgs
);
68 SfxRequest( const SfxRequest
& rOrig
);
69 virtual ~SfxRequest();
71 sal_uInt16
GetSlot() const { return nSlot
; }
72 void SetSlot(sal_uInt16 nNewSlot
) { nSlot
= nNewSlot
; }
74 sal_uInt16
GetModifier() const;
75 void SetModifier( sal_uInt16 nModi
);
76 SAL_DLLPRIVATE
void SetInternalArgs_Impl( const SfxAllItemSet
& rArgs
);
77 SAL_DLLPRIVATE
const SfxItemSet
* GetInternalArgs_Impl() const;
78 const SfxItemSet
* GetArgs() const { return pArgs
; }
79 void SetArgs( const SfxAllItemSet
& rArgs
);
80 void AppendItem(const SfxPoolItem
&);
81 void RemoveItem( sal_uInt16 nSlotId
);
83 static const SfxPoolItem
* GetItem( const SfxItemSet
*, sal_uInt16 nSlotId
,
86 const SfxPoolItem
* GetArg( sal_uInt16 nSlotId
, bool bDeep
= false, TypeId aType
= 0 ) const;
88 void SetReturnValue(const SfxPoolItem
&);
89 const SfxPoolItem
* GetReturnValue() const;
91 static com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchRecorder
> GetMacroRecorder( SfxViewFrame
* pFrame
=NULL
);
92 static bool HasMacroRecorder( SfxViewFrame
* pFrame
=NULL
);
93 SfxCallMode
GetCallMode() const;
94 void AllowRecording( bool );
95 bool AllowsRecording() const;
97 bool IsSynchronCall() const;
98 void SetSynchronCall( bool bSynchron
);
101 void Done( bool bRemove
= false );
105 bool IsCancelled() const;
106 void Done(const SfxItemSet
&, bool bKeep
= true );
108 void ForgetAllArgs();
111 const SfxRequest
& operator=(const SfxRequest
&) SAL_DELETED_FUNCTION
;
116 #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \
117 const ItemType *pItem = static_cast<const ItemType*>( \
118 rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) ) )
119 #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \
120 const ItemType *pItem = static_cast<const ItemType*>( \
121 SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) )
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */