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
;
41 //==================================================================
43 class SFX2_DLLPUBLIC SfxRequest
: public SfxHint
45 friend struct SfxRequest_Impl
;
49 SfxRequest_Impl
* pImp
;
51 //---------------------------------------------------------------------
53 SAL_DLLPRIVATE
void Record_Impl( SfxShell
&rSh
, const SfxSlot
&rSlot
,
54 com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchRecorder
> xRecorder
,
57 SAL_DLLPRIVATE
void Done_Impl( const SfxItemSet
*pSet
);
59 //---------------------------------------------------------------------
62 SfxRequest( SfxViewFrame
*, sal_uInt16 nSlotId
);
63 SfxRequest( sal_uInt16 nSlot
, sal_uInt16 nCallMode
, SfxItemPool
&rPool
);
64 SfxRequest( const SfxSlot
* pSlot
, const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rArgs
,
65 sal_uInt16 nCallMode
, SfxItemPool
&rPool
);
66 SfxRequest( sal_uInt16 nSlot
, sal_uInt16 nCallMode
, const SfxAllItemSet
& rSfxArgs
);
67 SfxRequest( const SfxRequest
& rOrig
);
70 sal_uInt16
GetSlot() const { return nSlot
; }
71 void SetSlot(sal_uInt16 nNewSlot
) { nSlot
= nNewSlot
; }
73 sal_uInt16
GetModifier() const;
74 void SetModifier( sal_uInt16 nModi
);
75 SAL_DLLPRIVATE
void SetInternalArgs_Impl( const SfxAllItemSet
& rArgs
);
76 SAL_DLLPRIVATE
const SfxItemSet
* GetInternalArgs_Impl() const;
77 const SfxItemSet
* GetArgs() const { return pArgs
; }
78 void SetArgs( const SfxAllItemSet
& rArgs
);
79 void AppendItem(const SfxPoolItem
&);
80 void RemoveItem( sal_uInt16 nSlotId
);
82 static const SfxPoolItem
* GetItem( const SfxItemSet
*, sal_uInt16 nSlotId
,
85 const SfxPoolItem
* GetArg( sal_uInt16 nSlotId
, bool bDeep
= false, TypeId aType
= 0 ) const;
87 void SetReturnValue(const SfxPoolItem
&);
88 const SfxPoolItem
* GetReturnValue() const;
90 static com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchRecorder
> GetMacroRecorder( SfxViewFrame
* pFrame
=NULL
);
91 static sal_Bool
HasMacroRecorder( SfxViewFrame
* pFrame
=NULL
);
92 sal_uInt16
GetCallMode() const;
93 void AllowRecording( sal_Bool
);
94 sal_Bool
AllowsRecording() const;
95 sal_Bool
IsAPI() const;
96 sal_Bool
IsSynchronCall() const;
97 void SetSynchronCall( sal_Bool bSynchron
);
99 sal_Bool
IsDone() const;
100 void Done( sal_Bool bRemove
= sal_False
);
104 sal_Bool
IsCancelled() const;
105 void Done(const SfxItemSet
&, bool bKeep
= true );
107 void ForgetAllArgs();
110 const SfxRequest
& operator=(const SfxRequest
&); // n.i.!!
113 //------------------------------------------------------------------------
115 #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \
116 const ItemType *pItem = (const ItemType*) \
117 rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) )
118 #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \
119 const ItemType *pItem = (const ItemType*) \
120 SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) )
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */