2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: sdview2.cxx,v $
|
|
|
|
*
|
2001-04-18 12:31:22 +00:00
|
|
|
* $Revision: 1.10 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2001-04-18 12:31:22 +00:00
|
|
|
* last change: $Author: dl $ $Date: 2001-04-18 13:31:22 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
#ifndef _REF_HXX
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/ref.hxx>
|
2001-01-19 18:15:28 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _URLOBJ_HXX //autogen
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SV_EXCHANGE_HXX //autogen
|
|
|
|
#include <vcl/exchange.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_DRAG_HXX //autogen
|
|
|
|
#include <vcl/drag.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDETC_HXX //autogen
|
|
|
|
#include <svx/svdetc.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _IPOBJ_HXX //autogen
|
|
|
|
#include <so3/ipobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOOLE2_HXX //autogen
|
|
|
|
#include <svx/svdoole2.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOGRAF_HXX //autogen
|
|
|
|
#include <svx/svdograf.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_GRAPH_HXX //autogen
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_XEXCH_HXX //autogen
|
|
|
|
#include <svx/xexch.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXDOCFILE_HXX //autogen
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#endif
|
2001-03-08 10:28:38 +00:00
|
|
|
#ifndef _SFX_CHILDWIN_HXX //autogen
|
|
|
|
#include <sfx2/childwin.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SVDUNDO_HXX //autogen
|
|
|
|
#include <svx/svdundo.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDPAGV_HXX //autogen
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _URLBMK_HXX //autogen
|
|
|
|
#include <svtools/urlbmk.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _URLBMK_HXX //autogen
|
|
|
|
#include <svtools/urlbmk.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _OUTLINER_HXX //autogen
|
|
|
|
#include <svx/outliner.hxx>
|
|
|
|
#endif
|
|
|
|
#include <svx/dbexch.hrc>
|
|
|
|
#ifndef _SOT_FORMATS_HXX //autogen
|
|
|
|
#include <sot/formats.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _MyEDITENG_HXX //autogen
|
|
|
|
#include <svx/editeng.hxx>
|
|
|
|
#endif
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
#include "navigatr.hxx"
|
|
|
|
#include "anminfo.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "strings.hrc"
|
|
|
|
#include "sdview.hxx"
|
2001-01-19 18:15:28 +00:00
|
|
|
#include "sdxfer.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "sdmod.hxx"
|
|
|
|
#include "drviewsh.hxx"
|
|
|
|
#include "docshell.hxx"
|
|
|
|
#include "fudraw.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "sdwindow.hxx"
|
|
|
|
#include "sdpage.hxx"
|
2001-03-08 10:28:38 +00:00
|
|
|
#include "unoaprms.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "drawview.hxx"
|
|
|
|
#include "slidview.hxx"
|
|
|
|
|
|
|
|
#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
|
|
|
|
#define SO2_DECL_SVINPLACEOBJECT_DEFINED
|
|
|
|
SO2_DECL_REF(SvInPlaceObject)
|
|
|
|
#endif
|
|
|
|
#ifndef SO2_DECL_SVSTORAGE_DEFINED
|
|
|
|
#define SO2_DECL_SVSTORAGE_DEFINED
|
|
|
|
SO2_DECL_REF(SvStorage)
|
|
|
|
#endif
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
// ------------------------
|
|
|
|
// - SdNavigatorDropEvent -
|
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
struct SdNavigatorDropEvent : public ExecuteDropEvent
|
|
|
|
{
|
|
|
|
SdWindow* mpWin;
|
|
|
|
USHORT mnPage;
|
|
|
|
USHORT mnLayer;
|
|
|
|
const SdDrawDocShell* mpNavigatorDragDocShell;
|
|
|
|
|
|
|
|
SdNavigatorDropEvent( const ExecuteDropEvent& rEvt, SdWindow* pWin, USHORT nPage, USHORT nLayer,
|
|
|
|
const SdDrawDocShell* pNavigatorDragDocShell ) :
|
|
|
|
ExecuteDropEvent( rEvt ), mpWin( pWin ), mnPage( nPage ), mnLayer( nLayer ), mpNavigatorDragDocShell( pNavigatorDragDocShell ) {}
|
|
|
|
};
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* DataObject fuer Drag&Drop erzeugen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SdView::CreateDataObject( SdView* pWorkView, Window& rWindow,
|
|
|
|
const Point& rDragPos )
|
2001-01-19 18:15:28 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
SdTransferable* pTransferable = new SdTransferable( pDoc, pWorkView );
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable );
|
2001-01-19 18:15:28 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
SD_MOD()->pTransferDrag = pTransferable;
|
|
|
|
|
|
|
|
TransferableObjectDescriptor aObjDesc;
|
|
|
|
String aDisplayName;
|
|
|
|
SdrOle2Obj* pSdrOleObj = NULL;
|
2001-01-19 18:15:28 +00:00
|
|
|
|
|
|
|
if( aMark.GetMarkCount() == 1 )
|
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
SdrObject* pObj = aMark.GetMark( 0 )->GetObj();
|
2001-01-19 18:15:28 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pObj && pObj->ISA( SdrOle2Obj ) && ( (SdrOle2Obj*) pObj )->GetObjRef().Is() )
|
2001-01-19 18:15:28 +00:00
|
|
|
pSdrOleObj = (SdrOle2Obj*) pObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pDocSh )
|
|
|
|
aDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
|
|
|
|
|
|
|
|
if( pSdrOleObj )
|
2001-03-08 10:28:38 +00:00
|
|
|
pSdrOleObj->GetObjRef()->FillTransferableObjectDescriptor( aObjDesc );
|
2001-01-19 18:15:28 +00:00
|
|
|
else
|
2001-03-08 10:28:38 +00:00
|
|
|
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
|
2001-01-19 18:15:28 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
aObjDesc.maSize = GetAllMarkedRect().GetSize();
|
|
|
|
aObjDesc.maDragStartPos = rDragPos;
|
|
|
|
aObjDesc.maDisplayName = aDisplayName;
|
|
|
|
aObjDesc.mbCanLink = FALSE;
|
2001-01-19 18:15:28 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
pTransferable->SetStartPos( rDragPos );
|
|
|
|
pTransferable->SetObjectDescriptor( aObjDesc );
|
|
|
|
pTransferable->StartDrag( &rWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
|
2001-01-19 18:15:28 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
return xRet;
|
2001-01-19 18:15:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* DataObject fuers Clipboard erzeugen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SdView::CreateDataObject()
|
|
|
|
{
|
|
|
|
// since SdTransferable::CopyToClipboard is called, this
|
|
|
|
// dynamically created object ist destroyed automatically
|
|
|
|
SdTransferable* pTransferable = new SdTransferable( pDoc );
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable );
|
|
|
|
|
|
|
|
SD_MOD()->pTransferClip = pTransferable;
|
|
|
|
|
|
|
|
pDoc->CreatingDataObj( TRUE );
|
|
|
|
pTransferable->SetWorkDocument( (SdDrawDocument*) GetAllMarkedModel() );
|
|
|
|
pDoc->CreatingDataObj( FALSE );
|
|
|
|
|
|
|
|
const Rectangle aMarkRect( GetAllMarkedRect() );
|
|
|
|
TransferableObjectDescriptor aObjDesc;
|
|
|
|
String aDisplayName;
|
|
|
|
SdrOle2Obj* pSdrOleObj = NULL;
|
|
|
|
SdrPageView* pPgView = GetPageViewPvNum( 0 );
|
|
|
|
SdPage* pPage = (SdPage*) pPgView->GetPage();
|
|
|
|
SdPage* pNewPage = (SdPage*) pTransferable->GetWorkDocument()->GetPage(0);
|
|
|
|
|
|
|
|
pNewPage->SetSize( pPage->GetSize() );
|
|
|
|
pNewPage->SetLayoutName( pPage->GetLayoutName() );
|
|
|
|
|
|
|
|
if( aMark.GetMarkCount() == 1 )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = aMark.GetMark(0)->GetObj();
|
|
|
|
|
|
|
|
if( pObj && pObj->ISA(SdrOle2Obj) && ((SdrOle2Obj*) pObj)->GetObjRef().Is() )
|
|
|
|
pSdrOleObj = (SdrOle2Obj*) pObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pSdrOleObj )
|
|
|
|
pSdrOleObj->GetObjRef()->FillTransferableObjectDescriptor( aObjDesc );
|
|
|
|
else
|
|
|
|
pTransferable->GetWorkDocument()->GetDocSh()->FillTransferableObjectDescriptor( aObjDesc );
|
|
|
|
|
|
|
|
if( pDocSh )
|
|
|
|
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
|
|
|
|
|
|
|
|
aObjDesc.maSize = aMarkRect.GetSize();
|
|
|
|
|
|
|
|
pTransferable->SetStartPos( aMarkRect.TopLeft() );
|
|
|
|
pTransferable->SetObjectDescriptor( aObjDesc );
|
|
|
|
pTransferable->CopyToClipboard();
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Cut object to clipboard
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void __EXPORT SdView::DoCut(Window* pWindow)
|
|
|
|
{
|
|
|
|
const OutlinerView* pOLV = GetTextEditOutlinerView();
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pOLV )
|
2000-09-18 16:07:07 +00:00
|
|
|
( (OutlinerView*) pOLV)->Cut();
|
2001-01-19 18:15:28 +00:00
|
|
|
else if( HasMarkedObj() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
String aStr( SdResId(STR_UNDO_CUT) );
|
2001-01-19 18:15:28 +00:00
|
|
|
|
|
|
|
DoCopy();
|
|
|
|
BegUndo( ( aStr += sal_Unicode(' ') ) += aMark.GetMarkDescription() );
|
2000-09-18 16:07:07 +00:00
|
|
|
DeleteMarked();
|
|
|
|
EndUndo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Copy object to clipboard
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void __EXPORT SdView::DoCopy(Window* pWindow)
|
|
|
|
{
|
|
|
|
const OutlinerView* pOLV = GetTextEditOutlinerView();
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pOLV )
|
2000-09-18 16:07:07 +00:00
|
|
|
( (OutlinerView*) pOLV)->Copy();
|
2001-01-19 18:15:28 +00:00
|
|
|
else if( HasMarkedObj() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BrkAction();
|
2001-01-19 18:15:28 +00:00
|
|
|
CreateDataObject();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Paste object from clipboard
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
void __EXPORT SdView::DoPaste( Window* pWindow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const OutlinerView* pOLV = GetTextEditOutlinerView();
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pOLV )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
( (OutlinerView*) pOLV)->PasteSpecial();
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
SdrObject* pObj = GetTextEditObject();
|
|
|
|
SdPage* pPage = (SdPage*)( pObj ? pObj->GetPage() : NULL );
|
|
|
|
Outliner* pOutliner = pOLV->GetOutliner();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pOutliner)
|
|
|
|
{
|
|
|
|
if( pObj && pPage && pPage->GetPresObjKind(pObj) == PRESOBJ_TITLE )
|
|
|
|
{
|
|
|
|
// remove all hard linebreaks from the title
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pOutliner && pOutliner->GetParagraphCount() > 1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BOOL bOldUpdateMode = pOutliner->GetUpdateMode();
|
2001-01-19 18:15:28 +00:00
|
|
|
|
|
|
|
pOutliner->SetUpdateMode( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
const EditEngine& rEdit = pOutliner->GetEditEngine();
|
|
|
|
const int nParaCount = rEdit.GetParagraphCount();
|
|
|
|
|
|
|
|
for( int nPara = nParaCount - 2; nPara >= 0; nPara-- )
|
|
|
|
{
|
|
|
|
const int nParaLen = rEdit.GetTextLen( nPara );
|
|
|
|
pOutliner->QuickDelete( ESelection( nPara, nParaLen, nPara+1, 0 ) );
|
|
|
|
pOutliner->QuickInsertLineBreak( ESelection( nPara, nParaLen, nPara, nParaLen ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titelobjekt contains hard line breaks" );
|
|
|
|
pOutliner->SetUpdateMode(bOldUpdateMode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !pDoc->IsChanged() )
|
|
|
|
{
|
|
|
|
if( pOutliner && pOutliner->IsModified() )
|
|
|
|
pDoc->SetChanged( TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
Point aPos;
|
|
|
|
BOOL bPagesInserted = FALSE;
|
|
|
|
SdTransferable* pTransferClip = SD_MOD()->pTransferClip;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pWindow )
|
|
|
|
aPos = pWindow->PixelToLogic( Rectangle( aPos, pWindow->GetOutputSizePixel() ).Center() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pTransferClip && pTransferClip->GetDocShell() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Eigenes Format: Ganze Seiten einfuegen?
|
2001-01-19 18:15:28 +00:00
|
|
|
SvEmbeddedObject* pObj = pTransferClip->GetDocShell();
|
|
|
|
SdDrawDocShell* pDataDocSh = (SdDrawDocShell*) pObj;
|
|
|
|
SdDrawDocument* pDataDoc = pDataDocSh->GetDoc();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pDataDoc && pDataDoc->GetPageCount() > 1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Dokument hat mehrere Seiten -> Seiten einfuegen
|
|
|
|
bPagesInserted = TRUE;
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
USHORT nInsertPgCnt = pDataDoc->GetSdPageCount(PK_STANDARD);
|
|
|
|
USHORT nInsertPos = pDoc->GetSdPageCount(PK_STANDARD) * 2 + 1;
|
|
|
|
USHORT nPgCnt = pDoc->GetSdPageCount(PK_STANDARD);
|
|
|
|
BOOL bMergeMasterPages = TRUE;
|
|
|
|
|
|
|
|
for( USHORT nPage = 0; nPage < nPgCnt; nPage++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
SdPage* pPage = pDoc->GetSdPage( nPage, PK_STANDARD );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pPage->IsSelected() )
|
2000-09-18 16:07:07 +00:00
|
|
|
nInsertPos = nPage * 2 + 3;
|
|
|
|
}
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pTransferClip->HasSourceDoc( pDoc ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
bMergeMasterPages = FALSE;
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
pDoc->InsertBookmarkAsPage( NULL, NULL, FALSE, FALSE, nInsertPos,
|
|
|
|
FALSE, pDataDocSh, TRUE, bMergeMasterPages );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( this->ISA( SdSlideView ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Alle Seiten deselektieren
|
2001-01-19 18:15:28 +00:00
|
|
|
for( USHORT nPage = 0, nPgCnt = pDoc->GetSdPageCount( PK_STANDARD ); nPage < nPgCnt; nPage++ )
|
|
|
|
pDoc->GetSdPage( nPage, PK_STANDARD )->SetSelected( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Die letzte eingefuegte Seite selektieren
|
2001-01-19 18:15:28 +00:00
|
|
|
SdPage* pPage = pDoc->GetSdPage( nInsertPos / 2 + nInsertPgCnt - 1, PK_STANDARD );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pPage )
|
|
|
|
pPage->SetSelected( TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( !bPagesInserted && this->ISA( SdDrawView ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard() );
|
|
|
|
|
|
|
|
if( aDataHelper.GetTransferable().is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
sal_Int8 nDnDAction = DND_ACTION_COPY;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( !InsertData( aDataHelper.GetTransferable(), aPos, nDnDAction, FALSE ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
SdDrawViewShell* pDrViewSh = (SdDrawViewShell*) pDocSh->GetViewShell();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-19 18:15:28 +00:00
|
|
|
if( pDrViewSh )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
String aEmptyStr;
|
|
|
|
INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
|
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
|
|
|
|
aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
|
|
|
|
( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
|
|
|
|
aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
|
|
|
|
( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
|
|
|
|
aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
|
|
|
|
{
|
2001-01-19 18:15:28 +00:00
|
|
|
pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
|
2001-04-04 15:41:39 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* DragServer starten
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
BOOL SdView::BeginDrag(Window* pWindow, Point aStartPos)
|
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
BOOL bRet = HasMarkedObj() && IsAction() && pViewSh && pWindow;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( bRet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BrkAction();
|
|
|
|
|
|
|
|
SdViewShell* pViewShell= pDocSh->GetViewShell();
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pViewShell && pViewShell->ISA( SdDrawViewShell ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
FuPoor* pFunc = ( (SdDrawViewShell*) pViewShell )->GetActualFunction();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pFunc && pFunc->ISA( FuDraw ) )
|
|
|
|
( (FuDraw*) pFunc)->ForcePointer( NULL );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
pDragSrcMarkList = new SdrMarkList( aMark );
|
2000-09-18 16:07:07 +00:00
|
|
|
nDragSrcPgNum = GetPageViewPvNum(0)->GetPage()->GetPageNum();
|
|
|
|
|
|
|
|
String aStr( SdResId(STR_UNDO_DRAGDROP) );
|
|
|
|
aStr += sal_Unicode(' ');
|
|
|
|
aStr += pDragSrcMarkList->GetMarkDescription();
|
|
|
|
BegUndo(aStr);
|
2001-03-08 10:28:38 +00:00
|
|
|
CreateDataObject( this, *pWindow, aStartPos );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* DragFinished
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
void SdView::DragFinished( sal_Int8 nDropAction )
|
|
|
|
{
|
|
|
|
SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pDragTransferable )
|
|
|
|
pDragTransferable->SetView( NULL );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( ( nDropAction & DND_ACTION_MOVE ) && !pDragTransferable->IsInternalMove() &&
|
|
|
|
!IsPresObjSelected() && pDragSrcMarkList && pDragSrcMarkList->GetMarkCount() )
|
|
|
|
{
|
|
|
|
pDragSrcMarkList->ForceSort();
|
|
|
|
BegUndo();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
ULONG nm, nAnz = pDragSrcMarkList->GetMarkCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
for( nm = nAnz; nm>0; )
|
|
|
|
{
|
|
|
|
nm--;
|
|
|
|
SdrMark* pM=pDragSrcMarkList->GetMark(nm);
|
|
|
|
AddUndo(new SdrUndoDelObj(*pM->GetObj()));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
pDragSrcMarkList->GetMark(0)->GetObj()->GetOrdNum();
|
|
|
|
|
|
|
|
for (nm=nAnz; nm>0;)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
nm--;
|
|
|
|
SdrMark* pM=pDragSrcMarkList->GetMark(nm);
|
|
|
|
SdrObject* pObj=pM->GetObj();
|
|
|
|
UINT32 nOrdNum=pObj->GetOrdNumDirect();
|
|
|
|
SdrObject* pChkObj = pObj->GetPage()->RemoveObject(nOrdNum);
|
|
|
|
DBG_ASSERT(pChkObj==pObj,"DeleteMarked(MarkList): pChkObj!=pObj beim RemoveObject()");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EndUndo();
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pDragTransferable )
|
|
|
|
pDragTransferable->SetInternalMove( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
EndUndo();
|
|
|
|
nDragSrcPgNum = SDRPAGE_NOTFOUND;
|
|
|
|
delete pDragSrcMarkList, pDragSrcMarkList = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2001-03-08 10:28:38 +00:00
|
|
|
|* AcceptDrop
|
2000-09-18 16:07:07 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
sal_Int8 SdView::AcceptDrop( const AcceptDropEvent& rEvt, SdWindow* pWin, USHORT nPage, USHORT nLayer )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
String aLayerName( GetActiveLayer() );
|
|
|
|
SdrPageView* pPV = GetPageViewPvNum(0);
|
|
|
|
sal_Int8 nDropAction = rEvt.mnAction;
|
|
|
|
sal_Int8 nRet = DND_ACTION_NONE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( nLayer != SDRLAYER_NOTFOUND )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
|
|
|
|
aLayerName = rLayerAdmin.GetLayerPerID(nLayer)->GetName();
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( bIsDropAllowed && !pPV->IsLayerLocked( aLayerName ) && pPV->IsLayerVisible( aLayerName ) )
|
|
|
|
{
|
|
|
|
const OutlinerView* pOLV = GetTextEditOutlinerView();
|
|
|
|
BOOL bIsInsideOutlinerView = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pOLV )
|
|
|
|
{
|
|
|
|
Rectangle aRect( pOLV->GetOutputArea() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if (aMark.GetMarkCount() == 1)
|
|
|
|
{
|
|
|
|
SdrMark* pMark = aMark.GetMark(0);
|
|
|
|
SdrObject* pObj = pMark->GetObj();
|
|
|
|
aRect.Union( pObj->GetLogicRect() );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 11:38:30 +00:00
|
|
|
if( aRect.IsInside( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ) )
|
2001-03-08 10:28:38 +00:00
|
|
|
{
|
|
|
|
bIsInsideOutlinerView = TRUE;
|
|
|
|
//!!!DND nRet = ( (OutlinerView*) pOLV )->AcceptDrop( rEvt, pWin, nPage, nLayer );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( !bIsInsideOutlinerView )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pDragTransferable )
|
|
|
|
{
|
|
|
|
const SdView* pSourceView = pDragTransferable->GetView();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pSourceView )
|
|
|
|
{
|
|
|
|
if( !( nDropAction & DND_ACTION_LINK ) || pSourceView->GetDocSh()->GetMedium()->GetName().Len() )
|
|
|
|
nRet = nDropAction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BOOL bDrawing = pWin->IsDropFormatSupported( SOT_FORMATSTR_ID_DRAWING );
|
|
|
|
BOOL bGraphic = pWin->IsDropFormatSupported( SOT_FORMATSTR_ID_SVXB );
|
|
|
|
BOOL bMtf = pWin->IsDropFormatSupported( FORMAT_GDIMETAFILE );
|
|
|
|
BOOL bBitmap = pWin->IsDropFormatSupported( FORMAT_BITMAP );
|
|
|
|
BOOL bBookmark = pWin->IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
|
|
|
|
BOOL bXFillExchange = pWin->IsDropFormatSupported( SOT_FORMATSTR_ID_XFA );
|
|
|
|
BOOL bSBAFormat = pWin->IsDropFormatSupported( SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH );
|
|
|
|
BOOL bIsPresTarget = FALSE;
|
|
|
|
BOOL nDefaultDrop = DND_ACTION_NONE;
|
2001-04-04 15:41:39 +00:00
|
|
|
//!!!DND BOOL nDefaultDrop = nRet = FmFormView::AcceptDrop( rEvt, pWin, nPage, nLayer );
|
2001-03-08 10:28:38 +00:00
|
|
|
|
|
|
|
nDropAction = ( ( nDropAction & DND_ACTION_MOVE ) ? DND_ACTION_COPY : nDropAction );
|
|
|
|
|
|
|
|
if( !nDefaultDrop && ( ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( ( nDropAction & DND_ACTION_MOVE ) || ( nDropAction & DND_ACTION_LINK ) ) ) || bXFillExchange ) )
|
|
|
|
{
|
|
|
|
SdrObject* pPickObj = NULL;
|
|
|
|
SdrPageView* pPV = NULL;
|
|
|
|
SdWindow* pWindow = pViewSh->GetActiveWindow();
|
|
|
|
USHORT nHitLog = USHORT( pWindow->PixelToLogic( Size( HITPIX, 0 ) ).Width() );
|
2001-03-08 11:38:30 +00:00
|
|
|
Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) );
|
2001-03-08 10:28:38 +00:00
|
|
|
BOOL bHasPickObj = PickObj( aPos, pPickObj, pPV );
|
|
|
|
|
|
|
|
if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) )
|
|
|
|
{
|
|
|
|
SdPage* pPage = (SdPage*) pPickObj->GetPage();
|
|
|
|
|
|
|
|
if( pPage && pPage->IsMasterPage() )
|
|
|
|
bIsPresTarget = pPage->GetPresObjList()->GetPos( pPickObj ) != LIST_ENTRY_NOTFOUND;
|
|
|
|
}
|
|
|
|
|
2001-04-18 12:31:22 +00:00
|
|
|
if( bHasPickObj && !bIsPresTarget &&
|
|
|
|
( !pPickObj->ISA( SdrGrafObj ) || bGraphic || bMtf || bBitmap ||
|
|
|
|
( bXFillExchange && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) ) )
|
2001-03-08 10:28:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if( !pDropMarker )
|
|
|
|
pDropMarker = new SdrViewUserMarker(this);
|
|
|
|
|
|
|
|
if( pDropMarkerObj != pPickObj )
|
|
|
|
{
|
|
|
|
pDropMarkerObj = pPickObj;
|
|
|
|
pDropMarker->SetXPolyPolygon( pDropMarkerObj, GetPageViewPvNum( 0 ) );
|
|
|
|
pDropMarker->Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bXFillExchange = FALSE;
|
|
|
|
|
|
|
|
if( pDropMarker )
|
|
|
|
{
|
|
|
|
pDropMarker->Hide();
|
|
|
|
pDropMarkerObj = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( pDropMarker )
|
|
|
|
{
|
|
|
|
pDropMarker->Hide();
|
|
|
|
pDropMarkerObj = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL bFile = ( pWin->IsDropFormatSupported( FORMAT_FILE ) && pViewSh && !pViewSh->GetSlideShow() && !( nDropAction & DND_ACTION_MOVE ) );
|
|
|
|
|
|
|
|
if( bBookmark && !bFile && pWin->IsDropFormatSupported( FORMAT_FILE ) )
|
|
|
|
bBookmark = FALSE;
|
|
|
|
|
|
|
|
if( IsDragDropFormatSupported() || bFile || bBookmark || bGraphic || bXFillExchange || bSBAFormat || nDefaultDrop )
|
|
|
|
nRet = nDropAction;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* ExecuteDrop
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
sal_Int8 SdView::ExecuteDrop( const ExecuteDropEvent& rEvt, SdWindow* pWin, USHORT nPage, USHORT nLayer )
|
|
|
|
{
|
|
|
|
if( pDropMarker )
|
|
|
|
{
|
|
|
|
pDropMarker->Hide();
|
|
|
|
delete pDropMarker, pDropMarker = NULL;
|
|
|
|
pDropMarkerObj = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrPageView* pPV = GetPageViewPvNum( 0 );
|
|
|
|
String aActiveLayer = GetActiveLayer();
|
|
|
|
sal_Int8 nDropAction = rEvt.mnAction;
|
|
|
|
sal_Int8 nRet = DND_ACTION_NONE;
|
|
|
|
|
|
|
|
if( !pPV->IsLayerLocked( aActiveLayer ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
const OutlinerView* pOLV = GetTextEditOutlinerView();
|
|
|
|
BOOL bIsInsideOutlinerView = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pOLV )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
Rectangle aRect( pOLV->GetOutputArea() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( aMark.GetMarkCount() == 1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
SdrMark* pMark = aMark.GetMark(0);
|
|
|
|
SdrObject* pObj = pMark->GetObj();
|
|
|
|
aRect.Union( pObj->GetLogicRect() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
Point aPos( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) );
|
2001-03-08 10:28:38 +00:00
|
|
|
|
|
|
|
if( aRect.IsInside( aPos ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-08 10:28:38 +00:00
|
|
|
bIsInsideOutlinerView = TRUE;
|
|
|
|
//!!!DND nRet = ( (OutlinerView*) pOLV)->ExecuteDrop( nDropAction, rPointerPos, nDnDSourceActions, rxTransferable, pWin, nPage, nLayer );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-03-08 10:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !bIsInsideOutlinerView )
|
|
|
|
{
|
|
|
|
Point aPos;
|
|
|
|
SdDrawViewShell* pDrViewSh = (SdDrawViewShell*) pDocSh->GetViewShell();
|
|
|
|
SdrPage* pPage = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pWin )
|
2001-03-08 11:38:30 +00:00
|
|
|
aPos = pWin->PixelToLogic( rEvt.maPosPixel );
|
2001-03-08 10:28:38 +00:00
|
|
|
|
|
|
|
//!!!DND if( !( bReturn = FmFormView::Drop(rMEvt, pWin) ) ) )
|
|
|
|
if( !InsertData( rEvt.maDropEvent.Transferable, aPos, nDropAction, TRUE, 0, nPage, nLayer ) && pViewSh )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-16 16:41:14 +00:00
|
|
|
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
|
|
|
|
String aTmpString1, aTmpString2;
|
|
|
|
INetBookmark aINetBookmark( aTmpString1, aTmpString2 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
// insert bookmark
|
|
|
|
if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
|
|
|
|
aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
const NavigatorDragType eDragType = SD_MOD()->GetCurrentNavigatorDragType();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
if( eDragType == NAVIGATOR_DRAGTYPE_LINK || eDragType == NAVIGATOR_DRAGTYPE_EMBEDDED )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
// insert bookmark from own navigator (handled async. due to possible message box )
|
|
|
|
Application::PostUserEvent( LINK( this, SdView, ExecuteNavigatorDrop ),
|
|
|
|
new SdNavigatorDropEvent( rEvt, pWin, nPage, nLayer, SD_MOD()->GetCurrentNavigatorDragDocShell() ) );
|
|
|
|
nRet = nDropAction;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-04-04 15:41:39 +00:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
SdrObject* pPickObj = NULL;
|
|
|
|
SdrPageView* pPV = NULL;
|
|
|
|
SdWindow* pWindow = pViewSh->GetActiveWindow();
|
|
|
|
USHORT nHitLog = USHORT(pWindow->PixelToLogic(Size(HITPIX,0)).Width());
|
2001-03-08 10:28:38 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
if( PickObj( aPos, pPickObj, pPV ) )
|
2001-03-08 10:28:38 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
// insert as clip action => jump
|
|
|
|
String aBookmark( aINetBookmark.GetURL() );
|
|
|
|
SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pPickObj );
|
|
|
|
BOOL bCreated = FALSE;
|
2001-03-08 10:28:38 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
if( aBookmark.Len() )
|
2001-03-08 10:28:38 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
presentation::ClickAction eClickAction = presentation::ClickAction_DOCUMENT;
|
|
|
|
String aDocName( aBookmark.GetToken( 0, '#' ) );
|
|
|
|
|
|
|
|
if( pDocSh->GetMedium()->GetName() == aDocName || pDocSh->GetName() == aDocName )
|
|
|
|
{
|
|
|
|
// Interner Sprung -> nur "#Bookmark" verwenden
|
|
|
|
aBookmark = aBookmark.GetToken( 1, '#' );
|
|
|
|
eClickAction = presentation::ClickAction_BOOKMARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !pInfo )
|
|
|
|
{
|
|
|
|
pInfo = new SdAnimationInfo( pDoc );
|
|
|
|
pPickObj->InsertUserData( pInfo );
|
|
|
|
bCreated = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Undo-Action mit alten und neuen Groessen erzeugen
|
|
|
|
SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction(pDoc, pPickObj, bCreated);
|
|
|
|
pAction->SetActive(pInfo->bActive, pInfo->bActive);
|
|
|
|
pAction->SetEffect(pInfo->eEffect, pInfo->eEffect);
|
|
|
|
pAction->SetTextEffect(pInfo->eTextEffect, pInfo->eTextEffect);
|
|
|
|
pAction->SetSpeed(pInfo->eSpeed, pInfo->eSpeed);
|
|
|
|
pAction->SetDim(pInfo->bDimPrevious, pInfo->bDimPrevious);
|
|
|
|
pAction->SetDimColor(pInfo->aDimColor, pInfo->aDimColor);
|
|
|
|
pAction->SetDimHide(pInfo->bDimHide, pInfo->bDimHide);
|
|
|
|
pAction->SetSoundOn(pInfo->bSoundOn, pInfo->bSoundOn);
|
|
|
|
pAction->SetSound(pInfo->aSoundFile, pInfo->aSoundFile);
|
|
|
|
pAction->SetBlueScreen(pInfo->aBlueScreen, pInfo->aBlueScreen);
|
|
|
|
pAction->SetPlayFull(pInfo->bPlayFull, pInfo->bPlayFull);
|
|
|
|
pAction->SetPathObj(pInfo->pPathObj, pInfo->pPathObj);
|
|
|
|
pAction->SetClickAction(pInfo->eClickAction, eClickAction);
|
|
|
|
pAction->SetBookmark(pInfo->aBookmark, aBookmark);
|
|
|
|
pAction->SetInvisibleInPres(pInfo->bInvisibleInPresentation, TRUE);
|
|
|
|
pAction->SetVerb(pInfo->nVerb, pInfo->nVerb);
|
|
|
|
pAction->SetSecondEffect(pInfo->eSecondEffect, pInfo->eSecondEffect);
|
|
|
|
pAction->SetSecondSpeed(pInfo->eSecondSpeed, pInfo->eSecondSpeed);
|
|
|
|
pAction->SetSecondSoundOn(pInfo->bSecondSoundOn, pInfo->bSecondSoundOn);
|
|
|
|
pAction->SetSecondPlayFull(pInfo->bSecondPlayFull, pInfo->bSecondPlayFull);
|
|
|
|
|
|
|
|
String aString(SdResId(STR_UNDO_ANIMATION));
|
|
|
|
pAction->SetComment(aString);
|
|
|
|
pDocSh->GetUndoManager()->AddUndoAction(pAction);
|
|
|
|
pInfo->eClickAction = eClickAction;
|
|
|
|
pInfo->aBookmark = aBookmark;
|
|
|
|
pDoc->SetChanged();
|
2001-03-08 10:28:38 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
nRet = nDropAction;
|
2001-03-08 10:28:38 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-04 15:41:39 +00:00
|
|
|
else if( pViewSh->ISA( SdDrawViewShell ) )
|
2001-03-08 10:28:38 +00:00
|
|
|
{
|
2001-04-04 15:41:39 +00:00
|
|
|
// insert as normal URL button
|
|
|
|
( (SdDrawViewShell*) pViewSh )->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), String(), &aPos );
|
|
|
|
nRet = nDropAction;
|
2001-03-08 10:28:38 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-03-14 11:58:28 +00:00
|
|
|
else
|
|
|
|
nRet = nDropAction;
|
2001-03-08 10:28:38 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
return nRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-04 15:41:39 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK( SdView, ExecuteNavigatorDrop, SdNavigatorDropEvent*, pSdNavigatorDropEvent )
|
|
|
|
{
|
|
|
|
TransferableDataHelper aDataHelper( pSdNavigatorDropEvent->maDropEvent.Transferable );
|
|
|
|
INetBookmark aINetBookmark;
|
|
|
|
|
|
|
|
if( pSdNavigatorDropEvent->mpNavigatorDragDocShell &&
|
|
|
|
aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) )
|
|
|
|
{
|
|
|
|
Point aPos;
|
|
|
|
List aBookmarkList;
|
|
|
|
String aBookmark;
|
|
|
|
String aFile;
|
|
|
|
SdPage* pPage = (SdPage*) GetPageViewPvNum( 0 )->GetPage();
|
|
|
|
USHORT nPgPos = 0xFFFF;
|
|
|
|
|
|
|
|
if( pSdNavigatorDropEvent->mpWin )
|
|
|
|
aPos = pSdNavigatorDropEvent->mpWin->PixelToLogic( pSdNavigatorDropEvent->maPosPixel );
|
|
|
|
|
|
|
|
aFile = aINetBookmark.GetURL().GetToken( 0, '#' );
|
|
|
|
aBookmark = aINetBookmark.GetURL().GetToken( 1, '#' );
|
|
|
|
aBookmarkList.Insert( &aBookmark );
|
|
|
|
|
|
|
|
if( !pPage->IsMasterPage() )
|
|
|
|
{
|
|
|
|
if( pPage->GetPageKind() == PK_STANDARD )
|
|
|
|
nPgPos = pPage->GetPageNum() + 2;
|
|
|
|
else if( pPage->GetPageKind() == PK_NOTES )
|
|
|
|
nPgPos = pPage->GetPageNum() + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Um zu gewaehrleisten, dass alle Seitennamen eindeutig sind, werden
|
|
|
|
// die einzufuegenden geprueft und gegebenenfalls in einer Ersatzliste
|
|
|
|
// aufgenommen (bNameOK == FALSE -> Benutzer hat abgebrochen)
|
|
|
|
List* pExchangeList = NULL;
|
|
|
|
BOOL bNameOK = GetExchangeList( pExchangeList, &aBookmarkList, 2 );
|
|
|
|
BOOL bLink = ( SD_MOD()->GetCurrentNavigatorDragType() == NAVIGATOR_DRAGTYPE_LINK ? TRUE : FALSE );
|
|
|
|
BOOL bReplace = FALSE;
|
|
|
|
|
|
|
|
// Da man hier nicht weiss, ob es sich um eine Seite oder ein Objekt handelt,
|
|
|
|
// wird eine Liste sowohl mit Seiten, als auch mit Objekten gefuellt.
|
|
|
|
// Sollten Seitennamen und Objektnamen identisch sein gibt es hier natuerlich Probleme !!!
|
|
|
|
if( bNameOK )
|
|
|
|
{
|
|
|
|
pDoc->InsertBookmark( &aBookmarkList, pExchangeList,
|
|
|
|
bLink, bReplace, nPgPos, FALSE,
|
|
|
|
(SdDrawDocShell*) pSdNavigatorDropEvent->mpNavigatorDragDocShell,
|
|
|
|
TRUE, &aPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Loeschen der ExchangeList
|
|
|
|
if( pExchangeList )
|
|
|
|
{
|
|
|
|
for( void* p = pExchangeList->First(); p; p = pExchangeList->Next() )
|
|
|
|
delete (String*) p;
|
|
|
|
|
|
|
|
delete pExchangeList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete pSdNavigatorDropEvent;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Rueckgabeparameter:
|
|
|
|
|* pExchangeList == NULL -> Namen sind alle eindeutig
|
|
|
|
|* bNameOK == FALSE -> Benutzer hat abgebrochen
|
|
|
|
|* nType == 0 -> Seiten
|
|
|
|
|* nType == 1 -> Objekte
|
|
|
|
|* nType == 2 -> Seiten + Objekte
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
BOOL SdView::GetExchangeList( List*& rpExchangeList, List* pBookmarkList, USHORT nType )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( !rpExchangeList, "ExchangeList muss NULL sein!");
|
|
|
|
|
|
|
|
BOOL bListIdentical = TRUE; // BookmarkList und ExchangeList sind gleich
|
|
|
|
BOOL bNameOK = TRUE; // Name ist eindeutig
|
|
|
|
|
|
|
|
rpExchangeList = new List();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
if( pBookmarkList )
|
|
|
|
{
|
|
|
|
String* pString = (String*) pBookmarkList->First();
|
|
|
|
while( pString && bNameOK )
|
|
|
|
{
|
|
|
|
String* pNewName = new String( *pString );
|
|
|
|
if( nType == 0 || nType == 2 )
|
|
|
|
bNameOK = pDocSh->CheckPageName( pViewSh->GetWindow(), *pNewName );
|
|
|
|
if( bNameOK && (nType == 1 || nType == 2) )
|
|
|
|
bNameOK = pDocSh->CheckObjectName( pViewSh->GetWindow(), *pNewName );
|
|
|
|
|
|
|
|
if( bListIdentical )
|
|
|
|
bListIdentical = ( *pString == *pNewName );
|
|
|
|
|
|
|
|
rpExchangeList->Insert( pNewName, LIST_APPEND );
|
|
|
|
pString = (String*) pBookmarkList->Next();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
// ExchangeList ist mit BookmarkList identisch
|
|
|
|
if( rpExchangeList && bListIdentical )
|
|
|
|
{
|
|
|
|
String* pString = (String*) rpExchangeList->First();
|
|
|
|
while( pString )
|
|
|
|
{
|
|
|
|
delete pString;
|
|
|
|
pString = (String*) rpExchangeList->Next();
|
|
|
|
}
|
|
|
|
delete rpExchangeList;
|
|
|
|
rpExchangeList = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-08 10:28:38 +00:00
|
|
|
return( bNameOK );
|
|
|
|
}
|