2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* $RCSfile: pglink.cxx,v $
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* $Revision: 1.8 $
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-09 03:12:55 $
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* 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.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* 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.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2005-09-09 02:12:55 +00:00
|
|
|
* 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
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
#ifndef _SVXLINK_HXX
|
|
|
|
#include <svx/linkmgr.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "pglink.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Ctor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
SdPageLink::SdPageLink(SdPage* pPg, const String& rFileName,
|
|
|
|
const String& rBookmarkName) :
|
2005-01-11 11:09:40 +00:00
|
|
|
::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
|
2000-09-18 23:16:46 +00:00
|
|
|
pPage(pPg)
|
|
|
|
{
|
|
|
|
pPage->SetFileName(rFileName);
|
|
|
|
pPage->SetBookmarkName(rBookmarkName);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dtor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
SdPageLink::~SdPageLink()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Daten haben sich geaendert
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
void SdPageLink::DataChanged( const String& ,
|
2001-03-08 20:00:07 +00:00
|
|
|
const ::com::sun::star::uno::Any& )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SdDrawDocument* pDoc = (SdDrawDocument*) pPage->GetModel();
|
|
|
|
SvxLinkManager* pLinkManager = pDoc!=NULL ? pDoc->GetLinkManager() : NULL;
|
|
|
|
|
|
|
|
if (pLinkManager)
|
|
|
|
{
|
|
|
|
/**********************************************************************
|
|
|
|
* Nur Standardseiten duerfen gelinkt sein
|
|
|
|
* Die entsprechenden Notizseiten werden automatisch aktualisiert
|
|
|
|
**********************************************************************/
|
|
|
|
String aFileName;
|
|
|
|
String aBookmarkName;
|
|
|
|
String aFilterName;
|
2001-03-08 20:00:07 +00:00
|
|
|
pLinkManager->GetDisplayNames( this,0, &aFileName, &aBookmarkName,
|
2000-09-18 23:16:46 +00:00
|
|
|
&aFilterName);
|
|
|
|
pPage->SetFileName(aFileName);
|
|
|
|
pPage->SetBookmarkName(aBookmarkName);
|
|
|
|
|
|
|
|
SdDrawDocument* pBookmarkDoc = pDoc->OpenBookmarkDoc(aFileName);
|
|
|
|
|
|
|
|
if (pBookmarkDoc)
|
|
|
|
{
|
|
|
|
/******************************************************************
|
|
|
|
* Die gelinkte Seite wird im Model replaced
|
|
|
|
******************************************************************/
|
|
|
|
if (aBookmarkName.Len() == 0)
|
|
|
|
{
|
|
|
|
// Kein Seitenname angegeben: es wird die erste Seite genommen
|
|
|
|
aBookmarkName = pBookmarkDoc->GetSdPage(0, PK_STANDARD)->GetName();
|
|
|
|
pPage->SetBookmarkName(aBookmarkName);
|
|
|
|
}
|
|
|
|
|
|
|
|
List aBookmarkList;
|
|
|
|
aBookmarkList.Insert(&aBookmarkName);
|
|
|
|
USHORT nInsertPos = pPage->GetPageNum();
|
|
|
|
BOOL bLink = TRUE;
|
|
|
|
BOOL bReplace = TRUE;
|
|
|
|
BOOL bNoDialogs = FALSE;
|
|
|
|
BOOL bCopy = FALSE;
|
|
|
|
|
|
|
|
if( pDoc->pDocLockedInsertingLinks )
|
|
|
|
{
|
|
|
|
// resolving links while loading pDoc
|
|
|
|
bNoDialogs = TRUE;
|
|
|
|
bCopy = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDoc->InsertBookmarkAsPage(&aBookmarkList, NULL, bLink, bReplace,
|
2002-11-19 17:02:28 +00:00
|
|
|
nInsertPos, bNoDialogs, NULL, bCopy, TRUE, TRUE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if( !pDoc->pDocLockedInsertingLinks )
|
|
|
|
pDoc->CloseBookmarkDoc();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Link an oder abmelden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
void SdPageLink::Closed()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// Die Verbindung wird aufgehoben
|
|
|
|
pPage->SetFileName(String());
|
|
|
|
pPage->SetBookmarkName(String());
|
|
|
|
|
|
|
|
SvBaseLink::Closed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|