LCOV - code coverage report
Current view: top level - sd/source/core - sdpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 844 1397 60.4 %
Date: 2012-08-25 Functions: 53 64 82.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1008 2882 35.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <algorithm>
      31                 :            : 
      32                 :            : #include <comphelper/classids.hxx>
      33                 :            : 
      34                 :            : #include <vcl/svapp.hxx>
      35                 :            : #include "eetext.hxx"
      36                 :            : #include <editeng/eeitem.hxx>
      37                 :            : #include <svx/svdoutl.hxx>
      38                 :            : #include <editeng/editdata.hxx>
      39                 :            : #include <svx/pageitem.hxx>
      40                 :            : #include <editeng/lrspitem.hxx>
      41                 :            : #include <editeng/bulitem.hxx>
      42                 :            : #include <svx/svdpagv.hxx>
      43                 :            : #include <editeng/fhgtitem.hxx>
      44                 :            : #include <editeng/outlobj.hxx>
      45                 :            : #include <svx/svdoole2.hxx>
      46                 :            : #include <svx/svdograf.hxx>
      47                 :            : #include <svx/svdopage.hxx>
      48                 :            : #include <sfx2/printer.hxx>
      49                 :            : #include <basic/basmgr.hxx>
      50                 :            : #include <editeng/pbinitem.hxx>
      51                 :            : #include <svx/svdundo.hxx>
      52                 :            : #include <svl/smplhint.hxx>
      53                 :            : #include <editeng/adjitem.hxx>
      54                 :            : #include <editeng/editobj.hxx>
      55                 :            : #include <editeng/scripttypeitem.hxx>
      56                 :            : #include <svx/unopage.hxx>
      57                 :            : #include <editeng/flditem.hxx>
      58                 :            : #include <svx/sdr/contact/displayinfo.hxx>
      59                 :            : #include <svx/svditer.hxx>
      60                 :            : 
      61                 :            : #include "../ui/inc/DrawDocShell.hxx"
      62                 :            : #include "Outliner.hxx"
      63                 :            : #include "app.hrc"
      64                 :            : #include "drawdoc.hxx"
      65                 :            : #include "sdpage.hxx"
      66                 :            : #include "pglink.hxx"
      67                 :            : #include "sdresid.hxx"
      68                 :            : #include "stlsheet.hxx"
      69                 :            : #include "glob.hrc"
      70                 :            : #include "glob.hxx"
      71                 :            : #include "helpids.h"
      72                 :            : #include "anminfo.hxx"
      73                 :            : #include "undo/undomanager.hxx"
      74                 :            : #include "undo/undoobjects.hxx"
      75                 :            : #include <svx/sdr/contact/viewobjectcontact.hxx>
      76                 :            : #include <svx/sdr/contact/viewcontact.hxx>
      77                 :            : #include <svx/sdr/contact/objectcontact.hxx>
      78                 :            : #include <svx/unoapi.hxx>
      79                 :            : 
      80                 :            : #include <set>
      81                 :            : 
      82                 :            : using namespace ::sd;
      83                 :            : using namespace ::com::sun::star;
      84                 :            : 
      85 [ +  + ][ +  - ]:      27784 : TYPEINIT2( SdPage, FmFormPage, SdrObjUserCall );
                 [ #  # ]
      86                 :            : 
      87                 :            : /*************************************************************************
      88                 :            : |*
      89                 :            : |*      Ctor
      90                 :            : |*
      91                 :            : \************************************************************************/
      92                 :            : 
      93                 :       1028 : SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage)
      94                 :            : :   FmFormPage(rNewDoc, pBasic, bMasterPage)
      95                 :            : ,   SdrObjUserCall()
      96                 :            : ,   mePageKind(PK_STANDARD)
      97                 :            : ,   meAutoLayout(AUTOLAYOUT_NONE)
      98                 :            : ,   mbSelected(sal_False)
      99                 :            : ,   mePresChange(PRESCHANGE_MANUAL)
     100                 :            : ,   mnTime(1)
     101                 :            : ,   mbSoundOn(sal_False)
     102                 :            : ,   mbExcluded(sal_False)
     103                 :            : ,   mbLoopSound(sal_False)
     104                 :            : ,   mbStopSound(sal_False)
     105                 :            : ,   mbScaleObjects(sal_True)
     106                 :            : ,   mbBackgroundFullSize( sal_False )
     107         [ +  - ]:       1028 : ,   meCharSet(osl_getThreadTextEncoding())
     108                 :            : ,   mnPaperBin(PAPERBIN_PRINTER_SETTINGS)
     109                 :            : ,   mpPageLink(NULL)
     110                 :            : ,   mpItems(NULL)
     111                 :            : ,   mnTransitionType(0)
     112                 :            : ,   mnTransitionSubtype(0)
     113                 :            : ,   mbTransitionDirection(sal_True)
     114                 :            : ,   mnTransitionFadeColor(0)
     115                 :            : ,   mfTransitionDuration(2.0)
     116 [ +  - ][ +  - ]:       2056 : ,   mbIsPrecious(true)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     117                 :            : {
     118                 :            :     // Der Layoutname der Seite wird von SVDRAW benutzt, um die Praesentations-
     119                 :            :     // vorlagen der Gliederungsobjekte zu ermitteln. Darum enthaelt er bereits
     120                 :            :     // den Bezeichner fuer die Gliederung (STR_LAYOUT_OUTLINE).
     121 [ +  - ][ +  - ]:       1028 :     maLayoutName  = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
         [ +  - ][ +  - ]
     122         [ +  - ]:       1028 :     maLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
     123 [ +  - ][ +  - ]:       1028 :     maLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
         [ +  - ][ +  - ]
     124                 :            : 
     125         [ +  - ]:       1028 :     Size aPageSize(GetSize());
     126                 :            : 
     127         [ -  + ]:       1028 :     if (aPageSize.Width() > aPageSize.Height())
     128                 :            :     {
     129                 :          0 :         meOrientation = ORIENTATION_LANDSCAPE;
     130                 :            :     }
     131                 :            :     else
     132                 :            :     {
     133                 :       1028 :         meOrientation = ORIENTATION_PORTRAIT;
     134                 :            :     }
     135                 :       1028 : }
     136                 :            : 
     137                 :            : /*************************************************************************
     138                 :            : |*
     139                 :            : |* Dtor
     140                 :            : |*
     141                 :            : \************************************************************************/
     142                 :            : 
     143 [ +  - ][ +  - ]:       1010 : SdPage::~SdPage()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     144                 :            : {
     145         [ +  - ]:       1010 :     DisconnectLink();
     146                 :            : 
     147         [ +  - ]:       1010 :     EndListenOutlineText();
     148                 :            : 
     149         [ -  + ]:       1010 :     if( mpItems )
     150 [ #  # ][ #  # ]:          0 :         delete mpItems;
     151         [ -  + ]:       2020 : }
     152                 :            : 
     153                 :            : struct OrdNumSorter
     154                 :            : {
     155                 :        210 :     bool operator()( SdrObject* p1, SdrObject* p2 )
     156                 :            :     {
     157                 :        210 :         return p1->GetOrdNum() < p2->GetOrdNum();
     158                 :            :     }
     159                 :            : };
     160                 :            : 
     161                 :            : /** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
     162                 :       3166 : SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ )
     163                 :            : {
     164                 :            :     // first sort all matching shapes with z-order
     165         [ +  - ]:       3166 :     std::vector< SdrObject* > aMatches;
     166                 :            : 
     167                 :       3166 :     SdrObject* pObj = 0;
     168 [ +  - ][ +  + ]:      10492 :     while( (pObj = maPresentationShapeList.getNextShape(pObj)) != 0 )
     169                 :            :     {
     170         [ +  - ]:       7326 :         SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
     171         [ +  - ]:       7326 :         if( pInfo )
     172                 :            :         {
     173                 :       7326 :             bool bFound = false;
     174         [ +  + ]:       7326 :             if( pInfo->mePresObjKind == eObjKind )
     175                 :            :             {
     176                 :        835 :                 bFound = true;
     177                 :            :             }
     178 [ +  + ][ +  + ]:       6491 :             else if( bFuzzySearch && (eObjKind == PRESOBJ_OUTLINE) )
     179                 :            :             {
     180         [ -  + ]:         21 :                 switch( pInfo->mePresObjKind )
     181                 :            :                 {
     182                 :            :                 case PRESOBJ_GRAPHIC:
     183                 :            :                 case PRESOBJ_OBJECT:
     184                 :            :                 case PRESOBJ_CHART:
     185                 :            :                 case PRESOBJ_ORGCHART:
     186                 :            :                 case PRESOBJ_TABLE:
     187                 :            :                 case PRESOBJ_CALC:
     188                 :            :                 case PRESOBJ_IMAGE:
     189                 :            :                 case PRESOBJ_MEDIA:
     190                 :          0 :                     bFound = sal_True;
     191                 :          0 :                     break;
     192                 :            :                 default:
     193                 :         21 :                     break;
     194                 :            :                 }
     195                 :            :             }
     196         [ +  + ]:       7326 :             if( bFound )
     197                 :            :             {
     198         [ +  - ]:        835 :                 aMatches.push_back( pObj );
     199                 :            :             }
     200                 :            :         }
     201                 :            :     }
     202                 :            : 
     203         [ +  + ]:       3166 :     if( aMatches.size() > 1 )
     204                 :            :     {
     205                 :            :         OrdNumSorter aSortHelper;
     206         [ +  - ]:         35 :         std::sort( aMatches.begin(), aMatches.end(), aSortHelper );
     207                 :            :     }
     208                 :            : 
     209         [ +  - ]:       3166 :     if( nIndex > 0 )
     210                 :       3166 :         nIndex--;
     211                 :            : 
     212 [ +  - ][ +  + ]:       3166 :     if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) )
                 [ +  + ]
     213         [ +  - ]:        703 :         return aMatches[nIndex];
     214                 :            : 
     215                 :       3166 :     return 0;
     216                 :            : }
     217                 :            : 
     218                 :            : /** create background properties */
     219                 :        240 : void SdPage::EnsureMasterPageDefaultBackground()
     220                 :            : {
     221         [ +  - ]:        240 :     if(mbMaster)
     222                 :            :     {
     223                 :            :         // no hard attributes on MasterPage attributes
     224                 :        240 :         getSdrPageProperties().ClearItem();
     225                 :        240 :         SfxStyleSheet* pSheetForPresObj = GetStyleSheetForMasterPageBackground();
     226                 :            : 
     227         [ +  - ]:        240 :         if(pSheetForPresObj)
     228                 :            :         {
     229                 :            :             // set StyleSheet for background fill attributes
     230                 :        240 :             getSdrPageProperties().SetStyleSheet(pSheetForPresObj);
     231                 :            :         }
     232                 :            :         else
     233                 :            :         {
     234                 :            :             // no style found, assert and set at least XFILL_NONE
     235                 :            :             OSL_FAIL("No Style for MasterPageBackground fill found (!)");
     236         [ #  # ]:          0 :             getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
     237                 :            :         }
     238                 :            :     }
     239                 :        240 : }
     240                 :            : 
     241                 :            : /** creates a presentation object with the given PresObjKind on this page. A user call will be set
     242                 :            : */
     243                 :       1726 : SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool /* bInsert */ )
     244                 :            : {
     245         [ +  - ]:       1726 :     ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
     246 [ +  - ][ -  + ]:       1726 :     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
                 [ #  # ]
     247                 :            : 
     248                 :       1726 :     SdrObject* pSdrObj = NULL;
     249                 :            : 
     250                 :       1726 :     bool bForceText = false;    // forces the shape text to be set even if its empty
     251                 :       1726 :     bool bEmptyPresObj = true;
     252                 :            : 
     253   [ +  +  +  +  :       1726 :     switch( eObjKind )
          +  -  -  -  -  
             +  +  +  - ]
     254                 :            :     {
     255                 :            :         case PRESOBJ_TITLE:
     256                 :            :         {
     257         [ +  - ]:        183 :             pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
     258                 :            : 
     259         [ +  + ]:        183 :             if (mbMaster)
     260                 :            :             {
     261                 :        102 :                 pSdrObj->SetNotVisibleAsMaster(sal_True);
     262                 :            :             }
     263                 :            :         }
     264                 :        183 :         break;
     265                 :            : 
     266                 :            :         case PRESOBJ_OUTLINE:
     267                 :            :         {
     268         [ +  - ]:         81 :             pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
     269                 :            : 
     270         [ +  + ]:         81 :             if (mbMaster)
     271                 :            :             {
     272                 :         54 :                 pSdrObj->SetNotVisibleAsMaster(sal_True);
     273                 :            :             }
     274                 :            :         }
     275                 :         81 :         break;
     276                 :            : 
     277                 :            :         case PRESOBJ_NOTES:
     278                 :            :         {
     279         [ +  - ]:        271 :             pSdrObj = new SdrRectObj(OBJ_TEXT);
     280                 :            : 
     281         [ +  + ]:        271 :             if (mbMaster)
     282                 :            :             {
     283                 :         48 :                 pSdrObj->SetNotVisibleAsMaster(sal_True);
     284                 :            :             }
     285                 :            :         }
     286                 :        271 :         break;
     287                 :            : 
     288                 :            :         case PRESOBJ_TEXT:
     289                 :            :         {
     290         [ +  - ]:         48 :             pSdrObj = new SdrRectObj(OBJ_TEXT);
     291                 :            :         }
     292                 :         48 :         break;
     293                 :            : 
     294                 :            :         case PRESOBJ_GRAPHIC:
     295                 :            :         {
     296 [ +  - ][ +  - ]:          3 :             BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_GRAPHIC ) );
     297         [ +  - ]:          3 :             Graphic  aGraphic( aBmpEx );
     298         [ +  - ]:          3 :             OutputDevice &aOutDev = *Application::GetDefaultDevice();
     299         [ +  - ]:          3 :             aOutDev.Push();
     300                 :            : 
     301 [ +  - ][ +  - ]:          3 :             aOutDev.SetMapMode( aGraphic.GetPrefMapMode() );
                 [ +  - ]
     302 [ +  - ][ +  - ]:          3 :             Size aSizePix = aOutDev.LogicToPixel( aGraphic.GetPrefSize() );
     303 [ +  - ][ +  - ]:          3 :             aOutDev.SetMapMode(MAP_100TH_MM);
                 [ +  - ]
     304                 :            : 
     305         [ +  - ]:          3 :             Size aSize = aOutDev.PixelToLogic(aSizePix);
     306                 :          3 :             Point aPnt (0, 0);
     307         [ +  - ]:          3 :             Rectangle aRect (aPnt, aSize);
     308 [ +  - ][ +  - ]:          3 :             pSdrObj = new SdrGrafObj(aGraphic, aRect);
     309 [ +  - ][ +  - ]:          3 :             aOutDev.Pop();
                 [ +  - ]
     310                 :            :         }
     311                 :          3 :         break;
     312                 :            : 
     313                 :            :         case PRESOBJ_MEDIA:
     314                 :            :         case PRESOBJ_OBJECT:
     315                 :            :         {
     316 [ #  # ][ #  # ]:          0 :             pSdrObj = new SdrOle2Obj();
     317 [ #  # ][ #  # ]:          0 :             BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_OBJECT ) );
     318         [ #  # ]:          0 :             Graphic aGraphic( aBmpEx );
     319 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
                 [ #  # ]
     320                 :            :         }
     321                 :          0 :         break;
     322                 :            : 
     323                 :            :         case PRESOBJ_CHART:
     324                 :            :         {
     325 [ #  # ][ #  # ]:          0 :             pSdrObj = new SdrOle2Obj();
     326 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarChart" ) );
                 [ #  # ]
     327 [ #  # ][ #  # ]:          0 :             BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_CHART ) );
     328         [ #  # ]:          0 :             Graphic aGraphic( aBmpEx );
     329 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
                 [ #  # ]
     330                 :            :         }
     331                 :          0 :         break;
     332                 :            : 
     333                 :            :         case PRESOBJ_ORGCHART:
     334                 :            :         {
     335 [ #  # ][ #  # ]:          0 :             pSdrObj = new SdrOle2Obj();
     336 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarOrg" ) );
                 [ #  # ]
     337 [ #  # ][ #  # ]:          0 :             BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_ORGCHART ) );
     338         [ #  # ]:          0 :             Graphic aGraphic( aBmpEx );
     339 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
                 [ #  # ]
     340                 :            :         }
     341                 :            : 
     342                 :            :         case PRESOBJ_TABLE:
     343                 :            :         case PRESOBJ_CALC:
     344                 :            :         {
     345 [ #  # ][ #  # ]:          0 :             pSdrObj = new SdrOle2Obj();
     346 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarCalc" ) );
                 [ #  # ]
     347 [ #  # ][ #  # ]:          0 :             BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_TABLE ) );
     348         [ #  # ]:          0 :             Graphic aGraphic( aBmpEx );
     349 [ #  # ][ #  # ]:          0 :             ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
                 [ #  # ]
     350                 :            :         }
     351                 :          0 :         break;
     352                 :            : 
     353                 :            :         case PRESOBJ_HANDOUT:
     354                 :            :         {
     355                 :            :             //Erste Standardseite am SdrPageObj vermerken
     356                 :            :             // #i105146# We want no content to be displayed for PK_HANDOUT,
     357                 :            :             // so just never set a page as content
     358         [ +  - ]:        384 :             pSdrObj = new SdrPageObj(0);
     359                 :            :         }
     360                 :        384 :         break;
     361                 :            : 
     362                 :            :         case PRESOBJ_PAGE:
     363                 :            :         {
     364                 :            :             //Notizseite am SdrPageObj vermerken
     365                 :        217 :             sal_uInt16 nDestPageNum(GetPageNum());
     366                 :            : 
     367         [ +  + ]:        217 :             if(nDestPageNum)
     368                 :            :             {
     369                 :            :                 // decrement only when != 0, else we get a 0xffff
     370                 :        214 :                 nDestPageNum -= 1;
     371                 :            :             }
     372                 :            : 
     373         [ +  - ]:        217 :             if(nDestPageNum < pModel->GetPageCount())
     374                 :            :             {
     375         [ +  - ]:        217 :                 pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
     376                 :            :             }
     377                 :            :             else
     378                 :            :             {
     379         [ #  # ]:          0 :                 pSdrObj = new SdrPageObj();
     380                 :            :             }
     381                 :            : 
     382                 :        217 :             pSdrObj->SetResizeProtect(sal_True);
     383                 :            :         }
     384                 :        217 :         break;
     385                 :            : 
     386                 :            :         case PRESOBJ_HEADER:
     387                 :            :         case PRESOBJ_FOOTER:
     388                 :            :         case PRESOBJ_DATETIME:
     389                 :            :         case PRESOBJ_SLIDENUMBER:
     390                 :            :         {
     391         [ +  - ]:        539 :             pSdrObj = new SdrRectObj(OBJ_TEXT);
     392                 :        539 :             bEmptyPresObj = false;
     393                 :        539 :             bForceText = true;
     394                 :            :         }
     395                 :        539 :         break;
     396                 :            :         default:
     397                 :          0 :             break;
     398                 :            :     }
     399                 :            : 
     400         [ +  - ]:       1726 :     if (pSdrObj)
     401                 :            :     {
     402         [ +  - ]:       1726 :         pSdrObj->SetEmptyPresObj(bEmptyPresObj);
     403         [ +  - ]:       1726 :         pSdrObj->SetLogicRect(rRect);
     404                 :            : 
     405         [ +  - ]:       1726 :         InsertObject(pSdrObj);
     406                 :            : 
     407 [ +  - ][ +  - ]:       1726 :         if ( pSdrObj->ISA(SdrTextObj) )
                 [ +  + ]
     408                 :            :         {
     409                 :            :             // Tell the object EARLY that it is vertical to have the
     410                 :            :             // defaults for AutoGrowWidth/Height reversed
     411         [ -  + ]:       1125 :             if(bVertical)
     412         [ #  # ]:          0 :                 ((SdrTextObj*)pSdrObj)->SetVerticalWriting(sal_True);
     413                 :            : 
     414         [ +  - ]:       1125 :             SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
     415         [ -  + ]:       1125 :             if( bVertical )
     416 [ #  # ][ #  # ]:          0 :                 aTempAttr.Put( SdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
         [ #  # ][ #  # ]
     417                 :            :             else
     418 [ +  - ][ +  - ]:       1125 :                 aTempAttr.Put( SdrTextMinFrameHeightItem( rRect.GetSize().Height() ) );
         [ +  - ][ +  - ]
     419                 :            : 
     420         [ +  + ]:       1125 :             if (mbMaster)
     421                 :            :             {
     422                 :            :                 // Bei Praesentationsobjekten auf der MasterPage soll die
     423                 :            :                 // Groesse vom Benutzwer frei waehlbar sein
     424                 :            : 
     425                 :            :                 // potential problem: This action was still NOT
     426                 :            :                 // adapted for vertical text. This sure needs to be done.
     427         [ -  + ]:        740 :                 if(bVertical)
     428 [ #  # ][ #  # ]:          0 :                     aTempAttr.Put(SdrTextAutoGrowWidthItem(sal_False));
                 [ #  # ]
     429                 :            :                 else
     430 [ +  - ][ +  - ]:        740 :                     aTempAttr.Put(SdrTextAutoGrowHeightItem(sal_False));
                 [ +  - ]
     431                 :            :             }
     432                 :            : 
     433                 :            :             // check if we need another vertical adjustement than the default
     434                 :       1125 :             SdrTextVertAdjust eV = SDRTEXTVERTADJUST_TOP;
     435                 :            : 
     436 [ +  + ][ +  + ]:       1125 :             if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind != PK_STANDARD) )
     437                 :            :             {
     438                 :         98 :                 eV = SDRTEXTVERTADJUST_BOTTOM;
     439                 :            :             }
     440 [ +  + ][ +  + ]:       1027 :             else if( (eObjKind == PRESOBJ_SLIDENUMBER) && (mePageKind != PK_STANDARD) )
     441                 :            :             {
     442                 :        101 :                 eV = SDRTEXTVERTADJUST_BOTTOM;
     443                 :            :             }
     444                 :            : 
     445         [ +  + ]:       1125 :             if( eV != SDRTEXTVERTADJUST_TOP )
     446 [ +  - ][ +  - ]:        199 :                 aTempAttr.Put(SdrTextVertAdjustItem(eV));
                 [ +  - ]
     447                 :            : 
     448         [ +  - ]:       1125 :             pSdrObj->SetMergedItemSet(aTempAttr);
     449                 :            : 
     450 [ +  - ][ +  - ]:       1125 :             pSdrObj->SetLogicRect(rRect);
     451                 :            :         }
     452                 :            : 
     453         [ +  - ]:       1726 :         String aString = GetPresObjText(eObjKind);
     454 [ +  + ][ +  + ]:       1726 :         if( (aString.Len() || bForceText) && pSdrObj->ISA(SdrTextObj) )
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
     455                 :            :         {
     456 [ +  - ][ +  - ]:       1125 :             SdrOutliner* pOutliner = ( (SdDrawDocument*) GetModel() )->GetInternalOutliner();
     457                 :            : 
     458                 :       1125 :             sal_uInt16 nOutlMode = pOutliner->GetMode();
     459         [ +  - ]:       1125 :             pOutliner->Init( OUTLINERMODE_TEXTOBJECT );
     460         [ +  - ]:       1125 :             pOutliner->SetStyleSheet( 0, NULL );
     461         [ +  - ]:       1125 :             pOutliner->SetVertical( bVertical );
     462                 :            : 
     463         [ +  - ]:       1125 :             String aEmptyStr;
     464         [ +  - ]:       1125 :             SetObjText( (SdrTextObj*) pSdrObj, (SdrOutliner*)pOutliner, eObjKind, aString );
     465                 :            : 
     466         [ +  - ]:       1125 :             pOutliner->Init( nOutlMode );
     467 [ +  - ][ +  - ]:       1125 :             pOutliner->SetStyleSheet( 0, NULL );
     468                 :            :         }
     469                 :            : 
     470 [ +  + ][ +  + ]:       1726 :         if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) )
         [ +  + ][ +  + ]
     471                 :            :         {
     472         [ +  - ]:        539 :             SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
     473 [ +  - ][ +  - ]:        539 :             aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) );
                 [ +  - ]
     474 [ +  - ][ +  - ]:        539 :             aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) );
                 [ +  - ]
     475 [ +  - ][ +  - ]:        539 :             aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) );
                 [ +  - ]
     476                 :            : 
     477                 :        539 :             SvxAdjust eH = SVX_ADJUST_LEFT;
     478                 :            : 
     479 [ +  + ][ +  + ]:        539 :             if( (eObjKind == PRESOBJ_DATETIME) && (mePageKind != PK_STANDARD ) )
     480                 :            :             {
     481                 :         98 :                 eH = SVX_ADJUST_RIGHT;
     482                 :            :             }
     483 [ +  + ][ +  + ]:        441 :             else if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind == PK_STANDARD ) )
     484                 :            :             {
     485                 :         49 :                 eH = SVX_ADJUST_CENTER;
     486                 :            :             }
     487         [ +  + ]:        392 :             else if( eObjKind == PRESOBJ_SLIDENUMBER )
     488                 :            :             {
     489                 :        150 :                 eH = SVX_ADJUST_RIGHT;
     490                 :            :             }
     491                 :            : 
     492         [ +  + ]:        539 :             if( eH != SVX_ADJUST_LEFT )
     493 [ +  - ][ +  - ]:        297 :                 aTempAttr.Put(SvxAdjustItem(eH, EE_PARA_JUST ));
                 [ +  - ]
     494                 :            : 
     495 [ +  - ][ +  - ]:        539 :             pSdrObj->SetMergedItemSet(aTempAttr);
     496                 :            :         }
     497                 :            : 
     498         [ +  + ]:       1726 :         if (mbMaster)
     499                 :            :         {
     500                 :       1124 :             SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
     501                 :            : 
     502                 :            :             // Hintergrundobjekte der MasterPage
     503                 :            :             pSdrObj->SetLayer( rLayerAdmin.
     504 [ +  - ][ +  - ]:       1124 :                 GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False) );
         [ +  - ][ +  - ]
                 [ +  - ]
     505                 :            :         }
     506                 :            : 
     507                 :            :         // Objekt am StyleSheet anmelden
     508                 :            :         // Set style only when one was found (as in 5.2)
     509         [ +  + ]:       1726 :         if( mePageKind != PK_HANDOUT )
     510                 :            :         {
     511         [ +  - ]:       1122 :             SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind);
     512         [ +  + ]:       1122 :             if(pSheetForPresObj)
     513         [ +  - ]:        902 :                 pSdrObj->SetStyleSheet(pSheetForPresObj, sal_False);
     514                 :            :         }
     515                 :            : 
     516         [ +  + ]:       1726 :         if (eObjKind == PRESOBJ_OUTLINE)
     517                 :            :         {
     518         [ +  + ]:        810 :             for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
     519                 :            :             {
     520         [ +  - ]:        729 :                 String aName(maLayoutName);
     521         [ +  - ]:        729 :                 aName += sal_Unicode( ' ' );
     522 [ +  - ][ +  - ]:        729 :                 aName += String::CreateFromInt32( nLevel );
                 [ +  - ]
     523 [ +  - ][ +  - ]:        729 :                 SfxStyleSheet* pSheet = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     524                 :            :                 DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
     525         [ +  - ]:        729 :                 if (pSheet)
     526         [ +  - ]:        729 :                     pSdrObj->StartListening(*pSheet);
     527         [ +  - ]:        729 :             }
     528                 :            :         }
     529                 :            : 
     530 [ +  - ][ +  - ]:       1726 :         if ( eObjKind == PRESOBJ_OBJECT   ||
         [ +  - ][ +  - ]
                 [ +  + ]
     531                 :            :              eObjKind == PRESOBJ_CHART    ||
     532                 :            :              eObjKind == PRESOBJ_ORGCHART ||
     533                 :            :              eObjKind == PRESOBJ_CALC    ||
     534                 :            :              eObjKind == PRESOBJ_GRAPHIC )
     535                 :            :         {
     536         [ +  - ]:          3 :             SfxItemSet aSet( ((SdDrawDocument*) pModel)->GetPool() );
     537 [ +  - ][ +  - ]:          3 :             aSet.Put( SdrTextContourFrameItem( sal_True ) );
                 [ +  - ]
     538 [ +  - ][ +  - ]:          3 :             aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
                 [ +  - ]
     539                 :            : 
     540 [ +  - ][ +  - ]:          3 :             pSdrObj->SetMergedItemSet(aSet);
     541                 :            :         }
     542                 :            : 
     543         [ -  + ]:       1726 :         if( bUndo )
     544                 :            :         {
     545 [ #  # ][ #  # ]:          0 :             pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
                 [ #  # ]
     546                 :            :         }
     547                 :            : 
     548         [ -  + ]:       1726 :         if( bUndo )
     549                 :            :         {
     550 [ #  # ][ #  # ]:          0 :             pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pSdrObj ) );
                 [ #  # ]
     551 [ #  # ][ #  # ]:          0 :             pUndoManager->AddUndoAction( new UndoObjectUserCall(*pSdrObj) );
                 [ #  # ]
     552                 :            :         }
     553                 :            : 
     554         [ +  - ]:       1726 :         InsertPresObj(pSdrObj, eObjKind);
     555         [ +  - ]:       1726 :         pSdrObj->SetUserCall(this);
     556                 :            : 
     557 [ +  - ][ +  - ]:       1726 :         pSdrObj->RecalcBoundRect();
     558                 :            :     }
     559                 :            : 
     560                 :       1726 :     return(pSdrObj);
     561                 :            : }
     562                 :            : 
     563                 :            : /*************************************************************************
     564                 :            : |*
     565                 :            : |* Es werden Praesentationsobjekte auf der Page erzeugt.
     566                 :            : |* Alle Praesentationsobjekte erhalten einen UserCall auf die Page.
     567                 :            : |*
     568                 :            : \************************************************************************/
     569                 :            : 
     570                 :        252 : SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
     571                 :            : {
     572         [ +  - ]:        252 :     String aName(GetLayoutName());
     573         [ +  - ]:        252 :     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     574         [ +  - ]:        252 :     sal_uInt16 nPos = aName.Search(aSep);
     575                 :            : 
     576         [ +  - ]:        252 :     if (nPos != STRING_NOTFOUND)
     577                 :            :     {
     578                 :        252 :         nPos = nPos + aSep.Len();
     579         [ +  - ]:        252 :         aName.Erase(nPos);
     580                 :            :     }
     581                 :            : 
     582 [ +  - ][ +  - ]:        252 :     aName += String(SdResId(STR_LAYOUT_BACKGROUND));
         [ +  - ][ +  - ]
     583                 :            : 
     584         [ +  - ]:        252 :     SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
     585         [ +  - ]:        252 :     SfxStyleSheetBase*     pResult   = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     586 [ +  - ][ +  - ]:        252 :     return (SfxStyleSheet*)pResult;
     587                 :            : }
     588                 :            : 
     589                 :       1356 : SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
     590                 :            : {
     591         [ +  - ]:       1356 :     String aName(GetLayoutName());
     592         [ +  - ]:       1356 :     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     593         [ +  - ]:       1356 :     sal_uInt16 nPos = aName.Search(aSep);
     594         [ +  - ]:       1356 :     if (nPos != STRING_NOTFOUND)
     595                 :            :     {
     596                 :       1356 :         nPos = nPos + aSep.Len();
     597         [ +  - ]:       1356 :         aName.Erase(nPos);
     598                 :            :     }
     599                 :            : 
     600   [ +  +  +  +  :       1356 :     switch (eObjKind)
                   +  + ]
     601                 :            :     {
     602                 :            :         case PRESOBJ_OUTLINE:
     603                 :            :         {
     604 [ +  - ][ +  - ]:        162 :             aName = GetLayoutName();
                 [ +  - ]
     605         [ +  - ]:        162 :             aName += sal_Unicode( ' ' );
     606 [ +  - ][ +  - ]:        162 :             aName += String::CreateFromInt32( 1 );
                 [ +  - ]
     607                 :            :         }
     608                 :        162 :         break;
     609                 :            : 
     610                 :            :         case PRESOBJ_TITLE:
     611 [ +  - ][ +  - ]:        244 :             aName += String(SdResId(STR_LAYOUT_TITLE));
         [ +  - ][ +  - ]
     612                 :        244 :             break;
     613                 :            : 
     614                 :            :         case PRESOBJ_NOTES:
     615 [ +  - ][ +  - ]:        302 :             aName += String(SdResId(STR_LAYOUT_NOTES));
         [ +  - ][ +  - ]
     616                 :        302 :             break;
     617                 :            : 
     618                 :            :         case PRESOBJ_TEXT:
     619 [ +  - ][ +  - ]:         67 :             aName += String(SdResId(STR_LAYOUT_SUBTITLE));
         [ +  - ][ +  - ]
     620                 :         67 :             break;
     621                 :            : 
     622                 :            :         case PRESOBJ_HEADER:
     623                 :            :         case PRESOBJ_FOOTER:
     624                 :            :         case PRESOBJ_DATETIME:
     625                 :            :         case PRESOBJ_SLIDENUMBER:
     626 [ +  - ][ +  - ]:        355 :             aName += String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
         [ +  - ][ +  - ]
     627                 :        355 :             break;
     628                 :            : 
     629                 :            :         default:
     630                 :        226 :             break;
     631                 :            :     }
     632                 :            : 
     633         [ +  - ]:       1356 :     SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
     634         [ +  - ]:       1356 :     SfxStyleSheetBase*     pResult   = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     635 [ +  - ][ +  - ]:       1356 :     return (SfxStyleSheet*)pResult;
     636                 :            : }
     637                 :            : 
     638                 :            : /** returns the presentation style with the given helpid from this masterpage or this
     639                 :            :     slides masterpage */
     640                 :          0 : SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
     641                 :            : {
     642         [ #  # ]:          0 :     String aStyleName( pPage->GetLayoutName() );
     643         [ #  # ]:          0 :     const String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     644 [ #  # ][ #  # ]:          0 :     aStyleName.Erase(aStyleName.Search(aSep) + aSep.Len());
     645                 :            : 
     646                 :            :     sal_uInt16 nNameId;
     647   [ #  #  #  #  :          0 :     switch( nHelpId )
                #  #  # ]
     648                 :            :     {
     649                 :          0 :     case HID_PSEUDOSHEET_TITLE:             nNameId = STR_LAYOUT_TITLE;             break;
     650                 :          0 :     case HID_PSEUDOSHEET_SUBTITLE:          nNameId = STR_LAYOUT_SUBTITLE;          break;
     651                 :            :     case HID_PSEUDOSHEET_OUTLINE1:
     652                 :            :     case HID_PSEUDOSHEET_OUTLINE2:
     653                 :            :     case HID_PSEUDOSHEET_OUTLINE3:
     654                 :            :     case HID_PSEUDOSHEET_OUTLINE4:
     655                 :            :     case HID_PSEUDOSHEET_OUTLINE5:
     656                 :            :     case HID_PSEUDOSHEET_OUTLINE6:
     657                 :            :     case HID_PSEUDOSHEET_OUTLINE7:
     658                 :            :     case HID_PSEUDOSHEET_OUTLINE8:
     659                 :          0 :     case HID_PSEUDOSHEET_OUTLINE9:          nNameId = STR_LAYOUT_OUTLINE;           break;
     660                 :          0 :     case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_LAYOUT_BACKGROUNDOBJECTS; break;
     661                 :          0 :     case HID_PSEUDOSHEET_BACKGROUND:        nNameId = STR_LAYOUT_BACKGROUND;        break;
     662                 :          0 :     case HID_PSEUDOSHEET_NOTES:             nNameId = STR_LAYOUT_NOTES;             break;
     663                 :            : 
     664                 :            :     default:
     665                 :            :         OSL_FAIL( "SdPage::getPresentationStyle(), illegal argument!" );
     666                 :          0 :         return 0;
     667                 :            :     }
     668 [ #  # ][ #  # ]:          0 :     aStyleName.Append( String( SdResId( nNameId ) ) );
         [ #  # ][ #  # ]
     669         [ #  # ]:          0 :     if( nNameId == STR_LAYOUT_OUTLINE )
     670                 :            :     {
     671         [ #  # ]:          0 :         aStyleName.Append( sal_Unicode( ' ' ));
     672 [ #  # ][ #  # ]:          0 :         aStyleName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
                 [ #  # ]
     673                 :            :     }
     674                 :            : 
     675         [ #  # ]:          0 :     SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
     676         [ #  # ]:          0 :     SfxStyleSheetBase*     pResult   = pStShPool->Find(aStyleName, SD_STYLE_FAMILY_MASTERPAGE);
     677 [ #  # ][ #  # ]:          0 :     return dynamic_cast<SdStyleSheet*>(pResult);
                 [ #  # ]
     678                 :            : }
     679                 :            : 
     680                 :            : /*************************************************************************
     681                 :            : |*
     682                 :            : |* Das Praesentationsobjekt rObj hat sich geaendert und wird nicht mehr
     683                 :            : |* durch das Praesentationsobjekt der MasterPage referenziert.
     684                 :            : |* Der UserCall wird geloescht.
     685                 :            : |*
     686                 :            : \************************************************************************/
     687                 :            : 
     688                 :      17442 : void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& )
     689                 :            : {
     690         [ +  + ]:      17442 :     if (!maLockAutoLayoutArrangement.isLocked())
     691                 :            :     {
     692         [ +  + ]:      16820 :         switch (eType)
     693                 :            :         {
     694                 :            :             case SDRUSERCALL_MOVEONLY:
     695                 :            :             case SDRUSERCALL_RESIZE:
     696                 :            :             {
     697         [ +  - ]:        298 :                 if( pModel->isLocked() )
     698                 :        298 :                     break;
     699                 :            : 
     700                 :          0 :                 SdrObject* pObj = (SdrObject*) &rObj;
     701                 :            : 
     702         [ #  # ]:          0 :                 if (pObj)
     703                 :            :                 {
     704         [ #  # ]:          0 :                     if (!mbMaster)
     705                 :            :                     {
     706         [ #  # ]:          0 :                         if( pObj->GetUserCall() )
     707                 :            :                         {
     708         [ #  # ]:          0 :                             ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
     709 [ #  # ][ #  # ]:          0 :                             const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
                 [ #  # ]
     710                 :            : 
     711         [ #  # ]:          0 :                             if( bUndo )
     712         [ #  # ]:          0 :                                 pUndoManager->AddUndoAction( new UndoObjectUserCall(*pObj) );
     713                 :            : 
     714                 :            :                             // Objekt was resized by user and does not listen to its slide anymore
     715                 :          0 :                             pObj->SetUserCall(0);
     716                 :            :                         }
     717                 :            :                     }
     718         [ #  # ]:          0 :                     else if (pModel)
     719                 :            :                     {
     720                 :            :                         // MasterPage-Objekt wurde veraendert, daher
     721                 :            :                         // Objekte auf allen Seiten anpassen
     722                 :          0 :                         sal_uInt16 nPageCount = ((SdDrawDocument*) pModel)->GetSdPageCount(mePageKind);
     723                 :            : 
     724         [ #  # ]:          0 :                         for (sal_uInt16 i = 0; i < nPageCount; i++)
     725                 :            :                         {
     726                 :          0 :                             SdPage* pLoopPage = ((SdDrawDocument*) pModel)->GetSdPage(i, mePageKind);
     727                 :            : 
     728 [ #  # ][ #  # ]:          0 :                             if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
                 [ #  # ]
     729                 :            :                             {
     730                 :            :                                 // Seite hoert auf diese MasterPage, daher
     731                 :            :                                 // AutoLayout anpassen
     732                 :          0 :                                 pLoopPage->SetAutoLayout(pLoopPage->GetAutoLayout());
     733                 :            :                             }
     734                 :            :                         }
     735                 :            :                     }
     736                 :            :                 }
     737                 :            :             }
     738                 :          0 :             break;
     739                 :            : 
     740                 :            :             case SDRUSERCALL_DELETE:
     741                 :            :             case SDRUSERCALL_REMOVED:
     742                 :            :             default:
     743                 :      16820 :                 break;
     744                 :            :         }
     745                 :            :     }
     746                 :      17442 : }
     747                 :            : 
     748                 :            : /*************************************************************************
     749                 :            : |*
     750                 :            : |* Erzeugt auf einer MasterPage Hintergrund, Titel- und Layout-Bereich
     751                 :            : |*
     752                 :            : \************************************************************************/
     753                 :            : 
     754                 :        599 : void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
     755                 :            : {
     756         [ +  - ]:        599 :     ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
     757 [ +  - ][ -  + ]:        599 :     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
                 [ #  # ]
     758                 :            : 
     759                 :        599 :     SdPage* pMasterPage = this;
     760                 :            : 
     761         [ +  + ]:        599 :     if (!mbMaster)
     762                 :            :     {
     763                 :        427 :         pMasterPage = (SdPage*)(&(TRG_GetMasterPage()));
     764                 :            :     }
     765                 :            : 
     766         [ -  + ]:        599 :     if (!pMasterPage)
     767                 :            :     {
     768                 :        599 :         return;
     769                 :            :     }
     770                 :            : 
     771                 :            :     /**************************************************************************
     772                 :            :     * Hintergrund, Titel- und Layout-Bereich werden angelegt
     773                 :            :     **************************************************************************/
     774         [ +  + ]:        599 :     if( mePageKind == PK_STANDARD )
     775                 :            :     {
     776                 :        232 :         pMasterPage->EnsureMasterPageDefaultBackground();
     777                 :            :     }
     778                 :            : 
     779         [ +  + ]:        599 :     if( ( (SdDrawDocument*) GetModel() )->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
     780                 :            :     {
     781 [ +  + ][ +  - ]:        247 :         if( mePageKind == PK_HANDOUT && bInit )
     782                 :            :         {
     783                 :            :             // handout template
     784                 :            : 
     785                 :            :             // delete all available handout presentation objects
     786                 :            :             SdrObject* pObj;
     787 [ +  - ][ +  + ]:         99 :             while( (pObj = pMasterPage->GetPresObj(PRESOBJ_HANDOUT)) != 0 )
     788                 :            :             {
     789         [ -  + ]:         42 :                 if( bUndo )
     790 [ #  # ][ #  # ]:          0 :                     pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
                 [ #  # ]
     791                 :            : 
     792 [ +  - ][ +  - ]:         42 :                 pMasterPage->RemoveObject(pObj->GetOrdNum());
     793                 :            :             }
     794                 :            : 
     795         [ +  - ]:         57 :             std::vector< Rectangle > aAreas;
     796 [ +  - ][ +  - ]:         57 :             CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
     797                 :            : 
     798                 :         57 :             const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
     799                 :         57 :             std::vector< Rectangle >::iterator iter( aAreas.begin() );
     800                 :            : 
     801 [ +  - ][ +  + ]:        399 :             while( iter != aAreas.end() )
     802                 :            :             {
     803 [ +  - ][ +  - ]:        342 :                 SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pMasterPage->CreatePresObj(PRESOBJ_HANDOUT, sal_False, (*iter++), sal_True) );
                 [ +  - ]
     804                 :            :                 // #i105146# We want no content to be displayed for PK_HANDOUT,
     805                 :            :                 // so just never set a page as content
     806         [ +  - ]:        342 :                 pPageObj->SetReferencedPage(0L);
     807                 :            : 
     808 [ -  + ][ #  # ]:        342 :                 if( bSkip && iter != aAreas.end() )
         [ #  # ][ -  + ]
           [ -  +  #  # ]
     809         [ #  # ]:          0 :                     ++iter;
     810                 :         57 :             }
     811                 :            :         }
     812                 :            : 
     813         [ +  + ]:        247 :         if( mePageKind != PK_HANDOUT )
     814                 :            :         {
     815                 :        190 :             SdrObject* pMasterTitle = pMasterPage->GetPresObj( PRESOBJ_TITLE );
     816         [ +  + ]:        190 :             if( pMasterTitle == NULL )
     817                 :         79 :                 pMasterPage->CreateDefaultPresObj(PRESOBJ_TITLE, true);
     818                 :            : 
     819         [ +  + ]:        190 :             SdrObject* pMasterOutline = pMasterPage->GetPresObj( mePageKind==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
     820         [ +  + ]:        190 :             if( pMasterOutline == NULL )
     821         [ +  + ]:         88 :                 pMasterPage->CreateDefaultPresObj( mePageKind == PK_STANDARD ? PRESOBJ_OUTLINE : PRESOBJ_NOTES, true );
     822                 :            :         }
     823                 :            : 
     824                 :            :         // create header&footer objects
     825                 :            : 
     826         [ +  + ]:        247 :         if( bCreate )
     827                 :            :         {
     828         [ +  + ]:        126 :             if( mePageKind != PK_STANDARD )
     829                 :            :             {
     830                 :         88 :                 SdrObject* pHeader = pMasterPage->GetPresObj( PRESOBJ_HEADER );
     831         [ +  - ]:         88 :                 if( pHeader == NULL )
     832                 :         88 :                     pMasterPage->CreateDefaultPresObj( PRESOBJ_HEADER, true );
     833                 :            :             }
     834                 :            : 
     835                 :        126 :             SdrObject* pDate   = pMasterPage->GetPresObj( PRESOBJ_DATETIME );
     836         [ +  - ]:        126 :             if( pDate == NULL )
     837                 :        126 :                 pMasterPage->CreateDefaultPresObj( PRESOBJ_DATETIME, true );
     838                 :            : 
     839                 :        126 :             SdrObject* pFooter = pMasterPage->GetPresObj( PRESOBJ_FOOTER );
     840         [ +  - ]:        126 :             if( pFooter == NULL )
     841                 :        126 :                 pMasterPage->CreateDefaultPresObj( PRESOBJ_FOOTER, true );
     842                 :            : 
     843                 :        126 :             SdrObject* pNumber = pMasterPage->GetPresObj( PRESOBJ_SLIDENUMBER );
     844         [ +  - ]:        126 :             if( pNumber == NULL )
     845                 :        126 :                 pMasterPage->CreateDefaultPresObj( PRESOBJ_SLIDENUMBER, true );
     846                 :            :         }
     847                 :            :     }
     848                 :            : }
     849                 :            : 
     850                 :        633 : SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
     851                 :            : {
     852         [ +  + ]:        633 :     if( eObjKind == PRESOBJ_TITLE )
     853                 :            :     {
     854         [ +  - ]:         79 :         Rectangle aTitleRect( GetTitleRect() );
     855         [ +  - ]:         79 :         return CreatePresObj(PRESOBJ_TITLE, sal_False, aTitleRect, bInsert);
     856                 :            :     }
     857         [ +  + ]:        554 :     else if( eObjKind == PRESOBJ_OUTLINE )
     858                 :            :     {
     859         [ +  - ]:         47 :         Rectangle aLayoutRect( GetLayoutRect() );
     860         [ +  - ]:         47 :         return CreatePresObj( PRESOBJ_OUTLINE, sal_False, aLayoutRect, bInsert);
     861                 :            :     }
     862         [ +  + ]:        507 :     else if( eObjKind == PRESOBJ_NOTES )
     863                 :            :     {
     864         [ +  - ]:         41 :         Rectangle aLayoutRect( GetLayoutRect() );
     865         [ +  - ]:         41 :         return CreatePresObj( PRESOBJ_NOTES, sal_False, aLayoutRect, bInsert);
     866                 :            :     }
     867 [ +  + ][ +  + ]:        466 :     else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
         [ +  + ][ +  - ]
     868                 :            :     {
     869                 :            :         // create footer objects for standard master page
     870         [ +  + ]:        466 :         if( mePageKind == PK_STANDARD )
     871                 :            :         {
     872         [ +  - ]:        114 :             const long nLftBorder = GetLftBorder();
     873         [ +  - ]:        114 :             const long nUppBorder = GetUppBorder();
     874                 :            : 
     875                 :        114 :             Point aTitlePos ( nLftBorder, nUppBorder );
     876         [ +  - ]:        114 :             Size aPageSize ( GetSize() );
     877         [ +  - ]:        114 :             aPageSize.Width()  -= nLftBorder + GetRgtBorder();
     878         [ +  - ]:        114 :             aPageSize.Height() -= nUppBorder + GetLwrBorder();
     879                 :            : 
     880                 :        114 :             const int Y = long(nUppBorder + aPageSize.Height() * 0.911);
     881                 :        114 :             const int W1 = long(aPageSize.Width() * 0.233);
     882                 :        114 :             const int W2 = long(aPageSize.Width() * 0.317);
     883                 :        114 :             const int H = long(aPageSize.Height() * 0.069);
     884                 :            : 
     885         [ +  + ]:        114 :             if( eObjKind == PRESOBJ_DATETIME )
     886                 :            :             {
     887                 :         38 :                 Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y );
     888                 :         38 :                 Size aSize( W1, H );
     889         [ +  - ]:         38 :                 Rectangle aRect( aPos, aSize );
     890         [ +  - ]:         38 :                 return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
     891                 :            :             }
     892         [ +  + ]:         76 :             else if( eObjKind == PRESOBJ_FOOTER )
     893                 :            :             {
     894                 :         38 :                 Point aPos( long(nLftBorder+ aPageSize.Width() * 0.342), Y );
     895                 :         38 :                 Size aSize( W2, H );
     896         [ +  - ]:         38 :                 Rectangle aRect( aPos, aSize );
     897         [ +  - ]:         38 :                 return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
     898                 :            :             }
     899         [ +  - ]:         38 :             else if( eObjKind == PRESOBJ_SLIDENUMBER )
     900                 :            :             {
     901                 :         38 :                 Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y );
     902                 :         38 :                 Size aSize( W1, H );
     903         [ +  - ]:         38 :                 Rectangle aRect( aPos, aSize );
     904         [ +  - ]:         38 :                 return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
     905                 :            :             }
     906                 :            :             else
     907                 :            :             {
     908                 :            :                 OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
     909                 :        114 :                 return NULL;
     910                 :            :             }
     911                 :            :         }
     912                 :            :         else
     913                 :            :         {
     914                 :            :             // create header&footer objects for handout and notes master
     915 [ +  - ][ +  - ]:        352 :             Point aTitlePos ( GetLftBorder(), GetUppBorder() );
     916         [ +  - ]:        352 :             Size aPageSize ( GetSize() );
     917 [ +  - ][ +  - ]:        352 :             aPageSize.Width()  -= GetLftBorder() + GetRgtBorder();
     918 [ +  - ][ +  - ]:        352 :             aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
     919                 :            : 
     920                 :            : 
     921                 :        352 :             const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434);
     922                 :        352 :             const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05);
     923                 :            : 
     924                 :        352 :             Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT );
     925                 :            : 
     926         [ +  - ]:        352 :             const int X1 = GetLftBorder();
     927         [ +  - ]:        352 :             const int X2 = GetLftBorder() + long(aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH);
     928         [ +  - ]:        352 :             const int Y1 = GetUppBorder();
     929         [ +  - ]:        352 :             const int Y2 = GetUppBorder() + long(aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
     930                 :            : 
     931         [ +  + ]:        352 :             if( eObjKind == PRESOBJ_HEADER )
     932                 :            :             {
     933                 :         88 :                 Point aPos( X1, Y1 );
     934         [ +  - ]:         88 :                 Rectangle aRect( aPos, aSize );
     935         [ +  - ]:         88 :                 return CreatePresObj( PRESOBJ_HEADER, sal_False, aRect, bInsert );
     936                 :            :             }
     937         [ +  + ]:        264 :             else if( eObjKind == PRESOBJ_DATETIME )
     938                 :            :             {
     939                 :         88 :                 Point aPos( X2, Y1 );
     940         [ +  - ]:         88 :                 Rectangle aRect( aPos, aSize );
     941         [ +  - ]:         88 :                 return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
     942                 :            :             }
     943         [ +  + ]:        176 :             else if( eObjKind == PRESOBJ_FOOTER )
     944                 :            :             {
     945                 :         88 :                 Point aPos( X1, Y2 );
     946         [ +  - ]:         88 :                 Rectangle aRect( aPos, aSize );
     947         [ +  - ]:         88 :                 return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
     948                 :            :             }
     949         [ +  - ]:         88 :             else if( eObjKind == PRESOBJ_SLIDENUMBER )
     950                 :            :             {
     951                 :         88 :                 Point aPos( X2, Y2 );
     952         [ +  - ]:         88 :                 Rectangle aRect( aPos, aSize );
     953         [ +  - ]:         88 :                 return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
     954                 :            :             }
     955                 :            : 
     956                 :            :             OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
     957                 :        352 :             return NULL;
     958                 :            :         }
     959                 :            :     }
     960                 :            :     else
     961                 :            :     {
     962                 :            :         OSL_FAIL("SdPage::CreateDefaultPresObj() - unknown PRESOBJ kind" );
     963                 :        633 :         return NULL;
     964                 :            :     }
     965                 :            : }
     966                 :            : 
     967                 :            : /*************************************************************************
     968                 :            : |*
     969                 :            : |* Titelbereich zurueckgeben
     970                 :            : |*
     971                 :            : \************************************************************************/
     972                 :            : 
     973                 :        229 : Rectangle SdPage::GetTitleRect() const
     974                 :            : {
     975                 :        229 :     Rectangle aTitleRect;
     976                 :            : 
     977         [ +  - ]:        229 :     if (mePageKind != PK_HANDOUT)
     978                 :            :     {
     979                 :            :         /******************************************************************
     980                 :            :         * Standard- oder Notiz-Seite: Titelbereich
     981                 :            :         ******************************************************************/
     982 [ +  - ][ +  - ]:        229 :         Point aTitlePos ( GetLftBorder(), GetUppBorder() );
     983         [ +  - ]:        229 :         Size aTitleSize ( GetSize() );
     984 [ +  - ][ +  - ]:        229 :         aTitleSize.Width()  -= GetLftBorder() + GetRgtBorder();
     985 [ +  - ][ +  - ]:        229 :         aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
     986                 :            : 
     987         [ +  + ]:        229 :         if (mePageKind == PK_STANDARD)
     988                 :            :         {
     989                 :         58 :             aTitlePos.X() += long( aTitleSize.Width() * 0.05 );
     990                 :         58 :             aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 );
     991                 :         58 :             aTitleSize.Width() = long( aTitleSize.Width() * 0.9 );
     992                 :         58 :             aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
     993                 :            :         }
     994         [ +  - ]:        171 :         else if (mePageKind == PK_NOTES)
     995                 :            :         {
     996                 :        171 :             Point aPos = aTitlePos;
     997                 :        171 :             aPos.Y() += long( aTitleSize.Height() * 0.076 );
     998                 :            : 
     999                 :            :             // Hoehe beschraenken
    1000                 :        171 :             aTitleSize.Height() = (long) (aTitleSize.Height() * 0.375);
    1001                 :            : 
    1002                 :        171 :             Size aPartArea = aTitleSize;
    1003                 :        171 :             Size aSize;
    1004         [ +  - ]:        171 :             sal_uInt16 nDestPageNum(GetPageNum());
    1005                 :        171 :             SdrPage* pRefPage = 0L;
    1006                 :            : 
    1007         [ +  + ]:        171 :             if(nDestPageNum)
    1008                 :            :             {
    1009                 :            :                 // only decrement if != 0, else we get 0xffff
    1010                 :        168 :                 nDestPageNum -= 1;
    1011                 :            :             }
    1012                 :            : 
    1013 [ +  - ][ +  + ]:        171 :             if(nDestPageNum < pModel->GetPageCount())
    1014                 :            :             {
    1015         [ +  - ]:        168 :                 pRefPage = pModel->GetPage(nDestPageNum);
    1016                 :            :             }
    1017                 :            : 
    1018         [ +  + ]:        171 :             if ( pRefPage )
    1019                 :            :             {
    1020                 :            :                 // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
    1021         [ +  - ]:        168 :                 double fH = (double) aPartArea.Width()  / pRefPage->GetWdt();
    1022         [ +  - ]:        168 :                 double fV = (double) aPartArea.Height() / pRefPage->GetHgt();
    1023                 :            : 
    1024         [ +  - ]:        168 :                 if ( fH > fV )
    1025                 :        168 :                     fH = fV;
    1026         [ +  - ]:        168 :                 aSize.Width()  = (long) (fH * pRefPage->GetWdt());
    1027         [ +  - ]:        168 :                 aSize.Height() = (long) (fH * pRefPage->GetHgt());
    1028                 :            : 
    1029                 :        168 :                 aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
    1030                 :        168 :                 aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
    1031                 :            :             }
    1032                 :            : 
    1033                 :        171 :             aTitlePos = aPos;
    1034                 :        171 :             aTitleSize = aSize;
    1035                 :            :         }
    1036                 :            : 
    1037                 :        229 :         aTitleRect.SetPos(aTitlePos);
    1038         [ +  - ]:        229 :         aTitleRect.SetSize(aTitleSize);
    1039                 :            :     }
    1040                 :            : 
    1041                 :        229 :     return aTitleRect;
    1042                 :            : }
    1043                 :            : 
    1044                 :            : 
    1045                 :            : /*************************************************************************
    1046                 :            : |*
    1047                 :            : |* Gliederungsbereich zurueckgeben
    1048                 :            : |*
    1049                 :            : \************************************************************************/
    1050                 :            : 
    1051                 :        409 : Rectangle SdPage::GetLayoutRect() const
    1052                 :            : {
    1053                 :        409 :     Rectangle aLayoutRect;
    1054                 :            : 
    1055         [ +  + ]:        409 :     if (mePageKind != PK_HANDOUT)
    1056                 :            :     {
    1057 [ +  - ][ +  - ]:        347 :         Point aLayoutPos ( GetLftBorder(), GetUppBorder() );
    1058         [ +  - ]:        347 :         Size aLayoutSize ( GetSize() );
    1059 [ +  - ][ +  - ]:        347 :         aLayoutSize.Width()  -= GetLftBorder() + GetRgtBorder();
    1060 [ +  - ][ +  - ]:        347 :         aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
    1061                 :            : 
    1062         [ +  + ]:        347 :         if (mePageKind == PK_STANDARD)
    1063                 :            :         {
    1064                 :         94 :             aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 );
    1065                 :         94 :             aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 );
    1066                 :         94 :             aLayoutSize.Width() = long( aLayoutSize.Width() * 0.88 );
    1067                 :         94 :             aLayoutSize.Height() = long( aLayoutSize.Height() * 0.58 );
    1068                 :         94 :             aLayoutRect.SetPos(aLayoutPos);
    1069         [ +  - ]:         94 :             aLayoutRect.SetSize(aLayoutSize);
    1070                 :            :         }
    1071         [ +  - ]:        253 :         else if (mePageKind == PK_NOTES)
    1072                 :            :         {
    1073                 :        253 :             aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 );
    1074                 :        253 :             aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 );
    1075                 :        253 :             aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 );
    1076                 :        253 :             aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 );
    1077                 :        253 :             aLayoutRect.SetPos(aLayoutPos);
    1078         [ +  - ]:        347 :             aLayoutRect.SetSize(aLayoutSize);
    1079                 :            :         }
    1080                 :            :     }
    1081                 :            : 
    1082                 :        409 :     return aLayoutRect;
    1083                 :            : }
    1084                 :            : 
    1085                 :            : 
    1086                 :            : /**************************************************************************
    1087                 :            : |*
    1088                 :            : |* Diese Methode weist ein AutoLayout zu
    1089                 :            : |*
    1090                 :            : \*************************************************************************/
    1091                 :            : 
    1092                 :            : const int MAX_PRESOBJS = 7; // maximum number of presentation objects per layout
    1093                 :            : const int VERTICAL = 0x8000;
    1094                 :            : 
    1095                 :            : struct LayoutDescriptor
    1096                 :            : {
    1097                 :            :     int mnLayout;
    1098                 :            :     PresObjKind meKind[MAX_PRESOBJS];
    1099                 :            :     bool mbVertical[MAX_PRESOBJS];
    1100                 :            : 
    1101                 :            :     LayoutDescriptor( int nLayout, int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0, int k5 = 0, int k6 = 0 );
    1102                 :            : };
    1103                 :            : 
    1104                 :        770 : LayoutDescriptor::LayoutDescriptor( int nLayout, int k0, int k1, int k2, int k3, int k4, int k5, int k6 )
    1105                 :        770 : : mnLayout( nLayout )
    1106                 :            : {
    1107                 :        770 :     meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL;
    1108                 :        770 :     meKind[1] = static_cast<PresObjKind>(k1 & (~VERTICAL)); mbVertical[1] = (k1 & VERTICAL) == VERTICAL;
    1109                 :        770 :     meKind[2] = static_cast<PresObjKind>(k2 & (~VERTICAL)); mbVertical[2] = (k2 & VERTICAL) == VERTICAL;
    1110                 :        770 :     meKind[3] = static_cast<PresObjKind>(k3 & (~VERTICAL)); mbVertical[3] = (k3 & VERTICAL) == VERTICAL;
    1111                 :        770 :     meKind[4] = static_cast<PresObjKind>(k4 & (~VERTICAL)); mbVertical[4] = (k4 & VERTICAL) == VERTICAL;
    1112                 :        770 :     meKind[5] = static_cast<PresObjKind>(k5 & (~VERTICAL)); mbVertical[5] = (k5 & VERTICAL) == VERTICAL;
    1113                 :        770 :     meKind[6] = static_cast<PresObjKind>(k6 & (~VERTICAL)); mbVertical[6] = (k6 & VERTICAL) == VERTICAL;
    1114                 :        770 : }
    1115                 :            : 
    1116                 :        282 : static const LayoutDescriptor& GetLayoutDescriptor( AutoLayout eLayout )
    1117                 :            : {
    1118                 :            :     static LayoutDescriptor aLayouts[AUTOLAYOUT__END-AUTOLAYOUT__START] =
    1119                 :            :     {
    1120                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TEXT ),                                 // AUTOLAYOUT_TITLE
    1121                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ),                              // AUTOLAYOUT_ENUM
    1122                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ),                              // AUTOLAYOUT_CHART
    1123                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_2TEXT
    1124                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_TEXTCHART
    1125                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ),                              // AUTOLAYOUT_ORG
    1126                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_TEXTCLbIP
    1127                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_CHARTTEXT
    1128                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ),                              // AUTOLAYOUT_TAB
    1129                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_CLIPTEXT
    1130                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_TEXTOBJ
    1131                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OBJECT ),                               // AUTOLAYOUT_OBJ
    1132                 :            :         LayoutDescriptor( 2, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),    // AUTOLAYOUT_TEXT2OBJ
    1133                 :            :         LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_TEXTOBJ
    1134                 :            :         LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_OBJOVERTEXT
    1135                 :            :         LayoutDescriptor( 3, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),    // AUTOLAYOUT_2OBJTEXT
    1136                 :            :         LayoutDescriptor( 5, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),    // AUTOLAYOUT_2OBJOVERTEXT
    1137                 :            :         LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),             // AUTOLAYOUT_TEXTOVEROBJ
    1138                 :            :         LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE,                   // AUTOLAYOUT_4OBJ
    1139                 :            :             PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),
    1140                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_NONE ),                                 // AUTOLAYOUT_ONLY_TITLE
    1141                 :            :         LayoutDescriptor( 0, PRESOBJ_NONE ),                                                // AUTOLAYOUT_NONE
    1142                 :            :         LayoutDescriptor( 0, PRESOBJ_PAGE, PRESOBJ_NOTES ),                                 // AUTOLAYOUT_NOTES
    1143                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT1
    1144                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT2
    1145                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT3
    1146                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT4
    1147                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT6
    1148                 :            :         LayoutDescriptor( 7, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE ),// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
    1149                 :            :         LayoutDescriptor( 8, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ),            // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
    1150                 :            :         LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL ),                     // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
    1151                 :            :         LayoutDescriptor( 9, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ),   // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
    1152                 :            :         LayoutDescriptor( 0 ),                                                              // AUTOLAYOUT_HANDOUT9
    1153                 :            :         LayoutDescriptor( 10, PRESOBJ_TEXT, PRESOBJ_NONE ),                                 // AUTOLAYOUT_ONLY_TEXT
    1154                 :            :         LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE,               // AUTOLAYOUT_4CLIPART
    1155                 :            :             PRESOBJ_GRAPHIC, PRESOBJ_GRAPHIC ),
    1156                 :            :         LayoutDescriptor( 11, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE,              // AUTOLAYOUT_6CLIPART
    1157                 :            :             PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE )
    1158 [ +  + ][ +  - ]:        282 :     };
    1159                 :            : 
    1160 [ +  - ][ -  + ]:        282 :     if( (eLayout < AUTOLAYOUT__START) || (eLayout >= AUTOLAYOUT__END) )
    1161                 :          0 :         eLayout = AUTOLAYOUT_NONE;
    1162                 :            : 
    1163                 :        282 :     return aLayouts[ eLayout - AUTOLAYOUT__START ];
    1164                 :            : }
    1165                 :            : 
    1166                 :        282 : static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRectangle )
    1167                 :            : {
    1168         [ +  - ]:        282 :     Rectangle aTitleRect;
    1169         [ +  - ]:        282 :     Rectangle aLayoutRect;
    1170                 :            : 
    1171         [ +  - ]:        282 :     if( rPage.GetPageKind() != PK_HANDOUT )
    1172                 :            :     {
    1173         [ +  - ]:        282 :         SdPage& rMasterPage = static_cast<SdPage&>(rPage.TRG_GetMasterPage());
    1174         [ +  - ]:        282 :         SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
    1175 [ +  + ][ +  - ]:        282 :         SdrObject* pMasterOutline = rMasterPage.GetPresObj( rPage.GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
    1176                 :            : 
    1177         [ +  + ]:        282 :         if( pMasterTitle )
    1178         [ +  - ]:        162 :             aTitleRect = pMasterTitle->GetLogicRect();
    1179                 :            : 
    1180 [ +  - ][ +  + ]:        282 :         if (aTitleRect.IsEmpty() )
    1181         [ +  - ]:        123 :             aTitleRect = rPage.GetTitleRect();
    1182                 :            : 
    1183         [ +  + ]:        282 :         if( pMasterOutline )
    1184         [ +  - ]:        162 :             aLayoutRect = pMasterOutline->GetLogicRect();
    1185                 :            : 
    1186 [ +  - ][ +  + ]:        282 :         if (aLayoutRect.IsEmpty() )
    1187         [ +  - ]:        120 :             aLayoutRect = rPage.GetLayoutRect();
    1188                 :            :     }
    1189                 :            : 
    1190                 :        282 :     rRectangle[0] = aTitleRect;
    1191                 :            : 
    1192                 :            :     int i;
    1193         [ +  + ]:       1974 :     for( i = 1; i < MAX_PRESOBJS; i++ )
    1194                 :       1692 :         rRectangle[i] = aLayoutRect;
    1195                 :            : 
    1196                 :        282 :     Point       aTitlePos( aTitleRect.TopLeft() );
    1197         [ +  - ]:        282 :     Size        aLayoutSize( aLayoutRect.GetSize() );
    1198                 :        282 :     Point       aLayoutPos( aLayoutRect.TopLeft() );
    1199                 :        282 :     Size        aTempSize;
    1200                 :        282 :     Point       aTempPnt;
    1201                 :            : 
    1202 [ +  - ][ +  - ]:        282 :     sal_Bool    bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
         [ +  - ][ -  + ]
                 [ +  - ]
    1203                 :            : 
    1204   [ +  -  -  -  :        282 :     switch( nLayout )
          -  -  -  -  -  
                -  -  - ]
    1205                 :            :     {
    1206                 :            :     case 0: // default layout using only the title and layout area
    1207                 :        282 :         break; // do nothing
    1208                 :            :     case 1: // title, 2 shapes
    1209                 :            :     case 9: // title, 2 vertical shapes
    1210                 :          0 :         aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.488);
    1211         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1212                 :            : 
    1213                 :          0 :         aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
    1214         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1215                 :            : 
    1216 [ #  # ][ #  # ]:          0 :         if( bRightToLeft && (nLayout != 9) )
    1217                 :          0 :             ::std::swap< Rectangle >( rRectangle[1], rRectangle[2] );
    1218                 :          0 :         break;
    1219                 :            :     case 2: // title, shape, 2 shapes
    1220                 :          0 :         aTempPnt = aLayoutPos;
    1221                 :          0 :         aTempSize = aLayoutSize;
    1222                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1223                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
    1224                 :          0 :         aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
    1225         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1226                 :            : 
    1227                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1228         [ #  # ]:          0 :         rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
    1229                 :            : 
    1230                 :          0 :         aLayoutPos = aTempPnt;
    1231                 :          0 :         aLayoutSize = aTempSize;
    1232                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
    1233         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1234                 :            : 
    1235         [ #  # ]:          0 :         if( bRightToLeft )
    1236                 :            :         {
    1237                 :          0 :             ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
    1238                 :          0 :             rRectangle[3].Left() = rRectangle[2].Left();
    1239                 :            :         }
    1240                 :          0 :         break;
    1241                 :            :     case 3: // title, 2 shapes, shape
    1242                 :          0 :         aTempPnt = aLayoutPos;
    1243                 :          0 :         aTempSize = aLayoutSize;
    1244                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1245                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
    1246         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1247                 :            : 
    1248                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1249         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1250                 :            : 
    1251                 :          0 :         aLayoutPos = aTempPnt;
    1252                 :          0 :         aLayoutSize = aTempSize;
    1253                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
    1254                 :          0 :         aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
    1255         [ #  # ]:          0 :         rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
    1256                 :            : 
    1257         [ #  # ]:          0 :         if( bRightToLeft )
    1258                 :            :         {
    1259                 :          0 :             ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
    1260                 :          0 :             rRectangle[3].Left() = rRectangle[2].Left();
    1261                 :            :         }
    1262                 :          0 :         break;
    1263                 :            :     case 4: // title, shape above shape
    1264                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1265         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1266                 :            : 
    1267                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1268         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1269                 :          0 :         break;
    1270                 :            : 
    1271                 :            :     case 5: // title, 2 shapes above shape
    1272                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1273                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
    1274         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1275                 :            : 
    1276                 :          0 :         aTempPnt = aLayoutPos;
    1277                 :          0 :         aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
    1278         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1279                 :            : 
    1280                 :          0 :         aLayoutPos.X() = aTempPnt.X();
    1281                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1282                 :          0 :         aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
    1283         [ #  # ]:          0 :         rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
    1284                 :          0 :         break;
    1285                 :            :     case 6: // title, 4 shapes
    1286                 :            :     {
    1287                 :          0 :         sal_uLong nX = long (aLayoutPos.X());
    1288                 :            : 
    1289                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1290                 :          0 :         aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.488);
    1291         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1292                 :            : 
    1293                 :          0 :         aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
    1294         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1295                 :            : 
    1296                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1297         [ #  # ]:          0 :         rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
    1298                 :            : 
    1299                 :          0 :         aLayoutPos.X() = nX;
    1300         [ #  # ]:          0 :         rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
    1301                 :          0 :         break;
    1302                 :            :     }
    1303                 :            :     case 7: // vertical title, shape above shape
    1304                 :            :     {
    1305 [ #  # ][ #  # ]:          0 :         Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
    1306         [ #  # ]:          0 :         rRectangle[0].SetSize( aSize );
    1307         [ #  # ]:          0 :         rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
    1308                 :            : 
    1309         [ #  # ]:          0 :         Size aPageSize ( rPage.GetSize() );
    1310 [ #  # ][ #  # ]:          0 :         aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
    1311         [ #  # ]:          0 :         aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
    1312                 :          0 :         aSize.Width() = long( aPageSize.Width() * 0.7 );
    1313                 :          0 :         rRectangle[1].SetPos( aTitleRect.TopLeft() );
    1314         [ #  # ]:          0 :         rRectangle[1].SetSize( aSize );
    1315                 :            : 
    1316         [ #  # ]:          0 :         aSize.Height() = rRectangle[0].GetSize().Height();
    1317                 :          0 :         Point aPos( aTitleRect.TopLeft() );
    1318                 :          0 :         aPos.Y() += long ( aSize.Height() * 0.53 );
    1319                 :          0 :         rRectangle[2].SetPos( aPos );
    1320         [ #  # ]:          0 :         aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
    1321         [ #  # ]:          0 :         rRectangle[2].SetSize( aSize );
    1322                 :            :         break;
    1323                 :            :     }
    1324                 :            :     case 8: // vertical title, shape
    1325                 :            :     {
    1326 [ #  # ][ #  # ]:          0 :         Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
    1327         [ #  # ]:          0 :         rRectangle[0].SetSize( aSize );
    1328         [ #  # ]:          0 :         rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
    1329                 :            : 
    1330         [ #  # ]:          0 :         Size aPageSize ( rPage.GetSize() );
    1331 [ #  # ][ #  # ]:          0 :         aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
    1332         [ #  # ]:          0 :         aSize.Height() = rRectangle[0].GetSize().Height();
    1333                 :          0 :         aSize.Width() = long( aPageSize.Width() * 0.7 );
    1334                 :          0 :         rRectangle[1].SetPos( aTitleRect.TopLeft() );
    1335         [ #  # ]:          0 :         rRectangle[1].SetSize( aSize );
    1336                 :            :         break;
    1337                 :            :     }
    1338                 :            :     case 10: // onlytext
    1339                 :            :     {
    1340 [ #  # ][ #  # ]:          0 :         Size aSize( rRectangle[0].GetSize().Width(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
    1341         [ #  # ]:          0 :         rRectangle[0].SetSize( aSize );
    1342                 :          0 :         rRectangle[0].SetPos( aTitlePos);
    1343                 :            :         break;
    1344                 :            :     }
    1345                 :            :     case 11: // title, 6 shapes
    1346                 :            :     {
    1347                 :          0 :         sal_uLong nX = long (aLayoutPos.X());
    1348                 :            : 
    1349                 :          0 :         aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
    1350                 :          0 :         aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.322);
    1351         [ #  # ]:          0 :         rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
    1352                 :            : 
    1353                 :          0 :         aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
    1354         [ #  # ]:          0 :         rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
    1355                 :            : 
    1356                 :          0 :         aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05);
    1357         [ #  # ]:          0 :         rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
    1358                 :            : 
    1359                 :          0 :         aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
    1360         [ #  # ]:          0 :         rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
    1361                 :            : 
    1362                 :          0 :         aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
    1363         [ #  # ]:          0 :         rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize);
    1364                 :            : 
    1365                 :          0 :         aLayoutPos.X() = nX;
    1366         [ #  # ]:          0 :         rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize);
    1367                 :            : 
    1368                 :          0 :         break;
    1369                 :            :     }
    1370                 :            : 
    1371                 :            :     }
    1372                 :        282 : }
    1373                 :            : 
    1374                 :            : 
    1375                 :        282 : void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit, bool bSwitchLayout )
    1376                 :            : {
    1377                 :            :     int i;
    1378                 :            : 
    1379                 :            :     // init list of indexes for each presentation shape kind
    1380                 :            :     // this is used to find subsequent shapes with the same presentation shape kind
    1381                 :            :     int PresObjIndex[PRESOBJ_MAX];
    1382         [ +  + ]:       5640 :     for( i = 0; i < PRESOBJ_MAX; i++ ) PresObjIndex[i] = 1;
    1383                 :            : 
    1384                 :        282 :     bool bMissing = false;
    1385                 :            : 
    1386                 :            :     // for each entry in the layoutdescriptor, arrange a presentation shape
    1387 [ +  - ][ +  + ]:        840 :     for (i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++)
                 [ +  + ]
    1388                 :            :     {
    1389                 :        558 :         PresObjKind eKind = rDescriptor.meKind[i];
    1390                 :        558 :         SdrObject* pObj = 0;
    1391 [ +  - ][ +  + ]:        585 :         while( (pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind], true )) != 0 )
    1392                 :            :         {
    1393                 :         44 :             PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind
    1394                 :            : 
    1395 [ +  + ][ +  - ]:         44 :             if( !bSwitchLayout || !pObj->IsEmptyPresObj() )
         [ +  + ][ +  + ]
    1396                 :            :             {
    1397         [ +  - ]:         17 :                 rShapes[i] = pObj;
    1398                 :         17 :                 break;
    1399                 :            :             }
    1400                 :            :         }
    1401                 :            : 
    1402         [ +  + ]:        558 :         if( !pObj )
    1403                 :        541 :             bMissing = true;
    1404                 :            :     }
    1405                 :            : 
    1406 [ +  + ][ +  + ]:        282 :     if( bMissing && bInit )
    1407                 :            :     {
    1408                 :            :         // for each entry in the layoutdescriptor, look for an alternative shape
    1409 [ +  - ][ +  + ]:        753 :         for (i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++)
                 [ +  + ]
    1410                 :            :         {
    1411 [ +  - ][ -  + ]:        502 :             if( rShapes[i] )
    1412                 :          0 :                 continue;
    1413                 :            : 
    1414                 :        502 :             PresObjKind eKind = rDescriptor.meKind[i];
    1415                 :            : 
    1416                 :        502 :             SdrObject* pObj = 0;
    1417                 :        502 :             bool bFound = false;
    1418                 :            : 
    1419         [ +  - ]:        502 :             const int nShapeCount = rPage.GetObjCount();
    1420                 :        502 :             int nShapeIndex = 0;
    1421 [ +  + ][ +  - ]:        526 :             while((nShapeIndex < nShapeCount) && !bFound )
                 [ +  + ]
    1422                 :            :             {
    1423         [ +  - ]:         24 :                 pObj = rPage.GetObj(nShapeIndex++);
    1424                 :            : 
    1425 [ +  - ][ +  - ]:         24 :                 if( pObj->IsEmptyPresObj() )
    1426                 :         24 :                     continue;
    1427                 :            : 
    1428 [ #  # ][ #  # ]:          0 :                 if( pObj->GetObjInventor() != SdrInventor )
    1429                 :          0 :                     continue;
    1430                 :            : 
    1431                 :            :                 // do not reuse shapes that are already part of the layout
    1432 [ #  # ][ #  # ]:          0 :                 if( std::find( rShapes.begin(), rShapes.end(), pObj ) != rShapes.end() )
                 [ #  # ]
    1433                 :          0 :                     continue;
    1434                 :            : 
    1435 [ #  # ][ #  # ]:          0 :                 bool bPresStyle = pObj->GetStyleSheet() && (pObj->GetStyleSheet()->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE);
         [ #  # ][ #  # ]
    1436         [ #  # ]:          0 :                 SdrObjKind eSdrObjKind = static_cast< SdrObjKind >( pObj->GetObjIdentifier() );
    1437                 :            : 
    1438   [ #  #  #  #  :          0 :                 switch( eKind )
          #  #  #  #  #  
                      # ]
    1439                 :            :                 {
    1440                 :            :                 case PRESOBJ_TITLE:
    1441                 :          0 :                     bFound = eSdrObjKind == OBJ_TITLETEXT;
    1442                 :          0 :                     break;
    1443                 :            :                 case PRESOBJ_TABLE:
    1444                 :          0 :                     bFound = eSdrObjKind == OBJ_TABLE;
    1445                 :          0 :                     break;
    1446                 :            :                 case PRESOBJ_MEDIA:
    1447                 :          0 :                     bFound = eSdrObjKind == OBJ_MEDIA;
    1448                 :          0 :                     break;
    1449                 :            :                 case PRESOBJ_OUTLINE:
    1450                 :            :                     bFound = (eSdrObjKind == OBJ_OUTLINETEXT) ||
    1451                 :            :                              ((eSdrObjKind == OBJ_TEXT) && bPresStyle) ||
    1452 [ #  # ][ #  # ]:          0 :                              (eSdrObjKind == OBJ_TABLE) || (eSdrObjKind == OBJ_MEDIA) || (eSdrObjKind == OBJ_GRAF) || (eSdrObjKind == OBJ_OLE2);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1453                 :          0 :                     break;
    1454                 :            :                 case PRESOBJ_GRAPHIC:
    1455                 :          0 :                     bFound = eSdrObjKind == OBJ_GRAF;
    1456                 :          0 :                     break;
    1457                 :            :                 case PRESOBJ_OBJECT:
    1458         [ #  # ]:          0 :                     if( eSdrObjKind == OBJ_OLE2 )
    1459                 :            :                     {
    1460         [ #  # ]:          0 :                         SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
    1461         [ #  # ]:          0 :                         if( pOle2 )
    1462                 :            :                         {
    1463 [ #  # ][ #  # ]:          0 :                             if( pOle2->IsEmpty() )
    1464                 :          0 :                                 bFound = true;
    1465 [ #  # ][ #  # ]:          0 :                             else if( rPage.GetModel() )
    1466                 :            :                             {
    1467         [ #  # ]:          0 :                                 SdrModel* pSdrModel = rPage.GetModel();
    1468                 :          0 :                                 ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
    1469         [ #  # ]:          0 :                                 if( pPersist )
    1470                 :            :                                 {
    1471         [ #  # ]:          0 :                                     uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
    1472 [ #  # ][ #  # ]:          0 :                                             GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
         [ #  # ][ #  # ]
    1473                 :            : 
    1474                 :            :                                     // TODO CL->KA: Why is this not working anymore?
    1475         [ #  # ]:          0 :                                     if( xObject.is() )
    1476                 :            :                                     {
    1477 [ #  # ][ #  # ]:          0 :                                         SvGlobalName aClassId( xObject->getClassID() );
         [ #  # ][ #  # ]
    1478                 :            : 
    1479         [ #  # ]:          0 :                                         const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
    1480         [ #  # ]:          0 :                                         const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
    1481         [ #  # ]:          0 :                                         const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
    1482                 :            : 
    1483 [ #  # ][ #  # ]:          0 :                                         if( aPluginClassId != aClassId && aAppletClassId != aClassId && aIFrameClassId != aClassId )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1484                 :            :                                         {
    1485                 :          0 :                                             bFound = true;
    1486 [ #  # ][ #  # ]:          0 :                                         }
         [ #  # ][ #  # ]
    1487                 :          0 :                                     }
    1488                 :            :                                 }
    1489                 :            :                              }
    1490                 :            :                          }
    1491                 :            :                     }
    1492                 :          0 :                     break;
    1493                 :            :                 case PRESOBJ_CHART:
    1494                 :            :                 case PRESOBJ_CALC:
    1495         [ #  # ]:          0 :                     if( eSdrObjKind == OBJ_OLE2 )
    1496                 :            :                     {
    1497         [ #  # ]:          0 :                         SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
    1498         [ #  # ]:          0 :                         if( pOle2 )
    1499                 :            :                         {
    1500 [ #  # ][ #  # ]:          0 :                             if(
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1501                 :            :                                 ((eKind == PRESOBJ_CHART) &&
    1502 [ #  # ][ #  # ]:          0 :                                     ( pOle2->GetProgName().EqualsAscii( "StarChart" ) || pOle2->IsChart() ) )
    1503                 :            :                                 ||
    1504                 :            :                                 ((eKind == PRESOBJ_CALC) &&
    1505 [ #  # ][ #  # ]:          0 :                                     ( pOle2->GetProgName().EqualsAscii( "StarCalc" ) || pOle2->IsCalc() ) ) )
    1506                 :            :                             {
    1507                 :          0 :                                 bFound = true;
    1508                 :            :                             }
    1509                 :            :                         }
    1510                 :          0 :                         break;
    1511                 :            :                     }
    1512         [ #  # ]:          0 :                     else if( eSdrObjKind == OBJ_TABLE )
    1513                 :            :                     {
    1514                 :          0 :                         bFound = true;
    1515                 :            :                     }
    1516                 :          0 :                     break;
    1517                 :            :                 case PRESOBJ_PAGE:
    1518                 :            :                 case PRESOBJ_HANDOUT:
    1519                 :          0 :                     bFound = eSdrObjKind == OBJ_PAGE;
    1520                 :          0 :                     break;
    1521                 :            :                 case PRESOBJ_NOTES:
    1522                 :            :                 case PRESOBJ_TEXT:
    1523 [ #  # ][ #  # ]:          0 :                     bFound = (bPresStyle && (eSdrObjKind == OBJ_TEXT)) || (eSdrObjKind == OBJ_OUTLINETEXT);
                 [ #  # ]
    1524                 :          0 :                     break;
    1525                 :            :                 default:
    1526                 :          0 :                     break;
    1527                 :            :                 }
    1528                 :            :             }
    1529                 :            : 
    1530         [ -  + ]:        502 :             if( bFound )
    1531         [ #  # ]:        502 :                 rShapes[i] = pObj;
    1532                 :            :         }
    1533                 :            :     }
    1534                 :        282 : }
    1535                 :            : 
    1536                 :        599 : void SdPage::SetAutoLayout(AutoLayout eLayout, sal_Bool bInit, sal_Bool bCreate )
    1537                 :            : {
    1538                 :        599 :     sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
    1539                 :            : 
    1540                 :        599 :     const bool bSwitchLayout = eLayout != GetAutoLayout();
    1541                 :            : 
    1542 [ +  - ][ +  - ]:        599 :     ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
    1543 [ +  - ][ +  - ]:        599 :     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
         [ -  + ][ #  # ]
    1544                 :            : 
    1545                 :        599 :     meAutoLayout = eLayout;
    1546                 :            : 
    1547                 :            :     // if needed, creates and initialises the presentation shapes on this slides master page
    1548         [ +  - ]:        599 :     CreateTitleAndLayout(bInit, bCreate);
    1549                 :            : 
    1550 [ +  + ][ +  - ]:        599 :     if((meAutoLayout == AUTOLAYOUT_NONE && maPresentationShapeList.isEmpty()) || mbMaster)
         [ +  + ][ +  + ]
                 [ +  + ]
    1551                 :            :     {
    1552                 :            :         // MasterPage or no layout and no presentation shapes available, noting to do
    1553                 :        599 :         return;
    1554                 :            :     }
    1555                 :            : 
    1556 [ +  - ][ +  + ]:       2256 :     Rectangle aRectangle[MAX_PRESOBJS];
    1557                 :        282 :     const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
    1558         [ +  - ]:        282 :     CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle );
    1559                 :            : 
    1560         [ +  - ]:        282 :     std::set< SdrObject* > aUsedPresentationObjects;
    1561                 :            : 
    1562                 :            : 
    1563         [ +  - ]:        282 :     std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
    1564         [ +  - ]:        282 :     findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout );
    1565                 :            : 
    1566                 :            :     int i;
    1567                 :            : 
    1568                 :            :     // for each entry in the layoutdescriptor, arrange a presentation shape
    1569 [ +  - ][ +  + ]:        840 :     for (i = 0; (i < MAX_PRESOBJS) && (aDescriptor.meKind[i] != PRESOBJ_NONE); i++)
                 [ +  + ]
    1570                 :            :     {
    1571                 :        558 :         PresObjKind eKind = aDescriptor.meKind[i];
    1572 [ +  - ][ +  - ]:        558 :         SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit );
    1573         [ +  + ]:        558 :         if( pObj )
    1574         [ +  - ]:        519 :             aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
    1575                 :            :     }
    1576                 :            : 
    1577                 :            :     // now delete all empty presentation objects that are no longer used by the new layout
    1578         [ +  + ]:        282 :     if( bInit )
    1579                 :            :     {
    1580         [ +  - ]:        261 :         SdrObject* pObj = maPresentationShapeList.getNextShape(0);
    1581                 :            : 
    1582         [ +  + ]:        795 :         while( pObj )
    1583                 :            :         {
    1584         [ +  - ]:        534 :             SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
    1585 [ +  - ][ +  + ]:        534 :             if( aUsedPresentationObjects.count(pObj) == 0 )
    1586                 :            :             {
    1587                 :            : 
    1588 [ +  - ][ +  - ]:         18 :                 if( pObj->IsEmptyPresObj() )
    1589                 :            :                 {
    1590         [ -  + ]:         18 :                     if( bUndo )
    1591 [ #  # ][ #  # ]:          0 :                         pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
                 [ #  # ]
    1592                 :            : 
    1593 [ +  - ][ +  - ]:         18 :                     RemoveObject( pObj->GetOrdNum() );
    1594                 :            : 
    1595         [ +  - ]:         18 :                     if( !bUndo )
    1596         [ +  - ]:         18 :                         SdrObject::Free( pObj );
    1597                 :            :                 }
    1598                 :            : /* #i108541# keep non empty pres obj as pres obj even if they are not part of the current layout */
    1599                 :            :             }
    1600                 :        534 :             pObj = pNext;
    1601                 :            :         }
    1602         [ +  + ]:        599 :     }
    1603                 :            : }
    1604                 :            : 
    1605                 :            : /*************************************************************************
    1606                 :            : |*
    1607                 :            : |* Objekt einfuegen
    1608                 :            : |*
    1609                 :            : \************************************************************************/
    1610                 :            : 
    1611                 :       2427 : void SdPage::NbcInsertObject(SdrObject* pObj, sal_uLong nPos, const SdrInsertReason* pReason)
    1612                 :            : {
    1613                 :       2427 :     FmFormPage::NbcInsertObject(pObj, nPos, pReason);
    1614                 :            : 
    1615                 :       2427 :     ((SdDrawDocument*) pModel)->InsertObject(pObj, this);
    1616                 :            : 
    1617                 :       2427 :     SdrLayerID nId = pObj->GetLayer();
    1618         [ +  + ]:       2427 :     if( mbMaster )
    1619                 :            :     {
    1620         [ +  + ]:       1327 :         if( nId == 0 )
    1621                 :       1159 :             pObj->NbcSetLayer( 2 );     // wrong layer. corrected to BackgroundObj layer
    1622                 :            :     }
    1623                 :            :     else
    1624                 :            :     {
    1625         [ -  + ]:       1100 :         if( nId == 2 )
    1626                 :          0 :             pObj->NbcSetLayer( 0 );     // wrong layer. corrected to layout layer
    1627                 :            :     }
    1628                 :       2427 : }
    1629                 :            : 
    1630                 :            : /*************************************************************************
    1631                 :            : |*
    1632                 :            : |* Objekt loeschen
    1633                 :            : |*
    1634                 :            : \************************************************************************/
    1635                 :            : 
    1636                 :        508 : SdrObject* SdPage::RemoveObject(sal_uLong nObjNum)
    1637                 :            : {
    1638                 :        508 :     onRemoveObject(GetObj( nObjNum ));
    1639                 :        508 :     return FmFormPage::RemoveObject(nObjNum);
    1640                 :            : }
    1641                 :            : 
    1642                 :            : /*************************************************************************
    1643                 :            : |*
    1644                 :            : |* Objekt loeschen, ohne Broadcast
    1645                 :            : |*
    1646                 :            : \************************************************************************/
    1647                 :            : 
    1648                 :          0 : SdrObject* SdPage::NbcRemoveObject(sal_uLong nObjNum)
    1649                 :            : {
    1650                 :          0 :     onRemoveObject(GetObj( nObjNum ));
    1651                 :          0 :     return FmFormPage::NbcRemoveObject(nObjNum);
    1652                 :            : }
    1653                 :            : 
    1654                 :            : // Also overload ReplaceObject methods to realize when
    1655                 :            : // objects are removed with this mechanism instead of RemoveObject
    1656                 :          0 : SdrObject* SdPage::NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
    1657                 :            : {
    1658                 :          0 :     onRemoveObject(GetObj( nObjNum ));
    1659                 :          0 :     return FmFormPage::NbcReplaceObject(pNewObj, nObjNum);
    1660                 :            : }
    1661                 :            : 
    1662                 :            : // Also overload ReplaceObject methods to realize when
    1663                 :            : // objects are removed with this mechanism instead of RemoveObject
    1664                 :         40 : SdrObject* SdPage::ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
    1665                 :            : {
    1666                 :         40 :     onRemoveObject(GetObj( nObjNum ));
    1667                 :         40 :     return FmFormPage::ReplaceObject(pNewObj, nObjNum);
    1668                 :            : }
    1669                 :            : 
    1670                 :            : // -------------------------------------------------------------------------
    1671                 :            : 
    1672                 :            : // called after a shape is removed or replaced from this slide
    1673                 :            : 
    1674                 :        548 : void SdPage::onRemoveObject( SdrObject* pObject )
    1675                 :            : {
    1676         [ +  - ]:        548 :     if( pObject )
    1677                 :            :     {
    1678                 :        548 :         RemovePresObj(pObject);
    1679                 :            : 
    1680         [ +  - ]:        548 :         if( pModel )
    1681                 :        548 :             static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject, this);
    1682                 :            : 
    1683                 :        548 :         removeAnimations( pObject );
    1684                 :            :     }
    1685                 :        548 : }
    1686                 :            : 
    1687                 :       1193 : void SdPage::SetSize(const Size& aSize)
    1688                 :            : {
    1689         [ +  - ]:       1193 :     Size aOldSize = GetSize();
    1690                 :            : 
    1691         [ +  + ]:       1193 :     if (aSize != aOldSize)
    1692                 :            :     {
    1693         [ +  - ]:       1150 :         FmFormPage::SetSize(aSize);
    1694                 :            : 
    1695 [ +  + ][ +  - ]:       1150 :         if (aOldSize.Height() == 10 && aOldSize.Width() == 10)
                 [ +  + ]
    1696                 :            :         {
    1697                 :            :             // Die Seite bekommt erstmalig eine gueltige Groesse gesetzt,
    1698                 :            :             // daher wird nun die Orientation initialisiert
    1699         [ +  + ]:       1022 :             if (aSize.Width() > aSize.Height())
    1700                 :            :             {
    1701                 :        125 :                 meOrientation = ORIENTATION_LANDSCAPE;
    1702                 :            :             }
    1703                 :            :             else
    1704                 :            :             {
    1705                 :        897 :                 meOrientation = ORIENTATION_PORTRAIT;
    1706                 :            :             }
    1707                 :            :         }
    1708                 :            :     }
    1709                 :       1193 : }
    1710                 :            : 
    1711                 :        993 : void SdPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
    1712                 :            : {
    1713 [ +  + ][ +  -  :       2515 :     if (nLft != GetLftBorder() || nUpp != GetUppBorder() ||
             +  -  -  + ]
                 [ +  + ]
    1714                 :       1522 :         nRgt != GetRgtBorder() || nLwr != GetLwrBorder() )
    1715                 :            :     {
    1716                 :        232 :         FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr);
    1717                 :            :     }
    1718                 :        993 : }
    1719                 :            : 
    1720                 :         40 : void SdPage::SetLftBorder(sal_Int32 nBorder)
    1721                 :            : {
    1722         [ +  - ]:         40 :     if (nBorder != GetLftBorder() )
    1723                 :            :     {
    1724                 :         40 :         FmFormPage::SetLftBorder(nBorder);
    1725                 :            :     }
    1726                 :         40 : }
    1727                 :            : 
    1728                 :         40 : void SdPage::SetRgtBorder(sal_Int32 nBorder)
    1729                 :            : {
    1730         [ +  - ]:         40 :     if (nBorder != GetRgtBorder() )
    1731                 :            :     {
    1732                 :         40 :         FmFormPage::SetRgtBorder(nBorder);
    1733                 :            :     }
    1734                 :         40 : }
    1735                 :            : 
    1736                 :         40 : void SdPage::SetUppBorder(sal_Int32 nBorder)
    1737                 :            : {
    1738         [ +  - ]:         40 :     if (nBorder != GetUppBorder() )
    1739                 :            :     {
    1740                 :         40 :         FmFormPage::SetUppBorder(nBorder);
    1741                 :            :     }
    1742                 :         40 : }
    1743                 :            : 
    1744                 :         40 : void SdPage::SetLwrBorder(sal_Int32 nBorder)
    1745                 :            : {
    1746         [ +  - ]:         40 :     if (nBorder != GetLwrBorder() )
    1747                 :            :     {
    1748                 :         40 :         FmFormPage::SetLwrBorder(nBorder);
    1749                 :            :     }
    1750                 :         40 : }
    1751                 :            : 
    1752                 :            : /*************************************************************************
    1753                 :            : |*
    1754                 :            : |* Setzt BackgroundFullSize und ruft dann AdjustBackground auf
    1755                 :            : |*
    1756                 :            : \************************************************************************/
    1757                 :            : 
    1758                 :         15 : void SdPage::SetBackgroundFullSize( sal_Bool bIn )
    1759                 :            : {
    1760         [ +  + ]:         15 :     if( bIn != mbBackgroundFullSize )
    1761                 :            :     {
    1762                 :          4 :         mbBackgroundFullSize = bIn;
    1763                 :            :     }
    1764                 :         15 : }
    1765                 :            : 
    1766                 :            : /*************************************************************************
    1767                 :            : |*
    1768                 :            : |* Alle Objekte an neue Seitengroesse anpassen
    1769                 :            : |*
    1770                 :            : |* bScaleAllObj: Alle Objekte werden in die neue Flaeche innerhalb der
    1771                 :            : |* Seitenraender skaliert. Dabei werden die Position, Groesse und bei
    1772                 :            : |* Praesentationsobjekten auf der MasterPage auch die Schrifthoehe der
    1773                 :            : |* Praesentationsvorlagen skaliert.
    1774                 :            : |*
    1775                 :            : \************************************************************************/
    1776                 :            : 
    1777                 :          0 : void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect, sal_Bool bScaleAllObj)
    1778                 :            : {
    1779                 :          0 :     sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
    1780                 :            : 
    1781                 :          0 :     mbScaleObjects = bScaleAllObj;
    1782                 :          0 :     SdrObject* pObj = NULL;
    1783                 :          0 :     Point aRefPnt(0, 0);
    1784                 :          0 :     Size aNewPageSize(rNewPageSize);
    1785                 :          0 :     sal_Int32 nLeft  = rNewBorderRect.Left();
    1786                 :          0 :     sal_Int32 nRight = rNewBorderRect.Right();
    1787                 :          0 :     sal_Int32 nUpper = rNewBorderRect.Top();
    1788                 :          0 :     sal_Int32 nLower = rNewBorderRect.Bottom();
    1789                 :            : 
    1790                 :            :     // Negative Werte stehen fuer nicht zu aendernde Werte
    1791                 :            :     // -> aktuelle Werte verwenden
    1792         [ #  # ]:          0 :     if (aNewPageSize.Width() < 0)
    1793                 :            :     {
    1794         [ #  # ]:          0 :         aNewPageSize.Width() = GetWdt();
    1795                 :            :     }
    1796         [ #  # ]:          0 :     if (aNewPageSize.Height() < 0)
    1797                 :            :     {
    1798         [ #  # ]:          0 :         aNewPageSize.Height() = GetHgt();
    1799                 :            :     }
    1800         [ #  # ]:          0 :     if (nLeft < 0)
    1801                 :            :     {
    1802         [ #  # ]:          0 :         nLeft = GetLftBorder();
    1803                 :            :     }
    1804         [ #  # ]:          0 :     if (nRight < 0)
    1805                 :            :     {
    1806         [ #  # ]:          0 :         nRight = GetRgtBorder();
    1807                 :            :     }
    1808         [ #  # ]:          0 :     if (nUpper < 0)
    1809                 :            :     {
    1810         [ #  # ]:          0 :         nUpper = GetUppBorder();
    1811                 :            :     }
    1812         [ #  # ]:          0 :     if (nLower < 0)
    1813                 :            :     {
    1814         [ #  # ]:          0 :         nLower = GetLwrBorder();
    1815                 :            :     }
    1816                 :            : 
    1817                 :          0 :     Point aBackgroundPos(nLeft, nUpper);
    1818                 :          0 :     Size aBackgroundSize(aNewPageSize);
    1819         [ #  # ]:          0 :     Rectangle aBorderRect (aBackgroundPos, aBackgroundSize);
    1820                 :            : 
    1821         [ #  # ]:          0 :     if (mbScaleObjects)
    1822                 :            :     {
    1823                 :          0 :         aBackgroundSize.Width()  -= nLeft  + nRight;
    1824                 :          0 :         aBackgroundSize.Height() -= nUpper + nLower;
    1825         [ #  # ]:          0 :         aBorderRect.SetSize(aBackgroundSize);
    1826                 :          0 :         aNewPageSize = aBackgroundSize;
    1827                 :            :     }
    1828                 :            : 
    1829 [ #  # ][ #  # ]:          0 :     long nOldWidth  = GetWdt() - GetLftBorder() - GetRgtBorder();
                 [ #  # ]
    1830 [ #  # ][ #  # ]:          0 :     long nOldHeight = GetHgt() - GetUppBorder() - GetLwrBorder();
                 [ #  # ]
    1831                 :            : 
    1832         [ #  # ]:          0 :     Fraction aFractX = Fraction(aNewPageSize.Width(), nOldWidth);
    1833         [ #  # ]:          0 :     Fraction aFractY = Fraction(aNewPageSize.Height(), nOldHeight);
    1834                 :            : 
    1835 [ #  # ][ #  # ]:          0 :     sal_uLong nObjCnt = (mbScaleObjects ? GetObjCount() : 0);
    1836                 :            : 
    1837         [ #  # ]:          0 :     for (sal_uLong nObj = 0; nObj < nObjCnt; nObj++)
    1838                 :            :     {
    1839                 :          0 :         sal_Bool bIsPresObjOnMaster = sal_False;
    1840                 :            : 
    1841                 :            :         // Alle Objekte
    1842         [ #  # ]:          0 :         pObj = GetObj(nObj);
    1843                 :            : 
    1844 [ #  # ][ #  # ]:          0 :         if (mbMaster && IsPresObj(pObj))
         [ #  # ][ #  # ]
    1845                 :            :         {
    1846                 :            :             // Es ist ein Praesentationsobjekt auf der MasterPage
    1847                 :          0 :             bIsPresObjOnMaster = sal_True;
    1848                 :            :         }
    1849                 :            : 
    1850         [ #  # ]:          0 :         if (pObj)
    1851                 :            :         {
    1852                 :            :             // remember aTopLeft as original TopLeft
    1853         [ #  # ]:          0 :             Point aTopLeft(pObj->GetCurrentBoundRect().TopLeft());
    1854                 :            : 
    1855 [ #  # ][ #  # ]:          0 :             if (!pObj->IsEdgeObj())
    1856                 :            :             {
    1857                 :            :                 /**************************************************************
    1858                 :            :                 * Objekt skalieren
    1859                 :            :                 **************************************************************/
    1860         [ #  # ]:          0 :                 if (mbScaleObjects)
    1861                 :            :                 {
    1862                 :            :                     // use aTopLeft as original TopLeft
    1863                 :          0 :                     aRefPnt = aTopLeft;
    1864                 :            :                 }
    1865                 :            : 
    1866         [ #  # ]:          0 :                 pObj->Resize(aRefPnt, aFractX, aFractY);
    1867                 :            : 
    1868         [ #  # ]:          0 :                 if (mbScaleObjects)
    1869                 :            :                 {
    1870         [ #  # ]:          0 :                     SdrObjKind eObjKind = (SdrObjKind) pObj->GetObjIdentifier();
    1871                 :            : 
    1872         [ #  # ]:          0 :                     if (bIsPresObjOnMaster)
    1873                 :            :                     {
    1874                 :            :                         /**********************************************************
    1875                 :            :                         * Praesentationsvorlage: Texthoehe anpassen
    1876                 :            :                         **********************************************************/
    1877                 :          0 :                         sal_uInt16 nIndexTitle = 0;
    1878                 :          0 :                         sal_uInt16 nIndexOutline = 0;
    1879                 :          0 :                         sal_uInt16 nIndexNotes = 0;
    1880                 :            : 
    1881 [ #  # ][ #  # ]:          0 :                         if (pObj == GetPresObj(PRESOBJ_TITLE, nIndexTitle))
    1882                 :            :                         {
    1883         [ #  # ]:          0 :                             SfxStyleSheet* pTitleSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
    1884                 :            : 
    1885         [ #  # ]:          0 :                             if (pTitleSheet)
    1886                 :            :                             {
    1887         [ #  # ]:          0 :                                 SfxItemSet& rSet = pTitleSheet->GetItemSet();
    1888                 :            : 
    1889         [ #  # ]:          0 :                                 SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT);
    1890                 :          0 :                                 sal_uLong nFontHeight = rOldHgt.GetHeight();
    1891         [ #  # ]:          0 :                                 nFontHeight = long(nFontHeight * (double) aFractY);
    1892 [ #  # ][ #  # ]:          0 :                                 rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
                 [ #  # ]
    1893                 :            : 
    1894 [ #  # ][ #  # ]:          0 :                                 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
    1895                 :            :                                 {
    1896 [ #  # ][ #  # ]:          0 :                                     rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CJK);
    1897                 :          0 :                                     nFontHeight = rOldHgt.GetHeight();
    1898         [ #  # ]:          0 :                                     nFontHeight = long(nFontHeight * (double) aFractY);
    1899 [ #  # ][ #  # ]:          0 :                                     rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
                 [ #  # ]
    1900                 :            :                                 }
    1901                 :            : 
    1902 [ #  # ][ #  # ]:          0 :                                 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
    1903                 :            :                                 {
    1904 [ #  # ][ #  # ]:          0 :                                     rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CTL);
    1905                 :          0 :                                     nFontHeight = rOldHgt.GetHeight();
    1906         [ #  # ]:          0 :                                     nFontHeight = long(nFontHeight * (double) aFractY);
    1907 [ #  # ][ #  # ]:          0 :                                     rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
                 [ #  # ]
    1908                 :            :                                 }
    1909                 :            : 
    1910 [ #  # ][ #  # ]:          0 :                                 pTitleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
                 [ #  # ]
    1911                 :            :                             }
    1912                 :            :                         }
    1913 [ #  # ][ #  # ]:          0 :                         else if (pObj == GetPresObj(PRESOBJ_OUTLINE, nIndexOutline))
    1914                 :            :                         {
    1915         [ #  # ]:          0 :                             String aName(GetLayoutName());
    1916         [ #  # ]:          0 :                             aName += sal_Unicode( ' ' );
    1917                 :            : 
    1918         [ #  # ]:          0 :                             for (sal_uInt16 i=1; i<=9; i++)
    1919                 :            :                             {
    1920         [ #  # ]:          0 :                                 String sLayoutName(aName);
    1921 [ #  # ][ #  # ]:          0 :                                 sLayoutName += String::CreateFromInt32( (sal_Int32)i );
                 [ #  # ]
    1922 [ #  # ][ #  # ]:          0 :                                 SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)((SdDrawDocument*) pModel)->GetStyleSheetPool()->Find(sLayoutName, SD_STYLE_FAMILY_MASTERPAGE);
    1923                 :            : 
    1924         [ #  # ]:          0 :                                 if (pOutlineSheet)
    1925                 :            :                                 {
    1926                 :            :                                     // Neue Fonthoehe berechnen
    1927 [ #  # ][ #  # ]:          0 :                                     SfxItemSet aTempSet(pOutlineSheet->GetItemSet());
    1928                 :            : 
    1929         [ #  # ]:          0 :                                     SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT);
    1930                 :          0 :                                     sal_uLong nFontHeight = rOldHgt.GetHeight();
    1931         [ #  # ]:          0 :                                     nFontHeight = long(nFontHeight * (double) aFractY);
    1932 [ #  # ][ #  # ]:          0 :                                     aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
                 [ #  # ]
    1933                 :            : 
    1934 [ #  # ][ #  # ]:          0 :                                     if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
    1935                 :            :                                     {
    1936 [ #  # ][ #  # ]:          0 :                                         rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK);
    1937                 :          0 :                                         nFontHeight = rOldHgt.GetHeight();
    1938         [ #  # ]:          0 :                                         nFontHeight = long(nFontHeight * (double) aFractY);
    1939 [ #  # ][ #  # ]:          0 :                                         aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
                 [ #  # ]
    1940                 :            :                                     }
    1941                 :            : 
    1942 [ #  # ][ #  # ]:          0 :                                     if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
    1943                 :            :                                     {
    1944 [ #  # ][ #  # ]:          0 :                                         rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL);
    1945                 :          0 :                                         nFontHeight = rOldHgt.GetHeight();
    1946         [ #  # ]:          0 :                                         nFontHeight = long(nFontHeight * (double) aFractY);
    1947 [ #  # ][ #  # ]:          0 :                                         aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
                 [ #  # ]
    1948                 :            :                                     }
    1949                 :            : 
    1950                 :            :                                     // Bullet anpassen
    1951         [ #  # ]:          0 :                                     ((SdStyleSheet*) pOutlineSheet)->AdjustToFontHeight(aTempSet, sal_False);
    1952                 :            : 
    1953                 :            :                                     // Sonderbehandlung: die INVALIDS auf NULL-Pointer
    1954                 :            :                                     // zurueckgesetzen (sonst landen INVALIDs oder
    1955                 :            :                                     // Pointer auf die DefaultItems in der Vorlage;
    1956                 :            :                                     // beides wuerde die Attribut-Vererbung unterbinden)
    1957         [ #  # ]:          0 :                                     aTempSet.ClearInvalidItems();
    1958                 :            : 
    1959                 :            :                                     // Sonderbehandlung: nur die gueltigen Anteile des
    1960                 :            :                                     // BulletItems
    1961 [ #  # ][ #  # ]:          0 :                                     if (aTempSet.GetItemState(EE_PARA_BULLET) == SFX_ITEM_AVAILABLE)
    1962                 :            :                                     {
    1963 [ #  # ][ #  # ]:          0 :                                         SvxBulletItem aOldBulItem((SvxBulletItem&) pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET));
                 [ #  # ]
    1964         [ #  # ]:          0 :                                         SvxBulletItem& rNewBulItem = (SvxBulletItem&) aTempSet.Get(EE_PARA_BULLET);
    1965         [ #  # ]:          0 :                                         aOldBulItem.CopyValidProperties(rNewBulItem);
    1966 [ #  # ][ #  # ]:          0 :                                         aTempSet.Put(aOldBulItem);
    1967                 :            :                                     }
    1968                 :            : 
    1969 [ #  # ][ #  # ]:          0 :                                     pOutlineSheet->GetItemSet().Put(aTempSet);
    1970 [ #  # ][ #  # ]:          0 :                                     pOutlineSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ #  # ][ #  # ]
    1971                 :            :                                 }
    1972 [ #  # ][ #  # ]:          0 :                             }
    1973                 :            :                         }
    1974 [ #  # ][ #  # ]:          0 :                         else if (pObj == GetPresObj(PRESOBJ_NOTES, nIndexNotes))
    1975                 :            :                         {
    1976         [ #  # ]:          0 :                             SfxStyleSheet* pNotesSheet = GetStyleSheetForPresObj(PRESOBJ_NOTES);
    1977                 :            : 
    1978         [ #  # ]:          0 :                             if (pNotesSheet)
    1979                 :            :                             {
    1980 [ #  # ][ #  # ]:          0 :                                 sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height();
    1981                 :          0 :                                 sal_uLong nFontHeight = (sal_uLong) (nHeight * 0.0741);
    1982         [ #  # ]:          0 :                                 SfxItemSet& rSet = pNotesSheet->GetItemSet();
    1983 [ #  # ][ #  # ]:          0 :                                 rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT ));
                 [ #  # ]
    1984 [ #  # ][ #  # ]:          0 :                                 rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK ));
                 [ #  # ]
    1985 [ #  # ][ #  # ]:          0 :                                 rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL ));
                 [ #  # ]
    1986 [ #  # ][ #  # ]:          0 :                                 pNotesSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
                 [ #  # ]
    1987                 :            :                             }
    1988                 :            :                         }
    1989                 :            :                     }
    1990 [ #  # ][ #  # ]:          0 :                     else if ( eObjKind != OBJ_TITLETEXT   &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1991                 :            :                               eObjKind != OBJ_OUTLINETEXT &&
    1992 [ #  # ][ #  # ]:          0 :                               pObj->ISA(SdrTextObj)       &&
    1993         [ #  # ]:          0 :                               pObj->GetOutlinerParaObject() )
    1994                 :            :                     {
    1995                 :            :                         /******************************************************
    1996                 :            :                         * Normales Textobjekt: Texthoehe anpassen
    1997                 :            :                         ******************************************************/
    1998 [ #  # ][ #  # ]:          0 :                         sal_uLong nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
                 [ #  # ]
    1999                 :          0 :                         sal_uInt16 nWhich = EE_CHAR_FONTHEIGHT;
    2000         [ #  # ]:          0 :                         if ( nScriptType == SCRIPTTYPE_ASIAN )
    2001                 :          0 :                             nWhich = EE_CHAR_FONTHEIGHT_CJK;
    2002         [ #  # ]:          0 :                         else if ( nScriptType == SCRIPTTYPE_COMPLEX )
    2003                 :          0 :                             nWhich = EE_CHAR_FONTHEIGHT_CTL;
    2004                 :            : 
    2005                 :            :                         // use more modern method to scale the text height
    2006         [ #  # ]:          0 :                         sal_uInt32 nFontHeight = ((SvxFontHeightItem&)pObj->GetMergedItem(nWhich)).GetHeight();
    2007         [ #  # ]:          0 :                         sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY);
    2008                 :            : 
    2009 [ #  # ][ #  # ]:          0 :                         pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich));
                 [ #  # ]
    2010                 :            :                     }
    2011                 :            :                 }
    2012                 :            :             }
    2013                 :            : 
    2014 [ #  # ][ #  # ]:          0 :             if (mbScaleObjects && !pObj->IsEdgeObj())
         [ #  # ][ #  # ]
    2015                 :            :             {
    2016                 :            :                 /**************************************************************
    2017                 :            :                 * Objektposition skalieren
    2018                 :            :                 **************************************************************/
    2019                 :          0 :                 Point aNewPos;
    2020                 :            : 
    2021                 :            :                 // corrected scaling; only distances may be scaled
    2022                 :            :                 // use aTopLeft as original TopLeft
    2023 [ #  # ][ #  # ]:          0 :                 aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * (double)aFractX) + nLeft;
    2024 [ #  # ][ #  # ]:          0 :                 aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * (double)aFractY) + nUpper;
    2025                 :            : 
    2026                 :          0 :                 Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y());
    2027                 :            : 
    2028 [ #  # ][ #  # ]:          0 :                 if (aVec.Height() != 0 || aVec.Width() != 0)
                 [ #  # ]
    2029                 :            :                 {
    2030         [ #  # ]:          0 :                     pObj->NbcMove(aVec);
    2031                 :            :                 }
    2032                 :            : 
    2033         [ #  # ]:          0 :                 pObj->SetChanged();
    2034         [ #  # ]:          0 :                 pObj->BroadcastObjectChange();
    2035                 :            :             }
    2036                 :            :         }
    2037                 :          0 :     }
    2038                 :          0 : }
    2039                 :            : 
    2040                 :         14 : SdrObject* convertPresentationObjectImpl( SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, Rectangle aRect )
    2041                 :            : {
    2042                 :         14 :     SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
    2043                 :            :     DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
    2044 [ -  + ][ +  - ]:         14 :     if( !pModel || !pSourceObj )
    2045                 :          0 :         return pSourceObj;
    2046                 :            : 
    2047         [ +  - ]:         14 :     ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
    2048 [ +  - ][ -  + ]:         14 :     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted();
                 [ #  # ]
    2049                 :            : 
    2050                 :         14 :     SdrObject* pNewObj = pSourceObj;
    2051 [ -  + ][ #  # ]:         14 :     if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() == OBJ_TEXT) )
                 [ -  + ]
    2052                 :            :     {
    2053                 :          0 :         pNewObj = rPage.CreatePresObj(PRESOBJ_OUTLINE, bVertical, aRect);
    2054                 :            : 
    2055                 :            :         // Text des Untertitels in das PRESOBJ_OUTLINE setzen
    2056                 :          0 :         OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
    2057                 :            : 
    2058         [ #  # ]:          0 :         if(pOutlParaObj)
    2059                 :            :         {
    2060                 :            :             // Text umsetzen
    2061         [ #  # ]:          0 :             ::sd::Outliner* pOutl = pModel->GetInternalOutliner( sal_True );
    2062         [ #  # ]:          0 :             pOutl->Clear();
    2063         [ #  # ]:          0 :             pOutl->SetText( *pOutlParaObj );
    2064         [ #  # ]:          0 :             pOutlParaObj = pOutl->CreateParaObject();
    2065         [ #  # ]:          0 :             pNewObj->SetOutlinerParaObject( pOutlParaObj );
    2066         [ #  # ]:          0 :             pOutl->Clear();
    2067         [ #  # ]:          0 :             pNewObj->SetEmptyPresObj(sal_False);
    2068                 :            : 
    2069         [ #  # ]:          0 :             for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
    2070                 :            :             {
    2071                 :            :                 // Neue Vorlage zuweisen
    2072         [ #  # ]:          0 :                 String aName(rPage.GetLayoutName());
    2073         [ #  # ]:          0 :                 aName += sal_Unicode( ' ' );
    2074 [ #  # ][ #  # ]:          0 :                 aName += String::CreateFromInt32( nLevel );
                 [ #  # ]
    2075 [ #  # ][ #  # ]:          0 :                 SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
    2076                 :            : 
    2077         [ #  # ]:          0 :                 if (pSheet)
    2078                 :            :                 {
    2079         [ #  # ]:          0 :                     if (nLevel == 1)
    2080                 :            :                     {
    2081         [ #  # ]:          0 :                         SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
    2082                 :            : 
    2083         [ #  # ]:          0 :                         if (pSubtitleSheet)
    2084 [ #  # ][ #  # ]:          0 :                             pOutlParaObj->ChangeStyleSheetName(SD_STYLE_FAMILY_MASTERPAGE, pSubtitleSheet->GetName(), pSheet->GetName());
                 [ #  # ]
    2085                 :            :                     }
    2086                 :            : 
    2087         [ #  # ]:          0 :                     pNewObj->StartListening(*pSheet);
    2088                 :            :                 }
    2089         [ #  # ]:          0 :             }
    2090                 :            : 
    2091                 :            :             // LRSpace-Item loeschen
    2092         [ #  # ]:          0 :             SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
    2093                 :            : 
    2094 [ #  # ][ #  # ]:          0 :             aSet.Put(pNewObj->GetMergedItemSet());
    2095                 :            : 
    2096         [ #  # ]:          0 :             aSet.ClearItem(EE_PARA_LRSPACE);
    2097                 :            : 
    2098         [ #  # ]:          0 :             pNewObj->SetMergedItemSet(aSet);
    2099                 :            : 
    2100         [ #  # ]:          0 :             if( bUndo )
    2101 [ #  # ][ #  # ]:          0 :                 pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
                 [ #  # ]
    2102                 :            : 
    2103                 :            :             // Remove outline shape from page
    2104 [ #  # ][ #  # ]:          0 :             rPage.RemoveObject( pSourceObj->GetOrdNum() );
    2105                 :            : 
    2106         [ #  # ]:          0 :             if( !bUndo )
    2107 [ #  # ][ #  # ]:          0 :                 SdrObject::Free( pSourceObj );
    2108                 :            :         }
    2109                 :            :     }
    2110 [ +  + ][ -  + ]:         14 :     else if((eObjKind == PRESOBJ_TEXT) && (pSourceObj->GetObjIdentifier() == OBJ_OUTLINETEXT) )
                 [ -  + ]
    2111                 :            :     {
    2112                 :            :         // is there an outline shape we can use to replace empty subtitle shape?
    2113                 :          0 :         pNewObj = rPage.CreatePresObj(PRESOBJ_TEXT, bVertical, aRect);
    2114                 :            : 
    2115                 :            :         // Text des Gliederungsobjekts in das PRESOBJ_TITLE setzen
    2116                 :          0 :         OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
    2117                 :            : 
    2118         [ #  # ]:          0 :         if(pOutlParaObj)
    2119                 :            :         {
    2120                 :            :             // Text umsetzen
    2121         [ #  # ]:          0 :             ::sd::Outliner* pOutl = pModel->GetInternalOutliner();
    2122         [ #  # ]:          0 :             pOutl->Clear();
    2123         [ #  # ]:          0 :             pOutl->SetText( *pOutlParaObj );
    2124         [ #  # ]:          0 :             pOutlParaObj = pOutl->CreateParaObject();
    2125         [ #  # ]:          0 :             pNewObj->SetOutlinerParaObject( pOutlParaObj );
    2126         [ #  # ]:          0 :             pOutl->Clear();
    2127         [ #  # ]:          0 :             pNewObj->SetEmptyPresObj(sal_False);
    2128                 :            : 
    2129                 :            :             // Linken Einzug zuruecksetzen
    2130         [ #  # ]:          0 :             SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
    2131                 :            : 
    2132 [ #  # ][ #  # ]:          0 :             aSet.Put(pNewObj->GetMergedItemSet());
    2133                 :            : 
    2134         [ #  # ]:          0 :             const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE);
    2135         [ #  # ]:          0 :             SvxLRSpaceItem aNewLRItem(rLRItem);
    2136         [ #  # ]:          0 :             aNewLRItem.SetTxtLeft(0);
    2137         [ #  # ]:          0 :             aSet.Put(aNewLRItem);
    2138                 :            : 
    2139         [ #  # ]:          0 :             pNewObj->SetMergedItemSet(aSet);
    2140                 :            : 
    2141         [ #  # ]:          0 :             SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
    2142         [ #  # ]:          0 :             if (pSheet)
    2143         [ #  # ]:          0 :                 pNewObj->SetStyleSheet(pSheet, sal_True);
    2144                 :            : 
    2145                 :            :             // Remove subtitle shape from page
    2146         [ #  # ]:          0 :             if( bUndo )
    2147 [ #  # ][ #  # ]:          0 :                 pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
                 [ #  # ]
    2148                 :            : 
    2149 [ #  # ][ #  # ]:          0 :             rPage.RemoveObject( pSourceObj->GetOrdNum() );
    2150                 :            : 
    2151         [ #  # ]:          0 :             if( !bUndo )
    2152 [ #  # ][ #  # ]:          0 :                 SdrObject::Free( pSourceObj );
                 [ #  # ]
    2153                 :            :         }
    2154                 :            :     }
    2155 [ -  + ][ #  # ]:         14 :     else if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() != OBJ_OUTLINETEXT) )
                 [ -  + ]
    2156                 :            :     {
    2157   [ #  #  #  #  :          0 :         switch( pSourceObj->GetObjIdentifier() )
                      # ]
    2158                 :            :         {
    2159                 :          0 :         case OBJ_TABLE: eObjKind = PRESOBJ_TABLE; break;
    2160                 :          0 :         case OBJ_MEDIA: eObjKind = PRESOBJ_MEDIA; break;
    2161                 :          0 :         case OBJ_GRAF: eObjKind = PRESOBJ_GRAPHIC; break;
    2162                 :          0 :         case OBJ_OLE2: eObjKind = PRESOBJ_OBJECT; break;
    2163                 :            :         }
    2164                 :            :     }
    2165                 :            : 
    2166                 :         14 :     return pNewObj;
    2167                 :            : }
    2168                 :            : 
    2169                 :            : /** reuses or creates a presentation shape for an auto layout that fits the given parameter
    2170                 :            : 
    2171                 :            :     @param  eObjKind
    2172                 :            :         The kind of presentation shape we like to have
    2173                 :            :     @param  nIndex
    2174                 :            :         If > 1 we skip the first nIndex-1 shapes with the presentation shape kind eObjKind while
    2175                 :            :         looking for an existing presentation shape
    2176                 :            :     @param  bVertical
    2177                 :            :         If true, the shape is created vertical if bInit is true
    2178                 :            :     @param  aRect
    2179                 :            :         The rectangle that should be used to transform the shape
    2180                 :            :     @param  bInit
    2181                 :            :         If true the shape is created if not found
    2182                 :            :     @returns
    2183                 :            :         A presentation shape that was either found or created with the given parameters
    2184                 :            : */
    2185                 :        558 : SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit )
    2186                 :            : {
    2187         [ +  - ]:        558 :     ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
    2188 [ +  - ][ -  + ]:        558 :     const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
                 [ #  # ]
    2189                 :            : 
    2190 [ +  + ][ +  + ]:        558 :     if (!pObj && bInit)
    2191                 :            :     {
    2192                 :        502 :         pObj = CreatePresObj(eObjKind, bVertical, aRect);
    2193                 :            :     }
    2194 [ +  + ][ +  + ]:         56 :     else if ( pObj && (pObj->GetUserCall() || bInit) )
         [ -  + ][ +  + ]
    2195                 :            :     {
    2196                 :            :         // convert object if shape type does not match kind (f.e. converting outline text to subtitle text)
    2197         [ +  - ]:         14 :         if( bInit )
    2198                 :         14 :             pObj = convertPresentationObjectImpl( *this, pObj, eObjKind, bVertical, aRect );
    2199                 :            : 
    2200         [ -  + ]:         14 :         if( bUndo )
    2201                 :            :         {
    2202                 :          0 :             pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
    2203                 :          0 :             pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, sal_True, sal_True ) );
    2204         [ #  # ]:          0 :             pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
    2205                 :            :         }
    2206                 :            : 
    2207                 :         14 :             ( /*(SdrGrafObj*)*/ pObj)->AdjustToMaxRect( aRect );
    2208                 :            : 
    2209                 :         14 :         pObj->SetUserCall(this);
    2210                 :            : 
    2211         [ -  + ]:         14 :         SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >(pObj);
    2212         [ +  - ]:         14 :         if( pTextObject )
    2213                 :            :         {
    2214 [ -  + ][ -  + ]:         14 :             if( pTextObject->IsVerticalWriting() != (bVertical ? sal_True : sal_False) )
    2215                 :            :             {
    2216                 :          0 :                 pTextObject->SetVerticalWriting( bVertical );
    2217                 :            : 
    2218                 :            :                 // here make sure the correct anchoring is used when the object
    2219                 :            :                 // is re-used but orientation is changed
    2220         [ #  # ]:          0 :                 if(PRESOBJ_OUTLINE == eObjKind)
    2221 [ #  # ][ #  # ]:          0 :                     pTextObject->SetMergedItem(SdrTextHorzAdjustItem( bVertical ? SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_BLOCK ));
    2222                 :            :             }
    2223                 :            : 
    2224 [ +  - ][ +  - ]:         14 :             if( !mbMaster && (pTextObject->GetObjIdentifier() != OBJ_TABLE) )
                 [ +  - ]
    2225                 :            :             {
    2226         [ +  - ]:         14 :                 if ( pTextObject->IsAutoGrowHeight() )
    2227                 :            :                 {
    2228                 :            :                     // switch off AutoGrowHeight, set new MinHeight
    2229         [ +  - ]:         14 :                     SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
    2230 [ +  - ][ +  - ]:         14 :                     SdrTextMinFrameHeightItem aMinHeight( aRect.GetSize().Height() );
    2231         [ +  - ]:         14 :                     aTempAttr.Put( aMinHeight );
    2232 [ +  - ][ +  - ]:         14 :                     aTempAttr.Put( SdrTextAutoGrowHeightItem(sal_False) );
                 [ +  - ]
    2233         [ +  - ]:         14 :                     pTextObject->SetMergedItemSet(aTempAttr);
    2234         [ +  - ]:         14 :                     pTextObject->SetLogicRect(aRect);
    2235                 :            : 
    2236                 :            :                     // switch on AutoGrowHeight
    2237         [ +  - ]:         14 :                     SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
    2238 [ +  - ][ +  - ]:         14 :                     aAttr.Put( SdrTextAutoGrowHeightItem(sal_True) );
                 [ +  - ]
    2239                 :            : 
    2240 [ +  - ][ +  - ]:         14 :                     pTextObject->SetMergedItemSet(aAttr);
         [ +  - ][ +  - ]
    2241                 :            :                 }
    2242                 :            : 
    2243         [ -  + ]:         14 :                 if ( pTextObject->IsAutoGrowWidth() )
    2244                 :            :                 {
    2245                 :            :                     // switch off AutoGrowWidth , set new MinWidth
    2246         [ #  # ]:          0 :                     SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
    2247 [ #  # ][ #  # ]:          0 :                     SdrTextMinFrameWidthItem aMinWidth( aRect.GetSize().Width() );
    2248         [ #  # ]:          0 :                     aTempAttr.Put( aMinWidth );
    2249 [ #  # ][ #  # ]:          0 :                     aTempAttr.Put( SdrTextAutoGrowWidthItem(sal_False) );
                 [ #  # ]
    2250         [ #  # ]:          0 :                     pTextObject->SetMergedItemSet(aTempAttr);
    2251         [ #  # ]:          0 :                     pTextObject->SetLogicRect(aRect);
    2252                 :            : 
    2253                 :            :                     // switch on AutoGrowWidth
    2254         [ #  # ]:          0 :                     SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
    2255 [ #  # ][ #  # ]:          0 :                     aAttr.Put( SdrTextAutoGrowWidthItem(sal_True) );
                 [ #  # ]
    2256 [ #  # ][ #  # ]:          0 :                     pTextObject->SetMergedItemSet(aAttr);
         [ #  # ][ #  # ]
    2257                 :            :                 }
    2258                 :            :             }
    2259                 :            :         }
    2260                 :            :     }
    2261                 :            : 
    2262 [ +  + ][ +  + ]:        558 :     if(pObj && bInit )
    2263                 :            :     {
    2264         [ -  + ]:        516 :         if( !IsPresObj( pObj ) )
    2265                 :            :         {
    2266         [ #  # ]:          0 :             if( bUndo )
    2267         [ #  # ]:          0 :                 pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
    2268                 :            : 
    2269                 :          0 :             InsertPresObj( pObj, eObjKind );
    2270                 :            :         }
    2271                 :            : 
    2272                 :            :         // make adjustments for vertical title and outline shapes
    2273 [ -  + ][ #  # ]:        516 :         if( bVertical && (( eObjKind == PRESOBJ_TITLE) || (eObjKind == PRESOBJ_OUTLINE)))
                 [ #  # ]
    2274                 :            :         {
    2275 [ #  # ][ #  # ]:          0 :             SfxItemSet aNewSet(pObj->GetMergedItemSet());
    2276 [ #  # ][ #  # ]:          0 :             aNewSet.Put( SdrTextAutoGrowWidthItem(sal_True) );
                 [ #  # ]
    2277 [ #  # ][ #  # ]:          0 :             aNewSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
                 [ #  # ]
    2278         [ #  # ]:          0 :             if( eObjKind == PRESOBJ_OUTLINE )
    2279                 :            :             {
    2280 [ #  # ][ #  # ]:          0 :                 aNewSet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
                 [ #  # ]
    2281 [ #  # ][ #  # ]:          0 :                 aNewSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
                 [ #  # ]
    2282                 :            :             }
    2283 [ #  # ][ #  # ]:          0 :             pObj->SetMergedItemSet(aNewSet);
    2284                 :            :         }
    2285                 :            :     }
    2286                 :            : 
    2287 [ +  + ][ +  + ]:        558 :     if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
         [ -  + ][ -  + ]
         [ #  # ][ +  + ]
    2288                 :        516 :         pObj->AdjustToMaxRect( aRect );
    2289                 :            : 
    2290                 :        558 :     return pObj;
    2291                 :            : }
    2292                 :            : 
    2293                 :            : 
    2294                 :            : /*************************************************************************
    2295                 :            : |*
    2296                 :            : |* Liefert den PresObjKind eines Objektes zurueck
    2297                 :            : |*
    2298                 :            : \************************************************************************/
    2299                 :            : 
    2300                 :       8098 : PresObjKind SdPage::GetPresObjKind(SdrObject* pObj) const
    2301                 :            : {
    2302                 :       8098 :     PresObjKind eKind = PRESOBJ_NONE;
    2303 [ +  - ][ +  + ]:       8098 :     if( (pObj != 0) && (maPresentationShapeList.hasShape(*pObj)) )
                 [ +  + ]
    2304                 :            :     {
    2305                 :       2296 :         SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
    2306         [ +  - ]:       2296 :         if( pInfo )
    2307                 :       2296 :             eKind = pInfo->mePresObjKind;
    2308                 :            :     }
    2309                 :            : 
    2310                 :       8098 :     return eKind;
    2311                 :            : }
    2312                 :            : 
    2313                 :        850 : bool SdPage::IsPresObj(const SdrObject* pObj)
    2314                 :            : {
    2315 [ +  - ][ +  + ]:        850 :     return pObj && maPresentationShapeList.hasShape( const_cast<SdrObject&>(*pObj) );
    2316                 :            : }
    2317                 :            : 
    2318                 :        902 : void SdPage::RemovePresObj(const SdrObject* pObj)
    2319                 :            : {
    2320 [ +  - ][ +  + ]:        902 :     if( pObj && maPresentationShapeList.hasShape(const_cast<SdrObject&>(*pObj)) )
                 [ +  + ]
    2321                 :            :     {
    2322                 :        386 :         SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(const_cast<SdrObject&>(*pObj));
    2323         [ +  - ]:        386 :         if( pInfo )
    2324                 :        386 :             pInfo->mePresObjKind = PRESOBJ_NONE;
    2325                 :        386 :         maPresentationShapeList.removeShape(const_cast<SdrObject&>(*pObj));
    2326                 :            :     }
    2327                 :        902 : }
    2328                 :            : 
    2329                 :       1840 : void SdPage::InsertPresObj(SdrObject* pObj, PresObjKind eKind )
    2330                 :            : {
    2331                 :            :     DBG_ASSERT( pObj, "sd::SdPage::InsertPresObj(), invalid presentation object inserted!" );
    2332                 :            :     DBG_ASSERT( !IsPresObj(pObj), "sd::SdPage::InsertPresObj(), presentation object inserted twice!" );
    2333         [ +  - ]:       1840 :     if( pObj )
    2334                 :            :     {
    2335                 :       1840 :         SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
    2336         [ +  - ]:       1840 :         if( pInfo )
    2337                 :       1840 :             pInfo->mePresObjKind = eKind;
    2338                 :       1840 :         maPresentationShapeList.addShape(*pObj);
    2339                 :            :     }
    2340                 :       1840 : }
    2341                 :            : 
    2342                 :            : /*************************************************************************
    2343                 :            : |*
    2344                 :            : |* Text des Objektes setzen
    2345                 :            : |*
    2346                 :            : \************************************************************************/
    2347                 :            : 
    2348                 :       1167 : void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rString )
    2349                 :            : {
    2350         [ +  - ]:       1167 :     if ( pObj )
    2351                 :            :     {
    2352                 :            :         DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: Kein SdrTextObj!" );
    2353                 :       1167 :         ::Outliner* pOutl = pOutliner;
    2354                 :            : 
    2355         [ +  + ]:       1167 :         if (!pOutliner)
    2356                 :            :         {
    2357 [ +  - ][ +  - ]:         24 :             SfxItemPool* pPool = ((SdDrawDocument*) GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
                 [ +  - ]
    2358 [ +  - ][ +  - ]:         24 :             pOutl = new ::Outliner( pPool, OUTLINERMODE_OUTLINEOBJECT );
    2359 [ +  - ][ +  - ]:         24 :             pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *( (SdDrawDocument*) GetModel() )->GetDocSh() ) );
         [ +  - ][ +  - ]
    2360         [ +  - ]:         24 :             pOutl->SetEditTextObjectPool(pPool);
    2361 [ +  - ][ +  - ]:         24 :             pOutl->SetStyleSheetPool((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool());
                 [ +  - ]
    2362         [ +  - ]:         24 :             pOutl->EnableUndo(sal_False);
    2363         [ +  - ]:         24 :             pOutl->SetUpdateMode( sal_False );
    2364                 :            :         }
    2365                 :            : 
    2366                 :       1167 :         sal_uInt16 nOutlMode = pOutl->GetMode();
    2367         [ +  - ]:       1167 :         Size aPaperSize = pOutl->GetPaperSize();
    2368         [ +  - ]:       1167 :         sal_Bool bUpdateMode = pOutl->GetUpdateMode();
    2369         [ +  - ]:       1167 :         pOutl->SetUpdateMode(sal_False);
    2370 [ +  - ][ +  - ]:       1167 :         pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
    2371                 :            : 
    2372                 :            :         // Always set the object's StyleSheet at the Outliner to
    2373                 :            :         // use the current objects StyleSheet. Thus it's the same as in
    2374                 :            :         // SetText(...).
    2375                 :            :         // Moved this implementation from where SetObjText(...) was called
    2376                 :            :         // to inside this method to work even when outliner is fetched here.
    2377 [ +  - ][ +  - ]:       1167 :         pOutl->SetStyleSheet(0, pObj->GetStyleSheet());
    2378                 :            : 
    2379                 :       1167 :         rtl::OUString aString;
    2380                 :            : 
    2381      [ +  +  + ]:       1167 :         switch( eObjKind )
    2382                 :            :         {
    2383                 :            :             case PRESOBJ_OUTLINE:
    2384                 :            :             {
    2385         [ +  - ]:         93 :                 pOutl->Init( OUTLINERMODE_OUTLINEOBJECT );
    2386                 :            : 
    2387                 :         93 :                 aString += "\t";
    2388         [ +  - ]:         93 :                 aString += rString;
    2389                 :            : 
    2390         [ +  + ]:         93 :                 if (mbMaster)
    2391                 :            :                 {
    2392 [ +  - ][ +  - ]:         66 :                     pOutl->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind) );
    2393                 :         66 :                     aString += "\n\t\t";
    2394 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER2);
    2395                 :            : 
    2396                 :         66 :                     aString += "\n\t\t\t";
    2397 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER3);
    2398                 :            : 
    2399                 :         66 :                     aString += "\n\t\t\t\t";
    2400 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER4);
    2401                 :            : 
    2402                 :         66 :                     aString += "\n\t\t\t\t\t";
    2403 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER5);
    2404                 :            : 
    2405                 :         66 :                     aString += "\n\t\t\t\t\t\t";
    2406 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER6);
    2407                 :            : 
    2408                 :         66 :                     aString += "\n\t\t\t\t\t\t\t";
    2409 [ +  - ][ +  - ]:         66 :                     aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER7);
    2410                 :            : 
    2411                 :            :                 }
    2412                 :            :             }
    2413                 :         93 :             break;
    2414                 :            : 
    2415                 :            :             case PRESOBJ_TITLE:
    2416                 :            :             {
    2417         [ +  - ]:        204 :                 pOutl->Init( OUTLINERMODE_TITLEOBJECT );
    2418         [ +  - ]:        204 :                 aString += rString;
    2419                 :            :             }
    2420                 :        204 :             break;
    2421                 :            : 
    2422                 :            :             default:
    2423                 :            :             {
    2424         [ +  - ]:        870 :                 pOutl->Init( OUTLINERMODE_TEXTOBJECT );
    2425         [ +  - ]:        870 :                 aString += rString;
    2426                 :            : 
    2427                 :            :                 // check if we need to add a text field
    2428                 :        870 :                 SvxFieldData* pData = NULL;
    2429                 :            : 
    2430   [ +  +  +  +  :        870 :                 switch( eObjKind )
                      + ]
    2431                 :            :                 {
    2432                 :            :                 case PRESOBJ_HEADER:
    2433 [ +  - ][ +  - ]:         98 :                     pData = new SvxHeaderField();
    2434                 :         98 :                     break;
    2435                 :            :                 case PRESOBJ_FOOTER:
    2436 [ +  - ][ +  - ]:        147 :                     pData = new SvxFooterField();
    2437                 :        147 :                     break;
    2438                 :            :                 case PRESOBJ_SLIDENUMBER:
    2439 [ +  - ][ +  - ]:        150 :                     pData = new SvxPageField();
    2440                 :        150 :                     break;
    2441                 :            :                 case PRESOBJ_DATETIME:
    2442 [ +  - ][ +  - ]:        144 :                     pData = new SvxDateTimeField();
    2443                 :        144 :                     break;
    2444                 :            :                 default:
    2445                 :        331 :                     break;
    2446                 :            :                 }
    2447                 :            : 
    2448         [ +  + ]:        870 :                 if( pData )
    2449                 :            :                 {
    2450                 :        539 :                     ESelection e;
    2451         [ +  - ]:        539 :                     SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
    2452         [ +  - ]:        539 :                     pOutl->QuickInsertField(aField,e);
    2453 [ +  - ][ +  - ]:        539 :                     delete pData;
                 [ +  - ]
    2454                 :            :                 }
    2455                 :            :             }
    2456                 :        870 :             break;
    2457                 :            :         }
    2458                 :            : 
    2459 [ +  - ][ +  - ]:       1167 :         pOutl->SetPaperSize( pObj->GetLogicRect().GetSize() );
                 [ +  - ]
    2460                 :            : 
    2461         [ +  + ]:       1167 :         if( !aString.isEmpty() )
    2462 [ +  - ][ +  - ]:        628 :             pOutl->SetText( aString, pOutl->GetParagraph( 0 ) );
         [ +  - ][ +  - ]
    2463                 :            : 
    2464 [ +  - ][ +  - ]:       1167 :         ( (SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
    2465                 :            : 
    2466         [ +  + ]:       1167 :         if (!pOutliner)
    2467                 :            :         {
    2468 [ +  - ][ +  - ]:         24 :             delete pOutl;
    2469                 :         24 :             pOutl = NULL;
    2470                 :            :         }
    2471                 :            :         else
    2472                 :            :         {
    2473                 :            :             // Outliner restaurieren
    2474         [ +  - ]:       1143 :             pOutl->Init( nOutlMode );
    2475 [ +  - ][ +  - ]:       1143 :             pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
    2476         [ +  - ]:       1143 :             pOutl->SetUpdateMode( bUpdateMode );
    2477         [ +  - ]:       1143 :             pOutl->SetPaperSize( aPaperSize );
    2478                 :       1167 :         }
    2479                 :            :     }
    2480                 :       1167 : }
    2481                 :            : 
    2482                 :            : /*************************************************************************
    2483                 :            : |*
    2484                 :            : |* Link & Daten von einem VControl empfangen
    2485                 :            : |*
    2486                 :            : \************************************************************************/
    2487                 :            : 
    2488                 :          0 : void SdPage::SetLinkData(const String&, const String& )
    2489                 :            : {
    2490                 :          0 : }
    2491                 :            : 
    2492                 :            : /*************************************************************************
    2493                 :            : |*
    2494                 :            : |* Layoutname setzen
    2495                 :            : |*
    2496                 :            : \************************************************************************/
    2497                 :        307 : void SdPage::SetLayoutName(String aName)
    2498                 :            : {
    2499                 :        307 :     maLayoutName = aName;
    2500                 :            : 
    2501         [ +  + ]:        307 :     if( mbMaster )
    2502                 :            :     {
    2503         [ +  - ]:         79 :         String aSep( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) );
    2504         [ +  - ]:         79 :         sal_uInt16 nPos = maLayoutName.Search( aSep );
    2505         [ +  - ]:         79 :         if ( nPos != STRING_NOTFOUND )
    2506                 :            :         {
    2507 [ +  - ][ +  - ]:         79 :             FmFormPage::SetName(maLayoutName.Copy(0, nPos));
                 [ +  - ]
    2508         [ +  - ]:         79 :         }
    2509                 :            :     }
    2510                 :        307 : }
    2511                 :            : 
    2512                 :            : 
    2513                 :            : /*************************************************************************
    2514                 :            : |*
    2515                 :            : |* Seitenname zurueckgeben und ggf. generieren
    2516                 :            : |*
    2517                 :            : \************************************************************************/
    2518                 :            : 
    2519                 :       2709 : const String& SdPage::GetName() const
    2520                 :            : {
    2521         [ +  - ]:       2709 :     String aCreatedPageName( maCreatedPageName );
    2522 [ +  - ][ +  - ]:       2709 :     if (GetRealName().Len() == 0)
                 [ +  + ]
    2523                 :            :     {
    2524 [ +  + ][ +  + ]:       2603 :         if ((mePageKind == PK_STANDARD || mePageKind == PK_NOTES) && !mbMaster)
                 [ +  + ]
    2525                 :            :         {
    2526                 :            :             // default name for handout pages
    2527         [ +  - ]:       2235 :             sal_uInt16  nNum = (GetPageNum() + 1) / 2;
    2528                 :            : 
    2529 [ +  - ][ +  - ]:       2235 :             aCreatedPageName = String(SdResId(STR_PAGE));
         [ +  - ][ +  - ]
    2530         [ +  - ]:       2235 :             aCreatedPageName += sal_Unicode( ' ' );
    2531 [ +  - ][ +  - ]:       2235 :             if( GetModel()->GetPageNumType() == SVX_NUMBER_NONE )
                 [ -  + ]
    2532                 :            :             {
    2533                 :            :                 // if the document has number none as a formating
    2534                 :            :                 // for page numbers we still default to arabic numbering
    2535                 :            :                 // to keep the default page names unique
    2536 [ #  # ][ #  # ]:          0 :                 aCreatedPageName += String::CreateFromInt32( (sal_Int32)nNum );
                 [ #  # ]
    2537                 :            :             }
    2538                 :            :             else
    2539                 :            :             {
    2540 [ +  - ][ +  - ]:       2235 :                 aCreatedPageName += ((SdDrawDocument*) GetModel())->CreatePageNumValue(nNum);
         [ +  - ][ +  - ]
    2541                 :       2235 :             }
    2542                 :            :         }
    2543                 :            :         else
    2544                 :            :         {
    2545                 :            :             /******************************************************************
    2546                 :            :             * Defaultname fuer Handzettelseiten
    2547                 :            :             ******************************************************************/
    2548 [ +  - ][ +  - ]:       2603 :             aCreatedPageName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
         [ +  - ][ +  - ]
    2549                 :            :         }
    2550                 :            :     }
    2551                 :            :     else
    2552                 :            :     {
    2553 [ +  - ][ +  - ]:        106 :         aCreatedPageName = GetRealName();
                 [ +  - ]
    2554                 :            :     }
    2555                 :            : 
    2556         [ +  + ]:       2709 :     if (mePageKind == PK_NOTES)
    2557                 :            :     {
    2558         [ +  - ]:        148 :         aCreatedPageName += sal_Unicode( ' ' );
    2559 [ +  - ][ +  - ]:        148 :         aCreatedPageName += String(SdResId(STR_NOTES));
         [ +  - ][ +  - ]
    2560                 :            :     }
    2561 [ +  + ][ +  + ]:       2561 :     else if (mePageKind == PK_HANDOUT && mbMaster)
    2562                 :            :     {
    2563         [ +  - ]:         41 :         aCreatedPageName += rtl::OUString(" (");
    2564 [ +  - ][ +  - ]:         41 :         aCreatedPageName += SdResId(STR_HANDOUT).toString();
                 [ +  - ]
    2565         [ +  - ]:         41 :         aCreatedPageName += sal_Unicode( ')' );
    2566                 :            :     }
    2567                 :            : 
    2568         [ +  - ]:       2709 :     const_cast< SdPage* >(this)->maCreatedPageName = aCreatedPageName;
    2569         [ +  - ]:       2709 :     return maCreatedPageName;
    2570                 :            : }
    2571                 :            : 
    2572                 :        165 : void SdPage::SetOrientation( Orientation eOrient)
    2573                 :            : {
    2574                 :        165 :     meOrientation = eOrient;
    2575                 :        165 : }
    2576                 :            : 
    2577                 :        230 : Orientation SdPage::GetOrientation() const
    2578                 :            : {
    2579                 :        230 :     return meOrientation;
    2580                 :            : }
    2581                 :            : 
    2582                 :            : /*************************************************************************
    2583                 :            : |*
    2584                 :            : |* Liefert den Default-Text eines PresObjektes zurueck
    2585                 :            : |*
    2586                 :            : \************************************************************************/
    2587                 :            : 
    2588                 :       1768 : String SdPage::GetPresObjText(PresObjKind eObjKind) const
    2589                 :            : {
    2590                 :       1768 :     String aString;
    2591                 :            : 
    2592         [ +  + ]:       1768 :     if (eObjKind == PRESOBJ_TITLE)
    2593                 :            :     {
    2594         [ +  + ]:        204 :         if (mbMaster)
    2595                 :            :         {
    2596         [ +  + ]:        123 :             if (mePageKind != PK_NOTES)
    2597                 :            :             {
    2598 [ +  - ][ +  - ]:         66 :                 aString = String ( SdResId( STR_PRESOBJ_MPTITLE ) );
         [ +  - ][ +  - ]
    2599                 :            :             }
    2600                 :            :             else
    2601                 :            :             {
    2602 [ +  - ][ +  - ]:         57 :                 aString = String ( SdResId( STR_PRESOBJ_MPNOTESTITLE ) );
         [ +  - ][ +  - ]
    2603                 :            :             }
    2604                 :            :         }
    2605                 :            :         else
    2606                 :            :         {
    2607 [ +  - ][ +  - ]:         81 :             aString = String ( SdResId( STR_PRESOBJ_TITLE ) );
         [ +  - ][ +  - ]
    2608                 :            :         }
    2609                 :            :     }
    2610         [ +  + ]:       1564 :     else if (eObjKind == PRESOBJ_OUTLINE)
    2611                 :            :     {
    2612         [ +  + ]:         93 :         if (mbMaster)
    2613                 :            :         {
    2614 [ +  - ][ +  - ]:         66 :             aString = String ( SdResId( STR_PRESOBJ_MPOUTLINE ) );
         [ +  - ][ +  - ]
    2615                 :            :         }
    2616                 :            :         else
    2617                 :            :         {
    2618 [ +  - ][ +  - ]:         27 :             aString = String ( SdResId( STR_PRESOBJ_OUTLINE ) );
         [ +  - ][ +  - ]
    2619                 :            :         }
    2620                 :            :     }
    2621         [ +  + ]:       1471 :     else if (eObjKind == PRESOBJ_NOTES)
    2622                 :            :     {
    2623         [ +  + ]:        280 :         if (mbMaster)
    2624                 :            :         {
    2625 [ +  - ][ +  - ]:         57 :             aString = String ( SdResId( STR_PRESOBJ_MPNOTESTEXT ) );
         [ +  - ][ +  - ]
    2626                 :            :         }
    2627                 :            :         else
    2628                 :            :         {
    2629 [ +  - ][ +  - ]:        223 :             aString = String ( SdResId( STR_PRESOBJ_NOTESTEXT ) );
         [ +  - ][ +  - ]
    2630                 :            :         }
    2631                 :            :     }
    2632         [ +  + ]:       1191 :     else if (eObjKind == PRESOBJ_TEXT)
    2633                 :            :     {
    2634 [ +  - ][ +  - ]:         48 :         aString = String ( SdResId( STR_PRESOBJ_TEXT ) );
         [ +  - ][ +  - ]
    2635                 :            :     }
    2636         [ +  + ]:       1143 :     else if (eObjKind == PRESOBJ_GRAPHIC)
    2637                 :            :     {
    2638 [ +  - ][ +  - ]:          3 :         aString = String ( SdResId( STR_PRESOBJ_GRAPHIC ) );
         [ +  - ][ +  - ]
    2639                 :            :     }
    2640         [ -  + ]:       1140 :     else if (eObjKind == PRESOBJ_OBJECT)
    2641                 :            :     {
    2642 [ #  # ][ #  # ]:          0 :         aString = String ( SdResId( STR_PRESOBJ_OBJECT ) );
         [ #  # ][ #  # ]
    2643                 :            :     }
    2644         [ -  + ]:       1140 :     else if (eObjKind == PRESOBJ_CHART)
    2645                 :            :     {
    2646 [ #  # ][ #  # ]:          0 :         aString = String ( SdResId( STR_PRESOBJ_CHART ) );
         [ #  # ][ #  # ]
    2647                 :            :     }
    2648         [ -  + ]:       1140 :     else if (eObjKind == PRESOBJ_ORGCHART)
    2649                 :            :     {
    2650 [ #  # ][ #  # ]:          0 :         aString = String ( SdResId( STR_PRESOBJ_ORGCHART ) );
         [ #  # ][ #  # ]
    2651                 :            :     }
    2652         [ -  + ]:       1140 :     else if (eObjKind == PRESOBJ_CALC)
    2653                 :            :     {
    2654 [ #  # ][ #  # ]:          0 :         aString = String ( SdResId( STR_PRESOBJ_TABLE ) );
         [ #  # ][ #  # ]
    2655                 :            :     }
    2656                 :            : 
    2657                 :       1768 :     return(aString);
    2658                 :            : }
    2659                 :            : 
    2660                 :            : extern uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage );
    2661                 :            : 
    2662                 :        581 : uno::Reference< uno::XInterface > SdPage::createUnoPage()
    2663                 :            : {
    2664                 :        581 :     return createUnoPageImpl( this );
    2665                 :            : }
    2666                 :            : 
    2667                 :            : /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
    2668                 :          0 : SdPage* SdPage::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage )
    2669                 :            : {
    2670                 :            :     try
    2671                 :            :     {
    2672         [ #  # ]:          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( xPage, ::com::sun::star::uno::UNO_QUERY );
    2673         [ #  # ]:          0 :         if( xUnoTunnel.is() )
    2674                 :            :         {
    2675 [ #  # ][ #  # ]:          0 :             SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
    2676         [ #  # ]:          0 :             if( pUnoPage )
    2677                 :          0 :                 return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
    2678 [ #  # ][ #  # ]:          0 :         }
    2679                 :            :     }
    2680                 :          0 :     catch( ::com::sun::star::uno::Exception& )
    2681                 :            :     {
    2682                 :            :         OSL_FAIL("sd::SdPage::getImplementation(), exception caught!" );
    2683                 :            :     }
    2684                 :            : 
    2685                 :          0 :     return 0;
    2686                 :            : }
    2687                 :            : 
    2688                 :        412 : void SdPage::SetName (const String& rName)
    2689                 :            : {
    2690 [ +  - ][ +  - ]:        412 :     String aOldName = GetName();
    2691         [ +  - ]:        412 :     FmFormPage::SetName (rName);
    2692         [ +  - ]:        412 :     static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
    2693 [ +  - ][ +  - ]:        412 :     ActionChanged();
    2694                 :        412 : }
    2695                 :            : 
    2696                 :       1311 : const HeaderFooterSettings& SdPage::getHeaderFooterSettings() const
    2697                 :            : {
    2698 [ +  + ][ -  + ]:       1311 :     if( mePageKind == PK_HANDOUT && !mbMaster )
    2699                 :            :     {
    2700                 :          0 :         return (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings);
    2701                 :            :     }
    2702                 :            :     else
    2703                 :            :     {
    2704                 :       1311 :         return maHeaderFooterSettings;
    2705                 :            :     }
    2706                 :            : }
    2707                 :            : 
    2708                 :        111 : void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings )
    2709                 :            : {
    2710 [ -  + ][ #  # ]:        111 :     if( mePageKind == PK_HANDOUT && !mbMaster )
    2711                 :            :     {
    2712                 :          0 :         (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings) = rNewSettings;
    2713                 :            :     }
    2714                 :            :     else
    2715                 :            :     {
    2716                 :        111 :         maHeaderFooterSettings = rNewSettings;
    2717                 :            :     }
    2718                 :            : 
    2719                 :        111 :     SetChanged();
    2720         [ +  - ]:        111 :     if(TRG_HasMasterPage())
    2721                 :            :     {
    2722                 :        111 :         TRG_GetMasterPageDescriptorViewContact().ActionChanged();
    2723                 :            :     }
    2724                 :        111 : }
    2725                 :            : 
    2726                 :       2443 : bool SdPage::checkVisibility(
    2727                 :            :     const sdr::contact::ViewObjectContact& rOriginal,
    2728                 :            :     const sdr::contact::DisplayInfo& rDisplayInfo,
    2729                 :            :     bool bEdit )
    2730                 :            : {
    2731         [ -  + ]:       2443 :     if( !FmFormPage::checkVisibility( rOriginal, rDisplayInfo, bEdit ) )
    2732                 :          0 :         return false;
    2733                 :            : 
    2734                 :       2443 :     SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
    2735         [ -  + ]:       2443 :     if( pObj == NULL )
    2736                 :          0 :         return false;
    2737                 :            : 
    2738                 :       2443 :     const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
    2739 [ -  + ][ +  - ]:       2443 :     const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter() || rOriginal.GetObjectContact().isOutputToPDFFile());
    2740                 :       2443 :     const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
    2741 [ -  + ][ +  - ]:       2443 :     const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
    2742                 :            : 
    2743                 :            :     // empty presentation objects only visible during edit mode
    2744 [ +  - ][ +  - ]:       2443 :     if( (bIsPrinting || !bEdit || bIsInsidePageObj ) && pObj->IsEmptyPresObj() )
         [ -  + ][ #  # ]
                 [ -  + ]
    2745                 :            :     {
    2746 [ #  # ][ #  # ]:          0 :         if( (pObj->GetObjInventor() != SdrInventor) || ( (pObj->GetObjIdentifier() != OBJ_RECT) && (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
         [ #  # ][ #  # ]
    2747                 :          0 :             return false;
    2748                 :            :     }
    2749                 :            : 
    2750 [ +  + ][ +  + ]:       2443 :     if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_TEXT ) )
                 [ +  + ]
    2751                 :            :     {
    2752         [ -  + ]:       1054 :            const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->GetPage());
    2753                 :            : 
    2754         [ +  - ]:       1054 :         if( pCheckPage )
    2755                 :            :         {
    2756                 :       1054 :             PresObjKind eKind = pCheckPage->GetPresObjKind(pObj);
    2757                 :            : 
    2758 [ +  + ][ +  + ]:       1054 :             if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
         [ +  + ][ +  + ]
    2759                 :            :             {
    2760                 :        413 :                 const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
    2761                 :            : 
    2762 [ #  # ][ #  # ]:        413 :                 if( bSubContentProcessing || ( pCheckPage->GetPageKind() == PK_HANDOUT && bIsPrinting ) )
         [ +  - ][ -  + ]
    2763                 :            :                 {
    2764                 :            :                     // use the page that is currently processed
    2765         [ -  + ]:        413 :                     const SdPage* pVisualizedSdPage = dynamic_cast< const SdPage* >(pVisualizedPage);
    2766                 :            : 
    2767         [ +  - ]:        413 :                     if( pVisualizedSdPage )
    2768                 :            :                     {
    2769                 :            :                         // if we are not on a masterpage, see if we have to draw this header&footer object at all
    2770                 :        413 :                         const sd::HeaderFooterSettings& rSettings = pVisualizedSdPage->getHeaderFooterSettings();
    2771                 :            : 
    2772   [ +  +  +  +  :        413 :                         switch( eKind )
                      - ]
    2773                 :            :                         {
    2774                 :            :                         case PRESOBJ_FOOTER:
    2775                 :        137 :                             return rSettings.mbFooterVisible;
    2776                 :            :                         case PRESOBJ_HEADER:
    2777                 :          2 :                             return rSettings.mbHeaderVisible;
    2778                 :            :                         case PRESOBJ_DATETIME:
    2779                 :        137 :                             return rSettings.mbDateTimeVisible;
    2780                 :            :                         case PRESOBJ_SLIDENUMBER:
    2781                 :        137 :                             return rSettings.mbSlideNumberVisible;
    2782                 :            :                         default:
    2783                 :          0 :                             break;
    2784                 :            :                         }
    2785                 :            :                     }
    2786                 :          0 :                 }
    2787                 :            :             } // check for placeholders on master
    2788 [ +  + ][ -  + ]:        641 :             else if( (eKind != PRESOBJ_NONE) && pCheckPage->IsMasterPage() && ( pVisualizedPage != pCheckPage ) )
         [ #  # ][ -  + ]
    2789                 :            :             {
    2790                 :            :                 // presentation objects on master slide are always invisible if slide is shown.
    2791                 :        641 :                 return false;
    2792                 :            :             }
    2793                 :            :         }
    2794                 :            :     }
    2795                 :            : 
    2796                 :            :     // i63977, do not print SdrpageObjs from master pages
    2797 [ +  + ][ +  + ]:       2030 :     if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_PAGE ) )
                 [ +  + ]
    2798                 :            :     {
    2799 [ +  - ][ -  + ]:         11 :         if( pObj->GetPage() && pObj->GetPage()->IsMasterPage() )
                 [ -  + ]
    2800                 :          0 :             return false;
    2801                 :            :     }
    2802                 :            : 
    2803                 :       2443 :     return true;
    2804                 :            : }
    2805                 :            : 
    2806                 :          0 : bool SdPage::RestoreDefaultText( SdrObject* pObj )
    2807                 :            : {
    2808                 :          0 :     bool bRet = false;
    2809                 :            : 
    2810         [ #  # ]:          0 :     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
    2811                 :            : 
    2812         [ #  # ]:          0 :     if( pTextObj )
    2813                 :            :     {
    2814                 :          0 :         PresObjKind ePresObjKind = GetPresObjKind(pTextObj);
    2815                 :            : 
    2816 [ #  # ][ #  # ]:          0 :         if (ePresObjKind == PRESOBJ_TITLE   ||
         [ #  # ][ #  # ]
    2817                 :            :             ePresObjKind == PRESOBJ_OUTLINE ||
    2818                 :            :             ePresObjKind == PRESOBJ_NOTES   ||
    2819                 :            :             ePresObjKind == PRESOBJ_TEXT)
    2820                 :            :         {
    2821         [ #  # ]:          0 :             String aString( GetPresObjText(ePresObjKind) );
    2822                 :            : 
    2823         [ #  # ]:          0 :             if (aString.Len())
    2824                 :            :             {
    2825                 :          0 :                 sal_Bool bVertical = sal_False;
    2826         [ #  # ]:          0 :                 OutlinerParaObject* pOldPara = pTextObj->GetOutlinerParaObject();
    2827         [ #  # ]:          0 :                 if( pOldPara )
    2828         [ #  # ]:          0 :                     bVertical = pOldPara->IsVertical();  // is old para object vertical?
    2829                 :            : 
    2830         [ #  # ]:          0 :                 SetObjText( pTextObj, 0, ePresObjKind, aString );
    2831                 :            : 
    2832         [ #  # ]:          0 :                 if( pOldPara )
    2833                 :            :                 {
    2834                 :            :                     // Here, only the vertical flag for the
    2835                 :            :                     // OutlinerParaObjects needs to be changed. The
    2836                 :            :                     // AutoGrowWidth/Height items still exist in the
    2837                 :            :                     // not changed object.
    2838 [ #  # ][ #  # ]:          0 :                     if(pTextObj
         [ #  # ][ #  # ]
    2839         [ #  # ]:          0 :                         && pTextObj->GetOutlinerParaObject()
    2840 [ #  # ][ #  # ]:          0 :                         && pTextObj->GetOutlinerParaObject()->IsVertical() != (bool)bVertical)
    2841                 :            :                     {
    2842         [ #  # ]:          0 :                         Rectangle aObjectRect = pTextObj->GetSnapRect();
    2843 [ #  # ][ #  # ]:          0 :                         pTextObj->GetOutlinerParaObject()->SetVertical(bVertical);
    2844         [ #  # ]:          0 :                         pTextObj->SetSnapRect(aObjectRect);
    2845                 :            :                     }
    2846                 :            :                 }
    2847                 :            : 
    2848                 :          0 :                 pTextObj->SetTextEditOutliner( NULL );  // to make stylesheet settings work
    2849 [ #  # ][ #  # ]:          0 :                 pTextObj->NbcSetStyleSheet( GetStyleSheetForPresObj(ePresObjKind), sal_True );
    2850         [ #  # ]:          0 :                 pTextObj->SetEmptyPresObj(sal_True);
    2851                 :          0 :                 bRet = true;
    2852         [ #  # ]:          0 :             }
    2853                 :            :         }
    2854                 :            :     }
    2855                 :          0 :     return bRet;
    2856                 :            : }
    2857                 :            : 
    2858                 :         57 : void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas )
    2859                 :            : {
    2860                 :         57 :     SdPage& rHandoutMaster = *rModel.GetMasterSdPage( 0, PK_HANDOUT );
    2861                 :            : 
    2862         [ -  + ]:         57 :     if( eLayout == AUTOLAYOUT_NONE )
    2863                 :            :     {
    2864                 :            :         // use layout from handout master
    2865         [ #  # ]:          0 :         SdrObjListIter aShapeIter (rHandoutMaster);
    2866         [ #  # ]:          0 :         while (aShapeIter.IsMore())
    2867                 :            :         {
    2868 [ #  # ][ #  # ]:          0 :             SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
    2869         [ #  # ]:          0 :             if (pPageObj)
    2870 [ #  # ][ #  # ]:          0 :                 rAreas.push_back( pPageObj->GetCurrentBoundRect() );
    2871                 :          0 :         }
    2872                 :            :     }
    2873                 :            :     else
    2874                 :            :     {
    2875         [ +  - ]:         57 :         Size    aArea = rHandoutMaster.GetSize();
    2876                 :            : 
    2877                 :         57 :         const long nGapW = 1000; // gap is 1cm
    2878                 :         57 :         const long nGapH = 1000;
    2879                 :            : 
    2880         [ +  - ]:         57 :         long nLeftBorder = rHandoutMaster.GetLftBorder();
    2881         [ +  - ]:         57 :         long nRightBorder = rHandoutMaster.GetRgtBorder();
    2882         [ +  - ]:         57 :         long nTopBorder = rHandoutMaster.GetUppBorder();
    2883         [ +  - ]:         57 :         long nBottomBorder = rHandoutMaster.GetLwrBorder();
    2884                 :            : 
    2885                 :         57 :         const long nHeaderFooterHeight = static_cast< long >( (aArea.Height() - nTopBorder - nLeftBorder) * 0.05  );
    2886                 :            : 
    2887                 :         57 :         nTopBorder += nHeaderFooterHeight;
    2888                 :         57 :         nBottomBorder += nHeaderFooterHeight;
    2889                 :            : 
    2890                 :         57 :         long nX = nGapW + nLeftBorder;
    2891                 :         57 :         long nY = nGapH + nTopBorder;
    2892                 :            : 
    2893                 :         57 :         aArea.Width() -= nGapW * 2 + nLeftBorder + nRightBorder;
    2894                 :         57 :         aArea.Height() -= nGapH * 2 + nTopBorder + nBottomBorder;
    2895                 :            : 
    2896                 :         57 :         const bool bLandscape = aArea.Width() > aArea.Height();
    2897                 :            : 
    2898                 :            :         static sal_uInt16 aOffsets[5][9] =
    2899                 :            :         {
    2900                 :            :             { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
    2901                 :            :             { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
    2902                 :            :             { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
    2903                 :            :             { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
    2904                 :            :             { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
    2905                 :            :         };
    2906                 :            : 
    2907                 :         57 :         sal_uInt16* pOffsets = aOffsets[0];
    2908                 :         57 :         sal_uInt16  nColCnt = 0, nRowCnt = 0;
    2909   [ -  -  -  -  :         57 :         switch ( eLayout )
                   +  - ]
    2910                 :            :         {
    2911                 :            :             case AUTOLAYOUT_HANDOUT1:
    2912                 :          0 :                 nColCnt = 1; nRowCnt = 1;
    2913                 :          0 :                 break;
    2914                 :            : 
    2915                 :            :             case AUTOLAYOUT_HANDOUT2:
    2916         [ #  # ]:          0 :                 if( bLandscape )
    2917                 :            :                 {
    2918                 :          0 :                     nColCnt = 2; nRowCnt = 1;
    2919                 :            :                 }
    2920                 :            :                 else
    2921                 :            :                 {
    2922                 :          0 :                     nColCnt = 1; nRowCnt = 2;
    2923                 :            :                 }
    2924                 :          0 :                 break;
    2925                 :            : 
    2926                 :            :             case AUTOLAYOUT_HANDOUT3:
    2927         [ #  # ]:          0 :                 if( bLandscape )
    2928                 :            :                 {
    2929                 :          0 :                     nColCnt = 3; nRowCnt = 2;
    2930                 :            :                 }
    2931                 :            :                 else
    2932                 :            :                 {
    2933                 :          0 :                     nColCnt = 2; nRowCnt = 3;
    2934                 :            :                 }
    2935         [ #  # ]:          0 :                 pOffsets = aOffsets[ bLandscape ? 1 : 0 ];
    2936                 :          0 :                 break;
    2937                 :            : 
    2938                 :            :             case AUTOLAYOUT_HANDOUT4:
    2939                 :          0 :                 nColCnt = 2; nRowCnt = 2;
    2940         [ #  # ]:          0 :                 pOffsets = aOffsets[ bHorizontal ? 0 : 2 ];
    2941                 :          0 :                 break;
    2942                 :            : 
    2943                 :            :             case AUTOLAYOUT_HANDOUT6:
    2944         [ -  + ]:         57 :                 if( bLandscape )
    2945                 :            :                 {
    2946                 :          0 :                     nColCnt = 3; nRowCnt = 2;
    2947                 :            :                 }
    2948                 :            :                 else
    2949                 :            :                 {
    2950                 :         57 :                     nColCnt = 2; nRowCnt = 3;
    2951                 :            :                 }
    2952         [ +  - ]:         57 :                 if( !bHorizontal )
    2953         [ -  + ]:         57 :                     pOffsets = aOffsets[ bLandscape ? 1 : 3 ];
    2954                 :         57 :                 break;
    2955                 :            : 
    2956                 :            :             default:
    2957                 :            :             case AUTOLAYOUT_HANDOUT9:
    2958                 :          0 :                 nColCnt = 3; nRowCnt = 3;
    2959                 :            : 
    2960         [ #  # ]:          0 :                 if( !bHorizontal )
    2961                 :          0 :                     pOffsets = aOffsets[4];
    2962                 :          0 :                 break;
    2963                 :            :         }
    2964                 :            : 
    2965         [ +  - ]:         57 :         rAreas.resize( nColCnt * nRowCnt );
    2966                 :            : 
    2967                 :         57 :         Size aPartArea, aSize;
    2968                 :         57 :         aPartArea.Width()  = ((aArea.Width()  - ((nColCnt-1) * nGapW) ) / nColCnt);
    2969                 :         57 :         aPartArea.Height() = ((aArea.Height() - ((nRowCnt-1) * nGapH) ) / nRowCnt);
    2970                 :            : 
    2971         [ +  - ]:         57 :         SdrPage* pFirstPage = rModel.GetMasterSdPage(0, PK_STANDARD);
    2972         [ +  - ]:         57 :         if ( pFirstPage )
    2973                 :            :         {
    2974                 :            :             // scale actual size into handout rect
    2975         [ +  - ]:         57 :             double fScale = (double)aPartArea.Width() / (double)pFirstPage->GetWdt();
    2976                 :            : 
    2977         [ +  - ]:         57 :             aSize.Height() = (long)(fScale * pFirstPage->GetHgt() );
    2978         [ -  + ]:         57 :             if( aSize.Height() > aPartArea.Height() )
    2979                 :            :             {
    2980         [ #  # ]:          0 :                 fScale = (double)aPartArea.Height() / (double)pFirstPage->GetHgt();
    2981                 :          0 :                 aSize.Height() = aPartArea.Height();
    2982         [ #  # ]:          0 :                 aSize.Width() = (long)(fScale * pFirstPage->GetWdt());
    2983                 :            :             }
    2984                 :            :             else
    2985                 :            :             {
    2986                 :         57 :                 aSize.Width() = aPartArea.Width();
    2987                 :            :             }
    2988                 :            : 
    2989                 :         57 :             nX += (aPartArea.Width() - aSize.Width()) / 2;
    2990                 :         57 :             nY += (aPartArea.Height()- aSize.Height())/ 2;
    2991                 :            :         }
    2992                 :            :         else
    2993                 :            :         {
    2994                 :          0 :             aSize = aPartArea;
    2995                 :            :         }
    2996                 :            : 
    2997                 :         57 :         Point aPos( nX, nY );
    2998                 :            : 
    2999         [ +  - ]:         57 :         const bool bRTL = rModel.GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
    3000                 :            : 
    3001         [ -  + ]:         57 :         const long nOffsetX = (aPartArea.Width() + nGapW) * (bRTL ? -1 : 1);
    3002                 :         57 :         const long nOffsetY = aPartArea.Height() + nGapH;
    3003         [ -  + ]:         57 :         const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) - nX : nX;
    3004                 :            : 
    3005         [ +  + ]:        228 :         for(sal_uInt16 nRow = 0; nRow < nRowCnt; nRow++)
    3006                 :            :         {
    3007                 :        171 :             aPos.X() = nStartX;
    3008         [ +  + ]:        513 :             for(sal_uInt16 nCol = 0; nCol < nColCnt; nCol++)
    3009                 :            :             {
    3010 [ +  - ][ +  - ]:        342 :                 rAreas[*pOffsets++] = Rectangle(aPos, aSize);
    3011                 :        342 :                 aPos.X() += nOffsetX;
    3012                 :            :             }
    3013                 :            : 
    3014                 :        171 :             aPos.Y() += nOffsetY;
    3015                 :            :         }
    3016                 :            :     }
    3017                 :         57 : }
    3018                 :            : 
    3019                 :            : 
    3020                 :            : 
    3021                 :            : 
    3022                 :          0 : void SdPage::SetPrecious (const bool bIsPrecious)
    3023                 :            : {
    3024                 :          0 :     mbIsPrecious = bIsPrecious;
    3025                 :          0 : }
    3026                 :            : 
    3027                 :            : 
    3028                 :            : 
    3029                 :            : 
    3030                 :          0 : bool SdPage::IsPrecious (void) const
    3031                 :            : {
    3032                 :          0 :     return mbIsPrecious;
    3033                 :            : }
    3034                 :            : 
    3035                 :            : 
    3036                 :            : 
    3037                 :            : 
    3038 [ +  - ][ +  - ]:       1028 : HeaderFooterSettings::HeaderFooterSettings()
    3039                 :            : {
    3040                 :       1028 :     mbHeaderVisible = true;
    3041                 :       1028 :     mbFooterVisible = true;
    3042                 :       1028 :     mbSlideNumberVisible = false;
    3043                 :       1028 :     mbDateTimeVisible = true;
    3044                 :       1028 :     mbDateTimeIsFixed = true;
    3045                 :       1028 :     meDateTimeFormat = SVXDATEFORMAT_A;
    3046                 :       1028 : }
    3047                 :            : 
    3048                 :        241 : bool HeaderFooterSettings::operator==( const HeaderFooterSettings& rSettings ) const
    3049                 :            : {
    3050                 :            :     return (mbHeaderVisible == rSettings.mbHeaderVisible) &&
    3051                 :        238 :            (maHeaderText == rSettings.maHeaderText) &&
    3052                 :            :            (mbFooterVisible == rSettings.mbFooterVisible) &&
    3053                 :        226 :            (maFooterText == rSettings.maFooterText) &&
    3054                 :            :            (mbSlideNumberVisible == rSettings.mbSlideNumberVisible) &&
    3055                 :            :            (mbDateTimeVisible == rSettings.mbDateTimeVisible) &&
    3056                 :            :            (mbDateTimeIsFixed == rSettings.mbDateTimeIsFixed) &&
    3057                 :            :            (meDateTimeFormat == rSettings.meDateTimeFormat) &&
    3058   [ +  +  +  - ]:        705 :            (maDateTimeText == rSettings.maDateTimeText);
           [ +  +  +  - ]
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3059                 :            : }
    3060                 :            : 
    3061                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10