diff options
Diffstat (limited to 'binfilter/bf_sd/source/ui')
53 files changed, 18430 insertions, 0 deletions
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: */ |