1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <com/sun/star/embed/XVisualObject.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> 34*cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 35*cdf0e10cSrcweir #include <sfx2/printer.hxx> 36*cdf0e10cSrcweir #include <sfx2/app.hxx> 37*cdf0e10cSrcweir #ifndef SD_OUTLINE_HXX 38*cdf0e10cSrcweir #include "Outliner.hxx" 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #include <editeng/paperinf.hxx> 41*cdf0e10cSrcweir #include <svx/svdopage.hxx> 42*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 43*cdf0e10cSrcweir #include <svx/svdotext.hxx> 44*cdf0e10cSrcweir #include <svx/svdograf.hxx> 45*cdf0e10cSrcweir #include <svx/svdundo.hxx> 46*cdf0e10cSrcweir #include <vcl/svapp.hxx> 47*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 48*cdf0e10cSrcweir #include <editeng/langitem.hxx> 49*cdf0e10cSrcweir #include <svl/itempool.hxx> 50*cdf0e10cSrcweir #include <svx/svdpool.hxx> 51*cdf0e10cSrcweir #include <editeng/flditem.hxx> 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 54*cdf0e10cSrcweir #include <editeng/editdata.hxx> 55*cdf0e10cSrcweir #include <svx/dialogs.hrc> 56*cdf0e10cSrcweir #include <svx/dialmgr.hxx> // SVX_RESSTR 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #include "eetext.hxx" 59*cdf0e10cSrcweir #include <svx/svditer.hxx> 60*cdf0e10cSrcweir #include <svtools/imapobj.hxx> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #include "sdresid.hxx" 64*cdf0e10cSrcweir #include "drawdoc.hxx" 65*cdf0e10cSrcweir #include "sdpage.hxx" 66*cdf0e10cSrcweir #include "pglink.hxx" 67*cdf0e10cSrcweir #include "glob.hrc" 68*cdf0e10cSrcweir #include "glob.hxx" 69*cdf0e10cSrcweir #include "stlpool.hxx" 70*cdf0e10cSrcweir #include "sdiocmpt.hxx" 71*cdf0e10cSrcweir #include "anminfo.hxx" 72*cdf0e10cSrcweir #include "imapinfo.hxx" 73*cdf0e10cSrcweir #include "cusshow.hxx" 74*cdf0e10cSrcweir #include "undo/undomanager.hxx" 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir #include "../ui/inc/DrawDocShell.hxx" 77*cdf0e10cSrcweir #include "../ui/inc/FrameView.hxx" 78*cdf0e10cSrcweir #include "../ui/inc/cfgids.hxx" 79*cdf0e10cSrcweir #include "../ui/inc/strings.hrc" 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir #include "PageListWatcher.hxx" 82*cdf0e10cSrcweir #include <vcl/virdev.hxx> 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir using namespace ::sd; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir const long PRINT_OFFSET = 30; // siehe \svx\source\dialog\page.cxx (PB) 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir using namespace com::sun::star; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir /************************************************************************* 91*cdf0e10cSrcweir |* 92*cdf0e10cSrcweir |* Sucht ein Objekt per Name 93*cdf0e10cSrcweir |* 94*cdf0e10cSrcweir \************************************************************************/ 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir SdrObject* SdDrawDocument::GetObj(const String& rObjName) const 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir SdrObject* pObj = NULL; 99*cdf0e10cSrcweir SdrObject* pObjFound = NULL; 100*cdf0e10cSrcweir SdPage* pPage = NULL; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /************************************************************************** 103*cdf0e10cSrcweir * Zuerst alle Pages durchsuchen 104*cdf0e10cSrcweir **************************************************************************/ 105*cdf0e10cSrcweir sal_uInt16 nPage = 0; 106*cdf0e10cSrcweir const sal_uInt16 nMaxPages = GetPageCount(); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir while (nPage < nMaxPages && !pObjFound) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir pPage = (SdPage*) GetPage(nPage); 111*cdf0e10cSrcweir SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir while (aIter.IsMore() && !pObjFound) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir pObj = aIter.Next(); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if( ( rObjName == pObj->GetName() ) || 118*cdf0e10cSrcweir ( SdrInventor == pObj->GetObjInventor() && 119*cdf0e10cSrcweir OBJ_OLE2 == pObj->GetObjIdentifier() && 120*cdf0e10cSrcweir rObjName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) ) 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir pObjFound = pObj; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir nPage++; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir /************************************************************************** 130*cdf0e10cSrcweir * Wenn nicht gefunden, dann alle MasterPages durchsuchen 131*cdf0e10cSrcweir **************************************************************************/ 132*cdf0e10cSrcweir nPage = 0; 133*cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = GetMasterPageCount(); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir while (nPage < nMaxMasterPages && !pObjFound) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir pPage = (SdPage*) GetMasterPage(nPage); 138*cdf0e10cSrcweir SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir while (aIter.IsMore() && !pObjFound) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir pObj = aIter.Next(); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir if( ( rObjName == pObj->GetName() ) || 145*cdf0e10cSrcweir ( SdrInventor == pObj->GetObjInventor() && 146*cdf0e10cSrcweir OBJ_OLE2 == pObj->GetObjIdentifier() && 147*cdf0e10cSrcweir rObjName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir pObjFound = pObj; 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir nPage++; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir return (pObjFound); 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir /************************************************************************* 161*cdf0e10cSrcweir |* 162*cdf0e10cSrcweir |* Sucht die SdPage per Name 163*cdf0e10cSrcweir |* 164*cdf0e10cSrcweir \************************************************************************/ 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::GetPageByName(const String& rPgName, sal_Bool& rbIsMasterPage) const 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir SdPage* pPage = NULL; 169*cdf0e10cSrcweir sal_uInt16 nPage = 0; 170*cdf0e10cSrcweir const sal_uInt16 nMaxPages = GetPageCount(); 171*cdf0e10cSrcweir sal_uInt16 nPageNum = SDRPAGE_NOTFOUND; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir rbIsMasterPage = sal_False; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // Search all regular pages and all notes pages (handout pages are 176*cdf0e10cSrcweir // ignored.) 177*cdf0e10cSrcweir while (nPage < nMaxPages && nPageNum == SDRPAGE_NOTFOUND) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir pPage = const_cast<SdPage*>(static_cast<const SdPage*>( 180*cdf0e10cSrcweir GetPage(nPage))); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir if (pPage != NULL 183*cdf0e10cSrcweir && pPage->GetPageKind() != PK_HANDOUT 184*cdf0e10cSrcweir && pPage->GetName() == rPgName) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir nPageNum = nPage; 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir nPage++; 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // Search all master pages when not found among non-master pages. 193*cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = GetMasterPageCount(); 194*cdf0e10cSrcweir nPage = 0; 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir while (nPage < nMaxMasterPages && nPageNum == SDRPAGE_NOTFOUND) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir pPage = const_cast<SdPage*>(static_cast<const SdPage*>( 199*cdf0e10cSrcweir GetMasterPage(nPage))); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir if (pPage && pPage->GetName() == rPgName) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir nPageNum = nPage; 204*cdf0e10cSrcweir rbIsMasterPage = sal_True; 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir nPage++; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir return nPageNum; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir /************************************************************************* 215*cdf0e10cSrcweir |* 216*cdf0e10cSrcweir |* 217*cdf0e10cSrcweir |* 218*cdf0e10cSrcweir \************************************************************************/ 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir SdPage* SdDrawDocument::GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir // #109538# 223*cdf0e10cSrcweir return mpDrawPageListWatcher->GetSdPage(ePgKind, sal_uInt32(nPgNum)); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir /************************************************************************* 227*cdf0e10cSrcweir |* 228*cdf0e10cSrcweir |* 229*cdf0e10cSrcweir |* 230*cdf0e10cSrcweir \************************************************************************/ 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::GetSdPageCount(PageKind ePgKind) const 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir // #109538# 235*cdf0e10cSrcweir return (sal_uInt16)mpDrawPageListWatcher->GetSdPageCount(ePgKind); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir /************************************************************************* 239*cdf0e10cSrcweir |* 240*cdf0e10cSrcweir |* 241*cdf0e10cSrcweir |* 242*cdf0e10cSrcweir \************************************************************************/ 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir SdPage* SdDrawDocument::GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir // #109538# 247*cdf0e10cSrcweir return mpMasterPageListWatcher->GetSdPage(ePgKind, sal_uInt32(nPgNum)); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir /************************************************************************* 251*cdf0e10cSrcweir |* 252*cdf0e10cSrcweir |* 253*cdf0e10cSrcweir |* 254*cdf0e10cSrcweir \************************************************************************/ 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::GetMasterSdPageCount(PageKind ePgKind) const 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir // #109538# 259*cdf0e10cSrcweir return (sal_uInt16)mpMasterPageListWatcher->GetSdPageCount(ePgKind); 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /************************************************************************* 263*cdf0e10cSrcweir |* 264*cdf0e10cSrcweir |* die in den Seitenobjekten der Notizseiten eingetragenen 265*cdf0e10cSrcweir |* Seitennummern anpassen 266*cdf0e10cSrcweir |* 267*cdf0e10cSrcweir \************************************************************************/ 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir void SdDrawDocument::UpdatePageObjectsInNotes(sal_uInt16 nStartPos) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir sal_uInt16 nPageCount = GetPageCount(); 272*cdf0e10cSrcweir SdPage* pPage = NULL; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir for (sal_uInt16 nPage = nStartPos; nPage < nPageCount; nPage++) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir pPage = (SdPage*)GetPage(nPage); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir // wenn es eine Notizseite ist, Seitenobjekt suchen 279*cdf0e10cSrcweir // und Nummer korrigieren 280*cdf0e10cSrcweir if (pPage && pPage->GetPageKind() == PK_NOTES) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir sal_uLong nObjCount = pPage->GetObjCount(); 283*cdf0e10cSrcweir SdrObject* pObj = NULL; 284*cdf0e10cSrcweir for (sal_uLong nObj = 0; nObj < nObjCount; nObj++) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir pObj = pPage->GetObj(nObj); 287*cdf0e10cSrcweir if (pObj->GetObjIdentifier() == OBJ_PAGE && 288*cdf0e10cSrcweir pObj->GetObjInventor() == SdrInventor) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir // das Seitenobjekt stellt die vorhergende Seite (also 291*cdf0e10cSrcweir // die Zeichenseite) dar 292*cdf0e10cSrcweir DBG_ASSERTWARNING(nStartPos, "Notizseitenpos. darf nicht 0 sein"); 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir DBG_ASSERTWARNING(nPage > 1, "Seitenobjekt darf nicht Handzettel darstellen"); 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir if (nStartPos > 0 && nPage > 1) 297*cdf0e10cSrcweir ((SdrPageObj*)pObj)->SetReferencedPage(GetPage(nPage - 1)); 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir void SdDrawDocument::UpdatePageRelativeURLs(const String& rOldName, const String& rNewName) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir if (rNewName.Len() == 0) 307*cdf0e10cSrcweir return; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir SfxItemPool& pPool(GetPool()); 310*cdf0e10cSrcweir sal_uInt32 nCount = pPool.GetItemCount2(EE_FEATURE_FIELD); 311*cdf0e10cSrcweir for (sal_uInt32 nOff = 0; nOff < nCount; nOff++) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir const SfxPoolItem *pItem = pPool.GetItem2(EE_FEATURE_FIELD, nOff); 314*cdf0e10cSrcweir const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem * > (pItem); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if(pFldItem) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) ); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir if(pURLField) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir XubString aURL = pURLField->GetURL(); 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir if (aURL.Len() && (aURL.GetChar(0) == 35) && (aURL.Search(rOldName, 1) == 1)) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir if (aURL.Len() == rOldName.Len() + 1) // standard page name 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir aURL.Erase (1, aURL.Len() - 1); 329*cdf0e10cSrcweir aURL += rNewName; 330*cdf0e10cSrcweir pURLField->SetURL(aURL); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir else 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir const XubString sNotes = SdResId(STR_NOTES); 335*cdf0e10cSrcweir if (aURL.Len() == rOldName.Len() + 2 + sNotes.Len() && aURL.Search(sNotes, rOldName.Len() + 2) == rOldName.Len() + 2) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir aURL.Erase (1, aURL.Len() - 1); 338*cdf0e10cSrcweir aURL += rNewName; 339*cdf0e10cSrcweir aURL += ' '; 340*cdf0e10cSrcweir aURL += sNotes; 341*cdf0e10cSrcweir pURLField->SetURL(aURL); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir void SdDrawDocument::UpdatePageRelativeURLs(SdPage* pPage, sal_uInt16 nPos, sal_Int32 nIncrement) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir bool bNotes = (pPage->GetPageKind() == PK_NOTES); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir SfxItemPool& pPool(GetPool()); 355*cdf0e10cSrcweir sal_uInt32 nCount = pPool.GetItemCount2(EE_FEATURE_FIELD); 356*cdf0e10cSrcweir for (sal_uInt32 nOff = 0; nOff < nCount; nOff++) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir const SfxPoolItem *pItem = pPool.GetItem2(EE_FEATURE_FIELD, nOff); 359*cdf0e10cSrcweir const SvxFieldItem* pFldItem; 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir if ((pFldItem = dynamic_cast< const SvxFieldItem * > (pItem)) != 0) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) ); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir if(pURLField) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir XubString aURL = pURLField->GetURL(); 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir if (aURL.Len() && (aURL.GetChar(0) == 35)) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir XubString aHashSlide('#'); 372*cdf0e10cSrcweir aHashSlide += SdResId(STR_PAGE); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir if (aURL.CompareTo(aHashSlide, aHashSlide.Len()) == COMPARE_EQUAL) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir XubString aURLCopy = aURL; 377*cdf0e10cSrcweir const XubString sNotes = SdResId(STR_NOTES); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir aURLCopy.Erase(0, aHashSlide.Len()); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir bool bNotesLink = (aURLCopy.Len() >= sNotes.Len() + 3 && aURLCopy.Search(sNotes, aURLCopy.Len() - sNotes.Len()) == aURLCopy.Len() - sNotes.Len()); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir if (bNotesLink ^ bNotes) 384*cdf0e10cSrcweir continue; // no compatible link and page 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir if (bNotes) 387*cdf0e10cSrcweir aURLCopy.Erase(aURLCopy.Len() - sNotes.Len(), sNotes.Len()); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir sal_Int32 number = aURLCopy.ToInt32(); 390*cdf0e10cSrcweir sal_uInt16 realPageNumber = (nPos + 1)/ 2; 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir if ( number >= realPageNumber ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir // update link page number 395*cdf0e10cSrcweir number += nIncrement; 396*cdf0e10cSrcweir aURL.Erase (aHashSlide.Len() + 1, aURL.Len() - aHashSlide.Len() - 1); 397*cdf0e10cSrcweir aURL += XubString::CreateFromInt32(number); 398*cdf0e10cSrcweir if (bNotes) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir aURL += ' '; 401*cdf0e10cSrcweir aURL += sNotes; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir pURLField->SetURL(aURL); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir /************************************************************************* 413*cdf0e10cSrcweir |* 414*cdf0e10cSrcweir |* Seite verschieben 415*cdf0e10cSrcweir |* 416*cdf0e10cSrcweir \************************************************************************/ 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir void SdDrawDocument::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir // Seite verschieben 421*cdf0e10cSrcweir FmFormModel::MovePage(nPgNum, nNewPos); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir sal_uInt16 nMin = Min(nPgNum, nNewPos); 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir UpdatePageObjectsInNotes(nMin); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir /************************************************************************* 429*cdf0e10cSrcweir |* 430*cdf0e10cSrcweir |* Seite einfuegen 431*cdf0e10cSrcweir |* 432*cdf0e10cSrcweir \************************************************************************/ 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir bool bLast = (nPos == GetPageCount()); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir FmFormModel::InsertPage(pPage, nPos); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir ((SdPage*)pPage)->ConnectLink(); 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir UpdatePageObjectsInNotes(nPos); 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if (!bLast) 445*cdf0e10cSrcweir UpdatePageRelativeURLs(static_cast<SdPage*>( pPage ), nPos, 1); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir /************************************************************************* 450*cdf0e10cSrcweir |* 451*cdf0e10cSrcweir |* Seite loeschen 452*cdf0e10cSrcweir |* 453*cdf0e10cSrcweir \************************************************************************/ 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir void SdDrawDocument::DeletePage(sal_uInt16 nPgNum) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir FmFormModel::DeletePage(nPgNum); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir UpdatePageObjectsInNotes(nPgNum); 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir /************************************************************************* 463*cdf0e10cSrcweir |* 464*cdf0e10cSrcweir |* Seite entfernen 465*cdf0e10cSrcweir |* 466*cdf0e10cSrcweir \************************************************************************/ 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir SdrPage* pPage = FmFormModel::RemovePage(nPgNum); 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir bool bLast = ((nPgNum+1)/2 == (GetPageCount()+1)/2); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir ((SdPage*)pPage)->DisconnectLink(); 475*cdf0e10cSrcweir ReplacePageInCustomShows( dynamic_cast< SdPage* >( pPage ), 0 ); 476*cdf0e10cSrcweir UpdatePageObjectsInNotes(nPgNum); 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir if (!bLast) 479*cdf0e10cSrcweir UpdatePageRelativeURLs((SdPage*)pPage, nPgNum, -1); 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir return pPage; 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir // Warning: This is not called for new master pages created from SdrModel::Merge, 485*cdf0e10cSrcweir // you also have to modify code in SdDrawDocument::Merge! 486*cdf0e10cSrcweir void SdDrawDocument::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir FmFormModel::InsertMasterPage( pPage, nPos ); 489*cdf0e10cSrcweir if( pPage && pPage->IsMasterPage() && (static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) ) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir // new master page created, add its style family 492*cdf0e10cSrcweir SdStyleSheetPool* pStylePool = (SdStyleSheetPool*) GetStyleSheetPool(); 493*cdf0e10cSrcweir if( pStylePool ) 494*cdf0e10cSrcweir pStylePool->AddStyleFamily( static_cast<SdPage*>(pPage) ); 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir SdrPage* SdDrawDocument::RemoveMasterPage(sal_uInt16 nPgNum) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir SdPage* pPage = static_cast<SdPage*>(GetMasterPage(nPgNum )); 501*cdf0e10cSrcweir if( pPage && pPage->IsMasterPage() && (pPage->GetPageKind() == PK_STANDARD) ) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir // master page removed, remove its style family 504*cdf0e10cSrcweir SdStyleSheetPool* pStylePool = (SdStyleSheetPool*) GetStyleSheetPool(); 505*cdf0e10cSrcweir if( pStylePool ) 506*cdf0e10cSrcweir pStylePool->RemoveStyleFamily( pPage ); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir return FmFormModel::RemoveMasterPage(nPgNum); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir /************************************************************************* 513*cdf0e10cSrcweir |* 514*cdf0e10cSrcweir |* Seiten selektieren 515*cdf0e10cSrcweir |* 516*cdf0e10cSrcweir \************************************************************************/ 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir void SdDrawDocument::SetSelected(SdPage* pPage, sal_Bool bSelect) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir PageKind ePageKind = pPage->GetPageKind(); 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir if (ePageKind == PK_STANDARD) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir pPage->SetSelected(bSelect); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir const sal_uInt16 nDestPageNum(pPage->GetPageNum() + 1); 527*cdf0e10cSrcweir SdPage* pNotesPage = 0L; 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir if(nDestPageNum < GetPageCount()) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir pNotesPage = (SdPage*)GetPage(nDestPageNum); 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir if (pNotesPage && pNotesPage->GetPageKind() == PK_NOTES) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir pNotesPage->SetSelected(bSelect); 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir else if (ePageKind == PK_NOTES) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir pPage->SetSelected(bSelect); 542*cdf0e10cSrcweir SdPage* pStandardPage = (SdPage*) GetPage( pPage->GetPageNum() - 1 ); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir if (pStandardPage && pStandardPage->GetPageKind() == PK_STANDARD) 545*cdf0e10cSrcweir pStandardPage->SetSelected(bSelect); 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir /************************************************************************* 550*cdf0e10cSrcweir |* 551*cdf0e10cSrcweir |* Sofern noch keine Seiten vorhanden sind, werden nun Seiten erzeugt 552*cdf0e10cSrcweir |* 553*cdf0e10cSrcweir \************************************************************************/ 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ ) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir /************************************************************************** 558*cdf0e10cSrcweir * Wenn noch keine Seite im Model vorhanden ist (Datei-Neu), wird 559*cdf0e10cSrcweir * eine neue Seite eingefuegt 560*cdf0e10cSrcweir **************************************************************************/ 561*cdf0e10cSrcweir sal_uInt16 nPageCount = GetPageCount(); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir if (nPageCount <= 1) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir // #i57181# Paper size depends on Language, like in Writer 566*cdf0e10cSrcweir Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM ); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir /********************************************************************** 569*cdf0e10cSrcweir * Handzettel-Seite einfuegen 570*cdf0e10cSrcweir **********************************************************************/ 571*cdf0e10cSrcweir sal_Bool bMasterPage; 572*cdf0e10cSrcweir SdPage* pHandoutPage = dynamic_cast< SdPage* >( AllocPage(bMasterPage=sal_False) ); 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir SdPage* pRefPage = NULL; 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir if( pRefDocument ) 577*cdf0e10cSrcweir pRefPage = pRefDocument->GetSdPage( 0, PK_HANDOUT ); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir if( pRefPage ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir pHandoutPage->SetSize(pRefPage->GetSize()); 582*cdf0e10cSrcweir pHandoutPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() ); 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir else 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir pHandoutPage->SetSize(aDefSize); 587*cdf0e10cSrcweir pHandoutPage->SetBorder(0, 0, 0, 0); 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir pHandoutPage->SetPageKind(PK_HANDOUT); 591*cdf0e10cSrcweir pHandoutPage->SetName( String (SdResId(STR_HANDOUT) ) ); 592*cdf0e10cSrcweir InsertPage(pHandoutPage, 0); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir /********************************************************************** 595*cdf0e10cSrcweir * MasterPage einfuegen und an der Handzettel-Seite vermerken 596*cdf0e10cSrcweir **********************************************************************/ 597*cdf0e10cSrcweir SdPage* pHandoutMPage = (SdPage*) AllocPage(bMasterPage=sal_True); 598*cdf0e10cSrcweir pHandoutMPage->SetSize( pHandoutPage->GetSize() ); 599*cdf0e10cSrcweir pHandoutMPage->SetPageKind(PK_HANDOUT); 600*cdf0e10cSrcweir pHandoutMPage->SetBorder( pHandoutPage->GetLftBorder(), 601*cdf0e10cSrcweir pHandoutPage->GetUppBorder(), 602*cdf0e10cSrcweir pHandoutPage->GetRgtBorder(), 603*cdf0e10cSrcweir pHandoutPage->GetLwrBorder() ); 604*cdf0e10cSrcweir InsertMasterPage(pHandoutMPage, 0); 605*cdf0e10cSrcweir pHandoutPage->TRG_SetMasterPage( *pHandoutMPage ); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir /********************************************************************** 608*cdf0e10cSrcweir * Seite einfuegen 609*cdf0e10cSrcweir * Sofern nPageCount==1 ist, wurde das Model fuers Clipboad erzeugt. 610*cdf0e10cSrcweir * Eine Standard-Seite ist daher schon vorhanden. 611*cdf0e10cSrcweir **********************************************************************/ 612*cdf0e10cSrcweir SdPage* pPage; 613*cdf0e10cSrcweir sal_Bool bClipboard = sal_False; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir if( pRefDocument ) 616*cdf0e10cSrcweir pRefPage = pRefDocument->GetSdPage( 0, PK_STANDARD ); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir if (nPageCount == 0) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir pPage = dynamic_cast< SdPage* >( AllocPage(bMasterPage=sal_False) ); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir if( pRefPage ) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir pPage->SetSize( pRefPage->GetSize() ); 625*cdf0e10cSrcweir pPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() ); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir else if (meDocType == DOCUMENT_TYPE_DRAW) 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir // Draw: stets Default-Groesse mit Raendern 630*cdf0e10cSrcweir pPage->SetSize(aDefSize); 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir SfxPrinter* pPrinter = mpDocSh->GetPrinter(sal_False); 633*cdf0e10cSrcweir if (pPrinter && pPrinter->IsValid()) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir Size aOutSize(pPrinter->GetOutputSize()); 636*cdf0e10cSrcweir Point aPageOffset(pPrinter->GetPageOffset()); 637*cdf0e10cSrcweir aPageOffset -= pPrinter->PixelToLogic( Point() ); 638*cdf0e10cSrcweir long nOffset = !aPageOffset.X() && !aPageOffset.X() ? 0 : PRINT_OFFSET; 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir sal_uLong nTop = aPageOffset.Y(); 641*cdf0e10cSrcweir sal_uLong nLeft = aPageOffset.X(); 642*cdf0e10cSrcweir sal_uLong nBottom = Max((long)(aDefSize.Height() - aOutSize.Height() - nTop + nOffset), 0L); 643*cdf0e10cSrcweir sal_uLong nRight = Max((long)(aDefSize.Width() - aOutSize.Width() - nLeft + nOffset), 0L); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir pPage->SetBorder(nLeft, nTop, nRight, nBottom); 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir else 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir // The printer is not available. Use a border of 10mm 650*cdf0e10cSrcweir // on each side instead. 651*cdf0e10cSrcweir // This has to be kept synchronized with the border 652*cdf0e10cSrcweir // width set in the 653*cdf0e10cSrcweir // SvxPageDescPage::PaperSizeSelect_Impl callback. 654*cdf0e10cSrcweir pPage->SetBorder(1000, 1000, 1000, 1000); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir else 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir // Impress: stets Bildschirmformat, quer 660*cdf0e10cSrcweir Size aSz( SvxPaperInfo::GetPaperSize(PAPER_SCREEN, MAP_100TH_MM) ); 661*cdf0e10cSrcweir pPage->SetSize( Size( aSz.Height(), aSz.Width() ) ); 662*cdf0e10cSrcweir pPage->SetBorder(0, 0, 0, 0); 663*cdf0e10cSrcweir } 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir InsertPage(pPage, 1); 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir else 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir bClipboard = sal_True; 670*cdf0e10cSrcweir pPage = (SdPage*) GetPage(1); 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir /********************************************************************** 674*cdf0e10cSrcweir * MasterPage einfuegen und an der Seite vermerken 675*cdf0e10cSrcweir **********************************************************************/ 676*cdf0e10cSrcweir SdPage* pMPage = (SdPage*) AllocPage(bMasterPage=sal_True); 677*cdf0e10cSrcweir pMPage->SetSize( pPage->GetSize() ); 678*cdf0e10cSrcweir pMPage->SetBorder( pPage->GetLftBorder(), 679*cdf0e10cSrcweir pPage->GetUppBorder(), 680*cdf0e10cSrcweir pPage->GetRgtBorder(), 681*cdf0e10cSrcweir pPage->GetLwrBorder() ); 682*cdf0e10cSrcweir InsertMasterPage(pMPage, 1); 683*cdf0e10cSrcweir pPage->TRG_SetMasterPage( *pMPage ); 684*cdf0e10cSrcweir if( bClipboard ) 685*cdf0e10cSrcweir pMPage->SetLayoutName( pPage->GetLayoutName() ); 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir /********************************************************************** 688*cdf0e10cSrcweir * Notizen-Seite einfuegen 689*cdf0e10cSrcweir **********************************************************************/ 690*cdf0e10cSrcweir SdPage* pNotesPage = (SdPage*) AllocPage(bMasterPage=sal_False); 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir if( pRefDocument ) 693*cdf0e10cSrcweir pRefPage = pRefDocument->GetSdPage( 0, PK_NOTES ); 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir if( pRefPage ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir pNotesPage->SetSize( pRefPage->GetSize() ); 698*cdf0e10cSrcweir pNotesPage->SetBorder( pRefPage->GetLftBorder(), pRefPage->GetUppBorder(), pRefPage->GetRgtBorder(), pRefPage->GetLwrBorder() ); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir else 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir // Stets Hochformat 703*cdf0e10cSrcweir if (aDefSize.Height() >= aDefSize.Width()) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir pNotesPage->SetSize(aDefSize); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir else 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir pNotesPage->SetSize( Size(aDefSize.Height(), aDefSize.Width()) ); 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir pNotesPage->SetBorder(0, 0, 0, 0); 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir pNotesPage->SetPageKind(PK_NOTES); 715*cdf0e10cSrcweir InsertPage(pNotesPage, 2); 716*cdf0e10cSrcweir if( bClipboard ) 717*cdf0e10cSrcweir pNotesPage->SetLayoutName( pPage->GetLayoutName() ); 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir /********************************************************************** 720*cdf0e10cSrcweir * MasterPage einfuegen und an der Notizen-Seite vermerken 721*cdf0e10cSrcweir **********************************************************************/ 722*cdf0e10cSrcweir SdPage* pNotesMPage = (SdPage*) AllocPage(bMasterPage=sal_True); 723*cdf0e10cSrcweir pNotesMPage->SetSize( pNotesPage->GetSize() ); 724*cdf0e10cSrcweir pNotesMPage->SetPageKind(PK_NOTES); 725*cdf0e10cSrcweir pNotesMPage->SetBorder( pNotesPage->GetLftBorder(), 726*cdf0e10cSrcweir pNotesPage->GetUppBorder(), 727*cdf0e10cSrcweir pNotesPage->GetRgtBorder(), 728*cdf0e10cSrcweir pNotesPage->GetLwrBorder() ); 729*cdf0e10cSrcweir InsertMasterPage(pNotesMPage, 2); 730*cdf0e10cSrcweir pNotesPage->TRG_SetMasterPage( *pNotesMPage ); 731*cdf0e10cSrcweir if( bClipboard ) 732*cdf0e10cSrcweir pNotesMPage->SetLayoutName( pPage->GetLayoutName() ); 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir if( !pRefPage && (meDocType != DOCUMENT_TYPE_DRAW) ) 736*cdf0e10cSrcweir pPage->SetAutoLayout( AUTOLAYOUT_TITLE, sal_True, sal_True ); 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir mpWorkStartupTimer = new Timer(); 739*cdf0e10cSrcweir mpWorkStartupTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, WorkStartupHdl) ); 740*cdf0e10cSrcweir mpWorkStartupTimer->SetTimeout(2000); 741*cdf0e10cSrcweir mpWorkStartupTimer->Start(); 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir SetChanged(sal_False); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir /************************************************************************* 748*cdf0e10cSrcweir |* 749*cdf0e10cSrcweir |* Erzeugt fehlende Notiz und Handzettelseiten (nach PowerPoint-Import) 750*cdf0e10cSrcweir |* Es wird davon ausgegangen, dass mindestens eine Standard-Seite und 751*cdf0e10cSrcweir |* eine Standard-MasterPage vorhanden sind. 752*cdf0e10cSrcweir |* 753*cdf0e10cSrcweir \************************************************************************/ 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir sal_Bool SdDrawDocument::CreateMissingNotesAndHandoutPages() 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir sal_Bool bOK = sal_False; 758*cdf0e10cSrcweir sal_uInt16 nPageCount = GetPageCount(); 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir if (nPageCount != 0) 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir /********************************************************************** 763*cdf0e10cSrcweir * PageKind setzen 764*cdf0e10cSrcweir **********************************************************************/ 765*cdf0e10cSrcweir SdPage* pHandoutMPage = (SdPage*) GetMasterPage(0); 766*cdf0e10cSrcweir pHandoutMPage->SetPageKind(PK_HANDOUT); 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir SdPage* pHandoutPage = (SdPage*) GetPage(0); 769*cdf0e10cSrcweir pHandoutPage->SetPageKind(PK_HANDOUT); 770*cdf0e10cSrcweir pHandoutPage->TRG_SetMasterPage( *pHandoutMPage ); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir for (sal_uInt16 i = 1; i < nPageCount; i = i + 2) 773*cdf0e10cSrcweir { 774*cdf0e10cSrcweir SdPage* pPage = (SdPage*) GetPage(i); 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir if(!pPage->TRG_HasMasterPage()) 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir // Keine MasterPage gesetzt -> erste Standard-MasterPage nehmen 779*cdf0e10cSrcweir // (Wenn bei PPT keine Standard-Seite vorhanden war) 780*cdf0e10cSrcweir pPage->TRG_SetMasterPage(*GetMasterPage(1)); 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir SdPage* pNotesPage = (SdPage*) GetPage(i+1); 784*cdf0e10cSrcweir pNotesPage->SetPageKind(PK_NOTES); 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir // Notiz-MasterPages setzen 787*cdf0e10cSrcweir sal_uInt16 nMasterPageAfterPagesMasterPage = (pPage->TRG_GetMasterPage()).GetPageNum() + 1; 788*cdf0e10cSrcweir pNotesPage->TRG_SetMasterPage(*GetMasterPage(nMasterPageAfterPagesMasterPage)); 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir bOK = sal_True; 792*cdf0e10cSrcweir StopWorkStartupDelay(); 793*cdf0e10cSrcweir SetChanged(sal_False); 794*cdf0e10cSrcweir } 795*cdf0e10cSrcweir 796*cdf0e10cSrcweir return(bOK); 797*cdf0e10cSrcweir } 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir /************************************************************************* 800*cdf0e10cSrcweir |* 801*cdf0e10cSrcweir |* - selektierte Seiten hinter genannte Seite schieben 802*cdf0e10cSrcweir |* (nTargetPage = (sal_uInt16)-1 --> vor erste Seite schieben) 803*cdf0e10cSrcweir |* - ergibt sal_True, wenn Seiten verschoben wurden 804*cdf0e10cSrcweir |* 805*cdf0e10cSrcweir \************************************************************************/ 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir sal_Bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage) 808*cdf0e10cSrcweir { 809*cdf0e10cSrcweir SdPage* pTargetPage = NULL; 810*cdf0e10cSrcweir SdPage* pPage = NULL; 811*cdf0e10cSrcweir sal_uInt16 nPage; 812*cdf0e10cSrcweir sal_uInt16 nNoOfPages = GetSdPageCount(PK_STANDARD); 813*cdf0e10cSrcweir sal_Bool bSomethingHappened = sal_False; 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir if( bUndo ) 818*cdf0e10cSrcweir BegUndo(String(SdResId(STR_UNDO_MOVEPAGES))); 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir // Liste mit selektierten Seiten 821*cdf0e10cSrcweir List aPageList; 822*cdf0e10cSrcweir for (nPage = 0; nPage < nNoOfPages; nPage++) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir pPage = GetSdPage(nPage, PK_STANDARD); 825*cdf0e10cSrcweir if (pPage->IsSelected()) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir aPageList.Insert(pPage, LIST_APPEND); 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir // falls noetig, nach vorne hangeln, bis nicht selektierte Seite gefunden 832*cdf0e10cSrcweir nPage = nTargetPage; 833*cdf0e10cSrcweir if (nPage != (sal_uInt16)-1) 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir pPage = GetSdPage(nPage, PK_STANDARD); 836*cdf0e10cSrcweir while (nPage > 0 && pPage->IsSelected()) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir nPage--; 839*cdf0e10cSrcweir pPage = GetSdPage(nPage, PK_STANDARD); 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir if (pPage->IsSelected()) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir nPage = (sal_uInt16)-1; 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir // vor der ersten Seite einfuegen 849*cdf0e10cSrcweir if (nPage == (sal_uInt16)-1) 850*cdf0e10cSrcweir { 851*cdf0e10cSrcweir while (aPageList.Count() > 0) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir aPageList.Last(); 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir nPage = ( (SdPage*) aPageList.GetCurObject() )->GetPageNum(); 856*cdf0e10cSrcweir if (nPage != 0) 857*cdf0e10cSrcweir { 858*cdf0e10cSrcweir SdrPage* pPg = GetPage(nPage); 859*cdf0e10cSrcweir if( bUndo ) 860*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, 1)); 861*cdf0e10cSrcweir MovePage(nPage, 1); 862*cdf0e10cSrcweir pPg = GetPage(nPage+1); 863*cdf0e10cSrcweir if( bUndo ) 864*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, 2)); 865*cdf0e10cSrcweir MovePage(nPage+1, 2); 866*cdf0e10cSrcweir bSomethingHappened = sal_True; 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir aPageList.Remove(); 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir // hinter <nPage> einfuegen 872*cdf0e10cSrcweir else 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir pTargetPage = GetSdPage(nPage, PK_STANDARD); 875*cdf0e10cSrcweir nTargetPage = nPage; 876*cdf0e10cSrcweir nTargetPage = 2 * nTargetPage + 1; // PK_STANDARD --> absolut 877*cdf0e10cSrcweir while (aPageList.Count() > 0) 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir pPage = (SdPage*)aPageList.GetObject(0); 880*cdf0e10cSrcweir nPage = pPage->GetPageNum(); 881*cdf0e10cSrcweir if (nPage > nTargetPage) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir nTargetPage += 2; // hinter (!) der Seite einfuegen 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir if (nPage != nTargetPage) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir SdrPage* pPg = GetPage(nPage); 888*cdf0e10cSrcweir if( bUndo ) 889*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, nTargetPage)); 890*cdf0e10cSrcweir MovePage(nPage, nTargetPage); 891*cdf0e10cSrcweir pPg = GetPage(nPage+1); 892*cdf0e10cSrcweir if( bUndo ) 893*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, nTargetPage+1)); 894*cdf0e10cSrcweir MovePage(nPage+1, nTargetPage+1); 895*cdf0e10cSrcweir bSomethingHappened = sal_True; 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir } 898*cdf0e10cSrcweir else 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir if (nPage != nTargetPage) 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir SdrPage* pPg = GetPage(nPage+1); 903*cdf0e10cSrcweir if( bUndo ) 904*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage+1, nTargetPage+1)); 905*cdf0e10cSrcweir MovePage(nPage+1, nTargetPage+1); 906*cdf0e10cSrcweir pPg = GetPage(nPage); 907*cdf0e10cSrcweir if( bUndo ) 908*cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*pPg, nPage, nTargetPage)); 909*cdf0e10cSrcweir MovePage(nPage, nTargetPage); 910*cdf0e10cSrcweir bSomethingHappened = sal_True; 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir } 913*cdf0e10cSrcweir aPageList.Remove((sal_uLong)0); 914*cdf0e10cSrcweir nTargetPage = pPage->GetPageNum(); 915*cdf0e10cSrcweir } 916*cdf0e10cSrcweir } 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir if( bUndo ) 919*cdf0e10cSrcweir EndUndo(); 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir return bSomethingHappened; 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir /************************************************************************* 926*cdf0e10cSrcweir |* 927*cdf0e10cSrcweir |* Anzahl der Links im sfx2::LinkManager zurueckgeben 928*cdf0e10cSrcweir |* 929*cdf0e10cSrcweir \************************************************************************/ 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir sal_uLong SdDrawDocument::GetLinkCount() 932*cdf0e10cSrcweir { 933*cdf0e10cSrcweir return ( pLinkManager->GetLinks().Count() ); 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir /************************************************************************* 937*cdf0e10cSrcweir |* 938*cdf0e10cSrcweir |* Language setzen 939*cdf0e10cSrcweir |* 940*cdf0e10cSrcweir \************************************************************************/ 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir void SdDrawDocument::SetLanguage( const LanguageType eLang, const sal_uInt16 nId ) 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir sal_Bool bChanged = sal_False; 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir if( nId == EE_CHAR_LANGUAGE && meLanguage != eLang ) 947*cdf0e10cSrcweir { 948*cdf0e10cSrcweir meLanguage = eLang; 949*cdf0e10cSrcweir bChanged = sal_True; 950*cdf0e10cSrcweir } 951*cdf0e10cSrcweir else if( nId == EE_CHAR_LANGUAGE_CJK && meLanguageCJK != eLang ) 952*cdf0e10cSrcweir { 953*cdf0e10cSrcweir meLanguageCJK = eLang; 954*cdf0e10cSrcweir bChanged = sal_True; 955*cdf0e10cSrcweir } 956*cdf0e10cSrcweir else if( nId == EE_CHAR_LANGUAGE_CTL && meLanguageCTL != eLang ) 957*cdf0e10cSrcweir { 958*cdf0e10cSrcweir meLanguageCTL = eLang; 959*cdf0e10cSrcweir bChanged = sal_True; 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir if( bChanged ) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 965*cdf0e10cSrcweir pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 966*cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SvxLanguageItem( eLang, nId ) ); 967*cdf0e10cSrcweir SetChanged( bChanged ); 968*cdf0e10cSrcweir } 969*cdf0e10cSrcweir } 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir 972*cdf0e10cSrcweir /************************************************************************* 973*cdf0e10cSrcweir |* 974*cdf0e10cSrcweir |* Return language 975*cdf0e10cSrcweir |* 976*cdf0e10cSrcweir \************************************************************************/ 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir LanguageType SdDrawDocument::GetLanguage( const sal_uInt16 nId ) const 979*cdf0e10cSrcweir { 980*cdf0e10cSrcweir LanguageType eLangType = meLanguage; 981*cdf0e10cSrcweir 982*cdf0e10cSrcweir if( nId == EE_CHAR_LANGUAGE_CJK ) 983*cdf0e10cSrcweir eLangType = meLanguageCJK; 984*cdf0e10cSrcweir else if( nId == EE_CHAR_LANGUAGE_CTL ) 985*cdf0e10cSrcweir eLangType = meLanguageCTL; 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir return eLangType; 988*cdf0e10cSrcweir } 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir /************************************************************************* 992*cdf0e10cSrcweir |* 993*cdf0e10cSrcweir |* WorkStartup einleiten 994*cdf0e10cSrcweir |* 995*cdf0e10cSrcweir \************************************************************************/ 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir IMPL_LINK( SdDrawDocument, WorkStartupHdl, Timer *, EMPTYARG ) 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir if( mpDocSh ) 1000*cdf0e10cSrcweir mpDocSh->SetWaitCursor( sal_True ); 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir sal_Bool bChanged = IsChanged(); // merken 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir // Autolayouts initialisieren 1005*cdf0e10cSrcweir SdPage* pHandoutMPage = GetMasterSdPage(0, PK_HANDOUT); 1006*cdf0e10cSrcweir 1007*cdf0e10cSrcweir if (pHandoutMPage->GetAutoLayout() == AUTOLAYOUT_NONE) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir // AutoLayout wurde noch nicht umgesetzt -> Initialisieren 1010*cdf0e10cSrcweir pHandoutMPage->SetAutoLayout(AUTOLAYOUT_HANDOUT6, sal_True, sal_True); 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir SdPage* pPage = GetSdPage(0, PK_STANDARD); 1014*cdf0e10cSrcweir 1015*cdf0e10cSrcweir if (pPage->GetAutoLayout() == AUTOLAYOUT_NONE) 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir // AutoLayout wurde noch nicht umgesetzt -> Initialisieren 1018*cdf0e10cSrcweir pPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True, sal_True); 1019*cdf0e10cSrcweir } 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir SdPage* pNotesPage = GetSdPage(0, PK_NOTES); 1022*cdf0e10cSrcweir 1023*cdf0e10cSrcweir if (pNotesPage->GetAutoLayout() == AUTOLAYOUT_NONE) 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir // AutoLayout wurde noch nicht umgesetzt -> Initialisieren 1026*cdf0e10cSrcweir pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True); 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir SetChanged(bChanged || sal_False); 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir if( mpDocSh ) 1032*cdf0e10cSrcweir mpDocSh->SetWaitCursor( sal_False ); 1033*cdf0e10cSrcweir return 0; 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir /************************************************************************* 1038*cdf0e10cSrcweir |* 1039*cdf0e10cSrcweir |* Wenn der WorkStartupTimer erzeugt worden ist (das erfolgt ausschliesslich 1040*cdf0e10cSrcweir |* in SdDrawViewShell::Consruct() ), so wird der Timer ggf. gestoppt und 1041*cdf0e10cSrcweir |* das WorkStartup eingeleitet 1042*cdf0e10cSrcweir |* 1043*cdf0e10cSrcweir \************************************************************************/ 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir void SdDrawDocument::StopWorkStartupDelay() 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir if (mpWorkStartupTimer) 1048*cdf0e10cSrcweir { 1049*cdf0e10cSrcweir if ( mpWorkStartupTimer->IsActive() ) 1050*cdf0e10cSrcweir { 1051*cdf0e10cSrcweir // Timer war noch nicht abgelaufen -> WorkStartup wird eingeleitet 1052*cdf0e10cSrcweir mpWorkStartupTimer->Stop(); 1053*cdf0e10cSrcweir WorkStartupHdl(NULL); 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir delete mpWorkStartupTimer; 1057*cdf0e10cSrcweir mpWorkStartupTimer = NULL; 1058*cdf0e10cSrcweir } 1059*cdf0e10cSrcweir } 1060*cdf0e10cSrcweir 1061*cdf0e10cSrcweir /************************************************************************* 1062*cdf0e10cSrcweir |* 1063*cdf0e10cSrcweir |* Wenn der WorkStartupTimer erzeugt worden ist (das erfolgt ausschliesslich 1064*cdf0e10cSrcweir |* in SdDrawViewShell::Consruct() ), so wird der Timer ggf. gestoppt und 1065*cdf0e10cSrcweir |* das WorkStartup eingeleitet 1066*cdf0e10cSrcweir |* 1067*cdf0e10cSrcweir \************************************************************************/ 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir SdAnimationInfo* SdDrawDocument::GetAnimationInfo(SdrObject* pObject) const 1070*cdf0e10cSrcweir { 1071*cdf0e10cSrcweir DBG_ASSERT(pObject, "sd::SdDrawDocument::GetAnimationInfo(), invalid argument!"); 1072*cdf0e10cSrcweir if( pObject ) 1073*cdf0e10cSrcweir return GetShapeUserData( *pObject, false ); 1074*cdf0e10cSrcweir else 1075*cdf0e10cSrcweir return 0; 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir SdAnimationInfo* SdDrawDocument::GetShapeUserData(SdrObject& rObject, bool bCreate /* = false */ ) 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir sal_uInt16 nUD = 0; 1081*cdf0e10cSrcweir sal_uInt16 nUDCount = rObject.GetUserDataCount(); 1082*cdf0e10cSrcweir SdrObjUserData* pUD = 0; 1083*cdf0e10cSrcweir SdAnimationInfo* pRet = 0; 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir // gibt es in den User-Daten eine Animationsinformation? 1086*cdf0e10cSrcweir for (nUD = 0; nUD < nUDCount; nUD++) 1087*cdf0e10cSrcweir { 1088*cdf0e10cSrcweir pUD = rObject.GetUserData(nUD); 1089*cdf0e10cSrcweir if((pUD->GetInventor() == SdUDInventor) && (pUD->GetId() == SD_ANIMATIONINFO_ID)) 1090*cdf0e10cSrcweir { 1091*cdf0e10cSrcweir pRet = dynamic_cast<SdAnimationInfo*>(pUD); 1092*cdf0e10cSrcweir break; 1093*cdf0e10cSrcweir } 1094*cdf0e10cSrcweir } 1095*cdf0e10cSrcweir 1096*cdf0e10cSrcweir if( (pRet == 0) && bCreate ) 1097*cdf0e10cSrcweir { 1098*cdf0e10cSrcweir pRet = new SdAnimationInfo( rObject ); 1099*cdf0e10cSrcweir rObject.InsertUserData( pRet); 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir return pRet; 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir 1106*cdf0e10cSrcweir /************************************************************************* 1107*cdf0e10cSrcweir |* 1108*cdf0e10cSrcweir |* 1109*cdf0e10cSrcweir |* 1110*cdf0e10cSrcweir \************************************************************************/ 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir SdIMapInfo* SdDrawDocument::GetIMapInfo( SdrObject* pObject ) const 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir DBG_ASSERT(pObject, "ohne Objekt keine IMapInfo"); 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir SdrObjUserData* pUserData = NULL; 1117*cdf0e10cSrcweir SdIMapInfo* pIMapInfo = NULL; 1118*cdf0e10cSrcweir sal_uInt16 nCount = pObject->GetUserDataCount(); 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir // gibt es in den User-Daten eine IMap-Information? 1121*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; i++ ) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir pUserData = pObject->GetUserData( i ); 1124*cdf0e10cSrcweir 1125*cdf0e10cSrcweir if ( ( pUserData->GetInventor() == SdUDInventor ) && ( pUserData->GetId() == SD_IMAPINFO_ID ) ) 1126*cdf0e10cSrcweir pIMapInfo = (SdIMapInfo*) pUserData; 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir 1129*cdf0e10cSrcweir return pIMapInfo; 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir /************************************************************************* 1134*cdf0e10cSrcweir |* 1135*cdf0e10cSrcweir |* 1136*cdf0e10cSrcweir |* 1137*cdf0e10cSrcweir \************************************************************************/ 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj, 1140*cdf0e10cSrcweir const Point& rWinPoint, 1141*cdf0e10cSrcweir const ::Window& /* rCmpWnd */ ) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir SdIMapInfo* pIMapInfo = GetIMapInfo( pObj ); 1144*cdf0e10cSrcweir IMapObject* pIMapObj = NULL; 1145*cdf0e10cSrcweir 1146*cdf0e10cSrcweir if ( pIMapInfo ) 1147*cdf0e10cSrcweir { 1148*cdf0e10cSrcweir const MapMode aMap100( MAP_100TH_MM ); 1149*cdf0e10cSrcweir Size aGraphSize; 1150*cdf0e10cSrcweir Point aRelPoint( rWinPoint ); 1151*cdf0e10cSrcweir ImageMap& rImageMap = (ImageMap&) pIMapInfo->GetImageMap(); 1152*cdf0e10cSrcweir const Rectangle& rRect = pObj->GetLogicRect(); 1153*cdf0e10cSrcweir sal_Bool bObjSupported = sal_False; 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir // HitTest ausfuehren 1156*cdf0e10cSrcweir if ( pObj->ISA( SdrGrafObj ) ) // einfaches Grafik-Objekt 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir const SdrGrafObj* pGrafObj = (const SdrGrafObj*) pObj; 1159*cdf0e10cSrcweir const GeoStat& rGeo = pGrafObj->GetGeoStat(); 1160*cdf0e10cSrcweir SdrGrafObjGeoData* pGeoData = (SdrGrafObjGeoData*) pGrafObj->GetGeoData(); 1161*cdf0e10cSrcweir 1162*cdf0e10cSrcweir // Drehung rueckgaengig 1163*cdf0e10cSrcweir if ( rGeo.nDrehWink ) 1164*cdf0e10cSrcweir RotatePoint( aRelPoint, rRect.TopLeft(), -rGeo.nSin, rGeo.nCos ); 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir // Spiegelung rueckgaengig 1167*cdf0e10cSrcweir if ( pGeoData->bMirrored ) 1168*cdf0e10cSrcweir aRelPoint.X() = rRect.Right() + rRect.Left() - aRelPoint.X(); 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir // ggf. Unshear: 1171*cdf0e10cSrcweir if ( rGeo.nShearWink ) 1172*cdf0e10cSrcweir ShearPoint( aRelPoint, rRect.TopLeft(), -rGeo.nTan ); 1173*cdf0e10cSrcweir 1174*cdf0e10cSrcweir if ( pGrafObj->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL ) 1175*cdf0e10cSrcweir aGraphSize = Application::GetDefaultDevice()->PixelToLogic( pGrafObj->GetGrafPrefSize(), aMap100 ); 1176*cdf0e10cSrcweir else 1177*cdf0e10cSrcweir aGraphSize = OutputDevice::LogicToLogic( pGrafObj->GetGrafPrefSize(), 1178*cdf0e10cSrcweir pGrafObj->GetGrafPrefMapMode(), aMap100 ); 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir delete pGeoData; 1181*cdf0e10cSrcweir bObjSupported = sal_True; 1182*cdf0e10cSrcweir } 1183*cdf0e10cSrcweir else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt 1184*cdf0e10cSrcweir { 1185*cdf0e10cSrcweir aGraphSize = ( (SdrOle2Obj*) pObj )->GetOrigObjSize(); 1186*cdf0e10cSrcweir bObjSupported = sal_True; 1187*cdf0e10cSrcweir } 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir // hat alles geklappt, dann HitTest ausfuehren 1190*cdf0e10cSrcweir if ( bObjSupported ) 1191*cdf0e10cSrcweir { 1192*cdf0e10cSrcweir // relativen Mauspunkt berechnen 1193*cdf0e10cSrcweir aRelPoint -= rRect.TopLeft(); 1194*cdf0e10cSrcweir pIMapObj = rImageMap.GetHitIMapObject( aGraphSize, rRect.GetSize(), aRelPoint ); 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir // Deaktivierte Objekte wollen wir nicht 1197*cdf0e10cSrcweir if ( pIMapObj && !pIMapObj->IsActive() ) 1198*cdf0e10cSrcweir pIMapObj = NULL; 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir } 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweir return pIMapObj; 1203*cdf0e10cSrcweir } 1204*cdf0e10cSrcweir 1205*cdf0e10cSrcweir /** this method enforces that the masterpages are in the currect order, 1206*cdf0e10cSrcweir that is at position 1 is a PK_STANDARD masterpage followed by a 1207*cdf0e10cSrcweir PK_NOTES masterpage and so on. # 1208*cdf0e10cSrcweir */ 1209*cdf0e10cSrcweir void SdDrawDocument::CheckMasterPages() 1210*cdf0e10cSrcweir { 1211*cdf0e10cSrcweir // RemoveMasterPage(2); // code to test the creation of notes pages 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir sal_uInt16 nMaxPages = GetMasterPageCount(); 1214*cdf0e10cSrcweir 1215*cdf0e10cSrcweir // we need at least a handout master and one master page 1216*cdf0e10cSrcweir if( nMaxPages < 2 ) 1217*cdf0e10cSrcweir { 1218*cdf0e10cSrcweir return; 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir 1221*cdf0e10cSrcweir SdPage* pPage = NULL; 1222*cdf0e10cSrcweir SdPage* pNotesPage = NULL; 1223*cdf0e10cSrcweir 1224*cdf0e10cSrcweir sal_uInt16 nPage; 1225*cdf0e10cSrcweir 1226*cdf0e10cSrcweir // first see if the page order is correct 1227*cdf0e10cSrcweir for( nPage = 1; nPage < nMaxPages; nPage++ ) 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir pPage = static_cast<SdPage*> (GetMasterPage( nPage )); 1230*cdf0e10cSrcweir // if an odd page is not a standard page or an even page is not a notes page 1231*cdf0e10cSrcweir if( ((1 == (nPage & 1)) && (pPage->GetPageKind() != PK_STANDARD) ) || 1232*cdf0e10cSrcweir ((0 == (nPage & 1)) && (pPage->GetPageKind() != PK_NOTES) ) ) 1233*cdf0e10cSrcweir break; // then we have a fatal error 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir if( nPage < nMaxPages ) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir // there is a fatal error in the master page order, 1239*cdf0e10cSrcweir // we need to repair the document 1240*cdf0e10cSrcweir sal_Bool bChanged = sal_False; 1241*cdf0e10cSrcweir 1242*cdf0e10cSrcweir nPage = 1; 1243*cdf0e10cSrcweir while( nPage < nMaxPages ) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir pPage = static_cast<SdPage*> (GetMasterPage( nPage )); 1246*cdf0e10cSrcweir if( pPage->GetPageKind() != PK_STANDARD ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir bChanged = sal_True; 1249*cdf0e10cSrcweir sal_uInt16 nFound = nPage + 1; 1250*cdf0e10cSrcweir while( nFound < nMaxPages ) 1251*cdf0e10cSrcweir { 1252*cdf0e10cSrcweir pPage = static_cast<SdPage*>(GetMasterPage( nFound )); 1253*cdf0e10cSrcweir if( PK_STANDARD == pPage->GetPageKind() ) 1254*cdf0e10cSrcweir { 1255*cdf0e10cSrcweir MoveMasterPage( nFound, nPage ); 1256*cdf0e10cSrcweir pPage->SetInserted(sal_True); 1257*cdf0e10cSrcweir break; 1258*cdf0e10cSrcweir 1259*cdf0e10cSrcweir } 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir nFound++; 1262*cdf0e10cSrcweir } 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir // if we don't have any more standard pages, were done 1265*cdf0e10cSrcweir if( nMaxPages == nFound ) 1266*cdf0e10cSrcweir break; 1267*cdf0e10cSrcweir } 1268*cdf0e10cSrcweir 1269*cdf0e10cSrcweir nPage++; 1270*cdf0e10cSrcweir 1271*cdf0e10cSrcweir if( nPage < nMaxPages ) 1272*cdf0e10cSrcweir pNotesPage = static_cast<SdPage*>(GetMasterPage( nPage )); 1273*cdf0e10cSrcweir else 1274*cdf0e10cSrcweir pNotesPage = NULL; 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir if( (NULL == pNotesPage) || (pNotesPage->GetPageKind() != PK_NOTES) || ( pPage->GetLayoutName() != pNotesPage->GetLayoutName() ) ) 1277*cdf0e10cSrcweir { 1278*cdf0e10cSrcweir bChanged = sal_True; 1279*cdf0e10cSrcweir 1280*cdf0e10cSrcweir sal_uInt16 nFound = nPage + 1; 1281*cdf0e10cSrcweir while( nFound < nMaxPages ) 1282*cdf0e10cSrcweir { 1283*cdf0e10cSrcweir pNotesPage = static_cast<SdPage*>(GetMasterPage( nFound )); 1284*cdf0e10cSrcweir if( (PK_NOTES == pNotesPage->GetPageKind()) && ( pPage->GetLayoutName() == pNotesPage->GetLayoutName() ) ) 1285*cdf0e10cSrcweir { 1286*cdf0e10cSrcweir MoveMasterPage( nFound, nPage ); 1287*cdf0e10cSrcweir pNotesPage->SetInserted(sal_True); 1288*cdf0e10cSrcweir break; 1289*cdf0e10cSrcweir } 1290*cdf0e10cSrcweir 1291*cdf0e10cSrcweir nFound++; 1292*cdf0e10cSrcweir } 1293*cdf0e10cSrcweir 1294*cdf0e10cSrcweir // looks like we lost a notes page 1295*cdf0e10cSrcweir if( nMaxPages == nFound ) 1296*cdf0e10cSrcweir { 1297*cdf0e10cSrcweir // so create one 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir // first find a reference notes page for size 1300*cdf0e10cSrcweir SdPage* pRefNotesPage = NULL; 1301*cdf0e10cSrcweir nFound = 0; 1302*cdf0e10cSrcweir while( nFound < nMaxPages ) 1303*cdf0e10cSrcweir { 1304*cdf0e10cSrcweir pRefNotesPage = static_cast<SdPage*>(GetMasterPage( nFound )); 1305*cdf0e10cSrcweir if( PK_NOTES == pRefNotesPage->GetPageKind() ) 1306*cdf0e10cSrcweir break; 1307*cdf0e10cSrcweir nFound++; 1308*cdf0e10cSrcweir } 1309*cdf0e10cSrcweir if( nFound == nMaxPages ) 1310*cdf0e10cSrcweir pRefNotesPage = NULL; 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir SdPage* pNewNotesPage = static_cast<SdPage*>(AllocPage(sal_True)); 1313*cdf0e10cSrcweir pNewNotesPage->SetPageKind(PK_NOTES); 1314*cdf0e10cSrcweir if( pRefNotesPage ) 1315*cdf0e10cSrcweir { 1316*cdf0e10cSrcweir pNewNotesPage->SetSize( pRefNotesPage->GetSize() ); 1317*cdf0e10cSrcweir pNewNotesPage->SetBorder( pRefNotesPage->GetLftBorder(), 1318*cdf0e10cSrcweir pRefNotesPage->GetUppBorder(), 1319*cdf0e10cSrcweir pRefNotesPage->GetRgtBorder(), 1320*cdf0e10cSrcweir pRefNotesPage->GetLwrBorder() ); 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir InsertMasterPage(pNewNotesPage, nPage ); 1323*cdf0e10cSrcweir pNewNotesPage->SetLayoutName( pPage->GetLayoutName() ); 1324*cdf0e10cSrcweir pNewNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True ); 1325*cdf0e10cSrcweir nMaxPages++; 1326*cdf0e10cSrcweir } 1327*cdf0e10cSrcweir } 1328*cdf0e10cSrcweir 1329*cdf0e10cSrcweir nPage++; 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir 1332*cdf0e10cSrcweir // now remove all remaining and unused non PK_STANDARD slides 1333*cdf0e10cSrcweir while( nPage < nMaxPages ) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir bChanged = sal_True; 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir RemoveMasterPage( nPage ); 1338*cdf0e10cSrcweir nMaxPages--; 1339*cdf0e10cSrcweir } 1340*cdf0e10cSrcweir 1341*cdf0e10cSrcweir if( bChanged ) 1342*cdf0e10cSrcweir { 1343*cdf0e10cSrcweir DBG_ERROR( "master pages where in a wrong order" ); 1344*cdf0e10cSrcweir RecalcPageNums( sal_True); 1345*cdf0e10cSrcweir } 1346*cdf0e10cSrcweir } 1347*cdf0e10cSrcweir } 1348*cdf0e10cSrcweir 1349*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::CreatePage ( 1350*cdf0e10cSrcweir SdPage* pActualPage, 1351*cdf0e10cSrcweir PageKind ePageKind, 1352*cdf0e10cSrcweir const String& sStandardPageName, 1353*cdf0e10cSrcweir const String& sNotesPageName, 1354*cdf0e10cSrcweir AutoLayout eStandardLayout, 1355*cdf0e10cSrcweir AutoLayout eNotesLayout, 1356*cdf0e10cSrcweir sal_Bool bIsPageBack, 1357*cdf0e10cSrcweir sal_Bool bIsPageObj, 1358*cdf0e10cSrcweir const sal_Int32 nInsertPosition) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir SdPage* pPreviousStandardPage; 1361*cdf0e10cSrcweir SdPage* pPreviousNotesPage; 1362*cdf0e10cSrcweir SdPage* pStandardPage; 1363*cdf0e10cSrcweir SdPage* pNotesPage; 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir // From the given page determine the standard page and notes page of which 1366*cdf0e10cSrcweir // to take the layout and the position where to insert the new pages. 1367*cdf0e10cSrcweir if (ePageKind == PK_NOTES) 1368*cdf0e10cSrcweir { 1369*cdf0e10cSrcweir pPreviousNotesPage = pActualPage; 1370*cdf0e10cSrcweir sal_uInt16 nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2; 1371*cdf0e10cSrcweir pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3); 1372*cdf0e10cSrcweir eStandardLayout = pPreviousStandardPage->GetAutoLayout(); 1373*cdf0e10cSrcweir } 1374*cdf0e10cSrcweir else 1375*cdf0e10cSrcweir { 1376*cdf0e10cSrcweir pPreviousStandardPage = pActualPage; 1377*cdf0e10cSrcweir sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; 1378*cdf0e10cSrcweir pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1); 1379*cdf0e10cSrcweir eNotesLayout = pPreviousNotesPage->GetAutoLayout(); 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir // Create new standard page and set it up. 1383*cdf0e10cSrcweir pStandardPage = (SdPage*) AllocPage(sal_False); 1384*cdf0e10cSrcweir 1385*cdf0e10cSrcweir // #108658# 1386*cdf0e10cSrcweir // Set the size here since else the presobj autolayout 1387*cdf0e10cSrcweir // will be wrong. 1388*cdf0e10cSrcweir pStandardPage->SetSize( pPreviousStandardPage->GetSize() ); 1389*cdf0e10cSrcweir pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(), 1390*cdf0e10cSrcweir pPreviousStandardPage->GetUppBorder(), 1391*cdf0e10cSrcweir pPreviousStandardPage->GetRgtBorder(), 1392*cdf0e10cSrcweir pPreviousStandardPage->GetLwrBorder() ); 1393*cdf0e10cSrcweir 1394*cdf0e10cSrcweir // Use master page of current page. 1395*cdf0e10cSrcweir pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage()); 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir // User layout of current standard page. 1398*cdf0e10cSrcweir pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() ); 1399*cdf0e10cSrcweir pStandardPage->SetAutoLayout(eStandardLayout, sal_True); 1400*cdf0e10cSrcweir pStandardPage->setHeaderFooterSettings( pPreviousStandardPage->getHeaderFooterSettings() ); 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir // transition settings of current page 1403*cdf0e10cSrcweir pStandardPage->setTransitionType( pPreviousStandardPage->getTransitionType() ); 1404*cdf0e10cSrcweir pStandardPage->setTransitionSubtype( pPreviousStandardPage->getTransitionSubtype() ); 1405*cdf0e10cSrcweir pStandardPage->setTransitionDirection( pPreviousStandardPage->getTransitionDirection() ); 1406*cdf0e10cSrcweir pStandardPage->setTransitionFadeColor( pPreviousStandardPage->getTransitionFadeColor() ); 1407*cdf0e10cSrcweir pStandardPage->setTransitionDuration( pPreviousStandardPage->getTransitionDuration() ); 1408*cdf0e10cSrcweir 1409*cdf0e10cSrcweir // apply previous animation timing 1410*cdf0e10cSrcweir pStandardPage->SetPresChange( pPreviousStandardPage->GetPresChange() ); 1411*cdf0e10cSrcweir pStandardPage->SetTime( pPreviousStandardPage->GetTime() ); 1412*cdf0e10cSrcweir 1413*cdf0e10cSrcweir // Create new notes page and set it up. 1414*cdf0e10cSrcweir pNotesPage = (SdPage*) AllocPage(sal_False); 1415*cdf0e10cSrcweir pNotesPage->SetPageKind(PK_NOTES); 1416*cdf0e10cSrcweir 1417*cdf0e10cSrcweir // Use master page of current page. 1418*cdf0e10cSrcweir pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage()); 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir // Use layout of current notes page. 1421*cdf0e10cSrcweir pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() ); 1422*cdf0e10cSrcweir pNotesPage->SetAutoLayout(eNotesLayout, sal_True); 1423*cdf0e10cSrcweir pNotesPage->setHeaderFooterSettings( pPreviousNotesPage->getHeaderFooterSettings() ); 1424*cdf0e10cSrcweir 1425*cdf0e10cSrcweir return InsertPageSet ( 1426*cdf0e10cSrcweir pActualPage, 1427*cdf0e10cSrcweir ePageKind, 1428*cdf0e10cSrcweir sStandardPageName, 1429*cdf0e10cSrcweir sNotesPageName, 1430*cdf0e10cSrcweir eStandardLayout, 1431*cdf0e10cSrcweir eNotesLayout, 1432*cdf0e10cSrcweir bIsPageBack, 1433*cdf0e10cSrcweir bIsPageObj, 1434*cdf0e10cSrcweir pStandardPage, 1435*cdf0e10cSrcweir pNotesPage, 1436*cdf0e10cSrcweir nInsertPosition); 1437*cdf0e10cSrcweir } 1438*cdf0e10cSrcweir 1439*cdf0e10cSrcweir 1440*cdf0e10cSrcweir 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::DuplicatePage (sal_uInt16 nPageNum) 1443*cdf0e10cSrcweir { 1444*cdf0e10cSrcweir PageKind ePageKind = PK_STANDARD; 1445*cdf0e10cSrcweir 1446*cdf0e10cSrcweir // Get current page. 1447*cdf0e10cSrcweir SdPage* pActualPage = GetSdPage(nPageNum, ePageKind); 1448*cdf0e10cSrcweir 1449*cdf0e10cSrcweir // Get background flags. 1450*cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); 1451*cdf0e10cSrcweir sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False); 1452*cdf0e10cSrcweir sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False); 1453*cdf0e10cSrcweir SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers(); 1454*cdf0e10cSrcweir 1455*cdf0e10cSrcweir // Get layout from current page. 1456*cdf0e10cSrcweir AutoLayout eAutoLayout = pActualPage->GetAutoLayout(); 1457*cdf0e10cSrcweir 1458*cdf0e10cSrcweir return DuplicatePage ( 1459*cdf0e10cSrcweir pActualPage, ePageKind, 1460*cdf0e10cSrcweir // No names for the new slides. 1461*cdf0e10cSrcweir String(), String(), 1462*cdf0e10cSrcweir eAutoLayout, eAutoLayout, 1463*cdf0e10cSrcweir aVisibleLayers.IsSet(aBckgrnd), 1464*cdf0e10cSrcweir aVisibleLayers.IsSet(aBckgrndObj)); 1465*cdf0e10cSrcweir } 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir 1469*cdf0e10cSrcweir 1470*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::DuplicatePage ( 1471*cdf0e10cSrcweir SdPage* pActualPage, 1472*cdf0e10cSrcweir PageKind ePageKind, 1473*cdf0e10cSrcweir const String& sStandardPageName, 1474*cdf0e10cSrcweir const String& sNotesPageName, 1475*cdf0e10cSrcweir AutoLayout eStandardLayout, 1476*cdf0e10cSrcweir AutoLayout eNotesLayout, 1477*cdf0e10cSrcweir sal_Bool bIsPageBack, 1478*cdf0e10cSrcweir sal_Bool bIsPageObj, 1479*cdf0e10cSrcweir const sal_Int32 nInsertPosition) 1480*cdf0e10cSrcweir { 1481*cdf0e10cSrcweir SdPage* pPreviousStandardPage; 1482*cdf0e10cSrcweir SdPage* pPreviousNotesPage; 1483*cdf0e10cSrcweir SdPage* pStandardPage; 1484*cdf0e10cSrcweir SdPage* pNotesPage; 1485*cdf0e10cSrcweir 1486*cdf0e10cSrcweir // From the given page determine the standard page and the notes page 1487*cdf0e10cSrcweir // of which to make copies. 1488*cdf0e10cSrcweir if (ePageKind == PK_NOTES) 1489*cdf0e10cSrcweir { 1490*cdf0e10cSrcweir pPreviousNotesPage = pActualPage; 1491*cdf0e10cSrcweir sal_uInt16 nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2; 1492*cdf0e10cSrcweir pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3); 1493*cdf0e10cSrcweir } 1494*cdf0e10cSrcweir else 1495*cdf0e10cSrcweir { 1496*cdf0e10cSrcweir pPreviousStandardPage = pActualPage; 1497*cdf0e10cSrcweir sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; 1498*cdf0e10cSrcweir pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1); 1499*cdf0e10cSrcweir } 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir // Create duplicates of a standard page and the associated notes page. 1502*cdf0e10cSrcweir pStandardPage = (SdPage*) pPreviousStandardPage->Clone(); 1503*cdf0e10cSrcweir pNotesPage = (SdPage*) pPreviousNotesPage->Clone(); 1504*cdf0e10cSrcweir 1505*cdf0e10cSrcweir return InsertPageSet ( 1506*cdf0e10cSrcweir pActualPage, 1507*cdf0e10cSrcweir ePageKind, 1508*cdf0e10cSrcweir sStandardPageName, 1509*cdf0e10cSrcweir sNotesPageName, 1510*cdf0e10cSrcweir eStandardLayout, 1511*cdf0e10cSrcweir eNotesLayout, 1512*cdf0e10cSrcweir bIsPageBack, 1513*cdf0e10cSrcweir bIsPageObj, 1514*cdf0e10cSrcweir pStandardPage, 1515*cdf0e10cSrcweir pNotesPage, 1516*cdf0e10cSrcweir nInsertPosition); 1517*cdf0e10cSrcweir } 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir 1522*cdf0e10cSrcweir sal_uInt16 SdDrawDocument::InsertPageSet ( 1523*cdf0e10cSrcweir SdPage* pActualPage, 1524*cdf0e10cSrcweir PageKind ePageKind, 1525*cdf0e10cSrcweir const String& sStandardPageName, 1526*cdf0e10cSrcweir const String& sNotesPageName, 1527*cdf0e10cSrcweir AutoLayout eStandardLayout, 1528*cdf0e10cSrcweir AutoLayout eNotesLayout, 1529*cdf0e10cSrcweir sal_Bool bIsPageBack, 1530*cdf0e10cSrcweir sal_Bool bIsPageObj, 1531*cdf0e10cSrcweir SdPage* pStandardPage, 1532*cdf0e10cSrcweir SdPage* pNotesPage, 1533*cdf0e10cSrcweir sal_Int32 nInsertPosition) 1534*cdf0e10cSrcweir { 1535*cdf0e10cSrcweir SdPage* pPreviousStandardPage; 1536*cdf0e10cSrcweir SdPage* pPreviousNotesPage; 1537*cdf0e10cSrcweir sal_uInt16 nStandardPageNum; 1538*cdf0e10cSrcweir sal_uInt16 nNotesPageNum; 1539*cdf0e10cSrcweir String aStandardPageName = sStandardPageName; 1540*cdf0e10cSrcweir String aNotesPageName = sNotesPageName; 1541*cdf0e10cSrcweir 1542*cdf0e10cSrcweir // Gather some information about the standard page and the notes page 1543*cdf0e10cSrcweir // that are to be inserted. This makes sure that there is allways one 1544*cdf0e10cSrcweir // standard page followed by one notes page. 1545*cdf0e10cSrcweir if (ePageKind == PK_NOTES) 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir pPreviousNotesPage = pActualPage; 1548*cdf0e10cSrcweir nNotesPageNum = pPreviousNotesPage->GetPageNum() + 2; 1549*cdf0e10cSrcweir pPreviousStandardPage = (SdPage*) GetPage(nNotesPageNum - 3); 1550*cdf0e10cSrcweir nStandardPageNum = nNotesPageNum - 1; 1551*cdf0e10cSrcweir eStandardLayout = pPreviousStandardPage->GetAutoLayout(); 1552*cdf0e10cSrcweir } 1553*cdf0e10cSrcweir else 1554*cdf0e10cSrcweir { 1555*cdf0e10cSrcweir pPreviousStandardPage = pActualPage; 1556*cdf0e10cSrcweir nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; 1557*cdf0e10cSrcweir pPreviousNotesPage = (SdPage*) GetPage(nStandardPageNum - 1); 1558*cdf0e10cSrcweir nNotesPageNum = nStandardPageNum + 1; 1559*cdf0e10cSrcweir aNotesPageName = aStandardPageName; 1560*cdf0e10cSrcweir eNotesLayout = pPreviousNotesPage->GetAutoLayout(); 1561*cdf0e10cSrcweir } 1562*cdf0e10cSrcweir 1563*cdf0e10cSrcweir OSL_ASSERT(nNotesPageNum==nStandardPageNum+1); 1564*cdf0e10cSrcweir if (nInsertPosition < 0) 1565*cdf0e10cSrcweir nInsertPosition = nStandardPageNum; 1566*cdf0e10cSrcweir 1567*cdf0e10cSrcweir // Set up and insert the standard page. 1568*cdf0e10cSrcweir SetupNewPage ( 1569*cdf0e10cSrcweir pPreviousStandardPage, 1570*cdf0e10cSrcweir pStandardPage, 1571*cdf0e10cSrcweir aStandardPageName, 1572*cdf0e10cSrcweir nInsertPosition, 1573*cdf0e10cSrcweir bIsPageBack, 1574*cdf0e10cSrcweir bIsPageObj); 1575*cdf0e10cSrcweir 1576*cdf0e10cSrcweir // Set up and insert the notes page. 1577*cdf0e10cSrcweir pNotesPage->SetPageKind(PK_NOTES); 1578*cdf0e10cSrcweir SetupNewPage ( 1579*cdf0e10cSrcweir pPreviousNotesPage, 1580*cdf0e10cSrcweir pNotesPage, 1581*cdf0e10cSrcweir aNotesPageName, 1582*cdf0e10cSrcweir nInsertPosition+1, 1583*cdf0e10cSrcweir bIsPageBack, 1584*cdf0e10cSrcweir bIsPageObj); 1585*cdf0e10cSrcweir 1586*cdf0e10cSrcweir // Return an index that allows the caller to access the newly inserted 1587*cdf0e10cSrcweir // pages by using GetSdPage(). 1588*cdf0e10cSrcweir return pStandardPage->GetPageNum() / 2; 1589*cdf0e10cSrcweir } 1590*cdf0e10cSrcweir 1591*cdf0e10cSrcweir 1592*cdf0e10cSrcweir 1593*cdf0e10cSrcweir 1594*cdf0e10cSrcweir void SdDrawDocument::SetupNewPage ( 1595*cdf0e10cSrcweir SdPage* pPreviousPage, 1596*cdf0e10cSrcweir SdPage* pPage, 1597*cdf0e10cSrcweir const String& sPageName, 1598*cdf0e10cSrcweir sal_uInt16 nInsertionPoint, 1599*cdf0e10cSrcweir sal_Bool bIsPageBack, 1600*cdf0e10cSrcweir sal_Bool bIsPageObj) 1601*cdf0e10cSrcweir { 1602*cdf0e10cSrcweir if (pPreviousPage != NULL) 1603*cdf0e10cSrcweir { 1604*cdf0e10cSrcweir pPage->SetSize( pPreviousPage->GetSize() ); 1605*cdf0e10cSrcweir pPage->SetBorder( pPreviousPage->GetLftBorder(), 1606*cdf0e10cSrcweir pPreviousPage->GetUppBorder(), 1607*cdf0e10cSrcweir pPreviousPage->GetRgtBorder(), 1608*cdf0e10cSrcweir pPreviousPage->GetLwrBorder() ); 1609*cdf0e10cSrcweir } 1610*cdf0e10cSrcweir pPage->SetName(sPageName); 1611*cdf0e10cSrcweir 1612*cdf0e10cSrcweir InsertPage(pPage, nInsertionPoint); 1613*cdf0e10cSrcweir 1614*cdf0e10cSrcweir if (pPreviousPage != NULL) 1615*cdf0e10cSrcweir { 1616*cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); 1617*cdf0e10cSrcweir sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False); 1618*cdf0e10cSrcweir sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False); 1619*cdf0e10cSrcweir SetOfByte aVisibleLayers = pPreviousPage->TRG_GetMasterPageVisibleLayers(); 1620*cdf0e10cSrcweir aVisibleLayers.Set(aBckgrnd, bIsPageBack); 1621*cdf0e10cSrcweir aVisibleLayers.Set(aBckgrndObj, bIsPageObj); 1622*cdf0e10cSrcweir pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); 1623*cdf0e10cSrcweir } 1624*cdf0e10cSrcweir } 1625*cdf0e10cSrcweir 1626*cdf0e10cSrcweir sd::UndoManager* SdDrawDocument::GetUndoManager() const 1627*cdf0e10cSrcweir { 1628*cdf0e10cSrcweir return mpDocSh ? dynamic_cast< sd::UndoManager* >(mpDocSh->GetUndoManager()) : 0; 1629*cdf0e10cSrcweir } 1630*cdf0e10cSrcweir 1631*cdf0e10cSrcweir // eof 1632