Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SFX2_REQUEST_HXX
20 : #define INCLUDED_SFX2_REQUEST_HXX
21 :
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>
27 :
28 : #include <com/sun/star/uno/Sequence.hxx>
29 : #include <com/sun/star/beans/PropertyValue.hpp>
30 : #include <com/sun/star/frame/XDispatchRecorder.hpp>
31 :
32 : class SfxPoolItem;
33 : class SfxAllItemSet;
34 : class SfxItemSet;
35 : class SfxItemPool;
36 : class SfxShell;
37 : class SfxSlot;
38 : class SfxViewFrame;
39 : struct SfxRequest_Impl;
40 :
41 :
42 :
43 : class SFX2_DLLPUBLIC SfxRequest: public SfxHint
44 : {
45 : friend struct SfxRequest_Impl;
46 :
47 : sal_uInt16 nSlot;
48 : SfxAllItemSet* pArgs;
49 : SfxRequest_Impl* pImp;
50 :
51 :
52 : public:
53 : SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
54 : com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder,
55 : SfxViewFrame* );
56 : private:
57 : SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
58 :
59 :
60 :
61 : public:
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 );
68 : virtual ~SfxRequest();
69 :
70 0 : sal_uInt16 GetSlot() const { return nSlot; }
71 0 : void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
72 :
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 0 : const SfxItemSet* GetArgs() const { return pArgs; }
78 : void SetArgs( const SfxAllItemSet& rArgs );
79 : void AppendItem(const SfxPoolItem &);
80 : void RemoveItem( sal_uInt16 nSlotId );
81 :
82 : static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId,
83 : bool bDeep = false,
84 : TypeId aType = 0 );
85 : const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const;
86 : void ReleaseArgs();
87 : void SetReturnValue(const SfxPoolItem &);
88 : const SfxPoolItem* GetReturnValue() const;
89 :
90 : static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL );
91 : static bool HasMacroRecorder( SfxViewFrame* pFrame=NULL );
92 : sal_uInt16 GetCallMode() const;
93 : void AllowRecording( bool );
94 : bool AllowsRecording() const;
95 : bool IsAPI() const;
96 : bool IsSynchronCall() const;
97 : void SetSynchronCall( bool bSynchron );
98 :
99 : bool IsDone() const;
100 : void Done( bool bRemove = false );
101 :
102 : void Ignore();
103 : void Cancel();
104 : bool IsCancelled() const;
105 : void Done(const SfxItemSet &, bool bKeep = true );
106 :
107 : void ForgetAllArgs();
108 :
109 : private:
110 : const SfxRequest& operator=(const SfxRequest &); // n.i.!!
111 : };
112 :
113 :
114 :
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) )
121 :
122 : #endif
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|