diff options
Diffstat (limited to 'binfilter/bf_sd/source')
76 files changed, 28961 insertions, 0 deletions
diff --git a/binfilter/bf_sd/source/core/makefile.mk b/binfilter/bf_sd/source/core/makefile.mk new file mode 100644 index 000000000000..18a87dcd1921 --- /dev/null +++ b/binfilter/bf_sd/source/core/makefile.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sd_sd + +PRJNAME=binfilter +TARGET=sd_core + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +IENV+=-I..\ui\inc + +# --- Files -------------------------------------------------------- + + +SRS1NAME=$(TARGET) +SRC1FILES = sd_glob.src + +SLOFILES = $(SLO)$/sd_stlsheet.obj \ + $(SLO)$/sd_stlpool.obj \ + $(SLO)$/sd_drawdoc.obj \ + $(SLO)$/sd_drawdoc2.obj \ + $(SLO)$/sd_drawdoc3.obj \ + $(SLO)$/sd_drawdoc4.obj \ + $(SLO)$/sd_sdpage.obj \ + $(SLO)$/sd_sdattr.obj \ + $(SLO)$/sd_sdobjfac.obj \ + $(SLO)$/sd_anminfo.obj \ + $(SLO)$/sd_sdiocmpt.obj \ + $(SLO)$/sd_sdpage2.obj \ + $(SLO)$/sd_cusshow.obj + +EXCEPTIONSFILES= \ + $(SLO)$/sd_drawdoc.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sd/source/core/sd_anminfo.cxx b/binfilter/bf_sd/source/core/sd_anminfo.cxx new file mode 100644 index 000000000000..e68d0375c8ae --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_anminfo.cxx @@ -0,0 +1,407 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "bf_svx/xtable.hxx" +#include <bf_svx/svdsuro.hxx> +#include <bf_svx/svdopath.hxx> +#include <bf_svtools/urihelper.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "anminfo.hxx" +#include "glob.hxx" +#include "sdiocmpt.hxx" +#include "drawdoc.hxx" + +// #90477# +#include <tools/tenccvt.hxx> +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +using namespace ::com::sun::star; + +/************************************************************************* +|* +|* Konstruktor (String aSecondSoundFile unbenutzt --> default ctor) +|* +\************************************************************************/ + +/*N*/ SdAnimationInfo::SdAnimationInfo(SdDrawDocument* pTheDoc) +/*N*/ : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0), +/*N*/ pPolygon (NULL), +/*N*/ eEffect (presentation::AnimationEffect_NONE), +/*N*/ eTextEffect (presentation::AnimationEffect_NONE), +/*N*/ eSpeed (presentation::AnimationSpeed_SLOW), +/*N*/ bActive (TRUE), +/*N*/ bDimPrevious (FALSE), +/*N*/ bIsMovie (FALSE), +/*N*/ bDimHide (FALSE), +/*N*/ bSoundOn (FALSE), +/*N*/ bPlayFull (FALSE), +/*N*/ pPathSuro (NULL), +/*N*/ pPathObj (NULL), +/*N*/ eClickAction (presentation::ClickAction_NONE), +/*N*/ eSecondEffect (presentation::AnimationEffect_NONE), +/*N*/ eSecondSpeed (presentation::AnimationSpeed_SLOW), +/*N*/ bSecondSoundOn (FALSE), +/*N*/ bSecondPlayFull (FALSE), +/*N*/ bInvisibleInPresentation (FALSE), +/*N*/ nVerb (0), +/*N*/ pDoc (pTheDoc), +/*N*/ bShow (TRUE), +/*N*/ bIsShown (TRUE), +/*N*/ bDimmed (FALSE), +/*N*/ nPresOrder (LIST_APPEND) +/*N*/ { +/*N*/ aBlueScreen = RGB_Color(COL_LIGHTMAGENTA); +/*N*/ aDimColor = RGB_Color(COL_LIGHTGRAY); +/*N*/ } + +/************************************************************************* +|* +|* Copy Konstruktor +|* einige Anteile koennen nicht kopiert werden, da sie Referenzen in ein +|* bestimmtes Model bilden +|* +\************************************************************************/ + +/*N*/ SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo) +/*N*/ : SdrObjUserData (rAnmInfo), +/*N*/ pPolygon (NULL), +/*N*/ aStart (rAnmInfo.aStart), +/*N*/ aEnd (rAnmInfo.aEnd), +/*N*/ eEffect (rAnmInfo.eEffect), +/*N*/ eTextEffect (rAnmInfo.eTextEffect), +/*N*/ eSpeed (rAnmInfo.eSpeed), +/*N*/ bActive (rAnmInfo.bActive), +/*N*/ bDimPrevious (rAnmInfo.bDimPrevious), +/*N*/ bIsMovie (rAnmInfo.bIsMovie), +/*N*/ bDimHide (rAnmInfo.bDimHide), +/*N*/ aBlueScreen (rAnmInfo.aBlueScreen), +/*N*/ aDimColor (rAnmInfo.aDimColor), +/*N*/ aSoundFile (rAnmInfo.aSoundFile), +/*N*/ bSoundOn (rAnmInfo.bSoundOn), +/*N*/ bPlayFull (rAnmInfo.bPlayFull), +/*N*/ pPathObj (NULL), +/*N*/ pPathSuro (NULL), +/*N*/ eClickAction (rAnmInfo.eClickAction), +/*N*/ eSecondEffect (rAnmInfo.eSecondEffect), +/*N*/ eSecondSpeed (rAnmInfo.eSecondSpeed), +/*N*/ bSecondSoundOn (rAnmInfo.bSecondSoundOn), +/*N*/ bSecondPlayFull (rAnmInfo.bSecondPlayFull), +/*N*/ bInvisibleInPresentation (rAnmInfo.bInvisibleInPresentation), +/*N*/ nVerb (rAnmInfo.nVerb), +/*N*/ aBookmark (rAnmInfo.aBookmark), +/*N*/ aSecondSoundFile (rAnmInfo.aSecondSoundFile), +/*N*/ pDoc (NULL), +/*N*/ bShow (rAnmInfo.bShow), +/*N*/ bIsShown (rAnmInfo.bIsShown), +/*N*/ bDimmed (rAnmInfo.bDimmed), +/*N*/ nPresOrder (LIST_APPEND) +/*N*/ { +/*N*/ if (pPolygon) +/*N*/ pPolygon = new Polygon(*(rAnmInfo.pPolygon)); +/*N*/ +/*N*/ // kann nicht uebertragen werden +/*N*/ if (eEffect == presentation::AnimationEffect_PATH) +/*N*/ eEffect = presentation::AnimationEffect_NONE; +/*N*/ } + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*N*/ SdAnimationInfo::~SdAnimationInfo() +/*N*/ { +/*N*/ delete pPathSuro; +/*N*/ delete pPolygon; +/*N*/ } + +/************************************************************************* +|* +|* Clone +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SdAnimationInfo::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ // letzter Parameter ist die aktuelle Versionsnummer des Codes +/*N*/ SdIOCompat aIO(rOut, STREAM_WRITE, 9); +/*N*/ +/*N*/ if(pPolygon) +/*N*/ { +/*N*/ rOut << (UINT16)1; // es folgt ein Polygon +/*N*/ rOut << *pPolygon; +/*N*/ } +/*N*/ else +/*N*/ rOut << (UINT16)0; // kein Polygon +/*N*/ +/*N*/ rOut << aStart; +/*N*/ rOut << aEnd; +/*N*/ rOut << (UINT16)eEffect; +/*N*/ rOut << (UINT16)eSpeed; +/*N*/ +/*N*/ rOut << (UINT16)bActive; +/*N*/ rOut << (UINT16)bDimPrevious; +/*N*/ rOut << (UINT16)bIsMovie; +/*N*/ +/*N*/ rOut << aBlueScreen; +/*N*/ rOut << aDimColor; +/*N*/ +/*N*/ // #90477# rtl_TextEncoding eSysEnc = ::GetStoreCharSet( gsl_getSystemTextEncoding() ); +/*N*/ rtl_TextEncoding eSysEnc = GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion()); +/*N*/ +/*N*/ rOut << (INT16) eSysEnc; +/*N*/ +/*N*/ rOut.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel( aSoundFile, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS), eSysEnc ); +/*N*/ +/*N*/ rOut << bSoundOn; +/*N*/ rOut << bPlayFull; +/*N*/ +/*N*/ +/*N*/ if (pPathObj && pPathObj->IsInserted()) +/*N*/ { +/*N*/ rOut << (USHORT)1; +/*N*/ SdrObjSurrogate aSuro(pPathObj); +/*N*/ rOut << aSuro; +/*N*/ } +/*N*/ else +/*N*/ rOut << (USHORT)0; +/*N*/ +/*N*/ rOut << (UINT16)eClickAction; +/*N*/ rOut << (UINT16)eSecondEffect; +/*N*/ rOut << (UINT16)eSecondSpeed; +/*N*/ +/*N*/ if (eClickAction == presentation::ClickAction_DOCUMENT || eClickAction == presentation::ClickAction_PROGRAM || +/*N*/ eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND) +/*N*/ { +/*N*/ rOut.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel( aBookmark, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS), eSysEnc ); +/*N*/ } +/*N*/ else +/*N*/ rOut.WriteByteString( aBookmark, eSysEnc ); +/*N*/ +/*N*/ rOut.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel(aSecondSoundFile, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS), eSysEnc ); +/*N*/ rOut << (UINT16)bInvisibleInPresentation; +/*N*/ rOut << (UINT16)nVerb; +/*N*/ +/*N*/ rOut << bSecondSoundOn; +/*N*/ rOut << bSecondPlayFull; +/*N*/ +/*N*/ rOut << bDimHide; +/*N*/ rOut << (UINT16)eTextEffect; +/*N*/ rOut << (UINT32)nPresOrder; +/*N*/ } + + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SdAnimationInfo::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ SdIOCompat aIO(rIn, STREAM_READ); +/*N*/ UINT32 nTemp32; +/*N*/ UINT16 nTemp; +/*N*/ +/*N*/ rIn >> nTemp; +/*N*/ if (nTemp) +/*N*/ { +/*N*/ pPolygon = new Polygon; +/*N*/ rIn >> *pPolygon; +/*N*/ } +/*N*/ +/*N*/ rIn >> aStart; +/*N*/ rIn >> aEnd; +/*N*/ +/*N*/ rIn >> nTemp; eEffect = (presentation::AnimationEffect)nTemp; +/*N*/ rIn >> nTemp; eSpeed = (presentation::AnimationSpeed)nTemp; +/*N*/ +/*N*/ rIn >> nTemp; bActive = (BOOL)nTemp; +/*N*/ rIn >> nTemp; bDimPrevious = (BOOL)nTemp; +/*N*/ rIn >> nTemp; bIsMovie = (BOOL)nTemp; +/*N*/ +/*N*/ rIn >> aBlueScreen; +/*N*/ rIn >> aDimColor; +/*N*/ +/*N*/ rtl_TextEncoding eTextEnc; +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 0 eingelesen +/*N*/ if (aIO.GetVersion() > 0) +/*N*/ { +/*N*/ INT16 nCharSet; +/*N*/ rIn >> nCharSet; +/*N*/ +/*N*/ // #unicode# eTextEnc = (rtl_TextEncoding)nCharSet; +/*N*/ eTextEnc = (rtl_TextEncoding)GetSOLoadTextEncoding((rtl_TextEncoding)nCharSet, (sal_uInt16)rIn.GetVersion()); +/*N*/ +/*N*/ String aSoundFileRel; +/*N*/ rIn.ReadByteString( aSoundFileRel, eTextEnc ); +/*N*/ if( aSoundFileRel.Len() ) +/*N*/ { +/*N*/ INetURLObject aURLObj(SmartRel2Abs( INetURLObject(::binfilter::StaticBaseUrl::GetBaseURL()), aSoundFileRel, ::binfilter::GetMaybeFileHdl(), false, false, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8, false, INetURLObject::FSYS_DETECT )); +/*N*/ aSoundFile = aURLObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 1 eingelesen +/*N*/ if (aIO.GetVersion() > 1) +/*N*/ rIn >> bSoundOn; +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 2 eingelesen +/*N*/ if (aIO.GetVersion() > 2) +/*N*/ rIn >> bPlayFull; +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 3 eingelesen +/*N*/ if (aIO.GetVersion() > 3) +/*N*/ { +/*N*/ USHORT nFlag; +/*N*/ rIn >> nFlag; +/*N*/ if (nFlag == 1) +/*N*/ { +/*N*/ DBG_ASSERT(pDoc, "kein Doc"); +/*N*/ pPathSuro = new SdrObjSurrogate(*pDoc, rIn); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 4 eingelesen +/*N*/ if (aIO.GetVersion() > 4) +/*N*/ { +/*N*/ rIn >> nTemp; eClickAction = (presentation::ClickAction)nTemp; +/*N*/ rIn >> nTemp; eSecondEffect = (presentation::AnimationEffect)nTemp; +/*N*/ rIn >> nTemp; eSecondSpeed = (presentation::AnimationSpeed)nTemp; +/*N*/ +/*N*/ if (eClickAction == presentation::ClickAction_DOCUMENT || +/*N*/ eClickAction == presentation::ClickAction_PROGRAM || +/*N*/ eClickAction == presentation::ClickAction_VANISH || +/*N*/ eClickAction == presentation::ClickAction_SOUND) +/*N*/ { +/*N*/ String aBookmarkRel; +/*N*/ rIn.ReadByteString( aBookmarkRel, eTextEnc ); +/*N*/ INetURLObject aURLObj(::binfilter::StaticBaseUrl::SmartRelToAbs(aBookmarkRel, FALSE, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS)); +/*N*/ aBookmark = aURLObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ else +/*N*/ rIn.ReadByteString( aBookmark, eTextEnc ); +/*N*/ +/*N*/ String aSecondSoundFileRel; +/*N*/ rIn.ReadByteString( aSecondSoundFileRel, eTextEnc ); +/*N*/ if( aSecondSoundFileRel.Len() ) +/*N*/ { +/*N*/ INetURLObject aURLObj(SmartRel2Abs( INetURLObject(::binfilter::StaticBaseUrl::GetBaseURL()), aSecondSoundFileRel, ::binfilter::GetMaybeFileHdl(), false, false, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8, false, INetURLObject::FSYS_DETECT )); +/*N*/ aSecondSoundFile = aURLObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ +/*N*/ rIn >> nTemp; bInvisibleInPresentation = (BOOL)nTemp; +/*N*/ rIn >> nTemp; nVerb = (USHORT)nTemp; +/*N*/ } +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 5 eingelesen +/*N*/ if (aIO.GetVersion() > 5) +/*N*/ { +/*N*/ rIn >> bSecondSoundOn; +/*N*/ rIn >> bSecondPlayFull; +/*N*/ } +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 6 eingelesen +/*N*/ if (aIO.GetVersion() > 6) +/*N*/ rIn >> bDimHide; +/*N*/ +/*N*/ // ab hier werden Daten der Versionen > 7 eingelesen +/*N*/ if (aIO.GetVersion() > 7) +/*N*/ { +/*N*/ rIn >> nTemp; +/*N*/ eTextEffect = (presentation::AnimationEffect)nTemp; +/*N*/ } +/*N*/ +/*N*/ if (aIO.GetVersion() > 8) +/*N*/ { +/*N*/ rIn >> nTemp32; +/*N*/ nPresOrder = nTemp32; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* SetPath, Verbindung zum Pfadobjekt herstellen bzw. loesen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Notify, Aenderungen am Pfadobjekt +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* AfterRead, ggfs. Surrogat aufloesen +|* +\************************************************************************/ + +/*N*/ void SdAnimationInfo::AfterRead() +/*N*/ { +/*N*/ if (pPathSuro) +/*N*/ { +/*N*/ pPathObj = (SdrPathObj*)pPathSuro->GetObject(); +/*N*/ DBG_ASSERT(pPathObj, "Surrogat kann nicht aufgeloest werden"); +/*N*/ } +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_cusshow.cxx b/binfilter/bf_sd/source/core/sd_cusshow.cxx new file mode 100644 index 000000000000..e9a384557c95 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_cusshow.cxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include "sdiocmpt.hxx" +#include "cusshow.hxx" +#include "sdpage.hxx" +#include "drawdoc.hxx" + +// #90477# +#include <tools/tenccvt.hxx> +namespace binfilter { + +using namespace ::com::sun::star; + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ +/*N*/ SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc) +/*N*/ : List(), +/*N*/ pDoc(pDrawDoc) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Copy-Ctor +|* +\************************************************************************/ +/*N*/ SdCustomShow::SdCustomShow( const SdCustomShow& rShow ) +/*N*/ : List( rShow ) +/*N*/ { +/*N*/ aName = rShow.GetName(); +/*N*/ pDoc = rShow.GetDoc(); +/*N*/ } + +/*N*/ SdCustomShow::SdCustomShow(SdDrawDocument* pDrawDoc, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xShow ) +/*N*/ : List(), +/*N*/ pDoc(pDrawDoc), +/*N*/ mxUnoCustomShow( xShow ) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ +/*N*/ SdCustomShow::~SdCustomShow() +/*N*/ { +/*N*/ uno::Reference< uno::XInterface > xShow( mxUnoCustomShow ); +/*N*/ uno::Reference< lang::XComponent > xComponent( xShow, uno::UNO_QUERY ); +/*N*/ if( xComponent.is() ) +/*N*/ xComponent->dispose(); +/*N*/ } + + +/************************************************************************* +|* +|* Inserter fuer SvStream zum Speichern +|* +\************************************************************************/ +/*N*/ SvStream& operator << (SvStream& rOut, const SdCustomShow& rCustomShow) +/*N*/ { +/*N*/ // Letzter Parameter ist die aktuelle Versionsnummer des Codes +/*N*/ SdIOCompat aIO(rOut, STREAM_WRITE, 0); +/*N*/ +/*N*/ // Name +/*N*/ // #90477# rOut.WriteByteString( rCustomShow.aName, ::GetStoreCharSet( gsl_getSystemTextEncoding() ) ); +/*N*/ rOut.WriteByteString(rCustomShow.aName, +/*N*/ GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion())); +/*N*/ +/*N*/ // Anzahl Seiten +/*N*/ UINT32 nCount = rCustomShow.Count(); +/*N*/ rOut << nCount; +/*N*/ +/*N*/ for (UINT32 i = 0; i < nCount; i++) +/*N*/ { +/*N*/ // Seite aus Liste holen +/*N*/ SdPage* pPage = (SdPage*) rCustomShow.GetObject(i); +/*N*/ +/*N*/ if (pPage) +/*N*/ { +/*N*/ // SdPage-Seitennummer +/*N*/ UINT16 nPageNum = (pPage->GetPageNum() - 1) / 2; +/*N*/ rOut << nPageNum; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return rOut; +/*N*/ } + +/************************************************************************* +|* +|* Extractor fuer SvStream zum Laden +|* +\************************************************************************/ +/*N*/ SvStream& operator >> (SvStream& rIn, SdCustomShow& rCustomShow) +/*N*/ { +/*N*/ SdIOCompat aIO(rIn, STREAM_READ); +/*N*/ +/*N*/ // Name +/*N*/ // #90477# rIn.ReadByteString( rCustomShow.aName, ::GetStoreCharSet( gsl_getSystemTextEncoding() ) ); +/*N*/ rIn.ReadByteString(rCustomShow.aName, +/*N*/ GetSOLoadTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rIn.GetVersion())); +/*N*/ +/*N*/ // Anzahl Seiten +/*N*/ UINT32 nCount = 0; +/*N*/ rIn >> nCount; +/*N*/ +/*N*/ rCustomShow.Clear(); +/*N*/ +/*N*/ for (UINT32 i = 0; i < nCount; i++) +/*N*/ { +/*N*/ // Seitennummer +/*N*/ UINT16 nPageNum; +/*N*/ rIn >> nPageNum; +/*N*/ +/*N*/ // Seite in Liste einfuegen +/*N*/ SdPage* pPage = (SdPage*) rCustomShow.pDoc->GetSdPage(nPageNum, PK_STANDARD); +/*N*/ rCustomShow.Insert(pPage, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ return rIn; +/*N*/ } + +/*N*/ extern uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow ); + +/*N*/ uno::Reference< uno::XInterface > SdCustomShow::getUnoCustomShow() +/*N*/ { +/*N*/ // try weak reference first +/*N*/ uno::Reference< uno::XInterface > xShow( mxUnoCustomShow ); +/*N*/ +/*N*/ if( !xShow.is() ) +/*N*/ { +/*N*/ xShow = createUnoCustomShow( this ); +/*N*/ } +/*N*/ +/*N*/ return xShow; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_drawdoc.cxx b/binfilter/bf_sd/source/core/sd_drawdoc.cxx new file mode 100644 index 000000000000..5ad456b187d9 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_drawdoc.cxx @@ -0,0 +1,1360 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#define ITEMID_SEARCH SID_SEARCH_ITEM + +#include <bf_sd/sdmod.hxx> + +#include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/document/PrinterIndependentLayout.hpp> + +#include <bf_sfx2/objsh.hxx> +#include <bf_svx/forbiddencharacterstable.hxx> + +#include <bf_svx/svxids.hrc> +#include <bf_svx/dlgutil.hxx> + +#include <bf_sfx2/printer.hxx> +#include <bf_sfx2/app.hxx> +#include <bf_offmgr/app.hxx> +#include <bf_svx/linkmgr.hxx> +#include <bf_svx/dialogs.hrc> +#include "sdoutl.hxx" + +#include <bf_svx/eeitem.hxx> +#include <bf_svx/eeitemid.hxx> +#include <bf_svx/editstat.hxx> +#include <bf_svx/fontitem.hxx> +#include <bf_svtools/flagitem.hxx> +#include <bf_svx/svdoattr.hxx> +#include <bf_svx/svdotext.hxx> +#include <bf_svx/bulitem.hxx> +#include <bf_svx/numitem.hxx> +#include <bf_svx/svditer.hxx> +#include <bf_svx/unolingu.hxx> +#include <bf_svtools/itempool.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <bf_svx/xtable.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <bf_svx/outlobj.hxx> +#include <bf_svtools/saveopt.hxx> +#include <comphelper/extract.hxx> +#include <i18npool/mslangid.hxx> +#include <unotools/charclass.hxx> +#include <comphelper/processfactory.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/lingucfg.hxx> +#include <bf_svtools/linguprops.hxx> + +#include "bf_sd/frmview.hxx" +#include "eetext.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "sdattr.hxx" +#include "glob.hrc" +#include "glob.hxx" +#include "stlpool.hxx" +#include "sdiocmpt.hxx" +#include "sdresid.hxx" +#include "cusshow.hxx" + +#include "bf_sd/docshell.hxx" +#include "bf_sd/grdocsh.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#include <tools/tenccvt.hxx> + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::linguistic2; + +TYPEINIT1( SdDrawDocument, FmFormModel ); + +SdDrawDocument* SdDrawDocument::pDocLockedInsertingLinks = NULL; + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) : + FmFormModel( + SvtPathOptions().GetPalettePath(), + NULL, (SvPersist*)pDrDocSh ), + eDocType(eType), + pDocSh( (SdDrawDocShell*) pDrDocSh ), + bPresAll(TRUE), + bPresEndless(FALSE), + bPresManual(FALSE), + bPresMouseVisible(TRUE), + bPresMouseAsPen(FALSE), + bPresLockedPages(FALSE), + bStartPresWithNavigator(FALSE), + bAnimationAllowed(TRUE), + bPresAlwaysOnTop(FALSE), + bPresFullScreen(TRUE), + nPresPause(10), + bPresShowLogo(FALSE), + bCustomShow(false), + nPresFirstPage(1), + pOutliner(NULL), + pInternalOutliner(NULL), + ePageNumType(SVX_ARABIC), + bNewOrLoadCompleted(FALSE), + pOnlineSpellingTimer(NULL), + pOnlineSpellingList(NULL), + bInitialOnlineSpellingEnabled(TRUE), + bHasOnlineSpellErrors(FALSE), + mpLocale(NULL), + mpCharClass(NULL), + bAllocDocSh(FALSE), + pDeletedPresObjList(NULL), + nFileFormatVersion(SDIOCOMPAT_VERSIONDONTKNOW), + pDocStor(NULL), + pCustomShowList(NULL), + eLanguage( LANGUAGE_SYSTEM ), + eLanguageCJK( LANGUAGE_SYSTEM ), + eLanguageCTL( LANGUAGE_SYSTEM ), + mbStartWithPresentation( false ) +{ + SetObjectShell(pDrDocSh); // fuer das VCDrawModel + + if (pDocSh) + { + SetSwapGraphics(TRUE); + } + + SetUIUnit( GetModuleFieldUnit(), Fraction( 1, 1 ) ); // default + + SetScaleUnit(MAP_100TH_MM); + SetScaleFraction(Fraction(1, 1)); + SetDefaultFontHeight(847); // 24p + + pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM); + pItemPool->FreezeIdRanges(); + SetTextDefaults(); + + // die DrawingEngine muss auch wissen, wo er ist + FmFormModel::SetStyleSheetPool( new SdStyleSheetPool( GetPool(), this ) ); + + // Dem DrawOutliner den StyleSheetPool setzen, damit Textobjekte richtig + // eingelesen werden koennen. Der Link zum StyleRequest-Handler des + // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle + // Vorlagen existieren. + SdrOutliner& rOutliner = GetDrawOutliner(); + rOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + rOutliner.SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + + // set linguistic options + { + const SvtLinguConfig aLinguConfig; + SvtLinguOptions aOptions; + aLinguConfig.GetOptions( aOptions ); + + SetLanguage( aOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ); + SetLanguage( aOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ); + SetLanguage( aOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ); + + bOnlineSpell = aOptions.bIsSpellAuto; + bHideSpell = aOptions.bIsSpellHideMarkings; + } + + LanguageType eRealLanguage = MsLangId::getRealLanguage( eLanguage ); + + mpLocale = new ::com::sun::star::lang::Locale( MsLangId::convertLanguageToLocale( eRealLanguage )); + mpCharClass = new CharClass( *mpLocale ); + + // If the current application language is a language that uses right-to-left text... + LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage(); + if( MsLangId::isRightToLeft( eRealCTLLanguage ) ) + { + DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // ... then we have to set this as a default + } + + SetDefaultTabulator( 1250 ); + + rOutliner.SetDefaultLanguage( Application::GetSettings().GetLanguage() ); + + if (pDocSh) + SetLinkManager( new SvxLinkManager(pDrDocSh) ); + + ULONG nCntrl = rOutliner.GetControlWord(); + nCntrl |= EE_CNTRL_ALLOWBIGOBJS; + nCntrl |= EE_CNTRL_URLSFXEXECUTE; + + if (bHideSpell) + nCntrl |= EE_CNTRL_NOREDLINES; + else + nCntrl &= ~EE_CNTRL_NOREDLINES; + + if (bOnlineSpell) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + + nCntrl &= ~ EE_CNTRL_ULSPACESUMMATION; + SetSummationOfParagraphs( sal_False ); + rOutliner.SetControlWord(nCntrl); + + SetPrinterIndependentLayout(1); + + // Dem HitTestOutliner den StyleSheetPool setzen. + // Der Link zum StyleRequest-Handler des + // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle + // Vorlagen existieren. + SfxItemSet aSet2( pHitTestOutliner->GetEmptyItemSet() ); + pHitTestOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)GetStyleSheetPool() ); + + pHitTestOutliner->SetCalcFieldValueHdl( LINK(SD_MOD(), SdModule, CalcFieldValueHdl) ); + + + pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() ); + + ULONG nCntrl2 = pHitTestOutliner->GetControlWord(); + nCntrl2 |= EE_CNTRL_ALLOWBIGOBJS; + nCntrl2 |= EE_CNTRL_URLSFXEXECUTE; + nCntrl2 |= EE_CNTRL_NOREDLINES; + nCntrl2 &= ~EE_CNTRL_ONLINESPELLING; + + nCntrl2 &= ~ EE_CNTRL_ULSPACESUMMATION; + pHitTestOutliner->SetControlWord( nCntrl2 ); + + { + String aControlLayerName( RTL_CONSTASCII_USTRINGPARAM( "LAYER_CONTROLS" ) ); + + SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); + rLayerAdmin.NewLayer( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_LAYOUT" )) ); + rLayerAdmin.NewLayer( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )) ); + rLayerAdmin.NewLayer( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )) ); + rLayerAdmin.NewLayer( aControlLayerName ); + rLayerAdmin.NewLayer( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_MEASURELINES" )) ); + + rLayerAdmin.SetControlLayerName(aControlLayerName); + } + + pFrameViewList = new List(); +} + +SdDrawDocument::~SdDrawDocument() +{ + Broadcast(SdrHint(HINT_MODELCLEARED)); + + CloseBookmarkDoc(); + SetAllocDocSh(FALSE); + + Clear(); + + if (pLinkManager) + { + if ( pLinkManager->GetLinks().Count() ) + { + pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() ); + } + + delete pLinkManager; + pLinkManager = NULL; + } + + FrameView* pFrameView = NULL; + + for (ULONG i = 0; i < pFrameViewList->Count(); i++) + { + pFrameView = (FrameView*) pFrameViewList->GetObject(i); + + if (pFrameView) + delete pFrameView; + } + + delete pFrameViewList; + pFrameViewList = NULL; + + if (pCustomShowList) + { + for (ULONG j = 0; j < pCustomShowList->Count(); j++) + { + SdCustomShow* pCustomShow = (SdCustomShow*) pCustomShowList->GetObject(j); + delete pCustomShow; + } + + delete pCustomShowList; + pCustomShowList = NULL; + } + + delete pOutliner; + pOutliner = NULL; + + delete pInternalOutliner; + pInternalOutliner = NULL; + + delete pDeletedPresObjList; + pDeletedPresObjList = NULL; + + delete mpLocale; + mpLocale = NULL; + + delete mpCharClass; + mpCharClass = NULL; +} + +/************************************************************************* +|* +|* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger +|* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden +|* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN +|* der SdrPage sind). +|* +\************************************************************************/ + +SdrPage* SdDrawDocument::AllocPage(FASTBOOL bMasterPage) +{ + return new SdPage(*this, NULL, bMasterPage); +} + +/************************************************************************* +|* +|* Inserter fuer SvStream zum Speichern +|* +\************************************************************************/ + +SvStream& operator << (SvStream& rOut, SdDrawDocument& rDoc) +{ + // #90477# CharSet eSysSet = ::GetStoreCharSet( gsl_getSystemTextEncoding()); + CharSet eSysSet = GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion()); + + /************************************************************************** + * Aktuelle FileFormat-Versionsnummer + * Bei Aenderugen stets inkrementieren und beim Laden beruecksichtigen! + **************************************************************************/ + rDoc.nFileFormatVersion = 18; + + rOut << (FmFormModel&) rDoc; + + if ( rDoc.IsStreamingSdrModel() ) + { + // Es wird nur das SdrModel gestreamt, nicht das SdDrawDocument! + // Anwendungsfall: svdraw Clipboard-Format + return(rOut); + } + + SdIOCompat aIO(rOut, STREAM_WRITE, rDoc.nFileFormatVersion); + + BOOL bDummy = TRUE; + rOut << bDummy; // ehem. bPresentation + rOut << rDoc.bPresAll; + rOut << rDoc.bPresEndless; + rOut << rDoc.bPresManual; + rOut << rDoc.bPresMouseVisible; + rOut << rDoc.bPresMouseAsPen; + rOut << rDoc.nPresFirstPage; + + // Es wird nun eine Liste von FrameViews geschrieben (siehe weiter unten), + // daher wird an dieser Stelle ein FALSE vermerkt. + BOOL bSingleFrameView = FALSE; + rOut << bSingleFrameView; + + /************************************************************************** + * Frueher (StarDraw Version 3.0, File-Format Version 3) wurde hier das + * JobSetup geschrieben, nun der Printer (binaer-kompatibel, daher wurde + * die Version des File-Formats nicht geaendert) + **************************************************************************/ + if (rDoc.pDocSh) + { + SfxPrinter* pPrinter = rDoc.pDocSh->GetPrinter(TRUE); + pPrinter->Store(rOut); + } + else + { + // Keine DocShell, daher wird ein JobSetup geschrieben + JobSetup aJobSetup; + rOut << aJobSetup; + } + + rOut << (sal_uInt32) rDoc.eLanguage; + + /************************************************************************** + * FrameViews schreiben + **************************************************************************/ + sal_uInt32 nFrameViewCount = 0; + + // Anzahl FrameViews schreiben + rOut << nFrameViewCount; + + + rOut << rDoc.bStartPresWithNavigator; + rOut << rDoc.bPresLockedPages; + rOut << rDoc.bPresAlwaysOnTop; + rOut << rDoc.bOnlineSpell; + rOut << rDoc.bHideSpell; + rOut << rDoc.bPresFullScreen; + rOut.WriteByteString( rDoc.aPresPage, eSysSet ); + rOut << rDoc.bAnimationAllowed; + + UINT16 nDocType = (UINT16) rDoc.eDocType; + rOut << nDocType; + + // CustomShow aktiv + rOut << rDoc.bCustomShow; + + // Anzahl CustomShows schreiben + sal_uInt32 nCustomShowCount = 0; + + if (rDoc.pCustomShowList) + { + nCustomShowCount = rDoc.pCustomShowList->Count(); + } + + rOut << nCustomShowCount; + + if (rDoc.pCustomShowList) + { + for (ULONG i = 0; i < nCustomShowCount; i++) + { + // CustomShows schreiben + SdCustomShow* pCustomShow = (SdCustomShow*) rDoc.pCustomShowList->GetObject(i); + rOut << *pCustomShow; + } + + // Position der aktuellen CustomShow + sal_uInt32 nCurPos = rDoc.pCustomShowList->GetCurPos(); + rOut << nCurPos; + } + + // ab Version 15 + rOut << (sal_uInt32) rDoc.GetPageNumType(); + + // ab Version 17 + rOut << rDoc.GetPresPause() << rDoc.IsPresShowLogo(); + + // ab Version 18 (keine Aenderung) + + return rOut; +} + +/************************************************************************* +|* +|* Extractor fuer SvStream zum Laden +|* +\************************************************************************/ + +SvStream& operator >> (SvStream& rIn, SdDrawDocument& rDoc) +{ + // #90477# CharSet eSysSet = ::GetStoreCharSet( gsl_getSystemTextEncoding()); + CharSet eSysSet = GetSOLoadTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rIn.GetVersion()); + + rIn >> (FmFormModel&) rDoc; + rDoc.GetItemPool().LoadCompleted(); + rDoc.SetTextDefaults(); // overwrites loaded pool defaults + + // Turn off printer independent layout (make it printer *dependent*) for + // pre-6.0 documents. + rDoc.SetPrinterIndependentLayout ( + ::com::sun::star::document::PrinterIndependentLayout::DISABLED); + + // Fehler ? + if (rIn.GetError() != 0) + return (rIn); + + if ( rDoc.IsStreamingSdrModel() ) + { + // Es wird nur das SdrModel gestreamt, nicht das SdDrawDocument! + // Anwendungsfall: svdraw Clipboard-Format + return(rIn); + } + + SdIOCompat aIO(rIn, STREAM_READ); + + BOOL bDummy; + rIn >> bDummy; // ehem. bPresentation + rIn >> rDoc.bPresAll; + rIn >> rDoc.bPresEndless; + rIn >> rDoc.bPresManual; + rIn >> rDoc.bPresMouseVisible; + rIn >> rDoc.bPresMouseAsPen; + rIn >> rDoc.nPresFirstPage; + + rDoc.nFileFormatVersion = aIO.GetVersion(); + + if (rDoc.nFileFormatVersion >= 1) + { + // Daten der Versionen >= 1 einlesen + + BOOL bSingleFrameView; + rIn >> bSingleFrameView; + + if (bSingleFrameView) + { + FrameView * pFrameView = new FrameView( &rDoc ); + rIn >> *pFrameView; + rDoc.pFrameViewList->Insert(pFrameView, LIST_APPEND); + + // Fehler ? + if (rIn.GetError() != 0) + return (rIn); + } + } + + if (rDoc.nFileFormatVersion >= 2) + { + SfxPrinter* pPrinter = SdDrawDocShell::CreatePrinter(rIn,rDoc); + MapMode aMM (pPrinter->GetMapMode()); + aMM.SetMapUnit(MAP_100TH_MM); + pPrinter->SetMapMode(aMM); + if (rDoc.pDocSh) // z. B. nicht bei "Einfuegen-Datei" + rDoc.pDocSh->SetPrinter(pPrinter); + else + delete pPrinter; + } + + if (rDoc.nFileFormatVersion >= 3) + { + sal_uInt32 nTmp; + rIn >> nTmp; + rDoc.SetLanguage( (LanguageType) nTmp, EE_CHAR_LANGUAGE ); + } + + if (rDoc.nFileFormatVersion >= 4) + { + /********************************************************************** + * FrameViews lesen + **********************************************************************/ + ULONG nCount = 0; + FrameView* pFrameView = NULL; + + for (nCount=0; nCount<rDoc.pFrameViewList->Count(); nCount++) + { + // Ggf. FrameViews loeschen + pFrameView = (FrameView*) rDoc.pFrameViewList->GetObject(nCount); + + if (pFrameView) + delete pFrameView; + } + + rDoc.pFrameViewList->Clear(); + + // Anzahl FrameViews lesen + const SvtSaveOptions aOptions; + BOOL bIsSaveDocView = aOptions.IsSaveDocView(); + + sal_uInt32 nFrameViewCount = 0; + rIn >> nFrameViewCount; + + for (nCount=0; nCount<nFrameViewCount; nCount++) + { + // Einzelne FrameViews lesen + pFrameView = new FrameView( &rDoc ); + rIn >> *pFrameView; + + if (bIsSaveDocView) + { + // FrameViews werden fuer die ViewShell gebraucht + // Die FrameView gehoert nun der Liste + rDoc.pFrameViewList->Insert(pFrameView, nCount); + } + else + { + // FrameView kann wieder geloescht werden + delete pFrameView; + } + + // Fehler ? + if (rIn.GetError() != 0) + return (rIn); + } + } + + if (rDoc.nFileFormatVersion >= 5) + { + rIn >> rDoc.bStartPresWithNavigator; + } + + if (rDoc.nFileFormatVersion >= 6) + { + rIn >> rDoc.bPresLockedPages; + } + + if (rDoc.nFileFormatVersion >= 7) + { + rIn >> rDoc.bPresAlwaysOnTop; + } + + if (rDoc.nFileFormatVersion >= 8) + { + rIn >> rDoc.bOnlineSpell; + rIn >> rDoc.bHideSpell; + } + + if (rDoc.nFileFormatVersion >= 9) + { + rIn >> rDoc.bPresFullScreen; + } + + if (rDoc.nFileFormatVersion >= 10) + { + rIn.ReadByteString( rDoc.aPresPage, eSysSet ); + } + + if (rDoc.nFileFormatVersion >= 11) + { + rIn >> rDoc.bAnimationAllowed; + } + + if (rDoc.nFileFormatVersion >= 12) + { + UINT16 nDocType; + rIn >> nDocType; + } + + if (rDoc.nFileFormatVersion >= 13) + { + // Keine Aenderung + } + + if (rDoc.nFileFormatVersion >= 14) + { + // CustomShow aktiv + rIn >> rDoc.bCustomShow; + + sal_uInt32 nCustomShowCount = 0; + rIn >> nCustomShowCount; + + if (nCustomShowCount > 0) + { + // Liste erzeugen + rDoc.GetCustomShowList(TRUE); + rDoc.pCustomShowList->Clear(); + + for (ULONG i = 0; i < nCustomShowCount; i++) + { + // Einzelne CustomShows lesen + SdCustomShow* pCustomShow = new SdCustomShow(&rDoc); + rIn >> *pCustomShow; + + // Die CustomShows gehoert nun der Liste + rDoc.pCustomShowList->Insert(pCustomShow, i); + + // Fehler ? + if (rIn.GetError() != 0) + return (rIn); + } + + // Aktuelle CustomShow selektieren + sal_uInt32 nCurPos; + rIn >> nCurPos; + rDoc.pCustomShowList->Seek(nCurPos); + } + } + + if (rDoc.nFileFormatVersion >= 15) + { + sal_uInt32 nTmp; + rIn >> nTmp; + rDoc.SetPageNumType( (SvxNumType) nTmp ); + } + + if (rDoc.nFileFormatVersion >= 17) + { + sal_uInt32 nPauseSec; + BOOL bShowLogo; + + rIn >> nPauseSec >> bShowLogo; + rDoc.SetPresPause( nPauseSec ); + rDoc.SetPresShowLogo( bShowLogo ); + } + else + rDoc.SetPresPause( 0 ); + + if (rDoc.nFileFormatVersion >= 18) + { + // Keine Aenderung + } + + /************************************************************************** + * So machts der Writer, und so muessen es alle machen: + * Bug 9714: Der CharSet an den Fonts muss geaendert werden, wenn + * es der globale CharSet ist (MT) + **************************************************************************/ + SfxItemPool& rPool = rDoc.GetItemPool(); + USHORT nMaxItems = rPool.GetItemCount(EE_CHAR_FONTINFO); + SvxFontItem* pItem; + CharSet eSrcSet = ((SdPage*) rDoc.GetPage(0))->GetCharSet(); + + for (USHORT n = 0; n < nMaxItems; ++n) + { + pItem = (SvxFontItem*) rPool.GetItem(EE_CHAR_FONTINFO, n); + if (pItem && pItem->GetCharSet() == eSrcSet) + { + pItem->GetCharSet() = eSysSet; + } + } + + return rIn; +} + +/************************************************************************* +|* +|* "Alle Dias"-Parameter der Praesentation aendern +|* +\************************************************************************/ + +void SdDrawDocument::SetPresAll(BOOL bNewPresAll) +{ + bPresAll = bNewPresAll; +} + +/************************************************************************* +|* +|* "Endlos"-Parameter der Praesentation aendern +|* +\************************************************************************/ + +void SdDrawDocument::SetPresEndless(BOOL bNewPresEndless) +{ + bPresEndless = bNewPresEndless; +} + +/************************************************************************* +|* +|* "Manuell"-Parameter der Praesentation aendern +|* +\************************************************************************/ + +void SdDrawDocument::SetPresManual(BOOL bNewPresManual) +{ + bPresManual = bNewPresManual; +} + +/************************************************************************* +|* +|* "Maus sichtbar"-Parameter der Praesentation aendern +|* +\************************************************************************/ + +void SdDrawDocument::SetPresMouseVisible(BOOL bNewPresMouseVisible) +{ + bPresMouseVisible = bNewPresMouseVisible; +} + +/************************************************************************* +|* +|* "Maus als Stift"-Parameter der Praesentation aendern +|* +\************************************************************************/ + +void SdDrawDocument::SetPresMouseAsPen(BOOL bNewPresMouseAsPen) +{ + bPresMouseAsPen = bNewPresMouseAsPen; +} + +/************************************************************************* +|* +|* "Ab Dia"-Parameter der Praesentation aendern +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* SetChanged(), das Model wurde geaendert +|* +\************************************************************************/ + +void SdDrawDocument::SetChanged(FASTBOOL bFlag) +{ + if (pDocSh) + { + if (bNewOrLoadCompleted && pDocSh->IsEnableSetModified()) + { + // weitergeben an Basisklasse + FmFormModel::SetChanged(bFlag); + + // an ObjectShell weiterleiten + pDocSh->SetModified(bFlag); + } + } + else + { + // weitergeben an Basisklasse + FmFormModel::SetChanged(bFlag); + } +} + +/************************************************************************* +|* +|* NbcSetChanged(), the model changed, don't call anybody else +|* +\************************************************************************/ + +void SdDrawDocument::NbcSetChanged(FASTBOOL bFlag) +{ + // #100237# forward to baseclass + FmFormModel::SetChanged(bFlag); +} + +/************************************************************************* +|* +|* NewOrLoadCompleted +|* +|* Wird gerufen, wenn das Dokument geladen wurde bzw. feststeht, dass es +|* nicht mehr geladen wird. +|* +\************************************************************************/ + +void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode) +{ + if (eMode == NEW_DOC) + { + // Neues Dokument: + // Praesentations- und Standardvorlagen erzeugen, + // Pool fuer virtuelle Controls erzeugen + CreateLayoutTemplates(); + + ((SdStyleSheetPool*)pStyleSheetPool)->CreatePseudosIfNecessary(); + } + else if (eMode == DOC_LOADED) + { + RestoreLayerNames(); + + CheckMasterPages(); + + if ( GetMasterSdPageCount(PK_STANDARD) > 1 ) + RemoveDuplicateMasterPages(); + + for ( USHORT i = 0; i < GetPageCount(); i++ ) + { + // Check for correct layout names + SdPage* pPage = (SdPage*) GetPage( i ); + if( pPage->GetMasterPageCount() > 0 ) + { + SdPage* pMaster = (SdPage*) pPage->GetMasterPage( 0 ); + if( pMaster && pMaster->GetLayoutName() != pPage->GetLayoutName() ) + pPage->SetLayoutName( pMaster->GetLayoutName() ); + } + } + + for ( USHORT nPage = 0; nPage < GetMasterPageCount(); nPage++) + { + // LayoutName and PageName must be the same + SdPage* pPage = (SdPage*) GetMasterPage( nPage ); + + String aName( pPage->GetLayoutName() ); + aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ) ); + + if( aName != pPage->GetName() ) + pPage->SetName( aName ); + + SdrObject* pPresObj = pPage->GetPresObj( PRESOBJ_BACKGROUND ) ; + + if( pPage->GetPageKind() == PK_STANDARD ) + { + DBG_ASSERT( pPresObj, "Masterpage without a background object!" ); + if (pPresObj && pPresObj->GetOrdNum() != 0 ) + pPage->NbcSetObjectOrdNum(pPresObj->GetOrdNum(),0); + } + else + { + DBG_ASSERT( pPresObj == NULL, "Non Standard Masterpage with a background object!\n(This assertion is ok for old binary files)" ); + if( pPresObj ) + { + pPage->RemoveObject( pPresObj->GetOrdNum() ); + pPage->GetPresObjList()->Remove(pPresObj); + delete pPresObj; + } + } + } + + // Sprachabhaengige Namen der Vorlagen setzen + ((SdStyleSheetPool*)pStyleSheetPool)->UpdateStdNames(); + + // Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle) + ((SdStyleSheetPool*)pStyleSheetPool)->CreatePseudosIfNecessary(); + } + + // Standardvorlage an der Drawing Engine setzen + String aName( SdResId(STR_STANDARD_STYLESHEET_NAME)); + SfxStyleSheet* pSheet = (SfxStyleSheet*)pStyleSheetPool-> + Find(aName, SFX_STYLE_FAMILY_PARA); + SetDefaultStyleSheet(pSheet); + + // Draw-Outliner und Dokument Outliner initialisieren, + // aber nicht den globalen Outliner, den der ist ja nicht + // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler + Outliner& rDrawOutliner = GetDrawOutliner(); + rDrawOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + rDrawOutliner.SetMinDepth(0); + ULONG nCntrl = rDrawOutliner.GetControlWord(); + if (bOnlineSpell) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + rDrawOutliner.SetControlWord(nCntrl); + + // HitTest-Outliner und Dokument Outliner initialisieren, + // aber nicht den globalen Outliner, den der ist ja nicht + // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler + pHitTestOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + pHitTestOutliner->SetMinDepth(0); + + if (pOutliner) + { + pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + pOutliner->SetMinDepth(0); + } + if (pInternalOutliner) + { + pInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + pInternalOutliner->SetMinDepth(0); + } + + if ( eMode == DOC_LOADED ) + { + if (nFileFormatVersion <= 17 && nFileFormatVersion != SDIOCOMPAT_VERSIONDONTKNOW) + { + // Da sich die Bedeutung der SvxLRSpaceItems ab nFileFormatVersion = 16 + // geaendert hat (Bullet-Handling des Outliners), muss fuer aeltere Versionen + // eine Korrektur vorgenommen werden. + // Bis Version 17 gab es noch diverse Probleme + ((SdStyleSheetPool*) pStyleSheetPool)->AdjustLRSpaceItems(); + } + + // Praesentationsobjekte muessen wieder Listener der entsprechenden + // Vorlagen werden + SdStyleSheetPool* pSPool = (SdStyleSheetPool*) GetStyleSheetPool(); + SfxStyleSheet* pSheet = NULL; + USHORT nPage, nPageCount; + + // #96323# create missing layout style sheets for broken documents + // that where created with the 5.2 + nPageCount = GetMasterSdPageCount( PK_STANDARD ); + for (nPage = 0; nPage < nPageCount; nPage++) + { + SdPage* pPage = GetMasterSdPage(nPage, PK_STANDARD); + pSPool->CreateLayoutStyleSheets( pPage->GetName(), sal_True ); + } + + // Standard- und Notizseiten: + for (nPage = 0; nPage < GetPageCount(); nPage++) + { + SdPage* pPage = (SdPage*)GetPage(nPage); + + if( nFileFormatVersion <= 4 ) + pPage->CreateTitleAndLayout(); + + SdrObjListIter aIter( *pPage ); + while( aIter.IsMore() ) + { + OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject(); + if( pOPO ) + { + if( pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT ); + + pOPO->FinishLoad( pSPool ); + } + } + + List* pPresObjList = pPage->GetPresObjList(); + ULONG nObjCount = pPresObjList->Count(); + if (nObjCount) + { + // Listen mit Titel- und Gliederungsvorlagen erstellen + String aName = pPage->GetLayoutName(); + aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR )); + + List* pOutlineList = pSPool->CreateOutlineSheetList(aName); + SfxStyleSheet* pTitleSheet = (SfxStyleSheet*) + pSPool->GetTitleSheet(aName); + + // jetzt nach Titel- und Gliederungstextobjekten suchen und + // Objekte zu Listenern machen + SdrAttrObj* pObj = (SdrAttrObj*)pPresObjList->First(); + while (pObj) + { + if (pObj->GetObjInventor() == SdrInventor) + { + OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); + SdPage* pPage = (SdPage*) pObj->GetPage(); + UINT16 nId = pObj->GetObjIdentifier(); + + if (nId == OBJ_TITLETEXT) + { + if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); + + // TRUE: harte Attribute dabei nicht loeschen + if (pTitleSheet) + pObj->SetStyleSheet(pTitleSheet, TRUE); + } + else if (nId == OBJ_OUTLINETEXT) + { + if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT ); + + for (USHORT nSheet = 0; nSheet < 10; nSheet++) + { + pSheet = (SfxStyleSheet*)pOutlineList->GetObject(nSheet); + if (pSheet) + { + pObj->StartListening(*pSheet); + + if( nSheet == 0) + // Textrahmen hoert auf StyleSheet der Ebene1 + pObj->NbcSetStyleSheet(pSheet, TRUE); + } + } + } + + if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage) + { + PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); + String aString = pPage->GetPresObjText(ePresObjKind); + + if (aString.Len()) + { + SdOutliner* pInternalOutl = GetInternalOutliner(TRUE); + pInternalOutl->SetMinDepth(0); + pPage->SetObjText( (SdrTextObj*) pObj, pInternalOutl, ePresObjKind, aString ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), TRUE ); + pInternalOutl->Clear(); + } + } + } + pObj = (SdrAttrObj*)pPresObjList->Next(); + } + + delete pOutlineList; + } + } + + // Masterpages: + for (nPage = 0; nPage < GetMasterPageCount(); nPage++) + { + SdPage* pPage = (SdPage*)GetMasterPage(nPage); + SdrObjListIter aIter( *pPage ); + while( aIter.IsMore() ) + { + OutlinerParaObject* pOPO = aIter.Next()->GetOutlinerParaObject(); + if( pOPO ) + { + if( pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT ); + + pOPO->FinishLoad( pSPool ); + } + } + + // BackgroundObjekt vor Selektion schuetzen #62144# + SdrObject* pBackObj = pPage->GetPresObj(PRESOBJ_BACKGROUND); + if(pBackObj) + pBackObj->SetMarkProtect(TRUE); + + List* pPresObjList = pPage->GetPresObjList(); + ULONG nObjCount = pPresObjList->Count(); + if (nObjCount) + { + // Listen mit Titel- und Gliederungsvorlagen erstellen + String aName = pPage->GetLayoutName(); + aName.Erase(aName.SearchAscii( SD_LT_SEPARATOR )); + + List* pOutlineList = pSPool->CreateOutlineSheetList(aName); + SfxStyleSheet* pTitleSheet = (SfxStyleSheet*) + pSPool->GetTitleSheet(aName); + + // jetzt nach Titel- und Gliederungstextobjekten suchen und + // Objekte zu Listenern machen + SdrAttrObj* pObj = (SdrAttrObj*)pPresObjList->First(); + while (pObj) + { + if (pObj->GetObjInventor() == SdrInventor) + { + OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); + UINT16 nId = pObj->GetObjIdentifier(); + + if (nId == OBJ_TITLETEXT) + { + if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); + + // TRUE: harte Attribute dabei nicht loeschen + if (pTitleSheet) + pObj->SetStyleSheet(pTitleSheet, TRUE); + } + else if (nId == OBJ_OUTLINETEXT) + { + if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) + pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT ); + + for (USHORT nSheet = 0; nSheet < 10; nSheet++) + { + pSheet = (SfxStyleSheet*)pOutlineList->GetObject(nSheet); + if (pSheet) + { + pObj->StartListening(*pSheet); + + if( nSheet == 0) + // Textrahmen hoert auf StyleSheet der Ebene1 + pObj->NbcSetStyleSheet(pSheet, TRUE); + } + } + } + + SdPage* pPage = (SdPage*) pObj->GetPage(); + + if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage) + { + PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); + String aString = pPage->GetPresObjText(ePresObjKind); + + if (aString.Len()) + { + SdOutliner* pInternalOutl = GetInternalOutliner(TRUE); + pInternalOutl->SetMinDepth(0); + pPage->SetObjText( (SdrTextObj*) pObj, pInternalOutl, ePresObjKind, aString ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), TRUE ); + pInternalOutl->Clear(); + } + } + } + pObj = (SdrAttrObj*)pPresObjList->Next(); + } + + delete pOutlineList; + } + } + } + + bNewOrLoadCompleted = TRUE; + + /************************************************************************** + * Alle gelinkten Pages aktualisieren + **************************************************************************/ + SdPage* pPage = NULL; + USHORT nMaxSdPages = GetSdPageCount(PK_STANDARD); + + for (USHORT nSdPage=0; nSdPage < nMaxSdPages; nSdPage++) + { + pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD); + + if (pPage && pPage->GetFileName().Len() && pPage->GetBookmarkName().Len()) + { + pPage->SetModel(this); + } + } + + UpdateAllLinks(); + + SetChanged( FALSE ); +} + +/** updates all links, only links in this document should by resolved */ +void SdDrawDocument::UpdateAllLinks() +{ + if ( !pDocLockedInsertingLinks && pLinkManager && pLinkManager->GetLinks().Count() ) + { + pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved + + pLinkManager->UpdateAllLinks(TRUE, FALSE); + + if( pDocLockedInsertingLinks == this ) + pDocLockedInsertingLinks = NULL; // unlock inserting links + } +} + + +/************************************************************************* +|* +|* Lokaler Outliner, welcher fuer den Gliederungsmodus verwendet wird +|* In diesen Outliner werden ggf. OutlinerViews inserted! +|* +\************************************************************************/ + +SdOutliner* SdDrawDocument::GetOutliner(BOOL bCreateOutliner) +{ + if (!pOutliner && bCreateOutliner) + { + pOutliner = new SdOutliner( this, OUTLINERMODE_TEXTOBJECT ); + + if (pDocSh) + pOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *pDocSh ) ); + + pOutliner->SetDefTab( nDefaultTabulator ); + pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + pOutliner->SetMinDepth(0); + } + + return(pOutliner); +} + + +/************************************************************************* +|* +|* Interner Outliner, welcher fuer die Erzeugung von Textobjekten +|* verwendet wird. +|* In diesen Outliner werden keine OutlinerViews inserted! +|* +\************************************************************************/ + +SdOutliner* SdDrawDocument::GetInternalOutliner(BOOL bCreateOutliner) +{ + if ( !pInternalOutliner && bCreateOutliner ) + { + pInternalOutliner = new SdOutliner( this, OUTLINERMODE_TEXTOBJECT ); + // MT: + // Dieser Outliner wird nur fuer das Erzeugen spezieller Textobjekte + // verwendet. Da in diesen Textobjekten keine Portion-Informationen + // gespeichert werden muessen, kann/soll der Update-Mode immer FALSE bleiben. + pInternalOutliner->SetUpdateMode( FALSE ); + pInternalOutliner->EnableUndo( FALSE ); + + if (pDocSh) + pInternalOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *pDocSh ) ); + + pInternalOutliner->SetDefTab( nDefaultTabulator ); + pInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); + pInternalOutliner->SetMinDepth(0); + } + + DBG_ASSERT( !pInternalOutliner || ( pInternalOutliner->GetUpdateMode() == FALSE ) , "InternalOutliner: UpdateMode = TRUE !" ); + DBG_ASSERT( !pInternalOutliner || ( pInternalOutliner->IsUndoEnabled() == FALSE ), "InternalOutliner: Undo = TRUE !" ); + + // MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer: + // Vorteile: + // a) Keine unnoetigen Clear-Aufrufe + // b) Kein Muell im Speicher. + DBG_ASSERT( !pInternalOutliner || ( ( pInternalOutliner->GetParagraphCount() == 1 ) && ( pInternalOutliner->GetText( pInternalOutliner->GetParagraph( 0 ) ).Len() == 0 ) ), "InternalOutliner: Nicht leer!" ); + + return pInternalOutliner; +} + +/************************************************************************* +|* +|* beim Starten der Praesentation den Navigator hochfahren oder nicht +|* +\************************************************************************/ + +void SdDrawDocument::SetStartPresWithNavigator(BOOL bStart) +{ + bStartPresWithNavigator = bStart; +} + +/************************************************************************* +|* +|* in der Praesentation bei einem Klick in die Flaeche nicht die Seite wechslen +|* +\************************************************************************/ + +void SdDrawDocument::SetPresLockedPages(BOOL bLock) +{ + bPresLockedPages = bLock; +} + +/************************************************************************* +|* +|* Praesentation immer oberstes Fenster oder nicht +|* +\************************************************************************/ + +void SdDrawDocument::SetPresAlwaysOnTop(BOOL bOnTop) +{ + bPresAlwaysOnTop = bOnTop; +} + +/************************************************************************* +|* +|* Praesentation im Vollbild-Modus oder im Fenster +|* +\************************************************************************/ + +void SdDrawDocument::SetPresFullScreen(BOOL bNewFullScreen) +{ + bPresFullScreen = bNewFullScreen; +} + + +uno::Reference< uno::XInterface > SdDrawDocument::createUnoModel() +{ + uno::Reference< uno::XInterface > xModel; + + try + { + xModel = pDocSh->GetModel(); + } + catch( uno::RuntimeException& e ) + { + e; // to avoid a compiler warning... + } + + return xModel; +} + +SvxNumType SdDrawDocument::GetPageNumType() const +{ + return ePageNumType; +} + +void SdDrawDocument::SetPrinterIndependentLayout (sal_Int32 nMode) +{ + // #108104# + // DBG_ASSERT (pDocSh!=NULL, "No available document shell to set ref device at."); + + switch (nMode) + { + case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: + case ::com::sun::star::document::PrinterIndependentLayout::ENABLED: + // Just store supported modes and inform the doc shell. + mnPrinterIndependentLayout = nMode; + + // #108104# + // Since it is possible that a SdDrawDocument is constructed without a + // SdDrawDocShell the pointer member pDocSh needs to be tested + // before the call is executed. This is e.-g. used for copy/paste. + if(pDocSh) + { + pDocSh->UpdateRefDevice (); + } + + break; + + default: + // Ignore unknown values. + break; + } +} + +sal_Int32 SdDrawDocument::GetPrinterIndependentLayout (void) +{ + return mnPrinterIndependentLayout; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_drawdoc2.cxx b/binfilter/bf_sd/source/core/sd_drawdoc2.cxx new file mode 100644 index 000000000000..500cebba9626 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_drawdoc2.cxx @@ -0,0 +1,596 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#ifndef SVX_LIGHT +#include <bf_sfx2/printer.hxx> +#include "sdoutl.hxx" +#else // SVX_LIGHT +#define SfxPrinter Printer +#endif // !SVX_LIGHT + +#include <bf_svx/paperinf.hxx> +#include <bf_svx/svdopage.hxx> +#include <vcl/svapp.hxx> +#include <bf_svx/eeitem.hxx> +#include <bf_svx/eeitemid.hxx> +#include <bf_svx/langitem.hxx> +#include <bf_svtools/itempool.hxx> + + +#include <bf_svx/dialogs.hrc> + + +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "glob.hrc" +#include "cusshow.hxx" + +#include "bf_sd/docshell.hxx" +#include "bf_sd/frmview.hxx" + +namespace binfilter { + +SdPage* SdDrawDocument::GetSdPage(USHORT nPgNum, PageKind ePgKind) const +{ + SdPage* pPage = NULL; + SdPage* pPageFound = NULL; + + USHORT nPage = 0; + const USHORT nMaxPages = GetPageCount(); + USHORT nPageNum = 0; + + while (nPage < nMaxPages && !pPageFound) + { + pPage = (SdPage*) GetPage(nPage); + + if (pPage && pPage->GetPageKind() == ePgKind) + { + if (nPageNum == nPgNum) + { + pPageFound = pPage; + } + + nPageNum++; + } + + nPage++; + } + + return (pPageFound); +} + + +USHORT SdDrawDocument::GetSdPageCount(PageKind ePgKind) const +{ + SdPage* pPage = NULL; + + USHORT nPage; + const USHORT nMaxPages = GetPageCount(); + USHORT nPageNum = 0; + + for (nPage = 0; nPage < nMaxPages; nPage++) + { + pPage = (SdPage*) GetPage(nPage); + + if (pPage && pPage->GetPageKind() == ePgKind) + { + nPageNum++; + } + } + + return (nPageNum); +} + + +SdPage* SdDrawDocument::GetMasterSdPage(USHORT nPgNum, PageKind ePgKind) +{ + SdPage* pPage = NULL; + SdPage* pPageFound = NULL; + + USHORT nPage = 0; + const USHORT nMaxPages = GetMasterPageCount(); + USHORT nPageNum = 0; + + while (nPage < nMaxPages && !pPageFound) + { + pPage = (SdPage*) GetMasterPage(nPage); + + if (pPage && pPage->GetPageKind() == ePgKind) + { + if (nPageNum == nPgNum) + { + pPageFound = pPage; + } + + nPageNum++; + } + + nPage++; + } + + return (pPageFound); +} + +USHORT SdDrawDocument::GetMasterSdPageCount(PageKind ePgKind) const +{ + SdPage* pPage = NULL; + + USHORT nPage; + const USHORT nMaxPages = GetMasterPageCount(); + USHORT nPageNum = 0; + + for (nPage = 0; nPage < nMaxPages; nPage++) + { + pPage = (SdPage*) GetMasterPage(nPage); + + if (pPage && pPage->GetPageKind() == ePgKind) + { + nPageNum++; + } + } + + return (nPageNum); +} + +void SdDrawDocument::UpdatePageObjectsInNotes(USHORT nStartPos) +{ + USHORT nPageCount = GetPageCount(); + SdPage* pPage = NULL; + + for (USHORT nPage = nStartPos; nPage < nPageCount; nPage++) + { + pPage = (SdPage*)GetPage(nPage); + + // wenn es eine Notizseite ist, Seitenobjekt suchen + // und Nummer korrigieren + if (pPage && pPage->GetPageKind() == PK_NOTES) + { + ULONG nObjCount = pPage->GetObjCount(); + SdrObject* pObj = NULL; + for (ULONG nObj = 0; nObj < nObjCount; nObj++) + { +/*?*/ pObj = pPage->GetObj(nObj); +/*?*/ if (pObj->GetObjIdentifier() == OBJ_PAGE && +/*?*/ pObj->GetObjInventor() == SdrInventor) +/*?*/ { + // das Seitenobjekt stellt die vorhergende Seite (also + // die Zeichenseite) dar +/*?*/ DBG_ASSERTWARNING(nStartPos, "Notizseitenpos. darf nicht 0 sein"); + +/*?*/ DBG_ASSERTWARNING(nPage > 1, "Seitenobjekt darf nicht Handzettel darstellen"); + +/*?*/ if (nStartPos > 0 && nPage > 1) +/*?*/ ((SdrPageObj*)pObj)->SetPageNum(nPage - 1); +/*?*/ } +/*?*/ } +/*?*/ } + } +} + +void SdDrawDocument::InsertPage(SdrPage* pPage, USHORT nPos) +{ + FmFormModel::InsertPage(pPage, nPos); + + UpdatePageObjectsInNotes(nPos); +} + +void SdDrawDocument::DeletePage(USHORT nPgNum) +{ + FmFormModel::DeletePage(nPgNum); + + UpdatePageObjectsInNotes(nPgNum); +} + +SdrPage* SdDrawDocument::RemovePage(USHORT nPgNum) +{ + SdrPage* pPage = FmFormModel::RemovePage(nPgNum); + + + if (pCustomShowList) + { + for (ULONG i = 0; i < pCustomShowList->Count(); i++) + { + SdCustomShow* pCustomShow = (SdCustomShow*) pCustomShowList->GetObject(i); + pCustomShow->Remove(pPage); + } + } + + UpdatePageObjectsInNotes(nPgNum); + + return pPage; +} + +void SdDrawDocument::CreateFirstPages() +{ + USHORT nPageCount = GetPageCount(); + + if (nPageCount <= 1) + { + Size aDefSize(21000, 29700); // A4-Hochformat + + BOOL bMasterPage; + SdPage* pHandoutPage = (SdPage*) AllocPage(bMasterPage=FALSE); + + // Stets Querformat + if (aDefSize.Height() <= aDefSize.Width()) + { + pHandoutPage->SetSize(aDefSize); + } + else + { + pHandoutPage->SetSize( Size(aDefSize.Height(), aDefSize.Width()) ); + } + + pHandoutPage->SetBorder(2000, 2000, 2000, 2000); + pHandoutPage->SetPageKind(PK_HANDOUT); + pHandoutPage->SetName( String (SdResId(STR_HANDOUT) ) ); + InsertPage(pHandoutPage, 0); + + SdPage* pHandoutMPage = (SdPage*) AllocPage(bMasterPage=TRUE); + pHandoutMPage->SetSize( pHandoutPage->GetSize() ); + pHandoutMPage->SetPageKind(PK_HANDOUT); + pHandoutMPage->SetBorder( pHandoutPage->GetLftBorder(), + pHandoutPage->GetUppBorder(), + pHandoutPage->GetRgtBorder(), + pHandoutPage->GetLwrBorder() ); + InsertMasterPage(pHandoutMPage, 0); + pHandoutPage->InsertMasterPage( pHandoutMPage->GetPageNum() ); + + SdPage* pPage; + BOOL bClipboard = FALSE; + + if (nPageCount == 0) + { + pPage = (SdPage*) AllocPage(bMasterPage=FALSE); + + if (eDocType == DOCUMENT_TYPE_DRAW) + { + // Draw: stets Default-Groesse mit Raendern + pPage->SetSize(aDefSize); + pPage->SetBorder(0, 0, 0, 0); + } + else + { + // Impress: stets Bildschirmformat + pPage->SetSize( Size(28000, 21000) ); // Bildschirmformat + pPage->SetBorder(0, 0, 0, 0); + } + + InsertPage(pPage, 1); + } + else + { + bClipboard = TRUE; + pPage = (SdPage*) GetPage(1); + } + + /********************************************************************** + * MasterPage einfuegen und an der Seite vermerken + **********************************************************************/ + SdPage* pMPage = (SdPage*) AllocPage(bMasterPage=TRUE); + pMPage->SetSize( pPage->GetSize() ); + pMPage->SetBorder( pPage->GetLftBorder(), + pPage->GetUppBorder(), + pPage->GetRgtBorder(), + pPage->GetLwrBorder() ); + InsertMasterPage(pMPage, 1); + pPage->InsertMasterPage( pMPage->GetPageNum() ); + if( bClipboard ) +/*?*/ pMPage->SetLayoutName( pPage->GetLayoutName() ); + + /********************************************************************** + * Notizen-Seite einfuegen + **********************************************************************/ + SdPage* pNotesPage = (SdPage*) AllocPage(bMasterPage=FALSE); + + // Stets Hochformat + if (aDefSize.Height() >= aDefSize.Width()) + { + pNotesPage->SetSize(aDefSize); + } +/*?*/ else +/*?*/ { +/*?*/ pNotesPage->SetSize( Size(aDefSize.Height(), aDefSize.Width()) ); +/*?*/ } + + pNotesPage->SetBorder(2000, 2000, 2000, 2000); + pNotesPage->SetPageKind(PK_NOTES); + InsertPage(pNotesPage, 2); + if( bClipboard ) +/*?*/ pNotesPage->SetLayoutName( pPage->GetLayoutName() ); + + /********************************************************************** + * MasterPage einfuegen und an der Notizen-Seite vermerken + **********************************************************************/ + SdPage* pNotesMPage = (SdPage*) AllocPage(bMasterPage=TRUE); + pNotesMPage->SetSize( pNotesPage->GetSize() ); + pNotesMPage->SetPageKind(PK_NOTES); + pNotesMPage->SetBorder( pNotesPage->GetLftBorder(), + pNotesPage->GetUppBorder(), + pNotesPage->GetRgtBorder(), + pNotesPage->GetLwrBorder() ); + InsertMasterPage(pNotesMPage, 2); + pNotesPage->InsertMasterPage( pNotesMPage->GetPageNum() ); + if( bClipboard ) +/*?*/ pNotesMPage->SetLayoutName( pPage->GetLayoutName() ); + + WorkStartupHdl(); + + SetChanged(FALSE); + } +} + +void SdDrawDocument::SetLanguage( const LanguageType eLang, const USHORT nId ) +{ + BOOL bChanged = FALSE; + + if( nId == EE_CHAR_LANGUAGE && eLanguage != eLang ) + { + eLanguage = eLang; + bChanged = TRUE; + } + else if( nId == EE_CHAR_LANGUAGE_CJK && eLanguageCJK != eLang ) + { + eLanguageCJK = eLang; + bChanged = TRUE; + } + else if( nId == EE_CHAR_LANGUAGE_CTL && eLanguageCTL != eLang ) + { + eLanguageCTL = eLang; + bChanged = TRUE; + } + + if( bChanged ) + { + GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguage() ); + pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() ); + pItemPool->SetPoolDefaultItem( SvxLanguageItem( eLang, nId ) ); + SetChanged( bChanged ); + } +} + + +LanguageType SdDrawDocument::GetLanguage( const USHORT nId ) const +{ + LanguageType eLangType = eLanguage; + + if( nId == EE_CHAR_LANGUAGE_CJK ) + eLangType = eLanguageCJK; + else if( nId == EE_CHAR_LANGUAGE_CTL ) + eLangType = eLanguageCTL; + + return eLangType; +} + + +void SdDrawDocument::WorkStartupHdl() +{ + BOOL bChanged = IsChanged(); + + SdPage* pHandoutMPage = GetMasterSdPage(0, PK_HANDOUT); + + if (pHandoutMPage->GetAutoLayout() == AUTOLAYOUT_NONE) + pHandoutMPage->SetAutoLayout(AUTOLAYOUT_HANDOUT4, TRUE); + + SdPage* pPage = GetSdPage(0, PK_STANDARD); + + if (pPage->GetAutoLayout() == AUTOLAYOUT_NONE) + pPage->SetAutoLayout(AUTOLAYOUT_NONE, TRUE); + + SdPage* pNotesPage = GetSdPage(0, PK_NOTES); + + if (pNotesPage->GetAutoLayout() == AUTOLAYOUT_NONE) + pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, TRUE); + + SetChanged(bChanged || FALSE); +} + +SdAnimationInfo* SdDrawDocument::GetAnimationInfo(SdrObject* pObject) const +{ + DBG_ASSERT(pObject, "ohne Objekt keine AnimationsInfo"); + USHORT nUD = 0; + USHORT nUDCount = pObject->GetUserDataCount(); + SdrObjUserData* pUD = NULL; + + // gibt es in den User-Daten eine Animationsinformation? + for (nUD = 0; nUD < nUDCount; nUD++) + { + pUD = pObject->GetUserData(nUD); + if (pUD->GetInventor() == SdUDInventor && + pUD->GetId() == SD_ANIMATIONINFO_ID) + { + return (SdAnimationInfo*)pUD; + } + } + return NULL; +} + +SdIMapInfo* SdDrawDocument::GetIMapInfo( SdrObject* pObject ) const +{ + DBG_ASSERT(pObject, "ohne Objekt keine IMapInfo"); + + SdrObjUserData* pUserData = NULL; + SdIMapInfo* pIMapInfo = NULL; + USHORT nCount = pObject->GetUserDataCount(); + + // gibt es in den User-Daten eine IMap-Information? + for ( USHORT i = 0; i < nCount; i++ ) + { + pUserData = pObject->GetUserData( i ); + + if ( ( pUserData->GetInventor() == SdUDInventor ) && ( pUserData->GetId() == SD_IMAPINFO_ID ) ) + pIMapInfo = (SdIMapInfo*) pUserData; + } + + return pIMapInfo; +} + +void SdDrawDocument::CheckMasterPages() +{ + USHORT nMaxPages = GetMasterPageCount(); + + if( nMaxPages < 2 ) + { + return; + } + + SdPage* pPage = NULL; + SdPage* pNotesPage = NULL; + + USHORT nPage; + + for( nPage = 1; nPage < nMaxPages; nPage++ ) + { + pPage = static_cast<SdPage*> (GetMasterPage( nPage )); + if( ((1 == (nPage & 1)) && (pPage->GetPageKind() != PK_STANDARD) ) || + ((0 == (nPage & 1)) && (pPage->GetPageKind() != PK_NOTES) ) ) + break; // then we have a fatal error + } + + if( nPage < nMaxPages ) + { + // there is a fatal error in the master page order, + // we need to repair the document + sal_Bool bChanged = sal_False; + + nPage = 1; + while( nPage < nMaxPages ) + { + pPage = static_cast<SdPage*> (GetMasterPage( nPage )); + if( pPage->GetPageKind() != PK_STANDARD ) + { + bChanged = sal_True; + USHORT nFound = nPage + 1; + while( nFound < nMaxPages ) + { + pPage = static_cast<SdPage*>(GetMasterPage( nFound )); + if( PK_STANDARD == pPage->GetPageKind() ) + { + MoveMasterPage( nFound, nPage ); + pPage->SetInserted(sal_True); + break; + + } + + nFound++; + } + + // if we don't have any more standard pages, were done + if( nMaxPages == nFound ) + break; + } + + nPage++; + + if( nPage < nMaxPages ) + pNotesPage = static_cast<SdPage*>(GetMasterPage( nPage )); + else + pNotesPage = NULL; + + if( (NULL == pNotesPage) || (pNotesPage->GetPageKind() != PK_NOTES) || ( pPage->GetLayoutName() != pNotesPage->GetLayoutName() ) ) + { + bChanged = sal_True; + + USHORT nFound = nPage + 1; + while( nFound < nMaxPages ) + { + pNotesPage = static_cast<SdPage*>(GetMasterPage( nFound )); + if( (PK_NOTES == pNotesPage->GetPageKind()) && ( pPage->GetLayoutName() == pNotesPage->GetLayoutName() ) ) + { + MoveMasterPage( nFound, nPage ); + pNotesPage->SetInserted(sal_True); + break; + } + + nFound++; + } + + // looks like we lost a notes page + if( nMaxPages == nFound ) + { + // so create one + + // first find a reference notes page for size + SdPage* pRefNotesPage = NULL; + nFound = 0; + while( nFound < nMaxPages ) + { + pRefNotesPage = static_cast<SdPage*>(GetMasterPage( nFound )); + if( PK_NOTES == pRefNotesPage->GetPageKind() ) + break; + nFound++; + } + if( nFound == nMaxPages ) + pRefNotesPage = NULL; + + SdPage* pNotesPage = static_cast<SdPage*>(AllocPage(sal_True)); + pNotesPage->SetPageKind(PK_NOTES); + if( pRefNotesPage ) + { + pNotesPage->SetSize( pRefNotesPage->GetSize() ); + pNotesPage->SetBorder( pRefNotesPage->GetLftBorder(), + pRefNotesPage->GetUppBorder(), + pRefNotesPage->GetRgtBorder(), + pRefNotesPage->GetLwrBorder() ); + } + InsertMasterPage(pNotesPage, nPage ); + pNotesPage->SetLayoutName( pPage->GetLayoutName() ); + pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True); + nMaxPages++; + } + } + + nPage++; + } + + // now remove all remaining and unused non PK_STANDARD slides + while( nPage < nMaxPages ) + { + bChanged = sal_True; + + RemoveMasterPage( nPage ); + nMaxPages--; + } + + if( bChanged ) + { + DBG_ERROR( "master pages where in a wrong order" ); + RecalcPageNums( sal_True); + } + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_drawdoc3.cxx b/binfilter/bf_sd/source/core/sd_drawdoc3.cxx new file mode 100644 index 000000000000..5c7ad92243d2 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_drawdoc3.cxx @@ -0,0 +1,309 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <utility> +#include <algorithm> + +#include <bf_sfx2/docfile.hxx> + + + +#include <set> + +#include "glob.hrc" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "strmname.h" + +#include "bf_sd/docshell.hxx" + +namespace binfilter { + +using namespace ::com::sun::star; + +#define POOL_BUFFER_SIZE (USHORT)32768 +#define BASIC_BUFFER_SIZE (USHORT)8192 +#define DOCUMENT_BUFFER_SIZE (USHORT)32768 + +/************************************************************************* +|* +|* Oeffnet ein Bookmark-Dokument +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Oeffnet ein Bookmark-Dokument +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Fuegt ein Bookmark (Seite oder Objekt) ein +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Fuegt ein Bookmark als Seite ein +|* +\************************************************************************/ + +/** Concrete incarnations get called by IterateBookmarkPages, for + every page in the bookmark document/list + */ + +/************************************************************************* +|* +|* Fuegt ein Bookmark als Objekt ein +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Beendet das Einfuegen von Bookmarks +|* +\************************************************************************/ + +void SdDrawDocument::CloseBookmarkDoc() +{ + if (xBookmarkDocShRef.Is()) +/*?*/ { +/*?*/ xBookmarkDocShRef->DoClose(); +/*?*/ } + + xBookmarkDocShRef.Clear(); + aBookmarkFile = String(); +} + +/************************************************************************* +|* +|* Dokument laden (fuer gelinkte Objekte) +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Dokument schliessen (fuer gelinkte Objekte) +|* +\************************************************************************/ + +void SdDrawDocument::DisposeLoadedModels() +{ + CloseBookmarkDoc(); +} + +/************************************************************************* +|* +|* Ist das Dokument read-only? +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* In anschliessendem AllocModel() wird eine DocShell erzeugt +|* (xAllocedDocShRef). Eine bereits bestehende DocShell wird ggf. geloescht +|* +\************************************************************************/ + +void SdDrawDocument::SetAllocDocSh(BOOL bAlloc) +{ + bAllocDocSh = bAlloc; + + if (xAllocedDocShRef.Is()) +/*?*/ { +/*?*/ xAllocedDocShRef->DoClose(); +/*?*/ } + + xAllocedDocShRef.Clear(); +} + +/************************************************************************* +|* +|* Liste der CustomShows zurueckgeben (ggf. zuerst erzeugen) +|* +\************************************************************************/ + +List* SdDrawDocument::GetCustomShowList(BOOL bCreate) +{ + if (!pCustomShowList && bCreate) + { + // Liste erzeugen + pCustomShowList = new List(); + } + + return(pCustomShowList); +} + +/************************************************************************* +|* +|* Document-Stream herausgeben (fuer load-on-demand Graphiken) +|* +\************************************************************************/ + +SvStream* SdDrawDocument::GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const +{ + SotStorage* pStor = pDocSh ? pDocSh->GetMedium()->GetStorage() : NULL; + SvStream* pRet = NULL; + + if( pStor ) + { + if( rStreamInfo.maUserData.Len() && + ( rStreamInfo.maUserData.GetToken( 0, ':' ) == + String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) ) + { + const String aPicturePath( rStreamInfo.maUserData.GetToken( 1, ':' ) ); + + // graphic from picture stream in picture storage in XML package + if( aPicturePath.GetTokenCount( '/' ) == 2 ) + { + const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) ); + + if( !xPictureStorage.Is() ) + { + const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) ); + + if( pStor->IsContained( aPictureStorageName ) && + pStor->IsStorage( aPictureStorageName ) ) + { + // cast away const + ((SdDrawDocument*)this)->xPictureStorage = pStor->OpenUCBStorage( aPictureStorageName, STREAM_READ ); + } + } + + if( xPictureStorage.Is() && + xPictureStorage->IsContained( aPictureStreamName ) && + xPictureStorage->IsStream( aPictureStreamName ) ) + { + pRet = xPictureStorage->OpenSotStream( aPictureStreamName, STREAM_READ ); + + if( pRet ) + { + pRet->SetVersion( xPictureStorage->GetVersion() ); + pRet->SetKey( xPictureStorage->GetKey() ); + } + } + } + + rStreamInfo.mbDeleteAfterUse = ( pRet != NULL ); + } + else + { + // graphic from plain binary document stream + if( !pDocStor ) + { + if( pStor->IsStream( pStarDrawDoc ) ) + { + BOOL bOK = pStor->Rename(pStarDrawDoc, pStarDrawDoc3); + DBG_ASSERT(bOK, "Umbenennung des Streams gescheitert"); + } + + SotStorageStreamRef docStream = pStor->OpenSotStream( pStarDrawDoc3, STREAM_READ ); + docStream->SetVersion( pStor->GetVersion() ); + docStream->SetKey( pStor->GetKey() ); + + // cast away const (should be regarded logical constness) + ((SdDrawDocument*)this)->xDocStream = docStream; + ((SdDrawDocument*)this)->pDocStor = pStor; + } + + pRet = xDocStream; + rStreamInfo.mbDeleteAfterUse = FALSE; + } + } + +#if OSL_DEBUG_LEVEL > 1 + if( pRet ) + { + // try to get some information from stream + const ULONG nStartPos = pRet->Tell(); + const ULONG nEndPos = pRet->Seek( STREAM_SEEK_TO_END ); + const ULONG nStmLen = nEndPos - nStartPos; + sal_uChar aTestByte; + + // try to read one byte + if( nStmLen ) + *pRet >> aTestByte; + + pRet->Seek( nStartPos ); + } +#endif + + return pRet; +} + + +/************************************************************************* +|* +|* Release doc stream, if no longer valid +|* +\************************************************************************/ + +void SdDrawDocument::HandsOff() +{ + xPictureStorage = SotStorageRef(); + pDocStor = NULL; +} + +void SdDrawDocument::RemoveDuplicateMasterPages() +{ + USHORT nSdMasterPageCount = GetMasterSdPageCount( PK_STANDARD ); + for (sal_Int32 nMPage = nSdMasterPageCount - 1; nMPage >= 0; nMPage--) + { + SdPage* pMaster = (SdPage*) GetMasterSdPage( (USHORT) nMPage, PK_STANDARD ); + SdPage* pNotesMaster = (SdPage*) GetMasterSdPage( (USHORT) nMPage, PK_NOTES ); + + DBG_ASSERT( pMaster->GetPageKind() == PK_STANDARD, "wrong page kind" ); + + if ( pMaster->GetPageKind() == PK_STANDARD && GetMasterPageUserCount( pMaster ) == 0 && pNotesMaster ) + { + const String aLayoutName( pMaster->GetLayoutName() ); + for (USHORT i = 0; i < GetMasterSdPageCount( PK_STANDARD ); i++) + { + SdPage* pMPg = (SdPage*) GetMasterSdPage( i, PK_STANDARD ); + if( pMPg != pMaster && pMPg->GetLayoutName() == aLayoutName ) + { + RemoveMasterPage( pNotesMaster->GetPageNum() ); + RemoveMasterPage( pMaster->GetPageNum() ); + break; + } + } + } + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_drawdoc4.cxx b/binfilter/bf_sd/source/core/sd_drawdoc4.cxx new file mode 100644 index 000000000000..80819e52a69a --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_drawdoc4.cxx @@ -0,0 +1,790 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_offmgr/app.hxx> +#include <bf_svx/eeitem.hxx> + +#include "bf_sd/docshell.hxx" +#include <eetext.hxx> + +#define ITEMID_SEARCH SID_SEARCH_ITEM +#define ITEMID_LANGUAGE EE_CHAR_LANGUAGE +#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK +#define ITEMID_CHARRELIEF EE_CHAR_RELIEF +#define ITEMID_FRAMEDIR EE_PARA_WRITINGDIR + +#include <bf_svx/svxids.hrc> +#include <bf_svx/lrspitem.hxx> +#include <bf_svx/ulspitem.hxx> +#include <bf_svx/lspcitem.hxx> +#include <bf_svx/adjitem.hxx> +#include <bf_svx/dialogs.hrc> +#include <bf_svx/dialmgr.hxx> // SVX_RESSTR +#include <bf_svx/bulitem.hxx> +#include <bf_svx/xtable.hxx> + +#include <bf_svx/xdef.hxx> + +#include <bf_svx/svdotext.hxx> +#include <bf_svx/colritem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/wghtitem.hxx> +#include <bf_svx/postitem.hxx> +#include <bf_svx/crsditem.hxx> +#include <bf_svx/udlnitem.hxx> +#include <bf_svx/cntritem.hxx> +#include <bf_svx/emphitem.hxx> +#include <bf_svx/fontitem.hxx> +#include <bf_svx/shdditem.hxx> +#include <bf_svx/xbtmpit.hxx> +#include <bf_svx/xflhtit.hxx> +#include <bf_svx/xflgrit.hxx> +#include <bf_svx/xflclit.hxx> +#include <bf_svx/xlnedcit.hxx> +#include <bf_svx/xlnstcit.hxx> +#include <bf_svx/xlnedwit.hxx> +#include <bf_svx/xlnstwit.hxx> +#include <bf_svx/xlnedit.hxx> +#include <bf_svx/charreliefitem.hxx> +#include <bf_svx/xlnstit.hxx> +#include <bf_svx/xlndsit.hxx> +#include <bf_svx/xlnwtit.hxx> +#include <bf_svx/xlnclit.hxx> +#include <tools/shl.hxx> +#include <bf_svx/numitem.hxx> +#include <bf_svx/editeng.hxx> +#include <bf_svtools/itempool.hxx> +#include <bf_svx/outlobj.hxx> +#include <bf_svx/frmdiritem.hxx> + +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "glob.hrc" +#include "stlpool.hxx" +#include "helpids.h" +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::linguistic2; + +void SdDrawDocument::CreateLayoutTemplates() +{ + SdStyleSheetPool* pStyleSheetPool = (SdStyleSheetPool*)GetStyleSheetPool(); + SfxStyleSheetBase* pSheet = NULL; + String aHelpFile; + String aStdName = String(SdResId(STR_STANDARD_STYLESHEET_NAME)); + + // ---- Standardvorlage ----------------------------------------------- + + // nicht benutzt, nicht benutzerdefiniert + // SB hatte wahrscheinlich Probleme mit SFXSTYLEBIT_AUTO, da dann gar nichts + // mehr im Gestalter angezeigt wird. Dieses Problem ist zu 364 j behoben worden + // USHORT nMask = SFXSTYLEBIT_ALL & ~(SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF); + USHORT nMask = SFXSTYLEBIT_AUTO; + + String aName(aStdName); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetHelpId( aHelpFile, HID_STANDARD_STYLESHEET_NAME ); + SfxItemSet& rISet = pSheet->GetItemSet(); + SfxItemPool* pPool = rISet.GetPool(); + + String aNullStr; + + XPolygon aNullPol; + Color aNullCol(RGB_Color(COL_BLACK)); + + XDash aNullDash; + XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE)); + aNullGrad.SetStartIntens( 100 ); + aNullGrad.SetEndIntens( 100 ); + XHatch aNullHatch(aNullCol); + + // Linienattribute (Extended OutputDevice) + rISet.Put(XLineStyleItem(XLINE_SOLID)); + rISet.Put(XLineColorItem(String(), RGB_Color(COL_BLACK))); + rISet.Put(XLineWidthItem(0)); + rISet.Put(XLineDashItem(pPool,aNullDash)); + rISet.Put(XLineStartItem(pPool,aNullPol)); + rISet.Put(XLineEndItem(pPool,aNullPol)); + rISet.Put(XLineStartWidthItem(300)); + rISet.Put(XLineEndWidthItem(300)); + rISet.Put(XLineStartCenterItem()); + rISet.Put(XLineEndCenterItem()); + + // Fuellattribute (Extended OutputDevice) + rISet.Put(XFillStyleItem(XFILL_SOLID)); + rISet.Put(XFillColorItem(String(), Color(0,184,255))); // "Blau 7" + + rISet.Put(XFillGradientItem(pPool,aNullGrad)); + rISet.Put(XFillHatchItem(pPool,aNullHatch)); + Size aNullSize( 32, 32 ); + Color aNullColor( COL_WHITE ); + Bitmap aNullBmp( aNullSize, 8 ); + aNullBmp.Erase( aNullColor ); + rISet.Put(XFillBitmapItem(pPool,aNullBmp)); + + // Schattenattribute (Drawing Engine) + rISet.Put(SdrShadowItem(FALSE)); + rISet.Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY))); + rISet.Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz + rISet.Put(SdrShadowYDistItem(300)); + + Font aLatinFont, aCJKFont, aCTLFont; + + getDefaultFonts( aLatinFont, aCJKFont, aCTLFont ); + + SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(), + aLatinFont.GetCharSet(), EE_CHAR_FONTINFO ); + + SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(), + aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); + + SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(), + aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); + + rISet.Put( aSvxFontItem ); + rISet.Put( aSvxFontItemCJK ); + rISet.Put( aSvxFontItemCTL ); + + rISet.Put( SvxFontHeightItem( 846, 100, EE_CHAR_FONTHEIGHT ) ); // 24 pt + rISet.Put( SvxFontHeightItem( 846, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 24 pt + rISet.Put( SvxFontHeightItem( 846, 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 24 pt + + rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); + rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) ); + rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) ); + + rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) ); + rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) ); + rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) ); + + rISet.Put(SvxContourItem(FALSE)); + rISet.Put(SvxShadowedItem(FALSE)); + rISet.Put(SvxUnderlineItem(UNDERLINE_NONE)); + rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE)); + rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE)); + rISet.Put(SvxCharReliefItem(RELIEF_NONE)); + rISet.Put(SvxColorItem(Color(COL_AUTO))); + + // Absatzattribute (Edit Engine) + rISet.Put(SvxLRSpaceItem()); + rISet.Put(SvxULSpaceItem()); + + rISet.Put(SvxLineSpacingItem()); + + SvxBulletItem aBulletItem(EE_PARA_BULLET); + // die sind in allen Ebenen identisch + aBulletItem.SetStyle(BS_BULLET); + aBulletItem.SetStart(1); + aBulletItem.SetScale(45); // in Prozent + + Font aBulletFont( pStyleSheetPool->GetBulletFont() ); + aBulletFont.SetSize(Size(0,846)); // 24 pt + aBulletItem.SetFont(aBulletFont); + aBulletItem.SetSymbol( 0x25CF ); // Punkt + rISet.Put(aBulletItem); + + SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0); // Bullets nicht sichtbar + rISet.Put(aBulletStateItem); + + // Neues BulletItem + pStyleSheetPool->PutNumBulletItem( pSheet, aBulletFont ); + + SfxItemSet* pISet = NULL; + + // ---- Objekt mit Pfeilspitze ---------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_OBJWITHARROW)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHARROW ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_SOLID)); + pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK))); + pISet->Put(XLineWidthItem(150)); + + XPolygon aArrow(4); // [] + aArrow[0]=Point(10,0); // 0,4__[]__2,4 + aArrow[1]=Point(0,30); // \ / + aArrow[2]=Point(20,30); // \ / + aArrow[3]=Point(10,0); // \/1,0 + pISet->Put(XLineStartItem(SdResId(STR_POOLSHEET_ARROW),aArrow)); + + pISet->Put(XLineStartWidthItem(700)); + pISet->Put(XLineEndWidthItem(300)); + pISet->Put(XLineStartCenterItem(TRUE)); + + // ---- Objekt mit Schatten ------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_OBJWITHSHADOW)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHSHADOW ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(SdrShadowItem(TRUE)); + pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY))); + pISet->Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz + pISet->Put(SdrShadowYDistItem(300)); + + // ---- Objekt ohne Fllung ------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_OBJWITHOUTFILL)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHOUTFILL ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XFillStyleItem(XFILL_NONE)); + + // ---- Text ---------------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TEXT)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXT ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + // ---- Textk”rper ---------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TEXTBODY)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxFontHeightItem(564)); // 16 pt + + // ---- Textk”rper mit Blocksatz -------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TEXTBODY_JUSTIFY)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_JUSTIFY ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxAdjustItem(SVX_ADJUST_BLOCK)); + + // ---- Textkoerper mit Einzug ----------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TEXTBODY_INDENT)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_INDENT ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + SvxLRSpaceItem aLRSpaceItem; + aLRSpaceItem.SetTxtFirstLineOfst(600); // Erstzeileneinzug 6mm, rechts 0 + pISet->Put(aLRSpaceItem); + + // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen + SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) ); + EditEngine::ImportBulletItem( aNumBullet, 0, NULL, &aLRSpaceItem ); + pISet->Put( aNumBullet ); + + // ---- Titel --------------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TITLE)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxFontHeightItem(1551)); // 44 pt + + // ---- Titel1 -------------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TITLE1)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE1 ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_SOLID)); + pISet->Put(XFillColorItem(String(), RGB_Color(COL_CYAN))); + + pISet->Put(SdrShadowItem(TRUE)); + pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY))); + pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz + pISet->Put(SdrShadowYDistItem(200)); + + pISet->Put(SvxFontHeightItem(846)); // 24 pt + + pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); + + // ---- Titel2 -------------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_TITLE2)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE2 ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineWidthItem(50)); + + // Farbe nicht aus der Farbtabelle holen, denn da kann diese Farbe + // geloescht oder veraendert sein + Color aOrange4(255, 204, 153); + pISet->Put(XFillColorItem(String(), aOrange4)); + + pISet->Put(SdrShadowItem(TRUE)); + pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY))); + pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz + pISet->Put(SdrShadowYDistItem(200)); + + pISet->Put(SvxFontHeightItem(1270)); // 36 pt + + SvxLRSpaceItem aLRSpItem(0, 200, 200); + pISet->Put( aLRSpItem ); // Erstzeileneinzug 0 mm, links und rechts 2 mm + // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen + SvxNumBulletItem aNmBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) ); + EditEngine::ImportBulletItem( aNmBullet, 0, NULL, &aLRSpItem ); + pISet->Put( aNmBullet ); + + pISet->Put(SvxULSpaceItem(100, 100)); // Absatzrand oben/unten 1 mm + + pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); + + // ---- Ueberschrift --------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_HEADLINE)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxFontHeightItem(846)); // 24 pt + + pISet->Put(SvxULSpaceItem(420, 210)); // Absatzrand oben 4,2 mm, + // unten 2,1 mm + + // ---- Ueberschrift1 -------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_HEADLINE1)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE1 ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxWeightItem(WEIGHT_BOLD)); + + pISet->Put(SvxFontHeightItem(635)); // 18 pt + + pISet->Put(SvxULSpaceItem(420, 210)); // Absatzrand oben 4,2 mm, + // unten 2,1 mm + + // ---- Ueberschrift2 -------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_HEADLINE2)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE2 ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XLineStyleItem(XLINE_NONE)); + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxPostureItem(ITALIC_NORMAL)); + pISet->Put(SvxWeightItem(WEIGHT_BOLD)); + + pISet->Put(SvxFontHeightItem(494)); // 14 pt + + pISet->Put(SvxULSpaceItem(420, 210)); // Absatzrand oben 4,2 mm, + // unten 2,1 mm + + // ---- Bemassung -------------------------------------------------- + + aName = String(SdResId(STR_POOLSHEET_MEASURE)); + pSheet = &(pStyleSheetPool->Make(aName, SFX_STYLE_FAMILY_PARA, nMask)); + pSheet->SetParent(aStdName); + pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_MEASURE ); + pISet = &pSheet->GetItemSet(); + + pISet->Put(XFillStyleItem(XFILL_NONE)); + + pISet->Put(SvxFontHeightItem(423)); // 12 pt + + pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),aArrow)); + pISet->Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW),aArrow)); + pISet->Put(XLineEndWidthItem(200)); + pISet->Put(XLineStyleItem(XLINE_SOLID)); + + // Praesentationsvorlagen fuer das Standardlayout erzeugen + String aPrefix = String(SdResId(STR_LAYOUT_DEFAULT_NAME)); + pStyleSheetPool->CreateLayoutStyleSheets(aPrefix); +} + +USHORT SdDrawDocument::GetMasterPageUserCount(SdrPage* pMaster) const +{ + USHORT nResult = 0; + USHORT nPage; + USHORT nPageCount = GetPageCount(); + + for (nPage = 0; nPage < nPageCount; nPage++) + { + const SdrPage* pPage = GetPage(nPage); + for (USHORT nPos = 0; nPos < pPage->GetMasterPageCount(); nPos++) + { + if (pMaster == pPage->GetMasterPage(nPos)) + { + nResult++; + } + } + } + return nResult; +} + +void SdDrawDocument::RestoreLayerNames() +{ + SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); + USHORT nLayerCount = rLayerAdmin.GetLayerCount(); + + if (nFileFormatVersion < 13) + { + USHORT nStandardLayer = 5; + nLayerCount = Min(nLayerCount, nStandardLayer); + + for (USHORT nLayer = 0; nLayer < nLayerCount; nLayer++) + { + SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer); + + if (pLayer) + { + String aDefaultLayerName; + + if (nLayer == 0) + { + aDefaultLayerName = String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_LAYOUT" )); + } + else if (nLayer == 1) + { + aDefaultLayerName = String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )); + } + else if (nLayer == 2) + { + aDefaultLayerName = String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )); + } + else if (nLayer == 3) + { + aDefaultLayerName = String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_CONTROLS" )); + } + else if (nLayer == 4) + { + aDefaultLayerName = String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_MEASURELINES" )); + } + + if (pLayer->GetName() != aDefaultLayerName) + { + pLayer->SetName(aDefaultLayerName); + } + } + } + } +} + +String SdDrawDocument::CreatePageNumValue(USHORT nNum) const +{ + String aPageNumValue; + BOOL bUpper = FALSE; + + switch (ePageNumType) + { + case SVX_CHARS_UPPER_LETTER: + aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'A'); + break; + case SVX_CHARS_LOWER_LETTER: + aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'a'); + break; + case SVX_ROMAN_UPPER: + bUpper = TRUE; + case SVX_ROMAN_LOWER: + aPageNumValue += SvxNumberFormat::CreateRomanString(nNum, bUpper); + break; + case SVX_NUMBER_NONE: + aPageNumValue.Erase(); + aPageNumValue += sal_Unicode(' '); + break; + default: + aPageNumValue += String::CreateFromInt32( (sal_Int32)nNum ); + } + + return(aPageNumValue); +} + +void SdDrawDocument::RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName) +{ + String aOldName(rOldLayoutName); + USHORT nPos = aOldName.SearchAscii( SD_LT_SEPARATOR ); + + // erase everything after '~LT~' + aOldName.Erase(nPos + sizeof(SD_LT_SEPARATOR) - 1 ); + USHORT nLen = aOldName.Len(); + + List aReplList; + SfxStyleSheetIterator aIter(pStyleSheetPool, SD_LT_FAMILY); + SfxStyleSheetBase* pSheet = aIter.First(); + + while (pSheet) + { + String aSheetName = pSheet->GetName(); + + // if the sheetname starts with aOldName + "~LT~" + if (aSheetName.Match(aOldName) == nLen) + { + aSheetName.Erase(0, nLen - sizeof(SD_LT_SEPARATOR) + 1 ); + aSheetName.Insert(rNewName, 0); + + StyleReplaceData* pReplData = new StyleReplaceData; + pReplData->nFamily = pSheet->GetFamily(); + pReplData->nNewFamily = pSheet->GetFamily(); + pReplData->aName = pSheet->GetName(); + pReplData->aNewName = aSheetName; + aReplList.Insert(pReplData, LIST_APPEND); + + pSheet->SetName(aSheetName); + } + + pSheet = aIter.Next(); + } + + // jetzt noch den Layoutnamen der Zeichen- und der Notizseite + // sowie ihrer Masterpages setzen + String aPageLayoutName(rNewName); + aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); + aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE)); + + // an allen Seiten, die das jetzt umbeannte Layout benutzen, die + // Textobjekte von der Aenderung unterrichten und Layoutnamen setzen + USHORT nPage; + for (nPage = 0; nPage < GetPageCount(); nPage++) + { + SdPage* pPage = (SdPage*) GetPage(nPage); + String aTemp(pPage->GetLayoutName()); + + if (aTemp == rOldLayoutName) + { + pPage->SetLayoutName(aPageLayoutName); + + for (ULONG nObj = 0; nObj < pPage->GetObjCount(); nObj++) + { + SdrObject* pObj = pPage->GetObj(nObj); + + if (pObj->GetObjInventor() == SdrInventor) + { + switch( pObj->GetObjIdentifier() ) + { + case OBJ_TEXT: + case OBJ_OUTLINETEXT: + case OBJ_TITLETEXT: + { + OutlinerParaObject* pOPO = ((SdrTextObj*) pObj)->GetOutlinerParaObject(); + + if (pOPO) + { + StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First(); + + while( pReplData ) + { + pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily ); + pReplData = (StyleReplaceData*) aReplList.Next(); + } + } + } + break; + + default: + break; + } + } + } + } + } + + // und nochmal fuer die Masterpages + // die betroffenen Masterpages erhalten als Seitennamen den Namen + // des Layouts + for (nPage = 0; nPage < GetMasterPageCount(); nPage++) + { + SdPage* pPage = (SdPage*) GetMasterPage(nPage); + String aTemp(pPage->GetLayoutName()); + + if (aTemp == rOldLayoutName) + { + pPage->SetLayoutName(aPageLayoutName); + pPage->SetName(rNewName); + + for (ULONG nObj = 0; nObj < pPage->GetObjCount(); nObj++) + { + SdrObject* pObj = pPage->GetObj(nObj); + + if (pObj->GetObjInventor() == SdrInventor) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TEXT: + case OBJ_OUTLINETEXT: + case OBJ_TITLETEXT: + { + OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject(); + + if (pOPO) + { + StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First(); + + while( pReplData ) + { + pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily ); + pReplData = (StyleReplaceData*) aReplList.Next(); + } + } + } + break; + + default: + break; + } + } + } + } + } +} + +void SdDrawDocument::SetTextDefaults() const +{ + // BulletItem und BulletFont fuer Titel und Gliederung + SvxBulletItem aBulletItem(EE_PARA_BULLET); + Font aBulletFont( ((SdStyleSheetPool*) pStyleSheetPool)->GetBulletFont() ); + aBulletFont.SetSize(Size(0,846)); // 24 pt + aBulletItem.SetFont(aBulletFont); + aBulletItem.SetStyle(BS_BULLET); + aBulletItem.SetStart(1); + aBulletItem.SetScale(45); // in Prozent + aBulletItem.SetSymbol( 0x25CF ); // Punkt + pItemPool->SetPoolDefaultItem( aBulletItem ); + + // Bullets nicht sichtbar + SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0); + pItemPool->SetPoolDefaultItem( aBulletStateItem ); + + // Neues BulletItem + SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL); + aNumberFormat.SetBulletFont(&aBulletFont); + aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34 + aNumberFormat.SetBulletRelSize(45); + aNumberFormat.SetBulletColor(Color(COL_AUTO)); + aNumberFormat.SetStart(1); + aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); + + SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , FALSE); + + aNumberFormat.SetLSpace( 0 ); + aNumberFormat.SetAbsLSpace( 0 ); + aNumberFormat.SetFirstLineOffset( 0 ); + aNumRule.SetLevel( 0, aNumberFormat ); + + for( USHORT i = 1; i < 10; i++ ) + { + const short nLSpace = (i + 1) * 600; + aNumberFormat.SetLSpace(nLSpace); + aNumberFormat.SetAbsLSpace(nLSpace); + aNumberFormat.SetFirstLineOffset(-600); + aNumRule.SetLevel( i, aNumberFormat ); + } + + SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET ); + pItemPool->SetPoolDefaultItem( aNumBulletItem ); +} + +::com::sun::star::text::WritingMode SdDrawDocument::GetDefaultWritingMode() const +{ + const SfxPoolItem* pItem = ( pItemPool ? pItemPool->GetPoolDefaultItem( EE_PARA_WRITINGDIR ) : NULL ); + ::com::sun::star::text::WritingMode eRet = ::com::sun::star::text::WritingMode_LR_TB; + + if( pItem ) + { + switch( ( (SvxFrameDirectionItem&)( *pItem ) ).GetValue() ) + { + case( FRMDIR_HORI_LEFT_TOP ): eRet = ::com::sun::star::text::WritingMode_LR_TB; break; + case( FRMDIR_HORI_RIGHT_TOP ): eRet = ::com::sun::star::text::WritingMode_RL_TB; break; + case( FRMDIR_VERT_TOP_RIGHT ): eRet = ::com::sun::star::text::WritingMode_TB_RL; break; + default: + break; + } + } + + return eRet; +} + + +void SdDrawDocument::getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont ) +{ + LanguageType eLatin = GetLanguage( EE_CHAR_LANGUAGE ); + + LanguageType eUiLanguage = Application::GetSettings().GetUILanguage(); + switch( eUiLanguage ) + { + case LANGUAGE_KOREAN: + case LANGUAGE_KOREAN_JOHAB: + eLatin = eUiLanguage; + break; + } + + rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE ); + rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE ); + rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_glob.src b/binfilter/bf_sd/source/core/sd_glob.src new file mode 100644 index 000000000000..4824ac7f7117 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_glob.src @@ -0,0 +1,490 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT +/* StarView ressource file */ + +#define __RSC + +#include "glob.hrc" +#include "sderror.hxx" + +String STR_PAGE +{ + Text = "Slide" ; +}; +String STR_MASTERPAGE +{ + Text = "Background" ; +}; +String STR_NOTES +{ + Text = "(Notes)" ; +}; +String STR_HANDOUT +{ + Text = "Handouts" ; +}; +String STR_PRESOBJ_MPTITLE +{ + Text = "Click to edit the title text format" ; +}; +String STR_PRESOBJ_MPOUTLINE +{ + Text = "Click to edit the outline text format" ; +}; +String STR_PRESOBJ_MPOUTLLAYER2 +{ + Text = "Second Outline Level" ; +}; +String STR_PRESOBJ_MPOUTLLAYER3 +{ + Text = "Third Outline Level" ; +}; +String STR_PRESOBJ_MPOUTLLAYER4 +{ + Text = "Fourth Outline Level" ; +}; +String STR_PRESOBJ_MPOUTLLAYER5 +{ + Text = "Fifth Outline Level" ; +}; + +String STR_PRESOBJ_MPOUTLLAYER6 +{ + Text = "Sixth Outline Level" ; +}; + +String STR_PRESOBJ_MPOUTLLAYER7 +{ + Text = "Seventh Outline Level" ; +}; + +String STR_PRESOBJ_MPOUTLLAYER8 +{ + Text = "Eighth Outline Level" ; +}; + +String STR_PRESOBJ_MPOUTLLAYER9 +{ + Text = "Ninth Outline Level" ; +}; + +String STR_PRESOBJ_MPNOTESTITLE +{ + Text = "Click to move the slide" ; +}; + +String STR_PRESOBJ_MPNOTESTEXT +{ + Text = "Click to edit the notes format" ; +}; + +String STR_PRESOBJ_TITLE +{ + Text = "Click to add title" ; +}; + +String STR_PRESOBJ_OUTLINE +{ + Text = "Click to add an outline" ; +}; + +String STR_PRESOBJ_TEXT +{ + Text = "Click to add text" ; +}; + +String STR_PRESOBJ_NOTESTEXT +{ + Text = "Click to add notes" ; +}; + +String STR_PRESOBJ_GRAPHIC +{ + Text = "Double-click to add graphics" ; +}; + +String STR_PRESOBJ_OBJECT +{ + Text = "Double-click to add an object" ; +}; + +String STR_PRESOBJ_CHART +{ + Text = "Double-click to add a chart" ; +}; + +String STR_PRESOBJ_ORGCHART +{ + Text = "Double-click to add an organization chart" ; +}; + +String STR_PRESOBJ_TABLE +{ + Text = "Double-click to add a spreadsheet" ; +}; + + +String STR_LAYOUT_TITLE +{ + Text = "Titel" ; +}; + +String STR_LAYOUT_OUTLINE +{ + Text = "Gliederung" ; +}; + +String STR_LAYOUT_BACKGROUND +{ + Text = "Hintergrund" ; +}; + +String STR_LAYOUT_BACKGROUNDOBJECTS +{ + Text = "Hintergrundobjekte" ; +}; + +String STR_LAYOUT_NOTES +{ + Text = "Notizen" ; +}; + +String STR_LAYOUT_DEFAULT_NAME +{ + Text = "Default" ; +}; + +String STR_STANDARD_STYLESHEET_NAME +{ + Text = "Default" ; +}; + +String STR_LAYOUT_SUBTITLE +{ + Text = "Untertitel" ; +}; + +String STR_POOLSHEET_MEASURE_NT +{ + Text = "Maßlinie" ; +}; + +String STR_POOLSHEET_MEASURE +{ + Text = "Dimension Line" ; +}; + +String STR_POOLSHEET_OBJWITHARROW +{ + Text = "Object with arrow" ; +}; + +String STR_POOLSHEET_OBJWITHSHADOW +{ + Text = "Object with shadow" ; +}; + +String STR_POOLSHEET_OBJWITHOUTFILL_NT +{ + Text = "Objekt ohne Füllung" ; +}; + +String STR_POOLSHEET_OBJWITHOUTFILL +{ + Text = "Object without fill" ; +}; + +String STR_POOLSHEET_TEXT +{ + Text = "Text" ; +}; + +String STR_POOLSHEET_TEXTBODY_NT +{ + Text = "Textkörper" ; +}; + +String STR_POOLSHEET_TEXTBODY +{ + Text = "Text body" ; +}; + +String STR_POOLSHEET_TEXTBODY_JUSTIFY_NT +{ + Text = "Textkörper Blocksatz" ; +}; + +String STR_POOLSHEET_TEXTBODY_JUSTIFY +{ + Text = "Text body justfied" ; +}; + +String STR_POOLSHEET_TEXTBODY_INDENT_NT +{ + Text = "Textkörper Einzug" ; +}; + +String STR_POOLSHEET_TEXTBODY_INDENT +{ + Text = "First line indent" ; +}; + +String STR_POOLSHEET_TITLE +{ + Text = "Title" ; +}; + +String STR_POOLSHEET_TITLE1 +{ + Text = "Title1" ; +}; + +String STR_POOLSHEET_TITLE2 +{ + Text = "Title2" ; +}; + +String STR_POOLSHEET_HEADLINE_NT +{ + Text = "Überschrift" ; +}; +String STR_POOLSHEET_HEADLINE +{ + Text = "Heading" ; +}; + +String STR_POOLSHEET_HEADLINE1_NT +{ + Text = "Überschrift1" ; +}; + +String STR_POOLSHEET_HEADLINE1 +{ + Text = "Heading1" ; +}; + +String STR_POOLSHEET_HEADLINE2_NT +{ + Text = "Überschrift2" ; +}; + +String STR_POOLSHEET_HEADLINE2 +{ + Text = "Heading2" ; +}; + +String STR_EMPTY_STYLESHEET_NAME +{ + Text = "Blank template" ; +}; + +String STR_PSEUDOSHEET_TITLE +{ + Text = "Title" ; +}; + +String STR_PSEUDOSHEET_SUBTITLE +{ + Text = "Subtitle"; +}; + +String STR_PSEUDOSHEET_OUTLINE +{ + Text = "Outline" ; +}; + +String STR_PSEUDOSHEET_BACKGROUNDOBJECTS +{ + Text = "Background objects" ; +}; + +String STR_PSEUDOSHEET_BACKGROUND +{ + Text = "Background" ; +}; + +String STR_PSEUDOSHEET_NOTES +{ + Text = "Notes" ; +}; + +String STR_GRAFOBJECTBARSHELL +{ + Text = "Graphics mode" ; +}; + +String STR_POOLSHEET_ARROW +{ + Text = "Arrow" ; +}; + +String STR_LOAD_DOC +{ + Text [ de ] = "Dokument laden" ; + Text [ en-US ] = "Load Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Carregar documento"; + Text[ ru ] = "Загрузить документ"; + Text[ el ] = "ΦόÏτωση εγγÏάφου"; + Text[ nl ] = "Document laden"; + Text[ fr ] = "Charger un document"; + Text[ es ] = "Cargar documento"; + Text[ fi ] = "Lataa asiakirja"; + Text[ ca ] = "Carrega document"; + Text[ it ] = "Carica documento"; + Text[ da ] = "Indlæs dokument"; + Text[ sv ] = "Ladda dokument"; + Text[ pl ] = "Åaduj dokument"; + Text[ pt-BR ] = "Carregar Documento"; + Text[ th ] = "โหลดเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®èªã¿è¾¼ã¿"; + Text[ ko ] = "문서 로드"; + Text[ zh-CN ] = "装入文档"; + Text[ zh-TW ] = "載入文件"; + Text[ tr ] = "Döküman Yükle"; + Text[ hi-IN ] = "लेखपतà¥à¤° लोड करो"; + Text[ ar ] = "تØميل ملÙ"; + Text[ he ] = "â€®×˜×¢×™× ×ª מסמך‬"; +}; +String STR_SAVE_DOC +{ + Text [ de ] = "Dokument speichern" ; + Text [ en-US ] = "Save Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Guardar documento"; + Text[ ru ] = "Сохранить документ"; + Text[ el ] = "Αποθήκευση εγγÏάφου"; + Text[ nl ] = "Document opslaan"; + Text[ fr ] = "Enregistrer le document"; + Text[ es ] = "Guardar documento"; + Text[ fi ] = "Tallenna asiakirja"; + Text[ ca ] = "Desa document"; + Text[ it ] = "Salva documento"; + Text[ da ] = "Gem dokument"; + Text[ sv ] = "Spara dokument"; + Text[ pl ] = "Zapisz dokument"; + Text[ pt-BR ] = "Salvar Documento"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®ä¿å˜"; + Text[ ko ] = "문서 ì €ìž¥"; + Text[ zh-CN ] = "å˜ç›˜æ–‡æ¡£"; + Text[ zh-TW ] = "儲å˜æ–‡ä»¶"; + Text[ tr ] = "Belgeyi Sakla"; + Text[ hi-IN ] = "लेखपतà¥à¤° संचित करो"; + Text[ ar ] = "ØÙظ المستند"; + Text[ he ] = "Dokument speichern"; +}; + +#define ERR_CODE( class, err ) (class | (err - ERROR_SD_BASE)) +#define WARN_CODE( class, err ) (class | ( err - WARN_SD_BASE)) + +Resource RID_SD_ERRHDL +{ + String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_ROWCOL ) + { + Text [ de ] = "Formatfehler an Position $(ARG1)(Zeile,Spalte) in der Datei entdeckt" ; + Text = "File format error found at $(ARG1)(row,col)" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Descoberto erro de formato na posição $(ARG1)(linha, coluna) no ficheiro"; + Text[ ru ] = "Ошибка формата в файле в позиции $(ARG1) (Ñтрока, Ñтолбец)."; + Text[ el ] = "Î’ÏÎθηκε σφάλμα μοÏφοποίησης στη θÎση $(ARG1)(γÏαμμή,στήλη) του αÏχείο"; + Text[ nl ] = "Indelingsfout ontdekt op positie $(ARG1)(rij,kolom) in het bestand"; + Text[ fr ] = "Erreur de format dans le fichier, position $(ARG1)(ligne,colonne)."; + Text[ es ] = "Se ha descubierto un error de formato en el archivo en la posición $(ARG1)(fila,columna)"; + Text[ fi ] = "Tiedostomuotovirhe ilmeni kohteessa $(ARG1)(rivi,sarake)."; + Text[ ca ] = "Se ha descubierto un error de formato en el archivo en la posición $(ARG1)(fila,columna)"; + Text[ it ] = "È stato trovato un errore di formato nel file alla posizione $(ARG1)(riga, colonna)"; + Text[ da ] = "Der er konstateret formatfejl i filen pÃ¥ position $(ARG1)(linje,kolonne)"; + Text[ sv ] = "Formatfel vid position $(ARG1)(rad,kolumn) upptäckt i filen"; + Text[ pl ] = "Znaleziono bÅ‚Ä…d w formacie pliku na pozycji $(ARG1) (wiersz, kolumna)"; + Text[ pt-BR ] = "Ocorreu um erro de formato de arquivo em $(ARG1)(linha,coluna)"; + Text[ th ] = "พบรูปà¹à¸šà¸šà¹à¸Ÿà¹‰à¸¡à¸œà¸´à¸”พลาดที่ $(ARG1)(à¹à¸–ว,คà¸à¸¥à¸±à¸¡à¸™à¹Œ)"; + Text[ ja ] = "ファイル㮠$(ARG1)(è¡Œã€åˆ—)ã«æ›¸å¼ã‚¨ãƒ©ãƒ¼ãŒè¦‹ã¤ã‹ã‚Šã¾ã—ãŸã€‚"; + Text[ ko ] = "íŒŒì¼ í˜•ì‹ ì˜¤ë¥˜ê°€ $(ARG1)(í–‰,ì—´)ì—ì„œ 발견ë˜ì—ˆìŠµë‹ˆë‹¤."; + Text[ zh-CN ] = "在文件的 $(ARG1)(行,列)处å‘çŽ°æ ¼å¼é”™è¯¯"; + Text[ zh-TW ] = "æª”æ¡ˆçš„æ ¼å¼éŒ¯èª¤ï¼Œä½ç½®åœ¨ $(ARG1)(行,列)"; + Text[ tr ] = "$(ARG1)(satır,sütun) adresinde dosya biçim hatası bulundu"; + Text[ hi-IN ] = "$(ARG2)(पंकà¥à¤¤à¤¿,सà¥à¤¤à¤‚à¤) में फाइल रचना का गलती हà¥à¤† ।"; + Text[ ar ] = "تم اكتشا٠خطأ ÙÙŠ الموضع $(ARG1)(سطر،عمود) ÙÙŠ الملÙ"; + Text[ he ] = "Formatfehler an Position $(ARG1)(Zeile,Spalte) in der Datei entdeckt"; + }; + String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_FILE_ROWCOL ) + { + Text [ de ] = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt" ; + Text = "Format error discovered in the file in sub-document $(ARG1) at position $(ARG2)(row,col)"; + Text[ pt ] = "Erro de formato no sub-documento $(ARG1) do ficheiro, na posição $(ARG2)(linha,coluna)"; + Text[ ru ] = "Ошибка формата файла в поддокументе $(ARG1) в позиции $(ARG2)(Ñтрока, Ñтолбец)."; + Text[ el ] = "Εντοπίστηκε Îνα σφάλμα μοÏφοποίησης του αÏχείου στο τμήμα κειμÎνου $(ARG1) στη θÎση $(ARG2)(γÏαμμή, στήλη)"; + Text[ nl ] = "Fout in indeling in subdocument $(ARG1) op positie $(ARG2)(rij,kolom)"; + Text[ fr ] = "Erreur de format dans le sous-document $(ARG1) du fichier, position $(ARG2)(ligne,colonne)."; + Text[ es ] = "En el documento parcial $(ARG1) del archivo existe un error de formato en la posición $(ARG2)(fila,columna)"; + Text[ fi ] = "Tiedoston aliasiakirjan $(ARG1) kohdassa $(ARG2)(rivi,sarake) havaittiin muotoiluvirhe."; + Text[ ca ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)"; + Text[ it ] = "Errore di formato nel sottodocumento $(ARG1) del file nel punto $(ARG2)(riga,colonna)"; + Text[ da ] = "Der er konstateret formatfejl i underdokumentet $(ARG1) pÃ¥ position $(ARG2)(linje,kolonne) i filen"; + Text[ sv ] = "Det har upptäckts ett formatfel i filen: deldokument $(ARG1), position $(ARG2)(rad,kolumn)"; + Text[ pl ] = "Wykryto bÅ‚Ä…d formatowania w pliku dokumentu podrzÄ™dnego $(ARG1) na pozycji $(ARG2) (wiersz, kolumna)"; + Text[ pt-BR ] = "Foi descoberto um erro de formato no arquivo do sub-documento $(ARG1), na posição $(ARG2)(linha,coluna) "; + Text[ th ] = "ค้นพบรูปà¹à¸šà¸šà¸œà¸´à¸”พลาดในà¹à¸Ÿà¹‰à¸¡à¹ƒà¸™à¹€à¸à¸à¸ªà¸²à¸£à¸¢à¹ˆà¸à¸¢ $(ARG1) ที่ $(ARG2)(à¹à¸–ว,คà¸à¸¥à¸±à¸¡à¸™à¹Œ)"; + Text[ ja ] = "ファイル㮠$(ARG2)(è¡Œã€åˆ—)ã«ã‚る部分ドã‚ュメント $(ARG1) ã«æ›¸å¼ã‚¨ãƒ©ãƒ¼ãŒè¦‹ã¤ã‹ã‚Šã¾ã—ãŸã€‚"; + Text[ ko ] = "파ì¼ì˜ $(ARG2)(í–‰, ì—´) ìœ„ì¹˜ì— ìžˆëŠ” 부분 문서 $(ARG1)ì˜ ì„œì‹ ì˜¤ë¥˜ê°€ 발견ë˜ì—ˆìŠµë‹ˆë‹¤."; + Text[ zh-CN ] = "在文件的å文档$(ARG1)内的 $(ARG2)(è¡Œ,列)处å‘çŽ°æ ¼å¼é”™è¯¯"; + Text[ zh-TW ] = "發ç¾æª”案的å文件 $(ARG1) å…§å«éŒ¯èª¤ï¼Œä½ç½®åœ¨ $(ARG2)(è¡Œ,欄)"; + Text[ tr ] = "Alt döküman $(ARG1) da $(ARG2)(row,col) pozisyonunda dosya format hatası bulundu."; + Text[ hi-IN ] = "अधीन-लेखपतà¥à¤° $(ARG1) में $(ARG2)(पंकà¥à¤¤à¤¿,सà¥à¤¤à¤‚à¤) सà¥à¤¥à¤¾à¤¨ पर फाइल में रचना का गलती पà¥à¤°à¤•à¤Ÿ हà¥à¤† ।"; + Text[ ar ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)"; + Text[ he ] = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt"; + }; + String ERR_CODE ( ERRCODE_CLASS_READ , WARN_FORMAT_FILE_ROWCOL ) + { + Text [ de ] = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt" ; + Text = "Format error discovered in the file in sub-document $(ARG1) at position $(ARG2)(row,col)"; + Text[ pt ] = "Erro de formato no sub-documento $(ARG1) do ficheiro, na posição(ARG2)(linha,coluna)"; + Text[ ru ] = "Ошибка формата файла в поддокументе $(ARG1) в позиции $(ARG2)(Ñтрока, Ñтолбец)."; + Text[ el ] = "Εντοπίστηκε σφάλμα μοÏφοποίησης στο αÏχείο στο τμήμα κειμÎνου $(ARG1) στη θÎση $(ARG2)(γÏαμμή,στήλη)"; + Text[ nl ] = "Fout in indeling in subdocument $(ARG1) op positie $(ARG2)(rij,kolom)"; + Text[ fr ] = "Erreur de format dans le sous-document $(ARG1) du fichier, position $(ARG2)(ligne,colonne)."; + Text[ es ] = "En el documento parcial $(ARG1) del archivo existe un error de formato en la posición $(ARG2)(fila,columna)"; + Text[ fi ] = "Tiedoston aliasiakirjan $(ARG1) kohdassa $(ARG2)(rivi,sarake) havaittiin muotoiluvirhe."; + Text[ ca ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)"; + Text[ it ] = "Errore di formato nel sottodocumento $(ARG1) del file nel punto $(ARG2)(riga,colonna)"; + Text[ da ] = "Der er konstateret formatfejl i underdokumentet $(ARG1) pÃ¥ position $(ARG2)(linje,kolonne) i filen"; + Text[ sv ] = "Det har upptäckts ett formatfel i filen: deldokument $(ARG1), position $(ARG2)(rad,kolumn)"; + Text[ pl ] = "Wykryto bÅ‚Ä…d formatowania w pliku dokumentu podrzÄ™dnego $(ARG1) na pozycji $(ARG2) (wiersz, kolumna)"; + Text[ pt-BR ] = "Foi descoberto um erro de formato no arquivo do sub-documento $(ARG1), na posição $(ARG2)(linha,coluna) "; + Text[ th ] = "ค้นพบรูปà¹à¸šà¸šà¸œà¸´à¸”พลาดในà¹à¸Ÿà¹‰à¸¡à¹ƒà¸™à¹€à¸à¸à¸ªà¸²à¸£à¸¢à¹ˆà¸à¸¢ $(ARG1) ที่ $(ARG2)(à¹à¸–ว,คà¸à¸¥à¸±à¸¡à¸™à¹Œ)"; + Text[ ja ] = "ファイル㮠$(ARG2)(è¡Œã€åˆ—)ã«ã‚る部分ドã‚ュメント $(ARG1) ã«æ›¸å¼ã‚¨ãƒ©ãƒ¼ãŒè¦‹ã¤ã‹ã‚Šã¾ã—ãŸã€‚"; + Text[ ko ] = "파ì¼ì˜ $(ARG2)(í–‰, ì—´) ìœ„ì¹˜ì— ìžˆëŠ” 부분 문서 $(ARG1)ì˜ ì„œì‹ ì˜¤ë¥˜ê°€ 발견ë˜ì—ˆìŠµë‹ˆë‹¤."; + Text[ zh-CN ] = "在文件的å文档$(ARG1)内的 $(ARG2)(è¡Œ,列)处å‘çŽ°æ ¼å¼é”™è¯¯"; + Text[ zh-TW ] = "發ç¾æª”案的å文件 $(ARG1) å…§å«éŒ¯èª¤ï¼Œä½ç½®åœ¨ $(ARG2)(è¡Œ,欄)"; + Text[ tr ] = "Alt döküman $(ARG1) da $(ARG2)(row,col) pozisyonunda dosya format hatası bulundu."; + Text[ hi-IN ] = "अधीन-लेखपतà¥à¤° $(ARG1) में $(ARG2)(पंकà¥à¤¤à¤¿,सà¥à¤¤à¤‚à¤) सà¥à¤¥à¤¾à¤¨ पर फाइल में रचना का गलती पà¥à¤°à¤•à¤Ÿ हà¥à¤† ।"; + Text[ ar ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)"; + Text[ he ] = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt"; + }; +}; diff --git a/binfilter/bf_sd/source/core/sd_sdattr.cxx b/binfilter/bf_sd/source/core/sd_sdattr.cxx new file mode 100644 index 000000000000..1bacdd39c19c --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_sdattr.cxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "sdattr.hxx" +namespace binfilter { + +using namespace ::com::sun::star; + +/************************************************************************* +|* +|* DiaEffectItem +|* +*************************************************************************/ +/*N*/ TYPEINIT1( DiaEffectItem, SfxEnumItem ); + + + +/************************************************************************* +|* +|* DiaSpeedItem +|* +*************************************************************************/ +/*N*/ TYPEINIT1( DiaSpeedItem, SfxEnumItem ); + + + +/************************************************************************* +|* +|* DiaAutoItem +|* +*************************************************************************/ +/*N*/ TYPEINIT1( DiaAutoItem, SfxEnumItem ); + + +/************************************************************************* +|* +|* DiaTimeItem +|* +*************************************************************************/ +/*N*/ TYPEINIT1( DiaTimeItem, SfxUInt32Item ); + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_sdiocmpt.cxx b/binfilter/bf_sd/source/core/sd_sdiocmpt.cxx new file mode 100644 index 000000000000..1403dfb108ea --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_sdiocmpt.cxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <tools/debug.hxx> + +#include "sdiocmpt.hxx" +namespace binfilter { + + + + + +/************************************************************************* +|* +|* Konstruktor, schreibt bzw. liest Versionsnummer +|* +\************************************************************************/ + +/*N*/ SdIOCompat::SdIOCompat(SvStream& rNewStream, USHORT nNewMode, UINT16 nVer) +/*N*/ : SdrDownCompat(rNewStream, nNewMode, TRUE), +/*N*/ nVersion(nVer) +/*N*/ { +/*N*/ if (nNewMode == STREAM_WRITE) +/*N*/ { +/*N*/ DBG_ASSERT(nVer != SDIOCOMPAT_VERSIONDONTKNOW, +/*N*/ "kann unbekannte Version nicht schreiben"); +/*N*/ rNewStream << nVersion; +/*N*/ } +/*N*/ else if (nNewMode == STREAM_READ) +/*N*/ { +/*N*/ DBG_ASSERT(nVer == SDIOCOMPAT_VERSIONDONTKNOW, +/*N*/ "Lesen mit Angabe der Version ist Quatsch!"); +/*N*/ rNewStream >> nVersion; +/*N*/ } +/*N*/ } + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_sdobjfac.cxx b/binfilter/bf_sd/source/core/sd_sdobjfac.cxx new file mode 100644 index 000000000000..401b8d2b7243 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_sdobjfac.cxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include "sdpage.hxx" +#include "sdobjfac.hxx" +#include "anminfo.hxx" +#include "imapinfo.hxx" +namespace binfilter { + + +SdObjectFactory aSdObjectFactory; + +/************************************************************************* +|* +|* void SdObjectFactory::MakeUserData() +|* +\************************************************************************/ + +/*N*/ IMPL_LINK( SdObjectFactory, MakeUserData, SdrObjFactory *, pObjFactory ) +/*N*/ { +/*N*/ if ( pObjFactory->nInventor == SdUDInventor ) +/*N*/ { +/*N*/ SdrObject* pObj = pObjFactory->pObj; +/*N*/ +/*N*/ switch( pObjFactory->nIdentifier ) +/*N*/ { +/*N*/ case( SD_ANIMATIONINFO_ID ): +/*N*/ { +/*N*/ SdDrawDocument* pDoc = NULL; +/*N*/ +/*N*/ if ( pObj ) +/*N*/ pDoc = (SdDrawDocument*) pObj->GetModel(); +/*N*/ +/*N*/ DBG_ASSERT(pDoc, "kein Model gefunden"); +/*N*/ +/*N*/ pObjFactory->pNewData = new SdAnimationInfo(pDoc); +/*N*/ } +/*N*/ break; +/*?*/ +/*?*/ case( SD_IMAPINFO_ID ): +/*?*/ pObjFactory->pNewData = new SdIMapInfo; +/*?*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pObjFactory->pNewData ) +/*N*/ return 0; +/*N*/ +/*N*/ if( aOldMakeUserDataLink.IsSet() ) +/*?*/ aOldMakeUserDataLink.Call( this ); +/*N*/ +/*N*/ return 0; +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_sdpage.cxx b/binfilter/bf_sd/source/core/sd_sdpage.cxx new file mode 100644 index 000000000000..6560ab2f98d0 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_sdpage.cxx @@ -0,0 +1,2129 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "eetext.hxx" + +#include <bf_svx/eeitem.hxx> +#include <bf_svx/lrspitem.hxx> +#include <bf_svx/outlobj.hxx> +#include <bf_svx/svdoole2.hxx> +#include <bf_svx/svdograf.hxx> +#include <bf_svx/svdopage.hxx> +#include <bf_svx/pbinitem.hxx> +#include <bf_svx/adjitem.hxx> + +#include "sdoutl.hxx" + +#include "eetext.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "sdresid.hxx" +#include "stlsheet.hxx" +#include "glob.hrc" +#include "glob.hxx" + +#include <tools/shl.hxx> +#include "sdmod.hxx" +#include <vcl/svapp.hxx> + +namespace binfilter { + +#define MAX_PRESOBJ 5 // Max. Anzahl Praesentationsobjekte + +using namespace ::com::sun::star; + +TYPEINIT2( SdPage, FmFormPage, SdrObjUserCall ); + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, BOOL bMasterPage) : + FmFormPage(rNewDoc, pBasic, bMasterPage), + SdrObjUserCall(), + bSelected(FALSE), + eFadeSpeed(FADE_SPEED_MEDIUM), + eFadeEffect(::com::sun::star::presentation::FadeEffect_NONE), + ePresChange(PRESCHANGE_MANUAL), + nTime(1), + bSoundOn(FALSE), + bExcluded(FALSE), + eAutoLayout(AUTOLAYOUT_NONE), + bOwnArrangement(FALSE), + ePageKind(PK_STANDARD), + bScaleObjects(TRUE), + bBackgroundFullSize( FALSE ), + nPaperBin(PAPERBIN_PRINTER_SETTINGS), + mpItems(NULL) +{ + aLayoutName = String(SdResId(STR_LAYOUT_DEFAULT_NAME)); + aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); + aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE)); + + eCharSet = gsl_getSystemTextEncoding(); + + Size aPageSize(GetSize()); + + if (aPageSize.Width() > aPageSize.Height()) + { + eOrientation = ORIENTATION_LANDSCAPE; + } + else + { + eOrientation = ORIENTATION_PORTRAIT; + } +} + +SdPage::~SdPage() +{ + EndListenOutlineText(); + if( mpItems ) + delete mpItems; +} + +SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, USHORT nIndex) +{ + USHORT nObjFound = 0; // Index des gewuenschten Objekttypes + SdrObject* pObj = NULL; + SdrObject* pObjFound = NULL; + USHORT nIdx = 0; + USHORT nCnt = (USHORT) aPresObjList.Count(); + + while (nIdx < nCnt && nObjFound != nIndex) + { + pObj = (SdrObject*) aPresObjList.GetObject(nIdx); + + if (pObj) + { + if (eObjKind == GetPresObjKind(pObj) ) + nObjFound++; // Uebereinstimmendes Objekt gefunden + } + + nIdx++; + } + + if (nObjFound == nIndex) + { + pObjFound = pObj; + } + else if (eObjKind==PRESOBJ_TITLE || eObjKind==PRESOBJ_OUTLINE) + { + nObjFound = 0; + nIdx = 0; + nCnt = (USHORT) GetObjCount(); + + while (nIdx < nCnt && nObjFound != nIndex) + { + pObj = GetObj(nIdx); + SdrObjKind eSdrObjKind = (SdrObjKind) pObj->GetObjIdentifier(); + + if (pObj->GetObjInventor() == SdrInventor && + (eObjKind==PRESOBJ_TITLE && eSdrObjKind == OBJ_TITLETEXT || + eObjKind==PRESOBJ_OUTLINE && eSdrObjKind == OBJ_OUTLINETEXT)) + { + nObjFound++; // Uebereinstimmendes Objekt gefunden + } + + nIdx++; + } + + if (nObjFound == nIndex) + { + // Gewuenschtes Objekt auf der Seite gefunden + pObjFound = pObj; + } + } + + return(pObjFound); +} + +SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, BOOL bVertical, const Rectangle& rRect, BOOL bInsert) +{ + SdrObject* pSdrObj = NULL; + + if (eObjKind == PRESOBJ_TITLE) + { + pSdrObj = new SdrRectObj(OBJ_TITLETEXT); + + if (bMaster) + { + pSdrObj->SetNotVisibleAsMaster(TRUE); + } + } + else if (eObjKind == PRESOBJ_OUTLINE) + { + pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT); + + if (bMaster) + { + pSdrObj->SetNotVisibleAsMaster(TRUE); + } + } + else if (eObjKind == PRESOBJ_NOTES) + { + pSdrObj = new SdrRectObj(OBJ_TEXT); + + if (bMaster) + { + pSdrObj->SetNotVisibleAsMaster(TRUE); + } + } + else if (eObjKind == PRESOBJ_TEXT) + { + pSdrObj = new SdrRectObj(OBJ_TEXT); + } + else if (eObjKind == PRESOBJ_GRAPHIC) + { + pSdrObj = new SdrGrafObj(); + } + else if (eObjKind == PRESOBJ_OBJECT) + { + pSdrObj = new SdrOle2Obj(); + } + else if (eObjKind == PRESOBJ_CHART) + { + pSdrObj = new SdrOle2Obj(); + ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarChart" ))); + } + else if (eObjKind == PRESOBJ_ORGCHART) + { + pSdrObj = new SdrOle2Obj(); + ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarOrg" ))); + } + else if (eObjKind == PRESOBJ_TABLE) + { + pSdrObj = new SdrOle2Obj(); + ( (SdrOle2Obj*) pSdrObj)->SetProgName( String( RTL_CONSTASCII_USTRINGPARAM( "StarCalc" ))); + } + else if (eObjKind == PRESOBJ_BACKGROUND) + { + pSdrObj = new SdrRectObj(); + pSdrObj->SetMoveProtect(TRUE); + pSdrObj->SetResizeProtect(TRUE); + pSdrObj->SetMarkProtect(TRUE); + } + else if (eObjKind == PRESOBJ_HANDOUT) + { + SdrPage* pPage = ( (SdDrawDocument*) pModel )->GetSdPage(0, PK_STANDARD); + pSdrObj = new SdrPageObj( pPage->GetPageNum() ); + pSdrObj->SetResizeProtect(TRUE); + } + else if (eObjKind == PRESOBJ_PAGE) + { + pSdrObj = new SdrPageObj( GetPageNum() - 1 ); + pSdrObj->SetResizeProtect(TRUE); + } + + if (pSdrObj) + { + const bool bIsAlreadyInserted = aPresObjList.GetPos(pSdrObj) != LIST_ENTRY_NOTFOUND; + + if( !bIsAlreadyInserted ) + aPresObjList.Insert(pSdrObj, LIST_APPEND); + + pSdrObj->SetEmptyPresObj(TRUE); + pSdrObj->SetLogicRect(rRect); + + InsertObject(pSdrObj); + + if( !bIsAlreadyInserted && !bInsert ) + aPresObjList.Remove( pSdrObj ); + + if ( pSdrObj->ISA(SdrTextObj) ) + { + if(bVertical) + ((SdrTextObj*)pSdrObj)->SetVerticalWriting(TRUE); + + SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() ); + if( bVertical ) + aTempAttr.Put( SdrTextMinFrameWidthItem( rRect.GetSize().Width() ) ); + else + aTempAttr.Put( SdrTextMinFrameHeightItem( rRect.GetSize().Height() ) ); + + if (bMaster) + { + if(bVertical) + aTempAttr.Put(SdrTextAutoGrowWidthItem(FALSE)); + else + aTempAttr.Put(SdrTextAutoGrowHeightItem(FALSE)); + } + + pSdrObj->SetItemSet(aTempAttr); + } + + String aString = GetPresObjText(eObjKind); + if ( aString.Len() && pSdrObj->ISA(SdrTextObj) ) + { + SdrOutliner* pOutliner = ( (SdDrawDocument*) GetModel() )->GetInternalOutliner(); + + USHORT nOutlMode = pOutliner->GetMode(); + pOutliner->Init( OUTLINERMODE_TEXTOBJECT ); + pOutliner->SetMinDepth(0); + pOutliner->SetStyleSheet( 0, NULL ); + pOutliner->SetVertical( bVertical ); + + String aEmptyStr; + SetObjText( (SdrTextObj*) pSdrObj, (SdrOutliner*)pOutliner, eObjKind, aString ); + + pOutliner->Init( nOutlMode ); + pOutliner->SetStyleSheet( 0, NULL ); + } + + pSdrObj->SetUserCall(this); + pSdrObj->RecalcBoundRect(); + + if (bMaster) + { + SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin(); + + if (eObjKind == PRESOBJ_BACKGROUND) + { + pSdrObj->SetLayer( rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )), FALSE) ); + } + else + { + pSdrObj->SetLayer( rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )), FALSE) ); + } + } + + SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind); + if(pSheetForPresObj) + pSdrObj->SetStyleSheet(pSheetForPresObj, FALSE); + + if (eObjKind == PRESOBJ_OUTLINE) + { + for (USHORT nLevel = 1; nLevel < 10; nLevel++) + { + String aName(aLayoutName); + aName += sal_Unicode( ' ' ); + aName += String::CreateFromInt32( nLevel ); + SfxStyleSheet* pSheet = (SfxStyleSheet*)pModel->GetStyleSheetPool()-> + Find(aName, SD_LT_FAMILY); + DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden"); + if (pSheet) + pSdrObj->StartListening(*pSheet); + } + } + + if( eObjKind == PRESOBJ_OBJECT || eObjKind == PRESOBJ_CHART || eObjKind == PRESOBJ_ORGCHART || eObjKind == PRESOBJ_TABLE || eObjKind == PRESOBJ_GRAPHIC ) + { + SfxItemSet aSet( ((SdDrawDocument*) pModel)->GetPool() ); + aSet.Put( SdrTextContourFrameItem( TRUE ) ); + aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER ) ); + pSdrObj->SetItemSet(aSet); + } + } + + return(pSdrObj); +} + +SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) +{ + String aName(GetLayoutName()); + String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); + USHORT nPos = aName.Search(aSep); + if (nPos != STRING_NOTFOUND) + { + nPos += aSep.Len(); + 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_BACKGROUND: + aName += String(SdResId(STR_LAYOUT_BACKGROUND)); + break; + + case PRESOBJ_NOTES: + aName += String(SdResId(STR_LAYOUT_NOTES)); + break; + + case PRESOBJ_TEXT: + { + aName += String(SdResId(STR_LAYOUT_SUBTITLE)); + } + break; + + default: + break; + } + + SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool(); + SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_LT_FAMILY); + return (SfxStyleSheet*)pResult; +} + +void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect) +{ +} + +void SdPage::CreateTitleAndLayout(BOOL bInit, BOOL bAPICall ) +{ + SdPage* pMasterPage = this; + + if (!bMaster) + { + pMasterPage = (SdPage*) GetMasterPage(0); + } + + if (!pMasterPage) + { + return; + } + + SdrObject* pMasterTitle = NULL; + SdrObject* pMasterOutline = NULL; + SdrObject* pMasterBackground = NULL; + + + ULONG nMasterIndex = 0; + ULONG nMasterCount = pMasterPage->GetPresObjList()->Count(); + SdrObject* pMasterObj = NULL; + + for (nMasterIndex = 0; nMasterIndex < nMasterCount; nMasterIndex++) + { + pMasterObj = (SdrObject*) pMasterPage->GetPresObjList()->GetObject(nMasterIndex); + + if (pMasterObj && pMasterObj->GetObjInventor() == SdrInventor) + { + UINT16 nId = pMasterObj->GetObjIdentifier(); + + if (nId == OBJ_TITLETEXT) + { + pMasterTitle = pMasterObj; + } + else if ((ePageKind!=PK_NOTES && nId == OBJ_OUTLINETEXT) || + (ePageKind==PK_NOTES && nId == OBJ_TEXT) ) + { + pMasterOutline = pMasterObj; + } + else if (nId == OBJ_RECT && pMasterObj->IsEmptyPresObj() ) + { + pMasterBackground = pMasterObj; + } + } + } + + if (!pMasterBackground && ePageKind == PK_STANDARD) + { + Point aBackgroundPos ( GetLftBorder(), GetUppBorder() ); + Size aBackgroundSize ( GetSize() ); + aBackgroundSize.Width() -= GetLftBorder() + GetRgtBorder() - 1; + aBackgroundSize.Height() -= GetUppBorder() + GetLwrBorder() - 1; + Rectangle aBackgroundRect (aBackgroundPos, aBackgroundSize); + pMasterPage->CreatePresObj(PRESOBJ_BACKGROUND, FALSE, aBackgroundRect, TRUE); + } + + BOOL bDeletePresObjOnMaster = FALSE; + + if ((eAutoLayout == AUTOLAYOUT_NONE) && !bAPICall) + { + bDeletePresObjOnMaster = TRUE; + USHORT nPgCount = ((SdDrawDocument*) pModel)->GetSdPageCount(ePageKind); + + for (USHORT i = 0; i < nPgCount && bDeletePresObjOnMaster; i++) + { + SdPage* pPage = ((SdDrawDocument*) pModel)->GetSdPage(i, ePageKind); + + if (pPage && + pPage->GetMasterPage(0) == pMasterPage && + pPage->GetAutoLayout() != AUTOLAYOUT_NONE) + { + // Seite referenziert die aktuelle MasterPage + // und hat ein gueltiges (kein leeres!) AutoLayout + bDeletePresObjOnMaster = FALSE; + } + } + } + + if (bDeletePresObjOnMaster && !bMaster) + { + // Kein AutoLayout auf der MasterPage erforderlich + // (Hintergrundobjekt muss jedoch erzeugt werden) + + List* pMasterPresObjList = pMasterPage->GetPresObjList(); + + if (pMasterTitle) + { + pMasterPresObjList->Remove(pMasterTitle); + delete pMasterPage->RemoveObject(pMasterTitle->GetOrdNum()); + } + + if (pMasterOutline) + { + pMasterPresObjList->Remove(pMasterOutline); + delete pMasterPage->RemoveObject(pMasterOutline->GetOrdNum()); + } + + return; + } + + if ( ePageKind == PK_HANDOUT && bInit ) + { + /****************************************************************** + * Handzettel-Seite + ******************************************************************/ + + // alle bisherigen Praesentations-Objekte loeschen + List* pPresObjList = pMasterPage->GetPresObjList(); + + for (ULONG i = 0; i < pPresObjList->Count(); i++) + { + SdrObject* pObj = (SdrObject*) pPresObjList->GetObject(i); + delete pMasterPage->RemoveObject(pObj->GetOrdNum()); + } + + pMasterPage->GetPresObjList()->Clear(); + + Size aArea = GetSize(); + long nX = GetLftBorder(); + long nY = GetUppBorder(); + long nGapW = (nX + GetRgtBorder()) / 2; + long nGapH = (nY + GetLwrBorder()) / 2; + USHORT nColCnt, nRowCnt; + + if ( !nGapW ) + { + nGapW = aArea.Width() / 10; + nX = nGapW; + } + if ( !nGapH ) + { + nGapH = aArea.Height() / 10; + nY = nGapH; + } + + switch ( pMasterPage->GetAutoLayout() ) + { + case AUTOLAYOUT_HANDOUT1: nColCnt = 1; nRowCnt = 1; break; + case AUTOLAYOUT_HANDOUT2: nColCnt = 1; nRowCnt = 2; break; + case AUTOLAYOUT_HANDOUT3: nColCnt = 1; nRowCnt = 3; break; + case AUTOLAYOUT_HANDOUT4: nColCnt = 2; nRowCnt = 2; break; + case AUTOLAYOUT_HANDOUT6: nColCnt = 2; nRowCnt = 3; break; + default: nColCnt = 1; nRowCnt = 1; break; + } + aArea.Width() -= nGapW * 2; + aArea.Height() -= nGapH * 2; + + if ( nGapW < aArea.Width() / 10 ) + nGapW = aArea.Width() / 10; + if ( nGapH < aArea.Height() / 10 ) + nGapH = aArea.Height() / 10; + + // bei Querformat Reihen und Spalten vertauschen + if ( aArea.Width() > aArea.Height() ) + { + USHORT nTmp = nRowCnt; + nRowCnt = nColCnt; + nColCnt = nTmp; + } + + Size aPartArea, aSize; + aPartArea.Width() = ((aArea.Width() + nGapW) / nColCnt) - nGapW; + aPartArea.Height() = ((aArea.Height() + nGapH) / nRowCnt) - nGapH; + + SdrPage* pPage = ((SdDrawDocument*) pModel)-> + GetSdPage(0, PK_STANDARD); + if ( pPage ) + { // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren + double fH = (double) aPartArea.Width() / pPage->GetWdt(); + double fV = (double) aPartArea.Height() / pPage->GetHgt(); + + if ( fH > fV ) + fH = fV; + aSize.Width() = (long) (fH * pPage->GetWdt()); + aSize.Height() = (long) (fH * pPage->GetHgt()); + + nX += (aPartArea.Width() - aSize.Width()) / 2; + nY += (aPartArea.Height()- aSize.Height())/ 2; + } + else + aSize = aPartArea; + + Point aPos(nX, nY); + USHORT nPgNum = 0; + + for (USHORT nRow = 0; nRow < nRowCnt; nRow++) + { + aPos.X() = nX; + + for (USHORT nCol = 0; nCol < nColCnt; nCol++) + { + Rectangle aRect(aPos, aSize); + SdrPageObj* pPageObj = (SdrPageObj*) pMasterPage-> + CreatePresObj(PRESOBJ_HANDOUT, FALSE, aRect, TRUE); + + pPageObj->SetPageNum( 2 * nPgNum + 1); + + nPgNum++; + aPos.X() += aPartArea.Width() + nGapW; + } + aPos.Y() += aPartArea.Height() + nGapH; + } + } + + if ( !bDeletePresObjOnMaster ) + { + if (!pMasterTitle && ePageKind != PK_HANDOUT) + { + Rectangle aTitleRect = GetTitleRect(); + pMasterPage->CreatePresObj(PRESOBJ_TITLE, FALSE, aTitleRect, TRUE); + } + + if (!pMasterOutline && ePageKind != PK_HANDOUT) + { + Rectangle aLayoutRect = GetLayoutRect(); + + if (ePageKind == PK_STANDARD) + { + pMasterPage->CreatePresObj(PRESOBJ_OUTLINE, FALSE, aLayoutRect, TRUE); + } + else if (ePageKind == PK_NOTES) + { + pMasterPage->CreatePresObj(PRESOBJ_NOTES, FALSE, aLayoutRect, TRUE); + } + } + } + } + +Rectangle SdPage::GetTitleRect() const +{ + Rectangle aTitleRect; + + if (ePageKind != PK_HANDOUT) + { + Point aTitlePos ( GetLftBorder(), GetUppBorder() ); + Size aTitleSize ( GetSize() ); + aTitleSize.Width() -= GetLftBorder() + GetRgtBorder(); + aTitleSize.Height() -= GetUppBorder() + GetLwrBorder(); + + if (ePageKind == PK_STANDARD) + { + aTitlePos.X() += long( aTitleSize.Width() * 0.0735 ); + aTitlePos.Y() += long( aTitleSize.Height() * 0.083 ); + aTitleSize.Width() = long( aTitleSize.Width() * 0.854 ); + aTitleSize.Height() = long( aTitleSize.Height() * 0.167 ); + } + else if (ePageKind == PK_NOTES) + { + aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5); + + Point aPos = aTitlePos; + aPos.Y() += long( aTitleSize.Height() * 0.083 ); + Size aPartArea = aTitleSize; + Size aSize; + + SdrPage* pPage = pModel->GetPage( GetPageNum() - 1 ); + + if ( pPage ) + { + double fH = (double) aPartArea.Width() / pPage->GetWdt(); + double fV = (double) aPartArea.Height() / pPage->GetHgt(); + + if ( fH > fV ) + fH = fV; + aSize.Width() = (long) (fH * pPage->GetWdt()); + aSize.Height() = (long) (fH * pPage->GetHgt()); + + 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; +} + +Rectangle SdPage::GetLayoutRect() const +{ + Rectangle aLayoutRect; + + if (ePageKind != PK_HANDOUT) + { + Point aLayoutPos ( GetLftBorder(), GetUppBorder() ); + Size aLayoutSize ( GetSize() ); + aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder(); + aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder(); + + if (ePageKind == PK_STANDARD) + { + aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 ); + aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 ); + aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 ); + aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 ); + aLayoutRect.SetPos(aLayoutPos); + aLayoutRect.SetSize(aLayoutSize); + } + else if (ePageKind == PK_NOTES) + { + aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 ); + aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 ); + aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 ); + aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 ); + aLayoutRect.SetPos(aLayoutPos); + aLayoutRect.SetSize(aLayoutSize); + } + } + + return aLayoutRect; +} + +void SdPage::SetAutoLayout(AutoLayout eLayout, BOOL bInit, BOOL bAPICall ) +{ + eAutoLayout = eLayout; + bOwnArrangement = TRUE; + + CreateTitleAndLayout(bInit, bAPICall); + + if ((eAutoLayout == AUTOLAYOUT_NONE && aPresObjList.Count() == 0) || bMaster) + { + bOwnArrangement = FALSE; + return; + } + + USHORT nIndex = 0; + ULONG nCount = aPresObjList.Count(); + SdrObject* pObj = NULL; + + for (nIndex = 0; nIndex < nCount; nIndex++) + { + pObj = (SdrObject*) aPresObjList.GetObject(nIndex); + + if ( !pObj || pObj->GetPage() != this ) + { + aPresObjList.Remove( pObj ); + } + } + + ULONG nMasterIndex = 0; + SdPage* pMasterPage = (SdPage*) GetMasterPage(0); + List* pList = pMasterPage->GetPresObjList(); + ULONG nMasterCount = pList->Count(); + SdrObject* pMasterObj = NULL; + + Rectangle aTitleRect; + Rectangle aLayoutRect; + BOOL bFound = FALSE; + + for (nMasterIndex = 0; nMasterIndex < nMasterCount; nMasterIndex++) + { + bFound = FALSE; + pMasterObj = (SdrObject*) pList->GetObject(nMasterIndex); + + if (pMasterObj && pMasterObj->GetObjInventor() == SdrInventor) + { + UINT16 nId = pMasterObj->GetObjIdentifier(); + + if (nId == OBJ_TITLETEXT ) + { + aTitleRect = pMasterObj->GetLogicRect(); + } + + if ((ePageKind!=PK_NOTES && nId == OBJ_OUTLINETEXT) || + (ePageKind==PK_NOTES && nId == OBJ_TEXT)) + { + aLayoutRect = pMasterObj->GetLogicRect(); + } + } + } + + if (aTitleRect.IsEmpty() && ePageKind != PK_HANDOUT) + { + aTitleRect = GetTitleRect(); + } + + if (aLayoutRect.IsEmpty() && ePageKind != PK_HANDOUT) + { + aLayoutRect = GetLayoutRect(); + } + + Rectangle aRect0( aTitleRect ); + Rectangle aRect1( aLayoutRect ); + Rectangle aRect2( aLayoutRect ); + Rectangle aRect3( aLayoutRect ); + Rectangle aRect4( aLayoutRect ); + Size aTitleSize( aTitleRect.GetSize() ); + Point aTitlePos( aTitleRect.TopLeft() ); + Size aLayoutSize( aLayoutRect.GetSize() ); + Point aLayoutPos( aLayoutRect.TopLeft() ); + Size aTempSize; + Point aTempPnt; + PresObjKind nObjKind[ MAX_PRESOBJ ]; + List aObjList; + sal_Bool bRightToLeft = ( GetModel() && static_cast< SdDrawDocument* >( GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ); + + for (nIndex = 0; nIndex < MAX_PRESOBJ; nIndex++) + { + nObjKind[nIndex] = PRESOBJ_NONE; + } + + + switch (eAutoLayout) + { + case AUTOLAYOUT_NONE: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + + if ( pObj && pObj->GetUserCall() ) + { + pObj->SetLogicRect(aRect0); + pObj->SetUserCall(this); + } + + if (pObj && !pObj->IsEmptyPresObj() || !bInit) + aObjList.Insert(pObj, LIST_APPEND); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + + if ( pObj && pObj->GetUserCall() ) + { + pObj->SetLogicRect(aRect1); + pObj->SetUserCall(this); + } + + if (pObj && !pObj->IsEmptyPresObj() || !bInit) + aObjList.Insert(pObj, LIST_APPEND); + } + break; + + case AUTOLAYOUT_NOTES: + { + nObjKind[0] = PRESOBJ_PAGE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_NOTES; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TITLE: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_TEXT; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_ENUM: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_CHART: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_CHART; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_2TEXT: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + USHORT nIndex = 1; + if ( InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList) ) + nIndex++; + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2], nIndex); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TEXTCHART: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_CHART; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_ORG: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_ORGCHART; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TEXTCLIP: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_GRAPHIC; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_CHARTTEXT: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_CHART; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TAB: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_TABLE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_CLIPTEXT: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_GRAPHIC; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TEXTOBJ: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_OBJ: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TEXT2OBJ: + { + 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); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aRect3 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos = aTempPnt; + aLayoutSize = aTempSize; + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + { + ::std::swap< long >( aRect1.Left(), aRect2.Left() ); + aRect3.Left() = aRect2.Left(); + } + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2]); + USHORT nIndex = 1; + if ( InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList) ) + nIndex++; + + nObjKind[3] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[3], nIndex); + InsertPresObj(pObj, nObjKind[3], FALSE, aRect3, bInit, aObjList); + } + break; + + case AUTOLAYOUT_OBJTEXT: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + ::std::swap< Rectangle >( aRect1, aRect2 ); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_OBJOVERTEXT: + { + aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_2OBJTEXT: + { + aTempPnt = aLayoutPos; + aTempSize = aLayoutSize; + aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos = aTempPnt; + aLayoutSize = aTempSize; + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect3 = Rectangle (aLayoutPos, aLayoutSize); + + if( bRightToLeft ) + { + ::std::swap< long >( aRect1.Left(), aRect2.Left() ); + aRect3.Left() = aRect2.Left(); + } + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + USHORT nIndex = 1; + if ( InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList) ) + nIndex++; + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2], nIndex); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + + nObjKind[3] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[3]); + InsertPresObj(pObj, nObjKind[3], FALSE, aRect3, bInit, aObjList); + } + break; + + case AUTOLAYOUT_2OBJOVERTEXT: + { + aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aTempPnt = aLayoutPos; + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = aTempPnt.X(); + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488); + aRect3 = Rectangle (aLayoutPos, aLayoutSize); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + USHORT nIndex = 1; + if ( InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList) ) + nIndex++; + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2], nIndex); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + + nObjKind[3] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[3]); + InsertPresObj(pObj, nObjKind[3], FALSE, aRect3, bInit, aObjList); + } + break; + + case AUTOLAYOUT_TEXTOVEROBJ: + { + aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_4OBJ: + { + ULONG nX = long (aLayoutPos.X()); + ULONG nY = long (aLayoutPos.Y()); + + aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + aRect3 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = nX; + aRect4 = Rectangle (aLayoutPos, aLayoutSize); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[1]); + USHORT nIndex = 1; + if ( InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList) ) + nIndex++; + + nObjKind[2] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[2], nIndex); + if ( InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList) ) + nIndex++; + + nObjKind[3] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[3], nIndex); + if ( InsertPresObj(pObj, nObjKind[3], FALSE, aRect3, bInit, aObjList) ) + nIndex++; + + nObjKind[4] = PRESOBJ_OBJECT; + pObj = GetPresObj(nObjKind[4], nIndex); + InsertPresObj(pObj, nObjKind[4], FALSE, aRect4, bInit, aObjList); + } + break; + + case AUTOLAYOUT_ONLY_TITLE: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + } + break; + + case AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART: + { + Size aSize( aRect0.GetSize().Height(), aRect1.BottomLeft().Y() - aRect0.TopLeft().Y() ); + aRect0.SetSize( aSize ); + aRect0.SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) ); + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], TRUE, aRect0, bInit, aObjList); + pObj = GetPresObj(nObjKind[0]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + } + Size aLayoutSize ( GetSize() ); + aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder(); + aSize.Height() = long ( aRect0.GetSize().Height() * 0.47 ); + aSize.Width() = long( aLayoutSize.Width() * 0.7 ); + aRect1.SetPos( aTitleRect.TopLeft() ); + aRect1.SetSize( aSize ); + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], TRUE, aRect1, bInit, aObjList); + pObj = GetPresObj(nObjKind[1]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + + pObj->SetItem( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) ); + pObj->SetItem( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) ); + } + aSize.Height() = aRect0.GetSize().Height(); + Point aPos( aTitleRect.TopLeft() ); + aPos.Y() += long ( aSize.Height() * 0.53 ); + aRect2.SetPos( aPos ); + aSize.Height() = long ( aRect0.GetSize().Height() * 0.47 ); + aRect2.SetSize( aSize ); + nObjKind[2] = PRESOBJ_CHART; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], FALSE, aRect2, bInit, aObjList); + } + break; + + case AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE: + { + Size aSize( aRect0.GetSize().Height(), aRect1.BottomLeft().Y() - aRect0.TopLeft().Y() ); + aRect0.SetSize( aSize ); + aRect0.SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) ); + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], TRUE, aRect0, bInit, aObjList); + pObj = GetPresObj(nObjKind[0]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + } + Size aLayoutSize ( GetSize() ); + aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder(); + aSize.Height() = aRect0.GetSize().Height(); + aSize.Width() = long( aLayoutSize.Width() * 0.7 ); + aRect1.SetPos( aTitleRect.TopLeft() ); + aRect1.SetSize( aSize ); + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], TRUE, aRect1, bInit, aObjList); + pObj = GetPresObj(nObjKind[1]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + + // #90790# + pObj->SetItem( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) ); + pObj->SetItem( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) ); + } + } + break; + + case AUTOLAYOUT_TITLE_VERTICAL_OUTLINE: + { + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], TRUE, aRect1, bInit, aObjList); + pObj = GetPresObj(nObjKind[1]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + + // #90790# + pObj->SetItem( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) ); + pObj->SetItem( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) ); + } + } + break; + + case AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART: + { + aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488); + aRect1 = Rectangle (aLayoutPos, aLayoutSize); + + aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05); + aRect2 = Rectangle (aLayoutPos, aLayoutSize); + + nObjKind[0] = PRESOBJ_TITLE; + pObj = GetPresObj(nObjKind[0]); + InsertPresObj(pObj, nObjKind[0], FALSE, aRect0, bInit, aObjList); + + nObjKind[1] = PRESOBJ_GRAPHIC; + pObj = GetPresObj(nObjKind[1]); + InsertPresObj(pObj, nObjKind[1], FALSE, aRect1, bInit, aObjList); + + nObjKind[2] = PRESOBJ_OUTLINE; + pObj = GetPresObj(nObjKind[2]); + InsertPresObj(pObj, nObjKind[2], TRUE, aRect2, bInit, aObjList); + pObj = GetPresObj(nObjKind[2]); + if ( pObj ) + { + pObj->SetItem( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItem( SdrTextAutoGrowHeightItem(FALSE) ); + + // #90790# + pObj->SetItem( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) ); + pObj->SetItem( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) ); + } + } + break; + + default: + break; + } + + nCount = aPresObjList.Count(); + + for (nIndex=0; nIndex<nCount; nIndex++) + { + pObj = (SdrObject*) aPresObjList.GetObject(nIndex); + + if (pObj && aObjList.GetPos(pObj) == LIST_ENTRY_NOTFOUND) + { + if ( pObj->IsEmptyPresObj() ) + { + delete RemoveObject( pObj->GetOrdNum() ); + } + } + } + + aPresObjList.Clear(); + aPresObjList = aObjList; + + bOwnArrangement = FALSE; +} + +void SdPage::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason) +{ + FmFormPage::NbcInsertObject(pObj, nPos, pReason); + + SdrLayerID nId = pObj->GetLayer(); + if( bMaster ) + { + 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 + } +} + +SdrObject* SdPage::RemoveObject(ULONG nObjNum) +{ + SdrObject* pObj = FmFormPage::RemoveObject(nObjNum); + + if (pObj && pObj->GetUserCall()!=this && + aPresObjList.GetPos(pObj) != LIST_ENTRY_NOTFOUND) + { + // Objekt hat keinen UserCall auf diese Seite, es ist jedoch noch in + // der PresObjList eingetragen -> austragen + Changed(*pObj, SDRUSERCALL_REMOVED, pObj->GetBoundRect()); + } + return(pObj); +} + +void SdPage::SetSize(const Size& aSize) +{ + Size aOldSize = GetSize(); + + if (aSize != aOldSize) + { + FmFormPage::SetSize(aSize); + AdjustBackgroundSize(); + + 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()) + { + eOrientation = ORIENTATION_LANDSCAPE; + } + else + { + eOrientation = ORIENTATION_PORTRAIT; + } + } + } +} + +void SdPage::SetBorder(INT32 nLft, INT32 nUpp, INT32 nRgt, INT32 nLwr) +{ + if (nLft != GetLftBorder() || nUpp != GetUppBorder() || + nRgt != GetRgtBorder() || nLwr != GetLwrBorder() ) + { + FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr); + AdjustBackgroundSize(); + } +} + +void SdPage::SetLftBorder(INT32 nBorder) +{ + if (nBorder != GetLftBorder() ) + { + FmFormPage::SetLftBorder(nBorder); + AdjustBackgroundSize(); + } +} + +void SdPage::SetRgtBorder(INT32 nBorder) +{ + if (nBorder != GetRgtBorder() ) + { + FmFormPage::SetRgtBorder(nBorder); + AdjustBackgroundSize(); + } +} + +void SdPage::SetUppBorder(INT32 nBorder) +{ + if (nBorder != GetUppBorder() ) + { + FmFormPage::SetUppBorder(nBorder); + AdjustBackgroundSize(); + } +} + +void SdPage::SetLwrBorder(INT32 nBorder) +{ + if (nBorder != GetLwrBorder() ) + { + FmFormPage::SetLwrBorder(nBorder); + AdjustBackgroundSize(); + } +} + +void SdPage::SetBackgroundFullSize( BOOL bIn ) +{ + if( bIn != bBackgroundFullSize ) + { + bBackgroundFullSize = bIn; + AdjustBackgroundSize(); + } +} + +BOOL SdPage::InsertPresObj(SdrObject* pObj, PresObjKind eObjKind, BOOL bVertical, Rectangle aRect, BOOL bInit, List& rObjList) +{ + BOOL bIncrement = FALSE; + + if (!pObj && bInit) + { + pObj = CreatePresObj(eObjKind, bVertical, aRect); + } + else if ( pObj && (pObj->GetUserCall() || bInit) ) + { + if ( pObj->ISA(SdrGrafObj) && !pObj->IsEmptyPresObj() ) + ( (SdrGrafObj*) pObj)->AdjustToMaxRect( aRect, FALSE ); + else + pObj->SetLogicRect(aRect); + + pObj->SetUserCall(this); + + if ( pObj->ISA(SdrTextObj) ) + { + if( ((SdrTextObj*) pObj)->IsVerticalWriting() != bVertical ) + { + ((SdrTextObj*) pObj)->SetVerticalWriting( bVertical ); + + // #94826# here make sure the correct anchoring is used when the object + // is re-used but orientation is changed + if(PRESOBJ_OUTLINE == eObjKind) + { + if(bVertical) + { + // vertical activated on once horizontal outline object + ((SdrTextObj*) pObj)->SetItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); + } + else + { + // horizontal activated on once vertical outline object + ((SdrTextObj*) pObj)->SetItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); + } + } + } + + if( !bMaster ) + { + if ( ((SdrTextObj*) pObj)->IsAutoGrowHeight() ) + { + // switch off AutoGrowHeight, set new MinHeight + SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() ); + SdrTextMinFrameHeightItem aMinHeight( aRect.GetSize().Height() ); + aTempAttr.Put( aMinHeight ); + aTempAttr.Put( SdrTextAutoGrowHeightItem(FALSE) ); + pObj->SetItemSet(aTempAttr); + pObj->SetLogicRect(aRect); + + // switch on AutoGrowHeight + SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() ); + aAttr.Put( SdrTextAutoGrowHeightItem(TRUE) ); + + pObj->SetItemSet(aAttr); + } + + if ( ((SdrTextObj*) pObj)->IsAutoGrowWidth() ) + { + // switch off AutoGrowWidth , set new MinWidth + SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() ); + SdrTextMinFrameWidthItem aMinWidth( aRect.GetSize().Width() ); + aTempAttr.Put( aMinWidth ); + aTempAttr.Put( SdrTextAutoGrowWidthItem(FALSE) ); + pObj->SetItemSet(aTempAttr); + pObj->SetLogicRect(aRect); + + // switch on AutoGrowWidth + SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() ); + aAttr.Put( SdrTextAutoGrowWidthItem(TRUE) ); + pObj->SetItemSet(aAttr); + } + } + } + } + + if (pObj) + { + bIncrement = TRUE; + rObjList.Insert(pObj, LIST_APPEND); + + if (eObjKind == PRESOBJ_OUTLINE && pObj->IsEmptyPresObj()) + { + // Gibt es ev. noch ein Untertitel? + SdrObject* pSubtitle = GetPresObj(PRESOBJ_TEXT); + + if (pSubtitle) + { + // Text des Untertitels in das PRESOBJ_OUTLINE setzen + OutlinerParaObject* pOutlParaObj = pSubtitle->GetOutlinerParaObject(); + + if (pOutlParaObj) + { + if (!pSubtitle->IsEmptyPresObj()) + { + // Text umsetzen + SdOutliner* pOutl = ( (SdDrawDocument*) pModel )->GetInternalOutliner( TRUE ); + pOutl->Clear(); + pOutl->SetText( *pOutlParaObj ); + pOutl->SetMinDepth(1, TRUE); + pOutlParaObj = pOutl->CreateParaObject(); + pObj->SetOutlinerParaObject( pOutlParaObj ); + pOutl->Clear(); + pObj->SetEmptyPresObj(FALSE); + } + + for (USHORT nLevel = 1; nLevel < 10; nLevel++) + { + // Neue Vorlage zuweisen + String aName(aLayoutName); + aName += sal_Unicode( ' ' ); + aName += String::CreateFromInt32( nLevel ); + SfxStyleSheet* pSheet = (SfxStyleSheet*) pModel->GetStyleSheetPool()->Find(aName, SD_LT_FAMILY); + + if (pSheet) + { + if (nLevel == 1) + { + SfxStyleSheet* pSubtitleSheet = GetStyleSheetForPresObj(PRESOBJ_TEXT); + + if (pSubtitleSheet) + pOutlParaObj->ChangeStyleSheetName(SD_LT_FAMILY, pSubtitleSheet->GetName(), + pSheet->GetName()); + } + + pObj->StartListening(*pSheet); + } + } + + // LRSpace-Item loeschen + SfxItemSet aSet(((SdDrawDocument*) pModel)->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + + aSet.Put(pObj->GetItemSet()); + + aSet.ClearItem(EE_PARA_LRSPACE); + + pObj->SetItemSet(aSet); + + // Untertitel loeschen + aPresObjList.Remove(pSubtitle); + RemoveObject( pObj->GetOrdNum() ); + ReplaceObject( pObj, pSubtitle->GetOrdNum() ); + delete pSubtitle; + } + } + } + else if (eObjKind == PRESOBJ_TEXT && pObj->IsEmptyPresObj()) + { + // Gibt es ev. noch ein Gliederungsobjekt? + SdrObject* pOutlineObj = GetPresObj(PRESOBJ_OUTLINE); + + if (pOutlineObj) + { + // Text des Gliederungsobjekts in das PRESOBJ_TITLE setzen + OutlinerParaObject* pOutlParaObj = pOutlineObj->GetOutlinerParaObject(); + + if (pOutlParaObj) + { + if (!pOutlineObj->IsEmptyPresObj()) + { + // Text umsetzen + SdOutliner* pOutl = ( (SdDrawDocument*) pModel )->GetInternalOutliner(); + pOutl->Clear(); + pOutl->SetText( *pOutlParaObj ); + pOutl->SetMinDepth(0, TRUE); + pOutlParaObj = pOutl->CreateParaObject(); + pObj->SetOutlinerParaObject( pOutlParaObj ); + pOutl->Clear(); + pObj->SetEmptyPresObj(FALSE); + } + + // Linken Einzug zuruecksetzen + SfxItemSet aSet(((SdDrawDocument*) pModel)->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + + aSet.Put(pObj->GetItemSet()); + + const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE); + SvxLRSpaceItem aNewLRItem(rLRItem); + aNewLRItem.SetTxtLeft(0); + aSet.Put(aNewLRItem); + + pObj->SetItemSet(aSet); + + SfxStyleSheet* pSheet = GetStyleSheetForPresObj(PRESOBJ_TEXT); + + if (pSheet) + pObj->SetStyleSheet(pSheet, TRUE); + + // Gliederungsobjekt loeschen + aPresObjList.Remove(pOutlineObj); + RemoveObject( pObj->GetOrdNum() ); + ReplaceObject( pObj, pOutlineObj->GetOrdNum() ); + delete pOutlineObj; + } + } + } + } + + return(bIncrement); +} + +PresObjKind SdPage::GetPresObjKind(SdrObject* pObj) +{ + PresObjKind eObjKind = PRESOBJ_NONE; + + if (pObj && aPresObjList.GetPos(pObj) != LIST_ENTRY_NOTFOUND && + pObj->GetObjInventor() == SdrInventor) + { + + SdrObjKind eSdrObjKind = (SdrObjKind) pObj->GetObjIdentifier(); + + if (eSdrObjKind==OBJ_TITLETEXT) + { + eObjKind = PRESOBJ_TITLE; + } + else if (eSdrObjKind==OBJ_OUTLINETEXT) + { + eObjKind = PRESOBJ_OUTLINE; + } + else if (eSdrObjKind==OBJ_TEXT && ePageKind==PK_NOTES) + { + eObjKind = PRESOBJ_NOTES; + } + else if (eSdrObjKind==OBJ_TEXT && ePageKind!=PK_NOTES) + { + eObjKind = PRESOBJ_TEXT; + } + else if (eSdrObjKind==OBJ_GRAF) + { + eObjKind = PRESOBJ_GRAPHIC; + } + else if (eSdrObjKind==OBJ_RECT) + { + eObjKind = PRESOBJ_BACKGROUND; + } + else if (eSdrObjKind==OBJ_PAGE && ePageKind==PK_HANDOUT) + { + eObjKind = PRESOBJ_HANDOUT; + } + else if (eSdrObjKind==OBJ_PAGE && ePageKind!=PK_HANDOUT) + { + eObjKind = PRESOBJ_PAGE; + } + else if (eSdrObjKind==OBJ_OLE2) + { + String aName = ( (SdrOle2Obj*) pObj)->GetProgName(); + + if (aName.EqualsAscii( "StarChart" )) + { + eObjKind = PRESOBJ_CHART; + } + else if (aName.EqualsAscii( "StarOrg" )) + { + eObjKind = PRESOBJ_ORGCHART; + } + else if (aName.EqualsAscii( "StarCalc" )) + { + eObjKind = PRESOBJ_TABLE; + } + else + { + eObjKind = PRESOBJ_OBJECT; + } + } + } + + return(eObjKind); +} + +void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rString ) +{ + if ( pObj ) + { + DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: Kein SdrTextObj!" ); + Outliner* pOutl = pOutliner; + + if (!pOutliner) + { + SfxItemPool* pPool = ((SdDrawDocument*) GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool(); + pOutl = new Outliner( pPool, OUTLINERMODE_OUTLINEOBJECT ); + pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *( (SdDrawDocument*) GetModel() )->GetDocSh() ) ); + pOutl->SetEditTextObjectPool(pPool); + pOutl->SetStyleSheetPool((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool()); + pOutl->SetMinDepth(0); + pOutl->EnableUndo(FALSE); + pOutl->SetUpdateMode( FALSE ); + } + + USHORT nOutlMode = pOutl->GetMode(); + USHORT nMinDepth = pOutl->GetMinDepth(); + Size aPaperSize = pOutl->GetPaperSize(); + BOOL bUpdateMode = pOutl->GetUpdateMode(); + pOutl->SetUpdateMode(FALSE); + pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() ); + + pOutl->SetStyleSheet(0, pObj->GetStyleSheet()); + + String aString; + + if (eObjKind == PRESOBJ_OUTLINE) + { + pOutl->Init( OUTLINERMODE_OUTLINEOBJECT ); + pOutl->SetMinDepth(1); + + aString += sal_Unicode( '\t' ); + aString += rString; + + if (bMaster) + { + pOutl->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind) ); + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER2 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER3 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER4 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER5 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER6 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER7 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER8 ) ); + + aString += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\n\t\t\t\t\t\t\t\t\t" )); + aString += String ( SdResId( STR_PRESOBJ_MPOUTLLAYER9 ) ); + } + } + else if (eObjKind == PRESOBJ_TITLE) + { + pOutl->Init( OUTLINERMODE_TITLEOBJECT ); + pOutl->SetMinDepth(0); + aString += rString; + } + else + { + pOutl->Init( OUTLINERMODE_TEXTOBJECT ); + pOutl->SetMinDepth(0); + aString += rString; + } + + pOutl->SetPaperSize( pObj->GetLogicRect().GetSize() ); + + pOutl->SetText( aString, pOutl->GetParagraph( 0 ) ); + + ( (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->SetMinDepth( nMinDepth ); + pOutl->SetPaperSize( aPaperSize ); + } + } +} + +void SdPage::SetLayoutName(String aName) +{ + aLayoutName = aName; + + if( bMaster ) + { + String aSep( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) ); + USHORT nPos = aLayoutName.Search( aSep ); + if ( nPos != STRING_NOTFOUND ) + { + aPageName = aLayoutName; + aPageName.Erase( nPos ); + } + } +} + +const String& SdPage::GetName() +{ + if (aPageName.Len() == 0) + { + if ((ePageKind == PK_STANDARD || ePageKind == PK_NOTES) && + !bMaster) + { + USHORT nNum = (GetPageNum() + 1) / 2; + BOOL bUpper = FALSE; + + aCreatedPageName = String(SdResId(STR_PAGE)); + aCreatedPageName += sal_Unicode( ' ' ); + aCreatedPageName += ((SdDrawDocument*) GetModel())->CreatePageNumValue(nNum); + } + else + { + aCreatedPageName = String(SdResId(STR_LAYOUT_DEFAULT_NAME)); + } + } + else + { + aCreatedPageName = aPageName; + } + + if (ePageKind == PK_NOTES) + { + aCreatedPageName += sal_Unicode( ' ' ); + aCreatedPageName += String(SdResId(STR_NOTES)); + } + else if (ePageKind == PK_HANDOUT && bMaster) + { + aCreatedPageName += String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" )); + aCreatedPageName += String(SdResId(STR_HANDOUT)); + aCreatedPageName += sal_Unicode( ')' ); + } + + return aCreatedPageName; +} + +void SdPage::AdjustBackgroundSize() +{ + SdrObject* pObj = GetPresObj(PRESOBJ_BACKGROUND); + + if (pObj) + { + pObj->SetMoveProtect(FALSE); + pObj->SetResizeProtect(FALSE); + bOwnArrangement = TRUE; + + Point aBackgroundPos; + Size aBackgroundSize( GetSize() ); + + if( !bBackgroundFullSize ) + { + aBackgroundPos = Point( GetLftBorder(), GetUppBorder() ); + aBackgroundSize.Width() -= GetLftBorder() + GetRgtBorder() - 1; + aBackgroundSize.Height() -= GetUppBorder() + GetLwrBorder() - 1; + } + Rectangle aBackgroundRect (aBackgroundPos, aBackgroundSize); + pObj->SetLogicRect(aBackgroundRect); + bOwnArrangement = FALSE; + pObj->SetMoveProtect(TRUE); + pObj->SetResizeProtect(TRUE); + } +} + +void SdPage::SetOrientation( Orientation eOrient) +{ + eOrientation = eOrient; +} + +Orientation SdPage::GetOrientation() const +{ + return eOrientation; +} + +String SdPage::GetPresObjText(PresObjKind eObjKind) +{ + String aString; + + if (eObjKind == PRESOBJ_TITLE) + { + if (bMaster) + { + if (ePageKind != PK_NOTES) + { + 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) + { + if (bMaster) + { + aString = String ( SdResId( STR_PRESOBJ_MPOUTLINE ) ); + } + else + { + aString = String ( SdResId( STR_PRESOBJ_OUTLINE ) ); + } + } + else if (eObjKind == PRESOBJ_NOTES) + { + if (bMaster) + { + 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 ) ); + } + else if (eObjKind == PRESOBJ_TABLE) + { + aString = String ( SdResId( STR_PRESOBJ_TABLE ) ); + } + + return(aString); +} + +extern uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage ); + +uno::Reference< uno::XInterface > SdPage::createUnoPage() +{ + return createUnoPageImpl( this ); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_sdpage2.cxx b/binfilter/bf_sd/source/core/sd_sdpage2.cxx new file mode 100644 index 000000000000..f7a0e4f2c0dc --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_sdpage2.cxx @@ -0,0 +1,451 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "bf_so3/staticbaseurl.hxx" + +#include <tools/tenccvt.hxx> + +#include <bf_svtools/urihelper.hxx> + +#include <bf_sfx2/docfile.hxx> +#include <bf_svx/svdotext.hxx> +#include <bf_svx/xmlcnitm.hxx> +#include <bf_svx/svditer.hxx> + + +#include "sdpage.hxx" +#include "glob.hxx" +#include "glob.hrc" +#include "drawdoc.hxx" +#include "stlpool.hxx" +#include "sdiocmpt.hxx" +#include "strmname.h" +#include "anminfo.hxx" + +namespace binfilter { + +using namespace ::com::sun::star; + +void SdPage::EndListenOutlineText() +{ + SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE); + + if (pOutlineTextObj) + { + SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool(); + DBG_ASSERT(pSPool, "StyleSheetPool nicht gefunden"); + String aTrueLayoutName(aLayoutName); + aTrueLayoutName.Erase( aTrueLayoutName.SearchAscii( SD_LT_SEPARATOR )); + List* pOutlineStyles = pSPool->CreateOutlineSheetList(aTrueLayoutName); + for (SfxStyleSheet* pSheet = (SfxStyleSheet*)pOutlineStyles->First(); + pSheet; + pSheet = (SfxStyleSheet*)pOutlineStyles->Next()) + { + pOutlineTextObj->EndListening(*pSheet); + } + + delete pOutlineStyles; + } +} + +void SdPage::WriteData(SvStream& rOut) const +{ + FmFormPage::WriteData( rOut ); + rOut.SetStreamCharSet(GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion())); + + if ( pModel->IsStreamingSdrModel() ) + { + return; + } + + // letzter Parameter ist die aktuelle Versionsnummer des Codes + SdIOCompat aIO(rOut, STREAM_WRITE, 7); + + BOOL bDummy = TRUE; + BOOL bManual = ( PRESCHANGE_MANUAL == ePresChange ); // nur der Kompat.halber + + rOut<<bDummy; // ehem. bTemplateMode + rOut<<bDummy; // ehem. bBackgroundMode + rOut<<bDummy; // ehem. bOutlineMode + + UINT16 nUI16Temp = (UINT16) eAutoLayout; + rOut << nUI16Temp; + + // Selektionskennung ist nicht persistent, wird nicht geschrieben + + sal_uInt32 nULTemp; + nULTemp = (sal_uInt32)eFadeSpeed; + rOut << nULTemp; + nULTemp = (sal_uInt32)eFadeEffect; + rOut << nULTemp; + rOut << bManual; + rOut << nTime; + rOut << bSoundOn; + rOut << bExcluded; + rOut.WriteByteString( aLayoutName ); + + // Liste der Praesentationsobjekt abspeichern + UINT32 nUserCallCount = 0; + UINT32 nCount = (UINT32)aPresObjList.Count(); + UINT32 nValidCount = nCount; + + // NULL-Pointer rauszaehlen. Eigentlich haben die nichts in der Liste + // verloren, aber es gibt leider Kundenfiles, in denen so was vorkommt. + UINT32 nObj; for (nObj = 0; nObj < nCount; nObj++) + { + SdrObject* pObj = (SdrObject*)aPresObjList.GetObject(nObj); + if (!pObj) + nValidCount--; + } + rOut << nValidCount; + + for (nObj = 0; nObj < nCount; nObj++) + { + SdrObject* pObj = (SdrObject*)aPresObjList.GetObject(nObj); + if (pObj) + { + rOut << pObj->GetOrdNum(); + + if ( ( (SdPage*) pObj->GetUserCall() ) == this) + { + nUserCallCount++; + } + } + } + + nUI16Temp = (UINT16)ePageKind; + rOut << nUI16Temp; + + // Liste der Praesentationsobjekt abspeichern, + // welche einen UserCall auf die Seite haben + rOut << nUserCallCount; + for (nObj = 0; nObj < nCount; nObj++) + { + SdrObject* pObj = (SdrObject*)aPresObjList.GetObject(nObj); + + if ( pObj && ( (SdPage*) pObj->GetUserCall() ) == this) + { + rOut << pObj->GetOrdNum(); + } + } + + // #90477# INT16 nI16Temp = ::GetStoreCharSet( gsl_getSystemTextEncoding() ); // .EXEs vor 303 werten den aus + INT16 nI16Temp = GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion()); + + rOut << nI16Temp; + + rOut.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel(aSoundFile, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS)); + rOut.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel(aFileName, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS)); + rOut.WriteByteString( aBookmarkName ); + + UINT16 nPaperBinTemp = nPaperBin; + rOut << nPaperBinTemp; + + UINT16 nOrientationTemp = (UINT16) eOrientation; + rOut << nOrientationTemp; + + UINT16 nPresChangeTemp = (UINT16) ePresChange; // ab 370 (IO-Version 7) + rOut << nPresChangeTemp; +} + +void SdPage::ReadData(const SdrIOHeader& rHead, SvStream& rIn) +{ + FmFormPage::ReadData( rHead, rIn ); + + rIn.SetStreamCharSet(GetSOLoadTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rIn.GetVersion())); + + if ( pModel->IsStreamingSdrModel() ) + { + return; + } + + SdIOCompat aIO(rIn, STREAM_READ); + + BOOL bDummy; + BOOL bManual; + + rIn>>bDummy; // ehem. bTemplateMode + rIn>>bDummy; // ehem. bBackgroundMode + rIn>>bDummy; // ehem. bOutlineMode + + UINT16 nAutoLayout; + rIn>>nAutoLayout; + eAutoLayout = (AutoLayout) nAutoLayout; + + // Selektionskennung ist nicht persistent, wird nicht gelesen + + sal_uInt32 nULTemp; + rIn >> nULTemp; eFadeSpeed = (FadeSpeed)nULTemp; + rIn >> nULTemp; eFadeEffect = (presentation::FadeEffect)nULTemp; + rIn >> bManual; + rIn >> nTime; + rIn >> bSoundOn; + rIn >> bExcluded; + rIn.ReadByteString( aLayoutName ); + + if (IsObjOrdNumsDirty()) + RecalcObjOrdNums(); + + UINT32 nCount; + UINT32 nOrdNum; + rIn >> nCount; + for (UINT32 nObj = 0; nObj < nCount; nObj++) + { + rIn >> nOrdNum; + SdrObject* pObj = GetObj(nOrdNum); + aPresObjList.Insert(pObj, LIST_APPEND); + } + + // ab hier werden Daten der Versionen >=1 eingelesen + if (aIO.GetVersion() >= 1) + { + UINT16 nPageKind; + rIn >> nPageKind; + ePageKind = (PageKind) nPageKind; + } + + // ab hier werden Daten der Versionen >=2 eingelesen + if (aIO.GetVersion() >=2) + { + UINT32 nUserCallCount; + UINT32 nUserCallOrdNum; + rIn >> nUserCallCount; + for (UINT32 nObj = 0; nObj < nUserCallCount; nObj++) + { + rIn >> nUserCallOrdNum; + SdrObject* pObj = GetObj(nUserCallOrdNum); + + if (pObj) + pObj->SetUserCall(this); + } + } + + // ab hier werden Daten der Versionen >=3 eingelesen + if (aIO.GetVersion() >=3) + { + INT16 nCharSet; + rIn >> nCharSet; // nur Einlesen, Konvertierung ab 303 durch Stream + + // #90477# eCharSet = (CharSet) nCharSet; + eCharSet = (CharSet)GetSOLoadTextEncoding((rtl_TextEncoding)nCharSet, (sal_uInt16)rIn.GetVersion()); + + String aSoundFileRel; + rIn.ReadByteString( aSoundFileRel ); + INetURLObject aURLObj(::binfilter::StaticBaseUrl::SmartRelToAbs(aSoundFileRel, FALSE, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS)); + aSoundFile = aURLObj.GetMainURL( INetURLObject::NO_DECODE ); + } + + // ab hier werden Daten der Versionen >=4 eingelesen + if (aIO.GetVersion() >=4) + { + String aFileNameRel; + rIn.ReadByteString( aFileNameRel ); + INetURLObject aURLObj(::binfilter::StaticBaseUrl::SmartRelToAbs(aFileNameRel, FALSE, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS)); + aFileName = aURLObj.GetMainURL( INetURLObject::NO_DECODE ); + + rIn.ReadByteString( aBookmarkName ); + } + + // ab hier werden Daten der Versionen >=5 eingelesen + if (aIO.GetVersion() >=5) + { + UINT16 nPaperBinTemp; + rIn >> nPaperBinTemp; + nPaperBin = nPaperBinTemp; + } + + // ab hier werden Daten der Versionen >=6 eingelesen + if (aIO.GetVersion() >=6) + { + UINT16 nOrientationTemp; + rIn >> nOrientationTemp; + eOrientation = (Orientation) nOrientationTemp; + } + else + { + // In aelteren Versionen wird die Orientation aus der Seitengroesse bestimmt + Size aPageSize(GetSize()); + + if (aPageSize.Width() > aPageSize.Height()) + { + eOrientation = ORIENTATION_LANDSCAPE; + } + else + { + eOrientation = ORIENTATION_PORTRAIT; + } + } + + // ab hier werden Daten der Versionen >=7 eingelesen + if( aIO.GetVersion() >= 7 ) + { + UINT16 nPresChangeTemp; + rIn >> nPresChangeTemp; + ePresChange = (PresChange) nPresChangeTemp; + } + else + ePresChange = ( bManual ? PRESCHANGE_MANUAL : PRESCHANGE_AUTO ); +} + +void SdPage::SetModel(SdrModel* pNewModel) +{ + FmFormPage::SetModel(pNewModel); +} + +SdPage::SdPage(const SdPage& rSrcPage) +: FmFormPage(rSrcPage) +{ + ePageKind = rSrcPage.ePageKind; + eAutoLayout = rSrcPage.eAutoLayout; + bOwnArrangement = FALSE; + + UINT32 nCount = (UINT32) rSrcPage.aPresObjList.Count(); + + for (UINT32 nObj = 0; nObj < nCount; nObj++) + { + // Liste der Praesenationsobjekte fuellen + SdrObject* pSrcObj = (SdrObject*) rSrcPage.aPresObjList.GetObject(nObj); + + if (pSrcObj) + { + aPresObjList.Insert(GetObj(pSrcObj->GetOrdNum()), LIST_APPEND); + } + } + + bSelected = FALSE; + eFadeSpeed = rSrcPage.eFadeSpeed; + eFadeEffect = rSrcPage.eFadeEffect; + ePresChange = rSrcPage.ePresChange; + nTime = rSrcPage.nTime; + bSoundOn = rSrcPage.bSoundOn; + bExcluded = rSrcPage.bExcluded; + + aLayoutName = rSrcPage.aLayoutName; + aSoundFile = rSrcPage.aSoundFile; + aCreatedPageName = String(); + aFileName = rSrcPage.aFileName; + aBookmarkName = rSrcPage.aBookmarkName; + bScaleObjects = rSrcPage.bScaleObjects; + bBackgroundFullSize = rSrcPage.bBackgroundFullSize; + eCharSet = rSrcPage.eCharSet; + nPaperBin = rSrcPage.nPaperBin; + eOrientation = rSrcPage.eOrientation; +} + +SdrPage* SdPage::Clone() const +{ + SdPage* pPage = new SdPage(*this); + + if( (PK_STANDARD == ePageKind) && !IsMasterPage() ) + { + // preserve presentation order on slide duplications + SdrObjListIter aSrcIter( *this, IM_DEEPWITHGROUPS ); + SdrObjListIter aDstIter( *pPage, IM_DEEPWITHGROUPS ); + + while( aSrcIter.IsMore() && aDstIter.IsMore() ) + { + SdrObject* pSrc = aSrcIter.Next(); + SdrObject* pDst = aDstIter.Next(); + + SdAnimationInfo* pSrcInfo = ((SdDrawDocument*)pModel)->GetAnimationInfo(pSrc); + if( pSrcInfo && (pSrcInfo->nPresOrder != LIST_APPEND) ) + { + SdAnimationInfo* pDstInfo = ((SdDrawDocument*)pModel)->GetAnimationInfo(pDst); + DBG_ASSERT( pDstInfo, "shape should have an animation info after clone!" ); + + if( pDstInfo ) + pDstInfo->nPresOrder = pSrcInfo->nPresOrder; + } + } + + DBG_ASSERT( !aSrcIter.IsMore() && !aDstIter.IsMore(), "unequal shape numbers after a page clone?" ); + } + + return(pPage); +} + +SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const +{ + const PresObjKind eKind = ((SdPage*)this)->GetPresObjKind(pObj); + if( eKind != PRESOBJ_NONE ) + { + return ((SdPage*)this)->GetStyleSheetForPresObj(eKind); + } + + return FmFormPage::GetTextStyleSheetForObject( pObj ); +} + +SfxItemSet* SdPage::getOrCreateItems() +{ + if( mpItems == NULL ) + mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES ); + + return mpItems; +} + +sal_Bool SdPage::setAlienAttributes( const ::com::sun::star::uno::Any& rAttributes ) +{ + SfxItemSet* pSet = getOrCreateItems(); + + SvXMLAttrContainerItem aAlienAttributes( SDRATTR_XMLATTRIBUTES ); + if( aAlienAttributes.PutValue( rAttributes, 0 ) ) + { + pSet->Put( aAlienAttributes ); + return sal_True; + } + + return sal_False; +} + +void SdPage::getAlienAttributes( ::com::sun::star::uno::Any& rAttributes ) +{ + const SfxPoolItem* pItem; + + if( (mpItems == NULL) || ( SFX_ITEM_SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, sal_False, &pItem ) ) ) + { + SvXMLAttrContainerItem aAlienAttributes; + aAlienAttributes.QueryValue( rAttributes, 0 ); + } + else + { + ((SvXMLAttrContainerItem*)pItem)->QueryValue( rAttributes, 0 ); + } +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_stlpool.cxx b/binfilter/bf_sd/source/core/sd_stlpool.cxx new file mode 100644 index 000000000000..72cf09cee42f --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_stlpool.cxx @@ -0,0 +1,1261 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/eeitemid.hxx> +#include <bf_svx/eeitem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/colritem.hxx> +#include <bf_svx/cntritem.hxx> +#include <bf_svx/shdditem.hxx> +#include <bf_svx/crsditem.hxx> +#include <bf_svx/udlnitem.hxx> +#include <bf_svx/wghtitem.hxx> +#include <bf_svx/postitem.hxx> +#include <bf_svx/fontitem.hxx> +#include <bf_svx/xfillit0.hxx> +#include <bf_svx/xlineit0.hxx> +#include <bf_svx/ulspitem.hxx> +#include <bf_svx/numitem.hxx> +#define ITEMID_BRUSH 0 +#include <bf_svx/editeng.hxx> +#include <bf_svtools/smplhint.hxx> +#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK +#define ITEMID_CHARRELIEF EE_CHAR_RELIEF +#include <bf_svx/charreliefitem.hxx> +#include <bf_svx/emphitem.hxx> + + +#include <bf_svx/svdattr.hxx> +#include <bf_svx/bulitem.hxx> +#include <bf_svx/lrspitem.hxx> +#include <bf_svx/adjitem.hxx> +#include <bf_svtools/itempool.hxx> + +#define _SDR_POSITIVE +#define _SDR_ITEMS + +#include "stlpool.hxx" +#include "sdresid.hxx" +#include "stlsheet.hxx" +#include "glob.hrc" +#include "drawdoc.hxx" +#include "sdmod.hxx" +#include "sdpage.hxx" +#include "helpids.h" +namespace binfilter { + + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +/*N*/ SdStyleSheetPool::SdStyleSheetPool(SfxItemPool& rPool, SdDrawDocument* pDocument) : +/*N*/ SfxStyleSheetPool(rPool), +/*N*/ pActualStyleSheet(NULL), +/*N*/ pDoc(pDocument) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +/*N*/ SdStyleSheetPool::~SdStyleSheetPool() +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Vorlage erzeugen +|* +\************************************************************************/ + +/*N*/ SfxStyleSheetBase* SdStyleSheetPool::Create(const String& rName, +/*N*/ SfxStyleFamily eFamily, +/*N*/ USHORT nMask ) +/*N*/ { +/*N*/ return new SdStyleSheet(rName, *this, eFamily, nMask); +/*N*/ } + + +/************************************************************************* +|* +|* Vorlage nach Vorbild erzeugen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* eine Titelvorlage fuer ein Praesentationslayout suchen +|* +\************************************************************************/ + +/*N*/ SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const String& rLayoutName) +/*N*/ { +/*N*/ String aName(rLayoutName); +/*N*/ aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aName += String(SdResId(STR_LAYOUT_TITLE)); +/*N*/ SfxStyleSheetBase* pResult = Find(aName, SD_LT_FAMILY); +/*N*/ return pResult; +/*N*/ } + +/************************************************************************* +|* +|* LayoutName des ersten Layouts ermitteln +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* eine Liste der Gliederungstextvorlagen fuer ein Praesentationlayout +|* erstellen, der Aufrufer muss die Liste wieder loeschen +|* +\************************************************************************/ + +/*N*/ List* SdStyleSheetPool::CreateOutlineSheetList (const String& rLayoutName) +/*N*/ { +/*N*/ String aName(rLayoutName); +/*N*/ aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aName += String(SdResId(STR_LAYOUT_OUTLINE)); +/*N*/ List* pList = new List; +/*N*/ for (USHORT nSheet = 1; nSheet < 10; nSheet++) +/*N*/ { +/*N*/ String aFullName(aName); +/*N*/ aFullName.Append( sal_Unicode( ' ' )); +/*N*/ aFullName.Append( String::CreateFromInt32( (sal_Int32)nSheet )); +/*N*/ SfxStyleSheetBase* pSheet = Find(aFullName, SD_LT_FAMILY); +/*N*/ pList->Insert(pSheet, LIST_APPEND); +/*N*/ } +/*N*/ return pList; +/*N*/ } + +/************************************************************************* +|* +|* StyleSheets mit Defaultweren fuer das genannte Praesentationslayout erzeugen +|* +\************************************************************************/ + +/*N*/ void SdStyleSheetPool::CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck /*=sal_False*/ ) +/*N*/ { +/*N*/ sal_Bool bCreated = sal_False; +/*N*/ +/*N*/ SfxStyleSheetBase* pSheet = NULL; +/*N*/ +/*N*/ String aPrefix(rLayoutName); +/*N*/ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aPrefix.Insert(aSep); +/*N*/ +/*N*/ Font aLatinFont, aCJKFont, aCTLFont; +/*N*/ +/*N*/ pDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont ); +/*N*/ +/*N*/ // Font fuer Titel und Gliederung +/*N*/ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(), +/*N*/ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO ); +/*N*/ +/*N*/ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(), +/*N*/ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); +/*N*/ +/*N*/ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(), +/*N*/ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); +/*N*/ +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ + /************************************************************************** + * Gliederungsebenen + **************************************************************************/ +/*N*/ String aName(SdResId(STR_LAYOUT_OUTLINE)); +/*N*/ String aHelpFile; +/*N*/ +/*N*/ SfxStyleSheetBase* pParent = NULL; +/*N*/ SvxLRSpaceItem aSvxLRSpaceItem; +/*N*/ SvxULSpaceItem aSvxULSpaceItem; +/*N*/ USHORT nLevel; +/*N*/ +/*N*/ for( nLevel = 1; nLevel < 10; nLevel++) +/*N*/ { +/*N*/ String aLevelName(aName); +/*N*/ aLevelName.Append( sal_Unicode( ' ' )); +/*N*/ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel ))); +/*N*/ +/*N*/ aLevelName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aLevelName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ pSheet = &Make(aLevelName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel ); +/*N*/ +/*N*/ pSheet->SetParent( String() ); +/*N*/ +/*N*/ // Attributierung fuer Level 1, die anderen Ebenen "erben" +/*N*/ if (nLevel == 1) +/*N*/ { +/*N*/ SfxItemSet& rSet = pSheet->GetItemSet(); +/*N*/ +/*N*/ rSet.Put(aSvxFontItem); +/*N*/ rSet.Put(aSvxFontItemCJK); +/*N*/ rSet.Put(aSvxFontItemCTL); +/*N*/ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) ); +/*N*/ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) ); +/*N*/ rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) ); +/*N*/ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); +/*N*/ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) ); +/*N*/ rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) ); +/*N*/ rSet.Put( SvxUnderlineItem(UNDERLINE_NONE) ); +/*N*/ rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE) ); +/*N*/ rSet.Put( SvxShadowedItem(FALSE) ); +/*N*/ rSet.Put( SvxContourItem(FALSE) ); +/*N*/ rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE) ); +/*N*/ rSet.Put( SvxCharReliefItem(RELIEF_NONE) ); +/*N*/ rSet.Put( SvxColorItem( Color(COL_AUTO)) ); +/*N*/ rSet.Put( XLineStyleItem(XLINE_NONE) ); +/*N*/ rSet.Put( XFillStyleItem(XFILL_NONE) ); +/*N*/ +/*N*/ if( nLevel == 1 ) +/*N*/ { +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ULONG nFontSize = 20; +/*N*/ short nFirstIndent = -600; +/*N*/ USHORT nIndent = nLevel * 1200; +/*N*/ USHORT nLower = 100; +/*N*/ +/*N*/ switch (nLevel) +/*N*/ { +/*N*/ case 1: +/*N*/ { +/*N*/ nFontSize = 32; +/*N*/ nLower = 500; +/*N*/ nFirstIndent = -900; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 2: +/*N*/ { +/*N*/ nFontSize = 28; +/*N*/ nLower = 400; +/*N*/ nFirstIndent = -800; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 3: +/*N*/ { +/*N*/ nFontSize = 24; +/*N*/ nLower = 300; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 4: +/*N*/ { +/*N*/ nLower = 200; +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // FontSize +/*N*/ nFontSize = (USHORT)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm +/*N*/ SfxItemSet& rOutlineSet = pSheet->GetItemSet(); +/*N*/ rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) ); +/*N*/ rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) ); +/*N*/ rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CTL ) ); +/*N*/ +/*N*/ // Einzuege +/*N*/ aSvxLRSpaceItem.SetTxtFirstLineOfst(nFirstIndent); +/*N*/ aSvxLRSpaceItem.SetTxtLeft(nIndent); +/*N*/ aSvxLRSpaceItem.SetRight(0); +/*N*/ aSvxLRSpaceItem.SetBulletFI(TRUE); +/*N*/ pSheet->GetItemSet().Put(aSvxLRSpaceItem); +/*N*/ +/*N*/ // Zeilendurchschuss (Abstand nach unten) +/*N*/ aSvxULSpaceItem.SetLower(nLower); +/*N*/ pSheet->GetItemSet().Put(aSvxULSpaceItem); +/*N*/ +/*N*/ if (nLevel == 1) +/*N*/ { +/*N*/ SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 1); // Bullets sichtbar +/*N*/ pSheet->GetItemSet().Put(aBulletStateItem); +/*N*/ } +/*N*/ +/* + // Gliederungsvorlagen haben die naechsthoehere Ebene als Parent + if (pParent) + pSheet->SetParent(pParent->GetName()); + pParent = pSheet; +*/ +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // if we created outline styles, we need to chain them +/*N*/ if( bCreated ) +/*N*/ { +/*N*/ pParent = NULL; +/*N*/ for (nLevel = 1; nLevel < 10; nLevel++) +/*N*/ { +/*N*/ String aLevelName(aName); +/*N*/ aLevelName.Append( sal_Unicode( ' ' )); +/*N*/ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel ))); +/*N*/ +/*N*/ aLevelName.Insert(aPrefix, 0); +/*N*/ +/*N*/ pSheet = Find(aLevelName, SD_LT_FAMILY); +/*N*/ +/*N*/ DBG_ASSERT( pSheet, "missing layout style!"); +/*N*/ +/*N*/ if( pSheet ) +/*N*/ { +/*N*/ if (pParent) +/*N*/ pSheet->SetParent(pParent->GetName()); +/*N*/ pParent = pSheet; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ + /************************************************************************** + * Titel + **************************************************************************/ +/*N*/ aName = String(SdResId(STR_LAYOUT_TITLE)); +/*N*/ aName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ +/*N*/ pSheet = &Make(aName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE ); +/*N*/ pSheet->SetParent(String()); +/*N*/ SfxItemSet& rTitleSet = pSheet->GetItemSet(); +/*N*/ rTitleSet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ rTitleSet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ rTitleSet.Put(aSvxFontItem); +/*N*/ rTitleSet.Put(aSvxFontItemCJK); +/*N*/ rTitleSet.Put(aSvxFontItemCTL); +/*N*/ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) ); +/*N*/ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) ); +/*N*/ rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) ); +/*N*/ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); +/*N*/ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) ); +/*N*/ rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) ); +/*N*/ rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) ); // 44 pt +/*N*/ rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 44 pt +/*N*/ rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 44 pt +/*N*/ rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE)); +/*N*/ rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE)); +/*N*/ rTitleSet.Put(SvxShadowedItem(FALSE)); +/*N*/ rTitleSet.Put(SvxContourItem(FALSE)); +/*N*/ rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE) ); +/*N*/ rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE) ); +/*N*/ rTitleSet.Put(SvxColorItem( Color(COL_AUTO))); +/*N*/ rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER)); +/*N*/ rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); +/*N*/ rTitleSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) ); +/*N*/ aBulletFont.SetSize(Size(0,1552)); // 44 pt +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ + /************************************************************************** + * Untertitel + * Aenderugen auch in AdjustLRSpaceItems() vornehmen! + **************************************************************************/ +/*N*/ aName = String(SdResId(STR_LAYOUT_SUBTITLE)); +/*N*/ aName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ +/*N*/ pSheet = &Make(aName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE ); +/*N*/ pSheet->SetParent(String()); +/*N*/ SfxItemSet& rSubtitleSet = pSheet->GetItemSet(); +/*N*/ rSubtitleSet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ rSubtitleSet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ rSubtitleSet.Put(aSvxFontItem); +/*N*/ rSubtitleSet.Put(aSvxFontItemCJK); +/*N*/ rSubtitleSet.Put(aSvxFontItemCTL); +/*N*/ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) ); +/*N*/ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) ); +/*N*/ rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) ); +/*N*/ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); +/*N*/ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) ); +/*N*/ rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) ); +/*N*/ rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) ); // 32 pt +/*N*/ rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt +/*N*/ rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt +/*N*/ rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE)); +/*N*/ rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE)); +/*N*/ rSubtitleSet.Put(SvxShadowedItem(FALSE)); +/*N*/ rSubtitleSet.Put(SvxContourItem(FALSE)); +/*N*/ rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE) ); +/*N*/ rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE) ); +/*N*/ rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO))); +/*N*/ rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER)); +/*N*/ rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); +/*N*/ rSubtitleSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) ); +/*N*/ aSvxLRSpaceItem.SetTxtLeft(0); +/*N*/ rSubtitleSet.Put(aSvxLRSpaceItem); +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ aBulletFont.SetSize(Size(0, 1129)); // 32 pt +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ + /************************************************************************** + * Notizen + **************************************************************************/ +/*N*/ aName = String(SdResId(STR_LAYOUT_NOTES)); +/*N*/ aName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ +/*N*/ pSheet = &Make(aName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES ); +/*N*/ pSheet->SetParent(String()); +/*N*/ SfxItemSet& rNotesSet = pSheet->GetItemSet(); +/*N*/ rNotesSet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ rNotesSet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ rNotesSet.Put(aSvxFontItem); +/*N*/ rNotesSet.Put(aSvxFontItemCJK); +/*N*/ rNotesSet.Put(aSvxFontItemCTL); +/*N*/ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) ); +/*N*/ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) ); +/*N*/ rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) ); +/*N*/ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); +/*N*/ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) ); +/*N*/ rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) ); +/*N*/ rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) ); // 20 pt +/*N*/ rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt +/*N*/ rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt +/*N*/ rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE) ); +/*N*/ rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE) ); +/*N*/ rNotesSet.Put( SvxShadowedItem(FALSE) ); +/*N*/ rNotesSet.Put( SvxContourItem(FALSE) ); +/*N*/ rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE) ); +/*N*/ rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE) ); +/*N*/ rNotesSet.Put( SvxColorItem( Color(COL_AUTO)) ); +/*N*/ rNotesSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) ); +/*N*/ rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600 ) ); +/*N*/ +/*N*/ SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rNotesSet.Get(EE_PARA_NUMBULLET) ); +/*N*/ +/*N*/ EditEngine::ImportBulletItem( aNumBullet, 0, NULL, +/*N*/ &(const SvxLRSpaceItem&) rNotesSet.Get( EE_PARA_LRSPACE ) ); +/*N*/ +/*N*/ ( (SfxItemSet&) rNotesSet).Put( aNumBullet ); +/*N*/ +/*N*/ } +/*N*/ + /************************************************************************** + * Hintergrundobjekte + **************************************************************************/ +/*N*/ aName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)); +/*N*/ aName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ +/*N*/ pSheet = &Make(aName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS ); +/*N*/ pSheet->SetParent(String()); +/*N*/ SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet(); +/*N*/ rBackgroundObjectsSet.Put(SdrShadowItem(FALSE)); +/*N*/ rBackgroundObjectsSet.Put(SdrShadowColorItem(String(), Color(COL_GRAY))); +/*N*/ rBackgroundObjectsSet.Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz +/*N*/ rBackgroundObjectsSet.Put(SdrShadowYDistItem(300)); +/*N*/ } +/*N*/ + /************************************************************************** + * Hintergrund + **************************************************************************/ +/*N*/ aName = String(SdResId(STR_LAYOUT_BACKGROUND)); +/*N*/ aName.Insert(aPrefix, 0); +/*N*/ +/*N*/ if (!Find(aName, SD_LT_FAMILY)) +/*N*/ { +/*N*/ bCreated = sal_True; +/*N*/ +/*N*/ pSheet = &Make(aName, SD_LT_FAMILY); +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND ); +/*N*/ pSheet->SetParent(String()); +/*N*/ SfxItemSet& rBackgroundSet = pSheet->GetItemSet(); +/*N*/ rBackgroundSet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ rBackgroundSet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" ); +/*N*/ } + +/************************************************************************* +|* +|* StyleSheets des genannten Praesentationslayouts loeschen +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* Graphik-StyleSheets aus dem Quellpool in diesen Pool kopieren +|* +|* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find +|* nicht const ist) +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* StyleSheets des genannten Praesentationslayouts aus dem Quellpool in diesen +|* Pool kopieren. Kopiert werden nur solche StyleSheets, die in diesem Pool +|* noch nicht vorhanden sind. +|* pCreatedSheets wird - wenn ungleich NULL - mit Zeigern auf die erzeugten +|* StyleSheets gefuellt. +|* +|* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find +|* nicht const ist) +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Liste mit den Namen der Praesentationsvorlagen eines Layouts erzeugen. +|* Die Liste und die enthaltenen Strings gehoeren dem Caller! +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Liste mit Zeigern auf Praesentationsvorlagen eines Layouts erzeugen. +|* Die Liste gehoert dem Caller! +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* ggfs. PseudoStyleSheets erzeugen +|* +\************************************************************************/ + +/*N*/ void SdStyleSheetPool::CreatePseudosIfNecessary() +/*N*/ { +/*N*/ String aName; +/*N*/ String aHelpFile; +/*N*/ SfxStyleSheetBase* pSheet = NULL; +/*N*/ SfxStyleSheetBase* pParent = NULL; +/*N*/ +/*N*/ //USHORT nMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF; +/*N*/ USHORT nMask = SFXSTYLEBIT_USED; +/*N*/ +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_TITLE)); +/*N*/ if (!(pSheet = Find(aName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ pSheet->SetParent( String() ); +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE ); +/*N*/ +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE)); +/*N*/ if (!(pSheet = Find(aName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ pSheet->SetParent(String()); +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE ); +/*N*/ +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)); +/*N*/ if (!(pSheet = Find(aName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ pSheet->SetParent( String() ); +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS ); +/*N*/ +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND)); +/*N*/ if (!(pSheet = Find(aName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ pSheet->SetParent( String() ); +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND ); +/*N*/ +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_NOTES)); +/*N*/ if (!(pSheet = Find(aName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ pSheet->SetParent( String() ); +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES ); +/*N*/ +/*N*/ pParent = NULL; +/*N*/ SetSearchMask(SFX_STYLE_FAMILY_PSEUDO); +/*N*/ aName = String(SdResId(STR_PSEUDOSHEET_OUTLINE)); +/*N*/ for (USHORT nLevel = 1; nLevel < 10; nLevel++) +/*N*/ { +/*N*/ String aLevelName(aName); +/*N*/ aLevelName.Append( sal_Unicode( ' ' )); +/*N*/ aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel ))); +/*N*/ +/*N*/ if (!(pSheet = Find(aLevelName, SFX_STYLE_FAMILY_PSEUDO))) +/*N*/ { +/*N*/ pSheet = &Make(aLevelName, SFX_STYLE_FAMILY_PSEUDO, nMask); +/*N*/ +/*N*/ if (pSheet) +/*N*/ { +/*N*/ if (pParent) +/*N*/ pSheet->SetParent(pParent->GetName()); +/*N*/ pParent = pSheet; +/*N*/ ((SfxStyleSheet*)pSheet)->StartListening(*this); +/*N*/ } +/*N*/ } +/*N*/ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel ); +/*N*/ } +/*N*/ } + + +/************************************************************************* +|* +|* Standard-Styles den richtigen Namen in der Programm-Sprache geben +|* +\************************************************************************/ + +/*N*/ void SdStyleSheetPool::UpdateStdNames() +/*N*/ { +/*N*/ BOOL bNewHelpIds = FALSE; +/*N*/ String aHelpFile; +/*N*/ ULONG nCount = aStyles.Count(); +/*N*/ List* pEraseList = NULL; +/*N*/ +/*N*/ for( ULONG n=0; n < nCount; n++ ) +/*N*/ { +/*N*/ SfxStyleSheetBase* pStyle = aStyles.GetObject( n ); +/*N*/ +/*N*/ if( !pStyle->IsUserDefined() ) +/*N*/ { +/*N*/ String aOldName = pStyle->GetName(); +/*N*/ ULONG nHelpId = pStyle->GetHelpId( aHelpFile ); +/*N*/ SfxStyleFamily eFam = pStyle->GetFamily(); +/*N*/ +/*N*/ BOOL bHelpKnown = TRUE; +/*N*/ String aNewName; +/*N*/ USHORT nNameId = 0; +/*N*/ switch( nHelpId ) +/*N*/ { +/*N*/ case HID_STANDARD_STYLESHEET_NAME: nNameId = STR_STANDARD_STYLESHEET_NAME; break; +/*N*/ case HID_POOLSHEET_OBJWITHARROW: nNameId = STR_POOLSHEET_OBJWITHARROW; break; +/*N*/ case HID_POOLSHEET_OBJWITHSHADOW: nNameId = STR_POOLSHEET_OBJWITHSHADOW; break; +/*N*/ case HID_POOLSHEET_OBJWITHOUTFILL: nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break; +/*N*/ case HID_POOLSHEET_TEXT: nNameId = STR_POOLSHEET_TEXT; break; +/*N*/ case HID_POOLSHEET_TEXTBODY: nNameId = STR_POOLSHEET_TEXTBODY; break; +/*N*/ case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break; +/*N*/ case HID_POOLSHEET_TEXTBODY_INDENT: nNameId = STR_POOLSHEET_TEXTBODY_INDENT;break; +/*N*/ case HID_POOLSHEET_TITLE: nNameId = STR_POOLSHEET_TITLE; break; +/*N*/ case HID_POOLSHEET_TITLE1: nNameId = STR_POOLSHEET_TITLE1; break; +/*N*/ case HID_POOLSHEET_TITLE2: nNameId = STR_POOLSHEET_TITLE2; break; +/*N*/ case HID_POOLSHEET_HEADLINE: nNameId = STR_POOLSHEET_HEADLINE; break; +/*N*/ case HID_POOLSHEET_HEADLINE1: nNameId = STR_POOLSHEET_HEADLINE1; break; +/*N*/ case HID_POOLSHEET_HEADLINE2: nNameId = STR_POOLSHEET_HEADLINE2; break; +/*N*/ case HID_POOLSHEET_MEASURE: nNameId = STR_POOLSHEET_MEASURE; break; +/*N*/ +/*N*/ case HID_PSEUDOSHEET_TITLE: nNameId = STR_PSEUDOSHEET_TITLE; break; +/*N*/ case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_PSEUDOSHEET_SUBTITLE; break; +/*N*/ case HID_PSEUDOSHEET_OUTLINE1: +/*N*/ case HID_PSEUDOSHEET_OUTLINE2: +/*N*/ case HID_PSEUDOSHEET_OUTLINE3: +/*N*/ case HID_PSEUDOSHEET_OUTLINE4: +/*N*/ case HID_PSEUDOSHEET_OUTLINE5: +/*N*/ case HID_PSEUDOSHEET_OUTLINE6: +/*N*/ case HID_PSEUDOSHEET_OUTLINE7: +/*N*/ case HID_PSEUDOSHEET_OUTLINE8: +/*N*/ case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_PSEUDOSHEET_OUTLINE; break; +/*N*/ case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break; +/*N*/ case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_PSEUDOSHEET_BACKGROUND; break; +/*N*/ case HID_PSEUDOSHEET_NOTES: nNameId = STR_PSEUDOSHEET_NOTES; break; +/*N*/ +/*N*/ default: +/*N*/ // 0 oder falsche (alte) HelpId +/*N*/ bHelpKnown = FALSE; +/*N*/ } +/*N*/ if( bHelpKnown ) +/*N*/ { +/*N*/ if( nNameId ) +/*N*/ { +/*N*/ aNewName = String( SdResId( nNameId ) ); +/*N*/ if( nNameId == STR_PSEUDOSHEET_OUTLINE ) +/*N*/ { +/*N*/ aNewName.Append( sal_Unicode( ' ' )); +/*N*/ aNewName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ))); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( aNewName.Len() && aNewName != aOldName ) +/*N*/ { +/*N*/ SfxStyleSheetBase* pSheetFound = Find( aNewName, eFam ); +/*N*/ +/*N*/ if ( !pSheetFound ) +/*N*/ { +/*N*/ // Sheet existiert noch nicht: Altes Sheet wird umbenannt +/*N*/ pStyle->SetName( aNewName ); // setzt auch Parents um +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Sheet existiert schon: Altes Sheet muss entfernt werden +/*N*/ if( !pEraseList ) +/*N*/ { +/*N*/ pEraseList = new List(); +/*N*/ } +/*N*/ +/*N*/ pEraseList->Insert( pStyle ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // falsche oder keine HelpId -> neue generieren +/*N*/ +/*N*/ DBG_WARNING("Default-Vorlage mit falscher oder keiner HelpId"); +/*N*/ +/*N*/ // Da bisher nur deutsche Dokumente erzeugt worden sein koennen, +/*N*/ // kann hier auch der deutsche Text abgefragt werden, damit man +/*N*/ // nicht in einer anderssprachigen Version auf die deutsche +/*N*/ // Version zurueckgreifen muss! +/*N*/ +/*N*/ USHORT nNewId = 0; +/*N*/ if( eFam == SFX_STYLE_FAMILY_PARA ) +/*N*/ { +/*N*/ if( aOldName == String( SdResId( STR_STANDARD_STYLESHEET_NAME ) ) || +/*N*/ aOldName.EqualsAscii( "Standard", 0, RTL_CONSTASCII_LENGTH( "Standard" )) ) +/*N*/ nNewId = HID_STANDARD_STYLESHEET_NAME; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_OBJWITHARROW ) ) || +/*N*/ aOldName.EqualsAscii( "Objekt mit Pfeilspitze", 0, RTL_CONSTASCII_LENGTH( "Objekt mit Pfeilspitze" )) ) +/*N*/ nNewId = HID_POOLSHEET_OBJWITHARROW; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_OBJWITHSHADOW ) ) || +/*N*/ aOldName.EqualsAscii( "Objekt mit Schatten", 0, RTL_CONSTASCII_LENGTH( "Objekt mit Schatten" )) ) +/*N*/ nNewId = HID_POOLSHEET_OBJWITHSHADOW; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_OBJWITHOUTFILL ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_OBJWITHOUTFILL_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Objekt ohne Füllung", 0, RTL_CONSTASCII_LENGTH( "Objekt ohne Füllung" )) ) +/*N*/ nNewId = HID_POOLSHEET_OBJWITHOUTFILL; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TEXT ) ) || +/*N*/ aOldName.EqualsAscii( "Text", 0, RTL_CONSTASCII_LENGTH( "Text" )) ) +/*N*/ nNewId = HID_POOLSHEET_TEXT; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Textkörper", 0, RTL_CONSTASCII_LENGTH( "Textkörper" )) ) +/*N*/ nNewId = HID_POOLSHEET_TEXTBODY; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY_JUSTIFY ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY_JUSTIFY_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Textkörper Blocksatz", 0, RTL_CONSTASCII_LENGTH( "Textkörper Blocksatz" )) ) +/*N*/ nNewId = HID_POOLSHEET_TEXTBODY_JUSTIFY; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY_INDENT ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_TEXTBODY_INDENT_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Textkörper Einzug", 0, RTL_CONSTASCII_LENGTH( "Textkörper Einzug" )) ) +/*N*/ nNewId = HID_POOLSHEET_TEXTBODY_INDENT; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TITLE ) ) || +/*N*/ aOldName.EqualsAscii( "Titel", 0, RTL_CONSTASCII_LENGTH( "Titel" )) ) +/*N*/ nNewId = HID_POOLSHEET_TITLE; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TITLE1 ) ) || +/*N*/ aOldName.EqualsAscii( "Titel1", 0, RTL_CONSTASCII_LENGTH( "Titel1" )) ) +/*N*/ nNewId = HID_POOLSHEET_TITLE1; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_TITLE2 ) ) || +/*N*/ aOldName.EqualsAscii( "Titel2", 0, RTL_CONSTASCII_LENGTH( "Titel2" )) ) +/*N*/ nNewId = HID_POOLSHEET_TITLE2; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_HEADLINE ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_HEADLINE_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Überschrift", 0, RTL_CONSTASCII_LENGTH( "Überschrift" )) ) +/*N*/ nNewId = HID_POOLSHEET_HEADLINE; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_HEADLINE1 ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_HEADLINE1_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Überschrift1", 0, RTL_CONSTASCII_LENGTH( "Überschrift1" )) ) +/*N*/ nNewId = HID_POOLSHEET_HEADLINE1; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_HEADLINE2 ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_HEADLINE2_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Überschrift2", 0, RTL_CONSTASCII_LENGTH( "Überschrift2" )) ) +/*N*/ nNewId = HID_POOLSHEET_HEADLINE2; +/*N*/ else if( aOldName == String( SdResId( STR_POOLSHEET_MEASURE ) ) || +/*N*/ aOldName == String( SdResId( STR_POOLSHEET_MEASURE_NT ) ) ) +/*N*/ //aOldName.EqualsAscii( "Maßlinie", 0, RTL_CONSTASCII_LENGTH( "Maßlinie" )) ) +/*N*/ nNewId = HID_POOLSHEET_MEASURE; +/*N*/ } +/*N*/ else if( eFam == SFX_STYLE_FAMILY_PSEUDO ) +/*N*/ { +/*N*/ String aStr( SdResId( STR_PSEUDOSHEET_OUTLINE ) ); +/*N*/ aStr.Append( sal_Unicode( ' ' )); +/*N*/ String aStr2( RTL_CONSTASCII_USTRINGPARAM( "Gliederung " )); +/*N*/ sal_Int32 nNumber = 0; +/*N*/ +/*N*/ if( aOldName == String( SdResId( STR_PSEUDOSHEET_TITLE ) ) || +/*N*/ aOldName.EqualsAscii( "Titel", 0, RTL_CONSTASCII_LENGTH( "Titel" ))) +/*N*/ nNewId = HID_PSEUDOSHEET_TITLE; +/*N*/ else if( aOldName == String( SdResId( STR_PSEUDOSHEET_SUBTITLE ) ) || +/*N*/ aOldName.EqualsAscii( "Untertitel", 0, RTL_CONSTASCII_LENGTH( "Untertitel" )) ) +/*N*/ nNewId = HID_PSEUDOSHEET_SUBTITLE; +/*N*/ else if( aOldName == String( SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS ) ) || +/*N*/ aOldName.EqualsAscii( "Hintergrundobjekte", 0, RTL_CONSTASCII_LENGTH( "Hintergrundobjekte" )) ) +/*N*/ nNewId = HID_PSEUDOSHEET_BACKGROUNDOBJECTS; +/*N*/ else if( aOldName == String( SdResId( STR_PSEUDOSHEET_BACKGROUND ) ) || +/*N*/ aOldName.EqualsAscii( "Hintergrund", 0, RTL_CONSTASCII_LENGTH( "Hintergrund" )) ) +/*N*/ nNewId = HID_PSEUDOSHEET_BACKGROUND; +/*N*/ else if( aOldName == String( SdResId( STR_PSEUDOSHEET_NOTES ) ) || +/*N*/ aOldName.EqualsAscii( "Notizen", 0, RTL_CONSTASCII_LENGTH( "Notizen" )) ) +/*N*/ nNewId = HID_PSEUDOSHEET_NOTES; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE1; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "2" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "2" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE2; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "3" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "3" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE3; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "4" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "4" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE4; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "5" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "5" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE5; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "6" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "6" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE6; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "7" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "7" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE7; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "8" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "8" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE8; +/*N*/ else if( aOldName.Equals( String( String( aStr ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "9" ) ) ) ) ) ) || +/*N*/ aOldName.Equals( String( String( aStr2 ).Append( String( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "9" ) ) ) ) ) ) ) +/*N*/ nNewId = HID_PSEUDOSHEET_OUTLINE9; +/*N*/ } +/*N*/ +/*N*/ if ( nNewId ) +/*N*/ { +/*N*/ bNewHelpIds = TRUE; +/*N*/ pStyle->SetHelpId( aHelpFile, nNewId ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pEraseList ) +/*N*/ { +/*N*/ // Styles, welche nicht umbenannt werden konnten, muessen entfernt werden +/*N*/ for ( ULONG i = 0; i < pEraseList->Count(); i++ ) +/*N*/ { +/*N*/ SfxStyleSheetBase* pEraseSheet = ( SfxStyleSheetBase* ) pEraseList->GetObject( i ); +/*N*/ Erase( pEraseSheet ); +/*N*/ } +/*N*/ +/*N*/ delete pEraseList; +/*N*/ pEraseList = NULL; +/*N*/ } +/*N*/ +/*N*/ // Wenn neue HelpIDs gefunden wurden koennen die Namen auch gleich ersetzt werden +/*N*/ if( bNewHelpIds ) +/*N*/ UpdateStdNames(); +/*N*/ } + + +/************************************************************************* +|* +|* Da sich die Bedeutung der SvxLRSpaceItems ab nFileFormatVersion = 16 +|* geaendert hat (Bullet-Handling des Outliners, siehe auch +|* SdDrawDocument::NewOrLoadCompleted()), muss fuer aeltere Versionen +|* eine Korrektur vorgenommen werden. +|* +\************************************************************************/ + +/*N*/ void SdStyleSheetPool::AdjustLRSpaceItems() +/*N*/ { +/*N*/ String aHelpFile; +/*N*/ ULONG nCount = aStyles.Count(); +/*N*/ +/*N*/ // #63254# Aenderungen nicht mehr broadcasten,statt dessen nach +/*N*/ // AdjustLRSpaceItems() ein UpdateStyleSheets am Outliner +/*N*/ +/*N*/ if ( nCount > 0 ) +/*N*/ { + /************************************************************************** + * All LayoutStyleSheets loaded? (e.g. new Subtitle LayoutStyleSheet) + **************************************************************************/ +/*N*/ USHORT nMasterPageCount = pDoc->GetMasterSdPageCount(PK_STANDARD); +/*N*/ +/*N*/ for ( USHORT i = 0; i < nMasterPageCount; i++ ) +/*N*/ { +/*N*/ String aName(pDoc->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName()); +/*N*/ aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR )); +/*N*/ CreateLayoutStyleSheets(aName); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ String aOutlineName( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aOutlineName += String(SdResId(STR_PSEUDOSHEET_OUTLINE)); +/*N*/ String aTitleName( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aTitleName += String(SdResId(STR_PSEUDOSHEET_TITLE)); +/*N*/ String aSubtitleName( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ aSubtitleName += String(SdResId(STR_PSEUDOSHEET_SUBTITLE)); +/*N*/ String aStandardName(SdResId(STR_STANDARD_STYLESHEET_NAME)); +/*N*/ SfxStyleSheet* pSheetOutlineLevelOne = NULL; +/*N*/ +/*N*/ for (ULONG n = 0; n < nCount; n++) +/*N*/ { +/*N*/ SfxStyleSheet* pSheet = (SfxStyleSheet*)aStyles.GetObject(n); +/*N*/ SfxItemSet& rSet = pSheet->GetItemSet(); +/*N*/ String aName( pSheet->GetName() ); +/*N*/ String aHelpFile; +/*N*/ ULONG nHelpId = pSheet->GetHelpId( aHelpFile ); +/*N*/ +/*N*/ if( nHelpId == 0) +/*N*/ { +/*N*/ if( aName.Len() == aOutlineName.Len() + 1 && +/*N*/ aName.Match( aOutlineName ) == STRING_MATCH ) +/*N*/ { +/*?*/ sal_Int32 nNumber = String( aName, aName.Len(), 1 ).ToInt32(); +/*?*/ if( 1 <= nNumber && nNumber <= 9 ) +/*?*/ nHelpId = HID_PSEUDOSHEET_OUTLINE + nNumber; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( nHelpId && +/*N*/ ( HID_PSEUDOSHEET_OUTLINE + 1 <= nHelpId && +/*N*/ nHelpId <= HID_PSEUDOSHEET_OUTLINE + 9 )) +/*N*/ { +/*N*/ // Gliederungsvorlage +/*N*/ // Bei Gliederungsobjektvorlagen Korrektur vornehmen +/*N*/ // Es handelt sich hier um die RealStyleSheets und die Pseudos! +/*N*/ // (siehe SdStyleSheet::GetRealStyleSheet()) +/*N*/ if ( nHelpId == HID_PSEUDOSHEET_OUTLINE + 1 ) +/*N*/ { +/*N*/ if (rSet.GetItemState(EE_PARA_BULLETSTATE) != SFX_ITEM_ON) +/*N*/ { +/*N*/ SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 1); // Bullets sichtbar +/*N*/ rSet.Put(aBulletStateItem); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Gliederungs-Vorlage +/*N*/ const SvxBulletItem* pOldBullet = NULL; +/*N*/ if ( rSet.GetItemState( EE_PARA_BULLET ) == SFX_ITEM_ON ) +/*N*/ pOldBullet = &(const SvxBulletItem&) rSet.Get(EE_PARA_BULLET); +/*N*/ +/*N*/ const SvxLRSpaceItem* pOldLRSpace = NULL; +/*N*/ if ( rSet.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON ) +/*N*/ pOldLRSpace = &(const SvxLRSpaceItem&) rSet.Get(EE_PARA_LRSPACE); +/*N*/ +/*N*/ USHORT nLevel = (USHORT) (nHelpId - HID_PSEUDOSHEET_OUTLINE); +/*N*/ +/*N*/ if ( nHelpId == HID_PSEUDOSHEET_OUTLINE + 1 ) +/*N*/ { +/*N*/ pSheetOutlineLevelOne = pSheet; +/*N*/ SvxNumBulletItem aDefaultNumBullet( *(SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); +/*N*/ aDefaultNumBullet.GetNumRule()->SetNumRuleType( SVX_RULETYPE_PRESENTATION_NUMBERING ); +/*N*/ EditEngine::ImportBulletItem( aDefaultNumBullet, nLevel, pOldBullet, pOldLRSpace ); +/*N*/ rSet.Put( aDefaultNumBullet ); +/*N*/ +/*N*/ if (rSet.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_ON ) +/*N*/ { +/*N*/ // Flaechenattribute sind nun unsichtbar +/*N*/ XFillStyleItem aFillStyleItem(XFILL_NONE); +/*N*/ rSet.Put(aFillStyleItem); +/*N*/ } +/*N*/ +/*N*/ if (rSet.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_ON ) +/*N*/ { +/*N*/ // Linienattribute sind nun unsichtbar +/*N*/ XLineStyleItem aLineStyleItem(XLINE_NONE); +/*N*/ rSet.Put(aLineStyleItem); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SfxItemSet& rSetOutlineLevelOne = pSheetOutlineLevelOne->GetItemSet(); +/*N*/ SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rSetOutlineLevelOne.Get(EE_PARA_NUMBULLET) ); +/*N*/ EditEngine::ImportBulletItem( aNumBullet, nLevel, pOldBullet, pOldLRSpace ); +/*N*/ rSetOutlineLevelOne.Put( aNumBullet ); +/*N*/ +/*N*/ // SvxNumBulletItems darf es nur in der ersten Gliederungsebene geben! +/*N*/ if ( rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON ) +/*N*/ rSet.ClearItem( EE_PARA_NUMBULLET ); +/*N*/ } +/*N*/ +/*N*/ if (rSet.GetItemState(EE_PARA_LRSPACE) == SFX_ITEM_ON) +/*N*/ { +/*N*/ const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) rSet.Get(EE_PARA_LRSPACE); +/*N*/ +/*N*/ if (rLRItem.GetTxtFirstLineOfst() == 0) +/*N*/ { +/*N*/ SvxLRSpaceItem aNewLRItem(rLRItem); +/*N*/ const SvxBulletItem& rBulletItem = (const SvxBulletItem&) rSet.Get(EE_PARA_BULLET); +/*N*/ short nFirstLineOfst = (short) -rBulletItem.GetWidth(); +/*N*/ aNewLRItem.SetTxtFirstLineOfst(nFirstLineOfst); +/*N*/ rSet.Put(aNewLRItem); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if ( nHelpId == HID_PSEUDOSHEET_TITLE || +/*N*/ nHelpId == HID_PSEUDOSHEET_SUBTITLE || +/*N*/ aName.Search(aTitleName) != STRING_NOTFOUND || +/*N*/ aName.Search(aSubtitleName) != STRING_NOTFOUND ) +/*N*/ { +/*N*/ // Titel- oder Untertitel-Vorlage +/*N*/ SfxItemSet& rSet = pSheet->GetItemSet(); +/*N*/ +/*N*/ if (rSet.GetItemState(EE_PARA_BULLETSTATE) != SFX_ITEM_ON || +/*N*/ ((const SfxUInt16Item&) rSet.Get(EE_PARA_BULLETSTATE)).GetValue() == 1) +/*N*/ { +/*N*/ SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0); // Bullets nicht sichtbar +/*N*/ rSet.Put(aBulletStateItem); +/*N*/ } +/*N*/ +/*N*/ if( nHelpId == HID_PSEUDOSHEET_TITLE || +/*N*/ aName.Search(aTitleName) != STRING_NOTFOUND ) +/*N*/ { +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ aBulletFont.SetSize(Size(0,1552)); // 44 pt +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ else if( nHelpId == HID_PSEUDOSHEET_SUBTITLE || +/*N*/ aName.Search(aSubtitleName) != STRING_NOTFOUND ) +/*N*/ { +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ aBulletFont.SetSize(Size(0, 1129)); // 32 pt +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ } +/*N*/ else if ( aName == aStandardName ) +/*N*/ { +/*N*/ // Standardvorlage +/*N*/ Font aBulletFont( GetBulletFont() ); +/*N*/ aBulletFont.SetSize(Size(0,846)); // 24 pt +/*N*/ PutNumBulletItem( pSheet, aBulletFont ); +/*N*/ } +/*N*/ else if ( rSet.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON ) +/*N*/ { +/*N*/ // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen +/*N*/ SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rSet.Get(EE_PARA_NUMBULLET) ); +/*N*/ +/*N*/ EditEngine::ImportBulletItem( aNumBullet, 0, NULL, &(const SvxLRSpaceItem&) rSet.Get( EE_PARA_LRSPACE ) ); +/*N*/ rSet.Put( aNumBullet ); +/*N*/ } +/*N*/ } +/*N*/ } + + +/************************************************************************* +|* +|* Neues SvxNumBulletItem fuer das jeweilige StyleSheet setzen +|* +\************************************************************************/ + +/*N*/ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, +/*N*/ Font& rBulletFont ) +/*N*/ { +/*N*/ String aHelpFile; +/*N*/ ULONG nHelpId = pSheet->GetHelpId( aHelpFile ); +/*N*/ SfxItemSet& rSet = pSheet->GetItemSet(); +/*N*/ +/*N*/ switch ( nHelpId ) +/*N*/ { +/*N*/ case HID_STANDARD_STYLESHEET_NAME : +/*N*/ { +/*N*/ // Standard-Vorlage +/*N*/ SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL); +/*N*/ aNumberFormat.SetBulletFont(&rBulletFont); +/*N*/ aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34 +/*N*/ aNumberFormat.SetBulletRelSize(45); +/*N*/ aNumberFormat.SetBulletColor(Color(COL_AUTO)); +/*N*/ aNumberFormat.SetStart(1); +/*N*/ aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); +/*N*/ +/*N*/ SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , FALSE); +/*N*/ aNumberFormat.SetLSpace( 0 ); +/*N*/ aNumberFormat.SetAbsLSpace( 0 ); +/*N*/ aNumberFormat.SetFirstLineOffset( 0 ); +/*N*/ aNumRule.SetLevel( 0, aNumberFormat ); +/*N*/ +/*N*/ for( USHORT i = 1; i < 10; i++ ) +/*N*/ { +/*N*/ const short nLSpace = (i + 1) * 600; +/*N*/ aNumberFormat.SetLSpace(nLSpace); +/*N*/ aNumberFormat.SetAbsLSpace(nLSpace); +/*N*/ aNumberFormat.SetFirstLineOffset(-600); +/*N*/ aNumRule.SetLevel( i, aNumberFormat ); +/*N*/ } +/*N*/ +/*N*/ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); +/*N*/ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case HID_PSEUDOSHEET_TITLE: +/*N*/ /* #84013# title gets same bullet as subtitle and not that page symbol anymore */ +/*N*/ case HID_PSEUDOSHEET_SUBTITLE : +/*N*/ { +/*N*/ // Untertitel-Vorlage +/*N*/ SvxNumRule* pDefaultRule = ((SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule(); +/*N*/ DBG_ASSERT( pDefaultRule, "Wo ist mein Default? [CL]" ); +/*N*/ +/*N*/ if(pDefaultRule) +/*N*/ { +/*N*/ SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 9, FALSE); +/*N*/ for(USHORT i=0; i < aNumRule.GetLevelCount(); i++) +/*N*/ { +/*N*/ SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) ); +/*N*/ aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); +/*N*/ aFrmt.SetStart(1); +/*N*/ aFrmt.SetBulletRelSize(45); +/*N*/ aFrmt.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34 +/*N*/ aFrmt.SetBulletFont(&rBulletFont); +/*N*/ aNumRule.SetLevel(i, aFrmt); +/*N*/ } +/*N*/ +/*N*/ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); +/*N*/ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case HID_PSEUDOSHEET_OUTLINE + 1 : +/*N*/ { +/*N*/ // Gliederungs-Vorlage +/*N*/ SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL); +/*N*/ aNumberFormat.SetBulletColor(Color(COL_AUTO)); +/*N*/ aNumberFormat.SetStart(1); +/*N*/ aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); +/*N*/ +/*N*/ SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT, +/*N*/ 10, FALSE, SVX_RULETYPE_PRESENTATION_NUMBERING ); +/*N*/ for( UINT16 i = 0; i < 10; i++ ) +/*N*/ { +/*N*/ aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34 +/*N*/ aNumberFormat.SetBulletRelSize(45); +/*N*/ const short nLSpace = i ? i * 1200 : 1200; +/*N*/ aNumberFormat.SetLSpace(nLSpace); +/*N*/ aNumberFormat.SetAbsLSpace(nLSpace); +/*N*/ USHORT nFirstLineOffset = -600; +/*N*/ +/*N*/ ULONG nFontSize = 20; +/*N*/ switch(i) +/*N*/ { +/*N*/ case 0: +/*N*/ case 1: +/*N*/ { +/*N*/ nFontSize = 32; +/*N*/ nFirstLineOffset = -900; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 2: +/*N*/ { +/*N*/ nFontSize = 28; +/*N*/ nFirstLineOffset = -800; +/*N*/ aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150 +/*N*/ aNumberFormat.SetBulletRelSize(75); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 3: +/*N*/ { +/*N*/ nFontSize = 24; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case 4: +/*N*/ { +/*N*/ aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150 +/*N*/ aNumberFormat.SetBulletRelSize(75); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ aNumberFormat.SetFirstLineOffset(nFirstLineOffset); +/*N*/ nFontSize = (USHORT)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm +/*N*/ rBulletFont.SetSize(Size(0,846)); // 24 pt +/*N*/ aNumberFormat.SetBulletFont(&rBulletFont); +/*N*/ aNumRule.SetLevel( i, aNumberFormat ); +/*N*/ } +/*N*/ +/*N*/ rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); +/*N*/ ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) ); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Standard Bullet-Font erzeugen (ohne Groesse) +|* +\************************************************************************/ + +/*N*/ Font SdStyleSheetPool::GetBulletFont() const +/*N*/ { +/*N*/ Font aBulletFont( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )), Size(0, 1000) ); +/*N*/ aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE); +/*N*/ aBulletFont.SetWeight(WEIGHT_NORMAL); +/*N*/ aBulletFont.SetUnderline(UNDERLINE_NONE); +/*N*/ aBulletFont.SetStrikeout(STRIKEOUT_NONE); +/*N*/ aBulletFont.SetItalic(ITALIC_NONE); +/*N*/ aBulletFont.SetOutline(FALSE); +/*N*/ aBulletFont.SetShadow(FALSE); +/*N*/ aBulletFont.SetColor(Color(COL_AUTO)); +/*N*/ aBulletFont.SetTransparent(TRUE); +/*N*/ +/*N*/ return aBulletFont; +/*N*/ } + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/core/sd_stlsheet.cxx b/binfilter/bf_sd/source/core/sd_stlsheet.cxx new file mode 100644 index 000000000000..8a8ce9a223f1 --- /dev/null +++ b/binfilter/bf_sd/source/core/sd_stlsheet.cxx @@ -0,0 +1,398 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/eeitemid.hxx> + +#include <bf_svx/eeitem.hxx> + +#include <bf_svtools/itemset.hxx> +#include <bf_svtools/smplhint.hxx> +#include <bf_svx/xdef.hxx> +#include <bf_svx/svddef.hxx> +#include <bf_svx/svdoattr.hxx> +#include "stlsheet.hxx" +#include "sdresid.hxx" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "stlpool.hxx" +#include "glob.hrc" +#include "glob.hxx" + +namespace binfilter { + +/*N*/ TYPEINIT1(SdStyleSheet, SfxStyleSheet); + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +/*N*/ SdStyleSheet::SdStyleSheet(const String& rName, SfxStyleSheetBasePool& rPool, +/*N*/ SfxStyleFamily eFamily, USHORT nMask) : +/*N*/ SfxStyleSheet(rName, rPool, eFamily, nMask) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +/*N*/ SdStyleSheet::~SdStyleSheet() +/*N*/ { +/*N*/ delete pSet; +/*N*/ pSet = NULL; // damit nachfolgende Destruktoren eine Chance haben +/*N*/ } + +/************************************************************************* +|* +|* Load +|* +\************************************************************************/ + +/*N*/ void SdStyleSheet::Load (SvStream& rIn, USHORT nVersion) +/*N*/ { +/*N*/ SfxStyleSheetBase::Load(rIn, nVersion); +/*N*/ +/*N*/ // Die Default-Maske war frueher 0xAFFE. +/*N*/ // Aus dieser Default-Maske wurden die benoetigten Flags ausmaskiert. +/*N*/ // Nun wurde das Flag SFXSTYLEBIT_READONLY eingefuehrt, was dazu +/*N*/ // das alle StyleSheets read-only waren. +/*N*/ // Da im Draw kein StyleSheet read-only sein soll, wird an dieser Stelle +/*N*/ // das Flag zurueckgesetzt. +/*N*/ nMask &= ~SFXSTYLEBIT_READONLY; +/*N*/ } + +/************************************************************************* +|* +|* Store +|* +\************************************************************************/ + +/*N*/ void SdStyleSheet::Store(SvStream& rOut) +/*N*/ { +/*N*/ SfxStyleSheetBase::Store(rOut); +/*N*/ } + +/************************************************************************* +|* +|* Parent setzen +|* +\************************************************************************/ + +/*N*/ BOOL SdStyleSheet::SetParent(const String& rParentName) +/*N*/ { +/*N*/ BOOL bResult = FALSE; +/*N*/ +/*N*/ if (SfxStyleSheet::SetParent(rParentName)) +/*N*/ { +/*N*/ // PseudoStyleSheets haben keine eigenen ItemSets +/*N*/ if (nFamily != SFX_STYLE_FAMILY_PSEUDO) +/*N*/ { +/*N*/ if( rParentName.Len() ) +/*N*/ { +/*N*/ SfxStyleSheetBase* pStyle = rPool.Find(rParentName, nFamily); +/*N*/ if (pStyle) +/*N*/ { +/*N*/ bResult = TRUE; +/*N*/ SfxItemSet& rParentSet = pStyle->GetItemSet(); +/*N*/ GetItemSet().SetParent(&rParentSet); +/*N*/ Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bResult = TRUE; +/*N*/ GetItemSet().SetParent(NULL); +/*N*/ Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bResult = TRUE; +/*N*/ } +/*N*/ } +/*N*/ return bResult; +/*N*/ } + +/************************************************************************* +|* +|* ItemSet ggfs. erzeugen und herausreichen +|* +\************************************************************************/ + +/*N*/ SfxItemSet& SdStyleSheet::GetItemSet() +/*N*/ { +/*N*/ if (nFamily == SFX_STYLE_FAMILY_PARA || nFamily == SD_LT_FAMILY) +/*N*/ { +/*N*/ // ggfs. das ItemSet 'on demand' anlegen +/*N*/ if (!pSet) +/*N*/ { +/*N*/ USHORT nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*N*/ +/*N*/ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, +/*N*/ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_HORZADJUST, +/*N*/ SDRATTR_TEXT_ANIKIND, SDRATTR_TEXT_CONTOURFRAME, +/*N*/ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST, +/*N*/ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST, +/*N*/ +/*N*/ EE_PARA_START, EE_CHAR_END, +/*N*/ +/*N*/ SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES, +/*N*/ +/*N*/ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, +/*N*/ 0, 0 }; +/*N*/ +/*N*/ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); +/*N*/ } +/*N*/ +/*N*/ return *pSet; +/*N*/ } +/*N*/ +/*N*/ // dies ist eine Stellvertretervorlage fuer die interne Vorlage des +/*N*/ // aktuellen Praesentationslayouts: dessen ItemSet returnieren +/*N*/ else +/*N*/ { +/*N*/ // return (GetRealStyleSheet()->GetItemSet()); +/*N*/ +/*N*/ SdStyleSheet* pSdSheet = GetRealStyleSheet(); +/*N*/ +/*N*/ if (pSdSheet) +/*N*/ { +/*N*/ return(pSdSheet->GetItemSet()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (!pSet) +/*N*/ { +/*N*/ USHORT nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*N*/ +/*N*/ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, +/*N*/ SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_HORZADJUST, +/*N*/ SDRATTR_TEXT_ANIKIND, SDRATTR_TEXT_CONTOURFRAME, +/*N*/ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST, +/*N*/ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST, +/*N*/ +/*N*/ EE_PARA_START, EE_CHAR_END, +/*N*/ +/*N*/ SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES, +/*N*/ +/*N*/ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, +/*N*/ 0, 0 }; +/*N*/ +/*N*/ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); +/*N*/ } +/*N*/ +/*N*/ return(*pSet); +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* IsUsed(), eine Vorlage gilt als benutzt, wenn sie von eingefuegten Objekten +|* oder von benutzten Vorlagen referenziert wird +|* +\************************************************************************/ + +/*N*/ BOOL SdStyleSheet::IsUsed() const +/*N*/ { +/*N*/ BOOL bResult = FALSE; +/*N*/ +/*N*/ USHORT nListenerCount = GetListenerCount(); +/*N*/ if (nListenerCount > 0) +/*?*/ { +/*?*/ for (USHORT n = 0; n < nListenerCount; n++) +/*?*/ { +/*?*/ SfxListener* pListener = GetListener(n); + // NULL-Pointer ist im Listener-Array erlaubt +/*?*/ if (pListener && pListener->ISA(SdrAttrObj)) +/*?*/ { +/*?*/ bResult = ((SdrAttrObj*)pListener)->IsInserted(); +/*?*/ } +/*?*/ else if (pListener && pListener->ISA(SfxStyleSheet)) +/*?*/ { +/*?*/ bResult = ((SfxStyleSheet*)pListener)->IsUsed(); +/*?*/ } +/*?*/ if (bResult) +/*?*/ break; +/*?*/ } +/*?*/ } +/*N*/ return bResult; +/*N*/ } + +/************************************************************************* +|* +|* CreateChildList, erstellt eine Liste der unmittelbaren Kinder dieser +|* Vorlage; die Liste gehoert dem Caller! +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* das StyleSheet ermitteln, fuer das dieses StyleSheet steht +|* +\************************************************************************/ + +/*N*/ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const +/*N*/ { +/*N*/ String aRealStyle; +/*N*/ String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); +/*N*/ SdStyleSheet* pRealStyle = NULL; +/*N*/ SdDrawDocument* pDoc = ((SdStyleSheetPool&) rPool).GetDoc(); +/*N*/ +/*N*/ if (aRealStyle.Len() == 0) +/*N*/ { +/*N*/ SdPage* pPage = pDoc->GetSdPage(0, PK_STANDARD); +/*N*/ +/*N*/ if (pPage) +/*N*/ { +/*N*/ aRealStyle = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Noch keine Seite vorhanden +/*N*/ // Dieses kann beim Aktualisieren vonDokumentvorlagen vorkommen +/*?*/ SfxStyleSheetIterator aIter(&rPool, SD_LT_FAMILY); + SfxStyleSheetBase* pSheet = aIter.First(); + if( pSheet ) + aRealStyle = pSheet->GetName(); + } + +/*N*/ aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len()); +/*N*/ } +/*N*/ +/*N*/ // jetzt vom Namen (landessprachlich angepasst) auf den internen +/*N*/ // Namen (unabhaengig von der Landessprache) mappen +/*N*/ String aInternalName; +/*N*/ +/*N*/ if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE))) +/*N*/ { +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_TITLE)); +/*N*/ } +/*N*/ else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE))) +/*N*/ { +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_SUBTITLE)); +/*N*/ } +/*N*/ else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUND))) +/*N*/ { +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_BACKGROUND)); +/*N*/ } +/*N*/ else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))) +/*N*/ { +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)); +/*N*/ } +/*N*/ else if (aName == String(SdResId(STR_PSEUDOSHEET_NOTES))) +/*N*/ { +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_NOTES)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE)); +/*N*/ USHORT nPos = aName.Search(aOutlineStr); +/*N*/ if (nPos != STRING_NOTFOUND) +/*N*/ { +/*N*/ String aNumStr(aName.Copy(aOutlineStr.Len())); +/*N*/ aInternalName = String(SdResId(STR_LAYOUT_OUTLINE)); +/*N*/ aInternalName += aNumStr; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aRealStyle += aInternalName; +/*N*/ pRealStyle = (SdStyleSheet*)rPool.Find(aRealStyle, SD_LT_FAMILY); +/*N*/ if( !pRealStyle ) +/*N*/ { +/*N*/ SfxStyleSheetIterator aIter(&rPool, SD_LT_FAMILY); +/*N*/ if( aIter.Count() > 0 ) +/*N*/ // StyleSheet not found, but pool already loaded +/*N*/ DBG_ASSERT(pRealStyle, "Internal StyleSheet not found"); +/*N*/ } +/*N*/ +/*N*/ return pRealStyle; +/*N*/ } + +/************************************************************************* +|* +|* das PseudoStyleSheet ermitteln, durch das dieses StyleSheet vertreten wird +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* Notify +|* +\************************************************************************/ + +/*N*/ void SdStyleSheet::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, +/*N*/ const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ // erstmal die Basisklassenfunktionalitaet +/*N*/ SfxStyleSheet::Notify(rBC, rHint); +/*N*/ +/*N*/ // wenn der Stellvertreter ein Notify bezueglich geaenderter Attribute +/*N*/ // bekommt, sorgt er dafuer, dass das eigentlich gemeinte StyleSheet +/*N*/ // broadcastet +/*N*/ SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint); +/*N*/ ULONG nId = pSimple == NULL ? 0 : pSimple->GetId(); +/*N*/ if (nId == SFX_HINT_DATACHANGED && nFamily == SFX_STYLE_FAMILY_PSEUDO) +/*N*/ { +/*?*/ SdStyleSheet* pRealStyle = GetRealStyleSheet(); +/*?*/ if (pRealStyle) +/*?*/ pRealStyle->Broadcast(rHint); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* AdjustToFontHeight passt die Bulletbreite und den linken Texteinzug +|* des uebergebenen ItemSets dessen Fonthoehe an. Die neuen Werte werden so +|* berechnet, dass das Verhaeltnis zur Fonthoehe so ist wie im StyleSheet. +|* +|* bOnlyMissingItems legt fest, ob lediglich nicht gesetzte Items ergaenzt +|* (TRUE) oder explizit gesetzte Items ueberschreiben werden sollen (FALSE) +|* +\************************************************************************/ + + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/filter/bin/makefile.mk b/binfilter/bf_sd/source/filter/bin/makefile.mk new file mode 100644 index 000000000000..af311b1781b7 --- /dev/null +++ b/binfilter/bf_sd/source/filter/bin/makefile.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PRJNAME=binfilter +TARGET=sd_bin + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/sd_sdbinfilter.obj + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/binfilter/bf_sd/source/filter/bin/sd_sdbinfilter.cxx b/binfilter/bf_sd/source/filter/bin/sd_sdbinfilter.cxx new file mode 100644 index 000000000000..b865d87d39d7 --- /dev/null +++ b/binfilter/bf_sd/source/filter/bin/sd_sdbinfilter.cxx @@ -0,0 +1,564 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <rtl/logfile.hxx> + +#include <sot/formats.hxx> +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/style.hxx> +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/saveopt.hxx> +#include <bf_sfx2/docfile.hxx> +#include <bf_sfx2/progress.hxx> + +#include "bf_sd/docshell.hxx" + + +#include <bf_svx/xdef.hxx> + +#include <bf_svx/xflgrit.hxx> +#include <bf_svx/xbtmpit.hxx> +#include <bf_svx/xlndsit.hxx> +#include <bf_svx/xlnstit.hxx> +#include <bf_svx/xflftrit.hxx> +#include <bf_svx/xflhtit.hxx> +#include <bf_svx/xlnedit.hxx> +#include <bf_svx/svdotext.hxx> +#include <bf_svx/eeitem.hxx> +#include <bf_svx/svditer.hxx> + +#include "sdoutl.hxx" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "strmname.h" +#include "sdbinfilter.hxx" +namespace binfilter { + +// ----------- +// - Defines - +// ----------- + +#define POOL_BUFFER_SIZE 32768 +#define BASIC_BUFFER_SIZE 8192 +#define DOCUMENT_BUFFER_SIZE 32768 + +// -------------- +// - Namespaces - +// -------------- + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::frame; + +// --------------- +// - SdBINFilter - +// --------------- + +SdBINFilter::SdBINFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress ) : + SdFilter( rMedium, rDocShell, bShowProgress ) +{ +} + +// ----------------------------------------------------------------------------- + +static void ImplPostLoadCheckStyleSheetPool( SfxStyleSheetPool* pStyleSheetPool, SdDrawDocument* pDoc ) +{ + if( pStyleSheetPool ) + { + SfxStyleSheetBase* pStyleSheet = pStyleSheetPool->First(); + while( pStyleSheet ) + { + SfxItemSet& rSet = pStyleSheet->GetItemSet(); + + const SfxPoolItem *pItem; + + // check fill gradient item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_FILLGRADIENT, sal_False, &pItem ) ) + { + XFillGradientItem* pNewItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_FILLGRADIENT ); + delete pNewItem; + } + } + + // check fill bitmap item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_FILLBITMAP, sal_False, &pItem ) ) + { + XFillBitmapItem* pNewItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_FILLBITMAP ); + delete pNewItem; + } + } + + // check line dash item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_LINEDASH, sal_False, &pItem ) ) + { + XLineDashItem* pNewItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_LINEDASH ); + delete pNewItem; + } + } + + // check line start item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_LINESTART, sal_False, &pItem ) ) + { + XLineStartItem* pNewItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_LINESTART ); + delete pNewItem; + } + } + + // check line end item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_LINEEND, sal_False, &pItem ) ) + { + XLineEndItem* pNewItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_LINEEND ); + delete pNewItem; + } + } + + // check fill float transparence item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_FILLFLOATTRANSPARENCE, sal_False, &pItem ) ) + { + XFillFloatTransparenceItem* pNewItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_FILLFLOATTRANSPARENCE ); + delete pNewItem; + } + } + + // check fill hatch item for valid name + if( SFX_ITEM_SET == rSet.GetItemState( XATTR_FILLHATCH, sal_False, &pItem ) ) + { + XFillHatchItem* pNewItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pDoc ); + if( pNewItem != pItem ) + { + rSet.Put( *pNewItem, XATTR_FILLHATCH ); + delete pNewItem; + } + } +/* sample code for fixing bullet problems. Didn't need it yet + if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, sal_False, &pItem ) ) + { + SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule(); + + const USHORT nLevelCount = pRule->GetLevelCount(); + USHORT nLevel; + BOOL bNeedsFix = FALSE; + for( nLevel = 0; !bNeedsFix && (nLevel < nLevelCount); nLevel++ ) + { + const SvxNumberFormat& rLevel = pRule->GetLevel(nLevel); + bNeedsFix = (rLevel.GetNumberingType() == ::com::sun::star::style::NumberingType::CHAR_SPECIAL) && + (rLevel.GetBulletChar() == 0 ); + } + + if( bNeedsFix ) + { + SvxNumRule aNewRule( pRule->GetFeatureFlags(), nLevelCount, FALSE, pRule->GetNumRuleType() ); + + for( nLevel = 0; !bNeedsFix && (nLevel < nLevelCount); nLevel++ ) + { + SvxNumberFormat aLevel(pRule->GetLevel(nLevel)) ; + if( (aLevel.GetNumberingType() == ::com::sun::star::style::NumberingType::CHAR_SPECIAL) && (aLevel.GetBulletChar() == 0 ) ) + aLevel.SetNumberingType( ::com::sun::star::style::NumberingType::NUMBER_NONE ); + + aNewRule.SetLevel(nLevel, aLevel); + } + + rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) ); + + } + } +*/ + pStyleSheet = pStyleSheetPool->Next(); + } + } +} + +/** this checks for the given text object if all paragraphs have the + same stylesheet as the object itself. If not, they will be fixed +*/ +static void ImplPostLoadFixTextStyles( SdDrawDocument* pDoc, SdrTextObj* pText ) +{ + SfxStyleSheet* pObjectStyleSheet = pText->GetStyleSheet(); + if( pObjectStyleSheet ) + { + sal_Bool bDataChanged = sal_False; + + SdOutliner* pOutliner = pDoc->GetInternalOutliner(TRUE); + + pOutliner->SetText( *pText->GetOutlinerParaObject() ); + + const ULONG nParaCount = pOutliner->GetParagraphCount(); + ULONG nPara; + for( nPara = 0; nPara < nParaCount; nPara++ ) + { + SfxStyleSheet* pStyleSheet = pOutliner->GetStyleSheet( nPara ); + if( pStyleSheet && (pStyleSheet != pObjectStyleSheet) ) + { + SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); + SfxItemSet& rObjStyleSet = pObjectStyleSheet->GetItemSet(); + + SfxItemSet aSet( pOutliner->GetParaAttribs( nPara ) ); + + USHORT nWhich; + for( nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) + { + if( aSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) + { + const SfxPoolItem* pSourceItem = rStyleSet.GetItem( nWhich ); + const SfxPoolItem* pDestItem = rObjStyleSet.GetItem( nWhich ); + + if( (*pSourceItem) != (*pDestItem) ) + aSet.Put( *pSourceItem ); + } + } + pOutliner->SetStyleSheet( nPara, pObjectStyleSheet ); + pOutliner->SetParaAttribs( nPara, aSet ); + bDataChanged = sal_True; + } + } + + if( bDataChanged ) + pText->SetOutlinerParaObject( pOutliner->CreateParaObject() ); + + pOutliner->Clear(); + } +} + +static void ImplPostLoadFixTextStyles( SdDrawDocument* pDoc, SdrObjList* pList) +{ + SdrObjListIter aIter( *pList, IM_DEEPNOGROUPS ); + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + SdrTextObj* pText = PTR_CAST( SdrTextObj, pObj ); + if( pText && pText->HasText() ) + { + SdPage* pPage = PTR_CAST(SdPage,pList); + if( pPage && (pPage->GetPresObjKind(pObj) == PRESOBJ_NONE) ) + ImplPostLoadFixTextStyles( pDoc, pText ); + } + } +} + +/** this method checks all SdrObjects inside the document if the paragraphs have the + same style as the shape */ +static void ImplPostLoadFixTextStyles( SdDrawDocument* pDoc ) +{ + USHORT nPageCount = pDoc->GetPageCount(); + USHORT nPage; + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + ImplPostLoadFixTextStyles( pDoc, pDoc->GetPage(nPage) ); + } + + nPageCount = pDoc->GetMasterPageCount(); + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + ImplPostLoadFixTextStyles( pDoc, pDoc->GetMasterPage(nPage) ); + } +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdBINFilter::Import() +{ + RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdBINFilter::Import" ); +#ifdef TIMELOG + ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "importing %s", aFile.GetBuffer() ); +#endif + + SvStorage* pStore = mrMedium.GetStorage(); + ULONG nStorFmt = pStore->GetFormat(); + sal_Bool bRet = sal_False; + + const ByteString aStrKey = pStore->GetKey(); + const sal_Bool bKeySet = (aStrKey.Len() > 0); + + if ( nStorFmt == SOT_FORMATSTR_ID_STARIMPRESS_50 || + nStorFmt == SOT_FORMATSTR_ID_STARDRAW_50 || + nStorFmt == SOT_FORMATSTR_ID_STARDRAW_40 || + nStorFmt == SOT_FORMATSTR_ID_STARDRAW ) + { + StreamMode eStmMode = STREAM_STD_READWRITE; + const BOOL bProgress = ( mbShowProgress && ( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) ); + BOOL bIsEmptyStreams = FALSE; + + if( bProgress ) + { + // create progress + CreateProgress(); + + if( mpProgress ) + mrDocument.SetIOProgressHdl( LINK( this, SdBINFilter, IOProgressHdl ) ); + } + + if( pStore->IsStream( pSfxStyleSheets ) ) + { + SvStorageStreamRef xPoolStm( pStore->OpenStream( pSfxStyleSheets, STREAM_STD_READWRITE ) ); + + if( !( bRet = ( xPoolStm.Is() && ( xPoolStm->GetError() == 0 ) ) ) ) + { + // try to open as read only + xPoolStm.Clear(); + xPoolStm = pStore->OpenStream( pSfxStyleSheets, eStmMode = STREAM_STD_READ ); + bRet = ( xPoolStm.Is() && xPoolStm->GetError() == 0 ); + } + + if( bRet ) + { + // load ItemPool + xPoolStm->SetVersion( pStore->GetVersion() ); + mrDocShell.GetPool().SetFileFormatVersion( (USHORT) pStore->GetVersion() ); + xPoolStm->SetBufferSize( POOL_BUFFER_SIZE ); + mrDocShell.GetPool().Load( *xPoolStm ); + bRet = ( xPoolStm->GetError() == 0 ); + DBG_ASSERT( bRet, "Error while loading ItemPool" ); + } + + if( bRet ) + { + // load StyleSheet pool + ( (SfxStyleSheetPool*) mrDocShell.GetStyleSheetPool() )->Load( *xPoolStm ); + xPoolStm->SetBufferSize( 0 ); + bRet = ( xPoolStm->GetError() == 0 ); + DBG_ASSERT( bRet, "Error while loading StyleSheetPool" ); + } + + if( !bRet || xPoolStm->GetErrorCode() ) + mrDocShell.SetError( xPoolStm->GetErrorCode() ); + } + else + { + bIsEmptyStreams = TRUE; + bRet = TRUE; + } + + if( bRet ) + { + // load drawing model + SvStorageStreamRef xDocStm; + sal_Bool bAcceptableStreamFound = sal_False; + + if( pStore->IsStream( pStarDrawDoc ) ) + { + bAcceptableStreamFound = sal_True; + xDocStm = pStore->OpenStream( pStarDrawDoc, eStmMode ); + } + else if( pStore->IsStream( pStarDrawDoc3 )) + { + bAcceptableStreamFound = sal_True; + xDocStm = pStore->OpenStream( pStarDrawDoc3, eStmMode ); + } + + if( xDocStm.Is() && bAcceptableStreamFound ) + { + xDocStm->SetVersion( pStore->GetVersion() ); + if( bKeySet ) + xDocStm->SetKey( aStrKey ); + + if( bRet = ( xDocStm->GetError() == 0 ) ) + { + xDocStm->SetBufferSize( DOCUMENT_BUFFER_SIZE ); + if( bKeySet ) + xDocStm->SetKey( aStrKey ); + mrDocument.SetModelStorage( pStore ); + *xDocStm >> mrDocument; + mrDocument.SetModelStorage( NULL ); + + if( !( bRet = ( xDocStm->GetError() == 0 ) ) ) + { + if( pStore->GetKey().Len() == 0 ) + mrDocShell.SetError( ERRCODE_SFX_DOLOADFAILED ); // no password? --> file defect + else + mrDocShell.SetError( ERRCODE_SFX_WRONGPASSWORD ); // wrong password + } + else if ( xDocStm->GetErrorCode() ) + mrDocShell.SetError( xDocStm->GetErrorCode() ); + + xDocStm->SetBufferSize( 0 ); + } + + bIsEmptyStreams = FALSE; + } + } + + if( bRet ) + { + if( bIsEmptyStreams ) + mrDocument.NewOrLoadCompleted( NEW_DOC ); + else + { + mrDocument.NewOrLoadCompleted( DOC_LOADED ); + ImplPostLoadCheckStyleSheetPool( (SfxStyleSheetPool*) mrDocShell.GetStyleSheetPool(), &mrDocument ); + ImplPostLoadFixTextStyles( &mrDocument ); + } + } + + if( bProgress ) + { + const Link aNullLink; + mrDocument.SetIOProgressHdl( aNullLink ); + } + } + else + pStore->SetError( SVSTREAM_WRONGVERSION ); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdBINFilter::Export() +{ +#ifdef TIMELOG + RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdBINFilter::Export" ); + ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "exporting %s", aFile.GetBuffer() ); +#endif + + SvStorage* pStore = mrMedium.GetOutputStorage(); + const BOOL bSaveNative = FALSE; + const BOOL bSaveCompressed = FALSE; + sal_Bool bRet = sal_False; + + mrDocument.SetSaveCompressed( bSaveCompressed ); + mrDocument.SetSaveNative( bSaveNative ); + mrDocument.PreSave(); + + if( !pStore->GetError() ) + { + // store ItemPool and StyleSheetPool + SvStorageStreamRef xPoolStm( pStore->OpenStream( pSfxStyleSheets, STREAM_READ | STREAM_WRITE | STREAM_TRUNC ) ); + + if( xPoolStm.Is() && !xPoolStm->GetError() ) + { + const long nVersion = pStore->GetVersion(); + const USHORT nOldComprMode = xPoolStm->GetCompressMode(); + USHORT nNewComprMode = nOldComprMode; + + xPoolStm->SetVersion( pStore->GetVersion() ); + xPoolStm->SetSize( 0 ); + xPoolStm->SetBufferSize( POOL_BUFFER_SIZE ); + mrDocShell.GetPool().SetFileFormatVersion( (USHORT) nVersion ); + + if( SOFFICE_FILEFORMAT_40 <= nVersion ) + { + if( bSaveNative ) + nNewComprMode |= COMPRESSMODE_NATIVE; + + if( bSaveCompressed ) + nNewComprMode |= COMPRESSMODE_ZBITMAP; + + xPoolStm->SetCompressMode( nNewComprMode ); + } + + mrDocShell.GetPool().Store( *xPoolStm ); + mrDocShell.GetStyleSheetPool()->SetSearchMask( SFX_STYLE_FAMILY_ALL ); + mrDocShell.GetStyleSheetPool()->Store( *xPoolStm, FALSE ); + xPoolStm->SetBufferSize( 0 ); + xPoolStm->SetCompressMode( nOldComprMode ); + bRet = ( xPoolStm->GetError() == 0 ); + } + else + { + DBG_ERROR( "Error while writing the pool" ); + bRet = sal_False; + } + + if( !bRet || xPoolStm->GetErrorCode() ) + mrDocShell.SetError( xPoolStm->GetErrorCode() ); + } + + if( bRet && ( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_ORGANIZER ) ) + { + // rename stream is neccessary + if( pStore->IsStream( pStarDrawDoc ) && !pStore->Rename( pStarDrawDoc, pStarDrawDoc3 ) ) + { + DBG_ERROR( "Error while renaming the stream"); + } + + // store model + SvStorageStreamRef xDocStm( pStore->OpenStream( pStarDrawDoc3, STREAM_READ | STREAM_WRITE | STREAM_TRUNC ) ); + + if( xDocStm.Is() && !xDocStm->GetError() ) + { + xDocStm->SetVersion( pStore->GetVersion() ); + xDocStm->SetKey( pStore->GetKey() ); + xDocStm->SetSize( 0 ); + xDocStm->SetBufferSize( DOCUMENT_BUFFER_SIZE ); + xDocStm->SetKey( pStore->GetKey() ); + *xDocStm << mrDocument; + xDocStm->SetBufferSize( 0 ); + bRet = ( xDocStm->GetError() == 0 ); + } + else + { + DBG_ERROR( "Error while writing the model" ); + bRet = sal_False; + } + + if( !bRet || xDocStm->GetErrorCode() ) + mrDocShell.SetError( xDocStm->GetErrorCode() ); + } + +/* !!! + if( bRet && ( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) ) + mrDocShell.AddXMLAsZipToTheStorage( *pStore ); +*/ + + mrDocument.PostSave(); + + return bRet; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdBINFilter, IOProgressHdl, USHORT*, pPercent ) +{ + if( mpProgress && pPercent ) + mpProgress->SetState( *pPercent ); + + return 0; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/filter/makefile.mk b/binfilter/bf_sd/source/filter/makefile.mk new file mode 100644 index 000000000000..7e28a3025ecc --- /dev/null +++ b/binfilter/bf_sd/source/filter/makefile.mk @@ -0,0 +1,53 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sd_filter + +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/sd_sdfilter.obj \ + $(SLO)$/sd_propread.obj + +EXCEPTIONSFILES= \ + $(SLO)$/sd_sdfilter.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/binfilter/bf_sd/source/filter/propread.hxx b/binfilter/bf_sd/source/filter/propread.hxx new file mode 100644 index 000000000000..9d4eb5e88b43 --- /dev/null +++ b/binfilter/bf_sd/source/filter/propread.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _PROPREAD_HXX_ +#define _PROPREAD_HXX_ + +#include <tools/solar.h> +#include <bf_so3/svstor.hxx> + +namespace binfilter { + +// SummaryInformation +#define PID_TITLE 0x02 +#define PID_SUBJECT 0x03 +#define PID_AUTHOR 0x04 +#define PID_KEYWORDS 0x05 +#define PID_COMMENTS 0x06 +#define PID_TEMPLATE 0x07 +#define PID_LASTAUTHOR 0x08 +#define PID_REVNUMBER 0x09 +#define PID_EDITTIME 0x0a +#define PID_LASTPRINTED_DTM 0x0b +#define PID_CREATE_DTM 0x0c +#define PID_LASTSAVED_DTM 0x0d + +// DocumentSummaryInformation +#define PID_CATEGORY 0x02 +#define PID_PRESFORMAT 0x03 +#define PID_BYTECOUNT 0x04 +#define PID_LINECOUNT 0x05 +#define PID_PARACOUNT 0x06 +#define PID_SLIDECOUNT 0x07 +#define PID_NOTECOUNT 0x08 +#define PID_HIDDENCOUNT 0x09 +#define PID_MMCLIPCOUNT 0x0a +#define PID_SCALE 0x0b +#define PID_HEADINGPAIR 0x0c +#define PID_DOCPARTS 0x0d +#define PID_MANAGER 0x0e +#define PID_COMPANY 0x0f +#define PID_LINKSDIRTY 0x10 + +#define VT_EMPTY 0 +#define VT_NULL 1 +#define VT_I2 2 +#define VT_I4 3 +#define VT_R4 4 +#define VT_R8 5 +#define VT_CY 6 +#define VT_DATE 7 +#define VT_BSTR 8 +#define VT_UI4 9 +#define VT_ERROR 10 +#define VT_BOOL 11 +#define VT_VARIANT 12 +#define VT_DECIMAL 14 +#define VT_I1 16 +#define VT_UI1 17 +#define VT_UI2 18 +#define VT_I8 20 +#define VT_UI8 21 +#define VT_INT 22 +#define VT_UINT 23 +#define VT_LPSTR 30 +#define VT_LPWSTR 31 +#define VT_FILETIME 64 +#define VT_BLOB 65 +#define VT_STREAM 66 +#define VT_STORAGE 67 +#define VT_STREAMED_OBJECT 68 +#define VT_STORED_OBJECT 69 +#define VT_BLOB_OBJECT 70 +#define VT_CF 71 +#define VT_CLSID 72 +#define VT_VECTOR 0x1000 +#define VT_ARRAY 0x2000 +#define VT_BYREF 0x4000 +#define VT_TYPEMASK 0xFFF + +// ------------------------------------------------------------------------ + +class PropItem : public SvMemoryStream +{ + sal_uInt16 mnTextEnc; + + public : + PropItem(){}; + void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; }; + PropItem& operator=( PropItem& rPropItem ); +}; + +// ------------------------------------------------------------------------ + +class Dictionary : protected List +{ + friend class Section; + + public : + Dictionary(){}; + ~Dictionary(); + Dictionary& operator=( Dictionary& rDictionary ); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/filter/sd_propread.cxx b/binfilter/bf_sd/source/filter/sd_propread.cxx new file mode 100644 index 000000000000..1a5520a6611e --- /dev/null +++ b/binfilter/bf_sd/source/filter/sd_propread.cxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <propread.hxx> +#include "rtl/tencinfo.h" +#include "rtl/textenc.h" +namespace binfilter { + +// ------------------------------------------------------------------------ + +PropItem& PropItem::operator=( PropItem& rPropItem ) +{ + if ( this != &rPropItem ) + { + Seek( STREAM_SEEK_TO_BEGIN ); + delete[] SwitchBuffer(); + + mnTextEnc = rPropItem.mnTextEnc; + sal_uInt32 nPos = rPropItem.Tell(); + rPropItem.Seek( STREAM_SEEK_TO_END ); + SvMemoryStream::Write( rPropItem.GetData(), rPropItem.Tell() ); + rPropItem.Seek( nPos ); + } + return *this; +} + +// ----------------------------------------------------------------------- + +struct Dict +{ + sal_uInt32 mnId; + String aString; + + Dict( sal_uInt32 nId, String rString ) { mnId = nId; aString = rString; }; +}; + +// ----------------------------------------------------------------------- + +Dictionary::~Dictionary() +{ + for ( void* pPtr = First(); pPtr; pPtr = Next() ) + delete (Dict*)pPtr; +} + +// ----------------------------------------------------------------------- + +Dictionary& Dictionary::operator=( Dictionary& rDictionary ) +{ + if ( this != &rDictionary ) + { + void* pPtr; for ( pPtr = First(); pPtr; pPtr = Next() ) + delete (Dict*)pPtr; + + for ( pPtr = rDictionary.First(); pPtr; pPtr = rDictionary.Next() ) + Insert( new Dict( ((Dict*)pPtr)->mnId, ((Dict*)pPtr)->aString ), LIST_APPEND ); + } + return *this; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/filter/sd_sdfilter.cxx b/binfilter/bf_sd/source/filter/sd_sdfilter.cxx new file mode 100644 index 000000000000..034087e1939d --- /dev/null +++ b/binfilter/bf_sd/source/filter/sd_sdfilter.cxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> + +#include <tools/debug.hxx> +#include <osl/file.hxx> +#include <osl/module.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_sfx2/docfile.hxx> +#include <bf_sfx2/progress.hxx> + +#include "bf_sd/docshell.hxx" + +#include "sdresid.hxx" +#include "pres.hxx" +#include "drawdoc.hxx" +#include "sdfilter.hxx" +#include "glob.hrc" + +namespace binfilter { + +// -------------- +// - Namespaces - +// -------------- + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::frame; + +// ------------ +// - SdFilter - +// ------------ + +SdFilter::SdFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress ) : + mrMedium( rMedium ), + mrDocShell( rDocShell ), + mrDocument( *rDocShell.GetDoc() ), + mxModel( rDocShell.GetModel() ), + mpProgress( NULL ), + mbIsDraw( rDocShell.GetDocumentType() == DOCUMENT_TYPE_DRAW ), + mbShowProgress( bShowProgress ) +{ +} + +// ----------------------------------------------------------------------------- + +SdFilter::~SdFilter() +{ + delete mpProgress; +} + +// ----------------------------------------------------------------------------- + +void SdFilter::CreateStatusIndicator() +{ + try + { + if (mxModel.is()) + { + Reference< XController > xController( mxModel->getCurrentController()); + if( xController.is()) + { + Reference< XFrame > xFrame( xController->getFrame()); + if( xFrame.is()) + { + Reference< XStatusIndicatorFactory > xFactory( xFrame, UNO_QUERY ); + if( xFactory.is()) + { + mxStatusIndicator = xFactory->createStatusIndicator(); + } + } + } + } + } + catch( Exception& ) + { + } +} + +// ----------------------------------------------------------------------------- + +void SdFilter::CreateProgress() +{ + mpProgress = new SfxProgress( &mrDocShell, String( SdResId( STR_LOAD_DOC ) ), 100 ); + mpProgress->SetState( 0, 100 ); +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdFilter::Import() +{ + DBG_ERROR( "Not implemented" ); + return sal_False; +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdFilter::Export() +{ + DBG_ERROR( "Not implemented" ); + return sal_False; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/filter/xml/makefile.mk b/binfilter/bf_sd/source/filter/xml/makefile.mk new file mode 100644 index 000000000000..115604788685 --- /dev/null +++ b/binfilter/bf_sd/source/filter/xml/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PRJNAME=binfilter +TARGET=sd_xml + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sd_sdxmlwrp.obj + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sd/source/filter/xml/sd_sdxmlwrp.cxx b/binfilter/bf_sd/source/filter/xml/sd_sdxmlwrp.cxx new file mode 100644 index 000000000000..215b77c33efa --- /dev/null +++ b/binfilter/bf_sd/source/filter/xml/sd_sdxmlwrp.cxx @@ -0,0 +1,780 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <rtl/logfile.hxx> + +#include <com/sun/star/xml/sax/SAXParseException.hdl> +#include <bf_sfx2/docfile.hxx> +#include "drawdoc.hxx" +#include <unotools/streamwrap.hxx> +#include <bf_svx/xmlgrhlp.hxx> + +#include "bf_sd/docshell.hxx" +#include "sdxmlwrp.hxx" +#include "strmname.h" + +#include <bf_svx/xmleohlp.hxx> + +#include <bf_sfx2/appuno.hxx> + +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/packages/zip/ZipIOException.hpp> + +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> + +#include <comphelper/genericpropertyset.hxx> + +#include <bf_svtools/saveopt.hxx> + +// #80365# include necessary for XML progress bar at load time +#include <bf_svtools/itemset.hxx> + +#include <bf_svtools/sfxecode.hxx> + +#include "sderror.hxx" +#include "sdresid.hxx" +#include "glob.hrc" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace comphelper; + +using rtl::OUString; + +#define SD_XML_READERROR 1234 + +////////////////////////////////////////////////////////////////////////////// + +#ifndef SEQTYPE + #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) + #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x )) + #else + #define SEQTYPE(x) &(x) + #endif +#endif + +#define MAP_LEN(x) x, sizeof(x) - 1 + +#define XML_STRING(i, x) sal_Char __READONLY_DATA i[sizeof(x)] = x + +XML_STRING( sXML_metaStreamName, "meta.xml"); +XML_STRING( sXML_styleStreamName, "styles.xml" ); +XML_STRING( sXML_contentStreamName, "content.xml" ); +XML_STRING( sXML_oldContentStreamName, "Content.xml" ); +XML_STRING( sXML_settingsStreamName, "settings.xml" ); + +XML_STRING( sXML_export_impress_meta_service, "com.sun.star.comp.Impress.XMLMetaExporter" ); +XML_STRING( sXML_export_impress_styles_service, "com.sun.star.comp.Impress.XMLStylesExporter" ); +XML_STRING( sXML_export_impress_content_service, "com.sun.star.comp.Impress.XMLContentExporter" ); +XML_STRING( sXML_export_impress_settings_service, "com.sun.star.comp.Impress.XMLSettingsExporter" ); + +XML_STRING( sXML_export_draw_meta_service, "com.sun.star.comp.Draw.XMLMetaExporter" ); +XML_STRING( sXML_export_draw_styles_service, "com.sun.star.comp.Draw.XMLStylesExporter" ); +XML_STRING( sXML_export_draw_content_service, "com.sun.star.comp.Draw.XMLContentExporter" ); +XML_STRING( sXML_export_draw_settings_service, "com.sun.star.comp.Draw.XMLSettingsExporter" ); + +XML_STRING( sXML_import_impress_service, "com.sun.star.comp.Impress.XMLImporter" ); +XML_STRING( sXML_import_impress_meta_service, "com.sun.star.comp.Impress.XMLMetaImporter" ); +XML_STRING( sXML_import_impress_styles_service, "com.sun.star.comp.Impress.XMLStylesImporter" ); +XML_STRING( sXML_import_impress_content_service, "com.sun.star.comp.Impress.XMLContentImporter" ); +XML_STRING( sXML_import_impress_settings_service, "com.sun.star.comp.Impress.XMLSettingsImporter" ); + +XML_STRING( sXML_import_draw_service, "com.sun.star.comp.Draw.XMLImporter" ); +XML_STRING( sXML_import_draw_meta_service, "com.sun.star.comp.Draw.XMLMetaImporter" ); +XML_STRING( sXML_import_draw_styles_service, "com.sun.star.comp.Draw.XMLStylesImporter" ); +XML_STRING( sXML_import_draw_content_service, "com.sun.star.comp.Draw.XMLContentImporter" ); +XML_STRING( sXML_import_draw_settings_service, "com.sun.star.comp.Draw.XMLSettingsImporter" ); + +struct XML_SERVICEMAP +{ + const sal_Char* mpService; + const sal_Char* mpStream; + sal_Bool mbPlain; +}; + + +// ---------------- +// - SdXMLWrapper - +// ---------------- + +SdXMLFilter::SdXMLFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress, SdXMLFilterMode eFilterMode ) : + SdFilter( rMedium, rDocShell, bShowProgress ), meFilterMode( eFilterMode ) +{ +} + +sal_Int32 ReadThroughComponent( + Reference<io::XInputStream> xInputStream, + Reference<XComponent> xModelComponent, + const String& rStreamName, + Reference<lang::XMultiServiceFactory> & rFactory, + const sal_Char* pFilterName, + Sequence<Any> rFilterArguments, + const OUString& rName, + sal_Bool bMustBeSuccessfull, + sal_Bool bEncrypted ) +{ + DBG_ASSERT(xInputStream.is(), "input stream missing"); + DBG_ASSERT(xModelComponent.is(), "document missing"); + DBG_ASSERT(rFactory.is(), "factory missing"); + DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!"); + + RTL_LOGFILE_CONTEXT( aLog, "ReadThroughComponent" ); + + // prepare ParserInputSrouce + xml::sax::InputSource aParserInput; + aParserInput.sSystemId = rName; + aParserInput.aInputStream = xInputStream; + + // get parser + Reference< xml::sax::XParser > xParser( + rFactory->createInstance( + OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), + UNO_QUERY ); + DBG_ASSERT( xParser.is(), "Can't create parser" ); + if( !xParser.is() ) + return SD_XML_READERROR; + RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" ); + + // get filter + Reference< xml::sax::XDocumentHandler > xFilter( + rFactory->createInstanceWithArguments( + OUString::createFromAscii(pFilterName), rFilterArguments), + UNO_QUERY ); + DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); + if( !xFilter.is() ) + return SD_XML_READERROR; + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "%s created", pFilterName ); + + // connect parser and filter + xParser->setDocumentHandler( xFilter ); + + // connect model and filter + Reference < XImporter > xImporter( xFilter, UNO_QUERY ); + xImporter->setTargetDocument( xModelComponent ); + // finally, parser the stream + RTL_LOGFILE_CONTEXT_TRACE( aLog, "parsing stream" ); + try + { + xParser->parseStream( aParserInput ); + } + catch( xml::sax::SAXParseException& r ) + { + if( bEncrypted ) + return ERRCODE_SFX_WRONGPASSWORD; + +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "SAX parse exception catched while importing:\n" ); + aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + + String sErr( String::CreateFromInt32( r.LineNumber )); + sErr += ','; + sErr += String::CreateFromInt32( r.ColumnNumber ); + + if( rStreamName.Len() ) + { + return *new TwoStringErrorInfo( + (bMustBeSuccessfull ? ERR_FORMAT_FILE_ROWCOL + : WARN_FORMAT_FILE_ROWCOL), + rStreamName, sErr, + ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ); + } + else + { + DBG_ASSERT( bMustBeSuccessfull, "Warnings are not supported" ); + return *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr, + ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ); + } + } + catch( xml::sax::SAXException& r ) + { + if( bEncrypted ) + return ERRCODE_SFX_WRONGPASSWORD; + +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "SAX exception catched while importing:\n" ); + aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + return SD_XML_READERROR; + } + catch( packages::zip::ZipIOException& r ) + { +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "Zip exception catched while importing:\n" ); + aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + return ERRCODE_IO_BROKENPACKAGE; + } + catch( io::IOException& r ) + { +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "IO exception catched while importing:\n" ); + aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + return SD_XML_READERROR; + } + catch( uno::Exception& r ) + { +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "uno exception catched while importing:\n" ); + aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + return SD_XML_READERROR; + } + + // success! + return 0; +} + +sal_Int32 ReadThroughComponent( + SvStorage* pStorage, + Reference<XComponent> xModelComponent, + const sal_Char* pStreamName, + const sal_Char* pCompatibilityStreamName, + Reference<lang::XMultiServiceFactory> & rFactory, + const sal_Char* pFilterName, + Sequence<Any> rFilterArguments, + const OUString& rName, + sal_Bool bMustBeSuccessfull ) +{ + DBG_ASSERT(NULL != pStorage, "Need storage!"); + DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!"); + + // open stream (and set parser input) + OUString sStreamName = OUString::createFromAscii(pStreamName); + if (! pStorage->IsStream(sStreamName)) + { + // stream name not found! Then try the compatibility name. + // if no stream can be opened, return immediatly with OK signal + + // do we even have an alternative name? + if ( NULL == pCompatibilityStreamName ) + return 0; + + // if so, does the stream exist? + sStreamName = OUString::createFromAscii(pCompatibilityStreamName); + if (! pStorage->IsStream(sStreamName) ) + return 0; + } + + // get input stream + SvStorageStreamRef xEventsStream; + xEventsStream = pStorage->OpenStream( sStreamName, + STREAM_READ | STREAM_NOCREATE ); + Any aAny; + sal_Bool bEncrypted = + xEventsStream->GetProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), aAny ) && + aAny.getValueType() == ::getBooleanCppuType() && + *(sal_Bool *)aAny.getValue(); + + Reference<io::XInputStream> xInputStream = xEventsStream->GetXInputStream(); + + // read from the stream + return ReadThroughComponent( + xInputStream, xModelComponent, sStreamName, rFactory, + pFilterName, rFilterArguments, + rName, bMustBeSuccessfull, bEncrypted ); +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdXMLFilter::Import() +{ + RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdXMLFilter::Import" ); +#ifdef TIMELOG + ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "importing %s", aFile.GetBuffer() ); +#endif + + sal_uInt32 nRet = 0; + + // Get service factory + Reference< lang::XMultiServiceFactory > xServiceFactory = + ::legacy_binfilters::getLegacyProcessServiceFactory(); + DBG_ASSERT( xServiceFactory.is(), + "XMLReader::Read: got no service manager" ); + if( !xServiceFactory.is() ) + return sal_False; + + // ------------------------------------- + + SdDrawDocument* pDoc = mrDocShell.GetDoc(); + pDoc->NewOrLoadCompleted( NEW_DOC ); + pDoc->CreateFirstPages(); + + // ------------------------------------- + + mxModel->lockControllers(); + + // ------------------------------------- + + /** property map for export info set */ + PropertyMapEntry aImportInfoMap[] = + { + // #80365# necessary properties for XML progress bar at load time + { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "Preview" ), 0, &::getCppuType((const sal_Bool*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "PageLayouts" ), 0, SEQTYPE(::getCppuType((const uno::Reference< container::XNameAccess >*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + + uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) ); + xInfoSet->setPropertyValue( OUString::createFromAscii( "Preview" ), uno::makeAny( mrDocShell.GetDoc()->IsStarDrawPreviewMode() ) ); + + // ------------------------------------- + + Reference< io::XActiveDataSource > xSource; + Reference< XInterface > xPipe; + Reference< document::XGraphicObjectResolver > xGraphicResolver; + SvXMLGraphicHelper *pGraphicHelper = 0; + Reference< document::XEmbeddedObjectResolver > xObjectResolver; + SvXMLEmbeddedObjectHelper *pObjectHelper = 0; + + Reference< lang::XComponent > xModelComp( mxModel, uno::UNO_QUERY ); + + // ------------------------------------- + + // #80365# try to get an XStatusIndicator from the Medium + if( mbShowProgress ) + { + SfxItemSet* pSet = mrMedium.GetItemSet(); + if(pSet) + { + const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>( + pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); + if (pItem) + { + pItem->GetValue() >>= mxStatusIndicator; + } + } + + if(mxStatusIndicator.is()) + { + sal_Int32 nProgressRange(1000000); + sal_Int32 nProgressCurrent(0); + OUString aMsg = String( SdResId( STR_LOAD_DOC ) ); + mxStatusIndicator->start(aMsg, nProgressRange); + + // set ProgressRange + uno::Any aProgRange; + aProgRange <<= nProgressRange; + xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange); + + // set ProgressCurrent + uno::Any aProgCurrent; + aProgCurrent <<= nProgressCurrent; + xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent); + } + } + + // ------------------------------------- + // get the input stream (storage or stream) + // ------------------------------------- + + SvStorageStreamRef xDocStream; + Reference<io::XInputStream> xInputStream; + SvStorage *pStorage = 0; + + pStorage = mrMedium.GetStorage(); + + if( !pStorage ) + nRet = SD_XML_READERROR; + + if( 0 == nRet ) + { + pGraphicHelper = SvXMLGraphicHelper::Create( *pStorage, + GRAPHICHELPER_MODE_READ, + sal_False ); + + xGraphicResolver = pGraphicHelper; + SvPersist *pPersist = pDoc->GetPersist();; + if( pPersist ) + { + pObjectHelper = SvXMLEmbeddedObjectHelper::Create( + *pStorage, *pPersist, + EMBEDDEDOBJECTHELPER_MODE_READ, + sal_False ); + xObjectResolver = pObjectHelper; + } + } + + // ------------------------------------- + + if( 0 == nRet ) + { + + // prepare filter arguments + Sequence<Any> aFilterArgs( 5 ); + Any *pArgs = aFilterArgs.getArray(); + *pArgs++ <<= xGraphicResolver; + *pArgs++ <<= xObjectResolver; + *pArgs++ <<= mxStatusIndicator; + *pArgs++ <<= xInfoSet; + + Sequence<Any> aEmptyArgs( 3 ); + pArgs = aEmptyArgs.getArray(); + *pArgs++ <<= mxStatusIndicator; + *pArgs++ <<= xInfoSet; + + const OUString aName( mrMedium.GetName() ); + + sal_uInt32 nWarn = 0; + sal_uInt32 nWarn2 = 0; + // read storage streams + if( meFilterMode != SDXMLMODE_Organizer ) + { + nWarn = ReadThroughComponent( + pStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, + IsDraw() ? sXML_import_draw_meta_service : sXML_import_impress_meta_service, + aEmptyArgs, aName, sal_False ); + + nWarn2 = ReadThroughComponent( + pStorage, xModelComp, "settings.xml", NULL, xServiceFactory, + IsDraw() ? sXML_import_draw_settings_service : sXML_import_impress_settings_service, + aFilterArgs, aName, sal_False ); + } + + nRet = ReadThroughComponent( + pStorage, xModelComp, "styles.xml", NULL, xServiceFactory, + IsDraw() ? sXML_import_draw_styles_service : sXML_import_impress_styles_service, + aFilterArgs, aName, sal_True ); + + if( !nRet && (meFilterMode != SDXMLMODE_Organizer) ) + nRet = ReadThroughComponent( + pStorage, xModelComp, "content.xml", "Content.xml", xServiceFactory, + IsDraw() ? sXML_import_draw_content_service : sXML_import_impress_content_service, + aFilterArgs, aName, sal_True ); + + if( !nRet ) + { + if( nWarn ) + nRet = nWarn; + else if( nWarn2 ) + nRet = nWarn2; + } + } + + // ------------------------------------- + if( pGraphicHelper ) + SvXMLGraphicHelper::Destroy( pGraphicHelper ); + xGraphicResolver = 0; + if( pObjectHelper ) + SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); + xObjectResolver = 0; + + if( mxStatusIndicator.is() ) + mxStatusIndicator->end(); + + if( mxModel.is() ) + mxModel->unlockControllers(); + + if( nRet == 0 ) + pDoc->UpdateAllLinks(); + + switch( nRet ) + { + case 0: break; +// case ERRCODE_SFX_WRONGPASSWORD: break; + case SD_XML_READERROR: break; + case ERRCODE_IO_BROKENPACKAGE: + if( pStorage ) + { + pStorage->SetError( ERRCODE_IO_BROKENPACKAGE ); + break; + } + // fall through intented + default: + { +// ErrorHandler::HandleError( nRet ); + if( IsWarning( nRet ) ) + nRet = 0; + } + } + + return nRet == 0; +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdXMLFilter::Export() +{ +#ifdef TIMELOG + RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sd", "cl93746", "SdXMLFilter::Export" ); + ByteString aFile( mrMedium.GetName(), RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "exporting %s", aFile.GetBuffer() ); +#endif + + SvXMLEmbeddedObjectHelper* pObjectHelper = NULL; + SvXMLGraphicHelper* pGraphicHelper = NULL; + sal_Bool bDocRet = FALSE; + + try + { + if( !mxModel.is() ) + { + DBG_ERROR("Got NO Model in XMLExport"); + return FALSE; + } + + uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel, uno::UNO_QUERY ); + + if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GenericDrawingDocument" ) ) ) ) + { + DBG_ERROR( "Model is no DrawingDocument in XMLExport" ); + return FALSE; + } + + uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::legacy_binfilters::getLegacyProcessServiceFactory() ); + + if( !xServiceFactory.is() ) + { + DBG_ERROR( "got no service manager" ); + return FALSE; + } + + uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) ); + + if( !xWriter.is() ) + { + DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" ); + return FALSE; + } + + uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY ); + + /** property map for export info set */ + PropertyMapEntry aExportInfoMap[] = + { + // #82003# + { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "UsePrettyPrinting"),0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + + { MAP_LEN( "PageLayoutNames" ), 0, SEQTYPE(::getCppuType((const OUString*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + + uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aExportInfoMap ) ) ); + + + SvtSaveOptions aSaveOpt; + OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")); + sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() ); + xInfoSet->setPropertyValue( sUsePrettyPrinting, makeAny( bUsePrettyPrinting ) ); + + SvStorage* pStorage = mrMedium.GetOutputStorage( sal_True ); + + // initialize descriptor + uno::Sequence< beans::PropertyValue > aDescriptor( 1 ); + beans::PropertyValue* pProps = aDescriptor.getArray(); + + pProps[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) ); + pProps[0].Value <<= OUString( mrMedium.GetName() ); + + { + uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver; + uno::Reference< document::XGraphicObjectResolver > xGrfResolver; + + // create helper for graphic and ole export if we have a storage + if( pStorage ) + { + SvPersist *pPersist = mrDocShell.GetDoc()->GetPersist(); + if( pPersist ) + { + pObjectHelper = SvXMLEmbeddedObjectHelper::Create( *pStorage, *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE, sal_False ); + xObjectResolver = pObjectHelper; + } + + pGraphicHelper = SvXMLGraphicHelper::Create( *pStorage, GRAPHICHELPER_MODE_WRITE, FALSE ); + xGrfResolver = pGraphicHelper; + } + + // #82003# + if(mbShowProgress) + { + CreateStatusIndicator(); + if(mxStatusIndicator.is()) + { + sal_Int32 nProgressRange(1000000); + sal_Int32 nProgressCurrent(0); + OUString aMsg = String( SdResId( STR_SAVE_DOC ) ); + mxStatusIndicator->start(aMsg, nProgressRange); + + // set ProgressRange + uno::Any aProgRange; + aProgRange <<= nProgressRange; + xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange); + + // set ProgressCurrent + uno::Any aProgCurrent; + aProgCurrent <<= nProgressCurrent; + xInfoSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent); + } + } + + uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY ); + + XML_SERVICEMAP aServices[5]; sal_uInt16 i = 0; + aServices[i ].mpService = IsDraw() ? sXML_export_draw_styles_service : sXML_export_impress_styles_service; + aServices[i ].mpStream = sXML_styleStreamName; + aServices[i++].mbPlain = sal_False; + + aServices[i ].mpService = IsDraw() ? sXML_export_draw_content_service : sXML_export_impress_content_service; + aServices[i ].mpStream = sXML_contentStreamName; + aServices[i++].mbPlain = sal_False; + + aServices[i ].mpService = IsDraw() ? sXML_export_draw_settings_service : sXML_export_impress_settings_service; + aServices[i ].mpStream = sXML_settingsStreamName; + aServices[i++].mbPlain = sal_False; + + if( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + { + aServices[i ].mpService = IsDraw() ? sXML_export_draw_meta_service : sXML_export_impress_meta_service; + aServices[i ].mpStream = sXML_metaStreamName; + aServices[i++].mbPlain = sal_True; + }; + + aServices[i].mpService = NULL; + aServices[i].mpStream = NULL; + + XML_SERVICEMAP* pServices = aServices; + + // doc export + do + { + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "exporting substream %s", pServices->mpStream ); + + uno::Reference<io::XOutputStream> xDocOut; + SvStorageStreamRef xDocStream; + + if( pStorage ) + { + const OUString sDocName( OUString::createFromAscii( pServices->mpStream ) ); + xDocStream = pStorage->OpenStream( sDocName, STREAM_WRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC ); + DBG_ASSERT(xDocStream.Is(), "Can't create output stream in package!"); + if( !xDocStream.Is() ) + return sal_False; + + xDocStream->SetVersion( pStorage->GetVersion() ); +// xDocStream->SetKey( pStorage->GetKey() ); + xDocStream->SetBufferSize( 16*1024 ); + xDocOut = new ::utl::OOutputStreamWrapper( *xDocStream ); + + uno::Any aAny; aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); + xDocStream->SetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aAny); + + if( pServices->mbPlain ) + { + xDocStream->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed") ), uno::makeAny( (sal_Bool) sal_False ) ); + } + else + { + xDocStream->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), uno::makeAny( (sal_Bool)sal_True ) ); + } + + } + + uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, uno::UNO_QUERY ); + xDocSrc->setOutputStream( xDocOut ); + + uno::Sequence< uno::Any > aArgs( 2 + ( mxStatusIndicator.is() ? 1 : 0 ) + ( xGrfResolver.is() ? 1 : 0 ) + ( xObjectResolver.is() ? 1 : 0 ) ); + uno::Any* pArgs = aArgs.getArray(); + if( xGrfResolver.is() ) *pArgs++ <<= xGrfResolver; + if( xObjectResolver.is() ) *pArgs++ <<= xObjectResolver; + if( mxStatusIndicator.is() ) *pArgs++ <<= mxStatusIndicator; + + *pArgs++ <<= xInfoSet; + *pArgs <<= xHandler; + + uno::Reference< document::XFilter > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pServices->mpService ), aArgs ), uno::UNO_QUERY ); + if( xFilter.is() ) + { + uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY ); + if( xExporter.is() ) + { + xExporter->setSourceDocument( xComponent ); + + bDocRet = xFilter->filter( aDescriptor ); + + if(bDocRet && xDocStream.Is()) + xDocStream->Commit(); + } + } + + pServices++; + } + while( bDocRet && pServices->mpService ); + + // #82003# + if(mbShowProgress) + { + if(mxStatusIndicator.is()) + mxStatusIndicator->end(); + } + } + } + catch(uno::Exception e) + { +#if OSL_DEBUG_LEVEL > 1 + ByteString aError( "uno Exception caught while exporting:\n" ); + aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif + bDocRet = sal_False; + } + + if( pGraphicHelper ) + SvXMLGraphicHelper::Destroy( pGraphicHelper ); + + if( pObjectHelper ) + SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); + + + return bDocRet; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/makefile.mk b/binfilter/bf_sd/source/ui/app/makefile.mk new file mode 100644 index 000000000000..161688952ab2 --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/makefile.mk @@ -0,0 +1,89 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sd_sd + +PRJNAME=binfilter +TARGET=sd_app + +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd + +# --- Update-Version ----------------------------------------------- + +RSCUPDVER=$(RSCREVISION)SV$(UPD)$(UPDMINOR) + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = \ + sd_strings.src + +SLOFILES = \ + $(SLO)$/sd_sdmod.obj \ + $(SLO)$/sd_sddll.obj \ + $(SLO)$/sd_sdresid.obj \ + $(SLO)$/sd_optsitem.obj + +DEPOBJFILES= \ + $(SLO)$/sd_sdlib.obj + +.IF "$(GUI)" == "WNT" + +NOOPTFILES=\ + $(SLO)$/sd_optsitem.obj + +.ENDIF + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + +$(INCCOM)$/sddll0.hxx: makefile.mk + @echo $@ +.IF "$(GUI)"=="UNX" + echo \#define DLL_NAME \"libbf_sd$(DLLPOSTFIX)$(DLLPOST)\" >$@ +.ELSE # "$(GUI)"=="UNX" + echo \#define DLL_NAME \"bf_sd$(DLLPOSTFIX).DLL\" >$@ +.ENDIF # "$(GUI)"=="UNX" + + +ALLTAR : $(DEPOBJFILES) + +$(SRS)$/sd_app.srs: $(PRJ)$/inc$/bf_svx$/globlmn.hrc + +$(SLO)$/sd_sdlib.obj: $(INCCOM)$/sddll0.hxx diff --git a/binfilter/bf_sd/source/ui/app/sd_optsitem.cxx b/binfilter/bf_sd/source/ui/app/sd_optsitem.cxx new file mode 100644 index 000000000000..94dc0f5b58f8 --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_optsitem.cxx @@ -0,0 +1,1121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_sfx2/sfx.hrc> +#include <vcl/salbtype.hxx> +#include <bf_svtools/syslocale.hxx> + +#include "optsitem.hxx" +#include "cfgids.hxx" +namespace binfilter { + +using namespace ::rtl; +using namespace ::utl; +using namespace ::com::sun::star::uno; + +#define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr)) + + +// ----------------- +// - SdOptionsItem - +// ----------------- + +/*N*/ SdOptionsItem::SdOptionsItem( const SdOptionsGeneric& rParent, const OUString rSubTree ) : +/*N*/ ConfigItem ( rSubTree ), +/*N*/ mrParent ( rParent ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdOptionsItem::~SdOptionsItem() +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + + void SdOptionsItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ) {} + void SdOptionsItem::Commit() {} + + +// ----------------------------------------------------------------------------- + +/*N*/ Sequence< Any > SdOptionsItem::GetProperties( const Sequence< OUString >& rNames ) +/*N*/ { +/*N*/ return ConfigItem::GetProperties( rNames ); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsItem::SetModified() +/*N*/ { +/*N*/ ConfigItem::SetModified(); +/*N*/ } + +// -------------------- +// - SdOptionsGeneric - +// -------------------- + +/*N*/ SdOptionsGeneric::SdOptionsGeneric( USHORT nConfigId, const OUString& rSubTree ) : +/*N*/ maSubTree ( rSubTree ), +/*N*/ mpCfgItem ( NULL ), +/*N*/ mnConfigId ( nConfigId ), +/*N*/ mbInit ( rSubTree.getLength() == 0 ), +/*N*/ mbEnableModify ( TRUE ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsGeneric::Init() const +/*N*/ { +/*N*/ if( !mbInit ) +/*N*/ { +/*N*/ SdOptionsGeneric* pThis = (SdOptionsGeneric*) this; +/*N*/ +/*N*/ if( !mpCfgItem ) +/*N*/ pThis->mpCfgItem = new SdOptionsItem( *this, maSubTree ); +/*N*/ +/*N*/ const Sequence< OUString > aNames( GetPropertyNames() ); +/*N*/ const Sequence< Any > aValues = mpCfgItem->GetProperties( aNames ); +/*N*/ +/*N*/ if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) ) +/*N*/ { +/*N*/ const Any* pValues = aValues.getConstArray(); +/*N*/ +/*N*/ pThis->EnableModify( FALSE ); +/*N*/ pThis->mbInit = pThis->ReadData( pValues ); +/*N*/ pThis->EnableModify( TRUE ); +/*N*/ } +/*N*/ else +/*?*/ pThis->mbInit = TRUE; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdOptionsGeneric::~SdOptionsGeneric() +/*N*/ { +/*N*/ if( mpCfgItem ) +/*N*/ delete mpCfgItem; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ Sequence< OUString > SdOptionsGeneric::GetPropertyNames() const +/*N*/ { +/*N*/ ULONG nCount; +/*N*/ const char** ppPropNames; +/*N*/ +/*N*/ GetPropNameArray( ppPropNames, nCount ); +/*N*/ +/*N*/ Sequence< OUString > aNames( nCount ); +/*N*/ OUString* pNames = aNames.getArray(); +/*N*/ +/*N*/ for( ULONG i = 0; i < nCount; i++ ) +/*N*/ pNames[ i ] = OUString::createFromAscii( ppPropNames[ i ] ); +/*N*/ +/*N*/ return aNames; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ bool SdOptionsGeneric::isMetricSystem() +/*N*/ { +/*N*/ SvtSysLocale aSysLocale; +/*N*/ MeasurementSystem eSys = aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum(); +/*N*/ +/*N*/ return ( eSys == MEASURE_METRIC ); +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsLayout +|* +\************************************************************************/ + +/*N*/ SdOptionsLayout::SdOptionsLayout( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Layout" ) : +/*N*/ B2U( "Office.Impress/Layout" ) ) : +/*N*/ OUString() ), +/*N*/ bRuler( TRUE ), +/*N*/ bMoveOutline( TRUE ), +/*N*/ bDragStripes( FALSE ), +/*N*/ bHandlesBezier( FALSE ), +/*N*/ bHelplines( TRUE ), +/*N*/ nMetric( isMetricSystem() ? (UINT16)FUNIT_CM : (UINT16)FUNIT_INCH ), +/*N*/ nDefTab( 1250 ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsLayout::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNamesMetric[] = +/*N*/ { +/*N*/ "Display/Ruler", +/*N*/ "Display/Bezier", +/*N*/ "Display/Contour", +/*N*/ "Display/Guide", +/*N*/ "Display/Helpline", +/*N*/ "Other/MeasureUnit/Metric", +/*N*/ "Other/TabStop/Metric" +/*N*/ }; +/*N*/ +/*N*/ static const char* aPropNamesNonMetric[] = +/*N*/ { +/*N*/ "Display/Ruler", +/*N*/ "Display/Bezier", +/*N*/ "Display/Contour", +/*N*/ "Display/Guide", +/*N*/ "Display/Helpline", +/*N*/ "Other/MeasureUnit/NonMetric", +/*N*/ "Other/TabStop/NonMetric" +/*N*/ }; +/*N*/ +/*N*/ rCount = 7; +/*N*/ +/*N*/ if( isMetricSystem() ) +/*N*/ ppNames = aPropNamesMetric; +/*N*/ else +/*N*/ ppNames = aPropNamesNonMetric; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsLayout::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetRulerVisible( *(sal_Bool*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetHandlesBezier( *(sal_Bool*) pValues[ 1 ].getValue() ); +/*N*/ if( pValues[2].hasValue() ) SetMoveOutline( *(sal_Bool*) pValues[ 2 ].getValue() ); +/*N*/ if( pValues[3].hasValue() ) SetDragStripes( *(sal_Bool*) pValues[ 3 ].getValue() ); +/*N*/ if( pValues[4].hasValue() ) SetHelplines( *(sal_Bool*) pValues[ 4 ].getValue() ); +/*N*/ if( pValues[5].hasValue() ) SetMetric( (UINT16) *(sal_Int32*) pValues[ 5 ].getValue() ); +/*N*/ if( pValues[6].hasValue() ) SetDefTab( (UINT16) *(sal_Int32*) pValues[ 6 ].getValue() ); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsLayout::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= IsRulerVisible(); +/*N*/ pValues[ 1 ] <<= IsHandlesBezier(); +/*N*/ pValues[ 2 ] <<= IsMoveOutline(); +/*N*/ pValues[ 3 ] <<= IsDragStripes(); +/*N*/ pValues[ 4 ] <<= IsHelplines(); +/*N*/ pValues[ 5 ] <<= (sal_Int32) GetMetric(); +/*N*/ pValues[ 6 ] <<= (sal_Int32) GetDefTab(); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsLayoutItem +|* +\************************************************************************/ + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + + +// ---------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsContents +|* +\************************************************************************/ + +/*N*/ SdOptionsContents::SdOptionsContents( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Content" ) : +/*N*/ B2U( "Office.Impress/Content" ) ) : +/*N*/ OUString() ), +/*N*/ bExternGraphic( FALSE ), +/*N*/ bOutlineMode( FALSE ), +/*N*/ bHairlineMode( FALSE ), +/*N*/ bNoText( FALSE ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsContents::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNames[] = +/*N*/ { +/*N*/ "Display/PicturePlaceholder", +/*N*/ "Display/ContourMode", +/*N*/ "Display/LineContour", +/*N*/ "Display/TextPlaceholder" +/*N*/ }; +/*N*/ +/*N*/ rCount = 4; +/*N*/ ppNames = aPropNames; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsContents::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetExternGraphic( *(sal_Bool*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetOutlineMode( *(sal_Bool*)pValues[ 1 ].getValue() ); +/*N*/ if( pValues[2].hasValue() ) SetHairlineMode( *(sal_Bool*) pValues[ 2 ].getValue() ); +/*N*/ if( pValues[3].hasValue() ) SetNoText( *(sal_Bool*) pValues[ 3 ].getValue() ); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsContents::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= IsExternGraphic(); +/*N*/ pValues[ 1 ] <<= IsOutlineMode(); +/*N*/ pValues[ 2 ] <<= IsHairlineMode(); +/*N*/ pValues[ 3 ] <<= IsNoText(); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsContentsItem +|* +\************************************************************************/ + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsMisc +|* +\************************************************************************/ + +/*N*/ SdOptionsMisc::SdOptionsMisc( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Misc" ) : +/*N*/ B2U( "Office.Impress/Misc" ) ) : +/*N*/ OUString() ), +/*N*/ nPreviewQuality( DRAWMODE_DEFAULT ), +/*N*/ nDefaultObjectSizeWidth( 8000 ), +/*N*/ nDefaultObjectSizeHeight( 5000 ), +/*N*/ bStartWithTemplate( TRUE ), +/*N*/ bMarkedHitMovesAlways( TRUE ), +/*N*/ bMoveOnlyDragging( FALSE ), +/*N*/ bCrookNoContortion( FALSE ), +/*N*/ bQuickEdit( GetConfigId() != SDCFG_DRAW ), +/*N*/ bMasterPageCache( TRUE ), +/*N*/ bDragWithCopy( FALSE ), +/*N*/ bPickThrough( TRUE ), +/*N*/ bBigHandles( FALSE ), +/*N*/ bDoubleClickTextEdit( TRUE ), +/*N*/ bClickChangeRotation( FALSE ), +/*N*/ bStartWithActualPage( FALSE ), +/*N*/ bSolidDragging( FALSE ), +/*N*/ bSolidMarkHdl( TRUE ), +/*N*/ bSummationOfParagraphs( FALSE ), +/*N*/ bShowUndoDeleteWarning( TRUE ), +/*N*/ mnPrinterIndependentLayout( 1 ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNames[] = +/*N*/ { +/*N*/ "ObjectMoveable", +/*N*/ "NoDistort", +/*N*/ "TextObject/QuickEditing", +/*N*/ "BackgroundCache", +/*N*/ "CopyWhileMoving", +/*N*/ "TextObject/Selectable", +/*N*/ "BigHandles", +/*N*/ "DclickTextedit", +/*N*/ "RotateClick", +/*N*/ "Preview", +/*N*/ "CreateWithAttributes", +/*N*/ "SimpleHandles", +/*N*/ // #97016# +/*N*/ "DefaultObjectSize/Width", +/*N*/ "DefaultObjectSize/Height", +/*N*/ +/*N*/ "Compatibility/PrinterIndependentLayout", +/*N*/ +/*N*/ // just for impress +/*N*/ "NewDoc/AutoPilot", +/*N*/ "Start/CurrentPage", +/*N*/ "Compatibility/AddBetween", +/*N*/ // #90356# +/*N*/ "ShowUndoDeleteWarning" +/*N*/ }; +/*N*/ +/*N*/ // #90356# rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 15 : 12 ); +/*N*/ // #97016# rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 16 : 12 ); +/*N*/ rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 19 : 15 ); +/*N*/ ppNames = aPropNames; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsMisc::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetCrookNoContortion( *(sal_Bool*) pValues[ 1 ].getValue() ); +/*N*/ if( pValues[2].hasValue() ) SetQuickEdit( *(sal_Bool*)pValues[ 2 ].getValue() ); +/*N*/ if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool*) pValues[ 3 ].getValue() ); +/*N*/ if( pValues[4].hasValue() ) SetDragWithCopy( *(sal_Bool*) pValues[ 4 ].getValue() ); +/*N*/ if( pValues[5].hasValue() ) SetPickThrough( *(sal_Bool*) pValues[ 5 ].getValue() ); +/*N*/ if( pValues[6].hasValue() ) SetBigHandles( *(sal_Bool*) pValues[ 6 ].getValue() ); +/*N*/ if( pValues[7].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool*) pValues[ 7 ].getValue() ); +/*N*/ if( pValues[8].hasValue() ) SetClickChangeRotation( *(sal_Bool*) pValues[ 8 ].getValue() ); +/*N*/ if( pValues[9].hasValue() ) SetPreviewQuality( FRound( *(double*) pValues[ 9 ].getValue() ) ); +/*N*/ if( pValues[10].hasValue() ) SetSolidDragging( *(sal_Bool*) pValues[ 10 ].getValue() ); +/*N*/ if( pValues[11].hasValue() ) SetSolidMarkHdl( *(sal_Bool*) pValues[ 11 ].getValue() ); +/*N*/ // #97016# +/*N*/ if( pValues[12].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32*) pValues[ 12 ].getValue() ); +/*N*/ if( pValues[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 13 ].getValue() ); +/*N*/ if( pValues[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 14 ].getValue() ); +/*N*/ +/*N*/ // just for Impress +/*N*/ if( GetConfigId() == SDCFG_IMPRESS ) +/*N*/ { +/*N*/ if( pValues[15].hasValue() ) +/*N*/ SetStartWithTemplate( *(sal_Bool*) pValues[ 15 ].getValue() ); +/*N*/ if( pValues[16].hasValue() ) +/*N*/ SetStartWithActualPage( *(sal_Bool*) pValues[ 16 ].getValue() ); +/*N*/ if( pValues[17].hasValue() ) +/*N*/ SetSummationOfParagraphs( *(sal_Bool*) pValues[ 17 ].getValue() ); +/*N*/ // #90356# +/*N*/ if( pValues[18].hasValue() ) +/*N*/ SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 18 ].getValue() ); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsMisc::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= IsMarkedHitMovesAlways(); +/*N*/ pValues[ 1 ] <<= IsCrookNoContortion(); +/*N*/ pValues[ 2 ] <<= IsQuickEdit(); +/*N*/ pValues[ 3 ] <<= IsMasterPagePaintCaching(); +/*N*/ pValues[ 4 ] <<= IsDragWithCopy(); +/*N*/ pValues[ 5 ] <<= IsPickThrough(); +/*N*/ pValues[ 6 ] <<= IsBigHandles(); +/*N*/ pValues[ 7 ] <<= IsDoubleClickTextEdit(); +/*N*/ pValues[ 8 ] <<= IsClickChangeRotation(); +/*N*/ pValues[ 9 ] <<= (double) GetPreviewQuality(); +/*N*/ pValues[ 10 ] <<= IsSolidDragging(); +/*N*/ pValues[ 11 ] <<= IsSolidMarkHdl(); +/*N*/ // #97016# +/*N*/ pValues[ 12 ] <<= GetDefaultObjectSizeWidth(); +/*N*/ pValues[ 13 ] <<= GetDefaultObjectSizeHeight(); +/*N*/ pValues[ 14 ] <<= GetPrinterIndependentLayout(); +/*N*/ +/*N*/ // just for Impress +/*N*/ if( GetConfigId() == SDCFG_IMPRESS ) +/*N*/ { +/*N*/ pValues[ 15 ] <<= IsStartWithTemplate(); +/*N*/ pValues[ 16 ] <<= IsStartWithActualPage(); +/*N*/ pValues[ 17 ] <<= IsSummationOfParagraphs(); +/*N*/ // #90356# +/*N*/ pValues[ 18 ] <<= IsShowUndoDeleteWarning(); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsMiscItem +|* +\************************************************************************/ + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + + +// ---------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsSnap +|* +\************************************************************************/ + +/*N*/ SdOptionsSnap::SdOptionsSnap( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Snap" ) : +/*N*/ B2U( "Office.Impress/Snap" ) ) : +/*N*/ OUString() ), +/*N*/ bSnapHelplines( TRUE ), +/*N*/ bSnapBorder( TRUE ), +/*N*/ bSnapFrame( FALSE ), +/*N*/ bSnapPoints( FALSE ), +/*N*/ bOrtho( FALSE ), +/*N*/ bBigOrtho( TRUE ), +/*N*/ bRotate( FALSE ), +/*N*/ nSnapArea( 5 ), +/*N*/ nAngle( 1500 ), +/*N*/ nBezAngle( 1500 ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsSnap::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNames[] = +/*N*/ { +/*N*/ "Object/SnapLine", +/*N*/ "Object/PageMargin", +/*N*/ "Object/ObjectFrame", +/*N*/ "Object/ObjectPoint", +/*N*/ "Position/CreatingMoving", +/*N*/ "Position/ExtendEdges", +/*N*/ "Position/Rotating", +/*N*/ "Object/Range", +/*N*/ "Position/RotatingValue", +/*N*/ "Position/PointReduction" +/*N*/ }; +/*N*/ +/*N*/ rCount = 10; +/*N*/ ppNames = aPropNames; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsSnap::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetSnapHelplines( *(sal_Bool*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetSnapBorder( *(sal_Bool*)pValues[ 1 ].getValue() ); +/*N*/ if( pValues[2].hasValue() ) SetSnapFrame( *(sal_Bool*) pValues[ 2 ].getValue() ); +/*N*/ if( pValues[3].hasValue() ) SetSnapPoints( *(sal_Bool*) pValues[ 3 ].getValue() ); +/*N*/ if( pValues[4].hasValue() ) SetOrtho( *(sal_Bool*) pValues[ 4 ].getValue() ); +/*N*/ if( pValues[5].hasValue() ) SetBigOrtho( *(sal_Bool*) pValues[ 5 ].getValue() ); +/*N*/ if( pValues[6].hasValue() ) SetRotate( *(sal_Bool*) pValues[ 6 ].getValue() ); +/*N*/ if( pValues[7].hasValue() ) SetSnapArea( (INT16) *(sal_Int32*) pValues[ 7 ].getValue() ); +/*N*/ if( pValues[8].hasValue() ) SetAngle( (INT16) *(sal_Int32*) pValues[ 8 ].getValue() ); +/*N*/ if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (INT16) *(sal_Int32*) pValues[ 9 ].getValue() ); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsSnap::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= IsSnapHelplines(); +/*N*/ pValues[ 1 ] <<= IsSnapBorder(); +/*N*/ pValues[ 2 ] <<= IsSnapFrame(); +/*N*/ pValues[ 3 ] <<= IsSnapPoints(); +/*N*/ pValues[ 4 ] <<= IsOrtho(); +/*N*/ pValues[ 5 ] <<= IsBigOrtho(); +/*N*/ pValues[ 6 ] <<= IsRotate(); +/*N*/ pValues[ 7 ] <<= (sal_Int32) GetSnapArea(); +/*N*/ pValues[ 8 ] <<= (sal_Int32) GetAngle(); +/*N*/ pValues[ 9 ] <<= (sal_Int32) GetEliminatePolyPointLimitAngle(); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsSnapItem +|* +\************************************************************************/ + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + + +// ---------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsZoom +|* +\************************************************************************/ + +/*N*/ SdOptionsZoom::SdOptionsZoom( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, ( bUseConfig && ( SDCFG_DRAW == nConfigId ) ) ? +/*N*/ B2U( "Office.Draw/Zoom" ) : +/*N*/ OUString() ), +/*N*/ nX( 1 ), +/*N*/ nY( 1 ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsZoom::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNames[] = +/*N*/ { +/*N*/ "ScaleX", +/*N*/ "ScaleY" +/*N*/ }; +/*N*/ +/*N*/ rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0; +/*N*/ ppNames = aPropNames; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsZoom::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ INT32 nX = 1, nY = 1; +/*N*/ +/*N*/ if( pValues[0].hasValue() ) nX = ( *(sal_Int32*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) nY = ( *(sal_Int32*) pValues[ 1 ].getValue() ); +/*N*/ +/*N*/ SetScale( nX, nY ); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsZoom::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ INT32 nX, nY; +/*N*/ +/*N*/ GetScale( nX, nY ); +/*N*/ +/*N*/ pValues[ 0 ] <<= (sal_Int32) nX; +/*N*/ pValues[ 1 ] <<= (sal_Int32) nY; +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsZoomItem +|* +\************************************************************************/ + + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + + + +// ---------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsGrid +|* +\************************************************************************/ + +/*N*/ SdOptionsGrid::SdOptionsGrid( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Grid" ) : +/*N*/ B2U( "Office.Impress/Grid" ) ) : +/*N*/ OUString() ) +/*N*/ { +/*N*/ EnableModify( FALSE ); +/*N*/ SetDefaults(); +/*N*/ EnableModify( TRUE ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdOptionsGrid::~SdOptionsGrid() +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsGrid::SetDefaults() +/*N*/ { +/*N*/ const UINT32 nVal = 1000; +/*N*/ +/*N*/ SetFldDivisionX( nVal ); +/*N*/ SetFldDivisionY( nVal ); +/*N*/ SetFldDrawX( nVal ); +/*N*/ SetFldDrawY( nVal ); +/*N*/ SetFldSnapX( nVal ); +/*N*/ SetFldSnapY( nVal ); +/*N*/ SetUseGridSnap( FALSE ); +/*N*/ SetSynchronize( TRUE ); +/*N*/ SetGridVisible( FALSE ); +/*N*/ SetEqualGrid( TRUE ); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsGrid::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aPropNamesMetric[] = +/*N*/ { +/*N*/ "Resolution/XAxis/Metric", +/*N*/ "Resolution/YAxis/Metric", +/*N*/ "Subdivision/XAxis", +/*N*/ "Subdivision/YAxis", +/*N*/ "SnapGrid/XAxis/Metric", +/*N*/ "SnapGrid/YAxis/Metric", +/*N*/ "Option/SnapToGrid", +/*N*/ "Option/Synchronize", +/*N*/ "Option/VisibleGrid", +/*N*/ "SnapGrid/Size" +/*N*/ }; +/*N*/ +/*N*/ static const char* aPropNamesNonMetric[] = +/*N*/ { +/*N*/ "Resolution/XAxis/NonMetric", +/*N*/ "Resolution/YAxis/NonMetric", +/*N*/ "Subdivision/XAxis", +/*N*/ "Subdivision/YAxis", +/*N*/ "SnapGrid/XAxis/NonMetric", +/*N*/ "SnapGrid/YAxis/NonMetric", +/*N*/ "Option/SnapToGrid", +/*N*/ "Option/Synchronize", +/*N*/ "Option/VisibleGrid", +/*N*/ "SnapGrid/Size" +/*N*/ }; +/*N*/ +/*N*/ rCount = 10; +/*N*/ +/*N*/ if( isMetricSystem() ) +/*N*/ ppNames = aPropNamesMetric; +/*N*/ else +/*N*/ ppNames = aPropNamesNonMetric; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsGrid::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetFldDrawX( *(sal_Int32*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetFldDrawY( *(sal_Int32*) pValues[ 1 ].getValue() ); +/*N*/ +/*N*/ if( pValues[2].hasValue() ) +/*N*/ { +/*N*/ const UINT32 nDivX = FRound( *(double*) pValues[ 2 ].getValue() ); +/*N*/ SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX + 1 ) ); +/*N*/ } +/*N*/ +/*N*/ if( pValues[3].hasValue() ) +/*N*/ { +/*N*/ const UINT32 nDivY = FRound( *(double*) pValues[ 3 ].getValue() ); +/*N*/ SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY + 1 ) ); +/*N*/ } +/*N*/ +/*N*/ if( pValues[4].hasValue() ) SetFldSnapX( *(sal_Int32*) pValues[ 4 ].getValue() ); +/*N*/ if( pValues[5].hasValue() ) SetFldSnapY( *(sal_Int32*) pValues[ 5 ].getValue() ); +/*N*/ if( pValues[6].hasValue() ) SetUseGridSnap( *(sal_Bool*) pValues[ 6 ].getValue() ); +/*N*/ if( pValues[7].hasValue() ) SetSynchronize( *(sal_Bool*) pValues[ 7 ].getValue() ); +/*N*/ if( pValues[8].hasValue() ) SetGridVisible( *(sal_Bool*) pValues[ 8 ].getValue() ); +/*N*/ if( pValues[9].hasValue() ) SetEqualGrid( *(sal_Bool*) pValues[ 9 ].getValue() ); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsGrid::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= (sal_Int32) GetFldDrawX(); +/*N*/ pValues[ 1 ] <<= (sal_Int32) GetFldDrawY(); +/*N*/ pValues[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 ); +/*N*/ pValues[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 ); +/*N*/ pValues[ 4 ] <<= (sal_Int32) GetFldSnapX(); +/*N*/ pValues[ 5 ] <<= (sal_Int32) GetFldSnapY(); +/*N*/ pValues[ 6 ] <<= IsUseGridSnap(); +/*N*/ pValues[ 7 ] <<= IsSynchronize(); +/*N*/ pValues[ 8 ] <<= IsGridVisible(); +/*N*/ pValues[ 9 ] <<= IsEqualGrid(); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsGridItem +|* +\************************************************************************/ + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptionsPrint +|* +\************************************************************************/ + +/*N*/ SdOptionsPrint::SdOptionsPrint( USHORT nConfigId, BOOL bUseConfig ) : +/*N*/ SdOptionsGeneric( nConfigId, bUseConfig ? +/*N*/ ( ( SDCFG_DRAW == nConfigId ) ? +/*N*/ B2U( "Office.Draw/Print" ) : +/*N*/ B2U( "Office.Impress/Print" ) ) : +/*N*/ OUString() ), +/*N*/ bDraw( TRUE ), +/*N*/ bNotes( FALSE ), +/*N*/ bHandout( FALSE ), +/*N*/ bOutline( FALSE ), +/*N*/ bDate( FALSE ), +/*N*/ bTime( FALSE ), +/*N*/ bPagename( FALSE ), +/*N*/ bHiddenPages( TRUE ), +/*N*/ bPagesize( FALSE ), +/*N*/ bPagetile( FALSE ), +/*N*/ bWarningPrinter( TRUE ), +/*N*/ bWarningSize( FALSE ), +/*N*/ bWarningOrientation( FALSE ), +/*N*/ bBooklet( FALSE ), +/*N*/ bFront( TRUE ), +/*N*/ bBack( TRUE ), +/*N*/ bCutPage( FALSE ), +/*N*/ bPaperbin( FALSE ), +/*N*/ nQuality( 0 ) +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const +/*N*/ { +/*N*/ return( IsDraw() == rOpt.IsDraw() && +/*N*/ IsNotes() == rOpt.IsNotes() && +/*N*/ IsHandout() == rOpt.IsHandout() && +/*N*/ IsOutline() == rOpt.IsOutline() && +/*N*/ IsDate() == rOpt.IsDate() && +/*N*/ IsTime() == rOpt.IsTime() && +/*N*/ IsPagename() == rOpt.IsPagename() && +/*N*/ IsHiddenPages() == rOpt.IsHiddenPages() && +/*N*/ IsPagesize() == rOpt.IsPagesize() && +/*N*/ IsPagetile() == rOpt.IsPagetile() && +/*N*/ IsWarningPrinter() == rOpt.IsWarningPrinter() && +/*N*/ IsWarningSize() == rOpt.IsWarningSize() && +/*N*/ IsWarningOrientation() == rOpt.IsWarningOrientation() && +/*N*/ IsBooklet() == rOpt.IsBooklet() && +/*N*/ IsFrontPage() == rOpt.IsFrontPage() && +/*N*/ IsBackPage() == rOpt.IsBackPage() && +/*N*/ IsCutPage() == rOpt.IsCutPage() && +/*N*/ IsPaperbin() == rOpt.IsPaperbin() && +/*N*/ GetOutputQuality() == rOpt.GetOutputQuality() ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdOptionsPrint::GetPropNameArray( const char**& ppNames, ULONG& rCount ) const +/*N*/ { +/*N*/ static const char* aDrawPropNames[] = +/*N*/ { +/*N*/ "Other/Date", +/*N*/ "Other/Time", +/*N*/ "Other/PageName", +/*N*/ "Other/HiddenPage", +/*N*/ "Page/PageSize", +/*N*/ "Page/PageTile", +/*N*/ // bWarningPrinter +/*N*/ // bWarningSize +/*N*/ // bWarningOrientation +/*N*/ "Page/Booklet", +/*N*/ "Page/BookletFront", +/*N*/ "Page/BookletBack", +/*N*/ // bCutPage +/*N*/ "Other/FromPrinterSetup", +/*N*/ "Other/Quality", +/*N*/ "Content/Drawing", +/*N*/ }; +/*N*/ static const char* aImpressPropNames[] = +/*N*/ { +/*N*/ "Other/Date", +/*N*/ "Other/Time", +/*N*/ "Other/PageName", +/*N*/ "Other/HiddenPage", +/*N*/ "Page/PageSize", +/*N*/ "Page/PageTile", +/*N*/ // bWarningPrinter +/*N*/ // bWarningSize +/*N*/ // bWarningOrientation +/*N*/ "Page/Booklet", +/*N*/ "Page/BookletFront", +/*N*/ "Page/BookletBack", +/*N*/ // bCutPage +/*N*/ "Other/FromPrinterSetup", +/*N*/ "Other/Quality", +/*N*/ "Content/Presentation", +/*N*/ "Content/Note", +/*N*/ "Content/Handout", +/*N*/ "Content/Outline" +/*N*/ }; +/*N*/ +/*N*/ if( GetConfigId() == SDCFG_IMPRESS ) +/*N*/ { +/*N*/ rCount = 15; +/*N*/ ppNames = aImpressPropNames; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rCount = 12; +/*N*/ ppNames = aDrawPropNames; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsPrint::ReadData( const Any* pValues ) +/*N*/ { +/*N*/ if( pValues[0].hasValue() ) SetDate( *(sal_Bool*) pValues[ 0 ].getValue() ); +/*N*/ if( pValues[1].hasValue() ) SetTime( *(sal_Bool*) pValues[ 1 ].getValue() ); +/*N*/ if( pValues[2].hasValue() ) SetPagename( *(sal_Bool*) pValues[ 2 ].getValue() ); +/*N*/ if( pValues[3].hasValue() ) SetHiddenPages( *(sal_Bool*) pValues[ 3 ].getValue() ); +/*N*/ if( pValues[4].hasValue() ) SetPagesize( *(sal_Bool*) pValues[ 4 ].getValue() ); +/*N*/ if( pValues[5].hasValue() ) SetPagetile( *(sal_Bool*) pValues[ 5 ].getValue() ); +/*N*/ if( pValues[6].hasValue() ) SetBooklet( *(sal_Bool*) pValues[ 6 ].getValue() ); +/*N*/ if( pValues[7].hasValue() ) SetFrontPage( *(sal_Bool*) pValues[ 7 ].getValue() ); +/*N*/ if( pValues[8].hasValue() ) SetBackPage( *(sal_Bool*) pValues[ 8 ].getValue() ); +/*N*/ if( pValues[9].hasValue() ) SetPaperbin( *(sal_Bool*) pValues[ 9 ].getValue() ); +/*N*/ if( pValues[10].hasValue() ) SetOutputQuality( (UINT16) *(sal_Int32*) pValues[ 10 ].getValue() ); +/*N*/ if( pValues[11].hasValue() ) SetDraw( *(sal_Bool*) pValues[ 11 ].getValue() ); +/*N*/ +/*N*/ // just for impress +/*N*/ if( GetConfigId() == SDCFG_IMPRESS ) +/*N*/ { +/*N*/ if( pValues[12].hasValue() ) SetNotes( *(sal_Bool*) pValues[ 12 ].getValue() ); +/*N*/ if( pValues[13].hasValue() ) SetHandout( *(sal_Bool*) pValues[ 13 ].getValue() ); +/*N*/ if( pValues[14].hasValue() ) SetOutline( *(sal_Bool*) pValues[ 14 ].getValue() ); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdOptionsPrint::WriteData( Any* pValues ) const +/*N*/ { +/*N*/ pValues[ 0 ] <<= IsDate(); +/*N*/ pValues[ 1 ] <<= IsTime(); +/*N*/ pValues[ 2 ] <<= IsPagename(); +/*N*/ pValues[ 3 ] <<= IsHiddenPages(); +/*N*/ pValues[ 4 ] <<= IsPagesize(); +/*N*/ pValues[ 5 ] <<= IsPagetile(); +/*N*/ pValues[ 6 ] <<= IsBooklet(); +/*N*/ pValues[ 7 ] <<= IsFrontPage(); +/*N*/ pValues[ 8 ] <<= IsBackPage(); +/*N*/ pValues[ 9 ] <<= IsPaperbin(); +/*N*/ pValues[ 10 ] <<= (sal_Int32) GetOutputQuality(); +/*N*/ pValues[ 11 ] <<= IsDraw(); +/*N*/ +/*N*/ // just for impress +/*N*/ if( GetConfigId() == SDCFG_IMPRESS ) +/*N*/ { +/*N*/ pValues[ 12 ] <<= IsNotes(); +/*N*/ pValues[ 13 ] <<= IsHandout(); +/*N*/ pValues[ 14 ] <<= IsOutline(); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/*N*/ void SdOptionsPrint::SetPrinterOptions( const SdOptionsPrint* pOptions ) +/*N*/ { +/*N*/ bDraw = pOptions->bDraw; +/*N*/ bNotes = pOptions->bNotes; +/*N*/ bHandout = pOptions->bHandout; +/*N*/ bOutline = pOptions->bOutline; +/*N*/ bDate = pOptions->bDate; +/*N*/ bTime = pOptions->bTime; +/*N*/ bPagename = pOptions->bPagename; +/*N*/ bHiddenPages = pOptions->bHiddenPages; +/*N*/ bPagesize = pOptions->bPagesize; +/*N*/ bPagetile = pOptions->bPagetile; +/*N*/ bWarningPrinter = pOptions->bWarningPrinter; +/*N*/ bWarningSize = pOptions->bWarningSize; +/*N*/ bWarningOrientation = pOptions->bWarningOrientation; +/*N*/ bBooklet = pOptions->bBooklet; +/*N*/ bFront = pOptions->bFront; +/*N*/ bBack = pOptions->bBack; +/*N*/ bCutPage = pOptions->bCutPage; +/*N*/ bPaperbin = pOptions->bPaperbin; +/*N*/ nQuality = pOptions->nQuality; +/*N*/ } + +/************************************************************************* +|* +|* SdOptionsPrintItem +|* +\************************************************************************/ + +// ---------------------------------------------------------------------- + +/*N*/ SdOptionsPrintItem::SdOptionsPrintItem( USHORT nWhich, SdOptions* pOpts, FrameView* ) : +/*N*/ SfxPoolItem ( nWhich ), +/*N*/ SdOptionsPrint ( 0, FALSE ) +/*N*/ { +/*N*/ SetDraw( pOpts->IsDraw() ); +/*N*/ SetNotes( pOpts->IsNotes() ); +/*N*/ SetHandout( pOpts->IsHandout() ); +/*N*/ SetOutline( pOpts->IsOutline() ); +/*N*/ SetDate( pOpts->IsDate() ); +/*N*/ SetTime( pOpts->IsTime() ); +/*N*/ SetPagename( pOpts->IsPagename() ); +/*N*/ SetHiddenPages( pOpts->IsHiddenPages() ); +/*N*/ SetPagesize( pOpts->IsPagesize() ); +/*N*/ SetPagetile( pOpts->IsPagetile() ); +/*N*/ SetWarningPrinter( pOpts->IsWarningPrinter() ); +/*N*/ SetWarningSize( pOpts->IsWarningSize() ); +/*N*/ SetWarningOrientation( pOpts->IsWarningOrientation() ); +/*N*/ SetBooklet( pOpts->IsBooklet() ); +/*N*/ SetFrontPage( pOpts->IsFrontPage() ); +/*N*/ SetBackPage( pOpts->IsBackPage() ); +/*N*/ SetCutPage( pOpts->IsCutPage() ); +/*N*/ SetPaperbin( pOpts->IsPaperbin() ); +/*N*/ SetOutputQuality( pOpts->GetOutputQuality() ); +/*N*/ } + +// ---------------------------------------------------------------------- + +/*N*/ SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const +/*N*/ { +/*N*/ return new SdOptionsPrintItem( *this ); +/*N*/ } + +// ---------------------------------------------------------------------- + +int SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const +{ + const SdOptionsPrintItem* pRHS = dynamic_cast<const SdOptionsPrintItem *>(&rAttr); + DBG_ASSERT( pRHS, "SdOptionsPrintItem::operator==(), compare not possible for non SdOptionsPrintItem" ); + + if( pRHS ) + return SdOptionsPrint::operator==(*pRHS); + else + return 0; +} + +// ----------------------------------------------------------------------- + + +/************************************************************************* +|* +|* SdOptions +|* +\************************************************************************/ + +/*N*/ SdOptions::SdOptions( USHORT nConfigId ) : +/*N*/ SdOptionsLayout( nConfigId, TRUE ), +/*N*/ SdOptionsContents( nConfigId, TRUE ), +/*N*/ SdOptionsMisc( nConfigId, TRUE ), +/*N*/ SdOptionsSnap( nConfigId, TRUE ), +/*N*/ SdOptionsZoom( nConfigId, TRUE ), +/*N*/ SdOptionsGrid( nConfigId, TRUE ), +/*N*/ SdOptionsPrint( nConfigId, TRUE ) +/*N*/ { +/*N*/ } + +// ---------------------------------------------------------------------- + +/*N*/ SdOptions::~SdOptions() +/*N*/ { +/*N*/ } + +// ---------------------------------------------------------------------- + + +// ---------------------------------------------------------------------- + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/sd_sddll.cxx b/binfilter/bf_sd/source/ui/app/sd_sddll.cxx new file mode 100644 index 000000000000..e6f61f29fa60 --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_sddll.cxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_svx/svdobj.hxx> +#include <bf_svtools/moduleoptions.hxx> + +#include "bf_sd/grdocsh.hxx" +#include "sdresid.hxx" +#include "sdobjfac.hxx" +#include "cfgids.hxx" + +namespace binfilter { + +void SdDLL::Init() +{ + // the SdModule must be created + SdModuleDummy** ppShlPtr = (SdModuleDummy**) GetAppData(BF_SHL_DRAW); + SvFactory* pDrawFact = (SvFactory*)(*ppShlPtr)->pSdDrawDocShellFactory; + SvFactory* pGraphicFact = (SvFactory*)(*ppShlPtr)->pSdGraphicDocShellFactory; + delete (*ppShlPtr); + (*ppShlPtr) = new SdModule(pDrawFact, pGraphicFact); + (*ppShlPtr)->pSdDrawDocShellFactory = pDrawFact; + (*ppShlPtr)->pSdGraphicDocShellFactory = pGraphicFact; + + SdrObjFactory::InsertMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); +} + +void SdDLL::Exit() +{ + SdrObjFactory::RemoveMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); + + SdModuleDummy** ppShlPtr = (SdModuleDummy**) GetAppData(BF_SHL_DRAW); + delete (*ppShlPtr); + (*ppShlPtr) = NULL; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/sd_sdlib.cxx b/binfilter/bf_sd/source/ui/app/sd_sdlib.cxx new file mode 100644 index 000000000000..96c48ccd684b --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_sdlib.cxx @@ -0,0 +1,371 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <comphelper/classids.hxx> +#include <bf_svx/svxids.hrc> +#include <bf_svx/impgrf.hxx> + +#include <bf_sfx2/app.hxx> +#include <bf_sfx2/fcontnr.hxx> +#include <bf_sfx2/docfile.hxx> +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/FilterConfigItem.hxx> +#include <sot/formats.hxx> + +#include <com/sun/star/util/XArchiver.hpp> + +using namespace ::rtl; +using namespace ::com::sun::star; + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "sddll.hxx" + +#include "sddll0.hxx" // wird durchs Makefile generiert + +#include "bf_sd/grdocsh.hxx" +#include "strings.hrc" +#include "strmname.h" + + +#include <bf_offmgr/ofaids.hrc> + +#include <bf_svtools/moduleoptions.hxx> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +TYPEINIT1( SdModuleDummy, SfxModule ); + +extern "C" { static void SAL_CALL thisModule() {} } + +SFX_IMPL_MODULE_LIB(Sd, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( DLL_NAME ) ) ) + +SFX_IMPL_OBJECTFACTORY_MOD(SdDrawDocShell, SFXOBJECTSHELL_STD_NORMAL, simpress, + SvGlobalName(BF_SO3_SIMPRESS_CLASSID), Sd, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( DLL_NAME ) ) ) +{ + SdDrawDocShell::Factory().SetDocumentServiceName( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ); + SdDrawDocShell::Factory().GetFilterContainer()->SetDetectFilter( &SdDLL::DetectFilter ); +} + +SFX_IMPL_OBJECTFACTORY_MOD(SdGraphicDocShell, SFXOBJECTSHELL_STD_NORMAL, sdraw, + SvGlobalName(BF_SO3_SDRAW_CLASSID), Sd, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( DLL_NAME ) ) ) +{ + SdGraphicDocShell::Factory().SetDocumentServiceName( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ); + SdGraphicDocShell::Factory().GetFilterContainer()->SetDetectFilter( &SdDLL::DetectFilter ); +} + +SdDLL::SdDLL() +{ +} + +SdDLL::~SdDLL() +{ +} + +void SdDLL::LibInit() +{ + SfxApplication* pApp = SFX_APP(); + + SfxObjectFactory *p1 = NULL; + if(SvtModuleOptions().IsImpress()) + { + SdDrawDocShell::RegisterFactory(SDT_SD_DOCFACTPRIO); + p1 = &SdDrawDocShell::Factory(); + } + + SfxObjectFactory *p2 = NULL; + if(SvtModuleOptions().IsDraw()) + { + SdGraphicDocShell::RegisterFactory(SDT_SD_DOCFACTPRIO); + p2 = &SdGraphicDocShell::Factory(); + } + + SD_MOD() = new SdModuleDummy( NULL, TRUE, p1, p2 ); +} + +void SdDLL::LibExit() +{ + FreeLibSd(); + DELETEZ( SD_MOD() ); +} + +ULONG __EXPORT SdDLL::DetectFilter(SfxMedium& rMedium, const SfxFilter** pFilter, SfxFilterFlags nMust, SfxFilterFlags nDont) +{ + ULONG nReturn = ERRCODE_ABORT; // Erkennung fehlgeschlagen, Filter ungueltig + BOOL bStorage = FALSE; + + if( *pFilter && (*pFilter)->GetFilterFlags() & SFX_FILTER_PACKED ) + { + uno::Reference< lang::XMultiServiceFactory > xSMgr( ::legacy_binfilters::getLegacyProcessServiceFactory() ); + uno::Reference< util::XArchiver > xPacker( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.util.Archiver" ) ), uno::UNO_QUERY ); + if( xPacker.is() ) + { + // extract extra data + OUString aPath( rMedium.GetOrigURL() ); + OUString aExtraData( xPacker->getExtraData( aPath ) ); + const OUString aSig1= OUString::createFromAscii( "private:" ); + String aTmp; + aTmp += sal_Unicode( '?' ); + aTmp += (*pFilter)->GetFilterContainer()->GetName(); + const OUString aSig2( aTmp ); + INT32 nIndex1 = aExtraData.indexOf( aSig1 ); + INT32 nIndex2 = aExtraData.indexOf( aSig2 ); + if( nIndex1 == 0 && nIndex2 != -1 ) + return ERRCODE_NONE; + } + } + else if (rMedium.GetError() == SVSTREAM_OK) + { + if (rMedium.IsStorage()) + { + bStorage = TRUE; + // Storage + SvStorage* pStorage = rMedium.GetStorage(); + if ( pStorage == NULL ) return ULONG_MAX; + + + // Erkennung ueber contained streams (StarDraw 3.0) + if( ( pStorage->IsContained( pStarDrawDoc ) && pStorage->IsStream( pStarDrawDoc ) ) || + ( pStorage->IsContained( pStarDrawDoc3 ) && pStorage->IsStream( pStarDrawDoc3 ) ) ) + { + const SfxFilter* pFilt = NULL; + SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + SfxFilterContainer *pDraw = rMatcher.GetContainer( + UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sdraw" ) ) ); // Name kennt ihr besser + SfxFilterContainer *pImpr = rMatcher.GetContainer( + UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "simpress" ) )); // dito + ULONG nStorFmt = pStorage->GetFormat(); + if (*pFilter) + { + if ( (*pFilter)->GetFilterContainer() == pDraw) + { + if(SvtModuleOptions().IsDraw()) + { + pFilt = pDraw->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_SFX_FORCEQUIET; + } + else + { + pFilt = pImpr->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_SFX_FORCEQUIET; + } + } + else if ( (*pFilter)->GetFilterContainer() == pImpr) + { + if(SvtModuleOptions().IsImpress()) + { + pFilt = pImpr->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_SFX_FORCEQUIET; + } + else + { + pFilt = pDraw->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_SFX_FORCEQUIET; + } + } + } + else if(SvtModuleOptions().IsImpress()) + { + pFilt = pImpr->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_NONE; + } + else if(SvtModuleOptions().IsDraw()) + { + pFilt = pDraw->GetFilter4ClipBoardId( nStorFmt ); + nReturn = ERRCODE_NONE; + } + + if (pFilt && + (pFilt->GetFilterFlags() & nMust) == nMust && + (pFilt->GetFilterFlags() & nDont) == 0) + { + *pFilter = pFilt; + } + else + { + *pFilter = NULL; + nReturn = ERRCODE_NONE; + } + } + else if(SvtModuleOptions().IsImpress()) + { + // Erkennung ueber contained streams (PowerPoint 97-Filter) + String aStreamName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "PowerPoint Document" ) ); + + if (pStorage->IsContained( aStreamName ) && pStorage->IsStream( aStreamName ) ) + { + String aFileName(rMedium.GetName()); + aFileName.ToUpperAscii(); + + if( aFileName.SearchAscii( ".POT" ) == STRING_NOTFOUND ) + *pFilter = SFX_APP()->GetFilter(SdDrawDocShell::Factory(), pFilterPowerPoint97); + else + *pFilter = SFX_APP()->GetFilter(SdDrawDocShell::Factory(), pFilterPowerPoint97Template); + + return ERRCODE_NONE; + } + } + } + + // XML filter(s) + if( *pFilter ) + { + ::rtl::OUString aName = (*pFilter)->GetFilterName(); + + if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("StarOffice XML (Draw)")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("StarOffice XML (Impress)")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("draw_StarOffice_XML_Impress")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("impress_StarOffice_XML_Draw")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("impress_StarOffice_XML_Impress_Template")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("draw_StarOffice_XML_Draw_Template")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("draw_StarOffice_XML_Draw")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("impress_StarOffice_XML_Impress"))) + { + if( rMedium.IsStorage() ) + { + SvStorage* pStorage = rMedium.GetStorage(); + + nReturn = ERRCODE_ABORT; + + if( pStorage && ( pStorage->IsStream( pStarDrawXMLContent ) || pStorage->IsStream( pStarDrawOldXMLContent ) ) ) + { + const ULONG nStorageFormat = pStorage->GetFormat(); + if( nStorageFormat == 0 || + nStorageFormat == SOT_FORMATSTR_ID_STARIMPRESS_60 || + nStorageFormat == SOT_FORMATSTR_ID_STARDRAW_60 ) + { + nReturn = ERRCODE_NONE; + } + } + } + } + } + + String aFileName(rMedium.GetName()); + aFileName.ToUpperAscii(); + + if (nReturn == ERRCODE_ABORT) + { + if( bStorage ) // aber keine Clipboard-Id #55337# + { + *pFilter = NULL; + } + else + { + // Vektorgraphik? + SvStream* pStm = rMedium.GetInStream(); + + if( !pStm ) + nReturn = ERRCODE_IO_GENERAL; + else + { + pStm->Seek( STREAM_SEEK_TO_BEGIN ); + + const String aFileName( rMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ); + GraphicDescriptor aDesc( *pStm, &aFileName ); + GraphicFilter* pGrfFilter = GetGrfFilter(); + + if( !aDesc.Detect( FALSE ) ) + { + *pFilter = NULL; + nReturn = ERRCODE_ABORT; + INetURLObject aURL( aFileName ); + if( aURL.getExtension().equalsIgnoreAsciiCaseAscii( "cgm" ) ) + { + sal_uInt8 n8; + pStm->Seek( STREAM_SEEK_TO_BEGIN ); + *pStm >> n8; + if ( ( n8 & 0xf0 ) == 0 ) // we are supporting binary cgm format only, so + { // this is a small test to exclude cgm text + const String aName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "CGM - Computer Graphics Metafile" ) ); + *pFilter = SFX_APP()->GetFilter( SdDrawDocShell::Factory(), aName ); + nReturn = ERRCODE_NONE; + } + } + } + else + { + if( SvtModuleOptions().IsDraw() ) + { + String aShortName( aDesc.GetImportFormatShortName( aDesc.GetFileFormat() ) ); + const String aName( pGrfFilter->GetImportFormatTypeName( pGrfFilter->GetImportFormatNumberForShortName( aShortName ) ) ); + + if ( *pFilter && aShortName.EqualsIgnoreCaseAscii( "PCD" ) ) // there is a multiple pcd selection possible + { + sal_Int32 nBase = 2; // default Base0 + String aFilterTypeName( (*pFilter)->GetRealTypeName() ); + if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base4" ) == COMPARE_EQUAL ) + nBase = 1; + else if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base16" ) == COMPARE_EQUAL ) + nBase = 0; + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Import/PCD" ) ); + FilterConfigItem aFilterConfigItem( aFilterConfigPath ); + aFilterConfigItem.WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), nBase ); + } + + *pFilter = SFX_APP()->GetFilter( SdGraphicDocShell::Factory(), aName ); + nReturn = ERRCODE_NONE; + } + else + { + nReturn = ERRCODE_ABORT; + *pFilter = NULL; + } + } + } + } + } + } + else + { + nReturn = rMedium.GetError(); + } + + return nReturn; +} + + + +/************************************************************************* +|* +|* Modul laden +|* +\************************************************************************/ + +SfxModule* SdModuleDummy::Load() +{ + return (LoadLibSd() ? SD_MOD() : NULL); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/sd_sdmod.cxx b/binfilter/bf_sd/source/ui/app/sd_sdmod.cxx new file mode 100644 index 000000000000..e304e01366b0 --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_sdmod.cxx @@ -0,0 +1,152 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <vcl/virdev.hxx> + +#include <bf_svtools/ehdl.hxx> + +#include <bf_svx/eeitem.hxx> +#include <bf_svx/svdfield.hxx> +#include <bf_svx/outliner.hxx> + +#define _SD_DLL // fuer SD_MOD() +#include "optsitem.hxx" +#include "bf_sd/docshell.hxx" +#include "drawdoc.hxx" +#include "glob.hrc" +#include "strings.hrc" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> + +namespace binfilter { + +TYPEINIT1( SdModuleDummy, SfxModule ); +TYPEINIT1( SdModule, SdModuleDummy ); + +SFX_IMPL_MODULE_DLL(Sd) + +SdModule::SdModule(SvFactory* pDrawObjFact, SvFactory* pGraphicObjFact) +: SdModuleDummy(SFX_APP()->CreateResManager("bf_sd"), FALSE, pDrawObjFact, pGraphicObjFact) +, pImpressOptions(NULL) +, pDrawOptions(NULL) +{ + SetName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarDraw" ) ) ); // Nicht uebersetzen! + StartListening( *SFX_APP() ); + + mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL, + ERRCODE_AREA_SD, + ERRCODE_AREA_SD_END, + GetResMgr() ); + + mpVirtualRefDevice = new VirtualDevice; + mpVirtualRefDevice->SetMapMode( MAP_100TH_MM ); +} + +SdModule::~SdModule() +{ + delete mpErrorHdl; + delete static_cast< VirtualDevice* >( mpVirtualRefDevice ); +} + +SfxModule* SdModuleDummy::Load() +{ + return (NULL); +} + +SfxModule* SdModule::Load() +{ + return (this); +} + +IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo) +{ + if( pInfo ) + { + const String aStr( RTL_CONSTASCII_STRINGPARAM( "???" ) ); + pInfo->SetRepresentation( aStr ); + } + + return(0); +} + +void SdModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + if( rHint.ISA( SfxSimpleHint ) && + ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DEINITIALIZING ) + { + delete pImpressOptions, pImpressOptions = NULL; + delete pDrawOptions, pDrawOptions = NULL; + } +} + +void SdModule::Free() +{ +} + +SdOptions* SdModule::GetSdOptions(DocumentType eDocType) +{ + SdOptions* pOptions = NULL; + if (eDocType == DOCUMENT_TYPE_DRAW) + { + if (!pDrawOptions) + pDrawOptions = new SdOptions( SDCFG_DRAW ); + pOptions = pDrawOptions; + } + else if (eDocType == DOCUMENT_TYPE_IMPRESS) + { + if (!pImpressOptions) + pImpressOptions = new SdOptions( SDCFG_IMPRESS ); + pOptions = pImpressOptions; + } + if( pOptions ) + { + UINT16 nMetric = pOptions->GetMetric(); + SdDrawDocShell* pDocSh = PTR_CAST( SdDrawDocShell, SfxObjectShell::Current() ); + SdDrawDocument* pDoc = NULL; + if (pDocSh) + pDoc = pDocSh->GetDoc(); + if( nMetric != 0xffff && pDoc && eDocType == pDoc->GetDocumentType() ) + PutItem( SfxUInt16Item( SID_ATTR_METRIC, nMetric ) ); + } + return(pOptions); +} + +OutputDevice* SdModule::GetVirtualRefDevice (void) +{ + return mpVirtualRefDevice; +} + +OutputDevice* SdModule::GetRefDevice (SdDrawDocShell& rDocShell) +{ + return GetVirtualRefDevice(); +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/sd_sdresid.cxx b/binfilter/bf_sd/source/ui/app/sd_sdresid.cxx new file mode 100644 index 000000000000..62e1f88dfcc8 --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_sdresid.cxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "sdresid.hxx" +#include "sdmod.hxx" + +namespace binfilter { + +SdResId::SdResId(USHORT nId) +: ResId(nId, *SD_MOD()->GetResMgr()) +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/app/sd_strings.src b/binfilter/bf_sd/source/ui/app/sd_strings.src new file mode 100644 index 000000000000..0c39c380357a --- /dev/null +++ b/binfilter/bf_sd/source/ui/app/sd_strings.src @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + +#include "strings.hrc" + +String STR_LAYER +{ + Text = "Layer" ; +}; + +String STR_IMPRESS_DOCUMENT +{ + Text = "Presentation" ; +}; + +String STR_IMPRESS_DOCUMENT_FULLTYPE_60 +{ + Text = "%PRODUCTNAME 6.0 Presentation" ; +}; + +String STR_IMPRESS_DOCUMENT_FULLTYPE_50 +{ + Text = "%PRODUCTNAME 5.0 Presentation" ; +}; + +String STR_IMPRESS_DOCUMENT_FULLTYPE_40 +{ + Text = "%PRODUCTNAME 4.0 Presentation" ; +}; + +String STR_IMPRESS_DOCUMENT_FULLTYPE_31 +{ + Text = "Graphics/presentation (%PRODUCTNAME 3.0)" ; +}; + +String STR_GRAPHIC_DOCUMENT +{ + Text = "Drawing" ; +}; + +String STR_GRAPHIC_DOCUMENT_FULLTYPE_50 +{ + Text = "Drawing (%PRODUCTNAME 5.0)" ; +}; + +String STR_GRAPHIC_DOCUMENT_FULLTYPE_60 +{ + Text = "%PRODUCTNAME 6.0 Drawing" ; +}; diff --git a/binfilter/bf_sd/source/ui/docshell/makefile.mk b/binfilter/bf_sd/source/ui/docshell/makefile.mk new file mode 100644 index 000000000000..bae4b6870111 --- /dev/null +++ b/binfilter/bf_sd/source/ui/docshell/makefile.mk @@ -0,0 +1,56 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sd_sd + +PRJNAME=binfilter +TARGET=sd_docshell + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sd_docshell.obj \ + $(SLO)$/sd_grdocsh.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sd/source/ui/docshell/sd_docshell.cxx b/binfilter/bf_sd/source/ui/docshell/sd_docshell.cxx new file mode 100644 index 000000000000..8a6a8194c986 --- /dev/null +++ b/binfilter/bf_sd/source/ui/docshell/sd_docshell.cxx @@ -0,0 +1,580 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST +#define ITEMID_COLOR_TABLE SID_COLOR_TABLE +#define ITEMID_GRADIENT_LIST SID_GRADIENT_LIST +#define ITEMID_HATCH_LIST SID_HATCH_LIST +#define ITEMID_BITMAP_LIST SID_BITMAP_LIST +#define ITEMID_DASH_LIST SID_DASH_LIST +#define ITEMID_LINEEND_LIST SID_LINEEND_LIST +#define ITEMID_SEARCH SID_SEARCH_ITEM + +#include <com/sun/star/document/PrinterIndependentLayout.hpp> + +#include <comphelper/classids.hxx> + +#include <tools/urlobj.hxx> +#include <sot/formats.hxx> + +#include <bf_svtools/ctrltool.hxx> +#include <bf_svtools/flagitem.hxx> +#include <bf_svtools/itemset.hxx> + +#include <bf_sfx2/docfile.hxx> +#include <bf_sfx2/app.hxx> +#include <bf_sfx2/printer.hxx> +#include <bf_svx/svxids.hrc> +#include <bf_svx/flstitem.hxx> +#include <bf_svx/drawitem.hxx> +#include <bf_sfx2/docfilt.hxx> + +#include "sdresid.hxx" +#include "strings.hrc" +#include "optsitem.hxx" +#include "sdattr.hxx" +#include "bf_sd/docshell.hxx" +#include "drawdoc.hxx" +#include "unomodel.hxx" +#include "sdpage.hxx" +#include "sdxmlwrp.hxx" +#include "sdbinfilter.hxx" +#include "sdoutl.hxx" + +namespace binfilter +{ +TYPEINIT1( SdDrawDocShell, SfxObjectShell ); + +SFX_IMPL_OBJECTFACTORY_LOD(SdDrawDocShell, simpress, SvGlobalName(BF_SO3_SIMPRESS_CLASSID), Sd) + +void SdDrawDocShell::Construct() +{ + bInDestruction = FALSE; + SetSlotFilter(); + SetShell(this); + + pDoc = new SdDrawDocument(eDocType, this); + SetModel( new SdXImpressDocument( this ) ); + SetPool( &pDoc->GetItemPool() ); + UpdateTablePointers(); + SetStyleFamily(5); +} + +SdDrawDocShell::SdDrawDocShell(SfxObjectCreateMode eMode, BOOL bDataObject, DocumentType eDocumentType) : + SfxObjectShell(eMode), + pPrinter(NULL), + pDoc(NULL), + bUIActive(FALSE), + pProgress(NULL), + bSdDataObj(bDataObject), + bOwnPrinter(FALSE), + eDocType(eDocumentType), + mbNewDocument( sal_True ) +{ + Construct(); +} + +SdDrawDocShell::~SdDrawDocShell() +{ + bInDestruction = TRUE; + + if (bOwnPrinter) + delete pPrinter; + + delete pDoc; + +} + +void SdDrawDocShell::Deactivate( BOOL ) +{ +} + +void SdDrawDocShell::UpdateTablePointers() +{ + PutItem( SvxColorTableItem( pDoc->GetColorTable() ) ); + PutItem( SvxGradientListItem( pDoc->GetGradientList() ) ); + PutItem( SvxHatchListItem( pDoc->GetHatchList() ) ); + PutItem( SvxBitmapListItem( pDoc->GetBitmapList() ) ); + PutItem( SvxDashListItem( pDoc->GetDashList() ) ); + PutItem( SvxLineEndListItem( pDoc->GetLineEndList() ) ); +} + +void SdDrawDocShell::SetModified( BOOL bSet /* = TRUE */ ) +{ + SfxInPlaceObject::SetModified( bSet ); + + if( IsEnableSetModified() && pDoc ) + pDoc->NbcSetChanged( bSet ); + + Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) ); +} + + +void SdDrawDocShell::SetVisArea(const Rectangle& rRect) +{ + if (GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) + { + SfxInPlaceObject::SetVisArea(rRect); + } + else + { + SvEmbeddedObject::SetVisArea(rRect); + } +} + +Rectangle SdDrawDocShell::GetVisArea(USHORT nAspect) const +{ + Rectangle aVisArea; + + if( ( ASPECT_THUMBNAIL == nAspect ) || ( ASPECT_DOCPRINT == nAspect ) ) + { + MapMode aSrcMapMode(MAP_PIXEL); + MapMode aDstMapMode(MAP_100TH_MM); + Size aSize = pDoc->GetSdPage(0, PK_STANDARD)->GetSize(); + aSrcMapMode.SetMapUnit(MAP_100TH_MM); + + aSize = Application::GetDefaultDevice()->LogicToLogic(aSize, &aSrcMapMode, &aDstMapMode); + aVisArea.SetSize(aSize); + } + else + { + aVisArea = SfxInPlaceObject::GetVisArea(nAspect); + } + + return (aVisArea); +} + + +SfxPrinter* SdDrawDocShell::GetPrinter(BOOL bCreate) +{ + if (bCreate && !pPrinter) + { + // ItemSet mit speziellem Poolbereich anlegen + SfxItemSet* pSet = new SfxItemSet( GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, + 0 ); + // PrintOptionsSet setzen + SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT, + SD_MOD()->GetSdOptions(pDoc->GetDocumentType())); + SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC ); + USHORT nFlags = 0; + + nFlags = (aPrintItem.IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) | + (aPrintItem.IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0); + aFlagItem.SetValue( nFlags ); + + pSet->Put( aPrintItem ); + pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.IsWarningPrinter() ) ); + pSet->Put( aFlagItem ); + + pPrinter = new SfxPrinter(pSet); + bOwnPrinter = TRUE; + + // Ausgabequalitaet setzen + UINT16 nQuality = aPrintItem.GetOutputQuality(); + + ULONG nMode = DRAWMODE_DEFAULT; + + if( nQuality == 1 ) + nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT; + else if( nQuality == 2 ) + nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT; + + pPrinter->SetDrawMode( nMode ); + + MapMode aMM (pPrinter->GetMapMode()); + aMM.SetMapUnit(MAP_100TH_MM); + pPrinter->SetMapMode(aMM); + UpdateRefDevice(); + } + return pPrinter; +} + +void SdDrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) +{ + if ( pPrinter && bOwnPrinter && (pPrinter != pNewPrinter) ) + { + delete pPrinter; + } + + pPrinter = pNewPrinter; + bOwnPrinter = TRUE; + + UpdateRefDevice(); +} + +Printer* SdDrawDocShell::GetDocumentPrinter() +{ + return GetPrinter(FALSE); +} + +void SdDrawDocShell::UpdateRefDevice() +{ + if( pDoc ) + { + // Determine the device for which the output will be formatted. + OutputDevice* pRefDevice = NULL; + switch (pDoc->GetPrinterIndependentLayout()) + { + case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: + pRefDevice = pPrinter; + break; + + case ::com::sun::star::document::PrinterIndependentLayout::ENABLED: + pRefDevice = SD_MOD()->GetVirtualRefDevice(); + break; + + default: + // We are confronted with an invalid or un-implemented + // layout mode. Use the printer as formatting device + // as a fall-back. + DBG_ASSERT(false, "SdDrawDocShell::UpdateRefDevice(): Unexpected printer layout mode"); + + pRefDevice = pPrinter; + break; + } + pDoc->SetRefDevice( pRefDevice ); + + SdOutliner* pOutl = pDoc->GetOutliner( FALSE ); + + if( pOutl ) +/*?*/ pOutl->SetRefDevice( pRefDevice ); + + SdOutliner* pInternalOutl = pDoc->GetInternalOutliner( FALSE ); + + if( pInternalOutl ) + pInternalOutl->SetRefDevice( pRefDevice ); + } +} + +BOOL SdDrawDocShell::InitNew( SvStorage * pStor ) +{ + BOOL bRet = SfxInPlaceObject::InitNew( pStor ); + + Rectangle aVisArea( Point(0, 0), Size(14100, 10000) ); + SetVisArea(aVisArea); + + if (bRet) + { + if( !bSdDataObj ) + pDoc->NewOrLoadCompleted(NEW_DOC); + } + return bRet; +} + +BOOL SdDrawDocShell::Load( SvStorage* pStore ) +{ + mbNewDocument = sal_False; + + ULONG nStoreVer = pStore->GetVersion(); + BOOL bRet = FALSE; + BOOL bXML = ( nStoreVer >= SOFFICE_FILEFORMAT_60 ); + BOOL bBinary = ( nStoreVer < SOFFICE_FILEFORMAT_60 ); + bool bStartPresentation = false; + + if( bBinary || bXML ) + { + bRet = SfxInPlaceObject::Load( pStore ); + + if( bRet ) + { + SdFilter* pFilter = NULL; + SfxMedium* pMedium = 0L; + + if( bBinary ) + { + pMedium = new SfxMedium( pStore ); + pFilter = new SdBINFilter( *pMedium, *this, sal_True ); + } + else if( bXML ) + { + pFilter = new SdXMLFilter( *GetMedium(), *this, sal_True ); + } + + bRet = pFilter ? pFilter->Import() : FALSE; + + + if(pFilter) + delete pFilter; + if(pMedium) + delete pMedium; + } + } + else + pStore->SetError( SVSTREAM_WRONGVERSION ); + + if( bRet ) + { + UpdateTablePointers(); + + if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxInPlaceObject::GetVisArea( ASPECT_CONTENT ).IsEmpty() ) + { + SdPage* pPage = pDoc->GetSdPage( 0, PK_STANDARD ); + if( pPage ) + SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) ); + } + + FinishedLoading( SFX_LOADED_ALL ); + } + else + { + if( pStore->GetError() == ERRCODE_IO_BROKENPACKAGE ) + SetError( ERRCODE_IO_BROKENPACKAGE ); + pStore->SetError( SVSTREAM_WRONGVERSION ); + } + + return bRet; +} + + BOOL SdDrawDocShell::Save() + { + if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) + SvInPlaceObject::SetVisArea( Rectangle() ); + + BOOL bRet = SfxInPlaceObject::Save(); + + if( bRet ) + { + SvStorage* pStore = GetStorage(); + SfxMedium aMedium( pStore ); + SdFilter* pFilter = NULL; + + if( pStore->GetVersion() >= SOFFICE_FILEFORMAT_60 ) + pFilter = new SdXMLFilter( aMedium, *this, sal_True ); + else + pFilter = new SdBINFilter( aMedium, *this, sal_True ); + + UpdateDocInfoForSave(); + + bRet = pFilter ? pFilter->Export() : FALSE; + delete pFilter; + } + + return bRet; + } + +BOOL SdDrawDocShell::SaveAs( SvStorage* pStore ) +{ + if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) + SvInPlaceObject::SetVisArea( Rectangle() ); + + UINT32 nVBWarning = ERRCODE_NONE; + BOOL bRet = SfxInPlaceObject::SaveAs( pStore ); + + if( bRet ) + { + SdFilter* pFilter = NULL; + + if( pStore->GetVersion() >= SOFFICE_FILEFORMAT_60 ) + { + SfxMedium aMedium( pStore ); + pFilter = new SdXMLFilter( aMedium, *this, sal_True ); + + UpdateDocInfoForSave(); + + bRet = pFilter->Export(); + } + else + { + + SfxMedium aMedium( pStore ); + pFilter = new SdBINFilter( aMedium, *this, sal_True ); + + UpdateDocInfoForSave(); + + const ULONG nOldSwapMode = pDoc->GetSwapGraphicsMode(); + pDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); + if( !( bRet = pFilter->Export() ) ) + pDoc->SetSwapGraphicsMode( nOldSwapMode ); + + } + + delete pFilter; + } + + if( GetError() == ERRCODE_NONE ) + SetError( nVBWarning ); + + return bRet; +} + +BOOL SdDrawDocShell::SaveCompleted( SvStorage * pStor ) +{ + BOOL bRet = FALSE; + + if( SfxInPlaceObject::SaveCompleted(pStor) ) + { + pDoc->NbcSetChanged( FALSE ); + + bRet = TRUE; + + if( pDoc ) + pDoc->HandsOff(); + } + return bRet; +} + +void SdDrawDocShell::HandsOff() +{ + SfxInPlaceObject::HandsOff(); + + if( pDoc ) + pDoc->HandsOff(); +} + +SdDrawDocument* SdDrawDocShell::GetDoc() +{ + return pDoc; +} + +SfxStyleSheetBasePool* SdDrawDocShell::GetStyleSheetPool() +{ + return( (SfxStyleSheetBasePool*) pDoc->GetStyleSheetPool() ); +} + + +BOOL SdDrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium ) +{ + + const SfxFilter* pFilter = rMedium.GetFilter(); + + if (pFilter->IsOwnTemplateFormat()) + { + String aLayoutName; + + SfxStringItem* pLayoutItem; + if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, FALSE, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET ) + { + aLayoutName = pLayoutItem->GetValue(); + } + else + { + INetURLObject aURL( rMedium.GetName() ); + aURL.removeExtension(); + aLayoutName = aURL.getName(); + } + + if( aLayoutName.Len() ) + { + String aOldPageLayoutName = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName(); + pDoc->RenameLayoutTemplate(aOldPageLayoutName, aLayoutName); + } + } + + return SfxObjectShell::SaveAsOwnFormat(rMedium); +} + +void SdDrawDocShell::FillClass(SvGlobalName* pClassName,ULONG* pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, long nFileFormat) const +{ + SfxInPlaceObject::FillClass(pClassName, pFormat, pAppName, pFullTypeName, + pShortTypeName, nFileFormat); + + if (nFileFormat == SOFFICE_FILEFORMAT_31) + { + *pClassName = SvGlobalName(BF_SO3_SIMPRESS_CLASSID_30); + *pFormat = SOT_FORMATSTR_ID_STARDRAW; + *pAppName = String(RTL_CONSTASCII_USTRINGPARAM("Sdraw 3.1")); + *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_31));; + *pShortTypeName = String(SdResId(STR_IMPRESS_DOCUMENT)); + } + else if (nFileFormat == SOFFICE_FILEFORMAT_40) + { + *pClassName = SvGlobalName(BF_SO3_SIMPRESS_CLASSID_40); + *pFormat = SOT_FORMATSTR_ID_STARDRAW_40; + *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_40)); + *pShortTypeName = String(SdResId(STR_IMPRESS_DOCUMENT)); + } + else + { + if (nFileFormat == SOFFICE_FILEFORMAT_50) + { + if (eDocType == DOCUMENT_TYPE_DRAW) + { + *pClassName = SvGlobalName(BF_SO3_SDRAW_CLASSID_50); + *pFormat = SOT_FORMATSTR_ID_STARDRAW_50; + *pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_50)); + } + else + { + *pClassName = SvGlobalName(BF_SO3_SIMPRESS_CLASSID_50); + *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_50; + *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_50)); + } + } + else if (nFileFormat == SOFFICE_FILEFORMAT_CURRENT) + { + *pFullTypeName = String(SdResId( (eDocType == DOCUMENT_TYPE_DRAW) ? + STR_GRAPHIC_DOCUMENT_FULLTYPE_60 : STR_IMPRESS_DOCUMENT_FULLTYPE_60 )); + + if(eDocType == DOCUMENT_TYPE_DRAW) + { + *pClassName = SvGlobalName(BF_SO3_SDRAW_CLASSID_60); + *pFormat = SOT_FORMATSTR_ID_STARDRAW_60; + } + else + { + *pClassName = SvGlobalName(BF_SO3_SIMPRESS_CLASSID_60); + *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60; + } + + } + + *pShortTypeName = String(SdResId( (eDocType == DOCUMENT_TYPE_DRAW) ? + STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT )); + } +} + +OutputDevice* SdDrawDocShell::GetDocumentRefDev (void) +{ + OutputDevice* pReferenceDevice = SfxInPlaceObject::GetDocumentRefDev (); + if (pReferenceDevice == NULL && pDoc != NULL) + pReferenceDevice = pDoc->GetRefDevice (); + return pReferenceDevice; +} + +SfxPrinter* SdDrawDocShell::CreatePrinter( SvStream& rIn, SdDrawDocument& rDoc ) +{ + SfxItemSet* pSet = new SfxItemSet( rDoc.GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, + 0 ); + // PrintOptionsSet setzen + SdOptionsPrintItem aPrintItem(ATTR_OPTIONS_PRINT,SD_MOD()->GetSdOptions(rDoc.GetDocumentType()) ); + + pSet->Put( aPrintItem ); + pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, false ) ); + + return SfxPrinter::Create(rIn, pSet); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/docshell/sd_grdocsh.cxx b/binfilter/bf_sd/source/ui/docshell/sd_grdocsh.cxx new file mode 100644 index 000000000000..7702a459df53 --- /dev/null +++ b/binfilter/bf_sd/source/ui/docshell/sd_grdocsh.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_svx/svxids.hrc> +#define ITEMID_SEARCH SID_SEARCH_ITEM +#include <bf_sfx2/app.hxx> + + +#include <comphelper/classids.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "strings.hrc" +#include "glob.hrc" + +#include "bf_sd/grdocsh.hxx" +#include "sdresid.hxx" + +namespace binfilter +{ + +TYPEINIT1(SdGraphicDocShell, SdDrawDocShell); + +SFX_IMPL_OBJECTFACTORY_LOD(SdGraphicDocShell, sdraw, SvGlobalName(BF_SO3_SDRAW_CLASSID), Sd) + +SdGraphicDocShell::SdGraphicDocShell(SfxObjectCreateMode eMode, BOOL bDataObject, DocumentType eDocType) +: SdDrawDocShell(eMode, bDataObject, eDocType) +{ + SetStyleFamily( 2 ); +} + +SdGraphicDocShell::~SdGraphicDocShell() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/cfgids.hxx b/binfilter/bf_sd/source/ui/inc/cfgids.hxx new file mode 100644 index 000000000000..2ee0213fdb46 --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/cfgids.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SD_CFGID_HXX +#define _SD_CFGID_HXX + +#include <bf_sfx2/sfx.hrc> + +#define SDCFG_IMPRESS (SFX_ITEMTYPE_SD_BEGIN + 1) +#define SDCFG_DRAW (SFX_ITEMTYPE_SD_BEGIN + 3) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/optsitem.hxx b/binfilter/bf_sd/source/ui/inc/optsitem.hxx new file mode 100644 index 000000000000..3adc191cb133 --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/optsitem.hxx @@ -0,0 +1,592 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SD_OPTSITEM_HXX +#define _SD_OPTSITEM_HXX + +#include <unotools/configitem.hxx> +#include <bf_sfx2/cfgitem.hxx> +#include <bf_sfx2/module.hxx> +#include <bf_sfx2/app.hxx> +#include <bf_sfx2/sfxsids.hrc> +#include <bf_svx/optgrid.hxx> +#include <bf_svx/dlgutil.hxx> +namespace binfilter { + + +// ----------------- +// - Option ranges - +// ----------------- + +#define SD_OPTIONS_NONE 0x00000000 +#define SD_OPTIONS_ALL 0xffffffff + +#define SD_OPTIONS_LAYOUT 0x00000001 +#define SD_OPTIONS_CONTENTS 0x00000002 +#define SD_OPTIONS_MISC 0x00000004 +#define SD_OPTIONS_SNAP 0x00000008 +#define SD_OPTIONS_ZOOM 0x00000010 +#define SD_OPTIONS_GRID 0x00000020 +#define SD_OPTIONS_PRINT 0x00000040 + +// ------------ +// - Forwards - +// ------------ + +class SfxConfigItem; +class FrameView; +class SdOptions; + +// ----------------- +// - SdOptionsItem - +// ----------------- + +class SdOptionsGeneric; + +class SdOptionsItem : public ::utl::ConfigItem +{ + +private: + + const SdOptionsGeneric& mrParent; + + +public: + + SdOptionsItem( const SdOptionsGeneric& rParent, const ::rtl::OUString rSubTree ); + ~SdOptionsItem(); + + void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + void Commit(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetProperties( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames ); + void SetModified(); +}; + +// -------------------- +// - SdOptionsGeneric - +// -------------------- + +class SdOptionsGeneric +{ +friend class SdOptionsItem; + +private: + + ::rtl::OUString maSubTree; + SdOptionsItem* mpCfgItem; + USHORT mnConfigId; + BOOL mbInit : 1; + BOOL mbEnableModify : 1; + + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const; + +protected: + + void Init() const; + void OptionsChanged() { if( mpCfgItem && mbEnableModify ) mpCfgItem->SetModified(); } + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const = 0; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ) = 0; + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const = 0; + +public: + + SdOptionsGeneric( USHORT nConfigId, const ::rtl::OUString& rSubTree ); + virtual ~SdOptionsGeneric(); + + const ::rtl::OUString& GetSubTree() const { return maSubTree; } + USHORT GetConfigId() const { return mnConfigId; } + + void EnableModify( BOOL bModify ) { mbEnableModify = bModify; } + + + + static bool isMetricSystem(); +}; + +// ------------------- +// - SdOptionsLayout - +// ------------------- + +class SdOptionsLayout : public SdOptionsGeneric +{ +private: + + BOOL bRuler : 1; // Layout/Display/Ruler + BOOL bMoveOutline : 1; // Layout/Display/Contur + BOOL bDragStripes : 1; // Layout/Display/Guide + BOOL bHandlesBezier : 1; // Layout/Display/Bezier + BOOL bHelplines : 1; // Layout/Display/Helpline + UINT16 nMetric; // Layout/Other/MeasureUnit + UINT16 nDefTab; // Layout/Other/TabStop + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + SdOptionsLayout( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsLayout() {} + + BOOL IsRulerVisible() const { Init(); return (BOOL) bRuler; } + BOOL IsMoveOutline() const { Init(); return (BOOL) bMoveOutline; } + BOOL IsDragStripes() const { Init(); return (BOOL) bDragStripes; } + BOOL IsHandlesBezier() const { Init(); return (BOOL) bHandlesBezier; } + BOOL IsHelplines() const { Init(); return (BOOL) bHelplines; } + UINT16 GetMetric() const { Init(); return( ( 0xffff == nMetric ) ? (UINT16)GetModuleFieldUnit() : nMetric ); } + UINT16 GetDefTab() const { Init(); return nDefTab; } + + void SetRulerVisible( BOOL bOn = TRUE ) { if( bRuler != bOn ) { OptionsChanged(); bRuler = bOn; } } + void SetMoveOutline( BOOL bOn = TRUE ) { if( bMoveOutline != bOn ) { OptionsChanged(); bMoveOutline = bOn; } } + void SetDragStripes( BOOL bOn = TRUE ) { if( bDragStripes != bOn ) { OptionsChanged(); bDragStripes = bOn; } } + void SetHandlesBezier( BOOL bOn = TRUE ) { if( bHandlesBezier != bOn ) { OptionsChanged(); bHandlesBezier = bOn; } } + void SetHelplines( BOOL bOn = TRUE ) { if( bHelplines != bOn ) { OptionsChanged(); bHelplines = bOn; } } + void SetMetric( UINT16 nInMetric ) { if( nMetric != nInMetric ) { OptionsChanged(); nMetric = nInMetric; } } + void SetDefTab( UINT16 nTab ) { if( nDefTab != nTab ) { OptionsChanged(); nDefTab = nTab; } } +}; + +// ----------------------------------------------------------------------------- + + + + +// --------------------- +// - SdOptionsContents - +// --------------------- + +class SdOptionsContents : public SdOptionsGeneric +{ +private: + + BOOL bExternGraphic : 1; // Content/Display/PicturePlaceholder + BOOL bOutlineMode : 1; // Content/Display/ContourMode + BOOL bHairlineMode : 1; // Content/Display/LineContour + BOOL bNoText : 1; // Content/Display/TextPlaceholder + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsContents( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsContents() {} + + BOOL IsExternGraphic() const { Init(); return (BOOL) bExternGraphic; } + BOOL IsOutlineMode() const { Init(); return (BOOL) bOutlineMode; } + BOOL IsHairlineMode() const { Init(); return (BOOL) bHairlineMode; } + BOOL IsNoText() const { Init(); return (BOOL) bNoText; } + + void SetExternGraphic( BOOL bOn = TRUE ) { if( bExternGraphic != bOn ) { OptionsChanged(); bExternGraphic = bOn; } } + void SetOutlineMode( BOOL bOn = TRUE ) { if( bOutlineMode != bOn ) { OptionsChanged(); bOutlineMode = bOn; } } + void SetHairlineMode( BOOL bOn = TRUE ) { if( bHairlineMode != bOn ) { OptionsChanged(); bHairlineMode = bOn; } } + void SetNoText( BOOL bOn = TRUE ) { if( bNoText != bOn ) { OptionsChanged(); bNoText = bOn; } } +}; + +// ----------------------------------------------------------------------------- + + + + +// ----------------- +// - SdOptionsMisc - +// ----------------- + +class SdOptionsMisc : public SdOptionsGeneric +{ +private: + + ULONG nPreviewQuality; // !!!Misc/Preview (double=>integer)!!! + + // #97016# + ULONG nDefaultObjectSizeWidth; + ULONG nDefaultObjectSizeHeight; + + BOOL bStartWithTemplate : 1; // Misc/NewDoc/AutoPilot + BOOL bMarkedHitMovesAlways : 1; // Misc/ObjectMoveable + BOOL bMoveOnlyDragging : 1; // Currently, not in use !!! + BOOL bCrookNoContortion : 1; // Misc/NoDistort + BOOL bQuickEdit : 1; // Misc/TextObject/QuickEditing + BOOL bMasterPageCache : 1; // Misc/BackgroundCache + BOOL bDragWithCopy : 1; // Misc/CopyWhileMoving + BOOL bPickThrough : 1; // Misc/TextObject/Selectable + BOOL bBigHandles : 1; // Misc/BigHandles + BOOL bDoubleClickTextEdit : 1; // Misc/DclickTextedit + BOOL bClickChangeRotation : 1; // Misc/RotateClick + BOOL bStartWithActualPage : 1; // Misc/Start/CurrentPage + BOOL bSolidDragging : 1; // Misc/CreateWithAttributes + BOOL bSolidMarkHdl : 1; // /Misc/SimpleHandles + BOOL bSummationOfParagraphs : 1; // misc/SummationOfParagraphs + // #90356# + BOOL bShowUndoDeleteWarning : 1; // Misc/ShowUndoDeleteWarning + + /** This value controls the device to use for formatting documents. + The currently supported values are 0 for the current printer or 1 + for the printer independent virtual device the can be retrieved from + the modules. + */ + USHORT mnPrinterIndependentLayout; // Misc/Compatibility/PrinterIndependentLayout +// Misc + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsMisc( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsMisc() {} + + BOOL IsStartWithTemplate() const { Init(); return (BOOL) bStartWithTemplate; } + BOOL IsMarkedHitMovesAlways() const { Init(); return (BOOL) bMarkedHitMovesAlways; } + BOOL IsMoveOnlyDragging() const { Init(); return (BOOL) bMoveOnlyDragging; } + BOOL IsCrookNoContortion() const { Init(); return (BOOL) bCrookNoContortion; } + BOOL IsQuickEdit() const { Init(); return (BOOL) bQuickEdit; } + BOOL IsMasterPagePaintCaching() const { Init(); return (BOOL) bMasterPageCache; } + BOOL IsDragWithCopy() const { Init(); return (BOOL) bDragWithCopy; } + BOOL IsPickThrough() const { Init(); return (BOOL) bPickThrough; } + BOOL IsBigHandles() const { Init(); return (BOOL) bBigHandles; } + BOOL IsDoubleClickTextEdit() const { Init(); return (BOOL) bDoubleClickTextEdit; } + BOOL IsClickChangeRotation() const { Init(); return (BOOL) bClickChangeRotation; } + BOOL IsStartWithActualPage() const { Init(); return (BOOL) bStartWithActualPage; } + ULONG GetPreviewQuality() const { Init(); return nPreviewQuality; } + BOOL IsSolidDragging() const { Init(); return (BOOL) bSolidDragging; } + BOOL IsSolidMarkHdl() const { Init(); return (BOOL) bSolidMarkHdl; } + BOOL IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs != 0; }; + /** Return the currently selected printer independent layout mode. + @return + Returns 1 for printer independent layout enabled and 0 when it + is disabled. Other values are reserved for future use. + */ + USHORT GetPrinterIndependentLayout() const { Init(); return mnPrinterIndependentLayout; }; + // #90356# + BOOL IsShowUndoDeleteWarning() const { Init(); return (BOOL) bShowUndoDeleteWarning; } + // #97016# + ULONG GetDefaultObjectSizeWidth() const { Init(); return nDefaultObjectSizeWidth; } + ULONG GetDefaultObjectSizeHeight() const { Init(); return nDefaultObjectSizeHeight; } + + void SetStartWithTemplate( BOOL bOn = TRUE ) { if( bStartWithTemplate != bOn ) { OptionsChanged(); bStartWithTemplate = bOn; } } + void SetMarkedHitMovesAlways( BOOL bOn = TRUE ) { if( bMarkedHitMovesAlways != bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } } + void SetMoveOnlyDragging( BOOL bOn = TRUE ) { if( bMoveOnlyDragging != bOn ) { OptionsChanged(); bMoveOnlyDragging = bOn; } } + void SetCrookNoContortion( BOOL bOn = TRUE ) { if( bCrookNoContortion != bOn ) { OptionsChanged(); bCrookNoContortion = bOn; } } + void SetQuickEdit( BOOL bOn = TRUE ) { if( bQuickEdit != bOn ) { OptionsChanged(); bQuickEdit = bOn; } } + void SetMasterPagePaintCaching( BOOL bOn = TRUE ) { if( bMasterPageCache != bOn ) { OptionsChanged(); bMasterPageCache = bOn; } } + void SetDragWithCopy( BOOL bOn = TRUE ) { if( bDragWithCopy != bOn ) { OptionsChanged(); bDragWithCopy = bOn; } } + void SetPickThrough( BOOL bOn = TRUE ) { if( bPickThrough != bOn ) { OptionsChanged(); bPickThrough = bOn; } } + void SetBigHandles( BOOL bOn = TRUE ) { if( bBigHandles != bOn ) { OptionsChanged(); bBigHandles = bOn; } } + void SetDoubleClickTextEdit( BOOL bOn = TRUE ) { if( bDoubleClickTextEdit != bOn ) { OptionsChanged(); bDoubleClickTextEdit = bOn; } } + void SetClickChangeRotation( BOOL bOn = TRUE ) { if( bClickChangeRotation != bOn ) { OptionsChanged(); bClickChangeRotation = bOn; } } + void SetStartWithActualPage( BOOL bOn = TRUE ) { if( bStartWithActualPage != bOn ) { OptionsChanged(); bStartWithActualPage = bOn; } } + void SetSummationOfParagraphs( BOOL bOn = TRUE ){ if ( bOn != bSummationOfParagraphs ) { OptionsChanged(); bSummationOfParagraphs = bOn; } } + /** Set the printer independent layout mode. + @param nOn + The default value is to switch printer independent layout on, + hence the parameters name. Use 0 for turning it off. Other + values are reserved for future use. + */ + void SetPrinterIndependentLayout (USHORT nOn = 1 ){ if ( nOn != mnPrinterIndependentLayout ) { OptionsChanged(); mnPrinterIndependentLayout = nOn; } } + void SetPreviewQuality( ULONG nQual ) { if( nPreviewQuality != nQual ) { OptionsChanged(); nPreviewQuality = nQual; } } + void SetSolidDragging( BOOL bOn = TRUE ) { if( bSolidDragging != bOn ) { OptionsChanged(); bSolidDragging = bOn; } } + void SetSolidMarkHdl( BOOL bOn = TRUE ) { if( bSolidMarkHdl != bOn ) { OptionsChanged(); bSolidMarkHdl = bOn; } } + // #90356# + void SetShowUndoDeleteWarning( BOOL bOn = TRUE ) { if( bShowUndoDeleteWarning != bOn ) { OptionsChanged(); bShowUndoDeleteWarning = bOn; } } + // #97016# + void SetDefaultObjectSizeWidth( ULONG nWidth ) { if( nDefaultObjectSizeWidth != nWidth ) { OptionsChanged(); nDefaultObjectSizeWidth = nWidth; } } + void SetDefaultObjectSizeHeight( ULONG nHeight ) { if( nDefaultObjectSizeHeight != nHeight ) { OptionsChanged(); nDefaultObjectSizeHeight = nHeight; } } +}; + +// ----------------------------------------------------------------------------- + + + + +// ----------------- +// - SdOptionsSnap - +// ----------------- + +class SdOptionsSnap : public SdOptionsGeneric +{ +private: + + BOOL bSnapHelplines : 1; // Snap/Object/SnapLine + BOOL bSnapBorder : 1; // Snap/Object/PageMargin + BOOL bSnapFrame : 1; // Snap/Object/ObjectFrame + BOOL bSnapPoints : 1; // Snap/Object/ObjectPoint + BOOL bOrtho : 1; // Snap/Position/CreatingMoving + BOOL bBigOrtho : 1; // Snap/Position/ExtendEdges + BOOL bRotate : 1; // Snap/Position/Rotating + INT16 nSnapArea; // Snap/Object/Range + INT16 nAngle; // Snap/Position/RotatingValue + INT16 nBezAngle; // Snap/Position/PointReduction + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsSnap( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsSnap() {} + + BOOL IsSnapHelplines() const { Init(); return (BOOL) bSnapHelplines; } + BOOL IsSnapBorder() const { Init(); return (BOOL) bSnapBorder; } + BOOL IsSnapFrame() const { Init(); return (BOOL) bSnapFrame; } + BOOL IsSnapPoints() const { Init(); return (BOOL) bSnapPoints; } + BOOL IsOrtho() const { Init(); return (BOOL) bOrtho; } + BOOL IsBigOrtho() const { Init(); return (BOOL) bBigOrtho; } + BOOL IsRotate() const { Init(); return (BOOL) bRotate; } + INT16 GetSnapArea() const { Init(); return nSnapArea; } + INT16 GetAngle() const { Init(); return nAngle; } + INT16 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; } + + void SetSnapHelplines( BOOL bOn = TRUE ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } } + void SetSnapBorder( BOOL bOn = TRUE ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } } + void SetSnapFrame( BOOL bOn = TRUE ) { if( bSnapFrame != bOn ) { OptionsChanged(); bSnapFrame = bOn; } } + void SetSnapPoints( BOOL bOn = TRUE ) { if( bSnapPoints != bOn ) { OptionsChanged(); bSnapPoints = bOn; } } + void SetOrtho( BOOL bOn = TRUE ) { if( bOrtho != bOn ) { OptionsChanged(); bOrtho = bOn; } } + void SetBigOrtho( BOOL bOn = TRUE ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } } + void SetRotate( BOOL bOn = TRUE ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } } + void SetSnapArea( INT16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } } + void SetAngle( INT16 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } } + void SetEliminatePolyPointLimitAngle( INT16 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } } +}; + +// ----------------------------------------------------------------------------- + + + + + +// ----------------- +// - SdOptionsZoom - +// ----------------- + +class SdOptionsZoom : public SdOptionsGeneric +{ +private: + + INT32 nX; // Zoom/ScaleX + INT32 nY; // Zoom/ScaleY + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsZoom( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsZoom() {} + + void GetScale( INT32& rX, INT32& rY ) const { Init(); rX = nX; rY = nY; } + void SetScale( INT32 nInX, INT32 nInY ) { if( nX != nInX || nY != nInY ) { OptionsChanged(); nX = nInX; nY = nInY; } } +}; + +// ----------------------------------------------------------------------------- + + + +// ----------------- +// - SdOptionsGrid - +// ----------------- + +class SdOptionsGrid : public SdOptionsGeneric, public SvxOptionsGrid +{ +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsGrid( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsGrid(); + + void SetDefaults(); + + UINT32 GetFldDrawX() const { Init(); return SvxOptionsGrid::GetFldDrawX(); } + UINT32 GetFldDivisionX() const { Init(); return SvxOptionsGrid::GetFldDivisionX(); } + UINT32 GetFldDrawY() const { Init(); return SvxOptionsGrid::GetFldDrawY(); } + UINT32 GetFldDivisionY() const { Init(); return SvxOptionsGrid::GetFldDivisionY(); } + UINT32 GetFldSnapX() const { Init(); return SvxOptionsGrid::GetFldSnapX(); } + UINT32 GetFldSnapY() const { Init(); return SvxOptionsGrid::GetFldSnapY(); } + BOOL IsUseGridSnap() const { Init(); return SvxOptionsGrid::GetUseGridSnap(); } + BOOL IsSynchronize() const { Init(); return SvxOptionsGrid::GetSynchronize(); } + BOOL IsGridVisible() const { Init(); return SvxOptionsGrid::GetGridVisible(); } + BOOL IsEqualGrid() const { Init(); return SvxOptionsGrid::GetEqualGrid(); } + + void SetFldDrawX( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawX( nSet ); } } + void SetFldDivisionX( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionX( nSet ); } } + void SetFldDrawY( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawY( nSet ); } } + void SetFldDivisionY( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionY( nSet ); } } + void SetFldSnapX( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapX() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapX( nSet ); } } + void SetFldSnapY( UINT32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapY() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapY( nSet ); } } + void SetUseGridSnap( BOOL bSet ) { if( bSet != SvxOptionsGrid::GetUseGridSnap() ) { OptionsChanged(); SvxOptionsGrid::SetUseGridSnap( bSet ); } } + void SetSynchronize( BOOL bSet ) { if( bSet != SvxOptionsGrid::GetSynchronize() ) { OptionsChanged(); SvxOptionsGrid::SetSynchronize( bSet ); } } + void SetGridVisible( BOOL bSet ) { if( bSet != SvxOptionsGrid::GetGridVisible() ) { OptionsChanged(); SvxOptionsGrid::SetGridVisible( bSet ); } } + void SetEqualGrid( BOOL bSet ) { if( bSet != SvxOptionsGrid::GetEqualGrid() ) { OptionsChanged(); SvxOptionsGrid::SetEqualGrid( bSet ); } } +}; + +// ----------------------------------------------- + + +// ------------------ +// - SdOptionsPrint - +// ------------------ + +class SdOptionsPrint : public SdOptionsGeneric +{ +private: + + BOOL bDraw : 1; // Print/Content/Drawing + BOOL bNotes : 1; // Print/Content/Note + BOOL bHandout : 1; // Print/Content/Handout + BOOL bOutline : 1; // Print/Content/Outline + BOOL bDate : 1; // Print/Other/Date + BOOL bTime : 1; // Print/Other/Time + BOOL bPagename : 1; // Print/Other/PageName + BOOL bHiddenPages : 1; // Print/Other/HiddenPage + BOOL bPagesize : 1; // Print/Page/PageSize + BOOL bPagetile : 1; // Print/Page/PageTile + BOOL bWarningPrinter : 1; // These flags you get + BOOL bWarningSize : 1; // from the common options, + BOOL bWarningOrientation : 1; // currently org.openoffice.Office.Common.xml (class OfaMiscCfg ; bf_sfx2/misccfg.hxx ) + BOOL bBooklet : 1; // Print/Page/Booklet + BOOL bFront : 1; // Print/Page/BookletFront + BOOL bBack : 1; // Print/Page/BookletFront + BOOL bCutPage : 1; // NOT persistent !!! + BOOL bPaperbin : 1; // Print/Other/FromPrinterSetup + UINT16 nQuality; // Print/Other/Quality + +protected: + + virtual void GetPropNameArray( const char**& ppNames, ULONG& rCount ) const; + virtual BOOL ReadData( const ::com::sun::star::uno::Any* pValues ); + virtual BOOL WriteData( ::com::sun::star::uno::Any* pValues ) const; + +public: + + SdOptionsPrint( USHORT nConfigId, BOOL bUseConfig ); + ~SdOptionsPrint() {} + + void SetPrinterOptions( const SdOptionsPrint* pOptions ); + + BOOL operator==( const SdOptionsPrint& rOpt ) const; + + BOOL IsDraw() const { Init(); return (BOOL) bDraw; } + BOOL IsNotes() const { Init(); return (BOOL) bNotes; } + BOOL IsHandout() const { Init(); return (BOOL) bHandout; } + BOOL IsOutline() const { Init(); return (BOOL) bOutline; } + BOOL IsDate() const { Init(); return (BOOL) bDate; } + BOOL IsTime() const { Init(); return (BOOL) bTime; } + BOOL IsPagename() const { Init(); return (BOOL) bPagename; } + BOOL IsHiddenPages() const { Init(); return (BOOL) bHiddenPages; } + BOOL IsPagesize() const { Init(); return (BOOL) bPagesize; } + BOOL IsPagetile() const { Init(); return (BOOL) bPagetile; } + BOOL IsWarningPrinter() const { Init(); return (BOOL) bWarningPrinter; } + BOOL IsWarningSize() const { Init(); return (BOOL) bWarningSize; } + BOOL IsWarningOrientation() const { Init(); return (BOOL) bWarningOrientation; } + BOOL IsBooklet() const { Init(); return (BOOL) bBooklet; } + BOOL IsFrontPage() const { Init(); return (BOOL) bFront; } + BOOL IsBackPage() const { Init(); return (BOOL) bBack; } + BOOL IsCutPage() const { Init(); return (BOOL) bCutPage; } + BOOL IsPaperbin() const { Init(); return (BOOL) bPaperbin; } + UINT16 GetOutputQuality() const { Init(); return nQuality; } + + void SetDraw( BOOL bOn = TRUE ) { if( bDraw != bOn ) { OptionsChanged(); bDraw = bOn; } } + void SetNotes( BOOL bOn = TRUE ) { if( bNotes != bOn ) { OptionsChanged(); bNotes = bOn; } } + void SetHandout( BOOL bOn = TRUE ) { if( bHandout != bOn ) { OptionsChanged(); bHandout = bOn; } } + void SetOutline( BOOL bOn = TRUE ) { if( bOutline != bOn ) { OptionsChanged(); bOutline = bOn; } } + void SetDate( BOOL bOn = TRUE ) { if( bDate != bOn ) { OptionsChanged(); bDate = bOn; } } + void SetTime( BOOL bOn = TRUE ) { if( bTime != bOn ) { OptionsChanged(); bTime = bOn; } } + void SetPagename( BOOL bOn = TRUE ) { if( bPagename != bOn ) { OptionsChanged(); bPagename = bOn; } } + void SetHiddenPages( BOOL bOn = TRUE ) { if( bHiddenPages != bOn ) { OptionsChanged(); bHiddenPages = bOn; } } + void SetPagesize( BOOL bOn = TRUE ) { if( bPagesize != bOn ) { OptionsChanged(); bPagesize = bOn; } } + void SetPagetile( BOOL bOn = TRUE ) { if( bPagetile != bOn ) { OptionsChanged(); bPagetile = bOn; } } + void SetWarningPrinter( BOOL bOn = TRUE ) { if( bWarningPrinter != bOn ) { OptionsChanged(); bWarningPrinter = bOn; } } + void SetWarningSize( BOOL bOn = TRUE ) { if( bWarningSize != bOn ) { OptionsChanged(); bWarningSize = bOn; } } + void SetWarningOrientation( BOOL bOn = TRUE ) { if( bWarningOrientation != bOn ) { OptionsChanged(); bWarningOrientation = bOn; } } + void SetBooklet( BOOL bOn = TRUE ) { if( bBooklet != bOn ) { OptionsChanged(); bBooklet = bOn; } } + void SetFrontPage( BOOL bOn = TRUE ) { if( bFront != bOn ) { OptionsChanged(); bFront = bOn; } } + void SetBackPage( BOOL bOn = TRUE ) { if( bBack != bOn ) { OptionsChanged(); bBack = bOn; } } + void SetCutPage( BOOL bOn = TRUE ) { if( bCutPage != bOn ) { OptionsChanged(); bCutPage = bOn; } } + void SetPaperbin( BOOL bOn = TRUE ) { if( bPaperbin != bOn ) { OptionsChanged(); bPaperbin = bOn; } } + void SetOutputQuality( UINT16 nInQuality ) { if( nQuality != nInQuality ) { OptionsChanged(); nQuality = nInQuality; } } +}; + +// ----------------------------------------------------------------------------- + +class SdOptionsPrintItem : public SfxPoolItem, public SdOptionsPrint +{ +public: + + SdOptionsPrintItem( USHORT nWhich, SdOptions* pOpts, FrameView* pView = NULL ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual int operator==( const SfxPoolItem& ) const; + +}; + +// ------------- +// - SdOptions - +// ------------- + +class SdOptions : + public SdOptionsLayout, + public SdOptionsContents, + public SdOptionsMisc, + public SdOptionsSnap, + public SdOptionsZoom, + public SdOptionsGrid, + public SdOptionsPrint +{ +public: + + SdOptions( USHORT nConfigId ); + ~SdOptions(); + +}; + +} //namespace binfilter +#endif // _SD_OPTSITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/prlayout.hxx b/binfilter/bf_sd/source/ui/inc/prlayout.hxx new file mode 100644 index 000000000000..955465f472a9 --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/prlayout.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +/************************************************************************* +|* Enthielt frueher auch die Klasse SdPresentationLayoutDlg (wird jetzt nicht +|* mehr benoetigt). Dieses File ist auf ungeklaerte Weise aus dem PVCS +|* verschwunden und wird jetzt neu eingecheckt und enthaelt nur noch den enum. +\************************************************************************/ + +#ifndef _SD_PRLAYOUT_HXX_ +#define _SD_PRLAYOUT_HXX_ +namespace binfilter { + +enum PresentationObjects +{ + PO_TITLE, + PO_BACKGROUND, + PO_BACKGROUNDOBJECTS, + PO_OUTLINE_1, + PO_OUTLINE_2, + PO_OUTLINE_3, + PO_OUTLINE_4, + PO_OUTLINE_5, + PO_OUTLINE_6, + PO_OUTLINE_7, + PO_OUTLINE_8, + PO_OUTLINE_9, + PO_NOTES, + PO_SUBTITLE +}; + +} //namespace binfilter +#endif // _SD_PRLAYOUT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/strings.hrc b/binfilter/bf_sd/source/ui/inc/strings.hrc new file mode 100644 index 000000000000..98bdbe8e3934 --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/strings.hrc @@ -0,0 +1,39 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#include "bf_sfx2/sfx.hrc" +#include "cfgids.hxx" + +#define STR_IMPRESS_DOCUMENT (RID_APP_START+154) +#define STR_LAYER (RID_APP_START+158) + +#define STR_IMPRESS_DOCUMENT_FULLTYPE_31 (RID_APP_START+167) +#define STR_IMPRESS_DOCUMENT_FULLTYPE_40 (RID_APP_START+168) +#define STR_IMPRESS_DOCUMENT_FULLTYPE_50 (RID_APP_START+169) +#define STR_IMPRESS_DOCUMENT_FULLTYPE_60 (RID_APP_START+170) +#define STR_GRAPHIC_DOCUMENT (RID_APP_START+499) +#define STR_GRAPHIC_DOCUMENT_FULLTYPE_50 (RID_APP_START+500) +#define STR_GRAPHIC_DOCUMENT_FULLTYPE_60 (RID_APP_START+501) diff --git a/binfilter/bf_sd/source/ui/inc/unokywds.hxx b/binfilter/bf_sd/source/ui/inc/unokywds.hxx new file mode 100644 index 000000000000..eb32eb3f738e --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/unokywds.hxx @@ -0,0 +1,218 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SD_UNOKYWDS_HXX_ +#define _SD_UNOKYWDS_HXX_ + + +#include <tools/solar.h> +namespace binfilter { + +#ifndef SD_DEFINE_KEYWORDS +#define SD_CONSTASCII_ACTION( n, s ) extern sal_Char __FAR_DATA n[sizeof(s)] +#else +#define SD_CONSTASCII_ACTION( n, s ) sal_Char __FAR_DATA n[sizeof(s)] = s +#endif + +#define UNO_PREFIX "com.sun.star." + +// SdXImpressDocument +SD_CONSTASCII_ACTION( sUNO_Service_DrawingDocument, UNO_PREFIX "drawing.DrawingDocument" ); +SD_CONSTASCII_ACTION( sUNO_Service_PresentationDocument, UNO_PREFIX "drawing.PresentationDocument" ); + +// SdUnoStyleFamilies +SD_CONSTASCII_ACTION( sUNO_SdUnoStyleFamilies, "SdUnoStyleFamilies" ); +SD_CONSTASCII_ACTION( sUNO_Graphic_Style_Family_Name, "graphics" ); + +// SdUnoPseudoStyleFamily +SD_CONSTASCII_ACTION( sUNO_SdUnoPseudoStyleFamily, "SdUnoPseudoStyleFamily" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Title, "title" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_SubTitle, "subtitle" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Background, "background" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Background_Objects, "backgroundobjects" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Notes, "notes" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline1, "outline1" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline2, "outline2" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline3, "outline3" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline4, "outline4" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline5, "outline5" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline6, "outline6" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline7, "outline7" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline8, "outline8" ); +SD_CONSTASCII_ACTION( sUNO_PseudoSheet_Outline9, "outline9" ); + +// SdUnoPseudoStyle +SD_CONSTASCII_ACTION( sUNO_SdUnoPseudoStyle, "SdUnoPseudoStyle" ); + +// SdUnoGraphicStyleFamily +SD_CONSTASCII_ACTION( sUNO_SdUnoGraphicStyleFamily, "SdUnoGraphicStyleFamily" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_standard, "standard" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_objwitharrow, "objectwitharrow" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_objwithshadow, "objectwithshadow" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_objwithoutfill, "objectwithoutfill" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_text, "text" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_textbody, "textbody" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_textbodyjust, "textbodyjustfied" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_textbodyindent, "textbodyindent" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_title, "title" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_title1, "title1" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_title2, "title2" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_headline, "headline" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_headline1, "headline1" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_headline2, "headline2" ); +SD_CONSTASCII_ACTION( sUNO_StyleName_measure, "measure" ); + +// SdUnoGraphicStyle +SD_CONSTASCII_ACTION( sUNO_SdUnoGraphicStyle, "SdUnoGraphicStyle" ); + +// SdUnoPageBackground +SD_CONSTASCII_ACTION( sUNO_SdUnoPageBackground, "SdUnoPageBackground" ); + +// SdLayerManager +SD_CONSTASCII_ACTION( sUNO_SdLayerManager, "SdUnoLayerManager" ); + +// SdLayer +SD_CONSTASCII_ACTION( sUNO_SdLayer, "SdUnoLayer" ); +SD_CONSTASCII_ACTION( sUNO_LayerName_background, "background" ); +SD_CONSTASCII_ACTION( sUNO_LayerName_background_objects, "backgroundobjects" ); +SD_CONSTASCII_ACTION( sUNO_LayerName_layout, "layout" ); +SD_CONSTASCII_ACTION( sUNO_LayerName_controls, "controls" ); +SD_CONSTASCII_ACTION( sUNO_LayerName_measurelines, "measurelines" ); + +// SdXShape +SD_CONSTASCII_ACTION( sUNO_shape_style, "Style" ); +SD_CONSTASCII_ACTION( sUNO_shape_layername, "LayerName" ); +SD_CONSTASCII_ACTION( sUNO_shape_zorder, "ZOrder" ); + +// services +SD_CONSTASCII_ACTION( sUNO_Service_StyleFamily, UNO_PREFIX "style.StyleFamily" ); +SD_CONSTASCII_ACTION( sUNO_Service_StyleFamilies, UNO_PREFIX "style.StyleFamilies" ); +SD_CONSTASCII_ACTION( sUNO_Service_Style, UNO_PREFIX "style.Style" ); +SD_CONSTASCII_ACTION( sUNO_Service_FillProperties, UNO_PREFIX "drawing.FillProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_LineProperties, UNO_PREFIX "drawing.LineProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_ParagraphProperties, UNO_PREFIX "style.ParagraphProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_CharacterProperties, UNO_PREFIX "style.CharacterProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_Text, UNO_PREFIX "drawing.Text" ); +SD_CONSTASCII_ACTION( sUNO_Service_TextProperties, UNO_PREFIX "drawing.TextProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_ShadowProperties, UNO_PREFIX "drawing.ShadowProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_ConnectorProperties, UNO_PREFIX "drawing.ConnectorProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_MeasureProperties, UNO_PREFIX "drawing.MeasureProperties" ); +SD_CONSTASCII_ACTION( sUNO_Service_PageBackground, UNO_PREFIX "drawing.PageBackground" ); +SD_CONSTASCII_ACTION( sUNO_Service_DrawingLayer, UNO_PREFIX "drawing.Layer" ); +SD_CONSTASCII_ACTION( sUNO_Service_DrawingLayerManager, UNO_PREFIX "drawing.LayerManager" ); +SD_CONSTASCII_ACTION( sUNO_Service_GraphicObjectShape, UNO_PREFIX "drawing.GraphicObjectShape" ); +SD_CONSTASCII_ACTION( sUNO_Service_ImageMapRectangleObject, UNO_PREFIX "image.ImageMapRectangleObject" ); +SD_CONSTASCII_ACTION( sUNO_Service_ImageMapCircleObject, UNO_PREFIX "image.ImageMapCircleObject" ); +SD_CONSTASCII_ACTION( sUNO_Service_ImageMapPolygonObject, UNO_PREFIX "image.ImageMapPolygonObject" ); + +// properties +SD_CONSTASCII_ACTION( sUNO_Prop_Background, "Background" ); +SD_CONSTASCII_ACTION( sUNO_Prop_ForbiddenCharacters, "ForbiddenCharacters" ); +SD_CONSTASCII_ACTION( sUNO_Prop_MapUnit, "MapUnit" ); +SD_CONSTASCII_ACTION( sUNO_Prop_VisibleArea, "VisibleArea" ); +SD_CONSTASCII_ACTION( sUNO_Prop_TabStop, "TabStop" ); +SD_CONSTASCII_ACTION( sUNO_Prop_CharLocale, "CharLocale" ); +SD_CONSTASCII_ACTION( sUNO_Prop_AutomContFocus, "AutomaticControlFocus" ); +SD_CONSTASCII_ACTION( sUNO_Prop_ApplyFrmDsgnMode, "ApplyFormDesignMode" ); +SD_CONSTASCII_ACTION( sUNO_Prop_IsBackgroundVisible, "IsBackgroundVisible" ); +SD_CONSTASCII_ACTION( sUNO_Prop_IsBackgroundObjectsVisible, "IsBackgroundObjectsVisible" ); +SD_CONSTASCII_ACTION( sUNO_Prop_UserDefinedAttributes, "UserDefinedAttributes" ); +SD_CONSTASCII_ACTION( sUNO_Prop_BookmarkURL, "BookmarkURL" ); + +// view settings +SD_CONSTASCII_ACTION( sUNO_View_ViewId, "ViewId" ); +SD_CONSTASCII_ACTION( sUNO_View_SnapLinesDrawing, "SnapLinesDrawing" ); +SD_CONSTASCII_ACTION( sUNO_View_SnapLinesNotes, "SnapLinesNotes" ); +SD_CONSTASCII_ACTION( sUNO_View_SnapLinesHandout, "SnapLinesHandout" ); +SD_CONSTASCII_ACTION( sUNO_View_RulerIsVisible, "RulerIsVisible" ); +SD_CONSTASCII_ACTION( sUNO_View_PageKind, "PageKind" ); +SD_CONSTASCII_ACTION( sUNO_View_SelectedPage, "SelectedPage" ); +SD_CONSTASCII_ACTION( sUNO_View_IsLayerMode, "IsLayerMode" ); +SD_CONSTASCII_ACTION( sUNO_View_IsQuickEdit, "IsQuickEdit" ); +SD_CONSTASCII_ACTION( sUNO_View_IsBigHandles, "IsBigHandles" ); +SD_CONSTASCII_ACTION( sUNO_View_IsDoubleClickTextEdit, "IsDoubleClickTextEdit" ); +SD_CONSTASCII_ACTION( sUNO_View_IsClickChangeRotation, "IsClickChangeRotation" ); +SD_CONSTASCII_ACTION( sUNO_View_IsDragWithCopy, "IsDragWithCopy" ); +SD_CONSTASCII_ACTION( sUNO_View_SlidesPerRow, "SlidesPerRow" ); +SD_CONSTASCII_ACTION( sUNO_View_DrawMode, "DrawMode" ); +SD_CONSTASCII_ACTION( sUNO_View_PreviewDrawMode, "PreviewDrawMode" ); +SD_CONSTASCII_ACTION( sUNO_View_IsShowPreviewInPageMode, "IsShowPreviewInPageMode" ); +SD_CONSTASCII_ACTION( sUNO_View_IsShowPreviewInMasterPageMode, "IsShowPreviewInMasterPageMode" ); +SD_CONSTASCII_ACTION( sUNO_View_SetShowPreviewInOutlineMode, "SetShowPreviewInOutlineMode" ); +SD_CONSTASCII_ACTION( sUNO_View_EditModeStandard, "EditModeStandard" ); +SD_CONSTASCII_ACTION( sUNO_View_EditModeNotes, "EditModeNotes" ); +SD_CONSTASCII_ACTION( sUNO_View_EditModeHandout, "EditModeHandout" ); +SD_CONSTASCII_ACTION( sUNO_View_VisArea, "VisArea" ); + +SD_CONSTASCII_ACTION( sUNO_View_GridIsVisible, "GridIsVisible" ); +SD_CONSTASCII_ACTION( sUNO_View_GridIsFront, "GridIsFront" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapToGrid, "IsSnapToGrid" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapToPageMargins, "IsSnapToPageMargins" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapToSnapLines, "IsSnapToSnapLines" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapToObjectFrame, "IsSnapToObjectFrame" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapToObjectPoints, "IsSnapToObjectPoints" ); +SD_CONSTASCII_ACTION( sUNO_View_IsSnapLinesVisible, "IsSnapLinesVisible" ); +SD_CONSTASCII_ACTION( sUNO_View_IsDragStripes, "IsDragStripes" ); +SD_CONSTASCII_ACTION( sUNO_View_IsPlusHandlesAlwaysVisible, "IsPlusHandlesAlwaysVisible" ); +SD_CONSTASCII_ACTION( sUNO_View_IsFrameDragSingles, "IsFrameDragSingles" ); +SD_CONSTASCII_ACTION( sUNO_View_IsMarkedHitMovesAlways, "IsMarkedHitMovesAlways" ); +SD_CONSTASCII_ACTION( sUNO_View_EliminatePolyPointLimitAngle, "EliminatePolyPointLimitAngle" ); +SD_CONSTASCII_ACTION( sUNO_View_IsEliminatePolyPoints, "IsEliminatePolyPoints" ); +SD_CONSTASCII_ACTION( sUNO_View_IsLineDraft, "IsLineDraft" ); +SD_CONSTASCII_ACTION( sUNO_View_IsFillDraft, "IsFillDraft" ); +SD_CONSTASCII_ACTION( sUNO_View_IsTextDraft, "IsTextDraft" ); +SD_CONSTASCII_ACTION( sUNO_View_IsGrafDraft, "IsGrafDraft" ); +SD_CONSTASCII_ACTION( sUNO_View_ActiveLayer, "ActiveLayer" ); +SD_CONSTASCII_ACTION( sUNO_View_NoAttribs, "NoAttribs" ); +SD_CONSTASCII_ACTION( sUNO_View_NoColors, "NoColors" ); +SD_CONSTASCII_ACTION( sUNO_View_GridCoarseWidth, "GridCoarseWidth" ); +SD_CONSTASCII_ACTION( sUNO_View_GridCoarseHeight, "GridCoarseHeight" ); +SD_CONSTASCII_ACTION( sUNO_View_GridFineWidth, "GridFineWidth" ); +SD_CONSTASCII_ACTION( sUNO_View_GridFineHeight, "GridFineHeight" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidth, "GridSnapWidth" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapHeight, "GridSnapHeight" ); +SD_CONSTASCII_ACTION( sUNO_View_IsAngleSnapEnabled, "IsAngleSnapEnabled" ); +SD_CONSTASCII_ACTION( sUNO_View_SnapAngle, "SnapAngle" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthXNumerator, "GridSnapWidthXNumerator" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthXDenominator, "GridSnapWidthXDenominator" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthYNumerator, "GridSnapWidthYNumerator" ); +SD_CONSTASCII_ACTION( sUNO_View_GridSnapWidthYDenominator, "GridSnapWidthYDenominator" ); +SD_CONSTASCII_ACTION( sUNO_View_VisibleLayers, "VisibleLayers" ); +SD_CONSTASCII_ACTION( sUNO_View_PrintableLayers, "PrintableLayers" ); +SD_CONSTASCII_ACTION( sUNO_View_LockedLayers, "LockedLayers" ); + +SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaTop, "VisibleAreaTop" ); +SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaLeft, "VisibleAreaLeft" ); +SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaWidth, "VisibleAreaWidth" ); +SD_CONSTASCII_ACTION( sUNO_View_VisibleAreaHeight, "VisibleAreaHeight" ); + +SD_CONSTASCII_ACTION( sUNO_View_ZoomOnPage, "ZoomOnPage" ); +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/unomodel.hxx b/binfilter/bf_sd/source/ui/inc/unomodel.hxx new file mode 100644 index 000000000000..657b0164860c --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/unomodel.hxx @@ -0,0 +1,328 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _UNOMODEL_HXX +#define _UNOMODEL_HXX + +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPageSummarizer.hpp> +#include <com/sun/star/drawing/XDrawPageDuplicator.hpp> +#include <com/sun/star/drawing/XLayerSupplier.hpp> +#include <com/sun/star/drawing/XMasterPagesSupplier.hpp> +#include <com/sun/star/presentation/XPresentationSupplier.hpp> +#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> +#include <com/sun/star/drawing/XLayerManager.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/presentation/XPresentation.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/ucb/XAnyCompareFactory.hpp> +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> +#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp> +#include <com/sun/star/view/XRenderable.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> + +#include <bf_svtools/lstner.hxx> + +#include <bf_sfx2/sfxbasemodel.hxx> +#include <bf_svx/fmdmod.hxx> + +#include <bf_svx/unoipset.hxx> + +#include <comphelper/servicehelper.hxx> +class List; +namespace binfilter { + +class SdDrawDocShell; +class SdDrawDocument; +class SdPage; +class SdXCustomPresentations; + +/*********************************************************************** +* * +***********************************************************************/ +class SdXImpressDocument : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other + public SvxFmMSFactory, + public ::com::sun::star::drawing::XDrawPageDuplicator, + public ::com::sun::star::drawing::XLayerSupplier, + public ::com::sun::star::drawing::XMasterPagesSupplier, + public ::com::sun::star::drawing::XDrawPagesSupplier, + public ::com::sun::star::presentation::XPresentationSupplier, + public ::com::sun::star::presentation::XCustomPresentationSupplier, + public ::com::sun::star::document::XLinkTargetSupplier, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::style::XStyleFamiliesSupplier, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::ucb::XAnyCompareFactory, + public ::com::sun::star::presentation::XHandoutMasterSupplier, + public ::com::sun::star::view::XRenderable +{ + friend class SdDrawPagesAccess; + friend class SdMasterPagesAccess; + friend class SdLayerManager; + +private: + SdDrawDocShell* pDocShell; + SdDrawDocument* pDoc; + + SdPage* InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate = sal_False ) throw(); + + sal_Bool mbImpressDoc; + sal_Bool mbClipBoard; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::drawing::XDrawPages > mxDrawPagesAccess; + ::com::sun::star::uno::WeakReference< ::com::sun::star::drawing::XDrawPages > mxMasterPagesAccess; + ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > mxLayerManager; + ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameContainer > mxCustomPresentationAccess; + ::com::sun::star::uno::WeakReference< ::com::sun::star::presentation::XPresentation > mxPresentation; + ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > mxStyleFamilies; + ::com::sun::star::uno::WeakReference< ::com::sun::star::i18n::XForbiddenCharacters > mxForbidenCharacters; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDashTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxGradientTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxHatchTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxBitmapTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxTransGradientTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxMarkerTable; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDrawingPool; + + SvxItemPropertySet aPropSet; + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; + + void initializeDocument(); +public: + SdXImpressDocument( SdDrawDocShell* pShell ) throw(); + virtual ~SdXImpressDocument() throw(); + + // intern + virtual int operator==( const SdXImpressDocument& rModel ) const { return pDoc == rModel.pDoc; } + virtual int operator!=( const SdXImpressDocument& rModel ) const { return pDoc != rModel.pDoc; } + + SdDrawDocShell* GetDocShell() const { return pDocShell; } + SdDrawDocument* GetDoc() const { return pDoc; } + sal_Bool IsImpressDocument() const { return mbImpressDoc; } + + void SetModified( sal_Bool bModified = sal_True ) throw(); + + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XForbiddenCharacters > getForbiddenCharsTable(); + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + UNO3_GETIMPLEMENTATION_DECL(SdXImpressDocument) + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XModel + virtual void SAL_CALL lockControllers( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unlockControllers( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasControllersLocked( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setViewData( const ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess >& aData ) throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XDrawPageDuplicator + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL duplicate( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) throw(::com::sun::star::uno::RuntimeException); + + // XDrawPagesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > SAL_CALL getDrawPages( ) throw(::com::sun::star::uno::RuntimeException); + + // XMasterPagesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > SAL_CALL getMasterPages( ) throw(::com::sun::star::uno::RuntimeException); + + // XLayerManagerSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLayerManager( ) throw(::com::sun::star::uno::RuntimeException); + + // XCustomPresentationSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getCustomPresentations( ) throw(::com::sun::star::uno::RuntimeException); + + // XHandoutMasterSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getHandoutMasterPage( ) throw (::com::sun::star::uno::RuntimeException); + + // XPresentationSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation > SAL_CALL getPresentation( ) throw(::com::sun::star::uno::RuntimeException); + + // XMultiServiceFactory ( SvxFmMSFactory ) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XLinkTargetSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException); + + // XStyleFamiliesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies( ) throw(::com::sun::star::uno::RuntimeException); + + // XAnyCompareFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + + // XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XPrintable + virtual void SAL_CALL setPrinter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqPrinter ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); +}; +} //namespace binfilter +/*********************************************************************** +* * +***********************************************************************/ + +#include <cppuhelper/implbase3.hxx> +namespace binfilter {//STRIP009 +class SdDrawPagesAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::container::XNameAccess, ::com::sun::star::lang::XServiceInfo > +{ +private: + SdXImpressDocument& rModel; + +public: + SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw(); + virtual ~SdDrawPagesAccess() throw(); + + // XDrawPages + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); +}; +} //namespace binfilter +/*********************************************************************** +* * +***********************************************************************/ + +#include <cppuhelper/implbase2.hxx> +namespace binfilter {//STRIP009 +class SdMasterPagesAccess : public ::cppu::WeakImplHelper2< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::lang::XServiceInfo > +{ +private: + SdXImpressDocument& rModel; + +public: + SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw(); + virtual ~SdMasterPagesAccess() throw(); + + // XDrawPages + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); +}; +} //namespace binfilter +/*********************************************************************** +* * +***********************************************************************/ +#include <cppuhelper/implbase2.hxx> +namespace binfilter {//STRIP009 +class SdDocLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo > +{ +private: + SdXImpressDocument& rModel; + +public: + SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw(); + virtual ~SdDocLinkTargets() throw(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // intern + SdPage* FindPage( const ::rtl::OUString& rName ) const throw(); +}; + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/inc/unoprnms.hxx b/binfilter/bf_sd/source/ui/inc/unoprnms.hxx new file mode 100644 index 000000000000..244a2a8a2a65 --- /dev/null +++ b/binfilter/bf_sd/source/ui/inc/unoprnms.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOPRNMS_HXX +#define _SD_UNOPRNMS_HXX +namespace binfilter { + +#define UNO_NAME_MODEL_LANGUAGE "CharLocale" +#define UNO_NAME_MODEL_TABSTOP "TabStop" + +#define UNO_NAME_PAGE_BACKGROUND "Background" +#define UNO_NAME_PAGE_LEFT "BorderLeft" +#define UNO_NAME_PAGE_RIGHT "BorderRight" +#define UNO_NAME_PAGE_TOP "BorderTop" +#define UNO_NAME_PAGE_BOTTOM "BorderBottom" +#define UNO_NAME_PAGE_CHANGE "Change" +#define UNO_NAME_PAGE_DURATION "Duration" +#define UNO_NAME_PAGE_EFFECT "Effect" +#define UNO_NAME_PAGE_HEIGHT "Height" +#define UNO_NAME_PAGE_LAYOUT "Layout" +#define UNO_NAME_PAGE_NUMBER "Number" +#define UNO_NAME_PAGE_OBJECTS "Objects" +#define UNO_NAME_PAGE_ORIENTATION "Orientation" +#define UNO_NAME_PAGE_SPEED "Speed" +#define UNO_NAME_PAGE_WIDTH "Width" +#define UNO_NAME_PAGE_PREVIEW "Preview" +#define UNO_NAME_PAGE_VISIBLE "Visible" + +#define UNO_NAME_OBJ_BOOKMARK "Bookmark" +#define UNO_NAME_OBJ_DIMCOLOR "DimColor" +#define UNO_NAME_OBJ_DIMHIDE "DimHide" +#define UNO_NAME_OBJ_DIMPREV "DimPrevious" +#define UNO_NAME_OBJ_EFFECT "Effect" +#define UNO_NAME_OBJ_ISEMPTYPRESOBJ "IsEmptyPresentationObject" +#define UNO_NAME_OBJ_ISPRESOBJ "IsPresentationObject" +#define UNO_NAME_OBJ_CLICKACTION "OnClick" +#define UNO_NAME_OBJ_PLAYFULL "PlayFull" +#define UNO_NAME_OBJ_PRESORDER "PresentationOrder" +#define UNO_NAME_OBJ_SOUNDFILE "Sound" +#define UNO_NAME_OBJ_SOUNDON "SoundOn" +#define UNO_NAME_OBJ_SPEED "Speed" +#define UNO_NAME_OBJ_TEXTEFFECT "TextEffect" +#define UNO_NAME_OBJ_BLUESCREEN "TransparentColor" +#define UNO_NAME_OBJ_VERB "Verb" +#define UNO_NAME_OBJ_STYLE "Style" +#define UNO_NAME_OBJ_MASTERDEPENDENT "IsPlaceholderDependent" +#define UNO_NAME_OBJ_ANIMATIONPATH "AnimationPath" + +#define UNO_NAME_LAYER_LOCKED "IsLocked" +#define UNO_NAME_LAYER_PRINTABLE "IsPrintable" +#define UNO_NAME_LAYER_VISIBLE "IsVisible" +#define UNO_NAME_LAYER_NAME "Name" + +#define UNO_NAME_SHOW_ALLOWANIM "AllowAnimations" +#define UNO_NAME_SHOW_CUSTOMSHOW "CustomShow" +#define UNO_NAME_SHOW_FIRSTPAGE "FirstPage" +#define UNO_NAME_SHOW_ONTOP "IsAlwaysOnTop" +#define UNO_NAME_SHOW_AUTOMATIC "IsAutomatic" +#define UNO_NAME_SHOW_ENDLESS "IsEndless" +#define UNO_NAME_SHOW_FULLSCREEN "IsFullScreen" +#define UNO_NAME_SHOW_LIVEMODUS "IsLivePresentation" +#define UNO_NAME_SHOW_MOUSEVISIBLE "IsMouseVisible" +#define UNO_NAME_SHOW_PAGERANGE "PageRange" +#define UNO_NAME_SHOW_PAUSE "Pause" +#define UNO_NAME_SHOW_STARTWITHNAV "StartWithNavigator" +#define UNO_NAME_SHOW_USEPEN "UsePen" + +#define UNO_NAME_SEARCH_BACKWARDS "SearchBackwards" +#define UNO_NAME_SEARCH_CASE "SearchCaseSensitive" +#define UNO_NAME_SEARCH_WORDS "SearchWords" + +#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName" +#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap" + +#define UNO_NAME_STYLE_FAMILY "Family" +} +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/UnoDocumentSettings.hxx b/binfilter/bf_sd/source/ui/unoidl/UnoDocumentSettings.hxx new file mode 100644 index 000000000000..7e6aa6a9f035 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/UnoDocumentSettings.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SD_UNODOCUMENTSETTINGS_HXX_ +#define _SD_UNODOCUMENTSETTINGS_HXX_ + +#include <com/sun/star/frame/XModel.hpp> +namespace binfilter { + +class SdXImpressDocument; + +namespace sd +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pDoc ) throw(); +} + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/makefile.mk b/binfilter/bf_sd/source/ui/unoidl/makefile.mk new file mode 100644 index 000000000000..32304f42d7a7 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sd_sd + +PRJNAME=binfilter +TARGET=sd_unoidl + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +.IF "$(COM)"=="GCC" +NOOPTFILES= $(SLO)$/sd_unowcntr.obj +.ENDIF + +SLOFILES = \ + $(SLO)$/sd_unopool.obj \ + $(SLO)$/sd_UnoDocumentSettings.obj \ + $(SLO)$/sd_facreg.obj \ + $(SLO)$/sd_unomodel.obj \ + $(SLO)$/sd_unopage.obj \ + $(SLO)$/sd_unolayer.obj \ + $(SLO)$/sd_unopres.obj \ + $(SLO)$/sd_unocpres.obj \ + $(SLO)$/sd_unoobj.obj \ + $(SLO)$/sd_unowcntr.obj \ + $(SLO)$/sd_unogsfm.obj \ + $(SLO)$/sd_unogstyl.obj \ + $(SLO)$/sd_unopsfm.obj \ + $(SLO)$/sd_unopstyl.obj \ + $(SLO)$/sd_unokywds.obj \ + $(SLO)$/sd_unostyls.obj \ + $(SLO)$/sd_unopback.obj \ + $(SLO)$/sd_unodoc.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_UnoDocumentSettings.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_UnoDocumentSettings.cxx new file mode 100644 index 000000000000..a8c0b2ef020d --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_UnoDocumentSettings.cxx @@ -0,0 +1,1080 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <vector> +#include <comphelper/propertysethelper.hxx> +#include <comphelper/propertysetinfo.hxx> +#include <bf_sfx2/docinf.hxx> +#include <tools/urlobj.hxx> +#include <bf_svx/xtable.hxx> +#include <osl/diagnose.h> + +#include "drawdoc.hxx" +#include "bf_sd/docshell.hxx" +#include "unomodel.hxx" + +#include "optsitem.hxx" +#include <bf_sfx2/printer.hxx> +#include "sdattr.hxx" +#include "bf_sd/frmview.hxx" +#include <sdoutl.hxx> +#include <bf_svx/editstat.hxx> +#include <bf_svx/unoapi.hxx> + +namespace binfilter { + +#define MAP_LEN(x) x, sizeof(x)-1 + +using namespace ::comphelper; +using namespace ::osl; +using namespace ::cppu; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::i18n; + +using rtl::OUString; + +namespace sd +{ + class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >, + public comphelper::PropertySetHelper + { + public: + DocumentSettings( SdXImpressDocument* pModel ); + virtual ~DocumentSettings() throw(); + + // XInterface + virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); + + protected: + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); + + private: + Reference< XModel > mxModel; + SdXImpressDocument* mpModel; + }; + + Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel ) + throw( Exception ) + { + DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" ); + return (XWeak*)new DocumentSettings( pModel ); + } + +enum SdDocumentSettingsPropertyHandles +{ + HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM, + HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME, + HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT, + HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL, + HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT, + HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE, + HANDLE_PRINTER_INDEPENDENT_LAYOUT +}; + +#define MID_PRINTER 1 + + PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw ) + { + static PropertyMapEntry aImpressSettingsInfoMap[] = + { + { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, MID_PRINTER }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + static PropertyMapEntry aDrawSettingsInfoMap[] = + { + { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int16*)0), 0, 0 }, + { MAP_LEN("ScaleNumerator"), HANDLE_SCALE_NUM, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("ScaleDenominator"), HANDLE_SCALE_DOM, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + static PropertyMapEntry aCommonSettingsInfoMap[] = + { + { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("PrinterName"), HANDLE_PRINTERNAME, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("PrinterSetup"), HANDLE_PRINTERJOB, &::getCppuType((const uno::Sequence < sal_Int8 > *)0), 0, MID_PRINTER }, + + { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, MID_PRINTER }, + { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, MID_PRINTER }, + { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + + { MAP_LEN("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS, &::getCppuType((const Reference< XForbiddenCharacters >*)0), 0, 0 }, + { MAP_LEN("ApplyUserData"), HANDLE_APPLYUSERDATA, &::getBooleanCppuType(), 0, 0 }, + + { MAP_LEN("PageNumberFormat"), HANDLE_PAGENUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS, &::getCppuType((sal_Int16*)0), 0, 0 }, + { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap ); + pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap ); + + return pInfo; + } +} + +using namespace ::binfilter::sd; + +DocumentSettings::DocumentSettings( SdXImpressDocument* pModel ) +: PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ), + mxModel( pModel ), + mpModel( pModel ) +{ +} + +DocumentSettings::~DocumentSettings() throw() +{ +} + +void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) +{ + ::SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + SdDrawDocShell* pDocSh = mpModel->GetDocShell(); + if( NULL == pDoc || NULL == pDocSh ) + throw UnknownPropertyException(); + + sal_Bool bOk, bChanged = sal_False, bValue; + + SfxPrinter* pPrinter = NULL; + SdOptionsPrintItem* pPrinterOptions = NULL; + + for( ; *ppEntries; ppEntries++, pValues++ ) + { + bOk = sal_False; + if( ((*ppEntries)->mnMemberId == MID_PRINTER) && (pPrinter == NULL) ) + { + pPrinter = pDocSh->GetPrinter( sal_True ); + if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) != SFX_ITEM_SET) + { + DBG_ERROR( "could not get printer options!" ); + pPrinter = NULL; + pPrinterOptions = NULL; + continue; + } + } + + switch( (*ppEntries)->mnHandle ) + { + case HANDLE_COLORTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pColTab->SetName( aURL.getName() ); + if( pColTab->Load() ) + { + pDoc->SetColorTable( pColTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_DASHTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XDashList* pDashTab = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pDashTab->SetName( aURL.getName() ); + if( pDashTab->Load() ) + { + pDoc->SetDashList( pDashTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_LINEENDTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XLineEndList* pTab = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetLineEndList( pTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_HATCHTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XHatchList* pTab = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetHatchList( pTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_GRADIENTTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XGradientList* pTab = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetGradientList( pTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_BITMAPTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XBitmapList* pTab = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetBitmapList( pTab ); + bOk = sal_True; + bChanged = sal_True; + } + } + } + break; + case HANDLE_FORBIDDENCHARS: + { + bOk = sal_True; + } + break; + case HANDLE_APPLYUSERDATA: + { + sal_Bool bApplyUserData; + if( *pValues >>= bApplyUserData ) + { + SfxDocumentInfo& rInfo = pDocSh->GetDocInfo(); + if( rInfo.IsUseUserData() != bApplyUserData ) + { + rInfo.SetUseUserData( bApplyUserData ); + bChanged = sal_True; + } + bOk = sal_True; + } + } + break; + case HANDLE_PRINTDRAWING: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetDraw( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTNOTES: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetNotes( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTHANDOUT: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetHandout( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTOUTLINE: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetOutline( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTPAGENAME: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetPagename( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTDATE: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetDate( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTTIME: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetTime( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTHIDENPAGES: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetHiddenPages( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTFITPAGE: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetPagesize( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTTILEPAGE: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetPagetile( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTBOOKLET: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetBooklet( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTBOOKLETFRONT: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetFrontPage( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTBOOKLETBACK: + if( *pValues >>= bValue ) + { + pPrinterOptions->SetBackPage( bValue ); + bOk = sal_True; + } + break; + case HANDLE_PRINTQUALITY: + { + sal_Int32 nValue; + if( *pValues >>= nValue ) + { + pPrinterOptions->SetOutputQuality( (sal_uInt16)nValue ); + bOk = sal_True; + } + } + break; + case HANDLE_MEASUREUNIT: + { + sal_Int16 nValue; + if( *pValues >>= nValue ) + { + short nFieldUnit; + if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) ) + { + pDoc->SetUIUnit((FieldUnit)nFieldUnit ); + bOk = sal_True; + } + } + } + break; + case HANDLE_SCALE_NUM: + { + sal_Int32 nValue; + if( *pValues >>= nValue ) + { + Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() ); + pDoc->SetUIScale( aFract ); + bOk = sal_True; + bChanged = sal_True; + } + } + break; + case HANDLE_SCALE_DOM: + { + sal_Int32 nValue; + if( *pValues >>= nValue ) + { + Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue ); + pDoc->SetUIScale( aFract ); + bOk = sal_True; + bChanged = sal_True; + } + } + break; + + case HANDLE_TABSTOP: + { + sal_Int32 nValue; + if( (*pValues >>= nValue) && (nValue >= 0) ) + { + pDoc->SetDefaultTabulator((sal_uInt16)nValue); + bOk = sal_True; + bChanged = sal_True; + } + } + break; + case HANDLE_PAGENUMFMT: + { + sal_Int32 nValue; + if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) ) + { + pDoc->SetPageNumType((SvxNumType)nValue); + bOk = sal_True; + bChanged = sal_True; + } + } + break; + case HANDLE_PRINTERNAME: + { + OUString aPrinterName; + if( *pValues >>= aPrinterName ) + { + bOk = sal_True; + SfxPrinter *pPrinter = pDocSh->GetPrinter( sal_True ); + if (pPrinter) + { + SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), aPrinterName ); + pDocSh->SetPrinter( pNewPrinter ); + } + } + } + break; + case HANDLE_PRINTERJOB: + { + Sequence < sal_Int8 > aSequence; + if ( *pValues >>= aSequence ) + { + bOk = sal_True; + sal_uInt32 nSize = aSequence.getLength(); + SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ ); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + SfxItemSet* pItemSet; + + if( pPrinter ) + { + pItemSet = pPrinter->GetOptions().Clone(); + } + else + { + pItemSet = new SfxItemSet(pDoc->GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, + 0 ); + } + + pPrinter = SfxPrinter::Create ( aStream, pItemSet ); + + MapMode aMM (pPrinter->GetMapMode()); + aMM.SetMapUnit(MAP_100TH_MM); + pPrinter->SetMapMode(aMM); + + pDocSh->SetPrinter( pPrinter ); + + pPrinter = NULL; + } + } + break; + + case HANDLE_PARAGRAPHSUMMATION : + { + sal_Bool bIsSummationOfParagraphs; + if ( *pValues >>= bIsSummationOfParagraphs ) + { + bOk = sal_True; + bChanged = sal_True; + if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ) + { + sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0; + sal_uInt32 nCntrl; + + pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs ); + SdDrawDocument* pDocument = pDocSh->GetDoc(); + SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE ); + nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; + rOutl.SetControlWord( nCntrl | nSum ); + SdOutliner* pOutl = pDocument->GetOutliner( FALSE ); + if( pOutl ) + { + nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; + pOutl->SetControlWord( nCntrl | nSum ); + } + pOutl = pDocument->GetInternalOutliner( FALSE ); + if( pOutl ) + { + nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; + pOutl->SetControlWord( nCntrl | nSum ); + } + } + } + } + break; + + case HANDLE_CHARCOMPRESS: + { + sal_Int16 nCharCompressType; + if( *pValues >>= nCharCompressType ) + { + bOk = sal_True; + + pDoc->SetCharCompressType( (UINT16)nCharCompressType ); + SdDrawDocument* pDocument = pDocSh->GetDoc(); + SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE ); + rOutl.SetAsianCompressionMode( (UINT16)nCharCompressType ); + SdOutliner* pOutl = pDocument->GetOutliner( FALSE ); + if( pOutl ) + { + pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType ); + } + pOutl = pDocument->GetInternalOutliner( FALSE ); + if( pOutl ) + { + pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType ); + } + } + break; + + } + case HANDLE_ASIANPUNCT: + { + sal_Bool bAsianPunct; + if( *pValues >>= bAsianPunct ) + { + bOk = sal_True; + + pDoc->SetKernAsianPunctuation( bAsianPunct ); + SdDrawDocument* pDocument = pDocSh->GetDoc(); + SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE ); + rOutl.SetKernAsianPunctuation( bAsianPunct ); + SdOutliner* pOutl = pDocument->GetOutliner( FALSE ); + if( pOutl ) + { + pOutl->SetKernAsianPunctuation( bAsianPunct ); + } + pOutl = pDocument->GetInternalOutliner( FALSE ); + if( pOutl ) + { + pOutl->SetKernAsianPunctuation( bAsianPunct ); + } + } + break; + + } + case HANDLE_UPDATEFROMTEMPLATE: + { + sal_Bool bValue; + if( *pValues >>= bValue ) + { + SfxDocumentInfo& rInfo = pDocSh->GetDocInfo(); + rInfo.SetQueryLoadTemplate( bValue ); + bOk = sal_True; + } + } + break; + + case HANDLE_PRINTER_INDEPENDENT_LAYOUT: + { + // Just propagate the new printer independent layout mode to + // the document and determine it really differs from the old + // one. + sal_Int16 nOldValue = pDoc->GetPrinterIndependentLayout (); + sal_Int16 nValue; + if (*pValues >>= nValue) + { + pDoc->SetPrinterIndependentLayout (nValue); + bChanged = (nValue != nOldValue); + bOk = sal_True; + } + } + break; + + default: + throw UnknownPropertyException(); + + } + + if( !bOk ) + throw IllegalArgumentException(); + } + + if( pPrinter && pPrinterOptions ) + { + SfxItemSet aNewOptions( pPrinter->GetOptions() ); + SdOptionsPrintItem aOpts( *pPrinterOptions ); + aNewOptions.Put( aOpts ); + pPrinter->SetOptions( aNewOptions ); + + SdOptions* pOptions = SD_MOD()->GetSdOptions( pDoc->GetDocumentType() ); + pOptions->SetPrinterOptions( &aOpts ); + } + + if( bChanged ) + mpModel->SetModified( sal_True ); +} + +void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException ) +{ + ::SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + SdDrawDocShell* pDocSh = mpModel->GetDocShell(); + if( NULL == pDoc || NULL == pDocSh ) + throw UnknownPropertyException(); + + SfxPrinter* pPrinter = NULL; + SdOptionsPrintItem* pPrinterOptions = NULL; + + for( ; *ppEntries; ppEntries++, pValue++ ) + { + if( (*ppEntries)->mnMemberId == MID_PRINTER && pPrinter == NULL ) + { + pPrinter = pDocSh->GetPrinter( sal_True ); + if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) != SFX_ITEM_SET) + { + DBG_ERROR( "could not get printer options!" ); + pPrinter = NULL; + pPrinterOptions = NULL; + continue; + } + } + + switch( (*ppEntries)->mnHandle ) + { + case HANDLE_COLORTABLEURL: + { + INetURLObject aPathURL( pDoc->GetColorTable()->GetPath() ); + aPathURL.insertName( pDoc->GetColorTable()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_DASHTABLEURL: + { + INetURLObject aPathURL( pDoc->GetDashList()->GetPath() ); + aPathURL.insertName( pDoc->GetDashList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_LINEENDTABLEURL: + { + INetURLObject aPathURL( pDoc->GetLineEndList()->GetPath() ); + aPathURL.insertName( pDoc->GetLineEndList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_HATCHTABLEURL: + { + INetURLObject aPathURL( pDoc->GetHatchList()->GetPath() ); + aPathURL.insertName( pDoc->GetHatchList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_GRADIENTTABLEURL: + { + INetURLObject aPathURL( pDoc->GetGradientList()->GetPath() ); + aPathURL.insertName( pDoc->GetGradientList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_BITMAPTABLEURL: + { + INetURLObject aPathURL( pDoc->GetBitmapList()->GetPath() ); + aPathURL.insertName( pDoc->GetBitmapList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + *pValue <<= aPath; + } + break; + case HANDLE_FORBIDDENCHARS: + *pValue <<= mpModel->getForbiddenCharsTable(); + break; + + case HANDLE_APPLYUSERDATA: + *pValue <<= (sal_Bool)pDocSh->GetDocInfo().IsUseUserData(); + break; + + case HANDLE_PRINTDRAWING: + *pValue <<= (sal_Bool)pPrinterOptions->IsDraw(); + break; + case HANDLE_PRINTNOTES: + *pValue <<= (sal_Bool)pPrinterOptions->IsNotes(); + break; + case HANDLE_PRINTHANDOUT: + *pValue <<= (sal_Bool)pPrinterOptions->IsHandout(); + break; + case HANDLE_PRINTOUTLINE: + *pValue <<= (sal_Bool)pPrinterOptions->IsOutline(); + break; + case HANDLE_PRINTPAGENAME: + *pValue <<= (sal_Bool)pPrinterOptions->IsPagename(); + break; + case HANDLE_PRINTDATE: + *pValue <<= (sal_Bool)pPrinterOptions->IsDate(); + break; + case HANDLE_PRINTTIME: + *pValue <<= (sal_Bool)pPrinterOptions->IsTime(); + break; + case HANDLE_PRINTHIDENPAGES: + *pValue <<= (sal_Bool)pPrinterOptions->IsHiddenPages(); + break; + case HANDLE_PRINTFITPAGE: + *pValue <<= (sal_Bool)pPrinterOptions->IsPagesize(); + break; + case HANDLE_PRINTTILEPAGE: + *pValue <<= (sal_Bool)pPrinterOptions->IsPagetile(); + break; + case HANDLE_PRINTBOOKLET: + *pValue <<= (sal_Bool)pPrinterOptions->IsBooklet(); + break; + case HANDLE_PRINTBOOKLETFRONT: + *pValue <<= (sal_Bool)pPrinterOptions->IsFrontPage(); + break; + case HANDLE_PRINTBOOKLETBACK: + *pValue <<= (sal_Bool)pPrinterOptions->IsBackPage(); + break; + case HANDLE_PRINTQUALITY: + *pValue <<= (sal_Int32)pPrinterOptions->GetOutputQuality(); + break; + case HANDLE_MEASUREUNIT: + { + sal_Int16 nMeasure; + SvxFieldUnitToMeasureUnit( pDoc->GetUIUnit(), nMeasure ); + *pValue <<= nMeasure; + } + break; + case HANDLE_SCALE_NUM: + *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator(); + break; + case HANDLE_SCALE_DOM: + *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator(); + break; + case HANDLE_TABSTOP: + *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator(); + break; + case HANDLE_PAGENUMFMT: + *pValue <<= (sal_Int32)pDoc->GetPageNumType(); + break; + case HANDLE_PRINTERNAME: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter( sal_False ); + *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); + } + break; + case HANDLE_PRINTERJOB: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter( sal_False ); + if (pPrinter) + { + SvMemoryStream aStream; + pPrinter->Store( aStream ); + aStream.Seek ( STREAM_SEEK_TO_END ); + sal_uInt32 nSize = aStream.Tell(); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + Sequence < sal_Int8 > aSequence ( nSize ); + memcpy ( aSequence.getArray(), aStream.GetData(), nSize ); + *pValue <<= aSequence; + } + } + break; + + case HANDLE_PARAGRAPHSUMMATION : + { + sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs(); + *pValue <<= bIsSummationOfParagraphs; + } + break; + + case HANDLE_CHARCOMPRESS: + { + *pValue <<= (sal_Int16)pDoc->GetCharCompressType(); + break; + } + + case HANDLE_ASIANPUNCT: + { + *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation(); + break; + } + + case HANDLE_UPDATEFROMTEMPLATE: + { + SfxDocumentInfo& rInfo = pDocSh->GetDocInfo(); + *pValue <<= (sal_Bool)rInfo.IsQueryLoadTemplate(); + } + break; + + case HANDLE_PRINTER_INDEPENDENT_LAYOUT: + { + sal_Int16 nPrinterIndependentLayout = pDoc->GetPrinterIndependentLayout(); + *pValue <<= nPrinterIndependentLayout; + } + break; + + default: + throw UnknownPropertyException(); + } + } +} + +// XInterface +Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException) +{ + return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType ); +} + +void SAL_CALL DocumentSettings::acquire( ) throw () +{ + WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire(); +} + +void SAL_CALL DocumentSettings::release( ) throw () +{ + WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release(); +} + + +// XPropertySet +Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) throw(RuntimeException) +{ + return PropertySetHelper::getPropertySetInfo(); +} + +void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + return PropertySetHelper::getPropertyValue( PropertyName ); +} + +void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener ); +} + +void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener ); +} + +void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::addVetoableChangeListener( PropertyName, aListener ); +} + +void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener ); +} + +// XMultiPropertySet +void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::setPropertyValues( aPropertyNames, aValues ); +} + +Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException) +{ + return PropertySetHelper::getPropertyValues( aPropertyNames ); +} + +void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener ); +} + +void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::removePropertiesChangeListener( xListener ); +} + +void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener ); +} + +// XServiceInfo +OUString SAL_CALL DocumentSettings::getImplementationName( ) + throw(RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings")); +} + +sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName ) + throw(RuntimeException) +{ + const Sequence< OUString > aSeq( getSupportedServiceNames() ); + sal_Int32 nCount = aSeq.getLength(); + const OUString* pServices = aSeq.getConstArray(); + while( nCount-- ) + { + if( *pServices++ == ServiceName ) + return sal_True; + } + + return sal_True; +} + +Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( ) + throw(RuntimeException) +{ + Sequence< OUString > aSeq( 2 ); + aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") ); + if( mpModel->IsImpressDocument() ) + { + aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings") ); + } + else + { + aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings") ); + } + + return aSeq; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_facreg.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_facreg.cxx new file mode 100644 index 000000000000..e1c8398e42c4 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_facreg.cxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <string.h> + + +#include <osl/diagnose.h> + +#include <cppuhelper/factory.hxx> +#include <uno/lbnames.h> +namespace binfilter { + +using namespace rtl; +using namespace ::com::sun::star; + +extern uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory ); +extern OUString SdDrawingDocument_getImplementationName() throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException ); + +extern uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory ); +extern OUString SdPresentationDocument_getImplementationName() throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException ); + + +#ifdef __cplusplus +extern "C" +{ +#endif + +void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +void SAL_CALL writeInfo( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const uno::Sequence< OUString >& rServices ) +{ + uno::Reference< registry::XRegistryKey > xNewKey( + pRegistryKey->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); + + for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) + xNewKey->createKey( rServices.getConstArray()[i]); +} + +sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) +{ + if( pRegistryKey ) + { + try + { + registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey ); + + writeInfo( pKey, SdDrawingDocument_getImplementationName(), SdDrawingDocument_getSupportedServiceNames() ); + writeInfo( pKey, SdPresentationDocument_getImplementationName(), SdPresentationDocument_getSupportedServiceNames() ); + } + catch (registry::InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_True; +} + +void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + if( pServiceManager ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) ); + + uno::Reference< lang::XSingleServiceFactory > xFactory; + + const sal_Int32 nImplNameLen = strlen( pImplName ); + if(0)//STRIP001 if( SdHtmlOptionsDialog_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + } + else if( SdDrawingDocument_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + SdDrawingDocument_getImplementationName(), + SdDrawingDocument_createInstance, + SdDrawingDocument_getSupportedServiceNames() ); + } + else if( SdPresentationDocument_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + SdPresentationDocument_getImplementationName(), + SdPresentationDocument_createInstance, + SdPresentationDocument_getSupportedServiceNames() ); + } + + + if( xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unocpres.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unocpres.cxx new file mode 100644 index 000000000000..0629501cf9ab --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unocpres.cxx @@ -0,0 +1,469 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> +#include <bf_svx/svdpage.hxx> + +#include "unohelp.hxx" +#include "unocpres.hxx" +#include "cusshow.hxx" +#include "unopage.hxx" + +#include <bf_svx/unoprov.hxx> + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + + +uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow ) +{ + return (cppu::OWeakObject*)new SdXCustomPresentation( pShow, NULL ); +} + +SdXCustomPresentation::SdXCustomPresentation() throw() +: mpSdCustomShow(NULL), mpModel(NULL), + aDisposeListeners( aDisposeContainerMutex ), + bDisposing( sal_False ) +{ +} + +SdXCustomPresentation::SdXCustomPresentation( SdCustomShow* pShow, SdXImpressDocument* pMyModel) throw() +: mpSdCustomShow(pShow), mpModel(pMyModel), + aDisposeListeners( aDisposeContainerMutex ), + bDisposing( sal_False ) +{ +} + +SdXCustomPresentation::~SdXCustomPresentation() throw() +{ +} + +UNO3_GETIMPLEMENTATION_IMPL( SdXCustomPresentation ); + +// XServiceInfo +OUString SAL_CALL SdXCustomPresentation::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentation") ); +} + +sal_Bool SAL_CALL SdXCustomPresentation::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdXCustomPresentation::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentation") ); + uno::Sequence< OUString > aSeq( &aSN, 1 ); + return aSeq; +} + +// XIndexContainer +void SAL_CALL SdXCustomPresentation::insertByIndex( sal_Int32 Index, const uno::Any& Element ) + throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( Index < 0 || Index > (sal_Int32)( mpSdCustomShow ? mpSdCustomShow->Count() : 0 ) ) + throw lang::IndexOutOfBoundsException(); + + uno::Reference< drawing::XDrawPage > xPage; + Element >>= xPage; + + if(!xPage.is()) + throw lang::IllegalArgumentException(); + + SdDrawPage* pPage = SdDrawPage::getImplementation( xPage ); + + if(pPage) + { + if( NULL == mpModel ) + mpModel = pPage->GetModel(); + + if( NULL != mpModel && NULL == mpSdCustomShow && mpModel->GetDoc() ) + mpSdCustomShow = new SdCustomShow( mpModel->GetDoc() ); + + mpSdCustomShow->Insert(pPage->GetSdrPage(), Index); + } + + if( mpModel ) + mpModel->SetModified(); +} + +void SAL_CALL SdXCustomPresentation::removeByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(mpSdCustomShow) + { + uno::Reference< drawing::XDrawPage > xPage; + getByIndex( Index ) >>= xPage; + + if( xPage.is() ) + { + SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage ); + if(pPage) + mpSdCustomShow->Remove(pPage->GetSdrPage()); + } + } + + if( mpModel ) + mpModel->SetModified(); +} + +// XIndexReplace +void SAL_CALL SdXCustomPresentation::replaceByIndex( sal_Int32 Index, const uno::Any& Element ) + throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + removeByIndex( Index ); + insertByIndex( Index, Element ); +} + +// XElementAccess +uno::Type SAL_CALL SdXCustomPresentation::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( drawing::XDrawPage ); +} + +sal_Bool SAL_CALL SdXCustomPresentation::hasElements() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return getCount() > 0; +} + +// XIndexAccess +sal_Int32 SAL_CALL SdXCustomPresentation::getCount() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return mpSdCustomShow?mpSdCustomShow->Count():0; +} + +uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( Index < 0 || Index >= (sal_Int32)mpSdCustomShow->Count() ) + throw lang::IndexOutOfBoundsException(); + + uno::Any aAny; + if(mpSdCustomShow ) + { + SdrPage* pPage = (SdrPage*)mpSdCustomShow->GetObject(Index); + + if( pPage ) + { + uno::Reference< drawing::XDrawPage > xRef( pPage->getUnoPage(), uno::UNO_QUERY ); + aAny <<= xRef; + } + } + + return aAny; +} + +// XNamed +OUString SAL_CALL SdXCustomPresentation::getName() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(mpSdCustomShow) + return mpSdCustomShow->GetName(); + + return OUString(); +} + +void SAL_CALL SdXCustomPresentation::setName( const OUString& aName ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(mpSdCustomShow) + mpSdCustomShow->SetName( aName ); +} + +// XComponent +void SAL_CALL SdXCustomPresentation::dispose() throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( bDisposing ) + return; // catched a recursion + + bDisposing = sal_True; + + uno::Reference< uno::XInterface > xSource( (cppu::OWeakObject*)this ); + + lang::EventObject aEvt; + aEvt.Source = xSource; + aDisposeListeners.disposeAndClear(aEvt); + + mpSdCustomShow = NULL; +} + +//---------------------------------------------------------------------- +void SAL_CALL SdXCustomPresentation::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw(uno::RuntimeException) +{ + aDisposeListeners.addInterface(xListener); +} + +//---------------------------------------------------------------------- +void SAL_CALL SdXCustomPresentation::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException) +{ + aDisposeListeners.removeInterface(aListener); +} + +/*===========================================================================* + * class SdXCustomPresentationAccess : public XCustomPresentationAccess, * + * public UsrObject * + *===========================================================================*/ + +SdXCustomPresentationAccess::SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw() +: mrModel(rMyModel) +{ +} + +SdXCustomPresentationAccess::~SdXCustomPresentationAccess() throw() +{ +} + +// XServiceInfo +OUString SAL_CALL SdXCustomPresentationAccess::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentationAccess") ); +} + +sal_Bool SAL_CALL SdXCustomPresentationAccess::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + const OUString aNS( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentationAccess") ); + uno::Sequence< OUString > aSeq( &aNS, 1 ); + return aSeq; +} + +// XSingleServiceFactory +uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstance() + throw(uno::Exception, uno::RuntimeException) +{ + uno::Reference< uno::XInterface > xRef( (::cppu::OWeakObject*)new SdXCustomPresentation() ); + return xRef; +} + +uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstanceWithArguments( const uno::Sequence< uno::Any >& aArguments ) + throw(uno::Exception, uno::RuntimeException) +{ + return createInstance(); +} + +// XNameContainer +void SAL_CALL SdXCustomPresentationAccess::insertByName( const OUString& aName, const uno::Any& aElement ) + throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + // get the documents custom show list + List* pList = NULL; + if(mrModel.GetDoc()) + pList = mrModel.GetDoc()->GetCustomShowList(sal_True); + + // no list, no cookies + if( NULL == pList) + throw uno::RuntimeException(); + + // do we have an container::XIndexContainer? + SdXCustomPresentation* pXShow = NULL; + + uno::Reference< container::XIndexContainer > xContainer; + if( (aElement >>= xContainer) && xContainer.is() ) + pXShow = SdXCustomPresentation::getImplementation(xContainer); + + if( NULL == pXShow ) + throw lang::IllegalArgumentException(); + + // get the internal custom show from the api wrapper + SdCustomShow* pShow = pXShow->GetSdCustomShow(); + if( NULL == pShow ) + { + pShow = new SdCustomShow( mrModel.GetDoc(), xContainer ); + pXShow->SetSdCustomShow( pShow ); + } + else + { + if( NULL == pXShow->GetModel() || *pXShow->GetModel() != mrModel ) + throw lang::IllegalArgumentException(); + } + + // give it a name + pShow->SetName( aName); + + // check if this or another customshow with the same name already exists + for( SdCustomShow* pCompare = (SdCustomShow*)pList->First(); + pCompare; + pCompare = (SdCustomShow*)pList->Next() ) + { + if( pCompare == pShow || pCompare->GetName() == pShow->GetName() ) + throw container::ElementExistException(); + } + + pList->Insert(pShow); + + mrModel.SetModified(); +} + +void SAL_CALL SdXCustomPresentationAccess::removeByName( const OUString& Name ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdCustomShow* pShow = getSdCustomShow(Name); + + List* pList = GetCustomShowList(); + if(pList && pShow) + delete (SdCustomShow*)pList->Remove( pShow ); + else + throw container::NoSuchElementException(); + + mrModel.SetModified(); +} + +// XNameReplace +void SAL_CALL SdXCustomPresentationAccess::replaceByName( const OUString& aName, const uno::Any& aElement ) + throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + removeByName( aName ); + insertByName( aName, aElement ); +} + +// XNameAccess +uno::Any SAL_CALL SdXCustomPresentationAccess::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + + SdCustomShow* pShow = getSdCustomShow(aName); + if(pShow) + { + uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY ); + aAny <<= xRef; + } + else + { + throw container::NoSuchElementException(); + } + + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getElementNames() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + List* pList = GetCustomShowList(); + const sal_uInt32 nCount = pList?pList->Count():0; + + uno::Sequence< OUString > aSequence( nCount ); + OUString* pStringList = aSequence.getArray(); + + sal_uInt32 nIdx = 0; + while( nIdx < nCount ) + { + const SdCustomShow* pShow = (const SdCustomShow*)pList->GetObject(nIdx); + pStringList[nIdx] = pShow->GetName(); + nIdx++; + } + + return aSequence; +} + + +sal_Bool SAL_CALL SdXCustomPresentationAccess::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return getSdCustomShow(aName) != NULL; +} + +// XElementAccess +uno::Type SAL_CALL SdXCustomPresentationAccess::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( container::XIndexContainer ); +} + +sal_Bool SAL_CALL SdXCustomPresentationAccess::hasElements() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + List* pList = GetCustomShowList(); + return pList && pList->Count() > 0; +} + +SdCustomShow * SdXCustomPresentationAccess::getSdCustomShow( const OUString& Name ) const throw() +{ + sal_uInt32 nIdx = 0; + + List* pList = GetCustomShowList(); + const sal_uInt32 nCount = pList?pList->Count():0; + + const String aName( Name ); + + while( nIdx < nCount ) + { + SdCustomShow* pShow = (SdCustomShow*)pList->GetObject(nIdx); + if( pShow->GetName() == aName ) + return pShow; + nIdx++; + } + return NULL; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unodoc.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unodoc.cxx new file mode 100644 index 000000000000..67c0821aa52f --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unodoc.cxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// System - Includes ----------------------------------------------------- + +#include <bf_sfx2/docfac.hxx> + + +#include "sdmod.hxx" + +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> +namespace binfilter { + +using namespace ::com::sun::star; + +// com.sun.star.comp.Draw.DrawingDocument + +::rtl::OUString SAL_CALL SdDrawingDocument_getImplementationName() throw( uno::RuntimeException ) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingDocument" ) ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException ) +{ + // useable for component registration only! + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument")); + + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) +{ + SolarMutexGuard aGuard; + + // to create the service the SW_MOD should be already initialized + DBG_ASSERT( SD_MOD(), "No StarDraw module!" ); + + if ( SD_MOD() ) + { + ::rtl::OUString aFactoryURL( RTL_CONSTASCII_USTRINGPARAM ( "private:factory/sdraw" ) ); + const SfxObjectFactory* pFactory = SfxObjectFactory::GetFactory( aFactoryURL ); + if ( pFactory ) + { + SfxObjectShell* pShell = pFactory->CreateObject(); + if( pShell ) + return uno::Reference< uno::XInterface >( pShell->GetModel() ); + } + } + + return uno::Reference< uno::XInterface >(); +} + +// com.sun.star.comp.Draw.PresentationDocument + +::rtl::OUString SAL_CALL SdPresentationDocument_getImplementationName() throw( uno::RuntimeException ) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.PresentationDocument" ) ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException ) +{ + // useable for component registration only! + uno::Sequence< ::rtl::OUString > aSeq( 1 ); + aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); + + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) +{ + SolarMutexGuard aGuard; + + // to create the service the SW_MOD should be already initialized + DBG_ASSERT( SD_MOD(), "No StarDraw module!" ); + + if ( SD_MOD() ) + { + ::rtl::OUString aFactoryURL( RTL_CONSTASCII_USTRINGPARAM ( "private:factory/simpress" ) ); + const SfxObjectFactory* pFactory = SfxObjectFactory::GetFactory( aFactoryURL ); + if ( pFactory ) + { + SfxObjectShell* pShell = pFactory->CreateObject(); + if( pShell ) + return uno::Reference< uno::XInterface >( pShell->GetModel() ); + } + } + + return uno::Reference< uno::XInterface >(); +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unogsfm.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unogsfm.cxx new file mode 100644 index 000000000000..d986b8952bbf --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unogsfm.cxx @@ -0,0 +1,490 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + +#include <osl/mutex.hxx> + +#include <vcl/svapp.hxx> + +#include <bf_svtools/style.hxx> + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/unoprov.hxx> + +#include "unohelp.hxx" +#include "unokywds.hxx" +#include "unowcntr.hxx" +#include "unogsfm.hxx" +#include "unogstyl.hxx" +#include "drawdoc.hxx" +#include "glob.hrc" +#include "helpids.h" +#include "sdresid.hxx" +namespace binfilter { + + +using namespace ::rtl; +using namespace ::com::sun::star; + +UNO3_GETIMPLEMENTATION_IMPL( SdUnoGraphicStyleFamily ); + +SdUnoGraphicStyleFamily::SdUnoGraphicStyleFamily( SdXImpressDocument* pModel ) throw() +: mxModel( pModel ), mpModel( pModel ) +{ + mpStyles = new SvUnoWeakContainer; +} + +SdUnoGraphicStyleFamily::~SdUnoGraphicStyleFamily() throw() +{ + delete mpStyles; +} + +struct SdUnoGStyleNameMapper_s +{ + char* mpName; + sal_uInt16 mnResId; + sal_uInt16 mnHelpId; +} +SdUnoGStyleNameMapper[] = +{ + { sUNO_StyleName_standard, STR_STANDARD_STYLESHEET_NAME, HID_STANDARD_STYLESHEET_NAME }, + { sUNO_StyleName_objwitharrow, STR_POOLSHEET_OBJWITHARROW, HID_POOLSHEET_OBJWITHARROW }, + { sUNO_StyleName_objwithshadow, STR_POOLSHEET_OBJWITHSHADOW, HID_POOLSHEET_OBJWITHSHADOW }, + { sUNO_StyleName_objwithoutfill,STR_POOLSHEET_OBJWITHOUTFILL, HID_POOLSHEET_OBJWITHOUTFILL }, + { sUNO_StyleName_text, STR_POOLSHEET_TEXT, HID_POOLSHEET_TEXT }, + { sUNO_StyleName_textbody, STR_POOLSHEET_TEXTBODY, HID_POOLSHEET_TEXTBODY }, + { sUNO_StyleName_textbodyjust, STR_POOLSHEET_TEXTBODY_JUSTIFY, HID_POOLSHEET_TEXTBODY_JUSTIFY }, + { sUNO_StyleName_textbodyindent,STR_POOLSHEET_TEXTBODY_INDENT, HID_POOLSHEET_TEXTBODY_INDENT }, + { sUNO_StyleName_title, STR_POOLSHEET_TITLE, HID_POOLSHEET_TITLE }, + { sUNO_StyleName_title1, STR_POOLSHEET_TITLE1, HID_POOLSHEET_TITLE1 }, + { sUNO_StyleName_title2, STR_POOLSHEET_TITLE2, HID_POOLSHEET_TITLE2 }, + { sUNO_StyleName_headline, STR_POOLSHEET_HEADLINE, HID_POOLSHEET_HEADLINE }, + { sUNO_StyleName_headline1, STR_POOLSHEET_HEADLINE1, HID_POOLSHEET_HEADLINE1 }, + { sUNO_StyleName_headline2, STR_POOLSHEET_HEADLINE2, HID_POOLSHEET_HEADLINE2 }, + { sUNO_StyleName_measure, STR_POOLSHEET_MEASURE, HID_POOLSHEET_MEASURE }, + { NULL, 0, 0 } +}; + +String SdUnoGraphicStyleFamily::getInternalStyleName( const OUString& rName ) throw() +{ + struct SdUnoGStyleNameMapper_s* pMap = SdUnoGStyleNameMapper; + while( pMap->mpName ) + { + if( rName.compareToAscii( pMap->mpName ) == 0 ) + { + String aStr( SdResId(pMap->mnResId) ); + return aStr; + } + + pMap++; + } + + // check for user suffix and delete if found + const sal_Unicode *pChar = rName.getStr(); + sal_Int32 nLen = rName.getLength(); + if (nLen > 8 && + pChar[nLen-7] == ' ' && + pChar[nLen-6] == '(' && + pChar[nLen-5] == 'u' && + pChar[nLen-4] == 's' && + pChar[nLen-3] == 'e' && + pChar[nLen-2] == 'r' && + pChar[nLen-1] == ')') + { + return rName.copy( 0, nLen-7 ); + } + + return rName; +} + +OUString SdUnoGraphicStyleFamily::getExternalStyleName( const String& rName ) throw() +{ + sal_Bool bNeedsUser = sal_False; + + // check if we have an internal name and return the coresponding programatic name + struct SdUnoGStyleNameMapper_s* pMap = SdUnoGStyleNameMapper; + while( pMap->mpName ) + { + String aCompare( SdResId(pMap->mnResId) ); + if( rName == aCompare ) + return OUString::createFromAscii( pMap->mpName ); + + // check if the internal name equals a programatic name and add user + if( rName.CompareToAscii( pMap->mpName ) == 0 ) + { + bNeedsUser = sal_True; + break; + } + + pMap++; + } + + if( !bNeedsUser ) + { + // check if this string ends with a " (user)", if so, add another one + // check for user suffix and delete if found + const sal_Unicode *pChar = rName.GetBuffer(); + sal_Int32 nLen = rName.Len(); + if (nLen > 8 && + pChar[nLen-7] == ' ' && + pChar[nLen-6] == '(' && + pChar[nLen-5] == 'u' && + pChar[nLen-4] == 's' && + pChar[nLen-3] == 'e' && + pChar[nLen-2] == 'r' && + pChar[nLen-1] == ')') + { + bNeedsUser = sal_True; + } + } + + if( bNeedsUser ) + { + OUString aName( rName ); + aName += OUString( RTL_CONSTASCII_USTRINGPARAM ( " (user)" ) ); + return aName; + } + + return rName; +} + +// XServiceInfo +OUString SAL_CALL SdUnoGraphicStyleFamily::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdUnoGraphicStyleFamily") ); +} + +sal_Bool SAL_CALL SdUnoGraphicStyleFamily::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoGraphicStyleFamily::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aServiceName( OUString::createFromAscii(sUNO_Service_StyleFamily) ); + uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +// XNameAccess +uno::Any SAL_CALL SdUnoGraphicStyleFamily::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + if( NULL == pDoc || 0 == aName.getLength() ) + throw container::NoSuchElementException(); + + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pSSPool->Find( getInternalStyleName( aName ), SFX_STYLE_FAMILY_PARA ); + if( pStyleSheet == NULL ) + throw container::NoSuchElementException(); + + uno::Any aAny; + createStyle( pStyleSheet, aAny ); + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdUnoGraphicStyleFamily::getElementNames() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + SfxStyleSheetIterator* pIter = NULL; + + sal_Int32 nCount = 0; + if( pDoc ) + { + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + pIter = pSSPool->CreateIterator(SFX_STYLE_FAMILY_PARA, 0xFFFF ); + nCount = pIter->Count(); + } + + uno::Sequence< OUString > aNameSequence( nCount ); + + if( nCount ) + { + OUString* pNamesSeq = aNameSequence.getArray(); + + SfxStyleSheetBase* pStyleSheet = pIter->First(); + while( nCount && pStyleSheet ) + { + *pNamesSeq++ = getExternalStyleName( pStyleSheet->GetName() ); + pStyleSheet = pIter->Next(); + nCount--; + } + + DBG_ASSERT( pStyleSheet == NULL && nCount == 0, "memory overwrite catched! [CL]" ); + } + + return aNameSequence; +} + +sal_Bool SAL_CALL SdUnoGraphicStyleFamily::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + if( pDoc == NULL ) + return sal_False; + + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pSSPool->Find( getInternalStyleName( aName ), SFX_STYLE_FAMILY_PARA ); + return pStyleSheet != NULL; +} + +// XElementAccess +uno::Type SAL_CALL SdUnoGraphicStyleFamily::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( style::XStyle ); +} + +sal_Bool SAL_CALL SdUnoGraphicStyleFamily::hasElements() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return mpModel->GetDoc() != NULL; +} + +// XIndexAccess +/** the number of styles inside a pseudo style family is fix */ +sal_Int32 SAL_CALL SdUnoGraphicStyleFamily::getCount() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + sal_Int32 nCount = 0; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + if( pDoc != NULL ) + { + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetIterator* pIter = pSSPool->CreateIterator(SFX_STYLE_FAMILY_PARA, 0xFFFF ); + nCount = pIter->Count(); + delete pIter; + } + + return nCount; +} + +uno::Any SAL_CALL SdUnoGraphicStyleFamily::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + if( pDoc == NULL ) + return aAny; + + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetIterator* pIter = pSSPool->CreateIterator(SFX_STYLE_FAMILY_PARA, 0xFFFF ); + const sal_Int32 nCount = pIter->Count(); + + if( Index < 0 || Index >= nCount ) + throw lang::IndexOutOfBoundsException(); + + createStyle( (*pIter)[(sal_uInt16)Index], aAny ); + + delete pIter; + + return aAny; +} + +// XNameContainer +void SAL_CALL SdUnoGraphicStyleFamily::insertByName( const OUString& aName, const uno::Any& aElement ) + throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdUnoGraphicStyle* pStyle = getStyleFromAny( aElement ); + + if( pStyle == NULL || pStyle->isValid() || 0 == aName.getLength() ) + throw lang::IllegalArgumentException(); + + String aStyleName( getInternalStyleName(aName) ); + + SdDrawDocument* pDoc = mpModel->GetDoc(); + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); + if( pStyleSheet ) + throw container::ElementExistException(); + + pStyleSheet = &pSSPool->Make( aStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ); + + pStyle->create( mpModel, pStyleSheet ); + + mpModel->SetModified(); +} + +void SAL_CALL SdUnoGraphicStyleFamily::removeByName( const OUString& Name ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + String aStyleName( Name ); + + SdDrawDocument* pDoc = mpModel->GetDoc(); + SfxStyleSheetBase* pStyleSheet = NULL; + SfxStyleSheetBasePool* pSSPool = NULL; + + if( pDoc && 0 != Name.getLength() ) + { + pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + if( pSSPool ) + SfxStyleSheetBase* pStyleSheet = pSSPool->Find( getInternalStyleName(Name), SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); + } + + if( NULL == pStyleSheet || pStyleSheet->IsUserDefined() ) + throw container::NoSuchElementException(); + + pSSPool->Erase( pStyleSheet ); + + mpModel->SetModified(); +} + +// XNameReplace +void SAL_CALL SdUnoGraphicStyleFamily::replaceByName( const OUString& aName, const uno::Any& aElement ) + throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdUnoGraphicStyle* pStyle = getStyleFromAny( aElement ); + + SdDrawDocument* pDoc = mpModel->GetDoc(); + + if( NULL == pDoc || pStyle->isValid() || 0 == aName.getLength() ) + throw lang::IllegalArgumentException(); + + SfxStyleSheetBase* pStyleSheet = NULL; + const String aStyleName( aName ); + + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + if( pSSPool ) + pStyleSheet = pSSPool->Find( getInternalStyleName(aName), SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); + + if( NULL == pStyleSheet ) + throw container::NoSuchElementException(); + + pSSPool->Erase( pStyleSheet ); + + pStyleSheet = &pSSPool->Make( aStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ); + pStyle->create( mpModel, pStyleSheet ); + + mpModel->SetModified(); +} + +// XSingleServiceFactory +uno::Reference< uno::XInterface > SAL_CALL SdUnoGraphicStyleFamily::createInstance( ) + throw(uno::Exception, uno::RuntimeException) +{ + return (::cppu::OWeakObject*)new SdUnoGraphicStyle(); +} + +uno::Reference< uno::XInterface > SAL_CALL SdUnoGraphicStyleFamily::createInstanceWithArguments( const uno::Sequence< uno::Any >& aArguments ) + throw(uno::Exception, uno::RuntimeException) +{ + return (::cppu::OWeakObject*)new SdUnoGraphicStyle(); +} + +sal_Bool SdUnoGraphicStyleFamily_searchfunc( uno::WeakReference< uno::XInterface > xRef, void* pSearchData ) +{ + uno::Reference< uno::XInterface > xStyle( xRef ); + if( xStyle.is() ) + { + SdUnoGraphicStyle* pStyle = SdUnoGraphicStyle::getImplementation( xStyle ); + if( pStyle ) + { + if( pStyle->getStyleSheet() == (SfxStyleSheetBase*)pSearchData ) + return sal_True; + } + } + return sal_False; +} + +void SdUnoGraphicStyleFamily::createStyle( SfxStyleSheetBase* pStyleSheet, uno::Any& rAny ) const throw() +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + + DBG_ASSERT( pStyleSheet, "need a style for insert! [CL]" ); + DBG_ASSERT( pDoc, "need a document here! [CL]" ); + + uno::WeakReference< uno::XInterface > xRef; + uno::Reference< style::XStyle > xStyle; + + if( mpStyles->findRef( xRef, (void*)pStyleSheet, SdUnoGraphicStyleFamily_searchfunc ) ) + { + uno::Reference< uno::XInterface > xInt( xRef ); + if( xInt.is() ) + { + rAny = xInt->queryInterface( ITYPE( style::XStyle ) ); + if( rAny.hasValue() ) + return; + } + } + + if( !xStyle.is() ) + { + xStyle = new SdUnoGraphicStyle( mpModel, pStyleSheet ); + uno::WeakReference<uno::XInterface> wRef(xStyle); + mpStyles->insert(wRef); + } + + rAny <<= xStyle; +} + +SdUnoGraphicStyle* SdUnoGraphicStyleFamily::getStyleFromAny( const uno::Any& Element ) + throw( lang::IllegalArgumentException ) +{ + SdUnoGraphicStyle* pStyle = NULL; + + if( Element.hasValue() && Element.getValueTypeClass() == uno::TypeClass_INTERFACE ) + { + uno::Reference< uno::XInterface > xStyle( *(uno::Reference< uno::XInterface > *)Element.getValue() ); + + pStyle = SdUnoGraphicStyle::getImplementation( xStyle ); + } + + if( NULL == pStyle ) + throw lang::IllegalArgumentException(); + + return pStyle; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unogstyl.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unogstyl.cxx new file mode 100644 index 000000000000..74d16d09e787 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unogstyl.cxx @@ -0,0 +1,276 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <osl/mutex.hxx> + +#include <vcl/svapp.hxx> + + + +#include "stlsheet.hxx" +#include <bf_svtools/smplhint.hxx> + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/unoprov.hxx> + +#include <unogsfm.hxx> +#include <unogstyl.hxx> +#include <unokywds.hxx> +#include <helpids.h> +#include <unoprnms.hxx> +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +SdUnoGraphicStyle::SdUnoGraphicStyle( SdXImpressDocument* pModel /* = NULL */, + SfxStyleSheetBase* pStyleSheet /* = NULL */ ) throw() +: SdUnoPseudoStyle( pModel, pStyleSheet ) +{ +} + +SdUnoGraphicStyle::~SdUnoGraphicStyle() throw() +{ +} + +const ::com::sun::star::uno::Sequence< sal_Int8 > & SdUnoGraphicStyle::getUnoTunnelId() throw() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +SdUnoGraphicStyle* SdUnoGraphicStyle::getImplementation( const uno::Reference< uno::XInterface >& xInt ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); + if( xUT.is() ) + return (SdUnoGraphicStyle*)xUT->getSomething( SdUnoGraphicStyle::getUnoTunnelId() ); + else + return NULL; +} + +sal_Int64 SAL_CALL SdUnoGraphicStyle::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) +{ + if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + else + { + return SdUnoPseudoStyle::getSomething( rId ); + } +} + +/** attaches a style sheet to this instance and fill it with things the user + already set on this instance +*/ +void SdUnoGraphicStyle::create( SdXImpressDocument* pModel, SfxStyleSheetBase* pStyleSheet ) throw() +{ + DBG_ASSERT( pModel != NULL, "where is my model? [CL]" ); + DBG_ASSERT( pStyleSheet != NULL, "where is my style? [CL]" ); + DBG_ASSERT( mpStyleSheet == NULL, "creating already existing style! [CL]" ); + + mxModel = pModel; + mpModel = pModel; + + mpStyleSheet = pStyleSheet; + StartListening( pStyleSheet->GetPool() ); + + if( maPreInitName.getLength() ) + setName( maPreInitName ); + + if( maPreInitParent.getLength() ) + setParentStyle( maPreInitParent ); + + if( maPropSet.AreThereOwnUsrAnys() ) + { + uno::Any* pAny; + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMap(); + while( pMap->pName ) + { + pAny = maPropSet.GetUsrAnyForID( pMap->nWID ); + if( pAny ) + { + OUString aPropertyName( OUString::createFromAscii(pMap->pName) ); + setPropertyValue( aPropertyName, *pAny ); + } + pMap++; + } + } +} + +// XNamed +OUString SAL_CALL SdUnoGraphicStyle::getName( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + OUString aName; + if( mpStyleSheet ) + { + aName = SdUnoGraphicStyleFamily::getExternalStyleName( mpStyleSheet->GetName() ); + } + else + { + aName = maPreInitName; + } + + return aName; +} + +void SAL_CALL SdUnoGraphicStyle::setName( const OUString& aName ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( mpStyleSheet ) + { + if( mpStyleSheet->IsUserDefined() ) + { + mpStyleSheet->SetName( aName ); + ((SdStyleSheet*)mpStyleSheet)->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + } + } + else + { + maPreInitName = aName; + } + + if( mpModel ) + mpModel->SetModified(); +} + +// XPropertySet +uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdUnoGraphicStyle::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) +{ + return SdUnoPseudoStyle::getPropertySetInfo(); +} + +void SAL_CALL SdUnoGraphicStyle::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SdUnoPseudoStyle::setPropertyValue( aPropertyName, aValue ); +} + +uno::Any SAL_CALL SdUnoGraphicStyle::getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + static OUString aStyleName( OUString::createFromAscii( UNO_NAME_STYLE_FAMILY ) ); + if( PropertyName == aStyleName ) + { + uno::Any aAny; + aAny <<= OUString::createFromAscii( "graphic" ); + return aAny; + } + else + { + return SdUnoPseudoStyle::getPropertyValue( PropertyName ); + } +} + +void SAL_CALL SdUnoGraphicStyle::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SdUnoPseudoStyle::addPropertyChangeListener( aPropertyName, xListener ); +} + +void SAL_CALL SdUnoGraphicStyle::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SdUnoPseudoStyle::removePropertyChangeListener( aPropertyName, aListener ); +} + +void SAL_CALL SdUnoGraphicStyle::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SdUnoPseudoStyle::addVetoableChangeListener( PropertyName, aListener ); +} + +void SAL_CALL SdUnoGraphicStyle::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SdUnoPseudoStyle::removeVetoableChangeListener( PropertyName, aListener ); +} + +// XStyle +OUString SAL_CALL SdUnoGraphicStyle::getParentStyle( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + OUString aName; + if( mpStyleSheet ) + { + aName = SdUnoGraphicStyleFamily::getExternalStyleName( mpStyleSheet->GetParent() ); + } + else + { + aName = maPreInitParent; + } + + return aName; +} + +void SAL_CALL SdUnoGraphicStyle::setParentStyle( const OUString& aParentStyle ) + throw(container::NoSuchElementException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( mpStyleSheet ) + { + String aStyleName( SdUnoGraphicStyleFamily::getInternalStyleName(aParentStyle) ); + if( aStyleName.Len() && mpStyleSheet->GetPool().Find( aStyleName, SFX_STYLE_FAMILY_PARA ) == NULL ) + throw container::NoSuchElementException(); + + mpStyleSheet->SetParent( aStyleName ); + ((SdStyleSheet*)mpStyleSheet)->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + } + else + { + maPreInitParent = aParentStyle; + } + + if( mpModel ) + mpModel->SetModified(); +} + +//XServiceInfo +OUString SAL_CALL SdUnoGraphicStyle::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( OUString::createFromAscii(sUNO_SdUnoGraphicStyle) ); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unokywds.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unokywds.cxx new file mode 100644 index 000000000000..32d436238c87 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unokywds.cxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SD_UNOKYWDS_HXX_ +#define SD_DEFINE_KEYWORDS +#include <unokywds.hxx> +#undef SD_DEFINE_KEYWORDS +#endif +namespace binfilter { + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unolayer.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unolayer.cxx new file mode 100644 index 000000000000..442d442aa3f8 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unolayer.cxx @@ -0,0 +1,657 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <rtl/uuid.h> + +#include <bf_sd/drawdoc.hxx> +#include <bf_svx/svdpagv.hxx> +#include <bf_svx/unoshape.hxx> + +#include "bf_sd/docshell.hxx" + +#include <drawdoc.hxx> +#include <unolayer.hxx> +#include "unoprnms.hxx" + +#include "unohelp.hxx" +#include "frmview.hxx" + +#include "strings.hrc" +#include "sdresid.hxx" +#include "glob.hrc" + +#include "unokywds.hxx" +#include "unowcntr.hxx" + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +#define WID_LAYER_LOCKED 1 +#define WID_LAYER_PRINTABLE 2 +#define WID_LAYER_VISIBLE 3 +#define WID_LAYER_NAME 4 + +const SfxItemPropertyMap* ImplGetSdLayerPropertyMap() +{ + static const SfxItemPropertyMap aSdLayerPropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_LAYER_LOCKED), WID_LAYER_LOCKED, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_LAYER_PRINTABLE), WID_LAYER_PRINTABLE,&::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_LAYER_VISIBLE), WID_LAYER_VISIBLE, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_LAYER_NAME), WID_LAYER_NAME, &::getCppuType((const OUString*)0), 0, 0 }, + { 0,0,0,0,0} + }; + + return aSdLayerPropertyMap_Impl; +} + +String SdLayer::convertToInternalName( const OUString& rName ) +{ + if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background) ) ) + { + return String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )); + } + else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background_objects) ) ) + { + return String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )); + } + else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_layout) ) ) + { + return String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_LAYOUT" )); + } + else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_controls) ) ) + { + return String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_CONTROLS" )); + } + else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_measurelines) ) ) + { + return String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_MEASURELINES" )); + } + else + { + return String( rName ); + } +} + +OUString SdLayer::convertToExternalName( const String& rName ) +{ + const String aCompare( rName ); + if( rName == String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )) ) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background) ); + } + else if( rName == String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )) ) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background_objects) ); + } + else if( rName == String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_LAYOUT" )) ) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_layout) ); + } + else if( rName == String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_CONTROLS" )) ) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_controls) ); + } + else if( rName == String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_MEASURELINES" )) ) + { + return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_measurelines) ); + } + else + { + return OUString( rName ); + } +} + +/** */ +SdLayer::SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw() +: aPropSet(ImplGetSdLayerPropertyMap()), + pLayerManager(pLayerManager_), pLayer(pSdrLayer_), + mxLayerManager(pLayerManager_) +{ +} + +SdLayer::~SdLayer() throw() +{ +} + +UNO3_GETIMPLEMENTATION_IMPL( SdLayer ); + +OUString SAL_CALL SdLayer::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( OUString::createFromAscii(sUNO_SdLayer) ); +} + +sal_Bool SAL_CALL SdLayer::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdLayer::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayer) ); + uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +// beans::XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdLayer::getPropertySetInfo( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return aPropSet.getPropertySetInfo(); +} + +void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(pLayer == NULL || pLayerManager == NULL) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(aPropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_LAYER_LOCKED: + { + sal_Bool bValue; + if(!sd::any2bool( aValue, bValue )) + throw lang::IllegalArgumentException(); + set( LOCKED, bValue ); + break; + } + case WID_LAYER_PRINTABLE: + { + sal_Bool bValue; + if(!sd::any2bool( aValue, bValue )) + throw lang::IllegalArgumentException(); + set( PRINTABLE, bValue ); + break; + } + case WID_LAYER_VISIBLE: + { + sal_Bool bValue; + if(!sd::any2bool( aValue, bValue )) + throw lang::IllegalArgumentException(); + set( VISIBLE, bValue ); + break; + } + case WID_LAYER_NAME: + { + OUString aName; + if(!(aValue >>= aName)) + throw lang::IllegalArgumentException(); + + pLayer->SetName(SdLayer::convertToInternalName( aName ) ); + break; + } + default: + throw beans::UnknownPropertyException(); + break; + } +} + +uno::Any SAL_CALL SdLayer::getPropertyValue( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(pLayer == NULL || pLayerManager == NULL) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(PropertyName); + + uno::Any aValue; + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_LAYER_LOCKED: + sd::bool2any( get( LOCKED ), aValue ); + break; + case WID_LAYER_PRINTABLE: + sd::bool2any( get( PRINTABLE ), aValue ); + break; + case WID_LAYER_VISIBLE: + sd::bool2any( get( VISIBLE ), aValue ); + break; + case WID_LAYER_NAME: + { + OUString aRet( SdLayer::convertToExternalName( pLayer->GetName() ) ); + aValue <<= aRet; + break; + } + default: + throw beans::UnknownPropertyException(); + break; + } + + return aValue; +} + +void SAL_CALL SdLayer::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdLayer::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdLayer::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdLayer::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} + +/** */ +sal_Bool SdLayer::get( LayerAttribute what ) throw() +{ + if(pLayer&&pLayerManager&&pLayerManager->rModel.GetDoc() ) + { + List* pFrameViewList = pLayerManager->rModel.GetDoc()->GetFrameViewList(); + if( pFrameViewList && pFrameViewList->Count() ) + { + FrameView* pFrameView = (FrameView*) pFrameViewList->GetObject(0); + + if( pFrameView ) + { + SdrLayerAdmin& rLayerAdmin = pLayerManager->rModel.GetDoc()->GetLayerAdmin(); + BYTE id = rLayerAdmin.GetLayerID(pLayer->GetName(), sal_False); + + switch(what) + { + case VISIBLE: return pFrameView->GetVisibleLayers().IsSet(id); + case PRINTABLE: return pFrameView->GetPrintableLayers().IsSet(id); + case LOCKED: return pFrameView->GetLockedLayers().IsSet(id); + } + } + } + } + return sal_False; +} + +void SdLayer::set( LayerAttribute what, sal_Bool flag ) throw() +{ + if(pLayer&&pLayerManager&&pLayerManager->rModel.GetDoc() ) + { + List* pFrameViewList = pLayerManager->rModel.GetDoc()->GetFrameViewList(); + if( pFrameViewList && pFrameViewList->Count() ) + { + FrameView* pFrameView = (FrameView*) pFrameViewList->GetObject(0); + + if( pFrameView ) + { + SdrLayerAdmin& rLayerAdmin = pLayerManager->rModel.GetDoc()->GetLayerAdmin(); + BYTE id = rLayerAdmin.GetLayerID(pLayer->GetName(), sal_False); + + SetOfByte aSet; + switch(what) + { + case VISIBLE: aSet = pFrameView->GetVisibleLayers(); break; + case PRINTABLE: aSet = pFrameView->GetPrintableLayers(); break; + case LOCKED: aSet = pFrameView->GetLockedLayers(); break; + } + + aSet.Set(id,flag); + + switch(what) + { + case VISIBLE: pFrameView->SetVisibleLayers(aSet); break; + case PRINTABLE: pFrameView->SetPrintableLayers(aSet); break; + case LOCKED: pFrameView->SetLockedLayers(aSet); break; + } + } + } + } +} + + + + +//===== ::com::sun::star::container::XChild ================================= + +uno::Reference<uno::XInterface> SAL_CALL SdLayer::getParent (void) + throw (::com::sun::star::uno::RuntimeException) +{ + return uno::Reference<uno::XInterface> (mxLayerManager, uno::UNO_QUERY); +} + + +void SAL_CALL SdLayer::setParent (const uno::Reference<uno::XInterface >& rxParent) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException) +{ + throw lang::NoSupportException (); +} + + + + +//============================================================================= +// class SdLayerManager +//============================================================================= + +/** */ +SdLayerManager::SdLayerManager( SdXImpressDocument& rMyModel ) throw() +:rModel(rMyModel) +{ + mpLayers = new SvUnoWeakContainer; +} + +/** */ +SdLayerManager::~SdLayerManager() throw() +{ + delete mpLayers; +} + +// uno helper +const ::com::sun::star::uno::Sequence< sal_Int8 > & SdLayerManager::getUnoTunnelId() throw() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +sal_Int64 SAL_CALL SdLayerManager::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) +{ + if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + } + return 0; +} + +// XServiceInfo +OUString SAL_CALL SdLayerManager::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( OUString::createFromAscii(sUNO_SdLayerManager) ); +} + +sal_Bool SAL_CALL SdLayerManager::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdLayerManager::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayerManager) ); + uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +// XLayerManager +uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::insertNewByIndex( sal_Int32 nIndex ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Reference< drawing::XLayer > xLayer; + + if( rModel.pDoc ) + { + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); + sal_uInt16 nLayer = nLayerCnt - 2 + 1; + String aLayerName; + + // Ueberpruefung auf schon vorhandene Namen + while( aLayerName.Len()==0 || rLayerAdmin.GetLayer( aLayerName, sal_False) ) + { + aLayerName = String(SdResId(STR_LAYER)); + aLayerName += String::CreateFromInt32( (sal_Int32)nLayer ); + nLayer++; + } + + SdrLayerAdmin& rLA=rModel.pDoc->GetLayerAdmin(); + const sal_Int32 nMax=rLA.GetLayerCount(); + if (nIndex>nMax) nIndex=nMax; + xLayer = GetLayer (rLA.NewLayer(aLayerName,(USHORT)nIndex)); + rModel.SetModified(); + } + return xLayer; +} + +void SAL_CALL SdLayerManager::remove( const uno::Reference< drawing::XLayer >& xLayer ) throw(container::NoSuchElementException, uno::RuntimeException) +{ +} + +void SAL_CALL SdLayerManager::attachShapeToLayer( const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XLayer >& xLayer ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if(rModel.pDoc==NULL) + return; + + SdLayer* pSdLayer = SdLayer::getImplementation(xLayer); + SdrLayer* pSdrLayer = pSdLayer?pSdLayer->GetSdrLayer():NULL; + if(pSdrLayer==NULL) + return; + + SvxShape* pShape = SvxShape::getImplementation( xShape ); + SdrObject* pSdrObject = pShape?pShape->GetSdrObject():NULL; + + if(pSdrObject && pSdrLayer ) + pSdrObject->SetLayer(pSdrLayer->GetID()); + + rModel.SetModified(); +} + +uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::getLayerForShape( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Reference< drawing::XLayer > xLayer; + + if(rModel.pDoc) + { + SvxShape* pShape = SvxShape::getImplementation( xShape ); + SdrObject* pObj = pShape?pShape->GetSdrObject():NULL; + if(pObj) + { + SdrLayerID aId = pObj->GetLayer(); + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + xLayer = GetLayer (rLayerAdmin.GetLayerPerID(aId)); + } + } + return xLayer; +} + +// XIndexAccess +sal_Int32 SAL_CALL SdLayerManager::getCount() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( rModel.pDoc ) + { + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + return rLayerAdmin.GetLayerCount(); + } + + return 0; +} + +uno::Any SAL_CALL SdLayerManager::getByIndex( sal_Int32 nLayer ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( nLayer >= getCount() || nLayer < 0 ) + throw lang::IndexOutOfBoundsException(); + + uno::Any aAny; + + if( rModel.pDoc ) + { + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + uno::Reference<drawing::XLayer> xLayer (GetLayer (rLayerAdmin.GetLayer((sal_uInt16)nLayer))); + aAny <<= xLayer; + } + return aAny; +} + + +// XNameAccess +uno::Any SAL_CALL SdLayerManager::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Reference< drawing::XLayer > xLayer; + + uno::Any aAny; + + if( rModel.pDoc ) + { + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + SdrLayer* pLayer = rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), FALSE ); + if( pLayer == NULL ) + throw container::NoSuchElementException(); + + xLayer = GetLayer (pLayer); + aAny <<= xLayer; + return aAny; + } + + throw container::NoSuchElementException(); + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdLayerManager::getElementNames() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + const sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount(); + + uno::Sequence< OUString > aSeq( nLayerCount ); + + OUString* pStrings = aSeq.getArray(); + SdrLayer* pLayer; + + for( sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++ ) + { + pLayer = rLayerAdmin.GetLayer( nLayer ); + if( pLayer ) + *pStrings++ = SdLayer::convertToExternalName( pLayer->GetName() ); + } + + return aSeq; +} + +sal_Bool SAL_CALL SdLayerManager::hasByName( const OUString& aName ) throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdrLayerAdmin& rLayerAdmin = rModel.pDoc->GetLayerAdmin(); + + return NULL != rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), FALSE ); +} + +// XElementAccess +uno::Type SAL_CALL SdLayerManager::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( drawing::XLayer ); +} + +sal_Bool SAL_CALL SdLayerManager::hasElements() throw(uno::RuntimeException) +{ + return getCount() > 0; +} + + +namespace +{ +/** Compare two pointers to <type>SdrLayer</type> objects. + @param xRef + The implementing SdLayer class provides the first pointer by the + <member>SdLayer::GetSdrLayer</member> method. + @param pSearchData + This void pointer is the second pointer to an <type>SdrLayer</type> + object. + @return + Return </True> if both pointers point to the same object. +*/ +sal_Bool compare_layers (uno::WeakReference<uno::XInterface> xRef, void* pSearchData) +{ + uno::Reference<uno::XInterface> xLayer (xRef); + if (xLayer.is()) + { + SdLayer* pSdLayer = SdLayer::getImplementation (xRef); + if (pSdLayer != NULL) + { + SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer (); + if (pSdrLayer == static_cast<SdrLayer*>(pSearchData)) + return sal_True; + } + } + return sal_False; +} +} + +uno::Reference<drawing::XLayer> SdLayerManager::GetLayer (SdrLayer* pLayer) +{ + uno::WeakReference<uno::XInterface> xRef; + uno::Reference<drawing::XLayer> xLayer; + + // Search existing xLayer for the given pLayer. + if (mpLayers->findRef (xRef, (void*)pLayer, compare_layers)) + xLayer = uno::Reference<drawing::XLayer> (xRef, uno::UNO_QUERY); + + // Create the xLayer if necessary. + if ( ! xLayer.is()) + { + xLayer = new SdLayer (this, pLayer); + + // Remember the new xLayer for future calls. + uno::WeakReference<uno::XInterface> wRef(xLayer); + mpLayers->insert(wRef); + } + + return xLayer; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unomodel.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unomodel.cxx new file mode 100644 index 000000000000..499aa7b84751 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unomodel.cxx @@ -0,0 +1,2064 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/ServiceNotRegisteredException.hpp> + + + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/unofield.hxx> + + + + +#include <bf_svx/UnoForbiddenCharsTable.hxx> + +#include <bf_svx/forbiddencharacterstable.hxx> + +#include <bf_svx/UnoNamespaceMap.hxx> + +#include <bf_svx/unoapi.hxx> + +#include <bf_svx/unofill.hxx> + +#include <bf_svx/svdorect.hxx> + +#include <toolkit/awt/vclxdevice.hxx> + +#include <bf_svtools/unoimap.hxx> + +#include <bf_svx/unolingu.hxx> +#include <bf_svx/svdpagv.hxx> + +#include <bf_svx/unoshape.hxx> +#include <bf_svx/unonrule.hxx> + +// #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver +#include <bf_svx/xmleohlp.hxx> + +#include <bf_svx/xmlgrhlp.hxx> + +#include "bf_sd/docshell.hxx" + +#include <UnoDocumentSettings.hxx> + +#include <glob.hrc> +#include <sdresid.hxx> +#include <sdpage.hxx> + +#include "unohelp.hxx" +#include <unolayer.hxx> +#include <unopage.hxx> +#include <unopres.hxx> +#include <unocpres.hxx> +#include <unoobj.hxx> +#include <unostyls.hxx> +#include <stlpool.hxx> +#include <unopback.hxx> +#include <unogstyl.hxx> +#include <unokywds.hxx> +#include <frmview.hxx> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using namespace ::osl; +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star; + +extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel ); + +/////////////////////////////////////////////////////////////////////// + +class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable, + public SfxListener +{ +private: + SdrModel* mpModel; + +protected: + virtual void onChange(); + +public: + SdUnoForbiddenCharsTable( SdrModel* pModel ); + ~SdUnoForbiddenCharsTable(); + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw (); +}; + +SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel ) +: SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel ) +{ + StartListening( *pModel ); +} + +void SdUnoForbiddenCharsTable::onChange() +{ + if( mpModel ) + { + mpModel->ReformatAllTextObjects(); + } +} + +SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable() +{ + if( mpModel ) + EndListening( *mpModel ); +} + +void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw() +{ + const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); + + if( pSdrHint ) + { + if( HINT_MODELCLEARED == pSdrHint->GetKind() ) + { + mpModel = NULL; + } + } +} + +/////////////////////////////////////////////////////////////////////// + +const sal_Int32 WID_MODEL_LANGUAGE = 1; +const sal_Int32 WID_MODEL_TABSTOP = 2; +const sal_Int32 WID_MODEL_VISAREA = 3; +const sal_Int32 WID_MODEL_MAPUNIT = 4; +const sal_Int32 WID_MODEL_FORBCHARS= 5; +const sal_Int32 WID_MODEL_CONTFOCUS = 6; +const sal_Int32 WID_MODEL_DSGNMODE = 7; +const sal_Int32 WID_MODEL_BASICLIBS = 8; + +const SfxItemPropertyMap* ImplGetDrawModelPropertyMap() +{ + // Achtung: Der erste Parameter MUSS sortiert vorliegen !!! + const static SfxItemPropertyMap aDrawModelPropertyMap_Impl[] = + { + { MAP_CHAR_LEN(sUNO_Prop_CharLocale), WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_TabStop), WID_MODEL_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_VisibleArea), WID_MODEL_VISAREA, &::getCppuType((const awt::Rectangle*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_MapUnit), WID_MODEL_MAPUNIT, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters), WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ), WID_MODEL_CONTFOCUS, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN("BasicLibraries"), WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 }, + { 0,0,0,0,0 } + }; + + return aDrawModelPropertyMap_Impl; +} + +// this ctor is used from the DocShell +SdXImpressDocument::SdXImpressDocument( SdDrawDocShell* pShell ) throw() +: SfxBaseModel( pShell ), + pDocShell( pShell ), + aPropSet( ImplGetDrawModelPropertyMap() ), + mbClipBoard( sal_False ) +{ + if( pDocShell ) + { + pDoc = pDocShell->GetDoc(); + StartListening( *pDoc ); + } + else + { + DBG_ERROR("DocShell is invalid"); + } + + mbImpressDoc = pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS; +} + +/*********************************************************************** +* * +***********************************************************************/ +SdXImpressDocument::~SdXImpressDocument() throw() +{ +} + +// uno helper + + +/****************************************************************************** +* Erzeugt anhand der uebergebennen SdPage eine SdDrawPage. Wurde fuer diese * +* SdPage bereits eine SdDrawPage erzeugt, wird keine neue SdDrawPage erzeug. * +******************************************************************************/ +/* +uno::Reference< drawing::XDrawPage > SdXImpressDocument::CreateXDrawPage( SdPage* pPage ) throw() +{ + DBG_ASSERT(pPage,"SdXImpressDocument::CreateXDrawPage( NULL? )"); + + uno::Reference< drawing::XDrawPage > xDrawPage; + + if(pPage) + { + xDrawPage = SvxDrawPage::GetPageForSdrPage(pPage); + + if(!xDrawPage.is()) + { + if(pPage->IsMasterPage()) + { + xDrawPage = (presentation::XPresentationPage*)new SdMasterPage( this, pPage ); + } + else + { + xDrawPage = (SvxDrawPage*)new SdDrawPage( this, pPage ); + } + } + } + + return xDrawPage; +} +*/ + +UNO3_GETIMPLEMENTATION_IMPL( SdXImpressDocument ); + +// XInterface +uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException) +{ + uno::Any aAny; + + QUERYINT(lang::XServiceInfo); + else QUERYINT(beans::XPropertySet); + else QUERYINT(lang::XMultiServiceFactory); + else QUERYINT(drawing::XDrawPageDuplicator); + else QUERYINT(drawing::XLayerSupplier); + else QUERYINT(drawing::XMasterPagesSupplier); + else QUERYINT(drawing::XDrawPagesSupplier); + else QUERYINT(presentation::XHandoutMasterSupplier); + else QUERYINT(document::XLinkTargetSupplier); + else QUERYINT(style::XStyleFamiliesSupplier); + else QUERYINT(lang::XUnoTunnel); + else QUERYINT(::com::sun::star::ucb::XAnyCompareFactory); + else QUERYINT(view::XRenderable); + else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) ) + aAny <<= uno::Reference< presentation::XPresentationSupplier >(this); + else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) ) + aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this); + else + return SfxBaseModel::queryInterface( rType ); + + return aAny; +} + +void SAL_CALL SdXImpressDocument::acquire() throw ( ) +{ + SfxBaseModel::acquire(); +} + +void SAL_CALL SdXImpressDocument::release() throw ( ) +{ + SfxBaseModel::release(); +} + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno::RuntimeException) +{ + if( maTypeSequence.getLength() == 0 ) + { + const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + const sal_Int32 nOwnTypes = mbImpressDoc ? 15 : 12; // !DANGER! Keep this updated! + + maTypeSequence.realloc( nBaseTypes + nOwnTypes ); + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ITYPE(beans::XPropertySet); + *pTypes++ = ITYPE(lang::XServiceInfo); + *pTypes++ = ITYPE(lang::XMultiServiceFactory); + *pTypes++ = ITYPE(drawing::XDrawPageDuplicator); + *pTypes++ = ITYPE(drawing::XLayerSupplier); + *pTypes++ = ITYPE(drawing::XMasterPagesSupplier); + *pTypes++ = ITYPE(drawing::XDrawPagesSupplier); + *pTypes++ = ITYPE(document::XLinkTargetSupplier); + *pTypes++ = ITYPE(style::XStyleFamiliesSupplier); + *pTypes++ = ITYPE(lang::XUnoTunnel); + *pTypes++ = ITYPE(::com::sun::star::ucb::XAnyCompareFactory); + *pTypes++ = ITYPE(view::XRenderable); + if( mbImpressDoc ) + { + *pTypes++ = ITYPE(presentation::XPresentationSupplier); + *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier); + *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier); + } + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException) +{ + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); + } + return aId; +} + +/*********************************************************************** +* * +***********************************************************************/ +void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + if( pDoc ) + { + const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); + + if( pSdrHint ) + { + if( hasEventListeners() ) + { + + bool bBackgroundShape = false; + + // the background shape itself has no api representation, so filter all notifies for it + const SdrObject* pSdrObj = pSdrHint->GetObject(); + if( pSdrObj && (pSdrObj->GetObjInventor() == SdrInventor) && (pSdrObj->GetObjIdentifier() == OBJ_RECT) ) + { + SdPage* pPage = (SdPage*)pSdrObj->GetPage(); + bBackgroundShape = pPage && (pPage->GetPresObjKind(const_cast<SdrObject*>(pSdrObj)) == PRESOBJ_BACKGROUND); + } + + if( !bBackgroundShape ) + { + document::EventObject aEvent; + if( SvxUnoDrawMSFactory::createEvent( pDoc, pSdrHint, aEvent ) ) + notifyEvent( aEvent ); + } + } + + if( pSdrHint->GetKind() == HINT_MODELCLEARED ) + { + if( pDoc ) + EndListening( *pDoc ); + pDoc = NULL; + pDocShell = NULL; + } + } + else + { + const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint ); + + // ist unser SdDrawDocument gerade gestorben? + if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING) + { + // yup, also schnell ein neues erfragen + if( pDocShell ) + { + SdDrawDocument *pNewDoc = pDocShell->GetDoc(); + + // ist ueberhaupt ein neues da? + if( pNewDoc != pDoc ) + { + pDoc = pNewDoc; + if(pDoc) + StartListening( *pDoc ); + } + } + } + } + } + SfxBaseModel::Notify( rBC, rHint ); +} + +/****************************************************************************** +* * +******************************************************************************/ +SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw() +{ + sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD ); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + BYTE aBckgrnd = rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )), sal_False); + BYTE aBckgrndObj = rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )), sal_False); + + SdPage* pStandardPage = NULL; + + if( 0 == nPageCount ) + { + // this is only used for clipboard where we only have one page + pStandardPage = (SdPage*) pDoc->AllocPage(sal_False); + + Size aDefSize(21000, 29700); // A4-Hochformat + pStandardPage->SetSize( aDefSize ); + pDoc->InsertPage(pStandardPage, 0); + } + else + { + // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll + SdPage* pPreviousStandardPage = pDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD ); + + sal_uInt16 nPos = 0; + SetOfByte aVisibleLayers = pPreviousStandardPage->GetMasterPageVisibleLayers( nPos ); + sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd ); + sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj ); + + /************************************************************** + * Es wird stets zuerst eine Standardseite und dann eine + * Notizseite erzeugt. Es ist sichergestellt, dass auf eine + * Standardseite stets die zugehoerige Notizseite folgt. + **************************************************************/ + + sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; + SdPage* pPreviousNotesPage = (SdPage*) pDoc->GetPage( nStandardPageNum - 1 ); + sal_uInt16 nNotesPageNum = nStandardPageNum + 1; + String aStandardPageName; + String aNotesPageName; + + /************************************************************** + * Standardseite + **************************************************************/ + if( bDuplicate ) + pStandardPage = (SdPage*) pPreviousStandardPage->Clone(); + else + pStandardPage = (SdPage*) pDoc->AllocPage(sal_False); + + pStandardPage->SetSize( pPreviousStandardPage->GetSize() ); + pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(), + pPreviousStandardPage->GetUppBorder(), + pPreviousStandardPage->GetRgtBorder(), + pPreviousStandardPage->GetLwrBorder() ); + + pStandardPage->SetName(aStandardPageName); + + // Seite hinter aktueller Seite einfuegen + pDoc->InsertPage(pStandardPage, nStandardPageNum); + + if( !bDuplicate ) + { + // MasterPage der aktuellen Seite verwenden + sal_uInt16 nPgNum = pPreviousStandardPage->GetMasterPageNum(nPos=0); + pStandardPage->InsertMasterPage(nPgNum); + pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() ); + pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True, sal_True); + } + + aBckgrnd = rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )), sal_False); + aBckgrndObj = rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )), sal_False); + aVisibleLayers.Set(aBckgrnd, bIsPageBack); + aVisibleLayers.Set(aBckgrndObj, bIsPageObj); + pStandardPage->SetMasterPageVisibleLayers(aVisibleLayers, nPos=0); + + /************************************************************** + * Notizseite + **************************************************************/ + SdPage* pNotesPage = NULL; + + if( bDuplicate ) + pNotesPage = (SdPage*) pPreviousNotesPage->Clone(); + else + pNotesPage = (SdPage*) pDoc->AllocPage(sal_False); + + pNotesPage->SetSize( pPreviousNotesPage->GetSize() ); + pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(), + pPreviousNotesPage->GetUppBorder(), + pPreviousNotesPage->GetRgtBorder(), + pPreviousNotesPage->GetLwrBorder() ); + pNotesPage->SetName(aNotesPageName); + pNotesPage->SetPageKind(PK_NOTES); + + // Seite hinter aktueller Seite einfuegen + pDoc->InsertPage(pNotesPage, nNotesPageNum); + + if( !bDuplicate ) + { + // MasterPage der aktuellen Seite verwenden + sal_uInt16 nPgNum = pPreviousNotesPage->GetMasterPageNum(nPos=0); + pNotesPage->InsertMasterPage(nPgNum); + pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() ); + pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True); + } + } + + SetModified(); + + return( pStandardPage ); +} + +void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw() +{ + if( pDoc ) + pDoc->SetChanged( bModified ); +} + +// XModel +void SAL_CALL SdXImpressDocument::lockControllers( ) + throw(uno::RuntimeException) +{ + if( NULL == pDoc ) + throw lang::DisposedException(); + + pDoc->setLock( sal_True ); +} + +void SAL_CALL SdXImpressDocument::unlockControllers( ) + throw(uno::RuntimeException) +{ + if( NULL == pDoc ) + throw lang::DisposedException(); + + if( pDoc->isLocked() ) + { + pDoc->setLock( sal_False ); + } +} + +sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked( ) + throw(uno::RuntimeException) +{ + return pDoc && pDoc->isLocked(); +} +} //namespace binfilter +namespace binfilter {//STRIP009 +uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException ) +{ + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() ); + + if( !xRet.is() ) + { + List* pFrameViewList = pDoc->GetFrameViewList(); + + if( pFrameViewList && pFrameViewList->Count() ) + { + xRet = uno::Reference < container::XIndexAccess >::query(::legacy_binfilters::getLegacyProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")))); + + + uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY ); + DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" ); + if( xCont.is() ) + { + sal_uInt32 i; + for( i = 0; i < pFrameViewList->Count(); i++ ) + { + FrameView* pFrameView = (FrameView*) pFrameViewList->GetObject(i); + + if(pFrameView) + { + uno::Sequence< beans::PropertyValue > aSeq; + pFrameView->WriteUserDataSequence( aSeq ); + xCont->insertByIndex( i, uno::makeAny( aSeq ) ); + } + } + } + } + } + + return xRet; +} + +void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException) +{ + if( NULL == pDoc ) + throw lang::DisposedException(); + + SfxBaseModel::setViewData( xData ); + if( pDocShell && (pDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() ) + { + const sal_Int32 nCount = xData->getCount(); + + List* pFrameViewList = pDoc->GetFrameViewList(); + + DBG_ASSERT( pFrameViewList, "No FrameViewList?" ); + if( pFrameViewList ) + { + FrameView* pFrameView; + + sal_uInt32 i; + for ( i = 0; i < pFrameViewList->Count(); i++) + { + // Ggf. FrameViews loeschen + pFrameView = (FrameView*) pFrameViewList->GetObject(i); + + if (pFrameView) + delete pFrameView; + } + + pFrameViewList->Clear(); + + uno::Sequence< beans::PropertyValue > aSeq; + sal_Int32 nIndex; + for( nIndex = 0; nIndex < nCount; nIndex++ ) + { + if( xData->getByIndex( nIndex ) >>= aSeq ) + { + pFrameView = new FrameView( pDoc ); + pFrameView->ReadUserDataSequence( aSeq ); + pFrameViewList->Insert( pFrameView ); + } + } + } + } +} + +// XDrawPageDuplicator +uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + // pPage von xPage besorgen und dann die Id (nPos )ermitteln + SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage ); + if( pSvxPage ) + { + SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage(); + sal_uInt16 nPos = pPage->GetPageNum(); + nPos = ( nPos - 1 ) / 2; + pPage = InsertSdPage( nPos, sal_True ); + if( pPage ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); + return xDrawPage; + } + } + + uno::Reference< drawing::XDrawPage > xDrawPage; + return xDrawPage; +} + + +// XDrawPagesSupplier +uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess ); + + if( !xDrawPages.is() ) + { + initializeDocument(); + mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this); + } + + return xDrawPages; +} + +// XMasterPagesSupplier +uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess ); + + if( !xMasterPages.is() ) + { + initializeDocument(); + mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this); + } + + return xMasterPages; +} + +// XLayerManagerSupplier +uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager ); + + if( !xLayerManager.is() ) + mxLayerManager = xLayerManager = new SdLayerManager(*this); + + return xLayerManager; +} + +// XCustomPresentationSupplier +uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess ); + + if( !xCustomPres.is() ) + mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this); + + return xCustomPres; +} + +// XPresentationSupplier +uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< presentation::XPresentation > aPresentation( mxPresentation ); + + if( !aPresentation.is() ) + mxPresentation = aPresentation = new SdXPresentation(*this); + + return aPresentation; +} + +// XHandoutMasterSupplier +uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage() + throw (uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< drawing::XDrawPage > xPage; + + if( pDoc ) + { + initializeDocument(); + SdPage* pPage = pDoc->GetMasterSdPage( 0, PK_HANDOUT ); + if( pPage ) + xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ); + } + return xPage; +} + +// XMultiServiceFactory ( SvxFmMSFactory ) +uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier ) + throw(uno::Exception, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) ) + { + if( !mxDashTable.is() ) + mxDashTable = SvxUnoDashTable_createInstance( pDoc ); + + return mxDashTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) ) + { + if( !mxGradientTable.is() ) + mxGradientTable = SvxUnoGradientTable_createInstance( pDoc ); + + return mxGradientTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) ) + { + if( !mxHatchTable.is() ) + mxHatchTable = SvxUnoHatchTable_createInstance( pDoc ); + + return mxHatchTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) ) + { + if( !mxBitmapTable.is() ) + mxBitmapTable = SvxUnoBitmapTable_createInstance( pDoc ); + + return mxBitmapTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ) + { + if( !mxTransGradientTable.is() ) + mxTransGradientTable = SvxUnoTransGradientTable_createInstance( pDoc ); + + return mxTransGradientTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) ) + { + if( !mxMarkerTable.is() ) + mxMarkerTable = SvxUnoMarkerTable_createInstance( pDoc ); + + return mxMarkerTable; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) ) + { + return SvxCreateNumRule( pDoc ); + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) ) + { + return uno::Reference< uno::XInterface >( (uno::XWeak*)(new SdUnoPageBackground( pDoc )) ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.Style") ) ) + { + uno::Reference< style::XStyle > xStyle( new SdUnoGraphicStyle() ); + return xStyle; + } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) ) + { + if( !mxDrawingPool.is() ) + mxDrawingPool = SdUnoCreatePool( pDoc ); + + return mxDrawingPool; + + } + + if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapRectangleObject) ) ) + { + return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() ); + } + + if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapCircleObject) ) ) + { + return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() ); + } + + if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapPolygonObject) ) ) + { + return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() ); + } + + if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) || + ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) || + ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) ) + { + return sd::DocumentSettings_createInstance( this ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) + { + return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) ) + { + static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 }; + + return svx::NamespaceMap_createInstance( aWhichIds, &pDoc->GetItemPool() ); + } + + // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) ) + { + return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) ) + { + return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) ) + { + SvPersist *pPersist = pDoc ? pDoc->GetPersist() : NULL; + + if( NULL == pPersist ) + throw lang::DisposedException(); + + return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE ); + } + + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) ) + { + SvPersist *pPersist = pDoc ? pDoc->GetPersist() : NULL; + + if( NULL == pPersist ) + throw lang::DisposedException(); + + return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ ); + } + + uno::Reference< uno::XInterface > xRet; + + const String aType( aServiceSpecifier ); + if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) ) + { + SvxShape* pShape = NULL; + + sal_uInt16 nType = OBJ_TEXT; + // create a shape wrapper + if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) ) + { + nType = OBJ_TEXT; + } + else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) ) + { + nType = OBJ_TEXT; + } + else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) ) + { + nType = OBJ_TEXT; + } + else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) ) + { + nType = OBJ_GRAF; + } + else if( aType.EqualsAscii( "PageShape", 26, 9 ) ) + { + nType = OBJ_PAGE; + } + else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) ) + { + nType = OBJ_OLE2; + } + else if( aType.EqualsAscii( "ChartShape", 26, 10 ) ) + { + nType = OBJ_OLE2; + } + else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) + { + nType = OBJ_OLE2; + } + else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) ) + { + nType = OBJ_OLE2; + } + else if( aType.EqualsAscii( "NotesShape", 26, 13 ) ) + { + nType = OBJ_TEXT; + } + else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) ) + { + nType = OBJ_PAGE; + } + else + { + throw lang::ServiceNotRegisteredException(); + } + + // create the API wrapper + pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor ); + + // set shape type + if( pShape && !mbClipBoard ) + pShape->SetShapeType(aServiceSpecifier); + + xRet = (uno::XWeak*)pShape; + } + else + { + xRet = SvxFmMSFactory::createInstance( aServiceSpecifier ); + } + + uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY ); + if( xShape.is() ) + { + xRet.clear(); + new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this ); + xRet = xShape; + xShape.clear(); + } + + return xRet; +} + +uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames() + throw(uno::RuntimeException) +{ + const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); + + uno::Sequence< OUString > aSNS( mbImpressDoc ? (26 + 4) : (15 + 4) ); + + sal_uInt16 i(0); + + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Background")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.Style")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapRectangleObject)); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapCircleObject)); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapPolygonObject)); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")); + + // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")); + + if(mbImpressDoc) + { + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape")); + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings")); + } + else + { + aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings")); + } + + DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" ); + + return comphelper::concatSequences( aSNS_ORG, aSNS ); +} + +// lang::XServiceInfo +OUString SAL_CALL SdXImpressDocument::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXImpressDocument")); +} + +sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aSeq( 4 ); + OUString* pServices = aSeq.getArray(); + + *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OfficeDocument")); + *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GenericDrawingDocument")); + + if( mbImpressDoc ) + *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); + else + *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument")); + + return aSeq; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + return aPropSet.getPropertySetInfo(); +} + +void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(aPropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_MODEL_LANGUAGE: + { + lang::Locale aLocale; + if(!(aValue >>= aLocale)) + throw lang::IllegalArgumentException(); + + pDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE ); + break; + } + case WID_MODEL_TABSTOP: + { + sal_Int32 nValue; + if(!(aValue >>= nValue) || nValue < 0 ) + throw lang::IllegalArgumentException(); + + pDoc->SetDefaultTabulator((sal_uInt16)nValue); + break; + } + case WID_MODEL_VISAREA: + { + SvEmbeddedObject* pEmbeddedObj = pDoc->GetDocSh(); + if( !pEmbeddedObj ) + break; + + awt::Rectangle aVisArea; + if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) ) + throw lang::IllegalArgumentException(); + + pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) ); + } + break; + case WID_MODEL_CONTFOCUS: + { + sal_Bool bFocus; + if( !(aValue >>= bFocus ) ) + throw lang::IllegalArgumentException(); + pDoc->SetAutoControlFocus( bFocus ); + } + break; + case WID_MODEL_DSGNMODE: + { + sal_Bool bMode; + if( !(aValue >>= bMode ) ) + throw lang::IllegalArgumentException(); + pDoc->SetOpenInDesignMode( bMode ); + } + break; + case WID_MODEL_MAPUNIT: + case WID_MODEL_BASICLIBS: + throw beans::PropertyVetoException(); + default: + throw beans::UnknownPropertyException(); + break; + } + + SetModified(); +} + +uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + uno::Any aAny; + if( NULL == pDoc ) + throw lang::DisposedException(); + + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(PropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_MODEL_LANGUAGE: + { + LanguageType eLang = pDoc->GetLanguage( EE_CHAR_LANGUAGE ); + lang::Locale aLocale; + SvxLanguageToLocale( aLocale, eLang ); + aAny <<= aLocale; + break; + } + case WID_MODEL_TABSTOP: + aAny <<= (sal_Int32)pDoc->GetDefaultTabulator(); + break; + case WID_MODEL_VISAREA: + { + SvEmbeddedObject* pEmbeddedObj = pDoc->GetDocSh(); + if( !pEmbeddedObj ) + break; + + const Rectangle& aRect = pEmbeddedObj->GetVisArea(); + awt::Rectangle aVisArea( aRect.nLeft, aRect.nTop, aRect.getWidth(), aRect.getHeight() ); + + aAny <<= aVisArea; + } + break; + case WID_MODEL_MAPUNIT: + { + SvEmbeddedObject* pEmbeddedObj = pDoc->GetDocSh(); + if( !pEmbeddedObj ) + break; + + sal_Int16 nMeasureUnit = 0; + SvxMapUnitToMeasureUnit( pEmbeddedObj->GetMapUnit(), nMeasureUnit ); + aAny <<= (sal_Int16)nMeasureUnit; + } + break; + case WID_MODEL_FORBCHARS: + { + aAny <<= getForbiddenCharsTable(); + } + break; + case WID_MODEL_CONTFOCUS: + aAny <<= (sal_Bool)pDoc->GetAutoControlFocus(); + break; + case WID_MODEL_DSGNMODE: + aAny <<= pDoc->GetOpenInDesignMode(); + break; + case WID_MODEL_BASICLIBS: + aAny <<= pDocShell->GetBasicContainer(); + break; + default: + throw beans::UnknownPropertyException(); + break; + } + + return aAny; +} + +void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} + +// XLinkTargetSupplier +uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + return new SdDocLinkTargets( *this ); +} + +// XStyleFamiliesSupplier +uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies); + + if( !xStyles.is() ) + mxStyleFamilies = xStyles = new SdUnoStyleFamilies( this ); + + return xStyles; +} + +// XAnyCompareFactory +uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& PropertyName ) + throw (uno::RuntimeException) +{ + return SvxCreateNumRuleCompare(); +} + +// XRenderable +sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection, + const uno::Sequence< beans::PropertyValue >& rxOptions ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + sal_Int32 nRet = 0; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Sequence< beans::PropertyValue > aRenderer; + + if( pDocShell && pDoc ) + { + uno::Reference< frame::XModel > xModel; + + rSelection >>= xModel; + + if( xModel == pDocShell->GetModel() ) + nRet = pDoc->GetSdPageCount( PK_STANDARD ); + else + { + uno::Reference< drawing::XShapes > xShapes; + + rSelection >>= xShapes; + + if( xShapes.is() && xShapes->getCount() ) + nRet = 1; + } + } + + return nRet; +} + +uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 nRenderer, const uno::Any& rSelection, + const uno::Sequence< beans::PropertyValue >& rxOptions ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + uno::Sequence< beans::PropertyValue > aRenderer; + + if( pDocShell && pDoc ) + { + const Rectangle aVisArea( pDocShell->GetVisArea( ASPECT_DOCPRINT ) ); + awt::Size aPageSize( aVisArea.GetWidth(), aVisArea.GetHeight() ); + + aRenderer.realloc( 1 ); + + aRenderer[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); + aRenderer[ 0 ].Value <<= aPageSize; + } + + return aRenderer; +} + +struct ImplRenderPaintProc +{ + const SdrLayerAdmin& rLayerAdmin; + SdrPageView* pSdrPageView; + + sal_Bool IsVisible ( const SdrObject* pObj ) const; + sal_Bool IsPrintable( const SdrObject* pObj ) const; + + ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView ) : + rLayerAdmin ( rLA ), + pSdrPageView ( pView ) + {} + + DECL_LINK(_ImplRenderPaintProc, SdrPaintProcRec*); +}; +sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const +{ + sal_Bool bVisible = sal_True; + SdrLayerID nLayerId = pObj->GetLayer(); + if( pSdrPageView ) + { + const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId ); + if ( pSdrLayer ) + { + String aLayerName = pSdrLayer->GetName(); + bVisible = pSdrPageView->IsLayerVisible( aLayerName ); + } + } + return bVisible; +} +sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const +{ + sal_Bool bPrintable = sal_True; + SdrLayerID nLayerId = pObj->GetLayer(); + if( pSdrPageView ) + { + const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId ); + if ( pSdrLayer ) + { + String aLayerName = pSdrLayer->GetName(); + bPrintable = pSdrPageView->IsLayerPrintable( aLayerName ); + } + } + return bPrintable; + +} +IMPL_LINK( ImplRenderPaintProc, _ImplRenderPaintProc, SdrPaintProcRec*, pRecord ) +{ + SdrObject* pObj = pRecord->pObj; + if( !pObj->IsEmptyPresObj() && IsVisible( pObj ) && IsPrintable( pObj ) ) + { + pObj->Paint( pRecord->rOut, pRecord->rInfoRec ); + } + else + { + if( pObj->GetPage()->IsMasterPage() && (pObj->GetPage() == pObj->GetObjList()) && (pObj->GetOrdNum() == 0) && pObj->ISA( SdrRectObj ) ) + pObj->Paint( pRecord->rOut, pRecord->rInfoRec ); + } + return 0; +} + +void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection, + const uno::Sequence< beans::PropertyValue >& rxOptions ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == pDoc ) + throw lang::DisposedException(); + + if( pDocShell && pDoc ) + { + uno::Reference< awt::XDevice > xRenderDevice; + const sal_Int32 nPageNumber = nRenderer + 1; + + for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) + { + if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) + rxOptions[ nProperty].Value >>= xRenderDevice; + } + + if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= pDoc->GetSdPageCount( PK_STANDARD ) ) ) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; + + if( pOut ) + { + DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SdClientView* pView = new SdClientView( pDocShell, pOut, NULL ); + } + } + } +} + +uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() +{ + uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); + + if( !xForb.is() ) + mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( pDoc ); + + return xForb; +} + +void SdXImpressDocument::initializeDocument() +{ + if( (pDoc->GetPageCount() <= 1) && !mbClipBoard ) + { + pDoc->CreateFirstPages(); + } +} + +void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException) +{ + { + ::SolarMutexGuard aGuard; + if( pDoc ) + { + EndListening( *pDoc ); + pDoc = NULL; + } + } + + SfxBaseModel::dispose(); +} + +// ----------------------------------------------------------------------------- +void SAL_CALL SdXImpressDocument::setPrinter( const uno::Sequence< beans::PropertyValue >& rPrinter) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + SfxPrinter* pPrinter = NULL; + sal_uInt16 nChangeFlags = 0; + SfxViewShell *pViewSh=0; + impl_setPrinter(rPrinter,pPrinter,nChangeFlags,pViewSh); +} + +//============================================================================= +// class SdDrawPagesAccess +//============================================================================= + +SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw() +: rModel(rMyModel) +{ + rModel.acquire(); +} + +SdDrawPagesAccess::~SdDrawPagesAccess() throw() +{ + rModel.release(); +} + +// XIndexAccess +sal_Int32 SAL_CALL SdDrawPagesAccess::getCount() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + return rModel.pDoc->GetSdPageCount( PK_STANDARD ); +} + +uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + uno::Any aAny; + + if( (Index < 0) || (Index >= rModel.pDoc->GetSdPageCount( PK_STANDARD ) ) ) + throw lang::IndexOutOfBoundsException(); + + SdPage* pPage = rModel.pDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD ); + if( pPage ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); + aAny <<= xDrawPage; + } + + return aAny; +} + +// XNameAccess +uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + if( aName.getLength() != 0 ) + { + const sal_uInt16 nCount = rModel.pDoc->GetSdPageCount( PK_STANDARD ); + sal_uInt16 nPage; + for( nPage = 0; nPage < nCount; nPage++ ) + { + SdPage* pPage = rModel.pDoc->GetSdPage( nPage, PK_STANDARD ); + if(NULL == pPage) + continue; + + if( aName == SdDrawPage::getPageApiName( pPage ) ) + { + uno::Any aAny; + uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); + aAny <<= xDrawPage; + return aAny; + } + } + } + + throw container::NoSuchElementException(); +} + +uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + const sal_uInt16 nCount = rModel.pDoc->GetSdPageCount( PK_STANDARD ); + uno::Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + + sal_uInt16 nPage; + for( nPage = 0; nPage < nCount; nPage++ ) + { + SdPage* pPage = rModel.pDoc->GetSdPage( nPage, PK_STANDARD ); + *pNames++ = SdDrawPage::getPageApiName( pPage ); + } + + return aNames; +} + +sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + const sal_uInt16 nCount = rModel.pDoc->GetSdPageCount( PK_STANDARD ); + sal_uInt16 nPage; + for( nPage = 0; nPage < nCount; nPage++ ) + { + SdPage* pPage = rModel.pDoc->GetSdPage( nPage, PK_STANDARD ); + if(NULL == pPage) + continue; + + if( aName == SdDrawPage::getPageApiName( pPage ) ) + return sal_True; + } + + return sal_False; +} + +// XElementAccess +uno::Type SAL_CALL SdDrawPagesAccess::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( drawing::XDrawPage ); +} + +sal_Bool SAL_CALL SdDrawPagesAccess::hasElements() + throw(uno::RuntimeException) +{ + return getCount() > 0; +} + +// XDrawPages + +/****************************************************************************** +* Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die * +* dazugehoerige SdDrawPage zurueck. * +******************************************************************************/ +uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + if( rModel.pDoc ) + { + SdPage* pPage = rModel.InsertSdPage( (sal_uInt16)nIndex ); + if( pPage ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); + return xDrawPage; + } + } + uno::Reference< drawing::XDrawPage > xDrawPage; + return xDrawPage; +} + +/****************************************************************************** +* Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen * +* Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model * +* nach dem entfernen dieser Seite vorhanden ist. * +******************************************************************************/ +void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + sal_uInt16 nPageCount = rModel.pDoc->GetSdPageCount( PK_STANDARD ); + if( nPageCount > 1 ) + { + // pPage von xPage besorgen und dann die Id (nPos )ermitteln + SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage ); + if( pSvxPage ) + { + SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage(); + if(pPage) + { + // Es duerfen nur Standardpages DIREKT geloescht werden + if( pPage->GetPageKind() == PK_STANDARD ) + { + sal_uInt16 nPage = pPage->GetPageNum(); + rModel.pDoc->RemovePage( nPage ); + + // Die darauffolgende Seite ist die dazugeoerige Notizseite + rModel.pDoc->RemovePage( nPage ); + } + } + pSvxPage->Invalidate(); + } + } + + rModel.SetModified(); +} + +// XServiceInfo +sal_Char pSdDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages"; + +OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdDrawPagesAccess" ) ); +} + +sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdDrawPagesAccessService ) ); +} + +uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) +{ + OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdDrawPagesAccessService ) ); + uno::Sequence< OUString > aSeq( &aService, 1 ); + return aSeq; +} + +//============================================================================= +// class SdMasterPagesAccess +//============================================================================= + +SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw() +: rModel(rMyModel) +{ + rModel.acquire(); +} + +SdMasterPagesAccess::~SdMasterPagesAccess() throw() +{ + rModel.release(); +} + +// XIndexAccess +sal_Int32 SAL_CALL SdMasterPagesAccess::getCount() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + return rModel.pDoc->GetMasterSdPageCount(PK_STANDARD); +} + +/****************************************************************************** +* Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der * +* angegebennen Position im Model. * +******************************************************************************/ +uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + uno::Any aAny; + + if( (Index < 0) || (Index >= rModel.pDoc->GetMasterSdPageCount( PK_STANDARD ) ) ) + throw lang::IndexOutOfBoundsException(); + + SdPage* pPage = rModel.pDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD ); + if( pPage ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); + aAny <<= xDrawPage; + } + + return aAny; +} + +// XElementAccess +uno::Type SAL_CALL SdMasterPagesAccess::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE(drawing::XDrawPage); +} + +sal_Bool SAL_CALL SdMasterPagesAccess::hasElements() + throw(uno::RuntimeException) +{ + return getCount() > 0; +} + +// XDrawPages +uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + uno::Reference< drawing::XDrawPage > xDrawPage; + + SdDrawDocument* pDoc = rModel.pDoc; + if( pDoc ) + { + // calculate internal index and check for range errors + const sal_Int32 nMPageCount = pDoc->GetMasterPageCount(); + nInsertPos = nInsertPos * 2 + 1; + if( nInsertPos < 0 || nInsertPos > nMPageCount ) + nInsertPos = nMPageCount; + + // now generate a unique name for the new masterpage + const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) ); + String aPrefix( aStdPrefix ); + + sal_Bool bUnique = sal_True; + sal_Int32 i = 0; + do + { + bUnique = sal_True; + for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ ) + { + SdPage* pPage = (SdPage*)pDoc->GetMasterPage((USHORT)nMaster); + if( pPage && pPage->GetName() == aPrefix ) + { + bUnique = sal_False; + break; + } + } + + if( !bUnique ) + { + i++; + aPrefix = aStdPrefix; + aPrefix += sal_Unicode( ' ' ); + aPrefix += String::CreateFromInt32( i ); + } + + } while( !bUnique ); + + String aLayoutName( aPrefix ); + aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); + aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE)); + + // create styles + ((SdStyleSheetPool*)pDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix ); + + // get the first page for initial size and border settings + SdPage* pPage = rModel.pDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD ); + SdPage* pRefNotesPage = rModel.pDoc->GetSdPage( (sal_uInt16)0, PK_NOTES); + + // create and instert new draw masterpage + SdPage* pMPage = (SdPage*)rModel.pDoc->AllocPage(sal_True); + pMPage->SetSize( pPage->GetSize() ); + pMPage->SetBorder( pPage->GetLftBorder(), + pPage->GetUppBorder(), + pPage->GetRgtBorder(), + pPage->GetLwrBorder() ); + pDoc->InsertMasterPage(pMPage, (USHORT)nInsertPos); + pMPage->SetLayoutName( aLayoutName ); + + { // insert background object + Point aBackgroundPos ( pMPage->GetLftBorder(), pMPage->GetUppBorder() ); + Size aBackgroundSize ( pMPage->GetSize() ); + aBackgroundSize.Width() -= pMPage->GetLftBorder() + pMPage->GetRgtBorder() - 1; + aBackgroundSize.Height() -= pMPage->GetUppBorder() + pMPage->GetLwrBorder() - 1; + Rectangle aBackgroundRect (aBackgroundPos, aBackgroundSize); + pMPage->CreatePresObj(PRESOBJ_BACKGROUND, FALSE, aBackgroundRect, sal_True ); + } + + xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() ); + + // create and instert new notes masterpage + SdPage* pMNotesPage = (SdPage*)rModel.pDoc->AllocPage(sal_True); + pMNotesPage->SetSize( pRefNotesPage->GetSize() ); + pMNotesPage->SetPageKind(PK_NOTES); + pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(), + pRefNotesPage->GetUppBorder(), + pRefNotesPage->GetRgtBorder(), + pRefNotesPage->GetLwrBorder() ); + pDoc->InsertMasterPage(pMNotesPage, nInsertPos + 1); +// pMNotesPage->InsertMasterPage( pMPage->GetPageNum() ); + pMNotesPage->SetLayoutName( aLayoutName ); + pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True); + rModel.SetModified(); + } + + return( xDrawPage ); +} + +/****************************************************************************** +* Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen * +* Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese * +* Seite als Masterpage benutzt. * +******************************************************************************/ +void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.pDoc ) + throw lang::DisposedException(); + + SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage ); + if(pSdPage == NULL) + return; + + SdrPage* pSdrPage = pSdPage->GetSdrPage(); + + DBG_ASSERT( pSdrPage->IsMasterPage(), "SdMasterPage is not masterpage?"); + + if(rModel.pDoc->GetMasterPageUserCount(pSdrPage) > 0) + return; //Todo: hier fehlt eine uno::Exception + + sal_uInt16 nCount = rModel.pDoc->GetMasterPageCount(); + for( sal_uInt16 nPgNum = 0; nPgNum < nCount; nPgNum++ ) + { + if(rModel.pDoc->GetMasterPage(nPgNum) == pSdrPage) + { + rModel.pDoc->DeleteMasterPage(nPgNum); + break; + } + } + + pSdPage->Invalidate(); +} + +// XServiceInfo +sal_Char pSdMasterPagesAccessService[sizeof("com.sun.star.drawing.MasterPages")] = "com.sun.star.drawing.MasterPages"; + +OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdMasterPagesAccess" ) ); +} + +sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdMasterPagesAccessService ) ); +} + +uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) +{ + OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdMasterPagesAccessService ) ); + uno::Sequence< OUString > aSeq( &aService, 1 ); + return aSeq; +} + +//============================================================================= +// class SdDocLinkTargets +//============================================================================= + +SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw() +: rModel( rMyModel ) +{ + rModel.acquire(); +} + +SdDocLinkTargets::~SdDocLinkTargets() throw() +{ + rModel.release(); +} + +// XNameAccess +uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.GetDoc() ) + throw lang::DisposedException(); + + SdPage* pPage = FindPage( aName ); + + if( pPage == NULL ) + throw container::NoSuchElementException(); + + uno::Any aAny; + + uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY ); + if( xProps.is() ) + aAny <<= xProps; + + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.GetDoc() ) + throw lang::DisposedException(); + + SdDrawDocument* pDoc = rModel.GetDoc(); + if( pDoc == NULL ) + { + uno::Sequence< OUString > aSeq; + return aSeq; + } + + const sal_uInt16 nMaxPages = pDoc->GetPageCount(); + const sal_uInt16 nMaxMasterPages = pDoc->GetMasterPageCount(); + + uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages ); + OUString* pStr = aSeq.getArray(); + + sal_uInt16 nPage; + // standard pages + for( nPage = 0; nPage < nMaxPages; nPage++ ) + *pStr++ = ((SdPage*)pDoc->GetPage( nPage ))->GetName(); + + // master pages + for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) + *pStr++ = ((SdPage*)pDoc->GetMasterPage( nPage ))->GetName(); + + return aSeq; +} + +sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( NULL == rModel.GetDoc() ) + throw lang::DisposedException(); + + return FindPage( aName ) != NULL; +} + +// container::XElementAccess +uno::Type SAL_CALL SdDocLinkTargets::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE(beans::XPropertySet); +} + +sal_Bool SAL_CALL SdDocLinkTargets::hasElements() + throw(uno::RuntimeException) +{ + SdDrawDocument* pDoc = rModel.GetDoc(); + return pDoc != NULL; +} + +SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw() +{ + SdDrawDocument* pDoc = rModel.GetDoc(); + if( pDoc == NULL ) + return NULL; + + const sal_uInt16 nMaxPages = pDoc->GetPageCount(); + const sal_uInt16 nMaxMasterPages = pDoc->GetMasterPageCount(); + + sal_uInt16 nPage; + SdPage* pPage; + + const String aName( rName ); + + // standard pages + for( nPage = 0; nPage < nMaxPages; nPage++ ) + { + pPage = (SdPage*)pDoc->GetPage( nPage ); + if( pPage->GetName() == aName ) + return pPage; + } + + // master pages + for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) + { + pPage = (SdPage*)pDoc->GetMasterPage( nPage ); + if( pPage->GetName() == aName ) + return pPage; + } + + return NULL; +} + +// XServiceInfo +OUString SAL_CALL SdDocLinkTargets::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDocLinkTargets") ); +} + +sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") ); + uno::Sequence< OUString > aSeq( &aSN, 1 ); + return aSeq; +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unoobj.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unoobj.cxx new file mode 100644 index 000000000000..c83583f088b4 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unoobj.cxx @@ -0,0 +1,1730 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <rtl/ustrbuf.hxx> + +#include <comphelper/stl_types.hxx> + +#include <bf_svtools/style.hxx> + +#include <bf_svtools/unoimap.hxx> +#include <bf_svtools/unoevent.hxx> + +#include <vcl/svapp.hxx> + +#include <bf_sfx2/sfxsids.hrc> +#include <comphelper/extract.hxx> +#include <bf_svx/unoshape.hxx> +#include <bf_svx/svditer.hxx> +#include <bf_svx/unoapi.hxx> + +#include <bf_svx/svdopath.hxx> + +#include <bf_svx/svdoole2.hxx> +#include <bf_svx/svdograf.hxx> +#include <bf_svx/outlobj.hxx> + +#include "sdoutl.hxx" + +#include "sdresid.hxx" + +#include "anminfo.hxx" +#include "unohelp.hxx" +#include "unoobj.hxx" +#include "unoprnms.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "unokywds.hxx" +#include "unopsfm.hxx" +#include "unogsfm.hxx" +#include "unopstyl.hxx" +#include "unopage.hxx" + +#include "bf_sd/docshell.hxx" +#include "helpids.h" +#include "glob.hrc" +#include "unolayer.hxx" +#include "imapinfo.hxx" +namespace binfilter { + +#ifndef SEQTYPE + #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) + #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x )) + #else + #define SEQTYPE(x) &(x) + #endif +#endif + +using namespace ::rtl; +using namespace ::com::sun::star; + +/////////////////////////////////////////////////////////////////////// + +DECLARE_STL_STDKEY_MAP(sal_uIntPtr, SfxExtItemPropertySetInfo*, SdExtPropertySetInfoCache); +static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache; +static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache; + +DECLARE_STL_STDKEY_MAP(sal_uInt32, uno::Sequence< uno::Type >*, SdTypesCache); +static SdTypesCache gImplTypesCache; + +/////////////////////////////////////////////////////////////////////// + + +#define WID_EFFECT 1 +#define WID_SPEED 2 +#define WID_TEXTEFFECT 3 +#define WID_BOOKMARK 4 +#define WID_CLICKACTION 5 +#define WID_PLAYFULL 6 +#define WID_SOUNDFILE 7 +#define WID_SOUNDON 8 +#define WID_BLUESCREEN 9 +#define WID_VERB 10 +#define WID_DIMCOLOR 11 +#define WID_DIMHIDE 12 +#define WID_DIMPREV 13 +#define WID_PRESORDER 14 +#define WID_STYLE 15 +#define WID_ANIMPATH 16 +#define WID_IMAGEMAP 17 +#define WID_ISANIMATION 18 + +#define WID_ISEMPTYPRESOBJ 20 +#define WID_ISPRESOBJ 21 +#define WID_MASTERDEPEND 22 + +#define WID_THAT_NEED_ANIMINFO 19 + +const SfxItemPropertyMap* ImplGetShapePropertyMap( sal_Bool bImpress, sal_Bool bGraphicObj ) +{ + // Achtung: Der erste Parameter MUSS sortiert vorliegen !!! + static const SfxItemPropertyMap aImpress_SdXShapePropertyMap_Impl[] = + { + { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH), WID_ANIMPATH, &ITYPE(drawing::XShape), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR), WID_DIMCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMHIDE), WID_DIMHIDE, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMPREV), WID_DIMPREV, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_EFFECT), WID_EFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_ISEMPTYPRESOBJ),WID_ISEMPTYPRESOBJ, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_ISPRESOBJ), WID_ISPRESOBJ, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_MASTERDEPENDENT),WID_MASTERDEPEND, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_PLAYFULL), WID_PLAYFULL, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_PRESORDER), WID_PRESORDER, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE( style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_SOUNDFILE, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDON), WID_SOUNDON, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_SPEED), WID_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_TEXTEFFECT), WID_TEXTEFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_BLUESCREEN), WID_BLUESCREEN, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_VERB), WID_VERB, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN("IsAnimation"), WID_ISANIMATION, &::getBooleanCppuType(), 0, 0}, + { 0,0,0,0,0} + }; + + static const SfxItemPropertyMap aDraw_SdXShapePropertyMap_Impl[] = + { + { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &ITYPE(container::XIndexContainer), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE(style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { 0,0,0,0,0} + }; + + if( bImpress ) + return &aImpress_SdXShapePropertyMap_Impl[ bGraphicObj ? 0 : 1 ]; + else + return &aDraw_SdXShapePropertyMap_Impl[ bGraphicObj ? 0 : 1 ]; +} + +SfxItemPropertyMap aEmpty_SdXShapePropertyMap_Impl[] = +{ + { 0,0,0,0,0} +}; + +const SvEventDescription* ImplGetSupportedMacroItems() +{ + static const SvEventDescription aMacroDescriptionsImpl[] = + { + { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, + { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, + { 0, NULL } + }; + + return aMacroDescriptionsImpl; +} + +/************************************************************************* +|* +|* Vergleichsfkt. fuer QSort +|* +\************************************************************************/ +struct SortStruct +{ + SdrObject* pObj; + sal_uInt32 nOrder; +}; + +typedef SortStruct SORT; +typedef SORT* PSORT; + +static int SortFunc( const void* p1, const void* p2 ) +{ + const PSORT pCmp1 = (const PSORT) p1; + const PSORT pCmp2 = (const PSORT) p2; + return ( pCmp1->nOrder < pCmp2->nOrder ? -1 : pCmp1->nOrder > pCmp2->nOrder ? 1 : 0 ); +} + +SdXShape::SdXShape( SvxShape* pShape, SdXImpressDocument* pModel) throw() +: maPropSet( pModel? + ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF ) + : aEmpty_SdXShapePropertyMap_Impl ), + mpMap( pModel? + ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF ) + : aEmpty_SdXShapePropertyMap_Impl ), + mpModel(pModel), + mpImplementationId( NULL ), + mpShape( pShape ) +{ + pShape->setMaster( this ); +} + +SdXShape::~SdXShape() throw() +{ +} + +void SdXShape::dispose() +{ + mpShape->setMaster( NULL ); + delete this; +} + +// XInterface +uno::Any SAL_CALL SdXShape::queryAggregation( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + uno::Any aAny; + mpShape->queryAggregation( rType, aAny ); + return aAny; +} + +uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + return mpShape->queryInterface( rType ); +} + +void SAL_CALL SdXShape::acquire() throw() +{ + mpShape->acquire(); +} + +void SAL_CALL SdXShape::release() throw() +{ + mpShape->release(); +} + +sal_Bool SdXShape::queryAggregation( const ::com::sun::star::uno::Type & rType, ::com::sun::star::uno::Any& aAny ) +{ + if( mpModel && mpModel ->IsImpressDocument() ) + { + if( rType == ::getCppuType(( const uno::Reference< document::XEventsSupplier >*)0) ) + { + aAny <<= uno::Reference< document::XEventsSupplier >(this); + return sal_True; + } + } + + return sal_False; +} + +uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes() + throw (uno::RuntimeException) +{ + if( mpModel && !mpModel->IsImpressDocument() ) + { + return mpShape->_getTypes(); + } + else + { + const sal_uInt32 nObjId = mpShape->getShapeKind(); + uno::Sequence< uno::Type >* pTypes; + SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) ); + if( aIter == gImplTypesCache.end() ) + { + pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() ); + sal_uInt32 nCount = pTypes->getLength(); + pTypes->realloc( nCount+1 ); + (*pTypes)[nCount] = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); + + gImplTypesCache[ nObjId ] = pTypes; + } + else + { + // use the already computed implementation id + pTypes = (*aIter).second; + } + return *pTypes; + } +} + +// XPropertyState +beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( maPropSet.getPropertyMapEntry(PropertyName) ) + { + return beans::PropertyState_DIRECT_VALUE; + } + else + { + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj == NULL || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) ) + return beans::PropertyState_DEFAULT_VALUE; + + return mpShape->_getPropertyState( PropertyName ); + } +} + +void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( maPropSet.getPropertyMapEntry(PropertyName) ) + { + return; + } + else + { + mpShape->_setPropertyToDefault(PropertyName); + } +} + +uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( maPropSet.getPropertyMapEntry(aPropertyName) ) + { + return getPropertyValue( aPropertyName ); + } + else + { + uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) ); + + if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) ) + { + OUString aName; + if( aRet >>= aName ) + { + aName = SdLayer::convertToExternalName( aName ); + aRet <<= aName; + } + } + return aRet; + } +} + +//XPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException) +{ + sal_uIntPtr nObjId = (sal_uIntPtr)mpShape->getPropertyMap(); + SfxExtItemPropertySetInfo* pInfo = NULL; + + SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ? + &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache; + + SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) ); + if( aIter == pCache->end() ) + { + uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() ); + pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() ); + pInfo->acquire(); + + (*pCache)[ nObjId ] = pInfo; + } + else + { + // use the already computed implementation id + pInfo = (*aIter).second; + } + + uno::Reference< beans::XPropertySetInfo > xInfo( pInfo ); + return pInfo; +} + +void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(aPropertyName); + + if( pMap ) + { + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj ) + { + SdAnimationInfo* pInfo = GetAnimationInfo((pMap->nWID <= WID_THAT_NEED_ANIMINFO)?sal_True:sal_False); + + switch(pMap->nWID) + { + case WID_EFFECT: + ::cppu::any2enum< presentation::AnimationEffect >( pInfo->eEffect, aValue ); + break; + case WID_TEXTEFFECT: + ::cppu::any2enum< presentation::AnimationEffect >( pInfo->eTextEffect, aValue); + break; + case WID_SPEED: + ::cppu::any2enum< presentation::AnimationSpeed >( pInfo->eSpeed, aValue); + break; + case WID_ISANIMATION: + { + sal_Bool bIsAnimation; + if(!(aValue >>= bIsAnimation)) + throw lang::IllegalArgumentException(); + + pInfo->bIsMovie = bIsAnimation; + break; + } + case WID_BOOKMARK: + { + OUString aString; + if(!(aValue >>= aString)) + throw lang::IllegalArgumentException(); + + pInfo->aBookmark = SdDrawPage::getUiNameFromPageApiName( aString ); + break; + } + case WID_CLICKACTION: + ::cppu::any2enum< presentation::ClickAction >( pInfo->eClickAction, aValue); + break; + case WID_PLAYFULL: + pInfo->bPlayFull = ::cppu::any2bool(aValue); + break; + case WID_SOUNDFILE: + { + OUString aString; + if(!(aValue >>= aString)) + throw lang::IllegalArgumentException(); + pInfo->aSoundFile = aString; + break; + } + case WID_SOUNDON: + pInfo->bSoundOn = ::cppu::any2bool(aValue); + break; + case WID_BLUESCREEN: + { + sal_Int32 nColor; + if(!(aValue >>= nColor)) + throw lang::IllegalArgumentException(); + + pInfo->aBlueScreen.SetColor( nColor ); + break; + } + case WID_VERB: + { + sal_Int32 nVerb; + if(!(aValue >>= nVerb)) + throw lang::IllegalArgumentException(); + + pInfo->nVerb = (USHORT)nVerb; + break; + } + case WID_DIMCOLOR: + { + sal_Int32 nColor; + if(!(aValue >>= nColor)) + throw lang::IllegalArgumentException(); + + pInfo->aDimColor.SetColor( (ColorData) nColor ); + break; + } + case WID_DIMHIDE: + pInfo->bDimHide = ::cppu::any2bool(aValue); + break; + case WID_DIMPREV: + pInfo->bDimPrevious = ::cppu::any2bool(aValue); + break; + case WID_PRESORDER: + { + sal_Int32 nPos; + if(!(aValue >>= nPos)) + throw lang::IllegalArgumentException(); + + SetPresentationOrderPos( nPos ); + break; + } + case WID_STYLE: + SetStyleSheet( aValue ); + break; + case WID_ISEMPTYPRESOBJ: + SetEmptyPresObj( ::cppu::any2bool(aValue) ); + break; + case WID_MASTERDEPEND: + SetMasterDepend( ::cppu::any2bool(aValue) ); + break; + case WID_ANIMPATH: + { + uno::Reference< drawing::XShape > xShape; + aValue >>= xShape; + + SdrObject* pObj = NULL; + if(xShape.is()) + pObj = GetSdrObjectFromXShape( xShape ); + + if( pObj == NULL || !pObj->ISA( SdrPathObj ) ) + throw lang::IllegalArgumentException(); + + pInfo->pPathObj = (SdrPathObj*)pObj; + + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if( pDoc ) + { + pInfo = pDoc->GetAnimationInfo(pObj); + if( pInfo == NULL ) + { + pInfo = new SdAnimationInfo(pDoc); + pObj->InsertUserData( pInfo ); + } + pInfo->bInvisibleInPresentation = sal_True; + } + + break; + } + case WID_IMAGEMAP: + { + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if( pDoc ) + { + ImageMap aImageMap; + uno::Reference< uno::XInterface > xImageMap; + aValue >>= xImageMap; + + if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) ) + throw lang::IllegalArgumentException(); + + SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(pObj); + if( pIMapInfo ) + { + // replace existing image map + pIMapInfo->SetImageMap( aImageMap ); + } + else + { + // insert new user data with image map + pObj->InsertUserData(new SdIMapInfo(aImageMap) ); + } + } + } + } + } + } + else + { + uno::Any aAny( aValue ); + + if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) ) + { + OUString aName; + if( aAny >>= aName ) + { + aName = SdLayer::convertToInternalName( aName ); + aAny <<= aName; + } + } + else if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_zorder ) ) ) + { + SdrObject* pObj = mpShape->GetSdrObject(); + SdPage* pPage = pObj ? (SdPage*)pObj->GetPage() : NULL; + if( pPage && pPage == pObj->GetObjList() && pPage->IsMasterPage() && pPage->GetPageKind() == PK_STANDARD ) + { + sal_Int32 nOrdNum; + if( aAny >>= nOrdNum ) + { + // if this is a masterpage, there is always a background shape with the ord num 0 + // so we add one to the api ordnum to hide the background shape over the api + nOrdNum++; + aAny <<= nOrdNum; + } + } + } + + mpShape->_setPropertyValue(aPropertyName, aAny); + } + + if( mpModel ) + mpModel->SetModified(); +} + +::com::sun::star::uno::Any SAL_CALL SdXShape::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aRet; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(PropertyName); + + if( pMap && mpShape->GetSdrObject() ) + { + SdAnimationInfo* pInfo = GetAnimationInfo(sal_False); + + switch(pMap->nWID) + { + case WID_EFFECT: + aRet = ::cppu::enum2any< presentation::AnimationEffect >( pInfo?pInfo->eEffect:presentation::AnimationEffect_NONE ); + break; + case WID_TEXTEFFECT: + aRet = ::cppu::enum2any< presentation::AnimationEffect >( pInfo?pInfo->eTextEffect:presentation::AnimationEffect_NONE ); + break; + case WID_ISPRESOBJ: + aRet <<= (sal_Bool)IsPresObj(); + break; + case WID_ISEMPTYPRESOBJ: + aRet <<= (sal_Bool)IsEmptyPresObj(); + break; + case WID_MASTERDEPEND: + aRet <<= (sal_Bool)IsMasterDepend(); + break; + case WID_SPEED: + aRet = ::cppu::enum2any< presentation::AnimationSpeed >( pInfo?pInfo->eSpeed:presentation::AnimationSpeed_MEDIUM ); + break; + case WID_ISANIMATION: + aRet <<= (sal_Bool)( pInfo && pInfo->bIsMovie); + break; + case WID_BOOKMARK: + { + OUString aString; + if( pInfo ) + aString = SdDrawPage::getPageApiNameFromUiName( pInfo->aBookmark ); + + aRet <<= aString; + break; + } + case WID_CLICKACTION: + aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->eClickAction:presentation::ClickAction_NONE ); + break; + case WID_PLAYFULL: + aRet <<= (sal_Bool)( pInfo && pInfo->bPlayFull ); + break; + case WID_SOUNDFILE: + { + OUString aString; + if( pInfo ) + aString = pInfo->aSoundFile ; + aRet <<= aString; + break; + } + case WID_SOUNDON: + aRet <<= (sal_Bool)( pInfo && pInfo->bSoundOn ); + break; + case WID_BLUESCREEN: + aRet <<= (sal_Int32)( pInfo?pInfo->aBlueScreen.GetColor():0x00ffffff ); + break; + case WID_VERB: + aRet <<= (sal_Int32)( pInfo?pInfo->nVerb:0 ); + break; + case WID_DIMCOLOR: + aRet <<= (sal_Int32)( pInfo?pInfo->aDimColor.GetColor():0x00ffffff ); + break; + case WID_DIMHIDE: + aRet <<= (sal_Bool)( pInfo && pInfo->bDimHide ); + break; + case WID_DIMPREV: + aRet <<= (sal_Bool)( pInfo && pInfo->bDimPrevious ); + break; + case WID_PRESORDER: + aRet <<= (sal_Int32)( GetPresentationOrderPos() ); + break; + case WID_STYLE: + aRet = GetStyleSheet(); + break; + case WID_ANIMPATH: + if( pInfo && pInfo->pPathObj ) + aRet <<= pInfo->pPathObj->getUnoShape(); + break; + case WID_IMAGEMAP: + { + uno::Reference< uno::XInterface > xImageMap; + + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if( pDoc ) + { + + SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(mpShape->GetSdrObject()); + if( pIMapInfo ) + { + const ImageMap& rIMap = pIMapInfo->GetImageMap(); + xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() ); + } + else + { + xImageMap = SvUnoImageMap_createInstance(ImplGetSupportedMacroItems() ); + } + } + + aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap ); + break; + } + } + } + else + { + aRet = mpShape->_getPropertyValue(PropertyName); + + if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) ) + { + OUString aName; + if( aRet >>= aName ) + { + aName = SdLayer::convertToExternalName( aName ); + aRet <<= aName; + } + } + else if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_zorder ) ) ) + { + SdrObject* pObj = mpShape->GetSdrObject(); + SdPage* pPage = pObj ? (SdPage*)pObj->GetPage() : NULL; + if( pPage && pPage == pObj->GetObjList() && pPage->IsMasterPage() && pPage->GetPageKind() == PK_STANDARD ) + { + sal_Int32 nOrdNum; + if( aRet >>= nOrdNum ) + { + // if this is a masterpage, there is always a background shape with the ord num 0 + // so we add one to the api ordnum to hide the background shape over the api + if( nOrdNum > 0 ) + { + nOrdNum--; + aRet <<= nOrdNum; + } + else + { + DBG_ERROR( "Masterpage without a background shape, ZOrder property will be corrupt!" ); + } + } + } + } + + } + + return aRet; +} + +/** */ +SdAnimationInfo* SdXShape::GetAnimationInfo( sal_Bool bCreate ) const throw() +{ + SdAnimationInfo* pInfo = NULL; + + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if(pDoc) + { + SdrObject* pObj = mpShape->GetSdrObject(); + if(pObj) + { + pInfo = pDoc->GetAnimationInfo(pObj); + if( pInfo == NULL && bCreate ) + { + pInfo = new SdAnimationInfo(pDoc); + pObj->InsertUserData( pInfo ); + } + } + } + + return pInfo; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SdXShape::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) +{ + uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() ); + + SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.presentation.Shape", + "com.sun.star.document.LinkTarget" ); + + SdrObject* pObj = mpShape->GetSdrObject(); + if(pObj && pObj->GetObjInventor() == SdrInventor ) + { + sal_uInt32 nInventor = pObj->GetObjIdentifier(); + switch( nInventor ) + { + case OBJ_TITLETEXT: + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.TitleTextShape" ); + break; + case OBJ_OUTLINETEXT: + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.OutlinerShape" ); + break; + } + } + return aSeq; +} + +/** checks if this is a presentation object + */ +sal_Bool SdXShape::IsPresObj() const throw() +{ + SdrObject* pObj = mpShape->GetSdrObject(); + if(pObj) + { + SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + if(pPage) + return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE; + } + return sal_False; +} + +/** checks if this presentation object is empty + */ +sal_Bool SdXShape::IsEmptyPresObj() const throw() +{ + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj == NULL || !pObj->IsEmptyPresObj() ) + return sal_False; + + // check if the object is in edit, than its temporarely not empty + SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, pObj ); + return (NULL == pTextObj) || ( NULL == pTextObj->GetEditOutlinerParaObject() ); +} + +/** sets/reset the empty status of a presentation object +*/ +void SdXShape::SetEmptyPresObj( sal_Bool bEmpty ) throw() +{ + // only possible if this actually *is* a presentation object + if( !IsPresObj() ) + return; + + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj == NULL ) + return; + + if( pObj->IsEmptyPresObj() != bEmpty ) + { + if(!bEmpty) + { + OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); + const sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False; + + // really delete SdrOutlinerObj at pObj + pObj->NbcSetOutlinerParaObject(0L); + if( bVertical && PTR_CAST( SdrTextObj, pObj ) ) + ((SdrTextObj*)pObj)->SetVerticalWriting( sal_True ); + + SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj ); + if( pGraphicObj ) + { + Graphic aEmpty; + pGraphicObj->SetGraphic(aEmpty); + } + else + { + SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj ); + if( pOleObj ) + { + pOleObj->SetGraphic( NULL ); + } + } + } + else + { + // now set an empty OutlinerParaObject at pObj without + // any content but with the style of the old OutlinerParaObjects + // first paragraph + do + { + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + DBG_ASSERT( pDoc, "no document?" ); + if( pDoc == NULL) + break; + + SdOutliner* pOutliner = pDoc->GetInternalOutliner(); + DBG_ASSERT( pOutliner, "no outliner?" ); + if( pOutliner == NULL ) + break; + + SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + DBG_ASSERT( pPage, "no page?" ); + if( pPage == NULL ) + break; + + OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject(); + pOutliner->SetText( *pOutlinerParaObject ); + SfxStyleSheetPool* pStyle = pOutliner->GetStyleSheetPool(); + const sal_Bool bVertical = pOutliner->IsVertical(); + + pOutliner->Clear(); + pOutliner->SetVertical( bVertical ); + pOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)pDoc->GetStyleSheetPool() ); + pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) ); + pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) ); + pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() ); + pOutliner->Clear(); + } + while(0); + } + + pObj->SetEmptyPresObj(bEmpty); + } +} + +sal_Bool SdXShape::IsMasterDepend() const throw() +{ + SdrObject* pObj = mpShape->GetSdrObject(); + return pObj && pObj->GetUserCall() != NULL; +} + +void SdXShape::SetMasterDepend( sal_Bool bDepend ) throw() +{ + if( IsMasterDepend() != bDepend ) + { + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj ) + { + if( bDepend ) + { + SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + pObj->SetUserCall( pPage ); + } + else + { + pObj->SetUserCall( NULL ); + } + } + } +} + +/** + */ +inline sal_Bool IsPathObj( SdrObject* pObj, SdAnimationInfo* pInfo ) +{ + // Wenn es sich um das Pfad-Objekt bei dem Effekt "An Kurve entlang" + // handelt, soll es nicht in der Tabelle aufgenommen werden + // "bInvisibleInPresentation" ist der einzige Hinweis darauf, ob + // es sich um das Pfad-Objekt handelt + + const SdrObjKind eKind = (SdrObjKind)pObj->GetObjIdentifier(); + return pInfo->bInvisibleInPresentation && + pObj->GetObjInventor() == SdrInventor && + (eKind == OBJ_LINE || eKind == OBJ_PLIN || eKind == OBJ_PATHLINE ); +} + +/** Returns the position of the given SdrObject in the Presentation order. + * This function returns -1 if the SdrObject is not in the Presentation order + * or if its the path-object. + */ +sal_Int32 SdXShape::GetPresentationOrderPos() const throw() +{ + SdrObject* pObj = mpShape->GetSdrObject(); + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if(pDoc == NULL || pObj == NULL) + return -1; + + SdrObjListIter aIter( *pObj->GetPage(), IM_FLAT ); + + + SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pObj ); + if(pInfo == NULL || pInfo->bActive == sal_False || IsPathObj( pObj, pInfo ) ) + return -1; + + sal_Int32 nPos = 0; + + while( aIter.IsMore() ) + { + SdrObject* pIterObj = aIter.Next(); + if(pIterObj == pObj) + continue; + + SdAnimationInfo* pIterInfo = pDoc->GetAnimationInfo( pIterObj ); + if( pIterInfo ) + { + if( !IsPathObj(pIterObj, pIterInfo ) ) + { + if( pIterInfo->nPresOrder < pInfo->nPresOrder ) + nPos++; + } + } + } + + return nPos; +} + + +/** Sets the position of the given SdrObject in the Presentation order. + */ +void SdXShape::SetPresentationOrderPos( sal_Int32 nPos ) throw() +{ + SdrObject* pObj = mpShape->GetSdrObject(); + SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; + if(pDoc == 0 || pObj == NULL) + return; + + List aAnmList; + + // Erstmal alle animierten Objekte in eine List packen, + // ausgenommen unser eigenes + SdrObjListIter aIter( *pObj->GetPage(), IM_FLAT ); + while( aIter.IsMore()) + { + SdrObject* pIterObj = aIter.Next(); + if( pIterObj != pObj && pDoc->GetAnimationInfo( pIterObj ) ) + aAnmList.Insert(pIterObj, LIST_APPEND); + } + + const sal_Int32 nCount = aAnmList.Count(); + + if ( nCount ) + { + PSORT pSort = new SORT[ nCount ]; + sal_Int32 nOrderIndex = 0; + sal_Int32 nAppendIndex = LIST_APPEND - nCount; + + for( SdrObject* pIterObj = (SdrObject*) aAnmList.First(); pIterObj; pIterObj = (SdrObject*) aAnmList.Next() ) + { + const SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pIterObj ); + PSORT pSortTmp = &pSort[ nOrderIndex++ ]; + + pSortTmp->pObj = pIterObj; + pSortTmp->nOrder = ( pInfo->nPresOrder != LIST_APPEND ) ? pInfo->nPresOrder : nAppendIndex++; + } + + // Liste loeschen, die Information steckt jetzt im Array + aAnmList.Clear(); + + // Array nach Ordnungsnummern sortieren + qsort( pSort, nCount, sizeof( SORT ), SortFunc ); + + // Animationliste neu aufbauen + for( sal_Int32 i = 0; i < nCount; i++ ) + aAnmList.Insert( pSort[ i ].pObj, LIST_APPEND ); + + delete[] pSort; + } + + aAnmList.Insert(pObj, nPos); + + sal_Int32 nIdx = 0; + for( SdrObject* pIterObj = (SdrObject*) aAnmList.First(); pIterObj; pIterObj = (SdrObject*) aAnmList.Next() ) + { + SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pIterObj ); + pInfo->nPresOrder = nIdx++; + } +} + +void SdXShape::SetStyleSheet( const uno::Any& rAny ) throw( lang::IllegalArgumentException ) +{ + SdUnoPseudoStyle* pStyleSheet = NULL; + + if( rAny.hasValue() && rAny.getValueTypeClass() == uno::TypeClass_INTERFACE ) + pStyleSheet = SdUnoPseudoStyle::getImplementation(*(uno::Reference< uno::XInterface > *)rAny.getValue() ); + + SdrObject* pObj = mpShape->GetSdrObject(); + + // check if it is a style and if its not a presentation style + if( NULL == pObj || NULL == pStyleSheet || pStyleSheet->getStyleSheet()->GetFamily() == SFX_STYLE_FAMILY_PSEUDO ) + throw lang::IllegalArgumentException(); + + // check if this is a praesentation object by checking the stylesheet + const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet(); + const SfxStyleSheet* pNewStyleSheet = (SfxStyleSheet*)pStyleSheet->getStyleSheet(); + + if( pOldStyleSheet == pNewStyleSheet ) + return; + + if( pOldStyleSheet && (pOldStyleSheet->GetFamily() != SFX_STYLE_FAMILY_PARA) ) + throw lang::IllegalArgumentException(); + + pObj->SetStyleSheet( (SfxStyleSheet*)pStyleSheet->getStyleSheet(), sal_False ); + + SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : NULL; +} + +uno::Any SdXShape::GetStyleSheet() const throw( beans::UnknownPropertyException ) +{ + SdrObject* pObj = mpShape->GetSdrObject(); + if( pObj == NULL ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; + + SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet(); + if(!pStyleSheet) + return aAny; + + // it is possible for shapes inside a draw to have a presentation style + // but we don't want this for the api + if( pStyleSheet->GetFamily() != SFX_STYLE_FAMILY_PARA && !mpModel->IsImpressDocument() ) + return aAny; + + // style::XStyleFamiliesSupplier + uno::Reference< container::XNameAccess > xFamilies( mpModel->getStyleFamilies() ); + + uno::Reference< style::XStyle > xStyle; + + if( pStyleSheet->GetFamily() != SFX_STYLE_FAMILY_PARA ) + { + SdrPage* pPage = pObj->GetPage(); + if( !pPage->IsMasterPage() ) + { + if( 0 == pPage->GetMasterPageCount() ) + return aAny; + + pPage = pPage->GetMasterPage(0); + } + + String aLayoutName( pPage->GetLayoutName() ); + aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ) ))); + + aAny = xFamilies->getByName( aLayoutName ); + uno::Reference< container::XNameAccess > xStyleFam( *(uno::Reference< container::XNameAccess > *)aAny.getValue() ); + + SdUnoPseudoStyleFamily *pStyleFamily = SdUnoPseudoStyleFamily::getImplementation( xStyleFam ); + if( pStyleFamily ) + pStyleFamily->createStyle( pStyleSheet, xStyle ); + } + else + { + const OUString aSFN( OUString::createFromAscii( sUNO_Graphic_Style_Family_Name ) ); + aAny = xFamilies->getByName( aSFN ); + uno::Reference< container::XNameAccess > xStyleFam( *(uno::Reference< container::XNameAccess > *)aAny.getValue() ); + + SdUnoGraphicStyleFamily *pStyleFamily = SdUnoGraphicStyleFamily::getImplementation(xStyleFam); + + if( pStyleFamily ) + { + pStyleFamily->createStyle( pStyleSheet, aAny ); + return aAny; + } + } + + aAny.setValue( &xStyle, ITYPE( style::XStyle ) ); + return aAny; +} + +class SdUnoEventsAccess : public cppu::WeakImplHelper2< ::com::sun::star::container::XNameReplace, ::com::sun::star::lang::XServiceInfo > +{ +private: + const OUString maStrOnClick; + const OUString maStrServiceName; + const OUString maStrEventType; + const OUString maStrPresentation; + const OUString maStrLibrary; + const OUString maStrMacroName; + const OUString maStrClickAction; + const OUString maStrBookmark; + const OUString maStrEffect; + const OUString maStrPlayFull; + const OUString maStrVerb; + const OUString maStrSoundURL; + const OUString maStrSpeed; + const OUString maStrStarBasic; + + SdXShape* mpShape; + uno::Reference< document::XEventsSupplier > mxShape; + +public: + SdUnoEventsAccess( SdXShape* pShape ) throw(); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); +}; + +// XEventsSupplier +uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents( ) throw(::com::sun::star::uno::RuntimeException) +{ + return new SdUnoEventsAccess( this ); +} + +SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw() +: mpShape( pShape ), mxShape( pShape ), + maStrOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ), + maStrServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.documents.Events") ), + maStrEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ), + maStrPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ), + maStrClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ), + maStrBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ), + maStrEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ), + maStrPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ), + maStrVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ), + maStrSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ), + maStrSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ), + maStrStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ), + maStrLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")), + maStrMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")) +{ +} + +#define FOUND_CLICKACTION 0x0001 +#define FOUND_BOOKMARK 0x0002 +#define FOUND_EFFECT 0x0004 +#define FOUND_PLAYFULL 0x0008 +#define FOUND_VERB 0x0010 +#define FOUND_SOUNDURL 0x0020 +#define FOUND_SPEED 0x0040 +#define FOUND_EVENTTYPE 0x0080 +#define FOUND_MACRO 0x0100 +#define FOUND_LIBRARY 0x0200 + +static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo ) +{ + const String aEmpty; + pInfo->aBookmark = aEmpty; + pInfo->bSecondSoundOn = sal_False; + pInfo->bSecondPlayFull = sal_False; + pInfo->eClickAction = presentation::ClickAction_NONE; + pInfo->eSecondEffect = presentation::AnimationEffect_NONE; + pInfo->eSecondSpeed = presentation::AnimationSpeed_MEDIUM; + pInfo->nVerb = 0; +} + +// XNameReplace +void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement ) + throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + if( mpShape == NULL || aName != maStrOnClick ) + throw container::NoSuchElementException(); + + uno::Sequence< beans::PropertyValue > aProperties; + if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) ) + throw lang::IllegalArgumentException(); + + sal_Int32 nFound = 0; + const beans::PropertyValue* pProperties = aProperties.getConstArray(); + + OUString aStrEventType; + presentation::ClickAction eClickAction; + presentation::AnimationEffect eEffect; + presentation::AnimationSpeed eSpeed; + OUString aStrSoundURL; + sal_Bool bPlayFull; + sal_Int32 nVerb; + OUString aStrMacro; + OUString aStrLibrary; + OUString aStrBookmark; + + const sal_Int32 nCount = aProperties.getLength(); + sal_Int32 nIndex; + for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ ) + { + if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType ) + { + if( pProperties->Value >>= aStrEventType ) + { + nFound |= FOUND_EVENTTYPE; + continue; + } + } + else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction ) + { + if( pProperties->Value >>= eClickAction ) + { + nFound |= FOUND_CLICKACTION; + continue; + } + } + else if( ( ( nFound & FOUND_MACRO ) == 0 ) && pProperties->Name == maStrMacroName ) + { + if( pProperties->Value >>= aStrMacro ) + { + nFound |= FOUND_MACRO; + continue; + } + } + else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary ) + { + if( pProperties->Value >>= aStrLibrary ) + { + nFound |= FOUND_LIBRARY; + continue; + } + } + else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect ) + { + if( pProperties->Value >>= eEffect ) + { + nFound |= FOUND_EFFECT; + continue; + } + } + else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark ) + { + if( pProperties->Value >>= aStrBookmark ) + { + nFound |= FOUND_BOOKMARK; + continue; + } + } + else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed ) + { + if( pProperties->Value >>= eSpeed ) + { + nFound |= FOUND_SPEED; + continue; + } + } + else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL ) + { + if( pProperties->Value >>= aStrSoundURL ) + { + nFound |= FOUND_SOUNDURL; + continue; + } + } + else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull ) + { + if( pProperties->Value >>= bPlayFull ) + { + nFound |= FOUND_PLAYFULL; + continue; + } + } + else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb ) + { + if( pProperties->Value >>= nVerb ) + { + nFound |= FOUND_VERB; + continue; + } + } + + throw lang::IllegalArgumentException(); + } + + sal_Bool bOk = sal_False; + do + { + if( ( nFound & FOUND_EVENTTYPE ) == 0 ) + break; + + if( aStrEventType == maStrPresentation ) + { + if( ( nFound & FOUND_CLICKACTION ) == 0 ) + break; + + SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False ); + if( presentation::ClickAction_NONE == eClickAction && NULL == pInfo ) + { + bOk = sal_True; + break; + } + + if( NULL == pInfo ) + pInfo = mpShape->GetAnimationInfo( sal_True ); + + DBG_ASSERT( pInfo, "shape animation info could not be created!" ); + if( NULL == pInfo ) + break; + + clearEventsInAnimationInfo( pInfo ); + pInfo->eClickAction = eClickAction; + + switch( eClickAction ) + { + case presentation::ClickAction_NONE: + case presentation::ClickAction_PREVPAGE: + case presentation::ClickAction_NEXTPAGE: + case presentation::ClickAction_FIRSTPAGE: + case presentation::ClickAction_LASTPAGE: + case presentation::ClickAction_INVISIBLE: + case presentation::ClickAction_STOPPRESENTATION: + { + bOk = sal_True; + } + break; + + case presentation::ClickAction_PROGRAM: + case presentation::ClickAction_BOOKMARK: + case presentation::ClickAction_DOCUMENT: + if( nFound & FOUND_BOOKMARK ) + { + if( eClickAction == presentation::ClickAction_BOOKMARK ) + { + const OUString aApiPageName( RTL_CONSTASCII_USTRINGPARAM("page") ); + + if( aStrBookmark.indexOf( aApiPageName ) == 0 ) + { + if( aStrBookmark.indexOf( aApiPageName ) == 0 ) + { + sal_Int32 nPageNumber = aStrBookmark.copy( aApiPageName.getLength() ).toInt32(); + OUStringBuffer sBuffer; + String aPageName( SdResId(STR_PAGE) ); + sBuffer.append( aPageName ); + sBuffer.append( sal_Unicode( ' ' ) ); + sBuffer.append( nPageNumber ); + aStrBookmark = sBuffer.makeStringAndClear(); + } + } + } + + pInfo->aBookmark = aStrBookmark; + bOk = sal_True; + } + break; + + case presentation::ClickAction_MACRO: + if( nFound & FOUND_MACRO ) + { + pInfo->aBookmark = aStrMacro; + bOk = sal_True; + } + break; + + case presentation::ClickAction_VERB: + if( nFound & FOUND_VERB ) + { + pInfo->nVerb = (USHORT)nVerb; + bOk = sal_True; + } + break; + + case presentation::ClickAction_VANISH: + if( ( nFound & FOUND_EFFECT ) == 0 ) + break; + + pInfo->eSecondEffect = eEffect; + pInfo->eSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM; + + bOk = sal_True; + + // NOTE: No break here!!! + + case presentation::ClickAction_SOUND: + if( nFound & FOUND_SOUNDURL ) + { + pInfo->aBookmark = aStrSoundURL; + if( eClickAction != presentation::ClickAction_SOUND ) + pInfo->bSecondSoundOn = aStrSoundURL.getLength() != 0; + pInfo->bSecondPlayFull = nFound & FOUND_PLAYFULL ? bPlayFull : sal_False; + + bOk = sal_True; + } + break; + } + } + else + { + SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_True ); + + DBG_ASSERT( pInfo, "shape animation info could not be created!" ); + if( NULL == pInfo ) + break; + + clearEventsInAnimationInfo( pInfo ); + pInfo->eClickAction = presentation::ClickAction_MACRO; + + String aMacro = aStrMacro; + + String aLibName = aMacro.GetToken(0, sal_Unicode('.')); + String aModulName = aMacro.GetToken(1, sal_Unicode('.')); + String aMacroName = aMacro.GetToken(2, sal_Unicode('.')); + + OUStringBuffer sBuffer; + sBuffer.append( aMacroName ); + sBuffer.append( sal_Unicode('.') ); + sBuffer.append( aModulName ); + sBuffer.append( sal_Unicode('.') ); + sBuffer.append( aLibName ); + sBuffer.append( sal_Unicode('.') ); + + if( aStrLibrary.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ) ) + { + sBuffer.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) ); + } + else + { + sBuffer.append( aStrLibrary ); + } + + pInfo->aBookmark = sBuffer.makeStringAndClear(); + bOk = sal_True; + } + } + while(0); + + if( !bOk ) + throw lang::IllegalArgumentException(); +} + +// XNameAccess +uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + if( mpShape == NULL || aName != maStrOnClick ) + throw container::NoSuchElementException(); + + SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False ); + + presentation::ClickAction eClickAction = presentation::ClickAction_NONE; + if( pInfo ) + eClickAction = pInfo->eClickAction; + + sal_Int32 nPropertyCount = 2; + switch( eClickAction ) + { + case presentation::ClickAction_NONE: + case presentation::ClickAction_PREVPAGE: + case presentation::ClickAction_NEXTPAGE: + case presentation::ClickAction_FIRSTPAGE: + case presentation::ClickAction_LASTPAGE: + case presentation::ClickAction_INVISIBLE: + case presentation::ClickAction_STOPPRESENTATION: + break; + case presentation::ClickAction_PROGRAM: + case presentation::ClickAction_VERB: + case presentation::ClickAction_BOOKMARK: + case presentation::ClickAction_DOCUMENT: + case presentation::ClickAction_MACRO: + nPropertyCount += 1; + break; + + case presentation::ClickAction_SOUND: + nPropertyCount += 2; + break; + + case presentation::ClickAction_VANISH: + nPropertyCount += 4; + break; + } + + uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount ); + beans::PropertyValue* pProperties = aProperties.getArray(); + + uno::Any aAny; + + if( eClickAction == presentation::ClickAction_MACRO ) + { + aAny <<= maStrStarBasic;; + pProperties->Name = maStrEventType; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + String aMacro = pInfo->aBookmark; + + // aMacro has got following format: + // "Macroname.Modulname.Libname.Documentname" or + // "Macroname.Modulname.Libname.Applicationsname" + String aMacroName = aMacro.GetToken(0, sal_Unicode('.')); + String aModulName = aMacro.GetToken(1, sal_Unicode('.')); + String aLibName = aMacro.GetToken(2, sal_Unicode('.')); + String aDocName = aMacro.GetToken(3, sal_Unicode('.')); + + OUStringBuffer sBuffer; + sBuffer.append( aLibName ); + sBuffer.append( sal_Unicode('.') ); + sBuffer.append( aModulName ); + sBuffer.append( sal_Unicode('.') ); + sBuffer.append( aMacroName ); + + aAny <<= OUString( sBuffer.makeStringAndClear() ); + pProperties->Name = maStrMacroName; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) ); + pProperties->Name = maStrLibrary; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + } + else + { + aAny <<= maStrPresentation; + pProperties->Name = maStrEventType; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + aAny <<= eClickAction; + pProperties->Name = maStrClickAction; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + switch( eClickAction ) + { + case presentation::ClickAction_NONE: + case presentation::ClickAction_PREVPAGE: + case presentation::ClickAction_NEXTPAGE: + case presentation::ClickAction_FIRSTPAGE: + case presentation::ClickAction_LASTPAGE: + case presentation::ClickAction_INVISIBLE: + case presentation::ClickAction_STOPPRESENTATION: + break; + case presentation::ClickAction_BOOKMARK: + { + String aPageName( SdResId(STR_PAGE) ); + aPageName += sal_Unicode( ' ' ); + + const OUString aStrBookmark( pInfo->aBookmark ); + if( aStrBookmark.indexOf( aPageName ) == 0 ) + { + sal_Int32 nPageNumber = aStrBookmark.copy( aPageName.Len() ).toInt32(); + OUStringBuffer sBuffer; + sBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "page" ) ); + sBuffer.append( nPageNumber ); + aAny <<= sBuffer.makeStringAndClear(); + } + else + { + aAny <<= aStrBookmark; + } + + pProperties->Name = maStrBookmark; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + } + break; + + case presentation::ClickAction_DOCUMENT: + case presentation::ClickAction_PROGRAM: + aAny <<= OUString( pInfo->aBookmark ); + pProperties->Name = maStrBookmark; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + break; + + case presentation::ClickAction_VANISH: + aAny <<= pInfo->eSecondEffect; + pProperties->Name = maStrEffect; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + aAny <<= pInfo->eSecondSpeed; + pProperties->Name = maStrSpeed; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + // NOTE: no break here!!! + + case presentation::ClickAction_SOUND: + if( eClickAction == presentation::ClickAction_SOUND || pInfo->bSecondSoundOn ) + { + aAny <<= OUString( pInfo->aBookmark ); + pProperties->Name = maStrSoundURL; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + pProperties->Name = maStrPlayFull; + pProperties->Handle = -1; + pProperties->Value = ::cppu::bool2any(pInfo->bSecondPlayFull); + pProperties->State = beans::PropertyState_DIRECT_VALUE; + } + break; + + case presentation::ClickAction_VERB: + aAny <<= (sal_Int32)pInfo->nVerb; + pProperties->Name = maStrVerb; + pProperties->Handle = -1; + pProperties->Value = aAny; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + break; + } + } + + aAny <<= aProperties; + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames( ) + throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aStr( &maStrOnClick, 1 ); + return aStr; +} + +sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + return aName == maStrOnClick; +} + +// XElementAccess +uno::Type SAL_CALL SdUnoEventsAccess::getElementType( ) + throw(uno::RuntimeException) +{ + return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0)); +} + +sal_Bool SAL_CALL SdUnoEventsAccess::hasElements( ) throw(uno::RuntimeException) +{ + return sal_True; +} + +// XServiceInfo +OUString SAL_CALL SdUnoEventsAccess::getImplementationName( ) + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdUnoEventsAccess" ) ); +} + +sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return ServiceName == maStrServiceName; +} + +uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames( ) + throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aStr( &maStrServiceName, 1 ); + return aStr; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopage.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopage.cxx new file mode 100644 index 000000000000..b0a2a3c48705 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopage.cxx @@ -0,0 +1,2233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <com/sun/star/view/PaperOrientation.hpp> + +#include <bf_sfx2/app.hxx> +#include <rtl/ustrbuf.hxx> +#include <vcl/metaact.hxx> +#include <unomodel.hxx> +#include <unopage.hxx> +#include <bf_svx/svxids.hrc> +#include <sdresid.hxx> +#include <glob.hrc> +#include <sdpage.hxx> +#include <unoprnms.hxx> +#include <drawdoc.hxx> +#include <bf_svx/unoshape.hxx> +#include <com/sun/star/style/XStyle.hpp> +#include <bf_svtools/style.hxx> +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <comphelper/extract.hxx> + +#include <bf_svx/svditer.hxx> +#include <bf_svtools/wmf.hxx> +#include <bf_svx/svdoole2.hxx> + +#include "bf_sd/docshell.hxx" +#include "unoobj.hxx" +#include "unokywds.hxx" +#include "unopback.hxx" +#include "unohelp.hxx" +namespace binfilter { + +using namespace ::rtl; +using namespace ::osl; +using namespace ::com::sun::star; + +/* this are the ids for page properties */ +enum WID_PAGE +{ + WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH, + WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER, + WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, + WID_PAGE_BACK, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL, + WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK +}; + +#ifndef SEQTYPE + #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) + #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x )) + #else + #define SEQTYPE(x) &(x) + #endif +#endif + +static sal_Char __FAR_DATA sEmptyPageName[sizeof("page")] = "page"; + +/** this function stores the property maps for draw pages in impress and draw */ +const SfxItemPropertyMap* ImplGetDrawPagePropertyMap( sal_Bool bImpress ) +{ + static const SfxItemPropertyMap aDrawPagePropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, &::getCppuType((const presentation::FadeEffect*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + static const SfxItemPropertyMap aGraphicPagePropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet), beans::PropertyAttribute::MAYBEVOID,0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, + { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + if( bImpress ) + return aDrawPagePropertyMap_Impl; + else + return aGraphicPagePropertyMap_Impl; +} + +/** this function stores the property map for master pages in impress and draw */ +const SfxItemPropertyMap* ImplGetMasterPagePropertyMap( PageKind ePageKind ) +{ + static const SfxItemPropertyMap aMasterPagePropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE(beans::XPropertySet), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL, &::getBooleanCppuType(), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, + { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + static const SfxItemPropertyMap aHandoutMasterPagePropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, + { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, + { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + if( ePageKind == PK_HANDOUT ) + { + return aHandoutMasterPagePropertyMap_Impl; + } + else + { + return aMasterPagePropertyMap_Impl; + } +} + +const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) +{ + if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + } + else + { + return SvxFmDrawPage::getSomething( rId ); + } +} + +/*********************************************************************** +* * +***********************************************************************/ +SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SfxItemPropertyMap* pMap ) throw() +: SvxFmDrawPage( (SdrPage*) pInPage ), + mpModel ( _pModel ), + maPropSet ( (pInPage&& (pInPage->GetPageKind() != PK_STANDARD) && (pInPage->GetPageKind() != PK_HANDOUT) )?&pMap[1]:pMap ), + mbHasBackgroundObject(sal_False), + mrBHelper( maMutex ) +{ + mxModel = (::cppu::OWeakObject*)(SvxDrawPage*)mpModel; +} + +SdGenericDrawPage::~SdGenericDrawPage() throw() +{ +} + +// this is called whenever a SdrObject must be created for a empty api shape wrapper +SdrObject * SdGenericDrawPage::_CreateSdrObject( const uno::Reference< drawing::XShape >& xShape ) throw() +{ + if( NULL == pPage || !xShape.is() ) + return NULL; + + String aType( xShape->getShapeType() ); + const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") ); + if(aType.CompareTo( aPrefix, aPrefix.Len() ) != 0) + return SvxFmDrawPage::_CreateSdrObject( xShape ); + + aType = aType.Copy( aPrefix.Len() ); + + PresObjKind eObjKind = PRESOBJ_NONE; + + if( aType.EqualsAscii( "TitleTextShape" ) ) + { + eObjKind = PRESOBJ_TITLE; + } + else if( aType.EqualsAscii( "OutlinerShape" ) ) + { + eObjKind = PRESOBJ_OUTLINE; + } + else if( aType.EqualsAscii( "SubtitleShape" ) ) + { + eObjKind = PRESOBJ_TEXT; + } + else if( aType.EqualsAscii( "OLE2Shape" ) ) + { + eObjKind = PRESOBJ_OBJECT; + } + else if( aType.EqualsAscii( "ChartShape" ) ) + { + eObjKind = PRESOBJ_CHART; + } + else if( aType.EqualsAscii( "TableShape" ) ) + { + eObjKind = PRESOBJ_TABLE; + } + else if( aType.EqualsAscii( "GraphicObjectShape" ) ) + { +#ifdef STARIMAGE_AVAILABLE + eObjKind = PRESOBJ_IMAGE; +#else + eObjKind = PRESOBJ_GRAPHIC; +#endif + } + else if( aType.EqualsAscii( "OrgChartShape" ) ) + { + eObjKind = PRESOBJ_ORGCHART; + } + else if( aType.EqualsAscii( "PageShape" ) ) + { + if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() ) + eObjKind = PRESOBJ_TITLE; + else + eObjKind = PRESOBJ_PAGE; + } + else if( aType.EqualsAscii( "NotesShape" ) ) + { + eObjKind = PRESOBJ_NOTES; + } + else if( aType.EqualsAscii( "HandoutShape" ) ) + { + eObjKind = PRESOBJ_HANDOUT; + } + + Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() ); + + const awt::Point aPos( aRect.Left(), aRect.Top() ); + xShape->setPosition( aPos ); + + const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() ); + xShape->setSize( aSize ); + + SdrObject *pPresObj = GetPage()->CreatePresObj( eObjKind, FALSE, aRect, sal_True ); + + if( pPresObj ) + pPresObj->SetUserCall( GetPage() ); + + return pPresObj; +} + +// XInterface +uno::Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + uno::Any aAny; + + QUERYINT( beans::XPropertySet ); + else QUERYINT( container::XNamed ); + else QUERYINT( lang::XComponent ); + else + return SvxDrawPage::queryInterface( rType ); + + return aAny; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if( (GetPage() == NULL) || (mpModel == NULL) ) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(aPropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_PAGE_LEFT: + case WID_PAGE_RIGHT: + case WID_PAGE_TOP: + case WID_PAGE_BOTTOM: + case WID_PAGE_LAYOUT: + case WID_PAGE_DURATION: + case WID_PAGE_CHANGE: + { + sal_Int32 nValue; + if(!(aValue >>= nValue)) + throw lang::IllegalArgumentException(); + + switch( pMap->nWID ) + { + case WID_PAGE_LEFT: + SetLftBorder(nValue); + break; + case WID_PAGE_RIGHT: + SetRgtBorder( nValue ); + break; + case WID_PAGE_TOP: + SetUppBorder( nValue ); + break; + case WID_PAGE_BOTTOM: + SetLwrBorder( nValue ); + break; + case WID_PAGE_CHANGE: + GetPage()->SetPresChange( (PresChange)nValue ); + break; + case WID_PAGE_LAYOUT: + GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True, sal_True ); + break; + case WID_PAGE_DURATION: + GetPage()->SetTime((sal_uInt32)nValue); + break; + } + break; + } + case WID_PAGE_WIDTH: + { + sal_Int32 nWidth; + if(!(aValue >>= nWidth)) + throw lang::IllegalArgumentException(); + + SetWidth( nWidth ); + break; + } + case WID_PAGE_HEIGHT: + { + sal_Int32 nHeight; + if(!(aValue >>= nHeight)) + throw lang::IllegalArgumentException(); + + SetHeight( nHeight ); + break; + } + case WID_PAGE_ORIENT: + { + sal_Int32 nEnum; + if(!::cppu::enum2int( nEnum, aValue )) + throw lang::IllegalArgumentException(); + + Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE; + + if( eOri != GetPage()->GetOrientation() ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetOrientation( eOri ); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetOrientation( eOri ); + } + } + break; + } + case WID_PAGE_EFFECT: + { + sal_Int32 nEnum; + if(!::cppu::enum2int( nEnum, aValue )) + throw lang::IllegalArgumentException(); + + GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum ); + break; + } + case WID_PAGE_BACK: + setBackground( aValue ); + break; + case WID_PAGE_SPEED: + { + sal_Int32 nEnum; + if(!::cppu::enum2int( nEnum, aValue )) + throw lang::IllegalArgumentException(); + + GetPage()->SetFadeSpeed( (FadeSpeed) nEnum ); + break; + } + case WID_PAGE_VISIBLE : + { + sal_Bool bVisible; + if( ! ( aValue >>= bVisible ) ) + throw lang::IllegalArgumentException(); + GetPage()->SetExcluded( bVisible == FALSE ); + break; + } + case WID_PAGE_SOUNDFILE : + { + OUString aURL; + if( ! ( aValue >>= aURL ) ) + throw lang::IllegalArgumentException(); + + GetPage()->SetSoundFile( aURL ); + GetPage()->SetSound( sal_True ); + break; + } + case WID_PAGE_BACKFULL: + { + sal_Bool bFullSize; + if( ! ( aValue >>= bFullSize ) ) + throw lang::IllegalArgumentException(); + GetPage()->SetBackgroundFullSize( bFullSize ); + break; + } + case WID_PAGE_BACKVIS: + { + sal_Bool bVisible; + if( ! ( aValue >>= bVisible ) ) + throw lang::IllegalArgumentException(); + + SdrPage* pPage = GetPage(); + if( pPage ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + if( pDoc->GetMasterPageCount() ) + { + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SetOfByte aVisibleLayers = pPage->GetMasterPageVisibleLayers(0); + aVisibleLayers.Set(rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )), FALSE), bVisible); + pPage->SetMasterPageVisibleLayers(aVisibleLayers, 0); + } + } + break; + } + case WID_PAGE_BACKOBJVIS: + { + sal_Bool bVisible; + if( ! ( aValue >>= bVisible ) ) + throw lang::IllegalArgumentException(); + + SdrPage* pPage = GetPage(); + if( pPage ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + if( pDoc->GetMasterPageCount() ) + { + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SetOfByte aVisibleLayers = pPage->GetMasterPageVisibleLayers(0); + aVisibleLayers.Set(rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )), FALSE), bVisible); + pPage->SetMasterPageVisibleLayers(aVisibleLayers, 0); + } + } + + break; + } + case WID_PAGE_USERATTRIBS: + { + if( !GetPage()->setAlienAttributes( aValue ) ) + throw lang::IllegalArgumentException(); + break; + } + case WID_PAGE_BOOKMARK: + { + OUString aBookmarkURL; + if( ! ( aValue >>= aBookmarkURL ) ) + throw lang::IllegalArgumentException(); + + setBookmarkURL( aBookmarkURL ); + break; + } + + case WID_PAGE_NUMBER: + case WID_PAGE_ISDARK: + throw beans::PropertyVetoException(); + + default: + throw beans::UnknownPropertyException(); + break; + } + + mpModel->SetModified(); +} + +/*********************************************************************** +* * +***********************************************************************/ +uno::Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + uno::Any aAny; + if( (GetPage() == NULL) || (mpModel == NULL) ) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(PropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case WID_PAGE_LEFT: + aAny <<= (sal_Int32)( GetPage()->GetLftBorder() ); + break; + case WID_PAGE_RIGHT: + aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() ); + break; + case WID_PAGE_TOP: + aAny <<= (sal_Int32)( GetPage()->GetUppBorder() ); + break; + case WID_PAGE_BOTTOM: + aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() ); + break; + case WID_PAGE_WIDTH: + aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() ); + break; + case WID_PAGE_HEIGHT: + aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() ); + break; + case WID_PAGE_ORIENT: + aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::getCppuType((const view::PaperOrientation*)0) ); + break; + case WID_PAGE_EFFECT: + aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect*)0) ); + break; + case WID_PAGE_CHANGE: + aAny <<= (sal_Int32)( GetPage()->GetPresChange() ); + break; + case WID_PAGE_SPEED: + aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeSpeed(), ::getCppuType((const presentation::AnimationSpeed*)0) ); + break; + case WID_PAGE_LAYOUT: + aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() ); + break; + case WID_PAGE_NUMBER: + aAny <<= (sal_Int16)((sal_uInt16)((GetPage()->GetPageNum()-1)>>1) + 1); + break; + case WID_PAGE_DURATION: + aAny <<= (sal_Int32)(GetPage()->GetTime()); + break; + case WID_PAGE_BACK: + getBackground( aAny ); + break; + + case WID_PAGE_VISIBLE : + { + sal_Bool bVisible = GetPage()->IsExcluded() == FALSE; + aAny <<= uno::Any( &bVisible, ::getBooleanCppuType() ); + break; + } + + case WID_PAGE_SOUNDFILE : + { + OUString aURL; + if( GetPage()->IsSoundOn() ) + aURL = GetPage()->GetSoundFile(); + aAny <<= aURL; + break; + } + case WID_PAGE_BACKFULL: + { + sal_Bool bFullSize = GetPage()->IsBackgroundFullSize(); + aAny = uno::Any( &bFullSize, ::getBooleanCppuType() ); + break; + } + case WID_PAGE_BACKVIS: + { + SdrPage* pPage = GetPage(); + if( pPage ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + if( pDoc->GetMasterPageCount() ) + { + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SetOfByte aVisibleLayers = pPage->GetMasterPageVisibleLayers(0); + aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )), FALSE)); + } + else + { + aAny <<= (sal_Bool)sal_False; + } + } + break; + } + case WID_PAGE_BACKOBJVIS: + { + SdrPage* pPage = GetPage(); + if( pPage ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + if( pDoc->GetMasterPageCount() ) + { + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SetOfByte aVisibleLayers = pPage->GetMasterPageVisibleLayers(0); + aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )), FALSE)); + } + else + { + aAny <<= (sal_Bool)sal_False; + } + } + break; + } + case WID_PAGE_USERATTRIBS: + { + GetPage()->getAlienAttributes( aAny ); + break; + } + case WID_PAGE_BOOKMARK: + { + aAny <<= getBookmarkURL(); + break; + } + case WID_PAGE_ISDARK: + { + aAny <<= (sal_Bool)GetPage()->GetBackgroundColor().IsDark(); + break; + } + + default: + throw beans::UnknownPropertyException(); + break; + } + return aAny; +} + +void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} + +uno::Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj ) const throw() +{ + PresObjKind eKind = GetPage()->GetPresObjKind(pObj); + + SvxShape* pShape = NULL; + + if(pObj->GetObjInventor() == SdrInventor) + { + sal_uInt32 nInventor = pObj->GetObjIdentifier(); + switch( nInventor ) + { + case OBJ_TITLETEXT: + pShape = new SvxShapeText( pObj ); + if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() ) + { + // fake a empty PageShape if its a title shape on the master page + pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape"))); + } + else + { + pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape"))); + } + eKind = PRESOBJ_NONE; + break; + case OBJ_OUTLINETEXT: + pShape = new SvxShapeText( pObj ); + pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape"))); + eKind = PRESOBJ_NONE; + break; + } + } + + uno::Reference< drawing::XShape > xShape( pShape ); + + if(!xShape.is()) + xShape = SvxFmDrawPage::_CreateShape( pObj ); + + + if( eKind != PRESOBJ_NONE ) + { + String aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.")); + + switch( eKind ) + { + case PRESOBJ_TITLE: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") ); + break; + case PRESOBJ_OUTLINE: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") ); + break; + case PRESOBJ_TEXT: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") ); + break; + case PRESOBJ_GRAPHIC: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") ); + break; + case PRESOBJ_OBJECT: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") ); + break; + case PRESOBJ_CHART: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") ); + break; + case PRESOBJ_ORGCHART: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") ); + break; + case PRESOBJ_TABLE: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") ); + break; + case PRESOBJ_BACKGROUND: + DBG_ASSERT( sal_False, "Danger! Someone got hold of the horrible background shape!" ); + break; + case PRESOBJ_PAGE: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("PageShape") ); + break; + case PRESOBJ_HANDOUT: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") ); + break; + case PRESOBJ_NOTES: + aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") ); + break; + } + + SvxShape* pShape = SvxShape::getImplementation( xShape ); + if( pShape ) + pShape->SetShapeType( aShapeType ); + } + + // SdXShape aggregiert SvxShape + new SdXShape( SvxShape::getImplementation( xShape ), mpModel ); + return xShape; +} + +//---------------------------------------------------------------------- + +// XServiceInfo +uno::Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() ); + SvxServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage", + "com.sun.star.document.LinkTarget", + "com.sun.star.document.LinkTargetSupplier"); + return aSeq; +} + +//---------------------------------------------------------------------- + +// XLinkTargetSupplier +uno::Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( ) + throw(uno::RuntimeException) +{ + return new SdPageLinkTargets( (SdGenericDrawPage*)this ); +} + +//---------------------------------------------------------------------- + +void SdGenericDrawPage::setBackground( const uno::Any& rValue ) throw(lang::IllegalArgumentException) +{ + DBG_ERROR( "Don't call me, I'm useless!" ); +} + +//---------------------------------------------------------------------- + +void SdGenericDrawPage::getBackground( uno::Any& rValue ) throw() +{ + DBG_ERROR( "Don't call me, I'm useless!" ); +} + +//---------------------------------------------------------------------- + +OUString SdGenericDrawPage::getBookmarkURL() const +{ + OUStringBuffer aRet; + if( pPage ) + { + OUString aFileName( static_cast<SdPage*>(pPage)->GetFileName() ); + if( aFileName.getLength() ) + { + const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(pPage)->GetBookmarkName() ) ); + aRet.append( aFileName ); + aRet.append( (sal_Unicode)'#' ); + aRet.append( aBookmarkName ); + } + } + + return aRet.makeStringAndClear(); +} + +//---------------------------------------------------------------------- +void SdGenericDrawPage::setBookmarkURL( ::rtl::OUString& rURL ) +{ + if( pPage ) + { + sal_Int32 nIndex = rURL.lastIndexOf( (sal_Unicode)'#' ); + if( nIndex != -1 ) + { + const String aFileName( rURL.copy( 0, nIndex ) ); + const String aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) ); + + if( aFileName.Len() && aBookmarkName.Len() ) + { + static_cast<SdPage*>(pPage)->SetFileName( aFileName ); + static_cast<SdPage*>(pPage)->SetBookmarkName( aBookmarkName ); + } + } + } +} + +void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue ) +{ + if( nValue != GetPage()->GetLftBorder() ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetLftBorder( nValue ); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetLftBorder( nValue ); + } + } +} + +void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue ) +{ + if( nValue != GetPage()->GetRgtBorder() ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetRgtBorder( nValue ); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetRgtBorder( nValue ); + } + } +} + +void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue ) +{ + if( nValue != GetPage()->GetUppBorder() ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetUppBorder( nValue ); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetUppBorder( nValue ); + } + } +} + +void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue ) +{ + if( nValue != GetPage()->GetLwrBorder() ) + { + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetLwrBorder( nValue ); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetLwrBorder( nValue ); + } + } +} + +static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind ) +{ +} + +void SdGenericDrawPage::SetWidth( sal_Int32 nWidth ) +{ + Size aSize( GetPage()->GetSize() ); + if( aSize.getWidth() != nWidth ) + { + aSize.setWidth( nWidth ); + + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetSize(aSize); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetSize(aSize); + } + + refreshpage( pDoc, ePageKind ); + } +} + +void SdGenericDrawPage::SetHeight( sal_Int32 nHeight ) +{ + Size aSize( GetPage()->GetSize() ); + if( aSize.getHeight() != nHeight ) + { + aSize.setHeight( nHeight ); + + SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel(); + const PageKind ePageKind = GetPage()->GetPageKind(); + + USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); + pPage->SetSize(aSize); + } + + nPageCnt = pDoc->GetSdPageCount(ePageKind); + + for (i = 0; i < nPageCnt; i++) + { + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); + pPage->SetSize(aSize); + } + + refreshpage( pDoc, ePageKind ); + } +} + +// XInterface +void SdGenericDrawPage::release() throw() +{ + uno::Reference< uno::XInterface > x( xDelegator ); + if (! x.is()) + { + if (osl_decrementInterlockedCount( &m_refCount ) == 0) + { + if (! mrBHelper.bDisposed) + { + uno::Reference< uno::XInterface > xHoldAlive( (uno::XWeak*)this ); + // First dispose + try + { + dispose(); + } + catch(::com::sun::star::uno::Exception&) + { + // release should not throw exceptions + } + + // only the alive ref holds the object + OSL_ASSERT( m_refCount == 1 ); + // destroy the object if xHoldAlive decrement the refcount to 0 + return; + } + } + // restore the reference count + osl_incrementInterlockedCount( &m_refCount ); + } + OWeakAggObject::release(); +} + +// XComponent +void SdGenericDrawPage::disposing() throw() +{ + Invalidate(); +} + +// XComponent +void SdGenericDrawPage::dispose() + throw(::com::sun::star::uno::RuntimeException) +{ + // An frequently programming error is to release the last + // reference to this object in the disposing message. + // Make it rubust, hold a self Reference. + uno::Reference< lang::XComponent > xSelf( this ); + + // Guard dispose against multible threading + // Remark: It is an error to call dispose more than once + sal_Bool bDoDispose = sal_False; + { + osl::MutexGuard aGuard( mrBHelper.rMutex ); + if( !mrBHelper.bDisposed && !mrBHelper.bInDispose ) + { + // only one call go into this section + mrBHelper.bInDispose = sal_True; + bDoDispose = sal_True; + } + } + + // Do not hold the mutex because we are broadcasting + if( bDoDispose ) + { + // Create an event with this as sender + try + { + uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query( (lang::XComponent *)this ) ); + document::EventObject aEvt; + aEvt.Source = xSource; + // inform all listeners to release this object + // The listener container are automaticly cleared + mrBHelper.aLC.disposeAndClear( aEvt ); + // notify subclasses to do their dispose + disposing(); + } + catch(::com::sun::star::uno::Exception& e) + { + // catch exception and throw again but signal that + // the object was disposed. Dispose should be called + // only once. + mrBHelper.bDisposed = sal_True; + mrBHelper.bInDispose = sal_False; + throw e; + } + + // the values bDispose and bInDisposing must set in this order. + // No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard. + mrBHelper.bDisposed = sal_True; + mrBHelper.bInDispose = sal_False; + } + else + { + // in a multithreaded environment, it can't be avoided, that dispose is called twice. + // However this condition is traced, because it MAY indicate an error. + OSL_TRACE( "OComponentHelper::dispose() - dispose called twice" ); + } +} + +// XComponent +void SAL_CALL SdGenericDrawPage::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException) +{ + mrBHelper.addListener( ::getCppuType( &aListener ) , aListener ); +} + +// XComponent +void SAL_CALL SdGenericDrawPage::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException) +{ + mrBHelper.removeListener( ::getCppuType( &aListener ) , aListener ); +} + +//======================================================================== +// SdPageLinkTargets +//======================================================================== + +SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw() +{ + mxPage = pUnoPage; + mpUnoPage = pUnoPage; +} + +SdPageLinkTargets::~SdPageLinkTargets() throw() +{ +} + + // XElementAccess +uno::Type SAL_CALL SdPageLinkTargets::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE(beans::XPropertySet); +} + +sal_Bool SAL_CALL SdPageLinkTargets::hasElements() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + SdPage* pPage = mpUnoPage->GetPage(); + if( pPage != NULL ) + { + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + String aStr( pObj->GetName() ); + if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) ) + aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); + if( aStr.Len() ) + return sal_True; + } + } + + return sal_False; +} + +// container::XNameAccess + +// XNameAccess +uno::Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + SdPage* pPage = mpUnoPage->GetPage(); + if( pPage != NULL ) + { + SdrObject* pObj = FindObject( aName ); + if( pObj ) + { + uno::Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY ); + return uno::makeAny( aRef ); + } + } + + throw container::NoSuchElementException(); +} + +uno::Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + sal_uInt32 nObjCount = 0; + + SdPage* pPage = mpUnoPage->GetPage(); + if( pPage != NULL ) + { + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + String aStr( pObj->GetName() ); + if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) ) + aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); + if( aStr.Len() ) + nObjCount++; + } + } + + uno::Sequence< OUString > aSeq( nObjCount ); + if( nObjCount > 0 ) + { + OUString* pStr = aSeq.getArray(); + + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + String aStr( pObj->GetName() ); + if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) ) + aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); + if( aStr.Len() ) + *pStr++ = aStr; + } + } + + return aSeq; +} + +sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + return FindObject( aName ) != NULL; +} + +/*********************************************************************** +* * +***********************************************************************/ +SdrObject* SdPageLinkTargets::FindObject( const String& rName ) const throw() +{ + SdPage* pPage = mpUnoPage->GetPage(); + if( pPage == NULL ) + return NULL; + + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + String aStr( pObj->GetName() ); + if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) ) + aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); + if( aStr.Len() && (aStr == rName) ) + return pObj; + } + + return NULL; +} + +// XServiceInfo +OUString SAL_CALL SdPageLinkTargets::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") ); +} + +sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") ); + uno::Sequence< OUString > aSeq( &aSN, 1); + return aSeq; +} + +//======================================================================== +// SdDrawPage +//======================================================================== + +SdDrawPage::SdDrawPage( SdXImpressDocument* mpModel, SdPage* pPage ) throw() +: SdGenericDrawPage( mpModel, pPage, ImplGetDrawPagePropertyMap( mpModel->IsImpressDocument() ) ) +{ +} + +SdDrawPage::~SdDrawPage() throw() +{ +} + +// XInterface +uno::Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + uno::Any aAny; + if( rType == ITYPE( drawing::XMasterPageTarget ) ) + aAny <<= uno::Reference< drawing::XMasterPageTarget >( this ); + else if( mpModel && mpModel->IsImpressDocument() && + GetPage() && GetPage()->GetPageKind() != PK_HANDOUT && + rType == ITYPE( presentation::XPresentationPage ) ) + aAny <<= uno::Reference< presentation::XPresentationPage >( this ); + else + return SdGenericDrawPage::queryInterface( rType ); + + return aAny; +} + +void SAL_CALL SdDrawPage::acquire() throw() +{ + SvxDrawPage::acquire(); +} + +void SAL_CALL SdDrawPage::release() throw() +{ + SvxDrawPage::release(); +} + +UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage ); + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException) +{ + if( maTypeSequence.getLength() == 0 ) + { + sal_Bool bPresPage = mpModel && mpModel->IsImpressDocument() && GetPage() && GetPage()->GetPageKind() != PK_HANDOUT; + + const uno::Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + const sal_Int32 nOwnTypes = bPresPage ? 7 : 6; // !DANGER! Keep this updated! + + maTypeSequence.realloc( nBaseTypes + nOwnTypes ); + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ITYPE(drawing::XDrawPage); + *pTypes++ = ITYPE(beans::XPropertySet); + *pTypes++ = ITYPE(container::XNamed); + *pTypes++ = ITYPE(drawing::XMasterPageTarget); + *pTypes++ = ITYPE(lang::XServiceInfo); + *pTypes++ = ITYPE( lang::XComponent ); + + if( bPresPage ) + *pTypes++ = ITYPE(presentation::XPresentationPage); + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException) +{ + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); + } + return aId; +} + +OUString SdDrawPage::getPageApiName( SdPage* pPage ) +{ + OUString aPageName; + + if(pPage) + { + aPageName = pPage->GetRealName(); + + if( aPageName.getLength() == 0 ) + { + OUStringBuffer sBuffer; + sBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName ) ); + const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1; + sBuffer.append( nPageNum ); + aPageName = sBuffer.makeStringAndClear(); + } + } + + return aPageName; +} + +OUString SdDrawPage::getPageApiNameFromUiName( const String& rUIName ) +{ + OUString aApiName; + + String aDefPageName(SdResId(STR_PAGE)); + aDefPageName += sal_Unicode( ' ' ); + + if( rUIName.Equals( aDefPageName, 0, aDefPageName.Len() ) ) + { + aApiName = OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ) ); + aApiName += rUIName.Copy( aDefPageName.Len() ); + } + else + { + aApiName = rUIName; + } + + return aApiName; +} + +String SdDrawPage::getUiNameFromPageApiName( const ::rtl::OUString& rApiName ) +{ + const String aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName )); + if( rApiName.compareTo( aDefPageName, aDefPageName.Len() ) == 0 ) + { + OUString aNumber( rApiName.copy( sizeof( sEmptyPageName ) - 1 ) ); + + // create the page number + sal_Int32 nPageNumber = aNumber.toInt32(); + + // check if there are non number characters in the number part + const sal_Int32 nChars = aNumber.getLength(); + const sal_Unicode* pString = aNumber.getStr(); + sal_Int32 nChar; + for( nChar = 0; nChar < nChars; nChar++, pString++ ) + { + if((*pString < sal_Unicode('0')) || (*pString > sal_Unicode('9'))) + { + // found a non number character, so this is not the default + // name for this page + nPageNumber = -1; + break; + } + } + + if( nPageNumber != -1) + { + OUStringBuffer sBuffer; + sBuffer.append( String(SdResId(STR_PAGE)) ); + sBuffer.append( sal_Unicode( ' ' ) ); + sBuffer.append( aNumber ); + return sBuffer.makeStringAndClear(); + } + } + + return rApiName; +} + +// XServiceInfo +OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") ); +} + +uno::Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() ); + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" ); + + if( mpModel && mpModel->IsImpressDocument() ) + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" ); + + return aSeq; +} + +sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::supportsService( ServiceName ); +} + +// XNamed +void SAL_CALL SdDrawPage::setName( const OUString& rName ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" ); + + OUString aName( rName ); + + if(GetPage() && GetPage()->GetPageKind() != PK_NOTES) + { + // check if this is the default 'page1234' name + if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0) + { + // ok, it maybe is, first get the number part after 'page' + OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) ); + + // create the page number + sal_Int32 nPageNumber = aNumber.toInt32(); + + // check if there are non number characters in the number part + const sal_Int32 nChars = aNumber.getLength(); + const sal_Unicode* pString = aNumber.getStr(); + sal_Int32 nChar; + for( nChar = 0; nChar < nChars; nChar++, pString++ ) + { + if((*pString < '0') || (*pString > '9')) + { + // found a non number character, so this is not the default + // name for this page + nPageNumber = -1; + break; + } + } + + if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 ) + aName = OUString(); + } + + GetPage()->SetName( aName ); + + SdPage* pNotesPage = mpModel->GetDoc()->GetSdPage( (GetPage()->GetPageNum()-1)>>1, PK_NOTES ); + if( pNotesPage ) + pNotesPage->SetName(aName); + + mpModel->SetModified(); + } +} + +OUString SAL_CALL SdDrawPage::getName() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + return getPageApiName( GetPage() ); +} + +// XMasterPageTarget +uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + DBG_ASSERT(mpModel,"SdDrawPage hat kein Model??"); + if(mpModel && GetPage()) + { + uno::Reference< drawing::XDrawPages > xPages( mpModel->getMasterPages() ); + uno::Reference< drawing::XDrawPage > xPage; + + if( pPage->GetMasterPageCount() ) + xPage = uno::Reference< drawing::XDrawPage >( (pPage->GetMasterPage(0))->getUnoPage(), uno::UNO_QUERY ); + + return xPage; + } + return NULL; +} + +void SAL_CALL SdDrawPage::setMasterPage( const uno::Reference< drawing::XDrawPage >& xMasterPage ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + DBG_ASSERT(mpModel,"SdDrawPage hat kein Model??"); + if(mpModel && pPage) + { + SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage ); + if( pMasterPage && pMasterPage->isValid() ) + { + pPage->RemoveMasterPage(0); + + SdPage* pSdPage = (SdPage*) pMasterPage->GetSdrPage(); + sal_uInt16 nPos = pSdPage->GetPageNum(); + pPage->InsertMasterPage(nPos); + + pPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(), + pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() ); + + pPage->SetSize( pSdPage->GetSize() ); + pPage->SetOrientation( pSdPage->GetOrientation() ); + ((SdPage*)pPage)->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() ); + + // set notes master also + SdPage* pNotesPage = mpModel->GetDoc()->GetSdPage( (pPage->GetPageNum()-1)>>1, PK_NOTES ); + + pNotesPage->RemoveMasterPage(0); + USHORT nNum = pPage->GetMasterPageNum(0) + 1; + pNotesPage->InsertMasterPage(nNum); + pNotesPage->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() ); + + mpModel->SetModified(); + } + + } +} + +// XPresentationPage +uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if(pPage && mpModel && mpModel->GetDoc() ) + { + SdPage* pNotesPage = mpModel->GetDoc()->GetSdPage( (pPage->GetPageNum()-1)>>1, PK_NOTES ); + if( pNotesPage ) + { + uno::Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY ); + return xPage; + } + } + return NULL; +} + + +// XIndexAccess +sal_Int32 SAL_CALL SdDrawPage::getCount() + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::getCount(); +} + +uno::Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + return SdGenericDrawPage::getByIndex( Index ); +} + +// XElementAccess +uno::Type SAL_CALL SdDrawPage::getElementType() + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::getElementType(); +} + +sal_Bool SAL_CALL SdDrawPage::hasElements() + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::hasElements(); +} + +// XShapes +void SAL_CALL SdDrawPage::add( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException) +{ + SdGenericDrawPage::add( xShape ); +} + +void SAL_CALL SdDrawPage::remove( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException) +{ + SvxShape* pShape = SvxShape::getImplementation( xShape ); + if( pShape ) + { + SdrObject* pObj = pShape->GetSdrObject(); + if( pObj ) + { + GetPage()->GetPresObjList()->Remove((void*) pObj); + pObj->SetUserCall(NULL); + } + } + + SdGenericDrawPage::remove( xShape ); +} + +void SdDrawPage::setBackground( const uno::Any& rValue ) + throw( lang::IllegalArgumentException ) +{ + uno::Reference< beans::XPropertySet > xSet; + + if( !(rValue >>= xSet) && !rValue.hasValue() ) + throw lang::IllegalArgumentException(); + + if( !xSet.is() ) + { + // the easy case, clear the background obj + GetPage()->SetBackgroundObj( NULL ); + return; + } + + // prepare background object + SdrObject* pObj = GetPage()->GetBackgroundObj(); + if( NULL == pObj ) + { + pObj = new SdrRectObj(); + GetPage()->SetBackgroundObj( pObj ); + } + + const sal_Int32 nLeft = GetPage()->GetLftBorder(); + const sal_Int32 nRight = GetPage()->GetRgtBorder(); + const sal_Int32 nUpper = GetPage()->GetUppBorder(); + const sal_Int32 nLower = GetPage()->GetLwrBorder(); + + Point aPos ( nLeft, nRight ); + Size aSize( GetPage()->GetSize() ); + aSize.Width() -= nLeft + nRight - 1; + aSize.Height() -= nUpper + nLower - 1; + Rectangle aRect( aPos, aSize ); + pObj->SetLogicRect( aRect ); + + // is it our own implementation? + SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet ); + + SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILLRESERVED_LAST ); + + if( pBack ) + { + pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet ); + } + else + { + SdUnoPageBackground* pBackground = new SdUnoPageBackground(); + + uno::Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() ); + uno::Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground ); + uno::Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() ); + + uno::Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() ); + sal_Int32 nCount = aProperties.getLength(); + beans::Property* pProp = aProperties.getArray(); + + while( nCount-- ) + { + const OUString aPropName( pProp->Name ); + if( xSetInfo->hasPropertyByName( aPropName ) ) + xDestSet->setPropertyValue( aPropName, + xSet->getPropertyValue( aPropName ) ); + + pProp++; + } + + pBackground->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet ); + } + +//-/ pObj->NbcSetAttributes( aSet, sal_False ); + if( aSet.Count() == 0 ) + { + GetPage()->SetBackgroundObj( NULL ); + } + else + { + pObj->SetItemSet(aSet); + } + + pPage->SendRepaintBroadcast(); +} + +void SdDrawPage::getBackground( uno::Any& rValue ) throw() +{ + SdrObject* pObj = GetPage()->GetBackgroundObj(); + if( NULL == pObj ) + { + rValue.clear(); + } + else + { + uno::Reference< beans::XPropertySet > xSet( new SdUnoPageBackground( GetModel()->GetDoc(), pObj ) ); + rValue <<= xSet; + } +} + +//======================================================================== +// class SdMasterPage +//======================================================================== + +SdMasterPage::SdMasterPage( SdXImpressDocument* mpModel, SdPage* pPage ) throw() +: SdGenericDrawPage( mpModel, pPage, ImplGetMasterPagePropertyMap( pPage ? pPage->GetPageKind() : PK_STANDARD ) ), + mpBackgroundObj(NULL) +{ + if( pPage && GetPage()->GetPageKind() == PK_STANDARD ) + { + sal_uInt32 nMasterIndex = 0; + sal_uInt32 nMasterCount = GetPage()->GetPresObjList()->Count(); + + for (nMasterIndex = 0; nMasterIndex < nMasterCount; nMasterIndex++) + { + // loop over all presentation objects in the masterpage + SdrObject* pMasterObj = (SdrObject*) GetPage()->GetPresObjList()->GetObject(nMasterIndex); + + if (pMasterObj && pMasterObj->GetObjInventor() == SdrInventor) + { + sal_uInt16 nId = pMasterObj->GetObjIdentifier(); + + if (nId == OBJ_RECT && pMasterObj->IsEmptyPresObj() ) + { + mpBackgroundObj = pMasterObj; + + if( pMasterObj->GetOrdNum() != 0 ) + pMasterObj->SetOrdNum( 0 ); + + break; + } + } + } + + mbHasBackgroundObject = NULL != mpBackgroundObj; + } +} + +SdMasterPage::~SdMasterPage() throw() +{ +} + +// XInterface +uno::Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + uno::Any aAny; + + if( rType == ITYPE( container::XIndexAccess ) ) + aAny <<= uno::Reference< container::XIndexAccess >((presentation::XPresentationPage*)(this)); + else if( rType == ITYPE( container::XElementAccess ) ) + aAny <<= uno::Reference< container::XElementAccess >((presentation::XPresentationPage*)(this)); + else if( rType == ITYPE( container::XNamed ) ) + aAny <<= uno::Reference< container::XNamed >(this); + else if( rType == ITYPE( presentation::XPresentationPage ) && + ( mpModel && mpModel->IsImpressDocument() && + pPage && GetPage()->GetPageKind() != PK_HANDOUT) ) + aAny <<= uno::Reference< presentation::XPresentationPage >( this ); + else + return SdGenericDrawPage::queryInterface( rType ); + + return aAny; +} + +void SAL_CALL SdMasterPage::acquire() throw() +{ + SvxDrawPage::acquire(); +} + +void SAL_CALL SdMasterPage::release() throw() +{ + SvxDrawPage::release(); +} + +UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage ); + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException) +{ + if( maTypeSequence.getLength() == 0 ) + { + sal_Bool bPresPage = mpModel && mpModel->IsImpressDocument() && pPage && GetPage()->GetPageKind() != PK_HANDOUT; + + const uno::Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + const sal_Int32 nOwnTypes = bPresPage ? 8 : 7; // !DANGER! Keep this updated! + + maTypeSequence.realloc( nBaseTypes + nOwnTypes ); + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ITYPE(drawing::XDrawPage); + *pTypes++ = ITYPE(beans::XPropertySet); + *pTypes++ = ITYPE(container::XNamed); + *pTypes++ = ITYPE(lang::XServiceInfo); + *pTypes++ = ITYPE(document::XLinkTargetSupplier); + *pTypes++ = ITYPE( drawing::XShapeCombiner ); + *pTypes++ = ITYPE( drawing::XShapeBinder ); + + if( bPresPage ) + *pTypes++ = ITYPE(presentation::XPresentationPage); + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException) +{ + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) + { + aId.realloc( 16 ); + rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); + } + return aId; +} + +// XServiceInfo +OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") ); +} + +uno::Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() ); + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" ); + + if( pPage && ((SdPage*)pPage)->GetPageKind() == PK_HANDOUT ) + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" ); + + return aSeq; +} + +sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::supportsService( ServiceName ); +} + +// XElementAccess +sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException) +{ + if( pPage == NULL ) + return sal_False; + + return (pPage->GetObjCount() > 1) || (!mbHasBackgroundObject && pPage->GetObjCount() == 1 ); +} + +uno::Type SAL_CALL SdMasterPage::getElementType() + throw(uno::RuntimeException) +{ + return SdGenericDrawPage::getElementType(); +} + +// XIndexAccess +sal_Int32 SAL_CALL SdMasterPage::getCount() + throw(uno::RuntimeException) +{ + sal_Int32 nCount = SdGenericDrawPage::getCount(); + DBG_ASSERT( !mbHasBackgroundObject || (nCount > 0), "possible wrong shape count!" ); + + if( mbHasBackgroundObject && ( nCount > 0 ) ) + nCount--; + + return nCount; +} + +uno::Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + if( mbHasBackgroundObject ) + Index++; + + return SdGenericDrawPage::getByIndex(Index); +} + +// intern +void SdMasterPage::setBackground( const uno::Any& rValue ) + throw( lang::IllegalArgumentException ) +{ + // we need at least an beans::XPropertySet + uno::Reference< beans::XPropertySet > xSet; + + rValue >>= xSet; + + if( !xSet.is() ) + throw lang::IllegalArgumentException(); + + if( mpModel && mpModel->IsImpressDocument() ) + { + uno::Reference< container::XNameAccess > xFamilies = mpModel->getStyleFamilies(); + uno::Any aAny( xFamilies->getByName( getName() ) ); + + uno::Reference< container::XNameAccess > xFamily; + + aAny >>= xFamily; + + if( xFamily.is() ) + { + OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) ); + + try + { + aAny = xFamily->getByName( aStyleName ); + + uno::Reference< style::XStyle > xStyle( *(uno::Reference< style::XStyle > *)aAny.getValue() ); + uno::Reference< beans::XPropertySet > xStyleSet( xStyle, uno::UNO_QUERY ); + if( xStyleSet.is() ) + { + uno::Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() ); + uno::Reference< beans::XPropertyState > xSetStates( xSet, uno::UNO_QUERY ); + + const SfxItemPropertyMap* pMap = ImplGetPageBackgroundPropertyMap(); + while( pMap->pName ) + { + const OUString aPropName( OUString::createFromAscii(pMap->pName) ); + if( xSetInfo->hasPropertyByName( aPropName ) ) + { + if( !xSetStates.is() || xSetStates->getPropertyState( aPropName ) == beans::PropertyState_DIRECT_VALUE ) + xStyleSet->setPropertyValue( aPropName, + xSet->getPropertyValue( aPropName ) ); + else + xSetStates->setPropertyToDefault( aPropName ); + } + + ++pMap; + } + } + } + catch(...) + { + // + } + } + } + else + { + // first fill an item set + // is it our own implementation? + SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet ); + + SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILLRESERVED_LAST ); + + if( pBack ) + { + pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet ); + } + else + { + SdUnoPageBackground* pBackground = new SdUnoPageBackground(); + + uno::Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() ); + uno::Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground ); + uno::Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() ); + + uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() ); + sal_Int32 nCount = aProperties.getLength(); + beans::Property* pProp = aProperties.getArray(); + + while( nCount-- ) + { + const OUString aPropName( pProp->Name ); + if( xSetInfo->hasPropertyByName( aPropName ) ) + xDestSet->setPropertyValue( aPropName, + xSet->getPropertyValue( aPropName ) ); + + pProp++; + } + + pBackground->fillItemSet( (SdDrawDocument*)pPage->GetModel(), aSet ); + } + + // if we find the background style, copy the set to the background + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = NULL; + if(pSSPool) + { + String aStr(SdResId(STR_PSEUDOSHEET_BACKGROUND)); + pStyleSheet = pSSPool->Find( aStr, SFX_STYLE_FAMILY_PSEUDO); + + if( pStyleSheet ) + { + SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); + rStyleSet.Put( aSet ); + pPage->SendRepaintBroadcast(); + return; + } + } + + + // if no background style is available, try the background object + SdrObject* pObj = GetPage()->GetPresObj(PRESOBJ_BACKGROUND); + if( pObj == NULL ) + return; + + pObj->SetItemSet(aSet); + + pPage->SendRepaintBroadcast(); + } +} + +void SdMasterPage::getBackground( uno::Any& rValue ) throw() +{ + if( mpModel == NULL ) + return; + + if( mpModel->IsImpressDocument() ) + { + try + { + uno::Reference< container::XNameAccess > xFamilies( mpModel->getStyleFamilies() ); + uno::Any aAny( xFamilies->getByName( getName() ) ); + uno::Reference< container::XNameAccess > xFamily( *(uno::Reference< container::XNameAccess >*)aAny.getValue() ); + + const OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) ); + aAny = xFamily->getByName( aStyleName ); + uno::Reference< style::XStyle > xStyle( *(uno::Reference< style::XStyle > *)aAny.getValue() ); + + uno::Reference< beans::XPropertySet > xStyleSet( xStyle, uno::UNO_QUERY ); + rValue <<= xStyleSet; + } + catch(...) + { + rValue.clear(); + } + } + else + { + SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel(); + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = NULL; + if(pSSPool) + { + String aStr(SdResId(STR_PSEUDOSHEET_BACKGROUND)); + pStyleSheet = pSSPool->Find( aStr, SFX_STYLE_FAMILY_PSEUDO); + + if( pStyleSheet ) + { + SfxItemSet aStyleSet( pStyleSheet->GetItemSet()); + if( aStyleSet.Count() ) + { + uno::Reference< beans::XPropertySet > xSet( new SdUnoPageBackground( pDoc, &aStyleSet ) ); + rValue <<= xSet; + return; + } + } + } + + // no stylesheet? try old fashion background rectangle + SdrObject* pObj = NULL; + if( pPage->GetObjCount() >= 1 ) + { + pObj = pPage->GetObj(0); + if( pObj->GetObjInventor() != SdrInventor || pObj->GetObjIdentifier() != OBJ_RECT ) + pObj = NULL; + } + + if( pObj ) + { + uno::Reference< beans::XPropertySet > xSet( new SdUnoPageBackground( GetModel()->GetDoc(), pObj ) ); + rValue <<= xSet; + return; + } + + + rValue.clear(); + } +} + +// XNamed +void SAL_CALL SdMasterPage::setName( const OUString& aName ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if(pPage && GetPage()->GetPageKind() != PK_NOTES) + { + String aNewName( aName ); + GetPage()->SetName( aNewName ); + + if(mpModel->GetDoc()) + mpModel->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName); + + mpModel->SetModified(); + } +} + +OUString SAL_CALL SdMasterPage::getName( ) + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if(pPage) + { + String aLayoutName( GetPage()->GetLayoutName() ); + aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR))))); + + return aLayoutName; + } + + return OUString(); +} + +// XPresentationPage +uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage() + throw(uno::RuntimeException) +{ + ::SolarMutexGuard aGuard; + + if(pPage && mpModel && mpModel->GetDoc() ) + { + SdPage* pNotesPage = mpModel->GetDoc()->GetMasterSdPage( (pPage->GetPageNum()-1)>>1, PK_NOTES ); + if( pNotesPage ) + { + uno::Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY ); + return xPage; + } + } + return NULL; +} + +// XShapes +void SAL_CALL SdMasterPage::add( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException) +{ + SdGenericDrawPage::add( xShape ); +} + +void SAL_CALL SdMasterPage::remove( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException) +{ + SvxShape* pShape = SvxShape::getImplementation( xShape ); + if( pShape ) + { + SdrObject* pObj = pShape->GetSdrObject(); + if( pObj ) + GetPage()->GetPresObjList()->Remove((void*) pObj); + } + + SdGenericDrawPage::remove( xShape ); +} + + +uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage ) +{ + uno::Reference< uno::XInterface > xPage; + + if( pPage && pPage->GetModel() ) + { + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() ); + if( pModel ) + { + if( pPage->IsMasterPage() ) + { + xPage = (::cppu::OWeakObject*)new SdMasterPage( pModel, pPage ); + } + else + { + xPage = (::cppu::OWeakObject*)new SdDrawPage( pModel, pPage ); + } + } + } + + return xPage; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopback.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopback.cxx new file mode 100644 index 000000000000..e7d6d6f96129 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopback.cxx @@ -0,0 +1,427 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + +#include <vcl/svapp.hxx> + + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/xflbstit.hxx> +#include <bf_svx/xflbmtit.hxx> + +#include <bf_svx/svdobj.hxx> +#include <bf_svx/unoshape.hxx> + +#include "unopback.hxx" +#include "drawdoc.hxx" +#include "unokywds.hxx" +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +const SfxItemPropertyMap* ImplGetPageBackgroundPropertyMap() +{ + static const SfxItemPropertyMap aPageBackgroundPropertyMap_Impl[] = + { + FILL_PROPERTIES + {0,0,0,0,0} + }; + + return aPageBackgroundPropertyMap_Impl; +} + +UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground ); + +SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc /* = NULL */, SdrObject* pObj /* = NULL */ ) throw() +: maPropSet( ImplGetPageBackgroundPropertyMap() ), mpSet( NULL ), mpDoc( pDoc ) +{ + if( pDoc ) + { + StartListening( *pDoc ); + mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILLRESERVED_LAST ); + + if( pObj ) + mpSet->Put(pObj->GetItemSet()); + } +} + +SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc, const SfxItemSet* pSet ) throw() +: maPropSet( ImplGetPageBackgroundPropertyMap() ), mpSet( NULL ), mpDoc( pDoc ) +{ + if( pDoc ) + { + StartListening( *pDoc ); + mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILLRESERVED_LAST ); + + if( pSet ) + mpSet->Put(*pSet); + } +} + +SdUnoPageBackground::~SdUnoPageBackground() throw() +{ + if( mpDoc ) + EndListening( *mpDoc ); + + if( mpSet ) + delete mpSet; +} + +void SdUnoPageBackground::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); + + if( pSdrHint ) + { + // delete item set if document is dying because then the pool + // will also die + if( pSdrHint->GetKind() == HINT_MODELCLEARED ) + { + delete mpSet; + mpSet = NULL; + mpDoc = NULL; + } + } + +} + +void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw() +{ + rSet.ClearItem(); + + if( mpSet == NULL ) + { + StartListening( *pDoc ); + mpDoc = pDoc; + + mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); + + if( maPropSet.AreThereOwnUsrAnys() ) + { + uno::Any* pAny; + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMap(); + while( pMap->pName ) + { + pAny = maPropSet.GetUsrAnyForID( pMap->nWID ); + if( pAny ) + { + OUString aPropertyName( OUString::createFromAscii(pMap->pName)); + setPropertyValue( aPropertyName, *pAny ); + } + pMap++; + } + } + } + + rSet.Put( *mpSet ); +} + +// XServiceInfo +OUString SAL_CALL SdUnoPageBackground::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString::createFromAscii( sUNO_SdUnoPageBackground ); +} + +sal_Bool SAL_CALL SdUnoPageBackground::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoPageBackground::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aNameSequence( 2 ); + OUString* pStrings = aNameSequence.getArray(); + + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_PageBackground ) ); + *pStrings = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_FillProperties ) ); + + return aNameSequence; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPageBackground::getPropertySetInfo() + throw(uno::RuntimeException) +{ + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry( aPropertyName ); + + if( pMap == NULL ) + { + throw beans::UnknownPropertyException(); + } + else + { + if( mpSet ) + { + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + drawing::BitmapMode eMode; + if( aValue >>= eMode ) + { + mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + return; + } + throw lang::IllegalArgumentException(); + } + + SfxItemPool& rPool = *mpSet->GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + aSet.Put( *mpSet ); + + if( !aSet.Count() ) + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + + if( pMap->nMemberId == MID_NAME && ( pMap->nWID == XATTR_FILLBITMAP || pMap->nWID == XATTR_FILLGRADIENT || pMap->nWID == XATTR_FILLHATCH || pMap->nWID == XATTR_FILLFLOATTRANSPARENCE ) ) + { + OUString aName; + if(!(aValue >>= aName )) + throw lang::IllegalArgumentException(); + + SvxShape::SetFillAttribute( pMap->nWID, aName, aSet ); + } + else + { + maPropSet.setPropertyValue( pMap, aValue, aSet ); + } + + mpSet->Put( aSet ); + } + else + { + if(pMap && pMap->nWID) + maPropSet.setPropertyValue( pMap, aValue ); + } + } +} + +uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + const SfxItemPropertyMap* pMap = getPropertyMapEntry(PropertyName); + + if( pMap == NULL ) + { + throw beans::UnknownPropertyException(); + } + else + { + if( mpSet ) + { + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)mpSet->GetItem(XATTR_FILLBMP_STRETCH); + XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)mpSet->GetItem(XATTR_FILLBMP_TILE); + + if( pStretchItem && pTileItem ) + { + if( pTileItem->GetValue() ) + aAny <<= drawing::BitmapMode_REPEAT; + else if( pStretchItem->GetValue() ) + aAny <<= drawing::BitmapMode_STRETCH; + else + aAny <<= drawing::BitmapMode_NO_REPEAT; + } + } + else + { + SfxItemPool& rPool = *mpSet->GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + aSet.Put( *mpSet ); + + if( !aSet.Count() ) + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + + // Hole Wert aus ItemSet + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + } + else + { + if(pMap && pMap->nWID) + aAny = maPropSet.getPropertyValue( pMap ); + } + } + return aAny; +} + +void SAL_CALL SdUnoPageBackground::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPageBackground::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPageBackground::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPageBackground::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} + +// XPropertyState +beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry(PropertyName); + + if( pMap == NULL ) + throw beans::UnknownPropertyException(); + + if( mpSet ) + { + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + if( mpSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || + mpSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + { + return beans::PropertyState_DIRECT_VALUE; + } + else + { + return beans::PropertyState_AMBIGUOUS_VALUE; + } + } + + switch( mpSet->GetItemState( pMap->nWID, sal_False ) ) + { + case SFX_ITEM_READONLY: + case SFX_ITEM_SET: + return beans::PropertyState_DIRECT_VALUE; + case SFX_ITEM_DEFAULT: + return beans::PropertyState_DEFAULT_VALUE; + default: +// case SFX_ITEM_DONTCARE: +// case SFX_ITEM_DISABLED: + return beans::PropertyState_AMBIGUOUS_VALUE; + } + } + else + { + if( NULL == maPropSet.GetUsrAnyForID(pMap->nWID) ) + return beans::PropertyState_DEFAULT_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } +} + +uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyStates( const uno::Sequence< OUString >& aPropertyName ) + throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + sal_Int32 nCount = aPropertyName.getLength(); + const OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount ); + beans::PropertyState* pState = aPropertyStateSequence.getArray(); + + while( nCount-- ) + *pState++ = getPropertyState( *pNames++ ); + + return aPropertyStateSequence; +} + +void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry(PropertyName); + + if( pMap == NULL ) + throw beans::UnknownPropertyException(); + + if( mpSet ) + { + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + mpSet->ClearItem( XATTR_FILLBMP_STRETCH ); + mpSet->ClearItem( XATTR_FILLBMP_TILE ); + } + else + { + mpSet->ClearItem( pMap->nWID ); + } + } +} + +uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry(aPropertyName); + if( pMap == NULL || mpSet == NULL ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; + if( mpSet ) + { + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + aAny <<= drawing::BitmapMode_REPEAT; + } + else + { + SfxItemPool& rPool = *mpSet->GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + } + return aAny; +} + +/** this is used because our property map is not sorted yet */ +const SfxItemPropertyMap* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw() +{ + const SfxItemPropertyMap *pMap = maPropSet.getPropertyMap(); + while( pMap->pName ) + { + if( rPropertyName.compareToAscii( pMap->pName ) == 0 ) + return pMap; + ++pMap; + } + + return NULL; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopool.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopool.cxx new file mode 100644 index 000000000000..40eec0d0b38e --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopool.cxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <i18npool/mslangid.hxx> + +#include <comphelper/propertysetinfo.hxx> + +#include <bf_svx/eeitem.hxx> + +#include <bf_svx/unopool.hxx> + +#include "drawdoc.hxx" +namespace binfilter { + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::cppu; +using namespace ::comphelper; + +LanguageType SdUnoGetLanguage( const lang::Locale& rLocale ) +{ + // empty language -> LANGUAGE_SYSTEM + if ( rLocale.Language.getLength() == 0 ) + return LANGUAGE_SYSTEM; + + LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale ); + if ( eRet == LANGUAGE_NONE ) + eRet = LANGUAGE_SYSTEM; //! or throw an exception? + + return eRet; +} + +class SdUnoDrawPool : public SvxUnoDrawPool +{ +public: + SdUnoDrawPool( SdDrawDocument* pModel ) throw(); + virtual ~SdUnoDrawPool() throw(); + +protected: + virtual void putAny( SfxItemPool* pPool, const PropertyMapEntry* pEntry, const Any& rValue ) throw( UnknownPropertyException, IllegalArgumentException); + +private: + SdDrawDocument* mpDrawModel; +}; + +SdUnoDrawPool::SdUnoDrawPool( SdDrawDocument* pModel ) throw() +: SvxUnoDrawPool( pModel ), mpDrawModel( pModel ) +{ +} + +SdUnoDrawPool::~SdUnoDrawPool() throw() +{ +} + +void SdUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const Any& rValue ) + throw(UnknownPropertyException, IllegalArgumentException) +{ + switch( pEntry->mnHandle ) + { + case EE_CHAR_LANGUAGE: + case EE_CHAR_LANGUAGE_CJK: + case EE_CHAR_LANGUAGE_CTL: + { + lang::Locale aLocale; + if( rValue >>= aLocale ) + mpDrawModel->SetLanguage( SdUnoGetLanguage( aLocale ), pEntry->mnHandle ); + } + } + SvxUnoDrawPool::putAny( pPool, pEntry, rValue ); +} + +Reference< XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel ) +{ + return (uno::XAggregation*)new SdUnoDrawPool( pDrawModel ); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopres.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopres.cxx new file mode 100644 index 000000000000..03c167e767f4 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopres.cxx @@ -0,0 +1,443 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_svx/dialogs.hrc> // fuer SID_REHEARSE_TIMINGS +#include <bf_svx/unoprov.hxx> +#include <vcl/svapp.hxx> + +#include "unopres.hxx" +#include "unocpres.hxx" +#include "bf_sd/docshell.hxx" +#include "sdattr.hxx" +#include "cusshow.hxx" +#include "unoprnms.hxx" +#include "unohelp.hxx" +#include "unopage.hxx" + +#include <osl/mutex.hxx> + +namespace binfilter { + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star; + +const SfxItemPropertyMap* ImplGetPresentationPropertyMap() +{ + static const SfxItemPropertyMap aPresentationPropertyMap_Impl[] = + { + { MAP_CHAR_LEN("IsShowAll"), ATTR_PRESENT_ALL, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_ALLOWANIM), ATTR_PRESENT_ANIMATION_ALLOWED, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_CUSTOMSHOW), ATTR_PRESENT_CUSTOMSHOW, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_FIRSTPAGE), ATTR_PRESENT_DIANAME, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_ONTOP), ATTR_PRESENT_ALWAYS_ON_TOP, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_AUTOMATIC), ATTR_PRESENT_MANUEL, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_ENDLESS), ATTR_PRESENT_ENDLESS, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_FULLSCREEN), ATTR_PRESENT_FULLSCREEN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_MOUSEVISIBLE),ATTR_PRESENT_MOUSE, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_PAUSE), ATTR_PRESENT_PAUSE_TIMEOUT, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_STARTWITHNAV),ATTR_PRESENT_NAVIGATOR, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN(UNO_NAME_SHOW_USEPEN), ATTR_PRESENT_PEN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN("IsTransitionOnClick"), ATTR_PRESENT_CHANGE_PAGE, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN("IsShowLogo"), ATTR_PRESENT_SHOW_PAUSELOGO, &::getBooleanCppuType(), 0, 0 }, + { 0,0,0,0,0} + + }; + + return aPresentationPropertyMap_Impl; +} + +SfxItemPropertyMap map_impl[] = { 0,0,0,0 }; + +/////////////////////////////////////////////////////////////////////////////// + +SdXPresentation::SdXPresentation(SdXImpressDocument& rMyModel) throw() +: maPropSet(ImplGetPresentationPropertyMap()), mrModel(rMyModel) +{ +} + +SdXPresentation::~SdXPresentation() throw() +{ +} + +// XServiceInfo +OUString SAL_CALL SdXPresentation::getImplementationName( ) + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXPresentation") ); +} + +sal_Bool SAL_CALL SdXPresentation::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames( ) ); +} + +uno::Sequence< OUString > SAL_CALL SdXPresentation::getSupportedServiceNames( ) + throw(uno::RuntimeException) +{ + OUString aService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.Presentation") ); + uno::Sequence< OUString > aSeq( &aService, 1 ); + return aSeq; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXPresentation::getPropertySetInfo() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); + } + +void SAL_CALL SdXPresentation::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + SdDrawDocument* pDoc = mrModel.GetDoc(); + if(pDoc == NULL) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(aPropertyName); + + sal_Bool bValuesChanged = sal_False; + + switch( pMap ? pMap->nWID : -1 ) + { + case ATTR_PRESENT_ALL: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if( pDoc->GetPresAll() != bVal ) + { + pDoc->SetPresAll( bVal ); + bValuesChanged = sal_True; + if( bVal ) + pDoc->SetCustomShow( false ); + } + break; + } + case ATTR_PRESENT_CHANGE_PAGE: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if ( bVal == pDoc->GetPresLockedPages() ) + { + bValuesChanged = sal_True; + pDoc->SetPresLockedPages( !bVal ); + } + break; + } + + case ATTR_PRESENT_ANIMATION_ALLOWED: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->IsAnimationAllowed() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetAnimationAllowed(bVal); + } + break; + } + case ATTR_PRESENT_CUSTOMSHOW: + { + OUString aShow; + if(!(aValue >>= aShow)) + throw lang::IllegalArgumentException(); + + const String aShowName( aShow ); + + List* pCustomShowList = pDoc->GetCustomShowList(sal_False); + if(pCustomShowList) + { + SdCustomShow* pCustomShow; + for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); pCustomShow != NULL; pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) + { + if( pCustomShow->GetName() == aShowName ) + break; + } + + pDoc->SetCustomShow( true ); + bValuesChanged = sal_True; + } + break; + } + case ATTR_PRESENT_ENDLESS: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresEndless() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresEndless(bVal); + } + break; + } + case ATTR_PRESENT_FULLSCREEN: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresFullScreen() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresFullScreen(bVal); + } + break; + } + case ATTR_PRESENT_DIANAME: + { + OUString aPresPage; + + aValue >>= aPresPage; + pDoc->SetPresPage(SdDrawPage::getUiNameFromPageApiName(aPresPage)); + pDoc->SetCustomShow(false); + pDoc->SetPresAll(false); + + bValuesChanged = sal_True; + break; + } + case ATTR_PRESENT_MANUEL: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresManual() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresManual(bVal); + } + break; + } + case ATTR_PRESENT_MOUSE: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresMouseVisible() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresMouseVisible(bVal); + } + break; + } + case ATTR_PRESENT_ALWAYS_ON_TOP: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresAlwaysOnTop() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresAlwaysOnTop(bVal); + } + break; + } + case ATTR_PRESENT_NAVIGATOR: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetStartPresWithNavigator() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetStartPresWithNavigator(bVal); + } + break; + } + case ATTR_PRESENT_PEN: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + if(pDoc->GetPresMouseAsPen() != bVal) + { + bValuesChanged = sal_True; + pDoc->SetPresMouseAsPen(bVal); + } + break; + } + case ATTR_PRESENT_PAUSE_TIMEOUT: + { + sal_Int32 nValue; + if(!(aValue >>= nValue) || (nValue < 0)) + throw lang::IllegalArgumentException(); + + pDoc->SetPresPause( (sal_uInt32)nValue ); + break; + } + case ATTR_PRESENT_SHOW_PAUSELOGO: + { + sal_Bool bVal; + + if(! sd::any2bool( aValue, bVal ) ) + throw lang::IllegalArgumentException(); + + pDoc->SetPresShowLogo( bVal ); + } + } + + mrModel.SetModified(); +} + +uno::Any SAL_CALL SdXPresentation::getPropertyValue( const OUString& PropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any any; + + SdDrawDocument* pDoc = mrModel.GetDoc(); + if(pDoc == NULL) + throw uno::RuntimeException(); + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry(PropertyName); + + switch( pMap ? pMap->nWID : -1 ) + { + case ATTR_PRESENT_ALL: + any <<= (sal_Bool) ( !pDoc->IsCustomShow() && pDoc->GetPresAll() ); + break; + case ATTR_PRESENT_CHANGE_PAGE: + sd::bool2any( !pDoc->GetPresLockedPages(), any ); + break; + case ATTR_PRESENT_ANIMATION_ALLOWED: + sd::bool2any( pDoc->IsAnimationAllowed(), any ); + break; + case ATTR_PRESENT_CUSTOMSHOW: + { + List* pList = pDoc->GetCustomShowList(sal_False); + SdCustomShow* pShow = (pList && pDoc->IsCustomShow())?(SdCustomShow*)pList->GetCurObject():NULL; + OUString aShowName; + + if(pShow) + aShowName = pShow->GetName(); + + any <<= aShowName; + break; + } + case ATTR_PRESENT_ENDLESS: + sd::bool2any( pDoc->GetPresEndless(), any ); + break; + case ATTR_PRESENT_FULLSCREEN: + sd::bool2any( pDoc->GetPresFullScreen(), any ); + break; + case ATTR_PRESENT_DIANAME: + { + OUString aSlideName; + + if( !pDoc->IsCustomShow() && !pDoc->GetPresAll() ) + aSlideName = SdDrawPage::getPageApiNameFromUiName( pDoc->GetPresPage() ); + + any <<= aSlideName; + } + break; + case ATTR_PRESENT_MANUEL: + sd::bool2any( pDoc->GetPresManual(), any ); + break; + case ATTR_PRESENT_MOUSE: + sd::bool2any( pDoc->GetPresMouseVisible(), any ); + break; + case ATTR_PRESENT_ALWAYS_ON_TOP: + sd::bool2any( pDoc->GetPresAlwaysOnTop(), any ); + break; + case ATTR_PRESENT_NAVIGATOR: + sd::bool2any( pDoc->GetStartPresWithNavigator(), any ); + break; + case ATTR_PRESENT_PEN: + sd::bool2any( pDoc->GetPresMouseAsPen(), any ); + break; + case ATTR_PRESENT_PAUSE_TIMEOUT: + any <<= (sal_Int32)pDoc->GetPresPause(); + break; + case ATTR_PRESENT_SHOW_PAUSELOGO: + sd::bool2any( pDoc->IsPresShowLogo(), any ); + break; + } + + return any; +} + +void SAL_CALL SdXPresentation::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ +} + +void SAL_CALL SdXPresentation::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ +} + +void SAL_CALL SdXPresentation::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ +} + +void SAL_CALL SdXPresentation::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ +} + +// XPresentation +void SAL_CALL SdXPresentation::start( ) throw(uno::RuntimeException) +{ +} + +void SAL_CALL SdXPresentation::end( ) throw(uno::RuntimeException) +{ +} + +void SAL_CALL SdXPresentation::rehearseTimings( ) throw(uno::RuntimeException) +{ +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopsfm.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopsfm.cxx new file mode 100644 index 000000000000..2d2a28cb4b7e --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopsfm.cxx @@ -0,0 +1,373 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + +#include <vcl/svapp.hxx> + +#include <bf_svtools/style.hxx> + +#include <unokywds.hxx> + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/unoprov.hxx> + +#include "unohelp.hxx" +#include "glob.hrc" +#include "drawdoc.hxx" +#include "bf_sd/docshell.hxx" +#include "unowcntr.hxx" +#include "unopsfm.hxx" +#include "unopstyl.hxx" +#include "sdresid.hxx" +#include "sdpage.hxx" +#include "helpids.h" +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +static struct StyleNameMapping_t +{ + char * mpName; + PresentationObjects meObject; + sal_uInt16 mnRID; +} + StyleNameMapping[] = +{ + { sUNO_PseudoSheet_Title, PO_TITLE, STR_LAYOUT_TITLE }, + { sUNO_PseudoSheet_SubTitle, PO_SUBTITLE, STR_LAYOUT_SUBTITLE }, + { sUNO_PseudoSheet_Background, PO_BACKGROUND, STR_LAYOUT_BACKGROUND }, + { sUNO_PseudoSheet_Background_Objects, PO_BACKGROUNDOBJECTS, STR_LAYOUT_BACKGROUNDOBJECTS }, + { sUNO_PseudoSheet_Notes, PO_NOTES, STR_LAYOUT_NOTES }, + { sUNO_PseudoSheet_Outline1, PO_OUTLINE_1, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline2, PO_OUTLINE_2, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline3, PO_OUTLINE_3, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline4, PO_OUTLINE_4, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline5, PO_OUTLINE_5, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline6, PO_OUTLINE_6, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline7, PO_OUTLINE_7, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline8, PO_OUTLINE_8, STR_LAYOUT_OUTLINE }, + { sUNO_PseudoSheet_Outline9, PO_OUTLINE_9, STR_LAYOUT_OUTLINE } +}; + +static const sal_uInt16 nPseudoStyleCount = 14; + +UNO3_GETIMPLEMENTATION_IMPL( SdUnoPseudoStyleFamily ); + +SdUnoPseudoStyleFamily::SdUnoPseudoStyleFamily( SdXImpressDocument* pModel, SdPage* pPage ) throw() +: mxModel( pModel ), mpModel( pModel ), mpPage( pPage ) +{ + DBG_ASSERT( pPage && mxModel.is(), "no page or model? [CL] " ); + + mpStyles = new SvUnoWeakContainer; + if( mpModel && mpModel->GetDoc() ) + StartListening( *mpModel->GetDoc() ); +} + +SdUnoPseudoStyleFamily::~SdUnoPseudoStyleFamily() throw() +{ + delete mpStyles; +} + +OUString SdUnoPseudoStyleFamily::getExternalStyleName( const String& rStyleName ) throw() +{ + String aExtName; + + String aStyleName( rStyleName ); + aStyleName.Erase(0, aStyleName.Search(String( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4); + + sal_uInt16 nIndex; + for( nIndex = 0; nIndex < nPseudoStyleCount; nIndex++ ) + { + SdResId aRID(StyleNameMapping[nIndex].mnRID); + String aCompareString(aRID); + + if( StyleNameMapping[nIndex].mnRID == STR_LAYOUT_OUTLINE ) + { + aCompareString += sal_Unicode(' '); + aCompareString += sal_Unicode('1' + StyleNameMapping[nIndex].meObject - PO_OUTLINE_1 ); + } + + if( aStyleName == aCompareString ) + { + aExtName = OUString::createFromAscii(StyleNameMapping[nIndex].mpName); + break; + } + } + + return aExtName; +} + +// XServiceInfo +OUString SAL_CALL SdUnoPseudoStyleFamily::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdUnoPseudoStyleFamily") ); +} + +sal_Bool SAL_CALL SdUnoPseudoStyleFamily::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoPseudoStyleFamily::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aServiceName( OUString::createFromAscii(sUNO_Service_StyleFamily) ); + uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +// XNameAccess +uno::Any SAL_CALL SdUnoPseudoStyleFamily::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( 0 == aName.getLength() ) + throw container::NoSuchElementException(); + + sal_uInt16 nIndex; + for( nIndex = 0; nIndex < nPseudoStyleCount; nIndex++ ) + { + if( aName.compareToAscii( StyleNameMapping[nIndex].mpName ) == 0 ) + break; + } + + if( !isValid() || nIndex >= nPseudoStyleCount ) + throw container::NoSuchElementException(); + + return getByIndex( nIndex ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoPseudoStyleFamily::getElementNames() + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > aNameSequence( nPseudoStyleCount ); + OUString* pNamesSeq = aNameSequence.getArray(); + StyleNameMapping_t* pNames = StyleNameMapping; + sal_uInt16 nCount = nPseudoStyleCount; + while( nCount-- ) + { + *pNamesSeq++ = OUString::createFromAscii(pNames->mpName ); + pNames++; + } + + return aNameSequence; +} + +sal_Bool SAL_CALL SdUnoPseudoStyleFamily::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( aName.getLength() ) + { + StyleNameMapping_t* pNames = StyleNameMapping; + sal_uInt16 nCount = nPseudoStyleCount; + while( nCount-- ) + { + if( aName.compareToAscii( pNames->mpName ) == 0 ) + return sal_True; + + pNames++; + } + } + + return sal_False; +} + +// XElementAccess +uno::Type SAL_CALL SdUnoPseudoStyleFamily::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( style::XStyle ); +} + +sal_Bool SAL_CALL SdUnoPseudoStyleFamily::hasElements() + throw(uno::RuntimeException) +{ + return sal_True; +} + +// XIndexAccess + +/** the number of styles inside a pseudo style family is fix */ +sal_Int32 SAL_CALL SdUnoPseudoStyleFamily::getCount() + throw(uno::RuntimeException) +{ + return nPseudoStyleCount; +} + +uno::Any SAL_CALL SdUnoPseudoStyleFamily::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( !isValid() || Index < 0 || Index >= nPseudoStyleCount ) + throw lang::IndexOutOfBoundsException(); + + uno::Any aAny; + createStyle( (sal_uInt16)Index, aAny ); + + if(!aAny.hasValue()) + throw lang::IndexOutOfBoundsException(); + + return aAny; +} + +struct StyleSearchData_t +{ + SfxStyleSheetBase* mpStyleSheet; + PresentationObjects meObject; +}; + +sal_Bool SdUnoPseudoStyleFamily_searchfunc( uno::WeakReference< uno::XInterface > xRef, void* pSearchData ) +{ + uno::Reference< uno::XInterface > xStyle( xRef ); + if(xStyle.is()) + { + SdUnoPseudoStyle* pStyle = SdUnoPseudoStyle::getImplementation( xStyle ); + if( pStyle ) + { + if( pStyle->getStyleSheet() == ((StyleSearchData_t*)pSearchData)->mpStyleSheet && + pStyle->getPresObject() == ((StyleSearchData_t*)pSearchData)->meObject ) + return sal_True; + } + } + return sal_False; +} + +void SdUnoPseudoStyleFamily::createStyle( sal_uInt16 nIndex, uno::Any& rAny ) throw() +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + + DBG_ASSERT( nIndex < nPseudoStyleCount, "index overflow! [CL]" ); + DBG_ASSERT( pDoc, "need a document here! [CL]" ); + + String aLayoutName( mpPage->GetLayoutName() ); + aLayoutName.Erase(aLayoutName.Search(String( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4); + + sal_uInt16 nRID = StyleNameMapping[nIndex].mnRID; + SdResId aRID(nRID); + aLayoutName += String(aRID); + + if( STR_LAYOUT_OUTLINE == nRID ) + { + aLayoutName += sal_Unicode(' '); + aLayoutName += sal_Unicode('1' + StyleNameMapping[nIndex].meObject - PO_OUTLINE_1 ); + } + + SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, (SfxStyleFamily) SD_LT_FAMILY, + SFXSTYLEBIT_ALL ); + DBG_ASSERT( pStyleSheet, "no style sheet found! [CL]" ); + + if( pStyleSheet ) + { + uno::Reference< style::XStyle > xStyle; + createStyle( pStyleSheet, StyleNameMapping[nIndex].meObject, xStyle ); + rAny <<= xStyle; + } + else + { + rAny.clear(); + } +} + +void SdUnoPseudoStyleFamily::createStyle( SfxStyleSheetBase* pStyleSheet, uno::Reference< style::XStyle > & rxRef ) throw() +{ + uno::Any aAny( getByName( getExternalStyleName( pStyleSheet->GetName() ) ) ); + if( aAny.hasValue() && aAny.getValueType() == ITYPE( style::XStyle ) ) + rxRef = *(uno::Reference< style::XStyle > *)aAny.getValue(); + else + rxRef = NULL; +} + +void SdUnoPseudoStyleFamily::createStyle( SfxStyleSheetBase* pStyleSheet, PresentationObjects eObject, uno::Reference< style::XStyle > & rxRef ) throw() +{ + rxRef = NULL; + + StyleSearchData_t aSearchData; + aSearchData.mpStyleSheet = pStyleSheet; + aSearchData.meObject = eObject; + + uno::WeakReference< uno::XInterface > xRef; + if( mpStyles->findRef( xRef, (void*)&aSearchData, SdUnoPseudoStyleFamily_searchfunc ) ) + { + uno::Reference< uno::XInterface > xInt( xRef ); + if( xInt.is() ) + { + uno::Any aAny( xInt->queryInterface( ITYPE( style::XStyle ) ) ); + if( aAny >>= rxRef ) + return; + } + } + + rxRef = new SdUnoPseudoStyle( mpModel, mpPage, aSearchData.mpStyleSheet, aSearchData.meObject ); + + uno::WeakReference<uno::XInterface> wRef(rxRef); + mpStyles->insert(wRef); +} + +void SdUnoPseudoStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + sal_Bool bGoneDead = sal_False; + + const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); + + if( pSdrHint ) + { + switch( pSdrHint->GetKind() ) + { + case HINT_PAGEORDERCHG: + if( pSdrHint->GetPage() == mpPage && !mpPage->IsInserted() ) + bGoneDead = sal_True; + break; + case HINT_MODELCLEARED: + bGoneDead = sal_True; + break; + } + } + + if( bGoneDead ) + { + if( IsListening( rBC ) ) + EndListening( rBC ); + mpPage = NULL; + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unopstyl.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unopstyl.cxx new file mode 100644 index 000000000000..baf762068576 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unopstyl.cxx @@ -0,0 +1,637 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + + +#include <osl/mutex.hxx> + +#include <vcl/svapp.hxx> + + +#include <bf_svx/unoshprp.hxx> + + +#include "stlsheet.hxx" +#include <bf_svtools/smplhint.hxx> + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include <bf_svx/xflbstit.hxx> +#include <bf_svx/xflbmtit.hxx> + +#include <bf_svx/unoshape.hxx> +#include <bf_svx/xit.hxx> + +#include "stlpool.hxx" + +#include <unopsfm.hxx> +#include <unopstyl.hxx> +#include <unokywds.hxx> +#include <unoprnms.hxx> +#include <glob.hxx> +#include <helpids.h> +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +#define WID_STYLE_DISPNAME 7998 +#define WID_STYLE_FAMILY 7999 + +const SfxItemPropertyMap* ImplGetFullPropertyMap() +{ + static const SfxItemPropertyMap aFullPropertyMap_Impl[] = + { + { MAP_CHAR_LEN(UNO_NAME_STYLE_FAMILY), WID_STYLE_FAMILY, &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, + { MAP_CHAR_LEN("DisplayName"), WID_STYLE_DISPNAME, &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + + SVX_UNOEDIT_NUMBERING_PROPERTIE, + SHADOW_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + FILL_PROPERTIES + EDGERADIUS_PROPERTIES + TEXT_PROPERTIES + CONNECTOR_PROPERTIES + SPECIAL_DIMENSIONING_PROPERTIES + {0,0,0,0,0} + }; + + return aFullPropertyMap_Impl; +} + +//UNO3_GETIMPLEMENTATION_IMPL( SdUnoPseudoStyle ); + +SdUnoPseudoStyle::SdUnoPseudoStyle( SdXImpressDocument* pModel, SfxStyleSheetBase* pStyleSheet ) throw() +: mxModel( pModel ), + mpModel( pModel ), + mpPage( NULL ), + mpStyleSheet( pStyleSheet ), + meObject( PO_TITLE ), + maPropSet( ImplGetFullPropertyMap() ) +{ + if( mpStyleSheet ) + StartListening( mpStyleSheet->GetPool() ); +} + +SdUnoPseudoStyle::SdUnoPseudoStyle( SdXImpressDocument* pModel, SdPage* pPage, + SfxStyleSheetBase* pStyleSheet, PresentationObjects eObject ) throw() +: mpModel( pModel ), + mxModel( pModel ), + mpPage( pPage ), + mpStyleSheet( pStyleSheet ), + meObject( eObject ), + maPropSet( (eObject >= PO_OUTLINE_2 && eObject <= PO_OUTLINE_9) ? &ImplGetFullPropertyMap()[1] : ImplGetFullPropertyMap() ) +{ + if( mpStyleSheet ) + StartListening( mpStyleSheet->GetPool() ); +} + +SdUnoPseudoStyle::~SdUnoPseudoStyle() throw() +{ +} + +const ::com::sun::star::uno::Sequence< sal_Int8 > & SdUnoPseudoStyle::getUnoTunnelId() throw() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +SdUnoPseudoStyle* SdUnoPseudoStyle::getImplementation( const uno::Reference< uno::XInterface >& xInt ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); + if( xUT.is() ) + return (SdUnoPseudoStyle*)xUT->getSomething( SdUnoPseudoStyle::getUnoTunnelId() ); + else + return NULL; +} + +sal_Int64 SAL_CALL SdUnoPseudoStyle::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) +{ + if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + else + { + return NULL; + } +} + +// XServiceInfo +OUString SAL_CALL SdUnoPseudoStyle::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString::createFromAscii( sUNO_SdUnoPseudoStyle ); +} + +sal_Bool SAL_CALL SdUnoPseudoStyle::supportsService( const OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoPseudoStyle::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence< OUString > aNameSequence( 10 ); + OUString* pStrings = aNameSequence.getArray(); + + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_Style ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_FillProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_LineProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_ShadowProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_ConnectorProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_MeasureProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_ParagraphProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_CharacterProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_TextProperties ) ); + *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_Text ) ); + + return aNameSequence; +} + +// XNamed +OUString SAL_CALL SdUnoPseudoStyle::getName( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if( isValid() ) + return SdUnoPseudoStyleFamily::getExternalStyleName( mpStyleSheet->GetName() ); + + return OUString(); +} + +void SAL_CALL SdUnoPseudoStyle::setName( const OUString& aName ) + throw(uno::RuntimeException) +{ +} + +// XStyle +sal_Bool SAL_CALL SdUnoPseudoStyle::isUserDefined( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + return mpStyleSheet && mpStyleSheet->IsUserDefined(); +} + +sal_Bool SAL_CALL SdUnoPseudoStyle::isInUse( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + return mpStyleSheet && mpStyleSheet->IsUsed(); +} + +OUString SAL_CALL SdUnoPseudoStyle::getParentStyle( ) + throw(uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + OUString aName; + if( isValid() ) + aName = SdUnoPseudoStyleFamily::getExternalStyleName( mpStyleSheet->GetParent() ); + + return aName; +} + +void SAL_CALL SdUnoPseudoStyle::setParentStyle( const OUString& aParentStyle ) + throw(container::NoSuchElementException, uno::RuntimeException) +{ +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPseudoStyle::getPropertySetInfo() + throw(uno::RuntimeException) +{ + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL SdUnoPseudoStyle::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry( aPropertyName ); + + if( pMap == NULL ) + { + throw beans::UnknownPropertyException(); + } + else + { + if( pMap->nWID == SDRATTR_TEXTDIRECTION ) + return; // not yet implemented for styles + + if( mpStyleSheet ) + { + if( (pMap->nWID == EE_PARA_NUMBULLET) && (mpStyleSheet->GetFamily() == (SfxStyleFamily) SD_LT_FAMILY) ) + { + String aEmptyStr; + const sal_uInt32 nHelpId = mpStyleSheet->GetHelpId( aEmptyStr ); + + if( (nHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nHelpId <= HID_PSEUDOSHEET_OUTLINE9) ) + return; + } + + SfxItemSet &rStyleSet = mpStyleSheet->GetItemSet(); + + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + drawing::BitmapMode eMode; + if( aValue >>= eMode ) + { + rStyleSet.Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + rStyleSet.Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + return; + } + throw lang::IllegalArgumentException(); + } + + SfxItemPool& rPool = mpStyleSheet->GetPool().GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + aSet.Put( rStyleSet ); + + if( !aSet.Count() ) + { + if( EE_PARA_NUMBULLET == pMap->nWID ) + { + Font aBulletFont; + SdStyleSheetPool::PutNumBulletItem( mpStyleSheet, aBulletFont ); + aSet.Put( rStyleSet ); + } + else + { + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + } + } + + if( pMap->nMemberId == MID_NAME && + ( pMap->nWID == XATTR_FILLBITMAP || pMap->nWID == XATTR_FILLGRADIENT || + pMap->nWID == XATTR_FILLHATCH || pMap->nWID == XATTR_FILLFLOATTRANSPARENCE || + pMap->nWID == XATTR_LINESTART || pMap->nWID == XATTR_LINEEND || pMap->nWID == XATTR_LINEDASH) ) + { + OUString aName; + if(!(aValue >>= aName )) + throw lang::IllegalArgumentException(); + + SvxShape::SetFillAttribute( pMap->nWID, aName, aSet ); + } + else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pMap, aValue, aSet )) + { + maPropSet.setPropertyValue( pMap, aValue, aSet ); + } + + rStyleSet.Put( aSet ); + ((SdStyleSheet*)mpStyleSheet)->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + } + else + { + if(pMap && pMap->nWID) + maPropSet.setPropertyValue( pMap, aValue ); + } + + if( mpModel ) + mpModel->SetModified(); + } +} + +uno::Any SAL_CALL SdUnoPseudoStyle::getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + const SfxItemPropertyMap* pMap = getPropertyMapEntry( PropertyName ); + + if( pMap == NULL ) + { + throw beans::UnknownPropertyException(); + } + else + { + if( mpStyleSheet ) + { + if( pMap->nWID == WID_STYLE_FAMILY ) + { + aAny <<= OUString::createFromAscii( "presentation" ); + } + else if( pMap->nWID == WID_STYLE_DISPNAME ) + { + String aStyleName( mpStyleSheet->GetName() ); + xub_StrLen nPos = aStyleName.Search(String( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR))); + if( nPos != STRING_NOTFOUND ) + aStyleName.Erase(0, nPos+4); + + aAny <<= OUString( aStyleName ); + } + else if( pMap->nWID == SDRATTR_TEXTDIRECTION ) + { + sal_Bool bWritingMode = sal_False; + aAny = uno::Any( &bWritingMode, ::getBooleanCppuType() ); + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet &rStyleSet = mpStyleSheet->GetItemSet(); + + XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)rStyleSet.GetItem(XATTR_FILLBMP_STRETCH); + XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)rStyleSet.GetItem(XATTR_FILLBMP_TILE); + + if( pStretchItem && pTileItem ) + { + if( pTileItem->GetValue() ) + aAny <<= drawing::BitmapMode_REPEAT; + else if( pStretchItem->GetValue() ) + aAny <<= drawing::BitmapMode_STRETCH; + else + aAny <<= drawing::BitmapMode_NO_REPEAT; + } + } + else + { + SfxItemPool& rPool = mpStyleSheet->GetPool().GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + + const SfxPoolItem* pItem; + SfxItemSet& rStyleSet = mpStyleSheet->GetItemSet(); + + if( rStyleSet.GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET ) + aSet.Put( *pItem ); + + if( !aSet.Count() ) + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + + if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny )) + return aAny; + + // Hole Wert aus ItemSet + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + } + else + { + if(pMap->nWID) + aAny = maPropSet.getPropertyValue( pMap ); + } + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= (sal_Int16)nValue; + } + else + { + DBG_ERROR("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" ); + } + } + } + return aAny; +} + +void SAL_CALL SdUnoPseudoStyle::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPseudoStyle::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPseudoStyle::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} +void SAL_CALL SdUnoPseudoStyle::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} + +// XPropertyState +beans::PropertyState SAL_CALL SdUnoPseudoStyle::getPropertyState( const OUString& PropertyName ) throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = getPropertyMapEntry( PropertyName ); + + if( pMap == NULL ) + throw beans::UnknownPropertyException(); + + if( pMap->nWID == WID_STYLE_FAMILY ) + { + return beans::PropertyState_DIRECT_VALUE; + } + else if( pMap->nWID == SDRATTR_TEXTDIRECTION ) + { + return beans::PropertyState_DEFAULT_VALUE; + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + const SfxItemSet& rSet = mpStyleSheet->GetItemSet(); + + if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || + rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + { + return beans::PropertyState_DIRECT_VALUE; + } + else + { + return beans::PropertyState_AMBIGUOUS_VALUE; + } + } + else if( mpStyleSheet ) + { + SfxItemSet &rStyleSet = mpStyleSheet->GetItemSet(); + + beans::PropertyState eState; + + switch( rStyleSet.GetItemState( pMap->nWID, sal_False ) ) + { + case SFX_ITEM_READONLY: + case SFX_ITEM_SET: + eState = beans::PropertyState_DIRECT_VALUE; + break; + case SFX_ITEM_DEFAULT: + eState = beans::PropertyState_DEFAULT_VALUE; + break; +// case SFX_ITEM_DONTCARE: +// case SFX_ITEM_DISABLED: + default: + eState = beans::PropertyState_AMBIGUOUS_VALUE; + break; + } + + // if a item is set, this doesn't mean we want it :) + if( ( beans::PropertyState_DIRECT_VALUE == eState ) ) + { + switch( pMap->nWID ) + { + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + { + NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((USHORT)pMap->nWID); + if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) ) + eState = beans::PropertyState_DEFAULT_VALUE; + } + } + } + + return eState; + } + else + { + if( NULL == maPropSet.GetUsrAnyForID(pMap->nWID) ) + return beans::PropertyState_DEFAULT_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } +} + +uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPseudoStyle::getPropertyStates( const uno::Sequence< OUString >& aPropertyName ) throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + sal_Int32 nCount = aPropertyName.getLength(); + const OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount ); + beans::PropertyState* pState = aPropertyStateSequence.getArray(); + + while( nCount-- ) + *pState++ = getPropertyState( *pNames++ ); + + return aPropertyStateSequence; +} + +void SAL_CALL SdUnoPseudoStyle::setPropertyToDefault( const OUString& PropertyName ) throw(beans::UnknownPropertyException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + const SfxItemPropertyMap* pMap = getPropertyMapEntry( PropertyName ); + + if( pMap == NULL ) + throw beans::UnknownPropertyException(); + + if( mpStyleSheet ) + { + SfxItemSet &rStyleSet = mpStyleSheet->GetItemSet(); + + if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH ); + rStyleSet.ClearItem( XATTR_FILLBMP_TILE ); + } + else + { + rStyleSet.ClearItem( pMap->nWID ); + ((SdStyleSheet*)mpStyleSheet)->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + } + } + if( mpModel ) + mpModel->SetModified(); +} + +uno::Any SAL_CALL SdUnoPseudoStyle::getPropertyDefault( const OUString& aPropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + const SfxItemPropertyMap* pMap = getPropertyMapEntry( aPropertyName ); + + if( pMap == NULL || mpStyleSheet == NULL ) + throw beans::UnknownPropertyException(); + + if( pMap->nWID == WID_STYLE_FAMILY ) + { + aAny <<= OUString::createFromAscii( "presentation" ); + } + else if( pMap->nWID == SDRATTR_TEXTDIRECTION ) + { + sal_Bool bWritingMode = sal_False; + aAny = uno::Any( &bWritingMode, ::getBooleanCppuType() ); + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + aAny <<= drawing::BitmapMode_REPEAT; + } + else if( mpStyleSheet ) + { + SfxItemPool& rPool = mpStyleSheet->GetPool().GetPool(); + SfxItemSet aSet( rPool, pMap->nWID, pMap->nWID); + aSet.Put( rPool.GetDefaultItem( pMap->nWID ) ); + + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + return aAny; +} + +/** detect if the StyleSheetPool dies or if this instances style sheet is erased */ +void SdUnoPseudoStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + sal_Bool bGoneDead = sal_False; + + const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint ); + if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING ) + bGoneDead = sal_True; + + const SfxStyleSheetHint* pStyleSheetHint = PTR_CAST( SfxStyleSheetHint, &rHint ); + if( pStyleSheetHint && pStyleSheetHint->GetHint() == SFX_STYLESHEET_ERASED ) + { + if( pStyleSheetHint->GetStyleSheet() == mpStyleSheet ) + bGoneDead = sal_True; + } + + if( bGoneDead ) + mpStyleSheet = NULL; +} + +/** this is used because our property map is not sorted yet */ +const SfxItemPropertyMap* SdUnoPseudoStyle::getPropertyMapEntry( const OUString& rPropertyName ) const throw() +{ + const SfxItemPropertyMap*pMap = maPropSet.getPropertyMap(); + while( pMap->pName ) + { + if( rPropertyName.compareToAscii( pMap->pName ) == 0 ) + return pMap; + ++pMap; + } + + return NULL; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unostyls.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unostyls.cxx new file mode 100644 index 000000000000..325e2dcdde86 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unostyls.cxx @@ -0,0 +1,305 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + + +#include <bf_svx/unoprov.hxx> + +#include "unostyls.hxx" +#include "unohelp.hxx" +#include "unowcntr.hxx" +#include "unokywds.hxx" +#include "unogsfm.hxx" +#include "unopsfm.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "glob.hxx" +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +SdUnoStyleFamilies::SdUnoStyleFamilies( SdXImpressDocument* pModel ) throw() +: mxModel( pModel ), mpModel( pModel ) +{ + DBG_ASSERT( mxModel.is(), "i need a model to work with" ); + + mbImpress = mpModel->IsImpressDocument(); + mpStyleFamilies = new SvUnoWeakContainer(); +} + +SdUnoStyleFamilies::~SdUnoStyleFamilies() throw() +{ + delete mpStyleFamilies; +} + +// XServiceInfo +OUString SAL_CALL SdUnoStyleFamilies::getImplementationName() + throw(uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("SdUnoStyleFamilies") ); +} + + +sal_Bool SAL_CALL SdUnoStyleFamilies::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< OUString > SAL_CALL SdUnoStyleFamilies::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + OUString aStr( OUString::createFromAscii( sUNO_Service_StyleFamilies ) ); + uno::Sequence< OUString > aSeq( &aStr, 1 ); + return aSeq; +} + +// XNameAccess +uno::Any SAL_CALL SdUnoStyleFamilies::getByName( const OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + if( !isValid() ) + throw container::NoSuchElementException(); + + uno::Any aAny; + + if( aName.compareToAscii( sUNO_Graphic_Style_Family_Name ) == 0 ) + { + createGraphicStyleFamily( aAny ); + } + else + { + sal_uInt16 nLayout = mbImpress ? getLayoutIndexByName( aName ) : USHRT_MAX; + if( nLayout != USHRT_MAX ) + { + createStyleFamilyByIndex( nLayout, aAny ); + } + else + { + throw container::NoSuchElementException(); + } + } + + return aAny; +} + +uno::Sequence< OUString > SAL_CALL SdUnoStyleFamilies::getElementNames() + throw(uno::RuntimeException) +{ + sal_uInt16 nFamilies = (sal_uInt16)getCount(); + + uno::Sequence< OUString > aNameSequence( nFamilies ); + OUString* pNames = aNameSequence.getArray(); + + *pNames++ = OUString::createFromAscii( sUNO_Graphic_Style_Family_Name ); + nFamilies--; + + if( mbImpress ) + { + sal_uInt16 nLayout = 0; + while( nFamilies ) + { + *pNames++ = getLayoutNameByIndex( nLayout ); + nLayout++; + nFamilies--; + } + } + + return aNameSequence; +} + +/** returns true if this instances has a layout with the given name */ +sal_Bool SAL_CALL SdUnoStyleFamilies::hasByName( const OUString& aName ) + throw(uno::RuntimeException) +{ + // is the model still valid? + if( NULL == mpModel->GetDoc() ) + return NULL; + + // is it the graphic style? + if( aName.compareToAscii( sUNO_Graphic_Style_Family_Name ) == 0 ) + return sal_True; + + // if this is an impress, check the master pages2 + return mbImpress && getLayoutIndexByName( aName ) != USHRT_MAX; +} + +// XElementAccess + +/** returns the type of a style family, the container::XNameContainer interface */ +uno::Type SAL_CALL SdUnoStyleFamilies::getElementType() + throw(uno::RuntimeException) +{ + return ITYPE( container::XNameAccess ); +} + +/** returns true if we have a valid model, than we always have style families */ +sal_Bool SAL_CALL SdUnoStyleFamilies::hasElements() + throw(uno::RuntimeException) +{ + return mpModel->GetDoc() != NULL; +} + +// XIndexAccess +sal_Int32 SAL_CALL SdUnoStyleFamilies::getCount() + throw(uno::RuntimeException) +{ + if( mpModel->GetDoc() != NULL ) + return mbImpress ? getLayoutCount() + 1 : 1; + else + return 0; +} + +uno::Any SAL_CALL SdUnoStyleFamilies::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + uno::Any aAny; + + if( Index < 0 || Index > getLayoutCount() || ( !mbImpress && Index > 0 ) ) + throw lang::IndexOutOfBoundsException(); + + if( 0 == Index ) + { + createGraphicStyleFamily( aAny ); + } + else + { + createStyleFamilyByIndex( Index - 1, aAny ); + } + + return aAny; +} + +/** creates a style family object for the graphic style family */ +void SdUnoStyleFamilies::createGraphicStyleFamily( uno::Any& rAny ) + throw( container::NoSuchElementException ) +{ + uno::Reference< container::XNameAccess > xContainer( mxGraphicStyles ); + if( !xContainer.is() ) + mxGraphicStyles = xContainer = new SdUnoGraphicStyleFamily( mpModel ); + + if( !xContainer.is() ) + throw container::NoSuchElementException(); + + rAny <<= xContainer; +} + +sal_Bool SdUnoStyleFamilies_searchfunc( uno::WeakReference< uno::XInterface > xRef, void* pSearchData ) +{ + uno::Reference< uno::XInterface > xInt( xRef ); + uno::Reference< container::XNameAccess > xFamily( xInt, uno::UNO_QUERY ); + if( xFamily.is() ) + { + SdUnoPseudoStyleFamily* pFamily = SdUnoPseudoStyleFamily::getImplementation( xFamily ); + + if( pFamily && pFamily->getPage() == (SdPage*)pSearchData ) + return sal_True; + } + return sal_False; +} + +/** creates a style family for the given layout */ +void SdUnoStyleFamilies::createStyleFamilyByIndex( sal_uInt16 nLayout, uno::Any& rAny ) throw() +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + SdPage* pMaster = (SdPage*)pDoc->GetMasterSdPage(nLayout,PK_STANDARD); + + // do we already have an instance for this layout? + uno::WeakReference< uno::XInterface > xRef; + uno::Reference< container::XNameAccess > xFamily; + + if( mpStyleFamilies->findRef( xRef, (void*)pMaster, SdUnoStyleFamilies_searchfunc ) ) + xFamily = uno::Reference< container::XNameAccess >::query( xRef.get() ); + + if( !xFamily.is() ) + { + xFamily = new SdUnoPseudoStyleFamily( mpModel, pMaster ); + uno::WeakReference<uno::XInterface> wRef(xFamily); + mpStyleFamilies->insert(wRef); + } + + rAny <<= xFamily; + +} + +/** returns the count of standard master pages of the document */ +sal_uInt16 SdUnoStyleFamilies::getLayoutCount() throw() +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + sal_uInt16 nCount = 0; + if( pDoc && mbImpress ) + nCount = pDoc->GetMasterSdPageCount(PK_STANDARD); + + return nCount; +} + +/** returns the layout name of the standard master page with the givin index */ +OUString SdUnoStyleFamilies::getLayoutNameByIndex( sal_uInt16 nIndex ) throw() +{ + String aLayoutName; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + + SdPage* pMaster = (SdPage*)pDoc->GetMasterSdPage(nIndex,PK_STANDARD); + aLayoutName = pMaster->GetLayoutName(); + aLayoutName = aLayoutName.Erase(aLayoutName.Search(String( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )) )); + + return aLayoutName; +} + +/** returns the index of the standard master page with the given layout name or + USHRT_MAX if the layout name was not found */ +sal_uInt16 SdUnoStyleFamilies::getLayoutIndexByName( const OUString& rName ) throw() +{ + const String aName( rName ); + + USHORT nIndex = 0; + + SdDrawDocument* pDoc = mpModel->GetDoc(); + if( NULL != pDoc ) + { + sal_uInt16 nCount = pDoc->GetMasterSdPageCount(PK_STANDARD); + + for( sal_uInt16 nPage = 0; nPage < nCount; nPage++ ) + { + SdPage* pMaster = (SdPage*)pDoc->GetMasterSdPage(nPage, PK_STANDARD); + + String aLayoutName( pMaster->GetLayoutName() ); + aLayoutName.Erase(aLayoutName.Search(String( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))); + + if( aName == aLayoutName ) + return nPage; + } + } + + return USHRT_MAX; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/sd_unowcntr.cxx b/binfilter/bf_sd/source/ui/unoidl/sd_unowcntr.cxx new file mode 100644 index 000000000000..eab7aaf4f3cd --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/sd_unowcntr.cxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <tools/list.hxx> + +#include <unowcntr.hxx> +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +DECLARE_LIST( WeakRefList, uno::WeakReference< uno::XInterface >* )//STRIP008 ; + +SvUnoWeakContainer::SvUnoWeakContainer() throw() +{ + mpList = new WeakRefList; +} + +SvUnoWeakContainer::~SvUnoWeakContainer() throw() +{ + uno::WeakReference< uno::XInterface >* pRef = mpList->First(); + while( pRef ) + { + delete mpList->Remove(); + pRef = mpList->GetCurObject(); + } + delete mpList; +} + +/** inserts the given ref into this container */ +void SvUnoWeakContainer::insert( uno::WeakReference< uno::XInterface > xRef ) throw() +{ + uno::WeakReference< uno::XInterface >* pRef = mpList->First(); + while( pRef ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef ); + if(! xTestRef.is() ) + { + delete mpList->Remove(); + pRef = mpList->GetCurObject(); + } + else + { + if( *pRef == xRef ) + return; + + pRef = mpList->Next(); + } + } + + mpList->Insert( new uno::WeakReference< uno::XInterface >( xRef ) ); +} + +/** searches the container for a ref that returns true on the given + search function +*/ +sal_Bool SvUnoWeakContainer::findRef( uno::WeakReference< uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc ) +{ + uno::WeakReference< uno::XInterface >* pRef = mpList->First(); + while( pRef ) + { + uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef ); + if(!xTestRef.is()) + { + delete mpList->Remove(); + pRef = mpList->GetCurObject(); + } + else + { + if( (*pSearchFunc)( *pRef, pSearchData ) ) + { + rRef = *pRef; + return sal_True; + } + + pRef = mpList->Next(); + } + } + + return sal_False; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unocpres.hxx b/binfilter/bf_sd/source/ui/unoidl/unocpres.hxx new file mode 100644 index 000000000000..336fefc180f3 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unocpres.hxx @@ -0,0 +1,173 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOCPRES_HXX +#define _SD_UNOCPRES_HXX + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/interfacecontainer.h> +#include <osl/mutex.hxx> + +#include <cppuhelper/implbase5.hxx> +#include <comphelper/servicehelper.hxx> +namespace binfilter { + +/////////////////////////////////////////////////////////////////////////////// + +class SdXImpressDocument; +class SdView; +class SdCustomShow; + +class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XComponent, + ::com::sun::star::lang::XServiceInfo > +{ +private: + SdCustomShow* mpSdCustomShow; + SdXImpressDocument* mpModel; + + // for xComponent + ::osl::Mutex aDisposeContainerMutex; + ::cppu::OInterfaceContainerHelper aDisposeListeners; + BOOL bDisposing; + +public: + SdXCustomPresentation() throw(); + SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw(); + virtual ~SdXCustomPresentation() throw(); + + // internal + void Invalidate() { mpSdCustomShow = NULL; } + SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; } + void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; } + SdXImpressDocument* GetModel() const throw() { return mpModel; } + + // uno helper + UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); +}; + +// -------------------------------------------------------------------------- +} +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> + +#include <cppuhelper/implbase3.hxx> + +#include "unomodel.hxx" +#include "drawdoc.hxx" +class List; +namespace binfilter {//STRIP009 + +class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer, + ::com::sun::star::lang::XSingleServiceFactory, + ::com::sun::star::lang::XServiceInfo > +{ +private: + SdXImpressDocument& mrModel; + + // intern + inline List* GetCustomShowList() const throw(); + SdCustomShow * getSdCustomShow( const ::rtl::OUString& Name ) const throw(); + +public: + SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw(); + ~SdXCustomPresentationAccess() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XSingleServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); +}; + +inline List * SdXCustomPresentationAccess::GetCustomShowList() const throw() +{ + if(mrModel.GetDoc()) + return mrModel.GetDoc()->GetCustomShowList(sal_False); + else + return NULL; +}; + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unogsfm.hxx b/binfilter/bf_sd/source/ui/unoidl/unogsfm.hxx new file mode 100644 index 000000000000..007a7c48e034 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unogsfm.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOGSFM_HXX_ +#define _SD_UNOGSFM_HXX_ + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <comphelper/servicehelper.hxx> + +#include <bf_svtools/lstner.hxx> + +#include <cppuhelper/implbase5.hxx> + +#include <unomodel.hxx> +namespace binfilter { + +class SfxStyleSheetBase; +class SvUnoWeakContainer; +class SdPage; +class SdUnoGraphicStyle; + +class SdUnoGraphicStyleFamily : public ::cppu::WeakImplHelper5< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::lang::XSingleServiceFactory, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo > +{ +private: + SvUnoWeakContainer* mpStyles; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + SdXImpressDocument* mpModel; + + SdUnoGraphicStyle* getStyleFromAny( const ::com::sun::star::uno::Any& Element ) throw( ::com::sun::star::lang::IllegalArgumentException ); + +public: + SdUnoGraphicStyleFamily( SdXImpressDocument* pModel ) throw(); + ~SdUnoGraphicStyleFamily() throw(); + + void createStyle( SfxStyleSheetBase* pStyleSheet, ::com::sun::star::uno::Any &rAny ) const throw(); + + static String getInternalStyleName( const ::rtl::OUString& rName ) throw(); + static ::rtl::OUString getExternalStyleName( const String& rName ) throw(); + + UNO3_GETIMPLEMENTATION_DECL( SdUnoGraphicStyleFamily ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XSingleServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unogstyl.hxx b/binfilter/bf_sd/source/ui/unoidl/unogstyl.hxx new file mode 100644 index 000000000000..b37513c0886b --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unogstyl.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <unopstyl.hxx> +namespace binfilter { + +class SfxStyleSheetBase; + +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SdUnoGraphicStyle_CreateInstance_Impl(); + + +class SdUnoGraphicStyle : public SdUnoPseudoStyle +{ +private: + ::rtl::OUString maPreInitName; + ::rtl::OUString maPreInitParent; + +public: + SdUnoGraphicStyle( SdXImpressDocument* pModel = NULL, SfxStyleSheetBase* pStyleSheet = NULL ) throw(); + ~SdUnoGraphicStyle() throw(); + + void create( SdXImpressDocument* pModel, SfxStyleSheetBase* pStyleSheet ) throw(); + + UNO3_GETIMPLEMENTATION_DECL( SdUnoGraphicStyle ) + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XStyle + virtual ::rtl::OUString SAL_CALL getParentStyle( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unohelp.hxx b/binfilter/bf_sd/source/ui/unoidl/unohelp.hxx new file mode 100644 index 000000000000..07ff678a4329 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unohelp.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +namespace binfilter {//STRIP009 +namespace sd +{ +inline sal_Bool any2bool( const ::com::sun::star::uno::Any& rAny, sal_Bool& rBool ) +{ + if( rAny.getValueType() == ::getCppuBooleanType() ) + { + rBool = *(sal_Bool*)rAny.getValue(); + } + else + { + sal_Int32 nValue; + if(!(rAny >>= nValue)) + return sal_False; + rBool = nValue != 0; + } + + return sal_True; +} + +inline void bool2any( sal_Bool bBool, ::com::sun::star::uno::Any& rAny ) +{ + rAny.setValue( &bBool, ::getCppuBooleanType() ); +} + +} + +#define ITYPE( xint ) \ + ::getCppuType((const uno::Reference< xint >*)0) + +#define QUERYINT( xint ) \ + if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \ + aAny <<= uno::Reference< xint >(this) + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unolayer.hxx b/binfilter/bf_sd/source/ui/unoidl/unolayer.hxx new file mode 100644 index 000000000000..880ca47d71c9 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unolayer.hxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _UNOLAYER_HXX +#define _UNOLAYER_HXX + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/drawing/XLayer.hpp> +#include <com/sun/star/drawing/XLayerManager.hpp> + +#include <cppuhelper/implbase4.hxx> +#include <comphelper/servicehelper.hxx> + +#include <unomodel.hxx> +namespace binfilter { + +class SdrLayer; +class SdLayerManager; +class SdXImpressDocument; +class SvUnoWeakContainer; + +enum LayerAttribute { VISIBLE, PRINTABLE, LOCKED }; + +/*********************************************************************** +* * +***********************************************************************/ +class SdLayer : public ::cppu::WeakImplHelper4< ::com::sun::star::drawing::XLayer, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::container::XChild, + ::com::sun::star::lang::XUnoTunnel> +{ +private: + SdLayerManager* pLayerManager; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayerManager > mxLayerManager; + + SdrLayer* pLayer; + SvxItemPropertySet aPropSet; + + sal_Bool get( LayerAttribute what ) throw(); + void set( LayerAttribute what, sal_Bool flag ) throw(); + +public: + SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw(); + virtual ~SdLayer() throw(); + + // intern + SdrLayer* GetSdrLayer() const throw() { return pLayer; } + + static String convertToInternalName( const ::rtl::OUString& rName ); + static ::rtl::OUString convertToExternalName( const String& rName ); + + // uno helper + UNO3_GETIMPLEMENTATION_DECL( SdLayer ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XChild + + /** Returns the layer manager that manages this layer. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException); + + /** Not implemented. Allways throws an exception. + @raises NoSupportException. + */ + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + +}; + + +class SdLayerManager : public ::cppu::WeakImplHelper4< ::com::sun::star::drawing::XLayerManager, + ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel > +{ +public: + SdLayerManager( SdXImpressDocument& rMyModel ) throw(); + virtual ~SdLayerManager() throw(); + + // uno helper + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XLayerManager + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL attachShapeToLayer( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL getLayerForShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference<com::sun::star::drawing::XLayer> GetLayer (SdrLayer* pLayer); + SdXImpressDocument& rModel; + SvUnoWeakContainer* mpLayers; +}; + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unoobj.hxx b/binfilter/bf_sd/source/ui/unoidl/unoobj.hxx new file mode 100644 index 000000000000..37a1019ef812 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unoobj.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _UNOOBJ_HXX +#define _UNOOBJ_HXX + +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> + +#include <bf_svx/svdpool.hxx> + +#include <bf_svx/unomaster.hxx> + +#include <bf_svx/unoipset.hxx> + +#include <cppuhelper/implbase2.hxx> +struct SvEventDescription; +namespace binfilter { + +class SdrObject; +class SdXImpressDocument; +class SdAnimationInfo; + +class SdXShape : public SvxShapeMaster, + public ::com::sun::star::document::XEventsSupplier +{ + friend class SdUnoEventsAccess; + +private: + SvxShape* mpShape; + SvxItemPropertySet maPropSet; + const SfxItemPropertyMap* mpMap; + SdXImpressDocument* mpModel; + + void SetStyleSheet( const ::com::sun::star::uno::Any& rAny ) throw( ::com::sun::star::lang::IllegalArgumentException ); + ::com::sun::star::uno::Any GetStyleSheet() const throw( ::com::sun::star::beans::UnknownPropertyException ); + + // Intern + SdAnimationInfo* GetAnimationInfo( sal_Bool bCreate = sal_False ) const throw(); + sal_Bool IsPresObj() const throw(); + void SetPresObj( sal_Bool bPresObj ) throw(); + + sal_Bool IsEmptyPresObj() const throw(); + void SetEmptyPresObj( sal_Bool bEmpty ) throw(); + + sal_Bool IsMasterDepend() const throw(); + void SetMasterDepend( sal_Bool bDepend ) throw(); + + SdrObject* GetSdrObject() const throw(); + sal_Int32 GetPresentationOrderPos() const throw(); + void SetPresentationOrderPos( sal_Int32 nPos ) throw(); + + ::com::sun::star::uno::Sequence< sal_Int8 >* mpImplementationId; + +public: + SdXShape(SvxShape* pShape, SdXImpressDocument* pModel) throw(); + virtual ~SdXShape() throw(); + + virtual sal_Bool queryAggregation( const ::com::sun::star::uno::Type & rType, ::com::sun::star::uno::Any& aAny ); + virtual void dispose(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + //XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + //XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XEventsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException); +}; + +const SvEventDescription* ImplGetSupportedMacroItems(); + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unopage.hxx b/binfilter/bf_sd/source/ui/unoidl/unopage.hxx new file mode 100644 index 000000000000..a2cfea20253b --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unopage.hxx @@ -0,0 +1,301 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOPAGE_HXX +#define _SD_UNOPAGE_HXX + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/drawing/XMasterPageTarget.hpp> +#include <com/sun/star/presentation/XPresentationPage.hpp> +#include <cppuhelper/interfacecontainer.hxx> + +#include <bf_svtools/itemprop.hxx> +#include <bf_svx/unopage.hxx> +#include <bf_svx/fmdpage.hxx> +#include <bf_svx/svdpool.hxx> + +#include <comphelper/servicehelper.hxx> + +namespace binfilter { + +struct SfxItemPropertyMap; + +class SdPage; +class SvxShape; +class SdrObject; + +#ifdef SVX_LIGHT +#define SvxFmDrawPage SvxDrawPage +#endif + +class SdGenericDrawPageMutex +{ +protected: + ::osl::Mutex maMutex; +}; + +/*********************************************************************** +* * +***********************************************************************/ +class SdGenericDrawPage : public SvxFmDrawPage, + public ::com::sun::star::container::XNamed, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::document::XLinkTargetSupplier, + public ::com::sun::star::lang::XComponent, + public SdGenericDrawPageMutex +{ +protected: + friend class SdXImpressDocument; + + SvxItemPropertySet maPropSet; + SdXImpressDocument* mpModel; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxModel; + + virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException); + virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); + + ::rtl::OUString getBookmarkURL() const; + void setBookmarkURL( ::rtl::OUString& rURL ); + + void SetLftBorder( sal_Int32 nValue ); + void SetRgtBorder( sal_Int32 nValue ); + void SetUppBorder( sal_Int32 nValue ); + void SetLwrBorder( sal_Int32 nValue ); + + void SetWidth( sal_Int32 nWidth ); + void SetHeight( sal_Int32 nHeight ); + + sal_Bool mbHasBackgroundObject; + + cppu::OBroadcastHelper mrBHelper; + + virtual void disposing() throw(); + +public: + SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SfxItemPropertyMap* pMap ) throw(); + virtual ~SdGenericDrawPage() throw(); + + // intern + void Invalidate() { pPage = NULL; mpModel = NULL; mxModel = NULL; } + sal_Bool isValid() { return (pPage != NULL) && (mpModel != NULL); } + + SdPage* GetPage() const { return (SdPage*)pPage; } + SdXImpressDocument* GetModel() const { return mpModel; } + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // this is called whenever a SdrObject must be created for a empty api shape wrapper + virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(); + + // SvxFmDrawPage + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw (); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL release() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XLinkTargetSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); +}; +} //namespace binfilter +#endif + +/*********************************************************************** +* * +***********************************************************************/ +namespace binfilter {//STRIP009 +class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget, + public ::com::sun::star::presentation::XPresentationPage, + public SdGenericDrawPage +{ +private: + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; +protected: + virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException); + virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); +public: + SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw(); + virtual ~SdDrawPage() throw(); + + UNO3_GETIMPLEMENTATION_DECL( SdDrawPage ) + + static ::rtl::OUString getPageApiName( SdPage* pPage ); + static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName ); + static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName ); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XMasterPageTarget + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException); + + // XPresentationPage + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XShapes + virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage, + public SdGenericDrawPage +{ +private: + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; +protected: + SdrObject* mpBackgroundObj; + + virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException ); + virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); + +public: + SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw(); + virtual ~SdMasterPage() throw(); + + UNO3_GETIMPLEMENTATION_DECL(SdMasterPage) + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPresentationPage + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XShapes + virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); +}; + + +/*********************************************************************** +* * +***********************************************************************/ +#include <cppuhelper/implbase2.hxx> + +class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo > +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage; + SdGenericDrawPage* mpUnoPage; + +public: + SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw(); + virtual ~SdPageLinkTargets() throw(); + + // intern + SdrObject* FindObject( const String& rName ) const throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unopback.hxx b/binfilter/bf_sd/source/ui/unoidl/unopback.hxx new file mode 100644 index 000000000000..458510fac6f1 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unopback.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOPBACK_HXX +#define _SD_UNOPBACK_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <bf_svx/unoshprp.hxx> +#include <bf_svx/unoipset.hxx> + +#include <comphelper/servicehelper.hxx> + +#include <cppuhelper/implbase4.hxx> +namespace binfilter { + +class SfxItemSet; +const SfxItemPropertyMap* ImplGetPageBackgroundPropertyMap(); + +class SdrObject; +class SdDrawDocument; + +class SdUnoPageBackground : public ::cppu::WeakImplHelper4< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::lang::XUnoTunnel>, + public SfxListener +{ +protected: + SvxItemPropertySet maPropSet; + SfxItemSet* mpSet; + SdrModel* mpDoc; + + const SfxItemPropertyMap* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw(); +public: + SdUnoPageBackground( SdDrawDocument* pDoc = NULL, SdrObject* pObj = NULL ) throw(); + SdUnoPageBackground( SdDrawDocument* pDoc, const SfxItemSet* pSet ) throw(); + ~SdUnoPageBackground() throw(); + + // internal + void fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // uno helper + UNO3_GETIMPLEMENTATION_DECL( SdUnoPageBackground ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unopres.hxx b/binfilter/bf_sd/source/ui/unoidl/unopres.hxx new file mode 100644 index 000000000000..5ec134d77448 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unopres.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOPRES_HXX +#define _SD_UNOPRES_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/presentation/XPresentation.hpp> + +#include <bf_svx/unoipset.hxx> + +#include <cppuhelper/implbase3.hxx> +namespace binfilter { + +/////////////////////////////////////////////////////////////////////////////// + +class SdXImpressDocument; + +class SdXPresentation : public ::cppu::WeakImplHelper3< + ::com::sun::star::presentation::XPresentation, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo> +{ +private: + SdXImpressDocument& mrModel; + SvxItemPropertySet maPropSet; + +public: + SdXPresentation(SdXImpressDocument& rModel) throw(); + virtual ~SdXPresentation() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XPresentation + virtual void SAL_CALL start( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL end( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rehearseTimings( ) throw(::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unopsfm.hxx b/binfilter/bf_sd/source/ui/unoidl/unopsfm.hxx new file mode 100644 index 000000000000..adda62a158eb --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unopsfm.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <bf_svtools/lstner.hxx> + +#include <comphelper/servicehelper.hxx> + +#include <cppuhelper/implbase4.hxx> + +#include "unomodel.hxx" +#include "prlayout.hxx" +namespace binfilter { + +class SfxStyleSheet; +class SfxStyleSheetBase; + +class SvUnoWeakContainer; +class SdPage; + +class SdUnoPseudoStyleFamily : public ::cppu::WeakImplHelper4< + ::com::sun::star::container::XNameAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + SdXImpressDocument* mpModel; + SdPage* mpPage; + + SvUnoWeakContainer* mpStyles; + +public: + SdUnoPseudoStyleFamily( SdXImpressDocument* pModel, SdPage* pPage ) throw(); + ~SdUnoPseudoStyleFamily() throw(); + + static ::rtl::OUString getExternalStyleName( const String& rStyleName ) throw(); + + void createStyle( sal_uInt16 nIndex, ::com::sun::star::uno::Any& rAny ) throw(); + void createStyle( SfxStyleSheetBase* pStyleSheet, ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & rxRef ) throw(); + void createStyle( SfxStyleSheetBase* pStyleSheet, PresentationObjects eObject, ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & rxRef ) throw(); + + sal_Bool isValid() const throw() { return mxModel.is() && mpModel->GetDoc() != NULL; } + SdPage* getPage() const throw() { return mpPage; } + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + UNO3_GETIMPLEMENTATION_DECL( SdUnoPseudoStyleFamily ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unopstyl.hxx b/binfilter/bf_sd/source/ui/unoidl/unopstyl.hxx new file mode 100644 index 000000000000..f6029f50d580 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unopstyl.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_UNOPSTYL_HXX +#define _SD_UNOPSTYL_HXX + +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <bf_svtools/lstner.hxx> + +#include <bf_svx/unoipset.hxx> + +#include <comphelper/servicehelper.hxx> + +#include <prlayout.hxx> + +#include <cppuhelper/implbase5.hxx> +namespace binfilter { + +class SfxStyleSheetBase; + +class SdPage; +class SdXImpressDocument; + +class SdUnoPseudoStyle : public ::cppu::WeakImplHelper5< + ::com::sun::star::style::XStyle, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::beans::XPropertyState >, + public SfxListener +{ +protected: + SfxStyleSheetBase* mpStyleSheet; + PresentationObjects meObject; + SvxItemPropertySet maPropSet; + const ::rtl::OUString maStyleName; + SdPage* mpPage; + + SdXImpressDocument* mpModel; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + + SdUnoPseudoStyle( SdXImpressDocument* pModel, SfxStyleSheetBase* pStyleSheet ) throw(); + const SfxItemPropertyMap* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw(); + +public: + SdUnoPseudoStyle( SdXImpressDocument* pModel, SdPage* pPage, + SfxStyleSheetBase* pStyleSheet, + PresentationObjects eObject ) throw(); + ~SdUnoPseudoStyle() throw(); + + SfxStyleSheetBase* getStyleSheet() const throw() { return mpStyleSheet; } + PresentationObjects getPresObject() const throw() { return meObject; } + + sal_Bool isValid() const throw() { return mpStyleSheet != NULL; } + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + UNO3_GETIMPLEMENTATION_DECL( SdUnoPseudoStyle ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XStyle + virtual sal_Bool SAL_CALL isUserDefined( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isInUse( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getParentStyle( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unostyls.hxx b/binfilter/bf_sd/source/ui/unoidl/unostyls.hxx new file mode 100644 index 000000000000..56db0f442c40 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unostyls.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <cppuhelper/implbase3.hxx> + +#include <unomodel.hxx> +namespace binfilter { + +class SvUnoWeakContainer; + +class SdUnoStyleFamilies : public ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XNameAccess > +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + SdXImpressDocument* mpModel; + + sal_Bool mbImpress; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > mxGraphicStyles; + SvUnoWeakContainer* mpStyleFamilies; + + sal_uInt16 getLayoutCount() throw(); + ::rtl::OUString getLayoutNameByIndex( sal_uInt16 nIndex ) throw(); + sal_uInt16 getLayoutIndexByName( const ::rtl::OUString& rName ) throw(); + + void createGraphicStyleFamily( ::com::sun::star::uno::Any& rAny ) throw( ::com::sun::star::container::NoSuchElementException ) ; + void createStyleFamilyByIndex( sal_uInt16 nLayout, ::com::sun::star::uno::Any& rAny ) throw(); + +public: + SdUnoStyleFamilies( SdXImpressDocument* pModel ) throw(); + virtual ~SdUnoStyleFamilies() throw(); + + sal_Bool isValid() const throw() { return mxModel.is(); } + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/unoidl/unowcntr.hxx b/binfilter/bf_sd/source/ui/unoidl/unowcntr.hxx new file mode 100644 index 000000000000..0bc5381575b3 --- /dev/null +++ b/binfilter/bf_sd/source/ui/unoidl/unowcntr.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef _SV_UNOWCNTR_HXX_ +#define _SV_UNOWCNTR_HXX_ + +#include <cppuhelper/weakref.hxx> +namespace binfilter { + +typedef sal_Bool (*weakref_searchfunc)( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef, void* pSearchData ); + +class WeakRefList; + +class SvUnoWeakContainer +{ +private: + WeakRefList* mpList; + +public: + SvUnoWeakContainer() throw(); + ~SvUnoWeakContainer() throw(); + + /** inserts the given ref into this container */ + void insert( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef ) throw(); + + /** searches the container for a ref that returns true on the given + search function + */ + sal_Bool findRef( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc ); +}; + +} //namespace binfilter +#endif // _SV_UNOWCNTR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/view/makefile.mk b/binfilter/bf_sd/source/ui/view/makefile.mk new file mode 100644 index 000000000000..37796e44a296 --- /dev/null +++ b/binfilter/bf_sd/source/ui/view/makefile.mk @@ -0,0 +1,58 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sd_sd + +PRJNAME=binfilter +TARGET=sd_view + +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_sd +# --- Files -------------------------------------------------------- + +EXCEPTIONSFILES= \ + $(SLO)$/sd_sdoutl.obj + +SLOFILES = \ + $(SLO)$/sd_sdoutl.obj \ + $(SLO)$/sd_frmview.obj + + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sd/source/ui/view/sd_frmview.cxx b/binfilter/bf_sd/source/ui/view/sd_frmview.cxx new file mode 100644 index 000000000000..ec7fa44c4094 --- /dev/null +++ b/binfilter/bf_sd/source/ui/view/sd_frmview.cxx @@ -0,0 +1,941 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_svx/svxids.hrc> + + +#include <rtl/ustrbuf.hxx> + +#include "unokywds.hxx" + +#include <vector> + +#include "frmview.hxx" +#include "drawdoc.hxx" +#include "optsitem.hxx" +#include "sdresid.hxx" +#include "glob.hrc" +#include "sdiocmpt.hxx" +#include "bf_sd/docshell.hxx" + +namespace binfilter { + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::rtl; +using namespace ::std; + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView ) +: SdrView(pDrawDoc, (OutputDevice*) NULL) +, nRefCount(0) +, nPresViewShellId(SID_VIEWSHELL0) +, nSlotId(SID_OBJECT_SELECT) +{ + EndListening(*pDrawDoc); + + EnableExtendedKeyInputDispatcher(FALSE); + EnableExtendedMouseEventDispatcher(FALSE); + EnableExtendedCommandEventDispatcher(FALSE); + + SetGridFront( TRUE ); + SetOConSnap( FALSE ); + SetFrameDragSingles( TRUE ); + SetSlidesPerRow(4); + + if( NULL == pFrameView ) + { + SdDrawDocShell* pDocShell = pDrawDoc->GetDocSh(); + + if ( pDocShell ) + { + /********************************************************************** + * Das Dokument wurde geladen, ist eine FrameView vorhanden? + **********************************************************************/ + ULONG nSdViewShellCount = 0; + SdDrawDocument* pDoc = pDocShell->GetDoc(); + } + } + + aVisibleLayers.SetAll(); + aPrintableLayers.SetAll(); + SetGridCoarse( Size( 1000, 1000 ) ); + SetSnapGrid( Size( 1000, 1000 ) ); + SetSnapGridWidth(Fraction(1000, 1), Fraction(1000, 1)); + bNoColors = TRUE; + bNoAttribs = FALSE; + aVisArea = Rectangle( Point(), Size(0, 0) ); + ePageKind = PK_STANDARD; + nSelectedPage = 0; + eStandardEditMode = EM_PAGE; + eNotesEditMode = EM_PAGE; + eHandoutEditMode = EM_MASTERPAGE; + bLayerMode = FALSE; + SetEliminatePolyPoints(FALSE); + + { + bool bUseContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + nDrawMode = bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR; + } + nPreviewDrawMode = nDrawMode; + bShowPreviewInPageMode = FALSE; + bShowPreviewInMasterPageMode = TRUE; + bShowPreviewInOutlineMode = TRUE; + nTabCtrlPercent = 0.0; + + // get default for design mode + sal_Bool bInitDesignMode = pDrawDoc->GetOpenInDesignMode(); + if( pDrawDoc->OpenInDesignModeIsDefaulted() ) + { + bInitDesignMode = sal_True; + } + + SfxObjectShell* pObjShell = pDrawDoc->GetObjectShell(); + sal_Bool bReadOnly = sal_False; + if( pObjShell ) + bReadOnly = pObjShell->IsReadOnly(); + if( bReadOnly ) + bInitDesignMode = sal_False; + SetDesignMode( bInitDesignMode ); + + Update( SD_MOD()->GetSdOptions(pDrawDoc->GetDocumentType()) ); +} + +FrameView::~FrameView() +{ +} + +SvStream& operator << (SvStream& rOut, const FrameView& rView) +{ + sal_uInt32 nULTemp; + + rOut << (SdrView&) rView; + + SdIOCompat aIO(rOut, STREAM_WRITE, 11); + + rOut << rView.bRuler; + rOut << rView.aVisibleLayers; + rOut << rView.aLockedLayers; + rOut << rView.aPrintableLayers; + rOut << rView.aStandardHelpLines; + rOut << rView.aNotesHelpLines; + rOut << rView.aHandoutHelpLines; + rOut << rView.bNoColors; + rOut << rView.bNoAttribs; + rOut << rView.aVisArea; + nULTemp = (sal_uInt32) rView.ePageKind; rOut << nULTemp; + rOut << rView.nSelectedPage; + nULTemp = (sal_uInt32) rView.eStandardEditMode; rOut << nULTemp; + rOut << rView.bLayerMode; + rOut << rView.bQuickEdit; + rOut << rView.bDragWithCopy; + rOut << (UINT16)rView.nSlidesPerRow; + + rOut << rView.bBigHandles; + rOut << rView.bDoubleClickTextEdit; + rOut << rView.bClickChangeRotation; + + nULTemp = (sal_uInt32) rView.eNotesEditMode; rOut << nULTemp; + nULTemp = (sal_uInt32) rView.eHandoutEditMode; rOut << nULTemp; + + rOut << static_cast<sal_uInt32>(rView.nDrawMode); + rOut << static_cast<sal_uInt32>(rView.nPreviewDrawMode); + + rOut << rView.bShowPreviewInPageMode; + rOut << rView.bShowPreviewInMasterPageMode; + rOut << rView.bShowPreviewInOutlineMode; + + return rOut; +} + +SvStream& operator >> (SvStream& rIn, FrameView& rView) +{ + rIn >> (SdrView&) rView; + + SdIOCompat aIO(rIn, STREAM_READ); + + rIn >> rView.bRuler; + rIn >> rView.aVisibleLayers; + rIn >> rView.aLockedLayers; + rIn >> rView.aPrintableLayers; + rIn >> rView.aStandardHelpLines; + + if (aIO.GetVersion() >= 1) + { + // Daten der Versionen >= 1 einlesen + rIn >> rView.aNotesHelpLines; + rIn >> rView.aHandoutHelpLines; + } + + if (aIO.GetVersion() >= 2) + { + // Daten der Versionen >= 2 einlesen + rIn >> rView.bNoColors; + rIn >> rView.bNoAttribs; + } + + if (aIO.GetVersion() >= 3) + { + sal_uInt32 nULTemp; + rIn >> rView.aVisArea; + rIn >> nULTemp; rView.ePageKind = (PageKind) nULTemp; + rIn >> rView.nSelectedPage; + rIn >> nULTemp; rView.eStandardEditMode = (EditMode) nULTemp; + rView.eNotesEditMode = rView.eStandardEditMode; + rView.eHandoutEditMode = rView.eStandardEditMode; + rIn >> rView.bLayerMode; + } + + if (aIO.GetVersion() >= 4) + { + rIn >> rView.bQuickEdit; + } + + if (aIO.GetVersion() >= 5) + { + rIn >> rView.bDragWithCopy; + } + + if (aIO.GetVersion() >= 6) + { + UINT16 nTemp; + rIn >> nTemp; rView.nSlidesPerRow = (USHORT)nTemp; + } + + if (aIO.GetVersion() >= 7) + { + rIn >> rView.bBigHandles; + rIn >> rView.bDoubleClickTextEdit; + rIn >> rView.bClickChangeRotation; + } + + if (aIO.GetVersion() >= 8) + { + sal_uInt32 nULTemp; + rIn >> nULTemp; rView.eNotesEditMode = (EditMode) nULTemp; + rIn >> nULTemp; rView.eHandoutEditMode = (EditMode) nULTemp; + } + + if (aIO.GetVersion() >= 9) + { + sal_uInt32 nTemp; + rIn >> nTemp; + rView.nDrawMode = nTemp; + rIn >> nTemp; + rView.nPreviewDrawMode = nTemp; + } + + if (aIO.GetVersion() >= 10) + { + rIn >> rView.bShowPreviewInPageMode; + rIn >> rView.bShowPreviewInMasterPageMode; + } + + if (aIO.GetVersion() >= 11) + { + rIn >> rView.bShowPreviewInOutlineMode; + } + + if (rView.GetModel()) + { + USHORT nMaxPages = ((SdDrawDocument* )rView.GetModel())->GetSdPageCount(rView.ePageKind); + + if (rView.nSelectedPage >= nMaxPages) + rView.nSelectedPage = nMaxPages - 1; + } + + return rIn; +} + +void FrameView::Update(SdOptions* pOptions) +{ + if (pOptions) + { + bRuler = pOptions->IsRulerVisible(); + SetGridVisible( pOptions->IsGridVisible() ); + SetSnapAngle( pOptions->GetAngle() ); + SetGridSnap( pOptions->IsUseGridSnap() ); + SetBordSnap( pOptions->IsSnapBorder() ); + SetHlplSnap( pOptions->IsSnapHelplines() ); + SetOFrmSnap( pOptions->IsSnapFrame() ); + SetOPntSnap( pOptions->IsSnapPoints() ); + SetHlplVisible( pOptions->IsHelplines() ); + SetDragStripes( pOptions->IsDragStripes() ); + SetPlusHandlesAlwaysVisible( pOptions->IsHandlesBezier() ); + SetSnapMagneticPixel( pOptions->GetSnapArea() ); + SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() ); + SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() ); + SetSlantButShear( pOptions->IsMoveOnlyDragging() ); + SetNoDragXorPolys ( !pOptions->IsMoveOutline() ); + SetCrookNoContortion( pOptions->IsCrookNoContortion() ); + SetAngleSnapEnabled( pOptions->IsRotate() ); + SetBigOrtho( pOptions->IsBigOrtho() ); + SetOrtho( pOptions->IsOrtho() ); + SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle() ); + SetMasterPagePaintCaching( pOptions->IsMasterPagePaintCaching() ); + GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() ); + + SetLineDraft( pOptions->IsHairlineMode() ); + SetFillDraft( pOptions->IsOutlineMode() ); + SetTextDraft( pOptions->IsNoText() ); + SetGrafDraft( pOptions->IsExternGraphic() ); + SetSolidMarkHdl( pOptions->IsSolidMarkHdl() ); + SetSolidDragging( pOptions->IsSolidDragging() ); + + SetGridCoarse( Size( pOptions->GetFldDrawX(), pOptions->GetFldDrawY() ) ); + SetGridFine( Size( pOptions->GetFldDivisionX(), pOptions->GetFldDivisionY() ) ); +// SetSnapGrid( Size( pOptions->GetFldSnapX(), pOptions->GetFldSnapY() ) ); + Fraction aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 )); + Fraction aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 )); + SetSnapGridWidth(aFractX, aFractY); + SetQuickEdit(pOptions->IsQuickEdit()); + SetDragWithCopy(pOptions->IsDragWithCopy()); + + SetBigHandles( pOptions->IsBigHandles() ); + SetDoubleClickTextEdit( pOptions->IsDoubleClickTextEdit() ); + SetClickChangeRotation( pOptions->IsClickChangeRotation() ); + SetPreviewDrawMode( pOptions->GetPreviewQuality() ); + } +} + + +void FrameView::SetViewShEditMode(EditMode eMode, PageKind eKind) +{ + if (eKind == PK_STANDARD) + { + eStandardEditMode = eMode; + } + else if (eKind == PK_NOTES) + { + eNotesEditMode = eMode; + } + else if (eKind == PK_HANDOUT) + { + eHandoutEditMode = eMode; + } +} + +EditMode FrameView::GetViewShEditMode(PageKind eKind) +{ + EditMode eMode = EM_PAGE; + + if (eKind == PK_STANDARD) + { + eMode = eStandardEditMode; + } + else if (eKind == PK_NOTES) + { + eMode = eNotesEditMode; + } + else if (eKind == PK_HANDOUT) + { + eMode = eHandoutEditMode; + } + + return (eMode); +} + +static OUString createHelpLinesString( const SdrHelpLineList& rHelpLines ) +{ + OUStringBuffer aLines; + + const USHORT nCount = rHelpLines.GetCount(); + for( USHORT nHlpLine = 0; nHlpLine < nCount; nHlpLine++ ) + { + const SdrHelpLine& rHelpLine = rHelpLines[nHlpLine]; + const Point& rPos = rHelpLine.GetPos(); + + switch( rHelpLine.GetKind() ) + { + case SDRHELPLINE_POINT: + aLines.append( (sal_Unicode)'P' ); + aLines.append( (sal_Int32)rPos.X() ); + aLines.append( (sal_Unicode)',' ); + aLines.append( (sal_Int32)rPos.Y() ); + break; + case SDRHELPLINE_VERTICAL: + aLines.append( (sal_Unicode)'V' ); + aLines.append( (sal_Int32)rPos.X() ); + break; + case SDRHELPLINE_HORIZONTAL: + aLines.append( (sal_Unicode)'H' ); + aLines.append( (sal_Int32)rPos.Y() ); + break; + default: + DBG_ERROR( "Unsupported helpline Kind!" ); + } + } + + return aLines.makeStringAndClear(); +} + +#define addValue( n, v ) push_back( std::pair< OUString, Any >( OUString( RTL_CONSTASCII_USTRINGPARAM( n ) ), v ) ) +void FrameView::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rValues, sal_Bool bBrowse ) +{ + std::vector< std::pair< OUString, Any > > aUserData; + + aUserData.addValue( sUNO_View_GridIsVisible, makeAny( (sal_Bool)IsGridVisible() ) ); + aUserData.addValue( sUNO_View_GridIsFront, makeAny( (sal_Bool)IsGridFront() ) ); + aUserData.addValue( sUNO_View_IsSnapToGrid, makeAny( (sal_Bool)IsGridSnap() ) ); + aUserData.addValue( sUNO_View_IsSnapToPageMargins, makeAny( (sal_Bool)IsBordSnap() ) ); + aUserData.addValue( sUNO_View_IsSnapToSnapLines, makeAny( (sal_Bool)IsHlplSnap() ) ); + aUserData.addValue( sUNO_View_IsSnapToObjectFrame, makeAny( (sal_Bool)IsOFrmSnap() ) ); + aUserData.addValue( sUNO_View_IsSnapToObjectPoints, makeAny( (sal_Bool)IsOPntSnap() ) ); + + aUserData.addValue( sUNO_View_IsPlusHandlesAlwaysVisible, makeAny( (sal_Bool)IsPlusHandlesAlwaysVisible() ) ); + aUserData.addValue( sUNO_View_IsFrameDragSingles, makeAny( (sal_Bool)IsFrameDragSingles() ) ); + + aUserData.addValue( sUNO_View_EliminatePolyPointLimitAngle, makeAny( (sal_Int32)GetEliminatePolyPointLimitAngle() ) ); + aUserData.addValue( sUNO_View_IsEliminatePolyPoints, makeAny( (sal_Bool)IsEliminatePolyPoints() ) ); + + Any aAny; + GetVisibleLayers().QueryValue( aAny ); + aUserData.addValue( sUNO_View_VisibleLayers, aAny ); + + GetPrintableLayers().QueryValue( aAny ); + aUserData.addValue( sUNO_View_PrintableLayers, aAny ); + + GetLockedLayers().QueryValue( aAny ); + aUserData.addValue( sUNO_View_LockedLayers, aAny ); + + aUserData.addValue( sUNO_View_NoAttribs, makeAny( (sal_Bool)IsNoAttribs() ) ); + aUserData.addValue( sUNO_View_NoColors, makeAny( (sal_Bool)IsNoColors() ) ); + + if( GetStandardHelpLines().GetCount() ) + aUserData.addValue( sUNO_View_SnapLinesDrawing, makeAny( createHelpLinesString( GetStandardHelpLines() ) ) ); + + aUserData.addValue( sUNO_View_RulerIsVisible, makeAny( (sal_Bool)HasRuler() ) ); + aUserData.addValue( sUNO_View_PageKind, makeAny( (sal_Int16)GetPageKind() ) ); + aUserData.addValue( sUNO_View_SelectedPage, makeAny( (sal_Int16)GetSelectedPage() ) ); + aUserData.addValue( sUNO_View_IsLayerMode, makeAny( (sal_Bool)IsLayerMode() ) ); + + aUserData.addValue( sUNO_View_IsBigHandles, makeAny( (sal_Bool)IsBigHandles() ) ); + aUserData.addValue( sUNO_View_IsDoubleClickTextEdit, makeAny( (sal_Bool)IsDoubleClickTextEdit() ) ); + aUserData.addValue( sUNO_View_IsClickChangeRotation, makeAny( (sal_Bool)IsClickChangeRotation() ) ); + + aUserData.addValue( sUNO_View_SlidesPerRow, makeAny( (sal_Int16)GetSlidesPerRow() ) ); + aUserData.addValue( sUNO_View_IsShowPreviewInPageMode, makeAny( (sal_Bool)IsShowPreviewInPageMode() ) ); + aUserData.addValue( sUNO_View_IsShowPreviewInMasterPageMode, makeAny( (sal_Bool)IsShowPreviewInMasterPageMode() ) ); + aUserData.addValue( sUNO_View_SetShowPreviewInOutlineMode, makeAny( (sal_Bool)IsShowPreviewInOutlineMode() ) ); + aUserData.addValue( sUNO_View_EditModeStandard, makeAny( (sal_Int32)GetViewShEditMode( PK_STANDARD ) ) ); + aUserData.addValue( sUNO_View_EditModeNotes, makeAny( (sal_Int32)GetViewShEditMode( PK_NOTES ) ) ); + aUserData.addValue( sUNO_View_EditModeHandout, makeAny( (sal_Int32)GetViewShEditMode( PK_HANDOUT ) ) ); + + { + const Rectangle aVisArea = GetVisArea(); + + aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( (sal_Int32)aVisArea.Top() ) ); + aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( (sal_Int32)aVisArea.Left() ) ); + aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( (sal_Int32)aVisArea.GetWidth() ) ); + aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( (sal_Int32)aVisArea.GetHeight() ) ); + } + + aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( (sal_Int32)GetGridCoarse().Width() ) ); + aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( (sal_Int32)GetGridCoarse().Height() ) ); + aUserData.addValue( sUNO_View_GridFineWidth, makeAny( (sal_Int32)GetGridFine().Width() ) ); + aUserData.addValue( sUNO_View_GridFineHeight, makeAny( (sal_Int32)GetGridFine().Height() ) ); + aUserData.addValue( sUNO_View_GridSnapWidth, makeAny( (sal_Int32)GetSnapGrid().Width() ) ); + aUserData.addValue( sUNO_View_GridSnapHeight, makeAny( (sal_Int32)GetSnapGrid().Height() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().GetNumerator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().GetDenominator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().GetNumerator() ) ); + aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().GetDenominator() ) ); + aUserData.addValue( sUNO_View_IsAngleSnapEnabled, makeAny( (sal_Bool)IsAngleSnapEnabled() ) ); + aUserData.addValue( sUNO_View_SnapAngle, makeAny( (sal_Int32)GetSnapAngle() ) ); + + const sal_Int32 nOldLength = rValues.getLength(); + rValues.realloc( nOldLength + aUserData.size() ); + + PropertyValue* pValue = &(rValues.getArray()[nOldLength]); + + std::vector< std::pair< OUString, Any > >::iterator aIter( aUserData.begin() ); + for( ; aIter != aUserData.end(); aIter++, pValue++ ) + { + pValue->Name = (*aIter).first; + pValue->Value = (*aIter).second; + } +} +#undef addValue + + static void createHelpLinesFromString( const ::rtl::OUString& rLines, SdrHelpLineList& rHelpLines ) + { + const sal_Unicode * pStr = rLines.getStr(); + SdrHelpLine aNewHelpLine; + ::rtl::OUStringBuffer sBuffer; + + while( *pStr ) + { + Point aPoint; + + switch( *pStr ) + { + case (sal_Unicode)'P': + aNewHelpLine.SetKind( SDRHELPLINE_POINT ); + break; + case (sal_Unicode)'V': + aNewHelpLine.SetKind( SDRHELPLINE_VERTICAL ); + break; + case (sal_Unicode)'H': + aNewHelpLine.SetKind( SDRHELPLINE_HORIZONTAL ); + break; + default: + DBG_ERROR( "syntax error in snap lines settings string" ); + return; + } + + pStr++; + + while( (*pStr >= sal_Unicode('0') && *pStr <= sal_Unicode('9')) || (*pStr == '+') || (*pStr == '-') ) + { + sBuffer.append( *pStr++ ); + } + + sal_Int32 nValue = sBuffer.makeStringAndClear().toInt32(); + + if( aNewHelpLine.GetKind() == SDRHELPLINE_HORIZONTAL ) + { + aPoint.Y() = nValue; + } + else + { + aPoint.X() = nValue; + + if( aNewHelpLine.GetKind() == SDRHELPLINE_POINT ) + { + if( *pStr++ != ',' ) + return; + + while( (*pStr >= sal_Unicode('0') && *pStr <= sal_Unicode('9')) || (*pStr == '+') || (*pStr == '-') ) + { + sBuffer.append( *pStr++ ); + } + + aPoint.Y() = sBuffer.makeStringAndClear().toInt32(); + + } + } + + aNewHelpLine.SetPos( aPoint ); + rHelpLines.Insert( aNewHelpLine ); + } + } + +/*?*/ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse ) +/*?*/ { +/*?*/ const sal_Int32 nLength = rSequence.getLength(); + if (nLength) + { + sal_Bool bBool; + sal_Int32 nInt32; + sal_Int16 nInt16; + ::rtl::OUString aString; + + sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator(); + sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator(); + + sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator(); + sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator(); + + const ::com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray(); + for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ ) + { + if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ViewId ) ) ) + { + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesDrawing ) ) ) + { + if( pValue->Value >>= aString ) + { + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetStandardHelpLines( aHelpLines ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesNotes ) ) ) + { + if( pValue->Value >>= aString ) + { + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetNotesHelpLines( aHelpLines ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapLinesHandout ) ) ) + { + if( pValue->Value >>= aString ) + { + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetHandoutHelpLines( aHelpLines ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_RulerIsVisible ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetRuler( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_PageKind ) ) ) + { + if( pValue->Value >>= nInt16 ) + { + SetPageKind( (PageKind)nInt16 ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsLayerMode ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetLayerMode( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsBigHandles ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetBigHandles( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsDoubleClickTextEdit ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetDoubleClickTextEdit( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsClickChangeRotation ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetClickChangeRotation( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SlidesPerRow ) ) ) + { + if( pValue->Value >>= nInt16 ) + { + SetSlidesPerRow( (USHORT)nInt16 ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsShowPreviewInPageMode ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetShowPreviewInPageMode( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsShowPreviewInMasterPageMode ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetShowPreviewInMasterPageMode( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SetShowPreviewInOutlineMode ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetShowPreviewInOutlineMode( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeStandard ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + SetViewShEditMode( (EditMode)nInt32, PK_STANDARD ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeNotes ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + SetViewShEditMode( (EditMode)nInt32, PK_NOTES ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EditModeHandout ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + SetViewShEditMode( (EditMode)nInt32, PK_HANDOUT ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaTop ) ) ) + { + sal_Int32 nTop; + if( pValue->Value >>= nTop ) + { + Rectangle aVisArea( GetVisArea() ); + aVisArea.nBottom += nTop - aVisArea.nTop; + aVisArea.nTop = nTop; + SetVisArea( aVisArea ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaLeft ) ) ) + { + sal_Int32 nLeft; + if( pValue->Value >>= nLeft ) + { + Rectangle aVisArea( GetVisArea() ); + aVisArea.nRight += nLeft - aVisArea.nLeft; + aVisArea.nLeft = nLeft; + SetVisArea( aVisArea ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaWidth ) ) ) + { + sal_Int32 nWidth; + if( pValue->Value >>= nWidth ) + { + Rectangle aVisArea( GetVisArea() ); + aVisArea.nRight = aVisArea.nLeft + nWidth - 1; + SetVisArea( aVisArea ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleAreaHeight ) ) ) + { + sal_Int32 nHeight; + if( pValue->Value >>= nHeight ) + { + Rectangle aVisArea( GetVisArea() ); + aVisArea.nBottom = nHeight + aVisArea.nTop - 1; + SetVisArea( aVisArea ); + } + } + + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridIsVisible ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetGridVisible( bBool ); + } + } + + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToGrid ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetGridSnap( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridIsFront ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetGridFront( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToPageMargins ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetBordSnap( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToSnapLines ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetHlplSnap( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToObjectFrame ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetOFrmSnap( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsSnapToObjectPoints ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetOPntSnap( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsPlusHandlesAlwaysVisible ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetPlusHandlesAlwaysVisible( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsFrameDragSingles ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetFrameDragSingles( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_EliminatePolyPointLimitAngle ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + SetEliminatePolyPointLimitAngle( nInt32 ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsEliminatePolyPoints ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetEliminatePolyPoints( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ActiveLayer ) ) ) + { + if( pValue->Value >>= aString ) + { + SetActiveLayer( aString ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_NoAttribs ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetNoAttribs( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_NoColors ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetNoColors( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridCoarseWidth ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( nInt32, GetGridCoarse().Height() ); + SetGridCoarse( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridCoarseHeight ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( GetGridCoarse().Width(), nInt32 ); + SetGridCoarse( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridFineWidth ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( nInt32, GetGridFine().Height() ); + SetGridFine( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridFineHeight ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( GetGridFine().Width(), nInt32 ); + SetGridFine( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidth ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( nInt32, GetSnapGrid().Height() ); + SetSnapGrid( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapHeight ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + const Size aCoarse( GetSnapGrid().Width(), nInt32 ); + SetSnapGrid( aCoarse ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_IsAngleSnapEnabled ) ) ) + { + if( pValue->Value >>= bBool ) + { + SetAngleSnapEnabled( bBool ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_SnapAngle ) ) ) + { + if( pValue->Value >>= nInt32 ) + { + SetSnapAngle( nInt32 ); + } + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthXNumerator ) ) ) + { + pValue->Value >>= aSnapGridWidthXNum; + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthXDenominator ) ) ) + { + pValue->Value >>= aSnapGridWidthXDom; + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthYNumerator ) ) ) + { + pValue->Value >>= aSnapGridWidthYNum; + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_GridSnapWidthYDenominator ) ) ) + { + pValue->Value >>= aSnapGridWidthYDom; + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_VisibleLayers ) ) ) + { + SetOfByte aSetOfBytes; + aSetOfBytes.PutValue( pValue->Value ); + SetVisibleLayers( aSetOfBytes ); + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_PrintableLayers ) ) ) + { + SetOfByte aSetOfBytes; + aSetOfBytes.PutValue( pValue->Value ); + SetPrintableLayers( aSetOfBytes ); + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_LockedLayers ) ) ) + { + SetOfByte aSetOfBytes; + aSetOfBytes.PutValue( pValue->Value ); + SetLockedLayers( aSetOfBytes ); + } + } + + const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom ); + const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom ); + + SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY ); + } +} +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sd/source/ui/view/sd_sdoutl.cxx b/binfilter/bf_sd/source/ui/view/sd_sdoutl.cxx new file mode 100644 index 000000000000..081de83bc412 --- /dev/null +++ b/binfilter/bf_sd/source/ui/view/sd_sdoutl.cxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <bf_sfx2/app.hxx> +#include <bf_svx/editstat.hxx> +#include <bf_svx/unolingu.hxx> +#include <bf_svx/eeitem.hxx> +#include <bf_svx/forbiddencharacterstable.hxx> + +#include "sdoutl.hxx" +#include "drawdoc.hxx" +#include "sdmod.hxx" + +class SfxStyleSheetPool; + +namespace binfilter { + +SdOutliner::SdOutliner( SdDrawDocument* pDoc, USHORT nMode ) +: SdrOutliner( &pDoc->GetItemPool(), nMode ) +{ + SetStyleSheetPool((SfxStyleSheetPool*) pDoc->GetStyleSheetPool()); + SetEditTextObjectPool( &pDoc->GetItemPool() ); + SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + SetForbiddenCharsTable( pDoc->GetForbiddenCharsTable() ); + + ULONG nCntrl = GetControlWord(); + nCntrl |= EE_CNTRL_ALLOWBIGOBJS; + nCntrl |= EE_CNTRL_URLSFXEXECUTE; + nCntrl |= EE_CNTRL_MARKFIELDS; + nCntrl |= EE_CNTRL_AUTOCORRECT; + nCntrl |= EE_CNTRL_NOREDLINES; + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + + SetControlWord(nCntrl); + + SetDefaultLanguage( Application::GetSettings().GetLanguage() ); +} + +SdOutliner::~SdOutliner() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |