bump product version to 5.0.4.1
[LibreOffice.git] / sfx2 / source / control / request.cxx
blob140db1bcd919e631ce62b85d5ea257cb38ea03f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <com/sun/star/frame/DispatchStatement.hpp>
21 #include <com/sun/star/container/XIndexReplace.hpp>
22 #include <com/sun/star/beans/PropertyValue.hpp>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/util/URLTransformer.hpp>
26 #include <com/sun/star/util/XURLTransformer.hpp>
27 #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
28 #include <svl/itemiter.hxx>
30 #include <svl/itempool.hxx>
31 #include "itemdel.hxx"
33 #include <comphelper/processfactory.hxx>
35 #include <svl/smplhint.hxx>
37 #include <sfx2/request.hxx>
38 #include <sfx2/dispatch.hxx>
39 #include <sfx2/msg.hxx>
40 #include <sfx2/viewfrm.hxx>
41 #include <sfx2/objface.hxx>
42 #include <rtl/strbuf.hxx>
46 using namespace ::com::sun::star;
48 struct SfxRequest_Impl: public SfxListener
50 /* [Description]
52 Implementation structure of the <SfxRequest> class.
56 SfxRequest* pAnti; // Owner because of dying pool
57 OUString aTarget; // if possible from target object set by App
58 SfxItemPool* pPool; // ItemSet build with this pool
59 SfxPoolItem* pRetVal; // Return value belongs to itself
60 SfxShell* pShell; // run from this shell
61 const SfxSlot* pSlot; // executed Slot
62 sal_uInt16 nModifier; // which Modifier was pressed?
63 bool bDone; // at all executed
64 bool bIgnored; // Cancelled by the User
65 bool bCancelled; // no longer notify
66 SfxCallMode nCallMode; // Synch/Asynch/API/Record
67 bool bAllowRecording;
68 SfxAllItemSet* pInternalArgs;
69 SfxViewFrame* pViewFrame;
71 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder;
73 SfxRequest_Impl( SfxRequest *pOwner )
74 : pAnti( pOwner)
75 , pPool(0)
76 , pRetVal(0)
77 , pShell(0)
78 , pSlot(0)
79 , nModifier(0)
80 , bDone(false)
81 , bIgnored(false)
82 , bCancelled(false)
83 , nCallMode( SfxCallMode::SYNCHRON )
84 , bAllowRecording( false )
85 , pInternalArgs( 0 )
86 , pViewFrame(0)
88 virtual ~SfxRequest_Impl() { delete pInternalArgs; }
91 void SetPool( SfxItemPool *pNewPool );
92 virtual void Notify( SfxBroadcaster &rBC, const SfxHint &rHint ) SAL_OVERRIDE;
93 void Record( const uno::Sequence < beans::PropertyValue >& rArgs );
99 void SfxRequest_Impl::Notify( SfxBroadcaster&, const SfxHint &rHint )
101 const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
102 if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING )
103 pAnti->Cancel();
108 void SfxRequest_Impl::SetPool( SfxItemPool *pNewPool )
110 if ( pNewPool != pPool )
112 if ( pPool )
113 EndListening( pPool->BC() );
114 pPool = pNewPool;
115 if ( pNewPool )
116 StartListening( pNewPool->BC() );
123 SfxRequest::~SfxRequest()
125 // Leave out Done() marked requests with 'rem'
126 if ( pImp->xRecorder.is() && !pImp->bDone && !pImp->bIgnored )
127 pImp->Record( uno::Sequence < beans::PropertyValue >() );
129 // Clear object
130 delete pArgs;
131 if ( pImp->pRetVal )
132 DeleteItemOnIdle(pImp->pRetVal);
133 delete pImp;
138 SfxRequest::SfxRequest
140 const SfxRequest& rOrig
142 : SfxHint( rOrig ),
143 nSlot(rOrig.nSlot),
144 pArgs(rOrig.pArgs? new SfxAllItemSet(*rOrig.pArgs): 0),
145 pImp( new SfxRequest_Impl(this) )
147 pImp->bAllowRecording = rOrig.pImp->bAllowRecording;
148 pImp->bDone = false;
149 pImp->bIgnored = false;
150 pImp->pRetVal = 0;
151 pImp->pShell = 0;
152 pImp->pSlot = 0;
153 pImp->nCallMode = rOrig.pImp->nCallMode;
154 pImp->aTarget = rOrig.pImp->aTarget;
155 pImp->nModifier = rOrig.pImp->nModifier;
157 // deep copy needed !
158 pImp->pInternalArgs = (rOrig.pImp->pInternalArgs ? new SfxAllItemSet(*rOrig.pImp->pInternalArgs) : 0);
160 if ( pArgs )
161 pImp->SetPool( pArgs->GetPool() );
162 else
163 pImp->SetPool( rOrig.pImp->pPool );
168 SfxRequest::SfxRequest
170 SfxViewFrame* pViewFrame,
171 sal_uInt16 nSlotId
175 /* [Description]
177 With this constructor events can subsequently be recorded that are not run
178 across SfxDispatcher (eg from KeyInput() or mouse events). For this, a
179 SfxRequest instance is created by this constructor and then proceed
180 exactly as with a SfxRequest that in a <Slot-Execute-Method> is given as a
181 parameter.
184 : nSlot(nSlotId),
185 pArgs(0),
186 pImp( new SfxRequest_Impl(this) )
188 pImp->bDone = false;
189 pImp->bIgnored = false;
190 pImp->SetPool( &pViewFrame->GetPool() );
191 pImp->pRetVal = 0;
192 pImp->pShell = 0;
193 pImp->pSlot = 0;
194 pImp->nCallMode = SfxCallMode::SYNCHRON;
195 pImp->pViewFrame = pViewFrame;
196 if( pImp->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl( nSlotId, &pImp->pShell, &pImp->pSlot, true, true ) )
198 pImp->SetPool( &pImp->pShell->GetPool() );
199 pImp->xRecorder = SfxRequest::GetMacroRecorder( pViewFrame );
200 pImp->aTarget = pImp->pShell->GetName();
202 #ifdef DBG_UTIL
203 else
205 OStringBuffer aStr("Recording unsupported slot: ");
206 aStr.append(static_cast<sal_Int32>(pImp->pPool->GetSlotId(nSlotId)));
207 OSL_FAIL(aStr.getStr());
209 #endif
215 SfxRequest::SfxRequest
217 sal_uInt16 nSlotId, // executed <Slot-Id>
218 SfxCallMode nMode, // Synch/API/...
219 SfxItemPool& rPool // necessary for the SfxItemSet for parameters
222 // creates a SfxRequest without arguments
224 : nSlot(nSlotId),
225 pArgs(0),
226 pImp( new SfxRequest_Impl(this) )
228 pImp->bDone = false;
229 pImp->bIgnored = false;
230 pImp->SetPool( &rPool );
231 pImp->pRetVal = 0;
232 pImp->pShell = 0;
233 pImp->pSlot = 0;
234 pImp->nCallMode = nMode;
237 SfxRequest::SfxRequest
239 const SfxSlot* pSlot, // executed <Slot-Id>
240 const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs,
241 SfxCallMode nMode, // Synch/API/...
242 SfxItemPool& rPool // necessary for the SfxItemSet for parameters
244 : nSlot(pSlot->GetSlotId()),
245 pArgs(new SfxAllItemSet(rPool)),
246 pImp( new SfxRequest_Impl(this) )
248 pImp->bDone = false;
249 pImp->bIgnored = false;
250 pImp->SetPool( &rPool );
251 pImp->pRetVal = 0;
252 pImp->pShell = 0;
253 pImp->pSlot = 0;
254 pImp->nCallMode = nMode;
255 TransformParameters( nSlot, rArgs, *pArgs, pSlot );
260 SfxRequest::SfxRequest
262 sal_uInt16 nSlotId,
263 SfxCallMode nMode,
264 const SfxAllItemSet& rSfxArgs
267 // creates a SfxRequest with arguments
269 : nSlot(nSlotId),
270 pArgs(new SfxAllItemSet(rSfxArgs)),
271 pImp( new SfxRequest_Impl(this) )
273 pImp->bDone = false;
274 pImp->bIgnored = false;
275 pImp->SetPool( rSfxArgs.GetPool() );
276 pImp->pRetVal = 0;
277 pImp->pShell = 0;
278 pImp->pSlot = 0;
279 pImp->nCallMode = nMode;
283 SfxCallMode SfxRequest::GetCallMode() const
285 return pImp->nCallMode;
290 bool SfxRequest::IsSynchronCall() const
292 return SfxCallMode::SYNCHRON == ( SfxCallMode::SYNCHRON & pImp->nCallMode );
297 void SfxRequest::SetSynchronCall( bool bSynchron )
299 if ( bSynchron )
300 pImp->nCallMode |= SfxCallMode::SYNCHRON;
301 else
302 pImp->nCallMode &= ~SfxCallMode::SYNCHRON;
305 void SfxRequest::SetInternalArgs_Impl( const SfxAllItemSet& rArgs )
307 delete pImp->pInternalArgs;
308 pImp->pInternalArgs = new SfxAllItemSet( rArgs );
311 const SfxItemSet* SfxRequest::GetInternalArgs_Impl() const
313 return pImp->pInternalArgs;
319 void SfxRequest_Impl::Record
321 const uno::Sequence < beans::PropertyValue >& rArgs // current Parameter
324 /* [Description]
326 Internal helper method to create a repeatable description of the just
327 executed SfxRequest.
331 OUString aCommand(".uno:");
332 aCommand += OUString( pSlot->GetUnoName(), strlen( pSlot->GetUnoName() ), RTL_TEXTENCODING_UTF8 );
333 OUString aCmd( aCommand );
334 if(xRecorder.is())
336 uno::Reference< container::XIndexReplace > xReplace( xRecorder, uno::UNO_QUERY );
337 if ( xReplace.is() && aCmd == ".uno:InsertText" )
339 sal_Int32 nCount = xReplace->getCount();
340 if ( nCount )
342 frame::DispatchStatement aStatement;
343 uno::Any aElement = xReplace->getByIndex(nCount-1);
344 if ( (aElement >>= aStatement) && aStatement.aCommand == aCmd )
346 OUString aStr;
347 OUString aNew;
348 aStatement.aArgs[0].Value >>= aStr;
349 rArgs[0].Value >>= aNew;
350 aStr += aNew;
351 aStatement.aArgs[0].Value <<= aStr;
352 aElement <<= aStatement;
353 xReplace->replaceByIndex( nCount-1, aElement );
354 return;
359 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
361 uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext );
363 com::sun::star::util::URL aURL;
364 aURL.Complete = aCmd;
365 xTransform->parseStrict(aURL);
367 if (bDone)
368 xRecorder->recordDispatch(aURL,rArgs);
369 else
370 xRecorder->recordDispatchAsComment(aURL,rArgs);
376 void SfxRequest::Record_Impl
378 SfxShell& rSh, // the <SfxShell>, which has executed the Request
379 const SfxSlot& rSlot, // the <SfxSlot>, which has executed the Request
380 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder,
381 SfxViewFrame* pViewFrame
384 /* [Description]
386 This internal method marks the specified SfxMakro SfxRequest as recorded in
387 SfxMakro. Pointer to the parameters in Done() is used again, thus has to
388 still be alive.
392 pImp->pShell = &rSh;
393 pImp->pSlot = &rSlot;
394 pImp->xRecorder = xRecorder;
395 pImp->aTarget = rSh.GetName();
396 pImp->pViewFrame = pViewFrame;
401 void SfxRequest::SetArgs( const SfxAllItemSet& rArgs )
403 delete pArgs;
404 pArgs = new SfxAllItemSet(rArgs);
405 pImp->SetPool( pArgs->GetPool() );
410 void SfxRequest::AppendItem(const SfxPoolItem &rItem)
412 if(!pArgs)
413 pArgs = new SfxAllItemSet(*pImp->pPool);
414 pArgs->Put(rItem, rItem.Which());
419 void SfxRequest::RemoveItem( sal_uInt16 nID )
421 if (pArgs)
423 pArgs->ClearItem(nID);
424 if ( !pArgs->Count() )
425 DELETEZ(pArgs);
431 const SfxPoolItem* SfxRequest::GetArg
433 sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters
434 bool bDeep, // sal_False: do not search in the Parent-ItemSets
435 TypeId aType // != 0: RTTI check with Assertion
436 ) const
438 return GetItem( pArgs, nSlotId, bDeep, aType );
443 const SfxPoolItem* SfxRequest::GetItem
445 const SfxItemSet* pArgs,
446 sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters
447 bool bDeep, // sal_False: do not search in the Parent-ItemSets
448 TypeId aType // != 0: RTTI check with Assertion
451 /* [Description]
453 With this method the access to individual parameters in the SfxRequest is
454 simplified. In particular the type-examination (by Assertion) is performed,
455 whereby the application source code will be much clearer. In the product-
456 version is a 0 returned, if the found item is not of the specified class.
458 [Example]
460 void MyShell::Execute( SfxRequest &rReq )
462 switch ( rReq.GetSlot() )
464 case SID_MY:
467 // An Example on not using the macros
468 const SfxInt32Item *pPosItem = (const SfxUInt32Item*)
469 rReq.GetArg( SID_POS, sal_False, TYPE(SfxInt32Item) );
470 sal_uInt16 nPos = pPosItem ? pPosItem->GetValue() : 0;
472 // An Example on using the macros
473 SFX_REQUEST_ARG(rReq, pSizeItem, SfxInt32Item, SID_SIZE, sal_False);
474 sal_uInt16 nSize = pSizeItem ? pPosItem->GetValue() : 0;
485 if ( pArgs )
487 // Which may be converted to ID
488 sal_uInt16 nWhich = pArgs->GetPool()->GetWhich(nSlotId);
490 // Is the item set or available at bDeep == sal_True?
491 const SfxPoolItem *pItem = 0;
492 if ( ( bDeep ? SfxItemState::DEFAULT : SfxItemState::SET )
493 <= pArgs->GetItemState( nWhich, bDeep, &pItem ) )
495 // Compare type
496 if ( !pItem || pItem->IsA(aType) )
497 return pItem;
499 // Item of wrong type => Programming error
500 OSL_FAIL( "invalid argument type" );
504 // No Parameter, not found or wrong type
505 return 0;
510 void SfxRequest::SetReturnValue(const SfxPoolItem &rItem)
512 DBG_ASSERT(!pImp->pRetVal, "Set Return value multiple times?");
513 if(pImp->pRetVal)
514 delete pImp->pRetVal;
515 pImp->pRetVal = rItem.Clone();
520 const SfxPoolItem* SfxRequest::GetReturnValue() const
522 return pImp->pRetVal;
527 void SfxRequest::Done
529 const SfxItemSet& rSet, /* parameters passed on by the application,
530 that for example were asked for by the user
531 in a dialogue, 0 if no parameters have been
532 set */
534 bool bKeep /* true (default)
535 'rSet' is saved and GetArgs() queriable.
537 false
538 'rSet' is not copied (faster) */
541 /* [Description]
543 This method must be called in the <Execute-Method> of the <SfxSlot>s, which
544 has performed the SfxRequest when the execution actually took place. If
545 'Done()' is not called, then the SfxRequest is considered canceled.
547 Any return values are passed only when 'Done()' was called. Similar, when
548 recording a macro only true statements are generated if 'Done()' was
549 called; for SfxRequests that were not identified as such will instead
550 be commented out by inserting ('rem').
552 [Note]
554 'Done ()' is not called, for example when a dialoge started by the function
555 was canceled by the user or if the execution could not be performed due to
556 a wrong context (without use of separate <SfxShell>s). 'Done ()' will be
557 launched, when executing the function led to a regular error
558 (for example, file could not be opened).
562 Done_Impl( &rSet );
564 // Keep items if possible, so they can be queried by StarDraw.
565 if ( bKeep )
567 if ( !pArgs )
569 pArgs = new SfxAllItemSet( rSet );
570 pImp->SetPool( pArgs->GetPool() );
572 else
574 SfxItemIter aIter(rSet);
575 const SfxPoolItem* pItem = aIter.FirstItem();
576 while(pItem)
578 if(!IsInvalidItem(pItem))
579 pArgs->Put(*pItem,pItem->Which());
580 pItem = aIter.NextItem();
589 void SfxRequest::Done( bool bRelease )
590 // [<SfxRequest::Done(SfxItemSet&)>]
592 Done_Impl( pArgs );
593 if( bRelease )
594 DELETEZ( pArgs );
599 void SfxRequest::ForgetAllArgs()
601 DELETEZ( pArgs );
602 DELETEZ( pImp->pInternalArgs );
607 bool SfxRequest::IsCancelled() const
609 return pImp->bCancelled;
614 void SfxRequest::Cancel()
616 /* [Description]
618 Marks this request as no longer executable. For example, if called when
619 the target (more precisely, its pool) dies.
623 pImp->bCancelled = true;
624 pImp->SetPool( 0 );
625 DELETEZ( pArgs );
631 void SfxRequest::Ignore()
633 /* [Description]
635 If this method is called instead of <SfxRequest::Done()>, then this
636 request is not recorded.
638 [Example]
640 The selecting of tools in StarDraw should not be recorded, but the same
641 slots are to be used from the generation of the tools to the generated
642 objects. Thus can NoRecords not be specified, i.e. should not be recorded.
646 // Mark as actually executed
647 pImp->bIgnored = true;
652 void SfxRequest::Done_Impl
654 const SfxItemSet* pSet /* parameters passed on by the application,
655 that for example were asked for by the user
656 in a dialogue, 0 if no parameters have been
657 set */
661 /* [Description]
663 Internal method to mark SfxRequest with 'done' and to evaluate the
664 parameters in 'pSet' in case it is recorded.
668 // Mark as actually executed
669 pImp->bDone = true;
671 // not Recording
672 if ( !pImp->xRecorder.is() )
673 return;
675 // was running a different slot than requested (Delegation)
676 if ( nSlot != pImp->pSlot->GetSlotId() )
678 // Search Slot again
679 pImp->pSlot = pImp->pShell->GetInterface()->GetSlot(nSlot);
680 DBG_ASSERT( pImp->pSlot, "delegated SlotId not found" );
681 if ( !pImp->pSlot ) // playing it safe
682 return;
685 // recordable?
686 // new Recording uses UnoName!
687 if ( !pImp->pSlot->pUnoName )
689 OStringBuffer aStr("Recording not exported slot: ");
690 aStr.append(static_cast<sal_Int32>(pImp->pSlot->GetSlotId()));
691 OSL_FAIL(aStr.getStr());
694 if ( !pImp->pSlot->pUnoName ) // playing it safe
695 return;
697 // often required values
698 SfxItemPool &rPool = pImp->pShell->GetPool();
700 // Property-Slot?
701 if ( !pImp->pSlot->IsMode(SfxSlotMode::METHOD) )
703 // get the property as SfxPoolItem
704 const SfxPoolItem *pItem;
705 sal_uInt16 nWhich = rPool.GetWhich(pImp->pSlot->GetSlotId());
706 SfxItemState eState = pSet ? pSet->GetItemState( nWhich, false, &pItem ) : SfxItemState::UNKNOWN;
707 #ifdef DBG_UTIL
708 if ( SfxItemState::SET != eState )
710 OStringBuffer aStr("Recording property not available: ");
711 aStr.append(static_cast<sal_Int32>(pImp->pSlot->GetSlotId()));
712 OSL_FAIL(aStr.getStr());
714 #endif
715 uno::Sequence < beans::PropertyValue > aSeq;
716 if ( eState == SfxItemState::SET )
717 TransformItems( pImp->pSlot->GetSlotId(), *pSet, aSeq, pImp->pSlot );
718 pImp->Record( aSeq );
721 // record everything in a single statement?
722 else if ( pImp->pSlot->IsMode(SfxSlotMode::RECORDPERSET) )
724 uno::Sequence < beans::PropertyValue > aSeq;
725 if ( pSet )
726 TransformItems( pImp->pSlot->GetSlotId(), *pSet, aSeq, pImp->pSlot );
727 pImp->Record( aSeq );
730 // record each item as a single statement
731 else if ( pImp->pSlot->IsMode(SfxSlotMode::RECORDPERITEM) )
733 if ( pSet )
735 // iterate over Items
736 SfxItemIter aIter(*pSet);
737 for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() )
739 // to determine the slot ID for the individual item
740 sal_uInt16 nSlotId = rPool.GetSlotId( pItem->Which() );
741 if ( nSlotId == nSlot )
743 // play it safe; repair the wrong flags
744 OSL_FAIL( "recursion RecordPerItem - use RecordPerSet!" );
745 SfxSlot *pSlot = const_cast<SfxSlot*>(pImp->pSlot);
746 pSlot->nFlags &= ~(SfxSlotMode::RECORDPERITEM);
747 pSlot->nFlags &= SfxSlotMode::RECORDPERSET;
750 // Record a Sub-Request
751 SfxRequest aReq( pImp->pViewFrame, nSlotId );
752 if ( aReq.pImp->pSlot )
753 aReq.AppendItem( *pItem );
754 aReq.Done();
757 else
759 //HACK(think about this again)
760 pImp->Record( uno::Sequence < beans::PropertyValue >() );
767 bool SfxRequest::IsDone() const
769 /* [Description]
771 With this method it can be queried whether the SfxRequest was actually
772 executed or not. If a SfxRequest was not executed, then this is for example
773 because it was canceled by the user or the context for this request was
774 wrong, this was not implemented on a separate <SfxShell>.
776 SfxRequest instances that return false will not be recorded.
778 [Cross-reference]
780 <SfxRequest::Done(const SfxItemSet&)>
781 <SfxRequest::Done()>
785 return pImp->bDone;
790 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder( SfxViewFrame* pView )
792 /* [Description]
794 This recorder is an attempt for dispatch () to get calls from the Frame.
795 This is then available through a property by a supplier but only when
796 recording was turned on.
798 (See also SfxViewFrame::MiscExec_Impl() and SID_RECORDING)
802 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder;
804 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet(
805 (pView ? pView : SfxViewFrame::Current())->GetFrame().GetFrameInterface(),
806 com::sun::star::uno::UNO_QUERY);
808 if(xSet.is())
810 com::sun::star::uno::Any aProp = xSet->getPropertyValue("DispatchRecorderSupplier");
811 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorderSupplier > xSupplier;
812 aProp >>= xSupplier;
813 if(xSupplier.is())
814 xRecorder = xSupplier->getDispatchRecorder();
817 return xRecorder;
820 bool SfxRequest::HasMacroRecorder( SfxViewFrame* pView )
822 return GetMacroRecorder( pView ).is();
828 bool SfxRequest::IsAPI() const
830 /* [Description]
832 Returns true if this SfxRequest was generated by an API (for example BASIC),
833 otherwise false.
837 return SfxCallMode::API == ( SfxCallMode::API & pImp->nCallMode );
841 void SfxRequest::SetModifier( sal_uInt16 nModi )
843 pImp->nModifier = nModi;
847 sal_uInt16 SfxRequest::GetModifier() const
849 return pImp->nModifier;
854 void SfxRequest::AllowRecording( bool bSet )
856 pImp->bAllowRecording = bSet;
859 bool SfxRequest::AllowsRecording() const
861 bool bAllow = pImp->bAllowRecording;
862 if( !bAllow )
863 bAllow = ( SfxCallMode::API != ( SfxCallMode::API & pImp->nCallMode ) ) &&
864 ( SfxCallMode::RECORD == ( SfxCallMode::RECORD & pImp->nCallMode ) );
865 return bAllow;
868 void SfxRequest::ReleaseArgs()
870 DELETEZ( pArgs );
871 DELETEZ( pImp->pInternalArgs );
874 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */