2010-10-12 15:51:52 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-11 06:41:17 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 17:16:14 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2008-04-04 11:45:00 +00:00
|
|
|
#include <comphelper/classids.hxx>
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2007-05-10 14:22:46 +00:00
|
|
|
#include "eetext.hxx"
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/svdoutl.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/editdata.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/pageitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/lrspitem.hxx>
|
|
|
|
#include <editeng/bulitem.hxx>
|
2004-03-30 14:44:43 +00:00
|
|
|
#include <svx/svdpagv.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/fhgtitem.hxx>
|
|
|
|
#include <editeng/outlobj.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/svdoole2.hxx>
|
|
|
|
#include <svx/svdograf.hxx>
|
|
|
|
#include <svx/svdopage.hxx>
|
|
|
|
#include <svx/svdopage.hxx>
|
|
|
|
#include <sfx2/printer.hxx>
|
|
|
|
#include <basic/basmgr.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/pbinitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/svdundo.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/smplhint.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/adjitem.hxx>
|
|
|
|
#include <editeng/editobj.hxx>
|
|
|
|
#include <editeng/scripttypeitem.hxx>
|
2004-11-26 18:47:27 +00:00
|
|
|
#include <svx/unopage.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/flditem.hxx>
|
2004-03-30 14:44:43 +00:00
|
|
|
#include <svx/sdr/contact/displayinfo.hxx>
|
2010-06-04 14:14:06 +02:00
|
|
|
#include <svx/svditer.hxx>
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/adjitem.hxx>
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2004-01-20 09:28:03 +00:00
|
|
|
#include "../ui/inc/DrawDocShell.hxx"
|
|
|
|
#include "Outliner.hxx"
|
2010-07-19 17:13:56 +02:00
|
|
|
#include "app.hrc"
|
2000-09-18 23:16:46 +00:00
|
|
|
#include "eetext.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "pglink.hxx"
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "stlsheet.hxx"
|
|
|
|
#include "glob.hrc"
|
|
|
|
#include "glob.hxx"
|
2005-02-17 08:40:54 +00:00
|
|
|
#include "helpids.h"
|
2006-01-10 13:26:36 +00:00
|
|
|
#include "anminfo.hxx"
|
|
|
|
#include "undo/undomanager.hxx"
|
|
|
|
#include "undo/undoobjects.hxx"
|
2004-07-12 13:56:14 +00:00
|
|
|
#include <svx/sdr/contact/displayinfo.hxx>
|
|
|
|
#include <svx/sdr/contact/viewobjectcontact.hxx>
|
|
|
|
#include <svx/sdr/contact/viewcontact.hxx>
|
2008-08-19 23:13:11 +00:00
|
|
|
#include <svx/sdr/contact/objectcontact.hxx>
|
|
|
|
#include <svx/unoapi.hxx>
|
2004-07-12 13:56:14 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
#include <set>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
using namespace ::sd;
|
2000-11-26 18:24:16 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
TYPEINIT2( SdPage, FmFormPage, SdrObjUserCall );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Ctor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage)
|
2006-12-12 15:33:13 +00:00
|
|
|
: FmFormPage(rNewDoc, pBasic, bMasterPage)
|
|
|
|
, SdrObjUserCall()
|
|
|
|
, mePageKind(PK_STANDARD)
|
|
|
|
, meAutoLayout(AUTOLAYOUT_NONE)
|
2011-01-17 11:41:00 +01:00
|
|
|
, mbSelected(sal_False)
|
2006-12-12 15:33:13 +00:00
|
|
|
, mePresChange(PRESCHANGE_MANUAL)
|
|
|
|
, mnTime(1)
|
2011-01-17 11:41:00 +01:00
|
|
|
, mbSoundOn(sal_False)
|
|
|
|
, mbExcluded(sal_False)
|
|
|
|
, mbLoopSound(sal_False)
|
|
|
|
, mbStopSound(sal_False)
|
|
|
|
, mbScaleObjects(sal_True)
|
|
|
|
, mbBackgroundFullSize( sal_False )
|
2011-11-24 12:06:54 +01:00
|
|
|
, meCharSet(osl_getThreadTextEncoding())
|
2006-12-12 15:33:13 +00:00
|
|
|
, mnPaperBin(PAPERBIN_PRINTER_SETTINGS)
|
|
|
|
, mpPageLink(NULL)
|
|
|
|
, mpItems(NULL)
|
|
|
|
, mnTransitionType(0)
|
|
|
|
, mnTransitionSubtype(0)
|
|
|
|
, mbTransitionDirection(sal_True)
|
|
|
|
, mnTransitionFadeColor(0)
|
|
|
|
, mfTransitionDuration(2.0)
|
2009-01-21 14:22:27 +00:00
|
|
|
, mbIsPrecious(true)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// Der Layoutname der Seite wird von SVDRAW benutzt, um die Praesentations-
|
|
|
|
// vorlagen der Gliederungsobjekte zu ermitteln. Darum enthaelt er bereits
|
|
|
|
// den Bezeichner fuer die Gliederung (STR_LAYOUT_OUTLINE).
|
2006-12-12 15:33:13 +00:00
|
|
|
maLayoutName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
|
|
|
|
maLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
|
|
|
|
maLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
Size aPageSize(GetSize());
|
|
|
|
|
|
|
|
if (aPageSize.Width() > aPageSize.Height())
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
meOrientation = ORIENTATION_LANDSCAPE;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
meOrientation = ORIENTATION_PORTRAIT;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Dtor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-02-26 09:20:50 +00:00
|
|
|
SdPage::~SdPage()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
DisconnectLink();
|
|
|
|
|
|
|
|
EndListenOutlineText();
|
2001-10-12 15:19:53 +00:00
|
|
|
|
|
|
|
if( mpItems )
|
|
|
|
delete mpItems;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2010-02-23 00:23:09 +01:00
|
|
|
struct OrdNumSorter
|
|
|
|
{
|
|
|
|
bool operator()( SdrObject* p1, SdrObject* p2 )
|
|
|
|
{
|
|
|
|
return p1->GetOrdNum() < p2->GetOrdNum();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
/** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
|
2010-02-02 16:46:05 +01:00
|
|
|
SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-02-23 00:23:09 +01:00
|
|
|
// first sort all matching shapes with z-order
|
|
|
|
std::vector< SdrObject* > aMatches;
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObject* pObj = 0;
|
2006-12-12 15:33:13 +00:00
|
|
|
while( (pObj = maPresentationShapeList.getNextShape(pObj)) != 0 )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
|
2010-02-02 16:46:05 +01:00
|
|
|
if( pInfo )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-02-02 16:46:05 +01:00
|
|
|
bool bFound = false;
|
|
|
|
if( pInfo->mePresObjKind == eObjKind )
|
|
|
|
{
|
|
|
|
bFound = true;
|
|
|
|
}
|
|
|
|
else if( bFuzzySearch && (eObjKind == PRESOBJ_OUTLINE) )
|
|
|
|
{
|
|
|
|
switch( pInfo->mePresObjKind )
|
|
|
|
{
|
|
|
|
case PRESOBJ_GRAPHIC:
|
|
|
|
case PRESOBJ_OBJECT:
|
|
|
|
case PRESOBJ_CHART:
|
|
|
|
case PRESOBJ_ORGCHART:
|
|
|
|
case PRESOBJ_TABLE:
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_CALC:
|
2010-02-02 16:46:05 +01:00
|
|
|
case PRESOBJ_IMAGE:
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_MEDIA:
|
2011-01-17 11:41:00 +01:00
|
|
|
bFound = sal_True;
|
2010-02-02 16:46:05 +01:00
|
|
|
break;
|
2010-02-08 13:05:08 +01:00
|
|
|
default:
|
|
|
|
break;
|
2010-02-02 16:46:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if( bFound )
|
|
|
|
{
|
2010-02-23 00:23:09 +01:00
|
|
|
aMatches.push_back( pObj );
|
2010-02-02 16:46:05 +01:00
|
|
|
}
|
2001-02-26 09:20:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-23 00:23:09 +01:00
|
|
|
if( aMatches.size() > 1 )
|
|
|
|
{
|
|
|
|
OrdNumSorter aSortHelper;
|
|
|
|
std::sort( aMatches.begin(), aMatches.end(), aSortHelper );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nIndex > 0 )
|
|
|
|
nIndex--;
|
|
|
|
|
2010-02-24 13:01:59 +01:00
|
|
|
if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) )
|
2010-02-23 00:23:09 +01:00
|
|
|
return aMatches[nIndex];
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
return 0;
|
2001-02-26 09:20:50 +00:00
|
|
|
}
|
|
|
|
|
2010-02-09 11:33:08 +01:00
|
|
|
/** create background properties */
|
|
|
|
void SdPage::EnsureMasterPageDefaultBackground()
|
|
|
|
{
|
|
|
|
if(mbMaster)
|
|
|
|
{
|
|
|
|
// no hard attributes on MasterPage attributes
|
|
|
|
getSdrPageProperties().ClearItem();
|
|
|
|
SfxStyleSheet* pSheetForPresObj = GetStyleSheetForMasterPageBackground();
|
|
|
|
|
|
|
|
if(pSheetForPresObj)
|
|
|
|
{
|
|
|
|
// set StyleSheet for background fill attributes
|
|
|
|
getSdrPageProperties().SetStyleSheet(pSheetForPresObj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// no style found, assert and set at least XFILL_NONE
|
2011-03-12 11:41:23 +01:00
|
|
|
OSL_FAIL("No Style for MasterPageBackground fill found (!)");
|
2010-02-09 11:33:08 +01:00
|
|
|
getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
/** creates a presentation object with the given PresObjKind on this page. A user call will be set
|
|
|
|
*/
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool /* bInsert */ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
|
2006-01-10 13:26:36 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
SdrObject* pSdrObj = NULL;
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
bool bForceText = false; // forces the shape text to be set even if its empty
|
|
|
|
bool bEmptyPresObj = true;
|
|
|
|
|
|
|
|
switch( eObjKind )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_TITLE:
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
pSdrObj->SetNotVisibleAsMaster(sal_True);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_OUTLINE:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
|
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
pSdrObj->SetNotVisibleAsMaster(sal_True);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_NOTES:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
pSdrObj = new SdrRectObj(OBJ_TEXT);
|
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
pSdrObj->SetNotVisibleAsMaster(sal_True);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_TEXT:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
pSdrObj = new SdrRectObj(OBJ_TEXT);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_GRAPHIC:
|
|
|
|
{
|
2004-05-18 23:44:52 +00:00
|
|
|
BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_GRAPHIC ) );
|
|
|
|
Graphic aGraphic( aBmpEx );
|
2004-03-30 14:44:43 +00:00
|
|
|
OutputDevice &aOutDev = *Application::GetDefaultDevice();
|
|
|
|
aOutDev.Push();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aOutDev.SetMapMode( aGraphic.GetPrefMapMode() );
|
|
|
|
Size aSizePix = aOutDev.LogicToPixel( aGraphic.GetPrefSize() );
|
|
|
|
aOutDev.SetMapMode(MAP_100TH_MM);
|
|
|
|
|
|
|
|
Size aSize = aOutDev.PixelToLogic(aSizePix);
|
|
|
|
Point aPnt (0, 0);
|
|
|
|
Rectangle aRect (aPnt, aSize);
|
|
|
|
pSdrObj = new SdrGrafObj(aGraphic, aRect);
|
|
|
|
aOutDev.Pop();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_MEDIA:
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_OBJECT:
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrOle2Obj();
|
2004-05-18 23:44:52 +00:00
|
|
|
BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_OBJECT ) );
|
|
|
|
Graphic aGraphic( aBmpEx );
|
2004-03-30 14:44:43 +00:00
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_CHART:
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrOle2Obj();
|
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarChart" )));
|
2004-05-18 23:44:52 +00:00
|
|
|
BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_CHART ) );
|
|
|
|
Graphic aGraphic( aBmpEx );
|
2004-03-30 14:44:43 +00:00
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_ORGCHART:
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrOle2Obj();
|
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarOrg" )));
|
2004-05-18 23:44:52 +00:00
|
|
|
BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_ORGCHART ) );
|
|
|
|
Graphic aGraphic( aBmpEx );
|
2004-03-30 14:44:43 +00:00
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
|
|
|
|
}
|
|
|
|
|
|
|
|
case PRESOBJ_TABLE:
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_CALC:
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
pSdrObj = new SdrOle2Obj();
|
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarCalc" )));
|
2004-05-18 23:44:52 +00:00
|
|
|
BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_TABLE ) );
|
|
|
|
Graphic aGraphic( aBmpEx );
|
2004-03-30 14:44:43 +00:00
|
|
|
( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_HANDOUT:
|
|
|
|
{
|
|
|
|
//Erste Standardseite am SdrPageObj vermerken
|
2009-11-23 16:27:16 +01:00
|
|
|
// #i105146# We want no content to be displayed for PK_HANDOUT,
|
|
|
|
// so just never set a page as content
|
|
|
|
pSdrObj = new SdrPageObj(0);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_PAGE:
|
|
|
|
{
|
|
|
|
//Notizseite am SdrPageObj vermerken
|
2004-07-12 13:56:14 +00:00
|
|
|
sal_uInt16 nDestPageNum(GetPageNum());
|
|
|
|
|
|
|
|
if(nDestPageNum)
|
|
|
|
{
|
|
|
|
// decrement only when != 0, else we get a 0xffff
|
|
|
|
nDestPageNum -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nDestPageNum < pModel->GetPageCount())
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrPageObj();
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
pSdrObj->SetResizeProtect(sal_True);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_HEADER:
|
|
|
|
case PRESOBJ_FOOTER:
|
|
|
|
case PRESOBJ_DATETIME:
|
|
|
|
case PRESOBJ_SLIDENUMBER:
|
|
|
|
{
|
|
|
|
pSdrObj = new SdrRectObj(OBJ_TEXT);
|
|
|
|
bEmptyPresObj = false;
|
|
|
|
bForceText = true;
|
|
|
|
}
|
|
|
|
break;
|
2006-12-12 15:33:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pSdrObj)
|
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
pSdrObj->SetEmptyPresObj(bEmptyPresObj);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSdrObj->SetLogicRect(rRect);
|
2003-03-27 09:58:12 +00:00
|
|
|
|
2000-09-22 07:16:57 +00:00
|
|
|
InsertObject(pSdrObj);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if ( pSdrObj->ISA(SdrTextObj) )
|
|
|
|
{
|
2011-02-07 22:11:09 +01:00
|
|
|
// Tell the object EARLY that it is vertical to have the
|
2002-01-04 12:24:47 +00:00
|
|
|
// defaults for AutoGrowWidth/Height reversed
|
|
|
|
if(bVertical)
|
2011-01-17 11:41:00 +01:00
|
|
|
((SdrTextObj*)pSdrObj)->SetVerticalWriting(sal_True);
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2002-01-04 12:24:47 +00:00
|
|
|
SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
2001-02-26 09:20:50 +00:00
|
|
|
if( bVertical )
|
|
|
|
aTempAttr.Put( SdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
|
|
|
|
else
|
|
|
|
aTempAttr.Put( SdrTextMinFrameHeightItem( rRect.GetSize().Height() ) );
|
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// Bei Praesentationsobjekten auf der MasterPage soll die
|
|
|
|
// Groesse vom Benutzwer frei waehlbar sein
|
2002-01-04 12:24:47 +00:00
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// potential problem: This action was still NOT
|
2002-01-04 12:24:47 +00:00
|
|
|
// adapted for vertical text. This sure needs to be done.
|
|
|
|
if(bVertical)
|
2011-01-17 11:41:00 +01:00
|
|
|
aTempAttr.Put(SdrTextAutoGrowWidthItem(sal_False));
|
2002-01-04 12:24:47 +00:00
|
|
|
else
|
2011-01-17 11:41:00 +01:00
|
|
|
aTempAttr.Put(SdrTextAutoGrowHeightItem(sal_False));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
// check if we need another vertical adjustement than the default
|
|
|
|
SdrTextVertAdjust eV = SDRTEXTVERTADJUST_TOP;
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind != PK_STANDARD) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
eV = SDRTEXTVERTADJUST_BOTTOM;
|
|
|
|
}
|
2006-12-12 15:33:13 +00:00
|
|
|
else if( (eObjKind == PRESOBJ_SLIDENUMBER) && (mePageKind != PK_STANDARD) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
eV = SDRTEXTVERTADJUST_BOTTOM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( eV != SDRTEXTVERTADJUST_TOP )
|
|
|
|
aTempAttr.Put(SdrTextVertAdjustItem(eV));
|
|
|
|
|
2003-11-24 16:08:17 +00:00
|
|
|
pSdrObj->SetMergedItemSet(aTempAttr);
|
2004-03-30 14:44:43 +00:00
|
|
|
|
|
|
|
pSdrObj->SetLogicRect(rRect);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2001-03-19 08:53:25 +00:00
|
|
|
String aString = GetPresObjText(eObjKind);
|
2004-03-30 14:44:43 +00:00
|
|
|
if( (aString.Len() || bForceText) && pSdrObj->ISA(SdrTextObj) )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SdrOutliner* pOutliner = ( (SdDrawDocument*) GetModel() )->GetInternalOutliner();
|
2001-03-19 08:53:25 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nOutlMode = pOutliner->GetMode();
|
2000-09-18 23:16:46 +00:00
|
|
|
pOutliner->Init( OUTLINERMODE_TEXTOBJECT );
|
2001-12-14 10:37:49 +00:00
|
|
|
pOutliner->SetStyleSheet( 0, NULL );
|
2001-02-26 09:20:50 +00:00
|
|
|
pOutliner->SetVertical( bVertical );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
String aEmptyStr;
|
2001-03-19 08:53:25 +00:00
|
|
|
SetObjText( (SdrTextObj*) pSdrObj, (SdrOutliner*)pOutliner, eObjKind, aString );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
pOutliner->Init( nOutlMode );
|
|
|
|
pOutliner->SetStyleSheet( 0, NULL );
|
|
|
|
}
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) )
|
|
|
|
{
|
|
|
|
SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
|
|
|
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) );
|
|
|
|
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) );
|
|
|
|
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) );
|
|
|
|
|
|
|
|
SvxAdjust eH = SVX_ADJUST_LEFT;
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if( (eObjKind == PRESOBJ_DATETIME) && (mePageKind != PK_STANDARD ) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
eH = SVX_ADJUST_RIGHT;
|
|
|
|
}
|
2006-12-12 15:33:13 +00:00
|
|
|
else if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind == PK_STANDARD ) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
eH = SVX_ADJUST_CENTER;
|
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_SLIDENUMBER )
|
|
|
|
{
|
|
|
|
eH = SVX_ADJUST_RIGHT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( eH != SVX_ADJUST_LEFT )
|
2007-05-10 14:22:46 +00:00
|
|
|
aTempAttr.Put(SvxAdjustItem(eH, EE_PARA_JUST ));
|
2004-03-30 14:44:43 +00:00
|
|
|
|
|
|
|
pSdrObj->SetMergedItemSet(aTempAttr);
|
|
|
|
}
|
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
|
|
|
|
|
2010-02-11 17:35:16 +01:00
|
|
|
// Hintergrundobjekte der MasterPage
|
|
|
|
pSdrObj->SetLayer( rLayerAdmin.
|
2011-01-17 11:41:00 +01:00
|
|
|
GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Objekt am StyleSheet anmelden
|
2011-02-07 22:11:09 +01:00
|
|
|
// Set style only when one was found (as in 5.2)
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind != PK_HANDOUT )
|
2004-08-02 13:25:09 +00:00
|
|
|
{
|
|
|
|
SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind);
|
|
|
|
if(pSheetForPresObj)
|
2011-01-17 11:41:00 +01:00
|
|
|
pSdrObj->SetStyleSheet(pSheetForPresObj, sal_False);
|
2004-08-02 13:25:09 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (eObjKind == PRESOBJ_OUTLINE)
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
String aName(maLayoutName);
|
2000-09-18 23:16:46 +00:00
|
|
|
aName += sal_Unicode( ' ' );
|
|
|
|
aName += String::CreateFromInt32( nLevel );
|
2008-03-12 10:27:32 +00:00
|
|
|
SfxStyleSheet* pSheet = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
|
|
|
|
if (pSheet)
|
|
|
|
pSdrObj->StartListening(*pSheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( eObjKind == PRESOBJ_OBJECT ||
|
|
|
|
eObjKind == PRESOBJ_CHART ||
|
|
|
|
eObjKind == PRESOBJ_ORGCHART ||
|
2010-02-23 00:23:09 +01:00
|
|
|
eObjKind == PRESOBJ_CALC ||
|
2000-09-18 23:16:46 +00:00
|
|
|
eObjKind == PRESOBJ_GRAPHIC )
|
|
|
|
{
|
|
|
|
SfxItemSet aSet( ((SdDrawDocument*) pModel)->GetPool() );
|
2011-01-17 11:41:00 +01:00
|
|
|
aSet.Put( SdrTextContourFrameItem( sal_True ) );
|
2007-05-10 14:22:46 +00:00
|
|
|
aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
|
2000-10-30 10:50:43 +00:00
|
|
|
|
2003-11-24 16:08:17 +00:00
|
|
|
pSdrObj->SetMergedItemSet(aSet);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
{
|
|
|
|
pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
{
|
|
|
|
pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pSdrObj ) );
|
|
|
|
pUndoManager->AddUndoAction( new UndoObjectUserCall(*pSdrObj) );
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertPresObj(pSdrObj, eObjKind);
|
|
|
|
pSdrObj->SetUserCall(this);
|
|
|
|
|
|
|
|
pSdrObj->RecalcBoundRect();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(pSdrObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Es werden Praesentationsobjekte auf der Page erzeugt.
|
|
|
|
|* Alle Praesentationsobjekte erhalten einen UserCall auf die Page.
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2010-02-09 11:33:08 +01:00
|
|
|
SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
|
|
|
|
{
|
|
|
|
String aName(GetLayoutName());
|
|
|
|
String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nPos = aName.Search(aSep);
|
2010-02-09 11:33:08 +01:00
|
|
|
|
|
|
|
if (nPos != STRING_NOTFOUND)
|
|
|
|
{
|
|
|
|
nPos = nPos + aSep.Len();
|
|
|
|
aName.Erase(nPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
aName += String(SdResId(STR_LAYOUT_BACKGROUND));
|
|
|
|
|
|
|
|
SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
|
|
|
|
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
|
|
|
return (SfxStyleSheet*)pResult;
|
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
String aName(GetLayoutName());
|
|
|
|
String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nPos = aName.Search(aSep);
|
2000-09-18 23:16:46 +00:00
|
|
|
if (nPos != STRING_NOTFOUND)
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
nPos = nPos + aSep.Len();
|
2000-09-18 23:16:46 +00:00
|
|
|
aName.Erase(nPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (eObjKind)
|
|
|
|
{
|
|
|
|
case PRESOBJ_OUTLINE:
|
|
|
|
{
|
|
|
|
aName = GetLayoutName();
|
|
|
|
aName += sal_Unicode( ' ' );
|
|
|
|
aName += String::CreateFromInt32( 1 );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_TITLE:
|
|
|
|
aName += String(SdResId(STR_LAYOUT_TITLE));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_NOTES:
|
|
|
|
aName += String(SdResId(STR_LAYOUT_NOTES));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_TEXT:
|
|
|
|
aName += String(SdResId(STR_LAYOUT_SUBTITLE));
|
2004-03-30 14:44:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_HEADER:
|
|
|
|
case PRESOBJ_FOOTER:
|
|
|
|
case PRESOBJ_DATETIME:
|
|
|
|
case PRESOBJ_SLIDENUMBER:
|
|
|
|
aName += String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
|
2008-03-12 10:27:32 +00:00
|
|
|
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
return (SfxStyleSheet*)pResult;
|
|
|
|
}
|
|
|
|
|
2005-02-17 08:40:54 +00:00
|
|
|
/** returns the presentation style with the given helpid from this masterpage or this
|
|
|
|
slides masterpage */
|
|
|
|
SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
|
|
|
|
{
|
|
|
|
String aStyleName( pPage->GetLayoutName() );
|
|
|
|
const String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
|
|
|
|
aStyleName.Erase(aStyleName.Search(aSep) + aSep.Len());
|
|
|
|
|
|
|
|
sal_uInt16 nNameId;
|
|
|
|
switch( nHelpId )
|
|
|
|
{
|
|
|
|
case HID_PSEUDOSHEET_TITLE: nNameId = STR_LAYOUT_TITLE; break;
|
|
|
|
case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_LAYOUT_SUBTITLE; break;
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE1:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE2:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE3:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE4:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE5:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE6:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE7:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE8:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_LAYOUT_OUTLINE; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_LAYOUT_BACKGROUNDOBJECTS; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_LAYOUT_BACKGROUND; break;
|
|
|
|
case HID_PSEUDOSHEET_NOTES: nNameId = STR_LAYOUT_NOTES; break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL( "SdPage::getPresentationStyle(), illegal argument!" );
|
2005-02-17 08:40:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
aStyleName.Append( String( SdResId( nNameId ) ) );
|
|
|
|
if( nNameId == STR_LAYOUT_OUTLINE )
|
|
|
|
{
|
|
|
|
aStyleName.Append( sal_Unicode( ' ' ));
|
|
|
|
aStyleName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
|
2008-03-12 10:27:32 +00:00
|
|
|
SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SD_STYLE_FAMILY_MASTERPAGE);
|
2005-02-17 08:40:54 +00:00
|
|
|
return dynamic_cast<SdStyleSheet*>(pResult);
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Das Praesentationsobjekt rObj hat sich geaendert und wird nicht mehr
|
|
|
|
|* durch das Praesentationsobjekt der MasterPage referenziert.
|
|
|
|
|* Der UserCall wird geloescht.
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if (!maLockAutoLayoutArrangement.isLocked())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
switch (eType)
|
|
|
|
{
|
|
|
|
case SDRUSERCALL_MOVEONLY:
|
|
|
|
case SDRUSERCALL_RESIZE:
|
|
|
|
{
|
2001-02-19 12:13:01 +00:00
|
|
|
if( pModel->isLocked() )
|
|
|
|
break;
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
SdrObject* pObj = (SdrObject*) &rObj;
|
|
|
|
|
|
|
|
if (pObj)
|
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if (!mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pObj->GetUserCall() )
|
|
|
|
{
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
|
2010-12-02 22:57:42 +01:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction( new UndoObjectUserCall(*pObj) );
|
|
|
|
|
|
|
|
// Objekt was resized by user and does not listen to its slide anymore
|
|
|
|
pObj->SetUserCall(0);
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else if (pModel)
|
|
|
|
{
|
|
|
|
// MasterPage-Objekt wurde veraendert, daher
|
|
|
|
// Objekte auf allen Seiten anpassen
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nPageCount = ((SdDrawDocument*) pModel)->GetSdPageCount(mePageKind);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uInt16 i = 0; i < nPageCount; i++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SdPage* pLoopPage = ((SdDrawDocument*) pModel)->GetSdPage(i, mePageKind);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// Seite hoert auf diese MasterPage, daher
|
|
|
|
// AutoLayout anpassen
|
2006-12-12 15:33:13 +00:00
|
|
|
pLoopPage->SetAutoLayout(pLoopPage->GetAutoLayout());
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SDRUSERCALL_DELETE:
|
|
|
|
case SDRUSERCALL_REMOVED:
|
|
|
|
default:
|
2006-01-10 13:26:36 +00:00
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Erzeugt auf einer MasterPage Hintergrund, Titel- und Layout-Bereich
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
|
2006-01-10 13:26:36 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
SdPage* pMasterPage = this;
|
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (!mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-07-12 13:56:14 +00:00
|
|
|
pMasterPage = (SdPage*)(&(TRG_GetMasterPage()));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!pMasterPage)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* Hintergrund, Titel- und Layout-Bereich werden angelegt
|
|
|
|
**************************************************************************/
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind == PK_STANDARD )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-02-09 11:33:08 +01:00
|
|
|
pMasterPage->EnsureMasterPageDefaultBackground();
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if( ( (SdDrawDocument*) GetModel() )->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind == PK_HANDOUT && bInit )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
// handout template
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
// delete all available handout presentation objects
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObject* pObj;
|
2006-12-12 15:33:13 +00:00
|
|
|
while( (pObj = pMasterPage->GetPresObj(PRESOBJ_HANDOUT)) != 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
|
|
|
|
|
|
|
|
pMasterPage->RemoveObject(pObj->GetOrdNum());
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2008-03-06 15:25:55 +00:00
|
|
|
std::vector< Rectangle > aAreas;
|
|
|
|
CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2008-03-06 15:25:55 +00:00
|
|
|
const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
|
|
|
|
std::vector< Rectangle >::iterator iter( aAreas.begin() );
|
2009-11-23 16:27:16 +01:00
|
|
|
|
2008-03-06 15:25:55 +00:00
|
|
|
while( iter != aAreas.end() )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pMasterPage->CreatePresObj(PRESOBJ_HANDOUT, sal_False, (*iter++), sal_True) );
|
2009-11-23 16:27:16 +01:00
|
|
|
// #i105146# We want no content to be displayed for PK_HANDOUT,
|
|
|
|
// so just never set a page as content
|
|
|
|
pPageObj->SetReferencedPage(0L);
|
2004-07-12 13:56:14 +00:00
|
|
|
|
2008-03-06 15:25:55 +00:00
|
|
|
if( bSkip && iter != aAreas.end() )
|
2011-01-01 20:53:07 +00:00
|
|
|
++iter;
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind != PK_HANDOUT )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
SdrObject* pMasterTitle = pMasterPage->GetPresObj( PRESOBJ_TITLE );
|
|
|
|
if( pMasterTitle == NULL )
|
|
|
|
pMasterPage->CreateDefaultPresObj(PRESOBJ_TITLE, true);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
SdrObject* pMasterOutline = pMasterPage->GetPresObj( mePageKind==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
|
2004-03-30 14:44:43 +00:00
|
|
|
if( pMasterOutline == NULL )
|
2006-12-12 15:33:13 +00:00
|
|
|
pMasterPage->CreateDefaultPresObj( mePageKind == PK_STANDARD ? PRESOBJ_OUTLINE : PRESOBJ_NOTES, true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
// create header&footer objects
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if( bCreate )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind != PK_STANDARD )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
SdrObject* pHeader = pMasterPage->GetPresObj( PRESOBJ_HEADER );
|
|
|
|
if( pHeader == NULL )
|
|
|
|
pMasterPage->CreateDefaultPresObj( PRESOBJ_HEADER, true );
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
SdrObject* pDate = pMasterPage->GetPresObj( PRESOBJ_DATETIME );
|
|
|
|
if( pDate == NULL )
|
|
|
|
pMasterPage->CreateDefaultPresObj( PRESOBJ_DATETIME, true );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
SdrObject* pFooter = pMasterPage->GetPresObj( PRESOBJ_FOOTER );
|
|
|
|
if( pFooter == NULL )
|
|
|
|
pMasterPage->CreateDefaultPresObj( PRESOBJ_FOOTER, true );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
SdrObject* pNumber = pMasterPage->GetPresObj( PRESOBJ_SLIDENUMBER );
|
|
|
|
if( pNumber == NULL )
|
|
|
|
pMasterPage->CreateDefaultPresObj( PRESOBJ_SLIDENUMBER, true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
|
|
|
|
{
|
|
|
|
if( eObjKind == PRESOBJ_TITLE )
|
|
|
|
{
|
|
|
|
Rectangle aTitleRect( GetTitleRect() );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj(PRESOBJ_TITLE, sal_False, aTitleRect, bInsert);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_OUTLINE )
|
|
|
|
{
|
|
|
|
Rectangle aLayoutRect( GetLayoutRect() );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_OUTLINE, sal_False, aLayoutRect, bInsert);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_NOTES )
|
|
|
|
{
|
|
|
|
Rectangle aLayoutRect( GetLayoutRect() );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_NOTES, sal_False, aLayoutRect, bInsert);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
|
|
|
|
{
|
|
|
|
// create footer objects for standard master page
|
2006-12-12 15:33:13 +00:00
|
|
|
if( mePageKind == PK_STANDARD )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
const long nLftBorder = GetLftBorder();
|
|
|
|
const long nUppBorder = GetUppBorder();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
Point aTitlePos ( nLftBorder, nUppBorder );
|
|
|
|
Size aPageSize ( GetSize() );
|
|
|
|
aPageSize.Width() -= nLftBorder + GetRgtBorder();
|
|
|
|
aPageSize.Height() -= nUppBorder + GetLwrBorder();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
const int Y = long(nUppBorder + aPageSize.Height() * 0.911);
|
|
|
|
const int W1 = long(aPageSize.Width() * 0.233);
|
|
|
|
const int W2 = long(aPageSize.Width() * 0.317);
|
|
|
|
const int H = long(aPageSize.Height() * 0.069);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if( eObjKind == PRESOBJ_DATETIME )
|
|
|
|
{
|
|
|
|
Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y );
|
|
|
|
Size aSize( W1, H );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_FOOTER )
|
|
|
|
{
|
|
|
|
Point aPos( long(nLftBorder+ aPageSize.Width() * 0.342), Y );
|
|
|
|
Size aSize( W2, H );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_SLIDENUMBER )
|
|
|
|
{
|
|
|
|
Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y );
|
|
|
|
Size aSize( W1, H );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
|
2004-03-30 14:44:43 +00:00
|
|
|
return NULL;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
else
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
// create header&footer objects for handout and notes master
|
|
|
|
Point aTitlePos ( GetLftBorder(), GetUppBorder() );
|
|
|
|
Size aPageSize ( GetSize() );
|
|
|
|
aPageSize.Width() -= GetLftBorder() + GetRgtBorder();
|
|
|
|
aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434);
|
|
|
|
const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05);
|
|
|
|
|
|
|
|
Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT );
|
|
|
|
|
|
|
|
const int X1 = GetLftBorder();
|
|
|
|
const int X2 = GetLftBorder() + long(aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH);
|
|
|
|
const int Y1 = GetUppBorder();
|
|
|
|
const int Y2 = GetUppBorder() + long(aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
|
|
|
|
|
|
|
|
if( eObjKind == PRESOBJ_HEADER )
|
|
|
|
{
|
|
|
|
Point aPos( X1, Y1 );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_HEADER, sal_False, aRect, bInsert );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else if( eObjKind == PRESOBJ_DATETIME )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
Point aPos( X2, Y1 );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
else if( eObjKind == PRESOBJ_FOOTER )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
Point aPos( X1, Y2 );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
else if( eObjKind == PRESOBJ_SLIDENUMBER )
|
|
|
|
{
|
|
|
|
Point aPos( X2, Y2 );
|
|
|
|
Rectangle aRect( aPos, aSize );
|
2011-01-17 11:41:00 +01:00
|
|
|
return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
|
2004-03-30 14:44:43 +00:00
|
|
|
return NULL;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
else
|
|
|
|
{
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL("SdPage::CreateDefaultPresObj() - unknown PRESOBJ kind" );
|
2004-03-30 14:44:43 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2001-04-26 16:11:09 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Titelbereich zurueckgeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
Rectangle SdPage::GetTitleRect() const
|
|
|
|
{
|
|
|
|
Rectangle aTitleRect;
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind != PK_HANDOUT)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
/******************************************************************
|
|
|
|
* Standard- oder Notiz-Seite: Titelbereich
|
|
|
|
******************************************************************/
|
|
|
|
Point aTitlePos ( GetLftBorder(), GetUppBorder() );
|
|
|
|
Size aTitleSize ( GetSize() );
|
|
|
|
aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
|
|
|
|
aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind == PK_STANDARD)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
aTitlePos.X() += long( aTitleSize.Width() * 0.05 );
|
|
|
|
aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 );
|
|
|
|
aTitleSize.Width() = long( aTitleSize.Width() * 0.9 );
|
2000-09-18 23:16:46 +00:00
|
|
|
aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
|
|
|
|
}
|
2006-12-12 15:33:13 +00:00
|
|
|
else if (mePageKind == PK_NOTES)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
Point aPos = aTitlePos;
|
|
|
|
aPos.Y() += long( aTitleSize.Height() * 0.076 );
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
// Hoehe beschraenken
|
2004-03-30 14:44:43 +00:00
|
|
|
aTitleSize.Height() = (long) (aTitleSize.Height() * 0.375);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
Size aPartArea = aTitleSize;
|
|
|
|
Size aSize;
|
2004-07-12 13:56:14 +00:00
|
|
|
sal_uInt16 nDestPageNum(GetPageNum());
|
2006-12-12 15:33:13 +00:00
|
|
|
SdrPage* pRefPage = 0L;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-07-12 13:56:14 +00:00
|
|
|
if(nDestPageNum)
|
|
|
|
{
|
|
|
|
// only decrement if != 0, else we get 0xffff
|
|
|
|
nDestPageNum -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nDestPageNum < pModel->GetPageCount())
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
pRefPage = pModel->GetPage(nDestPageNum);
|
2004-07-12 13:56:14 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if ( pRefPage )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
|
2006-12-12 15:33:13 +00:00
|
|
|
double fH = (double) aPartArea.Width() / pRefPage->GetWdt();
|
|
|
|
double fV = (double) aPartArea.Height() / pRefPage->GetHgt();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if ( fH > fV )
|
|
|
|
fH = fV;
|
2006-12-12 15:33:13 +00:00
|
|
|
aSize.Width() = (long) (fH * pRefPage->GetWdt());
|
|
|
|
aSize.Height() = (long) (fH * pRefPage->GetHgt());
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
|
|
|
|
aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
aTitlePos = aPos;
|
|
|
|
aTitleSize = aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
aTitleRect.SetPos(aTitlePos);
|
|
|
|
aTitleRect.SetSize(aTitleSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aTitleRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Gliederungsbereich zurueckgeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
Rectangle SdPage::GetLayoutRect() const
|
|
|
|
{
|
|
|
|
Rectangle aLayoutRect;
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind != PK_HANDOUT)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
Point aLayoutPos ( GetLftBorder(), GetUppBorder() );
|
|
|
|
Size aLayoutSize ( GetSize() );
|
|
|
|
aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
|
|
|
|
aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind == PK_STANDARD)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 );
|
|
|
|
aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 );
|
2011-08-17 23:30:02 +08:00
|
|
|
aLayoutSize.Width() = long( aLayoutSize.Width() * 0.88 );
|
|
|
|
aLayoutSize.Height() = long( aLayoutSize.Height() * 0.58 );
|
2000-09-18 23:16:46 +00:00
|
|
|
aLayoutRect.SetPos(aLayoutPos);
|
|
|
|
aLayoutRect.SetSize(aLayoutSize);
|
|
|
|
}
|
2006-12-12 15:33:13 +00:00
|
|
|
else if (mePageKind == PK_NOTES)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 );
|
|
|
|
aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 );
|
|
|
|
aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 );
|
|
|
|
aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 );
|
2000-09-18 23:16:46 +00:00
|
|
|
aLayoutRect.SetPos(aLayoutPos);
|
|
|
|
aLayoutRect.SetSize(aLayoutSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aLayoutRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|*
|
|
|
|
|* Diese Methode weist ein AutoLayout zu
|
|
|
|
|*
|
|
|
|
\*************************************************************************/
|
|
|
|
|
2009-05-19 09:32:45 +00:00
|
|
|
const int MAX_PRESOBJS = 7; // maximum number of presentation objects per layout
|
2006-01-10 13:26:36 +00:00
|
|
|
const int VERTICAL = 0x8000;
|
|
|
|
|
|
|
|
struct LayoutDescriptor
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
int mnLayout;
|
|
|
|
PresObjKind meKind[MAX_PRESOBJS];
|
|
|
|
bool mbVertical[MAX_PRESOBJS];
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2009-05-19 09:32:45 +00:00
|
|
|
LayoutDescriptor( int nLayout, int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0, int k5 = 0, int k6 = 0 );
|
2006-01-10 13:26:36 +00:00
|
|
|
};
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2009-05-19 09:32:45 +00:00
|
|
|
LayoutDescriptor::LayoutDescriptor( int nLayout, int k0, int k1, int k2, int k3, int k4, int k5, int k6 )
|
2006-01-10 13:26:36 +00:00
|
|
|
: mnLayout( nLayout )
|
|
|
|
{
|
|
|
|
meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL;
|
|
|
|
meKind[1] = static_cast<PresObjKind>(k1 & (~VERTICAL)); mbVertical[1] = (k1 & VERTICAL) == VERTICAL;
|
|
|
|
meKind[2] = static_cast<PresObjKind>(k2 & (~VERTICAL)); mbVertical[2] = (k2 & VERTICAL) == VERTICAL;
|
|
|
|
meKind[3] = static_cast<PresObjKind>(k3 & (~VERTICAL)); mbVertical[3] = (k3 & VERTICAL) == VERTICAL;
|
|
|
|
meKind[4] = static_cast<PresObjKind>(k4 & (~VERTICAL)); mbVertical[4] = (k4 & VERTICAL) == VERTICAL;
|
2009-05-19 16:03:18 +00:00
|
|
|
meKind[5] = static_cast<PresObjKind>(k5 & (~VERTICAL)); mbVertical[5] = (k5 & VERTICAL) == VERTICAL;
|
2009-05-19 09:32:45 +00:00
|
|
|
meKind[6] = static_cast<PresObjKind>(k6 & (~VERTICAL)); mbVertical[6] = (k6 & VERTICAL) == VERTICAL;
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
static const LayoutDescriptor& GetLayoutDescriptor( AutoLayout eLayout )
|
|
|
|
{
|
|
|
|
static LayoutDescriptor aLayouts[AUTOLAYOUT__END-AUTOLAYOUT__START] =
|
|
|
|
{
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TEXT ), // AUTOLAYOUT_TITLE
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ENUM
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHART
|
2006-01-10 13:26:36 +00:00
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2TEXT
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCHART
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ORG
|
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCLbIP
|
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHARTTEXT
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TAB
|
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CLIPTEXT
|
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
|
2006-01-10 13:26:36 +00:00
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OBJECT ), // AUTOLAYOUT_OBJ
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 2, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXT2OBJ
|
|
|
|
LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
|
|
|
|
LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_OBJOVERTEXT
|
|
|
|
LayoutDescriptor( 3, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJTEXT
|
|
|
|
LayoutDescriptor( 5, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJOVERTEXT
|
|
|
|
LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOVEROBJ
|
|
|
|
LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4OBJ
|
|
|
|
PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),
|
2006-01-10 13:26:36 +00:00
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TITLE
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_NONE ), // AUTOLAYOUT_NONE
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_PAGE, PRESOBJ_NOTES ), // AUTOLAYOUT_NOTES
|
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT1
|
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT2
|
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT3
|
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT4
|
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT6
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 7, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE ),// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
|
2006-01-10 13:26:36 +00:00
|
|
|
LayoutDescriptor( 8, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
|
|
|
|
LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 9, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
|
2008-07-01 12:33:23 +00:00
|
|
|
LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT9
|
2009-05-19 09:32:45 +00:00
|
|
|
LayoutDescriptor( 10, PRESOBJ_TEXT, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TEXT
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4CLIPART
|
2009-05-19 09:32:45 +00:00
|
|
|
PRESOBJ_GRAPHIC, PRESOBJ_GRAPHIC ),
|
2009-12-03 18:53:41 +01:00
|
|
|
LayoutDescriptor( 11, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_6CLIPART
|
|
|
|
PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE )
|
2006-01-10 13:26:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if( (eLayout < AUTOLAYOUT__START) || (eLayout >= AUTOLAYOUT__END) )
|
|
|
|
eLayout = AUTOLAYOUT_NONE;
|
|
|
|
|
|
|
|
return aLayouts[ eLayout - AUTOLAYOUT__START ];
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRectangle )
|
|
|
|
{
|
2000-09-18 23:16:46 +00:00
|
|
|
Rectangle aTitleRect;
|
|
|
|
Rectangle aLayoutRect;
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( rPage.GetPageKind() != PK_HANDOUT )
|
|
|
|
{
|
|
|
|
SdPage& rMasterPage = static_cast<SdPage&>(rPage.TRG_GetMasterPage());
|
|
|
|
SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
|
|
|
|
SdrObject* pMasterOutline = rMasterPage.GetPresObj( rPage.GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pMasterTitle )
|
|
|
|
aTitleRect = pMasterTitle->GetLogicRect();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if (aTitleRect.IsEmpty() )
|
2006-01-10 13:26:36 +00:00
|
|
|
aTitleRect = rPage.GetTitleRect();
|
|
|
|
|
|
|
|
if( pMasterOutline )
|
|
|
|
aLayoutRect = pMasterOutline->GetLogicRect();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if (aLayoutRect.IsEmpty() )
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutRect = rPage.GetLayoutRect();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
rRectangle[0] = aTitleRect;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
for( i = 1; i < MAX_PRESOBJS; i++ )
|
|
|
|
rRectangle[i] = aLayoutRect;
|
|
|
|
|
2002-08-01 10:30:12 +00:00
|
|
|
Size aTitleSize( aTitleRect.GetSize() );
|
|
|
|
Point aTitlePos( aTitleRect.TopLeft() );
|
|
|
|
Size aLayoutSize( aLayoutRect.GetSize() );
|
|
|
|
Point aLayoutPos( aLayoutRect.TopLeft() );
|
|
|
|
Size aTempSize;
|
|
|
|
Point aTempPnt;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
sal_Bool bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
switch( nLayout )
|
|
|
|
{
|
|
|
|
case 0: // default layout using only the title and layout area
|
|
|
|
break; // do nothing
|
|
|
|
case 1: // title, 2 shapes
|
|
|
|
case 9: // title, 2 vertical shapes
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bRightToLeft && (nLayout != 9) )
|
|
|
|
::std::swap< Rectangle >( rRectangle[1], rRectangle[2] );
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
case 2: // title, shape, 2 shapes
|
|
|
|
aTempPnt = aLayoutPos;
|
|
|
|
aTempSize = aLayoutSize;
|
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos = aTempPnt;
|
|
|
|
aLayoutSize = aTempSize;
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bRightToLeft )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
|
|
|
|
rRectangle[3].Left() = rRectangle[2].Left();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
case 3: // title, 2 shapes, shape
|
|
|
|
aTempPnt = aLayoutPos;
|
|
|
|
aTempSize = aLayoutSize;
|
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos = aTempPnt;
|
|
|
|
aLayoutSize = aTempSize;
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bRightToLeft )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
|
|
|
|
rRectangle[3].Left() = rRectangle[2].Left();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
case 4: // title, shape above shape
|
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
case 5: // title, 2 shapes above shape
|
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aTempPnt = aLayoutPos;
|
|
|
|
aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.X() = aTempPnt.X();
|
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
|
|
|
|
rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
case 6: // title, 4 shapes
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nX = long (aLayoutPos.X());
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
aLayoutPos.X() = nX;
|
|
|
|
rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
|
|
|
case 7: // vertical title, shape above shape
|
|
|
|
{
|
|
|
|
Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
|
|
|
|
rRectangle[0].SetSize( aSize );
|
|
|
|
rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
Size aPageSize ( rPage.GetSize() );
|
|
|
|
aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
|
2006-01-10 13:26:36 +00:00
|
|
|
aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
|
2006-12-12 15:33:13 +00:00
|
|
|
aSize.Width() = long( aPageSize.Width() * 0.7 );
|
2006-01-10 13:26:36 +00:00
|
|
|
rRectangle[1].SetPos( aTitleRect.TopLeft() );
|
|
|
|
rRectangle[1].SetSize( aSize );
|
|
|
|
|
|
|
|
aSize.Height() = rRectangle[0].GetSize().Height();
|
|
|
|
Point aPos( aTitleRect.TopLeft() );
|
|
|
|
aPos.Y() += long ( aSize.Height() * 0.53 );
|
|
|
|
rRectangle[2].SetPos( aPos );
|
|
|
|
aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
|
|
|
|
rRectangle[2].SetSize( aSize );
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
|
|
|
case 8: // vertical title, shape
|
|
|
|
{
|
|
|
|
Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
|
|
|
|
rRectangle[0].SetSize( aSize );
|
|
|
|
rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
Size aPageSize ( rPage.GetSize() );
|
|
|
|
aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
|
2006-01-10 13:26:36 +00:00
|
|
|
aSize.Height() = rRectangle[0].GetSize().Height();
|
2006-12-12 15:33:13 +00:00
|
|
|
aSize.Width() = long( aPageSize.Width() * 0.7 );
|
2006-01-10 13:26:36 +00:00
|
|
|
rRectangle[1].SetPos( aTitleRect.TopLeft() );
|
|
|
|
rRectangle[1].SetSize( aSize );
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
2008-12-11 15:25:59 +00:00
|
|
|
case 10: // onlytext
|
|
|
|
{
|
2009-05-19 16:03:18 +00:00
|
|
|
Size aSize( rRectangle[0].GetSize().Width(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
|
|
|
|
rRectangle[0].SetSize( aSize );
|
|
|
|
rRectangle[0].SetPos( aTitlePos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 11: // title, 6 shapes
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nX = long (aLayoutPos.X());
|
2009-05-19 16:03:18 +00:00
|
|
|
|
|
|
|
aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
|
|
|
|
aLayoutSize.Width() = long (aLayoutSize.Width() * 0.322);
|
|
|
|
rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
|
|
|
aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
|
|
|
aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05);
|
|
|
|
rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
|
|
|
aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
|
|
|
|
rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
|
|
|
aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
|
|
|
|
rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
|
|
|
aLayoutPos.X() = nX;
|
|
|
|
rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize);
|
|
|
|
|
2008-12-11 15:25:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-05-19 09:32:45 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
|
2010-02-25 18:04:05 +01:00
|
|
|
void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit, bool bSwitchLayout )
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// init list of indexes for each presentation shape kind
|
|
|
|
// this is used to find subsequent shapes with the same presentation shape kind
|
|
|
|
int PresObjIndex[PRESOBJ_MAX];
|
|
|
|
for( i = 0; i < PRESOBJ_MAX; i++ ) PresObjIndex[i] = 1;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
bool bMissing = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// for each entry in the layoutdescriptor, arrange a presentation shape
|
|
|
|
for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
|
|
|
|
{
|
|
|
|
PresObjKind eKind = rDescriptor.meKind[i];
|
2010-02-09 18:14:49 +01:00
|
|
|
SdrObject* pObj = 0;
|
|
|
|
while( (pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind], true )) != 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind
|
2010-02-09 18:14:49 +01:00
|
|
|
|
2010-02-25 18:04:05 +01:00
|
|
|
if( !bSwitchLayout || !pObj->IsEmptyPresObj() )
|
2010-02-09 18:14:49 +01:00
|
|
|
{
|
|
|
|
rShapes[i] = pObj;
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2010-02-09 18:14:49 +01:00
|
|
|
|
|
|
|
if( !pObj )
|
2006-01-10 13:26:36 +00:00
|
|
|
bMissing = true;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bMissing && bInit )
|
|
|
|
{
|
|
|
|
// for each entry in the layoutdescriptor, look for an alternative shape
|
|
|
|
for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( rShapes[i] )
|
|
|
|
continue;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
PresObjKind eKind = rDescriptor.meKind[i];
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObject* pObj = 0;
|
|
|
|
bool bFound = false;
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
const int nShapeCount = rPage.GetObjCount();
|
|
|
|
int nShapeIndex = 0;
|
|
|
|
while((nShapeIndex < nShapeCount) && !bFound )
|
2001-03-12 14:50:38 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
pObj = rPage.GetObj(nShapeIndex++);
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pObj->IsEmptyPresObj() )
|
|
|
|
continue;
|
2001-08-09 11:48:54 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pObj->GetObjInventor() != SdrInventor )
|
|
|
|
continue;
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// do not reuse shapes that are already part of the layout
|
|
|
|
if( std::find( rShapes.begin(), rShapes.end(), pObj ) != rShapes.end() )
|
|
|
|
continue;
|
2001-08-09 11:48:54 +00:00
|
|
|
|
2008-03-12 10:27:32 +00:00
|
|
|
bool bPresStyle = pObj->GetStyleSheet() && (pObj->GetStyleSheet()->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE);
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObjKind eSdrObjKind = static_cast< SdrObjKind >( pObj->GetObjIdentifier() );
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
switch( eKind )
|
|
|
|
{
|
|
|
|
case PRESOBJ_TITLE:
|
|
|
|
bFound = eSdrObjKind == OBJ_TITLETEXT;
|
|
|
|
break;
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_TABLE:
|
|
|
|
bFound = eSdrObjKind == OBJ_TABLE;
|
|
|
|
break;
|
|
|
|
case PRESOBJ_MEDIA:
|
|
|
|
bFound = eSdrObjKind == OBJ_MEDIA;
|
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
case PRESOBJ_OUTLINE:
|
2010-02-09 18:14:49 +01:00
|
|
|
bFound = (eSdrObjKind == OBJ_OUTLINETEXT) ||
|
|
|
|
((eSdrObjKind == OBJ_TEXT) && bPresStyle) ||
|
|
|
|
(eSdrObjKind == OBJ_TABLE) || (eSdrObjKind == OBJ_MEDIA) || (eSdrObjKind == OBJ_GRAF) || (eSdrObjKind == OBJ_OLE2);
|
2006-01-10 13:26:36 +00:00
|
|
|
break;
|
|
|
|
case PRESOBJ_GRAPHIC:
|
|
|
|
bFound = eSdrObjKind == OBJ_GRAF;
|
|
|
|
break;
|
|
|
|
case PRESOBJ_OBJECT:
|
2008-04-04 11:45:00 +00:00
|
|
|
if( eSdrObjKind == OBJ_OLE2 )
|
|
|
|
{
|
|
|
|
SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
|
|
|
|
if( pOle2 )
|
|
|
|
{
|
|
|
|
if( pOle2->IsEmpty() )
|
|
|
|
bFound = true;
|
|
|
|
else if( rPage.GetModel() )
|
|
|
|
{
|
|
|
|
SdrModel* pSdrModel = rPage.GetModel();
|
|
|
|
::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
|
|
|
|
if( pPersist )
|
|
|
|
{
|
|
|
|
uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
|
|
|
|
GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
|
|
|
|
|
|
|
|
// TODO CL->KA: Why is this not working anymore?
|
|
|
|
if( xObject.is() )
|
|
|
|
{
|
|
|
|
SvGlobalName aClassId( xObject->getClassID() );
|
|
|
|
|
|
|
|
const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
|
|
|
|
const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
|
|
|
|
const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
|
|
|
|
|
|
|
|
if( aPluginClassId != aClassId && aAppletClassId != aClassId && aIFrameClassId != aClassId )
|
|
|
|
{
|
|
|
|
bFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
break;
|
|
|
|
case PRESOBJ_CHART:
|
2010-02-23 00:23:09 +01:00
|
|
|
case PRESOBJ_CALC:
|
2006-01-10 13:26:36 +00:00
|
|
|
if( eSdrObjKind == OBJ_OLE2 )
|
|
|
|
{
|
|
|
|
SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
|
|
|
|
if( pOle2 )
|
|
|
|
{
|
|
|
|
if(
|
|
|
|
((eKind == PRESOBJ_CHART) &&
|
|
|
|
( pOle2->GetProgName().EqualsAscii( "StarChart" ) || pOle2->IsChart() ) )
|
|
|
|
||
|
2010-02-23 00:23:09 +01:00
|
|
|
((eKind == PRESOBJ_CALC) &&
|
2006-01-10 13:26:36 +00:00
|
|
|
( pOle2->GetProgName().EqualsAscii( "StarCalc" ) || pOle2->IsCalc() ) ) )
|
|
|
|
{
|
|
|
|
bFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-02-09 18:14:49 +01:00
|
|
|
else if( eSdrObjKind == OBJ_TABLE )
|
|
|
|
{
|
|
|
|
bFound = true;
|
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
break;
|
|
|
|
case PRESOBJ_PAGE:
|
|
|
|
case PRESOBJ_HANDOUT:
|
|
|
|
bFound = eSdrObjKind == OBJ_PAGE;
|
|
|
|
break;
|
|
|
|
case PRESOBJ_NOTES:
|
|
|
|
case PRESOBJ_TEXT:
|
|
|
|
bFound = (bPresStyle && (eSdrObjKind == OBJ_TEXT)) || (eSdrObjKind == OBJ_OUTLINETEXT);
|
|
|
|
break;
|
2006-12-12 15:33:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
2001-03-12 14:50:38 +00:00
|
|
|
}
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bFound )
|
|
|
|
rShapes[i] = pObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-08-09 11:48:54 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetAutoLayout(AutoLayout eLayout, sal_Bool bInit, sal_Bool bCreate )
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2010-02-25 18:04:05 +01:00
|
|
|
const bool bSwitchLayout = eLayout != GetAutoLayout();
|
|
|
|
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
meAutoLayout = eLayout;
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// if needed, creates and initialises the presentation shapes on this slides master page
|
|
|
|
CreateTitleAndLayout(bInit, bCreate);
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if((meAutoLayout == AUTOLAYOUT_NONE && maPresentationShapeList.isEmpty()) || mbMaster)
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
// MasterPage or no layout and no presentation shapes available, noting to do
|
|
|
|
return;
|
|
|
|
}
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
Rectangle aRectangle[MAX_PRESOBJS];
|
2006-12-12 15:33:13 +00:00
|
|
|
const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
|
2006-01-10 13:26:36 +00:00
|
|
|
CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle );
|
2001-02-26 09:20:50 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
std::set< SdrObject* > aUsedPresentationObjects;
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2001-08-09 11:48:54 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
|
2010-02-25 18:04:05 +01:00
|
|
|
findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout );
|
2003-11-24 16:08:17 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
int i;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// for each entry in the layoutdescriptor, arrange a presentation shape
|
|
|
|
for( i = 0; (i < PRESOBJ_MAX) && (aDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
|
|
|
|
{
|
|
|
|
PresObjKind eKind = aDescriptor.meKind[i];
|
|
|
|
SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit );
|
|
|
|
if( pObj )
|
|
|
|
aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// now delete all empty presentation objects that are no longer used by the new layout
|
|
|
|
if( bInit )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObject* pObj = maPresentationShapeList.getNextShape(0);
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
while( pObj )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
|
|
|
|
if( aUsedPresentationObjects.count(pObj) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
if( pObj->IsEmptyPresObj() )
|
|
|
|
{
|
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
|
|
|
|
|
|
|
|
RemoveObject( pObj->GetOrdNum() );
|
|
|
|
|
|
|
|
if( !bUndo )
|
2007-07-06 08:47:24 +00:00
|
|
|
SdrObject::Free( pObj );
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
2010-12-02 22:57:42 +01:00
|
|
|
/* #i108541# keep non empty pres obj as pres obj even if they are not part of the current layout */
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
pObj = pNext;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2001-03-19 08:53:25 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Objekt einfuegen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::NbcInsertObject(SdrObject* pObj, sal_uLong nPos, const SdrInsertReason* pReason)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
FmFormPage::NbcInsertObject(pObj, nPos, pReason);
|
|
|
|
|
|
|
|
((SdDrawDocument*) pModel)->InsertObject(pObj, this);
|
|
|
|
|
|
|
|
SdrLayerID nId = pObj->GetLayer();
|
2008-11-19 14:05:59 +00:00
|
|
|
if( mbMaster )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if( nId == 0 )
|
|
|
|
pObj->NbcSetLayer( 2 ); // wrong layer. corrected to BackgroundObj layer
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( nId == 2 )
|
|
|
|
pObj->NbcSetLayer( 0 ); // wrong layer. corrected to layout layer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Objekt loeschen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrObject* SdPage::RemoveObject(sal_uLong nObjNum)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
onRemoveObject(GetObj( nObjNum ));
|
|
|
|
return FmFormPage::RemoveObject(nObjNum);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Objekt loeschen, ohne Broadcast
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrObject* SdPage::NbcRemoveObject(sal_uLong nObjNum)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
onRemoveObject(GetObj( nObjNum ));
|
|
|
|
return FmFormPage::NbcRemoveObject(nObjNum);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// Also overload ReplaceObject methods to realize when
|
2001-12-13 14:57:04 +00:00
|
|
|
// objects are removed with this mechanism instead of RemoveObject
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrObject* SdPage::NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
|
2001-12-13 14:57:04 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
onRemoveObject(GetObj( nObjNum ));
|
|
|
|
return FmFormPage::NbcReplaceObject(pNewObj, nObjNum);
|
2001-12-13 14:57:04 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// Also overload ReplaceObject methods to realize when
|
2001-12-13 14:57:04 +00:00
|
|
|
// objects are removed with this mechanism instead of RemoveObject
|
2011-01-17 11:41:00 +01:00
|
|
|
SdrObject* SdPage::ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
|
2001-12-13 14:57:04 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
onRemoveObject(GetObj( nObjNum ));
|
|
|
|
return FmFormPage::ReplaceObject(pNewObj, nObjNum);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// called after a shape is removed or replaced from this slide
|
|
|
|
|
|
|
|
void SdPage::onRemoveObject( SdrObject* pObject )
|
|
|
|
{
|
|
|
|
if( pObject )
|
|
|
|
{
|
|
|
|
RemovePresObj(pObject);
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject, this);
|
|
|
|
|
|
|
|
removeAnimations( pObject );
|
|
|
|
}
|
2001-12-13 14:57:04 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2001-02-26 09:20:50 +00:00
|
|
|
void SdPage::SetSize(const Size& aSize)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
Size aOldSize = GetSize();
|
|
|
|
|
|
|
|
if (aSize != aOldSize)
|
|
|
|
{
|
|
|
|
FmFormPage::SetSize(aSize);
|
|
|
|
|
|
|
|
if (aOldSize.Height() == 10 && aOldSize.Width() == 10)
|
|
|
|
{
|
|
|
|
// Die Seite bekommt erstmalig eine gueltige Groesse gesetzt,
|
|
|
|
// daher wird nun die Orientation initialisiert
|
|
|
|
if (aSize.Width() > aSize.Height())
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
meOrientation = ORIENTATION_LANDSCAPE;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
meOrientation = ORIENTATION_PORTRAIT;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nLft != GetLftBorder() || nUpp != GetUppBorder() ||
|
|
|
|
nRgt != GetRgtBorder() || nLwr != GetLwrBorder() )
|
|
|
|
{
|
|
|
|
FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetLftBorder(sal_Int32 nBorder)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nBorder != GetLftBorder() )
|
|
|
|
{
|
|
|
|
FmFormPage::SetLftBorder(nBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetRgtBorder(sal_Int32 nBorder)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nBorder != GetRgtBorder() )
|
|
|
|
{
|
|
|
|
FmFormPage::SetRgtBorder(nBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetUppBorder(sal_Int32 nBorder)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nBorder != GetUppBorder() )
|
|
|
|
{
|
|
|
|
FmFormPage::SetUppBorder(nBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetLwrBorder(sal_Int32 nBorder)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nBorder != GetLwrBorder() )
|
|
|
|
{
|
|
|
|
FmFormPage::SetLwrBorder(nBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Setzt BackgroundFullSize und ruft dann AdjustBackground auf
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::SetBackgroundFullSize( sal_Bool bIn )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
if( bIn != mbBackgroundFullSize )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
mbBackgroundFullSize = bIn;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Alle Objekte an neue Seitengroesse anpassen
|
|
|
|
|*
|
|
|
|
|* bScaleAllObj: Alle Objekte werden in die neue Flaeche innerhalb der
|
|
|
|
|* Seitenraender skaliert. Dabei werden die Position, Groesse und bei
|
|
|
|
|* Praesentationsobjekten auf der MasterPage auch die Schrifthoehe der
|
|
|
|
|* Praesentationsvorlagen skaliert.
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect, sal_Bool bScaleAllObj)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
mbScaleObjects = bScaleAllObj;
|
2000-09-18 23:16:46 +00:00
|
|
|
SdrObject* pObj = NULL;
|
|
|
|
Point aRefPnt(0, 0);
|
|
|
|
Size aNewPageSize(rNewPageSize);
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_Int32 nLeft = rNewBorderRect.Left();
|
|
|
|
sal_Int32 nRight = rNewBorderRect.Right();
|
|
|
|
sal_Int32 nUpper = rNewBorderRect.Top();
|
|
|
|
sal_Int32 nLower = rNewBorderRect.Bottom();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// Negative Werte stehen fuer nicht zu aendernde Werte
|
|
|
|
// -> aktuelle Werte verwenden
|
|
|
|
if (aNewPageSize.Width() < 0)
|
|
|
|
{
|
|
|
|
aNewPageSize.Width() = GetWdt();
|
|
|
|
}
|
|
|
|
if (aNewPageSize.Height() < 0)
|
|
|
|
{
|
|
|
|
aNewPageSize.Height() = GetHgt();
|
|
|
|
}
|
|
|
|
if (nLeft < 0)
|
|
|
|
{
|
|
|
|
nLeft = GetLftBorder();
|
|
|
|
}
|
|
|
|
if (nRight < 0)
|
|
|
|
{
|
|
|
|
nRight = GetRgtBorder();
|
|
|
|
}
|
|
|
|
if (nUpper < 0)
|
|
|
|
{
|
|
|
|
nUpper = GetUppBorder();
|
|
|
|
}
|
|
|
|
if (nLower < 0)
|
|
|
|
{
|
|
|
|
nLower = GetLwrBorder();
|
|
|
|
}
|
|
|
|
|
|
|
|
Point aBackgroundPos(nLeft, nUpper);
|
|
|
|
Size aBackgroundSize(aNewPageSize);
|
|
|
|
Rectangle aBorderRect (aBackgroundPos, aBackgroundSize);
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mbScaleObjects)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aBackgroundSize.Width() -= nLeft + nRight;
|
|
|
|
aBackgroundSize.Height() -= nUpper + nLower;
|
|
|
|
aBorderRect.SetSize(aBackgroundSize);
|
|
|
|
aNewPageSize = aBackgroundSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
long nOldWidth = GetWdt() - GetLftBorder() - GetRgtBorder();
|
|
|
|
long nOldHeight = GetHgt() - GetUppBorder() - GetLwrBorder();
|
|
|
|
|
|
|
|
Fraction aFractX = Fraction(aNewPageSize.Width(), nOldWidth);
|
|
|
|
Fraction aFractY = Fraction(aNewPageSize.Height(), nOldHeight);
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nObjCnt = (mbScaleObjects ? GetObjCount() : 0);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uLong nObj = 0; nObj < nObjCnt; nObj++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_Bool bIsPresObjOnMaster = sal_False;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
// Alle Objekte
|
|
|
|
pObj = GetObj(nObj);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster && IsPresObj(pObj))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
// Es ist ein Praesentationsobjekt auf der MasterPage
|
2011-01-17 11:41:00 +01:00
|
|
|
bIsPresObjOnMaster = sal_True;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pObj)
|
|
|
|
{
|
2011-02-07 22:11:09 +01:00
|
|
|
// remember aTopLeft as original TopLeft
|
2003-11-24 16:08:17 +00:00
|
|
|
Point aTopLeft(pObj->GetCurrentBoundRect().TopLeft());
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2010-02-11 17:35:16 +01:00
|
|
|
if (!pObj->IsEdgeObj())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
/**************************************************************
|
|
|
|
* Objekt skalieren
|
|
|
|
**************************************************************/
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mbScaleObjects)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-02-07 22:11:09 +01:00
|
|
|
// use aTopLeft as original TopLeft
|
2001-06-13 11:00:17 +00:00
|
|
|
aRefPnt = aTopLeft;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pObj->Resize(aRefPnt, aFractX, aFractY);
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mbScaleObjects)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SdrObjKind eObjKind = (SdrObjKind) pObj->GetObjIdentifier();
|
|
|
|
|
|
|
|
if (bIsPresObjOnMaster)
|
|
|
|
{
|
|
|
|
/**********************************************************
|
|
|
|
* Praesentationsvorlage: Texthoehe anpassen
|
|
|
|
**********************************************************/
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nIndexTitle = 0;
|
|
|
|
sal_uInt16 nIndexOutline = 0;
|
|
|
|
sal_uInt16 nIndexNotes = 0;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (pObj == GetPresObj(PRESOBJ_TITLE, nIndexTitle))
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SfxStyleSheet* pTitleSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (pTitleSheet)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SfxItemSet& rSet = pTitleSheet->GetItemSet();
|
2000-11-16 12:55:39 +00:00
|
|
|
|
|
|
|
SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT);
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nFontHeight = rOldHgt.GetHeight();
|
2000-09-18 23:16:46 +00:00
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
2000-11-16 12:55:39 +00:00
|
|
|
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
|
|
|
|
|
2000-12-20 14:50:13 +00:00
|
|
|
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
|
|
|
|
{
|
|
|
|
rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CJK);
|
|
|
|
nFontHeight = rOldHgt.GetHeight();
|
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
|
|
|
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
|
|
|
|
}
|
2000-11-16 12:55:39 +00:00
|
|
|
|
2000-12-20 14:50:13 +00:00
|
|
|
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
|
|
|
|
{
|
|
|
|
rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CTL);
|
|
|
|
nFontHeight = rOldHgt.GetHeight();
|
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
|
|
|
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
|
|
|
|
}
|
2000-11-16 12:55:39 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
pTitleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pObj == GetPresObj(PRESOBJ_OUTLINE, nIndexOutline))
|
|
|
|
{
|
|
|
|
String aName(GetLayoutName());
|
|
|
|
aName += sal_Unicode( ' ' );
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uInt16 i=1; i<=9; i++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
String sLayoutName(aName);
|
|
|
|
sLayoutName += String::CreateFromInt32( (sal_Int32)i );
|
2008-03-12 10:27:32 +00:00
|
|
|
SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)((SdDrawDocument*) pModel)->GetStyleSheetPool()->Find(sLayoutName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (pOutlineSheet)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
// Neue Fonthoehe berechnen
|
2006-12-12 15:33:13 +00:00
|
|
|
SfxItemSet aTempSet(pOutlineSheet->GetItemSet());
|
2000-11-16 12:55:39 +00:00
|
|
|
|
|
|
|
SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT);
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nFontHeight = rOldHgt.GetHeight();
|
2000-09-18 23:16:46 +00:00
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
2000-11-16 12:55:39 +00:00
|
|
|
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
|
|
|
|
|
2000-12-20 14:50:13 +00:00
|
|
|
if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
|
|
|
|
{
|
|
|
|
rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK);
|
|
|
|
nFontHeight = rOldHgt.GetHeight();
|
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
|
|
|
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
|
|
|
|
}
|
2000-11-16 12:55:39 +00:00
|
|
|
|
2000-12-20 14:50:13 +00:00
|
|
|
if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
|
|
|
|
{
|
|
|
|
rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL);
|
|
|
|
nFontHeight = rOldHgt.GetHeight();
|
|
|
|
nFontHeight = long(nFontHeight * (double) aFractY);
|
|
|
|
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// Bullet anpassen
|
2011-01-17 11:41:00 +01:00
|
|
|
((SdStyleSheet*) pOutlineSheet)->AdjustToFontHeight(aTempSet, sal_False);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// Sonderbehandlung: die INVALIDS auf NULL-Pointer
|
|
|
|
// zurueckgesetzen (sonst landen INVALIDs oder
|
|
|
|
// Pointer auf die DefaultItems in der Vorlage;
|
|
|
|
// beides wuerde die Attribut-Vererbung unterbinden)
|
|
|
|
aTempSet.ClearInvalidItems();
|
|
|
|
|
|
|
|
// Sonderbehandlung: nur die gueltigen Anteile des
|
|
|
|
// BulletItems
|
2000-12-20 14:50:13 +00:00
|
|
|
if (aTempSet.GetItemState(EE_PARA_BULLET) == SFX_ITEM_AVAILABLE)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SvxBulletItem aOldBulItem((SvxBulletItem&) pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET));
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxBulletItem& rNewBulItem = (SvxBulletItem&) aTempSet.Get(EE_PARA_BULLET);
|
|
|
|
aOldBulItem.CopyValidProperties(rNewBulItem);
|
|
|
|
aTempSet.Put(aOldBulItem);
|
|
|
|
}
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
pOutlineSheet->GetItemSet().Put(aTempSet);
|
|
|
|
pOutlineSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pObj == GetPresObj(PRESOBJ_NOTES, nIndexNotes))
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SfxStyleSheet* pNotesSheet = GetStyleSheetForPresObj(PRESOBJ_NOTES);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (pNotesSheet)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height();
|
|
|
|
sal_uLong nFontHeight = (sal_uLong) (nHeight * 0.0741);
|
2006-12-12 15:33:13 +00:00
|
|
|
SfxItemSet& rSet = pNotesSheet->GetItemSet();
|
2007-05-10 14:22:46 +00:00
|
|
|
rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT ));
|
|
|
|
rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK ));
|
|
|
|
rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL ));
|
2006-12-12 15:33:13 +00:00
|
|
|
pNotesSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( eObjKind != OBJ_TITLETEXT &&
|
|
|
|
eObjKind != OBJ_OUTLINETEXT &&
|
|
|
|
pObj->ISA(SdrTextObj) &&
|
|
|
|
pObj->GetOutlinerParaObject() )
|
|
|
|
{
|
|
|
|
/******************************************************
|
|
|
|
* Normales Textobjekt: Texthoehe anpassen
|
|
|
|
******************************************************/
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
|
|
|
|
sal_uInt16 nWhich = EE_CHAR_FONTHEIGHT;
|
2000-12-20 14:50:13 +00:00
|
|
|
if ( nScriptType == SCRIPTTYPE_ASIAN )
|
|
|
|
nWhich = EE_CHAR_FONTHEIGHT_CJK;
|
|
|
|
else if ( nScriptType == SCRIPTTYPE_COMPLEX )
|
|
|
|
nWhich = EE_CHAR_FONTHEIGHT_CTL;
|
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// use more modern method to scale the text height
|
2003-11-24 16:08:17 +00:00
|
|
|
sal_uInt32 nFontHeight = ((SvxFontHeightItem&)pObj->GetMergedItem(nWhich)).GetHeight();
|
2001-06-13 09:39:01 +00:00
|
|
|
sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY);
|
2003-11-24 16:08:17 +00:00
|
|
|
|
|
|
|
pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mbScaleObjects && !pObj->IsEdgeObj())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
/**************************************************************
|
|
|
|
* Objektposition skalieren
|
|
|
|
**************************************************************/
|
2001-06-13 11:00:17 +00:00
|
|
|
Point aNewPos;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// corrected scaling; only distances may be scaled
|
|
|
|
// use aTopLeft as original TopLeft
|
2001-06-13 11:00:17 +00:00
|
|
|
aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * (double)aFractX) + nLeft;
|
|
|
|
aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * (double)aFractY) + nUpper;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2001-06-13 11:00:17 +00:00
|
|
|
Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y());
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (aVec.Height() != 0 || aVec.Width() != 0)
|
|
|
|
{
|
|
|
|
pObj->NbcMove(aVec);
|
|
|
|
}
|
|
|
|
|
2003-11-24 16:08:17 +00:00
|
|
|
pObj->SetChanged();
|
|
|
|
pObj->BroadcastObjectChange();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 15:55:14 +02:00
|
|
|
SdrObject* convertPresentationObjectImpl( SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, Rectangle aRect )
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
|
|
|
|
DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
|
|
|
|
if( !pModel || !pSourceObj )
|
|
|
|
return pSourceObj;
|
|
|
|
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted();
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
SdrObject* pNewObj = pSourceObj;
|
2010-02-08 18:01:46 +01:00
|
|
|
if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() == OBJ_TEXT) )
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
pNewObj = rPage.CreatePresObj(PRESOBJ_OUTLINE, bVertical, aRect);
|
|
|
|
|
|
|
|
// Text des Untertitels in das PRESOBJ_OUTLINE setzen
|
|
|
|
OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
|
|
|
|
|
|
|
|
if(pOutlParaObj)
|
|
|
|
{
|
|
|
|
// Text umsetzen
|
2011-01-17 11:41:00 +01:00
|
|
|
::sd::Outliner* pOutl = pModel->GetInternalOutliner( sal_True );
|
2006-01-10 13:26:36 +00:00
|
|
|
pOutl->Clear();
|
|
|
|
pOutl->SetText( *pOutlParaObj );
|
|
|
|
pOutlParaObj = pOutl->CreateParaObject();
|
|
|
|
pNewObj->SetOutlinerParaObject( pOutlParaObj );
|
|
|
|
pOutl->Clear();
|
2011-01-17 11:41:00 +01:00
|
|
|
pNewObj->SetEmptyPresObj(sal_False);
|
2006-01-10 13:26:36 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
// Neue Vorlage zuweisen
|
|
|
|
String aName(rPage.GetLayoutName());
|
|
|
|
aName += sal_Unicode( ' ' );
|
|
|
|
aName += String::CreateFromInt32( nLevel );
|
2008-03-12 10:27:32 +00:00
|
|
|
SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
if (pSheet)
|
|
|
|
{
|
|
|
|
if (nLevel == 1)
|
|
|
|
{
|
|
|
|
SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
|
|
|
|
|
|
|
|
if (pSubtitleSheet)
|
2008-03-12 10:27:32 +00:00
|
|
|
pOutlParaObj->ChangeStyleSheetName(SD_STYLE_FAMILY_MASTERPAGE, pSubtitleSheet->GetName(), pSheet->GetName());
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
pNewObj->StartListening(*pSheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LRSpace-Item loeschen
|
|
|
|
SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
|
|
|
|
|
|
|
|
aSet.Put(pNewObj->GetMergedItemSet());
|
|
|
|
|
|
|
|
aSet.ClearItem(EE_PARA_LRSPACE);
|
|
|
|
|
|
|
|
pNewObj->SetMergedItemSet(aSet);
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
|
|
|
|
|
|
|
|
// Remove outline shape from page
|
|
|
|
rPage.RemoveObject( pSourceObj->GetOrdNum() );
|
|
|
|
|
|
|
|
if( !bUndo )
|
2007-07-06 08:47:24 +00:00
|
|
|
SdrObject::Free( pSourceObj );
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-08 18:01:46 +01:00
|
|
|
else if((eObjKind == PRESOBJ_TEXT) && (pSourceObj->GetObjIdentifier() == OBJ_OUTLINETEXT) )
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
// is there an outline shape we can use to replace empty subtitle shape?
|
|
|
|
pNewObj = rPage.CreatePresObj(PRESOBJ_TEXT, bVertical, aRect);
|
|
|
|
|
|
|
|
// Text des Gliederungsobjekts in das PRESOBJ_TITLE setzen
|
|
|
|
OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
|
|
|
|
|
|
|
|
if(pOutlParaObj)
|
|
|
|
{
|
|
|
|
// Text umsetzen
|
|
|
|
::sd::Outliner* pOutl = pModel->GetInternalOutliner();
|
|
|
|
pOutl->Clear();
|
|
|
|
pOutl->SetText( *pOutlParaObj );
|
|
|
|
pOutlParaObj = pOutl->CreateParaObject();
|
|
|
|
pNewObj->SetOutlinerParaObject( pOutlParaObj );
|
|
|
|
pOutl->Clear();
|
2011-01-17 11:41:00 +01:00
|
|
|
pNewObj->SetEmptyPresObj(sal_False);
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
// Linken Einzug zuruecksetzen
|
|
|
|
SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
|
|
|
|
|
|
|
|
aSet.Put(pNewObj->GetMergedItemSet());
|
|
|
|
|
|
|
|
const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE);
|
|
|
|
SvxLRSpaceItem aNewLRItem(rLRItem);
|
|
|
|
aNewLRItem.SetTxtLeft(0);
|
|
|
|
aSet.Put(aNewLRItem);
|
|
|
|
|
|
|
|
pNewObj->SetMergedItemSet(aSet);
|
|
|
|
|
|
|
|
SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
|
|
|
|
if (pSheet)
|
2011-01-17 11:41:00 +01:00
|
|
|
pNewObj->SetStyleSheet(pSheet, sal_True);
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
// Remove subtitle shape from page
|
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
|
|
|
|
|
|
|
|
rPage.RemoveObject( pSourceObj->GetOrdNum() );
|
|
|
|
|
|
|
|
if( !bUndo )
|
2007-07-06 08:47:24 +00:00
|
|
|
SdrObject::Free( pSourceObj );
|
2006-01-10 13:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-17 15:55:14 +02:00
|
|
|
else if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() != OBJ_OUTLINETEXT) )
|
|
|
|
{
|
|
|
|
switch( pSourceObj->GetObjIdentifier() )
|
|
|
|
{
|
|
|
|
case OBJ_TABLE: eObjKind = PRESOBJ_TABLE; break;
|
|
|
|
case OBJ_MEDIA: eObjKind = PRESOBJ_MEDIA; break;
|
|
|
|
case OBJ_GRAF: eObjKind = PRESOBJ_GRAPHIC; break;
|
|
|
|
case OBJ_OLE2: eObjKind = PRESOBJ_OBJECT; break;
|
|
|
|
}
|
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
|
|
|
|
return pNewObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** reuses or creates a presentation shape for an auto layout that fits the given parameter
|
|
|
|
|
|
|
|
@param eObjKind
|
|
|
|
The kind of presentation shape we like to have
|
|
|
|
@param nIndex
|
|
|
|
If > 1 we skip the first nIndex-1 shapes with the presentation shape kind eObjKind while
|
|
|
|
looking for an existing presentation shape
|
|
|
|
@param bVertical
|
|
|
|
If true, the shape is created vertical if bInit is true
|
|
|
|
@param aRect
|
|
|
|
The rectangle that should be used to transform the shape
|
|
|
|
@param bInit
|
|
|
|
If true the shape is created if not found
|
|
|
|
@returns
|
|
|
|
A presentation shape that was either found or created with the given parameters
|
|
|
|
*/
|
|
|
|
SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2010-11-04 12:11:17 +01:00
|
|
|
::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
|
2010-10-22 15:00:39 +02:00
|
|
|
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (!pObj && bInit)
|
|
|
|
{
|
2001-02-26 09:20:50 +00:00
|
|
|
pObj = CreatePresObj(eObjKind, bVertical, aRect);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else if ( pObj && (pObj->GetUserCall() || bInit) )
|
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
// convert object if shape type does not match kind (f.e. converting outline text to subtitle text)
|
|
|
|
if( bInit )
|
|
|
|
pObj = convertPresentationObjectImpl( *this, pObj, eObjKind, bVertical, aRect );
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
{
|
|
|
|
pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
|
2011-01-17 11:41:00 +01:00
|
|
|
pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, sal_True, sal_True ) );
|
2006-01-10 13:26:36 +00:00
|
|
|
pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
|
|
|
|
}
|
|
|
|
|
2010-02-23 00:23:09 +01:00
|
|
|
( /*(SdrGrafObj*)*/ pObj)->AdjustToMaxRect( aRect );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
pObj->SetUserCall(this);
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >(pObj);
|
|
|
|
if( pTextObject )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pTextObject->IsVerticalWriting() != (bVertical ? sal_True : sal_False) )
|
2001-11-20 10:24:16 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetVerticalWriting( bVertical );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// here make sure the correct anchoring is used when the object
|
2001-11-20 10:24:16 +00:00
|
|
|
// is re-used but orientation is changed
|
|
|
|
if(PRESOBJ_OUTLINE == eObjKind)
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetMergedItem(SdrTextHorzAdjustItem( bVertical ? SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_BLOCK ));
|
2001-11-20 10:24:16 +00:00
|
|
|
}
|
|
|
|
|
2010-02-09 18:14:49 +01:00
|
|
|
if( !mbMaster && (pTextObject->GetObjIdentifier() != OBJ_TABLE) )
|
2001-02-26 09:20:50 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if ( pTextObject->IsAutoGrowHeight() )
|
2001-06-22 10:24:53 +00:00
|
|
|
{
|
|
|
|
// switch off AutoGrowHeight, set new MinHeight
|
|
|
|
SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
|
|
|
SdrTextMinFrameHeightItem aMinHeight( aRect.GetSize().Height() );
|
|
|
|
aTempAttr.Put( aMinHeight );
|
2011-01-17 11:41:00 +01:00
|
|
|
aTempAttr.Put( SdrTextAutoGrowHeightItem(sal_False) );
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetMergedItemSet(aTempAttr);
|
|
|
|
pTextObject->SetLogicRect(aRect);
|
2001-06-22 10:24:53 +00:00
|
|
|
|
|
|
|
// switch on AutoGrowHeight
|
|
|
|
SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
2011-01-17 11:41:00 +01:00
|
|
|
aAttr.Put( SdrTextAutoGrowHeightItem(sal_True) );
|
2001-06-22 10:24:53 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetMergedItemSet(aAttr);
|
2001-06-22 10:24:53 +00:00
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if ( pTextObject->IsAutoGrowWidth() )
|
2001-06-22 10:24:53 +00:00
|
|
|
{
|
|
|
|
// switch off AutoGrowWidth , set new MinWidth
|
|
|
|
SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
|
|
|
SdrTextMinFrameWidthItem aMinWidth( aRect.GetSize().Width() );
|
|
|
|
aTempAttr.Put( aMinWidth );
|
2011-01-17 11:41:00 +01:00
|
|
|
aTempAttr.Put( SdrTextAutoGrowWidthItem(sal_False) );
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetMergedItemSet(aTempAttr);
|
|
|
|
pTextObject->SetLogicRect(aRect);
|
2001-06-22 10:24:53 +00:00
|
|
|
|
|
|
|
// switch on AutoGrowWidth
|
|
|
|
SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
|
2011-01-17 11:41:00 +01:00
|
|
|
aAttr.Put( SdrTextAutoGrowWidthItem(sal_True) );
|
2006-01-10 13:26:36 +00:00
|
|
|
pTextObject->SetMergedItemSet(aAttr);
|
2001-06-22 10:24:53 +00:00
|
|
|
}
|
2001-02-26 09:20:50 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
if(pObj && bInit )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( !IsPresObj( pObj ) )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( bUndo )
|
|
|
|
pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
InsertPresObj( pObj, eObjKind );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
// make adjustments for vertical title and outline shapes
|
|
|
|
if( bVertical && (( eObjKind == PRESOBJ_TITLE) || (eObjKind == PRESOBJ_OUTLINE)))
|
|
|
|
{
|
|
|
|
SfxItemSet aNewSet(pObj->GetMergedItemSet());
|
2011-01-17 11:41:00 +01:00
|
|
|
aNewSet.Put( SdrTextAutoGrowWidthItem(sal_True) );
|
|
|
|
aNewSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
|
2006-01-10 13:26:36 +00:00
|
|
|
if( eObjKind == PRESOBJ_OUTLINE )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
aNewSet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
|
|
|
|
aNewSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2006-01-10 13:26:36 +00:00
|
|
|
pObj->SetMergedItemSet(aNewSet);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-04 10:48:35 +02:00
|
|
|
if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
|
2010-02-23 00:23:09 +01:00
|
|
|
pObj->AdjustToMaxRect( aRect );
|
2010-01-28 18:27:41 +01:00
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
return pObj;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Liefert den PresObjKind eines Objektes zurueck
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
PresObjKind SdPage::GetPresObjKind(SdrObject* pObj) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
PresObjKind eKind = PRESOBJ_NONE;
|
|
|
|
if( (pObj != 0) && (maPresentationShapeList.hasShape(*pObj)) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
|
|
|
|
if( pInfo )
|
|
|
|
eKind = pInfo->mePresObjKind;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
return eKind;
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SdPage::IsPresObj(const SdrObject* pObj)
|
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
return pObj && maPresentationShapeList.hasShape( const_cast<SdrObject&>(*pObj) );
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SdPage::RemovePresObj(const SdrObject* pObj)
|
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
if( pObj && maPresentationShapeList.hasShape(const_cast<SdrObject&>(*pObj)) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(const_cast<SdrObject&>(*pObj));
|
|
|
|
if( pInfo )
|
|
|
|
pInfo->mePresObjKind = PRESOBJ_NONE;
|
|
|
|
maPresentationShapeList.removeShape(const_cast<SdrObject&>(*pObj));
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdPage::InsertPresObj(SdrObject* pObj, PresObjKind eKind )
|
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
DBG_ASSERT( pObj, "sd::SdPage::InsertPresObj(), invalid presentation object inserted!" );
|
|
|
|
DBG_ASSERT( !IsPresObj(pObj), "sd::SdPage::InsertPresObj(), presentation object inserted twice!" );
|
2004-03-30 14:44:43 +00:00
|
|
|
if( pObj )
|
|
|
|
{
|
2006-01-10 13:26:36 +00:00
|
|
|
SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
|
|
|
|
if( pInfo )
|
|
|
|
pInfo->mePresObjKind = eKind;
|
|
|
|
maPresentationShapeList.addShape(*pObj);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Text des Objektes setzen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rString )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( pObj )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: Kein SdrTextObj!" );
|
2004-03-30 14:44:43 +00:00
|
|
|
::Outliner* pOutl = pOutliner;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (!pOutliner)
|
|
|
|
{
|
|
|
|
SfxItemPool* pPool = ((SdDrawDocument*) GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
|
2004-03-30 14:44:43 +00:00
|
|
|
pOutl = new ::Outliner( pPool, OUTLINERMODE_OUTLINEOBJECT );
|
2002-07-26 07:32:44 +00:00
|
|
|
pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *( (SdDrawDocument*) GetModel() )->GetDocSh() ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
pOutl->SetEditTextObjectPool(pPool);
|
|
|
|
pOutl->SetStyleSheetPool((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool());
|
2011-01-17 11:41:00 +01:00
|
|
|
pOutl->EnableUndo(sal_False);
|
|
|
|
pOutl->SetUpdateMode( sal_False );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nOutlMode = pOutl->GetMode();
|
2000-09-18 23:16:46 +00:00
|
|
|
Size aPaperSize = pOutl->GetPaperSize();
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_Bool bUpdateMode = pOutl->GetUpdateMode();
|
|
|
|
pOutl->SetUpdateMode(sal_False);
|
2000-09-18 23:16:46 +00:00
|
|
|
pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
|
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// Always set the object's StyleSheet at the Outliner to
|
2001-12-14 10:37:49 +00:00
|
|
|
// use the current objects StyleSheet. Thus it's the same as in
|
|
|
|
// SetText(...).
|
2011-02-07 22:11:09 +01:00
|
|
|
// Moved this implementation from where SetObjText(...) was called
|
2001-12-14 10:37:49 +00:00
|
|
|
// to inside this method to work even when outliner is fetched here.
|
|
|
|
pOutl->SetStyleSheet(0, pObj->GetStyleSheet());
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
String aString;
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
switch( eObjKind )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-30 14:44:43 +00:00
|
|
|
case PRESOBJ_OUTLINE:
|
|
|
|
{
|
|
|
|
pOutl->Init( OUTLINERMODE_OUTLINEOBJECT );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += sal_Unicode( '\t' );
|
|
|
|
aString += rString;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
pOutl->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind) );
|
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER2 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER3 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER4 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER5 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER6 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t" ));
|
|
|
|
aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER7 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PRESOBJ_TITLE:
|
|
|
|
{
|
|
|
|
pOutl->Init( OUTLINERMODE_TITLEOBJECT );
|
|
|
|
aString += rString;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
pOutl->Init( OUTLINERMODE_TEXTOBJECT );
|
|
|
|
aString += rString;
|
|
|
|
|
|
|
|
// check if we need to add a text field
|
|
|
|
SvxFieldData* pData = NULL;
|
|
|
|
|
|
|
|
switch( eObjKind )
|
|
|
|
{
|
|
|
|
case PRESOBJ_HEADER:
|
|
|
|
pData = new SvxHeaderField();
|
|
|
|
break;
|
|
|
|
case PRESOBJ_FOOTER:
|
|
|
|
pData = new SvxFooterField();
|
|
|
|
break;
|
|
|
|
case PRESOBJ_SLIDENUMBER:
|
|
|
|
pData = new SvxPageField();
|
|
|
|
break;
|
|
|
|
case PRESOBJ_DATETIME:
|
|
|
|
pData = new SvxDateTimeField();
|
|
|
|
break;
|
2006-12-12 15:33:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
ESelection e;
|
2007-05-10 14:22:46 +00:00
|
|
|
SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
|
2004-03-30 14:44:43 +00:00
|
|
|
pOutl->QuickInsertField(aField,e);
|
|
|
|
delete pData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pOutl->SetPaperSize( pObj->GetLogicRect().GetSize() );
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
if( aString.Len() )
|
|
|
|
pOutl->SetText( aString, pOutl->GetParagraph( 0 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
( (SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
|
|
|
|
|
|
|
|
if (!pOutliner)
|
|
|
|
{
|
|
|
|
delete pOutl;
|
|
|
|
pOutl = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Outliner restaurieren
|
|
|
|
pOutl->Init( nOutlMode );
|
|
|
|
pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
|
|
|
|
pOutl->SetUpdateMode( bUpdateMode );
|
|
|
|
pOutl->SetPaperSize( aPaperSize );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Link & Daten von einem VControl empfangen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
void SdPage::SetLinkData(const String&, const String& )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Layoutname setzen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
void SdPage::SetLayoutName(String aName)
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
maLayoutName = aName;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-11-19 14:05:59 +00:00
|
|
|
if( mbMaster )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
String aSep( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) );
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nPos = maLayoutName.Search( aSep );
|
2000-09-18 23:16:46 +00:00
|
|
|
if ( nPos != STRING_NOTFOUND )
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
FmFormPage::SetName(maLayoutName.Copy(0, nPos));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Seitenname zurueckgeben und ggf. generieren
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
const String& SdPage::GetName() const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
String aCreatedPageName( maCreatedPageName );
|
2006-06-19 11:30:42 +00:00
|
|
|
if (GetRealName().Len() == 0)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if ((mePageKind == PK_STANDARD || mePageKind == PK_NOTES) && !mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
// default name for handout pages
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nNum = (GetPageNum() + 1) / 2;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
aCreatedPageName = String(SdResId(STR_PAGE));
|
|
|
|
aCreatedPageName += sal_Unicode( ' ' );
|
2005-10-19 11:23:43 +00:00
|
|
|
if( GetModel()->GetPageNumType() == SVX_NUMBER_NONE )
|
|
|
|
{
|
|
|
|
// if the document has number none as a formating
|
|
|
|
// for page numbers we still default to arabic numbering
|
|
|
|
// to keep the default page names unique
|
|
|
|
aCreatedPageName += String::CreateFromInt32( (sal_Int32)nNum );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aCreatedPageName += ((SdDrawDocument*) GetModel())->CreatePageNumValue(nNum);
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/******************************************************************
|
|
|
|
* Defaultname fuer Handzettelseiten
|
|
|
|
******************************************************************/
|
|
|
|
aCreatedPageName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-19 11:30:42 +00:00
|
|
|
aCreatedPageName = GetRealName();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind == PK_NOTES)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aCreatedPageName += sal_Unicode( ' ' );
|
|
|
|
aCreatedPageName += String(SdResId(STR_NOTES));
|
|
|
|
}
|
2008-11-19 14:05:59 +00:00
|
|
|
else if (mePageKind == PK_HANDOUT && mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aCreatedPageName += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ));
|
|
|
|
aCreatedPageName += String(SdResId(STR_HANDOUT));
|
|
|
|
aCreatedPageName += sal_Unicode( ')' );
|
|
|
|
}
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
const_cast< SdPage* >(this)->maCreatedPageName = aCreatedPageName;
|
|
|
|
return maCreatedPageName;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2002-01-14 12:04:49 +00:00
|
|
|
void SdPage::SetOrientation( Orientation eOrient)
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
meOrientation = eOrient;
|
2002-01-14 12:04:49 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2002-01-14 12:04:49 +00:00
|
|
|
Orientation SdPage::GetOrientation() const
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
return meOrientation;
|
2002-01-14 12:04:49 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Liefert den Default-Text eines PresObjektes zurueck
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
String SdPage::GetPresObjText(PresObjKind eObjKind) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
String aString;
|
|
|
|
|
|
|
|
if (eObjKind == PRESOBJ_TITLE)
|
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
if (mePageKind != PK_NOTES)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_MPTITLE ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_MPNOTESTITLE ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_TITLE ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_OUTLINE)
|
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_MPOUTLINE ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_OUTLINE ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_NOTES)
|
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if (mbMaster)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_MPNOTESTEXT ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_NOTESTEXT ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_TEXT)
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_TEXT ) );
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_GRAPHIC)
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_GRAPHIC ) );
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_OBJECT)
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_OBJECT ) );
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_CHART)
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_CHART ) );
|
|
|
|
}
|
|
|
|
else if (eObjKind == PRESOBJ_ORGCHART)
|
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_ORGCHART ) );
|
|
|
|
}
|
2010-02-23 00:23:09 +01:00
|
|
|
else if (eObjKind == PRESOBJ_CALC)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
aString = String ( SdResId( STR_PRESOBJ_TABLE ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return(aString);
|
|
|
|
}
|
2000-11-26 18:24:16 +00:00
|
|
|
|
|
|
|
extern uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage );
|
|
|
|
|
|
|
|
uno::Reference< uno::XInterface > SdPage::createUnoPage()
|
|
|
|
{
|
2000-11-30 10:25:28 +00:00
|
|
|
return createUnoPageImpl( this );
|
2000-11-26 18:24:16 +00:00
|
|
|
}
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2004-11-26 18:47:27 +00:00
|
|
|
/** returns the SdPage implementation for the given XDrawPage or 0 if not available */
|
|
|
|
SdPage* SdPage::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( xPage, ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
if( xUnoTunnel.is() )
|
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
|
2004-11-26 18:47:27 +00:00
|
|
|
if( pUnoPage )
|
|
|
|
return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
|
|
|
|
}
|
|
|
|
}
|
2011-12-25 15:08:11 +09:00
|
|
|
catch( ::com::sun::star::uno::Exception& )
|
2004-11-26 18:47:27 +00:00
|
|
|
{
|
2011-12-25 15:08:11 +09:00
|
|
|
OSL_FAIL("sd::SdPage::getImplementation(), exception caught!" );
|
2004-11-26 18:47:27 +00:00
|
|
|
}
|
2004-07-13 12:45:35 +00:00
|
|
|
|
2004-11-26 18:47:27 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2004-07-13 12:45:35 +00:00
|
|
|
|
|
|
|
void SdPage::SetName (const String& rName)
|
|
|
|
{
|
2009-05-19 09:32:45 +00:00
|
|
|
String aOldName = GetName();
|
2004-07-13 12:45:35 +00:00
|
|
|
FmFormPage::SetName (rName);
|
2009-05-19 09:32:45 +00:00
|
|
|
static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
|
2004-07-13 12:45:35 +00:00
|
|
|
ActionChanged();
|
|
|
|
}
|
|
|
|
|
2005-01-13 16:25:42 +00:00
|
|
|
const HeaderFooterSettings& SdPage::getHeaderFooterSettings() const
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if( mePageKind == PK_HANDOUT && !mbMaster )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2004-07-12 13:56:14 +00:00
|
|
|
return (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings);
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return maHeaderFooterSettings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-13 16:25:42 +00:00
|
|
|
void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings )
|
|
|
|
{
|
2008-11-19 14:05:59 +00:00
|
|
|
if( mePageKind == PK_HANDOUT && !mbMaster )
|
2005-01-13 16:25:42 +00:00
|
|
|
{
|
|
|
|
(((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings) = rNewSettings;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
maHeaderFooterSettings = rNewSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetChanged();
|
|
|
|
if(TRG_HasMasterPage())
|
|
|
|
{
|
|
|
|
TRG_GetMasterPageDescriptorViewContact().ActionChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-12 13:56:14 +00:00
|
|
|
bool SdPage::checkVisibility(
|
2008-08-19 23:13:11 +00:00
|
|
|
const sdr::contact::ViewObjectContact& rOriginal,
|
|
|
|
const sdr::contact::DisplayInfo& rDisplayInfo,
|
2004-07-12 13:56:14 +00:00
|
|
|
bool bEdit )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2004-07-12 13:56:14 +00:00
|
|
|
if( !FmFormPage::checkVisibility( rOriginal, rDisplayInfo, bEdit ) )
|
2004-03-30 14:44:43 +00:00
|
|
|
return false;
|
|
|
|
|
2004-07-12 13:56:14 +00:00
|
|
|
SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
|
2004-03-30 14:44:43 +00:00
|
|
|
if( pObj == NULL )
|
|
|
|
return false;
|
|
|
|
|
2008-08-19 23:13:11 +00:00
|
|
|
const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
|
2009-06-17 10:58:14 +00:00
|
|
|
const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter() || rOriginal.GetObjectContact().isOutputToPDFFile());
|
2008-08-19 23:13:11 +00:00
|
|
|
const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
|
|
|
|
const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
|
2004-03-30 14:44:43 +00:00
|
|
|
|
|
|
|
// empty presentation objects only visible during edit mode
|
|
|
|
if( (bIsPrinting || !bEdit || bIsInsidePageObj ) && pObj->IsEmptyPresObj() )
|
|
|
|
{
|
|
|
|
if( (pObj->GetObjInventor() != SdrInventor) || ( (pObj->GetObjIdentifier() != OBJ_RECT) && (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_TEXT ) )
|
|
|
|
{
|
2008-08-19 23:13:11 +00:00
|
|
|
const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->GetPage());
|
|
|
|
|
2006-12-12 15:33:13 +00:00
|
|
|
if( pCheckPage )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2006-12-12 15:33:13 +00:00
|
|
|
PresObjKind eKind = pCheckPage->GetPresObjKind(pObj);
|
2004-03-30 14:44:43 +00:00
|
|
|
|
|
|
|
if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
|
|
|
|
{
|
2008-08-19 23:13:11 +00:00
|
|
|
const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
|
|
|
|
|
|
|
|
if( bSubContentProcessing || ( pCheckPage->GetPageKind() == PK_HANDOUT && bIsPrinting ) )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2008-08-19 23:13:11 +00:00
|
|
|
// use the page that is currently processed
|
|
|
|
const SdPage* pVisualizedSdPage = dynamic_cast< const SdPage* >(pVisualizedPage);
|
2004-11-26 18:47:27 +00:00
|
|
|
|
2008-08-19 23:13:11 +00:00
|
|
|
if( pVisualizedSdPage )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2004-11-26 18:47:27 +00:00
|
|
|
// if we are not on a masterpage, see if we have to draw this header&footer object at all
|
2008-08-19 23:13:11 +00:00
|
|
|
const sd::HeaderFooterSettings& rSettings = pVisualizedSdPage->getHeaderFooterSettings();
|
2004-03-30 14:44:43 +00:00
|
|
|
|
2004-11-26 18:47:27 +00:00
|
|
|
switch( eKind )
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
2004-11-26 18:47:27 +00:00
|
|
|
case PRESOBJ_FOOTER:
|
|
|
|
return rSettings.mbFooterVisible;
|
|
|
|
case PRESOBJ_HEADER:
|
|
|
|
return rSettings.mbHeaderVisible;
|
|
|
|
case PRESOBJ_DATETIME:
|
|
|
|
return rSettings.mbDateTimeVisible;
|
|
|
|
case PRESOBJ_SLIDENUMBER:
|
|
|
|
return rSettings.mbSlideNumberVisible;
|
2006-12-12 15:33:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 15:14:05 +00:00
|
|
|
} // check for placeholders on master
|
2009-10-28 16:04:53 +00:00
|
|
|
else if( (eKind != PRESOBJ_NONE) && pCheckPage->IsMasterPage() && ( pVisualizedPage != pCheckPage ) )
|
2009-10-14 15:14:05 +00:00
|
|
|
{
|
|
|
|
// presentation objects on master slide are always invisible if slide is shown.
|
|
|
|
return false;
|
2004-03-30 14:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2008-08-19 23:13:11 +00:00
|
|
|
// i63977, do not print SdrpageObjs from master pages
|
2008-03-06 15:25:55 +00:00
|
|
|
if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_PAGE ) )
|
|
|
|
{
|
|
|
|
if( pObj->GetPage() && pObj->GetPage()->IsMasterPage() )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-01-10 13:26:36 +00:00
|
|
|
bool SdPage::RestoreDefaultText( SdrObject* pObj )
|
|
|
|
{
|
|
|
|
bool bRet = false;
|
|
|
|
|
|
|
|
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
|
|
|
|
|
|
|
|
if( pTextObj )
|
|
|
|
{
|
|
|
|
PresObjKind ePresObjKind = GetPresObjKind(pTextObj);
|
|
|
|
|
|
|
|
if (ePresObjKind == PRESOBJ_TITLE ||
|
|
|
|
ePresObjKind == PRESOBJ_OUTLINE ||
|
|
|
|
ePresObjKind == PRESOBJ_NOTES ||
|
|
|
|
ePresObjKind == PRESOBJ_TEXT)
|
|
|
|
{
|
|
|
|
String aString( GetPresObjText(ePresObjKind) );
|
|
|
|
|
|
|
|
if (aString.Len())
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_Bool bVertical = sal_False;
|
2006-01-10 13:26:36 +00:00
|
|
|
OutlinerParaObject* pOldPara = pTextObj->GetOutlinerParaObject();
|
|
|
|
if( pOldPara )
|
|
|
|
bVertical = pOldPara->IsVertical(); // is old para object vertical?
|
|
|
|
|
|
|
|
SetObjText( pTextObj, 0, ePresObjKind, aString );
|
|
|
|
|
|
|
|
if( pOldPara )
|
|
|
|
{
|
2011-02-07 22:11:09 +01:00
|
|
|
// Here, only the vertical flag for the
|
2006-01-10 13:26:36 +00:00
|
|
|
// OutlinerParaObjects needs to be changed. The
|
|
|
|
// AutoGrowWidth/Height items still exist in the
|
|
|
|
// not changed object.
|
|
|
|
if(pTextObj
|
|
|
|
&& pTextObj->GetOutlinerParaObject()
|
CWS-TOOLING: integrate CWS aw063
2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects
2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects
2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL
2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction
2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction
2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1
2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round
2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round
2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round
2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round
2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round
2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round
2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round
2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition
2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF
2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable
2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable
2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix
2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix
2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers
2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts
2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules
2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include
2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include
2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much
2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from
2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size
2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances
2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage
2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences
2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange
2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle
2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case
2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
|
|
|
&& pTextObj->GetOutlinerParaObject()->IsVertical() != (bool)bVertical)
|
2006-01-10 13:26:36 +00:00
|
|
|
{
|
|
|
|
Rectangle aObjectRect = pTextObj->GetSnapRect();
|
|
|
|
pTextObj->GetOutlinerParaObject()->SetVertical(bVertical);
|
|
|
|
pTextObj->SetSnapRect(aObjectRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pTextObj->SetTextEditOutliner( NULL ); // to make stylesheet settings work
|
2011-01-17 11:41:00 +01:00
|
|
|
pTextObj->NbcSetStyleSheet( GetStyleSheetForPresObj(ePresObjKind), sal_True );
|
|
|
|
pTextObj->SetEmptyPresObj(sal_True);
|
2006-01-10 13:26:36 +00:00
|
|
|
bRet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2008-03-06 15:25:55 +00:00
|
|
|
void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas )
|
|
|
|
{
|
|
|
|
SdPage& rHandoutMaster = *rModel.GetMasterSdPage( 0, PK_HANDOUT );
|
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
if( eLayout == AUTOLAYOUT_NONE )
|
|
|
|
{
|
|
|
|
// use layout from handout master
|
|
|
|
SdrObjListIter aShapeIter (rHandoutMaster);
|
|
|
|
while (aShapeIter.IsMore())
|
|
|
|
{
|
|
|
|
SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
|
|
|
|
if (pPageObj)
|
|
|
|
rAreas.push_back( pPageObj->GetCurrentBoundRect() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Size aArea = rHandoutMaster.GetSize();
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
const long nGapW = 1000; // gap is 1cm
|
|
|
|
const long nGapH = 1000;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
long nLeftBorder = rHandoutMaster.GetLftBorder();
|
|
|
|
long nRightBorder = rHandoutMaster.GetRgtBorder();
|
|
|
|
long nTopBorder = rHandoutMaster.GetUppBorder();
|
|
|
|
long nBottomBorder = rHandoutMaster.GetLwrBorder();
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
const long nHeaderFooterHeight = static_cast< long >( (aArea.Height() - nTopBorder - nLeftBorder) * 0.05 );
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
nTopBorder += nHeaderFooterHeight;
|
|
|
|
nBottomBorder += nHeaderFooterHeight;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
long nX = nGapW + nLeftBorder;
|
|
|
|
long nY = nGapH + nTopBorder;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
aArea.Width() -= nGapW * 2 + nLeftBorder + nRightBorder;
|
|
|
|
aArea.Height() -= nGapH * 2 + nTopBorder + nBottomBorder;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
const bool bLandscape = aArea.Width() > aArea.Height();
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
static sal_uInt16 aOffsets[5][9] =
|
|
|
|
{
|
|
|
|
{ 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
|
|
|
|
{ 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
|
|
|
|
{ 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
|
|
|
|
{ 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
|
|
|
|
{ 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
|
|
|
|
};
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
sal_uInt16* pOffsets = aOffsets[0];
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nColCnt = 0, nRowCnt = 0;
|
2010-06-04 14:14:06 +02:00
|
|
|
switch ( eLayout )
|
|
|
|
{
|
|
|
|
case AUTOLAYOUT_HANDOUT1:
|
|
|
|
nColCnt = 1; nRowCnt = 1;
|
|
|
|
break;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
case AUTOLAYOUT_HANDOUT2:
|
|
|
|
if( bLandscape )
|
|
|
|
{
|
|
|
|
nColCnt = 2; nRowCnt = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nColCnt = 1; nRowCnt = 2;
|
|
|
|
}
|
|
|
|
break;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
case AUTOLAYOUT_HANDOUT3:
|
|
|
|
if( bLandscape )
|
|
|
|
{
|
|
|
|
nColCnt = 3; nRowCnt = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nColCnt = 2; nRowCnt = 3;
|
|
|
|
}
|
|
|
|
pOffsets = aOffsets[ bLandscape ? 1 : 0 ];
|
|
|
|
break;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
case AUTOLAYOUT_HANDOUT4:
|
|
|
|
nColCnt = 2; nRowCnt = 2;
|
|
|
|
pOffsets = aOffsets[ bHorizontal ? 0 : 2 ];
|
|
|
|
break;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
case AUTOLAYOUT_HANDOUT6:
|
|
|
|
if( bLandscape )
|
|
|
|
{
|
|
|
|
nColCnt = 3; nRowCnt = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nColCnt = 2; nRowCnt = 3;
|
|
|
|
}
|
|
|
|
if( !bHorizontal )
|
|
|
|
pOffsets = aOffsets[ bLandscape ? 1 : 3 ];
|
|
|
|
break;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
default:
|
|
|
|
case AUTOLAYOUT_HANDOUT9:
|
|
|
|
nColCnt = 3; nRowCnt = 3;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
if( !bHorizontal )
|
|
|
|
pOffsets = aOffsets[4];
|
|
|
|
break;
|
|
|
|
}
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
rAreas.resize( nColCnt * nRowCnt );
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
Size aPartArea, aSize;
|
|
|
|
aPartArea.Width() = ((aArea.Width() - ((nColCnt-1) * nGapW) ) / nColCnt);
|
|
|
|
aPartArea.Height() = ((aArea.Height() - ((nRowCnt-1) * nGapH) ) / nRowCnt);
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
SdrPage* pFirstPage = rModel.GetMasterSdPage(0, PK_STANDARD);
|
|
|
|
if ( pFirstPage )
|
2008-03-06 15:25:55 +00:00
|
|
|
{
|
2010-06-04 14:14:06 +02:00
|
|
|
// scale actual size into handout rect
|
|
|
|
double fScale = (double)aPartArea.Width() / (double)pFirstPage->GetWdt();
|
|
|
|
|
|
|
|
aSize.Height() = (long)(fScale * pFirstPage->GetHgt() );
|
|
|
|
if( aSize.Height() > aPartArea.Height() )
|
|
|
|
{
|
|
|
|
fScale = (double)aPartArea.Height() / (double)pFirstPage->GetHgt();
|
|
|
|
aSize.Height() = aPartArea.Height();
|
|
|
|
aSize.Width() = (long)(fScale * pFirstPage->GetWdt());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aSize.Width() = aPartArea.Width();
|
|
|
|
}
|
|
|
|
|
|
|
|
nX += (aPartArea.Width() - aSize.Width()) / 2;
|
|
|
|
nY += (aPartArea.Height()- aSize.Height())/ 2;
|
2008-03-06 15:25:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-04 14:14:06 +02:00
|
|
|
aSize = aPartArea;
|
2008-03-06 15:25:55 +00:00
|
|
|
}
|
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
Point aPos( nX, nY );
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
const bool bRTL = rModel.GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
const long nOffsetX = (aPartArea.Width() + nGapW) * (bRTL ? -1 : 1);
|
|
|
|
const long nOffsetY = aPartArea.Height() + nGapH;
|
|
|
|
const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) - nX : nX;
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
for(sal_uInt16 nRow = 0; nRow < nRowCnt; nRow++)
|
2008-03-06 15:25:55 +00:00
|
|
|
{
|
2010-06-04 14:14:06 +02:00
|
|
|
aPos.X() = nStartX;
|
|
|
|
for(sal_uInt16 nCol = 0; nCol < nColCnt; nCol++)
|
|
|
|
{
|
|
|
|
rAreas[*pOffsets++] = Rectangle(aPos, aSize);
|
|
|
|
aPos.X() += nOffsetX;
|
|
|
|
}
|
2008-03-06 15:25:55 +00:00
|
|
|
|
2010-06-04 14:14:06 +02:00
|
|
|
aPos.Y() += nOffsetY;
|
|
|
|
}
|
2008-03-06 15:25:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 14:22:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SdPage::SetPrecious (const bool bIsPrecious)
|
|
|
|
{
|
|
|
|
mbIsPrecious = bIsPrecious;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SdPage::IsPrecious (void) const
|
|
|
|
{
|
|
|
|
return mbIsPrecious;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-03-30 14:44:43 +00:00
|
|
|
HeaderFooterSettings::HeaderFooterSettings()
|
|
|
|
{
|
|
|
|
mbHeaderVisible = true;
|
|
|
|
mbFooterVisible = true;
|
|
|
|
mbSlideNumberVisible = false;
|
|
|
|
mbDateTimeVisible = true;
|
|
|
|
mbDateTimeIsFixed = true;
|
|
|
|
meDateTimeFormat = SVXDATEFORMAT_A;
|
|
|
|
}
|
|
|
|
|
2005-01-13 16:25:42 +00:00
|
|
|
bool HeaderFooterSettings::operator==( const HeaderFooterSettings& rSettings ) const
|
2004-03-30 14:44:43 +00:00
|
|
|
{
|
|
|
|
return (mbHeaderVisible == rSettings.mbHeaderVisible) &&
|
|
|
|
(maHeaderText == rSettings.maHeaderText) &&
|
|
|
|
(mbFooterVisible == rSettings.mbFooterVisible) &&
|
|
|
|
(maFooterText == rSettings.maFooterText) &&
|
|
|
|
(mbSlideNumberVisible == rSettings.mbSlideNumberVisible) &&
|
|
|
|
(mbDateTimeVisible == rSettings.mbDateTimeVisible) &&
|
|
|
|
(mbDateTimeIsFixed == rSettings.mbDateTimeIsFixed) &&
|
|
|
|
(meDateTimeFormat == rSettings.meDateTimeFormat) &&
|
|
|
|
(maDateTimeText == rSettings.maDateTimeText);
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:51:52 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|