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