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 _SFXREQUEST_HXX
20 : #define _SFXREQUEST_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 String;
39 : class SfxViewFrame;
40 : struct SfxRequest_Impl;
41 :
42 : //==================================================================
43 :
44 : class SFX2_DLLPUBLIC SfxRequest: public SfxHint
45 : {
46 : friend struct SfxRequest_Impl;
47 :
48 : sal_uInt16 nSlot;
49 : SfxAllItemSet* pArgs;
50 : SfxRequest_Impl* pImp;
51 :
52 : //---------------------------------------------------------------------
53 : public:
54 : SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
55 : com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder,
56 : SfxViewFrame* );
57 : private:
58 : SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
59 :
60 : //---------------------------------------------------------------------
61 :
62 : public:
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 );
69 : ~SfxRequest();
70 :
71 3811 : sal_uInt16 GetSlot() const { return nSlot; }
72 26 : void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
73 :
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 410 : const SfxItemSet* GetArgs() const { return pArgs; }
79 : void SetArgs( const SfxAllItemSet& rArgs );
80 : void AppendItem(const SfxPoolItem &);
81 : void RemoveItem( sal_uInt16 nSlotId );
82 :
83 : static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId,
84 : bool bDeep = false,
85 : TypeId aType = 0 );
86 : const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const;
87 : void ReleaseArgs();
88 : void SetReturnValue(const SfxPoolItem &);
89 : const SfxPoolItem* GetReturnValue() const;
90 :
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 );
99 :
100 : sal_Bool IsDone() const;
101 : void Done( sal_Bool bRemove = sal_False );
102 :
103 : void Ignore();
104 : void Cancel();
105 : sal_Bool IsCancelled() const;
106 : void Done(const SfxItemSet &, bool bKeep = true );
107 :
108 : void ForgetAllArgs();
109 :
110 : private:
111 : const SfxRequest& operator=(const SfxRequest &); // n.i.!!
112 : };
113 :
114 : //------------------------------------------------------------------------
115 :
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) )
122 :
123 : #endif
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|