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