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 _SFXREQUEST_HXX
20 #define _SFXREQUEST_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>
40 struct SfxRequest_Impl
;
42 //==================================================================
44 class SFX2_DLLPUBLIC SfxRequest
: public SfxHint
46 friend struct SfxRequest_Impl
;
50 SfxRequest_Impl
* pImp
;
52 //---------------------------------------------------------------------
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
);
60 //---------------------------------------------------------------------
63 SfxRequest( SfxViewFrame
*, sal_uInt16 nSlotId
);
64 SfxRequest( sal_uInt16 nSlot
, sal_uInt16 nCallMode
, SfxItemPool
&rPool
);
65 SfxRequest( const SfxSlot
* pSlot
, const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rArgs
,
66 sal_uInt16 nCallMode
, SfxItemPool
&rPool
);
67 SfxRequest( sal_uInt16 nSlot
, sal_uInt16 nCallMode
, const SfxAllItemSet
& rSfxArgs
);
68 SfxRequest( const SfxRequest
& rOrig
);
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 sal_Bool
HasMacroRecorder( SfxViewFrame
* pFrame
=NULL
);
93 sal_uInt16
GetCallMode() const;
94 void AllowRecording( sal_Bool
);
95 sal_Bool
AllowsRecording() const;
96 sal_Bool
IsAPI() const;
97 sal_Bool
IsSynchronCall() const;
98 void SetSynchronCall( sal_Bool bSynchron
);
100 sal_Bool
IsDone() const;
101 void Done( sal_Bool bRemove
= sal_False
);
105 sal_Bool
IsCancelled() const;
106 void Done(const SfxItemSet
&, bool bKeep
= true );
108 void ForgetAllArgs();
111 const SfxRequest
& operator=(const SfxRequest
&); // n.i.!!
114 //------------------------------------------------------------------------
116 #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \
117 const ItemType *pItem = (const ItemType*) \
118 rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) )
119 #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \
120 const ItemType *pItem = (const ItemType*) \
121 SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) )
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */