2010-10-12 15:51:52 +02:00
|
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:16:46 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
2008-04-10 17:41:45 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:16:46 +00:00
|
|
|
|
*
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
2006-09-16 17:16:27 +00:00
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
|
#include "precompiled_sd.hxx"
|
2011-03-04 07:38:16 -08:00
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
|
#include <vcl/svapp.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
|
#include <editeng/outliner.hxx>
|
2010-01-13 22:25:07 +01:00
|
|
|
|
#include <sfx2/linkmgr.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
#include <svx/svdotext.hxx>
|
|
|
|
|
#include <tools/urlobj.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
|
#include <editeng/outlobj.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
|
#include <svl/urihelper.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
|
#include <editeng/xmlcnitm.hxx>
|
2002-10-31 12:27:11 +00:00
|
|
|
|
#include <svx/svditer.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
|
#include "glob.hxx"
|
|
|
|
|
#include "glob.hrc"
|
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
|
#include "stlpool.hxx"
|
|
|
|
|
#include "pglink.hxx"
|
2002-10-31 12:27:11 +00:00
|
|
|
|
#include "anminfo.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
#include "../ui/inc/strings.hrc"
|
2004-01-20 09:28:24 +00:00
|
|
|
|
#include "../ui/inc/DrawDocShell.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2001-08-06 07:34:08 +00:00
|
|
|
|
#include <tools/tenccvt.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
|
#include <svl/itemset.hxx>
|
2001-08-06 07:34:08 +00:00
|
|
|
|
|
2004-03-30 14:44:57 +00:00
|
|
|
|
using namespace ::sd;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
using namespace ::com::sun::star;
|
2009-09-16 13:55:36 +00:00
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
using namespace ::com::sun::star::office;
|
|
|
|
|
|
|
|
|
|
extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
2011-03-12 20:06:58 +01:00
|
|
|
|
|* SetPresentationLayout, setzt: Layoutnamen, Masterpage-Verkn<EFBFBD>pfung und
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|* Vorlagen fuer Praesentationsobjekte
|
|
|
|
|
|*
|
|
|
|
|
|* Vorraussetzungen: - Die Seite muss bereits das richtige Model kennen!
|
|
|
|
|
|* - Die entsprechende Masterpage muss bereits im Model sein.
|
|
|
|
|
|* - Die entsprechenden StyleSheets muessen bereits im
|
|
|
|
|
|* im StyleSheetPool sein.
|
|
|
|
|
|*
|
2011-01-17 11:41:00 +01:00
|
|
|
|
|* bReplaceStyleSheets = sal_True : Benannte StyleSheets werden ausgetauscht
|
|
|
|
|
|* sal_False: Alle StyleSheets werden neu zugewiesen
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|*
|
2011-01-17 11:41:00 +01:00
|
|
|
|
|* bSetMasterPage = sal_True : MasterPage suchen und zuweisen
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|*
|
2011-01-17 11:41:00 +01:00
|
|
|
|
|* bReverseOrder = sal_False: MasterPages von vorn nach hinten suchen
|
|
|
|
|
|* sal_True : MasterPages von hinten nach vorn suchen (fuer Undo-Action)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
|
void SdPage::SetPresentationLayout(const String& rLayoutName,
|
2011-01-17 11:41:00 +01:00
|
|
|
|
sal_Bool bReplaceStyleSheets,
|
|
|
|
|
sal_Bool bSetMasterPage,
|
|
|
|
|
sal_Bool bReverseOrder)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
|* Layoutname der Seite
|
|
|
|
|
\********************************************************************/
|
2006-12-12 15:33:34 +00:00
|
|
|
|
String aOldLayoutName(maLayoutName); // merken
|
|
|
|
|
maLayoutName = rLayoutName;
|
|
|
|
|
maLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
|
|
|
|
|
maLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
|* ggf. Masterpage suchen und setzen
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
if (bSetMasterPage && !IsMasterPage())
|
|
|
|
|
{
|
|
|
|
|
SdPage* pMaster;
|
2004-08-31 12:48:34 +00:00
|
|
|
|
SdPage* pFoundMaster = 0;
|
2011-01-17 11:41:00 +01:00
|
|
|
|
sal_uInt16 nMaster = 0;
|
|
|
|
|
sal_uInt16 nMasterCount = pModel->GetMasterPageCount();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
if( !bReverseOrder )
|
|
|
|
|
{
|
|
|
|
|
for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
|
|
|
|
|
{
|
2004-08-31 12:48:34 +00:00
|
|
|
|
pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
|
2006-12-12 15:33:34 +00:00
|
|
|
|
if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2004-08-31 12:48:34 +00:00
|
|
|
|
pFoundMaster = pMaster;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-07-12 13:56:30 +00:00
|
|
|
|
for ( nMaster = nMasterCount; nMaster > 0; nMaster-- )
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2004-08-31 12:48:34 +00:00
|
|
|
|
pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1));
|
2006-12-12 15:33:34 +00:00
|
|
|
|
if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2004-08-31 12:48:34 +00:00
|
|
|
|
pFoundMaster = pMaster;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-31 12:48:34 +00:00
|
|
|
|
DBG_ASSERT(pFoundMaster, "Masterpage for presentation layout not found!");
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2004-08-31 12:48:34 +00:00
|
|
|
|
// this should never happen, but we play failsafe here
|
|
|
|
|
if( pFoundMaster == 0 )
|
2006-12-12 15:33:34 +00:00
|
|
|
|
pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind );
|
2004-08-31 12:48:34 +00:00
|
|
|
|
|
|
|
|
|
if( pFoundMaster )
|
|
|
|
|
TRG_SetMasterPage(*pFoundMaster);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
|* Vorlagen fuer Praesentationsobjekte
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
// Listen mit:
|
|
|
|
|
// - Vorlagenzeigern fuer Gliederungstextobjekt (alte und neue Vorlagen)
|
|
|
|
|
// -Replacedaten fuer OutlinerParaObject
|
2011-03-04 07:38:16 -08:00
|
|
|
|
std::vector<SfxStyleSheetBase*> aOutlineStyles;
|
|
|
|
|
std::vector<SfxStyleSheetBase*> aOldOutlineStyles;
|
|
|
|
|
boost::ptr_vector<StyleReplaceData> aReplList;
|
|
|
|
|
bool bListsFilled = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
|
sal_uLong nObjCount = GetObjCount();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
|
for (sal_uLong nObj = 0; nObj < nObjCount; nObj++)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
|
|
|
|
SdrTextObj* pObj = (SdrTextObj*) GetObj(nObj);
|
|
|
|
|
|
|
|
|
|
if (pObj->GetObjInventor() == SdrInventor &&
|
|
|
|
|
pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
|
|
|
|
|
{
|
|
|
|
|
if (!bListsFilled || !bReplaceStyleSheets)
|
|
|
|
|
{
|
|
|
|
|
String aFullName;
|
|
|
|
|
String aOldFullName;
|
|
|
|
|
SfxStyleSheetBase* pSheet = NULL;
|
|
|
|
|
SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
|
|
|
|
|
|
2008-06-06 10:57:39 +00:00
|
|
|
|
for (sal_Int16 i = -1; i < 9; i++)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2006-12-12 15:33:34 +00:00
|
|
|
|
aFullName = maLayoutName;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
aOldFullName = aOldLayoutName;
|
|
|
|
|
aFullName += sal_Unicode( ' ' );
|
2008-06-06 10:57:39 +00:00
|
|
|
|
aFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
aOldFullName += sal_Unicode( ' ' );
|
2008-06-06 10:57:39 +00:00
|
|
|
|
aOldFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1 );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2008-03-12 10:27:53 +00:00
|
|
|
|
pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
DBG_ASSERT(pSheet, "alte Gliederungsvorlage nicht gefunden");
|
2011-03-04 07:38:16 -08:00
|
|
|
|
aOldOutlineStyles.push_back(pSheet);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2008-03-12 10:27:53 +00:00
|
|
|
|
pSheet = pStShPool->Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
DBG_ASSERT(pSheet, "neue Gliederungsvorlage nicht gefunden");
|
2011-03-04 07:38:16 -08:00
|
|
|
|
aOutlineStyles.push_back(pSheet);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
if (bReplaceStyleSheets && pSheet)
|
|
|
|
|
{
|
|
|
|
|
// Replace anstatt Set
|
|
|
|
|
StyleReplaceData* pReplData = new StyleReplaceData;
|
|
|
|
|
pReplData->nNewFamily = pSheet->GetFamily();
|
|
|
|
|
pReplData->nFamily = pSheet->GetFamily();
|
|
|
|
|
pReplData->aNewName = aFullName;
|
|
|
|
|
pReplData->aName = aOldFullName;
|
2011-03-04 07:38:16 -08:00
|
|
|
|
aReplList.push_back(pReplData);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-07-19 07:53:08 +00:00
|
|
|
|
OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
|
|
|
|
|
|
|
|
|
|
if( pOPO )
|
2008-03-12 10:27:53 +00:00
|
|
|
|
pOPO->SetStyleSheets( i, aFullName, SD_STYLE_FAMILY_MASTERPAGE );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-04 07:38:16 -08:00
|
|
|
|
bListsFilled = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-04 07:38:16 -08:00
|
|
|
|
SfxStyleSheet* pSheet = NULL;
|
|
|
|
|
SfxStyleSheet* pOldSheet = NULL;
|
|
|
|
|
|
|
|
|
|
std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin();
|
|
|
|
|
std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin();
|
|
|
|
|
|
|
|
|
|
while (iterOut != aOutlineStyles.end())
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2011-03-04 07:38:16 -08:00
|
|
|
|
pSheet = reinterpret_cast<SfxStyleSheet*>(*iterOut);
|
|
|
|
|
pOldSheet = reinterpret_cast<SfxStyleSheet*>(*iterOldOut);
|
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
|
if (pSheet != pOldSheet)
|
|
|
|
|
{
|
|
|
|
|
pObj->EndListening(*pOldSheet);
|
|
|
|
|
|
|
|
|
|
if (!pObj->IsListening(*pSheet))
|
|
|
|
|
pObj->StartListening(*pSheet);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-04 07:38:16 -08:00
|
|
|
|
++iterOut;
|
|
|
|
|
++iterOldOut;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
|
|
|
|
|
if ( bReplaceStyleSheets && pOPO )
|
|
|
|
|
{
|
2011-03-04 07:38:16 -08:00
|
|
|
|
boost::ptr_vector<StyleReplaceData>::const_iterator it = aReplList.begin();
|
|
|
|
|
while (it != aReplList.end())
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2011-03-04 07:38:16 -08:00
|
|
|
|
pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
|
|
|
|
|
++it;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (pObj->GetObjInventor() == SdrInventor &&
|
|
|
|
|
pObj->GetObjIdentifier() == OBJ_TITLETEXT)
|
|
|
|
|
{
|
|
|
|
|
// PresObjKind nicht ueber GetPresObjKind() holen, da dort nur
|
|
|
|
|
// die PresObjListe beruecksichtigt wird. Es sollen aber alle
|
|
|
|
|
// "Titelobjekte" hier beruecksichtigt werden (Paste aus Clipboard usw.)
|
|
|
|
|
SfxStyleSheet* pSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
|
|
|
|
|
|
|
|
|
|
if (pSheet)
|
2011-01-17 11:41:00 +01:00
|
|
|
|
pObj->SetStyleSheet(pSheet, sal_True);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SfxStyleSheet* pSheet = GetStyleSheetForPresObj(GetPresObjKind(pObj));
|
|
|
|
|
|
|
|
|
|
if (pSheet)
|
2011-01-17 11:41:00 +01:00
|
|
|
|
pObj->SetStyleSheet(pSheet, sal_True);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-04-26 16:11:09 +00:00
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
|
|
|
|
|* das Gliederungstextobjekt bei den Vorlagen fuer die Gliederungsebenen
|
|
|
|
|
|* abmelden
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
|
void SdPage::EndListenOutlineText()
|
|
|
|
|
{
|
|
|
|
|
SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE);
|
|
|
|
|
|
|
|
|
|
if (pOutlineTextObj)
|
|
|
|
|
{
|
|
|
|
|
SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool();
|
|
|
|
|
DBG_ASSERT(pSPool, "StyleSheetPool nicht gefunden");
|
2006-12-12 15:33:34 +00:00
|
|
|
|
String aTrueLayoutName(maLayoutName);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
aTrueLayoutName.Erase( aTrueLayoutName.SearchAscii( SD_LT_SEPARATOR ));
|
|
|
|
|
|
2011-03-04 21:49:59 -08:00
|
|
|
|
SfxStyleSheet *pSheet = NULL;
|
|
|
|
|
std::vector<SfxStyleSheetBase*> aOutlineStyles;
|
|
|
|
|
pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
|
|
|
|
|
|
|
|
|
|
std::vector<SfxStyleSheetBase*>::iterator iter;
|
|
|
|
|
for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
|
|
|
|
|
{
|
|
|
|
|
pSheet = reinterpret_cast<SfxStyleSheet*>(*iter);
|
|
|
|
|
pOutlineTextObj->EndListening(*pSheet);
|
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-11 11:09:53 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|* Neues Model setzen
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
|
void SdPage::SetModel(SdrModel* pNewModel)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
|
|
|
|
DisconnectLink();
|
|
|
|
|
|
|
|
|
|
// Model umsetzen
|
|
|
|
|
FmFormPage::SetModel(pNewModel);
|
|
|
|
|
|
|
|
|
|
ConnectLink();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
|
|
|
|
|* Ist die Seite read-only?
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
2010-10-05 07:57:51 -05:00
|
|
|
|
bool SdPage::IsReadOnly() const
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2010-10-05 07:57:51 -05:00
|
|
|
|
return false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
2010-01-13 22:25:07 +01:00
|
|
|
|
|* Beim sfx2::LinkManager anmelden
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
|
void SdPage::ConnectLink()
|
|
|
|
|
{
|
2010-01-13 22:25:07 +01:00
|
|
|
|
sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
if (pLinkManager && !mpPageLink && maFileName.Len() && maBookmarkName.Len() &&
|
|
|
|
|
mePageKind==PK_STANDARD && !IsMasterPage() &&
|
2000-09-18 23:16:46 +00:00
|
|
|
|
( (SdDrawDocument*) pModel)->IsNewOrLoadCompleted())
|
|
|
|
|
{
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* Anmelden
|
|
|
|
|
* Nur Standardseiten duerfen gelinkt sein
|
|
|
|
|
**********************************************************************/
|
2004-01-20 09:28:24 +00:00
|
|
|
|
::sd::DrawDocShell* pDocSh = ((SdDrawDocument*) pModel)->GetDocSh();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
if (!pDocSh || pDocSh->GetMedium()->GetOrigURL() != maFileName)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
|
|
|
|
// Keine Links auf Dokument-eigene Seiten!
|
2006-12-12 15:33:34 +00:00
|
|
|
|
mpPageLink = new SdPageLink(this, maFileName, maBookmarkName);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
String aFilterName(SdResId(STR_IMPRESS));
|
2006-12-12 15:33:34 +00:00
|
|
|
|
pLinkManager->InsertFileLink(*mpPageLink, OBJECT_CLIENT_FILE,
|
|
|
|
|
maFileName, &aFilterName, &maBookmarkName);
|
|
|
|
|
mpPageLink->Connect();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
2010-01-13 22:25:07 +01:00
|
|
|
|
|* Beim sfx2::LinkManager abmelden
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
|
void SdPage::DisconnectLink()
|
|
|
|
|
{
|
2010-01-13 22:25:07 +01:00
|
|
|
|
sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
if (pLinkManager && mpPageLink)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* Abmelden
|
|
|
|
|
* (Bei Remove wird *pGraphicLink implizit deleted)
|
|
|
|
|
**********************************************************************/
|
2006-12-12 15:33:34 +00:00
|
|
|
|
pLinkManager->Remove(mpPageLink);
|
|
|
|
|
mpPageLink=NULL;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
|
|
|
|
|* Copy-Ctor
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
SdPage::SdPage(const SdPage& rSrcPage)
|
|
|
|
|
: FmFormPage(rSrcPage)
|
|
|
|
|
, SdrObjUserCall()
|
|
|
|
|
, mpItems(NULL)
|
2000-09-18 23:16:46 +00:00
|
|
|
|
{
|
2006-12-12 15:33:34 +00:00
|
|
|
|
mePageKind = rSrcPage.mePageKind;
|
|
|
|
|
meAutoLayout = rSrcPage.meAutoLayout;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2006-01-10 13:26:51 +00:00
|
|
|
|
SdrObject* pObj = 0;
|
2006-12-12 15:33:34 +00:00
|
|
|
|
while((pObj = rSrcPage.maPresentationShapeList.getNextShape(pObj)) != 0)
|
2006-01-10 13:26:51 +00:00
|
|
|
|
InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
|
mbSelected = sal_False;
|
2004-11-26 18:47:40 +00:00
|
|
|
|
mnTransitionType = rSrcPage.mnTransitionType;
|
|
|
|
|
mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
|
|
|
|
|
mbTransitionDirection = rSrcPage.mbTransitionDirection;
|
|
|
|
|
mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
|
|
|
|
|
mfTransitionDuration = rSrcPage.mfTransitionDuration;
|
2006-12-12 15:33:34 +00:00
|
|
|
|
mePresChange = rSrcPage.mePresChange;
|
|
|
|
|
mnTime = rSrcPage.mnTime;
|
|
|
|
|
mbSoundOn = rSrcPage.mbSoundOn;
|
|
|
|
|
mbExcluded = rSrcPage.mbExcluded;
|
|
|
|
|
|
|
|
|
|
maLayoutName = rSrcPage.maLayoutName;
|
|
|
|
|
maSoundFile = rSrcPage.maSoundFile;
|
2007-06-27 14:37:47 +00:00
|
|
|
|
mbLoopSound = rSrcPage.mbLoopSound;
|
|
|
|
|
mbStopSound = rSrcPage.mbStopSound;
|
2006-12-12 15:33:34 +00:00
|
|
|
|
maCreatedPageName = String();
|
|
|
|
|
maFileName = rSrcPage.maFileName;
|
|
|
|
|
maBookmarkName = rSrcPage.maBookmarkName;
|
|
|
|
|
mbScaleObjects = rSrcPage.mbScaleObjects;
|
|
|
|
|
mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
|
|
|
|
|
meCharSet = rSrcPage.meCharSet;
|
|
|
|
|
mnPaperBin = rSrcPage.mnPaperBin;
|
|
|
|
|
meOrientation = rSrcPage.meOrientation;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2005-07-14 09:43:59 +00:00
|
|
|
|
// header footer
|
|
|
|
|
setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
|
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
mpPageLink = NULL; // Wird beim Einfuegen ueber ConnectLink() gesetzt
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
|
|
|
|
|* Clone
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
|
|
SdrPage* SdPage::Clone() const
|
|
|
|
|
{
|
2006-12-12 15:33:34 +00:00
|
|
|
|
return Clone(NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SdrPage* SdPage::Clone(SdrModel* pNewModel) const
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( pNewModel == 0, "sd::SdPage::Clone(), new page ignored, please check code! CL" );
|
|
|
|
|
(void)pNewModel;
|
|
|
|
|
|
|
|
|
|
SdPage* pNewPage = new SdPage(*this);
|
2005-07-14 09:43:59 +00:00
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
cloneAnimations( *pNewPage );
|
2005-07-14 09:43:59 +00:00
|
|
|
|
|
2005-09-23 09:42:48 +00:00
|
|
|
|
// fix user calls for duplicated slide
|
|
|
|
|
SdrObjListIter aSourceIter( *this, IM_DEEPWITHGROUPS );
|
2006-12-12 15:33:34 +00:00
|
|
|
|
SdrObjListIter aTargetIter( *pNewPage, IM_DEEPWITHGROUPS );
|
2005-09-23 09:42:48 +00:00
|
|
|
|
|
|
|
|
|
while( aSourceIter.IsMore() && aTargetIter.IsMore() )
|
|
|
|
|
{
|
|
|
|
|
SdrObject* pSource = aSourceIter.Next();
|
|
|
|
|
SdrObject* pTarget = aTargetIter.Next();
|
|
|
|
|
|
|
|
|
|
if( pSource->GetUserCall() )
|
2006-12-12 15:33:34 +00:00
|
|
|
|
pTarget->SetUserCall( pNewPage );
|
2005-09-23 09:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-12 15:33:34 +00:00
|
|
|
|
return pNewPage;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-28 14:59:13 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
|*
|
|
|
|
|
|* GetTextStyleSheetForObject
|
|
|
|
|
|*
|
|
|
|
|
\************************************************************************/
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
|
|
2001-01-28 14:59:13 +00:00
|
|
|
|
SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
|
|
|
|
|
{
|
|
|
|
|
const PresObjKind eKind = ((SdPage*)this)->GetPresObjKind(pObj);
|
|
|
|
|
if( eKind != PRESOBJ_NONE )
|
|
|
|
|
{
|
|
|
|
|
return ((SdPage*)this)->GetStyleSheetForPresObj(eKind);
|
|
|
|
|
}
|
2001-01-30 14:25:02 +00:00
|
|
|
|
|
|
|
|
|
return FmFormPage::GetTextStyleSheetForObject( pObj );
|
2001-01-28 14:59:13 +00:00
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
2001-10-12 15:19:53 +00:00
|
|
|
|
SfxItemSet* SdPage::getOrCreateItems()
|
|
|
|
|
{
|
|
|
|
|
if( mpItems == NULL )
|
|
|
|
|
mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
|
|
|
|
|
|
|
|
|
|
return mpItems;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SdPage::setAlienAttributes( const com::sun::star::uno::Any& rAttributes )
|
|
|
|
|
{
|
|
|
|
|
SfxItemSet* pSet = getOrCreateItems();
|
|
|
|
|
|
|
|
|
|
SvXMLAttrContainerItem aAlienAttributes( SDRATTR_XMLATTRIBUTES );
|
|
|
|
|
if( aAlienAttributes.PutValue( rAttributes, 0 ) )
|
|
|
|
|
{
|
|
|
|
|
pSet->Put( aAlienAttributes );
|
|
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::getAlienAttributes( com::sun::star::uno::Any& rAttributes )
|
|
|
|
|
{
|
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
|
|
|
|
|
|
if( (mpItems == NULL) || ( SFX_ITEM_SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, sal_False, &pItem ) ) )
|
|
|
|
|
{
|
|
|
|
|
SvXMLAttrContainerItem aAlienAttributes;
|
|
|
|
|
aAlienAttributes.QueryValue( rAttributes, 0 );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
((SvXMLAttrContainerItem*)pItem)->QueryValue( rAttributes, 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-07 12:34:33 +00:00
|
|
|
|
|
2005-09-23 09:42:48 +00:00
|
|
|
|
void SdPage::RemoveEmptyPresentationObjects()
|
|
|
|
|
{
|
|
|
|
|
SdrObjListIter aShapeIter( *this, IM_DEEPWITHGROUPS );
|
2005-07-07 12:34:33 +00:00
|
|
|
|
|
2005-09-23 09:42:48 +00:00
|
|
|
|
SdrObject* pShape;
|
|
|
|
|
for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
|
|
|
|
|
{
|
|
|
|
|
if( pShape && pShape->IsEmptyPresObj() )
|
2007-07-06 08:47:46 +00:00
|
|
|
|
{
|
|
|
|
|
RemoveObject( pShape->GetOrdNum() );
|
|
|
|
|
SdrObject::Free( pShape );
|
|
|
|
|
}
|
2005-07-07 12:34:33 +00:00
|
|
|
|
|
2005-09-23 09:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-07 12:34:33 +00:00
|
|
|
|
|
|
|
|
|
sal_Int16 SdPage::getTransitionType (void) const
|
|
|
|
|
{
|
|
|
|
|
return mnTransitionType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::setTransitionType( sal_Int16 nTransitionType )
|
|
|
|
|
{
|
|
|
|
|
mnTransitionType = nTransitionType;
|
|
|
|
|
ActionChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_Int16 SdPage::getTransitionSubtype (void) const
|
|
|
|
|
{
|
|
|
|
|
return mnTransitionSubtype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::setTransitionSubtype ( sal_Int16 nTransitionSubtype )
|
|
|
|
|
{
|
|
|
|
|
mnTransitionSubtype = nTransitionSubtype;
|
|
|
|
|
ActionChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_Bool SdPage::getTransitionDirection (void) const
|
|
|
|
|
{
|
|
|
|
|
return mbTransitionDirection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::setTransitionDirection ( sal_Bool bTransitionbDirection )
|
|
|
|
|
{
|
|
|
|
|
mbTransitionDirection = bTransitionbDirection;
|
|
|
|
|
ActionChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_Int32 SdPage::getTransitionFadeColor (void) const
|
|
|
|
|
{
|
|
|
|
|
return mnTransitionFadeColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::setTransitionFadeColor ( sal_Int32 nTransitionFadeColor )
|
|
|
|
|
{
|
|
|
|
|
mnTransitionFadeColor = nTransitionFadeColor;
|
|
|
|
|
ActionChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double SdPage::getTransitionDuration (void) const
|
|
|
|
|
{
|
|
|
|
|
return mfTransitionDuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::setTransitionDuration ( double fTranstionDuration )
|
|
|
|
|
{
|
|
|
|
|
mfTransitionDuration = fTranstionDuration;
|
|
|
|
|
ActionChanged();
|
|
|
|
|
}
|
2009-09-16 13:55:36 +00:00
|
|
|
|
|
|
|
|
|
namespace sd {
|
|
|
|
|
extern void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage );
|
|
|
|
|
extern SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation )
|
|
|
|
|
{
|
|
|
|
|
sd::createAnnotation( xAnnotation, this );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIndex )
|
|
|
|
|
{
|
|
|
|
|
if( (nIndex == -1) || (nIndex > (int)maAnnotations.size()) )
|
|
|
|
|
{
|
|
|
|
|
maAnnotations.push_back( xAnnotation );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( pModel && pModel->IsUndoEnabled() )
|
|
|
|
|
{
|
|
|
|
|
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
|
|
|
|
|
if( pAction )
|
|
|
|
|
pModel->AddUndo( pAction );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetChanged();
|
|
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
|
{
|
|
|
|
|
pModel->SetChanged();
|
|
|
|
|
Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
|
|
|
|
|
NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationInserted" ) ), xSource );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
|
|
|
|
|
{
|
|
|
|
|
if( pModel && pModel->IsUndoEnabled() )
|
|
|
|
|
{
|
|
|
|
|
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
|
|
|
|
|
if( pAction )
|
|
|
|
|
pModel->AddUndo( pAction );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
|
|
|
|
|
if( iter != maAnnotations.end() )
|
|
|
|
|
maAnnotations.erase( iter );
|
|
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
|
{
|
|
|
|
|
pModel->SetChanged();
|
|
|
|
|
Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
|
|
|
|
|
NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationRemoved" ) ), xSource );
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-10-12 15:51:52 +02:00
|
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|