1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SFXREQUEST_HXX 24cdf0e10cSrcweir #define _SFXREQUEST_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "sal/config.h" 27cdf0e10cSrcweir #include "sfx2/dllapi.h" 28cdf0e10cSrcweir #include "sal/types.h" 29cdf0e10cSrcweir #include <svl/itemset.hxx> 30cdf0e10cSrcweir #include <svl/hint.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 33cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 34cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchRecorder.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir class SfxMacro; 37cdf0e10cSrcweir class SfxPoolItem; 38cdf0e10cSrcweir class SfxAllItemSet; 39cdf0e10cSrcweir class SfxItemSet; 40cdf0e10cSrcweir class SfxItemPool; 41cdf0e10cSrcweir class SfxShell; 42cdf0e10cSrcweir class SfxSlot; 43cdf0e10cSrcweir class SfxMacroStatement; 44cdf0e10cSrcweir class SfxArguments; 45cdf0e10cSrcweir class String; 46cdf0e10cSrcweir class SfxViewFrame; 47cdf0e10cSrcweir struct SfxRequest_Impl; 48cdf0e10cSrcweir 49cdf0e10cSrcweir //================================================================== 50cdf0e10cSrcweir 51cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxRequest: public SfxHint 52cdf0e10cSrcweir { 53cdf0e10cSrcweir friend struct SfxRequest_Impl; 54cdf0e10cSrcweir 55cdf0e10cSrcweir sal_uInt16 nSlot; 56cdf0e10cSrcweir SfxAllItemSet* pArgs; 57cdf0e10cSrcweir SfxRequest_Impl* pImp; 58cdf0e10cSrcweir 59cdf0e10cSrcweir //--------------------------------------------------------------------- 60cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot, 63cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, 64cdf0e10cSrcweir SfxViewFrame* ); 65cdf0e10cSrcweir private: 66cdf0e10cSrcweir SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir //#endif 69cdf0e10cSrcweir //--------------------------------------------------------------------- 70cdf0e10cSrcweir 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId ); 73cdf0e10cSrcweir SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, SfxItemPool &rPool ); 74cdf0e10cSrcweir SfxRequest( const SfxSlot* pSlot, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs, 75cdf0e10cSrcweir sal_uInt16 nCallMode, SfxItemPool &rPool ); 76cdf0e10cSrcweir SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, const SfxAllItemSet& rSfxArgs ); 77cdf0e10cSrcweir SfxRequest( const SfxRequest& rOrig ); 78cdf0e10cSrcweir ~SfxRequest(); 79cdf0e10cSrcweir GetSlot() const80cdf0e10cSrcweir sal_uInt16 GetSlot() const { return nSlot; } SetSlot(sal_uInt16 nNewSlot)81cdf0e10cSrcweir void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; } 82cdf0e10cSrcweir 83cdf0e10cSrcweir sal_uInt16 GetModifier() const; 84cdf0e10cSrcweir void SetModifier( sal_uInt16 nModi ); 85cdf0e10cSrcweir SAL_DLLPRIVATE void SetInternalArgs_Impl( const SfxAllItemSet& rArgs ); 86cdf0e10cSrcweir SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const; GetArgs() const87cdf0e10cSrcweir const SfxItemSet* GetArgs() const { return pArgs; } 88cdf0e10cSrcweir void SetArgs( const SfxAllItemSet& rArgs ); 89cdf0e10cSrcweir void AppendItem(const SfxPoolItem &); 90cdf0e10cSrcweir void RemoveItem( sal_uInt16 nSlotId ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId, 93cdf0e10cSrcweir bool bDeep = false, 94cdf0e10cSrcweir TypeId aType = 0 ); 95cdf0e10cSrcweir const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const; 96cdf0e10cSrcweir void ReleaseArgs(); 97cdf0e10cSrcweir void SetReturnValue(const SfxPoolItem &); 98cdf0e10cSrcweir const SfxPoolItem* GetReturnValue() const; 99cdf0e10cSrcweir 100cdf0e10cSrcweir static SfxMacro* GetRecordingMacro(); 101cdf0e10cSrcweir static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL ); 102cdf0e10cSrcweir static sal_Bool HasMacroRecorder( SfxViewFrame* pFrame=NULL ); 103cdf0e10cSrcweir sal_uInt16 GetCallMode() const; 104cdf0e10cSrcweir bool IsRecording() const; 105cdf0e10cSrcweir void AllowRecording( sal_Bool ); 106cdf0e10cSrcweir sal_Bool AllowsRecording() const; 107cdf0e10cSrcweir sal_Bool IsAPI() const; 108cdf0e10cSrcweir sal_Bool IsSynchronCall() const; 109cdf0e10cSrcweir void SetSynchronCall( sal_Bool bSynchron ); 110cdf0e10cSrcweir void SetTarget( const String &rTarget ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir sal_Bool IsDone() const; 113cdf0e10cSrcweir void Done( sal_Bool bRemove = sal_False ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void Ignore(); 116cdf0e10cSrcweir void Cancel(); 117cdf0e10cSrcweir sal_Bool IsCancelled() const; 118cdf0e10cSrcweir void Done(const SfxItemSet &, bool bKeep = true ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir void ForgetAllArgs(); 121cdf0e10cSrcweir 122cdf0e10cSrcweir private: 123cdf0e10cSrcweir const SfxRequest& operator=(const SfxRequest &); // n.i.!! 124cdf0e10cSrcweir }; 125cdf0e10cSrcweir 126cdf0e10cSrcweir //------------------------------------------------------------------------ 127cdf0e10cSrcweir 128cdf0e10cSrcweir #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \ 129cdf0e10cSrcweir const ItemType *pItem = (const ItemType*) \ 130cdf0e10cSrcweir rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) ) 131cdf0e10cSrcweir #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \ 132cdf0e10cSrcweir const ItemType *pItem = (const ItemType*) \ 133cdf0e10cSrcweir SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) 134cdf0e10cSrcweir 135cdf0e10cSrcweir #endif 136