LCOV - code coverage report
Current view: top level - libreoffice/sd/source/core - drawdoc2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 246 657 37.4 %
Date: 2012-12-17 Functions: 21 36 58.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10