summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-07-07 12:35:27 +0000
committerOliver Bolte <obo@openoffice.org>2005-07-07 12:35:27 +0000
commit25aff2c5bf2af267793c9aa39be572076889270d (patch)
tree151cf153755d91a2c9f4ab47b5afb96afa822ffc /sd/source/ui/slidesorter/controller/SlsClipboard.cxx
parent7df78ca790adfb9c2db87b585d3aa7b10181eb75 (diff)
INTEGRATION: CWS impress62 (1.12.74); FILE MERGED
2005/06/28 16:01:04 af 1.12.74.1: #i49761# Disabled copy-and-paste and drag-and-drop of master pages.
Diffstat (limited to 'sd/source/ui/slidesorter/controller/SlsClipboard.cxx')
-rw-r--r--sd/source/ui/slidesorter/controller/SlsClipboard.cxx69
1 files changed, 43 insertions, 26 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 899661d8e36b..9a25dda29926 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: SlsClipboard.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: obo $ $Date: 2005-04-12 16:56:40 $
+ * last change: $Author: obo $ $Date: 2005-07-07 13:35:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,13 +153,16 @@ void Clipboard::HandleSlotCall (SfxRequest& rRequest)
// Prevent redraws while inserting pages from the clipboard
// because the intermediate inconsistent state might lead to
// a crash.
- mrController.GetView().LockRedraw (TRUE);
- if (pCurrentFunction != NULL)
- pCurrentFunction->DoPaste();
- else
- DoPaste();
- mrController.MakeSelectionVisible();
- mrController.GetView().LockRedraw (FALSE);
+ if (mrController.GetModel().GetEditMode() != EM_MASTERPAGE)
+ {
+ mrController.GetView().LockRedraw (TRUE);
+ if (pCurrentFunction != NULL)
+ pCurrentFunction->DoPaste();
+ else
+ DoPaste();
+ mrController.MakeSelectionVisible();
+ mrController.GetView().LockRedraw (FALSE);
+ }
rRequest.Done();
break;
@@ -210,27 +213,15 @@ void Clipboard::DoPaste (::Window* pWindow)
if (pClipTransferable!=NULL && pClipTransferable->IsPageTransferable())
{
- OSL_TRACE("DoPaste 0 : %d %d",
- mrController.GetFocusManager().HasFocus(),
- mrController.GetFocusManager().IsFocusShowing());
sal_Int32 nInsertPosition = GetInsertionPosition(pWindow);
if (nInsertPosition >= 0)
{
- OSL_TRACE("DoPaste: %d %d",
- mrController.GetFocusManager().HasFocus(),
- mrController.GetFocusManager().IsFocusShowing());
// Paste the pages from the clipboard.
sal_Int32 nInsertPageCount = PasteTransferable(nInsertPosition);
- OSL_TRACE("DoPaste: %d %d",
- mrController.GetFocusManager().HasFocus(),
- mrController.GetFocusManager().IsFocusShowing());
// Select the pasted pages and make the first of them the
// current page.
mrController.GetView().GetWindow()->GrabFocus();
- OSL_TRACE("DoPaste: %d %d",
- mrController.GetFocusManager().HasFocus(),
- mrController.GetFocusManager().IsFocusShowing());
SelectPageRange(nInsertPosition, nInsertPageCount);
}
}
@@ -512,11 +503,10 @@ sal_Int8 Clipboard::AcceptDrop (
USHORT nLayer)
{
sal_Int8 nResult = DND_ACTION_NONE;
- SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
- if (pDragTransferable!=NULL
- && pDragTransferable->IsPageTransferable())
+ if (IsDropAccepted())
{
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
// Accept a drop.
nResult = rEvent.mnAction;
@@ -544,11 +534,11 @@ sal_Int8 Clipboard::ExecuteDrop (
USHORT nPage,
USHORT nLayer)
{
- SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
sal_Int8 nResult = DND_ACTION_NONE;
- if (pDragTransferable != NULL && pDragTransferable->IsPageTransferable())
+ if (IsDropAccepted())
{
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
const Point aEventModelPosition (
pTargetWindow->PixelToLogic (rEvent.maPosPixel));
long int nXOffset = labs (pDragTransferable->GetStartPos().X()
@@ -654,5 +644,32 @@ USHORT Clipboard::InsertSlides (
}
+
+
+bool Clipboard::IsDropAccepted (void) const
+{
+ const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+
+ bool bIsDropAccepted (false);
+ do
+ {
+ if (pDragTransferable == NULL)
+ break;
+
+ if ( ! pDragTransferable->IsPageTransferable())
+ break;
+
+ if (mrController.GetModel().GetEditMode() == EM_MASTERPAGE)
+ break;
+
+ bIsDropAccepted = true;
+ }
+ while (false);
+
+ return bIsDropAccepted;
+}
+
+
+
} } } // end of namespace ::sd::slidesorter::controller