diff options
author | jp <jp@openoffice.org> | 2001-04-30 15:00:13 +0000 |
---|---|---|
committer | jp <jp@openoffice.org> | 2001-04-30 15:00:13 +0000 |
commit | 66fb14d5ec4fdfb39737c24ff05a0e7203f05111 (patch) | |
tree | fc0a937c6f2e7c5249dfec2f66c7b9c2c16938c3 /sw/source/ui/shells/basesh.cxx | |
parent | 0505cb4db9cbb0aa839b91a4976f27e741a748b1 (diff) |
use Clipboard state listener instead of polling
Diffstat (limited to 'sw/source/ui/shells/basesh.cxx')
-rw-r--r-- | sw/source/ui/shells/basesh.cxx | 72 |
1 files changed, 32 insertions, 40 deletions
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 059c02acb0..5a1c0873c7 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basesh.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: tl $ $Date: 2001-04-09 07:27:03 $ + * last change: $Author: jp $ $Date: 2001-04-30 16:00:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -517,7 +517,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) { const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pFmt; - if( pArgs && SFX_ITEM_SET == + if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pFmt )) { TransferableDataHelper aDataHelper( @@ -585,46 +585,38 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet) { switch(nWhich) { - case SID_CUT: - if (rSh.IsSelObjProtected( (FlyProtectType)(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) ) != 0) - { - rSet.DisableItem( nWhich ); - break; - } - case SID_COPY: - if( !bCopy ) - rSet.DisableItem( nWhich ); + case SID_CUT: + if( 0 != rSh.IsSelObjProtected( (FlyProtectType) + (FLYPROTECT_CONTENT|FLYPROTECT_PARENT) ) ) + { + rSet.DisableItem( nWhich ); break; - case SID_PASTE: - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard() ); + } + case SID_COPY: + if( !bCopy ) + rSet.DisableItem( nWhich ); + break; - if( !aDataHelper.GetTransferable().is() || - !SwTransferable::IsPaste( rSh, aDataHelper )) - rSet.DisableItem( SID_PASTE ); - } - break; - case SID_CLIPBOARD_FORMAT_ITEMS: - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard() ); + case SID_PASTE: + if( !GetView().IsPasteAllowed() ) + rSet.DisableItem( SID_PASTE ); + break; - SvxClipboardFmtItem aFmtItem( nWhich ); - SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem ); - rSet.Put( aFmtItem ); - } - break; - case FN_PASTESPECIAL: - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard() ); + case FN_PASTESPECIAL: + if( !GetView().IsPasteSpecialAllowed() ) + rSet.DisableItem( FN_PASTESPECIAL ); + break; - if( !aDataHelper.GetTransferable().is() || - !SwTransferable::IsPasteSpecial( rSh, aDataHelper )) - rSet.DisableItem( FN_PASTESPECIAL ); - } - break; + case SID_CLIPBOARD_FORMAT_ITEMS: + { + TransferableDataHelper aDataHelper( + TransferableDataHelper::CreateFromSystemClipboard() ); + + SvxClipboardFmtItem aFmtItem( nWhich ); + SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem ); + rSet.Put( aFmtItem ); + } + break; } nWhich = aIter.NextWhich(); } @@ -637,7 +629,7 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet) void SwBaseShell::ExecUndo(SfxRequest &rReq) { SwWrtShell &rSh = GetShell(); - + USHORT nId = rReq.GetSlot(), nCnt = 1; const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pItem; |