2010-10-12 15:51:52 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-27 16:10:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
|
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>
|
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;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const OUString& rEventName, const Reference< XInterface >& xSource );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Sets: names of layout, master page links and templates for presentation
|
|
|
|
|* objects
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Preconditions: - The page has to know the correct model!
|
|
|
|
|* - The corresponding master page has to be in the model.
|
|
|
|
|* - The corresponding style sheets have to be in the style sheet
|
|
|
|
|* pool.
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* bReplaceStyleSheets = sal_True : Named style sheets are replaced
|
|
|
|
|* sal_False: All style sheets are reassigned
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* bSetMasterPage = sal_True : search and assign master page
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* bReverseOrder = sal_False: search master page from head to tail
|
|
|
|
|* sal_True : search master page from tail to head
|
|
|
|
|* (for undo operations)
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdPage::SetPresentationLayout(const OUString& 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
|
|
|
{
|
|
|
|
/*********************************************************************
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Name of the layout of the page
|
2000-09-18 23:16:46 +00:00
|
|
|
\********************************************************************/
|
2012-09-10 23:42:29 +01:00
|
|
|
OUString aOldLayoutName(maLayoutName); // merken
|
|
|
|
OUStringBuffer aBuf(rLayoutName);
|
|
|
|
aBuf.append(SD_LT_SEPARATOR).append(SdResId(STR_LAYOUT_OUTLINE).toString());
|
|
|
|
maLayoutName = aBuf.makeStringAndClear();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/*********************************************************************
|
2013-03-01 10:54:57 +01:00
|
|
|
|* search and replace master page if necessary
|
2000-09-18 23:16:46 +00:00
|
|
|
\********************************************************************/
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
2013-03-01 10:54:57 +01:00
|
|
|
|* templates for presentation objects
|
2000-09-18 23:16:46 +00:00
|
|
|
\********************************************************************/
|
2013-03-01 10:54:57 +01:00
|
|
|
// list with:
|
|
|
|
// - pointer to templates for outline text object (old and new templates)
|
|
|
|
// - replace-data for 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)
|
|
|
|
{
|
2013-09-18 15:50:00 +02:00
|
|
|
OUString aFullName;
|
|
|
|
OUString aOldFullName;
|
2000-09-18 23:16:46 +00:00
|
|
|
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
|
|
|
{
|
2013-09-19 10:37:30 +01:00
|
|
|
aOldFullName = aOldLayoutName + " " +
|
2013-09-18 15:50:00 +02:00
|
|
|
OUString::number( (sal_Int32) (i <= 0 ) ? 1 : i + 1 );
|
2013-09-19 10:37:30 +01:00
|
|
|
aFullName = maLayoutName + " " +
|
|
|
|
OUString::number( (sal_Int32) (i <= 0 ) ? 1 : i + 1);
|
2008-03-12 10:27:53 +00:00
|
|
|
pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE);
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT(pSheet, "Old outline style sheet not found");
|
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);
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT(pSheet, "New outline style sheet not found");
|
2011-03-04 07:38:16 -08:00
|
|
|
aOutlineStyles.push_back(pSheet);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (bReplaceStyleSheets && pSheet)
|
|
|
|
{
|
2013-03-01 10:54:57 +01:00
|
|
|
// Replace instead Set
|
2000-09-18 23:16:46 +00:00
|
|
|
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-10-26 15:05:27 +03:00
|
|
|
pSheet = static_cast<SfxStyleSheet*>(*iterOut);
|
|
|
|
pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut);
|
2011-03-04 07:38:16 -08:00
|
|
|
|
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)
|
|
|
|
{
|
2013-03-01 10:54:57 +01:00
|
|
|
// We do net get PresObjKind via GetPresObjKind() since there are
|
|
|
|
// only PresObjListe considered. But we want to consider all "Title
|
|
|
|
// objects" here (paste from clipboard etc.)
|
2000-09-18 23:16:46 +00:00
|
|
|
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
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* disconnect outline text object from templates for outline levels
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SdPage::EndListenOutlineText()
|
|
|
|
{
|
|
|
|
SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE);
|
|
|
|
|
|
|
|
if (pOutlineTextObj)
|
|
|
|
{
|
|
|
|
SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool();
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT(pSPool, "StyleSheetPool missing");
|
2013-09-18 15:50:00 +02:00
|
|
|
OUString aTrueLayoutName(maLayoutName);
|
|
|
|
aTrueLayoutName = aTrueLayoutName.copy(0, aTrueLayoutName.indexOf( SD_LT_SEPARATOR ));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2011-10-26 15:05:27 +03:00
|
|
|
pSheet = static_cast<SfxStyleSheet*>(*iter);
|
2011-03-04 21:49:59 -08:00
|
|
|
pOutlineTextObj->EndListening(*pSheet);
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-11 11:09:53 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Set new model
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
void SdPage::SetModel(SdrModel* pNewModel)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
DisconnectLink();
|
|
|
|
|
2013-03-01 10:54:57 +01:00
|
|
|
// assign model
|
2000-09-18 23:16:46 +00:00
|
|
|
FmFormPage::SetModel(pNewModel);
|
|
|
|
|
|
|
|
ConnectLink();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Is this page read-only?
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Connect to sfx2::LinkManager
|
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
|
|
|
|
2013-08-26 15:22:55 +02:00
|
|
|
if (pLinkManager && !mpPageLink && !maFileName.isEmpty() && !maBookmarkName.isEmpty() &&
|
2006-12-12 15:33:34 +00:00
|
|
|
mePageKind==PK_STANDARD && !IsMasterPage() &&
|
2000-09-18 23:16:46 +00:00
|
|
|
( (SdDrawDocument*) pModel)->IsNewOrLoadCompleted())
|
|
|
|
{
|
|
|
|
/**********************************************************************
|
2013-03-01 10:54:57 +01:00
|
|
|
* Connect
|
|
|
|
* Only standard pages are allowed to be linked
|
2000-09-18 23:16:46 +00:00
|
|
|
**********************************************************************/
|
2004-01-20 09:28:24 +00:00
|
|
|
::sd::DrawDocShell* pDocSh = ((SdDrawDocument*) pModel)->GetDocSh();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2012-07-25 09:31:59 -04:00
|
|
|
if (!pDocSh || !pDocSh->GetMedium()->GetOrigURL().equals(maFileName))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-01 10:54:57 +01:00
|
|
|
// No links to document owned pages!
|
2006-12-12 15:33:34 +00:00
|
|
|
mpPageLink = new SdPageLink(this, maFileName, maBookmarkName);
|
2013-08-26 15:22:55 +02:00
|
|
|
OUString 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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:54:57 +01:00
|
|
|
|* Disconnect from sfx2::LinkManager
|
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
|
|
|
{
|
|
|
|
/**********************************************************************
|
2013-03-01 10:54:57 +01:00
|
|
|
* Disconnect
|
|
|
|
* (remove deletes *pGraphicLink implicit)
|
2000-09-18 23:16:46 +00:00
|
|
|
**********************************************************************/
|
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
|
|
|
|
2013-06-25 11:01:52 +01:00
|
|
|
// use shape list directly to preserve constness of rSrcPage
|
|
|
|
const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
|
|
|
|
for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin();
|
|
|
|
aIter != rShapeList.end(); ++aIter )
|
2013-06-02 14:14:37 +02:00
|
|
|
{
|
|
|
|
SdrObject* pObj = *aIter;
|
2006-01-10 13:26:51 +00:00
|
|
|
InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
|
2013-06-02 14:14:37 +02:00
|
|
|
}
|
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;
|
2013-04-02 18:37:00 +02:00
|
|
|
mfTime = rSrcPage.mfTime;
|
2006-12-12 15:33:34 +00:00
|
|
|
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;
|
2013-09-18 15:50:00 +02:00
|
|
|
maCreatedPageName = "";
|
2006-12-12 15:33:34 +00:00
|
|
|
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() );
|
|
|
|
|
2013-03-01 10:54:57 +01:00
|
|
|
mpPageLink = NULL; // is set when inserting via ConnectLink()
|
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();
|
2013-05-02 10:36:43 +02:00
|
|
|
NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xAnnotation );
|
2009-09-16 13:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2013-05-02 10:36:43 +02:00
|
|
|
NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xAnnotation );
|
2009-09-16 13:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-12 15:51:52 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|