diff options
Diffstat (limited to 'binfilter/bf_svx/source/svdraw')
61 files changed, 33781 insertions, 0 deletions
diff --git a/binfilter/bf_svx/source/svdraw/makefile.mk b/binfilter/bf_svx/source/svdraw/makefile.mk new file mode 100644 index 000000000000..2b8c3988e897 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/makefile.mk @@ -0,0 +1,124 @@ +#*************************************************************************# +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=svx_svdraw + +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk +INC+= -I$(PRJ)$/inc$/bf_svx + +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/svx_svdoutlinercache.obj \ + $(SLO)$/svx_dialdll.obj \ + $(SLO)$/svx_svdattr.obj \ + $(SLO)$/svx_svdcrtv.obj \ + $(SLO)$/svx_svddrag.obj \ + $(SLO)$/svx_svddrgv.obj \ + $(SLO)$/svx_svdedtv.obj \ + $(SLO)$/svx_svdedtv2.obj \ + $(SLO)$/svx_svdedxv.obj \ + $(SLO)$/svx_svdetc.obj \ + $(SLO)$/svx_svdglev.obj \ + $(SLO)$/svx_svdglue.obj \ + $(SLO)$/svx_svdhdl.obj \ + $(SLO)$/svx_svdhlpln.obj \ + $(SLO)$/svx_svdio.obj \ + $(SLO)$/svx_svditer.obj \ + $(SLO)$/svx_svdlayer.obj \ + $(SLO)$/svx_svdmark.obj \ + $(SLO)$/svx_svdmodel.obj \ + $(SLO)$/svx_svdmrkv.obj \ + $(SLO)$/svx_svdmrkv1.obj \ + $(SLO)$/svx_svdoattr.obj \ + $(SLO)$/svx_svdobj.obj \ + $(SLO)$/svx_impgrfll.obj \ + $(SLO)$/svx_svdocapt.obj \ + $(SLO)$/svx_svdocirc.obj \ + $(SLO)$/svx_svdoedge.obj \ + $(SLO)$/svx_svdograf.obj \ + $(SLO)$/svx_svdogrp.obj \ + $(SLO)$/svx_svdomeas.obj \ + $(SLO)$/svx_svdoole2.obj \ + $(SLO)$/svx_svdopage.obj \ + $(SLO)$/svx_svdopath.obj \ + $(SLO)$/svx_svdorect.obj \ + $(SLO)$/svx_svdotext.obj \ + $(SLO)$/svx_svdotxat.obj \ + $(SLO)$/svx_svdotxed.obj \ + $(SLO)$/svx_svdotxfl.obj \ + $(SLO)$/svx_svdotxln.obj \ + $(SLO)$/svx_svdotxtr.obj \ + $(SLO)$/svx_svdouno.obj \ + $(SLO)$/svx_svdoutl.obj \ + $(SLO)$/svx_svdovirt.obj \ + $(SLO)$/svx_svdpage.obj \ + $(SLO)$/svx_svdpagv.obj \ + $(SLO)$/svx_svdpntv.obj \ + $(SLO)$/svx_svdpoev.obj \ + $(SLO)$/svx_svdsnpv.obj \ + $(SLO)$/svx_svdsuro.obj \ + $(SLO)$/svx_svdtouch.obj \ + $(SLO)$/svx_svdtrans.obj \ + $(SLO)$/svx_svdtxhdl.obj \ + $(SLO)$/svx_svdundo.obj \ + $(SLO)$/svx_svdview.obj \ + $(SLO)$/svx_svdviter.obj \ + $(SLO)$/svx_svdvmark.obj \ + $(SLO)$/svx_svdxcgv.obj + +.IF "$(OS)$(CPU)"=="LINUXI" +NOOPTFILES=$(SLO)$/svx_svdattr.obj +.ENDIF + +EXCEPTIONSFILES= \ + $(SLO)$/svx_svdhdl.obj \ + $(SLO)$/svx_svdmrkv.obj \ + $(SLO)$/svx_svdogrp.obj \ + $(SLO)$/svx_svdotxln.obj \ + $(SLO)$/svx_svdouno.obj \ + $(SLO)$/svx_svdfppt.obj \ + $(SLO)$/svx_svdmodel.obj \ + $(SLO)$/svx_svdpagv.obj + +SRS1NAME=svx_svdstr +SRC1FILES= \ + svx_svdstr.src + +.INCLUDE : target.mk + diff --git a/binfilter/bf_svx/source/svdraw/svditext.hxx b/binfilter/bf_svx/source/svdraw/svditext.hxx new file mode 100644 index 000000000000..cef96da12999 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svditext.hxx @@ -0,0 +1,58 @@ +/* -*- 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 _SVDITEXT_HXX +#define _SVDITEXT_HXX + +// SvxItem-Mapping. Wird benoetigt um die SvxItem-Header erfolgreich zu includen + +namespace binfilter { + +// textitem.hxx editdata.hxx +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_CHARSCALE_W EE_CHAR_FONTWIDTH +#define ITEMID_WEIGHT EE_CHAR_WEIGHT +#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE +#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT +#define ITEMID_POSTURE EE_CHAR_ITALIC +#define ITEMID_CONTOUR EE_CHAR_OUTLINE +#define ITEMID_SHADOWED EE_CHAR_SHADOW +#define ITEMID_ESCAPEMENT EE_CHAR_ESCAPEMENT +#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING +#define ITEMID_WORDLINEMODE EE_CHAR_WLM + +// paraitem.hxx editdata.hxx +#define ITEMID_ADJUST EE_PARA_JUST +#define ITEMID_FIELD EE_FEATURE_FIELD + +}//end of namespace binfilter +#endif // _SVDITEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svdtxhdl.hxx b/binfilter/bf_svx/source/svdraw/svdtxhdl.hxx new file mode 100644 index 000000000000..3b86745f72fb --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svdtxhdl.hxx @@ -0,0 +1,106 @@ +/* -*- 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 _SVDTXHDL_HXX +#define _SVDTXHDL_HXX + +#include <vcl/virdev.hxx> + + +namespace binfilter { + +//************************************************************ +// Vorausdeklarationen +//************************************************************ + +class SdrOutliner; +class DrawPortionInfo; +class SdrTextObj; +class SdrObjGroup; +class SdrModel; +class ExtOutputDevice; + +//************************************************************ +// ImpTextPortionHandler +//************************************************************ + +class ImpTextPortionHandler +{ + VirtualDevice aVDev; + Rectangle aFormTextBoundRect; + SdrOutliner& rOutliner; + const SdrTextObj& rTextObj; + ExtOutputDevice* pXOut; + + // Variablen fuer ConvertToPathObj + SdrObjGroup* pGroup; + SdrModel* pModel; + FASTBOOL bToPoly; + + // Variablen fuer DrawFitText + Point aPos; + Fraction aXFact; + Fraction aYFact; + + // Variablen fuer DrawTextToPath + // #101498# + //Polygon aPoly; + //long nTextWidth; + ULONG nParagraph; + BOOL bToLastPoint; + BOOL bDraw; + void* mpRecordPortions; + +private: + // #101498# + void SortedAddFormTextRecordPortion(DrawPortionInfo* pInfo); + void DrawFormTextRecordPortions(Polygon aPoly); + void ClearFormTextRecordPortions(); + sal_uInt32 GetFormTextPortionsLength(OutputDevice* pOut); + +public: + ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj); + + void DrawTextToPath(ExtOutputDevice& rXOut, FASTBOOL bDrawEffect=TRUE); + + // wird von DrawTextToPath() gesetzt: + const Rectangle& GetFormTextBoundRect() { return aFormTextBoundRect; } + + + // #101498# + DECL_LINK(FormTextRecordPortionHdl, DrawPortionInfo*); + //DECL_LINK(FormTextWidthHdl,DrawPortionInfo*); + //DECL_LINK(FormTextDrawHdl,DrawPortionInfo*); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +}//end of namespace binfilter +#endif //_SVDTXHDL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_dialdll.cxx b/binfilter/bf_svx/source/svdraw/svx_dialdll.cxx new file mode 100644 index 000000000000..e7b78baa4f4b --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_dialdll.cxx @@ -0,0 +1,92 @@ +/* -*- 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 --------------------------------------------------------------- + +#include <bf_svtools/solar.hrc> +#include "dialdll.hxx" +#include "dialmgr.hxx" +#define ITEMID_BRUSH 1 +#include "brshitem.hxx" + + +#include <vcl/svapp.hxx> + + + +#include <bf_svtools/filter.hxx> + +#include <bf_svtools/wallitem.hxx> +namespace binfilter { + +// struct DialogsResMgr -------------------------------------------------- +/*N*/ DialogsResMgr::DialogsResMgr() +/*N*/ : pResMgr(0), +/*N*/ pGrapicFilter(0) +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ ByteString aName( "bf_svx" ); //STRIP005 +/*N*/ #else +/*N*/ ByteString aName( "bf_svl" ); //STRIP005 +/*N*/ #endif +/*N*/ pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() ); +/*N*/ } + +// ----------------------------------------------------------------------- +/*N*/ DialogsResMgr::~DialogsResMgr() +/*N*/ { +/*N*/ delete pGrapicFilter; +/*N*/ delete pResMgr; +/*N*/ } + +// class SvxDialogDll ---------------------------------------------------- +/*N*/ SvxDialogDll::SvxDialogDll() +/*N*/ { +/*N*/ DBG_ASSERT( !(*GetAppData(BF_SHL_SVX)), "Ctor, but pointer not null" ); +/*N*/ +/*N*/ (*(DialogsResMgr**)GetAppData(BF_SHL_SVX)) = new DialogsResMgr; +/*N*/ SvxBrushItem::InitSfxLink(); // OV,30.06.1998 +/*N*/ } + +// ----------------------------------------------------------------------- +/*N*/ SvxDialogDll::~SvxDialogDll() +/*N*/ { +/*N*/ DBG_ASSERT( (*GetAppData(BF_SHL_SVX)), "Dtor, pointer == null" ); +/*N*/ +/*N*/ delete (*(DialogsResMgr**)GetAppData(BF_SHL_SVX)); +/*N*/ (*(DialogsResMgr**)GetAppData(BF_SHL_SVX)) = 0; +/*N*/ delete SfxBrushItemLink::Get(); +/*N*/ (*(SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM)) = 0; +/*N*/ } + +// ----------------------------------------------------------------------- + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_impgrfll.cxx b/binfilter/bf_svx/source/svdraw/svx_impgrfll.cxx new file mode 100644 index 000000000000..26b161e69a21 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_impgrfll.cxx @@ -0,0 +1,95 @@ +/* -*- 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/metaact.hxx> + + + +#include "svdobj.hxx" + +#include "xdef.hxx" + +#include "xattr.hxx" +#include "xoutx.hxx" + +#include "svdoimp.hxx" +#include "svdattr.hxx" +namespace binfilter { + + +/////////////////////////////////////////////////////////////////////////////// + +#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +// #100127# Bracket filled output with a comment, if recording a Mtf +/*N*/ ImpGraphicFill::ImpGraphicFill( const SdrObject& rObj, +/*N*/ const ExtOutputDevice& rXOut, +/*N*/ const SfxItemSet& rFillItemSet, +/*N*/ bool bIsShadow ) : +/*N*/ mrObj( rObj ), +/*N*/ mrXOut( rXOut ), +/*N*/ mbCommentWritten( false ) +/*N*/ { +/*N*/ const SfxItemSet& rSet = rObj.GetItemSet(); +/*N*/ XFillStyle eFillStyle( ITEMVALUE( rFillItemSet, XATTR_FILLSTYLE, XFillStyleItem ) ); +/*N*/ XGradient aGradient( ITEMVALUE( rFillItemSet, XATTR_FILLGRADIENT, XFillGradientItem ) ); +/*N*/ XHatch aHatch( ITEMVALUE( rFillItemSet, XATTR_FILLHATCH, XFillHatchItem ) ); +/*N*/ +/*N*/ sal_Int32 nDX( ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue() ); +/*N*/ sal_Int32 nDY( ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue() ); +/*N*/ +/*N*/ GDIMetaFile* pMtf=NULL; +/*N*/ if( eFillStyle != XFILL_NONE && +/*N*/ (pMtf=mrXOut.GetOutDev()->GetConnectMetaFile()) ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } +/*N*/ } + +// #100127# Bracket filled output with a comment, if recording a Mtf +/*N*/ ImpGraphicFill::~ImpGraphicFill() +/*N*/ { +/*N*/ GDIMetaFile* pMtf=NULL; +/*N*/ if( mbCommentWritten && +/*N*/ (pMtf=mrXOut.GetOutDev()->GetConnectMetaFile()) ) +/*N*/ { +/*?*/ pMtf->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_END" ) ); +/*N*/ } +/*N*/ } + +/////////////////////////////////////////////////////////////////////////////// + +// #104609# Extracted from XOutputDevice::ImpCalcBmpFillStartValues +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdattr.cxx b/binfilter/bf_svx/source/svdraw/svx_svdattr.cxx new file mode 100644 index 000000000000..091ce7a18d73 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdattr.cxx @@ -0,0 +1,1456 @@ +/* -*- 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_GRF_CROP 0 + +#include <com/sun/star/drawing/TextFitToSizeType.hpp> +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/TextAnimationKind.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/drawing/TextAnimationDirection.hpp> +#include <com/sun/star/drawing/ConnectorType.hpp> +#include <com/sun/star/drawing/MeasureKind.hpp> +#include <com/sun/star/drawing/MeasureTextHorzPos.hpp> +#include <com/sun/star/drawing/MeasureTextVertPos.hpp> +#include <com/sun/star/drawing/CircleKind.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <unotools/intlwrapper.hxx> +#include <comphelper/processfactory.hxx> + +#include <vcl/svapp.hxx> + +#include "xdef.hxx" + +#include "svdattr.hxx" +#include "svdattrx.hxx" +#include "svdpool.hxx" + +#include <bf_svtools/solar.hrc> + +#include "xmlcnitm.hxx" + +#include "svxids.hrc" +#include "xtable.hxx" // fuer RGB_Color() +#include "svditext.hxx" +#include "svdmodel.hxx" // fuer DEGREE_CHAR +#include "svdtrans.hxx" +#include "svdglob.hxx" // Stringcache +#include "svdstr.hrc" +#include "sdgcpitm.hxx" +#include "adjitem.hxx" +#include "writingmodeitem.hxx" + +#include <tools/bigint.hxx> + +#include <tools/stream.hxx> + +#include <xtxasit.hxx> +#include <xfillit0.hxx> +#include <xflclit.hxx> +#include <xlineit0.hxx> + +#include <svx3ditems.hxx> +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +SdrItemPool::SdrItemPool(USHORT nAttrStart, USHORT nAttrEnd, FASTBOOL bLoadRefCounts): + XOutdevItemPool(nAttrStart,nAttrEnd,bLoadRefCounts) +{ + Ctor(NULL,nAttrStart,nAttrEnd); +} + +SdrItemPool::SdrItemPool(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEnd, FASTBOOL bLoadRefCounts): + XOutdevItemPool(pMaster,nAttrStart,nAttrEnd,bLoadRefCounts) +{ + Ctor(pMaster,nAttrStart,nAttrEnd); +} + +void SdrItemPool::Ctor(SfxItemPool* pMaster, USHORT nAttrStart, USHORT nAttrEnd) +{ + if (pMaster==NULL) { + pMaster=this; + } + + Color aNullCol(RGB_Color(COL_BLACK)); + XubString aEmptyStr; + + USHORT i; + for (i=SDRATTR_NOTPERSIST_FIRST; i<=SDRATTR_NOTPERSIST_LAST; i++) { + pItemInfos[i-SDRATTR_START]._nFlags=0; + } + // Schatten + ppPoolDefaults[SDRATTR_SHADOW -SDRATTR_START]=new SdrShadowItem; + ppPoolDefaults[SDRATTR_SHADOWCOLOR -SDRATTR_START]=new SdrShadowColorItem(aEmptyStr,aNullCol); + ppPoolDefaults[SDRATTR_SHADOWXDIST -SDRATTR_START]=new SdrShadowXDistItem; + ppPoolDefaults[SDRATTR_SHADOWYDIST -SDRATTR_START]=new SdrShadowYDistItem; + ppPoolDefaults[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]=new SdrShadowTransparenceItem; + ppPoolDefaults[SDRATTR_SHADOW3D -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOW3D ); + ppPoolDefaults[SDRATTR_SHADOWPERSP -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOWPERSP ); + for (i=SDRATTR_SHADOWRESERVE1; i<=SDRATTR_SHADOWRESERVE5; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + + ppPoolDefaults[SDRATTRSET_SHADOW-SDRATTR_START]=new SdrShadowSetItem(pMaster); + + // SID_ATTR_FILL_SHADOW = SID_SVX_START+299 = SID_LIB_START+299 = 10299 + pItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nSID=SID_ATTR_FILL_SHADOW; + + // Legendenobjekt + ppPoolDefaults[SDRATTR_CAPTIONTYPE -SDRATTR_START]=new SdrCaptionTypeItem ; + ppPoolDefaults[SDRATTR_CAPTIONFIXEDANGLE-SDRATTR_START]=new SdrCaptionFixedAngleItem; + ppPoolDefaults[SDRATTR_CAPTIONANGLE -SDRATTR_START]=new SdrCaptionAngleItem ; + ppPoolDefaults[SDRATTR_CAPTIONGAP -SDRATTR_START]=new SdrCaptionGapItem ; + ppPoolDefaults[SDRATTR_CAPTIONESCDIR -SDRATTR_START]=new SdrCaptionEscDirItem ; + ppPoolDefaults[SDRATTR_CAPTIONESCISREL -SDRATTR_START]=new SdrCaptionEscIsRelItem ; + ppPoolDefaults[SDRATTR_CAPTIONESCREL -SDRATTR_START]=new SdrCaptionEscRelItem ; + ppPoolDefaults[SDRATTR_CAPTIONESCABS -SDRATTR_START]=new SdrCaptionEscAbsItem ; + ppPoolDefaults[SDRATTR_CAPTIONLINELEN -SDRATTR_START]=new SdrCaptionLineLenItem ; + ppPoolDefaults[SDRATTR_CAPTIONFITLINELEN-SDRATTR_START]=new SdrCaptionFitLineLenItem; + for (i=SDRATTR_CAPTIONRESERVE1; i<=SDRATTR_CAPTIONRESERVE5; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + ppPoolDefaults[SDRATTRSET_CAPTION-SDRATTR_START]=new SdrCaptionSetItem(pMaster); + + // Outliner-Attribute + ppPoolDefaults[SDRATTRSET_OUTLINER-SDRATTR_START]=new SdrOutlinerSetItem(pMaster); + + // Misc-Attribute + ppPoolDefaults[SDRATTR_ECKENRADIUS -SDRATTR_START]=new SdrEckenradiusItem; + ppPoolDefaults[SDRATTR_TEXT_MINFRAMEHEIGHT -SDRATTR_START]=new SdrTextMinFrameHeightItem; + ppPoolDefaults[SDRATTR_TEXT_AUTOGROWHEIGHT -SDRATTR_START]=new SdrTextAutoGrowHeightItem; + ppPoolDefaults[SDRATTR_TEXT_FITTOSIZE -SDRATTR_START]=new SdrTextFitToSizeTypeItem; + ppPoolDefaults[SDRATTR_TEXT_LEFTDIST -SDRATTR_START]=new SdrTextLeftDistItem; + ppPoolDefaults[SDRATTR_TEXT_RIGHTDIST -SDRATTR_START]=new SdrTextRightDistItem; + ppPoolDefaults[SDRATTR_TEXT_UPPERDIST -SDRATTR_START]=new SdrTextUpperDistItem; + ppPoolDefaults[SDRATTR_TEXT_LOWERDIST -SDRATTR_START]=new SdrTextLowerDistItem; + ppPoolDefaults[SDRATTR_TEXT_VERTADJUST -SDRATTR_START]=new SdrTextVertAdjustItem; + ppPoolDefaults[SDRATTR_TEXT_MAXFRAMEHEIGHT -SDRATTR_START]=new SdrTextMaxFrameHeightItem; + ppPoolDefaults[SDRATTR_TEXT_MINFRAMEWIDTH -SDRATTR_START]=new SdrTextMinFrameWidthItem; + ppPoolDefaults[SDRATTR_TEXT_MAXFRAMEWIDTH -SDRATTR_START]=new SdrTextMaxFrameWidthItem; + ppPoolDefaults[SDRATTR_TEXT_AUTOGROWWIDTH -SDRATTR_START]=new SdrTextAutoGrowWidthItem; + ppPoolDefaults[SDRATTR_TEXT_HORZADJUST -SDRATTR_START]=new SdrTextHorzAdjustItem; + ppPoolDefaults[SDRATTR_TEXT_ANIKIND -SDRATTR_START]=new SdrTextAniKindItem; + ppPoolDefaults[SDRATTR_TEXT_ANIDIRECTION -SDRATTR_START]=new SdrTextAniDirectionItem; + ppPoolDefaults[SDRATTR_TEXT_ANISTARTINSIDE -SDRATTR_START]=new SdrTextAniStartInsideItem; + ppPoolDefaults[SDRATTR_TEXT_ANISTOPINSIDE -SDRATTR_START]=new SdrTextAniStopInsideItem; + ppPoolDefaults[SDRATTR_TEXT_ANICOUNT -SDRATTR_START]=new SdrTextAniCountItem; + ppPoolDefaults[SDRATTR_TEXT_ANIDELAY -SDRATTR_START]=new SdrTextAniDelayItem; + ppPoolDefaults[SDRATTR_TEXT_ANIAMOUNT -SDRATTR_START]=new SdrTextAniAmountItem; + ppPoolDefaults[SDRATTR_TEXT_CONTOURFRAME -SDRATTR_START]=new SdrTextContourFrameItem; + ppPoolDefaults[SDRATTR_AUTOSHAPE_ADJUSTMENT -SDRATTR_START]=new SdrAutoShapeAdjustmentItem; +#ifndef SVX_LIGHT + ppPoolDefaults[SDRATTR_XMLATTRIBUTES -SDRATTR_START]=new SvXMLAttrContainerItem( SDRATTR_XMLATTRIBUTES ); +#else + // no need to have alien attributes persistent in the player + ppPoolDefaults[SDRATTR_XMLATTRIBUTES -SDRATTR_START]=new SfxVoidItem( SDRATTR_XMLATTRIBUTES ); +#endif // #ifndef SVX_LIGHT + for (i=SDRATTR_RESERVE15; i<=SDRATTR_RESERVE19; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + ppPoolDefaults[SDRATTRSET_MISC-SDRATTR_START]=new SdrMiscSetItem(pMaster); + + pItemInfos[SDRATTR_TEXT_FITTOSIZE-SDRATTR_START]._nSID=SID_ATTR_TEXT_FITTOSIZE; + + // Objektverbinder + ppPoolDefaults[SDRATTR_EDGEKIND -SDRATTR_START]=new SdrEdgeKindItem; + long nDefEdgeDist=500; // Erstmal hart defaulted fuer Draw (100TH_MM). hier muss noch der MapMode beruecksichtigt werden. + ppPoolDefaults[SDRATTR_EDGENODE1HORZDIST-SDRATTR_START]=new SdrEdgeNode1HorzDistItem(nDefEdgeDist); + ppPoolDefaults[SDRATTR_EDGENODE1VERTDIST-SDRATTR_START]=new SdrEdgeNode1VertDistItem(nDefEdgeDist); + ppPoolDefaults[SDRATTR_EDGENODE2HORZDIST-SDRATTR_START]=new SdrEdgeNode2HorzDistItem(nDefEdgeDist); + ppPoolDefaults[SDRATTR_EDGENODE2VERTDIST-SDRATTR_START]=new SdrEdgeNode2VertDistItem(nDefEdgeDist); + ppPoolDefaults[SDRATTR_EDGENODE1GLUEDIST-SDRATTR_START]=new SdrEdgeNode1GlueDistItem; + ppPoolDefaults[SDRATTR_EDGENODE2GLUEDIST-SDRATTR_START]=new SdrEdgeNode2GlueDistItem; + ppPoolDefaults[SDRATTR_EDGELINEDELTAANZ -SDRATTR_START]=new SdrEdgeLineDeltaAnzItem; + ppPoolDefaults[SDRATTR_EDGELINE1DELTA -SDRATTR_START]=new SdrEdgeLine1DeltaItem; + ppPoolDefaults[SDRATTR_EDGELINE2DELTA -SDRATTR_START]=new SdrEdgeLine2DeltaItem; + ppPoolDefaults[SDRATTR_EDGELINE3DELTA -SDRATTR_START]=new SdrEdgeLine3DeltaItem; + for (i=SDRATTR_EDGERESERVE02; i<=SDRATTR_EDGERESERVE09; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + ppPoolDefaults[SDRATTRSET_EDGE-SDRATTR_START]=new SdrEdgeSetItem(pMaster); + + // Bemassungsobjekt + ppPoolDefaults[SDRATTR_MEASUREKIND -SDRATTR_START]=new SdrMeasureKindItem; + ppPoolDefaults[SDRATTR_MEASURETEXTHPOS -SDRATTR_START]=new SdrMeasureTextHPosItem; + ppPoolDefaults[SDRATTR_MEASURETEXTVPOS -SDRATTR_START]=new SdrMeasureTextVPosItem; + ppPoolDefaults[SDRATTR_MEASURELINEDIST -SDRATTR_START]=new SdrMeasureLineDistItem(800); + ppPoolDefaults[SDRATTR_MEASUREHELPLINEOVERHANG -SDRATTR_START]=new SdrMeasureHelplineOverhangItem(200); + ppPoolDefaults[SDRATTR_MEASUREHELPLINEDIST -SDRATTR_START]=new SdrMeasureHelplineDistItem(100); + ppPoolDefaults[SDRATTR_MEASUREHELPLINE1LEN -SDRATTR_START]=new SdrMeasureHelpline1LenItem; + ppPoolDefaults[SDRATTR_MEASUREHELPLINE2LEN -SDRATTR_START]=new SdrMeasureHelpline2LenItem; + ppPoolDefaults[SDRATTR_MEASUREBELOWREFEDGE -SDRATTR_START]=new SdrMeasureBelowRefEdgeItem; + ppPoolDefaults[SDRATTR_MEASURETEXTROTA90 -SDRATTR_START]=new SdrMeasureTextRota90Item; + ppPoolDefaults[SDRATTR_MEASURETEXTUPSIDEDOWN -SDRATTR_START]=new SdrMeasureTextUpsideDownItem; + ppPoolDefaults[SDRATTR_MEASUREOVERHANG -SDRATTR_START]=new SdrMeasureOverhangItem(600); + ppPoolDefaults[SDRATTR_MEASUREUNIT -SDRATTR_START]=new SdrMeasureUnitItem; + ppPoolDefaults[SDRATTR_MEASURESCALE -SDRATTR_START]=new SdrMeasureScaleItem; + ppPoolDefaults[SDRATTR_MEASURESHOWUNIT -SDRATTR_START]=new SdrMeasureShowUnitItem; + ppPoolDefaults[SDRATTR_MEASUREFORMATSTRING -SDRATTR_START]=new SdrMeasureFormatStringItem(); + ppPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLE -SDRATTR_START]=new SdrMeasureTextAutoAngleItem(); + ppPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLEVIEW-SDRATTR_START]=new SdrMeasureTextAutoAngleViewItem(); + ppPoolDefaults[SDRATTR_MEASURETEXTISFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextIsFixedAngleItem(); + ppPoolDefaults[SDRATTR_MEASURETEXTFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextFixedAngleItem(); + ppPoolDefaults[SDRATTR_MEASUREDECIMALPLACES -SDRATTR_START]=new SdrMeasureDecimalPlacesItem(); + for (i=SDRATTR_MEASURERESERVE05; i<=SDRATTR_MEASURERESERVE07; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + ppPoolDefaults[SDRATTRSET_MEASURE-SDRATTR_START]=new SdrMeasureSetItem(pMaster); + + // Kreis + ppPoolDefaults[SDRATTR_CIRCKIND -SDRATTR_START]=new SdrCircKindItem; + ppPoolDefaults[SDRATTR_CIRCSTARTANGLE-SDRATTR_START]=new SdrCircStartAngleItem; + ppPoolDefaults[SDRATTR_CIRCENDANGLE -SDRATTR_START]=new SdrCircEndAngleItem; + for (i=SDRATTR_CIRCRESERVE0; i<=SDRATTR_CIRCRESERVE3; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + ppPoolDefaults[SDRATTRSET_CIRC-SDRATTR_START]=new SdrCircSetItem(pMaster); + + // Nichtpersistente-Items + ppPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrObjMoveProtectItem; + ppPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrObjSizeProtectItem; + ppPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem; + ppPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem; + ppPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; + ppPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SdrObjectNameItem; + ppPoolDefaults[SDRATTR_ALLPOSITIONX -SDRATTR_START]=new SdrAllPositionXItem; + ppPoolDefaults[SDRATTR_ALLPOSITIONY -SDRATTR_START]=new SdrAllPositionYItem; + ppPoolDefaults[SDRATTR_ALLSIZEWIDTH -SDRATTR_START]=new SdrAllSizeWidthItem; + ppPoolDefaults[SDRATTR_ALLSIZEHEIGHT -SDRATTR_START]=new SdrAllSizeHeightItem; + ppPoolDefaults[SDRATTR_ONEPOSITIONX -SDRATTR_START]=new SdrOnePositionXItem; + ppPoolDefaults[SDRATTR_ONEPOSITIONY -SDRATTR_START]=new SdrOnePositionYItem; + ppPoolDefaults[SDRATTR_ONESIZEWIDTH -SDRATTR_START]=new SdrOneSizeWidthItem; + ppPoolDefaults[SDRATTR_ONESIZEHEIGHT -SDRATTR_START]=new SdrOneSizeHeightItem; + ppPoolDefaults[SDRATTR_LOGICSIZEWIDTH -SDRATTR_START]=new SdrLogicSizeWidthItem; + ppPoolDefaults[SDRATTR_LOGICSIZEHEIGHT-SDRATTR_START]=new SdrLogicSizeHeightItem; + ppPoolDefaults[SDRATTR_ROTATEANGLE -SDRATTR_START]=new SdrRotateAngleItem; + ppPoolDefaults[SDRATTR_SHEARANGLE -SDRATTR_START]=new SdrShearAngleItem; + ppPoolDefaults[SDRATTR_MOVEX -SDRATTR_START]=new SdrMoveXItem; + ppPoolDefaults[SDRATTR_MOVEY -SDRATTR_START]=new SdrMoveYItem; + ppPoolDefaults[SDRATTR_RESIZEXONE -SDRATTR_START]=new SdrResizeXOneItem; + ppPoolDefaults[SDRATTR_RESIZEYONE -SDRATTR_START]=new SdrResizeYOneItem; + ppPoolDefaults[SDRATTR_ROTATEONE -SDRATTR_START]=new SdrRotateOneItem; + ppPoolDefaults[SDRATTR_HORZSHEARONE -SDRATTR_START]=new SdrHorzShearOneItem; + ppPoolDefaults[SDRATTR_VERTSHEARONE -SDRATTR_START]=new SdrVertShearOneItem; + ppPoolDefaults[SDRATTR_RESIZEXALL -SDRATTR_START]=new SdrResizeXAllItem; + ppPoolDefaults[SDRATTR_RESIZEYALL -SDRATTR_START]=new SdrResizeYAllItem; + ppPoolDefaults[SDRATTR_ROTATEALL -SDRATTR_START]=new SdrRotateAllItem; + ppPoolDefaults[SDRATTR_HORZSHEARALL -SDRATTR_START]=new SdrHorzShearAllItem; + ppPoolDefaults[SDRATTR_VERTSHEARALL -SDRATTR_START]=new SdrVertShearAllItem; + ppPoolDefaults[SDRATTR_TRANSFORMREF1X -SDRATTR_START]=new SdrTransformRef1XItem; + ppPoolDefaults[SDRATTR_TRANSFORMREF1Y -SDRATTR_START]=new SdrTransformRef1YItem; + ppPoolDefaults[SDRATTR_TRANSFORMREF2X -SDRATTR_START]=new SdrTransformRef2XItem; + ppPoolDefaults[SDRATTR_TRANSFORMREF2Y -SDRATTR_START]=new SdrTransformRef2YItem; + ppPoolDefaults[SDRATTR_TEXTDIRECTION -SDRATTR_START]=new SvxWritingModeItem; + + for (i=SDRATTR_NOTPERSISTRESERVE2; i<=SDRATTR_NOTPERSISTRESERVE15; i++) { + ppPoolDefaults[i-SDRATTR_START]=new SfxVoidItem(i); + } + + // Grafik + ppPoolDefaults[ SDRATTR_GRAFRED - SDRATTR_START] = new SdrGrafRedItem; + ppPoolDefaults[ SDRATTR_GRAFGREEN - SDRATTR_START] = new SdrGrafGreenItem; + ppPoolDefaults[ SDRATTR_GRAFBLUE - SDRATTR_START] = new SdrGrafBlueItem; + ppPoolDefaults[ SDRATTR_GRAFLUMINANCE - SDRATTR_START] = new SdrGrafLuminanceItem; + ppPoolDefaults[ SDRATTR_GRAFCONTRAST - SDRATTR_START] = new SdrGrafContrastItem; + ppPoolDefaults[ SDRATTR_GRAFGAMMA - SDRATTR_START] = new SdrGrafGamma100Item; + ppPoolDefaults[ SDRATTR_GRAFTRANSPARENCE - SDRATTR_START] = new SdrGrafTransparenceItem; + ppPoolDefaults[ SDRATTR_GRAFINVERT - SDRATTR_START] = new SdrGrafInvertItem; + ppPoolDefaults[ SDRATTR_GRAFMODE - SDRATTR_START] = new SdrGrafModeItem; + ppPoolDefaults[ SDRATTR_GRAFCROP - SDRATTR_START] = new SdrGrafCropItem; + for( i = SDRATTR_GRAFRESERVE3; i <= SDRATTR_GRAFRESERVE6; i++ ) + ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i ); + ppPoolDefaults[ SDRATTRSET_GRAF - SDRATTR_START ] = new SdrGrafSetItem( pMaster ); + pItemInfos[SDRATTR_GRAFCROP-SDRATTR_START]._nSID=SID_ATTR_GRAF_CROP; + + // 3D Object Attr (28092000 AW) + ppPoolDefaults[ SDRATTR_3DOBJ_PERCENT_DIAGONAL - SDRATTR_START ] = new Svx3DPercentDiagonalItem; + ppPoolDefaults[ SDRATTR_3DOBJ_BACKSCALE - SDRATTR_START ] = new Svx3DBackscaleItem; + ppPoolDefaults[ SDRATTR_3DOBJ_DEPTH - SDRATTR_START ] = new Svx3DDepthItem; + ppPoolDefaults[ SDRATTR_3DOBJ_HORZ_SEGS - SDRATTR_START ] = new Svx3DHorizontalSegmentsItem; + ppPoolDefaults[ SDRATTR_3DOBJ_VERT_SEGS - SDRATTR_START ] = new Svx3DVerticalSegmentsItem; + ppPoolDefaults[ SDRATTR_3DOBJ_END_ANGLE - SDRATTR_START ] = new Svx3DEndAngleItem; + ppPoolDefaults[ SDRATTR_3DOBJ_DOUBLE_SIDED - SDRATTR_START ] = new Svx3DDoubleSidedItem; + ppPoolDefaults[ SDRATTR_3DOBJ_NORMALS_KIND - SDRATTR_START ] = new Svx3DNormalsKindItem; + ppPoolDefaults[ SDRATTR_3DOBJ_NORMALS_INVERT - SDRATTR_START ] = new Svx3DNormalsInvertItem; + ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_X - SDRATTR_START ] = new Svx3DTextureProjectionXItem; + ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_Y - SDRATTR_START ] = new Svx3DTextureProjectionYItem; + ppPoolDefaults[ SDRATTR_3DOBJ_SHADOW_3D - SDRATTR_START ] = new Svx3DShadow3DItem; + ppPoolDefaults[ SDRATTR_3DOBJ_MAT_COLOR - SDRATTR_START ] = new Svx3DMaterialColorItem; + ppPoolDefaults[ SDRATTR_3DOBJ_MAT_EMISSION - SDRATTR_START ] = new Svx3DMaterialEmissionItem; + ppPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR - SDRATTR_START ] = new Svx3DMaterialSpecularItem; + ppPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY - SDRATTR_START ] = new Svx3DMaterialSpecularIntensityItem; + ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_KIND - SDRATTR_START ] = new Svx3DTextureKindItem; + ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_MODE - SDRATTR_START ] = new Svx3DTextureModeItem; + ppPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_FILTER - SDRATTR_START ] = new Svx3DTextureFilterItem; + + // #107245# Add new items for 3d objects + ppPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_NORMALS - SDRATTR_START ] = new Svx3DSmoothNormalsItem; + ppPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_LIDS - SDRATTR_START ] = new Svx3DSmoothLidsItem; + ppPoolDefaults[ SDRATTR_3DOBJ_CHARACTER_MODE - SDRATTR_START ] = new Svx3DCharacterModeItem; + ppPoolDefaults[ SDRATTR_3DOBJ_CLOSE_FRONT - SDRATTR_START ] = new Svx3DCloseFrontItem; + ppPoolDefaults[ SDRATTR_3DOBJ_CLOSE_BACK - SDRATTR_START ] = new Svx3DCloseBackItem; + + // #107245# Start with SDRATTR_3DOBJ_RESERVED_06 now + for( i = SDRATTR_3DOBJ_RESERVED_06; i <= SDRATTR_3DOBJ_RESERVED_20; i++ ) + ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i ); + + // 3D Scene Attr (28092000 AW) + ppPoolDefaults[ SDRATTR_3DSCENE_PERSPECTIVE - SDRATTR_START ] = new Svx3DPerspectiveItem; + ppPoolDefaults[ SDRATTR_3DSCENE_DISTANCE - SDRATTR_START ] = new Svx3DDistanceItem; + ppPoolDefaults[ SDRATTR_3DSCENE_FOCAL_LENGTH - SDRATTR_START ] = new Svx3DFocalLengthItem; + ppPoolDefaults[ SDRATTR_3DSCENE_TWO_SIDED_LIGHTING - SDRATTR_START ] = new Svx3DTwoSidedLightingItem; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new Svx3DLightcolor1Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_2 - SDRATTR_START ] = new Svx3DLightcolor2Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_3 - SDRATTR_START ] = new Svx3DLightcolor3Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_4 - SDRATTR_START ] = new Svx3DLightcolor4Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_5 - SDRATTR_START ] = new Svx3DLightcolor5Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_6 - SDRATTR_START ] = new Svx3DLightcolor6Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_7 - SDRATTR_START ] = new Svx3DLightcolor7Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_8 - SDRATTR_START ] = new Svx3DLightcolor8Item; + ppPoolDefaults[ SDRATTR_3DSCENE_AMBIENTCOLOR - SDRATTR_START ] = new Svx3DAmbientcolorItem; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_1 - SDRATTR_START ] = new Svx3DLightOnOff1Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_2 - SDRATTR_START ] = new Svx3DLightOnOff2Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_3 - SDRATTR_START ] = new Svx3DLightOnOff3Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_4 - SDRATTR_START ] = new Svx3DLightOnOff4Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_5 - SDRATTR_START ] = new Svx3DLightOnOff5Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_6 - SDRATTR_START ] = new Svx3DLightOnOff6Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_7 - SDRATTR_START ] = new Svx3DLightOnOff7Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_8 - SDRATTR_START ] = new Svx3DLightOnOff8Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_1 - SDRATTR_START ] = new Svx3DLightDirection1Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_2 - SDRATTR_START ] = new Svx3DLightDirection2Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_3 - SDRATTR_START ] = new Svx3DLightDirection3Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_4 - SDRATTR_START ] = new Svx3DLightDirection4Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_5 - SDRATTR_START ] = new Svx3DLightDirection5Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_6 - SDRATTR_START ] = new Svx3DLightDirection6Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_7 - SDRATTR_START ] = new Svx3DLightDirection7Item; + ppPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_8 - SDRATTR_START ] = new Svx3DLightDirection8Item; + ppPoolDefaults[ SDRATTR_3DSCENE_SHADOW_SLANT - SDRATTR_START ] = new Svx3DShadowSlantItem; + ppPoolDefaults[ SDRATTR_3DSCENE_SHADE_MODE - SDRATTR_START ] = new Svx3DShadeModeItem; + + for( i = SDRATTR_3DSCENE_RESERVED_01; i <= SDRATTR_3DSCENE_RESERVED_20; i++ ) + ppPoolDefaults[ i - SDRATTR_START ] = new SfxVoidItem( i ); + + //////////////////////////////// +#ifdef DBG_UTIL + UINT16 nAnz(SDRATTR_END-SDRATTR_START + 1); + + for(UINT16 nNum = 0; nNum < nAnz; nNum++) + { + const SfxPoolItem* pItem = ppPoolDefaults[nNum]; + + if(!pItem) + { + ByteString aStr("PoolDefaultItem not set: "); + + aStr += "Num="; + aStr += ByteString::CreateFromInt32( nNum ); + aStr += "Which="; + aStr += ByteString::CreateFromInt32( nNum + 1000 ); + + DBG_ERROR(aStr.GetBuffer()); + } + else if(pItem->Which() != nNum + 1000) + { + ByteString aStr("PoolDefaultItem has wrong WhichId: "); + + aStr += "Num="; + aStr += ByteString::CreateFromInt32( nNum ); + aStr += " Which="; + aStr += ByteString::CreateFromInt32( pItem->Which() ); + + DBG_ERROR(aStr.GetBuffer()); + } + } +#endif + + if (nAttrStart==SDRATTR_START && nAttrEnd==SDRATTR_END) { + SetDefaults(ppPoolDefaults); + SetItemInfos(pItemInfos); + } +} + +/************************************************************************* +|* +|* copy ctor, sorgt dafuer, dass die static defaults gecloned werden +|* (Parameter 2 = TRUE) +|* +\************************************************************************/ + +SdrItemPool::SdrItemPool(const SdrItemPool& rPool): + XOutdevItemPool(rPool) +{ +} + +/************************************************************************* +|* +|* Clone() +|* +\************************************************************************/ + +SfxItemPool* __EXPORT SdrItemPool::Clone() const +{ + return new SdrItemPool(*this); +} + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +SdrItemPool::~SdrItemPool() +{ + Delete(); // erstmal den 'dtor' des SfxItemPools rufen + // und nun meine eigenen statischen Defaults abraeumen + if (ppPoolDefaults!=NULL) { + unsigned nBeg=SDRATTR_SHADOW-SDRATTR_START; + unsigned nEnd=SDRATTR_END-SDRATTR_START; + for (unsigned i=nBeg; i<=nEnd; i++) { + SetRefCount(*ppPoolDefaults[i],0); + delete ppPoolDefaults[i]; + ppPoolDefaults[i]=NULL; + } + } + // Vor dem zerstoeren die Pools ggf. voneinander trennen + SetSecondaryPool(NULL); +} + + + + +//////////////////////////////////////////////////////////////////////////////// +// FractionItem +//////////////////////////////////////////////////////////////////////////////// + +TYPEINIT1_AUTOFACTORY(SdrFractionItem,SfxPoolItem); + +SdrFractionItem::SdrFractionItem(USHORT nId, SvStream& rIn): + SfxPoolItem(nId) +{ + INT32 nMul,nDiv; + rIn>>nMul; + rIn>>nDiv; + nValue=Fraction(nMul,nDiv); +} + +int __EXPORT SdrFractionItem::operator==(const SfxPoolItem& rCmp) const +{ + return SfxPoolItem::operator==(rCmp) && + ((SdrFractionItem&)rCmp).GetValue()==nValue; +} + + + +SvStream& __EXPORT SdrFractionItem::Store(SvStream& rOut, USHORT nItemVers) const +{ + rOut<<INT32(nValue.GetNumerator()); + rOut<<INT32(nValue.GetDenominator()); + return rOut; +} + +SfxPoolItem* __EXPORT SdrFractionItem::Clone(SfxItemPool *pPool) const +{ + return new SdrFractionItem(Which(),GetValue()); +} + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrFractionItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +//////////////////////////////////////////////////////////////////////////////// +// ScaleItem +//////////////////////////////////////////////////////////////////////////////// + +TYPEINIT1_AUTOFACTORY(SdrScaleItem,SdrFractionItem); + + +SfxPoolItem* __EXPORT SdrScaleItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrScaleItem(Which(),rIn); +} + +SfxPoolItem* __EXPORT SdrScaleItem::Clone(SfxItemPool *pPool) const +{ + return new SdrScaleItem(Which(),GetValue()); +} + +//////////////////////////////////////////////////////////////////////////////// +// OnOffItem +//////////////////////////////////////////////////////////////////////////////// + +TYPEINIT1_AUTOFACTORY(SdrOnOffItem,SfxBoolItem); + +SfxPoolItem* __EXPORT SdrOnOffItem::Clone(SfxItemPool* pPool) const +{ + return new SdrOnOffItem(Which(),GetValue()); +} + +SfxPoolItem* __EXPORT SdrOnOffItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrOnOffItem(Which(),rIn); +} + + + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrOnOffItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +TYPEINIT1_AUTOFACTORY(SdrYesNoItem,SfxBoolItem); + +SfxPoolItem* __EXPORT SdrYesNoItem::Clone(SfxItemPool* pPool) const +{ + return new SdrYesNoItem(Which(),GetValue()); +} + +SfxPoolItem* __EXPORT SdrYesNoItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrYesNoItem(Which(),rIn); +} + + + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrYesNoItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +//------------------------------------------------------------ +// class SdrPercentItem +//------------------------------------------------------------ + +TYPEINIT1_AUTOFACTORY(SdrPercentItem,SfxUInt16Item); + +SfxPoolItem* __EXPORT SdrPercentItem::Clone(SfxItemPool* pPool) const +{ + return new SdrPercentItem(Which(),GetValue()); +} + +SfxPoolItem* __EXPORT SdrPercentItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrPercentItem(Which(),rIn); +} + + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrPercentItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +//------------------------------------------------------------ +// class SdrAngleItem +//------------------------------------------------------------ + +TYPEINIT1_AUTOFACTORY(SdrAngleItem,SfxInt32Item); + +SfxPoolItem* __EXPORT SdrAngleItem::Clone(SfxItemPool* pPool) const +{ + return new SdrAngleItem(Which(),GetValue()); +} + +SfxPoolItem* __EXPORT SdrAngleItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrAngleItem(Which(),rIn); +} + + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrAngleItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +//------------------------------------------------------------ +// class SdrMetricItem +//------------------------------------------------------------ + +TYPEINIT1_AUTOFACTORY(SdrMetricItem,SfxInt32Item); + +SfxPoolItem* __EXPORT SdrMetricItem::Clone(SfxItemPool* pPool) const +{ + return new SdrMetricItem(Which(),GetValue()); +} + +SfxPoolItem* __EXPORT SdrMetricItem::Create(SvStream& rIn, USHORT nVer) const +{ + return new SdrMetricItem(Which(),rIn); +} + + + + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrMetricItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST; +} +#endif + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// ShadowSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrShadowSetItem,SfxSetItem); + +SdrShadowSetItem::SdrShadowSetItem(SfxItemSet* pItemSet): + SfxSetItem(SDRATTRSET_SHADOW,pItemSet) +{ +} + +SdrShadowSetItem::SdrShadowSetItem(SfxItemPool* pItemPool): + SfxSetItem(SDRATTRSET_SHADOW,new SfxItemSet(*pItemPool,SDRATTR_SHADOW_FIRST,SDRATTR_SHADOW_LAST)) +{ +} + +SfxPoolItem* __EXPORT SdrShadowSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrShadowSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrShadowSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST); + pSet->Load(rStream); + return new SdrShadowSetItem(pSet); +} + +//////////////////////////////////////////////////////////////////////////////// +// Items des Legendenobjekts +//////////////////////////////////////////////////////////////////////////////// + +TYPEINIT1_AUTOFACTORY(SdrCaptionTypeItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrCaptionTypeItem::Clone(SfxItemPool* pPool) const { return new SdrCaptionTypeItem(*this); } + +SfxPoolItem* __EXPORT SdrCaptionTypeItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrCaptionTypeItem(rIn); } + +USHORT __EXPORT SdrCaptionTypeItem::GetValueCount() const { return 4; } + + + +TYPEINIT1_AUTOFACTORY(SdrCaptionEscDirItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrCaptionEscDirItem::Clone(SfxItemPool* pPool) const { return new SdrCaptionEscDirItem(*this); } + +SfxPoolItem* __EXPORT SdrCaptionEscDirItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrCaptionEscDirItem(rIn); } + +USHORT __EXPORT SdrCaptionEscDirItem::GetValueCount() const { return 3; } + + + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// CaptionSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrCaptionSetItem,SfxSetItem); + +SfxPoolItem* __EXPORT SdrCaptionSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrCaptionSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrCaptionSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_CAPTION_FIRST, SDRATTR_CAPTION_LAST); + pSet->Load(rStream); + return new SdrCaptionSetItem(pSet); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// OutlinerSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrOutlinerSetItem,SfxSetItem); + +SdrOutlinerSetItem::SdrOutlinerSetItem(SfxItemPool* pItemPool): + SfxSetItem(SDRATTRSET_OUTLINER,new SfxItemSet(*pItemPool,EE_ITEMS_START,EE_ITEMS_END)) +{ +} + +SfxPoolItem* __EXPORT SdrOutlinerSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrOutlinerSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrOutlinerSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + EE_ITEMS_START, EE_ITEMS_END); + pSet->Load(rStream); + return new SdrOutlinerSetItem(pSet); +} + +//////////////////////////////////////////////////////////////////////////////// +// MiscItems +//////////////////////////////////////////////////////////////////////////////// + +// FitToSize +TYPEINIT1_AUTOFACTORY(SdrTextFitToSizeTypeItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Clone(SfxItemPool* pPool) const { return new SdrTextFitToSizeTypeItem(*this); } + +SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextFitToSizeTypeItem(rIn); } + +USHORT __EXPORT SdrTextFitToSizeTypeItem::GetValueCount() const { return 4; } + + +bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + drawing::TextFitToSizeType eFS = (drawing::TextFitToSizeType)GetValue(); + rVal <<= eFS; + + return true; +} + +bool SdrTextFitToSizeTypeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::TextFitToSizeType eFS; + if(!(rVal >>= eFS)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eFS = (drawing::TextFitToSizeType) nEnum; + } + + SetValue( (SdrFitToSizeType)eFS ); + + return true; +} + +TYPEINIT1_AUTOFACTORY(SdrTextVertAdjustItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrTextVertAdjustItem::Clone(SfxItemPool* pPool) const { return new SdrTextVertAdjustItem(*this); } + +SfxPoolItem* __EXPORT SdrTextVertAdjustItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextVertAdjustItem(rIn); } + +USHORT __EXPORT SdrTextVertAdjustItem::GetValueCount() const { return 5; } + + + +bool SdrTextVertAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + rVal <<= (drawing::TextVerticalAdjust)GetValue(); + return true; +} + +bool SdrTextVertAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::TextVerticalAdjust eAdj; + if(!(rVal >>= eAdj)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eAdj = (drawing::TextVerticalAdjust)nEnum; + } + + SetValue( (SdrTextVertAdjust)eAdj ); + + return true; +} + +TYPEINIT1_AUTOFACTORY(SdrTextHorzAdjustItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrTextHorzAdjustItem::Clone(SfxItemPool* pPool) const { return new SdrTextHorzAdjustItem(*this); } + +SfxPoolItem* __EXPORT SdrTextHorzAdjustItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextHorzAdjustItem(rIn); } + +USHORT __EXPORT SdrTextHorzAdjustItem::GetValueCount() const { return 5; } + +XubString __EXPORT SdrTextHorzAdjustItem::GetValueTextByPos(USHORT nPos) const +{DBG_BF_ASSERT(0, "STRIP");XubString a; return a; //STRIP001 +} + + +bool SdrTextHorzAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + rVal <<= (drawing::TextHorizontalAdjust)GetValue(); + return sal_True; +} + +bool SdrTextHorzAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::TextHorizontalAdjust eAdj; + if(!(rVal >>= eAdj)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eAdj = (drawing::TextHorizontalAdjust)nEnum; + } + + SetValue( (SdrTextHorzAdjust)eAdj ); + + return true; +} + +TYPEINIT1_AUTOFACTORY(SdrTextAniKindItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrTextAniKindItem::Clone(SfxItemPool* pPool) const { return new SdrTextAniKindItem(*this); } + +SfxPoolItem* __EXPORT SdrTextAniKindItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextAniKindItem(rIn); } + +USHORT __EXPORT SdrTextAniKindItem::GetValueCount() const { return 5; } + + + +bool SdrTextAniKindItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + rVal <<= (drawing::TextAnimationKind)GetValue(); + return true; +} + +bool SdrTextAniKindItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::TextAnimationKind eKind; + if(!(rVal >>= eKind)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + eKind = (drawing::TextAnimationKind)nEnum; + } + + SetValue( (SdrTextAniKind)eKind ); + + return true; +} + +TYPEINIT1_AUTOFACTORY(SdrTextAniDirectionItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrTextAniDirectionItem::Clone(SfxItemPool* pPool) const { return new SdrTextAniDirectionItem(*this); } + +SfxPoolItem* __EXPORT SdrTextAniDirectionItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextAniDirectionItem(rIn); } + +USHORT __EXPORT SdrTextAniDirectionItem::GetValueCount() const { return 4; } + + + +bool SdrTextAniDirectionItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + rVal <<= (drawing::TextAnimationDirection)GetValue(); + return true; +} + +bool SdrTextAniDirectionItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::TextAnimationDirection eDir; + if(!(rVal >>= eDir)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eDir = (drawing::TextAnimationDirection)nEnum; + } + + SetValue( (SdrTextAniDirection)eDir ); + + return true; +} + +TYPEINIT1_AUTOFACTORY(SdrTextAniDelayItem,SfxUInt16Item); + +SfxPoolItem* __EXPORT SdrTextAniDelayItem::Clone(SfxItemPool* pPool) const { return new SdrTextAniDelayItem(*this); } + +SfxPoolItem* __EXPORT SdrTextAniDelayItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextAniDelayItem(rIn); } + + +TYPEINIT1_AUTOFACTORY(SdrTextAniAmountItem,SfxInt16Item); + +SfxPoolItem* __EXPORT SdrTextAniAmountItem::Clone(SfxItemPool* pPool) const { return new SdrTextAniAmountItem(*this); } + +SfxPoolItem* __EXPORT SdrTextAniAmountItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrTextAniAmountItem(rIn); } + + + + +TYPEINIT1_AUTOFACTORY( SdrAutoShapeAdjustmentItem, SfxPoolItem ); + +SdrAutoShapeAdjustmentItem::SdrAutoShapeAdjustmentItem() : SfxPoolItem( SDRATTR_AUTOSHAPE_ADJUSTMENT ) +{ +} + +SdrAutoShapeAdjustmentItem::SdrAutoShapeAdjustmentItem( SvStream& rIn, sal_uInt16 nVersion ): + SfxPoolItem( SDRATTR_AUTOSHAPE_ADJUSTMENT ) +{ + if ( nVersion ) + { + SdrAutoShapeAdjustmentValue aVal; + sal_uInt32 i, nCount; + rIn >> nCount; + for ( i = 0; i < nCount; i++ ) + {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 + } + } +} + +SdrAutoShapeAdjustmentItem::~SdrAutoShapeAdjustmentItem() +{ + void* pPtr; + for ( pPtr = aAdjustmentValueList.First(); pPtr; pPtr = aAdjustmentValueList.Next() ) + delete (SdrAutoShapeAdjustmentValue*)pPtr; +} + +int __EXPORT SdrAutoShapeAdjustmentItem::operator==( const SfxPoolItem& rCmp ) const +{ + int bRet = SfxPoolItem::operator==( rCmp ); + if ( bRet ) + { + bRet = ((SdrAutoShapeAdjustmentItem&)rCmp).GetCount() == GetCount(); + if ( bRet ) + { + sal_uInt32 i; + for ( i = 0; i < GetCount(); i++ ) + {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 + } + } + } + return bRet; +} + + +SfxPoolItem* __EXPORT SdrAutoShapeAdjustmentItem::Create( SvStream& rIn, sal_uInt16 nItemVersion ) const +{ + return new SdrAutoShapeAdjustmentItem( rIn, nItemVersion ); +} + +SvStream& __EXPORT SdrAutoShapeAdjustmentItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const +{ + if ( nItemVersion ) + { + sal_uInt32 i, nCount = GetCount(); + rOut << nCount; + for ( i = 0; i < nCount; i++ ) + {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 rOut << GetValue( i ).nValue; + } + return rOut; +} + +SfxPoolItem* __EXPORT SdrAutoShapeAdjustmentItem::Clone( SfxItemPool *pPool ) const +{ + sal_uInt32 i; + SdrAutoShapeAdjustmentItem* pItem = new SdrAutoShapeAdjustmentItem; + for ( i = 0; i < GetCount(); i++ ) + {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 + } + return pItem; +} + +#ifdef SDR_ISPOOLABLE +int __EXPORT SdrAutoShapeAdjustmentItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST; +} +#endif + + +sal_uInt16 SdrAutoShapeAdjustmentItem::GetVersion( sal_uInt16 nFileFormatVersion ) const +{ + return 1; +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrMiscSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrMiscSetItem,SfxSetItem); + +SfxPoolItem* __EXPORT SdrMiscSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrMiscSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrMiscSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST); + pSet->Load(rStream); + return new SdrMiscSetItem(pSet); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Edge +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// EdgeKind +TYPEINIT1_AUTOFACTORY(SdrEdgeKindItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrEdgeKindItem::Clone(SfxItemPool* pPool) const { return new SdrEdgeKindItem(*this); } + +SfxPoolItem* __EXPORT SdrEdgeKindItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrEdgeKindItem(rIn); } + +USHORT __EXPORT SdrEdgeKindItem::GetValueCount() const { return 4; } + + + +bool SdrEdgeKindItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + drawing::ConnectorType eCT = drawing::ConnectorType_STANDARD; + + switch( GetValue() ) + { + case SDREDGE_ORTHOLINES : eCT = drawing::ConnectorType_STANDARD; break; + case SDREDGE_THREELINES : eCT = drawing::ConnectorType_LINES; break; + case SDREDGE_ONELINE : eCT = drawing::ConnectorType_LINE; break; + case SDREDGE_BEZIER : eCT = drawing::ConnectorType_CURVE; break; + case SDREDGE_ARC : eCT = drawing::ConnectorType_CURVE; break; + default: + DBG_ERROR( "SdrEdgeKindItem::QueryValue : unknown enum" ); + } + + rVal <<= eCT; + + return true; +} + +bool SdrEdgeKindItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::ConnectorType eCT; + if(!(rVal >>= eCT)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eCT = (drawing::ConnectorType)nEnum; + } + + SdrEdgeKind eEK = SDREDGE_ORTHOLINES; + switch( eCT ) + { + case drawing::ConnectorType_STANDARD : eEK = SDREDGE_ORTHOLINES; break; + case drawing::ConnectorType_CURVE : eEK = SDREDGE_BEZIER; break; + case drawing::ConnectorType_LINE : eEK = SDREDGE_ONELINE; break; + case drawing::ConnectorType_LINES : eEK = SDREDGE_THREELINES; break; + default: + DBG_ERROR( "SdrEdgeKindItem::PuValue : unknown enum" ); + } + SetValue( eEK ); + + return true; +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrEdgeSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrEdgeSetItem,SfxSetItem); + +SfxPoolItem* __EXPORT SdrEdgeSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrEdgeSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrEdgeSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST); + pSet->Load(rStream); + return new SdrEdgeSetItem(pSet); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Measure +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// MeasureKind +TYPEINIT1_AUTOFACTORY(SdrMeasureKindItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrMeasureKindItem::Clone(SfxItemPool* pPool) const { return new SdrMeasureKindItem(*this); } + +SfxPoolItem* __EXPORT SdrMeasureKindItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrMeasureKindItem(rIn); } + +USHORT __EXPORT SdrMeasureKindItem::GetValueCount() const { return 2; } + + + + + +TYPEINIT1_AUTOFACTORY(SdrMeasureTextHPosItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrMeasureTextHPosItem::Clone(SfxItemPool* pPool) const { return new SdrMeasureTextHPosItem(*this); } + +SfxPoolItem* __EXPORT SdrMeasureTextHPosItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrMeasureTextHPosItem(rIn); } + +USHORT __EXPORT SdrMeasureTextHPosItem::GetValueCount() const { return 4; } + + +TYPEINIT1_AUTOFACTORY(SdrMeasureTextVPosItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrMeasureTextVPosItem::Clone(SfxItemPool* pPool) const { return new SdrMeasureTextVPosItem(*this); } + +SfxPoolItem* __EXPORT SdrMeasureTextVPosItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrMeasureTextVPosItem(rIn); } + +USHORT __EXPORT SdrMeasureTextVPosItem::GetValueCount() const { return 5; } + + + + + +TYPEINIT1_AUTOFACTORY(SdrMeasureUnitItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrMeasureUnitItem::Clone(SfxItemPool* pPool) const { return new SdrMeasureUnitItem(*this); } + +SfxPoolItem* __EXPORT SdrMeasureUnitItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrMeasureUnitItem(rIn); } + +USHORT __EXPORT SdrMeasureUnitItem::GetValueCount() const { return 14; } + + + + + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrMeasureSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrMeasureSetItem,SfxSetItem); + +SfxPoolItem* __EXPORT SdrMeasureSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrMeasureSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrMeasureSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST); + pSet->Load(rStream); + return new SdrMeasureSetItem(pSet); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Circ +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +// CircKind +TYPEINIT1_AUTOFACTORY(SdrCircKindItem,SfxEnumItem); + +SfxPoolItem* __EXPORT SdrCircKindItem::Clone(SfxItemPool* pPool) const { return new SdrCircKindItem(*this); } + +SfxPoolItem* __EXPORT SdrCircKindItem::Create(SvStream& rIn, USHORT nVer) const { return new SdrCircKindItem(rIn); } + +USHORT __EXPORT SdrCircKindItem::GetValueCount() const { return 4; } + + +bool SdrCircKindItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + drawing::CircleKind eKind; + if(!(rVal >>= eKind)) + { + sal_Int32 nEnum; + if(!(rVal >>= nEnum)) + return false; + + eKind = (drawing::CircleKind)nEnum; + } + + SetValue( (SdrCircKind)eKind ); + return true; +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrCircSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1(SdrCircSetItem,SfxSetItem); + +SfxPoolItem* __EXPORT SdrCircSetItem::Clone(SfxItemPool* pToPool) const +{ + return new SdrCircSetItem(*this,pToPool); +} + +SfxPoolItem* __EXPORT SdrCircSetItem::Create(SvStream& rStream, USHORT nVersion) const +{ + SfxItemSet *pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST); + pSet->Load(rStream); + return new SdrCircSetItem(pSet); +} + +//------------------------------------------------------------ +// class SdrSignedPercentItem +//------------------------------------------------------------ + +TYPEINIT1_AUTOFACTORY( SdrSignedPercentItem, SfxInt16Item ); + +#ifdef SDR_ISPOOLABLE + +int __EXPORT SdrSignedPercentItem::IsPoolable() const +{ + USHORT nId=Which(); + return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST; +} +#endif + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafSetItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafSetItem,SfxSetItem ); + +SfxPoolItem* __EXPORT SdrGrafSetItem::Clone( SfxItemPool* pToPool ) const +{ + return new SdrGrafSetItem( *this, pToPool ); +} + +SfxPoolItem* __EXPORT SdrGrafSetItem::Create( SvStream& rStream, USHORT nVersion ) const +{ + SfxItemSet* pSet = new SfxItemSet(*GetItemSet().GetPool(), + SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST ); + pSet->Load( rStream ); + return new SdrGrafSetItem( pSet ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafRedItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafRedItem, SdrSignedPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafRedItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafRedItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafRedItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafRedItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafGreenItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafGreenItem, SdrSignedPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafGreenItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafGreenItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafGreenItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafGreenItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafBlueItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafBlueItem, SdrSignedPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafBlueItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafBlueItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafBlueItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafBlueItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafLuminanceItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafLuminanceItem, SdrSignedPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafLuminanceItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafLuminanceItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafLuminanceItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafLuminanceItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafContrastItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafContrastItem, SdrSignedPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafContrastItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafContrastItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafContrastItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafContrastItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafGamma100Item +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafGamma100Item, SfxUInt32Item ); + +SfxPoolItem* __EXPORT SdrGrafGamma100Item::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafGamma100Item( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafGamma100Item::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafGamma100Item( rIn ); +} + +bool SdrGrafGamma100Item::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + rVal <<= ((double)GetValue()) / 100.0; + return true; +} + +bool SdrGrafGamma100Item::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + double nGamma; + if(!(rVal >>= nGamma)) + return false; + + SetValue( (UINT32)(nGamma * 100.0 ) ); + return true; +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafInvertItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafInvertItem, SdrOnOffItem ); + +SfxPoolItem* __EXPORT SdrGrafInvertItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafInvertItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafInvertItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafInvertItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafTransparenceItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafTransparenceItem, SdrPercentItem ); + +SfxPoolItem* __EXPORT SdrGrafTransparenceItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafTransparenceItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafTransparenceItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafTransparenceItem( rIn ); +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafModeItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafModeItem, SfxEnumItem ); + +SfxPoolItem* __EXPORT SdrGrafModeItem::Clone(SfxItemPool* pPool) const +{ + return new SdrGrafModeItem( *this ); +} + +SfxPoolItem* __EXPORT SdrGrafModeItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return new SdrGrafModeItem( rIn ); +} + +USHORT __EXPORT SdrGrafModeItem::GetValueCount() const +{ + return 4; +} + + + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// SdrGrafCropItem +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPEINIT1( SdrGrafCropItem, SvxGrfCrop ); + +SfxPoolItem* SdrGrafCropItem::Clone( SfxItemPool* pPool ) const +{ + return new SdrGrafCropItem( *this ); +} + +SfxPoolItem* SdrGrafCropItem::Create( SvStream& rIn, USHORT nVer ) const +{ + return( ( 0 == nVer ) ? Clone( NULL ) : SvxGrfCrop::Create( rIn, nVer ) ); +} + +USHORT SdrGrafCropItem::GetVersion( USHORT nFileVersion ) const +{ + // GRFCROP_VERSION_MOVETOSVX is 1 + return GRFCROP_VERSION_MOVETOSVX; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdcrtv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdcrtv.cxx new file mode 100644 index 000000000000..a2f11ad09761 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdcrtv.cxx @@ -0,0 +1,284 @@ +/* -*- 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 "svdcrtv.hxx" +#include "svdio.hxx" +#include "svdvmark.hxx" + + +namespace binfilter { + +#define XOR_CREATE_PEN PEN_SOLID + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ class ImpSdrConnectMarker: public SdrViewUserMarker +/*N*/ { +/*N*/ const SdrObject* pAktObj; +/*N*/ const SdrPageView* pAktPV; +/*N*/ + +/*N*/ public: +/*N*/ ImpSdrConnectMarker(SdrCreateView* pView): SdrViewUserMarker(pView),pAktObj(NULL),pAktPV(NULL) {} +/*N*/ ~ImpSdrConnectMarker() {} +/*N*/ void SetTargetObject(const SdrObject* pObj); +/*N*/ }; // svdvmark + + +/*N*/ void ImpSdrConnectMarker::SetTargetObject(const SdrObject* pObj) +/*N*/ { +/*N*/ if (pAktObj!=pObj) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrCreateView::ImpClearVars() +/*N*/ { +/*N*/ nAktInvent=SdrInventor; +/*N*/ nAktIdent=OBJ_NONE; +/*N*/ pCurrentLibObj=NULL; +/*N*/ bCurrentLibObjMoveNoResize=FALSE; +/*N*/ bCurrentLibObjSetDefAttr=FALSE; +/*N*/ bCurrentLibObjSetDefLayer=FALSE; +/*N*/ pLibObjDragMeth=NULL; +/*N*/ pAktCreate=NULL; +/*N*/ pCreatePV=NULL; +/*N*/ bAutoTextEdit=FALSE; +/*N*/ b1stPointAsCenter=FALSE; +/*N*/ aAktCreatePointer=Pointer(POINTER_CROSS); +/*N*/ bUseIncompatiblePathCreateInterface=FALSE; +/*N*/ bAutoClosePolys=TRUE; +/*N*/ nAutoCloseDistPix=5; +/*N*/ nFreeHandMinDistPix=10; +/*N*/ +/*N*/ pConnectMarker=new ImpSdrConnectMarker(this); +/*N*/ pConnectMarker->SetLineWidth(2); +/*N*/ pConnectMarker->SetAnimateDelay(500); +/*N*/ pConnectMarker->SetAnimateCount(3); +/*N*/ pConnectMarker->SetAnimateSpeed(100); +/*N*/ pConnectMarker->SetAnimateToggle(TRUE); +/*N*/ } + +/*N*/ void SdrCreateView::ImpMakeCreateAttr() +/*N*/ { +/*N*/ } + +/*N*/ SdrCreateView::SdrCreateView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrDragView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ ImpMakeCreateAttr(); +/*N*/ } + +/*N*/ SdrCreateView::~SdrCreateView() +/*N*/ { +/*N*/ delete pConnectMarker; +/*N*/ delete pCurrentLibObj; +/*N*/ delete pAktCreate; +/*N*/ } + + +/*N*/ BOOL SdrCreateView::IsAction() const +/*N*/ { +/*N*/ return SdrDragView::IsAction() || pAktCreate!=NULL; +/*N*/ } + + + + +/*N*/ void SdrCreateView::BrkAction() +/*N*/ { +/*N*/ SdrDragView::BrkAction(); +/*N*/ BrkCreateObj(); +/*N*/ } + + +/*N*/ void SdrCreateView::ToggleShownXor(OutputDevice* pOut, const Region* pRegion) const +/*N*/ { +/*N*/ SdrDragView::ToggleShownXor(pOut,pRegion); +/*N*/ if (pAktCreate!=NULL && aDragStat.IsShown()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrCreateView::CheckEdgeMode() +/*N*/ { +/*N*/ UINT32 nInv=nAktInvent; +/*N*/ UINT16 nIdn=nAktIdent; +/*N*/ if (pAktCreate!=NULL) { +/*?*/ nInv=pAktCreate->GetObjInventor(); +/*?*/ nIdn=pAktCreate->GetObjIdentifier(); +/*?*/ // wird vom EdgeObj gemanaged +/*?*/ if (nAktInvent==SdrInventor && nAktIdent==OBJ_EDGE) return FALSE; +/*N*/ } +/*N*/ if (!IsCreateMode() || nAktInvent!=SdrInventor || nAktIdent!=OBJ_EDGE || pCurrentLibObj!=NULL) { +/*?*/ if (pConnectMarker->IsVisible()) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pConnectMarker->Hide(); +/*N*/ pConnectMarker->SetTargetObject(NULL); +/*N*/ return FALSE; +/*N*/ } else { +/*N*/ // TRUE heisst: MouseMove soll Connect checken +/*?*/ return !IsAction(); +/*N*/ } +/*N*/ } + + + + +/*N*/ BOOL SdrCreateView::IsTextTool() const +/*N*/ { +/*N*/ return eEditMode==SDREDITMODE_CREATE && pCurrentLibObj==NULL && nAktInvent==SdrInventor && (nAktIdent==OBJ_TEXT || nAktIdent==OBJ_TEXTEXT || nAktIdent==OBJ_TITLETEXT || nAktIdent==OBJ_OUTLINETEXT); +/*N*/ } + +/*N*/ BOOL SdrCreateView::IsEdgeTool() const +/*N*/ { +/*N*/ return eEditMode==SDREDITMODE_CREATE && pCurrentLibObj==NULL && nAktInvent==SdrInventor && (nAktIdent==OBJ_EDGE); +/*N*/ } + + +/*N*/ void SdrCreateView::SetCurrentObj(UINT16 nIdent, UINT32 nInvent) +/*N*/ { +/*N*/ if (pCurrentLibObj!=NULL) { +/*?*/ delete pCurrentLibObj; +/*?*/ pCurrentLibObj=NULL; +/*N*/ } +/*N*/ if (nAktInvent!=nInvent || nAktIdent!=nIdent) { +/*N*/ nAktInvent=nInvent; +/*N*/ nAktIdent=nIdent; +/*N*/ SdrObject* pObj = SdrObjFactory::MakeNewObject(nInvent,nIdent,NULL,NULL); +/*N*/ +/*N*/ if(pObj) +/*N*/ { +/*N*/ // Auf pers. Wunsch von Marco: +/*N*/ // Mauszeiger bei Textwerkzeug immer I-Beam. Fadenkreuz +/*N*/ // mit kleinem I-Beam erst bai MouseButtonDown +/*N*/ if(IsTextTool()) +/*N*/ { +/*N*/ // #81944# AW: Here the correct pointer needs to be used +/*N*/ // if the default is set to vertical writing +/*?*/ aAktCreatePointer = POINTER_TEXT; +/*N*/ } +/*N*/ else +/*N*/ aAktCreatePointer = pObj->GetCreatePointer(); +/*N*/ +/*N*/ delete pObj; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ aAktCreatePointer = Pointer(POINTER_CROSS); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ CheckEdgeMode(); +/*N*/ ImpSetGlueVisible3(IsEdgeTool()); +/*N*/ } + + + + + + + + + +/*N*/ void SdrCreateView::BrkCreateObj() +/*N*/ { +/*N*/ if (pAktCreate!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrCreateView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ SdrDragView::WriteRecords(rOut); +/*N*/ { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWCROBJECT); +/*N*/ rOut<<nAktInvent; +/*N*/ rOut<<nAktIdent; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWCRFLAGS); +/*N*/ rOut<<BOOL(b1stPointAsCenter); +/*N*/ } { +/*N*/ // in der CreateView (statt ObjEditView) weil sonst inkompatibel. +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWTEXTEDIT); +/*N*/ rOut<<BOOL(bQuickTextEditMode); +/*N*/ } { +/*N*/ // in der CreateView (statt ObjEditView) weil sonst inkompatibel. +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWMACRO); +/*N*/ rOut<<BOOL(bMacroMode); +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrCreateView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) { +/*N*/ bRet=TRUE; +/*N*/ switch (rSubHead.GetIdentifier()) { +/*N*/ case SDRIORECNAME_VIEWCROBJECT: { +/*N*/ UINT32 nInvent; +/*N*/ UINT16 nIdent; +/*N*/ rIn>>nInvent; +/*N*/ rIn>>nIdent; +/*N*/ SetCurrentObj(nIdent,nInvent); +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWCRFLAGS: { +/*N*/ BOOL bTmp; rIn>>bTmp; b1stPointAsCenter=bTmp; +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWTEXTEDIT: { +/*N*/ // in der CreateView (statt ObjEditView) weil sonst inkompatibel. +/*N*/ BOOL bTmp; rIn>>bTmp; bQuickTextEditMode=bTmp; +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWMACRO: { +/*N*/ // in der CreateView (statt ObjEditView) weil sonst inkompatibel. +/*N*/ BOOL bTmp; rIn>>bTmp; bMacroMode=bTmp; +/*N*/ } break; +/*N*/ default: bRet=FALSE; +/*N*/ } +/*N*/ } +/*N*/ if (!bRet) bRet=SdrDragView::ReadRecord(rViewHead,rSubHead,rIn); +/*N*/ return bRet; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svddrag.cxx b/binfilter/bf_svx/source/svdraw/svx_svddrag.cxx new file mode 100644 index 000000000000..792fc67ca456 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svddrag.cxx @@ -0,0 +1,79 @@ +/* -*- 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 "svddrag.hxx" +namespace binfilter { + +/*N*/ void SdrDragStat::Clear(FASTBOOL bLeaveOne) +/*N*/ { +/*N*/ void* pP=aPnts.First(); +/*N*/ while (pP!=NULL) { +/*N*/ delete (Point*)pP; +/*N*/ pP=aPnts.Next(); +/*N*/ } +/*N*/ if (pUser!=NULL) delete pUser; +/*N*/ pUser=NULL; +/*N*/ aPnts.Clear(); +/*N*/ if (bLeaveOne) { +/*N*/ aPnts.Insert(new Point,CONTAINER_APPEND); +/*N*/ } +/*N*/ } + +/*N*/ void SdrDragStat::Reset() +/*N*/ { +/*N*/ pView=NULL; +/*N*/ pPageView=NULL; +/*N*/ bShown=FALSE; +/*N*/ nMinMov=1; +/*N*/ bMinMoved=FALSE; +/*N*/ bHorFixed=FALSE; +/*N*/ bVerFixed=FALSE; +/*N*/ bWantNoSnap=FALSE; +/*N*/ pHdl=NULL; +/*N*/ bOrtho4=FALSE; +/*N*/ bOrtho8=FALSE; +/*N*/ pDragMethod=NULL; +/*N*/ bEndDragChangesAttributes=FALSE; +/*N*/ bEndDragChangesGeoAndAttributes=FALSE; +/*N*/ bMouseIsUp=FALSE; +/*N*/ Clear(TRUE); +/*N*/ aActionRect=Rectangle(); +/*N*/ } + + + + + + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svddrgv.cxx b/binfilter/bf_svx/source/svdraw/svx_svddrgv.cxx new file mode 100644 index 000000000000..78a1ee9ec675 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svddrgv.cxx @@ -0,0 +1,223 @@ +/* -*- 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 "svddrgv.hxx" +#include "svdio.hxx" +#include "svdstr.hrc" // Namen aus der Resource +namespace binfilter { + +#define XOR_DRAG_PEN PEN_DOT + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@ @@@@@ @@@@ @@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@ @@ @@@@@ @@@@@@ @@ @@@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@@@@ @@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrDragView::ImpClearVars() +/*N*/ { +/*N*/ bFramDrag=FALSE; +/*N*/ eDragMode=SDRDRAG_MOVE; +/*N*/ bDragLimit=FALSE; +/*N*/ bMarkedHitMovesAlways=FALSE; +/*N*/ eDragHdl=HDL_MOVE; +/*N*/ pDragHdl=NULL; +/*N*/ bDragHdl=FALSE; +/*N*/ bDragSpecial=FALSE; +/*N*/ pDragBla=NULL; +/*N*/ bDragStripes=FALSE; +/*N*/ bNoDragHdl=TRUE; +/*N*/ bMirrRefDragObj=TRUE; +/*N*/ bSolidDragging=FALSE; +/*N*/ bSolidDrgNow=FALSE; +/*N*/ bSolidDrgChk=FALSE; +/*N*/ bDragWithCopy=FALSE; +/*N*/ pInsPointUndo=NULL; +/*N*/ bInsAfter=FALSE; +/*N*/ bInsGluePoint=FALSE; +/*N*/ bInsObjPointMode=FALSE; +/*N*/ bInsGluePointMode=FALSE; +/*N*/ nDragXorPolyLimit=100; +/*N*/ nDragXorPointLimit=500; +/*N*/ bNoDragXorPolys=FALSE; +/*N*/ bAutoVertexCon=TRUE; +/*N*/ bAutoCornerCon=FALSE; +/*N*/ bRubberEdgeDragging=TRUE; +/*N*/ nRubberEdgeDraggingLimit=100; +/*N*/ bDetailedEdgeDragging=TRUE; +/*N*/ nDetailedEdgeDraggingLimit=10; +/*N*/ bResizeAtCenter=FALSE; +/*N*/ bCrookAtCenter=FALSE; +/*N*/ bMouseHideWhileDraggingPoints=FALSE; +/*N*/ } + +/*N*/ void SdrDragView::ImpMakeDragAttr() +/*N*/ { +/*N*/ ImpDelDragAttr(); +/*N*/ } + +/*N*/ SdrDragView::SdrDragView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrExchangeView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ ImpMakeDragAttr(); +/*N*/ } + +/*N*/ SdrDragView::~SdrDragView() +/*N*/ { +/*N*/ ImpDelDragAttr(); +/*N*/ } + +/*N*/ void SdrDragView::ImpDelDragAttr() +/*N*/ { +/*N*/ } + +/*N*/ BOOL SdrDragView::IsAction() const +/*N*/ { +/*N*/ return SdrExchangeView::IsAction() || pDragBla!=NULL; +/*N*/ } + + + + +/*N*/ void SdrDragView::BrkAction() +/*N*/ { +/*N*/ SdrExchangeView::BrkAction(); +/*N*/ BrkDragObj(); +//STRIP012/*N*/ RefreshAllIAOManagers(); +/*N*/ } + + +/*N*/ void SdrDragView::ToggleShownXor(OutputDevice* pOut, const Region* pRegion) const +/*N*/ { +/*N*/ SdrExchangeView::ToggleShownXor(pOut,pRegion); + if (pDragBla!=NULL && aDragStat.IsShown() && + 1 )//STRIP001 //STRIP001 (!IS_TYPE(SdrDragMovHdl,pDragBla)) { // das ist ein Hack !!!!!!!!!! +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 DrawDragObj(pOut,TRUE); +/*N*/ } + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ void SdrDragView::BrkDragObj() +/*N*/ { +/*N*/ if (pDragBla!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrDragView::SetNoDragXorPolys(BOOL bOn) +/*N*/ { +/*N*/ if (IsNoDragXorPolys()!=bOn) { +/*N*/ BOOL bDragging=pDragBla!=NULL; +/*N*/ BOOL bShown=bDragging && aDragStat.IsShown(); +/*N*/ if (bShown) {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 HideDragObj(pDragWin); +/*N*/ bNoDragXorPolys=bOn; +/*N*/ if (bDragging) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (bShown) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ShowDragObj(pDragWin); +/*N*/ } +/*N*/ } + +/*N*/ void SdrDragView::SetDragStripes(BOOL bOn) +/*N*/ { +/*N*/ if (pDragBla!=NULL && aDragStat.IsShown()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } else { +/*N*/ bDragStripes=bOn; +/*N*/ } +/*N*/ } + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrDragView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ SdrExchangeView::WriteRecords(rOut); +/*N*/ { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWDRAGSTRIPES); +/*N*/ rOut<<(BOOL)bDragStripes; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWDRAGHIDEHDL); +/*N*/ rOut<<(BOOL)bNoDragHdl; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWOBJHITMOVES); +/*N*/ rOut<<(BOOL)bMarkedHitMovesAlways; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWMIRRDRAGOBJ); +/*N*/ rOut<<(BOOL)bMirrRefDragObj; +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrDragView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) { +/*N*/ bRet=TRUE; +/*N*/ switch (rSubHead.GetIdentifier()) { +/*N*/ case SDRIORECNAME_VIEWDRAGSTRIPES: { +/*N*/ BOOL bZwi; rIn >> bZwi; bDragStripes = bZwi; +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWDRAGHIDEHDL: { +/*N*/ BOOL bZwi; rIn >> bZwi; bNoDragHdl = bZwi; +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWOBJHITMOVES: { +/*N*/ BOOL bZwi; rIn >> bZwi; bMarkedHitMovesAlways = bZwi; +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWMIRRDRAGOBJ: { +/*N*/ BOOL bZwi; rIn >> bZwi; bMirrRefDragObj = bZwi; +/*N*/ } break; +/*N*/ default: bRet=FALSE; +/*N*/ } +/*N*/ } +/*N*/ if (!bRet) bRet=SdrExchangeView::ReadRecord(rViewHead,rSubHead,rIn); +/*N*/ return bRet; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdedtv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdedtv.cxx new file mode 100644 index 000000000000..e9221e2ab5ff --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdedtv.cxx @@ -0,0 +1,207 @@ +/* -*- 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 "svdpoev.hxx" // fuer die PolyPossiblities +#include "svdstr.hrc" // Namen aus der Resource + +// #i13033# +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrEditView::ImpResetPossibilityFlags() +/*N*/ { +/*N*/ bReadOnly =FALSE; +/*N*/ +/*N*/ bGroupPossible =FALSE; +/*N*/ bUnGroupPossible =FALSE; +/*N*/ bGrpEnterPossible =FALSE; +/*N*/ bDeletePossible =FALSE; +/*N*/ bToTopPossible =FALSE; +/*N*/ bToBtmPossible =FALSE; +/*N*/ bReverseOrderPossible =FALSE; +/*N*/ +/*N*/ bImportMtfPossible =FALSE; +/*N*/ bCombinePossible =FALSE; +/*N*/ bDismantlePossible =FALSE; +/*N*/ bCombineNoPolyPolyPossible =FALSE; +/*N*/ bDismantleMakeLinesPossible=FALSE; +/*N*/ bOrthoDesiredOnMarked =FALSE; +/*N*/ +/*N*/ bMoreThanOneNotMovable =FALSE; +/*N*/ bOneOrMoreMovable =FALSE; +/*N*/ bMoreThanOneNoMovRot =FALSE; +/*N*/ bContortionPossible =FALSE; +/*N*/ bAllPolys =FALSE; +/*N*/ bOneOrMorePolys =FALSE; +/*N*/ bMoveAllowed =FALSE; +/*N*/ bResizeFreeAllowed =FALSE; +/*N*/ bResizePropAllowed =FALSE; +/*N*/ bRotateFreeAllowed =FALSE; +/*N*/ bRotate90Allowed =FALSE; +/*N*/ bMirrorFreeAllowed =FALSE; +/*N*/ bMirror45Allowed =FALSE; +/*N*/ bMirror90Allowed =FALSE; +/*N*/ bTransparenceAllowed =FALSE; +/*N*/ bGradientAllowed =FALSE; +/*N*/ bShearAllowed =FALSE; +/*N*/ bEdgeRadiusAllowed =FALSE; +/*N*/ bCanConvToPath =FALSE; +/*N*/ bCanConvToPoly =FALSE; +/*N*/ bCanConvToContour =FALSE; +/*N*/ bCanConvToPathLineToArea=FALSE; +/*N*/ bCanConvToPolyLineToArea=FALSE; +/*N*/ bMoveProtect =FALSE; +/*N*/ bResizeProtect =FALSE; +/*N*/ } + +/*N*/ void SdrEditView::ImpClearVars() +/*N*/ { +/*N*/ ImpResetPossibilityFlags(); +/*N*/ bPossibilitiesDirty=TRUE; // << war von Purify angemeckert +/*N*/ bCombineError=FALSE; +/*N*/ bBundleVirtObj=FALSE; +/*N*/ } + +/*N*/ SdrEditView::SdrEditView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrMarkView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ } + +/*N*/ SdrEditView::~SdrEditView() +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +} //namespace binfilter +namespace binfilter {//STRIP009 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// #### ### #### #### # #### # # # ##### # ##### #### +// # # # # # # # # # # # # # # # # +// #### # # ### ### # #### # # # # # #### ### +// # # # # # # # # # # # # # # # +// # ### #### #### # #### # #### # # # ##### #### +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrEditView::MarkListHasChanged() +/*N*/ { +/*N*/ SdrMarkView::MarkListHasChanged(); +/*N*/ bPossibilitiesDirty=TRUE; +/*N*/ } + +/*N*/ void SdrEditView::ModelHasChanged() +/*N*/ { +/*N*/ SdrMarkView::ModelHasChanged(); +/*N*/ bPossibilitiesDirty=TRUE; +/*N*/ } + +/*N*/ void SdrEditView::CheckPossibilities() +/*N*/ { +/*N*/ if (bSomeObjChgdFlag) bPossibilitiesDirty=TRUE; +/*N*/ +/*N*/ if(bSomeObjChgdFlag) +/*N*/ { +/*N*/ // This call IS necessary to correct the MarkList, in which +/*N*/ // no longer to the model belonging objects still can reside. +/*N*/ // These ones nned to be removed. +/*N*/ CheckMarked(); +/*N*/ } +/*N*/ +/*N*/ if (bPossibilitiesDirty) { +/*N*/ ImpResetPossibilityFlags(); +/*N*/ aMark.ForceSort(); +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ if (nMarkAnz!=0) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ ImpCheckToTopBtmPossible(); +/*N*/ ((SdrPolyEditView*)this)->ImpCheckPolyPossibilities(); +/*N*/ bPossibilitiesDirty=FALSE; +/*N*/ +/*N*/ if (bReadOnly) { +/*?*/ BOOL bMerker1=bGrpEnterPossible; +/*?*/ ImpResetPossibilityFlags(); +/*?*/ bReadOnly=TRUE; +/*?*/ bGrpEnterPossible=bMerker1; +/*N*/ } +/*N*/ if (bMoveAllowed) { +/*?*/ // Verschieben von angeklebten Verbindern unterbinden +/*?*/ // Derzeit nur fuer Einfachselektion implementiert. +/*?*/ if (nMarkAnz==1) { +/*?*/ SdrObject* pObj=aMark.GetMark(0)->GetObj(); +/*?*/ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj); +/*?*/ if (pEdge!=NULL) { +/*?*/ SdrObject* pNode1=pEdge->GetConnectedNode(TRUE); +/*?*/ SdrObject* pNode2=pEdge->GetConnectedNode(FALSE); +/*?*/ if (pNode1!=NULL || pNode2!=NULL) bMoveAllowed=FALSE; +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef WIN + + + + + // nur nach dem 1. BegUndo oder vor dem letzten EndUndo: + +#endif + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdedtv2.cxx b/binfilter/bf_svx/source/svdraw/svx_svdedtv2.cxx new file mode 100644 index 000000000000..6319bae5a4b8 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdedtv2.cxx @@ -0,0 +1,130 @@ +/* -*- 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 "svdedtv.hxx" +#include "svdstr.hrc" // Namen aus der Resource + + + + + + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + +/*N*/ void SdrEditView::ImpCheckToTopBtmPossible() +/*N*/ { +/*N*/ ULONG nAnz=aMark.GetMarkCount(); +/*N*/ if (nAnz==0) return; +/*?*/ if (nAnz==1) { DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // Sonderbehandlung fuer Einzelmarkierung +/*N*/ } else {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // Mehrfachselektion +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// #### #### ### # # #### +// # # # # # # # # # +// # ## #### # # # # #### +// # # # # # # # # # +// #### # # ### ### # +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrEditView::GroupMarked(const SdrObject* pUserGrp) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// # # # # #### #### ### # # #### +// # # ## # # # # # # # # # # +// # # # # # # ## #### # # # # #### +// # # # ## # # # # # # # # # +// ### # # #### # # ### ### # +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrEditView::UnGroupMarked() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ### ### # # # # ##### #### ##### ##### ### #### ### # # # +// # # # # ## # # # # # # # # # # # # # # # # # +// # # # # # # # # #### #### # # # # #### # # # # +// # # # # # ## # # # # # # # # # # # # # # +// ### ### # # # ##### # # # # ### # ### #### # +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// # # ##### ##### ### ##### # # ##### # # # #### ### #### ##### +// ## ## # # # # # # # # # ## ## # # # # # # # +// # # # #### # ##### ### # # #### ### # # # # #### # # #### # +// # # # # # # # # # # # # # # # # # # # +// # # ##### # # # # # #### ##### # # # # ### # # # +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdedxv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdedxv.cxx new file mode 100644 index 000000000000..b2a6770fe75d --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdedxv.cxx @@ -0,0 +1,189 @@ +/* -*- 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 "svdedxv.hxx" +#include <bf_svtools/solar.hrc> +#include <string.h> +#include "svditext.hxx" +#include "svdoutl.hxx" +#include "svdstr.hrc" // Namen aus der Resource + + + +// #98988# +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrObjEditView::ImpClearVars() +/*N*/ { +/*N*/ bQuickTextEditMode=TRUE; +/*N*/ bMacroMode=TRUE; +/*N*/ pTextEditObj=NULL; +/*N*/ pTextEditOutliner=NULL; +/*N*/ pTextEditOutlinerView=NULL; +/*N*/ pTextEditPV=NULL; +/*N*/ pTextEditWin=NULL; +/*N*/ pTextEditCursorMerker=NULL; +/*N*/ pEditPara=NULL; +/*N*/ bTextEditNewObj=FALSE; +/*N*/ bMacroDown=FALSE; +/*N*/ pMacroObj=NULL; +/*N*/ pMacroPV=NULL; +/*N*/ pMacroWin=NULL; +/*N*/ nMacroTol=0; +/*N*/ bTextEditDontDelete=FALSE; +/*N*/ bTextEditOnlyOneView=FALSE; +/*N*/ } + +/*N*/ SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrGlueEditView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ } + +/*N*/ SdrObjEditView::~SdrObjEditView() +/*N*/ { +/*N*/ pTextEditWin = NULL; // Damit es in EndTextEdit kein ShowCursor gibt +/*N*/ if (IsTextEdit()){DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 EndTextEdit(); +/*N*/ if (pTextEditOutliner!=NULL) { +/*?*/ delete pTextEditOutliner; +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrObjEditView::IsAction() const +/*N*/ { +/*N*/ return IsMacroObj() || SdrGlueEditView::IsAction(); +/*N*/ } + + + + +/*N*/ void SdrObjEditView::BrkAction() +/*N*/ { +/*N*/ BrkMacroObj(); +/*N*/ SdrGlueEditView::BrkAction(); +/*N*/ } + + +/*N*/ void __EXPORT SdrObjEditView::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SdrGlueEditView::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ // Printerwechsel waerend des Editierens +/*N*/ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); +/*N*/ if (pSdrHint!=NULL && pTextEditOutliner!=NULL) { +/*?*/ SdrHintKind eKind=pSdrHint->GetKind(); +/*?*/ if (eKind==HINT_REFDEVICECHG) { +/*?*/ pTextEditOutliner->SetRefDevice(pMod->GetRefDevice()); +/*?*/ } +/*?*/ if (eKind==HINT_DEFAULTTABCHG) { +/*?*/ pTextEditOutliner->SetDefTab(pMod->GetDefaultTabulator()); +/*?*/ } +/*?*/ if (eKind==HINT_DEFFONTHGTCHG) { +/*?*/ // ... +/*?*/ } +/*?*/ if (eKind==HINT_MODELSAVED) { // #43095# +/*?*/ DBG_BF_ASSERT(0, "STRIP"); +/*?*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjEditView::ModelHasChanged() +/*N*/ { +/*N*/ SdrGlueEditView::ModelHasChanged(); +/*N*/ if (IsTextEdit() && !pTextEditObj->IsInserted()) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 EndTextEdit(); // Objekt geloescht +/*N*/ // TextEditObj geaendert? +/*N*/ if (IsTextEdit()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@@ @@@@@ @@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@@@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +/*N*/ BOOL SdrObjEditView::BegTextEdit(SdrObject* pObj, SdrPageView* pPV, Window* pWin, +/*N*/ SdrOutliner* pGivenOutliner, OutlinerView* pGivenOutlinerView, +/*N*/ BOOL bDontDeleteOutliner, BOOL bOnlyOneView) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*N*/ } + +/*N*/ SdrEndTextEditKind SdrObjEditView::EndTextEdit(BOOL bDontDeleteReally) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED; return eRet; //STRIP001 +/*N*/ } + +/*N*/ void SdrObjEditView::DelWin(OutputDevice* pWin1) +/*N*/ { +/*N*/ SdrGlueEditView::DelWin(pWin1); +/*N*/ if (pTextEditObj!=NULL && !bTextEditOnlyOneView && pWin1->GetOutDevType()==OUTDEV_WINDOW) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 for (ULONG i=pTextEditOutliner->GetViewCount(); i>0;) { +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@ @@@@ @@@@ @@@@@ @@@@ @@ @@ @@@@ @@@@@ @@@@@ +// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@ @@ +// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@ +// @@@@@@@ @@@@@@ @@ @@@@@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@@@ +// @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@@@ @@ @@ @@@@ @@ @@ @@@@ @@@@@ @@@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +/*N*/ void SdrObjEditView::BrkMacroObj() +/*N*/ { +/*N*/ if (pMacroObj!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdetc.cxx b/binfilter/bf_svx/source/svdraw/svx_svdetc.cxx new file mode 100644 index 000000000000..affb6e9fdda2 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdetc.cxx @@ -0,0 +1,632 @@ +/* -*- 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 "forbiddencharacterstable.hxx" + +#include "svdetc.hxx" +#include "svditext.hxx" +#include "svdstr.hrc" +#include "svdviter.hxx" +#include "svdview.hxx" +#include "svdoutl.hxx" + +#include <vcl/bmpacc.hxx> + +#include <eeitem.hxx> + + + +#include <bf_svtools/cacheoptions.hxx> + + + + + + + + +#include "xflclit.hxx" + +#include "xflhtit.hxx" + +#include "xbtmpit.hxx" + +#include "xflgrit.hxx" + +#include "svdoole2.hxx" + + + +#include <bf_svtools/syslocale.hxx> + +// #97870# +#include "xflbckit.hxx" + +#include <bf_goodies/b3dcolor.hxx> + +namespace binfilter { + +/****************************************************************************** +* Globale Daten der DrawingEngine +******************************************************************************/ + +/*N*/ SdrGlobalData::SdrGlobalData() : +/*N*/ pOutliner(NULL), +/*N*/ pDefaults(NULL), +/*N*/ pResMgr(NULL), +/*N*/ pStrCache(NULL), +/*N*/ nExchangeFormat(0) +/*N*/ { +/*N*/ pSysLocale = new SvtSysLocale; +/*N*/ pCharClass = pSysLocale->GetCharClassPtr(); +/*N*/ pLocaleData = pSysLocale->GetLocaleDataPtr(); +/*N*/ } + +/*N*/ SdrGlobalData::~SdrGlobalData() +/*N*/ { +/*N*/ delete pOutliner; +/*N*/ delete pDefaults; +/*N*/ delete pResMgr; +/*N*/ delete [] pStrCache; +/*N*/ //! do NOT delete pCharClass and pLocaleData +/*N*/ delete pSysLocale; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ OLEObjCache::OLEObjCache() +/*N*/ : Container( 0 ) +/*N*/ { +/*N*/ SvtCacheOptions aCacheOptions; +/*N*/ +/*N*/ nSize = aCacheOptions.GetDrawingEngineOLE_Objects(); +/*N*/ pTimer = new AutoTimer(); +/*N*/ Link aLink = LINK(this, OLEObjCache, UnloadCheckHdl); +/*N*/ +/*N*/ pTimer->SetTimeoutHdl(aLink); +/*N*/ pTimer->SetTimeout(20000); +/*N*/ pTimer->Start(); +/*N*/ +/*N*/ aLink.Call(pTimer); +/*N*/ } + +/*N*/ OLEObjCache::~OLEObjCache() +/*N*/ { +/*N*/ pTimer->Stop(); +/*N*/ delete pTimer; +/*N*/ // Kein Unload notwendig, da zu diesem Zeitpunkt +/*N*/ // die Objekte nicht mehr vorhanden sind +/*N*/ } + + +/*N*/ void OLEObjCache::InsertObj(SdrOle2Obj* pObj) +/*N*/ { +/*N*/ if (nSize <= Count()) +/*N*/ { +/*?*/ // Eintraege reduzieren +/*?*/ ULONG nIndex = Count() - 1; +/*?*/ +/*?*/ for (ULONG i = nIndex; i + 1 >= nSize; i--) +/*?*/ { +/*?*/ // Pruefen, ob Objekte entfernt werden koennen +/*?*/ SdrOle2Obj* pCacheObj = (SdrOle2Obj*) GetObject(i); +/*?*/ +/*?*/ if ( pCacheObj != pObj && UnloadObj(pCacheObj) ) +/*?*/ { +/*?*/ Remove(i); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ // Objekt ggf. entfernen und an erster Position einfuegen +/*N*/ Remove(pObj); +/*N*/ Insert(pObj, (ULONG) 0L); +/*N*/ } + +/*N*/ void OLEObjCache::RemoveObj(SdrOle2Obj* pObj) +/*N*/ { +/*N*/ UnloadObj( (SdrOle2Obj*) Remove(pObj) ); +/*N*/ } + +/*N*/ BOOL OLEObjCache::UnloadObj(SdrOle2Obj* pObj) +/*N*/ { +/*N*/ BOOL bUnloaded = FALSE; +/*N*/ +/*N*/ if (pObj) +/*N*/ { +/*N*/ BOOL bVisible = FALSE; +/*N*/ SdrViewIter aIter(pObj); +/*N*/ SdrView* pView = aIter.FirstView(); +/*N*/ +/*N*/ while (!bVisible && pView!=NULL) +/*N*/ { +/*?*/ bVisible = !pView->IsGrafDraft(); +/*?*/ +/*?*/ if (!bVisible) +/*?*/ pView = aIter.NextView(); +/*N*/ } +/*N*/ +/*N*/ if (!bVisible) +/*N*/ bUnloaded = pObj->Unload(); +/*N*/ } +/*N*/ +/*N*/ return bUnloaded; +/*N*/ } + +/*N*/ IMPL_LINK(OLEObjCache, UnloadCheckHdl, AutoTimer*, pTim) +/*N*/ { +/*N*/ if (nSize <= Count()) +/*N*/ { +/*?*/ // Eintraege reduzieren +/*?*/ ULONG nIndex = Count() - 1; +/*?*/ +/*?*/ for (ULONG i = nIndex; i + 1 >= nSize; i--) +/*?*/ { +/*?*/ // Pruefen, ob Objekte entfernt werden koennen +/*?*/ SdrOle2Obj* pCacheObj = (SdrOle2Obj*) GetObject(i); +/*?*/ +/*?*/ if ( UnloadObj(pCacheObj) ) +/*?*/ Remove(i); +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ return 0; +/*N*/ } + + + +/*N*/ void ContainerSorter::DoSort(ULONG a, ULONG b) const +/*N*/ { +/*N*/ ULONG nAnz=rCont.Count(); +/*N*/ if (b>nAnz) b=nAnz; +/*N*/ if (b>0) b--; +/*N*/ if (a<b) ImpSubSort(a,b); +/*N*/ } + + +/*?*/ void ContainerSorter::ImpSubSort(long nL, long nR) const +/*?*/ { +/*?*/ long i,j; +/*?*/ const void* pX; +/*?*/ void* pI; +/*?*/ void* pJ; +/*?*/ i=nL; +/*?*/ j=nR; +/*?*/ pX=rCont.GetObject((nL+nR)/2); +/*?*/ do { +/*?*/ pI=rCont.Seek(i); +/*?*/ while (pI!=pX && Compare(pI,pX)<0) { i++; pI=rCont.Next(); } +/*?*/ pJ=rCont.Seek(j); +/*?*/ while (pJ!=pX && Compare(pX,pJ)<0) { j--; pJ=rCont.Prev(); } +/*?*/ if (i<=j) { +/*?*/ rCont.Replace(pJ,i); +/*?*/ rCont.Replace(pI,j); +/*?*/ i++; +/*?*/ j--; +/*?*/ } +/*?*/ } while (i<=j); +/*?*/ if (nL<j) ImpSubSort(nL,j); +/*?*/ if (i<nR) ImpSubSort(i,nR); +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*?*/ class ImpClipMerk { +/*?*/ Region aClip; +/*?*/ FASTBOOL bClip; +/*?*/ public: +/*?*/ ImpClipMerk(const OutputDevice& rOut): aClip(rOut.GetClipRegion()),bClip(rOut.IsClipRegion()) {} +/*?*/ void Restore(OutputDevice& rOut) +/*?*/ { +/*?*/ // Kein Clipping in die Metafileaufzeichnung +/*?*/ GDIMetaFile* pMtf=rOut.GetConnectMetaFile(); +/*?*/ if (pMtf!=NULL && (!pMtf->IsRecord() || pMtf->IsPause())) pMtf=NULL; +/*?*/ if (pMtf!=NULL) pMtf->Pause(TRUE); +/*?*/ if (bClip) rOut.SetClipRegion(aClip); +/*?*/ else rOut.SetClipRegion(); +/*?*/ if (pMtf!=NULL) pMtf->Pause(FALSE); +/*?*/ } +/*?*/ }; +/*?*/ +/*?*/ class ImpColorMerk { +/*?*/ Color aLineColor; +/*?*/ Color aFillColor; +/*?*/ Color aBckgrdColor; +/*?*/ Font aFont; +/*?*/ public: +/*?*/ ImpColorMerk(const OutputDevice& rOut): +/*?*/ aLineColor( rOut.GetLineColor() ), +/*?*/ aFillColor( rOut.GetFillColor() ), +/*?*/ aBckgrdColor( rOut.GetBackground().GetColor() ), +/*?*/ aFont (rOut.GetFont()) {} +/*?*/ +/*?*/ ImpColorMerk(const OutputDevice& rOut, USHORT nMode) +/*?*/ { +/*?*/ if ( (nMode & SDRHDC_SAVEPEN) == SDRHDC_SAVEPEN ) +/*?*/ aLineColor = rOut.GetLineColor(); +/*?*/ +/*?*/ if ( (nMode & SDRHDC_SAVEBRUSH) == SDRHDC_SAVEBRUSH) +/*?*/ { +/*?*/ aFillColor = rOut.GetFillColor(); +/*?*/ aBckgrdColor = rOut.GetBackground().GetColor(); +/*?*/ } +/*?*/ +/*?*/ if ( (nMode & SDRHDC_SAVEFONT) == SDRHDC_SAVEFONT) +/*?*/ aFont=rOut.GetFont(); +/*?*/ } +/*?*/ +/*?*/ void Restore(OutputDevice& rOut, USHORT nMode=SDRHDC_SAVEPENANDBRUSHANDFONT) +/*?*/ { +/*?*/ if ( (nMode & SDRHDC_SAVEPEN) == SDRHDC_SAVEPEN) +/*?*/ rOut.SetLineColor( aLineColor ); +/*?*/ +/*?*/ if ( (nMode & SDRHDC_SAVEBRUSH) == SDRHDC_SAVEBRUSH) +/*?*/ { +/*?*/ rOut.SetFillColor( aFillColor ); +/*?*/ rOut.SetBackground( Wallpaper( aBckgrdColor ) ); +/*?*/ } +/*?*/ if ((nMode & SDRHDC_SAVEFONT) ==SDRHDC_SAVEFONT) +/*?*/ { +/*?*/ if (!rOut.GetFont().IsSameInstance(aFont)) +/*?*/ { +/*?*/ rOut.SetFont(aFont); +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ const Color& GetLineColor() const { return aLineColor; } +/*?*/ }; + +/*N*/ ImpSdrHdcMerk::ImpSdrHdcMerk(const OutputDevice& rOut, USHORT nNewMode, FASTBOOL bAutoMerk): +/*N*/ pFarbMerk(NULL), +/*N*/ pClipMerk(NULL), +/*N*/ pLineColorMerk(NULL), +/*N*/ nMode(nNewMode) +/*N*/ { +/*N*/ if (bAutoMerk) Save(rOut); +/*N*/ } + +/*N*/ ImpSdrHdcMerk::~ImpSdrHdcMerk() +/*N*/ { +/*N*/ if (pFarbMerk!=NULL) delete pFarbMerk; +/*N*/ if (pClipMerk!=NULL) delete pClipMerk; +/*N*/ if (pLineColorMerk !=NULL) delete pLineColorMerk; +/*N*/ } + +/*N*/ void ImpSdrHdcMerk::Save(const OutputDevice& rOut) +/*N*/ { +/*N*/ if (pFarbMerk!=NULL) +/*N*/ { +/*N*/ delete pFarbMerk; +/*N*/ pFarbMerk=NULL; +/*N*/ } +/*N*/ if (pClipMerk!=NULL) +/*N*/ { +/*N*/ delete pClipMerk; +/*N*/ pClipMerk=NULL; +/*N*/ } +/*N*/ if (pLineColorMerk !=NULL) +/*N*/ { +/*N*/ delete pLineColorMerk ; +/*N*/ pLineColorMerk =NULL; +/*N*/ } +/*N*/ if ((nMode & SDRHDC_SAVECLIPPING) ==SDRHDC_SAVECLIPPING) +/*N*/ pClipMerk=new ImpClipMerk(rOut); +/*N*/ +/*N*/ USHORT nCol=nMode & SDRHDC_SAVEPENANDBRUSHANDFONT; +/*N*/ +/*N*/ if (nCol==SDRHDC_SAVEPEN) +/*N*/ pLineColorMerk=new Color( rOut.GetLineColor() ); +/*N*/ else if (nCol==SDRHDC_SAVEPENANDBRUSHANDFONT) +/*N*/ pFarbMerk=new ImpColorMerk(rOut); +/*N*/ else if (nCol!=0) +/*N*/ pFarbMerk=new ImpColorMerk(rOut,nCol); +/*N*/ } + +/*N*/ void ImpSdrHdcMerk::Restore(OutputDevice& rOut, USHORT nMask) const +/*N*/ { +/*N*/ nMask&=nMode; // nur restaurieren, was auch gesichert wurde +/*N*/ +/*N*/ if ((nMask & SDRHDC_SAVECLIPPING) ==SDRHDC_SAVECLIPPING && pClipMerk!=NULL) +/*N*/ pClipMerk->Restore(rOut); +/*N*/ +/*N*/ USHORT nCol=nMask & SDRHDC_SAVEPENANDBRUSHANDFONT; +/*N*/ +/*N*/ if (nCol==SDRHDC_SAVEPEN) +/*N*/ { +/*N*/ if (pLineColorMerk!=NULL) +/*N*/ rOut.SetLineColor(*pLineColorMerk); +/*N*/ else if (pFarbMerk!=NULL) +/*N*/ rOut.SetLineColor( pFarbMerk->GetLineColor() ); +/*N*/ } else if (nCol!=0 && pFarbMerk!=NULL) +/*N*/ pFarbMerk->Restore(rOut,nCol); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrLinkList::Clear() +/*N*/ { +/*N*/ unsigned nAnz=GetLinkCount(); +/*N*/ for (unsigned i=0; i<nAnz; i++) { +/*N*/ delete (Link*)aList.GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + +/*N*/ unsigned SdrLinkList::FindEntry(const Link& rLink) const +/*N*/ { +/*N*/ unsigned nAnz=GetLinkCount(); +/*N*/ for (unsigned i=0; i<nAnz; i++) { +/*N*/ if (GetLink(i)==rLink) return i; +/*N*/ } +/*N*/ return 0xFFFF; +/*N*/ } + +/*N*/ void SdrLinkList::InsertLink(const Link& rLink, unsigned nPos) +/*N*/ { +/*N*/ unsigned nFnd=FindEntry(rLink); +/*N*/ if (nFnd==0xFFFF) { +/*N*/ if (rLink.IsSet()) { +/*N*/ aList.Insert(new Link(rLink),nPos); +/*N*/ } else { +/*N*/ DBG_ERROR("SdrLinkList::InsertLink(): Versuch, einen nicht gesetzten Link einzufuegen"); +/*N*/ } +/*N*/ } else { +/*N*/ DBG_ERROR("SdrLinkList::InsertLink(): Link schon vorhanden"); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void SdrLinkList::RemoveLink(const Link& rLink) +/*N*/ { +/*N*/ unsigned nFnd=FindEntry(rLink); +/*N*/ if (nFnd!=0xFFFF) { +/*N*/ Link* pLink=(Link*)aList.Remove(nFnd); +/*N*/ delete pLink; +/*N*/ } else { +/*N*/ DBG_ERROR("SdrLinkList::RemoveLink(): Link nicht gefunden"); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #98988# Re-implement GetDraftFillColor(...) + +/*N*/ FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol) +/*N*/ { +/*N*/ XFillStyle eFill=((XFillStyleItem&)rSet.Get(XATTR_FILLSTYLE)).GetValue(); +/*N*/ FASTBOOL bRetval(FALSE); +/*N*/ +/*N*/ switch(eFill) +/*N*/ { +/*N*/ case XFILL_SOLID: +/*N*/ { +/*N*/ rCol = ((XFillColorItem&)rSet.Get(XATTR_FILLCOLOR)).GetValue(); +/*N*/ bRetval = TRUE; +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ case XFILL_HATCH: +/*N*/ { +/*?*/ Color aCol1(((XFillHatchItem&)rSet.Get(XATTR_FILLHATCH)).GetValue().GetColor()); +/*?*/ Color aCol2(COL_WHITE); +/*?*/ +/*?*/ // #97870# when hatch background is activated, use object fill color as hatch color +/*?*/ sal_Bool bFillHatchBackground = ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue(); +/*?*/ if(bFillHatchBackground) +/*?*/ { +/*?*/ aCol2 = ((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetValue(); +/*?*/ } +/*?*/ +/*?*/ ((B3dColor&)rCol).CalcMiddle(aCol1, aCol2); +/*?*/ bRetval = TRUE; +/*?*/ +/*?*/ break; +/*N*/ } +/*N*/ case XFILL_GRADIENT: { +/*N*/ const XGradient& rGrad=((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetValue(); +/*N*/ Color aCol1(rGrad.GetStartColor()); +/*N*/ Color aCol2(rGrad.GetEndColor()); +/*N*/ ((B3dColor&)rCol).CalcMiddle(aCol1, aCol2); +/*N*/ bRetval = TRUE; +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ case XFILL_BITMAP: +/*N*/ { +/*?*/ const Bitmap& rBitmap = ((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetValue().GetBitmap(); +/*?*/ const Size aSize(rBitmap.GetSizePixel()); +/*?*/ const sal_uInt32 nWidth = aSize.Width(); +/*?*/ const sal_uInt32 nHeight = aSize.Height(); +/*?*/ Bitmap aBitmap(rBitmap); +/*?*/ BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); +/*?*/ +/*?*/ if(pAccess && nWidth > 0 && nHeight > 0) +/*?*/ { +/*?*/ sal_uInt32 nRt(0L); +/*?*/ sal_uInt32 nGn(0L); +/*?*/ sal_uInt32 nBl(0L); +/*?*/ const sal_uInt32 nMaxSteps(8L); +/*?*/ const sal_uInt32 nXStep((nWidth > nMaxSteps) ? nWidth / nMaxSteps : 1L); +/*?*/ const sal_uInt32 nYStep((nHeight > nMaxSteps) ? nHeight / nMaxSteps : 1L); +/*?*/ sal_uInt32 nAnz(0L); +/*?*/ +/*?*/ for(sal_uInt32 nY(0L); nY < nHeight; nY += nYStep) +/*?*/ { +/*?*/ for(sal_uInt32 nX(0L); nX < nWidth; nX += nXStep) +/*?*/ { +/*?*/ const BitmapColor& rCol = (pAccess->HasPalette()) +/*?*/ ? pAccess->GetPaletteColor((BYTE)pAccess->GetPixel(nY, nX)) +/*?*/ : pAccess->GetPixel(nY, nX); +/*?*/ +/*?*/ nRt += rCol.GetRed(); +/*?*/ nGn += rCol.GetGreen(); +/*?*/ nBl += rCol.GetBlue(); +/*?*/ nAnz++; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ nRt /= nAnz; +/*?*/ nGn /= nAnz; +/*?*/ nBl /= nAnz; +/*?*/ +/*?*/ rCol = Color(UINT8(nRt), UINT8(nGn), UINT8(nBl)); +/*?*/ +/*?*/ bRetval = TRUE; +/*?*/ } +/*?*/ +/*?*/ if(pAccess) +/*?*/ { +/*?*/ aBitmap.ReleaseAccess(pAccess); +/*?*/ } +/*?*/ +/*?*/ break; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ return bRetval; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrEngineDefaults::SdrEngineDefaults(): +/*N*/ aFontName( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ).GetName() ), +/*N*/ eFontFamily(FAMILY_ROMAN), +/*N*/ aFontColor(COL_AUTO), +/*N*/ nFontHeight(847), // 847/100mm = ca. 24 Point +/*N*/ eMapUnit(MAP_100TH_MM), +/*N*/ aMapFraction(1,1) +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ SdrEngineDefaults& SdrEngineDefaults::GetDefaults() +/*N*/ { +/*N*/ SdrGlobalData& rGlobalData=GetSdrGlobalData(); +/*N*/ if (rGlobalData.pDefaults==NULL) { +/*N*/ rGlobalData.pDefaults=new SdrEngineDefaults; +/*N*/ } +/*N*/ return *rGlobalData.pDefaults; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrOutliner* SdrMakeOutliner( USHORT nOutlinerMode, SdrModel* pModel ) +/*N*/ { +/*N*/ SdrEngineDefaults& rDefaults = SdrEngineDefaults::GetDefaults(); + +/* + MapUnit eUn( (pMod==NULL) ? rDefaults.eMapUnit : pMod->GetScaleUnit()); + Fraction aFr( *((pMod==NULL) ? &rDefaults.aMapFraction : &pMod->GetScaleFraction())); + + if ( pMod->GetRefDevice() ) + pOutl->SetRefDevice( pMod->GetRefDevice() ); + else + { + MapMode aMapMode(eUn,Point(0,0),aFr,aFr); + pOutl->SetRefMapMode( aMapMode ); + } + + SfxItemSet aSet(pOutl->GetEmptyItemSet()); + aSet.Put(SvxFontItem(rDefaults.eFontFamily, rDefaults.aFontName, String(), PITCH_DONTKNOW, gsl_getSystemTextEncoding() ) ); + aSet.Put(SvxColorItem(rDefaults.aFontColor)); + ULONG nHgt=rDefaults.nFontHeight; + FASTBOOL bDifUn=(eUn!=rDefaults.eMapUnit); // different MapUnits + FASTBOOL bDifFr=(aFr!=rDefaults.aMapFraction); // different MapFractions + if (bDifUn || bDifFr) { // Wenn pMod!=NULL und pMod->Map!=rDef.Map + long nTmpLong=long(nHgt); // caasting im Ctor bringt unter MSVC sehr merkwuerdige Fehlermeldungen + BigInt aHgt1(nTmpLong); // umrechnen von DefMap in ModMap + FrPair aUnitMul(GetMapFactor(rDefaults.eMapUnit,eUn)); + + if (bDifUn) aHgt1*=aUnitMul.Y().GetNumerator(); + if (bDifFr) aHgt1*=aFr.GetNumerator(); + if (bDifFr) aHgt1*=rDefaults.aMapFraction.GetDenominator(); + if (bDifUn) aHgt1/=aUnitMul.Y().GetDenominator(); + if (bDifFr) aHgt1/=aFr.GetDenominator(); + if (bDifFr) aHgt1/=rDefaults.aMapFraction.GetNumerator(); + + nHgt=ULONG(long(aHgt1)); + } + aSet.Put(SvxFontHeightItem(nHgt)); + pOutl->SetDefaults(aSet); +*/ + +/*N*/ SfxItemPool* pPool = &pModel->GetItemPool(); +/*N*/ SdrOutliner* pOutl = new SdrOutliner( pPool, nOutlinerMode ); +/*N*/ pOutl->SetEditTextObjectPool( pPool ); +/*N*/ pOutl->SetStyleSheetPool( (SfxStyleSheetPool*) pModel->GetStyleSheetPool() ); +/*N*/ pOutl->SetDefTab( pModel->GetDefaultTabulator() ); +/*N*/ pOutl->SetForbiddenCharsTable( pModel->GetForbiddenCharsTable() ); +/*N*/ pOutl->SetAsianCompressionMode( pModel->GetCharCompressType() ); +/*N*/ pOutl->SetKernAsianPunctuation( pModel->IsKernAsianPunctuation() ); +/*N*/ +/*N*/ return pOutl; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ SdrLinkList& ImpGetUserMakeObjHdl() +/*N*/ { +/*N*/ SdrGlobalData& rGlobalData=GetSdrGlobalData(); +/*N*/ return rGlobalData.aUserMakeObjHdl; +/*N*/ } + +/*N*/ SdrLinkList& ImpGetUserMakeObjUserDataHdl() +/*N*/ { +/*N*/ SdrGlobalData& rGlobalData=GetSdrGlobalData(); +/*N*/ return rGlobalData.aUserMakeObjUserDataHdl; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ ResMgr* ImpGetResMgr() +/*N*/ { +/*N*/ SdrGlobalData& rGlobalData = GetSdrGlobalData(); +/*N*/ +/*N*/ if(!rGlobalData.pResMgr) +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ ByteString aName("bf_svx"); //STRIP005 +/*N*/ #else +/*N*/ ByteString aName("bf_svl"); //STRIP005 +/*N*/ #endif +/*N*/ rGlobalData.pResMgr = +/*N*/ ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() ); +/*N*/ } +/*N*/ +/*N*/ return rGlobalData.pResMgr; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdglev.cxx b/binfilter/bf_svx/source/svdraw/svx_svdglev.cxx new file mode 100644 index 000000000000..f7b7c32caabb --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdglev.cxx @@ -0,0 +1,96 @@ +/* -*- 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 "svdglev.hxx" +#include <math.h> + +#include "svdstr.hrc" // Namen aus der Resource +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrGlueEditView::ImpClearVars() +/*N*/ { +/*N*/ } + +/*N*/ SdrGlueEditView::SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrPolyEditView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ } + +/*N*/ SdrGlueEditView::~SdrGlueEditView() +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdglue.cxx b/binfilter/bf_svx/source/svdraw/svx_svdglue.cxx new file mode 100644 index 000000000000..c8f74c55777d --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdglue.cxx @@ -0,0 +1,225 @@ +/* -*- 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 "svdobj.hxx" +#include "svdio.hxx" +#include "svdtrans.hxx" +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ Point SdrGluePoint::GetAbsolutePos(const SdrObject& rObj) const +/*N*/ { +/*N*/ if (bReallyAbsolute) return aPos; +/*N*/ Rectangle aSnap(rObj.GetSnapRect()); +/*N*/ Rectangle aBound(rObj.GetSnapRect()); +/*N*/ Point aPt(aPos); +/*N*/ +/*N*/ Point aOfs(aSnap.Center()); +/*N*/ switch (GetHorzAlign()) { +/*?*/ case SDRHORZALIGN_LEFT : aOfs.X()=aSnap.Left(); break; +/*?*/ case SDRHORZALIGN_RIGHT : aOfs.X()=aSnap.Right(); break; +/*N*/ } +/*N*/ switch (GetVertAlign()) { +/*?*/ case SDRVERTALIGN_TOP : aOfs.Y()=aSnap.Top(); break; +/*?*/ case SDRVERTALIGN_BOTTOM: aOfs.Y()=aSnap.Bottom(); break; +/*N*/ } +/*N*/ if (!bNoPercent) { +/*?*/ long nXMul=aSnap.Right()-aSnap.Left(); +/*?*/ long nYMul=aSnap.Bottom()-aSnap.Top(); +/*?*/ long nXDiv=10000; +/*?*/ long nYDiv=10000; +/*?*/ if (nXMul!=nXDiv) { +/*?*/ aPt.X()*=nXMul; +/*?*/ aPt.X()/=nXDiv; +/*?*/ } +/*?*/ if (nYMul!=nYDiv) { +/*?*/ aPt.Y()*=nYMul; +/*?*/ aPt.Y()/=nYDiv; +/*?*/ } +/*N*/ } +/*N*/ aPt+=aOfs; +/*N*/ // Und nun auf's BoundRect des Objekts begrenzen +/*N*/ if (aPt.X()<aBound.Left ()) aPt.X()=aBound.Left (); +/*N*/ if (aPt.X()>aBound.Right ()) aPt.X()=aBound.Right (); +/*N*/ if (aPt.Y()<aBound.Top ()) aPt.Y()=aBound.Top (); +/*N*/ if (aPt.Y()>aBound.Bottom()) aPt.Y()=aBound.Bottom(); +/*N*/ return aPt; +/*N*/ } + + + + + + + + + + + + + +/*?*/ SvStream& operator<<(SvStream& rOut, const SdrGluePoint& rGP) +/*?*/ { +/*?*/ if (rOut.GetError()!=0) return rOut; +/*?*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrGluePoint"); +/*?*/ #endif +/*?*/ rOut<<rGP.aPos; +/*?*/ rOut<<rGP.nEscDir; +/*?*/ rOut<<rGP.nId; +/*?*/ rOut<<rGP.nAlign; +/*?*/ BOOL bTmp=rGP.bNoPercent; // ueber bTmp, weil sonst (beim casting) im Falle +/*?*/ rOut<<bTmp; // TRUE nicht 01 sondern FF geschrieben wird. +/*?*/ return rOut; +/*?*/ } + +/*?*/ SvStream& operator>>(SvStream& rIn, SdrGluePoint& rGP) +/*?*/ { +/*?*/ if (rIn.GetError()!=0) return rIn; +/*?*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrGluePoint"); +/*?*/ #endif +/*?*/ BOOL bTmpBool; +/*?*/ rIn>>rGP.aPos; +/*?*/ rIn>>rGP.nEscDir; +/*?*/ rIn>>rGP.nId; +/*?*/ rIn>>rGP.nAlign; +/*?*/ rIn>>bTmpBool; rGP.bNoPercent=(bTmpBool!=0); +/*?*/ return rIn; +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrGluePointList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + + +// Die Id's der Klebepunkte in der Liste sind stets streng monoton steigend! +// Ggf. wird dem neuen Klebepunkt eine neue Id zugewiesen (wenn diese bereits +// vergeben ist). Die Id 0 ist reserviert. +/*N*/ USHORT SdrGluePointList::Insert(const SdrGluePoint& rGP) +/*N*/ { +/*N*/ SdrGluePoint* pGP=new SdrGluePoint(rGP); +/*N*/ USHORT nId=pGP->GetId(); +/*N*/ USHORT nAnz=GetCount(); +/*N*/ USHORT nInsPos=nAnz; +/*N*/ USHORT nLastId=nAnz!=0 ? GetObject(nAnz-1)->GetId() : 0; +/*N*/ DBG_ASSERT(nLastId>=nAnz,"SdrGluePointList::Insert(): nLastId<nAnz"); +/*N*/ FASTBOOL bHole=nLastId>nAnz; +/*N*/ if (nId<=nLastId) { +/*N*/ if (!bHole || nId==0) { +/*N*/ nId=nLastId+1; +/*N*/ } else { +/*N*/ FASTBOOL bBrk=FALSE; +/*N*/ for (USHORT nNum=0; nNum<nAnz && !bBrk; nNum++) { +/*N*/ const SdrGluePoint* pGP=GetObject(nNum); +/*N*/ USHORT nTmpId=pGP->GetId(); +/*N*/ if (nTmpId==nId) { +/*N*/ nId=nLastId+1; // bereits vorhanden +/*N*/ bBrk=TRUE; +/*N*/ } +/*N*/ if (nTmpId>nId) { +/*N*/ nInsPos=nNum; // Hier einfuegen (einsortieren) +/*N*/ bBrk=TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ pGP->SetId(nId); +/*N*/ } +/*N*/ aList.Insert(pGP,nInsPos); +/*N*/ return nInsPos; +/*N*/ } + + + +/*N*/ USHORT SdrGluePointList::FindGluePoint(USHORT nId) const +/*N*/ { +/*N*/ // Hier noch einen optimaleren Suchalgorithmus implementieren. +/*N*/ // Die Liste sollte stets sortiert sein!!!! +/*N*/ USHORT nAnz=GetCount(); +/*N*/ USHORT nRet=SDRGLUEPOINT_NOTFOUND; +/*N*/ for (USHORT nNum=0; nNum<nAnz && nRet==SDRGLUEPOINT_NOTFOUND; nNum++) { +/*N*/ const SdrGluePoint* pGP=GetObject(nNum); +/*N*/ if (pGP->GetId()==nId) nRet=nNum; +/*N*/ } +/*N*/ return nRet; +/*N*/ } + + + + + + + +/*?*/ SvStream& operator<<(SvStream& rOut, const SdrGluePointList& rGPL) +/*?*/ { +/*?*/ if (rOut.GetError()!=0) return rOut; +/*?*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrGluePointList"); +/*?*/ #endif +/*?*/ UINT16 nAnz=rGPL.GetCount(); +/*?*/ rOut<<(UINT16)nAnz; +/*?*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*?*/ rOut<<rGPL[nNum]; +/*?*/ } +/*?*/ return rOut; +/*?*/ } + +/*?*/ SvStream& operator>>(SvStream& rIn, SdrGluePointList& rGPL) +/*?*/ { +/*?*/ if (rIn.GetError()!=0) return rIn; +/*?*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrGluePointList"); +/*?*/ #endif +/*?*/ rGPL.Clear(); +/*?*/ UINT16 nAnz=0; +/*?*/ rIn>>nAnz; +/*?*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*?*/ SdrGluePoint aGP; +/*?*/ rIn>>aGP; +/*?*/ rGPL.Insert(aGP); +/*?*/ } +/*?*/ return rIn; +/*?*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdhdl.cxx b/binfilter/bf_svx/source/svdraw/svx_svdhdl.cxx new file mode 100644 index 000000000000..e71b4839c2c8 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdhdl.cxx @@ -0,0 +1,177 @@ +/* -*- 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 "svdetc.hxx" +#include "svdmrkv.hxx" + + + + + + + +#include "svdstr.hrc" + + +// #105678# +namespace binfilter { + +/*N*/ SdrHdl::~SdrHdl() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ class ImpSdrHdlListSorter: public ContainerSorter { +/*N*/ public: +/*N*/ ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {} +/*N*/ virtual int Compare(const void* pElem1, const void* pElem2) const; +/*N*/ }; + +/*N*/ int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #97016# II + +/*N*/ class ImplHdlListData +/*N*/ { +/*N*/ public: +/*N*/ sal_uInt32 mnFocusIndex; +/*N*/ SdrMarkView* pView; +/*N*/ +/*N*/ ImplHdlListData(SdrMarkView* pV): mnFocusIndex(CONTAINER_ENTRY_NOTFOUND), pView(pV) {} +/*N*/ }; + + +// #105678# Help struct for re-sorting handles +struct ImplHdlAndIndex +{ + SdrHdl* mpHdl; + sal_uInt32 mnIndex; +}; + +// #105678# Help method for sorting handles taking care of OrdNums, keeping order in +// single objects and re-sorting polygon handles intuitively + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #97016# II + + +/*N*/ SdrHdl* SdrHdlList::GetFocusHdl() const +/*N*/ { +/*N*/ if(pImpl->mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && pImpl->mnFocusIndex < GetHdlCount()) +/*?*/ return GetHdl(pImpl->mnFocusIndex); +/*N*/ else +/*?*/ return 0L; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrHdlList::SdrHdlList(SdrMarkView* pV) +/*N*/ : aList(1024,32,32), +/*N*/ pImpl(new ImplHdlListData(pV)) +/*N*/ //#97016# II +/*N*/ //pView(pV) +/*N*/ { +/*N*/ nHdlSize = 3; +/*N*/ bRotateShear = FALSE; +/*N*/ bMoveOutside = FALSE; +/*N*/ bDistortShear = FALSE; +/*N*/ bFineHandles = FALSE; +/*N*/ } +/*N*/ +/*N*/ SdrHdlList::~SdrHdlList() +/*N*/ { +/*N*/ Clear(); +/*N*/ //#97016# II +/*N*/ delete pImpl; +/*N*/ } + + + +/*N*/ void SdrHdlList::SetRotateShear(BOOL bOn) +/*N*/ { +/*N*/ bRotateShear = bOn; +/*N*/ } + +/*N*/ void SdrHdlList::SetDistortShear(BOOL bOn) +/*N*/ { +/*N*/ bDistortShear = bOn; +/*N*/ } + +/*N*/ void SdrHdlList::SetFineHdl(BOOL bOn) +/*N*/ { +/*N*/ if(bFineHandles != bOn) +/*N*/ { +/*N*/ // remember new state +/*N*/ bFineHandles = bOn; +/*N*/ +/*N*/ // propagate change to IAOs +/*N*/ for(UINT32 i=0; i<GetHdlCount(); i++) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrHdlList::Clear() +/*N*/ { +/*N*/ for (ULONG i=0; i<GetHdlCount(); i++) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ +/*N*/ // immediately remove from display +//STRIP012/*N*/ if(pImpl->pView) +//STRIP012/*N*/ pImpl->pView->RefreshAllIAOManagers(); +/*N*/ +/*N*/ bRotateShear=FALSE; +/*N*/ bDistortShear=FALSE; +/*N*/ } + +/*N*/ void SdrHdlList::Sort() +/*N*/ { +/*N*/ // #97016# II: remember current focused handle +/*N*/ SdrHdl* pPrev = GetFocusHdl(); +/*N*/ +/*N*/ ImpSdrHdlListSorter aSort(aList); +/*N*/ aSort.DoSort(); + + // #97016# II: get now and compare +/*N*/ SdrHdl* pNow = GetFocusHdl(); +/*N*/ +/*N*/ if(pPrev != pNow) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdhlpln.cxx b/binfilter/bf_svx/source/svdraw/svx_svdhlpln.cxx new file mode 100644 index 000000000000..df59f5eed3b0 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdhlpln.cxx @@ -0,0 +1,101 @@ +/* -*- 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 "svdhlpln.hxx" +#include "svdio.hxx" + + + +#include <vcl/window.hxx> + +namespace binfilter { + +/*?*/ SvStream& operator<<(SvStream& rOut, const SdrHelpLine& rHL) +/*?*/ { +/*?*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOHlpLID); +/*?*/ rOut<<UINT16(rHL.eKind); +/*?*/ rOut<<rHL.aPos; +/*?*/ return rOut; +/*?*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrHelpLine& rHL) +/*N*/ { +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ UINT16 nDum; +/*N*/ rIn>>nDum; +/*N*/ rHL.eKind=(SdrHelpLineKind)nDum; +/*N*/ rIn>>rHL.aPos; +/*N*/ return rIn; +/*N*/ } + +/*N*/ void SdrHelpLineList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + +/*N*/ void SdrHelpLineList::operator=(const SdrHelpLineList& rSrcList) +/*N*/ { +/*N*/ Clear(); +/*N*/ USHORT nAnz=rSrcList.GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ Insert(rSrcList[i]); +/*N*/ } +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrHelpLineList& rHLL) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOHLstID); +/*N*/ USHORT nAnz=rHLL.GetCount(); +/*N*/ rOut<<nAnz; +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ rOut<<rHLL[i]; +/*N*/ } +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrHelpLineList& rHLL) +/*N*/ { +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ rHLL.Clear(); +/*N*/ USHORT nAnz; +/*N*/ rIn>>nAnz; +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ SdrHelpLine* pHL=new SdrHelpLine; +/*N*/ rIn>>*pHL; +/*N*/ rHLL.aList.Insert(pHL,CONTAINER_APPEND); +/*N*/ } +/*N*/ return rIn; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdio.cxx b/binfilter/bf_svx/source/svdraw/svx_svdio.cxx new file mode 100644 index 000000000000..0eaf4a73bf1c --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdio.cxx @@ -0,0 +1,647 @@ +/* -*- 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/debug.hxx> + +#include "svdio.hxx" +#include "svdobj.hxx" +#include <osl/endian.h> +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ SdrIOHeader::SdrIOHeader(SvStream& rNewStream, UINT16 nNewMode, const char cID[2], +/*N*/ BOOL bAutoOpen) +/*N*/ : rStream(rNewStream) +/*N*/ { +/*N*/ nFilePos = 0; +/*N*/ nMode = nNewMode; +/*N*/ bOpen = FALSE; +/*N*/ bClosed = FALSE; +/*N*/ bLookAhead = FALSE; +/*N*/ SetID(cID); +/*N*/ nVersion = nAktSdrFileVersion; +/*N*/ nBlkSize = 0; +/*N*/ SetMagic(); +/*N*/ +/*N*/ if(bAutoOpen) +/*N*/ { +/*N*/ OpenRecord(); +/*N*/ } +/*N*/ } + +/*N*/ SdrIOHeader::~SdrIOHeader() +/*N*/ { +/*N*/ if(bOpen && !bClosed && !bLookAhead) +/*N*/ CloseRecord(); +/*N*/ } + +/*N*/ void SdrIOHeader::OpenRecord() +/*N*/ { +/*N*/ if(rStream.GetError()) +/*?*/ return; +/*N*/ +/*N*/ DBG_ASSERT(!bClosed,"SdrIOHeader::OpenRecord(): Record ist bereits geschlossen."); +/*N*/ DBG_ASSERT(!bOpen,"SdrIOHeader::OpenRecord(): Record ist bereits geoeffnet."); +/*N*/ +/*N*/ // Fileposition des Records merken +/*N*/ nFilePos = rStream.Tell(); +/*N*/ +/*N*/ if(nMode==STREAM_READ) +/*N*/ { +/*N*/ // RecordHeader lesen +/*N*/ Read(); +/*N*/ } +/*N*/ else if(nMode == STREAM_WRITE) +/*N*/ { +/*N*/ // Platz fuer RecordHeader schaffen +/*N*/ Write(); +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR("SdrIOHeader::OpenRecord(): Falscher StreamMode angegeben."); +/*N*/ +/*N*/ bOpen = TRUE; +/*N*/ +/*N*/ // Endemarke wird sofort geschlossen. +/*N*/ if(IsEnde() && !bLookAhead) +/*N*/ CloseRecord(); +/*N*/ +/*N*/ if(bLookAhead) +/*N*/ rStream.Seek(nFilePos); +/*N*/ } + +/*N*/ void SdrIOHeader::CloseRecord() +/*N*/ { +/*N*/ if(rStream.GetError()) +/*N*/ return; +/*N*/ +/*N*/ if(bLookAhead) +/*N*/ { +/*?*/ rStream.Seek(nFilePos); +/*?*/ DBG_ERROR("SdrIOHeader::CloseRecord(): CloseRecord im Modus LookAhead."); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT(!bClosed,"SdrIOHeader::CloseRecord(): Record ist bereits geschlossen."); +/*N*/ DBG_ASSERT(bOpen || bClosed,"SdrIOHeader::CloseRecord(): Record ist noch nicht geoeffnet."); +/*N*/ +/*N*/ UINT32 nAktPos(rStream.Tell()); +/*N*/ +/*N*/ if(nMode == STREAM_READ) +/*N*/ { +/*N*/ UINT32 nReadAnz(nAktPos - nFilePos); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ ImpCheckRecordIntegrity(); +/*N*/ #endif +/*N*/ +/*N*/ if(nReadAnz != nBlkSize) +/*N*/ { +/*N*/ // FilePos korregieren +/*N*/ rStream.Seek(nFilePos + nBlkSize); +/*N*/ } +/*N*/ } +/*N*/ else if(nMode == STREAM_WRITE) +/*N*/ { +/*N*/ // Groesse dieses Records (inkl. der Header) +/*N*/ nBlkSize = nAktPos - nFilePos; +/*N*/ // an den Anfang des Records +/*N*/ rStream.Seek(nFilePos); +/*N*/ // Header rausschreiben. +/*N*/ Write(); +/*N*/ // und die FilePos restaurieren. +/*N*/ rStream.Seek(nAktPos); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ ImpCheckRecordIntegrity(); +/*N*/ #endif +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR("SdrIOHeader::CloseRecord(): Falscher StreamMode angegeben."); +/*N*/ +/*N*/ bOpen = FALSE; +/*N*/ bClosed = TRUE; +/*N*/ } + +/*N*/ void SdrIOHeader::Write() +/*N*/ { +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nVersion=SWAPSHORT(nVersion); +/*N*/ nBlkSize=SWAPLONG (nBlkSize); +/*N*/ #endif +/*N*/ +/*N*/ rStream.Write(cMagic, 4); +/*N*/ +/*N*/ if(!IsEnde()) +/*N*/ { +/*N*/ rStream.Write((char*)&nVersion, 2); +/*N*/ rStream.Write((char*)&nBlkSize, 4); +/*N*/ } +/*N*/ +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nVersion=SWAPSHORT(nVersion); +/*N*/ nBlkSize=SWAPLONG (nBlkSize); +/*N*/ #endif +/*N*/ } + + +/*N*/ void SdrIOHeader::Read() +/*N*/ { +/*N*/ rStream.Read(cMagic, 4); +/*N*/ +/*N*/ if(!IsEnde()) +/*N*/ { +/*N*/ rStream.Read((char*)&nVersion, 2); +/*N*/ rStream.Read((char*)&nBlkSize, 4); +/*N*/ +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nVersion=SWAPSHORT(nVersion); +/*N*/ nBlkSize=SWAPLONG (nBlkSize); +/*N*/ #endif +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nBlkSize = 4; +/*N*/ } +/*N*/ } + +/*N*/ UINT32 SdrIOHeader::GetBytesLeft() const +/*N*/ { +/*N*/ if(nMode == STREAM_READ) +/*N*/ { +/*N*/ UINT32 nAktPos(rStream.Tell()); +/*N*/ UINT32 nReadAnz(nAktPos - nFilePos); +/*N*/ +/*N*/ if(nReadAnz <= nBlkSize) +/*N*/ return nBlkSize - nReadAnz; +/*N*/ else +/*N*/ // Fehler, zuviel gelesen! +/*N*/ return 0; +/*N*/ } +/*N*/ else +/*?*/ return 0; +/*N*/ } + +#ifdef DBG_UTIL + +/*N*/ void SdrIOHeader::ImpGetRecordName(ByteString& rStr, INT32 nSubRecCount, +/*N*/ INT32 nSubRecReadCount) const +/*N*/ { +/*N*/ rStr = "CheckRecordIntegrity (ID="; +/*N*/ rStr += cMagic[0]; +/*N*/ rStr += cMagic[1]; +/*N*/ rStr += cHdrID[0]; +/*N*/ rStr += cHdrID[1]; +/*N*/ rStr += ')'; +/*N*/ +/*N*/ if(nSubRecCount != -1) +/*N*/ { +/*N*/ rStr += " ("; +/*N*/ +/*N*/ if(nSubRecReadCount != -1) +/*N*/ { +/*N*/ rStr += ByteString::CreateFromInt32( nSubRecReadCount ); +/*N*/ rStr += " von "; +/*N*/ rStr += ByteString::CreateFromInt32( nSubRecCount ); +/*N*/ rStr += " Records gelesen)"; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rStr += ByteString::CreateFromInt32( nSubRecCount ); +/*N*/ rStr += " Records)"; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrIOHeader::ImpHasSubRecords() const +/*N*/ { +/*N*/ // nicht jeder Record hat SubRecords +/*N*/ return IsID(SdrIOModlID) || +/*N*/ IsID(SdrIOPageID) || +/*N*/ IsID(SdrIOMaPgID) || +/*N*/ IsID(SdrIODObjID); +/*N*/ } + +// Testet die Integritaet eines Records. Innerhalb eines Records +// muessen alle Daten in Subrecords (SdrDownCompat) untergebracht sein. + +/*N*/ void SdrIOHeader::ImpCheckRecordIntegrity() +/*N*/ { +/*N*/ UINT32 nFilePos0(rStream.Tell()); +/*N*/ +/*N*/ if(IsMagic() && ImpHasSubRecords()) +/*N*/ { +/*N*/ // nicht jeder Record hat SubRecords +/*N*/ // Seek an den Recordanfang +/*N*/ rStream.Seek(nFilePos); +/*N*/ Read(); +/*N*/ +/*N*/ // Anzahl der vorhandenen SubRecords +/*N*/ UINT32 nHasSubRecCount(0); +/*N*/ // Anzahl der SubRecords bis nFilePos0 +/*N*/ UINT32 nReadSubRecCount(0); +/*N*/ UINT32 nAktFilePos(rStream.Tell()); +/*N*/ BOOL bFilePos0Hit(nAktFilePos == nFilePos0); +/*N*/ +/*N*/ while(!rStream.GetError() && !rStream.IsEof() && nAktFilePos < nFilePos + nBlkSize) +/*N*/ { +/*N*/ UINT32 nSubRecSiz; +/*N*/ +/*N*/ nHasSubRecCount++; +/*N*/ rStream >> nSubRecSiz; +/*N*/ nAktFilePos += nSubRecSiz; +/*N*/ rStream.Seek(nAktFilePos); +/*N*/ +/*N*/ if(nAktFilePos <= nFilePos0) +/*N*/ nReadSubRecCount++; +/*N*/ +/*N*/ if(nAktFilePos == nFilePos0) +/*N*/ // Aha, nFilePos0 ist ok. +/*N*/ bFilePos0Hit = TRUE; +/*N*/ } +/*N*/ +/*N*/ ByteString aStr; +/*N*/ +/*N*/ if(nAktFilePos != nFilePos+nBlkSize) +/*N*/ aStr += "- SubRecord-Strukturfehler.\n"; +/*N*/ +/*N*/ if(nFilePos0 > nAktFilePos) +/*N*/ { +/*?*/ UINT32 nToMuch(nFilePos0 - nAktFilePos); +/*?*/ +/*?*/ aStr += "- "; +/*?*/ +/*?*/ if(nToMuch == 1) +/*?*/ aStr += "1 Byte"; +/*?*/ else +/*?*/ { +/*?*/ aStr += ByteString::CreateFromInt32( nToMuch ); +/*?*/ aStr += " Bytes"; +/*?*/ } +/*?*/ +/*?*/ aStr += " zuviel gelesen.\n"; +/*N*/ } + +/*N*/ if(!bFilePos0Hit) +/*N*/ aStr += "- Aktuelle Fileposition liegt nicht am Ende eines SubRecords.\n"; +/*N*/ +/*N*/ if(aStr.Len()) +/*N*/ { +/*?*/ ByteString aStr2; +/*?*/ +/*?*/ aStr.Insert(":\n", 0); +/*?*/ ImpGetRecordName(aStr2, nHasSubRecCount, nReadSubRecCount); +/*?*/ aStr.Insert(aStr2, 0); +/*?*/ DBG_ERROR(aStr.GetBuffer()); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // keine SubRecords vorhanden, also nur FilePos pruefen +/*N*/ if(nFilePos0 > nFilePos + nBlkSize) +/*N*/ { +/*?*/ ByteString aStr; +/*?*/ UINT32 nToMuch(nFilePos0 - nFilePos+nBlkSize); +/*?*/ +/*?*/ ImpGetRecordName(aStr); +/*?*/ aStr += ":\nAus dem Record wurde"; +/*?*/ +/*?*/ if(nToMuch == 1) +/*?*/ aStr += "1 Byte"; +/*?*/ else +/*?*/ { +/*?*/ aStr += "n "; +/*?*/ aStr += ByteString::CreateFromInt32( nToMuch ); +/*?*/ aStr += " Bytes"; +/*?*/ } +/*?*/ +/*?*/ aStr += " zuviel gelesen. FilePos wird korregiert"; +/*?*/ +/*?*/ DBG_ERROR(aStr.GetBuffer()); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Fileposition restaurieren +/*N*/ rStream.Seek(nFilePos0); +/*N*/ } +#endif + +/*N*/ SdrIOHeaderLookAhead::SdrIOHeaderLookAhead(SvStream& rNewStream, BOOL bAutoOpen) +/*N*/ : SdrIOHeader(rNewStream, STREAM_READ, SdrIOEndeID, FALSE) +/*N*/ { +/*N*/ bLookAhead = TRUE; +/*N*/ +/*N*/ if(bAutoOpen) +/*N*/ { +/*N*/ OpenRecord(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObjIOHeader::SdrObjIOHeader(SvStream& rNewStream, UINT16 nNewMode, +/*N*/ const SdrObject* pNewObj, BOOL bAutoOpen) +/*N*/ : SdrIOHeader(rNewStream, nNewMode, SdrIODObjID, FALSE), +/*N*/ pObj(pNewObj) +/*N*/ { +/*N*/ if(pNewObj) +/*N*/ { +/*N*/ nInventor = pNewObj->GetObjInventor(); +/*N*/ nIdentifier = pNewObj->GetObjIdentifier(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nInventor = 0; +/*N*/ nIdentifier = 0; +/*N*/ } +/*N*/ +/*N*/ if(bAutoOpen) +/*N*/ { +/*N*/ OpenRecord(); +/*N*/ } +/*N*/ } + +/*N*/ SdrObjIOHeader::~SdrObjIOHeader() +/*N*/ { +/*N*/ if(bOpen && !bClosed && !bLookAhead) +/*N*/ CloseRecord(); +/*N*/ } + +/*N*/ void SdrObjIOHeader::Write() +/*N*/ { +/*N*/ SdrIOHeader::Write(); +/*N*/ +/*N*/ if(!IsEnde()) +/*N*/ { +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ #endif +/*N*/ rStream.Write((char*)&nInventor, 4); +/*N*/ rStream.Write((char*)&nIdentifier, 2); +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ #endif +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjIOHeader::Read() +/*N*/ { +/*N*/ SdrIOHeader::Read(); +/*N*/ +/*N*/ if(!IsEnde()) +/*N*/ { +/*N*/ rStream.Read((char*)&nInventor, 4); +/*N*/ rStream.Read((char*)&nIdentifier, 2); +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ #endif +/*N*/ } +/*N*/ } + +/*N*/ SdrObjIOHeaderLookAhead::SdrObjIOHeaderLookAhead(SvStream& rNewStream, +/*N*/ BOOL bAutoOpen) +/*N*/ : SdrObjIOHeader(rNewStream, STREAM_READ, NULL, FALSE) +/*N*/ { +/*N*/ bLookAhead = TRUE; +/*N*/ +/*N*/ if(bAutoOpen) +/*N*/ { +/*N*/ OpenRecord(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrDownCompat::SdrDownCompat(SvStream& rNewStream, UINT16 nNewMode, BOOL bAutoOpen) +/*N*/ : rStream(rNewStream), +/*N*/ nSubRecSiz(0), +/*N*/ nSubRecPos(0), +/*N*/ nMode(nNewMode), +/*N*/ bOpen(FALSE), +/*N*/ bClosed(FALSE), +/*N*/ pRecId(NULL) +/*N*/ { +/*N*/ if(bAutoOpen) +/*N*/ OpenSubRecord(); +/*N*/ } + +/*N*/ SdrDownCompat::~SdrDownCompat() +/*N*/ { +/*N*/ if(!bClosed) +/*N*/ CloseSubRecord(); +/*N*/ } + +/*N*/ void SdrDownCompat::Read() +/*N*/ { +/*N*/ // Subrecordgroesse auslesen +/*N*/ rStream >> nSubRecSiz; +/*N*/ } + +/*N*/ void SdrDownCompat::Write() +/*N*/ { +/*N*/ // Platz fuer Groessenangabe schaffen +/*N*/ rStream << nSubRecSiz; +/*N*/ } + +/*N*/ void SdrDownCompat::OpenSubRecord() +/*N*/ { +/*N*/ if(rStream.GetError()) +/*N*/ return; +/*N*/ +/*N*/ DBG_ASSERT(!bClosed,"SdrDownCompat::OpenSubRecord(): Record ist bereits geschlossen."); +/*N*/ DBG_ASSERT(!bOpen,"SdrDownCompat::OpenSubRecord(): Record ist bereits geoeffnet."); +/*N*/ +/*N*/ // Fileposition des Records merken +/*N*/ nSubRecPos = rStream.Tell(); +/*N*/ +/*N*/ if(nMode == STREAM_READ) +/*N*/ { +/*N*/ // Subrecordgroesse auslesen +/*N*/ Read(); +/*N*/ } +/*N*/ else if(nMode == STREAM_WRITE) +/*N*/ { +/*N*/ // Platz fuer Groessenangabe schaffen +/*N*/ Write(); +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR("SdrDownCompat::OpenSubRecord(): Falscher StreamMode angegeben."); +/*N*/ +/*N*/ bOpen = TRUE; +/*N*/ } + +/*N*/ void SdrDownCompat::CloseSubRecord() +/*N*/ { +/*N*/ if(rStream.GetError()) +/*?*/ return; +/*N*/ +/*N*/ DBG_ASSERT(!bClosed,"SdrDownCompat::CloseSubRecord(): Record ist bereits geschlossen."); +/*N*/ DBG_ASSERT(bOpen || bClosed,"SdrDownCompat::CloseSubRecord(): Record ist noch nicht geoeffnet."); +/*N*/ +/*N*/ UINT32 nAktPos(rStream.Tell()); +/*N*/ +/*N*/ if(nMode == STREAM_READ) +/*N*/ { +/*N*/ UINT32 nReadAnz(nAktPos - nSubRecPos); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ if(nReadAnz > nSubRecSiz) +/*N*/ { +/*?*/ ByteString aErrMsg("SdrDownCompat::CloseSubRecord(), "); +/*?*/ +/*?*/ aErrMsg += "RedordID"; +/*?*/ +/*?*/ if(!pRecId) +/*?*/ aErrMsg += " unbekannt"; +/*?*/ else +/*?*/ { +/*?*/ aErrMsg += '='; +/*?*/ aErrMsg += pRecId; +/*?*/ } +/*?*/ +/*?*/ aErrMsg += ":\nAus dem Record wurde"; +/*?*/ +/*?*/ UINT32 nToMuch(nReadAnz - nSubRecSiz); +/*?*/ +/*?*/ if(nToMuch == 1) +/*?*/ aErrMsg += " 1 Byte"; +/*?*/ else +/*?*/ { +/*?*/ aErrMsg += "n "; +/*?*/ aErrMsg += ByteString::CreateFromInt32( nToMuch ); +/*?*/ aErrMsg += " Bytes"; +/*?*/ } +/*?*/ +/*?*/ aErrMsg += " zuviel gelesen, FilePos korregiert."; +/*?*/ +/*?*/ DBG_ERROR(aErrMsg.GetBuffer()); +/*N*/ } +#endif + +/*N*/ if(nReadAnz != nSubRecSiz) +/*N*/ { +/*N*/ // den Rest ueberspringen +/*N*/ rStream.Seek(nSubRecPos + nSubRecSiz); +/*N*/ } +/*N*/ } +/*N*/ else if(nMode == STREAM_WRITE) +/*N*/ { +/*N*/ // Groesse dieses SubRecords (inkl. der Groessenangabe selbst) +/*N*/ nSubRecSiz = nAktPos - nSubRecPos; +/*N*/ +/*N*/ // an den Anfang des Records +/*N*/ rStream.Seek(nSubRecPos); +/*N*/ // rausschreiben. +/*N*/ Write(); +/*N*/ // und die FilePos restaurieren. +/*N*/ rStream.Seek(nAktPos); +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR("SdrDownCompat::CloseSubRecord(): Falscher StreamMode angegeben."); +/*N*/ +/*N*/ bOpen = FALSE; +/*N*/ bClosed = TRUE; +/*N*/ } + +/*N*/ UINT32 SdrDownCompat::GetBytesLeft() const +/*N*/ { +/*N*/ if(nMode == STREAM_READ) +/*N*/ { +/*N*/ UINT32 nAktPos(rStream.Tell()); +/*N*/ UINT32 nReadAnz(nAktPos - nSubRecPos); +/*N*/ +/*N*/ if(nReadAnz <= nSubRecSiz) +/*N*/ return nSubRecSiz - nReadAnz; +/*N*/ else +/*N*/ // Fehler, zuviel gelesen! +/*N*/ return 0; +/*N*/ } +/*N*/ else +/*N*/ return 0; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrNamedSubRecord::SdrNamedSubRecord(SvStream& rNewStream, UINT16 nNewMode, +/*N*/ UINT32 nNewInventor, UINT16 nNewIdentifier, +/*N*/ BOOL bAutoOpen) +/*N*/ : SdrDownCompat(rNewStream, nNewMode, FALSE), +/*N*/ nInventor(nNewInventor), +/*N*/ nIdentifier(nNewIdentifier) +/*N*/ { +/*N*/ DBG_ASSERT(nNewMode==STREAM_READ || (nNewInventor!=0xFFFF && nNewInventor!=0xFFFF), +/*N*/ "SdrNamedSubRecord: bei Write muss Inventor und Identifier angegeben werden"); +/*N*/ +/*N*/ if(bAutoOpen) +/*N*/ OpenSubRecord(); +/*N*/ } + +/*N*/ void SdrNamedSubRecord::Read() +/*N*/ { +/*N*/ SdrDownCompat::Read(); +/*N*/ +/*N*/ rStream.Read((char*)&nInventor, 4); +/*N*/ rStream.Read((char*)&nIdentifier, 2); +/*N*/ +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ #endif +/*N*/ } + +/*N*/ void SdrNamedSubRecord::Write() +/*N*/ { +/*N*/ SdrDownCompat::Write(); +/*N*/ +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ #endif +/*N*/ +/*N*/ rStream.Write((char*)&nInventor, 4); +/*N*/ rStream.Write((char*)&nIdentifier, 2); +/*N*/ +/*N*/ #ifdef OSL_BIGENDIAN +/*N*/ nIdentifier = SWAPSHORT(nIdentifier); +/*N*/ nInventor = SWAPLONG(nInventor); +/*N*/ #endif +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svditer.cxx b/binfilter/bf_svx/source/svdraw/svx_svditer.cxx new file mode 100644 index 000000000000..864df0bb150e --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svditer.cxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "svditer.hxx" + + + +// #99190# +#include "scene3d.hxx" +namespace binfilter { + +/*N*/ SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bReverse) +/*N*/ : maObjList(1024, 64, 64), +/*N*/ mnIndex(0L), +/*N*/ mbReverse(bReverse) +/*N*/ { +/*N*/ ImpProcessObjectList(rObjList, eMode); +/*N*/ Reset(); +/*N*/ } + +/*N*/ SdrObjListIter::SdrObjListIter(const SdrObject& rGroup, SdrIterMode eMode, BOOL bReverse) +/*N*/ : maObjList(1024, 64, 64), +/*N*/ mnIndex(0L), +/*N*/ mbReverse(bReverse) +/*N*/ { +/*N*/ ImpProcessObjectList(*rGroup.GetSubList(), eMode); +/*N*/ Reset(); +/*N*/ } + +/*N*/ void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode) +/*N*/ { +/*N*/ for(sal_uInt32 a(0L); a < rObjList.GetObjCount(); a++) +/*N*/ { +/*N*/ SdrObject* pObj = rObjList.GetObj(a); +/*N*/ sal_Bool bIsGroup(pObj->IsGroupObject()); +/*N*/ +/*N*/ // #99190# 3D objects are no group objects, IsGroupObject() +/*N*/ // only tests if pSub is not null ptr :-( +/*N*/ if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene)) +/*N*/ bIsGroup = sal_False; +/*N*/ +/*N*/ if(eMode != IM_DEEPNOGROUPS || !bIsGroup) +/*N*/ maObjList.Insert(pObj, LIST_APPEND); +/*N*/ +/*N*/ if(bIsGroup && eMode != IM_FLAT) +/*N*/ ImpProcessObjectList(*pObj->GetSubList(), eMode); +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdlayer.cxx b/binfilter/bf_svx/source/svdraw/svx_svdlayer.cxx new file mode 100644 index 000000000000..86e077e25057 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdlayer.cxx @@ -0,0 +1,387 @@ +/* -*- 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 "svdlayer.hxx" +#include "svdio.hxx" +#include "svdmodel.hxx" // fuer Broadcasting +#include "svdstr.hrc" // Namen aus der Resource +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// SetOfByte +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FASTBOOL SetOfByte::IsEmpty() const +/*N*/ { +/*N*/ for (USHORT i=0; i<32; i++) { +/*N*/ if (aData[i]!=0) return FALSE; +/*N*/ } +/*N*/ return TRUE; +/*N*/ } + + + + + + +/*N*/ void SetOfByte::operator&=(const SetOfByte& r2ndSet) +/*N*/ { +/*N*/ for (unsigned i=0; i<32; i++) { +/*N*/ aData[i]&=r2ndSet.aData[i]; +/*N*/ } +/*N*/ } + + +/** initialize this set with a uno sequence of sal_Int8 +*/ +/*N*/ void SetOfByte::PutValue( const ::com::sun::star::uno::Any & rAny ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; +/*N*/ if( rAny >>= aSeq ) +/*N*/ { +/*N*/ sal_Int16 nCount = (sal_Int16)aSeq.getLength(); +/*N*/ if( nCount > 32 ) +/*N*/ nCount = 32; +/*N*/ +/*N*/ sal_Int16 nIndex; +/*N*/ for( nIndex = 0; nIndex < nCount; nIndex++ ) +/*N*/ { +/*N*/ aData[nIndex] = static_cast<BYTE>(aSeq[nIndex]); +/*N*/ } +/*N*/ +/*N*/ for( ; nIndex < 32; nIndex++ ) +/*N*/ { +/*N*/ aData[nIndex] = 0; +/*N*/ } +/*N*/ } +/*N*/ } + +/** returns a uno sequence of sal_Int8 +*/ +/*N*/ void SetOfByte::QueryValue( ::com::sun::star::uno::Any & rAny ) const +/*N*/ { +/*N*/ sal_Int16 nNumBytesSet = 0; +/*N*/ sal_Int16 nIndex; +/*N*/ for( nIndex = 31; nIndex >= 00; nIndex-- ) +/*N*/ { +/*N*/ if( 0 != aData[nIndex] ) +/*N*/ { +/*N*/ nNumBytesSet = nIndex + 1; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( nNumBytesSet ); +/*N*/ +/*N*/ for( nIndex = 0; nIndex < nNumBytesSet; nIndex++ ) +/*N*/ { +/*N*/ aSeq[nIndex] = static_cast<sal_Int8>(aData[nIndex]); +/*N*/ } +/*N*/ +/*N*/ rAny <<= aSeq; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// SdrLayer +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ void SdrLayer::SetName(const XubString& rNewName) +/*N*/ { +/*N*/ if(!rNewName.Equals(aName)) +/*N*/ { +/*N*/ aName = rNewName; +/*N*/ nType = 0; // Userdefined +/*N*/ +/*N*/ if(pModel) +/*N*/ { +/*N*/ SdrHint aHint(HINT_LAYERCHG); +/*N*/ +/*N*/ pModel->Broadcast(aHint); +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrLayer& rLayer) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*?*/ return rIn; +/*N*/ +/*N*/ SdrIOHeader aHead(rIn, STREAM_READ); +/*N*/ +/*N*/ rIn >> rLayer.nID; +/*N*/ +/*N*/ // UNICODE: rIn >> rLayer.aName; +/*N*/ rIn.ReadByteString(rLayer.aName); +/*N*/ +/*N*/ if(aHead.GetVersion() >= 1) +/*N*/ { +/*N*/ // Das Standardlayerflag kam direkt nach der Betalieferung dazu +/*N*/ rIn >> rLayer.nType; +/*N*/ +/*N*/ if(rLayer.nType == 1) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(aHead.GetVersion() <= 12) +/*N*/ { +/*N*/ // nType war lange Zeit nicht initiallisiert! +/*N*/ if(rLayer.nType > 1) +/*N*/ rLayer.nType = 0; +/*N*/ } +/*N*/ +/*N*/ return rIn; +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrLayer& rLayer) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut, STREAM_WRITE, SdrIOLayrID); +/*N*/ +/*N*/ rOut << rLayer.nID; +/*N*/ +/*N*/ // UNICODE: rOut << rLayer.aName; +/*N*/ rOut.WriteByteString(rLayer.aName); +/*N*/ +/*N*/ rOut << rLayer.nType; +/*N*/ +/*N*/ return rOut; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// SdrLayerSet +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/*?*/ SvStream& operator>>(SvStream& rIn, SdrLayerSet& rSet) +/*?*/ { +/*?*/ if(rIn.GetError()) +/*?*/ return rIn; +/*?*/ +/*?*/ SdrIOHeader aHead(rIn, STREAM_READ); +/*?*/ +/*?*/ rIn >> rSet.aMember; +/*?*/ rIn >> rSet.aExclude; +/*?*/ +/*?*/ // UNICODE: rIn >> rSet.aName; +/*?*/ rIn.ReadByteString(rSet.aName); +/*?*/ +/*?*/ return rIn; +/*?*/ } + +/*?*/ SvStream& operator<<(SvStream& rOut, const SdrLayerSet& rSet) +/*?*/ { +/*?*/ SdrIOHeader aHead(rOut, STREAM_WRITE, SdrIOLSetID); +/*?*/ +/*?*/ rOut << rSet.aMember; +/*?*/ rOut << rSet.aExclude; +/*?*/ +/*?*/ // UNICODE: rOut << rSet.aName; +/*?*/ rOut.WriteByteString(rSet.aName); +/*?*/ +/*?*/ return rOut; +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// SdrLayerAdmin +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrLayerAdmin::SdrLayerAdmin(SdrLayerAdmin* pNewParent): +/*N*/ aLayer(1024,16,16), +/*N*/ aLSets(1024,16,16), +/*N*/ pModel(NULL) +/*N*/ { +/*N*/ sal_Char aTextControls[] = "Controls"; +/*N*/ aControlLayerName = String(aTextControls, sizeof(aTextControls-1)); +/*N*/ pParent=pNewParent; +/*N*/ } + +/*?*/ SdrLayerAdmin::SdrLayerAdmin(const SdrLayerAdmin& rSrcLayerAdmin): +/*?*/ aLayer(1024,16,16), +/*?*/ aLSets(1024,16,16), +/*?*/ pParent(NULL), +/*?*/ pModel(NULL) +/*?*/ { +/*?*/ sal_Char aTextControls[] = "Controls"; +/*?*/ aControlLayerName = String(aTextControls, sizeof(aTextControls-1)); +/*?*/ *this = rSrcLayerAdmin; +/*?*/ } + +/*N*/ SdrLayerAdmin::~SdrLayerAdmin() +/*N*/ { +/*N*/ ClearLayer(); +/*N*/ ClearLayerSets(); +/*N*/ } + +/*N*/ void SdrLayerAdmin::ClearLayer() +/*N*/ { +/*N*/ SdrLayer* pL; +/*N*/ pL=(SdrLayer*)aLayer.First(); +/*N*/ while (pL!=NULL) { +/*N*/ delete pL; +/*N*/ pL=(SdrLayer*)aLayer.Next(); +/*N*/ } +/*N*/ aLayer.Clear(); +/*N*/ } + +/*N*/ void SdrLayerAdmin::ClearLayerSets() +/*N*/ { +/*N*/ SdrLayerSet* pL; +/*N*/ pL=(SdrLayerSet*)aLSets.First(); +/*N*/ while (pL!=NULL) { +/*?*/ delete pL; +/*?*/ pL=(SdrLayerSet*)aLSets.Next(); +/*N*/ } +/*N*/ aLSets.Clear(); +/*N*/ } + + + +/*N*/ void SdrLayerAdmin::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ if (pNewModel!=pModel) { +/*N*/ pModel=pNewModel; +/*N*/ USHORT nAnz=GetLayerCount(); +/*N*/ USHORT i; +/*N*/ for (i=0; i<nAnz; i++) { +/*?*/ GetLayer(i)->SetModel(pNewModel); +/*N*/ } +/*N*/ nAnz=GetLayerSetCount(); +/*N*/ for (i=0; i<nAnz; i++) { +/*?*/ GetLayerSet(i)->SetModel(pNewModel); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrLayerAdmin::Broadcast(FASTBOOL bLayerSet) const +/*N*/ { +/*N*/ if (pModel!=NULL) { +/*N*/ SdrHint aHint(bLayerSet ? HINT_LAYERSETORDERCHG : HINT_LAYERORDERCHG); +/*N*/ pModel->Broadcast(aHint); +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ } + +/*N*/ SdrLayer* SdrLayerAdmin::NewLayer(const XubString& rName, USHORT nPos) +/*N*/ { +/*N*/ SdrLayerID nID=GetUniqueLayerID(); +/*N*/ SdrLayer* pLay=new SdrLayer(nID,rName); +/*N*/ pLay->SetModel(pModel); +/*N*/ aLayer.Insert(pLay,nPos); +/*N*/ Broadcast(FALSE); +/*N*/ return pLay; +/*N*/ } + + + + + +/*N*/ const SdrLayer* SdrLayerAdmin::GetLayer(const XubString& rName, FASTBOOL bInherited) const +/*N*/ { +/*N*/ UINT16 i(0); +/*N*/ const SdrLayer* pLay = NULL; +/*N*/ +/*N*/ while(i < GetLayerCount() && !pLay) +/*N*/ { +/*N*/ if(rName.Equals(GetLayer(i)->GetName())) +/*N*/ pLay = GetLayer(i); +/*N*/ else +/*N*/ i++; +/*N*/ } +/*N*/ +/*N*/ if(!pLay && pParent) +/*N*/ { +/*N*/ pLay = pParent->GetLayer(rName, TRUE); +/*N*/ } +/*N*/ +/*N*/ return pLay; +/*N*/ } + +/*N*/ SdrLayerID SdrLayerAdmin::GetLayerID(const XubString& rName, FASTBOOL bInherited) const +/*N*/ { +/*N*/ SdrLayerID nRet=SDRLAYER_NOTFOUND; +/*N*/ const SdrLayer* pLay=GetLayer(rName,bInherited); +/*N*/ if (pLay!=NULL) nRet=pLay->GetID(); +/*N*/ return nRet; +/*N*/ } + +/*N*/ const SdrLayer* SdrLayerAdmin::GetLayerPerID(USHORT nID) const +/*N*/ { +/*N*/ USHORT i=0; +/*N*/ const SdrLayer* pLay=NULL; +/*N*/ while (i<GetLayerCount() && pLay==NULL) { +/*N*/ if (nID==GetLayer(i)->GetID()) pLay=GetLayer(i); +/*N*/ else i++; +/*N*/ } +/*N*/ return pLay; +/*N*/ } + +// Globale LayerID's beginnen mit 0 aufsteigend. +// Lokale LayerID's beginnen mit 254 absteigend. +// 255 ist reserviert fuer SDRLAYER_NOTFOUND + +/*N*/ SdrLayerID SdrLayerAdmin::GetUniqueLayerID() const +/*N*/ { +/*N*/ SetOfByte aSet; +/*N*/ sal_Bool bDown = (pParent == NULL); +/*N*/ sal_Int32 j; +/*N*/ for (j=0; j<GetLayerCount(); j++) +/*N*/ { +/*N*/ aSet.Set(GetLayer(j)->GetID()); +/*N*/ } +/*N*/ SdrLayerID i; +/*N*/ if (!bDown) +/*N*/ { +/*N*/ i=254; +/*N*/ while (i && aSet.IsSet(BYTE(i))) +/*N*/ --i; +/*N*/ if (i == 0) +/*N*/ i=254; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ i=0; +/*N*/ while (i<=254 && aSet.IsSet(BYTE(i))) +/*N*/ i++; +/*N*/ if (i>254) +/*N*/ i=0; +/*N*/ } +/*N*/ return i; +/*N*/ } + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdmark.cxx b/binfilter/bf_svx/source/svdraw/svx_svdmark.cxx new file mode 100644 index 000000000000..be4fbbff9bdf --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdmark.cxx @@ -0,0 +1,212 @@ +/* -*- 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 "svdmark.hxx" +#include "svdorect.hxx" // GetMarkDescription +#include "svdstr.hrc" // Namen aus der Resource +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkList::ForceSort() +/*N*/ { +/*N*/ if (!bSorted) { +/*N*/ bSorted=TRUE; +/*N*/ ULONG nAnz=aList.Count(); +/*N*/ if (nAnz>1) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrMarkList::Clear() +/*N*/ { +/*N*/ for (ULONG i=0; i<GetMarkCount(); i++) { +/*?*/ SdrMark* pMark=GetMark(i); +/*?*/ delete pMark; +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ SetNameDirty(); +/*N*/ } + +/*N*/ void SdrMarkList::operator=(const SdrMarkList& rLst) +/*N*/ { +/*N*/ Clear(); +/*N*/ for (ULONG i=0; i<rLst.GetMarkCount(); i++) { +/*?*/ SdrMark* pMark=rLst.GetMark(i); +/*?*/ SdrMark* pNeuMark=new SdrMark(*pMark); +/*?*/ aList.Insert(pNeuMark,CONTAINER_APPEND); +/*N*/ } +/*N*/ aMarkName=rLst.aMarkName; +/*N*/ bNameOk=rLst.bNameOk; +/*N*/ aPointName=rLst.aPointName; +/*N*/ bPointNameOk=rLst.bPointNameOk; +/*N*/ aGluePointName=rLst.aGluePointName; +/*N*/ bGluePointNameOk=rLst.bGluePointNameOk; +/*N*/ bSorted=rLst.bSorted; +/*N*/ } + +/*N*/ ULONG SdrMarkList::FindObject(const SdrObject* pObj) +/*N*/ { + // #109658# + // + // Since relying on OrdNums is not allowed for the selection because objects in the + // selection may not be inserted in a list if they are e.g. modified ATM, i changed + // this loop to just look if the object pointer is in the selection. + // + // Problem is that GetOrdNum() which is const, internally casts no non-const and + // hardly sets the OrdNum member of the object (nOrdNum) to 0 (ZERO) if the object + // is not inserted in a object list. + // Since this may be by purpose and necessary somewhere else i decided that it is + // less dangerous to change this method then changing SdrObject::GetOrdNum(). +/*N*/ if(pObj && aList.Count()) +/*N*/ { +/*N*/ for(sal_uInt32 a(0L); a < aList.Count(); a++) +/*N*/ { +/*N*/ if(((SdrMark*)(aList.GetObject(a)))->GetObj() == pObj) +/*N*/ { +/*N*/ return a; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return CONTAINER_ENTRY_NOTFOUND; + + /* + ForceSort(); + if (pObj==NULL || aList.Count()==0) return CONTAINER_ENTRY_NOTFOUND; + const SdrObjList* pOL=pObj->GetObjList(); + ULONG nObjOrd=pObj->GetOrdNum(); + ULONG nL=0; + ULONG nR=aList.Count(); + if (GetMark(nL)->GetObj()==pObj) return nL; + while (nL+1<nR) { // Der Gesuchte befindet sich zwischen, nicht auf den Grenzen! + ULONG nMid=(nL+nR)/2; + const SdrObject* pMidObj=GetMark(nMid)->GetObj(); + if (pMidObj==pObj) return nMid; // Hurra, gefunden! + const SdrObjList* pMidOL=pMidObj!=NULL ? pMidObj->GetObjList() : NULL; + ULONG nMidObjOrd=pMidObj!=NULL ? pMidObj->GetOrdNum() : 0; + if (pMidOL==pOL) { + if (nMidObjOrd<nObjOrd) nL=nMid; + else if (nMidObjOrd>nObjOrd) nR=nMid; + else { + DBG_ASSERT(FALSE,"SdrMarkList::FindObject(): Anderes Objekt mit gleicher OrdNum gefunden!"); + return CONTAINER_ENTRY_NOTFOUND; + } + } else if ((long)pMidOL<(long)pOL) nL=nMid; + else nR=nMid; + } + return CONTAINER_ENTRY_NOTFOUND; + */ +/*N*/ } + +/*N*/ void SdrMarkList::InsertEntry(const SdrMark& rMark, FASTBOOL bChkSort) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + + + +/*N*/ FASTBOOL SdrMarkList::DeletePageView(const SdrPageView& rPV) +/*N*/ { +/*N*/ FASTBOOL bChgd=FALSE; +/*N*/ for (ULONG i=GetMarkCount(); i>0;) { +/*?*/ i--; +/*?*/ SdrMark* pMark=GetMark(i); +/*?*/ if (pMark->GetPageView()==&rPV) { +/*?*/ aList.Remove(i); +/*?*/ delete pMark; +/*?*/ SetNameDirty(); +/*?*/ bChgd=TRUE; +/*?*/ } +/*N*/ } +/*N*/ return bChgd; +/*N*/ } + + + + + + +/*N*/ FASTBOOL SdrMarkList::TakeBoundRect(SdrPageView* pPV, Rectangle& rRect) const +/*N*/ { +/*N*/ FASTBOOL bFnd=FALSE; +/*N*/ Rectangle aR; +/*N*/ +/*N*/ for (ULONG i=0; i<GetMarkCount(); i++) { +/*?*/ SdrMark* pMark=GetMark(i); +/*?*/ if (pPV==NULL || pMark->GetPageView()==pPV) { +/*?*/ aR=pMark->GetObj()->GetBoundRect(); +/*?*/ if (bFnd) { +/*?*/ rRect.Union(aR); +/*?*/ } else { +/*?*/ rRect=aR; +/*?*/ bFnd=TRUE; +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ return bFnd; +/*N*/ } + +/*N*/ FASTBOOL SdrMarkList::TakeSnapRect(SdrPageView* pPV, Rectangle& rRect) const +/*N*/ { +/*N*/ FASTBOOL bFnd=FALSE; +/*N*/ +/*N*/ for (ULONG i=0; i<GetMarkCount(); i++) { +/*?*/ SdrMark* pMark=GetMark(i); +/*?*/ if (pPV==NULL || pMark->GetPageView()==pPV) { +/*?*/ Rectangle aR(pMark->GetObj()->GetSnapRect()); +/*?*/ if (bFnd) { +/*?*/ rRect.Union(aR); +/*?*/ } else { +/*?*/ rRect=aR; +/*?*/ bFnd=TRUE; +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ return bFnd; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdmodel.cxx b/binfilter/bf_svx/source/svdraw/svx_svdmodel.cxx new file mode 100644 index 000000000000..09353c0de3f5 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdmodel.cxx @@ -0,0 +1,2245 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <rtl/logfile.hxx> + +#include "svdmodel.hxx" + + +#include <bf_svtools/whiter.hxx> + +#include "xit.hxx" + +#include <xdef.hxx> + +#include "xbtmpit.hxx" +#include "xlndsit.hxx" +#include "xlnedit.hxx" +#include "xflftrit.hxx" +#include "xflhtit.hxx" +#include "xlnstit.hxx" + + +#include "editeng.hxx" // Fuer EditEngine::CreatePool() + +#include "xtable.hxx" + +#include "svditer.hxx" +#include "svdio.hxx" +#include "svdpage.hxx" +#include "svdundo.hxx" +#include "svdpool.hxx" +#include "svdetc.hxx" +#include "svdoutl.hxx" +#include "svdoole2.hxx" +#include "svdstr.hrc" // Objektname +#include "svdoutlinercache.hxx" + +#include <eeitemid.hxx> + +#ifndef SVX_LIGHT +#include "asiancfg.hxx" +#endif + +#include "eeitem.hxx" + +#include "fontitem.hxx" + +#include "colritem.hxx" + +#include "fhgtitem.hxx" + +#include <bf_svtools/style.hxx> + +#include <tools/bigint.hxx> + + + + +#include "forbiddencharacterstable.hxx" + +#include <bf_so3/persist.hxx> + +#include <bf_svtools/zforlist.hxx> + + +// #90477# +#include <tools/tenccvt.hxx> + + +// #95114# +#include <vcl/svapp.hxx> + +#include <osl/endian.h> + +namespace binfilter { + +using namespace ::com::sun::star; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrModelInfo::SdrModelInfo(FASTBOOL bInit): +/*N*/ aCreationDate(Date(0),Time(0)), +/*N*/ aLastWriteDate(Date(0),Time(0)), +/*N*/ aLastReadDate(Date(0),Time(0)), +/*N*/ aLastPrintDate(Date(0),Time(0)), +/*N*/ eCreationCharSet(RTL_TEXTENCODING_DONTKNOW), +/*N*/ eLastWriteCharSet(RTL_TEXTENCODING_DONTKNOW), +/*N*/ eLastReadCharSet(RTL_TEXTENCODING_DONTKNOW) +/*N*/ { +/*N*/ if (bInit) +/*N*/ { +/*N*/ aCreationDate = DateTime(); +/*N*/ eCreationCharSet = gsl_getSystemTextEncoding(); +/*N*/ } +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrModelInfo& rModInfo) +/*N*/ { +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrModelInfo"); +/*N*/ #endif +/*N*/ rOut<<UINT32(rModInfo.aCreationDate.GetDate()); +/*N*/ rOut<<UINT32(rModInfo.aCreationDate.GetTime()); +/*N*/ +/*N*/ // #90477# rOut<<UINT8( GetStoreCharSet( rModInfo.eCreationCharSet ) ); +/*N*/ rOut << UINT8(GetSOStoreTextEncoding(rModInfo.eCreationCharSet, (sal_uInt16)rOut.GetVersion())); +/*N*/ + /* Since we removed old SV-stuff there is no way to determine system-speciefic informations, yet. + We just have to write anythink in the file for compatibility: + eCreationGUI eLastWriteGUI eLastReadGUI + eCreationCPU eLastWriteCPU eLastReadCPU + eCreationSys eLastWriteSys eLastReadSys + + + */ +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eCreationGUI); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eCreationCPU); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eCreationSys); +/*N*/ +/*N*/ rOut<<UINT32(rModInfo.aLastWriteDate.GetDate()); +/*N*/ rOut<<UINT32(rModInfo.aLastWriteDate.GetTime()); +/*N*/ +/*N*/ // #90477# rOut<<UINT8( GetStoreCharSet( rModInfo.eLastWriteCharSet ) ); +/*N*/ rOut << UINT8(GetSOStoreTextEncoding(rModInfo.eLastWriteCharSet, (sal_uInt16)rOut.GetVersion())); +/*N*/ +/*N*/ // see comment above +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastWriteGUI); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastWriteCPU); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastWriteSys); +/*N*/ +/*N*/ rOut<<UINT32(rModInfo.aLastReadDate.GetDate()); +/*N*/ rOut<<UINT32(rModInfo.aLastReadDate.GetTime()); +/*N*/ +/*N*/ // #90477# rOut<<UINT8( GetStoreCharSet( rModInfo.eLastReadCharSet ) ); +/*N*/ rOut << UINT8(GetSOStoreTextEncoding(rModInfo.eLastReadCharSet, (sal_uInt16)rOut.GetVersion())); +/*N*/ +/*N*/ // see comment above +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastReadGUI); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastReadCPU); +/*N*/ rOut<<UINT8(0); // rOut<<UINT8(rModInfo.eLastReadSys); +/*N*/ +/*N*/ rOut<<UINT32(rModInfo.aLastPrintDate.GetDate()); +/*N*/ rOut<<UINT32(rModInfo.aLastPrintDate.GetTime()); +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrModelInfo& rModInfo) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrModelInfo"); +/*N*/ #endif +/*N*/ UINT8 n8; +/*N*/ UINT32 n32; +/*N*/ rIn>>n32; rModInfo.aCreationDate.SetDate(n32); +/*N*/ rIn>>n32; rModInfo.aCreationDate.SetTime(n32); +/*N*/ +/*N*/ // #90477# rIn>>n8; rModInfo.eCreationCharSet=rtl_TextEncoding(n8); +/*N*/ rIn >> n8; +/*N*/ n8 = (UINT8)GetSOLoadTextEncoding((rtl_TextEncoding)n8, (sal_uInt16)rIn.GetVersion()); +/*N*/ rModInfo.eCreationCharSet = rtl_TextEncoding(n8); +/*N*/ + /* Since we removed old SV-stuff there is no way to determine system-speciefic informations, yet. + We just have to write anythink in the file for compatibility: + eCreationGUI eLastWriteGUI eLastReadGUI + eCreationCPU eLastWriteCPU eLastReadCPU + eCreationSys eLastWriteSys eLastReadSys + + + */ +/*N*/ rIn>>n8; // rModInfo.eCreationGUI=GUIType(n8); +/*N*/ rIn>>n8; // rModInfo.eCreationCPU=CPUType(n8); +/*N*/ rIn>>n8; // rModInfo.eCreationSys=SystemType(n8); +/*N*/ rIn>>n32; rModInfo.aLastWriteDate.SetDate(n32); +/*N*/ rIn>>n32; rModInfo.aLastWriteDate.SetTime(n32); +/*N*/ +/*N*/ // #90477# rIn>>n8; rModInfo.eLastWriteCharSet=rtl_TextEncoding(n8); +/*N*/ rIn >> n8; +/*N*/ n8 = (UINT8)GetSOLoadTextEncoding((rtl_TextEncoding)n8, (sal_uInt16)rIn.GetVersion()); +/*N*/ rModInfo.eLastWriteCharSet = rtl_TextEncoding(n8); +/*N*/ +/*N*/ // see comment above +/*N*/ rIn>>n8; // rModInfo.eLastWriteGUI=GUIType(n8); +/*N*/ rIn>>n8; // rModInfo.eLastWriteCPU=CPUType(n8); +/*N*/ rIn>>n8; // rModInfo.eLastWriteSys=SystemType(n8); +/*N*/ +/*N*/ rIn>>n32; rModInfo.aLastReadDate.SetDate(n32); +/*N*/ rIn>>n32; rModInfo.aLastReadDate.SetTime(n32); +/*N*/ +/*N*/ // #90477# rIn>>n8; rModInfo.eLastReadCharSet=rtl_TextEncoding(n8); +/*N*/ rIn >> n8; +/*N*/ n8 = (UINT8)GetSOLoadTextEncoding((rtl_TextEncoding)n8, (sal_uInt16)rIn.GetVersion()); +/*N*/ rModInfo.eLastReadCharSet = rtl_TextEncoding(n8); +/*N*/ +/*N*/ // see comment above +/*N*/ rIn>>n8; // rModInfo.eLastReadGUI=GUIType(n8); +/*N*/ rIn>>n8; // rModInfo.eLastReadCPU=CPUType(n8); +/*N*/ rIn>>n8; // rModInfo.eLastReadSys=SystemType(n8); +/*N*/ +/*N*/ rIn>>n32; rModInfo.aLastPrintDate.SetDate(n32); +/*N*/ rIn>>n32; rModInfo.aLastPrintDate.SetTime(n32); +/*N*/ +/*N*/ return rIn; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ DBG_NAME(SdrModel) +/*N*/ TYPEINIT1(SdrModel,SfxBroadcaster); + +/*N*/ void SdrModel::ImpCtor(SfxItemPool* pPool, SvPersist* pPers, +/*N*/ FASTBOOL bUseExtColorTable, FASTBOOL bLoadRefCounts) +/*N*/ { +/*N*/ mbInDestruction=false; +/*N*/ aObjUnit=SdrEngineDefaults::GetMapFraction(); +/*N*/ eObjUnit=SdrEngineDefaults::GetMapUnit(); +/*N*/ eUIUnit=FUNIT_MM; +/*N*/ aUIScale=Fraction(1,1); +/*N*/ nUIUnitKomma=0; +/*N*/ bUIOnlyKomma=FALSE; +/*N*/ pLayerAdmin=NULL; +/*N*/ pItemPool=pPool; +/*N*/ bMyPool=FALSE; +/*N*/ pPersist=pPers; +/*N*/ pDrawOutliner=NULL; +/*N*/ pHitTestOutliner=NULL; +/*N*/ pRefOutDev=NULL; +/*N*/ nProgressAkt=0; +/*N*/ nProgressMax=0; +/*N*/ nProgressOfs=0; +/*N*/ pStyleSheetPool=NULL; +/*N*/ pDefaultStyleSheet=NULL; +/*N*/ pLinkManager=NULL; +/*N*/ pLoadedModel=NULL; +/*N*/ pUndoStack=NULL; +/*N*/ pRedoStack=NULL; +/*N*/ pAktPaintPV=NULL; +/*N*/ nMaxUndoCount=16; +/*N*/ pAktUndoGroup=NULL; +/*N*/ nUndoLevel=0; +/*N*/ nProgressPercent=0; +/*N*/ nLoadVersion=0; +/*N*/ bExtColorTable=FALSE; +/*N*/ bChanged=FALSE; +/*N*/ bInfoChanged=FALSE; +/*N*/ bPagNumsDirty=FALSE; +/*N*/ bMPgNumsDirty=FALSE; +/*N*/ bPageNotValid=FALSE; +/*N*/ bSavePortable=FALSE; +/*N*/ bSaveCompressed=FALSE; +/*N*/ bSaveNative=FALSE; +/*N*/ bSwapGraphics=FALSE; +/*N*/ nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT; +/*N*/ bSaveOLEPreview=FALSE; +/*N*/ bPasteResize=FALSE; +/*N*/ bNoBitmapCaching=FALSE; +/*N*/ bLoading=FALSE; +/*N*/ bStreamingSdrModel=FALSE; +/*N*/ bReadOnly=FALSE; +/*N*/ nStreamCompressMode=COMPRESSMODE_NONE; +/*N*/ nStreamNumberFormat=NUMBERFORMAT_INT_BIGENDIAN; +/*N*/ nDefaultTabulator=0; +/*N*/ pColorTable=NULL; +/*N*/ pDashList=NULL; +/*N*/ pLineEndList=NULL; +/*N*/ pHatchList=NULL; +/*N*/ pGradientList=NULL; +/*N*/ pBitmapList=NULL; +/*N*/ mpNumberFormatter = NULL; +/*N*/ bTransparentTextFrames=FALSE; +/*N*/ bStarDrawPreviewMode = FALSE; +/*N*/ nStarDrawPreviewMasterPageNum = SDRPAGE_NOTFOUND; +/*N*/ pModelStorage = NULL; +/*N*/ mpForbiddenCharactersTable = NULL; +/*N*/ mbModelLocked = FALSE; +/*N*/ mpOutlinerCache = NULL; +/*N*/ mbKernAsianPunctuation = sal_False; +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ SvxAsianConfig aAsian; +/*N*/ mnCharCompressType = aAsian.GetCharDistanceCompression(); +/*N*/ #else +/*N*/ mnCharCompressType = 0; +/*N*/ #endif +/*N*/ +/*N*/ #ifdef OSL_LITENDIAN +/*N*/ nStreamNumberFormat=NUMBERFORMAT_INT_LITTLEENDIAN; +/*N*/ #endif +/*N*/ bExtColorTable=bUseExtColorTable; +/*N*/ +/*N*/ if ( pPool == NULL ) +/*N*/ { +/*N*/ pItemPool=new SdrItemPool(SDRATTR_START, SDRATTR_END, bLoadRefCounts); +/*N*/ // Der Outliner hat keinen eigenen Pool, deshalb den der EditEngine +/*N*/ SfxItemPool* pOutlPool=EditEngine::CreatePool( bLoadRefCounts ); +/*N*/ // OutlinerPool als SecondaryPool des SdrPool +/*N*/ pItemPool->SetSecondaryPool(pOutlPool); +/*N*/ // Merken, dass ich mir die beiden Pools selbst gemacht habe +/*N*/ bMyPool=TRUE; +/*N*/ } +/*N*/ pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit); +/*N*/ +/*N*/ // SJ: #95129# using static SdrEngineDefaults only if default SvxFontHeight item is not available +/*N*/ const SfxPoolItem* pPoolItem = pItemPool->GetPoolDefaultItem( ITEMID_FONTHEIGHT ); +/*N*/ if ( pPoolItem ) +/*N*/ nDefTextHgt = ((SvxFontHeightItem*)pPoolItem)->GetHeight(); +/*N*/ else +/*N*/ nDefTextHgt = SdrEngineDefaults::GetFontHeight(); +/*N*/ +/*N*/ SetTextDefaults(); +/*N*/ pLayerAdmin=new SdrLayerAdmin; +/*N*/ pLayerAdmin->SetModel(this); +/*N*/ ImpSetUIUnit(); +/*N*/ +/*N*/ // den DrawOutliner OnDemand erzeugen geht noch nicht, weil ich den Pool +/*N*/ // sonst nicht kriege (erst ab 302!) +/*N*/ pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); +/*N*/ ImpSetOutlinerDefaults(pDrawOutliner, TRUE); +/*N*/ +/*N*/ pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); +/*N*/ ImpSetOutlinerDefaults(pHitTestOutliner, TRUE); +/*N*/ +/*N*/ ImpCreateTables(); +/*N*/ } + +/*N*/ SdrModel::SdrModel(SfxItemPool* pPool, SvPersist* pPers, INT32 bLoadRefCounts): +/*N*/ aInfo(TRUE), +/*N*/ aPages(1024,32,32), +/*N*/ aMaPag(1024,32,32) +/*N*/ { +/*N*/ #ifdef TIMELOG +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); +/*N*/ #endif +/*N*/ +/*N*/ DBG_CTOR(SdrModel,NULL); +/*N*/ ImpCtor(pPool,pPers,FALSE, (FASTBOOL)bLoadRefCounts); +/*N*/ } + +/*N*/ SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, SvPersist* pPers, INT32 bLoadRefCounts): +/*N*/ aInfo(TRUE), +/*N*/ aPages(1024,32,32), +/*N*/ aMaPag(1024,32,32), +/*N*/ aTablePath(rPath) +/*N*/ { +/*N*/ #ifdef TIMELOG +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); +/*N*/ #endif +/*N*/ +/*N*/ DBG_CTOR(SdrModel,NULL); +/*N*/ ImpCtor(pPool,pPers,FALSE, (FASTBOOL)bLoadRefCounts); +/*N*/ } + +/*N*/ SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, SvPersist* pPers, FASTBOOL bUseExtColorTable, INT32 bLoadRefCounts): +/*N*/ aInfo(TRUE), +/*N*/ aPages(1024,32,32), +/*N*/ aMaPag(1024,32,32), +/*N*/ aTablePath(rPath) +/*N*/ { +/*N*/ #ifdef TIMELOG +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); +/*N*/ #endif +/*N*/ +/*N*/ DBG_CTOR(SdrModel,NULL); +/*N*/ ImpCtor(pPool,pPers,bUseExtColorTable, (FASTBOOL)bLoadRefCounts); +/*N*/ } + +/*N*/ SdrModel::SdrModel(const SdrModel& rSrcModel): +/*N*/ aPages(1024,32,32), +/*N*/ aMaPag(1024,32,32) +/*N*/ { +/*N*/ #ifdef TIMELOG +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); +/*N*/ #endif +/*N*/ +/*N*/ // noch nicht implementiert +/*N*/ DBG_ERROR("SdrModel::CopyCtor() ist noch nicht implementiert"); +/*N*/ } + +/*N*/ SdrModel::~SdrModel() +/*N*/ { +/*N*/ #ifdef TIMELOG +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::~SdrModel(...)" ); +/*N*/ #endif +/*N*/ +/*N*/ DBG_DTOR(SdrModel,NULL); +/*N*/ +/*N*/ mbInDestruction = true; +/*N*/ +/*N*/ Broadcast(SdrHint(HINT_MODELCLEARED)); +/*N*/ +/*N*/ delete mpOutlinerCache; +/*N*/ +/*N*/ ClearUndoBuffer(); +/*N*/ #ifdef DBG_UTIL +/*N*/ if(pAktUndoGroup) +/*N*/ { +/*?*/ ByteString aStr("Im Dtor des SdrModel steht noch ein offenes Undo rum: \""); +/*?*/ +/*?*/ aStr += ByteString(pAktUndoGroup->GetComment(), gsl_getSystemTextEncoding()); +/*?*/ aStr += '\"'; +/*?*/ +/*?*/ DBG_ERROR(aStr.GetBuffer()); +/*N*/ } +/*N*/ #endif +/*N*/ if (pAktUndoGroup!=NULL) delete pAktUndoGroup; +/*N*/ Clear(); +/*N*/ delete pLayerAdmin; +/*N*/ +/*N*/ // Den DrawOutliner erst nach dem ItemPool loeschen, da +/*N*/ // der ItemPool Items des DrawOutliners referenziert !!! (<- das war mal) +/*N*/ // Wg. Problem bei Malte Reihenfolge wieder umgestellt. +/*N*/ // Loeschen des Outliners vor dem loeschen des ItemPools +/*N*/ delete pHitTestOutliner; +/*N*/ delete pDrawOutliner; +/*N*/ +/*N*/ // StyleSheetPool loeschen, abgeleitete Klassen sollten dies nicht tun, +/*N*/ // da die DrawingEngine moeglicherweise im Destruktor noch auf den +/*N*/ // StyleSheetPool zugreifen muss (SB) +/*N*/ delete pStyleSheetPool; +/*N*/ +/*N*/ if (bMyPool) { // Pools loeschen, falls es meine sind +/*N*/ SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool(); +/*N*/ delete pItemPool; +/*N*/ // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der +/*N*/ // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools +/*N*/ // referenzieren (Joe) +/*N*/ delete pOutlPool; +/*N*/ } +/*N*/ +/*N*/ if( mpForbiddenCharactersTable ) +/*N*/ mpForbiddenCharactersTable->release(); +/*N*/ +/*N*/ delete pLoadedModel; +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ // Tabellen, Listen und Paletten loeschen +/*N*/ if (!bExtColorTable) delete pColorTable; +/*N*/ delete pDashList; +/*N*/ delete pLineEndList; +/*N*/ delete pHatchList; +/*N*/ delete pGradientList; +/*N*/ delete pBitmapList; +/*N*/ #endif +/*N*/ +/*N*/ if(mpNumberFormatter) +/*?*/ delete mpNumberFormatter; +/*N*/ } + +/*N*/ bool SdrModel::IsInDestruction() const +/*N*/ { +/*N*/ return mbInDestruction; +/*N*/ } + + +// noch nicht implementiert: + + +/*N*/ void SdrModel::SetSwapGraphics( FASTBOOL bSwap ) +/*N*/ { +/*N*/ bSwapGraphics = bSwap; +/*N*/ } + +/*?*/ FASTBOOL SdrModel::IsReadOnly() const +/*?*/ { +/*?*/ return bReadOnly; +/*?*/ } + +/*?*/ void SdrModel::SetReadOnly(FASTBOOL bYes) +/*?*/ { +/*?*/ bReadOnly=bYes; +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrModel::DoProgress(ULONG nVal) +/*N*/ { +/*N*/ if (aIOProgressLink.IsSet()) { +/*N*/ if (nVal==0) { // Anfang +/*N*/ USHORT nVal=0; +/*N*/ aIOProgressLink.Call(&nVal); +/*N*/ nProgressPercent=0; +/*N*/ nProgressAkt=0; +/*N*/ } else if (nVal==0xFFFFFFFF) { // Ende +/*N*/ USHORT nVal=100; +/*N*/ aIOProgressLink.Call(&nVal); +/*N*/ nProgressPercent=100; +/*N*/ nProgressAkt=nProgressMax; +/*N*/ } else if (nVal!=nProgressAkt && nProgressMax!=0) { // dazwischen +/*N*/ USHORT nPercent; +/*N*/ if (nVal>nProgressOfs) nVal-=nProgressOfs; else nVal=0; +/*N*/ if (nVal>nProgressMax) nVal=nProgressMax; +/*N*/ if (nVal<=0x00FFFFFF) nPercent=USHORT(nVal*100/nProgressMax); +/*N*/ else { +/*?*/ ULONG nBla=nProgressMax/100; // Weil sonst Ueberlauf! +/*?*/ nPercent=USHORT(nVal/=nBla); +/*N*/ } +/*N*/ if (nPercent==0) nPercent=1; +/*N*/ if (nPercent>99) nPercent=99; +/*N*/ if (nPercent>nProgressPercent) { +/*N*/ aIOProgressLink.Call(&nPercent); +/*N*/ nProgressPercent=nPercent; +/*N*/ } +/*N*/ if (nVal>nProgressAkt) { +/*N*/ nProgressAkt=nVal; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetMaxUndoActionCount(ULONG nAnz) +/*N*/ { +/*N*/ if (nAnz<1) nAnz=1; +/*N*/ nMaxUndoCount=nAnz; +/*N*/ if (pUndoStack!=NULL) { +/*?*/ while (pUndoStack->Count()>nMaxUndoCount) { +/*?*/ delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count()); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::ClearUndoBuffer() +/*N*/ { +/*N*/ if (pUndoStack!=NULL) { +/*?*/ while (pUndoStack->Count()!=0) { +/*?*/ delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count()-1); +/*?*/ } +/*?*/ delete pUndoStack; +/*?*/ pUndoStack=NULL; +/*N*/ } +/*N*/ if (pRedoStack!=NULL) { +/*?*/ while (pRedoStack->Count()!=0) { +/*?*/ delete (SfxUndoAction*) pRedoStack->Remove(pRedoStack->Count()-1); +/*?*/ } +/*?*/ delete pRedoStack; +/*?*/ pRedoStack=NULL; +/*N*/ } +/*N*/ } + + + + + + + + + + + + +/*N*/ void SdrModel::AddUndo(SdrUndoAction* pUndo) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrModel::ImpCreateTables() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ // der Writer hat seinen eigenen ColorTable +/*N*/ if (!bExtColorTable) pColorTable=new XColorTable(aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ pDashList =new XDashList (aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ pHatchList =new XHatchList (aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ pGradientList=new XGradientList(aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ pBitmapList =new XBitmapList (aTablePath,(XOutdevItemPool*)pItemPool); +/*N*/ #endif +/*N*/ } + +/*N*/ void SdrModel::Clear() +/*N*/ { +/*N*/ mbInDestruction = true; +/*N*/ +/*N*/ sal_Int32 i; +/*N*/ // delete all drawing pages +/*N*/ sal_Int32 nAnz=GetPageCount(); +/*N*/ for (i=nAnz-1; i>=0; i--) +/*N*/ { +/*N*/ DeletePage( (USHORT)i ); +/*N*/ } +/*N*/ aPages.Clear(); +/*N*/ +/*N*/ // delete all Masterpages +/*N*/ nAnz=GetMasterPageCount(); +/*N*/ for(i=nAnz-1; i>=0; i--) +/*N*/ { +/*N*/ DeleteMasterPage( (USHORT)i ); +/*N*/ } +/*N*/ aMaPag.Clear(); +/*N*/ +/*N*/ pLayerAdmin->ClearLayer(); +/*N*/ pLayerAdmin->ClearLayerSets(); +/*N*/ //SetChanged(); +/*N*/ } + +/*N*/ SdrModel* SdrModel::AllocModel() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ SdrModel* pModel=new SdrModel; +/*N*/ return pModel; +/*N*/ } + +/*N*/ SdrPage* SdrModel::AllocPage(FASTBOOL bMasterPage) +/*N*/ { +/*N*/ return new SdrPage(*this,bMasterPage); +/*N*/ } + + +/*N*/ void SdrModel::DisposeLoadedModels() +/*N*/ { +/*N*/ delete pLoadedModel; +/*N*/ pLoadedModel = NULL; +/*N*/ aLoadedModelFN = String(); +/*N*/ } + +/*N*/ void SdrModel::SetTextDefaults() const +/*N*/ { +/*N*/ SetTextDefaults( pItemPool, nDefTextHgt ); +/*N*/ } + + +/*N*/ void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, ULONG nDefTextHgt ) +/*N*/ { +/*N*/ // #95114# set application-language specific dynamic pool language defaults +/*N*/ SvxFontItem aSvxFontItem; +/*N*/ SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK); +/*N*/ SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL); +/*N*/ sal_uInt16 nLanguage(Application::GetSettings().GetLanguage()); +/*N*/ +/*N*/ // get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default +/*N*/ Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); +/*N*/ aSvxFontItem.GetFamily() = aFont.GetFamily(); +/*N*/ aSvxFontItem.GetFamilyName() = aFont.GetName(); +/*N*/ aSvxFontItem.GetStyleName().Erase(); +/*N*/ aSvxFontItem.GetPitch() = aFont.GetPitch(); +/*N*/ aSvxFontItem.GetCharSet() = aFont.GetCharSet(); +/*N*/ pItemPool->SetPoolDefaultItem(aSvxFontItem); +/*N*/ +/*N*/ // get DEFAULTFONT_CJK_TEXT and set at pool as dynamic default +/*N*/ Font aFontCJK(OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); +/*N*/ aSvxFontItemCJK.GetFamily() = aFontCJK.GetFamily(); +/*N*/ aSvxFontItemCJK.GetFamilyName() = aFontCJK.GetName(); +/*N*/ aSvxFontItemCJK.GetStyleName().Erase(); +/*N*/ aSvxFontItemCJK.GetPitch() = aFontCJK.GetPitch(); +/*N*/ aSvxFontItemCJK.GetCharSet() = aFontCJK.GetCharSet(); +/*N*/ pItemPool->SetPoolDefaultItem(aSvxFontItemCJK); +/*N*/ +/*N*/ // get DEFAULTFONT_CTL_TEXT and set at pool as dynamic default +/*N*/ Font aFontCTL(OutputDevice::GetDefaultFont(DEFAULTFONT_CTL_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); +/*N*/ aSvxFontItemCTL.GetFamily() = aFontCTL.GetFamily(); +/*N*/ aSvxFontItemCTL.GetFamilyName() = aFontCTL.GetName(); +/*N*/ aSvxFontItemCTL.GetStyleName().Erase(); +/*N*/ aSvxFontItemCTL.GetPitch() = aFontCTL.GetPitch(); +/*N*/ aSvxFontItemCTL.GetCharSet() = aFontCTL.GetCharSet(); +/*N*/ pItemPool->SetPoolDefaultItem(aSvxFontItemCTL); +/*N*/ +/*N*/ // set dynamic FontHeight defaults +/*N*/ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT ) ); +/*N*/ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CJK ) ); +/*N*/ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CTL ) ); +/*N*/ +/*N*/ // set FontColor defaults +/*N*/ pItemPool->SetPoolDefaultItem( SvxColorItem(SdrEngineDefaults::GetFontColor()) ); +/*N*/ } + +/*N*/ SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const +/*N*/ { +/*N*/ pDrawOutliner->SetTextObj(pObj); +/*N*/ return *pDrawOutliner; +/*N*/ } + + +/*N*/ void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, BOOL bInit ) +/*N*/ { + /************************************************************************** + * Initialisierung der Outliner fuer Textausgabe und HitTest + **************************************************************************/ +/*N*/ if( bInit ) +/*N*/ { +/*N*/ pOutliner->EraseVirtualDevice(); +/*N*/ pOutliner->SetUpdateMode(FALSE); +/*N*/ pOutliner->SetEditTextObjectPool(pItemPool); +/*N*/ pOutliner->SetDefTab(nDefaultTabulator); +/*N*/ } + +/*N*/ pOutliner->SetRefDevice(GetRefDevice()); +/*N*/ pOutliner->SetForbiddenCharsTable(GetForbiddenCharsTable()); +/*N*/ pOutliner->SetAsianCompressionMode( mnCharCompressType ); +/*N*/ pOutliner->SetKernAsianPunctuation( IsKernAsianPunctuation() ); +/*N*/ +/*N*/ if ( !GetRefDevice() ) +/*N*/ { +/*N*/ MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit); +/*N*/ pOutliner->SetRefMapMode(aMapMode); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetRefDevice(OutputDevice* pDev) +/*N*/ { +/*N*/ pRefOutDev=pDev; +/*N*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*N*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*N*/ RefDeviceChanged(); +/*N*/ } + +/*N*/ void SdrModel::ImpReformatAllTextObjects() +/*N*/ { +/*N*/ if( isLocked() ) +/*N*/ return; +/*N*/ +/*N*/ USHORT nAnz=GetMasterPageCount(); +/*N*/ USHORT nNum; +/*N*/ for (nNum=0; nNum<nAnz; nNum++) { +/*N*/ GetMasterPage(nNum)->ReformatAllTextObjects(); +/*N*/ } +/*N*/ nAnz=GetPageCount(); +/*N*/ for (nNum=0; nNum<nAnz; nNum++) { +/*N*/ GetPage(nNum)->ReformatAllTextObjects(); +/*N*/ } +/*N*/ } + +/** #103122# + steps over all available pages and sends notify messages to + all edge objects that are connected to other objects so that + they may reposition itselfs +*/ +/*N*/ void SdrModel::ImpReformatAllEdgeObjects() +/*N*/ { +/*N*/ if( isLocked() ) +/*N*/ return; +/*N*/ +/*N*/ sal_uInt16 nAnz=GetMasterPageCount(); +/*N*/ sal_uInt16 nNum; +/*N*/ for (nNum=0; nNum<nAnz; nNum++) +/*N*/ { +/*N*/ GetMasterPage(nNum)->ReformatAllEdgeObjects(); +/*N*/ } +/*N*/ nAnz=GetPageCount(); +/*N*/ for (nNum=0; nNum<nAnz; nNum++) +/*N*/ { +/*N*/ GetPage(nNum)->ReformatAllEdgeObjects(); +/*N*/ } +/*N*/ } + +/*N*/ SvStream* SdrModel::GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const +/*N*/ { +/*N*/ return NULL; +/*N*/ } + +// Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln. + + +/*N*/ void SdrModel::RefDeviceChanged() +/*N*/ { +/*N*/ Broadcast(SdrHint(HINT_REFDEVICECHG)); +/*N*/ ImpReformatAllTextObjects(); +/*N*/ } +/*N*/ +/*N*/ void SdrModel::SetDefaultFontHeight(ULONG nVal) +/*N*/ { +/*N*/ if (nVal!=nDefTextHgt) { +/*?*/ nDefTextHgt=nVal; +/*?*/ Broadcast(SdrHint(HINT_DEFFONTHGTCHG)); +/*?*/ ImpReformatAllTextObjects(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetDefaultTabulator(USHORT nVal) +/*N*/ { +/*N*/ if (nDefaultTabulator!=nVal) { +/*N*/ nDefaultTabulator=nVal; +/*N*/ Outliner& rOutliner=GetDrawOutliner(); +/*N*/ rOutliner.SetDefTab(nVal); +/*N*/ Broadcast(SdrHint(HINT_DEFAULTTABCHG)); +/*N*/ ImpReformatAllTextObjects(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::ImpSetUIUnit() +/*N*/ { +/*N*/ if (aUIScale.GetNumerator()==0 || aUIScale.GetDenominator()==0) aUIScale=Fraction(1,1); +/*N*/ FASTBOOL bMapInch=IsInch(eObjUnit); +/*N*/ FASTBOOL bMapMetr=IsMetric(eObjUnit); +/*N*/ FASTBOOL bUIInch=IsInch(eUIUnit); +/*N*/ FASTBOOL bUIMetr=IsMetric(eUIUnit); +/*N*/ nUIUnitKomma=0; +/*N*/ long nMul=1; +/*N*/ long nDiv=1; +/*N*/ +/*N*/ // Zunaechst normalisieren auf m bzw. " +/*N*/ switch (eObjUnit) { +/*N*/ case MAP_100TH_MM : nUIUnitKomma+=5; break; +/*N*/ case MAP_10TH_MM : nUIUnitKomma+=4; break; +/*N*/ case MAP_MM : nUIUnitKomma+=3; break; +/*N*/ case MAP_CM : nUIUnitKomma+=2; break; +/*N*/ case MAP_1000TH_INCH: nUIUnitKomma+=3; break; +/*N*/ case MAP_100TH_INCH : nUIUnitKomma+=2; break; +/*N*/ case MAP_10TH_INCH : nUIUnitKomma+=1; break; +/*N*/ case MAP_INCH : nUIUnitKomma+=0; break; +/*N*/ case MAP_POINT : nDiv=72; break; // 1Pt = 1/72" +/*N*/ case MAP_TWIP : nDiv=144; nUIUnitKomma++; break; // 1Twip = 1/1440" +/*N*/ case MAP_PIXEL : break; +/*N*/ case MAP_SYSFONT : break; +/*N*/ case MAP_APPFONT : break; +/*N*/ case MAP_RELATIVE : break; +/*N*/ } // switch +/*N*/ +/*N*/ // 1 mile = 8 furlong = 63.360" = 1.609.344,0mm +/*N*/ // 1 furlong = 10 chains = 7.920" = 201.168,0mm +/*N*/ // 1 chain = 4 poles = 792" = 20.116,8mm +/*N*/ // 1 pole = 5 1/2 yd = 198" = 5.029,2mm +/*N*/ // 1 yd = 3 ft = 36" = 914,4mm +/*N*/ // 1 ft = 12 " = 1" = 304,8mm +/*N*/ switch (eUIUnit) { +/*N*/ case FUNIT_NONE : break; +/*N*/ // Metrisch +/*N*/ case FUNIT_100TH_MM: nUIUnitKomma-=5; break; +/*N*/ case FUNIT_MM : nUIUnitKomma-=3; break; +/*N*/ case FUNIT_CM : nUIUnitKomma-=2; break; +/*N*/ case FUNIT_M : nUIUnitKomma+=0; break; +/*N*/ case FUNIT_KM : nUIUnitKomma+=3; break; +/*N*/ // Inch +/*N*/ case FUNIT_TWIP : nMul=144; nUIUnitKomma--; break; // 1Twip = 1/1440" +/*N*/ case FUNIT_POINT : nMul=72; break; // 1Pt = 1/72" +/*N*/ case FUNIT_PICA : nMul=6; break; // 1Pica = 1/6" ? +/*N*/ case FUNIT_INCH : break; // 1" = 1" +/*N*/ case FUNIT_FOOT : nDiv*=12; break; // 1Ft = 12" +/*N*/ case FUNIT_MILE : nDiv*=6336; nUIUnitKomma++; break; // 1mile = 63360" +/*N*/ // sonstiges +/*N*/ case FUNIT_CUSTOM : break; +/*N*/ case FUNIT_PERCENT: nUIUnitKomma+=2; break; +/*N*/ } // switch +/*N*/ +/*N*/ if (bMapInch && bUIMetr) { +/*N*/ nUIUnitKomma+=4; +/*N*/ nMul*=254; +/*N*/ } +/*N*/ if (bMapMetr && bUIInch) { +/*N*/ nUIUnitKomma-=4; +/*N*/ nDiv*=254; +/*N*/ } +/*N*/ +/*N*/ // Temporaere Fraction zum Kuerzen +/*N*/ Fraction aTempFract(nMul,nDiv); +/*N*/ nMul=aTempFract.GetNumerator(); +/*N*/ nDiv=aTempFract.GetDenominator(); +/*N*/ // Nun mit dem eingestellten Masstab verknuepfen +/*N*/ BigInt nBigMul(nMul); +/*N*/ BigInt nBigDiv(nDiv); +/*N*/ BigInt nBig1000(1000); +/*N*/ nBigMul*=aUIScale.GetDenominator(); +/*N*/ nBigDiv*=aUIScale.GetNumerator(); +/*N*/ while (nBigMul>nBig1000) { +/*N*/ nUIUnitKomma--; +/*N*/ nBigMul/=10; +/*N*/ } +/*N*/ while (nBigDiv>nBig1000) { +/*N*/ nUIUnitKomma++; +/*N*/ nBigDiv/=10; +/*N*/ } +/*N*/ nMul=long(nBigMul); +/*N*/ nDiv=long(nBigDiv); +/*N*/ switch ((short)nMul) { +/*N*/ case 10: nMul=1; nUIUnitKomma--; break; +/*N*/ case 100: nMul=1; nUIUnitKomma-=2; break; +/*N*/ case 1000: nMul=1; nUIUnitKomma-=3; break; +/*N*/ } // switch +/*N*/ switch ((short)nDiv) { +/*N*/ case 10: nDiv=1; nUIUnitKomma++; break; +/*N*/ case 100: nDiv=1; nUIUnitKomma+=2; break; +/*N*/ case 1000: nDiv=1; nUIUnitKomma+=3; break; +/*N*/ } // switch +/*N*/ aUIUnitFact=Fraction(nMul,nDiv); +/*N*/ bUIOnlyKomma=nMul==nDiv; +/*N*/ TakeUnitStr(eUIUnit,aUIUnitStr); +/*N*/ } + + +/*N*/ void SdrModel::SetScaleUnit(MapUnit eMap) +/*N*/ { +/*N*/ if (eObjUnit!=eMap) { +/*N*/ eObjUnit=eMap; +/*N*/ pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit); +/*N*/ ImpSetUIUnit(); +/*N*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*N*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*N*/ ImpReformatAllTextObjects(); // #40424# +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetScaleFraction(const Fraction& rFrac) +/*N*/ { +/*N*/ if (aObjUnit!=rFrac) { +/*?*/ aObjUnit=rFrac; +/*?*/ ImpSetUIUnit(); +/*?*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*?*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*?*/ ImpReformatAllTextObjects(); // #40424# +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetUIUnit(FieldUnit eUnit) +/*N*/ { +/*N*/ if (eUIUnit!=eUnit) { +/*?*/ eUIUnit=eUnit; +/*?*/ ImpSetUIUnit(); +/*?*/ ImpReformatAllTextObjects(); // #40424# +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetUIScale(const Fraction& rScale) +/*N*/ { +/*N*/ if (aUIScale!=rScale) { +/*?*/ aUIScale=rScale; +/*?*/ ImpSetUIUnit(); +/*?*/ ImpReformatAllTextObjects(); // #40424# +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale) +/*N*/ { +/*N*/ if (eUIUnit!=eUnit || aUIScale!=rScale) { +/*N*/ eUIUnit=eUnit; +/*N*/ aUIScale=rScale; +/*N*/ ImpSetUIUnit(); +/*N*/ ImpReformatAllTextObjects(); // #40424# +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::TakeUnitStr(FieldUnit eUnit, XubString& rStr) const +/*N*/ { +/*N*/ switch(eUnit) +/*N*/ { +/*N*/ default: +/*N*/ case FUNIT_NONE : +/*N*/ case FUNIT_CUSTOM : +/*N*/ { +/*?*/ rStr = String(); +/*?*/ break; +/*N*/ } +/*N*/ case FUNIT_100TH_MM: +/*?*/ { +/*?*/ sal_Char aText[] = "/100mm"; +/*?*/ rStr = UniString(aText, sizeof(aText-1)); +/*?*/ break; +/*N*/ } +/*N*/ case FUNIT_MM : +/*N*/ { +/*N*/ sal_Char aText[] = "mm"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_CM : +/*N*/ { +/*N*/ sal_Char aText[] = "cm"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_M : +/*N*/ { +/*N*/ rStr = String(); +/*N*/ rStr += sal_Unicode('m'); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_KM : +/*N*/ { +/*N*/ sal_Char aText[] = "km"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_TWIP : +/*N*/ { +/*N*/ sal_Char aText[] = "twip"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_POINT : +/*N*/ { +/*N*/ sal_Char aText[] = "pt"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_PICA : +/*N*/ { +/*N*/ sal_Char aText[] = "pica"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_INCH : +/*N*/ { +/*N*/ rStr = String(); +/*N*/ rStr += sal_Unicode('"'); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_FOOT : +/*N*/ { +/*N*/ sal_Char aText[] = "ft"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_MILE : +/*N*/ { +/*N*/ sal_Char aText[] = "mile(s)"; +/*N*/ rStr = UniString(aText, sizeof(aText-1)); +/*N*/ break; +/*N*/ } +/*N*/ case FUNIT_PERCENT: +/*N*/ { +/*N*/ rStr = String(); +/*N*/ rStr += sal_Unicode('%'); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } + +/*?*/ void SdrModel::TakeMetricStr(long nVal, XubString& rStr, FASTBOOL bNoUnitChars, sal_Int32 nNumDigits) const +/*?*/ { +/*?*/ if(!bUIOnlyKomma) +/*?*/ nVal = (nVal * aUIUnitFact.GetNumerator()) / aUIUnitFact.GetDenominator(); +/*?*/ +/*?*/ BOOL bNeg(nVal < 0); +/*?*/ +/*?*/ if(bNeg) +/*?*/ nVal = -nVal; +/*?*/ +/*?*/ SvtSysLocale aSysLoc; +/*?*/ const LocaleDataWrapper& rLoc = aSysLoc.GetLocaleData(); +/*?*/ sal_Int32 nKomma(nUIUnitKomma); +/*?*/ if( -1 == nNumDigits ) +/*?*/ nNumDigits = rLoc.getNumDigits(); +/*?*/ +/*?*/ while(nKomma > nNumDigits) +/*?*/ { +/*?*/ // das bedeutet teilen und runden +/*?*/ sal_Int32 nDiff(nKomma - nNumDigits); +/*?*/ +/*?*/ switch(nDiff) +/*?*/ { +/*?*/ case 1: nVal = (nVal+5)/10; nKomma--; break; +/*?*/ case 2: nVal = (nVal+50)/100; nKomma-=2; break; +/*?*/ case 3: nVal = (nVal+500)/1000; nKomma-=3; break; +/*?*/ case 4: nVal = (nVal+5000)/10000; nKomma-=4; break; +/*?*/ case 5: nVal = (nVal+50000)/100000; nKomma-=5; break; +/*?*/ case 6: nVal = (nVal+500000)/1000000; nKomma-=6; break; +/*?*/ case 7: nVal = (nVal+5000000)/10000000; nKomma-=7; break; +/*?*/ default:nVal = (nVal+50000000)/100000000; nKomma-=8; break; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ rStr = UniString::CreateFromInt32(nVal); +/*?*/ +/*?*/ if(nKomma < 0) +/*?*/ { +/*?*/ // Negatives Komma bedeutet: Nullen dran +/*?*/ sal_Int32 nAnz(-nKomma); +/*?*/ +/*?*/ for(sal_Int32 i=0; i<nAnz; i++) +/*?*/ rStr += sal_Unicode('0'); +/*?*/ +/*?*/ nKomma = 0; +/*?*/ } +/*?*/ +/*?*/ // #83257# the second condition needs to be <= since inside this loop +/*?*/ // also the leading zero is inserted. +/*?*/ if(nKomma > 0 && rStr.Len() <= nKomma) +/*?*/ { +/*?*/ // Fuer Komma evtl. vorne Nullen dran +/*?*/ sal_Int32 nAnz(nKomma - rStr.Len()); +/*?*/ +/*?*/ if(nAnz >= 0 && rLoc.isNumLeadingZero()) +/*?*/ nAnz++; +/*?*/ +/*?*/ for(sal_Int32 i=0; i<nAnz; i++) +/*?*/ rStr.Insert(sal_Unicode('0'), 0); +/*?*/ } +/*?*/ +/*?*/ sal_Unicode cDec( rLoc.getNumDecimalSep().GetChar(0) ); +/*?*/ +/*?*/ // KommaChar einfuegen +/*?*/ sal_Int32 nVorKomma(rStr.Len() - nKomma); +/*?*/ +/*?*/ if(nKomma > 0) +/*?*/ rStr.Insert(cDec, (xub_StrLen) nVorKomma); +/*?*/ +/*?*/ if(!rLoc.isNumTrailingZeros()) +/*?*/ { +/*?*/ while(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == sal_Unicode('0')) +/*?*/ rStr.Erase(rStr.Len() - 1); +/*?*/ +/*?*/ if(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == cDec) +/*?*/ rStr.Erase(rStr.Len() - 1); +/*?*/ } +/*?*/ +/*?*/ // ggf. Trennpunkte bei jedem Tausender einfuegen +/*?*/ if( nVorKomma > 3 ) +/*?*/ { +/*?*/ String aThoSep( rLoc.getNumThousandSep() ); +/*?*/ if ( aThoSep.Len() > 0 ) +/*?*/ { +/*?*/ sal_Unicode cTho( aThoSep.GetChar(0) ); +/*?*/ sal_Int32 i(nVorKomma - 3); +/*?*/ +/*?*/ while(i > 0) // #78311# +/*?*/ { +/*?*/ rStr.Insert(cTho, (xub_StrLen)i); +/*?*/ i -= 3; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if(!rStr.Len()) +/*?*/ { +/*?*/ rStr = String(); +/*?*/ rStr += sal_Unicode('0'); +/*?*/ } +/*?*/ +/*?*/ if(bNeg) +/*?*/ { +/*?*/ rStr.Insert(sal_Unicode('-'), 0); +/*?*/ } +/*?*/ +/*?*/ if(!bNoUnitChars) +/*?*/ rStr += aUIUnitStr; +/*?*/ } + + + +/*N*/ void SdrModel::SetChanged(FASTBOOL bFlg) +/*N*/ { +/*N*/ bChanged=bFlg; +/*N*/ } + +/*N*/ void SdrModel::RecalcPageNums(FASTBOOL bMaster) +/*N*/ { +/*N*/ Container& rPL=*(bMaster ? &aMaPag : &aPages); +/*N*/ USHORT nAnz=USHORT(rPL.Count()); +/*N*/ USHORT i; +/*N*/ for (i=0; i<nAnz; i++) { +/*N*/ SdrPage* pPg=(SdrPage*)(rPL.GetObject(i)); +/*N*/ pPg->SetPageNum(i); +/*N*/ } +/*N*/ if (bMaster) bMPgNumsDirty=FALSE; +/*N*/ else bPagNumsDirty=FALSE; +/*N*/ } + +/*N*/ void SdrModel::InsertPage(SdrPage* pPage, USHORT nPos) +/*N*/ { +/*N*/ USHORT nAnz=GetPageCount(); +/*N*/ if (nPos>nAnz) nPos=nAnz; +/*N*/ aPages.Insert(pPage,nPos); +/*N*/ pPage->SetInserted(TRUE); +/*N*/ pPage->SetPageNum(nPos); +/*N*/ pPage->SetModel(this); +/*N*/ if (nPos<nAnz) bPagNumsDirty=TRUE; +/*N*/ SetChanged(); +/*N*/ SdrHint aHint(HINT_PAGEORDERCHG); +/*N*/ aHint.SetPage(pPage); +/*N*/ Broadcast(aHint); +/*N*/ } + +/*N*/ void SdrModel::DeletePage(USHORT nPgNum) +/*N*/ { +/*N*/ SdrPage* pPg=RemovePage(nPgNum); +/*N*/ delete pPg; +/*N*/ } + +/*N*/ SdrPage* SdrModel::RemovePage(USHORT nPgNum) +/*N*/ { +/*N*/ SdrPage* pPg=(SdrPage*)aPages.Remove(nPgNum); +/*N*/ if (pPg!=NULL) { +/*N*/ pPg->SetInserted(FALSE); +/*N*/ } +/*N*/ bPagNumsDirty=TRUE; +/*N*/ SetChanged(); +/*N*/ SdrHint aHint(HINT_PAGEORDERCHG); +/*N*/ aHint.SetPage(pPg); +/*N*/ Broadcast(aHint); +/*N*/ return pPg; +/*N*/ } + + +/*N*/ void SdrModel::InsertMasterPage(SdrPage* pPage, USHORT nPos) +/*N*/ { +/*N*/ USHORT nAnz=GetMasterPageCount(); +/*N*/ if (nPos>nAnz) nPos=nAnz; +/*N*/ aMaPag.Insert(pPage,nPos); +/*N*/ pPage->SetInserted(TRUE); +/*N*/ pPage->SetPageNum(nPos); +/*N*/ pPage->SetModel(this); +/*N*/ if (nPos<nAnz) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ SetChanged(); +/*N*/ SdrHint aHint(HINT_PAGEORDERCHG); +/*N*/ aHint.SetPage(pPage); +/*N*/ Broadcast(aHint); +/*N*/ } + +/*N*/ void SdrModel::DeleteMasterPage(USHORT nPgNum) +/*N*/ { +/*N*/ SdrPage* pPg=RemoveMasterPage(nPgNum); +/*N*/ if (pPg!=NULL) delete pPg; +/*N*/ } + +/*N*/ SdrPage* SdrModel::RemoveMasterPage(USHORT nPgNum) +/*N*/ { +/*N*/ SdrPage* pRetPg=(SdrPage*)aMaPag.Remove(nPgNum); +/*N*/ // Nun die Verweise der normalen Zeichenseiten auf die entfernte MasterPage loeschen +/*N*/ // und Verweise auf dahinterliegende Masterpages anpassen. +/*N*/ USHORT nPageAnz=GetPageCount(); +/*N*/ for (USHORT np=0; np<nPageAnz; np++) { +/*N*/ GetPage(np)->ImpMasterPageRemoved(nPgNum); +/*N*/ } +/*N*/ if (pRetPg!=NULL) { +/*N*/ pRetPg->SetInserted(FALSE); +/*N*/ } +/*N*/ bMPgNumsDirty=TRUE; +/*N*/ SetChanged(); +/*N*/ SdrHint aHint(HINT_PAGEORDERCHG); +/*N*/ aHint.SetPage(pRetPg); +/*N*/ Broadcast(aHint); +/*N*/ return pRetPg; +/*N*/ } + +/*N*/ void SdrModel::MoveMasterPage(USHORT nPgNum, USHORT nNewPos) +/*N*/ { +/*N*/ SdrPage* pPg=(SdrPage*)aMaPag.Remove(nPgNum); +/*N*/ if (pPg!=NULL) { +/*N*/ pPg->SetInserted(FALSE); +/*N*/ aMaPag.Insert(pPg,nNewPos); +/*N*/ // Anpassen der MasterPageDescriptoren +/*N*/ USHORT nPageAnz=GetPageCount(); +/*N*/ for (USHORT np=0; np<nPageAnz; np++) { +/*N*/ GetPage(np)->ImpMasterPageMoved(nPgNum,nNewPos); +/*N*/ } +/*N*/ } +/*N*/ bMPgNumsDirty=TRUE; +/*N*/ SetChanged(); +/*N*/ SdrHint aHint(HINT_PAGEORDERCHG); +/*N*/ aHint.SetPage(pPg); +/*N*/ Broadcast(aHint); +/*N*/ } + +/*N*/ void SdrModel::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ const sal_uInt32 nOldCompressMode = nStreamCompressMode; +/*N*/ sal_uInt32 nNewCompressMode = nStreamCompressMode; +/*N*/ +/*N*/ if( SOFFICE_FILEFORMAT_40 <= rOut.GetVersion() ) +/*N*/ { +/*N*/ if( IsSaveCompressed() ) +/*N*/ nNewCompressMode |= COMPRESSMODE_ZBITMAP; +/*N*/ +/*N*/ if( IsSaveNative() ) +/*N*/ nNewCompressMode |= COMPRESSMODE_NATIVE; +/*N*/ } +/*N*/ +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrModel"); +/*N*/ #endif +/*N*/ +/*N*/ // damit ich meine eigenen SubRecords erkenne (ab V11) +/*N*/ rOut.Write(SdrIOJoeMagic, 4); +/*N*/ +/*N*/ { +/*N*/ // Focus fuer aModelMiscCompat +/*N*/ // ab V11 eingepackt +/*N*/ SdrDownCompat aModelMiscCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aModelMiscCompat.SetID("SdrModel(Miscellaneous)"); +/*N*/ #endif +/*N*/ +/*N*/ // ModelInfo muss hier ganz am Anfang stehen! +/*N*/ ((SdrModel*)this)->aInfo.aLastWriteDate = DateTime(); +/*N*/ rtl_TextEncoding eOutCharSet = rOut.GetStreamCharSet(); +/*N*/ if(eOutCharSet == ((rtl_TextEncoding)9) /* == RTL_TEXTENCODING_SYSTEM */ ) +/*?*/ eOutCharSet = gsl_getSystemTextEncoding(); +/*N*/ +/*N*/ // #90477# ((SdrModel*)this)->aInfo.eLastWriteCharSet = GetStoreCharSet(eOutCharSet); +/*N*/ ((SdrModel*)this)->aInfo.eLastWriteCharSet = GetSOStoreTextEncoding(eOutCharSet, (sal_uInt16)rOut.GetVersion()); +/*N*/ +/*N*/ // UNICODE: set the target charset on the stream to access it as parameter +/*N*/ // in all streaming operations for UniString->ByteString conversions +/*N*/ rOut.SetStreamCharSet(aInfo.eLastWriteCharSet); +/*N*/ + /* old SV-stuff, there is no possibility to determine this informations in another way + ((SdrModel*)this)->aInfo.eLastWriteGUI=System::GetGUIType(); + ((SdrModel*)this)->aInfo.eLastWriteCPU=System::GetCPUType(); + ((SdrModel*)this)->aInfo.eLastWriteSys=System::GetSystemType(); + */ +/*N*/ +/*N*/ if(aReadDate.IsValid()) +/*N*/ { +/*N*/ ((SdrModel*)this)->aInfo.aLastReadDate = aReadDate; +/*N*/ +/*N*/ // ((SdrModel*)this)->aInfo.eLastReadCharSet = GetStoreCharSet(gsl_getSystemTextEncoding()); +/*N*/ ((SdrModel*)this)->aInfo.eLastReadCharSet = GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rOut.GetVersion()); +/*N*/ + /* old SV-stuff, there is no possibility to determine this informations in another way + ((SdrModel*)this)->aInfo.eLastReadGUI=System::GetGUIType(); + ((SdrModel*)this)->aInfo.eLastReadCPU=System::GetCPUType(); + ((SdrModel*)this)->aInfo.eLastReadSys=System::GetSystemType(); + */ +/*N*/ } +/*N*/ rOut << aInfo; // DateiInfo rausschreiben (ab V11) +/*N*/ +/*N*/ { // ein Bereich fuer Statistik reservieren (V11) (kommt spaeter vielleicht mal dazu) +/*N*/ SdrDownCompat aModelStatisticCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aModelStatisticCompat.SetID("SdrModel(Statistic)"); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ { +/*N*/ // ab V11 +/*N*/ SdrDownCompat aModelFormatCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aModelFormatCompat.SetID("SdrModel(Format)"); +/*N*/ #endif +/*N*/ +/*N*/ // ab V11 +/*N*/ rOut << nNewCompressMode; +/*N*/ +/*N*/ // ab V11 +/*N*/ rOut << UINT16(rOut.GetNumberFormatInt()); +/*N*/ +/*N*/ rOut.SetCompressMode( (sal_uInt16)nNewCompressMode); +/*N*/ // CompressMode erst an dieser Stelle setzen, damit konform zu ReadData() +/*N*/ } +/*N*/ +/*N*/ rOut << INT32(aObjUnit.GetNumerator()); +/*N*/ rOut << INT32(aObjUnit.GetDenominator()); +/*N*/ rOut << UINT16(eObjUnit); +/*N*/ // Komprimiert ? +/*N*/ rOut << UINT16(0); +/*N*/ // Nur eine DummyPage, jedoch mit relevanten Objekten? +/*N*/ rOut << UINT8(bPageNotValid); +/*N*/ // Reserve DummyByte +/*N*/ rOut << UINT8(0); +/*N*/ +/*N*/ // Tabellen-, Listen- und Palettennamen schreiben +/*N*/ // rOut<<INT16(::GetSystemCharSet()); seit V11 hier kein CharSet mehr +/*N*/ XubString aEmptyStr; +/*N*/ +/*N*/ if(bExtColorTable) +/*N*/ { +/*N*/ // der Writer hat seinen eigenen ColorTable +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(pColorTable && !pColorTable->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut << pColorTable->GetName(); +/*N*/ rOut.WriteByteString(pColorTable->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(pDashList && !pDashList->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut<<pDashList->GetName(); +/*N*/ rOut.WriteByteString(pDashList->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ +/*N*/ if(pLineEndList && !pLineEndList->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut<<pLineEndList->GetName(); +/*N*/ rOut.WriteByteString(pLineEndList->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ +/*N*/ if(pHatchList && !pHatchList->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut<<pHatchList->GetName(); +/*N*/ rOut.WriteByteString(pHatchList->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ +/*N*/ if(pGradientList && !pGradientList->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut<<pGradientList->GetName(); +/*N*/ rOut.WriteByteString(pGradientList->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ +/*N*/ if(pBitmapList && !pBitmapList->GetName().Equals(pszStandard)) +/*N*/ { +/*N*/ // UNICODE: rOut<<pBitmapList->GetName(); +/*N*/ rOut.WriteByteString(pBitmapList->GetName()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << aEmptyStr; +/*N*/ rOut.WriteByteString(aEmptyStr); +/*N*/ } +/*N*/ +/*N*/ // ab 09-02-1996 +/*N*/ rOut << INT32(aUIScale.GetNumerator()); +/*N*/ rOut << INT32(aUIScale.GetDenominator()); +/*N*/ rOut << UINT16(eUIUnit); +/*N*/ +/*N*/ // ab 09-04-1997 fuer #37710# +/*N*/ rOut << INT32(nDefTextHgt); +/*N*/ rOut << INT32(nDefaultTabulator); +/*N*/ +/*N*/ // StarDraw-Preview: Nummer der MasterPage der ersten Standard-Seite +/*N*/ if(GetPageCount() >= 3 && GetPage(1)->GetMasterPageCount()) +/*N*/ { +/*N*/ ((SdrModel*)this)->nStarDrawPreviewMasterPageNum = +/*N*/ GetPage(1)->GetMasterPageNum(0); +/*N*/ } +/*N*/ rOut << nStarDrawPreviewMasterPageNum; +/*N*/ } +/*N*/ +/*N*/ UINT16 i; +/*N*/ +/*N*/ for(i=0; i < GetLayerAdmin().GetLayerCount(); i++) +/*N*/ { +/*N*/ rOut << *GetLayerAdmin().GetLayer(i); +/*N*/ } +/*N*/ +/*N*/ for(i=0; i < GetLayerAdmin().GetLayerSetCount(); i++) +/*N*/ { +/*?*/ rOut << *GetLayerAdmin().GetLayerSet(i); +/*N*/ } +/*N*/ +/*N*/ for(i=0; i < GetMasterPageCount(); i++) +/*N*/ { +/*N*/ const SdrPage* pPg = GetMasterPage(i); +/*N*/ rOut << *pPg; +/*N*/ } +/*N*/ +/*N*/ for(i=0; i < GetPageCount(); i++) +/*N*/ { +/*N*/ const SdrPage* pPg = GetPage(i); +/*N*/ rOut << *pPg; +/*N*/ } +/*N*/ +/*N*/ // Endemarke +/*N*/ SdrIOHeader(rOut, STREAM_WRITE, SdrIOEndeID); +/*N*/ } + +/*N*/ void SdrModel::ReadData(const SdrIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*N*/ return; +/*N*/ +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrModel"); +/*N*/ #endif +/*N*/ +/*N*/ if(rHead.GetVersion() >= 11) +/*N*/ { +/*N*/ // damit ich meine eigenen SubRecords erkenne (ab V11) +/*N*/ char cMagic[4]; +/*N*/ if(rIn.Read(cMagic, 4) != 4 || memcmp(cMagic, SdrIOJoeMagic, 4)) +/*N*/ { +/*N*/ rIn.SetError(SVSTREAM_FILEFORMAT_ERROR); +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DoProgress(rIn.Tell()); +/*N*/ +/*N*/ { +/*N*/ // Focus fuer aModelMiscCompat +/*N*/ SdrDownCompat* pModelMiscCompat = NULL; +/*N*/ +/*N*/ if(rHead.GetVersion() >= 11) +/*N*/ { +/*N*/ // MiscellaneousData ab V11 eingepackt +/*N*/ // MiscellaneousData ist alles von Recordbeginn bis +/*N*/ // zum Anfang der Pages, Layer, ... +/*N*/ pModelMiscCompat = new SdrDownCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ pModelMiscCompat->SetID("SdrModel(Miscellaneous)"); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 11) +/*N*/ { +/*N*/ // ModelInfo ab V11 +/*N*/ // DateiInfo lesen +/*N*/ rIn >> aInfo; +/*N*/ +/*N*/ // StreamCharSet setzen, damit Strings beim +/*N*/ // Lesen automatisch konvertiert werden +/*N*/ rIn.SetStreamCharSet(aInfo.eLastWriteCharSet); +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 11) +/*N*/ { +/*N*/ // reserviert fuer Statistik +/*N*/ SdrDownCompat aModelStatisticCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aModelStatisticCompat.SetID("SdrModel(Statistik)"); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 11) +/*N*/ { +/*N*/ // Info ueber Dateiformat +/*N*/ SdrDownCompat aModelFormatCompat(rIn,STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aModelFormatCompat.SetID("SdrModel(Format)"); +/*N*/ #endif +/*N*/ +/*N*/ if(aModelFormatCompat.GetBytesLeft() >= 4) +/*N*/ { +/*N*/ rIn >> nStreamCompressMode; +/*N*/ rIn >> nStreamNumberFormat; +/*N*/ rIn.SetCompressMode(nStreamCompressMode); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ INT32 nNum,nDen; +/*N*/ UINT16 nTmp; +/*N*/ UINT8 nTmp8; +/*N*/ +/*N*/ rIn >> nNum; +/*N*/ rIn >> nDen; +/*N*/ +/*N*/ aObjUnit = Fraction(nNum,nDen); +/*N*/ +/*N*/ rIn >> nTmp; +/*N*/ +/*N*/ eObjUnit = MapUnit(nTmp); +/*N*/ +/*N*/ // Komprimiert ? +/*N*/ rIn >> nTmp; +/*N*/ +/*N*/ //rIn.nJoeDummy=(nTmp==1); +/*N*/ rIn >> nTmp8; +/*N*/ +/*N*/ bPageNotValid = (nTmp == 1); +/*N*/ +/*N*/ rIn >> nTmp8; // Reserve DummyByte +/*N*/ +/*N*/ BOOL bExtFiles(rHead.GetVersion() >= 1); +/*N*/ +/*N*/ if(bExtFiles) +/*N*/ { +/*N*/ // Tabellen-, Listen- und Palettennamen lesen +/*N*/ XubString aName; +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { +/*N*/ // vor V11 gab's noch keine ModelInfo, deshalb CharSet von hier +/*N*/ // und rein zufaellig gab's genau bis inkl. zur V10 +/*N*/ // an dieser Stelle einen CharSet +/*N*/ INT16 nCharSet; +/*N*/ +/*N*/ // #90477# rIn >> nCharSet; +/*N*/ rIn >> nCharSet; +/*N*/ nCharSet = (INT16)GetSOLoadTextEncoding((rtl_TextEncoding)nCharSet, (sal_uInt16)rIn.GetVersion()); +/*N*/ +/*N*/ // StreamCharSet setzen, damit Strings beim +/*N*/ // Lesen automatisch konvertiert werden +/*N*/ // #90477# rIn.SetStreamCharSet(rtl_TextEncoding(nCharSet)); +/*N*/ rIn.SetStreamCharSet(GetSOLoadTextEncoding(rtl_TextEncoding(nCharSet), (sal_uInt16)rIn.GetVersion())); +/*N*/ } +/*N*/ +/*N*/ // Tabellen- und Listennamen lesen (Tabellen/Listen existieren schon) // SOH!!! +/*N*/ // UNICODE: rIn >> aName; +/*N*/ rIn.ReadByteString(aName); +/*N*/ +/*N*/ if(!bExtColorTable) +/*N*/ { +/*N*/ // der Writer hat seinen eigenen ColorTable +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ +/*N*/ if(pColorTable) +/*N*/ pColorTable->SetName(aName); +/*N*/ } +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ if(pDashList) +/*N*/ pDashList->SetName(aName); +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ if(pLineEndList) +/*N*/ pLineEndList->SetName(aName); +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ if(pHatchList) +/*N*/ pHatchList->SetName(aName); +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ if(pGradientList) +/*N*/ pGradientList->SetName(aName); +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ if(!aName.Len()) +/*N*/ aName = pszStandard; +/*N*/ if(pBitmapList) +/*N*/ pBitmapList->SetName(aName); +/*N*/ +/*N*/ // Wenn gewuenscht kann hier SetDirty() an den Tabellen gesetzt werden, ist m.M. nach aber ueberfluessig ! SOH. +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Ansonsten altes Format: Listen und Tables sind embedded +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*?*/ ByteString aMsg("Das Format dieser Datei ist noch von April '95 (Version "); +/*?*/ aMsg += ByteString::CreateFromInt32( rHead.GetVersion() ); +/*?*/ aMsg += "). Mit dieser Programmversion kann das nicht mehr gelesen werden"; +/*?*/ +/*?*/ DBG_ERROR(aMsg.GetBuffer()); +/*?*/ #endif +/*?*/ +/*?*/ // Version zu alt +/*?*/ rIn.SetError(SVSTREAM_WRONGVERSION); +/*?*/ +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ // UIUnit wird ab V12 gestreamt +/*N*/ if(rHead.GetVersion() >= 12 && pModelMiscCompat->GetBytesLeft() > 0) +/*N*/ { +/*N*/ rIn >> nNum; +/*N*/ rIn >> nDen; +/*N*/ +/*N*/ aUIScale = Fraction(nNum, nDen); +/*N*/ +/*N*/ rIn >> nTmp; +/*N*/ +/*N*/ eUIUnit = FieldUnit(nTmp); +/*N*/ } +/*N*/ +/*N*/ // ab 09-04-1997 fuer #37710#: Text in Dafaultgroesse vom Writer ins Draw und umgekehrt +/*N*/ if(rHead.GetVersion() >= 13 && pModelMiscCompat->GetBytesLeft() > 0) +/*N*/ { +/*N*/ rIn >> nNum; +/*N*/ nDefTextHgt = nNum; +/*N*/ +/*N*/ rIn >> nNum; +/*N*/ nDefaultTabulator = (UINT16)nNum; +/*N*/ +/*N*/ Outliner& rOutliner = GetDrawOutliner(); +/*N*/ rOutliner.SetDefTab(nDefaultTabulator); +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 14 && pModelMiscCompat->GetBytesLeft() > 0) +/*N*/ { +/*N*/ // StarDraw-Preview: Nummer der MasterPage der ersten Standard-Seite +/*N*/ rIn >> nStarDrawPreviewMasterPageNum; +/*N*/ } +/*N*/ +/*N*/ if(pModelMiscCompat) +/*N*/ { +/*N*/ delete pModelMiscCompat; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DoProgress(rIn.Tell()); +/*N*/ //SdrIOHeader aHead; +/*N*/ +/*N*/ // Seiten, Layer und LayerSets einlesen +/*N*/ BOOL bEnde(FALSE); +/*N*/ UINT16 nMasterPageNum(0); +/*N*/ BOOL bAllPagesLoaded(TRUE); +/*N*/ +/*N*/ while(!rIn.GetError() && !rIn.IsEof() && !bEnde) +/*N*/ { +/*N*/ SdrIOHeaderLookAhead aHead(rIn); +/*N*/ //ULONG nPos0=rIn.Tell(); +/*N*/ //rIn>>aHead; +/*N*/ +/*N*/ if(!aHead.IsMagic()) +/*N*/ { +/*N*/ // Format-Fehler +/*N*/ rIn.SetError(SVSTREAM_FILEFORMAT_ERROR); +/*N*/ return; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(!aHead.IsEnde()) +/*N*/ { +/*N*/ //rIn.Seek(nPos0); // Die Headers wollen alle selbst lesen +/*N*/ if(aHead.IsID(SdrIOPageID)) +/*N*/ { +/*N*/ if(!bStarDrawPreviewMode || GetPageCount() < 3) +/*N*/ { +/*N*/ // Page lesen +/*N*/ SdrPage* pPg = AllocPage(FALSE); +/*N*/ +/*N*/ rIn >> *pPg; +/*N*/ InsertPage(pPg); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bAllPagesLoaded = FALSE; +/*N*/ aHead.SkipRecord(); +/*N*/ } +/*N*/ } +/*N*/ else if(aHead.IsID(SdrIOMaPgID)) +/*N*/ { +/*N*/ if(!bStarDrawPreviewMode +/*N*/ || nStarDrawPreviewMasterPageNum == SDRPAGE_NOTFOUND +/*N*/ || nMasterPageNum == 0 +/*N*/ || nMasterPageNum <= nStarDrawPreviewMasterPageNum +/*N*/ || nMasterPageNum <= nStarDrawPreviewMasterPageNum + 1) +/*N*/ { +/*N*/ // Im StarDrawPreviewMode Standard und Notizseite lesen! +/*N*/ // MasterPage lesen +/*N*/ SdrPage* pPg = AllocPage(TRUE); +/*N*/ +/*N*/ rIn >> *pPg; +/*N*/ InsertMasterPage(pPg); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bAllPagesLoaded = FALSE; +/*N*/ aHead.SkipRecord(); +/*N*/ } +/*N*/ +/*N*/ nMasterPageNum++; +/*N*/ } +/*N*/ else if(aHead.IsID(SdrIOLayrID)) +/*N*/ { +/*N*/ //SdrLayer* pLay=GetLayer().NewLayer(""); +/*N*/ // Layerdefinition lesen +/*N*/ SdrLayer* pLay = new SdrLayer; +/*N*/ +/*N*/ rIn >> *pLay; +/*N*/ GetLayerAdmin().InsertLayer(pLay); +/*N*/ } +/*N*/ else if(aHead.IsID(SdrIOLSetID)) +/*N*/ { +/*N*/ //SdrLayerSet* pSet=GetLayer().NewLayerSet(""); +/*N*/ SdrLayerSet* pSet = new SdrLayerSet; // Layersetdefinition lesen +/*N*/ +/*N*/ rIn >> *pSet; +/*N*/ GetLayerAdmin().InsertLayerSet(pSet); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // aha, das wil keiner. Also ueberlesen. +/*N*/ aHead.SkipRecord(); +/*N*/ //rIn.Seek(nPos0+aHead.nBlkSize); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bEnde = TRUE; +/*N*/ +/*N*/ // Endemarke weglesen +/*N*/ aHead.SkipRecord(); +/*N*/ } +/*N*/ } +/*N*/ DoProgress(rIn.Tell()); +/*N*/ } +/*N*/ +/*N*/ if(bStarDrawPreviewMode && bAllPagesLoaded) +/*N*/ { +/*N*/ // Obwohl StarDrawPreviewMode wurden doch alle Seiten geladen, +/*N*/ // um dieses kenntlich zu machen, wird das Flag zurueckgesetzt +/*N*/ bStarDrawPreviewMode = FALSE; +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::AfterRead() +/*N*/ { +/*N*/ // alle MasterPages und alle Pages durchlaufen +/*N*/ UINT16 nCnt(GetMasterPageCount()); +/*N*/ UINT16 i; +/*N*/ +/*N*/ for(i=0; i < nCnt; i++) +/*N*/ { +/*N*/ GetMasterPage(i)->AfterRead(); +/*N*/ } +/*N*/ +/*N*/ nCnt = GetPageCount(); +/*N*/ +/*N*/ for(i=0; i < nCnt; i++) +/*N*/ { +/*N*/ GetPage(i)->AfterRead(); +/*N*/ } +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ // Investigation of bMyPool to check if it's allowed to delete the OLE objects. +/*N*/ // If bMyPool == FALSE it's not allowed (Writer) +/*N*/ if( pPersist && bMyPool ) +/*N*/ { +/*N*/ SvInfoObjectMemberList* pList = (SvInfoObjectMemberList*) pPersist->GetObjectList(); +/*N*/ +/*N*/ if( pList ) +/*N*/ { +/*N*/ SvInfoObjectRef pInfo = pList->First(); +/*N*/ while( pInfo.Is() ) +/*N*/ { +/*N*/ BOOL bFound = FALSE; +/*N*/ String aName = pInfo->GetObjName(); +/*N*/ +/*N*/ nCnt = GetPageCount(); +/*N*/ UINT16 a; for( a = 0; a < nCnt && !bFound; a++ ) +/*N*/ { +/*N*/ // Pages +/*N*/ SdrObjListIter aIter( *GetPage(a) ); +/*N*/ while( !bFound && aIter.IsMore() ) +/*N*/ { +/*N*/ SdrObject* pObj = aIter.Next(); +/*N*/ if( pObj->ISA(SdrOle2Obj) ) +/*N*/ { +/*N*/ if( aName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) +/*N*/ bFound = TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ nCnt = GetMasterPageCount(); +/*N*/ for( a = 0; a < nCnt && !bFound; a++ ) +/*N*/ { +/*N*/ // MasterPages +/*N*/ SdrObjListIter aIter( *GetMasterPage(a) ); +/*N*/ while( !bFound && aIter.IsMore() ) +/*N*/ { +/*N*/ SdrObject* pObj = aIter.Next(); +/*N*/ if( pObj->ISA(SdrOle2Obj) ) +/*N*/ { +/*N*/ if( aName == static_cast< SdrOle2Obj* >( pObj )->GetPersistName() ) +/*N*/ bFound = TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( !bFound ) +/*N*/ pInfo->SetDeleted(TRUE); +/*N*/ +/*N*/ pInfo = pList->Next(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ #endif +/*N*/ } + +/*N*/ ULONG SdrModel::ImpCountAllSteamComponents() const +/*N*/ { +/*N*/ UINT32 nCnt(0); +/*N*/ UINT16 nAnz(GetMasterPageCount()); +/*N*/ UINT16 nNum; +/*N*/ +/*N*/ for(nNum = 0; nNum < nAnz; nNum++) +/*N*/ { +/*N*/ nCnt += GetMasterPage(nNum)->CountAllObjects(); +/*N*/ } +/*N*/ +/*N*/ nAnz = GetPageCount(); +/*N*/ +/*N*/ for(nNum = 0; nNum < nAnz; nNum++) +/*N*/ { +/*N*/ nCnt += GetPage(nNum)->CountAllObjects(); +/*N*/ } +/*N*/ +/*N*/ return nCnt; +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrModel& rMod) +/*N*/ { +/*N*/ ((SdrModel*)&rMod)->nProgressOfs=0; +/*N*/ ((SdrModel*)&rMod)->nProgressMax=rMod.ImpCountAllSteamComponents(); // Hier passenden Wert einsetzen +/*N*/ ((SdrModel*)&rMod)->DoProgress(0); +/*N*/ ULONG nPos0=rOut.Tell(); +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOModlID); +/*N*/ USHORT nCompressMerk=rOut.GetCompressMode(); // Der CompressMode wird von SdrModel::ReadData() gesetzt +/*N*/ rMod.WriteData(rOut); +/*N*/ rOut.SetCompressMode(nCompressMerk); // CompressMode wieder restaurieren +/*N*/ ((SdrModel*)&rMod)->DoProgress(0xFFFFFFFF); +/*N*/ ((SdrModel*)&rMod)->Broadcast(SdrHint(HINT_MODELSAVED)); // #43095# +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrModel& rMod) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ rMod.aReadDate=DateTime(); // Zeitpunkt des Lesens merken +/*N*/ rMod.nProgressOfs=rIn.Tell(); +/*N*/ rMod.nProgressMax=0xFFFFFFFF; // Vorlaeufiger Wert +/*N*/ rMod.DoProgress(0); +/*N*/ rMod.Clear(); +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ rMod.nLoadVersion=aHead.GetVersion(); +/*N*/ if (!aHead.IsMagic()) { +/*?*/ rIn.SetError(SVSTREAM_FILEFORMAT_ERROR); // Format-Fehler +/*?*/ return rIn; +/*N*/ } +/*N*/ if (aHead.GetMajorVersion()>nAktSdrFileMajorVersion) { +/*?*/ rIn.SetError(SVSTREAM_WRONGVERSION); // Datei zu neu / Programm zu alt +/*?*/ return rIn; +/*N*/ } +/*N*/ rMod.nProgressMax=aHead.GetBlockSize(); +/*N*/ rMod.DoProgress(rIn.Tell()); +/*N*/ rMod.bLoading=TRUE; +/*N*/ rtl_TextEncoding eStreamCharSetMerker=rIn.GetStreamCharSet(); // Der StreamCharSet wird von SdrModel::ReadData() gesetzt +/*N*/ USHORT nCompressMerk=rIn.GetCompressMode(); // Der CompressMode wird von SdrModel::ReadData() gesetzt +/*N*/ rMod.ReadData(aHead,rIn); +/*N*/ rIn.SetCompressMode(nCompressMerk); // CompressMode wieder restaurieren +/*N*/ +/*N*/ rIn.SetStreamCharSet(eStreamCharSetMerker); // StreamCharSet wieder restaurieren +/*N*/ +/*N*/ rMod.bLoading=FALSE; +/*N*/ rMod.DoProgress(rIn.Tell()); +/*N*/ rMod.AfterRead(); +/*N*/ rMod.DisposeLoadedModels(); +/*N*/ +/*N*/ rMod.ImpSetUIUnit(); // weil ggf. neues Scaling eingelesen +/*N*/ rMod.DoProgress(0xFFFFFFFF); +/*N*/ return rIn; +/*N*/ } + +/*N*/ void SdrModel::PreSave() +/*N*/ { +/*N*/ sal_uInt16 nCnt(GetMasterPageCount()); +/*N*/ +/*N*/ sal_uInt16 a; for(a=0; a < nCnt; a++) +/*N*/ { +/*N*/ // MasterPages +/*N*/ const SdrPage& rPage = *GetMasterPage(a); +/*N*/ SdrObject* pObj = rPage.GetBackgroundObj(); +/*N*/ if( pObj ) +/*?*/ pObj->PreSave(); +/*N*/ +/*N*/ for(sal_uInt32 b(0); b < rPage.GetObjCount(); b++) +/*N*/ rPage.GetObj(b)->PreSave(); +/*N*/ } +/*N*/ +/*N*/ nCnt = GetPageCount(); +/*N*/ for(a = 0; a < nCnt; a++) +/*N*/ { +/*N*/ // Pages +/*N*/ const SdrPage& rPage = *GetPage(a); +/*N*/ SdrObject* pObj = rPage.GetBackgroundObj(); +/*N*/ if( pObj ) +/*N*/ pObj->PreSave(); +/*N*/ +/*N*/ for(sal_uInt32 b(0); b < rPage.GetObjCount(); b++) +/*N*/ rPage.GetObj(b)->PreSave(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::PostSave() +/*N*/ { +/*N*/ sal_uInt16 nCnt(GetMasterPageCount()); +/*N*/ +/*N*/ sal_uInt16 a; for(a=0; a < nCnt; a++) +/*N*/ { +/*N*/ // MasterPages +/*N*/ const SdrPage& rPage = *GetMasterPage(a); +/*N*/ SdrObject* pObj = rPage.GetBackgroundObj(); +/*N*/ if( pObj ) +/*?*/ pObj->PostSave(); +/*N*/ +/*N*/ for(sal_uInt32 b(0); b < rPage.GetObjCount(); b++) +/*N*/ rPage.GetObj(b)->PostSave(); +/*N*/ } +/*N*/ +/*N*/ nCnt = GetPageCount(); +/*N*/ for(a = 0; a < nCnt; a++) +/*N*/ { +/*N*/ // Pages +/*N*/ const SdrPage& rPage = *GetPage(a); +/*N*/ SdrObject* pObj = rPage.GetBackgroundObj(); +/*N*/ if( pObj ) +/*N*/ pObj->PostSave(); +/*N*/ +/*N*/ for(sal_uInt32 b(0); b < rPage.GetObjCount(); b++) +/*N*/ rPage.GetObj(b)->PostSave(); +/*N*/ } +/*N*/ } + +/*N*/ uno::Reference< uno::XInterface > SdrModel::getUnoModel() +/*N*/ { +/*N*/ // try weak reference first +/*N*/ uno::Reference< uno::XInterface > xModel( mxUnoModel ); +/*N*/ +/*N*/ if( !xModel.is() ) +/*N*/ { +/*N*/ // create one +/*N*/ xModel = createUnoModel(); +/*N*/ +/*N*/ mxUnoModel = xModel; +/*N*/ } +/*N*/ +/*N*/ return xModel; +/*N*/ +/*N*/ } + +/*?*/ uno::Reference< uno::XInterface > SdrModel::createUnoModel() +/*?*/ { +/*?*/ DBG_ERROR( "SdrModel::createUnoModel() - base implementation should not be called!" ); +/*?*/ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt; +/*?*/ return xInt; +/*?*/ } + +/*N*/ void SdrModel::setLock( BOOL bLock ) +/*N*/ { +/*N*/ if( mbModelLocked != bLock ) +/*N*/ { +/*N*/ mbModelLocked = bLock; +/*N*/ if( sal_False == bLock ) +/*N*/ { +/*N*/ // ReformatAllTextObjects(); #103122# due to a typo in the above if, this code was never +/*N*/ // executed, so I remove it until we discover that we need it here +/*N*/ ImpReformatAllEdgeObjects(); // #103122# +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel ) +/*N*/ { +/*N*/ if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) ) +/*N*/ { +/*N*/ if( pNewModel == NULL ) +/*N*/ pNewModel = this; +/*N*/ +/*N*/ SfxWhichIter aWhichIter(*pSourceSet); +/*N*/ sal_uInt16 nWhich(aWhichIter.FirstWhich()); +/*N*/ const SfxPoolItem *pPoolItem; +/*N*/ +/*N*/ while(nWhich) +/*N*/ { +/*N*/ if(SFX_ITEM_SET == pSourceSet->GetItemState(nWhich, FALSE, &pPoolItem)) +/*N*/ { +/*N*/ const SfxPoolItem* pItem = pPoolItem; +/*N*/ +/*N*/ switch( nWhich ) +/*N*/ { +/*N*/ case XATTR_FILLBITMAP: +/*N*/ pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_LINEDASH: +/*N*/ pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_LINESTART: +/*N*/ pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_LINEEND: +/*N*/ pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_FILLGRADIENT: +/*N*/ pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_FILLFLOATTRANSPARENCE: +/*N*/ // #85953# allow all kinds of XFillFloatTransparenceItem to be set +/*N*/ pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ case XATTR_FILLHATCH: +/*N*/ pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pNewModel ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // set item +/*N*/ if( pItem ) +/*N*/ { +/*N*/ pDestSet->Put(*pItem); +/*N*/ +/*N*/ // delete item if it was a generated one +/*N*/ if( pItem != pPoolItem) +/*N*/ delete (SfxPoolItem*)pItem; +/*N*/ } +/*N*/ } +/*N*/ nWhich = aWhichIter.NextWhich(); +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrModel::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) +/*N*/ { +/*N*/ if( mpForbiddenCharactersTable ) +/*N*/ mpForbiddenCharactersTable->release(); +/*N*/ +/*N*/ mpForbiddenCharactersTable = xForbiddenChars.get(); +/*N*/ +/*N*/ if( mpForbiddenCharactersTable ) +/*N*/ mpForbiddenCharactersTable->acquire(); +/*N*/ +/*N*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*N*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*N*/ } + +/*N*/ rtl::Reference<SvxForbiddenCharactersTable> SdrModel::GetForbiddenCharsTable() const +/*N*/ { +/*N*/ return mpForbiddenCharactersTable; +/*N*/ } + +/*N*/ void SdrModel::SetCharCompressType( UINT16 nType ) +/*N*/ { +/*N*/ if( nType != mnCharCompressType ) +/*N*/ { +/*?*/ mnCharCompressType = nType; +/*?*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*?*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::SetKernAsianPunctuation( sal_Bool bEnabled ) +/*N*/ { +/*N*/ if( mbKernAsianPunctuation != bEnabled ) +/*N*/ { +/*?*/ mbKernAsianPunctuation = bEnabled; +/*?*/ ImpSetOutlinerDefaults( pDrawOutliner ); +/*?*/ ImpSetOutlinerDefaults( pHitTestOutliner ); +/*N*/ } +/*N*/ } + +/*N*/ void SdrModel::ReformatAllTextObjects() +/*N*/ { +/*N*/ ImpReformatAllTextObjects(); +/*N*/ } + + +/*N*/ SdrOutliner* SdrModel::createOutliner( USHORT nOutlinerMode ) +/*N*/ { +/*N*/ if( NULL == mpOutlinerCache ) +/*N*/ mpOutlinerCache = new SdrOutlinerCache(this); +/*N*/ +/*N*/ return mpOutlinerCache->createOutliner( nOutlinerMode ); +/*N*/ } + +/*N*/ void SdrModel::disposeOutliner( SdrOutliner* pOutliner ) +/*N*/ { +/*N*/ if( mpOutlinerCache ) +/*N*/ { +/*N*/ mpOutlinerCache->disposeOutliner( pOutliner ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ delete pOutliner; +/*N*/ } +/*N*/ } + +/*?*/ SvxNumType SdrModel::GetPageNumType() const +/*?*/ { +/*?*/ return SVX_ARABIC; +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrHint,SfxHint); + +/*N*/ SdrHint::SdrHint(const SdrPage& rNewPage) +/*N*/ { +/*N*/ aRect=Rectangle(0,0,rNewPage.GetWdt(),rNewPage.GetHgt()); +/*N*/ pPage=&rNewPage; +/*N*/ pObj=NULL; +/*N*/ pObjList=&rNewPage; +/*N*/ bNeedRepaint=TRUE; +/*N*/ eHint=HINT_PAGECHG; +/*N*/ } + +/*N*/ SdrHint::SdrHint(const SdrObject& rNewObj) +/*N*/ { +/*N*/ aRect=rNewObj.GetBoundRect(); +/*N*/ pPage=rNewObj.GetPage(); +/*N*/ pObj=&rNewObj; +/*N*/ pObjList=rNewObj.GetObjList(); +/*N*/ bNeedRepaint=TRUE; +/*N*/ eHint=HINT_OBJCHG; +/*N*/ } +/*N*/ +/*N*/ SdrHint::SdrHint(const SdrObject& rNewObj, const Rectangle& rRect) +/*N*/ { +/*N*/ aRect = rRect; +/*N*/ pPage = rNewObj.GetPage(); +/*N*/ pObj = &rNewObj; +/*N*/ pObjList = rNewObj.GetObjList(); +/*N*/ bNeedRepaint = TRUE; +/*N*/ eHint = HINT_OBJCHG; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdmrkv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdmrkv.cxx new file mode 100644 index 000000000000..19dd17c5cf14 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdmrkv.cxx @@ -0,0 +1,901 @@ +/* -*- 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 "svdview.hxx" +#include "svdpagv.hxx" +#include "svdio.hxx" +#include "svdoole2.hxx" + + +#include "svdstr.hrc" + +// #105722# +#include "svdopath.hxx" + +// #i13033# +#include "scene3d.hxx" + +// OD 30.06.2003 #108784# +#include <svdovirt.hxx> +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@ @@ +// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkView::ImpClearVars() +/*N*/ { +/*N*/ eDragMode=SDRDRAG_MOVE; +/*N*/ bHdlShown=FALSE; +/*N*/ bRefHdlShownOnly=FALSE; +/*N*/ eEditMode=SDREDITMODE_EDIT; +/*N*/ eEditMode0=SDREDITMODE_EDIT; +/*N*/ bDesignMode=FALSE; +/*N*/ bMarking=FALSE; +/*N*/ bMarkingPoints=FALSE; +/*N*/ bMarkingGluePoints=FALSE; +/*N*/ bUnmarking=FALSE; +/*N*/ pMarkedObj=NULL; +/*N*/ pMarkedPV=NULL; +/*N*/ bForceFrameHandles=FALSE; +/*N*/ bPlusHdlAlways=FALSE; +/*N*/ nFrameHandlesLimit=50; +/*N*/ nSpecialCnt=0; +/*N*/ bInsPolyPoint=FALSE; +/*N*/ nInsPointNum=0; +/*N*/ bEdgesOfMarkedNodesDirty=FALSE; +/*N*/ bMarkedObjRectDirty=FALSE; +/*N*/ bMarkedPointsRectsDirty=FALSE; +/*N*/ bHdlHidden=FALSE; +/*N*/ bMrkPntDirty=FALSE; +/*N*/ bMarkHdlWhenTextEdit=FALSE; +/*N*/ // bSolidHdlBackgroundInvalid=FALSE; +/*N*/ bMarkableObjCountDirty=FALSE; // noch nicht implementiert +/*N*/ nMarkableObjCount=0; // noch nicht implementiert +/*N*/ } + +/*N*/ SdrMarkView::SdrMarkView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrSnapView(pModel1,pOut), +/*N*/ aHdl(this) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ StartListening(*pModel1); +/*N*/ } + +/*N*/ void __EXPORT SdrMarkView::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); +/*N*/ if (pSdrHint!=NULL) { +/*N*/ SdrHintKind eKind=pSdrHint->GetKind(); +/*N*/ if (eKind==HINT_OBJLISTCLEARED) { +/*N*/ USHORT nAnz=GetPageViewCount(); +/*N*/ BOOL bMLChgd=FALSE; +/*N*/ for (USHORT nv=0; nv<nAnz; nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ if (pPV->GetObjList()==pSdrHint->GetObjList()) { +/*?*/ aMark.DeletePageView(*pPV); +/*?*/ bMLChgd=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (bMLChgd) MarkListHasChanged(); +/*N*/ } +/*N*/ if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) +/*N*/ { +/*N*/ if(bHdlShown +/*N*/ // #75438# do not hide handles if no repaint will be triggered +/*N*/ // since the repaint will show handles again later +/*N*/ && pSdrHint->IsNeedRepaint()) +/*N*/ { +/*N*/ HideMarkHdl(NULL); +/*N*/ } +/*N*/ +/*N*/ bMarkedObjRectDirty=TRUE; +/*N*/ bMarkedPointsRectsDirty=TRUE; +/*N*/ } +/*N*/ } +/*N*/ SdrSnapView::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ } + +/*N*/ void SdrMarkView::ModelHasChanged() +/*N*/ { +/*N*/ SdrPaintView::ModelHasChanged(); +/*N*/ aMark.SetNameDirty(); +/*N*/ bMarkedObjRectDirty=TRUE; +/*N*/ bMarkedPointsRectsDirty=TRUE; +/*N*/ // Es sind beispielsweise Obj markiert und aMark ist Sorted. +/*N*/ // In einer anderen View 2 wird die ObjOrder veraendert +/*N*/ // (z.B. MovToTop()). Dann ist Neusortieren der MarkList erforderlich. +/*N*/ aMark.SetUnsorted(); +/*N*/ aMark.ForceSort(); +/*N*/ bMrkPntDirty=TRUE; +/*N*/ UndirtyMrkPnt(); +/*N*/ SdrView* pV=(SdrView*)this; +/*N*/ if (pV!=NULL && !pV->IsDragObj() && !pV->IsInsObjPoint()) { // an dieser Stelle habe ich ein ziemliches Problem !!! +/*N*/ AdjustMarkHdl(); +// if (!IsSolidMarkHdl()) { +// if (!bHdlShown) { +// // Ein wenig unsauber ... +// if ((bMarkHdlWhenTextEdit || !pV->IsTextEdit()) && // evtl. keine Handles bei TextEdit +// !(pV->IsDragHdlHide() && pV->IsDragObj() && // Ggf. keine Handles beim Draggen +// aDragStat.IsMinMoved() && !IS_TYPE(SdrDragMovHdl,pV->GetDragMethod()))) { +// ShowMarkHdl(NULL); +// } +// } +// } + } +/*N*/ } + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrMarkView::IsAction() const +/*N*/ { +/*N*/ return SdrSnapView::IsAction() || bMarking || bMarkingPoints || bMarkingGluePoints; +/*N*/ } + + + + +/*N*/ void SdrMarkView::BrkAction() +/*N*/ { +/*N*/ SdrSnapView::BrkAction(); +/*N*/ BrkMarkObj(); +/*N*/ BrkMarkPoints(); +/*N*/ BrkMarkGluePoints(); +/*N*/ } + + +/*N*/ void SdrMarkView::ToggleShownXor(OutputDevice* pOut, const Region* pRegion) const +/*N*/ { +/*N*/ SdrSnapView::ToggleShownXor(pOut,pRegion); +/*N*/ if ((bMarking || bMarkingPoints || bMarkingGluePoints) && aDragStat.IsShown()) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DrawMarkObjOrPoints(pOut); +/*N*/ } +// if (bHdlShown) { +// DrawMarkHdl(pOut,FALSE); +// } else if (bRefHdlShownOnly) { +// DrawMarkHdl(pOut,BOOL(2)); HACK(nur die Ref-Hdls painten) +// } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkView::ClearPageViews() +/*N*/ { +/*N*/ UnmarkAllObj(); +/*N*/ SdrSnapView::ClearPageViews(); +/*N*/ } + +/*N*/ void SdrMarkView::HidePage(SdrPageView* pPV) +/*N*/ { +/*N*/ if(pPV) +/*N*/ { +/*N*/ // break all creation actions when hiding page (#75081#) +/*N*/ BrkAction(); +/*N*/ +/*N*/ BOOL bVis(IsMarkHdlShown()); +/*N*/ +/*N*/ if(bVis) +/*?*/ HideMarkHdl(NULL); +/*N*/ +/*N*/ // Alle Markierungen dieser Seite verwerfen +/*N*/ BOOL bMrkChg(aMark.DeletePageView(*pPV)); +/*N*/ SdrSnapView::HidePage(pPV); +/*N*/ +/*N*/ if(bMrkChg) +/*N*/ { +/*?*/ MarkListHasChanged(); +/*?*/ AdjustMarkHdl(); +/*N*/ } +/*N*/ +/*N*/ if(bVis) +/*N*/ ShowMarkHdl(NULL); +/*N*/ } +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +/*N*/ void SdrMarkView::BrkMarkObj() +/*N*/ { +/*N*/ if (bMarking) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +/*N*/ void SdrMarkView::BrkMarkPoints() +/*N*/ { +/*N*/ if (bMarkingPoints) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +/*N*/ void SdrMarkView::BrkMarkGluePoints() +/*N*/ { +/*N*/ if (bMarkingGluePoints) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +//void SdrMarkView::DrawMarkHdl(OutputDevice* pOut, BOOL bNoRefHdl) const +//{ +// if (bHdlHidden) return; +//// if (IsSolidMarkHdl()) +// bNoRefHdl=FALSE; // geht leider erstmal nicht anders +// BOOL bOnlyRefs=USHORT(bNoRefHdl)==2; HACK(nur die Ref-Hdls painten) +// USHORT nWinAnz=GetWinCount(); +// USHORT nWinNum=0; +// do { +// OutputDevice* pO=pOut; +// if (pO==NULL) { +// pO=GetWin(nWinNum); +// nWinNum++; +// } +// if (pO!=NULL) { +// if (!bInsPolyPoint && !bNoRefHdl && !bOnlyRefs) { +// aHdl.DrawAll(*pO); +// } else { +// ULONG nHdlAnz=aHdl.GetHdlCount(); +// for (ULONG nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) { +// SdrHdl* pHdl=aHdl.GetHdl(nHdlNum); +// SdrHdlKind eKind=pHdl->GetKind(); +// USHORT nPtNum=pHdl->GetObjHdlNum(); +// const SdrObject* pObj=pHdl->GetObj(); +// if ((!bInsPolyPoint || nPtNum!=nInsPointNum || pObj==NULL || pObj!=pMarkedObj) && +// (!bNoRefHdl || (eKind!=HDL_REF1 && eKind!=HDL_REF2 && eKind!=HDL_MIRX))!=bOnlyRefs) { +// pHdl->Draw(*pO); +// } +// } +// } +// } +// } while (pOut==NULL && nWinNum<nWinAnz); +//} + +/*N*/ void SdrMarkView::ImpShowMarkHdl(OutputDevice* pOut, const Region* pRegion, BOOL bNoRefHdl) +/*N*/ { +// if (IsSolidMarkHdl()) +/*N*/ bNoRefHdl=FALSE; // geht leider erstmal nicht anders +/*N*/ if (!bHdlShown) { +// if (aHdl.IsSolidHdl()) { +// USHORT nAnz=pOut==NULL ? aWinList.GetCount() : 1; +// for (USHORT i=0; i<nAnz; i++) { +// USHORT nWinNum=pOut==NULL ? i : aWinList.Find(pOut); +// if (nWinNum!=SDRVIEWWIN_NOTFOUND) { +// if (aWinList[nWinNum].pVDev==NULL) { +// aWinList[nWinNum].pVDev=new VirtualDevice; +// } +// aHdl.SaveBackground(*aWinList[nWinNum].pWin,*aWinList[nWinNum].pVDev,pRegion); +// bSolidHdlBackgroundInvalid=FALSE; +// } +// } +// } +// DrawMarkHdl(pOut,bRefHdlShownOnly); +/*N*/ bRefHdlShownOnly=FALSE; +/*N*/ bHdlShown=TRUE; + + // refresh IAOs +// RefreshAllIAOManagers(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrMarkView::ShowMarkHdl(OutputDevice* pOut, BOOL bNoRefHdl) +/*N*/ { +// if (IsSolidMarkHdl()) +/*N*/ bNoRefHdl=FALSE; // geht leider erstmal nicht anders +/*N*/ ImpShowMarkHdl(pOut,NULL,bNoRefHdl); + + // refresh IAOs +//STRIP012/*N*/ RefreshAllIAOManagers(); +/*N*/ } + + +/*N*/ void SdrMarkView::HideMarkHdl(OutputDevice* pOut, BOOL bNoRefHdl) +/*N*/ { +// if (IsSolidMarkHdl()) +/*N*/ bNoRefHdl=FALSE; // geht leider erstmal nicht anders +/*N*/ if (bHdlShown) { +/*N*/ if (!bHdlHidden) { // #37331# + // Optimierung geht nicht, weil diverse Handles trotz SolidHdl doch noch XOR gapainted werden +// DrawMarkHdl(pOut,bNoRefHdl); +// if (aHdl.IsSolidHdl()) { +// BOOL bInvalidate=IsMarkHdlBackgroundInvalid(); +// USHORT nAnz=pOut==NULL ? aWinList.GetCount() : 1; +// for (USHORT i=0; i<nAnz; i++) { +// USHORT nWinNum=pOut==NULL ? i : aWinList.Find(pOut); +// if (nWinNum!=SDRVIEWWIN_NOTFOUND) { +// SdrViewWinRec& rWRec=GetWinRec(nWinNum); +// if (rWRec.pVDev!=NULL) { +// OutputDevice* pOut=rWRec.pWin; +// if (bInvalidate) { // fuer den Writer in einigen Faellen Invalidieren +// if (pOut->GetOutDevType()==OUTDEV_WINDOW) { +// aHdl.Invalidate(*(Window*)pOut); +// } +// } else { +// if (bNoRefHdl) { +// ULONG nHdlAnz=aHdl.GetHdlCount(); +// for (ULONG nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) { +// SdrHdl* pHdl=aHdl.GetHdl(nHdlNum); +// SdrHdlKind eKind=pHdl->GetKind(); +// USHORT nPtNum=pHdl->GetObjHdlNum(); +// if (eKind!=HDL_REF1 && eKind!=HDL_REF2 && eKind!=HDL_MIRX) { +// aHdl.RestoreBackground(*pOut,*rWRec.pVDev,(USHORT)nHdlNum); +// } +// } +// } else { +// aHdl.RestoreBackground(*pOut,*rWRec.pVDev); +// } +// } +// } +// } +// } +// } +/*N*/ } +/*N*/ bRefHdlShownOnly=bNoRefHdl; +/*N*/ bHdlShown=FALSE; +/*N*/ } +// bSolidHdlBackgroundInvalid=FALSE; + + // refresh IAOs +// RefreshAllIAOManagers(); +/*N*/ } + +/*N*/ void SdrMarkView::SetMarkHdlHidden(BOOL bOn) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ BOOL SdrMarkView::ImpIsFrameHandles() const +/*N*/ { +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ BOOL bFrmHdl=nMarkAnz>nFrameHandlesLimit || bForceFrameHandles; +/*N*/ BOOL bStdDrag=eDragMode==SDRDRAG_MOVE; +/*N*/ if (nMarkAnz==1 && bStdDrag && bFrmHdl) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (!bStdDrag && !bFrmHdl) { +/*?*/ // Grundsaetzlich erstmal alle anderen Dragmodi nur mit FrameHandles +/*?*/ bFrmHdl=TRUE; +/*?*/ if (eDragMode==SDRDRAG_ROTATE) { +/*?*/ // bei Rotate ObjOwn-Drag, wenn mind. 1 PolyObj +/*?*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz && bFrmHdl; nMarkNum++) { +/*?*/ const SdrMark* pM=aMark.GetMark(nMarkNum); +/*?*/ const SdrObject* pObj=pM->GetObj(); +/*?*/ bFrmHdl=!pObj->IsPolyObj(); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ if (!bFrmHdl) { +/*N*/ // FrameHandles, wenn wenigstens 1 Obj kein SpecialDrag kann +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ return bFrmHdl; +/*N*/ } + +/*N*/ void SdrMarkView::SetMarkHandles() +/*N*/ { +/*N*/ // #105722# remember old focus handle values to search for it again +/*N*/ const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl(); +/*N*/ sal_Bool bSaveOldFocus(sal_False); +/*N*/ sal_uInt16 nSavePolyNum, nSavePointNum; +/*N*/ SdrHdlKind eSaveKind; +/*N*/ SdrObject* pSaveObj; +/*N*/ +/*N*/ if(pSaveOldFocusHdl +/*N*/ && pSaveOldFocusHdl->GetObj() +/*N*/ && pSaveOldFocusHdl->GetObj()->ISA(SdrPathObj) +/*N*/ && (pSaveOldFocusHdl->GetKind() == HDL_POLY || pSaveOldFocusHdl->GetKind() == HDL_BWGT)) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); +/*N*/ } +/*N*/ +/*N*/ aHdl.Clear(); +/*N*/ aHdl.SetRotateShear(eDragMode==SDRDRAG_ROTATE); +/*N*/ aHdl.SetDistortShear(eDragMode==SDRDRAG_SHEAR); +/*N*/ pMarkedObj=NULL; +/*N*/ pMarkedPV=NULL; +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ BOOL bStdDrag=eDragMode==SDRDRAG_MOVE; +/*N*/ if (nMarkAnz==1) { +/*?*/ pMarkedObj=aMark.GetMark(0)->GetObj(); +/*N*/ } +/*N*/ BOOL bFrmHdl=ImpIsFrameHandles(); +/*N*/ if (nMarkAnz>0) { +/*?*/ pMarkedPV=aMark.GetMark(0)->GetPageView(); +/*?*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz && (pMarkedPV!=NULL || !bFrmHdl); nMarkNum++) { +/*?*/ const SdrMark* pM=aMark.GetMark(nMarkNum); +/*?*/ if (pMarkedPV!=pM->GetPageView()) { +/*?*/ pMarkedPV=NULL; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ if (bFrmHdl) { +/*N*/ Rectangle aRect(GetMarkedObjRect()); +/*N*/ if (!aRect.IsEmpty()) { // sonst nix gefunden +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 BOOL bWdt0=aRect.Left()==aRect.Right(); +/*N*/ } +/*N*/ } else { +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SdrMark* pM=aMark.GetMark(nMarkNum); +/*N*/ } // for nMarkNum +/*N*/ } // if bFrmHdl else +/*N*/ // GluePoint-Handles +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + // Drehpunkt/Spiegelachse +/*N*/ AddDragModeHdl(eDragMode); +/*N*/ +/*N*/ // add custom handles (used by other apps, e.g. AnchorPos) +/*N*/ AddCustomHdl(); +/*N*/ +/*N*/ // sort handles +/*N*/ aHdl.Sort(); +/*N*/ +/*N*/ // #105722# try to restore focus handle index from remembered values +/*N*/ if(bSaveOldFocus) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrMarkView::AddCustomHdl() +/*N*/ { +/*N*/ // add custom handles (used by other apps, e.g. AnchorPos) +/*N*/ } + +/*N*/ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) +/*N*/ { +/*N*/ switch(eMode) +/*N*/ { +/*?*/ case SDRDRAG_ROTATE: +/*?*/ { +/*?*/ // add rotation center +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SdrHdl* pHdl = new SdrHdl(aRef1, HDL_REF1); +/*?*/ +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ case SDRDRAG_MIRROR: +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ case SDRDRAG_TRANSPARENCE: +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ break; +/*?*/ } +/*?*/ case SDRDRAG_GRADIENT: +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ } + + + + +/*N*/ void SdrMarkView::CheckMarked() +/*N*/ { +/*N*/ for (ULONG nm=aMark.GetMarkCount(); nm>0;) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + // #67670# When this leads to a change, MarkListHasChanged() + // had been called before. Calling MarkListHasChanged() again + // could lead to problems in sfx, see BUG description. + // if(bChg) + // MarkListHasChanged(); + + // #97995# at least reset the remembered BoundRect to prevent handle + // generation if bForceFrameHandles is TRUE. +/*N*/ bMarkedObjRectDirty = TRUE; +/*N*/ } + +/*N*/ void SdrMarkView::SetMarkRects() +/*N*/ { +/*N*/ for (USHORT nv=0; nv<GetPageViewCount(); nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ pPV->SetHasMarkedObj(aMark.TakeSnapRect(pPV,pPV->MarkSnap())); +/*N*/ aMark.TakeBoundRect(pPV,pPV->MarkBound()); +/*N*/ } +/*N*/ } + +/*N*/ void SdrMarkView::SetFrameHandles(BOOL bOn) +/*N*/ { +/*N*/ if (bOn!=bForceFrameHandles) { +/*N*/ BOOL bOld=ImpIsFrameHandles(); +/*N*/ bForceFrameHandles=bOn; +/*N*/ BOOL bNew=ImpIsFrameHandles(); +/*N*/ if (bNew!=bOld) { +/*N*/ AdjustMarkHdl(TRUE); +/*N*/ MarkListHasChanged(); +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrMarkView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const +/*N*/ { +/*N*/ if (pObj) +/*N*/ { +/*N*/ if (pObj->IsMarkProtect() || +/*N*/ (!bDesignMode && pObj->IsUnoObj())) +/*N*/ { +/*N*/ // Objekt nicht selektierbar oder +/*N*/ // SdrUnoObj nicht im DesignMode +/*N*/ return FALSE; +/*N*/ } +/*N*/ } +/*N*/ return pPV!=NULL ? pPV->IsObjMarkable(pObj) : TRUE; +/*N*/ } + +/*N*/ void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, BOOL bUnmark, BOOL bImpNoSetMarkHdl) +/*N*/ { +/*N*/ if (pObj!=NULL && pPV!=NULL && IsObjMarkable(pObj, pPV)) { +/*N*/ BrkAction(); +/*N*/ if (!bUnmark) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } else { +/*N*/ ULONG nPos=aMark.FindObject(pObj); +/*N*/ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ if (!bImpNoSetMarkHdl) { +/*N*/ MarkListHasChanged(); +/*N*/ AdjustMarkHdl(TRUE); +/*N*/ // if (!IsSolidMarkHdl() || !bSomeObjChgdFlag) { +/*N*/ if (!bSomeObjChgdFlag) { +/*N*/ // ShowMarkHdl kommt sonst mit dem AfterPaintTimer +/*N*/ ShowMarkHdl(NULL); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrMarkView::SetSolidMarkHdl(BOOL bOn) +/*N*/ { +/*N*/ if (bOn!=aHdl.IsFineHdl()) { +/*N*/ BOOL bMerk=IsMarkHdlShown(); +/*N*/ if (bMerk) HideMarkHdl(NULL); +/*N*/ aHdl.SetFineHdl(bOn); +/*N*/ if (bMerk) ShowMarkHdl(NULL); +/*N*/ } +/*N*/ } + +/*N*/ #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ +/*N*/ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const +/*N*/ { +/*N*/ if ((nOptions & SDRSEARCH_IMPISMASTER) !=0 && pObj->IsNotVisibleAsMaster()) { +/*N*/ return NULL; +/*N*/ } +/*N*/ BOOL bCheckIfMarkable=(nOptions & SDRSEARCH_TESTMARKABLE)!=0; +/*N*/ BOOL bBack=(nOptions & SDRSEARCH_BACKWARD)!=0; +/*N*/ BOOL bDeep=(nOptions & SDRSEARCH_DEEP)!=0; +/*N*/ BOOL bOLE=pObj->ISA(SdrOle2Obj); +/*N*/ SdrObject* pRet=NULL; +/*N*/ Point aPnt1(rPnt-pPV->GetOffset()); // rPnt auf PageView transformieren +/*N*/ Rectangle aRect(pObj->GetBoundRect()); +/*N*/ USHORT nTol2=nTol; +/*N*/ // Doppelte Tolezanz fuer ein an dieser View im TextEdit befindliches Objekt +/*N*/ if (bOLE || pObj==((SdrObjEditView*)this)->GetTextEditObject()) nTol2*=2; +/*N*/ aRect.Left ()-=nTol2; // Einmal Toleranz drauf fuer alle Objekte +/*N*/ aRect.Top ()-=nTol2; +/*N*/ aRect.Right ()+=nTol2; +/*N*/ aRect.Bottom()+=nTol2; +/*N*/ if (aRect.IsInside(aPnt1)) { +/*N*/ if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV))) { +/*N*/ SdrObjList* pOL=pObj->GetSubList(); +/*N*/ if (pOL!=NULL && pOL->GetObjCount()!=0) { +/*N*/ SdrObject* pTmpObj; +/*N*/ // OD 30.06.2003 #108784# - adjustment hit point for virtual +/*N*/ // objects. +/*N*/ Point aPnt( rPnt ); +/*N*/ if ( pObj->ISA(SdrVirtObj) ) +/*N*/ { +/*N*/ Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset(); +/*N*/ aPnt.Move( -aOffset.X(), -aOffset.Y() ); +/*N*/ } +/*N*/ pRet=ImpCheckObjHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj); +/*N*/ } else { +/*N*/ SdrLayerID nLay=pObj->GetLayer(); +/*N*/ if (pPV->GetVisibleLayers().IsSet(nLay) && +/*N*/ (pMVisLay==NULL || pMVisLay->IsSet(nLay))) +/*N*/ { +/*N*/ pRet=pObj->CheckHit(aPnt1,nTol2,&pPV->GetVisibleLayers()); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (!bDeep && pRet!=NULL) pRet=pObj; +/*N*/ return pRet; +/*N*/ } + +/*N*/ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const +/*N*/ { +/*N*/ BOOL bBack=(nOptions & SDRSEARCH_BACKWARD)!=0; +/*N*/ SdrObject* pRet=NULL; +/*N*/ rpRootObj=NULL; +/*N*/ if (pOL!=NULL) { +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ ULONG nObjNum=bBack ? 0 : nObjAnz; +/*N*/ while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) { +/*N*/ if (!bBack) nObjNum--; +/*N*/ SdrObject* pObj=pOL->GetObj(nObjNum); +/*N*/ pRet=ImpCheckObjHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay); +/*N*/ if (pRet!=NULL) rpRootObj=pObj; +/*N*/ if (bBack) nObjNum++; +/*N*/ } +/*N*/ } +/*N*/ return pRet; +/*N*/ } + +/*N*/ void SdrMarkView::UnmarkAllObj(SdrPageView* pPV) +/*N*/ { +/*N*/ if (aMark.GetMarkCount()!=0) { +/*?*/ BrkAction(); +/*?*/ BOOL bVis=bHdlShown; +/*?*/ if (bVis) HideMarkHdl(NULL); +/*?*/ if (pPV!=NULL) { +/*?*/ aMark.DeletePageView(*pPV); +/*?*/ } else { +/*?*/ aMark.Clear(); +/*?*/ } +/*?*/ pMarkedObj=NULL; +/*?*/ pMarkedPV=NULL; +/*?*/ MarkListHasChanged(); +/*?*/ AdjustMarkHdl(TRUE); +/*?*/ if (bVis) ShowMarkHdl(NULL); // ggf. fuer die RefPoints +/*?*/ } +/*N*/ } + + +/*N*/ void SdrMarkView::AdjustMarkHdl(BOOL bRestraintPaint) +/*N*/ { +/*N*/ BOOL bVis=bHdlShown; +/*N*/ if (bVis) HideMarkHdl(NULL); +/*N*/ CheckMarked(); +/*N*/ SetMarkRects(); +/*N*/ SetMarkHandles(); +/*N*/ if(bRestraintPaint && bVis) +/*N*/ { +/*?*/ ShowMarkHdl(NULL); +/*N*/ +/*N*/ // refresh IAOs +//STRIP012/*N*/ //--/ RefreshAllIAOManagers(); +/*N*/ } +/*N*/ } + + +/*N*/ const Rectangle& SdrMarkView::GetMarkedObjRect() const +/*N*/ { +/*N*/ if (bMarkedObjRectDirty) { +/*N*/ ((SdrMarkView*)this)->bMarkedObjRectDirty=FALSE; +/*N*/ Rectangle aRect; +/*N*/ for (ULONG nm=0; nm<aMark.GetMarkCount(); nm++) { +/*?*/ SdrMark* pM=aMark.GetMark(nm); +/*?*/ SdrObject* pO=pM->GetObj(); +/*?*/ Rectangle aR1(pO->GetSnapRect()); +/*?*/ aR1+=pM->GetPageView()->GetOffset(); +/*?*/ if (aRect.IsEmpty()) aRect=aR1; +/*?*/ else aRect.Union(aR1); +/*N*/ } +/*N*/ ((SdrMarkView*)this)->aMarkedObjRect=aRect; +/*N*/ } +/*N*/ return aMarkedObjRect; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +// #i13033# +// Helper method for building the transitive hull of all selected +// objects + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkView::MarkListHasChanged() +/*N*/ { +/*N*/ aMark.SetNameDirty(); +/*N*/ bEdgesOfMarkedNodesDirty=TRUE; +/*N*/ aEdgesOfMarkedNodes.Clear(); +/*N*/ aMarkedEdgesOfMarkedNodes.Clear(); +/*N*/ +/*N*/ // #i13033# +/*N*/ // Forget transitive hull of complete selection +/*N*/ maAllMarkedObjects.Clear(); +/*N*/ +/*N*/ bMarkedObjRectDirty=TRUE; +/*N*/ bMarkedPointsRectsDirty=TRUE; +/*N*/ #ifndef SVX_LIGHT +/*?*/ if (pItemBrowser!=NULL) DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pItemBrowser->SetDirty(); +/*N*/ #endif +/*N*/ BOOL bOneEdgeMarked=FALSE; +/*N*/ if (aMark.GetMarkCount()==1) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ ImpSetGlueVisible4(bOneEdgeMarked); +/*N*/ } +/*N*/ +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ SdrSnapView::WriteRecords(rOut); +/*N*/ { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWDRAGMODE); +/*N*/ rOut<<BOOL(eEditMode==SDREDITMODE_EDIT); // wg. Kompatibilitaet +/*N*/ rOut<<USHORT(eDragMode); +/*N*/ rOut<<aRef1; +/*N*/ rOut<<aRef2; +/*N*/ rOut<<BOOL(bForceFrameHandles); +/*N*/ rOut<<BOOL(bPlusHdlAlways); +/*N*/ rOut<<BOOL(eEditMode==SDREDITMODE_GLUEPOINTEDIT); // wg. Kompatibilitaet +/*N*/ rOut<<USHORT(eEditMode); +/*N*/ rOut<<BOOL(bMarkHdlWhenTextEdit); +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWCROOKCENTER); +/*N*/ rOut<<aLastCrookCenter; +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrMarkView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) { +/*N*/ bRet=TRUE; +/*N*/ switch (rSubHead.GetIdentifier()) { +/*N*/ case SDRIORECNAME_VIEWDRAGMODE: { +/*N*/ eEditMode=SDREDITMODE_EDIT; +/*N*/ BOOL bTmpBool; +/*N*/ USHORT nTmpUShort; +/*N*/ rIn>>bTmpBool; if (!bTmpBool) eEditMode=SDREDITMODE_CREATE; // wg. Kompatibilitaet +/*N*/ USHORT nDragMode; +/*N*/ rIn>>nDragMode; +/*N*/ eDragMode=SdrDragMode(nDragMode); +/*N*/ rIn>>aRef1; +/*N*/ rIn>>aRef2; +/*N*/ rIn>>bTmpBool; bForceFrameHandles=bTmpBool; +/*N*/ rIn>>bTmpBool; bPlusHdlAlways=bTmpBool; +/*N*/ if (rSubHead.GetBytesLeft()!=0) { +/*N*/ rIn>>bTmpBool; +/*N*/ if (bTmpBool) eEditMode=SDREDITMODE_GLUEPOINTEDIT; // wg. Kompatibilitaet +/*N*/ } +/*N*/ if (rSubHead.GetBytesLeft()!=0) { +/*N*/ rIn>>nTmpUShort; +/*N*/ eEditMode=(SdrViewEditMode)nTmpUShort; +/*N*/ } +/*N*/ bGlueVisible2=eEditMode==SDREDITMODE_GLUEPOINTEDIT; +/*N*/ if (rSubHead.GetBytesLeft()!=0) { +/*N*/ rIn>>bTmpBool; +/*N*/ bMarkHdlWhenTextEdit=bTmpBool; +/*N*/ } +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWCROOKCENTER: { +/*N*/ rIn>>aLastCrookCenter; +/*N*/ } break; +/*N*/ default: bRet=FALSE; +/*N*/ } +/*N*/ } +/*N*/ if (!bRet) bRet=SdrSnapView::ReadRecord(rViewHead,rSubHead,rIn); +/*N*/ return bRet; +/*N*/ } + + + +/*N*/ void SdrMarkView::SetDesignMode(BOOL bOn) +/*N*/ { +/*N*/ if (bDesignMode != bOn) +/*N*/ { +/*N*/ bDesignMode = bOn; +/*N*/ // Setzen des Modes fuer alle Controls +/*N*/ USHORT nAnz = GetPageViewCount(); +/*N*/ for (USHORT nv = 0; nv<nAnz; nv++) +/*N*/ { +/*N*/ SdrPageView* pPV = GetPageViewPvNum(nv); +/*N*/ const SdrPageViewWinList& rWinList = pPV->GetWinList(); +/*N*/ for (ULONG i = 0; i < rWinList.GetCount(); i++) +/*N*/ { +/*N*/ const SdrPageViewWinRec& rWR = rWinList[ (USHORT) i]; +/*N*/ const SdrUnoControlList& rControlList = rWR.GetControlList(); +/*N*/ +/*N*/ for(UINT32 j = 0; j < rControlList.GetCount(); j++) +/*N*/ { +/*?*/ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl = rControlList[ (USHORT) j].GetControl(); +/*?*/ DBG_ASSERT( xControl.is(), "SdrMarkView::SetDesignMode: no control at this position!" ); +/*?*/ if ( xControl.is() ) +/*?*/ xControl->setDesignMode(bOn); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +// MarkHandles Objektaenderung: +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// - Bei Notify mit HINT_OBJCHG (oder so) werden die Handles erstmal versteckt +// (wenn nicht schon wegen Dragging versteckt). +// - XorHdl: Bei ModelHasChanged() werden sie dann wieder angezeigt. +// - PaintEvents kommen nun durch. +// - Die XorHandles werden z.T. wieder uebermalt. +// - Xor: Nach dem Painten werden die Handles im (vom PaintHandler gerufenen) +// InitRedraw per ToggleShownXor bei gesetzter ClipRegion nochmal gemalt +// und damit ist alles in Butter. +// - ToggleShownXor macht bei SolidHdl nix weil bHdlShown=FALSE +// - Der AfterPaintTimer wird gestartet. +// - SolidHdl: Im AfterPaintHandler wird ShowMarkHdl gerufen. +// Da die Handles zu diesem Zeitpunkt nicht angezeigt sind wird: +// - SaveBackground durchgefuehrt. +// - DrawMarkHdl gerufen und bHdlShown gesetzt. +// +// MarkHandles bei sonstigem Invalidate: +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// In diesem Fall bekomme ich kein Notify und beim Aufruf des +// PaintHandlers->InitRedraw() sind auch die SolidHandles sichtbar. + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdmrkv1.cxx b/binfilter/bf_svx/source/svdraw/svx_svdmrkv1.cxx new file mode 100644 index 000000000000..3cf65344a180 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdmrkv1.cxx @@ -0,0 +1,107 @@ +/* -*- 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 "svdmrkv.hxx" +namespace binfilter { + +/*N*/ BOOL SdrMarkView::HasMarkedPoints() const +/*N*/ { +/*N*/ ForceUndirtyMrkPnt(); +/*N*/ BOOL bRet=FALSE; +/*N*/ if (!ImpIsFrameHandles()) { +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ if (nMarkAnz<=nFrameHandlesLimit) { +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) { +/*?*/ const SdrMark* pM=aMark.GetMark(nMarkNum); +/*?*/ const SdrUShortCont* pPts=pM->GetMarkedPoints(); +/*?*/ bRet=pPts!=NULL && pPts->GetCount()!=0; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ void SdrMarkView::SetPlusHandlesAlwaysVisible(BOOL bOn) +/*N*/ { // HandlePaint optimieren !!!!!!! +/*N*/ ForceUndirtyMrkPnt(); +/*N*/ if (bOn!=bPlusHdlAlways) { +/*?*/ BOOL bVis=IsMarkHdlShown(); +/*?*/ if (bVis) HideMarkHdl(NULL); +/*?*/ bPlusHdlAlways=bOn; +/*?*/ SetMarkHandles(); +/*?*/ if (bVis) ShowMarkHdl(NULL); +/*?*/ MarkListHasChanged(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ImpSetPointsRects() ist fuer PolyPoints und GluePoints! +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// UndirtyMrkPnt() ist fuer PolyPoints und GluePoints! +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMarkView::UndirtyMrkPnt() const +/*N*/ { +/*N*/ BOOL bChg=FALSE; +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (bChg) ((SdrMarkView*)this)->bMarkedPointsRectsDirty=TRUE; +/*N*/ ((SdrMarkView*)this)->bMrkPntDirty=FALSE; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/*N*/ BOOL SdrMarkView::HasMarkedGluePoints() const +/*N*/ { +/*N*/ ForceUndirtyMrkPnt(); +/*N*/ BOOL bRet=FALSE; +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) { +/*?*/ const SdrMark* pM=aMark.GetMark(nMarkNum); +/*?*/ const SdrUShortCont* pPts=pM->GetMarkedGluePoints(); +/*?*/ bRet=pPts!=NULL && pPts->GetCount()!=0; +/*N*/ } +/*N*/ return bRet; +/*N*/ } + + +/*N*/ BOOL SdrMarkView::MarkGluePoints(const Rectangle* pRect, BOOL bUnmark) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdoattr.cxx b/binfilter/bf_svx/source/svdraw/svx_svdoattr.cxx new file mode 100644 index 000000000000..9fa4811a2937 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdoattr.cxx @@ -0,0 +1,1049 @@ +/* -*- 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 "xpool.hxx" +#include "svdio.hxx" +#include "svdmodel.hxx" +#include "svdpage.hxx" +#include "svdpool.hxx" +#include "svdocapt.hxx" + +#include <bf_svtools/smplhint.hxx> + +#include "xlnstwit.hxx" + +#include "xlnedwit.hxx" + +#include <eeitemid.hxx> + +#include "eeitem.hxx" + +#include <xlnstcit.hxx> + +#include <xlnwtit.hxx> + + +#include <bf_svtools/style.hxx> + +#include <bf_svtools/whiter.hxx> + + +#include <xflclit.hxx> + + +#include <xfltrit.hxx> + +#include <xlnedcit.hxx> + +#include <adjitem.hxx> + +#include "xflbckit.hxx" + + +#include "xbtmpit.hxx" +#include "xlndsit.hxx" +#include "xlnedit.hxx" +#include "xflftrit.hxx" +#include "xflhtit.hxx" +#include "xlnstit.hxx" +#include "xoutx.hxx" +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrAttrObj,SdrObject); + +/*N*/ SdrAttrObj::SdrAttrObj() +/*N*/ : mpStyleSheet(NULL), +/*N*/ mpObjectItemSet(NULL) +/*N*/ { +/*N*/ } + +/*N*/ SdrAttrObj::~SdrAttrObj() +/*N*/ { +/*N*/ ImpDeleteItemSet(); +/*N*/ } + +/*N*/ void SdrAttrObj::ImpDeleteItemSet() +/*N*/ { +/*N*/ if(mpObjectItemSet) +/*N*/ { +/*N*/ if(GetStyleSheet()) +/*N*/ RemoveStyleSheet(); +/*N*/ +/*N*/ delete mpObjectItemSet; +/*N*/ mpObjectItemSet = 0L; +/*N*/ } +/*N*/ } + +/*N*/ void SdrAttrObj::ImpForceItemSet() +/*N*/ { +/*N*/ if(!mpObjectItemSet) +/*N*/ { +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ mpObjectItemSet = CreateNewItemSet(*pPool); +/*N*/ ForceDefaultAttr(); +/*N*/ } +/*N*/ } + +/*N*/ const Rectangle& SdrAttrObj::GetSnapRect() const +/*N*/ { +/*N*/ if(bSnapRectDirty) +/*N*/ { +/*N*/ ((SdrAttrObj*)this)->RecalcSnapRect(); +/*N*/ ((SdrAttrObj*)this)->bSnapRectDirty = FALSE; +/*N*/ } +/*N*/ return maSnapRect; +/*N*/ } + +/*N*/ void SdrAttrObj::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::operator=(rObj); +/*N*/ +/*N*/ SdrAttrObj* pAO = PTR_CAST(SdrAttrObj, (SdrObject*)&rObj); +/*N*/ if(pAO) +/*N*/ { +/*N*/ ImpDeleteItemSet(); +/*N*/ +/*N*/ if(pAO->mpObjectItemSet) +/*N*/ mpObjectItemSet = pAO->mpObjectItemSet->Clone(TRUE); +/*N*/ +/*N*/ if(pAO->GetStyleSheet()) +/*?*/ AddStyleSheet(pAO->GetStyleSheet(), TRUE); +/*N*/ } +/*N*/ } + +/*N*/ void SdrAttrObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*N*/ return; +/*N*/ +/*N*/ // call parent +/*N*/ SdrObject::ReadData(rHead, rIn); +/*N*/ +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrAttrObj"); +/*N*/ #endif +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ sal_uInt16 nSetID; +/*N*/ +/*N*/ // #89025# if mpObjectItemSet is set and contains items, it is because of ForceDefaultAttr() +/*N*/ // and the items need to be deleted. +/*N*/ if(mpObjectItemSet && mpObjectItemSet->Count()) +/*N*/ mpObjectItemSet->ClearItem(0); +/*N*/ +/*N*/ // Do this initialization AFTER the above fix +/*N*/ SfxItemSet aNewSet(GetItemSet()); +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = XATTRSET_LINE; +/*N*/ const XLineAttrSetItem* pLineAttr = (const XLineAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pLineAttr) +/*N*/ aNewSet.Put(pLineAttr->GetItemSet()); +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = XATTRSET_FILL; +/*N*/ const XFillAttrSetItem* pFillAttr = (const XFillAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pFillAttr) +/*N*/ aNewSet.Put(pFillAttr->GetItemSet()); +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = XATTRSET_TEXT; +/*N*/ const XTextAttrSetItem* pTextAttr = (const XTextAttrSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pTextAttr) +/*N*/ aNewSet.Put(pTextAttr->GetItemSet()); +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = SDRATTRSET_SHADOW; +/*N*/ const SdrShadowSetItem* pShadAttr = (const SdrShadowSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pShadAttr) +/*N*/ aNewSet.Put(pShadAttr->GetItemSet()); +/*N*/ +/*N*/ if(rHead.GetVersion() >= 5) +/*N*/ { +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = SDRATTRSET_OUTLINER; +/*N*/ const SdrOutlinerSetItem* pOutlAttr = (const SdrOutlinerSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pOutlAttr) +/*N*/ aNewSet.Put(pOutlAttr->GetItemSet()); +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 6) +/*N*/ { +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ { sal_uInt16 nWhichDum; rIn >> nWhichDum; } +/*N*/ nSetID = SDRATTRSET_MISC; +/*N*/ const SdrMiscSetItem* pMiscAttr = (const SdrMiscSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pMiscAttr) +/*N*/ aNewSet.Put(pMiscAttr->GetItemSet()); +/*N*/ } +/*N*/ +/*N*/ SetItemSet(aNewSet); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // an den Surrogaten und ggf. auch Whiches vorbeiseeken +/*N*/ // ganz zu anfang waren es 4 SetItems +/*N*/ sal_uInt16 nAnz(4); +/*N*/ +/*N*/ if(rHead.GetVersion() >= 5) +/*N*/ nAnz++; +/*N*/ +/*N*/ if(rHead.GetVersion() >= 6) +/*N*/ nAnz++; +/*N*/ +/*N*/ nAnz *= sizeof(sal_uInt16); +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) +/*N*/ nAnz *= 2; +/*N*/ +/*N*/ rIn.SeekRel(nAnz); +/*N*/ } +/*N*/ +/*N*/ // TextToContour: altes Format(Flag) in neues Format(Item) wandeln +/*N*/ if(rHead.GetVersion() <= 4 && pPool) +/*N*/ { +/*?*/ SetItem(XFormTextStyleItem(XFT_NONE)); +/*N*/ } +/*N*/ + // Fuer die StyleSheetgeschichte gehoert eigentlich auch noch eine + // Versionsabfrage hierher. + // Name und Familie des StyleSheet einlesen, in Pointer auf StyleSheet + // umwandeln lassen (SB) +/*N*/ XubString aStyleSheetName; +/*N*/ SfxStyleFamily eFamily; +/*N*/ sal_uInt16 nRead; +/*N*/ +/*N*/ // UNICODE: rIn>>aStyleSheetName; +/*N*/ rIn.ReadByteString(aStyleSheetName); +/*N*/ +/*N*/ if(aStyleSheetName.Len()) +/*N*/ { +/*N*/ rIn >> nRead; +/*N*/ eFamily = (SfxStyleFamily)(int)nRead; +/*N*/ +/*N*/ // ab Version 1 wird der CharacterSet gelesen, ab V11 nicht mehr +/*N*/ if(rHead.GetVersion() > 0 && rHead.GetVersion() < 11) +/*N*/ { +/*N*/ sal_Int16 nCharSet; +/*N*/ rIn >> nCharSet; +/*N*/ //aStyleSheetName.Convert((CharSet)nCharSet); +/*N*/ // nicht mehr noetig, da ab Vers 11 der CharSet bereits am +/*N*/ // Stream gesetzt wird. +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT(pModel, "SdrAttrObj::ReadData(): pModel=NULL, StyleSheet kann nicht gesetzt werden!"); +/*N*/ if(pModel) +/*N*/ { +/*N*/ SfxStyleSheetBasePool *pPool = pModel->GetStyleSheetPool(); +/*N*/ if(pPool) +/*N*/ { +/*N*/ SfxStyleSheet *pTmpStyleSheet = (SfxStyleSheet*)pPool->Find(aStyleSheetName, eFamily); +/*N*/ DBG_ASSERT(pTmpStyleSheet, "SdrAttrObj::ReadData(): StyleSheet nicht gefunden"); +/*N*/ +/*N*/ if(pTmpStyleSheet) +/*N*/ AddStyleSheet(pTmpStyleSheet, TRUE); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrAttrObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::PreSave(); +/*N*/ +/*N*/ // prepare SetItems for storage +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*N*/ +/*N*/ XLineAttrSetItem aLineAttr(rSet.GetPool()); +/*N*/ aLineAttr.GetItemSet().Put(rSet); +/*N*/ aLineAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aLineAttr); +/*N*/ +/*N*/ XFillAttrSetItem aFillAttr(rSet.GetPool()); +/*N*/ aFillAttr.GetItemSet().Put(rSet); +/*N*/ aFillAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aFillAttr); +/*N*/ +/*N*/ XTextAttrSetItem aTextAttr(rSet.GetPool()); +/*N*/ aTextAttr.GetItemSet().Put(rSet); +/*N*/ aTextAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aTextAttr); +/*N*/ +/*N*/ SdrShadowSetItem aShadAttr(rSet.GetPool()); +/*N*/ aShadAttr.GetItemSet().Put(rSet); +/*N*/ aShadAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aShadAttr); +/*N*/ +/*N*/ SdrOutlinerSetItem aOutlAttr(rSet.GetPool()); +/*N*/ aOutlAttr.GetItemSet().Put(rSet); +/*N*/ aOutlAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aOutlAttr); +/*N*/ +/*N*/ SdrMiscSetItem aMiscAttr(rSet.GetPool()); +/*N*/ aMiscAttr.GetItemSet().Put(rSet); +/*N*/ aMiscAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aMiscAttr); +/*N*/ } + +/*N*/ void SdrAttrObj::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::PostSave(); +/*N*/ +/*N*/ // remove SetItems from local itemset +/*N*/ ((SdrAttrObj*)this)->ImpForceItemSet(); +/*N*/ mpObjectItemSet->ClearItem(XATTRSET_LINE); +/*N*/ mpObjectItemSet->ClearItem(XATTRSET_FILL); +/*N*/ mpObjectItemSet->ClearItem(XATTRSET_TEXT); +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_SHADOW); +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_OUTLINER); +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_MISC); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrAttrObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::WriteData(rOut); +/*N*/ +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrAttrObj"); +/*N*/ #endif +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_LINE)); +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_FILL)); +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(XATTRSET_TEXT)); +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_SHADOW)); +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_OUTLINER)); +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_MISC)); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*?*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*N*/ } + + // StyleSheet-Pointer als Name, Familie abspeichern + // wenn kein StyleSheet vorhanden: leeren String speichern +/*N*/ if(GetStyleSheet()) +/*N*/ { +/*N*/ // UNICODE: rOut << pStyleSheet->GetName(); +/*N*/ rOut.WriteByteString(GetStyleSheet()->GetName()); +/*N*/ rOut << (sal_uInt16)(int)(GetStyleSheet()->GetFamily()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // UNICODE: rOut << String(); +/*N*/ rOut.WriteByteString(String()); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrAttrObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrModel* pOldModel = pModel; +/*N*/ +/*N*/ // test for correct pool in ItemSet; move to new pool if necessary +/*N*/ if(pNewModel && mpObjectItemSet && mpObjectItemSet->GetPool() != &pNewModel->GetItemPool()) +/*N*/ MigrateItemPool(mpObjectItemSet->GetPool(), &pNewModel->GetItemPool(), pNewModel); +/*N*/ +/*N*/ // call parent +/*N*/ SdrObject::SetModel(pNewModel); +/*N*/ +/*N*/ if(pOldModel != pNewModel && pNewModel && !pNewModel->IsLoading()) +/*N*/ { +/*N*/ +/*N*/ // fuer ein bereits "lebendes" Model die Attribute von einem Pool in den anderen schieben +/*N*/ if(pOldModel) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ // Jedes Objekt bekommt initial den DefaultStyleSheet +/*N*/ // des Model, falls noch kein StyleSheet gesetzt. +/*N*/ if(mpObjectItemSet && !GetStyleSheet() && pModel && !pModel->IsLoading()) +/*N*/ NbcSetStyleSheet(pModel->GetDefaultStyleSheet(), TRUE); + +/* this code was removed because NbcSetStyleSheet called with TRUE does not + alter the hard attributes. So they don't need to be restored, a useless + process that cost us up to 20% for xml import. Also there is a memory + leek with aSet.Put( *pItem->Clone() ); + { + SfxStyleSheet* pDefSS = pModel->GetDefaultStyleSheet(); + + if(pDefSS) + { + SfxItemPool* pPool = GetItemPool(); + if ( pPool ) + { + // Take hard attributes + SfxItemSet aSet(*pPool, + SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1, + SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END, + EE_ITEMS_START,EE_ITEMS_END, + 0,0); + + const SfxItemSet& rItemSet = GetItemSet(); + + SfxWhichIter aIter( rItemSet ); + sal_uInt16 nWhich( aIter.FirstWhich() ); + const SfxPoolItem* pItem = NULL; + + while( nWhich ) + { + if( SFX_ITEM_SET == rItemSet.GetItemState( nWhich, FALSE, &pItem ) ) + aSet.Put( *pItem->Clone() ); + nWhich = aIter.NextWhich(); + } + // Set the StyleSheet + NbcSetStyleSheet(pDefSS, TRUE); + + // Set the hard attributes + SetItemSet( aSet ); + } + else + NbcSetStyleSheet(pDefSS, TRUE); + } + } +*/ +/*N*/ } +/*N*/ } + +/*N*/ void SdrAttrObj::ForceDefaultAttr() +/*N*/ { +/*N*/ SdrTextObj* pText = PTR_CAST(SdrTextObj, this); +/*N*/ BOOL bTextFrame(pText && pText->IsTextFrame()); +/*N*/ +/*N*/ ImpForceItemSet(); +/*N*/ if(bTextFrame) +/*N*/ { +/*N*/ SdrCaptionObj* pCapt = PTR_CAST(SdrCaptionObj, this); +/*N*/ BOOL bCaption(pCapt != 0L); +/*N*/ +/*N*/ if(!bCaption) +/*N*/ mpObjectItemSet->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ +/*N*/ mpObjectItemSet->Put(XFillColorItem(String(), Color(COL_WHITE))); +/*N*/ mpObjectItemSet->Put(XFillStyleItem(XFILL_NONE)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ mpObjectItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); +/*N*/ mpObjectItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); +/*N*/ mpObjectItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ const SfxItemSet& SdrAttrObj::GetItemSet() const +/*N*/ { +/*N*/ ((SdrAttrObj*)this)->ImpForceItemSet(); +/*N*/ return *mpObjectItemSet; +/*N*/ } + +/*N*/ SfxItemSet* SdrAttrObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// syntactical sugar for ItemSet accesses + +/*N*/ const SfxItemSet& SdrAttrObj::GetUnmergedItemSet() const +/*N*/ { +/*N*/ return SdrAttrObj::GetItemSet(); +/*N*/ } + +/*N*/ void SdrAttrObj::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) +/*N*/ { +/*N*/ if(pNewItem) +/*N*/ { +/*N*/ const SfxPoolItem* pItem = pNewItem; +/*N*/ +/*N*/ switch( nWhich ) +/*N*/ { +/*N*/ case XATTR_FILLBITMAP: +/*N*/ pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_LINEDASH: +/*N*/ pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_LINESTART: +/*N*/ pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_LINEEND: +/*N*/ pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_FILLGRADIENT: +/*N*/ pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_FILLFLOATTRANSPARENCE: +/*N*/ // #85953# allow all kinds of XFillFloatTransparenceItem to be set +/*N*/ pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ case XATTR_FILLHATCH: +/*N*/ pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pModel ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // set item +/*N*/ if( pItem ) +/*N*/ { +/*N*/ ((SdrAttrObj*)this)->ImpForceItemSet(); +/*N*/ mpObjectItemSet->Put(*pItem); +/*N*/ +/*N*/ // delete item if it was a generated one +/*N*/ if( pItem != pNewItem) +/*N*/ delete (SfxPoolItem*)pItem; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // clear item +/*N*/ if(mpObjectItemSet) +/*N*/ { +/*N*/ mpObjectItemSet->ClearItem(nWhich); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrAttrObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::ItemSetChanged(rSet); +/*N*/ +/*N*/ // own modifications +/*N*/ bBoundRectDirty = TRUE; +/*N*/ SetRectsDirty(TRUE); +/*N*/ SetChanged(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void __EXPORT SdrAttrObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, +/*N*/ const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint); +/*N*/ BOOL bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId()); +/*N*/ SfxStyleSheetHint *pStyleHint = PTR_CAST(SfxStyleSheetHint, &rHint); +/*N*/ BOOL bDying(pStyleHint +/*N*/ && pStyleHint->GetStyleSheet() == GetStyleSheet() +/*N*/ && ( SFX_STYLESHEET_INDESTRUCTION == pStyleHint->GetHint() || +/*N*/ SFX_STYLESHEET_ERASED == pStyleHint->GetHint() )); +/*N*/ +/*N*/ if(bDataChg || bDying) +/*N*/ { +/*N*/ Rectangle aBoundRect0; +/*N*/ +/*N*/ if(pUserCall) +/*N*/ aBoundRect0 = GetBoundRect(); +/*N*/ +/*N*/ SfxStyleSheet* pNewStSh = NULL; +/*N*/ BOOL bBoundRectDirty0 = bBoundRectDirty; +/*N*/ +/*N*/ if(bDying) +/*N*/ { +/*N*/ // wenn es einen Parent gibt, wird jetzt der genommen +/*N*/ if(pModel && HAS_BASE(SfxStyleSheet, GetStyleSheet())) +/*N*/ { +/*N*/ // Sonst ist pStyleSheet schon zu weit weggestorben +/*N*/ pNewStSh = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find( +/*N*/ GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily()); +/*N*/ } +/*N*/ +/*N*/ // wenn es keinen Parent gibt, nehmen wir die Standardvorlage +/*N*/ if(!pNewStSh && pModel) +/*N*/ pNewStSh = pModel->GetDefaultStyleSheet(); +/*N*/ +/*N*/ // alten StyleSheet vor SendRepaintBroadcast entfernen #42276# +/*N*/ RemoveStyleSheet(); // setzt bBoundRectDirty=TRUE +/*N*/ } +/*N*/ +/*N*/ if(!bBoundRectDirty0) +/*N*/ { +/*N*/ bBoundRectDirty = FALSE; // fuer Broadcast mit dem alten Rect +/*N*/ +/*N*/ if(pPage && pPage->IsInserted()) +/*N*/ SendRepaintBroadcast(); // Erstmal mit dem alten Rect +/*N*/ +/*N*/ bBoundRectDirty = TRUE; +/*N*/ SetRectsDirty(TRUE); // Durch Vorlagenloeschung evtl. andere Linienbreite +/*N*/ } +/*N*/ +/*N*/ if(pNewStSh && !bDying) +/*N*/ AddStyleSheet(pNewStSh, TRUE); +/*N*/ +/*N*/ if(pPage && pPage->IsInserted()) +/*N*/ SendRepaintBroadcast(); +/*N*/ +/*N*/ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ SfxStyleSheet* SdrAttrObj::GetStyleSheet() const +/*N*/ { +/*N*/ return mpStyleSheet; +/*N*/ } + +/*N*/ void SdrAttrObj::RemoveStyleSheet() +/*N*/ { +/*N*/ // Typ checken, weil bei dying sich der Typ abbaut (bis zum Broadcaster runter) +/*N*/ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet)) +/*N*/ { +/*N*/ EndListening(*mpStyleSheet); +/*N*/ EndListening(mpStyleSheet->GetPool()); +/*N*/ +/*N*/ // das ItemSet der Vorlage ist jetzt nicht mehr Parent der +/*N*/ // eigenen ItemSets +/*N*/ if(mpObjectItemSet) +/*N*/ mpObjectItemSet->SetParent(NULL); +/*N*/ +/*N*/ bBoundRectDirty = TRUE; +/*N*/ SetRectsDirty(TRUE); +/*N*/ } +/*N*/ mpStyleSheet = NULL; +/*N*/ } + +/*N*/ void SdrAttrObj::AddStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ // old StyleSheet is deleted +/*N*/ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (?)"); +/*N*/ +/*N*/ if(pNewStyleSheet) +/*N*/ { +/*N*/ mpStyleSheet = pNewStyleSheet; +/*N*/ +/*N*/ // ItemSet is needed here, force it +/*N*/ ImpForceItemSet(); +/*N*/ +/*N*/ // als Listener anmelden +/*N*/ StartListening(pNewStyleSheet->GetPool()); +/*N*/ StartListening(*pNewStyleSheet); +/*N*/ +/*N*/ // harte Attributierung dort loeschen, wo was in der Vorlage steht +/*N*/ if(!bDontRemoveHardAttr) +/*N*/ { +/*N*/ const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet(); +/*N*/ SfxWhichIter aIter(rStyle); +/*N*/ sal_uInt16 nWhich = aIter.FirstWhich(); +/*N*/ +/*N*/ while(nWhich) +/*N*/ { +/*N*/ if(SFX_ITEM_SET == rStyle.GetItemState(nWhich)) +/*N*/ mpObjectItemSet->ClearItem(nWhich); +/*N*/ nWhich = aIter.NextWhich(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // set new stylesheet as parent +/*N*/ mpObjectItemSet->SetParent(&pNewStyleSheet->GetItemSet()); +/*N*/ } +/*N*/ } + +/*N*/ void SdrAttrObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ RemoveStyleSheet(); +/*N*/ AddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); +/*N*/ bBoundRectDirty = TRUE; +/*N*/ SetRectsDirty(TRUE); +/*N*/ } + +/*N*/ void SdrAttrObj::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ Rectangle aBoundRect0; +/*N*/ +/*N*/ if(pUserCall) +/*N*/ aBoundRect0 = GetBoundRect(); +/*N*/ +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0); +/*N*/ } + +/*N*/ INT32 SdrAttrObj::ImpGetLineWdt() const +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue(); +/*N*/ +/*N*/ if(XLINE_NONE == eLine) +/*N*/ return 0; // Garkeine Linie da. +/*N*/ +/*N*/ sal_Int32 nWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); +/*N*/ +/*N*/ return nWdt; +/*N*/ } + +/*N*/ INT32 SdrAttrObj::ImpGetLineEndAdd() const +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ BOOL bStartSet(TRUE); +/*N*/ BOOL bEndSet(TRUE); +/*N*/ +/*N*/ if(SFX_ITEM_DONTCARE != rSet.GetItemState(XATTR_LINESTART)) +/*N*/ { +/*N*/ String aStr(((const XLineStartItem&)rSet.Get(XATTR_LINESTART)).GetName()); +/*N*/ if(!aStr.Len()) +/*N*/ bStartSet = FALSE; +/*N*/ } +/*N*/ +/*N*/ if(rSet.GetItemState(XATTR_LINEEND) != SFX_ITEM_DONTCARE) +/*N*/ { +/*N*/ String aStr(((const XLineEndItem&)rSet.Get(XATTR_LINEEND)).GetName()); +/*N*/ if(!aStr.Len()) +/*N*/ bEndSet = FALSE; +/*N*/ } +/*N*/ +/*N*/ BOOL bLineEndSet = bStartSet || bEndSet; +/*N*/ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue(); +/*N*/ +/*N*/ if(XLINE_NONE == eLine) +/*N*/ return 0; // Garkeine Linie da. +/*N*/ +/*N*/ // Strichstaerke +/*N*/ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); +/*N*/ sal_Int32 nSttWdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue(); +/*N*/ +/*N*/ if(nSttWdt < 0) +/*N*/ nSttWdt = -nLineWdt * nSttWdt / 100; +/*N*/ +/*N*/ if(!bLineEndSet) +/*N*/ nSttWdt = 0; + +/*N*/ BOOL bSttCenter = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue(); +/*N*/ sal_Int32 nSttHgt = 0; +/*N*/ +/*N*/ if(bSttCenter) +/*N*/ { +/*N*/ // Linienende steht um die Haelfe ueber +/*N*/ XPolygon aSttPoly(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue()); +/*N*/ nSttHgt = XOutputDevice::InitLineStartEnd(aSttPoly, nSttWdt, bSttCenter); +/*N*/ // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe +/*N*/ } +/*N*/ +/*N*/ nSttWdt++; +/*N*/ nSttWdt /= 2; +/*N*/ +/*N*/ // Lieber etwas mehr, dafuer keine Wurzel ziehen +/*N*/ sal_Int32 nSttAdd = Max(nSttWdt, nSttHgt); +/*N*/ nSttAdd *= 3; +/*N*/ nSttAdd /= 2; +/*N*/ +/*N*/ sal_Int32 nEndWdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue(); +/*N*/ +/*N*/ if(nEndWdt < 0) +/*N*/ nEndWdt = -nLineWdt * nEndWdt / 100; // <0 = relativ +/*N*/ +/*N*/ if(!bLineEndSet) +/*N*/ nEndWdt = 0; +/*N*/ +/*N*/ BOOL bEndCenter = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue(); +/*N*/ sal_Int32 nEndHgt = 0; +/*N*/ +/*N*/ if(bEndCenter) +/*N*/ { +/*N*/ // Linienende steht um die Haelfe ueber +/*N*/ XPolygon aEndPoly(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue()); +/*N*/ nEndHgt = XOutputDevice::InitLineStartEnd(aEndPoly, nEndWdt, bEndCenter); +/*N*/ // InitLineStartEnd liefert bei bCenter=TRUE die halbe Hoehe +/*N*/ } +/*N*/ +/*N*/ nEndWdt++; +/*N*/ nEndWdt /= 2; +/*N*/ +/*N*/ // Lieber etwas mehr, dafuer keine Wurzel ziehen +/*N*/ sal_Int32 nEndAdd = Max(nEndWdt, nEndHgt); +/*N*/ nEndAdd *= 3; +/*N*/ nEndAdd /= 2; +/*N*/ +/*N*/ return Max(nSttAdd, nEndAdd); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + + +/*N*/ FASTBOOL SdrAttrObj::ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ nXDist = 0L; +/*N*/ nYDist = 0L; +/*N*/ +/*N*/ BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue(); +/*N*/ if(bShadOn) +/*N*/ { +/*N*/ nXDist = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(); +/*N*/ nYDist = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue(); +/*N*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +/*N*/ void SdrAttrObj::ImpAddShadowToBoundRect() +/*N*/ { +/*N*/ sal_Int32 nXDist; +/*N*/ sal_Int32 nYDist; +/*N*/ +/*N*/ if(ImpGetShadowDist(nXDist, nYDist)) +/*N*/ { +/*N*/ if(nXDist > 0) +/*N*/ aOutRect.Right() += nXDist; +/*N*/ else +/*?*/ aOutRect.Left() += nXDist; +/*N*/ +/*N*/ if(nYDist > 0) +/*N*/ aOutRect.Bottom() += nYDist; +/*N*/ else +/*?*/ aOutRect.Top() += nYDist; +/*N*/ } +/*N*/ } + +/*N*/ FASTBOOL SdrAttrObj::ImpSetShadowAttributes( const SfxItemSet& rSet, SfxItemSet& rShadowSet ) const +/*N*/ { +/*N*/ BOOL bShadOn=((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue(); +/*N*/ +/*N*/ if(bShadOn) +/*?*/ { +// LineAttr for shadow no longer necessary, lines and line shadows are drawn in Paint() +// routines individually (grep for CreateLinePoly()) +// +// if (pLineAttr!=NULL) { +// XLineAttrSetItem aL(*pLineAttr); +// aL.GetItemSet().Put(XLineColorItem(String(),aShadCol)); +// aL.GetItemSet().Put(XLineTransparenceItem(nTransp)); +// rXOut.SetLineAttr(aL); +// } + +// #103692# Caller must now handle noFill case +// if(!bNoFill) +// { + +/*?*/ const SdrShadowColorItem& rShadColItem = ((const SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))); +/*?*/ Color aShadCol(rShadColItem.GetValue()); +/*?*/ sal_uInt16 nTransp = ((const SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue(); +/*?*/ XFillStyle eStyle = ((const XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue(); +/*?*/ BOOL bFillBackground = ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue(); +/*?*/ +/*?*/ if(eStyle==XFILL_HATCH && !bFillBackground) +/*?*/ { +/*?*/ // #41666# +/*?*/ XHatch aHatch = ((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetValue(); +/*?*/ aHatch.SetColor(aShadCol); +/*?*/ rShadowSet.Put(XFillHatchItem(String(), aHatch)); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if(eStyle != XFILL_NONE && eStyle != XFILL_SOLID) +/*?*/ { +/*?*/ // also fuer Gradient und Bitmap +/*?*/ rShadowSet.Put(XFillStyleItem(XFILL_SOLID)); +/*?*/ } +/*?*/ +/*?*/ rShadowSet.Put(XFillColorItem(String(),aShadCol)); +/*?*/ +/*?*/ // #92183# set XFillTransparenceItem only when no FloatTransparence is used, +/*?*/ // else the OutDev will use the wrong method +/*?*/ if(nTransp) +/*?*/ { +/*?*/ const XFillFloatTransparenceItem& rFillFloatTransparence = +/*?*/ (const XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE); +/*?*/ if(!rFillFloatTransparence.IsEnabled()) +/*?*/ rShadowSet.Put(XFillTransparenceItem(nTransp)); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +// ItemPool fuer dieses Objekt wechseln +/*N*/ void SdrAttrObj::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) +/*N*/ { +/*N*/ if(pSrcPool && pDestPool && (pSrcPool != pDestPool)) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::MigrateItemPool(pSrcPool, pDestPool, pNewModel); +/*N*/ +/*N*/ if(mpObjectItemSet) +/*N*/ { +/*N*/ // migrate ItemSet to new pool. Scaling is NOT necessary +/*N*/ // because this functionality is used by UNDO only. Thus +/*N*/ // objects and ItemSets would be moved back to their original +/*N*/ // pool before usage. +/*N*/ +/*N*/ SfxItemSet* pOldSet = mpObjectItemSet; +/*N*/ SfxStyleSheet* pStySheet = GetStyleSheet(); +/*N*/ +/*N*/ if(GetStyleSheet()) +/*?*/ RemoveStyleSheet(); +/*N*/ +/*N*/ mpObjectItemSet = CreateNewItemSet(*pDestPool); +/*N*/ +/*N*/ GetModel()->MigrateItemSet( pOldSet, mpObjectItemSet, pNewModel ); +/*N*/ +/*N*/ // set stylesheet (if used) +/*N*/ if(pStySheet) +/*?*/ AddStyleSheet(pStySheet, TRUE); +/*N*/ +/*N*/ delete pOldSet; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrAttrObj::HasFill() const +/*N*/ { +/*N*/ return (!bClosedObj) ? FALSE +/*N*/ : ((XFillStyleItem&)(GetItem(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE; +/*N*/ } + +/*N*/ BOOL SdrAttrObj::HasLine() const +/*N*/ { +/*N*/ return ((XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE; +/*N*/ } + +// #94547# Have to re-activate more performant, but corrected version. +// This is necessary since SetItemSet() of the old implementation calls +// ItemSetChanged() which replaces in textobjects all text items which +// is wrong behaviour for BurnInStyleSheet. + +// #91695# back to corrected old version. Have to check new version again for later builds. +//void SdrAttrObj::BurnInStyleSheetAttributes( BOOL bPseudoSheetsOnly ) +//{ +// SfxItemPool* pPool = GetItemPool(); +// if ( pPool && mpStyleSheet ) +// { +// // Get StyleSheet attributes +// SfxItemSet aSet(*pPool, +// SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1, +// SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END, +// EE_ITEMS_START,EE_ITEMS_END, +// 0,0); +// +// SfxWhichIter aIter( mpStyleSheet->GetItemSet() ); +// sal_uInt16 nWhich( aIter.FirstWhich() ); +// const SfxPoolItem* pItem = NULL; +// +// while( nWhich ) +// { +// if( SFX_ITEM_SET == mpStyleSheet->GetItemSet().GetItemState(nWhich, TRUE, &pItem) ) +// aSet.Put( *pItem ); +// +// nWhich = aIter.NextWhich(); +// } +// +// SfxWhichIter aHardAttrIter( GetItemSet() ); +// nWhich = aHardAttrIter.FirstWhich(); +// +// while( nWhich ) +// { +// if( SFX_ITEM_SET == GetItemSet().GetItemState(nWhich, FALSE, &pItem) ) +// aSet.Put( *pItem ); +// +// nWhich = aHardAttrIter.NextWhich(); +// } +// +// // Set StyleSheet attributes as hard attributes +// SetItemSet( aSet ); +// } +//} + +/* +void SdrAttrObj::BurnInStyleSheetAttributes( BOOL bPseudoSheetsOnly ) +{ + // #89025# Added more performant implementation + if(mpStyleSheet) + { + const SfxItemSet& rSet = mpStyleSheet->GetItemSet(); + SfxWhichIter aIter(rSet); + sal_uInt16 nWhich(aIter.FirstWhich()); + const SfxPoolItem *pItem = NULL; + + ImpForceItemSet(); + const SfxItemSet* pParentSet = mpObjectItemSet->GetParent(); + if(pParentSet != 0L) + mpObjectItemSet->SetParent(0L); + + while(nWhich) + { + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, TRUE, &pItem)) + mpObjectItemSet->Put(*pItem); + nWhich = aIter.NextWhich(); + } + + if(pParentSet != 0L) + mpObjectItemSet->SetParent(pParentSet); + } +} +*/ + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdobj.cxx b/binfilter/bf_svx/source/svdraw/svx_svdobj.cxx new file mode 100644 index 000000000000..c9e8ca6e6a1f --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdobj.cxx @@ -0,0 +1,3442 @@ +/* -*- 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/cvtsvm.hxx> +#include <tools/line.hxx> +#include <vector> +#include "svdetc.hxx" +#include "svdio.hxx" +#include "svdpage.hxx" +#include "svdovirt.hxx" // Fuer Add/Del Ref +#include "svdview.hxx" // fuer Dragging (Ortho abfragen) +#include "svdstr.hrc" // Objektname +#include "svdogrp.hxx" // Factory +#include "svdopath.hxx" // Factory +#include "svdocirc.hxx" // Factory +#include "svdomeas.hxx" // Factory +#include "svdograf.hxx" // Factory +#include "svdoole2.hxx" // Factory +#include "svdocapt.hxx" // Factory +#include "svdopage.hxx" // Factory +#include "svdouno.hxx" // Factory + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "xlnwtit.hxx" +#include "xlnstwit.hxx" +#include "xlnedwit.hxx" +#include "xlnstit.hxx" +#include "xlnedit.hxx" +#include "xlnstcit.hxx" +#include "xlnedcit.hxx" +#include "xlndsit.hxx" +#include "xlnclit.hxx" +#include "svditer.hxx" +#include "xlntrit.hxx" +#include "xlinjoit.hxx" +#include "unopage.hxx" +#include "eeitem.hxx" + +#include "svdpool.hxx" + +#include "editeng.hxx" + +#include <vcl/salbtype.hxx> // FRound + +#include <bf_svtools/whiter.hxx> + +// #97849# +#include "fmmodel.hxx" + +#include <bf_sfx2/objsh.hxx> + +#include <bf_sfx2/docfac.hxx> + +#include "rectenum.hxx" + +#include "svdoimp.hxx" + +#include <vcl/graphictools.hxx> + + +#include "xoutx.hxx" + +#include <bf_goodies/matrix3d.hxx> + +namespace binfilter { + +using namespace ::com::sun::star; + +// #104018# replace macros above with type-detecting methods +inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } +inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT0(SdrObjUserCall); + +/*N*/ SdrObjUserCall::~SdrObjUserCall() +/*N*/ { +/*N*/ } + +/*N*/ void SdrObjUserCall::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect) +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT0(SdrObjUserData); + + + + +/*N*/ SdrObjUserData::~SdrObjUserData() +/*N*/ { +/*N*/ } + +/*N*/ void SdrObjUserData::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ rOut<<nInventor; +/*N*/ rOut<<nIdentifier; +/*N*/ rOut<<nVersion; +/*N*/ } + +/*N*/ void SdrObjUserData::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ //Inventor und Identifier wurden bereits von Aufrufer gelesen, +/*N*/ //sonst haette er mich ja nicht erzeugen koennen (kein SeekBack!). +/*N*/ rIn>>nVersion; // Miniatur-Versionsverwaltung. +/*N*/ } + +/*N*/ void SdrObjUserData::AfterRead() +/*N*/ { +/*N*/ } + +/*N*/ FASTBOOL SdrObjUserData::HasMacro(const SdrObject* pObj) const +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + + + + + + +/*N*/ void SdrObjUserDataList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetUserData(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ DBG_NAME(SdrObjGeoData) + +/*N*/ SdrObjGeoData::SdrObjGeoData(): +/*N*/ pGPL(NULL), +/*N*/ bMovProt(FALSE), +/*N*/ bSizProt(FALSE), +/*N*/ bNoPrint(FALSE), +/*N*/ bClosedObj(FALSE), +/*N*/ nLayerId(0) +/*N*/ { +/*N*/ DBG_CTOR(SdrObjGeoData,NULL); +/*N*/ } + +/*N*/ SdrObjGeoData::~SdrObjGeoData() +/*N*/ { +/*N*/ DBG_DTOR(SdrObjGeoData,NULL); +/*N*/ delete pGPL; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT0(SdrObjPlusData); + +/*N*/ SdrObjPlusData::SdrObjPlusData(): +/*N*/ pBroadcast(NULL), +/*N*/ pUserDataList(NULL), +/*N*/ pGluePoints(NULL), +///*N*/ pAnimator(NULL), +/*N*/ pAutoTimer(NULL) +/*N*/ { +/*N*/ } + +/*N*/ SdrObjPlusData::~SdrObjPlusData() +/*N*/ { +/*N*/ if (pBroadcast !=NULL) delete pBroadcast; +/*N*/ if (pUserDataList!=NULL) delete pUserDataList; +/*N*/ if (pGluePoints !=NULL) delete pGluePoints; +///*N*/ if (pAnimator !=NULL) delete pAnimator; +/*N*/ if (pAutoTimer !=NULL) delete pAutoTimer; +/*N*/ } + + +/////////////////////////////////////////////////////////////////////////////// + +static double SMALLEST_DASH_WIDTH(26.95); + +/*N*/ ImpLineStyleParameterPack::ImpLineStyleParameterPack(const SfxItemSet& rSet, +/*N*/ BOOL _bForceHair, OutputDevice* pOut) +/*N*/ : mpOut(pOut), +/*N*/ rStartPolygon(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue()), +/*N*/ rEndPolygon(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue()), +/*N*/ bForceNoArrowsLeft(FALSE), +/*N*/ bForceNoArrowsRight(FALSE), +/*N*/ bForceHair(_bForceHair) +/*N*/ { +/*N*/ // #i12227# now storing the real line width, not corrected by +/*N*/ // bForceHair. This is done within the GetDisplay*Width accessors, +/*N*/ // and preserves the true value for the Get*Width accessors. +/*N*/ nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); +/*N*/ eLineStyle = (XLineStyle)((const XLineStyleItem&)rSet.Get(XATTR_LINESTYLE)).GetValue(); +/*N*/ +/*N*/ nStartWidth = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue(); +/*N*/ if(nStartWidth < 0) +/*N*/ nStartWidth = -nLineWidth * nStartWidth / 100; +/*N*/ +/*N*/ nEndWidth = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue(); +/*N*/ if(nEndWidth < 0) +/*N*/ nEndWidth = -nLineWidth * nEndWidth / 100; +/*N*/ +/*N*/ bStartCentered = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue(); +/*N*/ bEndCentered = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue(); +/*N*/ +/*N*/ fDegreeStepWidth = 10.0; +/*N*/ eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); +/*N*/ +/*N*/ aDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetValue(); +/*N*/ +/*N*/ // fill local dash info +/*N*/ UINT16 nNumDotDashArray = (GetDots() + GetDashes()) * 2; +/*N*/ aDotDashArray.resize( nNumDotDashArray, 0.0 ); +/*N*/ UINT16 a; +/*N*/ UINT16 nIns = 0; +/*N*/ double fDashDotDistance = (double)GetDashDistance(); +/*N*/ double fSingleDashLen = (double)GetDashLen(); +/*N*/ double fSingleDotLen = (double)GetDotLen(); +/*N*/ double fLineWidth = (double)GetDisplayLineWidth(); +/*N*/ +/*N*/ if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE) +/*?*/ { +/*?*/ if(GetDisplayLineWidth()) +/*?*/ { +/*?*/ double fFactor = fLineWidth / 100.0; +/*?*/ +/*?*/ if(GetDashes()) +/*?*/ { +/*?*/ if(GetDashLen()) +/*?*/ { +/*?*/ // is a dash +/*?*/ fSingleDashLen *= fFactor; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // is a dot +/*?*/ fSingleDashLen = fLineWidth; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if(GetDots()) +/*?*/ { +/*?*/ if(GetDotLen()) +/*?*/ { +/*?*/ // is a dash +/*?*/ fSingleDotLen *= fFactor; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // is a dot +/*?*/ fSingleDotLen = fLineWidth; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if(GetDashes() || GetDots()) +/*?*/ { +/*?*/ if(GetDashDistance()) +/*?*/ fDashDotDistance *= fFactor; +/*?*/ else +/*?*/ fDashDotDistance = fLineWidth; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if(GetDashes()) +/*?*/ { +/*?*/ if(GetDashLen()) +/*?*/ { +/*?*/ // is a dash +/*?*/ fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // is a dot +/*?*/ fSingleDashLen = SMALLEST_DASH_WIDTH; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if(GetDots()) +/*?*/ { +/*?*/ if(GetDotLen()) +/*?*/ { +/*?*/ // is a dash +/*?*/ fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // is a dot +/*?*/ fSingleDotLen = SMALLEST_DASH_WIDTH; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if(GetDashes() || GetDots()) +/*?*/ { +/*?*/ if(GetDashDistance()) +/*?*/ { +/*?*/ // dash as distance +/*?*/ fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // dot as distance +/*?*/ fDashDotDistance = SMALLEST_DASH_WIDTH; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ // smallest dot size compare value +/*N*/ double fDotCompVal(GetDisplayLineWidth() ? fLineWidth : SMALLEST_DASH_WIDTH); +/*N*/ +/*N*/ // absolute values +/*N*/ if(GetDashes()) +/*N*/ { +/*N*/ if(GetDashLen()) +/*N*/ { +/*N*/ // is a dash +/*N*/ if(fSingleDashLen < SMALLEST_DASH_WIDTH) +/*N*/ fSingleDashLen = SMALLEST_DASH_WIDTH; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // is a dot +/*?*/ if(fSingleDashLen < fDotCompVal) +/*?*/ fSingleDashLen = fDotCompVal; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(GetDots()) +/*N*/ { +/*N*/ if(GetDotLen()) +/*N*/ { +/*N*/ // is a dash +/*N*/ if(fSingleDotLen < SMALLEST_DASH_WIDTH) +/*N*/ fSingleDotLen = SMALLEST_DASH_WIDTH; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // is a dot +/*?*/ if(fSingleDotLen < fDotCompVal) +/*?*/ fSingleDotLen = fDotCompVal; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(GetDashes() || GetDots()) +/*N*/ { +/*N*/ if(GetDashDistance()) +/*N*/ { +/*N*/ // dash as distance +/*N*/ if(fDashDotDistance < SMALLEST_DASH_WIDTH) +/*N*/ fDashDotDistance = SMALLEST_DASH_WIDTH; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // dot as distance +/*?*/ if(fDashDotDistance < fDotCompVal) +/*?*/ fDashDotDistance = fDotCompVal; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ fFullDashDotLen = 0.0; +/*N*/ +/*N*/ for(a=0;a<GetDots();a++) +/*N*/ { +/*N*/ aDotDashArray[nIns++] = fSingleDotLen; +/*N*/ fFullDashDotLen += fSingleDotLen; +/*N*/ aDotDashArray[nIns++] = fDashDotDistance; +/*N*/ fFullDashDotLen += fDashDotDistance; +/*N*/ } +/*N*/ +/*N*/ for(a=0;a<GetDashes();a++) +/*N*/ { +/*N*/ aDotDashArray[nIns++] = fSingleDashLen; +/*N*/ fFullDashDotLen += fSingleDashLen; +/*N*/ aDotDashArray[nIns++] = fDashDotDistance; +/*N*/ fFullDashDotLen += fDashDotDistance; +/*N*/ } +/*N*/ } + +/*N*/ ImpLineStyleParameterPack::~ImpLineStyleParameterPack() +/*N*/ { +/*N*/ } + +/*N*/ UINT16 ImpLineStyleParameterPack::GetFirstDashDotIndex(double fPos, double& rfDist) const +/*N*/ { +/*N*/ double fIndPos = fPos - (fFullDashDotLen * (double)((UINT32)(fPos / fFullDashDotLen))); +/*N*/ UINT16 nPos = 0; +/*N*/ +/*N*/ while(fIndPos && fIndPos - aDotDashArray[nPos] > -SMALL_DVALUE) +/*N*/ { +/*N*/ fIndPos -= aDotDashArray[nPos]; +/*N*/ nPos = (static_cast< size_t >(nPos + 1) == aDotDashArray.size()) ? 0 : nPos + 1; +/*N*/ } +/*N*/ +/*N*/ rfDist = aDotDashArray[nPos] - fIndPos; +/*N*/ nPos = (static_cast< size_t >(nPos + 1) == aDotDashArray.size()) ? 0 : nPos + 1; +/*N*/ +/*N*/ return nPos; +/*N*/ } + +/*N*/ UINT16 ImpLineStyleParameterPack::GetNextDashDotIndex(UINT16 nPos, double& rfDist) const +/*N*/ { +/*N*/ rfDist = aDotDashArray[nPos]; +/*N*/ nPos = (static_cast< size_t >(nPos + 1) == aDotDashArray.size()) ? 0 : nPos + 1; +/*N*/ return nPos; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ double ImpLineGeometryCreator::ImpSimpleFindCutPoint( +/*N*/ const Vector3D& rEdge1Start, const Vector3D& rEdge1Delta, +/*N*/ const Vector3D& rEdge2Start, const Vector3D& rEdge2Delta) +/*N*/ { +/*N*/ double fZwi = (rEdge1Delta.X() * rEdge2Delta.Y()) - (rEdge1Delta.Y() * rEdge2Delta.X()); +/*N*/ double fRetval = 0.0; +/*N*/ +/*N*/ if(fabs(fZwi) > SMALL_DVALUE) +/*N*/ { +/*N*/ fRetval = (rEdge2Delta.Y() * (rEdge2Start.X() - rEdge1Start.X()) +/*N*/ + rEdge2Delta.X() * (rEdge1Start.Y() - rEdge2Start.Y())) / fZwi; +/*N*/ } +/*N*/ return fRetval; +/*N*/ } + +/*N*/ void ImpLineGeometryCreator::ImpCreateLineSegment(const Vector3D* pPrev, const Vector3D* pLeft, const Vector3D* pRight, const Vector3D* pNext) +/*N*/ { +/*N*/ if(mrLineAttr.GetDisplayLineWidth()) +/*N*/ { +/*N*/ double fHalfLineWidth((double)mrLineAttr.GetDisplayLineWidth() / 2.0); +/*N*/ Vector3D aEdge = *pRight - *pLeft; +/*N*/ +/*N*/ // #78972# +/*N*/ Vector3D aPerpend(-aEdge.Y(), aEdge.X(), 0.0); +/*N*/ aPerpend.Normalize(); +/*N*/ +/*N*/ XLineJoint eJoint = mrLineAttr.GetLineJoint(); +/*N*/ +/*N*/ // joints need eventually not be done +/*N*/ if((eJoint == XLINEJOINT_MIDDLE || eJoint == XLINEJOINT_MITER) && (!pPrev && !pNext)) +/*N*/ eJoint = XLINEJOINT_NONE; +/*N*/ +/*N*/ switch(eJoint) +/*N*/ { +/*?*/ case XLINEJOINT_NONE: // no rounding +/*?*/ { +/*?*/ Polygon3D aNewPoly(4); +/*?*/ +/*?*/ aPerpend *= fHalfLineWidth; +/*?*/ aNewPoly[0] = *pLeft + aPerpend; +/*?*/ aNewPoly[1] = *pRight + aPerpend; +/*?*/ aNewPoly[2] = *pRight - aPerpend; +/*?*/ aNewPoly[3] = *pLeft - aPerpend; +/*?*/ +/*?*/ aNewPoly.SetClosed(TRUE); +/*?*/ mrPolyPoly3D.Insert(aNewPoly); +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ case XLINEJOINT_MIDDLE: // calc middle value between joints +/*?*/ { +/*?*/ Polygon3D aNewPoly(4); +/*?*/ Vector3D aPerpendLeft(aPerpend); +/*?*/ Vector3D aPerpendRight(aPerpend); +/*?*/ +/*?*/ if(pPrev) +/*?*/ { +/*?*/ aPerpendLeft = *pLeft - *pPrev; +/*?*/ +/*?*/ // #78972# +/*?*/ aPerpendLeft = Vector3D(-aPerpendLeft.Y(), aPerpendLeft.X(), 0.0); +/*?*/ aPerpendLeft.Normalize(); +/*?*/ } +/*?*/ +/*?*/ if(pNext) +/*?*/ { +/*?*/ aPerpendRight = *pNext - *pRight; +/*?*/ +/*?*/ // #78972# +/*?*/ aPerpendRight = Vector3D(-aPerpendRight.Y(), aPerpendRight.X(), 0.0); +/*?*/ aPerpendRight.Normalize(); +/*?*/ } +/*?*/ +/*?*/ aPerpendLeft = (aPerpend + aPerpendLeft) * (fHalfLineWidth / 2.0); +/*?*/ aPerpendRight = (aPerpend + aPerpendRight) * (fHalfLineWidth / 2.0); +/*?*/ +/*?*/ aNewPoly[0] = *pLeft + aPerpendLeft; +/*?*/ aNewPoly[1] = *pRight + aPerpendRight; +/*?*/ aNewPoly[2] = *pRight - aPerpendRight; +/*?*/ aNewPoly[3] = *pLeft - aPerpendLeft; +/*?*/ +/*?*/ aNewPoly.SetClosed(TRUE); +/*?*/ mrPolyPoly3D.Insert(aNewPoly); +/*?*/ +/*?*/ break; +/*?*/ } +/*N*/ case XLINEJOINT_BEVEL: // join edges with line +/*N*/ default: // #73428# case XLINEJOINT_ROUND: // create arc +/*N*/ { +/*N*/ Vector3D aPerpendRight(aPerpend); +/*N*/ BOOL bCreateSimplePart(TRUE); +/*N*/ +/*N*/ if(pNext) +/*N*/ { +/*N*/ aPerpendRight = *pNext - *pRight; +/*N*/ +/*N*/ // #78972# +/*N*/ aPerpendRight = Vector3D(-aPerpendRight.Y(), aPerpendRight.X(), 0.0); +/*N*/ aPerpendRight.Normalize(); +/*N*/ +/*N*/ double fAngle = atan2(aPerpend.Y(), aPerpend.X()); +/*N*/ double fRightAngle = atan2(aPerpendRight.Y(), aPerpendRight.X()); +/*N*/ double fAngleDiff = fAngle - fRightAngle; +/*N*/ double fDegreeStepWidth = mrLineAttr.GetDegreeStepWidth() * F_PI180; +/*N*/ +/*N*/ // go to range [0.0..2*F_PI[ +/*N*/ while(fAngleDiff < 0.0) +/*N*/ fAngleDiff += (F_PI * 2.0); +/*N*/ while(fAngleDiff >= (F_PI * 2.0)) +/*N*/ fAngleDiff -= (F_PI * 2.0); +/*N*/ +/*N*/ if((fAngleDiff > fDegreeStepWidth) && (fAngleDiff < ((F_PI * 2.0) - fDegreeStepWidth))) +/*N*/ { +/*N*/ bCreateSimplePart = FALSE; +/*N*/ aPerpend *= fHalfLineWidth; +/*N*/ aPerpendRight *= fHalfLineWidth; +/*N*/ +/*N*/ if(eJoint == XLINEJOINT_BEVEL) +/*?*/ { +/*?*/ UINT16 nPolyPoints(pPrev ? 7 : 6); +/*?*/ Polygon3D aNewPoly(nPolyPoints); +/*?*/ +/*?*/ aNewPoly[0] = *pLeft + aPerpend; +/*?*/ aNewPoly[1] = *pRight + aPerpend; +/*?*/ aNewPoly[4] = *pRight - aPerpend; +/*?*/ aNewPoly[5] = *pLeft - aPerpend; +/*?*/ +/*?*/ if(pPrev) +/*?*/ aNewPoly[6] = *pLeft; +/*?*/ +/*?*/ if(fAngleDiff > F_PI) +/*?*/ { +/*?*/ // lower side +/*?*/ aNewPoly[2] = *pRight; +/*?*/ aNewPoly[3] = *pRight - aPerpendRight; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // upper side +/*?*/ aNewPoly[2] = *pRight + aPerpendRight; +/*?*/ aNewPoly[3] = *pRight; +/*?*/ } +/*?*/ +/*?*/ aNewPoly.SetClosed(TRUE); +/*?*/ mrPolyPoly3D.Insert(aNewPoly); +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ BOOL bUseLowerSide(fAngleDiff > F_PI); +/*N*/ UINT16 nSegments; +/*N*/ +/*N*/ if(bUseLowerSide) +/*N*/ { +/*?*/ fAngleDiff = (F_PI * 2.0) - fAngleDiff; +/*?*/ nSegments = (UINT16)(fAngleDiff / fDegreeStepWidth); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nSegments = (UINT16)(fAngleDiff / fDegreeStepWidth); +/*N*/ } +/*N*/ +/*N*/ UINT16 nPolyPoints(pPrev ? 7 : 6); +/*N*/ Polygon3D aNewPoly(nPolyPoints + nSegments); +/*N*/ +/*N*/ aNewPoly[0] = *pLeft + aPerpend; +/*N*/ aNewPoly[1] = *pRight + aPerpend; +/*N*/ aNewPoly[4 + nSegments] = *pRight - aPerpend; +/*N*/ aNewPoly[5 + nSegments] = *pLeft - aPerpend; +/*N*/ +/*N*/ if(pPrev) +/*N*/ aNewPoly[6 + nSegments] = *pLeft; +/*N*/ +/*N*/ fAngleDiff /= (double)(nSegments + 1); +/*N*/ +/*N*/ if(bUseLowerSide) +/*N*/ { +/*N*/ // lower side +/*?*/ aNewPoly[2] = *pRight; +/*?*/ aNewPoly[3] = *pRight - aPerpendRight; +/*?*/ +/*?*/ for(UINT16 a=0;a<nSegments;a++) +/*?*/ { +/*?*/ double fDegree = fRightAngle - (double)a * fAngleDiff; +/*?*/ Vector3D aNewPos( +/*?*/ pRight->X() - (cos(fDegree) * fHalfLineWidth), +/*?*/ pRight->Y() - (sin(fDegree) * fHalfLineWidth), +/*?*/ pRight->Z()); // #78972# +/*?*/ aNewPoly[4 + a] = aNewPos; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // upper side +/*N*/ aNewPoly[2 + nSegments] = *pRight + aPerpendRight; +/*N*/ aNewPoly[3 + nSegments] = *pRight; +/*N*/ +/*N*/ for(UINT16 a=0;a<nSegments;a++) +/*N*/ { +/*N*/ double fDegree = fAngle - (double)a * fAngleDiff; +/*N*/ Vector3D aNewPos( +/*N*/ pRight->X() + (cos(fDegree) * fHalfLineWidth), +/*N*/ pRight->Y() + (sin(fDegree) * fHalfLineWidth), +/*N*/ pRight->Z()); // #78972# +/*N*/ aNewPoly[2 + a] = aNewPos; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aNewPoly.SetClosed(TRUE); +/*N*/ mrPolyPoly3D.Insert(aNewPoly); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(bCreateSimplePart) +/*N*/ { +/*N*/ // angle smaller DegreeStepWidth, create simple segment +/*N*/ UINT16 nNumPnt(4); +/*N*/ +/*N*/ if(pPrev) +/*N*/ nNumPnt++; +/*N*/ +/*N*/ if(pNext) +/*N*/ nNumPnt++; +/*N*/ +/*N*/ Polygon3D aNewPoly(nNumPnt); +/*N*/ +/*N*/ aPerpend *= fHalfLineWidth; +/*N*/ aPerpendRight *= fHalfLineWidth; +/*N*/ nNumPnt = 0; +/*N*/ +/*N*/ if(pPrev) +/*N*/ aNewPoly[nNumPnt++] = *pLeft; +/*N*/ +/*N*/ aNewPoly[nNumPnt++] = *pLeft + aPerpend; +/*N*/ aNewPoly[nNumPnt++] = *pRight + aPerpendRight; +/*N*/ +/*N*/ if(pNext) +/*N*/ aNewPoly[nNumPnt++] = *pRight; +/*N*/ +/*N*/ aNewPoly[nNumPnt++] = *pRight - aPerpendRight; +/*N*/ aNewPoly[nNumPnt++] = *pLeft - aPerpend; +/*N*/ +/*N*/ aNewPoly.SetClosed(TRUE); +/*N*/ mrPolyPoly3D.Insert(aNewPoly); +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ case XLINEJOINT_MITER: // extend till cut +/*?*/ { +/*?*/ Polygon3D aNewPoly(4); +/*?*/ aPerpend *= fHalfLineWidth; +/*?*/ BOOL bLeftSolved(FALSE); +/*?*/ BOOL bRightSolved(FALSE); +/*?*/ +/*?*/ if(pPrev) +/*?*/ { +/*?*/ Vector3D aLeftVec(*pLeft - *pPrev); +/*?*/ +/*?*/ // #78972# +/*?*/ Vector3D aPerpendLeft(-aLeftVec.Y(), aLeftVec.X(), 0.0); +/*?*/ aPerpendLeft.Normalize(); +/*?*/ +/*?*/ aPerpendLeft *= fHalfLineWidth; +/*?*/ double fUpperCut = ImpSimpleFindCutPoint(*pPrev + aPerpendLeft, aLeftVec, *pRight + aPerpend, -aEdge); +/*?*/ +/*?*/ if(fUpperCut != 0.0 && fUpperCut < mrLineAttr.GetLinejointMiterUpperBound()) +/*?*/ { +/*?*/ double fLowerCut = ImpSimpleFindCutPoint(*pPrev - aPerpendLeft, aLeftVec, *pRight - aPerpend, -aEdge); +/*?*/ +/*?*/ if(fLowerCut < mrLineAttr.GetLinejointMiterUpperBound()) +/*?*/ { +/*?*/ Vector3D aParam1 = *pPrev + aPerpendLeft; +/*?*/ Vector3D aParam2 = *pLeft + aPerpendLeft; +/*?*/ aNewPoly[0].CalcInBetween(aParam1, aParam2, fUpperCut); +/*?*/ aParam1 = *pPrev - aPerpendLeft; +/*?*/ aParam2 = *pLeft - aPerpendLeft; +/*?*/ aNewPoly[3].CalcInBetween(aParam1, aParam2, fLowerCut); +/*?*/ bLeftSolved = TRUE; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ if(!bLeftSolved) +/*?*/ { +/*?*/ aNewPoly[0] = *pLeft + aPerpend; +/*?*/ aNewPoly[3] = *pLeft - aPerpend; +/*?*/ } +/*?*/ +/*?*/ if(pNext) +/*?*/ { +/*?*/ Vector3D aRightVec(*pRight - *pNext); +/*?*/ Vector3D aPerpendRight = -aRightVec; +/*?*/ +/*?*/ // #78972# +/*?*/ aPerpendRight = Vector3D(-aPerpendRight.Y(), aPerpendRight.X(), 0.0); +/*?*/ aPerpendRight.Normalize(); +/*?*/ +/*?*/ aPerpendRight *= fHalfLineWidth; +/*?*/ double fUpperCut = ImpSimpleFindCutPoint(*pNext + aPerpendRight, aRightVec, *pRight + aPerpend, aEdge); +/*?*/ +/*?*/ if(fUpperCut != 0.0 && fUpperCut < mrLineAttr.GetLinejointMiterUpperBound()) +/*?*/ { +/*?*/ double fLowerCut = ImpSimpleFindCutPoint(*pNext - aPerpendRight, aRightVec, *pRight - aPerpend, aEdge); +/*?*/ +/*?*/ if(fLowerCut < mrLineAttr.GetLinejointMiterUpperBound()) +/*?*/ { +/*?*/ Vector3D aParam1 = *pNext + aPerpendRight; +/*?*/ Vector3D aParam2 = *pRight + aPerpendRight; +/*?*/ aNewPoly[1].CalcInBetween(aParam1, aParam2, fUpperCut); +/*?*/ aParam1 = *pNext - aPerpendRight; +/*?*/ aParam2 = *pRight - aPerpendRight; +/*?*/ aNewPoly[2].CalcInBetween(aParam1, aParam2, fLowerCut); +/*?*/ bRightSolved = TRUE; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ if(!bRightSolved) +/*?*/ { +/*?*/ aNewPoly[1] = *pRight + aPerpend; +/*?*/ aNewPoly[2] = *pRight - aPerpend; +/*?*/ } +/*?*/ +/*?*/ aNewPoly.SetClosed(TRUE); +/*?*/ mrPolyPoly3D.Insert(aNewPoly); +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ else +/*N*/ { +/*?*/ Polygon3D aNewPoly(2); +/*?*/ +/*?*/ aNewPoly[0] = *pLeft; +/*?*/ aNewPoly[1] = *pRight; +/*?*/ +/*?*/ aNewPoly.SetClosed(FALSE); +/*?*/ mrPolyLine3D.Insert(aNewPoly); +/*N*/ } +/*N*/ } + +/*N*/ void ImpLineGeometryCreator::ImpCreateSegmentsForLine(const Vector3D* pPrev, const Vector3D* pLeft, const Vector3D* pRight, const Vector3D* pNext, double fPolyPos) +/*N*/ { +/*N*/ Vector3D aEdge(*pRight - *pLeft); +/*N*/ double fLen = aEdge.GetLength(); +/*N*/ double fPos = 0.0; +/*N*/ double fDist; +/*N*/ BOOL bFirst(TRUE); +/*N*/ BOOL bLast(FALSE); +/*N*/ UINT16 nInd = mrLineAttr.GetFirstDashDotIndex(fPolyPos, fDist); +/*N*/ +/*N*/ do { +/*N*/ // nInd right edge, fDist to it +/*N*/ if((nInd % 2) && fDist > SMALL_DVALUE) +/*N*/ { +/*N*/ // left is fpos, get right +/*N*/ double fRight = fPos + fDist; +/*N*/ +/*N*/ if(fRight > fLen) +/*N*/ { +/*N*/ fRight = fLen; +/*N*/ bLast = TRUE; +/*N*/ } +/*N*/ +/*N*/ // create segment from fPos to fRight +/*N*/ Vector3D aLeft(*pLeft); +/*N*/ Vector3D aRight(*pRight); +/*N*/ +/*N*/ if(!bFirst) +/*N*/ aLeft.CalcInBetween(*pLeft, *pRight, fPos / fLen); +/*N*/ if(!bLast) +/*N*/ aRight.CalcInBetween(*pLeft, *pRight, fRight / fLen); +/*N*/ +/*N*/ ImpCreateLineSegment(bFirst ? pPrev : 0L, &aLeft, &aRight, bLast ? pNext : 0L); +/*N*/ } +/*N*/ +/*N*/ bFirst = FALSE; +/*N*/ fPos += fDist; +/*N*/ nInd = mrLineAttr.GetNextDashDotIndex(nInd, fDist); +/*N*/ } while(fPos < fLen); +/*N*/ } + +/*N*/ double ImpLineGeometryCreator::ImpCreateLineStartEnd(Polygon3D& rArrowPoly, const Polygon3D& rSourcePoly, BOOL bFront, double fWantedWidth, BOOL bCentered) +/*N*/ { +/*N*/ double fRetval(0.0); +/*N*/ double fOffset(0.0); +/*N*/ Volume3D aPolySize(rArrowPoly.GetPolySize()); +/*N*/ double fScaleValue(fWantedWidth / aPolySize.GetWidth()); +/*N*/ Matrix4D aTrans; +/*N*/ Vector3D aCenter; +/*N*/ +/*N*/ if(bCentered) +/*N*/ { +/*N*/ aCenter = Vector3D( +/*N*/ (aPolySize.MinVec().X() + aPolySize.MaxVec().X()) / 2.0, +/*N*/ (aPolySize.MinVec().Y() + aPolySize.MaxVec().Y()) / 2.0, 0.0); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aCenter = Vector3D(rArrowPoly.GetMiddle()); +/*N*/ } +/*N*/ +/*N*/ aTrans.Translate(-aCenter); +/*N*/ aTrans.Scale(fScaleValue, fScaleValue, fScaleValue); +/*N*/ +/*N*/ if(bCentered) +/*N*/ { +/*N*/ Vector3D aLowerCenter(aCenter.X(), aPolySize.MinVec().Y(), 0.0); +/*N*/ +/*N*/ aLowerCenter *= aTrans; +/*N*/ aCenter *= aTrans; +/*N*/ fOffset = (aCenter - aLowerCenter).GetLength(); +/*N*/ fRetval = fOffset / 2.0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ Vector3D aLowerCenter(aCenter.X(), aPolySize.MinVec().Y(), 0.0); +/*N*/ Vector3D aUpperCenter(aCenter.X(), aPolySize.MaxVec().Y(), 0.0); +/*N*/ +/*N*/ aUpperCenter *= aTrans; +/*N*/ aLowerCenter *= aTrans; +/*N*/ fOffset = (aUpperCenter - aLowerCenter).GetLength(); +/*N*/ fRetval = fOffset * 0.8; +/*N*/ } +/*N*/ +/*N*/ Vector3D aHead = (bFront) ? rSourcePoly[0] : rSourcePoly[rSourcePoly.GetPointCount() - 1]; +/*N*/ Vector3D aTail = (bFront) ? rSourcePoly[1] : rSourcePoly[rSourcePoly.GetPointCount() - 2]; +/*N*/ +/*N*/ if(fOffset != 0.0) +/*N*/ { +/*N*/ if(!bFront) +/*N*/ fOffset = rSourcePoly.GetLength() - fOffset; +/*N*/ aTail = rSourcePoly.GetPosition(fOffset); +/*N*/ } +/*N*/ +/*N*/ Vector3D aDirection = aHead - aTail; +/*N*/ aDirection.Normalize(); +/*N*/ double fRotation = atan2(aDirection.Y(), aDirection.X()) - (90.0 * F_PI180); +/*N*/ +/*N*/ aTrans.RotateZ(fRotation); +/*N*/ aTrans.Translate(aHead); +/*N*/ +/*N*/ if(!bCentered) +/*N*/ { +/*N*/ Vector3D aUpperCenter(aCenter.X(), aPolySize.MaxVec().Y(), 0.0); +/*N*/ +/*N*/ aUpperCenter *= aTrans; +/*N*/ aCenter *= aTrans; +/*N*/ aTrans.Translate(aCenter - aUpperCenter); +/*N*/ } +/*N*/ +/*N*/ rArrowPoly.Transform(aTrans); +/*N*/ rArrowPoly.SetClosed(TRUE); +/*N*/ +/*N*/ return fRetval; +/*N*/ } + +/*N*/ void ImpLineGeometryCreator::ImpCreateLineGeometry(const Polygon3D& rSourcePoly) +/*N*/ { +/*N*/ UINT16 nPntCnt = rSourcePoly.GetPointCount(); +/*N*/ +/*N*/ if(nPntCnt > 1) +/*N*/ { +/*N*/ BOOL bClosed = rSourcePoly.IsClosed(); +/*N*/ UINT16 nCount = nPntCnt; +/*N*/ Polygon3D aPoly = rSourcePoly; +/*N*/ +/*N*/ if(!bClosed) +/*N*/ { +/*N*/ nCount = nPntCnt-1; +/*N*/ double fPolyLength = rSourcePoly.GetLength(); +/*N*/ double fStart = 0.0; +/*N*/ double fEnd = fPolyLength; +/*N*/ +/*N*/ if(mrLineAttr.IsStartActive()) +/*N*/ { +/*?*/ // create line start polygon and move line end +/*?*/ Polygon3D aArrowPoly(XOutCreatePolygon(mrLineAttr.GetStartPolygon(), mrLineAttr.GetOutDev())); +/*?*/ fStart = ImpCreateLineStartEnd( +/*?*/ aArrowPoly, rSourcePoly, TRUE, +/*?*/ (double)mrLineAttr.GetStartWidth(), mrLineAttr.IsStartCentered()); +/*?*/ mrPolyPoly3D.Insert(aArrowPoly); +/*N*/ } +/*N*/ +/*N*/ if(mrLineAttr.IsEndActive()) +/*N*/ { +/*?*/ // create line end polygon and move line end +/*?*/ Polygon3D aArrowPoly(XOutCreatePolygon(mrLineAttr.GetEndPolygon(), mrLineAttr.GetOutDev())); +/*?*/ fEnd = fPolyLength - ImpCreateLineStartEnd( +/*?*/ aArrowPoly, rSourcePoly, FALSE, +/*?*/ (double)mrLineAttr.GetEndWidth(), mrLineAttr.IsEndCentered()); +/*?*/ mrPolyPoly3D.Insert(aArrowPoly); +/*N*/ } +/*N*/ +/*N*/ if(fStart != 0.0 || fEnd != fPolyLength) +/*N*/ { +/*?*/ // build new poly, consume something from old poly +/*?*/ aPoly = Polygon3D(nCount); +/*?*/ UINT16 nInsPos(0); +/*?*/ double fPolyPos = 0.0; +/*?*/ +/*?*/ for(UINT16 a=0;a<nCount;a++) +/*?*/ { +/*?*/ Vector3D aEdge = rSourcePoly[a+1] - rSourcePoly[a]; +/*?*/ double fLength = aEdge.GetLength(); +/*?*/ +/*?*/ if(fStart != 0.0) +/*?*/ { +/*?*/ if(fStart - fLength > -SMALL_DVALUE) +/*?*/ { +/*?*/ fStart -= fLength; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ Vector3D aNewPos; +/*?*/ aNewPos.CalcInBetween(rSourcePoly[a], rSourcePoly[a+1], fStart / fLength); +/*?*/ aPoly[nInsPos++] = aNewPos; +/*?*/ fStart = 0.0; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aPoly[nInsPos++] = rSourcePoly[a]; +/*?*/ } +/*?*/ +/*?*/ if((fPolyPos + fLength) - fEnd > -SMALL_DVALUE) +/*?*/ { +/*?*/ Vector3D aNewPos; +/*?*/ aNewPos.CalcInBetween(rSourcePoly[a], rSourcePoly[a+1], (fEnd - fPolyPos) / fLength); +/*?*/ aPoly[nInsPos++] = aNewPos; +/*?*/ a = nCount; +/*?*/ } +/*?*/ +/*?*/ // next PolyPos +/*?*/ fPolyPos += fLength; +/*?*/ } +/*?*/ +/*?*/ nCount = aPoly.GetPointCount() - 1; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(nCount) +/*N*/ { +/*N*/ if(!mrLineAttr.GetDisplayLineWidth() +/*N*/ && (mbLineDraft || mrLineAttr.GetLineStyle() == XLINE_SOLID)) +/*N*/ { +/*N*/ // LineWidth zero, solid line -> add directly to linePoly +/*N*/ mrPolyLine3D.Insert(aPoly); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ const Vector3D* pPrev = NULL; +/*N*/ const Vector3D* pLeft = NULL; +/*N*/ const Vector3D* pRight = NULL; +/*N*/ const Vector3D* pNext = NULL; +/*N*/ double fPolyPos = 0.0; +/*N*/ +/*N*/ for(UINT16 a=0;a<nCount;a++) +/*N*/ { +/*N*/ BOOL bStart(!a); +/*N*/ BOOL bEnd(a+1 == nCount); +/*N*/ +/*N*/ // get left, right positions +/*N*/ pLeft = &aPoly[a]; +/*N*/ +/*N*/ // get length +/*N*/ if(bClosed) +/*N*/ { +/*N*/ pRight = &aPoly[(a+1) % nCount]; +/*N*/ pPrev = &aPoly[(a+nCount-1) % nCount]; +/*N*/ pNext = &aPoly[(a+2) % nCount]; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pRight = &aPoly[a+1]; +/*?*/ +/*?*/ if(bStart) +/*?*/ { +/*?*/ pPrev = NULL; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pPrev = &aPoly[a-1]; +/*?*/ } +/*?*/ +/*?*/ if(bEnd) +/*?*/ { +/*?*/ pNext = NULL; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pNext = &aPoly[a+2]; +/*?*/ } +/*N*/ } + + // positions are in pPrev, pLeft, pRight and pNext. +/*N*/ if(!mbLineDraft && mrLineAttr.GetLineStyle() == XLINE_DASH) +/*?*/ ImpCreateSegmentsForLine(pPrev, pLeft, pRight, pNext, fPolyPos); +/*N*/ else +/*?*/ ImpCreateLineSegment(pPrev, pLeft, pRight, pNext); +/*N*/ +/*N*/ // increment PolyPos +/*N*/ Vector3D aEdge = *pRight - *pLeft; +/*N*/ fPolyPos += aEdge.GetLength(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// class to remember broadcast start positions + +/*N*/ SdrBroadcastItemChange::SdrBroadcastItemChange(const SdrObject& rObj) +/*N*/ { +/*N*/ if(rObj.ISA(SdrObjGroup)) +/*N*/ { +/*N*/ SdrObjListIter aIter((const SdrObjGroup&)rObj, IM_DEEPNOGROUPS); +/*N*/ mpData = new List(); +/*N*/ +/*N*/ while(aIter.IsMore()) +/*N*/ { +/*N*/ SdrObject* pObj = aIter.Next(); +/*N*/ if(pObj) +/*N*/ ((List*)mpData)->Insert(new Rectangle(pObj->GetBoundRect()), LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ mnCount = ((List*)mpData)->Count(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ mnCount = 1; +/*N*/ mpData = new Rectangle(rObj.GetBoundRect()); +/*N*/ } +/*N*/ } + +/*N*/ SdrBroadcastItemChange::~SdrBroadcastItemChange() +/*N*/ { +/*N*/ if(mnCount > 1) +/*N*/ { +/*N*/ for(sal_uInt32 a(0); a < mnCount;a++) +/*N*/ delete ((Rectangle*)((List*)mpData)->GetObject(a)); +/*N*/ delete ((List*)mpData); +/*N*/ } +/*N*/ else +/*N*/ delete ((Rectangle*)mpData); +/*N*/ } + +/*N*/ const Rectangle& SdrBroadcastItemChange::GetRectangle(sal_uInt32 nIndex) const +/*N*/ { +/*N*/ if(mnCount > 1) +/*N*/ return *((Rectangle*)((List*)mpData)->GetObject(nIndex)); +/*N*/ else +/*N*/ return *((Rectangle*)mpData); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@ @@@@@ @@@@ @@@@@ @@@@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ DBG_NAME(SdrObject) +/*N*/ TYPEINIT1(SdrObject,SfxListener); + +/*N*/ SdrObject::SdrObject(): +/*N*/ pObjList(NULL), +/*N*/ pPage(NULL), +/*N*/ pModel(NULL), +/*N*/ pUserCall(NULL), +/*N*/ pPlusData(NULL), +/*N*/ nOrdNum(0), +/*N*/ nLayerId(0) +/*N*/ { +/*N*/ DBG_CTOR(SdrObject,NULL); +/*N*/ bVirtObj =FALSE; +/*N*/ bBoundRectDirty =TRUE; +/*N*/ bSnapRectDirty =TRUE; +/*N*/ bNetLock =FALSE; +/*N*/ bInserted =FALSE; +/*N*/ bGrouped =FALSE; +/*N*/ bMovProt =FALSE; +/*N*/ bSizProt =FALSE; +/*N*/ bNoPrint =FALSE; +/*N*/ bEmptyPresObj =FALSE; +/*N*/ bNotPersistent =FALSE; +/*N*/ bNeedColorRestore=FALSE; +/*N*/ bNotVisibleAsMaster=FALSE; +/*N*/ bClosedObj =FALSE; +/*N*/ bWriterFlyFrame =FALSE; +/*N*/ bNotMasterCachable=FALSE; +/*N*/ bIsEdge=FALSE; +/*N*/ bIs3DObj=FALSE; +/*N*/ bMarkProt=FALSE; +/*N*/ bIsUnoObj=FALSE; +/*N*/ } + +/*N*/ SdrObject::~SdrObject() +/*N*/ { +/*N*/ uno::Reference< lang::XComponent > xShape( mxUnoShape, uno::UNO_QUERY ); +/*N*/ if( xShape.is() ) +/*N*/ xShape->dispose(); +/*N*/ +/*N*/ DBG_DTOR(SdrObject,NULL); +/*N*/ SendUserCall(SDRUSERCALL_DELETE,GetBoundRect()); +/*N*/ if (pPlusData!=NULL) delete pPlusData; +/*N*/ } + +/*N*/ SdrObjPlusData* SdrObject::NewPlusData() const +/*N*/ { +/*N*/ return new SdrObjPlusData; +/*N*/ } + +/*N*/ void SdrObject::SetRectsDirty(FASTBOOL bNotMyself) +/*N*/ { +/*N*/ if (!bNotMyself) { +/*N*/ bBoundRectDirty=TRUE; +/*N*/ bSnapRectDirty=TRUE; +/*N*/ } +/*N*/ if (pObjList!=NULL) { +/*N*/ pObjList->SetRectsDirty(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ if(pNewModel && pPage) +/*N*/ { +/*N*/ if(pPage->GetModel() != pNewModel) +/*N*/ { +/*N*/ pPage = NULL; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pModel = pNewModel; +/*N*/ } + +/*N*/ void SdrObject::SetObjList(SdrObjList* pNewObjList) +/*N*/ { +/*N*/ pObjList=pNewObjList; +/*N*/ } + +/*N*/ void SdrObject::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ pPage=pNewPage; +/*N*/ if (pPage!=NULL) { +/*N*/ SdrModel* pMod=pPage->GetModel(); +/*N*/ if (pMod!=pModel && pMod!=NULL) { +/*N*/ SetModel(pMod); +/*N*/ } +/*N*/ } +/*N*/ } + +// init global static itempool +/*N*/ SdrItemPool* SdrObject::mpGlobalItemPool = NULL; +/*N*/ +/*N*/ SdrItemPool* SdrObject::GetGlobalDrawObjectItemPool() +/*N*/ { +/*N*/ if(!mpGlobalItemPool) +/*N*/ { +/*N*/ mpGlobalItemPool = new SdrItemPool(SDRATTR_START, SDRATTR_END); +/*N*/ SfxItemPool* pGlobalOutlPool = EditEngine::CreatePool(); +/*N*/ mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool); +/*N*/ mpGlobalItemPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit()); +/*N*/ mpGlobalItemPool->FreezeIdRanges(); +/*N*/ } +/*N*/ +/*N*/ return mpGlobalItemPool; +/*N*/ } + + +/*N*/ SdrItemPool* SdrObject::GetItemPool() const +/*N*/ { +/*N*/ if(pModel) +/*N*/ return (SdrItemPool*)(&pModel->GetItemPool()); +/*N*/ +/*N*/ // use a static global default pool +/*N*/ return SdrObject::GetGlobalDrawObjectItemPool(); +/*N*/ } + +/*N*/ UINT32 SdrObject::GetObjInventor() const +/*N*/ { +/*N*/ return SdrInventor; +/*N*/ } + +/*N*/ UINT16 SdrObject::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(OBJ_NONE); +/*N*/ } + + +/*N*/ SdrLayerID SdrObject::GetLayer() const +/*N*/ { +/*N*/ return SdrLayerID(nLayerId); +/*N*/ } + +/*N*/ void SdrObject::GetLayer(SetOfByte& rSet) const +/*N*/ { +/*N*/ rSet.Set((BYTE)nLayerId); +/*N*/ SdrObjList* pOL=GetSubList(); +/*N*/ if (pOL!=NULL) { +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG nObjNum=0; nObjNum<nObjAnz; nObjNum++) { +/*N*/ pOL->GetObj(nObjNum)->GetLayer(rSet); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcSetLayer(SdrLayerID nLayer) +/*N*/ { +/*N*/ nLayerId=nLayer; +/*N*/ } + +/*N*/ void SdrObject::SetLayer(SdrLayerID nLayer) +/*N*/ { +/*N*/ NbcSetLayer(nLayer); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + +/*N*/ void SdrObject::AddListener(SfxListener& rListener) +/*N*/ { +/*N*/ ImpForcePlusData(); +/*N*/ if (pPlusData->pBroadcast==NULL) pPlusData->pBroadcast=new SfxBroadcaster; +/*N*/ rListener.StartListening(*pPlusData->pBroadcast); +/*N*/ } + +/*N*/ void SdrObject::RemoveListener(SfxListener& rListener) +/*N*/ { +/*N*/ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) { +/*N*/ rListener.EndListening(*pPlusData->pBroadcast); +/*N*/ if (!pPlusData->pBroadcast->HasListeners()) { +/*N*/ delete pPlusData->pBroadcast; +/*N*/ pPlusData->pBroadcast=NULL; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::AddReference(SdrVirtObj& rVrtObj) +/*N*/ { +/*N*/ AddListener(rVrtObj); +/*N*/ } + +/*N*/ void SdrObject::DelReference(SdrVirtObj& rVrtObj) +/*N*/ { +/*N*/ RemoveListener(rVrtObj); +/*N*/ } + + + + + + +/*N*/ SdrObjList* SdrObject::GetSubList() const +/*N*/ { +/*N*/ return NULL; +/*N*/ } + +/*N*/ SdrObject* SdrObject::GetUpGroup() const +/*N*/ { +/*N*/ return pObjList!=NULL ? pObjList->GetOwnerObj() : NULL; +/*N*/ } + + +/*N*/ void SdrObject::SetName(const XubString& rStr) +/*NBFF*/ { +/*NBFF*/ if(rStr.Len()) +/*NBFF*/ { +/*NBFF*/ ImpForcePlusData(); +/*NBFF*/ pPlusData->aObjName = rStr; +/*NBFF*/ } +/*NBFF*/ else +/*NBFF*/ { +/*NBFF*/ if(pPlusData) +/*NBFF*/ { +/*NBFF*/ pPlusData->aObjName = rStr; +/*NBFF*/ } +/*NBFF*/ } +/*N*/ } + +/*N*/ XubString SdrObject::GetName() const +/*N*/ { +/*N*/ SdrObjPlusData* pPlus=pPlusData; +/*N*/ if (pPlus!=NULL) { +/*N*/ return pPlus->aObjName; +/*N*/ } +/*N*/ return String(); +/*N*/ } + +// support for HTMLName + +// support for HTMLName + +/*N*/ UINT32 SdrObject::GetOrdNum() const +/*N*/ { +/*N*/ if (pObjList!=NULL) { +/*N*/ if (pObjList->IsObjOrdNumsDirty()) { +/*N*/ pObjList->RecalcObjOrdNums(); +/*N*/ } +/*N*/ } else ((SdrObject*)this)->nOrdNum=0; +/*N*/ return nOrdNum; +/*N*/ } + +/*N*/ const Rectangle& SdrObject::GetBoundRect() const +/*N*/ { +/*N*/ if (bBoundRectDirty) { +/*N*/ ((SdrObject*)this)->RecalcBoundRect(); +/*N*/ ((SdrObject*)this)->bBoundRectDirty=FALSE; +/*N*/ } +/*N*/ return aOutRect; +/*N*/ } + +/*N*/ void SdrObject::RecalcBoundRect() +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::SendRepaintBroadcast(const Rectangle& rRect) const +/*N*/ { +/*N*/ if( pModel && pModel->isLocked() ) +/*N*/ return; +/*N*/ +/*N*/ BOOL bBrd(pPlusData && pPlusData->pBroadcast); +/*N*/ BOOL bPnt(bInserted && pModel); +/*N*/ +/*N*/ if(bPnt || bBrd) +/*N*/ { +/*N*/ SdrHint aHint(*this, rRect); +/*N*/ +/*N*/ if(bBrd) +/*?*/ pPlusData->pBroadcast->Broadcast(aHint); +/*N*/ +/*N*/ if(bPnt) +/*N*/ pModel->Broadcast(aHint); +/*N*/ +/*N*/ // alle Animationen wegen Obj-Aenderung neustarten +/*N*/ RestartAnimation(NULL); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SendRepaintBroadcast(BOOL bNoPaintNeeded) const +/*N*/ { +/*N*/ if( pModel && pModel->isLocked() ) +/*N*/ return; +/*N*/ +/*N*/ BOOL bBrd(pPlusData && pPlusData->pBroadcast); +/*N*/ BOOL bPnt(bInserted && pModel); +/*N*/ +/*N*/ if(bPnt || bBrd) +/*N*/ { +/*N*/ SdrHint aHint(*this); +/*N*/ aHint.SetNeedRepaint(!bNoPaintNeeded); +/*N*/ +/*N*/ if(bBrd) +/*N*/ pPlusData->pBroadcast->Broadcast(aHint); +/*N*/ +/*N*/ if(bPnt) +/*N*/ pModel->Broadcast(aHint); +/*N*/ +/*N*/ // alle Animationen wegen Obj-Aenderung neustarten +/*N*/ RestartAnimation(NULL); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SetChanged() +/*N*/ { +/*N*/ if (bInserted && pModel!=NULL) pModel->SetChanged(); +/*N*/ } + +/*N*/ FASTBOOL SdrObject::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& /*rInfoRec*/) const +/*N*/ { +/*N*/ Color aRedColor( COL_RED ); +/*N*/ Color aYellowColor( COL_YELLOW ); +/*N*/ rXOut.OverrideLineColor( aRedColor ); +/*N*/ rXOut.OverrideFillColor( aYellowColor ); +/*N*/ rXOut.DrawRect(GetBoundRect()); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/*N*/ ::std::auto_ptr< SdrLineGeometry > SdrObject::CreateLinePoly( OutputDevice& rOut, +/*N*/ BOOL bForceOnePixel, +/*N*/ BOOL bForceTwoPixel, +/*N*/ BOOL bIsLineDraft ) const +/*N*/ { +/*N*/ PolyPolygon3D aPolyPoly3D; +/*N*/ PolyPolygon3D aLinePoly3D; +/*N*/ +/*N*/ // get XOR Poly as base +/*N*/ XPolyPolygon aTmpPolyPolygon; +/*N*/ TakeXorPoly(aTmpPolyPolygon, TRUE); +/*N*/ +/*N*/ // get ImpLineStyleParameterPack +/*N*/ ImpLineStyleParameterPack aLineAttr(GetItemSet(), bForceOnePixel || bForceTwoPixel || bIsLineDraft, &rOut); +/*N*/ ImpLineGeometryCreator aLineCreator(aLineAttr, aPolyPoly3D, aLinePoly3D, bIsLineDraft); +/*N*/ +/*N*/ // compute single lines +/*N*/ for(UINT16 a=0;a<aTmpPolyPolygon.Count();a++) +/*N*/ { +/*N*/ // expand splines into polygons and convert to double +/*N*/ Polygon3D aPoly3D(XOutCreatePolygon(aTmpPolyPolygon[a], &rOut)); +/*N*/ aPoly3D.RemoveDoublePoints(); +/*N*/ +/*N*/ // convert line to single Polygons; make sure the part +/*N*/ // polygons are all clockwise oriented +/*N*/ aLineCreator.AddPolygon3D(aPoly3D); +/*N*/ } +/*N*/ +/*N*/ if(aPolyPoly3D.Count() || aLinePoly3D.Count()) +/*N*/ return ::std::auto_ptr< SdrLineGeometry > (new SdrLineGeometry(aPolyPoly3D, aLinePoly3D, +/*N*/ aLineAttr, bForceOnePixel, bForceTwoPixel)); +/*N*/ else +/*?*/ return ::std::auto_ptr< SdrLineGeometry > (NULL); +/*N*/ } + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +//#define TEST_SKELETON +#ifdef TEST_SKELETON + +static OutputDevice* pImpTestOut = 0L; + +class ImpSkeleton; + + +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// + + + + +/////////////////////////////////////////////////////////////////////////////// + + + + + +/////////////////////////////////////////////////////////////////////////////// + + +#endif +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +/*N*/ ::std::auto_ptr< SdrLineGeometry > SdrObject::ImpPrepareLineGeometry( ExtOutputDevice& rXOut, const SfxItemSet& rSet, +/*N*/ BOOL bIsLineDraft) const +/*N*/ { +/*N*/ XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)rSet.Get(XATTR_LINESTYLE)).GetValue(); +/*N*/ if(eXLS != XLINE_NONE) +/*N*/ { +/*N*/ // need to force single point line? +/*N*/ INT32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); +/*N*/ Size aSize(nLineWidth, nLineWidth); +/*N*/ aSize = rXOut.GetOutDev()->LogicToPixel(aSize); +/*N*/ BOOL bForceOnePixel(aSize.Width() <= 1 || aSize.Height() <= 1); +/*N*/ BOOL bForceTwoPixel(!bForceOnePixel && (aSize.Width() <= 2 || aSize.Height() <= 2)); +/*N*/ +/*N*/ // no force to two pixel when connected to MetaFile, so that not +/*N*/ // four lines instead of one is recorded (e.g.) +/*N*/ if(bForceTwoPixel && rXOut.GetOutDev()->GetConnectMetaFile()) +/*N*/ bForceTwoPixel = FALSE; +/*N*/ +/*N*/ // #78210# switch off bForceTwoPixel when line draft mode +/*N*/ if(bForceTwoPixel && bIsLineDraft) +/*N*/ { +/*N*/ bForceTwoPixel = FALSE; +/*N*/ bForceOnePixel = TRUE; +/*N*/ } +/*N*/ +/*N*/ // create line geometry +/*N*/ return CreateLinePoly(*rXOut.GetOutDev(), +/*N*/ bForceOnePixel, bForceTwoPixel, bIsLineDraft); +/*N*/ } +/*N*/ +/*N*/ return ::std::auto_ptr< SdrLineGeometry > (0L); +/*N*/ } + + +/*N*/ void SdrObject::ImpDrawColorLineGeometry( +/*N*/ ExtOutputDevice& rXOut, const SfxItemSet& rSet, SdrLineGeometry& rLineGeometry) const +/*N*/ { +/*N*/ Color aColor = ((XLineColorItem&)rSet.Get(XATTR_LINECOLOR)).GetValue(); +/*N*/ sal_uInt16 nTrans = ((const XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue(); +/*N*/ +/*N*/ // draw the line geometry +/*N*/ ImpDrawLineGeometry(rXOut, aColor, nTrans, rLineGeometry); +/*N*/ } + +/*N*/ void SdrObject::ImpDrawLineGeometry( ExtOutputDevice& rXOut, +/*N*/ Color& rColor, +/*N*/ sal_uInt16 nTransparence, +/*N*/ SdrLineGeometry& rLineGeometry, +/*N*/ sal_Int32 nDX, +/*N*/ sal_Int32 nDY ) const +/*N*/ { +/*N*/ Color aLineColor( rColor ); +/*N*/ +/*N*/ // #72796# black/white option active? +/*N*/ const UINT32 nOldDrawMode(rXOut.GetOutDev()->GetDrawMode()); +/*N*/ +/*N*/ // #72796# if yes, force to DRAWMODE_BLACKFILL for these are LINES to be drawn as polygons +/*N*/ if( ( nOldDrawMode & DRAWMODE_WHITEFILL ) && ( nOldDrawMode & DRAWMODE_BLACKLINE ) ) +/*N*/ { +/*?*/ aLineColor = Color( COL_BLACK ); +/*?*/ rXOut.GetOutDev()->SetDrawMode( nOldDrawMode & (~DRAWMODE_WHITEFILL) ); +/*N*/ } +/*N*/ else if( ( nOldDrawMode & DRAWMODE_SETTINGSFILL ) && ( nOldDrawMode & DRAWMODE_SETTINGSLINE ) ) +/*N*/ { +/*?*/ ColorConfig aColorConfig; +/*?*/ aLineColor = Color( aColorConfig.GetColorValue( FONTCOLOR ).nColor ); +/*?*/ rXOut.GetOutDev()->SetDrawMode( nOldDrawMode & (~DRAWMODE_SETTINGSFILL) ); +/*N*/ } +/*N*/ +/*N*/ // #103692# Hold local copy of geometry +/*N*/ PolyPolygon3D aPolyPoly = rLineGeometry.GetPolyPoly3D(); +/*N*/ PolyPolygon3D aLinePoly = rLineGeometry.GetLinePoly3D(); +/*N*/ +/*N*/ // #103692# Offset geometry (extracted from SdrObject::ImpDrawShadowLineGeometry) +/*N*/ if( nDX || nDY ) +/*N*/ { +/*?*/ // transformation necessary +/*?*/ Matrix4D aTrans; +/*?*/ +/*?*/ aTrans.Translate((double)nDX, -(double)nDY, 0.0); +/*?*/ aPolyPoly.Transform(aTrans); +/*?*/ aLinePoly.Transform(aTrans); +/*N*/ } +/*N*/ +/*N*/ // #100127# Bracket output with a comment, if recording a Mtf +/*N*/ GDIMetaFile* pMtf=NULL; +/*N*/ bool bMtfCommentWritten( false ); +/*N*/ if( (pMtf=rXOut.GetOutDev()->GetConnectMetaFile()) ) +/*N*/ { +/*N*/ XPolyPolygon aPolyPoly; +/*N*/ TakeXorPoly(aPolyPoly, TRUE); +/*N*/ +/*N*/ // #103692# Offset original geometry, too +/*N*/ if( nDX || nDY ) +/*N*/ { +/*?*/ // transformation necessary +/*?*/ aPolyPoly.Move( nDX, nDY ); +/*N*/ } +/*N*/ +/*N*/ // for geometries with more than one polygon, dashing, arrows +/*N*/ // etc. become ambiguous (e.g. measure objects have no arrows +/*N*/ // on the end line), thus refrain from writing the comment +/*N*/ // here. +/*N*/ if( aPolyPoly.Count() == 1 ) +/*N*/ { +/*N*/ // add completely superfluous color action (gets overwritten +/*N*/ // below), to store our line color reliably +/*N*/ rXOut.GetOutDev()->SetLineColor(aLineColor); +/*N*/ +/*N*/ const ImpLineStyleParameterPack& rLineParameters = rLineGeometry.GetLineAttr(); +/*N*/ +/*N*/ XPolygon aStartPoly( rLineParameters.GetStartPolygon() ); +/*N*/ XPolygon aEndPoly( rLineParameters.GetEndPolygon() ); +/*N*/ +/*N*/ // scale arrows to specified stroke width +/*N*/ if( aStartPoly.GetPointCount() ) +/*?*/ { +/*?*/ Rectangle aBounds( aStartPoly.GetBoundRect() ); +/*?*/ +/*?*/ // mirror and translate to origin +/*?*/ aStartPoly.Scale(-1,-1); +/*?*/ aStartPoly.Translate( Point(aBounds.GetWidth() / 2, aBounds.GetHeight()) ); +/*?*/ +/*?*/ if( aBounds.GetWidth() ) +/*?*/ { +/*?*/ // #104527# Avoid division by zero. If rLineParameters.GetLineWidth +/*?*/ // is zero this is a hairline which can be handled as 1.0. +/*?*/ double fLineWidth(rLineParameters.GetLineWidth() ? (double)rLineParameters.GetLineWidth() : 1.0); +/*?*/ +/*?*/ double fScale( (double)rLineParameters.GetStartWidth() / fLineWidth * +/*?*/ (double)SvtGraphicStroke::normalizedArrowWidth / (double)aBounds.GetWidth() ); +/*?*/ aStartPoly.Scale( fScale, fScale ); +/*?*/ } +/*?*/ +/*?*/ if( rLineParameters.IsStartCentered() ) +/*?*/ aStartPoly.Translate( Point(0, -aStartPoly.GetBoundRect().GetHeight() / 2) ); +/*?*/ } +/*N*/ if( aEndPoly.GetPointCount() ) +/*?*/ { +/*?*/ Rectangle aBounds( aEndPoly.GetBoundRect() ); +/*?*/ +/*?*/ // mirror and translate to origin +/*?*/ aEndPoly.Scale(-1,-1); +/*?*/ aEndPoly.Translate( Point(aBounds.GetWidth() / 2, aBounds.GetHeight()) ); +/*?*/ +/*?*/ if( aBounds.GetWidth() ) +/*?*/ { +/*?*/ // #104527# Avoid division by zero. If rLineParameters.GetLineWidth +/*?*/ // is zero this is a hairline which we can be handled as 1.0. +/*?*/ double fLineWidth(rLineParameters.GetLineWidth() ? (double)rLineParameters.GetLineWidth() : 1.0); +/*?*/ +/*?*/ double fScale( (double)rLineParameters.GetEndWidth() / fLineWidth * +/*?*/ (double)SvtGraphicStroke::normalizedArrowWidth / (double)aBounds.GetWidth() ); +/*?*/ aEndPoly.Scale( fScale, fScale ); +/*?*/ } +/*?*/ +/*?*/ if( rLineParameters.IsEndCentered() ) +/*?*/ aEndPoly.Translate( Point(0, -aEndPoly.GetBoundRect().GetHeight() / 2) ); +/*?*/ } +/*N*/ +/*N*/ SvtGraphicStroke aStroke( XOutCreatePolygonBezier( aPolyPoly[0], rXOut.GetOutDev() ), +/*N*/ XOutCreatePolygonBezier( aStartPoly, rXOut.GetOutDev() ), +/*N*/ XOutCreatePolygonBezier( aEndPoly, rXOut.GetOutDev() ), +/*N*/ nTransparence / 100.0, +/*N*/ rLineParameters.GetLineWidth(), +/*N*/ SvtGraphicStroke::capButt, +/*N*/ SvtGraphicStroke::joinRound, +/*N*/ rLineParameters.GetLinejointMiterUpperBound(), +/*N*/ rLineParameters.GetLineStyle() == XLINE_DASH ? rLineParameters.GetDotDash() : SvtGraphicStroke::DashArray() ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ ::rtl::OString aStr( aStroke.toString() ); +/*N*/ #endif +/*N*/ +/*N*/ SvMemoryStream aMemStm; +/*N*/ +/*N*/ aMemStm << aStroke; +/*N*/ +/*N*/ pMtf->AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0, +/*N*/ static_cast<const BYTE*>(aMemStm.GetData()), +/*N*/ aMemStm.Seek( STREAM_SEEK_TO_END ) ) ); +/*N*/ bMtfCommentWritten = true; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(nTransparence) +/*?*/ { +/*?*/ if(nTransparence != 100) +/*?*/ { +/*?*/ // to be shown line has transparence, output via MetaFile +/*?*/ UINT8 nScaledTrans((UINT8)((nTransparence * 255)/100)); +/*?*/ Color aTransColor(nScaledTrans, nScaledTrans, nScaledTrans); +/*?*/ Gradient aGradient(GRADIENT_LINEAR, aTransColor, aTransColor); +/*?*/ GDIMetaFile aMetaFile; +/*?*/ VirtualDevice aVDev; +/*?*/ Volume3D aVolume; +/*?*/ MapMode aMap(rXOut.GetOutDev()->GetMapMode()); +/*?*/ +/*?*/ // StepCount to someting small +/*?*/ aGradient.SetSteps(3); +/*?*/ +/*?*/ // get bounds of geometry +/*?*/ if(aPolyPoly.Count()) +/*?*/ aVolume.Union(aPolyPoly.GetPolySize()); +/*?*/ if(aLinePoly.Count()) +/*?*/ aVolume.Union(aLinePoly.GetPolySize()); +/*?*/ +/*?*/ // get pixel size in logic coor for 1,2 pixel cases +/*?*/ Size aSizeSinglePixel(1, 1); +/*?*/ +/*?*/ if(rLineGeometry.DoForceOnePixel() || rLineGeometry.DoForceTwoPixel()) +/*?*/ aSizeSinglePixel = rXOut.GetOutDev()->PixelToLogic(aSizeSinglePixel); +/*?*/ +/*?*/ // create BoundRectangle +/*?*/ Rectangle aBound( +/*?*/ (INT32)aVolume.MinVec().X(), +/*?*/ (INT32)-aVolume.MaxVec().Y(), +/*?*/ (INT32)aVolume.MaxVec().X(), +/*?*/ (INT32)-aVolume.MinVec().Y()); +/*?*/ +/*?*/ if(rLineGeometry.DoForceOnePixel() || rLineGeometry.DoForceTwoPixel()) +/*?*/ { +/*?*/ // enlarge aBound +/*?*/ if(rLineGeometry.DoForceTwoPixel()) +/*?*/ { +/*?*/ aBound.Right() += 2 * (aSizeSinglePixel.Width() - 1); +/*?*/ aBound.Bottom() += 2 * (aSizeSinglePixel.Height() - 1); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aBound.Right() += (aSizeSinglePixel.Width() - 1); +/*?*/ aBound.Bottom() += (aSizeSinglePixel.Height() - 1); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // prepare VDev and MetaFile +/*?*/ aVDev.EnableOutput(FALSE); +/*?*/ aVDev.SetMapMode(rXOut.GetOutDev()->GetMapMode()); +/*?*/ aMetaFile.Record(&aVDev); +/*?*/ aVDev.SetLineColor(aLineColor); +/*?*/ aVDev.SetFillColor(aLineColor); +/*?*/ aVDev.SetFont(rXOut.GetOutDev()->GetFont()); +/*?*/ aVDev.SetDrawMode(rXOut.GetOutDev()->GetDrawMode()); +/*?*/ aVDev.SetRefPoint(rXOut.GetOutDev()->GetRefPoint()); +/*?*/ +/*?*/ // create output +/*?*/ if(aPolyPoly.Count()) +/*?*/ { +/*?*/ PolyPolygon aVCLPolyPoly = aPolyPoly.GetPolyPolygon(); +/*?*/ +/*?*/ for(UINT16 a=0;a<aVCLPolyPoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolygonAction(aVCLPolyPoly[a])); +/*?*/ } +/*?*/ +/*?*/ if(aLinePoly.Count()) +/*?*/ { +/*?*/ PolyPolygon aVCLLinePoly = aLinePoly.GetPolyPolygon(); +/*?*/ +/*?*/ if(rLineGeometry.DoForceTwoPixel()) +/*?*/ { +/*?*/ UINT16 a; +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolyLineAction(aVCLLinePoly[a])); +/*?*/ +/*?*/ aVCLLinePoly.Move(aSizeSinglePixel.Width() - 1, 0); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolyLineAction(aVCLLinePoly[a])); +/*?*/ +/*?*/ aVCLLinePoly.Move(0, aSizeSinglePixel.Height() - 1); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolyLineAction(aVCLLinePoly[a])); +/*?*/ +/*?*/ aVCLLinePoly.Move(-aSizeSinglePixel.Width() - 1, 0); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolyLineAction(aVCLLinePoly[a])); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ for(UINT16 a=0;a<aVCLLinePoly.Count();a++) +/*?*/ aMetaFile.AddAction(new MetaPolyLineAction(aVCLLinePoly[a])); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // draw metafile +/*?*/ aMetaFile.Stop(); +/*?*/ aMetaFile.WindStart(); +/*?*/ aMap.SetOrigin(aBound.TopLeft()); +/*?*/ aMetaFile.SetPrefMapMode(aMap); +/*?*/ aMetaFile.SetPrefSize(aBound.GetSize()); +/*?*/ rXOut.GetOutDev()->DrawTransparent(aMetaFile, aBound.TopLeft(), aBound.GetSize(), aGradient); +/*?*/ } +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ // no transparence, simple output +/*N*/ if(aPolyPoly.Count()) +/*N*/ { +/*N*/ PolyPolygon aVCLPolyPoly = aPolyPoly.GetPolyPolygon(); +/*N*/ +/*N*/ rXOut.GetOutDev()->SetLineColor(); +/*N*/ rXOut.GetOutDev()->SetFillColor(aLineColor); +/*N*/ +/*N*/ for(UINT16 a=0;a<aVCLPolyPoly.Count();a++) +/*N*/ rXOut.GetOutDev()->DrawPolygon(aVCLPolyPoly[a]); +/*N*/ } +/*N*/ +/*N*/ if(aLinePoly.Count()) +/*N*/ { +/*N*/ PolyPolygon aVCLLinePoly = aLinePoly.GetPolyPolygon(); +/*N*/ +/*N*/ rXOut.GetOutDev()->SetLineColor(aLineColor); +/*N*/ rXOut.GetOutDev()->SetFillColor(); +/*N*/ +/*N*/ if(rLineGeometry.DoForceTwoPixel()) +/*?*/ { +/*?*/ PolyPolygon aPolyPolyPixel( rXOut.GetOutDev()->LogicToPixel(aVCLLinePoly) ); +/*?*/ BOOL bWasEnabled = rXOut.GetOutDev()->IsMapModeEnabled(); +/*?*/ rXOut.GetOutDev()->EnableMapMode(FALSE); +/*?*/ UINT16 a; +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ rXOut.GetOutDev()->DrawPolyLine(aPolyPolyPixel[a]); +/*?*/ +/*?*/ aPolyPolyPixel.Move(1,0); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ rXOut.GetOutDev()->DrawPolyLine(aPolyPolyPixel[a]); +/*?*/ +/*?*/ aPolyPolyPixel.Move(0,1); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ rXOut.GetOutDev()->DrawPolyLine(aPolyPolyPixel[a]); +/*?*/ +/*?*/ aPolyPolyPixel.Move(-1,0); +/*?*/ +/*?*/ for(a=0;a<aVCLLinePoly.Count();a++) +/*?*/ rXOut.GetOutDev()->DrawPolyLine(aPolyPolyPixel[a]); +/*?*/ +/*?*/ rXOut.GetOutDev()->EnableMapMode(bWasEnabled); +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ for( UINT16 a = 0; a < aVCLLinePoly.Count(); a++ ) +/*N*/ { +/*N*/ const Polygon& rPoly = aVCLLinePoly[ a ]; +/*N*/ BOOL bDrawn = FALSE; +/*N*/ +/*N*/ if( rPoly.GetSize() == 2 ) +/*N*/ { +/*N*/ if ( !rXOut.GetOutDev()->GetConnectMetaFile() ) +/*N*/ { +/*?*/ const Line aLine( rXOut.GetOutDev()->LogicToPixel( rPoly[ 0 ] ), +/*?*/ rXOut.GetOutDev()->LogicToPixel( rPoly[ 1 ] ) ); +/*?*/ +/*?*/ if( aLine.GetLength() > 16000 ) +/*?*/ { +/*?*/ Point aPoint; +/*?*/ Rectangle aOutRect( aPoint, rXOut.GetOutDev()->GetOutputSizePixel() ); +/*?*/ Line aIntersection; +/*?*/ +/*?*/ if( aLine.Intersection( aOutRect, aIntersection ) ) +/*?*/ { +/*?*/ rXOut.GetOutDev()->DrawLine( rXOut.GetOutDev()->PixelToLogic( aIntersection.GetStart() ), +/*?*/ rXOut.GetOutDev()->PixelToLogic( aIntersection.GetEnd() ) ); +/*?*/ } +/*?*/ bDrawn = TRUE; +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ if( !bDrawn ) +/*N*/ rXOut.GetOutDev()->DrawPolyLine( rPoly ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // #100127# Bracket output with a comment, if recording a Mtf +/*N*/ if( bMtfCommentWritten && pMtf ) +/*N*/ pMtf->AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_END" ) ); +/*N*/ +/*N*/ rXOut.GetOutDev()->SetDrawMode( nOldDrawMode ); +/*N*/ } + + +/////////////////////////////////////////////////////////////////////////////// + + +/*N*/ SdrObject* SdrObject::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*N*/ } + +/*N*/ SdrObject* SdrObject::Clone() const +/*N*/ { +/*N*/ SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL); +/*N*/ if (pObj!=NULL) { +/*N*/ pObj->pModel=pModel; +/*N*/ pObj->pPage=pPage; +/*N*/ *pObj=*this; +/*N*/ } +/*N*/ return pObj; +/*N*/ } + +/*N*/ SdrObject* SdrObject::Clone(SdrPage* pNewPage, SdrModel* pNewModel) const +/*N*/ { +/*N*/ SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL); +/*N*/ if (pObj!=NULL) { +/*N*/ pObj->pModel=pNewModel; +/*N*/ pObj->pPage=pNewPage; +/*N*/ *pObj=*this; +/*N*/ } +/*N*/ return pObj; +/*N*/ } + +/*N*/ void SdrObject::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ pModel =rObj.pModel; +/*N*/ aOutRect=rObj.GetBoundRect(); +/*N*/ nLayerId=rObj.GetLayer(); +/*N*/ aAnchor =rObj.aAnchor; +/*N*/ bVirtObj=rObj.bVirtObj; +/*N*/ bSizProt=rObj.bSizProt; +/*N*/ bMovProt=rObj.bMovProt; +/*N*/ bNoPrint=rObj.bNoPrint; +/*N*/ bMarkProt=rObj.bMarkProt; +/*N*/ //EmptyPresObj wird nicht kopiert: nun doch! (25-07-1995, Joe) +/*N*/ bEmptyPresObj =rObj.bEmptyPresObj; +/*N*/ //NotVisibleAsMaster wird nicht kopiert: nun doch! (25-07-1995, Joe) +/*N*/ bNotVisibleAsMaster=rObj.bNotVisibleAsMaster; +/*N*/ +/*N*/ bBoundRectDirty=rObj.bBoundRectDirty; +/*N*/ bSnapRectDirty=TRUE; //rObj.bSnapRectDirty; +/*N*/ bNotMasterCachable=rObj.bNotMasterCachable; +/*N*/ if (pPlusData!=NULL) { delete pPlusData; pPlusData=NULL; } +/*N*/ if (rObj.pPlusData!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + + + + + + +/*N*/ void SdrObject::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL /*bDetail*/) const +/*N*/ { +/*N*/ rPoly=XPolyPolygon(XPolygon(GetBoundRect())); +/*N*/ } + +/*N*/ void SdrObject::TakeContour( XPolyPolygon& rPoly ) const +/*N*/ { +/*N*/ VirtualDevice aBlackHole; +/*N*/ GDIMetaFile aMtf; +/*N*/ SdrPaintInfoRec aPaintInfo; +/*N*/ XPolygon aXPoly; +/*N*/ +/*N*/ aBlackHole.EnableOutput( FALSE ); +/*N*/ aBlackHole.SetDrawMode( DRAWMODE_NOFILL ); +/*N*/ +/*N*/ ExtOutputDevice aXOut( &aBlackHole ); +/*N*/ SdrObject* pClone = Clone(); +/*N*/ +/*N*/ if(pClone && ISA(SdrEdgeObj)) +/*N*/ { +/*N*/ // #102344# Flat cloned SdrEdgeObj, copy connections to original object(s). +/*N*/ // This is deleted later at delete pClone. +/*N*/ SdrObject* pLeft = ((SdrEdgeObj*)this)->GetConnectedNode(TRUE); +/*N*/ SdrObject* pRight = ((SdrEdgeObj*)this)->GetConnectedNode(FALSE); +/*N*/ +/*N*/ if(pLeft) +/*N*/ { +/*N*/ pClone->ConnectToNode(TRUE, pLeft); +/*N*/ } +/*N*/ +/*N*/ if(pRight) +/*N*/ { +/*N*/ pClone->ConnectToNode(FALSE, pRight); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pClone->SetItem(XLineStyleItem(XLINE_SOLID)); +/*N*/ pClone->SetItem(XLineColorItem(String(), Color(COL_BLACK))); +/*N*/ pClone->SetItem(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ aMtf.Record( &aBlackHole ); +/*N*/ aPaintInfo.nPaintMode = SDRPAINTMODE_DRAFTTEXT | SDRPAINTMODE_DRAFTGRAF; +/*N*/ pClone->Paint( aXOut, aPaintInfo ); +/*N*/ delete pClone; +/*N*/ aMtf.Stop(); +/*N*/ aMtf.WindStart(); +/*N*/ rPoly.Clear(); +/*N*/ +/*N*/ for( ULONG nActionNum = 0, nActionAnz = aMtf.GetActionCount(); nActionNum < nActionAnz; nActionNum++ ) +/*N*/ { +/*N*/ const MetaAction& rAct = *aMtf.GetAction( nActionNum ); +/*N*/ BOOL bXPoly = FALSE; +/*N*/ +/*N*/ switch( rAct.GetType() ) +/*N*/ { +/*?*/ case META_RECT_ACTION: +/*?*/ { +/*?*/ const Rectangle& rRect = ( (const MetaRectAction&) rAct ).GetRect(); +/*?*/ +/*?*/ if( rRect.GetWidth() && rRect.GetHeight() ) +/*?*/ { +/*?*/ aXPoly = rRect; +/*?*/ bXPoly = TRUE; +/*?*/ } +/*?*/ } +/*?*/ break; +/*?*/ +/*?*/ case META_ELLIPSE_ACTION: +/*?*/ { +/*?*/ const Rectangle& rRect = ( (const MetaEllipseAction&) rAct ).GetRect(); +/*?*/ +/*?*/ if( rRect.GetWidth() && rRect.GetHeight() ) +/*?*/ { +/*?*/ aXPoly = XPolygon( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1 ); +/*?*/ bXPoly = TRUE; +/*?*/ } +/*?*/ } +/*?*/ break; +/*?*/ +/*N*/ case META_POLYGON_ACTION: +/*N*/ { +/*N*/ const Polygon& rPoly = ( (const MetaPolygonAction&) rAct ).GetPolygon(); +/*N*/ +/*N*/ if( rPoly.GetSize() > 2 ) +/*N*/ { +/*N*/ aXPoly = rPoly; +/*N*/ bXPoly = TRUE; +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ +/*?*/ case META_POLYPOLYGON_ACTION: +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ break; +/*?*/ +/*N*/ case META_POLYLINE_ACTION: +/*N*/ { +/*N*/ const Polygon& rPoly = ( (const MetaPolyLineAction&) rAct ).GetPolygon(); +/*N*/ +/*N*/ if( rPoly.GetSize() > 1 ) +/*N*/ { +/*N*/ aXPoly = rPoly; +/*N*/ bXPoly = TRUE; +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case META_LINE_ACTION: +/*N*/ { +/*N*/ aXPoly = XPolygon( 2 ); +/*N*/ aXPoly[ 0 ] = ( (const MetaLineAction&) rAct ).GetStartPoint(); +/*N*/ aXPoly[ 1 ] = ( (const MetaLineAction&) rAct ).GetEndPoint(); +/*N*/ bXPoly = TRUE; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ if( bXPoly ) +/*N*/ rPoly.Insert( aXPoly ); +/*N*/ } +/*N*/ +/*N*/ // if we only have the outline of the object, we have _no_ contouir +/*N*/ if( rPoly.Count() == 1 ) +/*N*/ rPoly.Clear(); +/*N*/ } + +/*?*/ void SdrObject::TakeContour(XPolyPolygon& rXPoly, SdrContourType eType) const +/*?*/ { +/*?*/ } + +// Handles + + + + + + +// Drag + + + + + + + + + +// Create + + + + + + +/*N*/ Pointer SdrObject::GetCreatePointer() const +/*N*/ { +/*N*/ return Pointer(POINTER_CROSS); +/*N*/ } + +// Transformationen +/*N*/ void SdrObject::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ MoveRect(aOutRect,rSiz); +/*N*/ SetRectsDirty(); +/*N*/ } + +/*N*/ void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); +/*N*/ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); +/*N*/ if (bXMirr || bYMirr) { +/*N*/ Point aRef1(GetSnapRect().Center()); +/*N*/ if (bXMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.Y()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ if (bYMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.X()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ } +/*N*/ ResizeRect(aOutRect,rRef,xFact,yFact); +/*N*/ SetRectsDirty(); +/*N*/ } + +/*N*/ void SdrObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ SetGlueReallyAbsolute(TRUE); +/*N*/ aOutRect.Move(-rRef.X(),-rRef.Y()); +/*N*/ Rectangle R(aOutRect); +/*N*/ if (sn==1.0 && cs==0.0) { // 90? +/*N*/ aOutRect.Left() =-R.Bottom(); +/*N*/ aOutRect.Right() =-R.Top(); +/*N*/ aOutRect.Top() =R.Left(); +/*N*/ aOutRect.Bottom()=R.Right(); +/*N*/ } else if (sn==0.0 && cs==-1.0) { // 180? +/*N*/ aOutRect.Left() =-R.Right(); +/*N*/ aOutRect.Right() =-R.Left(); +/*N*/ aOutRect.Top() =-R.Bottom(); +/*N*/ aOutRect.Bottom()=-R.Top(); +/*N*/ } else if (sn==-1.0 && cs==0.0) { // 270? +/*N*/ aOutRect.Left() =R.Top(); +/*N*/ aOutRect.Right() =R.Bottom(); +/*N*/ aOutRect.Top() =-R.Right(); +/*N*/ aOutRect.Bottom()=-R.Left(); +/*N*/ } +/*N*/ aOutRect.Move(rRef.X(),rRef.Y()); +/*N*/ aOutRect.Justify(); // Sicherheitshalber +/*N*/ SetRectsDirty(); +/*N*/ NbcRotateGluePoints(rRef,nWink,sn,cs); +/*N*/ SetGlueReallyAbsolute(FALSE); +/*N*/ } + +/*N*/ void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2) +/*N*/ { +/*N*/ SetGlueReallyAbsolute(TRUE); +/*N*/ aOutRect.Move(-rRef1.X(),-rRef1.Y()); +/*N*/ Rectangle R(aOutRect); +/*N*/ long dx=rRef2.X()-rRef1.X(); +/*N*/ long dy=rRef2.Y()-rRef1.Y(); +/*N*/ if (dx==0) { // Vertikale Achse +/*N*/ aOutRect.Left() =-R.Right(); +/*N*/ aOutRect.Right()=-R.Left(); +/*N*/ } else if (dy==0) { // Horizontale Achse +/*N*/ aOutRect.Top() =-R.Bottom(); +/*N*/ aOutRect.Bottom()=-R.Top(); +/*N*/ } else if (dx==dy) { /* 45 Grad Achse \ */ +/*N*/ aOutRect.Left() =R.Top(); +/*N*/ aOutRect.Right() =R.Bottom(); +/*N*/ aOutRect.Top() =R.Left(); +/*N*/ aOutRect.Bottom()=R.Right(); +/*N*/ } else if (dx==-dy) { // 45 Grad Achse / +/*N*/ aOutRect.Left() =-R.Bottom(); +/*N*/ aOutRect.Right() =-R.Top(); +/*N*/ aOutRect.Top() =-R.Right(); +/*N*/ aOutRect.Bottom()=-R.Left(); +/*N*/ } +/*N*/ aOutRect.Move(rRef1.X(),rRef1.Y()); +/*N*/ aOutRect.Justify(); // Sicherheitshalber +/*N*/ SetRectsDirty(); +/*N*/ NbcMirrorGluePoints(rRef1,rRef2); +/*N*/ SetGlueReallyAbsolute(FALSE); +/*N*/ } + +/*N*/ void SdrObject::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ SetGlueReallyAbsolute(TRUE); +/*N*/ NbcShearGluePoints(rRef,nWink,tn,bVShear); +/*N*/ SetGlueReallyAbsolute(FALSE); +/*N*/ } + +/*N*/ void SdrObject::Move(const Size& rSiz) +/*N*/ { +/*N*/ if (rSiz.Width()!=0 || rSiz.Height()!=0) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcMove(rSiz); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcResize(rRef,xFact,yFact); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::Rotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ if (nWink!=0) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcRotate(rRef,nWink,sn,cs); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObject::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ if (nWink!=0) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcShear(rRef,nWink,tn,bVShear); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcSetRelativePos(const Point& rPnt) +/*N*/ { +/*N*/ Point aRelPos0(GetSnapRect().TopLeft()-aAnchor); +/*N*/ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y()); +/*N*/ NbcMove(aSiz); // Der ruft auch das SetRectsDirty() +/*N*/ } + +/*N*/ void SdrObject::SetRelativePos(const Point& rPnt) +/*N*/ { +/*N*/ if (rPnt!=GetRelativePos()) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetRelativePos(rPnt); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Point SdrObject::GetRelativePos() const +/*N*/ { +/*N*/ return GetSnapRect().TopLeft()-aAnchor; +/*N*/ } +/*N*/ +/*N*/ void SdrObject::NbcSetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y()); +/*N*/ aAnchor=rPnt; +/*N*/ NbcMove(aSiz); // Der ruft auch das SetRectsDirty() +/*N*/ } +/*N*/ +/*N*/ void SdrObject::SetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ if (rPnt!=aAnchor) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetAnchorPos(rPnt); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ const Point& SdrObject::GetAnchorPos() const +/*N*/ { +/*N*/ return aAnchor; +/*N*/ } + +/*N*/ void SdrObject::RecalcSnapRect() +/*N*/ { +/*N*/ } + +/*N*/ const Rectangle& SdrObject::GetSnapRect() const +/*N*/ { +/*N*/ return aOutRect; +/*N*/ } + +/*N*/ void SdrObject::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ aOutRect=rRect; +/*N*/ } + +/*N*/ const Rectangle& SdrObject::GetLogicRect() const +/*N*/ { +/*N*/ return GetSnapRect(); +/*N*/ } + +/*N*/ void SdrObject::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ NbcSetSnapRect(rRect); +/*N*/ } + +/*N*/ void SdrObject::SetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetSnapRect(rRect); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + +/*N*/ void SdrObject::SetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetLogicRect(rRect); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + +/*N*/ long SdrObject::GetRotateAngle() const +/*N*/ { +/*N*/ return 0; +/*N*/ } + +/*N*/ long SdrObject::GetShearAngle(FASTBOOL bVertical) const +/*N*/ { +/*N*/ return 0; +/*N*/ } + + + +/*N*/ FASTBOOL SdrObject::IsPolyObj() const +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + +/*?*/ USHORT SdrObject::GetPointCount() const +/*?*/ { +/*?*/ return 0; +/*?*/ } + +/*?*/ const Point& SdrObject::GetPoint(USHORT i) const +/*?*/ { +/*?*/ return *((Point*)NULL); +/*?*/ } + +/*N*/ void SdrObject::SetPoint(const Point& rPnt, USHORT i) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetPoint(rPnt,i); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + +/*N*/ void SdrObject::NbcSetPoint(const Point& rPnt, USHORT i) +/*N*/ { +/*N*/ } + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FASTBOOL SdrObject::HasTextEdit() const +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + +/*N*/ SdrObject* SdrObject::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ return CheckHit(rPnt,nTol,pVisiLayer); +/*N*/ } + +/*N*/ FASTBOOL SdrObject::BegTextEdit(SdrOutliner& rOutl) +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + +/*N*/ void SdrObject::EndTextEdit(SdrOutliner& rOutl) +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::SetOutlinerParaObject(OutlinerParaObject* pTextObject) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetOutlinerParaObject(pTextObject); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ if (GetBoundRect()!=aBoundRect0) { +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) +/*N*/ { +/*N*/ } + +/*N*/ OutlinerParaObject* SdrObject::GetOutlinerParaObject() const +/*N*/ { +/*N*/ return NULL; +/*N*/ } + +/*N*/ void SdrObject::NbcReformatText() +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::ReformatText() +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcReformatText(); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ if (GetBoundRect()!=aBoundRect0) { +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObject::RestartAnimation(SdrPageView* pPageView) const +/*N*/ { +/*N*/ } + +/*N*/ #define Imp2ndKennung (0x434F4D43) +/*N*/ SdrObjUserData* SdrObject::ImpGetMacroUserData() const +/*N*/ { +/*N*/ SdrObjUserData* pData=NULL; +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT nNum=nAnz; nNum>0 && pData==NULL;) { +/*N*/ nNum--; +/*N*/ pData=GetUserData(nNum); +/*N*/ if (!pData->HasMacro(this)) pData=NULL; +/*N*/ } +/*N*/ return pData; +/*N*/ } + +/*N*/ FASTBOOL SdrObject::HasMacro() const +/*N*/ { +/*N*/ SdrObjUserData* pData=ImpGetMacroUserData(); +/*N*/ return pData!=NULL ? pData->HasMacro(this) : FALSE; +/*N*/ } + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObjGeoData* SdrObject::NewGeoData() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*N*/ } + +/*N*/ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ { +/*N*/ rGeo.aBoundRect =GetBoundRect(); +/*N*/ rGeo.aAnchor =aAnchor ; +/*N*/ rGeo.bMovProt =bMovProt ; +/*N*/ rGeo.bSizProt =bSizProt ; +/*N*/ rGeo.bNoPrint =bNoPrint ; +/*N*/ rGeo.bClosedObj =bClosedObj ; +/*N*/ rGeo.nLayerId =nLayerId ; +/*N*/ +/*N*/ // Benutzerdefinierte Klebepunkte +/*N*/ if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) { +/*?*/ if (rGeo.pGPL!=NULL) { +/*?*/ *rGeo.pGPL=*pPlusData->pGluePoints; +/*?*/ } else { +/*?*/ rGeo.pGPL=new SdrGluePointList(*pPlusData->pGluePoints); +/*N*/ } +/*N*/ } else { +/*N*/ if (rGeo.pGPL!=NULL) { +/*?*/ delete rGeo.pGPL; +/*?*/ rGeo.pGPL=NULL; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void SdrObject::RestGeoData(const SdrObjGeoData& rGeo) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ SdrObjGeoData* SdrObject::GetGeoData() const +/*N*/ { +/*N*/ SdrObjGeoData* pGeo=NewGeoData(); +/*N*/ SaveGeoData(*pGeo); +/*N*/ return pGeo; +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ SfxItemSet* SdrObject::mpEmptyItemSet = 0L; +/*N*/ const SfxItemSet& SdrObject::GetItemSet() const +/*N*/ { +/*N*/ if(!mpEmptyItemSet) +/*N*/ mpEmptyItemSet = ((SdrObject*)this)->CreateNewItemSet((SfxItemPool&)(*GetItemPool())); +/*N*/ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)"); +/*N*/ DBG_ASSERT(FALSE,"SdrObject::GetItemSet() should never be called, SdrObject has no Items"); +/*N*/ return *mpEmptyItemSet; +/*N*/ } + +/*N*/ SfxItemSet* SdrObject::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // Basic implementation; Basic object has NO attributes +/*N*/ DBG_ASSERT(FALSE,"SdrObject::CreateNewItemSet() should never be called, SdrObject has no Items"); +/*N*/ return new SfxItemSet(rPool, SDRATTR_START, SDRATTR_END); +/*N*/ } + +/*N*/ void SdrObject::SetItem( const SfxPoolItem& rItem ) +/*N*/ { +/*N*/ sal_uInt16 nWhichID(rItem.Which()); +/*N*/ +/*N*/ if(AllowItemChange(nWhichID, &rItem)) +/*N*/ { +/*N*/ ItemChange(nWhichID, &rItem); +/*N*/ PostItemChange(nWhichID); +/*N*/ +/*N*/ SfxItemSet aSet( *GetItemPool(), nWhichID, nWhichID, 0 ); +/*N*/ aSet.Put( rItem ); +/*N*/ ItemSetChanged( aSet ); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::ClearItem( const sal_uInt16 nWhich ) +/*N*/ { +/*N*/ if(AllowItemChange(nWhich)) +/*N*/ { +/*N*/ ItemChange(nWhich); +/*N*/ PostItemChange(nWhich); +/*N*/ +/*N*/ SfxItemSet aSet( *GetItemPool(), nWhich, nWhich, 0 ); +/*N*/ ItemSetChanged( aSet ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void SdrObject::SetItemSet( const SfxItemSet& rSet ) +/*N*/ { +/*N*/ SfxWhichIter aWhichIter(rSet); +/*N*/ sal_uInt16 nWhich(aWhichIter.FirstWhich()); +/*N*/ const SfxPoolItem *pPoolItem; +/*N*/ std::vector< sal_uInt16 > aPostItemChangeList; +/*N*/ BOOL bDidChange(FALSE); +/*N*/ SfxItemSet aSet( *GetItemPool(), SDRATTR_START, EE_ITEMS_END, 0 ); +/*N*/ +/*N*/ while(nWhich) +/*N*/ { +/*N*/ if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE, &pPoolItem)) +/*N*/ { +/*N*/ if(AllowItemChange(nWhich, pPoolItem)) +/*N*/ { +/*N*/ bDidChange = TRUE; +/*N*/ ItemChange(nWhich, pPoolItem); +/*N*/ aPostItemChangeList.push_back( nWhich ); +/*N*/ aSet.Put( *pPoolItem ); +/*N*/ } +/*N*/ } +/*N*/ nWhich = aWhichIter.NextWhich(); +/*N*/ } +/*N*/ +/*N*/ if(bDidChange) +/*N*/ { +/*N*/ std::vector< sal_uInt16 >::iterator aIter = aPostItemChangeList.begin(); +/*N*/ const std::vector< sal_uInt16 >::iterator aEnd = aPostItemChangeList.end(); +/*N*/ while( aIter != aEnd ) +/*N*/ { +/*N*/ PostItemChange((*aIter)); +/*N*/ aIter++; +/*N*/ } +/*N*/ +/*N*/ ItemSetChanged( aSet ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ // ItemSet was changed, maybe user wants to react +/*N*/ +/*N*/ void SdrObject::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ void SdrObject::BroadcastItemChange(const SdrBroadcastItemChange& rChange) +/*N*/ { +/*N*/ sal_uInt32 nCount(rChange.GetRectangleCount()); +/*N*/ +/*N*/ sal_uInt32 a; for(a=0; a < nCount; a++) +/*N*/ SendRepaintBroadcast(rChange.GetRectangle(a)); +/*N*/ +/*N*/ if(ISA(SdrObjGroup)) +/*N*/ { +/*N*/ SdrObjListIter aIter(*((SdrObjGroup*)this), IM_DEEPNOGROUPS); +/*N*/ while(aIter.IsMore()) +/*N*/ { +/*N*/ SdrObject* pObj = aIter.Next(); +/*N*/ SendRepaintBroadcast(pObj->GetBoundRect()); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ SendRepaintBroadcast(GetBoundRect()); +/*N*/ +/*N*/ for(a = 0; a < nCount; a++) +/*N*/ SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a)); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// syntactical sugar for ItemSet accesses + + + +/*N*/ void SdrObject::SetItemSetAndBroadcast(const SfxItemSet& rSet) +/*N*/ { +/*N*/ SdrBroadcastItemChange aC(*this); +/*N*/ SetItemSet(rSet); +/*N*/ BroadcastItemChange(aC); +/*N*/ } + +/*N*/ const SfxPoolItem& SdrObject::GetItem(const sal_uInt16 nWhich) const +/*N*/ { +/*N*/ return GetItemSet().Get(nWhich); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access + +/*N*/ BOOL SdrObject::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) const +/*N*/ { +/*N*/ return TRUE; +/*N*/ } + +/*N*/ void SdrObject::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) +/*N*/ { +/*N*/ DBG_ASSERT(FALSE,"SdrObject::ItemChange() should never be called, SdrObject has no Items"); +/*N*/ } + +/*N*/ void SdrObject::PostItemChange(const sal_uInt16 nWhich) +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrObject::PreSave() +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::PostSave() +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrObject::ApplyNotPersistAttr(const SfxItemSet& rAttr) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + + +/*N*/ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ SfxStyleSheet* SdrObject::GetStyleSheet() const +/*N*/ { +/*N*/ // Das hier ist ein Hack: +/*N*/ return NULL; +/*N*/ } + +/*N*/ void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ } + +// Das Broadcasting beim Setzen der Attribute wird vom AttrObj gemanagt +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FASTBOOL SdrObject::IsNode() const +/*N*/ { +/*N*/ return TRUE; +/*N*/ } + +/*N*/ SdrGluePoint SdrObject::GetVertexGluePoint(USHORT nPosNum) const +/*N*/ { +/*N*/ Rectangle aR(GetBoundRect()); +/*N*/ Point aPt; +/*N*/ switch (nPosNum) { +/*N*/ case 0 : aPt=aR.TopCenter(); break; +/*N*/ case 1 : aPt=aR.RightCenter(); break; +/*N*/ case 2 : aPt=aR.BottomCenter(); break; +/*N*/ case 3 : aPt=aR.LeftCenter(); break; +/*N*/ } +/*N*/ aPt-=GetSnapRect().Center(); +/*N*/ SdrGluePoint aGP(aPt); +/*N*/ aGP.SetPercent(FALSE); +/*N*/ return aGP; +/*N*/ } + + + +/*N*/ SdrGluePointList* SdrObject::GetGluePointList() +/*N*/ { +/*N*/ if (pPlusData!=NULL) return pPlusData->pGluePoints; +/*N*/ return NULL; +/*N*/ } + +/*N*/ SdrGluePointList* SdrObject::ForceGluePointList() +/*N*/ { +/*N*/ ImpForcePlusData(); +/*N*/ if (pPlusData->pGluePoints==NULL) { +/*N*/ pPlusData->pGluePoints=new SdrGluePointList; +/*N*/ } +/*N*/ return pPlusData->pGluePoints; +/*N*/ } + +/*N*/ void SdrObject::SetGlueReallyAbsolute(FASTBOOL bOn) +/*N*/ { +/*N*/ // erst Const-Aufruf um zu sehen, ob +/*N*/ // ueberhaupt Klebepunkte da sind +/*N*/ // const-Aufruf erzwingen! +/*N*/ if (GetGluePointList()!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ // erst Const-Aufruf um zu sehen, ob +/*N*/ // ueberhaupt Klebepunkte da sind +/*N*/ // const-Aufruf erzwingen! +/*N*/ if (GetGluePointList()!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2) +/*N*/ { +/*N*/ // erst Const-Aufruf um zu sehen, ob +/*N*/ // ueberhaupt Klebepunkte da sind +/*N*/ // const-Aufruf erzwingen! +/*N*/ if (GetGluePointList()!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::NbcShearGluePoints(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ // erst Const-Aufruf um zu sehen, ob +/*N*/ // ueberhaupt Klebepunkte da sind +/*N*/ // const-Aufruf erzwingen! +/*N*/ if (GetGluePointList()!=NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + + + + +/*N*/ void SdrObject::ConnectToNode(FASTBOOL bTail1, SdrObject* pObj) +/*N*/ { +/*N*/ } + +/*N*/ void SdrObject::DisconnectFromNode(FASTBOOL bTail1) +/*N*/ { +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +// convert this path object to contour object, even when it is a group + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObject* SdrObject::ConvertToPolyObj(BOOL bBezier, BOOL bLineToArea) const +/*N*/ { +/*N*/ SdrObject* pRet = DoConvertToPolyObj(bBezier); +/*N*/ +/*N*/ if(pRet && bLineToArea) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ return pRet; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObject* SdrObject::DoConvertToPolyObj(BOOL bBezier) const +/*N*/ { +/*N*/ return NULL; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Streams + +/*N*/ void SdrObject::AfterRead() +/*N*/ { +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ GetUserData(i)->AfterRead(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrObject"); +/*N*/ #endif +/*N*/ rIn>>aOutRect; +/*N*/ rIn>>nLayerId; +/*N*/ rIn>>aAnchor; + + // #97849# when in a Draw/Impress binary import the anchor pos is set it's an error. + // So, when could figure out that a Draw/Impress is running, correct that position + // to (0,0). Anchor is not used but with 6.0 and XML no longer ignored in Draw/Impress + // so this correction needs to be made for objects with that error. These could + // be created when copying back anchor based draw objects from Calc or Writer to + // Draw/Impress, this did not reset the anchor position. +/*N*/ if((aAnchor.X() || aAnchor.Y()) && GetModel() && GetModel()->ISA(FmFormModel)) +/*N*/ { +/*N*/ // find out which application is running +/*N*/ SfxObjectShell* pObjectShell = ((FmFormModel*)GetModel())->GetObjectShell(); +/*N*/ if(pObjectShell) +/*N*/ { + SfxObjectFactory& rFac = pObjectShell->GetFactory(); + if ( rFac.GetShortName() && + ( strcmp(rFac.GetShortName(), "sdraw") == 0 || + strcmp(rFac.GetShortName(), "simpress") == 0 ) ) +/*N*/ { +/*N*/ // it's a draw/Impress, reset anchor pos hard +/*N*/ aAnchor = Point(0, 0); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ BOOL bTemp; +/*N*/ rIn>>bTemp; bMovProt=bTemp; +/*N*/ rIn>>bTemp; bSizProt=bTemp; +/*N*/ rIn>>bTemp; bNoPrint=bTemp; +/*N*/ rIn>>bTemp; bMarkProt=bTemp; // war ganz frueher mal bTextToContour +/*N*/ rIn>>bTemp; bEmptyPresObj=bTemp; +/*N*/ if (rHead.GetVersion()>=4) { +/*N*/ rIn>>bTemp; bNotVisibleAsMaster=bTemp; +/*N*/ } +/*N*/ if (rHead.GetVersion()>=11) { // ab V11 sind Connectors in DownCompat gefasst (mit Flag davor) +/*N*/ rIn>>bTemp; +/*N*/ if (bTemp) { +/*?*/ SdrDownCompat aGluePointsCompat(rIn,STREAM_READ); +/*?*/ #ifdef DBG_UTIL +/*?*/ aGluePointsCompat.SetID("SdrObject(Klebepunkte)"); +/*?*/ #endif +/*?*/ if (aGluePointsCompat.GetBytesLeft()!=0) { +/*?*/ ImpForcePlusData(); +/*?*/ if (pPlusData->pGluePoints==NULL) pPlusData->pGluePoints=new SdrGluePointList; +/*?*/ rIn>>*pPlusData->pGluePoints; +/*?*/ } +/*N*/ } +/*N*/ } else { +/*N*/ Polygon aTmpPoly; +/*N*/ rIn>>aTmpPoly; // aConnectors; ehemals Konnektoren +/*N*/ } +/*N*/ +/*N*/ if (pPlusData!=NULL && pPlusData->pUserDataList!=NULL) { +/*N*/ delete pPlusData->pUserDataList; +/*N*/ pPlusData->pUserDataList=NULL; +/*N*/ } +/*N*/ FASTBOOL bReadUserDataList=FALSE; +/*N*/ SdrDownCompat* pUserDataListCompat=NULL; +/*N*/ if (rHead.GetVersion()>=11) { // ab V11 ist die UserDataList in DownCompat gefasst (mit Flag davor) +/*N*/ rIn>>bTemp; +/*N*/ bReadUserDataList=bTemp; +/*N*/ if (bTemp) { +/*N*/ pUserDataListCompat=new SdrDownCompat(rIn,STREAM_READ); // Record fuer UserDataList oeffnen +/*N*/ #ifdef DBG_UTIL +/*N*/ pUserDataListCompat->SetID("SdrObject(UserDataList)"); +/*N*/ #endif +/*N*/ } +/*N*/ } else { +/*N*/ bReadUserDataList=TRUE; +/*N*/ } +/*N*/ if (bReadUserDataList) { +/*N*/ USHORT nUserDataAnz; +/*N*/ rIn>>nUserDataAnz; +/*N*/ if (nUserDataAnz!=0) { +/*N*/ ImpForcePlusData(); +/*N*/ pPlusData->pUserDataList=new SdrObjUserDataList; +/*N*/ for (USHORT i=0; i<nUserDataAnz; i++) { +/*N*/ SdrDownCompat* pUserDataCompat=NULL; +/*N*/ if (rHead.GetVersion()>=11) { // ab V11 sind UserData in DownCompat gefasst +/*N*/ //SdrDownCompat aUserDataCompat(rIn,STREAM_READ); // Record fuer UserData oeffnen (seit V11) +/*N*/ pUserDataCompat=new SdrDownCompat(rIn,STREAM_READ); // Record fuer UserData oeffnen (seit V11) +/*N*/ #ifdef DBG_UTIL +/*N*/ pUserDataCompat->SetID("SdrObject(UserData)"); +/*N*/ #endif +/*N*/ } +/*N*/ UINT32 nInvent; +/*N*/ UINT16 nIdent; +/*N*/ rIn>>nInvent; +/*N*/ rIn>>nIdent; +/*N*/ SdrObjUserData* pData=SdrObjFactory::MakeNewObjUserData(nInvent,nIdent,this); +/*N*/ if (pData!=NULL) +/*N*/ { +/*N*/ pData->ReadData(rIn); +/*N*/ pPlusData->pUserDataList->InsertUserData(pData); +/*N*/ } else { +/*N*/ // Wenn UserDataFactory nicht gesetzt ist, kann auch keiner +/*N*/ // etwas mit diesen Daten anfangen; durch Compat werden sie +/*N*/ // eh ueberlesen, daher ist diese Assertion überflüssig (KA) +/*N*/ // DBG_ERROR("SdrObject::ReadData(): ObjFactory kann UserData nicht erzeugen"); +/*N*/ } +/*N*/ if (pUserDataCompat!=NULL) { // Aha, UserData war eingepackt. Record nun schliessen +/*N*/ delete pUserDataCompat; +/*N*/ pUserDataCompat=NULL; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (pUserDataListCompat!=NULL) { // Aha, UserDataList war eingepackt. Record nun schliessen +/*N*/ delete pUserDataListCompat; +/*N*/ pUserDataListCompat=NULL; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrObject"); +/*N*/ #endif +/*N*/ rOut<<GetBoundRect(); +/*N*/ rOut<<nLayerId; +/*N*/ rOut<<aAnchor; +/*N*/ BOOL bTemp; +/*N*/ bTemp=bMovProt; rOut<<bTemp; +/*N*/ bTemp=bSizProt; rOut<<bTemp; +/*N*/ bTemp=bNoPrint; rOut<<bTemp; +/*N*/ bTemp=bMarkProt; rOut<<bTemp; +/*N*/ bTemp=bEmptyPresObj; rOut<<bTemp; +/*N*/ bTemp=bNotVisibleAsMaster; rOut<<bTemp; +/*N*/ +/*N*/ // Konnektoren +/*N*/ bTemp=pPlusData!=NULL && pPlusData->pGluePoints!=NULL && pPlusData->pGluePoints->GetCount()!=0; +/*N*/ rOut<<bTemp; // Flag fuer GluePointList vorhanden +/*N*/ if (bTemp) { +/*?*/ SdrDownCompat aConnectorsCompat(rOut,STREAM_WRITE); // ab V11 Konnektoren einpacken +/*N*/ #ifdef DBG_UTIL +/*?*/ aConnectorsCompat.SetID("SdrObject(Klebepunkte)"); +/*N*/ #endif +/*?*/ rOut<<*pPlusData->pGluePoints; +/*N*/ } + + // UserData +/*N*/ USHORT nUserDataAnz=GetUserDataCount(); +/*N*/ bTemp=nUserDataAnz!=0; +/*N*/ rOut<<bTemp; +/*N*/ if (bTemp) { +/*N*/ SdrDownCompat aUserDataListCompat(rOut,STREAM_WRITE); // Record fuer UserDataList oeffnen (seit V11) +/*N*/ #ifdef DBG_UTIL +/*N*/ aUserDataListCompat.SetID("SdrObject(UserDataList)"); +/*N*/ #endif +/*N*/ rOut<<nUserDataAnz; +/*N*/ for (USHORT i=0; i<nUserDataAnz; i++) { +/*N*/ SdrDownCompat aUserDataCompat(rOut,STREAM_WRITE); // Record fuer UserData oeffnen (seit V11) +/*N*/ #ifdef DBG_UTIL +/*N*/ aUserDataCompat.SetID("SdrObject(UserData)"); +/*N*/ #endif +/*N*/ pPlusData->pUserDataList->GetUserData(i)->WriteData(rOut); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrObject& rObj) +/*N*/ { +/*N*/ DBG_ASSERT(!rObj.IsNotPersistent(),"operator>>(SdrObject): Ein nicht persistentes Zeichenobjekts wird gestreamt"); +/*N*/ SdrObjIOHeader aHead(rIn,STREAM_READ,&rObj); +/*N*/ rObj.ReadData(aHead,rIn); +/*N*/ return rIn; +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrObject& rObj) +/*N*/ { +/*N*/ DBG_ASSERT(!rObj.IsNotPersistent(),"operator<<(SdrObject): Ein nicht persistentes Zeichenobjekts wird gestreamt"); +/*N*/ SdrObjIOHeader aHead(rOut,STREAM_WRITE,&rObj); +/*N*/ +/*N*/ if(rObj.ISA(SdrVirtObj)) +/*N*/ { +/*N*/ // #108784# +/*N*/ // force to write a naked SdrObj +/*N*/ aHead.nIdentifier = OBJ_NONE; +/*N*/ rObj.SdrObject::WriteData(rOut); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rObj.WriteData(rOut); +/*N*/ } +/*N*/ +/*N*/ return rOut; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrObject::SetInserted(FASTBOOL bIns) +/*N*/ { +/*N*/ if (bIns!=bInserted) { +/*N*/ bInserted=bIns; +/*N*/ Rectangle aBoundRect0(GetBoundRect()); +/*N*/ if (bIns) SendUserCall(SDRUSERCALL_INSERTED,aBoundRect0); +/*N*/ else SendUserCall(SDRUSERCALL_REMOVED,aBoundRect0); +/*N*/ +/*N*/ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) { // #42522# +/*N*/ SdrHint aHint(*this); +/*N*/ aHint.SetKind(bIns?HINT_OBJINSERTED:HINT_OBJREMOVED); +/*N*/ pPlusData->pBroadcast->Broadcast(aHint); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SetMoveProtect(FASTBOOL bProt) +/*N*/ { +/*N*/ bMovProt=bProt; +/*N*/ SetChanged(); +/*N*/ if (bInserted && pModel!=NULL) { +/*N*/ SdrHint aHint(*this); +/*N*/ aHint.SetNeedRepaint(FALSE); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SetResizeProtect(FASTBOOL bProt) +/*N*/ { +/*N*/ bSizProt=bProt; +/*N*/ SetChanged(); +/*N*/ if (bInserted && pModel!=NULL) { +/*N*/ SdrHint aHint(*this); +/*N*/ aHint.SetNeedRepaint(FALSE); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObject::SetPrintable(FASTBOOL bPrn) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ USHORT SdrObject::GetUserDataCount() const +/*N*/ { +/*N*/ if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return 0; +/*N*/ return pPlusData->pUserDataList->GetUserDataCount(); +/*N*/ } + +/*N*/ SdrObjUserData* SdrObject::GetUserData(USHORT nNum) const +/*N*/ { +/*N*/ if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return NULL; +/*N*/ return pPlusData->pUserDataList->GetUserData(nNum); +/*N*/ } +/*N*/ +/*N*/ void SdrObject::InsertUserData(SdrObjUserData* pData, USHORT nPos) +/*N*/ { +/*N*/ if (pData!=NULL) { +/*N*/ ImpForcePlusData(); +/*N*/ if (pPlusData->pUserDataList==NULL) pPlusData->pUserDataList=new SdrObjUserDataList; +/*N*/ pPlusData->pUserDataList->InsertUserData(pData,nPos); +/*N*/ } else { +/*N*/ DBG_ERROR("SdrObject::InsertUserData(): pData ist NULL-Pointer"); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) +/*N*/ { +/*N*/ SdrObjGroup* pGroup = NULL; +/*N*/ +/*N*/ if( pObjList && pObjList->GetListKind() == SDROBJLIST_GROUPOBJ ) +/*N*/ pGroup = (SdrObjGroup*) pObjList->GetOwnerObj(); +/*N*/ +/*N*/ if ( pUserCall ) +/*N*/ { +/*N*/ // UserCall ausfuehren +/*N*/ pUserCall->Changed( *this, eUserCall, rBoundRect ); +/*N*/ } +/*N*/ +/*N*/ while( pGroup ) +/*N*/ { +/*N*/ // Gruppe benachrichtigen +/*N*/ if( pGroup->GetUserCall() ) +/*N*/ { +/*N*/ SdrUserCallType eChildUserType = SDRUSERCALL_CHILD_CHGATTR; +/*N*/ +/*N*/ switch( eUserCall ) +/*N*/ { +/*N*/ case SDRUSERCALL_MOVEONLY: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_MOVEONLY; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_RESIZE: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_RESIZE; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_CHGATTR: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_CHGATTR; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_DELETE: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_DELETE; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_COPY: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_COPY; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_INSERTED: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_INSERTED; +/*N*/ break; +/*N*/ +/*N*/ case SDRUSERCALL_REMOVED: +/*N*/ eChildUserType = SDRUSERCALL_CHILD_REMOVED; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect ); +/*N*/ } +/*N*/ +/*N*/ if( pGroup->GetObjList() && +/*N*/ pGroup->GetObjList()->GetListKind() == SDROBJLIST_GROUPOBJ && +/*N*/ pGroup != (SdrObjGroup*) pObjList->GetOwnerObj() ) +/*N*/ pGroup = (SdrObjGroup*) pObjList->GetOwnerObj(); +/*N*/ else +/*N*/ pGroup = NULL; +/*N*/ } +/*N*/ } + +// ItemPool fuer dieses Objekt wechseln +/*N*/ void SdrObject::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) +/*N*/ { +/*N*/ // Hier passiert erst was in SdrAttrObj und in SdrObjGroup +/*N*/ } + + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SdrObject::getUnoShape() +/*N*/ { +/*N*/ // try weak reference first +/*N*/ uno::Reference< uno::XInterface > xShape( mxUnoShape ); +/*N*/ +/*N*/ if( !xShape.is() && pPage ) +/*N*/ { +/*N*/ uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() ); +/*N*/ if( xPage.is() ) +/*N*/ { +/*N*/ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage); +/*N*/ if( pDrawPage ) +/*N*/ { +/*N*/ // create one +/*N*/ xShape = pDrawPage->_CreateShape( this ); +/*N*/ mxUnoShape = xShape; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return xShape; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// transformation interface for StarOfficeAPI. This implements support for +// homogen 3x3 matrices containing the transformation of the SdrObject. At the +// moment it contains a shearX, rotation and translation, but for setting all linear +// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon +// with the base geometry and returns TRUE. Otherwise it returns FALSE. +/*N*/ BOOL SdrObject::TRGetBaseGeometry(Matrix3D& rMat, XPolyPolygon& rPolyPolygon) const +/*N*/ { +/*N*/ // any kind of SdrObject, just use SnapRect +/*N*/ Rectangle aRectangle(GetSnapRect()); +/*N*/ +/*N*/ // convert to transformation values +/*N*/ Vector2D aScale((double)aRectangle.GetWidth(), (double)aRectangle.GetHeight()); +/*N*/ Vector2D aTranslate((double)aRectangle.Left(), (double)aRectangle.Top()); +/*N*/ +/*N*/ // position maybe relative to anchorpos, convert +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*?*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*?*/ aTranslate -= Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } + + // force MapUnit to 100th mm +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*N*/ { +/*?*/ case SFX_MAPUNIT_TWIP : +/*?*/ { +/*?*/ // postion +/*?*/ // #104018# +/*?*/ aTranslate.X() = ImplTwipsToMM(aTranslate.X()); +/*?*/ aTranslate.Y() = ImplTwipsToMM(aTranslate.Y()); +/*?*/ +/*?*/ // size +/*?*/ // #104018# +/*?*/ aScale.X() = ImplTwipsToMM(aScale.X()); +/*?*/ aScale.Y() = ImplTwipsToMM(aScale.Y()); +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ default: +/*?*/ { +/*?*/ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!"); +/*?*/ } +/*N*/ } +/*N*/ } + + // build matrix +/*N*/ rMat.Identity(); +/*N*/ if(aScale.X() != 1.0 || aScale.Y() != 1.0) +/*N*/ rMat.Scale(aScale.X(), aScale.Y()); +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ rMat.Translate(aTranslate.X(), aTranslate.Y()); +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +// sets the base geometry of the object using infos contained in the homogen 3x3 matrix. +// If it's an SdrPathObj it will use the provided geometry information. The Polygon has +// to use (0,0) as upper left and will be scaled to the given size in the matrix. +/*N*/ void SdrObject::TRSetBaseGeometry(const Matrix3D& rMat, const XPolyPolygon& rPolyPolygon) +/*N*/ { +/*N*/ // break up matrix +/*N*/ Vector2D aScale, aTranslate; +/*N*/ double fShear, fRotate; +/*N*/ rMat.DecomposeAndCorrect(aScale, fShear, fRotate, aTranslate); +/*N*/ +/*N*/ // force metric to pool metric +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*?*/ { +/*?*/ case SFX_MAPUNIT_TWIP : +/*?*/ { +/*?*/ // position +/*?*/ // #104018# +/*?*/ aTranslate.X() = ImplMMToTwips(aTranslate.X()); +/*?*/ aTranslate.Y() = ImplMMToTwips(aTranslate.Y()); +/*?*/ +/*?*/ // size +/*?*/ // #104018# +/*?*/ aScale.X() = ImplMMToTwips(aScale.X()); +/*?*/ aScale.Y() = ImplMMToTwips(aScale.Y()); +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ default: +/*?*/ { +/*?*/ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); +/*?*/ } +/*?*/ } +/*N*/ } + + // if anchor is used, make position relative to it +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*?*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*?*/ aTranslate -= Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } +/*N*/ +/*N*/ // build BaseRect +/*N*/ Point aPoint(FRound(aTranslate.X()), FRound(aTranslate.Y())); +/*N*/ Rectangle aBaseRect(aPoint, Size(FRound(aScale.X()), FRound(aScale.Y()))); +/*N*/ +/*N*/ // set BaseRect +/*N*/ SetSnapRect(aBaseRect); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@ @@@@@@ @@@@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@@@ @@@@@@ @@ @@ @@ @@ @@@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@ @@@@@ @@@@ @@ @@ @@ @@@@ @@ @@@@ @@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObject* SdrObjFactory::MakeNewObject(UINT32 nInvent, UINT16 nIdent, SdrPage* pPage, SdrModel* pModel) +/*N*/ { +/*N*/ if(pModel == NULL && pPage != NULL) +/*N*/ pModel = pPage->GetModel(); +/*N*/ SdrObject* pObj = NULL; +/*N*/ +/*N*/ if(nInvent == SdrInventor) +/*N*/ { +/*N*/ switch (nIdent) +/*N*/ { +/*N*/ case USHORT(OBJ_NONE ): pObj=new SdrObject; break; +/*N*/ case USHORT(OBJ_GRUP ): pObj=new SdrObjGroup; break; +/*N*/ case USHORT(OBJ_LINE ): pObj=new SdrPathObj(OBJ_LINE ); break; +/*N*/ case USHORT(OBJ_POLY ): pObj=new SdrPathObj(OBJ_POLY ); break; +/*N*/ case USHORT(OBJ_PLIN ): pObj=new SdrPathObj(OBJ_PLIN ); break; +/*N*/ case USHORT(OBJ_PATHLINE ): pObj=new SdrPathObj(OBJ_PATHLINE ); break; +/*N*/ case USHORT(OBJ_PATHFILL ): pObj=new SdrPathObj(OBJ_PATHFILL ); break; +/*N*/ case USHORT(OBJ_FREELINE ): pObj=new SdrPathObj(OBJ_FREELINE ); break; +/*N*/ case USHORT(OBJ_FREEFILL ): pObj=new SdrPathObj(OBJ_FREEFILL ); break; +/*?*/ case USHORT(OBJ_PATHPOLY ): pObj=new SdrPathObj(OBJ_POLY ); break; +/*?*/ case USHORT(OBJ_PATHPLIN ): pObj=new SdrPathObj(OBJ_PLIN ); break; +/*N*/ case USHORT(OBJ_EDGE ): pObj=new SdrEdgeObj; break; +/*N*/ case USHORT(OBJ_RECT ): pObj=new SdrRectObj; break; +/*N*/ case USHORT(OBJ_CIRC ): pObj=new SdrCircObj(OBJ_CIRC ); break; +/*N*/ case USHORT(OBJ_SECT ): pObj=new SdrCircObj(OBJ_SECT ); break; +/*N*/ case USHORT(OBJ_CARC ): pObj=new SdrCircObj(OBJ_CARC ); break; +/*N*/ case USHORT(OBJ_CCUT ): pObj=new SdrCircObj(OBJ_CCUT ); break; +/*N*/ case USHORT(OBJ_TEXT ): pObj=new SdrRectObj(OBJ_TEXT ); break; +/*?*/ case USHORT(OBJ_TEXTEXT ): pObj=new SdrRectObj(OBJ_TEXTEXT ); break; +/*N*/ case USHORT(OBJ_TITLETEXT ): pObj=new SdrRectObj(OBJ_TITLETEXT ); break; +/*N*/ case USHORT(OBJ_OUTLINETEXT): pObj=new SdrRectObj(OBJ_OUTLINETEXT); break; +/*N*/ case USHORT(OBJ_MEASURE ): pObj=new SdrMeasureObj; break; +/*N*/ case USHORT(OBJ_GRAF ): pObj=new SdrGrafObj; break; +/*N*/ case USHORT(OBJ_OLE2 ): pObj=new SdrOle2Obj; break; +/*?*/ case USHORT(OBJ_FRAME ): pObj=new SdrOle2Obj(TRUE); break; +/*N*/ case USHORT(OBJ_CAPTION ): pObj=new SdrCaptionObj; break; +/*N*/ case USHORT(OBJ_PAGE ): pObj=new SdrPageObj; break; +/*?*/ case USHORT(OBJ_UNO ): pObj=new SdrUnoObj(String()); break; +/*N*/ } +/*N*/ } + +/*N*/ if(pObj == NULL) +/*N*/ { +/*N*/ SdrObjFactory* pFact=new SdrObjFactory(nInvent,nIdent,pPage,pModel); +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjHdl(); +/*N*/ unsigned nAnz=rLL.GetLinkCount(); +/*N*/ unsigned i=0; +/*N*/ while (i<nAnz && pObj==NULL) { +/*N*/ rLL.GetLink(i).Call((void*)pFact); +/*N*/ pObj=pFact->pNewObj; +/*N*/ i++; +/*N*/ } +/*N*/ delete pFact; +/*N*/ } +/*N*/ +/*N*/ if(pObj == NULL) +/*N*/ { +/*N*/ // Na wenn's denn keiner will ... +/*N*/ } +/*N*/ +/*N*/ if(pObj != NULL) +/*N*/ { +/*N*/ if(pPage != NULL) +/*N*/ pObj->SetPage(pPage); +/*N*/ else if(pModel != NULL) +/*?*/ pObj->SetModel(pModel); +/*N*/ } +/*N*/ +/*N*/ return pObj; +/*N*/ } + +/*N*/ SdrObjUserData* SdrObjFactory::MakeNewObjUserData(UINT32 nInvent, UINT16 nIdent, SdrObject* pObj1) +/*N*/ { +/*N*/ SdrObjUserData* pData=NULL; +/*N*/ if (nInvent==SdrInventor) { +/*N*/ switch (nIdent) { +/*?*/ case USHORT(SDRUSERDATA_OBJGROUPLINK): pData=new ImpSdrObjGroupLinkUserData(pObj1); break; +/*?*/ case USHORT(SDRUSERDATA_OBJTEXTLINK) : pData=new ImpSdrObjTextLinkUserData((SdrTextObj*)pObj1); break; +/*N*/ } +/*N*/ } +/*N*/ if (pData==NULL) { +/*N*/ SdrObjFactory aFact(nInvent,nIdent,pObj1); +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl(); +/*N*/ unsigned nAnz=rLL.GetLinkCount(); +/*N*/ unsigned i=0; +/*N*/ while (i<nAnz && pData==NULL) { +/*N*/ rLL.GetLink(i).Call((void*)&aFact); +/*N*/ pData=aFact.pNewData; +/*N*/ i++; +/*N*/ } +/*N*/ } +/*N*/ return pData; +/*N*/ } + +/*N*/ void SdrObjFactory::InsertMakeObjectHdl(const Link& rLink) +/*N*/ { +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjHdl(); +/*N*/ rLL.InsertLink(rLink); +/*N*/ } + +/*N*/ void SdrObjFactory::RemoveMakeObjectHdl(const Link& rLink) +/*N*/ { +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjHdl(); +/*N*/ rLL.RemoveLink(rLink); +/*N*/ } + +/*N*/ void SdrObjFactory::InsertMakeUserDataHdl(const Link& rLink) +/*N*/ { +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl(); +/*N*/ rLL.InsertLink(rLink); +/*N*/ } + +/*N*/ void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink) +/*N*/ { +/*N*/ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl(); +/*N*/ rLL.RemoveLink(rLink); +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdocapt.cxx b/binfilter/bf_svx/source/svdraw/svx_svdocapt.cxx new file mode 100644 index 000000000000..e95f62029831 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdocapt.cxx @@ -0,0 +1,543 @@ +/* -*- 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/bigint.hxx> + + +#include <bf_svtools/style.hxx> + +#include "svdocapt.hxx" +#include "svdattrx.hxx" +#include "svdpool.hxx" +#include "svdio.hxx" +#include "svdstr.hrc" // Objektname + + + + +#include "eeitem.hxx" +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ enum EscDir {LKS,RTS,OBN,UNT}; + +/*N*/ class ImpCaptParams +/*N*/ { +/*N*/ public: +/*N*/ SdrCaptionType eType; +/*N*/ long nAngle; +/*N*/ long nGap; +/*N*/ long nEscRel; +/*N*/ long nEscAbs; +/*N*/ long nLineLen; +/*N*/ SdrCaptionEscDir eEscDir; +/*N*/ FASTBOOL bFitLineLen; +/*N*/ FASTBOOL bEscRel; +/*N*/ FASTBOOL bFixedAngle; +/*N*/ +/*N*/ public: +/*N*/ ImpCaptParams() +/*N*/ { +/*N*/ eType =SDRCAPT_TYPE3; +/*N*/ bFixedAngle=FALSE; +/*N*/ nAngle =4500; +/*N*/ nGap =0; +/*N*/ eEscDir =SDRCAPT_ESCHORIZONTAL; +/*N*/ bEscRel =TRUE; +/*N*/ nEscRel =5000; +/*N*/ nEscAbs =0; +/*N*/ nLineLen =0; +/*N*/ bFitLineLen=TRUE; +/*N*/ } +/*N*/ void CalcEscPos(const Point& rTail, const Rectangle& rRect, Point& rPt, EscDir& rDir) const; +/*N*/ }; + +/*N*/ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Point& rPt, EscDir& rDir) const +/*N*/ { +/*N*/ Point aTl(rTailPt); // lokal kopieren wg. Performance +/*N*/ long nX,nY; +/*N*/ if (bEscRel) { +/*N*/ nX=rRect.Right()-rRect.Left(); +/*N*/ nX=BigMulDiv(nX,nEscRel,10000); +/*N*/ nY=rRect.Bottom()-rRect.Top(); +/*N*/ nY=BigMulDiv(nY,nEscRel,10000); +/*N*/ } else { +/*N*/ nX=nEscAbs; +/*N*/ nY=nEscAbs; +/*N*/ } +/*N*/ nX+=rRect.Left(); +/*N*/ nY+=rRect.Top(); +/*N*/ Point aBestPt; +/*N*/ EscDir eBestDir=LKS; +/*N*/ FASTBOOL bTryH=eEscDir==SDRCAPT_ESCBESTFIT; +/*N*/ if (!bTryH) { +/*N*/ if (eType!=SDRCAPT_TYPE1) { +/*N*/ bTryH=eEscDir==SDRCAPT_ESCHORIZONTAL; +/*N*/ } else { +/*N*/ bTryH=eEscDir==SDRCAPT_ESCVERTICAL; +/*N*/ } +/*N*/ } +/*N*/ FASTBOOL bTryV=eEscDir==SDRCAPT_ESCBESTFIT; +/*N*/ if (!bTryV) { +/*N*/ if (eType!=SDRCAPT_TYPE1) { +/*N*/ bTryV=eEscDir==SDRCAPT_ESCVERTICAL; +/*N*/ } else { +/*N*/ bTryV=eEscDir==SDRCAPT_ESCHORIZONTAL; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (bTryH) { +/*N*/ Point aLft(rRect.Left()-nGap,nY); +/*N*/ Point aRgt(rRect.Right()+nGap,nY); +/*N*/ FASTBOOL bLft=(aTl.X()-aLft.X()<aRgt.X()-aTl.X()); +/*N*/ if (bLft) { +/*N*/ eBestDir=LKS; +/*N*/ aBestPt=aLft; +/*N*/ } else { +/*N*/ eBestDir=RTS; +/*N*/ aBestPt=aRgt; +/*N*/ } +/*N*/ } +/*N*/ if (bTryV) { +/*?*/ Point aTop(nX,rRect.Top()-nGap); +/*?*/ Point aBtm(nX,rRect.Bottom()+nGap); +/*?*/ FASTBOOL bTop=(aTl.Y()-aTop.Y()<aBtm.Y()-aTl.Y()); +/*?*/ Point aBest2; +/*?*/ EscDir eBest2; +/*?*/ if (bTop) { +/*?*/ eBest2=OBN; +/*?*/ aBest2=aTop; +/*?*/ } else { +/*?*/ eBest2=UNT; +/*?*/ aBest2=aBtm; +/*?*/ } +/*?*/ FASTBOOL bTakeIt=eEscDir!=SDRCAPT_ESCBESTFIT; +/*?*/ if (!bTakeIt) { +/*?*/ BigInt aHorX(aBestPt.X()-aTl.X()); aHorX*=aHorX; +/*?*/ BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY; +/*?*/ BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX; +/*?*/ BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY; +/*?*/ if (eType!=SDRCAPT_TYPE1) { +/*?*/ bTakeIt=aVerX+aVerY<aHorX+aHorY; +/*?*/ } else { +/*?*/ bTakeIt=aVerX+aVerY>=aHorX+aHorY; +/*?*/ } +/*?*/ } +/*?*/ if (bTakeIt) { +/*?*/ aBestPt=aBest2; +/*?*/ eBestDir=eBest2; +/*?*/ } +/*N*/ } +/*N*/ rPt=aBestPt; +/*N*/ rDir=eBestDir; +/*N*/ } + +/*N*/ TYPEINIT1(SdrCaptionObj,SdrRectObj); + +/*N*/ SdrCaptionObj::SdrCaptionObj(): +/*N*/ SdrRectObj(OBJ_TEXT), +/*N*/ aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien +/*N*/ mbSpecialTextBoxShadow(FALSE) +/*N*/ { +/*N*/ } + +/*N*/ SdrCaptionObj::~SdrCaptionObj() +/*N*/ { +/*N*/ } + + + +/*N*/ UINT16 SdrCaptionObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(OBJ_CAPTION); +/*N*/ } + +/*N*/ void SdrCaptionObj::RecalcBoundRect() +/*N*/ { +/*N*/ aOutRect=GetSnapRect(); +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ nLineWdt++; nLineWdt/=2; +/*N*/ long nLEndWdt=ImpGetLineEndAdd(); +/*N*/ if (nLEndWdt>nLineWdt) nLineWdt=nLEndWdt; +/*N*/ if (nLineWdt!=0) { +/*N*/ aOutRect.Left ()-=nLineWdt; +/*N*/ aOutRect.Top ()-=nLineWdt; +/*N*/ aOutRect.Right ()+=nLineWdt; +/*N*/ aOutRect.Bottom()+=nLineWdt; +/*N*/ } +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + + + + + + + + + + + + + + + + +/*N*/ void SdrCaptionObj::ImpGetCaptParams(ImpCaptParams& rPara) const +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ rPara.eType =((SdrCaptionTypeItem&) (rSet.Get(SDRATTR_CAPTIONTYPE ))).GetValue(); +/*N*/ rPara.bFixedAngle=((SdrCaptionFixedAngleItem&)(rSet.Get(SDRATTR_CAPTIONANGLE ))).GetValue(); +/*N*/ rPara.nAngle =((SdrCaptionAngleItem&) (rSet.Get(SDRATTR_CAPTIONFIXEDANGLE))).GetValue(); +/*N*/ rPara.nGap =((SdrCaptionGapItem&) (rSet.Get(SDRATTR_CAPTIONGAP ))).GetValue(); +/*N*/ rPara.eEscDir =((SdrCaptionEscDirItem&) (rSet.Get(SDRATTR_CAPTIONESCDIR ))).GetValue(); +/*N*/ rPara.bEscRel =((SdrCaptionEscIsRelItem&) (rSet.Get(SDRATTR_CAPTIONESCISREL ))).GetValue(); +/*N*/ rPara.nEscRel =((SdrCaptionEscRelItem&) (rSet.Get(SDRATTR_CAPTIONESCREL ))).GetValue(); +/*N*/ rPara.nEscAbs =((SdrCaptionEscAbsItem&) (rSet.Get(SDRATTR_CAPTIONESCABS ))).GetValue(); +/*N*/ rPara.nLineLen =((SdrCaptionLineLenItem&) (rSet.Get(SDRATTR_CAPTIONLINELEN ))).GetValue(); +/*N*/ rPara.bFitLineLen=((SdrCaptionFitLineLenItem&)(rSet.Get(SDRATTR_CAPTIONFITLINELEN))).GetValue(); +/*N*/ } + +/*N*/ void SdrCaptionObj::ImpRecalcTail() +/*N*/ { +/*N*/ ImpCaptParams aPara; +/*N*/ ImpGetCaptParams(aPara); +/*N*/ ImpCalcTail(aPara,aTailPoly,aRect); +/*N*/ SetRectsDirty(); +/*N*/ SetXPolyDirty(); +/*N*/ } + + + +/*N*/ void SdrCaptionObj::ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const +/*N*/ { // Gap/EscDir/EscPos/Angle/LineLen +/*N*/ Polygon aPol(3); +/*N*/ Point aTl(rPoly[0]); +/*N*/ aPol[0]=aTl; +/*N*/ +/*N*/ EscDir eEscDir; +/*N*/ Point aEscPos; +/*N*/ rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir); +/*N*/ aPol[1]=aEscPos; +/*N*/ aPol[2]=aEscPos; +/*N*/ +/*N*/ if (eEscDir==LKS || eEscDir==RTS) { +/*N*/ if (rPara.bFitLineLen) { +/*N*/ aPol[1].X()=(aTl.X()+aEscPos.X())/2; +/*N*/ } else { +/*N*/ if (eEscDir==LKS) aPol[1].X()-=rPara.nLineLen; +/*N*/ else aPol[1].X()+=rPara.nLineLen; +/*N*/ } +/*N*/ } else { +/*N*/ if (rPara.bFitLineLen) { +/*N*/ aPol[1].Y()=(aTl.Y()+aEscPos.Y())/2; +/*N*/ } else { +/*N*/ if (eEscDir==OBN) aPol[1].Y()-=rPara.nLineLen; +/*N*/ else aPol[1].Y()+=rPara.nLineLen; +/*N*/ } +/*N*/ } +/*N*/ if (!rPara.bFixedAngle) { +/*N*/ // fehlende Implementation +/*N*/ } +/*N*/ rPoly=aPol; +/*N*/ } + + +/*N*/ void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const +/*N*/ { +/*N*/ switch (rPara.eType) { +/*?*/ case SDRCAPT_TYPE1: DBG_BF_ASSERT(0, "STRIP"); break;//STRIP001 ImpCalcTail1(rPara,rPoly,rRect); break; +/*?*/ case SDRCAPT_TYPE2: DBG_BF_ASSERT(0, "STRIP"); break;//STRIP001 ImpCalcTail2(rPara,rPoly,rRect); break; +/*N*/ case SDRCAPT_TYPE3: ImpCalcTail3(rPara,rPoly,rRect); break; +/*?*/ case SDRCAPT_TYPE4: DBG_BF_ASSERT(0, "STRIP"); break;//STRIP001 ImpCalcTail4(rPara,rPoly,rRect); break; +/*N*/ } +/*N*/ } + + + + + + + + +/*N*/ void SdrCaptionObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ SdrRectObj::NbcMove(rSiz); +/*N*/ MovePoly(aTailPoly,rSiz); +/*N*/ } + +/*N*/ void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrRectObj::NbcResize(rRef,xFact,yFact); +/*N*/ ResizePoly(aTailPoly,rRef,xFact,yFact); +/*N*/ ImpRecalcTail(); +/*N*/ } + + + +/*N*/ void SdrCaptionObj::NbcSetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ SdrRectObj::NbcSetAnchorPos(rPnt); +/*N*/ // !!!!! fehlende Impl. +/*N*/ } + +/*N*/ const Point& SdrCaptionObj::GetAnchorPos() const +/*N*/ { +/*N*/ // !!!!! fehlende Impl. +/*N*/ return SdrRectObj::GetAnchorPos(); +/*N*/ } + +/*N*/ void SdrCaptionObj::RecalcSnapRect() +/*N*/ { +/*N*/ SdrRectObj::RecalcSnapRect(); +/*N*/ maSnapRect.Union(aTailPoly.GetBoundRect()); +/*N*/ // !!!!! fehlende Impl. +/*N*/ } + +/*N*/ const Rectangle& SdrCaptionObj::GetSnapRect() const +/*N*/ { +/*N*/ return SdrRectObj::GetSnapRect(); +/*N*/ } + +/*N*/ void SdrCaptionObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ // #109587# +/*N*/ // +/*N*/ // The new SnapRect contains the tail BoundRect, see +/*N*/ // RecalcSnapRect() above. Thus, the new to-be-setted +/*N*/ // SnapRect needs to be 'cleared' from that tail offsets +/*N*/ // before setting it as new SnapRect at the SdrRectObj. +/*N*/ // +/*N*/ // As base for 'clearing' the old text rect is taken from aRect +/*N*/ // using GetLogicRect(), see below. Second the outer tail point +/*N*/ // wich expanded that rect. Since the other end of the +/*N*/ // connection polygon always resides at one edge of the text rect +/*N*/ // this is sufficient information. +/*N*/ Rectangle aNewSnapRect(rRect); +/*N*/ const Rectangle aOriginalTextRect(GetLogicRect()); +/*N*/ const Point aTailPoint = GetTailPos(); +/*N*/ +/*N*/ // #109992# +/*N*/ // This compares only make sense when aOriginalTextRect and the +/*N*/ // aTailPoint contain useful data. Thus, test it before usage. +/*N*/ if(!aOriginalTextRect.IsEmpty()) +/*N*/ { +/*N*/ if(aTailPoint.X() < aOriginalTextRect.Left()) +/*N*/ { +/*N*/ const sal_Int32 nDist = aOriginalTextRect.Left() - aTailPoint.X(); +/*N*/ aNewSnapRect.Left() = aNewSnapRect.Left() + nDist; +/*N*/ } +/*N*/ else if(aTailPoint.X() > aOriginalTextRect.Right()) +/*N*/ { +/*N*/ const sal_Int32 nDist = aTailPoint.X() - aOriginalTextRect.Right(); +/*N*/ aNewSnapRect.Right() = aNewSnapRect.Right() - nDist; +/*N*/ } +/*N*/ +/*N*/ if(aTailPoint.Y() < aOriginalTextRect.Top()) +/*N*/ { +/*N*/ const sal_Int32 nDist = aOriginalTextRect.Top() - aTailPoint.Y(); +/*N*/ aNewSnapRect.Top() = aNewSnapRect.Top() + nDist; +/*N*/ } +/*N*/ else if(aTailPoint.Y() > aOriginalTextRect.Bottom()) +/*N*/ { +/*N*/ const sal_Int32 nDist = aTailPoint.Y() - aOriginalTextRect.Bottom(); +/*N*/ aNewSnapRect.Bottom() = aNewSnapRect.Bottom() - nDist; +/*N*/ } +/*N*/ +/*N*/ // make sure rectangle is correctly defined +/*N*/ ImpJustifyRect(aNewSnapRect); +/*N*/ +/*N*/ // #86616# +/*N*/ SdrRectObj::NbcSetSnapRect(aNewSnapRect); +/*N*/ } +/*N*/ } + + + +/*N*/ const Point& SdrCaptionObj::GetTailPos() const +/*N*/ { +/*N*/ return aTailPoly[0]; +/*N*/ } + +/*N*/ void SdrCaptionObj::SetTailPos(const Point& rPos) +/*N*/ { +/*N*/ if (aTailPoly.GetSize()==0 || aTailPoly[0]!=rPos) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetTailPos(rPos); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + +/*N*/ void SdrCaptionObj::NbcSetTailPos(const Point& rPos) +/*N*/ { +/*N*/ aTailPoly[0]=rPos; +/*N*/ ImpRecalcTail(); +/*N*/ } + + + +/*N*/ void SdrCaptionObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrRectObj::SetModel(pNewModel); +/*N*/ ImpRecalcTail(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ SfxItemSet* SdrCaptionObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // caption attributes +/*N*/ SDRATTR_CAPTION_FIRST, SDRATTRSET_CAPTION, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access +/*N*/ void SdrCaptionObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // local changes +/*N*/ ImpRecalcTail(); +/*N*/ +/*N*/ // call parent +/*N*/ SdrRectObj::ItemSetChanged(rSet); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrCaptionObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ ImpRecalcTail(); +/*N*/ } + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*?*/ void SdrCaptionObj::PreSave() +/*?*/ { +/*?*/ // call parent +/*?*/ SdrRectObj::PreSave(); +/*?*/ +/*?*/ // prepare SetItems for storage +/*?*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*?*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*?*/ SdrCaptionSetItem aCaptAttr(rSet.GetPool()); +/*?*/ aCaptAttr.GetItemSet().Put(rSet); +/*?*/ aCaptAttr.GetItemSet().SetParent(pParent); +/*?*/ mpObjectItemSet->Put(aCaptAttr); +/*?*/ } + +/*?*/ void SdrCaptionObj::PostSave() +/*?*/ { +/*?*/ // call parent +/*?*/ SdrRectObj::PostSave(); +/*?*/ +/*?*/ // remove SetItems from local itemset +/*?*/ mpObjectItemSet->ClearItem(SDRATTRSET_CAPTION); +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*?*/ void SdrCaptionObj::WriteData(SvStream& rOut) const +/*?*/ { +/*?*/ SdrRectObj::WriteData(rOut); +/*?*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrCaptionObj"); +/*?*/ #endif +/*?*/ +/*?*/ rOut << aTailPoly; +/*?*/ SfxItemPool* pPool = GetItemPool(); +/*?*/ +/*?*/ if(pPool) +/*?*/ { +/*?*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*?*/ +/*?*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_CAPTION)); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ rOut << UINT16(SFX_ITEMS_NULL); +/*?*/ } +/*?*/ } + +/*N*/ void SdrCaptionObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*N*/ return; +/*N*/ +/*N*/ SdrRectObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrCaptionObj"); +/*N*/ #endif +/*N*/ +/*N*/ rIn >> aTailPoly; +/*N*/ +/*N*/ if(rHead.GetVersion() < 11) { sal_uInt16 nWhichDum; rIn >> nWhichDum; } // ab V11 keine WhichId mehr +/*N*/ +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ sal_uInt16 nSetID = SDRATTRSET_CAPTION; +/*N*/ const SdrCaptionSetItem* pCaptAttr = (const SdrCaptionSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pCaptAttr) +/*N*/ SetItemSet(pCaptAttr->GetItemSet()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ sal_uInt16 nSuroDum; +/*N*/ rIn >> nSuroDum; +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdocirc.cxx b/binfilter/bf_svx/source/svdraw/svx_svdocirc.cxx new file mode 100644 index 000000000000..d8382ec524c1 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdocirc.cxx @@ -0,0 +1,907 @@ +/* -*- 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_svtools/style.hxx> + + +#include <xlnwtit.hxx> + +#include <xlnedwit.hxx> + +#include <xlnstwit.hxx> + +#include <xlnstit.hxx> + +#include <xlnedit.hxx> + +#include "svdocirc.hxx" +#include <math.h> +#include "svdpool.hxx" +#include "svdattrx.hxx" +#include "svdio.hxx" +#include "svdstr.hrc" // Objektname + +#include "eeitem.hxx" + +#include "rectenum.hxx" + +#include "svdoimp.hxx" + +#include "xoutx.hxx" + +namespace binfilter { + +/*N*/ void SetWinkPnt(const Rectangle& rR, long nWink, Point& rPnt) +/*N*/ { +/*N*/ Point aCenter(rR.Center()); +/*N*/ long nWdt=rR.Right()-rR.Left(); +/*N*/ long nHgt=rR.Bottom()-rR.Top(); +/*N*/ long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2; +/*N*/ double a; +/*N*/ a=nWink*nPi180; +/*N*/ rPnt=Point(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad)); +/*N*/ if (nWdt==0) rPnt.X()=0; +/*N*/ if (nHgt==0) rPnt.Y()=0; +/*N*/ if (nWdt!=nHgt) { +/*N*/ if (nWdt>nHgt) { +/*N*/ if (nWdt!=0) { +/*N*/ // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen (Bug 23384) +/*N*/ if (Abs(nHgt)>32767 || Abs(rPnt.Y())>32767) { +/*N*/ rPnt.Y()=BigMulDiv(rPnt.Y(),nHgt,nWdt); +/*N*/ } else { +/*N*/ rPnt.Y()=rPnt.Y()*nHgt/nWdt; +/*N*/ } +/*N*/ } +/*N*/ } else { +/*N*/ if (nHgt!=0) { +/*N*/ // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen (Bug 23384) +/*N*/ if (Abs(nWdt)>32767 || Abs(rPnt.X())>32767) { +/*N*/ rPnt.X()=BigMulDiv(rPnt.X(),nWdt,nHgt); +/*N*/ } else { +/*N*/ rPnt.X()=rPnt.X()*nWdt/nHgt; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ rPnt+=aCenter; +/*N*/ } + +/*N*/ TYPEINIT1(SdrCircObj,SdrRectObj); + +/*N*/ SdrCircObj::SdrCircObj(SdrObjKind eNewKind) +/*N*/ { +/*N*/ nStartWink=0; +/*N*/ nEndWink=36000; +/*N*/ eKind=eNewKind; +/*N*/ bClosedObj=eNewKind!=OBJ_CARC; +/*N*/ } + +/*N*/ SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect): +/*N*/ SdrRectObj(rRect) +/*N*/ { +/*N*/ nStartWink=0; +/*N*/ nEndWink=36000; +/*N*/ eKind=eNewKind; +/*N*/ bClosedObj=eNewKind!=OBJ_CARC; +/*N*/ } + +/*N*/ SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink): +/*N*/ SdrRectObj(rRect) +/*N*/ { +/*N*/ long nWinkDif=nNewEndWink-nNewStartWink; +/*N*/ nStartWink=NormAngle360(nNewStartWink); +/*N*/ nEndWink=NormAngle360(nNewEndWink); +/*N*/ if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis +/*N*/ eKind=eNewKind; +/*N*/ bClosedObj=eNewKind!=OBJ_CARC; +/*N*/ } +/*N*/ +/*N*/ SdrCircObj::~SdrCircObj() +/*N*/ { +/*N*/ } + + +/*N*/ UINT16 SdrCircObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(eKind); +/*N*/ } + +/*N*/ FASTBOOL SdrCircObj::PaintNeedsXPoly() const +/*N*/ { +/*N*/ // XPoly ist notwendig fuer alle gedrehten Ellipsenobjekte, +/*N*/ // fuer alle Kreis- und Ellipsenabschnitte +/*N*/ // und wenn nicht WIN dann (erstmal) auch fuer Kreis-/Ellipsenausschnitte +/*N*/ // und Kreis-/Ellipsenboegen (wg. Genauigkeit) +/*N*/ FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || eKind==OBJ_CCUT; +/*N*/ #ifndef WIN +/*N*/ // Wenn nicht Win, dann fuer alle ausser Vollkreis (erstmal!!!) +/*N*/ if (eKind!=OBJ_CIRC) bNeed=TRUE; +/*N*/ #endif +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ if(!bNeed) +/*N*/ { +/*N*/ // XPoly ist notwendig fuer alles was nicht LineSolid oder LineNone ist +/*N*/ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue(); +/*N*/ bNeed = eLine != XLINE_NONE && eLine != XLINE_SOLID; +/*N*/ +/*N*/ // XPoly ist notwendig fuer dicke Linien +/*N*/ if(!bNeed && eLine != XLINE_NONE) +/*N*/ bNeed = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue() != 0; +/*N*/ +/*N*/ // XPoly ist notwendig fuer Kreisboegen mit Linienenden +/*N*/ if(!bNeed && eKind == OBJ_CARC) +/*N*/ { +/*N*/ // Linienanfang ist da, wenn StartPolygon und StartWidth!=0 +/*?*/ bNeed=((XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue().GetPointCount() != 0 && +/*?*/ ((XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue() != 0; +/*?*/ +/*?*/ if(!bNeed) +/*?*/ { +/*?*/ // Linienende ist da, wenn EndPolygon und EndWidth!=0 +/*?*/ bNeed = ((XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue().GetPointCount() != 0 && +/*?*/ ((XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue() != 0; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // XPoly ist notwendig, wenn Fill !=None und !=Solid +/*N*/ if(!bNeed && eKind != OBJ_CARC) +/*N*/ { +/*N*/ XFillStyle eFill=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue(); +/*N*/ bNeed = eFill != XFILL_NONE && eFill != XFILL_SOLID; +/*N*/ } +/*N*/ +/*N*/ if(!bNeed && eKind != OBJ_CIRC && nStartWink == nEndWink) +/*N*/ bNeed=TRUE; // Weil sonst Vollkreis gemalt wird +/*N*/ +/*N*/ return bNeed; +/*N*/ } + +/*N*/ XPolygon SdrCircObj::ImpCalcXPoly(const Rectangle& rRect1, long nStart, long nEnd, FASTBOOL bContour) const +/*N*/ { +/*N*/ bContour=TRUE; // am 14.1.97 wg. Umstellung TakeContour ueber Mtf und Paint. Joe. +/*N*/ long rx=rRect1.GetWidth()/2; // Da GetWidth()/GetHeight() jeweils 1 +/*N*/ long ry=rRect1.GetHeight()/2; // draufaddieren wird korrekt gerundet. +/*N*/ long a=0,e=3600; +/*N*/ if (eKind!=OBJ_CIRC) { +/*N*/ a=nStart/10; +/*N*/ e=nEnd/10; +/*N*/ if (bContour) { +/*N*/ // Drehrichtung umkehren, damit Richtungssinn genauso wie Rechteck +/*N*/ rx=-rx; +/*N*/ a=1800-a; if (a<0) a+=3600; +/*N*/ e=1800-e; if (e<0) e+=3600; +/*N*/ long nTmp=a; +/*N*/ a=e; +/*N*/ e=nTmp; +/*N*/ } +/*N*/ } else { +/*N*/ if (bContour) { +/*N*/ long nTmp=rx; +/*N*/ rx=ry; +/*N*/ ry=nTmp; +/*N*/ // und auch noch die Drehrichtung aendern +/*N*/ ry=-ry; +/*N*/ } +/*N*/ } +/*N*/ ((SdrCircObj*)this)->bXPolyIsLine=eKind==OBJ_CARC; +/*N*/ FASTBOOL bClose=eKind==OBJ_CIRC /*|| eKind==OBJ_SECT*/; +/*N*/ XPolygon aXPoly(rRect1.Center(),rx,ry,USHORT(a),USHORT(e),bClose); +/*N*/ if (eKind!=OBJ_CIRC && nStart==nEnd) { +/*?*/ if (eKind==OBJ_SECT) { +/*?*/ Point aMerk(aXPoly[0]); +/*?*/ aXPoly=XPolygon(2); +/*?*/ aXPoly[0]=rRect1.Center(); +/*?*/ aXPoly[1]=aMerk; +/*?*/ } else { +/*?*/ aXPoly=XPolygon(); +/*?*/ } +/*N*/ } +/*N*/ if (eKind==OBJ_SECT) { // Der Sektor soll Start/Ende im Zentrum haben +/*N*/ // Polygon um einen Punkt rotieren (Punkte im Array verschieben) +/*N*/ unsigned nPointAnz=aXPoly.GetPointCount(); +/*N*/ aXPoly.Insert(0,rRect1.Center(),XPOLY_NORMAL); +/*N*/ aXPoly[aXPoly.GetPointCount()]=rRect1.Center(); +/*N*/ } +/*N*/ // Der Kreis soll Anfang und Ende im unteren Scheitelpunkt haben! +/*N*/ if (bContour && eKind==OBJ_CIRC) RotateXPoly(aXPoly,rRect1.Center(),-1.0,0.0); +/*N*/ // Die Winkelangaben beziehen sich immer auf die linke obere Ecke von !aRect! +/*N*/ if (aGeo.nShearWink!=0) ShearXPoly(aXPoly,aRect.TopLeft(),aGeo.nTan); +/*N*/ if (aGeo.nDrehWink!=0) RotateXPoly(aXPoly,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ return aXPoly; +/*N*/ } + +/*N*/ void SdrCircObj::RecalcXPoly() +/*N*/ { +/*N*/ pXPoly=new XPolygon(ImpCalcXPoly(aRect,nStartWink,nEndWink)); +/*N*/ } + +/*N*/ void SdrCircObj::RecalcBoundRect() +/*N*/ { +/*N*/ SetWinkPnt(aRect,nStartWink,aPnt1); +/*N*/ SetWinkPnt(aRect,nEndWink,aPnt2); +/*N*/ bBoundRectDirty=FALSE; +/*N*/ aOutRect=GetSnapRect(); +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ nLineWdt++; nLineWdt/=2; +/*N*/ if (nLineWdt!=0) { +/*N*/ long nWink=nEndWink-nStartWink; +/*N*/ if (nWink<0) nWink+=36000; +/*N*/ if (eKind==OBJ_SECT && nWink<18000) nLineWdt*=2; // doppelt, wegen evtl. spitzen Ecken +/*N*/ if (eKind==OBJ_CCUT && nWink<18000) nLineWdt*=2; // doppelt, wegen evtl. spitzen Ecken +/*N*/ } +/*N*/ if (eKind==OBJ_CARC) { // ggf. Linienenden beruecksichtigen +/*N*/ long nLEndWdt=ImpGetLineEndAdd(); +/*N*/ if (nLEndWdt>nLineWdt) nLineWdt=nLEndWdt; +/*N*/ } +/*N*/ if (nLineWdt!=0) { +/*N*/ aOutRect.Left ()-=nLineWdt; +/*N*/ aOutRect.Top ()-=nLineWdt; +/*N*/ aOutRect.Right ()+=nLineWdt; +/*N*/ aOutRect.Bottom()+=nLineWdt; +/*N*/ } +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + +/*N*/ FASTBOOL SdrCircObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec) const +/*N*/ { +/*N*/ // Hidden objects on masterpages, draw nothing +/*N*/ if((rInfoRec.nPaintMode & SDRPAINTMODE_MASTERPAGE) && bNotVisibleAsMaster) +/*N*/ return TRUE; +/*N*/ +/*N*/ BOOL bHideContour(IsHideContour()); +/*N*/ BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE)); +/*N*/ BOOL bIsFillDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTFILL)); +/*N*/ +/*N*/ // prepare ItemSet of this object +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ // perepare ItemSet to avoid old XOut line drawing +/*N*/ SfxItemSet aEmptySet(*rSet.GetPool()); +/*N*/ aEmptySet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ aEmptySet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ // #103692# prepare ItemSet for shadow fill attributes +/*N*/ SfxItemSet aShadowSet(rSet); +/*N*/ +/*N*/ // prepare line geometry +/*N*/ ::std::auto_ptr< SdrLineGeometry > pLineGeometry( ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft) ); +/*N*/ +/*N*/ // Shadows +/*N*/ if(!bHideContour && ImpSetShadowAttributes(rSet, aShadowSet)) +/*N*/ { +/*?*/ if( eKind==OBJ_CARC || bIsFillDraft ) +/*?*/ rXOut.SetFillAttr(aEmptySet); +/*?*/ else +/*?*/ rXOut.SetFillAttr(aShadowSet); +/*?*/ +/*?*/ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(); +/*?*/ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue(); +/*?*/ +/*?*/ // avoid shadow line drawing in XOut +/*?*/ rXOut.SetLineAttr(aEmptySet); +/*?*/ +/*?*/ if (PaintNeedsXPoly()) +/*?*/ { +/*?*/ if( !bXPolyIsLine ) +/*?*/ { +/*?*/ XPolygon aX(GetXPoly()); // In dieser Reihenfolge, damit bXPolyIsLine gueltig ist. +/*?*/ aX.Move(nXDist,nYDist); +/*?*/ +/*?*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, aShadowSet, true ); +/*?*/ +/*?*/ rXOut.DrawXPolygon(aX); +/*?*/ } +/*?*/ } else { +/*?*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, aShadowSet, true ); +/*?*/ +/*?*/ Rectangle aR(aRect); +/*?*/ aR.Move(nXDist,nYDist); +/*?*/ if (eKind==OBJ_CIRC) { +/*?*/ rXOut.DrawEllipse(aR); +/*?*/ } else { +/*?*/ GetBoundRect(); // fuer aPnt1,aPnt2 +/*?*/ Point aTmpPt1(aPnt1); +/*?*/ Point aTmpPt2(aPnt2); +/*?*/ aTmpPt1.X()+=nXDist; +/*?*/ aTmpPt1.Y()+=nYDist; +/*?*/ aTmpPt2.X()+=nXDist; +/*?*/ aTmpPt2.Y()+=nYDist; +/*?*/ switch (eKind) { +/*?*/ case OBJ_SECT: rXOut.DrawPie(aR,aTmpPt1,aTmpPt2); break; +/*?*/ case OBJ_CARC: rXOut.DrawArc(aR,aTmpPt1,aTmpPt2); break; +/*?*/ case OBJ_CCUT: DBG_ERROR("SdrCircObj::Paint(): ein Kreisabschnitt muss immer mit XPoly gepaintet werden"); break; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // new shadow line drawing +/*?*/ if( pLineGeometry.get() ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ // draw the line geometry +/*?*/ } +/*N*/ } + + // Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr); +/*N*/ rXOut.SetLineAttr(aEmptySet); +/*N*/ +/*N*/ rXOut.SetFillAttr( bIsFillDraft ? aEmptySet : rSet ); +/*N*/ +/*N*/ if (!bHideContour) { +/*N*/ if (PaintNeedsXPoly()) +/*N*/ { +/*?*/ if( !bXPolyIsLine ) +/*?*/ { +/*?*/ const XPolygon& rXP=GetXPoly(); // In dieser Reihenfolge, damit bXPolyIsLine gueltig ist. +/*?*/ +/*?*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, bIsFillDraft ? aEmptySet : rSet ); +/*?*/ +/*?*/ rXOut.DrawXPolygon(rXP); +/*N*/ } +/*N*/ } else { +/*N*/ // #100127# Output original geometry for metafiles +/*N*/ ImpGraphicFill aFill( *this, rXOut, bIsFillDraft ? aEmptySet : rSet ); +/*N*/ +/*N*/ if (eKind==OBJ_CIRC) { +/*N*/ rXOut.DrawEllipse(aRect); +/*N*/ } else { +/*?*/ GetBoundRect(); // fuer aPnt1,aPnt2 +/*?*/ switch (eKind) { +/*?*/ case OBJ_SECT: rXOut.DrawPie(aRect,aPnt1,aPnt2); break; +/*?*/ case OBJ_CARC: rXOut.DrawArc(aRect,aPnt1,aPnt2); break; +/*?*/ case OBJ_CCUT: DBG_ERROR("SdrCircObj::Paint(): ein Kreisabschnitt muss immer mit XPoly gepaintet werden"); break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + // Own line drawing +/*N*/ if(!bHideContour && pLineGeometry.get() ) +/*N*/ { +/*N*/ // draw the line geometry +/*N*/ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry); +/*N*/ } +/*N*/ +/*N*/ FASTBOOL bOk=TRUE; +/*N*/ if (HasText()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (bOk && (rInfoRec.nPaintMode & SDRPAINTMODE_GLUEPOINTS) !=0) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + + + + +/*N*/ void SdrCircObj::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ SdrRectObj::operator=(rObj); +/*N*/ +/*N*/ nStartWink = ((SdrCircObj&)rObj).nStartWink; +/*N*/ nEndWink = ((SdrCircObj&)rObj).nEndWink; +/*N*/ aPnt1 = ((SdrCircObj&)rObj).aPnt1; +/*N*/ aPnt2 = ((SdrCircObj&)rObj).aPnt2; +/*N*/ } + +/*N*/ void SdrCircObj::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const +/*N*/ { +/*N*/ XPolygon aP(ImpCalcXPoly(aRect,nStartWink,nEndWink)); +/*N*/ if (!bXPolyIsLine) { // Polygon schliessen +/*N*/ USHORT n=aP.GetPointCount(); +/*N*/ Point aPnt(aP[0]); +/*N*/ aP[n]=aPnt; +/*N*/ } +/*N*/ rPoly=XPolyPolygon(aP); +/*N*/ } + +/*N*/ void SdrCircObj::TakeContour(XPolyPolygon& rPoly) const +/*N*/ { +/*N*/ // am 14.1.97 wg. Umstellung TakeContour ueber Mtf und Paint. Joe. +/*N*/ SdrRectObj::TakeContour(rPoly); +/*N*/ } + + + + + + + + + + + + + + + + + + + + + +/*N*/ void SdrCircObj::NbcMove(const Size& aSiz) +/*N*/ { +/*N*/ MoveRect(aRect,aSiz); +/*N*/ MoveRect(aOutRect,aSiz); +/*N*/ MoveRect(maSnapRect,aSiz); +/*N*/ MovePoint(aPnt1,aSiz); +/*N*/ MovePoint(aPnt2,aSiz); +/*N*/ SetXPolyDirty(); +/*N*/ SetRectsDirty(TRUE); +/*N*/ } + +/*N*/ void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ long nWink0=aGeo.nDrehWink; +/*N*/ FASTBOOL bNoShearRota=(aGeo.nDrehWink==0 && aGeo.nShearWink==0); +/*N*/ SdrTextObj::NbcResize(rRef,xFact,yFact); +/*N*/ bNoShearRota|=(aGeo.nDrehWink==0 && aGeo.nShearWink==0); +/*N*/ if (eKind!=OBJ_CIRC) { +/*N*/ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); +/*N*/ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); +/*N*/ if (bXMirr || bYMirr) { +/*N*/ // bei bXMirr!=bYMirr muessten eigentlich noch die beiden +/*N*/ // Linienende vertauscht werden. Das ist jedoch mal wieder +/*N*/ // schlecht (wg. zwangslaeufiger harter Formatierung). +/*N*/ // Alternativ koennte ein bMirrored-Flag eingefuehrt werden +/*N*/ // (Vielleicht ja mal grundsaetzlich, auch fuer gepiegelten Text, ...). +/*N*/ long nS0=nStartWink; +/*N*/ long nE0=nEndWink; +/*N*/ if (bNoShearRota) { +/*N*/ // Das RectObj spiegelt bei VMirror bereits durch durch 180deg Drehung. +/*N*/ if (! (bXMirr && bYMirr)) { +/*N*/ long nTmp=nS0; +/*N*/ nS0=18000-nE0; +/*N*/ nE0=18000-nTmp; +/*N*/ } +/*N*/ } else { // Spiegeln fuer verzerrte Ellipsen +/*N*/ if (bXMirr!=bYMirr) { +/*N*/ nS0+=nWink0; +/*N*/ nE0+=nWink0; +/*N*/ if (bXMirr) { +/*N*/ long nTmp=nS0; +/*N*/ nS0=18000-nE0; +/*N*/ nE0=18000-nTmp; +/*N*/ } +/*N*/ if (bYMirr) { +/*N*/ long nTmp=nS0; +/*N*/ nS0=-nE0; +/*N*/ nE0=-nTmp; +/*N*/ } +/*N*/ nS0-=aGeo.nDrehWink; +/*N*/ nE0-=aGeo.nDrehWink; +/*N*/ } +/*N*/ } +/*N*/ long nWinkDif=nE0-nS0; +/*N*/ nStartWink=NormAngle360(nS0); +/*N*/ nEndWink =NormAngle360(nE0); +/*N*/ if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis +/*N*/ } +/*N*/ } +/*N*/ SetXPolyDirty(); +/*N*/ ImpSetCircInfoToAttr(); +/*N*/ } + +/*N*/ void SdrCircObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ SdrTextObj::NbcShear(rRef,nWink,tn,bVShear); +/*N*/ SetXPolyDirty(); +/*N*/ ImpSetCircInfoToAttr(); +/*N*/ } + + + + + +/*N*/ void Union(Rectangle& rR, const Point& rP) +/*N*/ { +/*N*/ if (rP.X()<rR.Left ()) rR.Left ()=rP.X(); +/*N*/ if (rP.X()>rR.Right ()) rR.Right ()=rP.X(); +/*N*/ if (rP.Y()<rR.Top ()) rR.Top ()=rP.Y(); +/*N*/ if (rP.Y()>rR.Bottom()) rR.Bottom()=rP.Y(); +/*N*/ } + +/*N*/ void SdrCircObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ rRect=aRect; +/*N*/ if (eKind!=OBJ_CIRC) { +/*N*/ SetWinkPnt(rRect,nStartWink,((SdrCircObj*)(this))->aPnt1); +/*N*/ SetWinkPnt(rRect,nEndWink ,((SdrCircObj*)(this))->aPnt2); +/*N*/ long a=nStartWink; +/*N*/ long e=nEndWink; +/*N*/ rRect.Left ()=aRect.Right(); +/*N*/ rRect.Right ()=aRect.Left(); +/*N*/ rRect.Top ()=aRect.Bottom(); +/*N*/ rRect.Bottom()=aRect.Top(); +/*N*/ Union(rRect,aPnt1); +/*N*/ Union(rRect,aPnt2); +/*N*/ if ((a<=18000 && e>=18000) || (a>e && (a<=18000 || e>=18000))) { +/*N*/ Union(rRect,aRect.LeftCenter()); +/*N*/ } +/*N*/ if ((a<=27000 && e>=27000) || (a>e && (a<=27000 || e>=27000))) { +/*N*/ Union(rRect,aRect.BottomCenter()); +/*N*/ } +/*N*/ if (a>e) { +/*N*/ Union(rRect,aRect.RightCenter()); +/*N*/ } +/*N*/ if ((a<=9000 && e>=9000) || (a>e && (a<=9000 || e>=9000))) { +/*N*/ Union(rRect,aRect.TopCenter()); +/*N*/ } +/*N*/ if (eKind==OBJ_SECT) { +/*N*/ Union(rRect,aRect.Center()); +/*N*/ } +/*N*/ if (aGeo.nDrehWink!=0) { +/*?*/ Point aDst(rRect.TopLeft()); +/*?*/ aDst-=aRect.TopLeft(); +/*?*/ Point aDst0(aDst); +/*?*/ RotatePoint(aDst,Point(),aGeo.nSin,aGeo.nCos); +/*?*/ aDst-=aDst0; +/*?*/ rRect.Move(aDst.X(),aDst.Y()); +/*N*/ } +/*N*/ } +/*N*/ if (aGeo.nShearWink!=0) { +/*N*/ long nDst=Round((rRect.Bottom()-rRect.Top())*aGeo.nTan); +/*N*/ if (aGeo.nShearWink>0) { +/*?*/ Point aRef(rRect.TopLeft()); +/*?*/ rRect.Left()-=nDst; +/*?*/ Point aTmpPt(rRect.TopLeft()); +/*?*/ RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos); +/*?*/ aTmpPt-=rRect.TopLeft(); +/*?*/ rRect.Move(aTmpPt.X(),aTmpPt.Y()); +/*?*/ } else { +/*?*/ rRect.Right()-=nDst; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrCircObj::RecalcSnapRect() +/*N*/ { +/*N*/ if (PaintNeedsXPoly()) { +/*N*/ maSnapRect=GetXPoly().GetBoundRect(); +/*N*/ } else { +/*N*/ TakeUnrotatedSnapRect(maSnapRect); +/*N*/ } +/*N*/ } + +/*N*/ void SdrCircObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || eKind!=OBJ_CIRC) { +/*?*/ Rectangle aSR0(GetSnapRect()); +/*?*/ long nWdt0=aSR0.Right()-aSR0.Left(); +/*?*/ long nHgt0=aSR0.Bottom()-aSR0.Top(); +/*?*/ long nWdt1=rRect.Right()-rRect.Left(); +/*?*/ long nHgt1=rRect.Bottom()-rRect.Top(); +/*?*/ NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0)); +/*?*/ NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top())); +/*N*/ } else { +/*N*/ aRect=rRect; +/*N*/ ImpJustifyRect(aRect); +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ SetXPolyDirty(); +/*N*/ ImpSetCircInfoToAttr(); +/*N*/ } + + + +/*N*/ void __EXPORT SdrCircObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SetXPolyDirty(); +/*N*/ SdrRectObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ ImpSetAttrToCircInfo(); +/*N*/ } + +/*N*/ void SdrCircObj::ForceDefaultAttr() +/*N*/ { +/*N*/ SdrCircKind eKindA = SDRCIRC_FULL; +/*N*/ +/*N*/ if(eKind == OBJ_SECT) +/*N*/ eKindA = SDRCIRC_SECT; +/*N*/ else if(eKind == OBJ_CARC) +/*N*/ eKindA = SDRCIRC_ARC; +/*N*/ else if(eKind == OBJ_CCUT) +/*N*/ eKindA = SDRCIRC_CUT; +/*N*/ +/*N*/ if(eKindA != SDRCIRC_FULL) +/*N*/ { +/*N*/ ImpForceItemSet(); +/*N*/ mpObjectItemSet->Put(SdrCircKindItem(eKindA)); +/*N*/ +/*N*/ if(nStartWink) +/*N*/ mpObjectItemSet->Put(SdrCircStartAngleItem(nStartWink)); +/*N*/ +/*N*/ if(nEndWink != 36000) +/*N*/ mpObjectItemSet->Put(SdrCircEndAngleItem(nEndWink)); +/*N*/ } +/*N*/ +/*N*/ // call parent, after SetItem(SdrCircKindItem()) +/*N*/ // because ForceDefaultAttr() will call +/*N*/ // ImpSetAttrToCircInfo() which needs a correct +/*N*/ // SdrCircKindItem +/*N*/ SdrRectObj::ForceDefaultAttr(); +/*N*/ +/*N*/ } + +/*N*/ void SdrCircObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SetXPolyDirty(); +/*N*/ SdrRectObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ ImpSetAttrToCircInfo(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ SfxItemSet* SdrCircObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // circle attributes +/*N*/ SDRATTR_CIRC_FIRST, SDRATTRSET_CIRC, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access +/*N*/ void SdrCircObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // local changes +/*N*/ SetXPolyDirty(); +/*N*/ +/*N*/ // call parent +/*N*/ SdrRectObj::ItemSetChanged(rSet); +/*N*/ +/*N*/ // local changes +/*N*/ ImpSetAttrToCircInfo(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrCircObj::ImpSetAttrToCircInfo() +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrCircKind eNewKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue(); +/*N*/ SdrObjKind eNewKind = eKind; +/*N*/ +/*N*/ if(eNewKindA == SDRCIRC_FULL) +/*N*/ eNewKind = OBJ_CIRC; +/*N*/ else if(eNewKindA == SDRCIRC_SECT) +/*N*/ eNewKind = OBJ_SECT; +/*N*/ else if(eNewKindA == SDRCIRC_ARC) +/*N*/ eNewKind = OBJ_CARC; +/*N*/ else if(eNewKindA == SDRCIRC_CUT) +/*N*/ eNewKind = OBJ_CCUT; +/*N*/ +/*N*/ sal_Int32 nNewStart = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue(); +/*N*/ sal_Int32 nNewEnd = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue(); +/*N*/ +/*N*/ BOOL bKindChg = eKind != eNewKind; +/*N*/ BOOL bWinkChg = nNewStart != nStartWink || nNewEnd != nEndWink; +/*N*/ +/*N*/ if(bKindChg || bWinkChg) +/*N*/ { +/*N*/ eKind = eNewKind; +/*N*/ nStartWink = nNewStart; +/*N*/ nEndWink = nNewEnd; +/*N*/ +/*N*/ if(bKindChg || (eKind != OBJ_CIRC && bWinkChg)) +/*N*/ { +/*N*/ SetXPolyDirty(); +/*N*/ SetRectsDirty(); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrCircObj::ImpSetCircInfoToAttr() +/*N*/ { +/*N*/ SdrCircKind eNewKindA = SDRCIRC_FULL; +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ if(eKind == OBJ_SECT) +/*N*/ eNewKindA = SDRCIRC_SECT; +/*N*/ else if(eKind == OBJ_CARC) +/*N*/ eNewKindA = SDRCIRC_ARC; +/*N*/ else if(eKind == OBJ_CCUT) +/*N*/ eNewKindA = SDRCIRC_CUT; +/*N*/ +/*N*/ SdrCircKind eOldKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue(); +/*N*/ sal_Int32 nOldStartWink = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue(); +/*N*/ sal_Int32 nOldEndWink = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue(); +/*N*/ +/*N*/ if(eNewKindA != eOldKindA || nStartWink != nOldStartWink || nEndWink != nOldEndWink) +/*N*/ { +/*N*/ // #81921# since SetItem() implicitly calls ImpSetAttrToCircInfo() +/*N*/ // setting the item directly is necessary here. +/*?*/ ImpForceItemSet(); +/*?*/ +/*?*/ if(eNewKindA != eOldKindA) +/*?*/ mpObjectItemSet->Put(SdrCircKindItem(eNewKindA)); +/*?*/ +/*?*/ if(nStartWink != nOldStartWink) +/*?*/ mpObjectItemSet->Put(SdrCircStartAngleItem(nStartWink)); +/*?*/ +/*?*/ if(nEndWink != nOldEndWink) +/*?*/ mpObjectItemSet->Put(SdrCircEndAngleItem(nEndWink)); +/*?*/ +/*?*/ SetXPolyDirty(); +/*?*/ ImpSetAttrToCircInfo(); +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrCircObj::DoConvertToPolyObj(BOOL bBezier) const +/*N*/ { +/*N*/ XPolygon aXP(ImpCalcXPoly(aRect,nStartWink,nEndWink)); +/*N*/ SdrObjKind ePathKind=OBJ_PATHFILL; +/*N*/ FASTBOOL bFill=TRUE; +/*N*/ if (eKind==OBJ_CARC) bFill=FALSE; +/*N*/ SdrObject* pRet=ImpConvertMakeObj(XPolyPolygon(aXP),bFill,bBezier); +/*N*/ pRet=ImpConvertAddText(pRet,bBezier); +/*N*/ return pRet; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrCircObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrRectObj::PreSave(); +/*N*/ +/*N*/ // prepare SetItems for storage +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*N*/ SdrCircSetItem aCircAttr(rSet.GetPool()); +/*N*/ aCircAttr.GetItemSet().Put(rSet); +/*N*/ aCircAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aCircAttr); +/*N*/ } + +/*N*/ void SdrCircObj::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrRectObj::PostSave(); +/*N*/ +/*N*/ // remove SetItems from local itemset +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_CIRC); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrCircObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrRectObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrCircObj"); +/*N*/ #endif +/*N*/ +/*N*/ if(eKind != OBJ_CIRC) +/*N*/ { +/*N*/ rOut << nStartWink; +/*N*/ rOut << nEndWink; +/*N*/ } +/*N*/ +/*N*/ SfxItemPool* pPool=GetItemPool(); +/*N*/ if(pPool) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_CIRC)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rOut << UINT16(SFX_ITEMS_NULL); +/*N*/ } +/*N*/ } + +/*N*/ void SdrCircObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*N*/ return; +/*N*/ +/*N*/ // #91764# remember eKind, it will be deleted during SdrRectObj::ReadData(...) +/*N*/ // but needs to be known to decide to jump over angles or not. Deletion happens +/*N*/ // cause of fix #89025# wich is necessary, too. +/*N*/ SdrObjKind eRememberedKind = eKind; +/*N*/ +/*N*/ SdrRectObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrCircObj"); +/*N*/ #endif +/*N*/ +/*N*/ // #92309# at once restore the remembered eKind here. +/*N*/ eKind = eRememberedKind; +/*N*/ +/*N*/ // #91764# use remembered eKind here +/*N*/ if(eRememberedKind != OBJ_CIRC) +/*N*/ { +/*N*/ rIn >> nStartWink; +/*N*/ rIn >> nEndWink; +/*N*/ } +/*N*/ +/*N*/ if(aCompat.GetBytesLeft() > 0) +/*N*/ { +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ sal_uInt16 nSetID = SDRATTRSET_CIRC; +/*N*/ const SdrCircSetItem* pCircAttr = (const SdrCircSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pCircAttr) +/*N*/ SetItemSet(pCircAttr->GetItemSet()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ sal_uInt16 nSuroDum; +/*N*/ rIn >> nSuroDum; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // create pCircAttr for old Objects to let ImpSetCircInfoToAttr() do it's work +/*N*/ SdrCircKind eKindA(SDRCIRC_FULL); +/*N*/ +/*N*/ if(eKind == OBJ_SECT) +/*N*/ eKindA = SDRCIRC_SECT; +/*N*/ else if(eKind == OBJ_CARC) +/*N*/ eKindA = SDRCIRC_ARC; +/*N*/ else if(eKind == OBJ_CCUT) +/*N*/ eKindA = SDRCIRC_CUT; +/*N*/ +/*N*/ if(eKindA != SDRCIRC_FULL) +/*N*/ { +/*N*/ mpObjectItemSet->Put(SdrCircKindItem(eKindA)); +/*N*/ +/*N*/ if(nStartWink) +/*N*/ mpObjectItemSet->Put(SdrCircStartAngleItem(nStartWink)); +/*N*/ +/*N*/ if(nEndWink != 36000) +/*N*/ mpObjectItemSet->Put(SdrCircEndAngleItem(nEndWink)); +/*N*/ } +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdoedge.cxx b/binfilter/bf_svx/source/svdraw/svx_svdoedge.cxx new file mode 100644 index 000000000000..10ffc7abf759 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdoedge.cxx @@ -0,0 +1,1947 @@ +/* -*- 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 "xpool.hxx" +#include "svdattrx.hxx" +#include "svdpool.hxx" +#include "svddrgv.hxx" +#include "svdtouch.hxx" +#include "svdio.hxx" +#include "svdsuro.hxx" +#include "svdstr.hrc" // Objektname + +#include <bf_svtools/style.hxx> + + +#include "eeitem.hxx" + +#include "rectenum.hxx" + + +#include "xoutx.hxx" + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObjConnection::~SdrObjConnection() +/*N*/ { +/*N*/ if (pSuro!=NULL) delete pSuro; +/*N*/ } + +/*N*/ void SdrObjConnection::ResetVars() +/*N*/ { +/*N*/ pSuro=NULL; +/*N*/ pObj=NULL; +/*N*/ nConId=0; +/*N*/ nXDist=0; +/*N*/ nYDist=0; +/*N*/ bBestConn=TRUE; +/*N*/ bBestVertex=TRUE; +/*N*/ bXDistOvr=FALSE; +/*N*/ bYDistOvr=FALSE; +/*N*/ bAutoVertex=FALSE; +/*N*/ bAutoCorner=FALSE; +/*N*/ } + +/*N*/ FASTBOOL SdrObjConnection::TakeGluePoint(SdrGluePoint& rGP, FASTBOOL bSetAbsPos) const +/*N*/ { +/*N*/ FASTBOOL bRet=FALSE; +/*N*/ if (pObj!=NULL) { // Ein Obj muss schon angedockt sein! +/*N*/ if (bAutoVertex) { +/*N*/ rGP=pObj->GetVertexGluePoint(nConId); +/*N*/ bRet=TRUE; +/*N*/ } else if (bAutoCorner) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } else { +/*?*/ const SdrGluePointList* pGPL=pObj->GetGluePointList(); +/*N*/ if (pGPL!=NULL) { +/*?*/ USHORT nNum=pGPL->FindGluePoint(nConId); +/*?*/ if (nNum!=SDRGLUEPOINT_NOTFOUND) { +/*?*/ rGP=(*pGPL)[nNum]; +/*?*/ bRet=TRUE; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (bRet && bSetAbsPos) { +/*N*/ Point aPt(rGP.GetAbsolutePos(*pObj)); +/*N*/ aPt+=aObjOfs; +/*N*/ rGP.SetPos(aPt); +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ void SdrObjConnection::Write(SvStream& rOut, const SdrObject* pEdgeObj) const +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOConnID); // ab V11 eingepackt +/*N*/ SdrObjSurrogate aSuro(pObj,pEdgeObj); +/*N*/ rOut<<aSuro; +/*N*/ rOut<<nConId; +/*N*/ rOut<<nXDist; +/*N*/ rOut<<nYDist; +/*N*/ BOOL bTmp; +/*N*/ bTmp=bBestConn; rOut<<bTmp; +/*N*/ bTmp=bBestVertex; rOut<<bTmp; +/*N*/ bTmp=bXDistOvr; rOut<<bTmp; +/*N*/ bTmp=bYDistOvr; rOut<<bTmp; +/*N*/ bTmp=bAutoVertex; rOut<<bTmp; +/*N*/ bTmp=bAutoCorner; rOut<<bTmp; +/*N*/ UINT32 nReserve=0; +/*N*/ rOut<<nReserve; +/*N*/ rOut<<nReserve; +/*N*/ } + +/*N*/ void SdrObjConnection::Read(SvStream& rIn, const SdrObject* pEdgeObj) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ,SdrIOConnID); // ab V11 eingepackt +/*N*/ pSuro=new SdrObjSurrogate(*pEdgeObj,rIn); +/*N*/ BOOL bBit; +/*N*/ rIn>>nConId; +/*N*/ rIn>>nXDist; +/*N*/ rIn>>nYDist; +/*N*/ rIn>>bBit; bBestConn =bBit; +/*N*/ rIn>>bBit; bBestVertex=bBit; +/*N*/ rIn>>bBit; bXDistOvr =bBit; +/*N*/ rIn>>bBit; bYDistOvr =bBit; +/*N*/ rIn>>bBit; bAutoVertex=bBit; +/*N*/ rIn>>bBit; bAutoCorner=bBit; +/*N*/ UINT32 nReserve; +/*N*/ rIn>>nReserve; +/*N*/ rIn>>nReserve; +/*N*/ } + +/*N*/ void SdrObjConnection::ReadTilV10(SvStream& rIn, const SdrObject* pEdgeObj) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ pSuro=new SdrObjSurrogate(*pEdgeObj,rIn); +/*N*/ BOOL bBit; +/*N*/ rIn>>nConId; +/*N*/ rIn>>nXDist; +/*N*/ rIn>>nYDist; +/*N*/ rIn>>bBit; bBestConn =bBit; +/*N*/ rIn>>bBit; bBestVertex=bBit; +/*N*/ rIn>>bBit; bXDistOvr =bBit; +/*N*/ rIn>>bBit; bYDistOvr =bBit; +/*N*/ rIn>>bBit; bAutoVertex=bBit; +/*N*/ rIn>>bBit; bAutoCorner=bBit; +/*N*/ UINT32 nReserve; +/*N*/ rIn>>nReserve; +/*N*/ rIn>>nReserve; +/*N*/ } + +/*N*/ void SdrObjConnection::AfterRead(const SdrObject* pEdgeObj) +/*N*/ { +/*N*/ if (pSuro!=NULL) { +/*N*/ pObj=pSuro->GetObject(); +/*N*/ delete pSuro; +/*N*/ pSuro=NULL; +/*N*/ } +/*N*/ } + +/*N*/ Point& SdrEdgeInfoRec::ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode) +/*N*/ { +/*N*/ switch (eLineCode) { +/*N*/ case OBJ1LINE2 : return aObj1Line2; +/*?*/ case OBJ1LINE3 : return aObj1Line3; +/*N*/ case OBJ2LINE2 : return aObj2Line2; +/*?*/ case OBJ2LINE3 : return aObj2Line3; +/*N*/ case MIDDLELINE: return aMiddleLine; +/*N*/ } // switch +/*N*/ return aMiddleLine; +/*N*/ } + +/*N*/ USHORT SdrEdgeInfoRec::ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const +/*N*/ { +/*N*/ switch (eLineCode) { +/*N*/ case OBJ1LINE2 : return 1; +/*N*/ case OBJ1LINE3 : return 2; +/*N*/ case OBJ2LINE2 : return rXP.GetPointCount()-3; +/*N*/ case OBJ2LINE3 : return rXP.GetPointCount()-4; +/*N*/ case MIDDLELINE: return nMiddleLine; +/*N*/ } // switch +/*N*/ return 0; +/*N*/ } + +/*N*/ FASTBOOL SdrEdgeInfoRec::ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const +/*N*/ { +/*N*/ USHORT nIdx=ImpGetPolyIdx(eLineCode,rXP); +/*N*/ FASTBOOL bHorz=nAngle1==0 || nAngle1==18000; +/*N*/ if (eLineCode==OBJ2LINE2 || eLineCode==OBJ2LINE3) { +/*N*/ nIdx=rXP.GetPointCount()-nIdx; // #36314# +/*N*/ bHorz=nAngle2==0 || nAngle2==18000; // #52000# +/*N*/ } +/*N*/ if ((nIdx & 1)==1) bHorz=!bHorz; +/*N*/ return bHorz; +/*N*/ } + +/*N*/ void SdrEdgeInfoRec::ImpSetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP, long nVal) +/*N*/ { +/*N*/ Point& rPt=ImpGetLineVersatzPoint(eLineCode); +/*N*/ if (ImpIsHorzLine(eLineCode,rXP)) rPt.Y()=nVal; +/*N*/ else rPt.X()=nVal; +/*N*/ } + +/*N*/ long SdrEdgeInfoRec::ImpGetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const +/*N*/ { +/*N*/ const Point& rPt=ImpGetLineVersatzPoint(eLineCode); +/*N*/ if (ImpIsHorzLine(eLineCode,rXP)) return rPt.Y(); +/*N*/ else return rPt.X(); +/*N*/ } +/*N*/ +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrEdgeInfoRec& rEI) +/*N*/ { +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrEdgeInfoRec"); +/*N*/ #endif +/*N*/ rOut<<rEI.aObj1Line2; +/*N*/ rOut<<rEI.aObj1Line3; +/*N*/ rOut<<rEI.aObj2Line2; +/*N*/ rOut<<rEI.aObj2Line3; +/*N*/ rOut<<rEI.aMiddleLine; +/*N*/ rOut<<rEI.nAngle1; +/*N*/ rOut<<rEI.nAngle2; +/*N*/ rOut<<rEI.nObj1Lines; +/*N*/ rOut<<rEI.nObj2Lines; +/*N*/ rOut<<rEI.nMiddleLine; +/*N*/ rOut<<rEI.cOrthoForm; +/*N*/ return rOut; +/*N*/ } +/*N*/ +/*N*/ SvStream& operator>>(SvStream& rIn, SdrEdgeInfoRec& rEI) +/*N*/ { +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrEdgeInfoRec"); +/*N*/ #endif +/*N*/ rIn>>rEI.aObj1Line2; +/*N*/ rIn>>rEI.aObj1Line3; +/*N*/ rIn>>rEI.aObj2Line2; +/*N*/ rIn>>rEI.aObj2Line3; +/*N*/ rIn>>rEI.aMiddleLine; +/*N*/ rIn>>rEI.nAngle1; +/*N*/ rIn>>rEI.nAngle2; +/*N*/ rIn>>rEI.nObj1Lines; +/*N*/ rIn>>rEI.nObj2Lines; +/*N*/ rIn>>rEI.nMiddleLine; +/*N*/ rIn>>rEI.cOrthoForm; +/*N*/ return rIn; +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ +/*N*/ TYPEINIT1(SdrEdgeObj,SdrTextObj); +/*N*/ +/*N*/ SdrEdgeObj::SdrEdgeObj(): +/*N*/ SdrTextObj() +/*N*/ { +/*N*/ bClosedObj=FALSE; +/*N*/ bIsEdge=TRUE; +/*N*/ bEdgeTrackDirty=FALSE; +/*N*/ nNotifyingCount=0; +/*N*/ pEdgeTrack=new XPolygon; +/*N*/ +/*N*/ // #109007# +/*N*/ // Default is to allow default connects +/*N*/ mbSuppressDefaultConnect = (FASTBOOL)sal_False; +/*N*/ } +/*N*/ +/*N*/ SdrEdgeObj::~SdrEdgeObj() +/*N*/ { +/*N*/ DisconnectFromNode(TRUE); +/*N*/ DisconnectFromNode(FALSE); +/*N*/ delete pEdgeTrack; +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ // ItemSet access +/*N*/ +/*N*/ SfxItemSet* SdrEdgeObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // edge attributes +/*N*/ SDRATTR_EDGE_FIRST, SDRATTRSET_EDGE, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ // private support routines for ItemSet access +/*N*/ void SdrEdgeObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::ItemSetChanged(rSet); +/*N*/ +/*N*/ // local changes +/*N*/ ImpSetAttrToEdgeInfo(); +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ +/*N*/ void SdrEdgeObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ ImpSetAttrToEdgeInfo(); // Werte vom Pool nach aEdgeInfo kopieren +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::ImpSetAttrToEdgeInfo() +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue(); +/*N*/ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue(); +/*N*/ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue(); +/*N*/ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue(); +/*N*/ +/*N*/ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER) +/*N*/ { +/*N*/ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 }; +/*N*/ sal_uInt16 n = 0; +/*N*/ +/*N*/ if(aEdgeInfo.nObj1Lines >= 2 && n < 3) +/*N*/ { +/*?*/ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE2, *pEdgeTrack, nVals[n]); +/*?*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj1Lines >= 3 && n < 3) +/*N*/ { +/*?*/ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE3, *pEdgeTrack, nVals[n]); +/*?*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3) +/*N*/ { +/*N*/ aEdgeInfo.ImpSetLineVersatz(MIDDLELINE, *pEdgeTrack, nVals[n]); +/*N*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj2Lines >= 3 && n < 3) +/*N*/ { +/*?*/ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE3, *pEdgeTrack, nVals[n]); +/*?*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj2Lines >= 2 && n < 3) +/*N*/ { +/*?*/ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE2, *pEdgeTrack, nVals[n]); +/*?*/ n++; +/*N*/ } +/*N*/ } +/*N*/ else if(eKind == SDREDGE_THREELINES) +/*N*/ { +/*?*/ BOOL bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000; +/*?*/ BOOL bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000; +/*?*/ +/*?*/ if(bHor1) +/*?*/ { +/*?*/ aEdgeInfo.aObj1Line2.X() = nVal1; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aEdgeInfo.aObj1Line2.Y() = nVal1; +/*?*/ } +/*?*/ +/*?*/ if(bHor2) +/*?*/ { +/*?*/ aEdgeInfo.aObj2Line2.X() = nVal2; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aEdgeInfo.aObj2Line2.Y() = nVal2; +/*?*/ } +/*N*/ } + + // #84649# +/*N*/ bEdgeTrackDirty = TRUE; +/*N*/ } + +/*N*/ void SdrEdgeObj::ImpSetEdgeInfoToAttr() +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue(); +/*N*/ sal_Int32 nValAnz = ((SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue(); +/*N*/ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue(); +/*N*/ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue(); +/*N*/ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue(); +/*N*/ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 }; +/*N*/ sal_uInt16 n = 0; +/*N*/ +/*N*/ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER) +/*N*/ { +/*N*/ if(aEdgeInfo.nObj1Lines >= 2 && n < 3) +/*N*/ { +/*?*/ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE2, *pEdgeTrack); +/*?*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj1Lines >= 3 && n < 3) +/*N*/ { +/*N*/ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE3, *pEdgeTrack); +/*N*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3) +/*N*/ { +/*?*/ nVals[n] = aEdgeInfo.ImpGetLineVersatz(MIDDLELINE, *pEdgeTrack); +/*?*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj2Lines >= 3 && n < 3) +/*N*/ { +/*N*/ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE3, *pEdgeTrack); +/*N*/ n++; +/*N*/ } +/*N*/ +/*N*/ if(aEdgeInfo.nObj2Lines >= 2 && n < 3) +/*N*/ { +/*N*/ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE2, *pEdgeTrack); +/*N*/ n++; +/*N*/ } +/*N*/ } +/*N*/ else if(eKind == SDREDGE_THREELINES) +/*N*/ { +/*?*/ BOOL bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000; +/*?*/ BOOL bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000; +/*?*/ +/*?*/ n = 2; +/*?*/ nVals[0] = bHor1 ? aEdgeInfo.aObj1Line2.X() : aEdgeInfo.aObj1Line2.Y(); +/*?*/ nVals[1] = bHor2 ? aEdgeInfo.aObj2Line2.X() : aEdgeInfo.aObj2Line2.Y(); +/*N*/ } +/*N*/ +/*N*/ if(n != nValAnz || nVals[0] != nVal1 || nVals[1] != nVal2 || nVals[2] != nVal3) +/*N*/ { +/*N*/ // #75371# Here no more notifying is necessary, just local changes are OK. +/*N*/ ImpForceItemSet(); +/*N*/ +/*N*/ if(n != nValAnz) +/*?*/ mpObjectItemSet->Put(SdrEdgeLineDeltaAnzItem(n)); +/*N*/ +/*N*/ if(nVals[0] != nVal1) +/*?*/ mpObjectItemSet->Put(SdrEdgeLine1DeltaItem(nVals[0])); +/*N*/ +/*N*/ if(nVals[1] != nVal2) +/*?*/ mpObjectItemSet->Put(SdrEdgeLine2DeltaItem(nVals[1])); +/*N*/ +/*N*/ if(nVals[2] != nVal3) +/*?*/ mpObjectItemSet->Put(SdrEdgeLine3DeltaItem(nVals[2])); +/*N*/ +/*N*/ if(n < 3) +/*N*/ mpObjectItemSet->ClearItem(SDRATTR_EDGELINE3DELTA); +/*N*/ +/*N*/ if(n < 2) +/*N*/ mpObjectItemSet->ClearItem(SDRATTR_EDGELINE2DELTA); +/*N*/ +/*N*/ if(n < 1) +/*N*/ mpObjectItemSet->ClearItem(SDRATTR_EDGELINE1DELTA); +/*N*/ } +/*N*/ } + + +/*N*/ UINT16 SdrEdgeObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(OBJ_EDGE); +/*N*/ } +/*N*/ +/*N*/ const Rectangle& SdrEdgeObj::GetBoundRect() const +/*N*/ { +/*N*/ if (bEdgeTrackDirty) { +/*N*/ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack(); +/*N*/ } +/*N*/ return SdrTextObj::GetBoundRect(); +/*N*/ } +/*N*/ +/*N*/ const Rectangle& SdrEdgeObj::GetSnapRect() const +/*N*/ { +/*N*/ if (bEdgeTrackDirty) { +/*N*/ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack(); +/*N*/ } +/*N*/ return SdrTextObj::GetSnapRect(); +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::RecalcSnapRect() +/*N*/ { +/*N*/ maSnapRect=pEdgeTrack->GetBoundRect(); +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::RecalcBoundRect() +/*N*/ { +/*N*/ aOutRect=GetSnapRect(); +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ // Linienenden beruecksichtigen +/*N*/ long nLEndWdt=ImpGetLineEndAdd(); +/*N*/ if (nLEndWdt>nLineWdt) nLineWdt=nLEndWdt; +/*N*/ if (nLineWdt!=0) { +/*N*/ aOutRect.Left ()-=nLineWdt; +/*N*/ aOutRect.Top ()-=nLineWdt; +/*N*/ aOutRect.Right ()+=nLineWdt; +/*N*/ aOutRect.Bottom()+=nLineWdt; +/*N*/ } +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + +/*N*/ void SdrEdgeObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ rRect=GetSnapRect(); +/*N*/ } + + +/*N*/ SdrObject* SdrEdgeObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ if (pVisiLayer!=NULL && !pVisiLayer->IsSet(nLayerId)) return NULL; +/*N*/ INT32 nMyTol=nTol; +/*N*/ +/*N*/ INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke +/*N*/ if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig +/*N*/ Rectangle aR(rPnt,rPnt); +/*N*/ aR.Left() -=nMyTol; +/*N*/ aR.Right() +=nMyTol; +/*N*/ aR.Top() -=nMyTol; +/*N*/ aR.Bottom()+=nMyTol; +/*N*/ +/*N*/ FASTBOOL bHit=FALSE; +/*N*/ +/*N*/ Polygon aPoly=XOutCreatePolygon(*pEdgeTrack,NULL); +/*N*/ bHit=IsRectTouchesLine(aPoly,aR); +/*N*/ if (!bHit && HasText()) bHit=SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL; +/*N*/ return bHit ? (SdrObject*)this : NULL; +/*N*/ } + +/*N*/ FASTBOOL SdrEdgeObj::IsNode() const +/*N*/ { +/*N*/ return TRUE; +/*N*/ } + +/*N*/ SdrGluePoint SdrEdgeObj::GetVertexGluePoint(USHORT nNum) const +/*N*/ { +/*N*/ Point aPt; +/*N*/ USHORT nPntAnz=pEdgeTrack->GetPointCount(); +/*N*/ if (nPntAnz>0) { +/*N*/ Point aOfs(GetSnapRect().Center()); +/*N*/ if (nNum==2 && GetConnectedNode(TRUE)==NULL) aPt=(*pEdgeTrack)[0]; +/*N*/ else if (nNum==3 && GetConnectedNode(FALSE)==NULL) aPt=(*pEdgeTrack)[nPntAnz-1]; +/*N*/ else { +/*N*/ if ((nPntAnz & 1) ==1) { +/*N*/ aPt=(*pEdgeTrack)[nPntAnz/2]; +/*N*/ } else { +/*N*/ Point aPt1((*pEdgeTrack)[nPntAnz/2-1]); +/*N*/ Point aPt2((*pEdgeTrack)[nPntAnz/2]); +/*N*/ aPt1+=aPt2; +/*N*/ aPt1.X()/=2; +/*N*/ aPt1.Y()/=2; +/*N*/ aPt=aPt1; +/*N*/ } +/*N*/ } +/*N*/ aPt-=aOfs; +/*N*/ } +/*N*/ SdrGluePoint aGP(aPt); +/*N*/ aGP.SetPercent(FALSE); +/*N*/ return aGP; +/*N*/ } + + + + + +/*N*/ void SdrEdgeObj::ConnectToNode(FASTBOOL bTail1, SdrObject* pObj) +/*N*/ { +/*N*/ SdrObjConnection& rCon=GetConnection(bTail1); +/*N*/ DisconnectFromNode(bTail1); +/*N*/ if (pObj!=NULL) { +/*N*/ pObj->AddListener(*this); +/*N*/ rCon.pObj=pObj; +/*N*/ bEdgeTrackDirty=TRUE; +/*N*/ } +/*N*/ } + +/*N*/ void SdrEdgeObj::DisconnectFromNode(FASTBOOL bTail1) +/*N*/ { +/*N*/ SdrObjConnection& rCon=GetConnection(bTail1); +/*N*/ if (rCon.pObj!=NULL) { +/*?*/ rCon.pObj->RemoveListener(*this); +/*?*/ rCon.pObj=NULL; +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrEdgeObj::GetConnectedNode(FASTBOOL bTail1) const +/*N*/ { +/*N*/ SdrObject* pObj=GetConnection(bTail1).pObj; +/*N*/ if (pObj!=NULL && (pObj->GetPage()!=pPage || !pObj->IsInserted())) pObj=NULL; +/*N*/ return pObj; +/*N*/ } + + +/*N*/ void SdrEdgeObj::ImpSetTailPoint(FASTBOOL bTail1, const Point& rPt) +/*N*/ { +/*N*/ USHORT nPtAnz=pEdgeTrack->GetPointCount(); +/*N*/ if (nPtAnz==0) { +/*?*/ (*pEdgeTrack)[0]=rPt; +/*?*/ (*pEdgeTrack)[1]=rPt; +/*N*/ } else if (nPtAnz==1) { +/*?*/ if (!bTail1) (*pEdgeTrack)[1]=rPt; +/*?*/ else { (*pEdgeTrack)[1]=(*pEdgeTrack)[0]; (*pEdgeTrack)[0]=rPt; } +/*N*/ } else { +/*?*/ if (!bTail1) (*pEdgeTrack)[USHORT(nPtAnz-1)]=rPt; +/*?*/ else (*pEdgeTrack)[0]=rPt; +/*N*/ } +/*N*/ ImpRecalcEdgeTrack(); +/*N*/ SetRectsDirty(); +/*N*/ } + + +/*N*/ void SdrEdgeObj::ImpRecalcEdgeTrack() +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=aOutRect; // war vorher =GetBoundRect() #36431# +/*N*/ SetRectsDirty(); +/*N*/ if (!bEdgeTrackDirty) SendRepaintBroadcast(); +/*N*/ *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo); +/*N*/ ImpSetEdgeInfoToAttr(); // Die Werte aus aEdgeInfo in den Pool kopieren +/*N*/ bEdgeTrackDirty=FALSE; +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + +/*N*/ USHORT SdrEdgeObj::ImpCalcEscAngle(SdrObject* pObj, const Point& rPt) const +/*N*/ { +/*N*/ if (pObj==NULL) return SDRESC_ALL; +/*N*/ Rectangle aR(pObj->GetSnapRect()); +/*N*/ long dxl=rPt.X()-aR.Left(); +/*N*/ long dyo=rPt.Y()-aR.Top(); +/*N*/ long dxr=aR.Right()-rPt.X(); +/*N*/ long dyu=aR.Bottom()-rPt.Y(); +/*N*/ FASTBOOL bxMitt=Abs(dxl-dxr)<2; +/*N*/ FASTBOOL byMitt=Abs(dyo-dyu)<2; +/*N*/ long dx=Min(dxl,dxr); +/*N*/ long dy=Min(dyo,dyu); +/*N*/ FASTBOOL bDiag=Abs(dx-dy)<2; +/*N*/ if (bxMitt && byMitt) return SDRESC_ALL; // In der Mitte +/*N*/ if (bDiag) { // diagonal +/*?*/ USHORT nRet=0; +/*?*/ if (byMitt) nRet|=SDRESC_VERT; +/*?*/ if (bxMitt) nRet|=SDRESC_HORZ; +/*?*/ if (dxl<dxr) { // Links +/*?*/ if (dyo<dyu) nRet|=SDRESC_LEFT | SDRESC_TOP; +/*?*/ else nRet|=SDRESC_LEFT | SDRESC_BOTTOM; +/*?*/ } else { // Rechts +/*?*/ if (dyo<dyu) nRet|=SDRESC_RIGHT | SDRESC_TOP; +/*?*/ else nRet|=SDRESC_RIGHT | SDRESC_BOTTOM; +/*?*/ } +/*?*/ return nRet; +/*N*/ } +/*N*/ if (dx<dy) { // waagerecht +/*N*/ if (bxMitt) return SDRESC_HORZ; +/*N*/ if (dxl<dxr) return SDRESC_LEFT; +/*N*/ else return SDRESC_RIGHT; +/*N*/ } else { // senkrecht +/*N*/ if (byMitt) return SDRESC_VERT; +/*N*/ if (dyo<dyu) return SDRESC_TOP; +/*N*/ else return SDRESC_BOTTOM; +/*N*/ } +/*N*/ } + + +/*N*/ XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, const Rectangle& rRect, const Point& rMeeting) const +/*N*/ { +/*N*/ XPolygon aXP; +/*N*/ aXP.Insert(XPOLY_APPEND,rStPt,XPOLY_NORMAL); +/*N*/ FASTBOOL bRts=nEscAngle==0; +/*N*/ FASTBOOL bObn=nEscAngle==9000; +/*N*/ FASTBOOL bLks=nEscAngle==18000; +/*N*/ FASTBOOL bUnt=nEscAngle==27000; +/*N*/ FASTBOOL bHor=bLks || bRts; +/*N*/ FASTBOOL bVer=bObn || bUnt; +/*N*/ +/*N*/ Point aP1(rStPt); // erstmal den Pflichtabstand +/*N*/ if (bLks) aP1.X()=rRect.Left(); +/*N*/ if (bRts) aP1.X()=rRect.Right(); +/*N*/ if (bObn) aP1.Y()=rRect.Top(); +/*N*/ if (bUnt) aP1.Y()=rRect.Bottom(); +/*N*/ +/*N*/ FASTBOOL bFinish=FALSE; +/*N*/ if (!bFinish) { +/*N*/ Point aP2(aP1); // Und nun den Pflichtabstand ggf. bis auf Meetinghoehe erweitern +/*N*/ if (bLks && rMeeting.X()<=aP2.X()) aP2.X()=rMeeting.X(); +/*N*/ if (bRts && rMeeting.X()>=aP2.X()) aP2.X()=rMeeting.X(); +/*N*/ if (bObn && rMeeting.Y()<=aP2.Y()) aP2.Y()=rMeeting.Y(); +/*N*/ if (bUnt && rMeeting.Y()>=aP2.Y()) aP2.Y()=rMeeting.Y(); +/*N*/ aXP.Insert(XPOLY_APPEND,aP2,XPOLY_NORMAL); +/*N*/ +/*N*/ Point aP3(aP2); +/*N*/ if ((bLks && rMeeting.X()>aP2.X()) || (bRts && rMeeting.X()<aP2.X())) { // Aussenrum +/*N*/ if (rMeeting.Y()<aP2.Y()) { +/*N*/ aP3.Y()=rRect.Top(); +/*N*/ if (rMeeting.Y()<aP3.Y()) aP3.Y()=rMeeting.Y(); +/*N*/ } else { +/*N*/ aP3.Y()=rRect.Bottom(); +/*N*/ if (rMeeting.Y()>aP3.Y()) aP3.Y()=rMeeting.Y(); +/*N*/ } +/*N*/ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL); +/*N*/ if (aP3.Y()!=rMeeting.Y()) { +/*N*/ aP3.X()=rMeeting.X(); +/*N*/ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL); +/*N*/ } +/*N*/ } +/*N*/ if ((bObn && rMeeting.Y()>aP2.Y()) || (bUnt && rMeeting.Y()<aP2.Y())) { // Aussenrum +/*N*/ if (rMeeting.X()<aP2.X()) { +/*N*/ aP3.X()=rRect.Left(); +/*N*/ if (rMeeting.X()<aP3.X()) aP3.X()=rMeeting.X(); +/*N*/ } else { +/*N*/ aP3.X()=rRect.Right(); +/*N*/ if (rMeeting.X()>aP3.X()) aP3.X()=rMeeting.X(); +/*N*/ } +/*N*/ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL); +/*N*/ if (aP3.X()!=rMeeting.X()) { +/*N*/ aP3.Y()=rMeeting.Y(); +/*N*/ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ #ifdef DBG_UTIL +/*N*/ if (aXP.GetPointCount()>4) { +/*N*/ DBG_ERROR("SdrEdgeObj::ImpCalcObjToCenter(): Polygon hat mehr als 4 Punkte!"); +/*N*/ } +/*N*/ #endif +/*N*/ return aXP; +/*N*/ } + +/*N*/ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const +/*N*/ { +/*N*/ Point aPt1,aPt2; +/*N*/ SdrGluePoint aGP1,aGP2; +/*N*/ USHORT nEsc1=SDRESC_ALL,nEsc2=SDRESC_ALL; +/*N*/ Rectangle aBoundRect1; +/*N*/ Rectangle aBoundRect2; +/*N*/ Rectangle aBewareRect1; +/*N*/ Rectangle aBewareRect2; +/*N*/ // Erstmal die alten Endpunkte wiederholen +/*N*/ if (rTrack0.GetPointCount()!=0) { +/*N*/ aPt1=rTrack0[0]; +/*N*/ USHORT nSiz=rTrack0.GetPointCount(); +/*N*/ nSiz--; +/*N*/ aPt2=rTrack0[nSiz]; +/*N*/ } else { +/*?*/ if (!aOutRect.IsEmpty()) { +/*?*/ aPt1=aOutRect.TopLeft(); +/*?*/ aPt2=aOutRect.BottomRight(); +/*?*/ } +/*N*/ } +/*N*/ FASTBOOL bCon1=rCon1.pObj!=NULL && rCon1.pObj->GetPage()==pPage && rCon1.pObj->IsInserted(); +/*N*/ FASTBOOL bCon2=rCon2.pObj!=NULL && rCon2.pObj->GetPage()==pPage && rCon2.pObj->IsInserted(); +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ if (bCon1) { +/*N*/ if (rCon1.pObj==(SdrObject*)this) { // sicherheitshalber Abfragen #44515# +/*?*/ aBoundRect1=aOutRect; +/*N*/ } else { +/*N*/ aBoundRect1=rCon1.pObj->GetBoundRect(); +/*N*/ } +/*N*/ aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y()); +/*N*/ aBewareRect1=aBoundRect1; +/*N*/ +/*N*/ sal_Int32 nH = ((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue(); +/*N*/ sal_Int32 nV = ((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue(); +/*N*/ +/*N*/ aBewareRect1.Left()-=nH; +/*N*/ aBewareRect1.Right()+=nH; +/*N*/ aBewareRect1.Top()-=nV; +/*N*/ aBewareRect1.Bottom()+=nV; +/*N*/ } else { +/*N*/ aBoundRect1=Rectangle(aPt1,aPt1); +/*N*/ aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y()); +/*N*/ aBewareRect1=aBoundRect1; +/*N*/ } +/*N*/ if (bCon2) { +/*N*/ if (rCon2.pObj==(SdrObject*)this) { // sicherheitshalber Abfragen #44515# +/*N*/ aBoundRect2=aOutRect; +/*N*/ } else { +/*N*/ aBoundRect2=rCon2.pObj->GetBoundRect(); +/*N*/ } +/*N*/ aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y()); +/*N*/ aBewareRect2=aBoundRect2; +/*N*/ +/*N*/ sal_Int32 nH = ((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue(); +/*N*/ sal_Int32 nV = ((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue(); +/*N*/ +/*N*/ aBewareRect2.Left()-=nH; +/*N*/ aBewareRect2.Right()+=nH; +/*N*/ aBewareRect2.Top()-=nV; +/*N*/ aBewareRect2.Bottom()+=nV; +/*N*/ } else { +/*N*/ aBoundRect2=Rectangle(aPt2,aPt2); +/*N*/ aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y()); +/*N*/ aBewareRect2=aBoundRect2; +/*N*/ } +/*N*/ XPolygon aBestXP; +/*N*/ ULONG nBestQual=0xFFFFFFFF; +/*N*/ SdrEdgeInfoRec aBestInfo; +/*N*/ FASTBOOL bAuto1=bCon1 && rCon1.bBestVertex; +/*N*/ FASTBOOL bAuto2=bCon2 && rCon2.bBestVertex; +/*N*/ if (bAuto1) rCon1.bAutoVertex=TRUE; +/*N*/ if (bAuto2) rCon2.bAutoVertex=TRUE; +/*N*/ USHORT nBestAuto1=0; +/*N*/ USHORT nBestAuto2=0; +/*N*/ USHORT nAnz1=bAuto1 ? 4 : 1; +/*N*/ USHORT nAnz2=bAuto2 ? 4 : 1; +/*N*/ for (USHORT nNum1=0; nNum1<nAnz1; nNum1++) { +/*N*/ if (bAuto1) rCon1.nConId=nNum1; +/*N*/ if (bCon1 && rCon1.TakeGluePoint(aGP1,TRUE)) { +/*N*/ aPt1=aGP1.GetPos(); +/*N*/ nEsc1=aGP1.GetEscDir(); +/*N*/ if (nEsc1==SDRESC_SMART) nEsc1=ImpCalcEscAngle(rCon1.pObj,aPt1-rCon1.aObjOfs); +/*N*/ } +/*N*/ for (USHORT nNum2=0; nNum2<nAnz2; nNum2++) { +/*N*/ if (bAuto2) rCon2.nConId=nNum2; +/*N*/ if (bCon2 && rCon2.TakeGluePoint(aGP2,TRUE)) { +/*N*/ aPt2=aGP2.GetPos(); +/*N*/ nEsc2=aGP2.GetEscDir(); +/*N*/ if (nEsc2==SDRESC_SMART) nEsc2=ImpCalcEscAngle(rCon2.pObj,aPt2-rCon2.aObjOfs); +/*N*/ } +/*N*/ for (long nA1=0; nA1<36000; nA1+=9000) { +/*N*/ USHORT nE1=nA1==0 ? SDRESC_RIGHT : nA1==9000 ? SDRESC_TOP : nA1==18000 ? SDRESC_LEFT : nA1==27000 ? SDRESC_BOTTOM : 0; +/*N*/ for (long nA2=0; nA2<36000; nA2+=9000) { +/*N*/ USHORT nE2=nA2==0 ? SDRESC_RIGHT : nA2==9000 ? SDRESC_TOP : nA2==18000 ? SDRESC_LEFT : nA2==27000 ? SDRESC_BOTTOM : 0; +/*N*/ if ((nEsc1&nE1)!=0 && (nEsc2&nE2)!=0) { +/*N*/ ULONG nQual=0; +/*N*/ SdrEdgeInfoRec aInfo; +/*N*/ if (pInfo!=NULL) aInfo=*pInfo; +/*N*/ XPolygon aXP(ImpCalcEdgeTrack(aPt1,nA1,aBoundRect1,aBewareRect1,aPt2,nA2,aBoundRect2,aBewareRect2,&nQual,&aInfo)); +/*N*/ if (nQual<nBestQual) { +/*N*/ aBestXP=aXP; +/*N*/ nBestQual=nQual; +/*N*/ aBestInfo=aInfo; +/*N*/ nBestAuto1=nNum1; +/*N*/ nBestAuto2=nNum2; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (bAuto1) rCon1.nConId=nBestAuto1; +/*N*/ if (bAuto2) rCon2.nConId=nBestAuto2; +/*N*/ if (pInfo!=NULL) *pInfo=aBestInfo; +/*N*/ return aBestXP; +/*N*/ } + +/*N*/ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rectangle& rBoundRect1, const Rectangle& rBewareRect1, +/*N*/ const Point& rPt2, long nAngle2, const Rectangle& rBoundRect2, const Rectangle& rBewareRect2, +/*N*/ ULONG* pnQuality, SdrEdgeInfoRec* pInfo) const +/*N*/ { +/*N*/ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetItem(SDRATTR_EDGEKIND))).GetValue(); +/*N*/ FASTBOOL bRts1=nAngle1==0; +/*N*/ FASTBOOL bObn1=nAngle1==9000; +/*N*/ FASTBOOL bLks1=nAngle1==18000; +/*N*/ FASTBOOL bUnt1=nAngle1==27000; +/*N*/ FASTBOOL bHor1=bLks1 || bRts1; +/*N*/ FASTBOOL bVer1=bObn1 || bUnt1; +/*N*/ FASTBOOL bRts2=nAngle2==0; +/*N*/ FASTBOOL bObn2=nAngle2==9000; +/*N*/ FASTBOOL bLks2=nAngle2==18000; +/*N*/ FASTBOOL bUnt2=nAngle2==27000; +/*N*/ FASTBOOL bHor2=bLks2 || bRts2; +/*N*/ FASTBOOL bVer2=bObn2 || bUnt2; +/*N*/ FASTBOOL bInfo=pInfo!=NULL; +/*N*/ if (bInfo) { +/*N*/ pInfo->cOrthoForm=0; +/*N*/ pInfo->nAngle1=nAngle1; +/*N*/ pInfo->nAngle2=nAngle2; +/*N*/ pInfo->nObj1Lines=1; +/*N*/ pInfo->nObj2Lines=1; +/*N*/ pInfo->nMiddleLine=0xFFFF; +/*N*/ } +/*N*/ Point aPt1(rPt1); +/*N*/ Point aPt2(rPt2); +/*N*/ Rectangle aBoundRect1 (rBoundRect1 ); +/*N*/ Rectangle aBoundRect2 (rBoundRect2 ); +/*N*/ Rectangle aBewareRect1(rBewareRect1); +/*N*/ Rectangle aBewareRect2(rBewareRect2); +/*N*/ Point aMeeting((aPt1.X()+aPt2.X()+1)/2,(aPt1.Y()+aPt2.Y()+1)/2); +/*N*/ FASTBOOL bMeetingXMid=TRUE; +/*N*/ FASTBOOL bMeetingYMid=TRUE; +/*N*/ if (eKind==SDREDGE_ONELINE) { +/*?*/ XPolygon aXP(2); +/*?*/ aXP[0]=rPt1; +/*?*/ aXP[1]=rPt2; +/*?*/ if (pnQuality!=NULL) { +/*?*/ *pnQuality=Abs(rPt1.X()-rPt2.X())+Abs(rPt1.Y()-rPt2.Y()); +/*?*/ } +/*?*/ return aXP; +/*N*/ } else if (eKind==SDREDGE_THREELINES) { +/*?*/ XPolygon aXP(4); +/*?*/ aXP[0]=rPt1; +/*?*/ aXP[1]=rPt1; +/*?*/ aXP[2]=rPt2; +/*?*/ aXP[3]=rPt2; +/*?*/ if (bRts1) aXP[1].X()=aBewareRect1.Right(); //+=500; +/*?*/ if (bObn1) aXP[1].Y()=aBewareRect1.Top(); //-=500; +/*?*/ if (bLks1) aXP[1].X()=aBewareRect1.Left(); //-=500; +/*?*/ if (bUnt1) aXP[1].Y()=aBewareRect1.Bottom(); //+=500; +/*?*/ if (bRts2) aXP[2].X()=aBewareRect2.Right(); //+=500; +/*?*/ if (bObn2) aXP[2].Y()=aBewareRect2.Top(); //-=500; +/*?*/ if (bLks2) aXP[2].X()=aBewareRect2.Left(); //-=500; +/*?*/ if (bUnt2) aXP[2].Y()=aBewareRect2.Bottom(); //+=500; +/*?*/ if (pnQuality!=NULL) { +/*?*/ long nQ=Abs(aXP[1].X()-aXP[0].X())+Abs(aXP[1].Y()-aXP[0].Y()); +/*?*/ nQ+=Abs(aXP[2].X()-aXP[1].X())+Abs(aXP[2].Y()-aXP[1].Y()); +/*?*/ nQ+=Abs(aXP[3].X()-aXP[2].X())+Abs(aXP[3].Y()-aXP[2].Y()); +/*?*/ *pnQuality=nQ; +/*?*/ } +/*?*/ USHORT n1=1; +/*?*/ USHORT n2=1; +/*?*/ if (bInfo) { +/*?*/ pInfo->nObj1Lines=2; +/*?*/ pInfo->nObj2Lines=2; +/*?*/ if (bHor1) { +/*?*/ aXP[1].X()+=pInfo->aObj1Line2.X(); +/*?*/ } else { +/*?*/ aXP[1].Y()+=pInfo->aObj1Line2.Y(); +/*?*/ } +/*?*/ if (bHor2) { +/*?*/ aXP[2].X()+=pInfo->aObj2Line2.X(); +/*?*/ } else { +/*?*/ aXP[2].Y()+=pInfo->aObj2Line2.Y(); +/*?*/ } +/*?*/ } +/*?*/ return aXP; +/*N*/ } +/*N*/ USHORT nIntersections=0; +/*N*/ FASTBOOL bForceMeeting=FALSE; // Muss die Linie durch den MeetingPoint laufen? +/*N*/ { +/*N*/ Point aC1(aBewareRect1.Center()); +/*N*/ Point aC2(aBewareRect2.Center()); +/*N*/ if (aBewareRect1.Left()<=aBewareRect2.Right() && aBewareRect1.Right()>=aBewareRect2.Left()) { +/*N*/ // Ueberschneidung auf der X-Achse +/*N*/ long n1=Max(aBewareRect1.Left(),aBewareRect2.Left()); +/*N*/ long n2=Min(aBewareRect1.Right(),aBewareRect2.Right()); +/*N*/ aMeeting.X()=(n1+n2+1)/2; +/*N*/ } else { +/*N*/ // Ansonsten den Mittelpunkt des Freiraums +/*N*/ if (aC1.X()<aC2.X()) { +/*N*/ aMeeting.X()=(aBewareRect1.Right()+aBewareRect2.Left()+1)/2; +/*N*/ } else { +/*N*/ aMeeting.X()=(aBewareRect1.Left()+aBewareRect2.Right()+1)/2; +/*N*/ } +/*N*/ } +/*N*/ if (aBewareRect1.Top()<=aBewareRect2.Bottom() && aBewareRect1.Bottom()>=aBewareRect2.Top()) { +/*N*/ // Ueberschneidung auf der Y-Achse +/*N*/ long n1=Max(aBewareRect1.Top(),aBewareRect2.Top()); +/*N*/ long n2=Min(aBewareRect1.Bottom(),aBewareRect2.Bottom()); +/*N*/ aMeeting.Y()=(n1+n2+1)/2; +/*N*/ } else { +/*N*/ // Ansonsten den Mittelpunkt des Freiraums +/*N*/ if (aC1.Y()<aC2.Y()) { +/*N*/ aMeeting.Y()=(aBewareRect1.Bottom()+aBewareRect2.Top()+1)/2; +/*N*/ } else { +/*N*/ aMeeting.Y()=(aBewareRect1.Top()+aBewareRect2.Bottom()+1)/2; +/*N*/ } +/*N*/ } +/*N*/ // Im Prinzip gibt es 3 zu unterscheidene Faelle: +/*N*/ // 1. Beide in die selbe Richtung +/*N*/ // 2. Beide in genau entgegengesetzte Richtungen +/*N*/ // 3. Einer waagerecht und der andere senkrecht +/*N*/ long nXMin=Min(aBewareRect1.Left(),aBewareRect2.Left()); +/*N*/ long nXMax=Max(aBewareRect1.Right(),aBewareRect2.Right()); +/*N*/ long nYMin=Min(aBewareRect1.Top(),aBewareRect2.Top()); +/*N*/ long nYMax=Max(aBewareRect1.Bottom(),aBewareRect2.Bottom()); +/*N*/ FASTBOOL bBoundOverlap=aBoundRect1.Right()>aBoundRect2.Left() && aBoundRect1.Left()<aBoundRect2.Right() && +/*N*/ aBoundRect1.Bottom()>aBoundRect2.Top() && aBoundRect1.Top()<aBoundRect2.Bottom(); +/*N*/ FASTBOOL bBewareOverlap=aBewareRect1.Right()>aBewareRect2.Left() && aBewareRect1.Left()<aBewareRect2.Right() && +/*N*/ aBewareRect1.Bottom()>aBewareRect2.Top() && aBewareRect1.Top()<aBewareRect2.Bottom(); +/*N*/ unsigned nMainCase=3; +/*N*/ if (nAngle1==nAngle2) nMainCase=1; +/*N*/ else if ((bHor1 && bHor2) || (bVer1 && bVer2)) nMainCase=2; +/*N*/ if (nMainCase==1) { // Fall 1: Beide in eine Richtung moeglich. +/*N*/ if (bVer1) aMeeting.X()=(aPt1.X()+aPt2.X()+1)/2; // ist hier besser, als der +/*N*/ if (bHor1) aMeeting.Y()=(aPt1.Y()+aPt2.Y()+1)/2; // Mittelpunkt des Freiraums +/*N*/ // bX1Ok bedeutet, dass die Vertikale, die aus Obj1 austritt, keinen Konflikt mit Obj2 bildet, ... +/*N*/ FASTBOOL bX1Ok=aPt1.X()<=aBewareRect2.Left() || aPt1.X()>=aBewareRect2.Right(); +/*N*/ FASTBOOL bX2Ok=aPt2.X()<=aBewareRect1.Left() || aPt2.X()>=aBewareRect1.Right(); +/*N*/ FASTBOOL bY1Ok=aPt1.Y()<=aBewareRect2.Top() || aPt1.Y()>=aBewareRect2.Bottom(); +/*N*/ FASTBOOL bY2Ok=aPt2.Y()<=aBewareRect1.Top() || aPt2.Y()>=aBewareRect1.Bottom(); +/*N*/ if (bLks1 && (bY1Ok || aBewareRect1.Left()<aBewareRect2.Right()) && (bY2Ok || aBewareRect2.Left()<aBewareRect1.Right())) { +/*N*/ aMeeting.X()=nXMin; +/*N*/ bMeetingXMid=FALSE; +/*N*/ } +/*N*/ if (bRts1 && (bY1Ok || aBewareRect1.Right()>aBewareRect2.Left()) && (bY2Ok || aBewareRect2.Right()>aBewareRect1.Left())) { +/*N*/ aMeeting.X()=nXMax; +/*N*/ bMeetingXMid=FALSE; +/*N*/ } +/*N*/ if (bObn1 && (bX1Ok || aBewareRect1.Top()<aBewareRect2.Bottom()) && (bX2Ok || aBewareRect2.Top()<aBewareRect1.Bottom())) { +/*N*/ aMeeting.Y()=nYMin; +/*N*/ bMeetingYMid=FALSE; +/*N*/ } +/*N*/ if (bUnt1 && (bX1Ok || aBewareRect1.Bottom()>aBewareRect2.Top()) && (bX2Ok || aBewareRect2.Bottom()>aBewareRect1.Top())) { +/*N*/ aMeeting.Y()=nYMax; +/*N*/ bMeetingYMid=FALSE; +/*N*/ } +/*N*/ } else if (nMainCase==2) { +/*N*/ // Fall 2: +/*N*/ bForceMeeting=TRUE; +/*N*/ if (bHor1) { // beide waagerecht +/*N*/ // 9 Moeglichkeiten: ??? +/*N*/ // 2.1 Gegenueber, Ueberschneidung ??? +/*N*/ // nur auf der Y-Achse ??? +/*N*/ // 2.2, 2.3 Gegenueber, vertikal versetzt. ??? ??? +/*N*/ // Ueberschneidung weder auf der ??? ??? +/*N*/ // X- noch auf der Y-Achse ??? ??? +/*N*/ // 2.4, 2.5 Untereinander, ??? ??? +/*N*/ // Ueberschneidung ??? ??? +/*N*/ // nur auf X-Achse ??? ??? +/*N*/ // 2.6, 2.7 Gegeneinander, vertikal versetzt. ??? ??? +/*N*/ // Ueberschneidung weder auf der ??? ??? +/*N*/ // X- noch auf der Y-Achse. ??? ??? +/*N*/ // 2.8 Gegeneinander. ??? +/*N*/ // Ueberschneidung nur ??? +/*N*/ // auf der Y-Achse. ??? +/*N*/ // 2.9 Die BewareRects der Objekte ueberschneiden +/*N*/ // sich auf X- und Y-Achse. +/*N*/ // Die Faelle gelten entsprechend umgesetzt auch fuer +/*N*/ // senkrechte Linienaustritte. +/*N*/ // Die Faelle 2.1-2.7 werden mir dem Default-Meeting ausreichend +/*N*/ // gut behandelt. Spezielle MeetingPoints werden hier also nur +/*N*/ // fuer 2.8 und 2.9 bestimmt. +/*N*/ +/*N*/ // Normalisierung. aR1 soll der nach rechts und +/*N*/ // aR2 der nach links austretende sein. +/*N*/ Rectangle aBewR1(bRts1 ? aBewareRect1 : aBewareRect2); +/*N*/ Rectangle aBewR2(bRts1 ? aBewareRect2 : aBewareRect1); +/*N*/ Rectangle aBndR1(bRts1 ? aBoundRect1 : aBoundRect2); +/*N*/ Rectangle aBndR2(bRts1 ? aBoundRect2 : aBoundRect1); +/*N*/ if (aBewR1.Bottom()>aBewR2.Top() && aBewR1.Top()<aBewR2.Bottom()) { +/*N*/ // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9 +/*N*/ if (aBewR1.Right()>aBewR2.Left()) { +/*N*/ // Faelle 2.8, 2.9 +/*N*/ // Fall 2.8 ist immer Aussenrumlauf (bDirect=FALSE). +/*N*/ // Fall 2.9 kann auch Direktverbindung sein (bei geringer +/*N*/ // Ueberschneidung der BewareRects ohne Ueberschneidung der +/*N*/ // Boundrects wenn die Linienaustritte sonst das BewareRect +/*N*/ // des jeweils anderen Objekts verletzen wuerden. +/*N*/ FASTBOOL bCase29Direct=FALSE; +/*N*/ FASTBOOL bCase29=aBewR1.Right()>aBewR2.Left(); +/*N*/ if (aBndR1.Right()<=aBndR2.Left()) { // Fall 2.9 und keine Boundrectueberschneidung +/*?*/ if ((aPt1.Y()>aBewareRect2.Top() && aPt1.Y()<aBewareRect2.Bottom()) || +/*?*/ (aPt2.Y()>aBewareRect1.Top() && aPt2.Y()<aBewareRect1.Bottom())) { +/*N*/ bCase29Direct=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (!bCase29Direct) { +/*N*/ FASTBOOL bObenLang=Abs(nYMin-aMeeting.Y())<=Abs(nYMax-aMeeting.Y()); +/*N*/ if (bObenLang) { +/*N*/ aMeeting.Y()=nYMin; +/*N*/ } else { +/*?*/ aMeeting.Y()=nYMax; +/*N*/ } +/*N*/ bMeetingYMid=FALSE; +/*N*/ if (bCase29) { +/*N*/ // und nun noch dafuer sorgen, dass das +/*N*/ // umzingelte Obj nicht durchquert wird +/*N*/ if (aBewR1.Center().Y()<aBewR2.Center().Y() != bObenLang) { +/*N*/ aMeeting.X()=aBewR2.Right(); +/*N*/ } else { +/*N*/ aMeeting.X()=aBewR1.Left(); +/*N*/ } +/*N*/ bMeetingXMid=FALSE; +/*N*/ } +/*N*/ } else { +/*N*/ // Direkte Verbindung (3-Linien Z-Verbindung), da +/*N*/ // Verletzung der BewareRects unvermeidlich ist. +/*?*/ // Via Dreisatz werden die BewareRects nun verkleinert. +/*?*/ long nWant1=aBewR1.Right()-aBndR1.Right(); // Abstand bei Obj1 +/*?*/ long nWant2=aBndR2.Left()-aBewR2.Left(); // Abstand bei Obj2 +/*?*/ long nSpace=aBndR2.Left()-aBndR1.Right(); // verfuegbarer Platz +/*?*/ long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2); +/*?*/ long nGet2=nSpace-nGet1; +/*?*/ if (bRts1) { // Normalisierung zurueckwandeln +/*?*/ aBewareRect1.Right()+=nGet1-nWant1; +/*?*/ aBewareRect2.Left()-=nGet2-nWant2; +/*?*/ } else { +/*?*/ aBewareRect2.Right()+=nGet1-nWant1; +/*?*/ aBewareRect1.Left()-=nGet2-nWant2; +/*?*/ } +/*?*/ nIntersections++; // Qualitaet herabsetzen +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } else if (bVer1) { // beide senkrecht +/*N*/ Rectangle aBewR1(bUnt1 ? aBewareRect1 : aBewareRect2); +/*N*/ Rectangle aBewR2(bUnt1 ? aBewareRect2 : aBewareRect1); +/*N*/ Rectangle aBndR1(bUnt1 ? aBoundRect1 : aBoundRect2); +/*N*/ Rectangle aBndR2(bUnt1 ? aBoundRect2 : aBoundRect1); +/*N*/ if (aBewR1.Right()>aBewR2.Left() && aBewR1.Left()<aBewR2.Right()) { +/*N*/ // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9 +/*N*/ if (aBewR1.Bottom()>aBewR2.Top()) { +/*N*/ // Faelle 2.8, 2.9 +/*N*/ // Fall 2.8 ist immer Aussenrumlauf (bDirect=FALSE). +/*N*/ // Fall 2.9 kann auch Direktverbindung sein (bei geringer +/*N*/ // Ueberschneidung der BewareRects ohne Ueberschneidung der +/*N*/ // Boundrects wenn die Linienaustritte sonst das BewareRect +/*N*/ // des jeweils anderen Objekts verletzen wuerden. +/*N*/ FASTBOOL bCase29Direct=FALSE; +/*N*/ FASTBOOL bCase29=aBewR1.Bottom()>aBewR2.Top(); +/*N*/ if (aBndR1.Bottom()<=aBndR2.Top()) { // Fall 2.9 und keine Boundrectueberschneidung +/*N*/ if ((aPt1.X()>aBewareRect2.Left() && aPt1.X()<aBewareRect2.Right()) || +/*N*/ (aPt2.X()>aBewareRect1.Left() && aPt2.X()<aBewareRect1.Right())) { +/*N*/ bCase29Direct=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (!bCase29Direct) { +/*N*/ FASTBOOL bLinksLang=Abs(nXMin-aMeeting.X())<=Abs(nXMax-aMeeting.X()); +/*N*/ if (bLinksLang) { +/*N*/ aMeeting.X()=nXMin; +/*N*/ } else { +/*N*/ aMeeting.X()=nXMax; +/*N*/ } +/*N*/ bMeetingXMid=FALSE; +/*N*/ if (bCase29) { +/*N*/ // und nun noch dafuer sorgen, dass das +/*N*/ // umzingelte Obj nicht durchquert wird +/*N*/ if (aBewR1.Center().X()<aBewR2.Center().X() != bLinksLang) { +/*N*/ aMeeting.Y()=aBewR2.Bottom(); +/*N*/ } else { +/*N*/ aMeeting.Y()=aBewR1.Top(); +/*N*/ } +/*N*/ bMeetingYMid=FALSE; +/*N*/ } +/*N*/ } else { +/*N*/ // Direkte Verbindung (3-Linien Z-Verbindung), da +/*N*/ // Verletzung der BewareRects unvermeidlich ist. +/*N*/ // Via Dreisatz werden die BewareRects nun verkleinert. +/*N*/ long nWant1=aBewR1.Bottom()-aBndR1.Bottom(); // Abstand bei Obj1 +/*N*/ long nWant2=aBndR2.Top()-aBewR2.Top(); // Abstand bei Obj2 +/*N*/ long nSpace=aBndR2.Top()-aBndR1.Bottom(); // verfuegbarer Platz +/*N*/ long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2); +/*N*/ long nGet2=nSpace-nGet1; +/*N*/ if (bUnt1) { // Normalisierung zurueckwandeln +/*?*/ aBewareRect1.Bottom()+=nGet1-nWant1; +/*?*/ aBewareRect2.Top()-=nGet2-nWant2; +/*N*/ } else { +/*N*/ aBewareRect2.Bottom()+=nGet1-nWant1; +/*N*/ aBewareRect1.Top()-=nGet2-nWant2; +/*N*/ } +/*N*/ nIntersections++; // Qualitaet herabsetzen +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } else if (nMainCase==3) { // Fall 3: Einer waagerecht und der andere senkrecht. Sehr viele Fallunterscheidungen +/*N*/ // Kleine Legende: ?????-> Ohne Ueberschneidung, maximal Beruehrung. +/*N*/ // ?????-> Ueberschneidung +/*N*/ // ?????-> Selbe Hoehe +/*N*/ // ?????-> Ueberschneidung +/*N*/ // ?????-> Ohne Ueberschneidung, maximal Beruehrung. +/*N*/ // Linienaustritte links ? rechts ? oben ?und unten ? +/*N*/ // Insgesamt sind 96 Konstellationen moeglich, wobei einige nicht einmal +/*N*/ // eindeutig einem Fall und damit einer Behandlungsmethode zugeordnet werden +/*N*/ // koennen. +/*N*/ // 3.1: Hierzu moegen alle Konstellationen zaehlen, die durch den +/*N*/ // Default-MeetingPoint zufriedenstellend abgedeckt sind (20+12). +/*N*/ // ????? ????? Diese 12 ????? ????? ????? ????? +/*N*/ // ????? ????? Konstel. ????? ????? ????? ????? +/*N*/ // ????? ????? jedoch ????? ????? ????? ????? +/*N*/ // ????? ????? nur zum ????? ????? ????? ????? +/*N*/ // ????? ????? Teil: ????? ????? ????? ????? +/*N*/ // Letztere 16 Faelle scheiden aus, sobald sich die Objekte offen +/*N*/ // gegenueberstehen (siehe Fall 3.2). +/*N*/ // 3.2: Die Objekte stehen sich offen gegenueber und somit ist eine +/*N*/ // Verbindung mit lediglich 2 Linien moeglich (4+20). +/*N*/ // Dieser Fall hat 1. Prioritaet. +/*N*/ // ????? ????? Diese 20 ????? ????? ????? ????? +/*N*/ // ????? ????? Konstel. ????? ????? ????? ????? +/*N*/ // ????? ????? jedoch ????? ????? ????? ????? +/*N*/ // ????? ????? nur zum ????? ????? ????? ????? +/*N*/ // ????? ????? Teil: ????? ????? ????? ????? +/*N*/ // 3.3: Die Linienaustritte zeigen vom anderen Objekt weg bzw. hinter +/*N*/ // dessen Ruecken vorbei (52+4). +/*N*/ // ????? ????? ????? ????? Diese 4 ????? ????? +/*N*/ // ????? ????? ????? ????? Konstel. ????? ????? +/*N*/ // ????? ????? ????? ????? jedoch ????? ????? +/*N*/ // ????? ????? ????? ????? nur zum ????? ????? +/*N*/ // ????? ????? ????? ????? Teil: ????? ????? +/*N*/ +/*N*/ // Fall 3.2 +/*N*/ Rectangle aTmpR1(aBewareRect1); +/*N*/ Rectangle aTmpR2(aBewareRect2); +/*N*/ if (bBewareOverlap) { +/*N*/ // Ueberschneidung der BewareRects: BoundRects fuer Check auf Fall 3.2 verwenden. +/*N*/ aTmpR1=aBoundRect1; +/*N*/ aTmpR2=aBoundRect2; +/*N*/ } +/*N*/ if ((((bRts1 && aTmpR1.Right ()<=aPt2.X()) || (bLks1 && aTmpR1.Left()>=aPt2.X())) && +/*N*/ ((bUnt2 && aTmpR2.Bottom()<=aPt1.Y()) || (bObn2 && aTmpR2.Top ()>=aPt1.Y()))) || +/*N*/ (((bRts2 && aTmpR2.Right ()<=aPt1.X()) || (bLks2 && aTmpR2.Left()>=aPt1.X())) && +/*N*/ ((bUnt1 && aTmpR1.Bottom()<=aPt2.Y()) || (bObn1 && aTmpR1.Top ()>=aPt2.Y())))) { +/*N*/ // Fall 3.2 trifft zu: Verbindung mit lediglich 2 Linien +/*N*/ bForceMeeting=TRUE; +/*N*/ bMeetingXMid=FALSE; +/*N*/ bMeetingYMid=FALSE; +/*N*/ if (bHor1) { +/*N*/ aMeeting.X()=aPt2.X(); +/*N*/ aMeeting.Y()=aPt1.Y(); +/*N*/ } else { +/*N*/ aMeeting.X()=aPt1.X(); +/*N*/ aMeeting.Y()=aPt2.Y(); +/*N*/ } +/*N*/ // Falls Ueberschneidung der BewareRects: +/*N*/ aBewareRect1=aTmpR1; +/*N*/ aBewareRect2=aTmpR2; +/*N*/ } else if ((((bRts1 && aBewareRect1.Right ()>aBewareRect2.Left ()) || +/*N*/ (bLks1 && aBewareRect1.Left ()<aBewareRect2.Right ())) && +/*N*/ ((bUnt2 && aBewareRect2.Bottom()>aBewareRect1.Top ()) || +/*N*/ (bObn2 && aBewareRect2.Top ()<aBewareRect1.Bottom()))) || +/*N*/ (((bRts2 && aBewareRect2.Right ()>aBewareRect1.Left ()) || +/*N*/ (bLks2 && aBewareRect2.Left ()<aBewareRect1.Right ())) && +/*N*/ ((bUnt1 && aBewareRect1.Bottom()>aBewareRect2.Top ()) || +/*N*/ (bObn1 && aBewareRect1.Top ()<aBewareRect2.Bottom())))) { +/*N*/ // Fall 3.3 +/*N*/ bForceMeeting=TRUE; +/*N*/ if (bRts1 || bRts2) { aMeeting.X()=nXMax; bMeetingXMid=FALSE; } +/*N*/ if (bLks1 || bLks2) { aMeeting.X()=nXMin; bMeetingXMid=FALSE; } +/*N*/ if (bUnt1 || bUnt2) { aMeeting.Y()=nYMax; bMeetingYMid=FALSE; } +/*N*/ if (bObn1 || bObn2) { aMeeting.Y()=nYMin; bMeetingYMid=FALSE; } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ XPolygon aXP1(ImpCalcObjToCenter(aPt1,nAngle1,aBewareRect1,aMeeting)); +/*N*/ XPolygon aXP2(ImpCalcObjToCenter(aPt2,nAngle2,aBewareRect2,aMeeting)); +/*N*/ USHORT nXP1Anz=aXP1.GetPointCount(); +/*N*/ USHORT nXP2Anz=aXP2.GetPointCount(); +/*N*/ if (bInfo) { +/*N*/ pInfo->nObj1Lines=nXP1Anz; if (nXP1Anz>1) pInfo->nObj1Lines--; +/*N*/ pInfo->nObj2Lines=nXP2Anz; if (nXP2Anz>1) pInfo->nObj2Lines--; +/*N*/ } +/*N*/ Point aEP1(aXP1[nXP1Anz-1]); +/*N*/ Point aEP2(aXP2[nXP2Anz-1]); +/*N*/ FASTBOOL bInsMeetingPoint=aEP1.X()!=aEP2.X() && aEP1.Y()!=aEP2.Y(); +/*N*/ FASTBOOL bHorzE1=aEP1.Y()==aXP1[nXP1Anz-2].Y(); // letzte Linie von XP1 horizontal? +/*N*/ FASTBOOL bHorzE2=aEP2.Y()==aXP2[nXP2Anz-2].Y(); // letzte Linie von XP2 horizontal? +/*N*/ if (aEP1==aEP2 && (bHorzE1 && bHorzE2 && aEP1.Y()==aEP2.Y()) || (!bHorzE1 && !bHorzE2 && aEP1.X()==aEP2.X())) { +/*N*/ // Sonderbehandlung fuer 'I'-Verbinder +/*N*/ nXP1Anz--; aXP1.Remove(nXP1Anz,1); +/*N*/ nXP2Anz--; aXP2.Remove(nXP2Anz,1); +/*N*/ bMeetingXMid=FALSE; +/*N*/ bMeetingYMid=FALSE; +/*N*/ } +/*N*/ if (bInsMeetingPoint) { +/*N*/ aXP1.Insert(XPOLY_APPEND,aMeeting,XPOLY_NORMAL); +/*N*/ if (bInfo) { +/*N*/ // Durch einfuegen des MeetingPoints kommen 2 weitere Linie hinzu. +/*N*/ // Evtl. wird eine von diesen die Mittellinie. +/*N*/ if (pInfo->nObj1Lines==pInfo->nObj2Lines) { +/*N*/ pInfo->nObj1Lines++; +/*N*/ pInfo->nObj2Lines++; +/*N*/ } else { +/*N*/ if (pInfo->nObj1Lines>pInfo->nObj2Lines) { +/*N*/ pInfo->nObj2Lines++; +/*N*/ pInfo->nMiddleLine=nXP1Anz-1; +/*N*/ } else { +/*N*/ pInfo->nObj1Lines++; +/*N*/ pInfo->nMiddleLine=nXP1Anz; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } else if (bInfo && aEP1!=aEP2 && nXP1Anz+nXP2Anz>=4) { +/*N*/ // Durch Verbinden der beiden Enden kommt eine weitere Linie hinzu. +/*N*/ // Dies wird die Mittellinie. +/*N*/ pInfo->nMiddleLine=nXP1Anz-1; +/*N*/ } +/*N*/ USHORT nNum=aXP2.GetPointCount(); +/*N*/ if (aXP1[nXP1Anz-1]==aXP2[nXP2Anz-1] && nXP1Anz>1 && nXP2Anz>1) nNum--; +/*N*/ while (nNum>0) { +/*N*/ nNum--; +/*N*/ aXP1.Insert(XPOLY_APPEND,aXP2[nNum],XPOLY_NORMAL); +/*N*/ } +/*N*/ USHORT nPntAnz=aXP1.GetPointCount(); +/*N*/ char cForm=0; +/*N*/ if (bInfo || pnQuality!=NULL) { +/*N*/ cForm='?'; +/*N*/ if (nPntAnz==2) cForm='I'; +/*N*/ else if (nPntAnz==3) cForm='L'; +/*N*/ else if (nPntAnz==4) { // Z oder U +/*N*/ if (nAngle1==nAngle2) cForm='U'; +/*N*/ else cForm='Z'; +/*N*/ } else if (nPntAnz==4) { // ?? ?? +/*N*/ // ... -? -? +/*N*/ } else if (nPntAnz==6) { // S oder C oder ... +/*N*/ if (nAngle1!=nAngle2) { +/*N*/ // Fuer Typ S hat Linie2 dieselbe Richtung wie Linie4. +/*N*/ // Bei Typ C sind die beiden genau entgegengesetzt. +/*N*/ Point aP1(aXP1[1]); +/*N*/ Point aP2(aXP1[2]); +/*N*/ Point aP3(aXP1[3]); +/*N*/ Point aP4(aXP1[4]); +/*N*/ if (aP1.Y()==aP2.Y()) { // beide Linien Horz +/*N*/ if (aP1.X()<aP2.X()==aP3.X()<aP4.X()) cForm='S'; +/*N*/ else cForm='C'; +/*N*/ } else { // sonst beide Linien Vert +/*N*/ if (aP1.Y()<aP2.Y()==aP3.Y()<aP4.Y()) cForm='S'; +/*N*/ else cForm='C'; +/*N*/ } +/*N*/ } else cForm='4'; // sonst der 3. Fall mit 5 Linien +/*N*/ } else cForm='?'; // +/*N*/ // Weitere Formen: +/*N*/ if (bInfo) { +/*N*/ pInfo->cOrthoForm=cForm; +/*N*/ if (cForm=='I' || cForm=='L' || cForm=='Z' || cForm=='U') { +/*N*/ pInfo->nObj1Lines=1; +/*N*/ pInfo->nObj2Lines=1; +/*N*/ if (cForm=='Z' || cForm=='U') { +/*N*/ pInfo->nMiddleLine=1; +/*N*/ } else { +/*N*/ pInfo->nMiddleLine=0xFFFF; +/*N*/ } +/*N*/ } else if (cForm=='S' || cForm=='C') { +/*N*/ pInfo->nObj1Lines=2; +/*N*/ pInfo->nObj2Lines=2; +/*N*/ pInfo->nMiddleLine=2; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (pnQuality!=NULL) { +/*N*/ ULONG nQual=0; +/*N*/ ULONG nQual0=nQual; // Ueberlaeufe vorbeugen +/*N*/ FASTBOOL bOverflow=FALSE; +/*N*/ Point aPt0(aXP1[0]); +/*N*/ for (USHORT nPntNum=1; nPntNum<nPntAnz; nPntNum++) { +/*N*/ Point aPt1(aXP1[nPntNum]); +/*N*/ nQual+=Abs(aPt1.X()-aPt0.X())+Abs(aPt1.Y()-aPt0.Y()); +/*N*/ if (nQual<nQual0) bOverflow=TRUE; +/*N*/ nQual0=nQual; +/*N*/ aPt0=aPt1; +/*N*/ } +/*N*/ +/*N*/ USHORT nTmp=nPntAnz; +/*N*/ if (cForm=='Z') { +/*N*/ nTmp=2; // Z-Form hat gute Qualitaet (nTmp=2 statt 4) +/*N*/ ULONG n1=Abs(aXP1[1].X()-aXP1[0].X())+Abs(aXP1[1].Y()-aXP1[0].Y()); +/*N*/ ULONG n2=Abs(aXP1[2].X()-aXP1[1].X())+Abs(aXP1[2].Y()-aXP1[1].Y()); +/*N*/ ULONG n3=Abs(aXP1[3].X()-aXP1[2].X())+Abs(aXP1[3].Y()-aXP1[2].Y()); +/*N*/ // fuer moeglichst gleichlange Linien sorgen +/*N*/ ULONG nBesser=0; +/*N*/ n1+=n3; +/*N*/ n3=n2/4; +/*N*/ if (n1>=n2) nBesser=6; +/*N*/ else if (n1>=3*n3) nBesser=4; +/*N*/ else if (n1>=2*n3) nBesser=2; +/*N*/ if (aXP1[0].Y()!=aXP1[1].Y()) nBesser++; // Senkrechte Startlinie kriegt auch noch einen Pluspunkt (fuer H/V-Prio) +/*N*/ if (nQual>nBesser) nQual-=nBesser; else nQual=0; +/*N*/ } +/*N*/ if (nTmp>=3) { +/*N*/ nQual0=nQual; +/*N*/ nQual+=(ULONG)nTmp*0x01000000; +/*N*/ if (nQual<nQual0 || nTmp>15) bOverflow=TRUE; +/*N*/ } +/*N*/ if (nPntAnz>=2) { // Austrittswinkel nochmal pruefen +/*N*/ Point aP1(aXP1[1]); aP1-=aXP1[0]; +/*N*/ Point aP2(aXP1[nPntAnz-2]); aP2-=aXP1[nPntAnz-1]; +/*N*/ long nAng1=0; if (aP1.X()<0) nAng1=18000; if (aP1.Y()>0) nAng1=27000; +/*N*/ if (aP1.Y()<0) nAng1=9000; if (aP1.X()!=0 && aP1.Y()!=0) nAng1=1; // Schraeg!?! +/*N*/ long nAng2=0; if (aP2.X()<0) nAng2=18000; if (aP2.Y()>0) nAng2=27000; +/*N*/ if (aP2.Y()<0) nAng2=9000; if (aP2.X()!=0 && aP2.Y()!=0) nAng2=1; // Schraeg!?! +/*N*/ if (nAng1!=nAngle1) nIntersections++; +/*N*/ if (nAng2!=nAngle2) nIntersections++; +/*N*/ } +/*N*/ +/*N*/ // Fuer den Qualitaetscheck wieder die Original-Rects verwenden und +/*N*/ // gleichzeitig checken, ob eins fuer die Edge-Berechnung verkleinert +/*N*/ // wurde (z.B. Fall 2.9) +/*N*/ aBewareRect1=rBewareRect1; +/*N*/ aBewareRect2=rBewareRect2; +/*N*/ +/*N*/ for (USHORT i=0; i<nPntAnz; i++) { +/*N*/ Point aPt1(aXP1[i]); +/*N*/ FASTBOOL b1=aPt1.X()>aBewareRect1.Left() && aPt1.X()<aBewareRect1.Right() && +/*N*/ aPt1.Y()>aBewareRect1.Top() && aPt1.Y()<aBewareRect1.Bottom(); +/*N*/ FASTBOOL b2=aPt1.X()>aBewareRect2.Left() && aPt1.X()<aBewareRect2.Right() && +/*N*/ aPt1.Y()>aBewareRect2.Top() && aPt1.Y()<aBewareRect2.Bottom(); +/*N*/ USHORT nInt0=nIntersections; +/*N*/ if (i==0 || i==nPntAnz-1) { +/*N*/ if (b1 && b2) nIntersections++; +/*N*/ } else { +/*N*/ if (b1) nIntersections++; +/*N*/ if (b2) nIntersections++; +/*N*/ } +/*N*/ // und nun noch auf Ueberschneidungen checken +/*N*/ if (i>0 && nInt0==nIntersections) { +/*N*/ if (aPt0.Y()==aPt1.Y()) { // Horizontale Linie +/*N*/ if (aPt0.Y()>aBewareRect1.Top() && aPt0.Y()<aBewareRect1.Bottom() && +/*N*/ ((aPt0.X()<=aBewareRect1.Left() && aPt1.X()>=aBewareRect1.Right()) || +/*N*/ (aPt1.X()<=aBewareRect1.Left() && aPt0.X()>=aBewareRect1.Right()))) nIntersections++; +/*N*/ if (aPt0.Y()>aBewareRect2.Top() && aPt0.Y()<aBewareRect2.Bottom() && +/*N*/ ((aPt0.X()<=aBewareRect2.Left() && aPt1.X()>=aBewareRect2.Right()) || +/*N*/ (aPt1.X()<=aBewareRect2.Left() && aPt0.X()>=aBewareRect2.Right()))) nIntersections++; +/*N*/ } else { // Vertikale Linie +/*N*/ if (aPt0.X()>aBewareRect1.Left() && aPt0.X()<aBewareRect1.Right() && +/*N*/ ((aPt0.Y()<=aBewareRect1.Top() && aPt1.Y()>=aBewareRect1.Bottom()) || +/*N*/ (aPt1.Y()<=aBewareRect1.Top() && aPt0.Y()>=aBewareRect1.Bottom()))) nIntersections++; +/*N*/ if (aPt0.X()>aBewareRect2.Left() && aPt0.X()<aBewareRect2.Right() && +/*N*/ ((aPt0.Y()<=aBewareRect2.Top() && aPt1.Y()>=aBewareRect2.Bottom()) || +/*N*/ (aPt1.Y()<=aBewareRect2.Top() && aPt0.Y()>=aBewareRect2.Bottom()))) nIntersections++; +/*N*/ } +/*N*/ } +/*N*/ aPt0=aPt1; +/*N*/ } +/*N*/ if (nPntAnz<=1) nIntersections++; +/*N*/ nQual0=nQual; +/*N*/ nQual+=(ULONG)nIntersections*0x10000000; +/*N*/ if (nQual<nQual0 || nIntersections>15) bOverflow=TRUE; +/*N*/ +/*N*/ if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE; +/*N*/ *pnQuality=nQual; +/*N*/ } +/*N*/ if (bInfo) { // nun die Linienversaetze auf aXP1 anwenden +/*N*/ if (pInfo->nMiddleLine!=0xFFFF) { +/*N*/ USHORT nIdx=pInfo->ImpGetPolyIdx(MIDDLELINE,aXP1); +/*N*/ if (pInfo->ImpIsHorzLine(MIDDLELINE,aXP1)) { +/*N*/ aXP1[nIdx].Y()+=pInfo->aMiddleLine.Y(); +/*N*/ aXP1[nIdx+1].Y()+=pInfo->aMiddleLine.Y(); +/*N*/ } else { +/*N*/ aXP1[nIdx].X()+=pInfo->aMiddleLine.X(); +/*N*/ aXP1[nIdx+1].X()+=pInfo->aMiddleLine.X(); +/*N*/ } +/*N*/ } +/*N*/ if (pInfo->nObj1Lines>=2) { +/*N*/ USHORT nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE2,aXP1); +/*N*/ if (pInfo->ImpIsHorzLine(OBJ1LINE2,aXP1)) { +/*N*/ aXP1[nIdx].Y()+=pInfo->aObj1Line2.Y(); +/*N*/ aXP1[nIdx+1].Y()+=pInfo->aObj1Line2.Y(); +/*N*/ } else { +/*N*/ aXP1[nIdx].X()+=pInfo->aObj1Line2.X(); +/*N*/ aXP1[nIdx+1].X()+=pInfo->aObj1Line2.X(); +/*N*/ } +/*N*/ } +/*N*/ if (pInfo->nObj1Lines>=3) { +/*N*/ USHORT nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE3,aXP1); +/*N*/ if (pInfo->ImpIsHorzLine(OBJ1LINE3,aXP1)) { +/*N*/ aXP1[nIdx].Y()+=pInfo->aObj1Line3.Y(); +/*N*/ aXP1[nIdx+1].Y()+=pInfo->aObj1Line3.Y(); +/*N*/ } else { +/*N*/ aXP1[nIdx].X()+=pInfo->aObj1Line3.X(); +/*N*/ aXP1[nIdx+1].X()+=pInfo->aObj1Line3.X(); +/*N*/ } +/*N*/ } +/*N*/ if (pInfo->nObj2Lines>=2) { +/*N*/ USHORT nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE2,aXP1); +/*N*/ if (pInfo->ImpIsHorzLine(OBJ2LINE2,aXP1)) { +/*N*/ aXP1[nIdx].Y()+=pInfo->aObj2Line2.Y(); +/*N*/ aXP1[nIdx+1].Y()+=pInfo->aObj2Line2.Y(); +/*N*/ } else { +/*N*/ aXP1[nIdx].X()+=pInfo->aObj2Line2.X(); +/*N*/ aXP1[nIdx+1].X()+=pInfo->aObj2Line2.X(); +/*N*/ } +/*N*/ } +/*N*/ if (pInfo->nObj2Lines>=3) { +/*N*/ USHORT nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE3,aXP1); +/*N*/ if (pInfo->ImpIsHorzLine(OBJ2LINE3,aXP1)) { +/*N*/ aXP1[nIdx].Y()+=pInfo->aObj2Line3.Y(); +/*N*/ aXP1[nIdx+1].Y()+=pInfo->aObj2Line3.Y(); +/*N*/ } else { +/*N*/ aXP1[nIdx].X()+=pInfo->aObj2Line3.X(); +/*N*/ aXP1[nIdx+1].X()+=pInfo->aObj2Line3.X(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ // Nun mache ich ggf. aus dem Verbinder eine Bezierkurve +/*N*/ if (eKind==SDREDGE_BEZIER && nPntAnz>2) { +/*?*/ Point* pPt1=&aXP1[0]; +/*?*/ Point* pPt2=&aXP1[1]; +/*?*/ Point* pPt3=&aXP1[nPntAnz-2]; +/*?*/ Point* pPt4=&aXP1[nPntAnz-1]; +/*?*/ long dx1=pPt2->X()-pPt1->X(); +/*?*/ long dy1=pPt2->Y()-pPt1->Y(); +/*?*/ long dx2=pPt3->X()-pPt4->X(); +/*?*/ long dy2=pPt3->Y()-pPt4->Y(); +/*?*/ if (cForm=='L') { // nPntAnz==3 +/*?*/ aXP1.SetFlags(1,XPOLY_CONTROL); +/*?*/ Point aPt3(*pPt2); +/*?*/ aXP1.Insert(2,aPt3,XPOLY_CONTROL); +/*?*/ nPntAnz=aXP1.GetPointCount(); +/*?*/ pPt1=&aXP1[0]; +/*?*/ pPt2=&aXP1[1]; +/*?*/ pPt3=&aXP1[nPntAnz-2]; +/*?*/ pPt4=&aXP1[nPntAnz-1]; +/*?*/ pPt2->X()-=dx1/3; +/*?*/ pPt2->Y()-=dy1/3; +/*?*/ pPt3->X()-=dx2/3; +/*?*/ pPt3->Y()-=dy2/3; +/*?*/ } else if (nPntAnz>=4 && nPntAnz<=6) { // Z oder U oder ... +/*?*/ // fuer Alle Anderen werden die Endpunkte der Ausgangslinien +/*?*/ // erstmal zu Kontrollpunkten. Bei nPntAnz>4 ist also noch +/*?*/ // Nacharbeit erforderlich! +/*?*/ aXP1.SetFlags(1,XPOLY_CONTROL); +/*?*/ aXP1.SetFlags(nPntAnz-2,XPOLY_CONTROL); +/*?*/ // Distanz x1.5 +/*?*/ pPt2->X()+=dx1/2; +/*?*/ pPt2->Y()+=dy1/2; +/*?*/ pPt3->X()+=dx2/2; +/*?*/ pPt3->Y()+=dy2/2; +/*?*/ if (nPntAnz==5) { +/*?*/ // Vor und hinter dem Mittelpunkt jeweils +/*?*/ // noch einen Kontrollpunkt einfuegen +/*?*/ Point aCenter(aXP1[2]); +/*?*/ long dx1=aCenter.X()-aXP1[1].X(); +/*?*/ long dy1=aCenter.Y()-aXP1[1].Y(); +/*?*/ long dx2=aCenter.X()-aXP1[3].X(); +/*?*/ long dy2=aCenter.Y()-aXP1[3].Y(); +/*?*/ aXP1.Insert(2,aCenter,XPOLY_CONTROL); +/*?*/ aXP1.SetFlags(3,XPOLY_SYMMTR); +/*?*/ aXP1.Insert(4,aCenter,XPOLY_CONTROL); +/*?*/ aXP1[2].X()-=dx1/2; +/*?*/ aXP1[2].Y()-=dy1/2; +/*?*/ aXP1[3].X()-=(dx1+dx2)/4; +/*?*/ aXP1[3].Y()-=(dy1+dy2)/4; +/*?*/ aXP1[4].X()-=dx2/2; +/*?*/ aXP1[4].Y()-=dy2/2; +/*?*/ } +/*?*/ if (nPntAnz==6) { +/*?*/ Point aPt1(aXP1[2]); +/*?*/ Point aPt2(aXP1[3]); +/*?*/ aXP1.Insert(2,aPt1,XPOLY_CONTROL); +/*?*/ aXP1.Insert(5,aPt2,XPOLY_CONTROL); +/*?*/ long dx=aPt1.X()-aPt2.X(); +/*?*/ long dy=aPt1.Y()-aPt2.Y(); +/*?*/ aXP1[3].X()-=dx/2; +/*?*/ aXP1[3].Y()-=dy/2; +/*?*/ aXP1.SetFlags(3,XPOLY_SYMMTR); +/*?*/ //aXP1[4].X()+=dx/2; +/*?*/ //aXP1[4].Y()+=dy/2; +/*?*/ aXP1.Remove(4,1); // weil identisch mit aXP1[3] +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ return aXP1; +/*N*/ } + +/* +Nach einer einfachen Rechnung koennte es max. 64 unterschiedliche Verlaeufe mit +5 Linien, 32 mit 4 Linien, 16 mit 3, 8 mit 2 Linien und 4 mit 1 Linie geben=124. +Normalisiert auf 1. Austrittswinkel nach rechts bleiben dann noch 31. +Dann noch eine vertikale Spiegelung wegnormalisiert bleiben noch 16 +characteristische Verlaufszuege mit 1-5 Linien: +Mit 1 Linie (Typ 'I'): -- +Mit 2 Linien (Typ 'L'): -? +Mit 3 Linien (Typ 'U'): -? (Typ 'Z'): ? + -? -? +Mit 4 Linien: 1 ist nicht plausibel, 3 ist=2 (90deg Drehung). Verbleibt 2,4 + ?? Ú¿ � Ú¿ Ú¿ ?? + -? -? -? -? -? -? +Mit 5 Linien: nicht plausibel sind 1,2,4,5. 7 ist identisch mit 3 (Richtungsumkehr) + Bleibt also 3,6 und 8. '4' 'S' 'C' + ? ? -? ? ?? ? + ?? ?? ?? ?? � � -???? ?? � ?? + -? -? -?? -?? -? -? --??? -?? -? ?? +Insgesamt sind also 9 Grundtypen zu unterscheiden die den 400 Konstellationen +aus Objektposition und Austrittswinkeln zuzuordnen sind. +4 der 9 Grundtypen haben eine 'Mittellinie'. Die Anzahl der zu Objektabstaende +je Objekt variiert von 0-3: + Mi O1 O2 Anmerkung +'I': n 0 0 +'L': n 0 0 +'U': n 0-1 0-1 +'Z': j 0 0 +4.1: j 0 1 = U+1 bzw. 1+U +4.2: n 0-2 0-2 = Z+1 +'4': j 0 2 = Z+2 +'S': j 1 1 = 1+Z+1 +'C': n 0-3 0-3 = 1+U+1 +*/ + +/*N*/ void __EXPORT SdrEdgeObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId&, const SfxHint& rHint, const TypeId&) +/*N*/ { +/*N*/ SfxSimpleHint* pSimple=PTR_CAST(SfxSimpleHint,&rHint); +/*N*/ ULONG nId=pSimple==0 ? 0 : pSimple->GetId(); +/*N*/ FASTBOOL bDataChg=nId==SFX_HINT_DATACHANGED; +/*N*/ FASTBOOL bDying=nId==SFX_HINT_DYING; +/*N*/ FASTBOOL bObj1=aCon1.pObj!=NULL && aCon1.pObj->GetBroadcaster()==&rBC; +/*N*/ FASTBOOL bObj2=aCon2.pObj!=NULL && aCon2.pObj->GetBroadcaster()==&rBC; +/*N*/ if (bDying && (bObj1 || bObj2)) { +/*N*/ // #35605# Dying vorher abfangen, damit AttrObj nicht +/*N*/ // wg. vermeintlicher Vorlagenaenderung rumbroadcastet +/*N*/ if (bObj1) aCon1.pObj=NULL; +/*N*/ if (bObj2) aCon2.pObj=NULL; +/*N*/ return; // Und mehr braucht hier nicht getan werden. +/*N*/ } +/*N*/ SdrTextObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ if (nNotifyingCount==0) { // Hier nun auch ein VerriegelungsFlag +/*N*/ ((SdrEdgeObj*)this)->nNotifyingCount++; +/*N*/ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); +/*N*/ if (bDataChg) { // StyleSheet geaendert +/*N*/ ImpSetAttrToEdgeInfo(); // Werte bei Vorlagenaenderung vom Pool nach aEdgeInfo kopieren +/*N*/ } +/*N*/ if (bDataChg || +/*N*/ (bObj1 && aCon1.pObj->GetPage()==pPage) || +/*N*/ (bObj2 && aCon2.pObj->GetPage()==pPage) || +/*N*/ (pSdrHint && pSdrHint->GetKind()==HINT_OBJREMOVED)) +/*N*/ { +/*N*/ // Broadcasting nur, wenn auf der selben Page +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ if (!bEdgeTrackDirty) SendRepaintBroadcast(); +/*N*/ bEdgeTrackDirty=TRUE; +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ ((SdrEdgeObj*)this)->nNotifyingCount--; +/*N*/ } +/*N*/ } + +/** updates edges that are connected to the edges of this object + as if the connected objects send a repaint broadcast + #103122# +*/ +/*N*/ void SdrEdgeObj::Reformat() +/*N*/ { +/*N*/ if( NULL != aCon1.pObj ) +/*N*/ { +/*N*/ SfxSimpleHint aHint( SFX_HINT_DATACHANGED ); +/*N*/ SFX_NOTIFY( *const_cast<SfxBroadcaster*>(aCon1.pObj->GetBroadcaster()), NULL, aHint, NULL ); +/*N*/ } +/*N*/ +/*N*/ if( NULL != aCon2.pObj ) +/*N*/ { +/*N*/ SfxSimpleHint aHint( SFX_HINT_DATACHANGED ); +/*N*/ SFX_NOTIFY( *const_cast<SfxBroadcaster*>(aCon2.pObj->GetBroadcaster()), NULL, aHint, NULL ); +/*N*/ } +/*N*/ } + + + + + + + + + + + + + + + + + + + + + + + + + + +/*N*/ void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aOld(GetSnapRect()); +/*N*/ long nMulX = rRect.Right() - rRect.Left(); +/*N*/ long nDivX = aOld.Right() - aOld.Left(); +/*N*/ long nMulY = rRect.Bottom() - rRect.Top(); +/*N*/ long nDivY = aOld.Bottom() - aOld.Top(); +/*N*/ if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } +/*N*/ if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } +/*N*/ Fraction aX(nMulX, nDivX); +/*N*/ Fraction aY(nMulY, nDivY); +/*N*/ NbcResize(aOld.TopLeft(), aX, aY); +/*N*/ NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); +/*N*/ } + +/*N*/ void SdrEdgeObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ SdrTextObj::NbcMove(rSiz); +/*N*/ MoveXPoly(*pEdgeTrack,rSiz); +/*N*/ } + +/*N*/ void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) +/*N*/ { +/*N*/ SdrTextObj::NbcResize(rRefPnt,aXFact,aXFact); +/*N*/ ResizeXPoly(*pEdgeTrack,rRefPnt,aXFact,aYFact); +/*N*/ +/*N*/ // #75371# if resize is not from paste, forget user distances +/*N*/ if(!GetModel()->IsPasteResize()) +/*N*/ { +/*N*/ // #75735# +/*N*/ aEdgeInfo.aObj1Line2 = Point(); +/*N*/ aEdgeInfo.aObj1Line3 = Point(); +/*N*/ aEdgeInfo.aObj2Line2 = Point(); +/*N*/ aEdgeInfo.aObj2Line3 = Point(); +/*N*/ aEdgeInfo.aMiddleLine = Point(); +/*N*/ } +/*N*/ } + + + + + + + +/*N*/ void SdrEdgeObj::NbcSetPoint(const Point& rPnt, USHORT i) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ // ToDo: Umconnekten fehlt noch +/*N*/ } + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrEdgeObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::PreSave(); +/*N*/ +/*N*/ // prepare SetItems for storage +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*N*/ SdrEdgeSetItem aEdgeAttr(rSet.GetPool()); +/*N*/ aEdgeAttr.GetItemSet().Put(rSet); +/*N*/ aEdgeAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aEdgeAttr); +/*N*/ } + +/*N*/ void SdrEdgeObj::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::PostSave(); +/*N*/ +/*N*/ // remove SetItems from local itemset +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_EDGE); +/*N*/ } +/*N*/ +/*N*/ //////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ +/*N*/ void SdrEdgeObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrTextObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrEdgeObj"); +/*N*/ #endif +/*N*/ +/*N*/ { +/*N*/ SdrDownCompat aTrackCompat(rOut,STREAM_WRITE); // ab V11 eingepackt +/*N*/ #ifdef DBG_UTIL +/*N*/ aTrackCompat.SetID("SdrEdgeObj(EdgeTrack)"); +/*N*/ #endif +/*N*/ rOut << *pEdgeTrack; +/*N*/ } +/*N*/ +/*N*/ aCon1.Write(rOut, this); // Die Connections haben +/*N*/ aCon2.Write(rOut, this); // ihren eigenen Header +/*N*/ +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_EDGE)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rOut << UINT16(SFX_ITEMS_NULL); +/*N*/ } +/*N*/ +/*N*/ rOut << aEdgeInfo; +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrTextObj::ReadData(rHead,rIn); +/*N*/ if (rHead.GetVersion()<2) { // frueher war EdgeObj von PathObj abgeleitet +/*N*/ DBG_ERROR("SdrEdgeObj::ReadData(): Dateiversion<2 wird nicht mehr unterstuetzt"); +/*N*/ rIn.SetError(SVSTREAM_WRONGVERSION); // Format-Fehler, File zu alt +/*N*/ return; +/*N*/ } +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrEdgeObj"); +/*N*/ #endif +/*N*/ if (rHead.GetVersion()>=11) { // ab V11 ist alles eingepackt +/*N*/ { +/*N*/ SdrDownCompat aTrackCompat(rIn,STREAM_READ); // ab V11 eingepackt +/*N*/ #ifdef DBG_UTIL +/*N*/ aTrackCompat.SetID("SdrEdgeObj(EdgeTrack)"); +/*N*/ #endif +/*N*/ rIn>>*pEdgeTrack; +/*N*/ } +/*N*/ aCon1.Read(rIn,this); // Die Connections haben +/*N*/ aCon2.Read(rIn,this); // ihren eigenen Header. +/*N*/ } else { +/*N*/ rIn>>*pEdgeTrack; +/*N*/ if (rHead.GetBytesLeft()>0) { // Aha, da ist noch mehr (Verbindungsdaten) +/*N*/ aCon1.ReadTilV10(rIn,this); // Import der +/*N*/ aCon2.ReadTilV10(rIn,this); // Connections +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(aCompat.GetBytesLeft() > 0) +/*N*/ { +/*N*/ // ab 10-08-1996 (noch Vers 12) Items fuer Verbinder +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ if(pPool) +/*N*/ { +/*N*/ sal_uInt16 nSetID = SDRATTRSET_EDGE; +/*N*/ const SdrEdgeSetItem* pEdgeAttr = (const SdrEdgeSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pEdgeAttr) +/*N*/ SetItemSet(pEdgeAttr->GetItemSet()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ sal_uInt16 nSuroDum; +/*N*/ rIn >> nSuroDum; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(aCompat.GetBytesLeft() > 0) +/*N*/ { +/*N*/ // ab 14-01-1997 (noch Vers 12) EdgeInfoRec +/*N*/ rIn >> aEdgeInfo; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::AfterRead() +/*N*/ { +/*N*/ SdrTextObj::AfterRead(); +/*N*/ aCon1.AfterRead(this); +/*N*/ aCon2.AfterRead(this); +/*N*/ if (aCon1.pObj!=NULL) aCon1.pObj->AddListener(*this); +/*N*/ if (aCon2.pObj!=NULL) aCon2.pObj->AddListener(*this); +/*N*/ +/*N*/ // #84026# always recalculate edgetrack after load +/*N*/ bEdgeTrackDirty=TRUE; +/*N*/ } +/*N*/ +/*N*/ Point SdrEdgeObj::GetTailPoint( BOOL bTail ) const +/*N*/ { +/*N*/ if( pEdgeTrack && pEdgeTrack->GetPointCount()!=0) +/*N*/ { +/*N*/ const XPolygon& rTrack0 = *pEdgeTrack; +/*N*/ if(bTail) +/*N*/ { +/*N*/ return rTrack0[0]; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ const USHORT nSiz = rTrack0.GetPointCount() - 1; +/*N*/ return rTrack0[nSiz]; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(bTail) +/*N*/ return aOutRect.TopLeft(); +/*N*/ else +/*N*/ return aOutRect.BottomRight(); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ void SdrEdgeObj::SetTailPoint( BOOL bTail, const Point& rPt ) +/*N*/ { +/*N*/ ImpSetTailPoint( bTail, rPt ); +/*N*/ SetChanged(); +/*N*/ } + +/** this method is used by the api to set a glue point for a connection + nId == -1 : The best default point is automaticly choosen + 0 <= nId <= 3 : One of the default points is choosen + nId >= 4 : A user defined glue point is choosen +*/ +/*N*/ void SdrEdgeObj::setGluePointIndex( sal_Bool bTail, sal_Int32 nIndex /* = -1 */ ) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ +/*N*/ SdrObjConnection& rConn1 = GetConnection( bTail ); +/*N*/ +/*N*/ rConn1.SetAutoVertex( nIndex >= 0 && nIndex <= 3 ); +/*N*/ rConn1.SetBestConnection( nIndex < 0 ); +/*N*/ rConn1.SetBestVertex( nIndex < 0 ); +/*N*/ +/*N*/ if( nIndex > 3 ) +/*N*/ { +/*N*/ nIndex -= 4; +/*N*/ // for user defined glue points we have +/*N*/ // to get the id for this index first +/*N*/ const SdrGluePointList* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList() : NULL; +/*N*/ if( pList == NULL || SDRGLUEPOINT_NOTFOUND == pList->FindGluePoint((sal_uInt16)nIndex) ) +/*N*/ return; +/*N*/ } +/*N*/ else if( nIndex < 0 ) +/*N*/ { +/*N*/ nIndex = 0; +/*N*/ } +/*N*/ +/*N*/ rConn1.SetConnectorId( (USHORT)nIndex ); +/*N*/ +/*N*/ SetChanged(); +/*N*/ SetRectsDirty(); +/*N*/ ImpRecalcEdgeTrack(); +/*N*/ bEdgeTrackDirty=TRUE; +/*N*/ } + +/** this method is used by the api to return a glue point id for a connection. + See setGluePointId for possible return values */ +/*N*/ sal_Int32 SdrEdgeObj::getGluePointIndex( sal_Bool bTail ) +/*N*/ { +/*N*/ SdrObjConnection& rConn1 = GetConnection( bTail ); +/*N*/ sal_Int32 nId = -1; +/*N*/ if( !rConn1.IsBestConnection() ) +/*N*/ { +/*N*/ nId = rConn1.GetConnectorId(); +/*N*/ if( !rConn1.IsAutoVertex() ) +/*N*/ nId += 4; +/*N*/ } +/*N*/ return nId; +/*N*/ } + +// #102344# Implementation was missing; edge track needs to be invalidated additionally. +/*N*/ void SdrEdgeObj::NbcSetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ // call parent functionality +/*N*/ SdrTextObj::NbcSetAnchorPos(rPnt); +/*N*/ +/*N*/ // Additionally, invalidate edge track +/*N*/ bEdgeTrackDirty = TRUE; +/*N*/ } + +// eof +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdograf.cxx b/binfilter/bf_svx/source/svdraw/svx_svdograf.cxx new file mode 100644 index 000000000000..8719c2399d04 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdograf.cxx @@ -0,0 +1,1606 @@ +/* -*- 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 _ANIMATION +#define ITEMID_GRF_CROP 0 + +#ifndef SVX_LIGHT +#include <bf_so3/lnkbase.hxx> +#else +#endif + +#include <math.h> +#include <vcl/salbtype.hxx> +#include <sot/formats.hxx> +#include <bf_so3/svstor.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/localfilehelper.hxx> +#include <bf_svtools/style.hxx> +#include <bf_svtools/urihelper.hxx> +#include "linkmgr.hxx" +#include "svdio.hxx" +#include "svdglob.hxx" +#include "svdstr.hrc" +#include "svdpool.hxx" +#include "svdpagv.hxx" +#include "svdviter.hxx" +#include "svdview.hxx" +#include "impgrf.hxx" +#include "svdograf.hxx" +#include "sdgcpitm.hxx" + +#include "eeitem.hxx" + +#include "xoutx.hxx" + +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +// ----------- +// - Defines - +// ----------- + +#define GRAFSTREAMPOS_INVALID 0xffffffff + +#ifndef SVX_LIGHT + +// ------------------ +// - SdrGraphicLink - +// ------------------ + +/*N*/ class SdrGraphicLink : public ::binfilter::SvBaseLink +/*N*/ { +/*N*/ SdrGrafObj* pGrafObj; +/*N*/ +/*N*/ public: +/*N*/ SdrGraphicLink(SdrGrafObj* pObj); +/*N*/ virtual ~SdrGraphicLink(); +/*N*/ +/*N*/ virtual void Closed(); +/*N*/ virtual void DataChanged( const String& rMimeType, +/*N*/ const ::com::sun::star::uno::Any & rValue ); +/*N*/ +/*N*/ BOOL Connect() { return 0 != GetRealObject(); } +/*N*/ void UpdateSynchron(); +/*N*/ }; + +// ----------------------------------------------------------------------------- + +/*N*/ SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj): +/*N*/ ::binfilter::SvBaseLink( ::binfilter::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ), +/*N*/ pGrafObj(pObj) +/*N*/ { +/*N*/ SetSynchron( FALSE ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrGraphicLink::~SdrGraphicLink() +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGraphicLink::DataChanged( const String& rMimeType, +/*N*/ const ::com::sun::star::uno::Any & rValue ) +/*N*/ { +/*N*/ SdrModel* pModel = pGrafObj ? pGrafObj->GetModel() : 0; +/*N*/ SvxLinkManager* pLinkManager= pModel ? pModel->GetLinkManager() : 0; +/*N*/ +/*N*/ if( pLinkManager && rValue.hasValue() ) +/*N*/ { +/*N*/ pLinkManager->GetDisplayNames( this, 0, &pGrafObj->aFileName, 0, &pGrafObj->aFilterName ); +/*N*/ +/*N*/ Graphic aGraphic; +/*N*/ if( SvxLinkManager::GetGraphicFromAny( rMimeType, rValue, aGraphic )) +/*N*/ { +/*?*/ GraphicType eOldGraphicType = pGrafObj->GetGraphicType(); // kein Hereinswappen +/*?*/ BOOL bIsChanged = pModel->IsChanged(); +/*?*/ +/*?*/ pGrafObj->SetGraphic( aGraphic ); +/*?*/ if( GRAPHIC_NONE != eOldGraphicType ) +/*?*/ pGrafObj->SetChanged(); +/*?*/ else +/*?*/ pModel->SetChanged( bIsChanged ); +/*N*/ } +/*N*/ else if( SotExchange::GetFormatIdFromMimeType( rMimeType ) != +/*N*/ SvxLinkManager::RegisterStatusInfoId() ) +/*?*/ pGrafObj->SendRepaintBroadcast(); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGraphicLink::Closed() +/*N*/ { +/*N*/ // Die Verbindung wird aufgehoben; pLink des Objekts auf NULL setzen, da die Link-Instanz ja gerade destruiert wird. +/*N*/ pGrafObj->ForceSwapIn(); +/*N*/ pGrafObj->pGraphicLink=NULL; +/*N*/ pGrafObj->ReleaseGraphicLink(); +/*N*/ SvBaseLink::Closed(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGraphicLink::UpdateSynchron() +/*N*/ { +/*N*/ if( GetObj() ) +/*N*/ { +/*N*/ String aMimeType( SotExchange::GetFormatMimeType( GetContentType() )); +/*N*/ ::com::sun::star::uno::Any aValue; +/*N*/ GetObj()->GetData( aValue, aMimeType, TRUE ); +/*N*/ DataChanged( aMimeType, aValue ); +/*N*/ } +/*N*/ } + +#else + +/*?*/ GraphicFilter* SVX_LIGHT_pGrapicFilter = NULL; +/*?*/ +/*?*/ GraphicFilter* GetGrfFilter() +/*?*/ { +/*?*/ if( !SVX_LIGHT_pGrapicFilter ) +/*?*/ { +/*?*/ const SvtPathOptions aPathOptions; +/*?*/ +/*?*/ SVX_LIGHT_pGrapicFilter = new GraphicFilter( FALSE ); +/*?*/ SVX_LIGHT_pGrapicFilter->SetFilterPath( aPathOptions.GetFilterPath() ); +/*?*/ } +/*?*/ +/*?*/ return SVX_LIGHT_pGrapicFilter; +/*?*/ } + + +#endif // SVX_LIGHT + +// -------------- +// - SdrGrafObj - +// -------------- + +/*N*/ TYPEINIT1(SdrGrafObj,SdrRectObj); + +// ----------------------------------------------------------------------------- + +/*N*/ SdrGrafObj::SdrGrafObj(): +/*N*/ bMirrored ( FALSE ), +/*N*/ pGraphicLink ( NULL ) +/*N*/ { +/*N*/ pGraphic = new BfGraphicObject; +/*N*/ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), 20000 ); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ bNoShear = TRUE; +/*N*/ bCopyToPoolOnAfterRead = FALSE; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*?*/ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ): +/*?*/ bMirrored ( FALSE ), +/*?*/ pGraphicLink ( NULL ) +/*?*/ { +/*?*/ pGraphic = new BfGraphicObject( rGrf ); +/*?*/ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), 20000 ); +/*?*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*?*/ bNoShear = TRUE; +/*?*/ bCopyToPoolOnAfterRead = FALSE; +/*?*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrGrafObj::~SdrGrafObj() +/*N*/ { +/*N*/ delete pGraphic; +/*N*/ ImpLinkAbmeldung(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetGraphicObject( const BfGraphicObject& rGrfObj ) +/*N*/ { +/*N*/ *pGraphic = rGrfObj; +/*N*/ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), 20000 ); +/*N*/ pGraphic->SetUserData(); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ const BfGraphicObject& SdrGrafObj::GetGraphicObject() const +/*N*/ { +/*N*/ ForceSwapIn(); +/*N*/ return *pGraphic; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetGraphic( const Graphic& rGrf ) +/*N*/ { +/*N*/ pGraphic->SetGraphic( rGrf ); +/*N*/ pGraphic->SetUserData(); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ const Graphic& SdrGrafObj::GetGraphic() const +/*N*/ { +/*N*/ ForceSwapIn(); +/*N*/ return pGraphic->GetGraphic(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ GraphicType SdrGrafObj::GetGraphicType() const +/*N*/ { +/*N*/ return pGraphic->GetType(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL ) +/*N*/ { +/*N*/ if( !rGraphicStreamURL.Len() ) +/*N*/ { +/*N*/ pGraphic->SetUserData(); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ } +/*N*/ else if( pModel->IsSwapGraphics() ) +/*N*/ { +/*N*/ pGraphic->SetUserData( rGraphicStreamURL ); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ +/*N*/ // set state of graphic object to 'swapped out' +/*N*/ if( pGraphic->GetType() == GRAPHIC_NONE ) +/*?*/ pGraphic->SetSwapState(); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ String SdrGrafObj::GetGrafStreamURL() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); String aString; return aString;//STRIP001 +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetName(const XubString& rStr) +/*N*/ { +/*N*/ aName = rStr; +/*N*/ SetChanged(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ XubString SdrGrafObj::GetName() const +/*N*/ { +/*N*/ return aName; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ForceSwapIn() const +/*N*/ { +/*N*/ pGraphic->FireSwapInRequest(); +/*N*/ +/*N*/ if( pGraphic->IsSwappedOut() || +/*N*/ ( pGraphic->GetType() == GRAPHIC_NONE ) || +/*N*/ ( pGraphic->GetType() == GRAPHIC_DEFAULT ) ) +/*N*/ { +/*N*/ Graphic aDefaultGraphic; +/*N*/ aDefaultGraphic.SetDefaultType(); +/*N*/ pGraphic->SetGraphic( aDefaultGraphic ); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ForceSwapOut() const +/*N*/ { +/*N*/ pGraphic->FireSwapOutRequest(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ImpLinkAnmeldung() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ +/*N*/ SvxLinkManager* pLinkManager = pModel != NULL ? pModel->GetLinkManager() : NULL; +/*N*/ +/*N*/ if( pLinkManager != NULL && pGraphicLink == NULL ) +/*N*/ { +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*N*/ pGraphicLink = new SdrGraphicLink( this ); +/*N*/ pLinkManager->InsertFileLink( *pGraphicLink, OBJECT_CLIENT_GRF, aFileName, ( aFilterName.Len() ? &aFilterName : NULL ), NULL ); +/*N*/ pGraphicLink->Connect(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ #endif // SVX_LIGHT +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ImpLinkAbmeldung() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ +/*N*/ SvxLinkManager* pLinkManager = pModel != NULL ? pModel->GetLinkManager() : NULL; +/*N*/ +/*N*/ if( pLinkManager != NULL && pGraphicLink!=NULL) +/*N*/ { +/*?*/ // Bei Remove wird *pGraphicLink implizit deleted +/*?*/ pLinkManager->Remove( pGraphicLink ); +/*?*/ pGraphicLink=NULL; +/*N*/ } +/*N*/ +/*N*/ #endif // SVX_LIGHT +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetGraphicLink( const String& rFileName, const String& rFilterName ) +/*N*/ { +/*N*/ ImpLinkAbmeldung(); +/*N*/ aFileName = rFileName; +/*N*/ aFilterName = rFilterName; +/*N*/ ImpLinkAnmeldung(); +/*N*/ pGraphic->SetUserData(); +/*N*/ +/*N*/ // #92205# A linked graphic is per definition swapped out (has to be loaded) +/*N*/ pGraphic->SetSwapState(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ReleaseGraphicLink() +/*N*/ { +/*N*/ ImpLinkAbmeldung(); +/*N*/ aFileName = String(); +/*N*/ aFilterName = String(); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ UINT16 SdrGrafObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16( OBJ_GRAF ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ sal_Bool SdrGrafObj::ImpUpdateGraphicLink() const +/*N*/ { +/*N*/ sal_Bool bRet = sal_False; +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ if( pGraphicLink ) +/*N*/ { +/*N*/ BOOL bIsChanged = pModel->IsChanged(); +/*N*/ pGraphicLink->UpdateSynchron(); +/*N*/ pModel->SetChanged( bIsChanged ); +/*N*/ +/*N*/ bRet = sal_True; +/*N*/ } +/*N*/ #else +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*N*/ // #92205# Load linked graphics for player +/*N*/ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_READ | STREAM_SHARE_DENYNONE ); +/*N*/ +/*N*/ if( pIStm ) +/*N*/ { +/*N*/ Graphic aGraphic; +/*N*/ GraphicFilter* pFilter = GetGrfFilter(); +/*N*/ USHORT nError = pFilter->ImportGraphic( aGraphic, aFileName, *pIStm ); +/*N*/ +/*N*/ pGraphic->SetGraphic( aGraphic ); +/*N*/ +/*N*/ delete pIStm; +/*N*/ } +/*N*/ +/*N*/ bRet = sal_True; +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ return bRet; +/*N*/ } + +// ----------------------------------------------------------------------------- + +// Liefert FALSE, wenn die Pres-Bitmap zu gross ist + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ImpPaintReplacement(OutputDevice* pOutDev, const XubString& rText, const Bitmap* pBmp, FASTBOOL bFill) const +/*N*/ { +/*N*/ Size aPixelSize( 1, 1 ); +/*N*/ Size aBmpSize; +/*N*/ +/*N*/ aPixelSize = Application::GetDefaultDevice()->PixelToLogic( aPixelSize, pOutDev->GetMapMode() ); +/*N*/ +/*N*/ if( bFill ) +/*N*/ { +/*?*/ pOutDev->SetLineColor(); +/*?*/ pOutDev->SetFillColor( COL_LIGHTGRAY ); +/*N*/ } +/*N*/ +/*N*/ Rectangle aRect1( aRect ); +/*N*/ Rectangle aRect2( aRect1 ); +/*N*/ Rectangle aTextRect( aRect1 ); +/*N*/ Point aTopLeft( aRect1.TopLeft() ); +/*N*/ Point aBmpPos( aTopLeft ); +/*N*/ +/*N*/ aRect2.Left() += aPixelSize.Width(); +/*N*/ aRect2.Top() += aPixelSize.Height(); +/*N*/ aRect2.Right() -= aPixelSize.Width(); +/*N*/ aRect2.Bottom() -= aPixelSize.Height(); +/*N*/ +/*N*/ if( pBmp != NULL ) +/*N*/ { +/*N*/ aBmpSize = Size( Application::GetDefaultDevice()->PixelToLogic( pBmp->GetSizePixel(), pOutDev->GetMapMode() ) ); +/*N*/ +/*N*/ long nRectWdt = aTextRect.Right() - aTextRect.Left(); +/*N*/ long nRectHgt = aTextRect.Bottom() - aTextRect.Top(); +/*N*/ long nBmpWdt = aBmpSize.Width(); +/*N*/ long nBmpHgt = aBmpSize.Height(); +/*N*/ long nMinWdt = nBmpWdt; +/*N*/ long nMinHgt = nBmpHgt; +/*N*/ BOOL bText = rText.Len() > 0; +/*N*/ +/*N*/ if( bText ) +/*N*/ { +/*N*/ nMinWdt= 2 * nBmpWdt + 5 * aPixelSize.Width(); +/*N*/ nMinHgt= 2 * nBmpHgt + 5 * aPixelSize.Height(); +/*N*/ } +/*N*/ +/*N*/ if( nRectWdt < nMinWdt || nRectHgt < nMinHgt ) +/*N*/ pBmp=NULL; +/*N*/ else +/*N*/ { +/*N*/ aTextRect.Left() += nBmpWdt; +/*N*/ +/*N*/ if( bText ) +/*N*/ aTextRect.Left() += 5 * aPixelSize.Width(); +/*N*/ } +/*N*/ +/*N*/ aBmpPos.X() += 2 * aPixelSize.Width(); +/*N*/ aBmpPos.Y() += 2 * aPixelSize.Height(); +/*N*/ +/*N*/ if( aGeo.nDrehWink != 0 ) +/*N*/ { +/*N*/ Point aRef( aBmpPos.X() - aBmpSize.Width() / 2 + 2 * aPixelSize.Width(), +/*N*/ aBmpPos.Y() - aBmpSize.Height() / 2 + 2 * aPixelSize.Height() ); +/*N*/ double nSin = sin( aGeo.nDrehWink * nPi180 ); +/*N*/ double nCos = cos( aGeo.nDrehWink * nPi180 ); +/*N*/ +/*N*/ RotatePoint( aBmpPos, aRef, nSin, nCos ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( aGeo.nDrehWink == 0 && aGeo.nShearWink == 0 ) +/*N*/ { +/*N*/ const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); +/*N*/ +/*N*/ if( bFill ) +/*N*/ pOutDev->DrawRect( aRect ); +/*N*/ +/*N*/ if( pBmp!=NULL ) +/*N*/ pOutDev->DrawBitmap( aBmpPos, aBmpSize, *pBmp ); +/*N*/ +/*N*/ pOutDev->SetFillColor(); +/*N*/ pOutDev->SetLineColor( rStyleSettings.GetShadowColor() ); +/*N*/ pOutDev->DrawLine( aRect1.TopLeft(), aRect1.TopRight() ); +/*N*/ pOutDev->DrawLine( aRect1.TopLeft(), aRect1.BottomLeft() ); +/*N*/ +/*N*/ pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); +/*N*/ pOutDev->DrawLine( aRect1.TopRight(), aRect1.BottomRight() ); +/*N*/ pOutDev->DrawLine( aRect1.BottomLeft(), aRect1.BottomRight() ); +/*N*/ +/*N*/ pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); +/*N*/ pOutDev->DrawLine( aRect2.TopLeft(), aRect2.TopRight() ); +/*N*/ pOutDev->DrawLine( aRect2.TopLeft(), aRect2.BottomLeft() ); +/*N*/ +/*N*/ pOutDev->SetLineColor( rStyleSettings.GetShadowColor() ); +/*N*/ pOutDev->DrawLine( aRect2.TopRight(), aRect2.BottomRight() ); +/*N*/ pOutDev->DrawLine( aRect2.BottomLeft(), aRect2.BottomRight() ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ Polygon aPoly1( Rect2Poly( aRect1, aGeo ) ); +/*N*/ Polygon aPoly2(5); +/*N*/ +/*N*/ aPoly2[0] = aRect2.TopLeft(); +/*N*/ aPoly2[1] = aRect2.TopRight(); +/*N*/ aPoly2[2] = aRect2.BottomRight(); +/*N*/ aPoly2[3] = aRect2.BottomLeft(); +/*N*/ aPoly2[4] = aRect2.TopLeft(); +/*N*/ +/*N*/ if( aGeo.nShearWink != 0 ) +/*?*/ ShearPoly( aPoly2, aTopLeft, aGeo.nTan ); +/*N*/ +/*N*/ if( aGeo.nDrehWink != 0 ) +/*N*/ RotatePoly( aPoly2, aTopLeft, aGeo.nSin, aGeo.nCos ); +/*N*/ +/*N*/ if( bFill ) +/*?*/ pOutDev->DrawPolygon( aPoly1 ); +/*N*/ +/*N*/ if( pBmp != NULL ) +/*N*/ pOutDev->DrawBitmap( aBmpPos, aBmpSize, *pBmp ); +/*N*/ +/*N*/ pOutDev->SetFillColor(); +/*N*/ +/*N*/ const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); +/*N*/ Color a3DLightColor( rStyleSettings.GetLightColor() ); +/*N*/ Color a3DShadowColor( rStyleSettings.GetShadowColor() ); +/*N*/ long nHWink=NormAngle360( aGeo.nDrehWink ); +/*N*/ long nVWink=NormAngle360( aGeo.nDrehWink-aGeo.nShearWink ); +/*N*/ FASTBOOL bHorzChg=nHWink>13500 && nHWink<=31500; +/*N*/ FASTBOOL bVertChg=nVWink>4500 && nVWink<=22500; +/*N*/ +/*N*/ pOutDev->SetLineColor( bHorzChg ? a3DShadowColor : a3DLightColor); +/*N*/ pOutDev->DrawLine( aPoly2[0], aPoly2[1] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bHorzChg ? a3DLightColor : a3DShadowColor); +/*N*/ pOutDev->DrawLine( aPoly2[2], aPoly2[3] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bVertChg ? a3DLightColor : a3DShadowColor); +/*N*/ pOutDev->DrawLine( aPoly2[1], aPoly2[2] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bVertChg ? a3DShadowColor : a3DLightColor); +/*N*/ pOutDev->DrawLine( aPoly2[3], aPoly2[4] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bHorzChg ? a3DLightColor : a3DShadowColor); +/*N*/ pOutDev->DrawLine( aPoly1[0], aPoly1[1] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bHorzChg ? a3DShadowColor : a3DLightColor); +/*N*/ pOutDev->DrawLine( aPoly1[2], aPoly1[3] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bVertChg ? a3DShadowColor : a3DLightColor); +/*N*/ pOutDev->DrawLine( aPoly1[1], aPoly1[2] ); +/*N*/ +/*N*/ pOutDev->SetLineColor( bVertChg ? a3DLightColor : a3DShadowColor); +/*N*/ pOutDev->DrawLine( aPoly1[3], aPoly1[4] ); +/*N*/ } +/*N*/ +/*N*/ XubString aNam( rText ); +/*N*/ +/*N*/ if( aNam.Len() ) +/*N*/ { +/*?*/ Size aOutSize( aTextRect.GetWidth() - 6 * aPixelSize.Width(), +/*?*/ aTextRect.GetHeight() - 6 * aPixelSize.Height() ); +/*?*/ +/*?*/ if( aOutSize.Width() >= ( 4 * aPixelSize.Width() ) || +/*?*/ aOutSize.Height() >= ( 4 * aPixelSize.Height() ) ) +/*?*/ { +/*?*/ Point aOutPos( aTextRect.Left() + 3 * aPixelSize.Width(), +/*?*/ aTextRect.Top() + 3 * aPixelSize.Height() ); +/*?*/ long nMaxOutY = aOutPos.Y() + aOutSize.Height(); +/*?*/ Font aFontMerk( pOutDev->GetFont() ); +/*?*/ Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ) ); +/*?*/ +/*?*/ aFont.SetColor( COL_LIGHTRED ); +/*?*/ aFont.SetTransparent( TRUE ); +/*?*/ aFont.SetOrientation( USHORT( NormAngle360( aGeo.nDrehWink ) / 10 ) ); +/*?*/ +/*?*/ if( IsLinkedGraphic() ) +/*?*/ aFont.SetUnderline( UNDERLINE_SINGLE ); +/*?*/ +/*?*/ Size aFontSize( 0, ( aGeo.nDrehWink % 9000 == 0 ? 12 : 14 ) * aPixelSize.Height() ); +/*?*/ +/*?*/ if( aFontSize.Height() > aOutSize.Height() ) +/*?*/ aFontSize.Height() = aOutSize.Height(); +/*?*/ +/*?*/ aFont.SetSize( aFontSize ); +/*?*/ pOutDev->SetFont( aFont ); +/*?*/ String aOutStr( aNam ); +/*?*/ +/*?*/ while( aOutStr.Len() && aOutPos.Y() <= nMaxOutY ) +/*?*/ { +/*?*/ String aStr1( aOutStr ); +/*?*/ INT32 nTextWidth = pOutDev->GetTextWidth( aStr1 ); +/*?*/ INT32 nTextHeight = pOutDev->GetTextHeight(); +/*?*/ +/*?*/ while( aStr1.Len() && nTextWidth > aOutSize.Width() ) +/*?*/ { +/*?*/ aStr1.Erase( aStr1.Len() - 1 ); +/*?*/ nTextWidth = pOutDev->GetTextWidth( aStr1 ); +/*?*/ nTextHeight = pOutDev->GetTextHeight(); +/*?*/ } +/*?*/ +/*?*/ Point aPos( aOutPos ); +/*?*/ aOutPos.Y() += nTextHeight; +/*?*/ +/*?*/ if( aOutPos.Y() <= nMaxOutY ) +/*?*/ { +/*?*/ if( aGeo.nShearWink != 0 ) +/*?*/ ShearPoint( aPos, aTopLeft, aGeo.nTan ); +/*?*/ +/*?*/ if( aGeo.nDrehWink != 0 ) +/*?*/ RotatePoint( aPos, aTopLeft, aGeo.nSin, aGeo.nCos ); +/*?*/ +/*?*/ pOutDev->DrawText( aPos, aStr1 ); +/*?*/ aOutStr.Erase( 0, aStr1.Len() ); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ pOutDev->SetFont( aFontMerk ); +/*N*/ } +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ FASTBOOL SdrGrafObj::Paint( ExtOutputDevice& rOut, const SdrPaintInfoRec& rInfoRec ) const +/*N*/ { +/*N*/ // Hidden objects on masterpages, draw nothing +/*N*/ if( ( ( rInfoRec.nPaintMode & SDRPAINTMODE_MASTERPAGE ) && bNotVisibleAsMaster ) || +/*N*/ ( ( OUTDEV_PRINTER == rOut.GetOutDev()->GetOutDevType() ) && bEmptyPresObj ) ) +/*N*/ { +/*?*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ FASTBOOL bDraft = ( 0 != ( rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTGRAF ) ); +/*N*/ FASTBOOL bSwappedOut = pGraphic->IsSwappedOut() || ( pGraphic->GetType() == GRAPHIC_NONE ); +/*N*/ FASTBOOL bLoading = FALSE; +/*N*/ OutputDevice* pOutDev = rOut.GetOutDev(); +/*N*/ GDIMetaFile* pRecMetaFile = pOutDev->GetConnectMetaFile(); +/*N*/ FASTBOOL bMtfRecording = ( pRecMetaFile && pRecMetaFile->IsRecord() && !pRecMetaFile->IsPause() ); +/*N*/ const SdrView* pView = ( rInfoRec.pPV ? &rInfoRec.pPV->GetView() : NULL ); +/*N*/ +/*N*/ if( bSwappedOut && !bDraft ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ if( pGraphic->IsSwappedOut() || ( pGraphic->GetType() == GRAPHIC_NONE ) || ( pGraphic->GetType() == GRAPHIC_DEFAULT ) ) +/*?*/ bDraft=TRUE; +/*N*/ +/*N*/ long nDrehWink = aGeo.nDrehWink, nShearWink = aGeo.nShearWink; +/*N*/ FASTBOOL bRotate = ( nDrehWink != 0 && nDrehWink != 18000 ); +/*N*/ FASTBOOL bShear = ( nShearWink != 0 ); +/*N*/ FASTBOOL bRota180 = nDrehWink == 18000; +/*N*/ USHORT nMirrorCase = ( bRota180 ? ( bMirrored ? 3 : 4 ) : ( bMirrored ? 2 : 1 ) ); // 4 | 3 H&V gespiegelt | nur Vertikal +/*N*/ FASTBOOL bHMirr = ( ( 2 == nMirrorCase ) || ( 4 == nMirrorCase ) ); // ---+--- ---------------+----------------- +/*N*/ FASTBOOL bVMirr = ( ( 3 == nMirrorCase ) || ( 4 == nMirrorCase ) ); // 2 | 1 nur Horizontal | nicht gespiegelt +/*N*/ +/*N*/ if( !bEmptyPresObj && !bDraft ) +/*N*/ { +/*?*/ Point aLogPos( aRect.TopLeft() ); +/*?*/ Size aLogSize( pOutDev->PixelToLogic( pOutDev->LogicToPixel( aRect ).GetSize() ) ); +/*?*/ BfGraphicAttr aAttr( aGrafInfo ); +/*?*/ const ULONG nGraphicManagerDrawMode = ( pView ? pView->GetGraphicManagerDrawMode() : GRFMGR_DRAW_STANDARD ); +/*?*/ +/*?*/ aAttr.SetMirrorFlags( ( bHMirr ? BMP_MIRROR_HORZ : 0 ) | ( bVMirr ? BMP_MIRROR_VERT : 0 ) ); +/*?*/ +/*?*/ if( bRota180 ) +/*?*/ { +/*?*/ aLogPos.X() -= ( aLogSize.Width() - 1L ); +/*?*/ aLogPos.Y() -= ( aLogSize.Height() - 1L ); +/*?*/ } +/*?*/ +/*?*/ bool bDidPaint( false ); +/*?*/ +/*?*/ if( pGraphic->GetType() == GRAPHIC_BITMAP ) +/*?*/ { +/*?*/ if( pGraphic->IsAnimated() ) +/*?*/ { +/*?*/ SdrAnimationMode eAnimMode = SDR_ANIMATION_ANIMATE; +/*?*/ FASTBOOL bEnable = TRUE; +/*?*/ +/*?*/ if( pView ) +/*?*/ { +/*?*/ eAnimMode= pView->GetAnimationMode(); +/*?*/ bEnable = ( eAnimMode != SDR_ANIMATION_DISABLE ); +/*?*/ +/*?*/ if( bEnable ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if( bEnable ) +/*?*/ { +/*?*/ if( eAnimMode == SDR_ANIMATION_ANIMATE ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ else if( eAnimMode == SDR_ANIMATION_DONT_ANIMATE ) +/*?*/ pGraphic->Draw( pOutDev, aLogPos, aLogSize, &aAttr, nGraphicManagerDrawMode ); +/*?*/ +/*?*/ bDidPaint = true; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if( bRotate && !bRota180 ) +/*?*/ aAttr.SetRotation( nDrehWink / 10 ); +/*?*/ +/*?*/ pGraphic->Draw( pOutDev, aLogPos, aLogSize, &aAttr, nGraphicManagerDrawMode ); +/*?*/ bDidPaint = true; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // MetaFiles +/*?*/ const ULONG nOldDrawMode = pOutDev->GetDrawMode(); +/*?*/ +/*?*/ // Falls Modus GRAYBITMAP, wollen wir auch Mtf's als Graustufen darstellen +/*?*/ if( nOldDrawMode & DRAWMODE_GRAYBITMAP ) +/*?*/ { +/*?*/ ULONG nNewDrawMode = nOldDrawMode; +/*?*/ nNewDrawMode &= ~( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_WHITEFILL | DRAWMODE_NOFILL ); +/*?*/ pOutDev->SetDrawMode( nNewDrawMode |= DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL ); +/*?*/ } +/*?*/ +/*?*/ if( bRotate && !bRota180 ) +/*?*/ aAttr.SetRotation( nDrehWink / 10 ); +/*?*/ +/*?*/ pGraphic->Draw( pOutDev, aLogPos, aLogSize, &aAttr, nGraphicManagerDrawMode ); +/*?*/ pOutDev->SetDrawMode( nOldDrawMode ); +/*?*/ +/*?*/ bDidPaint = true; +/*?*/ } +/*?*/ +/*?*/ // #110290# Remove the SdrGraphObj from the list of objects to be removed on +/*?*/ // page switch. This is permissible, as the Draw above reenabled the swapout +/*?*/ // timer. +/*?*/ // #110573# Occasionally, the view is NULL (e.g. previews in impress and calc) +/*?*/ if( bDidPaint && pView ) +/*?*/ ( (SdrView*) pView )->ImpAsyncPaintDone( this ); +/*N*/ } + + // auch GRAPHIC_NONE oder SwappedOut( AsyncSwap ) +/*N*/ if( ( bEmptyPresObj || bDraft ) && ( !bDraft || !( rInfoRec.nPaintMode & SDRPAINTMODE_HIDEDRAFTGRAF ) ) ) +/*N*/ { +/*N*/ XubString aText; +/*N*/ Bitmap* pBmp = NULL; +/*N*/ FASTBOOL bFill = FALSE; +/*N*/ +/*N*/ if( bEmptyPresObj ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 bFill = !ImpPaintEmptyPres( pOutDev ); +/*N*/ +/*N*/ // und nun noch einen grauen Rahmen drum herum, Text rein, ... +/*N*/ if( !bEmptyPresObj ) +/*N*/ { +/*N*/ aText = aFileName; +/*N*/ +/*N*/ if(!aText.Len()) +/*N*/ { +/*N*/ aText = aName; +/*N*/ +/*N*/ if( bLoading ) +/*N*/ { +/*?*/ aText.AppendAscii(" ..."); +/*?*/ //FASTBOOL bNoName=aText.Len()==0; +/*?*/ //if (!bNoName) aText.Insert(' ',0); +/*?*/ //else aText.Insert("...",0); +/*?*/ //aText.Insert("Loading",0); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ pBmp = new Bitmap( ResId ( BMAP_GrafikEi, *ImpGetResMgr() ) ); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ ImpPaintReplacement( pOutDev, aText, pBmp, bFill ); +/*N*/ delete pBmp; +/*N*/ } +/*N*/ +/*N*/ if( OUTDEV_PRINTER == pOutDev->GetOutDevType() ) +/*?*/ ForceSwapOut(); +/*N*/ +/*N*/ return( HasText() ? SdrTextObj::Paint( rOut, rInfoRec ) : TRUE ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrObject* SdrGrafObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ return ImpCheckHit( rPnt, nTol, pVisiLayer, TRUE ); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::operator=( const SdrObject& rObj ) +/*N*/ { +/*N*/ SdrRectObj::operator=( rObj ); +/*N*/ +/*N*/ const SdrGrafObj& rGraf = (SdrGrafObj&) rObj; +/*N*/ +/*N*/ pGraphic->SetGraphic( rGraf.GetGraphic() ); +/*N*/ aCropRect = rGraf.aCropRect; +/*N*/ aFileName = rGraf.aFileName; +/*N*/ aFilterName = rGraf.aFilterName; +/*N*/ aName = rGraf.aName; +/*N*/ bMirrored = rGraf.bMirrored; +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ if( rGraf.pGraphicLink != NULL) +/*N*/ #else +/*N*/ if( rGraf.aFileName.Len() ) +/*N*/ #endif +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 SetGraphicLink( aFileName, aFilterName ); +/*N*/ +/*N*/ ImpSetAttrToGrafInfo(); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrRectObj::NbcResize( rRef, xFact, yFact ); +/*N*/ +/*N*/ FASTBOOL bMirrX = xFact.GetNumerator() < 0; +/*N*/ FASTBOOL bMirrY = yFact.GetNumerator() < 0; +/*N*/ +/*N*/ if( bMirrX != bMirrY ) +/*?*/ bMirrored = !bMirrored; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ SdrRectObj::NbcRotate(rRef,nWink,sn,cs); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrRectObj::NbcSetSnapRect(rRect); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::NbcSetLogicRect( const Rectangle& rRect) +/*N*/ { +/*N*/ FASTBOOL bChg=rRect.GetSize()!=aRect.GetSize(); +/*N*/ SdrRectObj::NbcSetLogicRect(rRect); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrObjGeoData* SdrGrafObj::NewGeoData() const +/*N*/ { +/*N*/ return new SdrGrafObjGeoData; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ { +/*N*/ SdrRectObj::SaveGeoData(rGeo); +/*N*/ SdrGrafObjGeoData& rGGeo=(SdrGrafObjGeoData&)rGeo; +/*N*/ rGGeo.bMirrored=bMirrored; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetPage( SdrPage* pNewPage ) +/*N*/ { +/*N*/ FASTBOOL bRemove = pNewPage == NULL && pPage != NULL; +/*N*/ FASTBOOL bInsert = pNewPage != NULL && pPage == NULL; +/*N*/ +/*N*/ if( bRemove ) +/*N*/ { +/*N*/ // hier kein SwapIn noetig, weil wenn nicht geladen, dann auch nicht animiert. +/*N*/ if( pGraphic->IsAnimated()) +/*?*/ pGraphic->StopAnimation(); +/*N*/ +/*N*/ if( pGraphicLink != NULL ) +/*?*/ ImpLinkAbmeldung(); +/*N*/ } +/*N*/ +/*N*/ SdrRectObj::SetPage( pNewPage ); +/*N*/ +/*N*/ if(aFileName.Len() && bInsert) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ImpLinkAnmeldung(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SetModel( SdrModel* pNewModel ) +/*N*/ { +/*N*/ FASTBOOL bChg = pNewModel != pModel; +/*N*/ +/*N*/ if( bChg ) +/*N*/ { +/*N*/ if( ( GRAFSTREAMPOS_INVALID != nGrafStreamPos ) || pGraphic->HasUserData() ) +/*N*/ { +/*?*/ ForceSwapIn(); +/*?*/ pGraphic->SetUserData(); +/*?*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ } +/*N*/ +/*N*/ if( pGraphicLink != NULL ) +/*?*/ ImpLinkAbmeldung(); +/*N*/ } + + // Model umsetzen +/*N*/ SdrRectObj::SetModel(pNewModel); +/*N*/ +/*N*/ if( bChg && aFileName.Len() ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ImpLinkAnmeldung(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrGrafObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrRectObj::PreSave(); +/*N*/ +/*N*/ // prepare SetItems for storage +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*N*/ SdrGrafSetItem aGrafAttr(rSet.GetPool()); +/*N*/ aGrafAttr.GetItemSet().Put(rSet); +/*N*/ aGrafAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aGrafAttr); +/*N*/ } + +/*N*/ void SdrGrafObj::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrRectObj::PostSave(); +/*N*/ +/*N*/ // remove SetItems from local itemset +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_GRAF); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrGrafObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ ForceSwapIn(); +/*N*/ SdrRectObj::WriteData( rOut ); +/*N*/ +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat( rOut, STREAM_WRITE ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID( "SdrGrafObj" ); +/*N*/ #endif +/*N*/ +/*N*/ GraphicType eType( pGraphic->GetType() ); +/*N*/ BOOL bHasGraphic( !aFileName.Len() && eType != GRAPHIC_NONE ); +/*N*/ +/*N*/ // dieses Flag wird ab V11 rausgeschrieben +/*N*/ rOut << bHasGraphic; +/*N*/ +/*N*/ if(bHasGraphic) +/*N*/ { +/*N*/ // Graphik ist nicht gelinkt: ggf. komprimiert speichern: +/*N*/ // seit V11 eingapackt +/*N*/ SdrDownCompat aGrafCompat(rOut, STREAM_WRITE); +/*N*/ BOOL bZCompr(pModel && pModel->IsSaveCompressed() && eType == GRAPHIC_BITMAP); +/*N*/ BOOL bNCompr(pModel && pModel->IsSaveNative()); +/*N*/ const UINT16 nOldComprMode(rOut.GetCompressMode()); +/*N*/ UINT16 nNewComprMode(nOldComprMode); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aGrafCompat.SetID( "SdrGrafObj(Graphic)" ); +/*N*/ #endif +/*N*/ +/*N*/ if(pModel->IsSwapGraphics() && (pModel->GetSwapGraphicsMode() & SDR_SWAPGRAPHICSMODE_DOC)) +/*N*/ { +/*N*/ ((SdrGrafObj*)this)->pGraphic->SetUserData(); +/*N*/ ((SdrGrafObj*)this)->nGrafStreamPos = rOut.Tell(); +/*N*/ } +/*N*/ +/*N*/ if(bZCompr) +/*N*/ nNewComprMode |= COMPRESSMODE_ZBITMAP; +/*N*/ +/*N*/ if(bNCompr) +/*N*/ nNewComprMode |= COMPRESSMODE_NATIVE; +/*N*/ +/*N*/ rOut.SetCompressMode( nNewComprMode ); +/*N*/ rOut << pGraphic->GetGraphic(); +/*N*/ rOut.SetCompressMode( nOldComprMode ); +/*N*/ } +/*N*/ +/*N*/ rOut << aCropRect; +/*N*/ rOut << BOOL(bMirrored); +/*N*/ +/*N*/ rOut.WriteByteString(aName); +/*N*/ +/*N*/ String aRelFileName; +/*N*/ +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*?*/ aRelFileName = ::binfilter::StaticBaseUrl::AbsToRel( aFileName, +/*?*/ INetURLObject::WAS_ENCODED, +/*?*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ +/*N*/ rOut.WriteByteString( aRelFileName ); +/*N*/ +/*N*/ // UNICODE: rOut << aFilterName; +/*N*/ rOut.WriteByteString(aFilterName); +/*N*/ +/*N*/ // ab V11 +/*N*/ rOut << (BOOL)( aFileName.Len() != 0 ); +/*N*/ +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_GRAF)); +/*N*/ } +/*N*/ else +/*?*/ rOut << UINT16( SFX_ITEMS_NULL ); +/*N*/ +/*N*/ ForceSwapOut(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ReadDataTilV10( const SdrObjIOHeader& rHead, SvStream& rIn ) +/*N*/ { +/*N*/ Graphic aGraphic; +/*N*/ +/*N*/ // Import von allem mit Version <= 10 +/*N*/ rIn >> aGraphic; +/*N*/ +/*N*/ ULONG nError = rIn.GetError(); +/*N*/ +/*N*/ // Ist die Graphik defekt, oder wurde nur eine leere Graphik eingelesen? (was bei gelinkten Graphiken der Fall ist) +/*N*/ if( nError != 0) +/*?*/ rIn.ResetError(); +/*N*/ +/*N*/ if( rHead.GetVersion() >= 6) +/*N*/ rIn >> aCropRect; +/*N*/ +/*N*/ if(rHead.GetVersion() >= 8) +/*N*/ { +/*N*/ // UNICODE: rIn>>aFileName; +/*N*/ rIn.ReadByteString(aFileName); +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() >= 9) +/*N*/ { +/*N*/ // UNICODE: rIn >> aFilterName; +/*N*/ rIn.ReadByteString(aFilterName); +/*N*/ } +/*N*/ else +/*?*/ aFilterName = String( RTL_CONSTASCII_USTRINGPARAM( "BMP - MS Windows" ) ); +/*N*/ +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*?*/ #ifndef SVX_LIGHT +/*?*/ String aFileURLStr; +/*?*/ +/*?*/ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aFileURLStr ) ) +/*?*/ { +/*?*/ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFileURLStr, STREAM_READ | STREAM_SHARE_DENYNONE ); +/*?*/ +/*?*/ if( pIStm ) +/*?*/ { +/*?*/ GraphicFilter* pFilter = GetGrfFilter(); +/*?*/ USHORT nError = pFilter->ImportGraphic( aGraphic, aFileURLStr, *pIStm ); +/*?*/ +/*?*/ SetGraphicLink( aFileURLStr, aFilterName ); +/*?*/ +/*?*/ delete pIStm; +/*?*/ } +/*?*/ } +/*?*/ #else +/*?*/ DBG_ERROR("SdrGrafObj::ReadDataTilV10(): SVX_LIGHT kann keine Graphic-Links"); +/*?*/ #endif +/*N*/ } +/*N*/ else if( nError != 0 ) +/*?*/ rIn.SetError(nError); +/*N*/ +/*N*/ +/*N*/ if( !rIn.GetError() ) +/*N*/ pGraphic->SetGraphic( aGraphic ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ #ifdef _MSC_VER +/*N*/ #pragma optimize ("",off) +/*N*/ #endif + +/*N*/ void SdrGrafObj::ReadData( const SdrObjIOHeader& rHead, SvStream& rIn ) +/*N*/ { +/*N*/ if( rIn.GetError() ) +/*?*/ return; +/*N*/ +/*N*/ SdrRectObj::ReadData( rHead, rIn ); +/*N*/ +/*N*/ SdrDownCompat aCompat( rIn, STREAM_READ ); +/*N*/ FASTBOOL bDelayedLoad = ( pModel != NULL ) && pModel->IsSwapGraphics(); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrGrafObj"); +/*N*/ #endif +/*N*/ +/*N*/ pGraphic->SetUserData(); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ +/*N*/ if( rHead.GetVersion() < 11 ) +/*N*/ ReadDataTilV10( rHead, rIn ); +/*N*/ else +/*N*/ { +/*N*/ String aFileNameRel; +/*N*/ BOOL bHasGraphic; +/*N*/ BOOL bTmp; +/*N*/ BOOL bGraphicLink; +/*N*/ +/*N*/ rIn >> bHasGraphic; +/*N*/ +/*N*/ if( bHasGraphic ) +/*N*/ { +/*N*/ SdrDownCompat aGrafCompat( rIn,STREAM_READ ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aGrafCompat.SetID("SdrGrafObj(Graphic)"); +/*N*/ #endif +/*N*/ +/*N*/ nGrafStreamPos = rIn.Tell(); +/*N*/ +/*N*/ if( !bDelayedLoad ) +/*N*/ { +/*?*/ Graphic aGraphic; +/*?*/ rIn >> aGraphic; +/*?*/ pGraphic->SetGraphic( aGraphic ); +/*N*/ } +/*N*/ else +/*N*/ pGraphic->SetSwapState(); +/*N*/ +/*N*/ // Ist die Grafik defekt, oder wurde nur eine leere Graphik eingelesen? +/*N*/ // Daran soll mein Read jedoch nicht scheitern. +/*N*/ if( rIn.GetError() != 0 ) +/*?*/ rIn.ResetError(); +/*N*/ } +/*N*/ +/*N*/ rIn >> aCropRect; +/*N*/ rIn >> bTmp; bMirrored = bTmp; +/*N*/ +/*N*/ rIn.ReadByteString(aName); +/*N*/ // #85414# since there seems to be some documents wich have an illegal +/*N*/ // character inside the name of a graphic object we have to fix this +/*N*/ // here on load time or it will crash our xml later. +/*N*/ const xub_StrLen nLen = aName.Len(); +/*N*/ for( xub_StrLen nIndex = 0; nIndex < nLen; nIndex++ ) +/*N*/ { +/*N*/ if( aName.GetChar( nIndex ) < ' ' ) +/*?*/ aName.SetChar( nIndex, '?' ); +/*N*/ } +/*N*/ +/*N*/ rIn.ReadByteString(aFileNameRel); +/*N*/ +/*N*/ if( aFileNameRel.Len() ) +/*N*/ { +/*N*/ aFileName = ::binfilter::StaticBaseUrl::SmartRelToAbs( aFileNameRel, FALSE, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ else +/*N*/ aFileName.Erase(); +/*N*/ +/*N*/ // UNICODE: rIn >> aFilterName; +/*N*/ rIn.ReadByteString(aFilterName); +/*N*/ +/*N*/ rIn >> bGraphicLink; // auch dieses Flag ist neu in V11 +/*N*/ +/*N*/ if( aCompat.GetBytesLeft() > 0 ) +/*N*/ { +/*N*/ SfxItemPool* pPool = GetItemPool(); +/*N*/ +/*N*/ if( pPool ) +/*N*/ { +/*N*/ sal_uInt16 nSetID = SDRATTRSET_GRAF; +/*N*/ const SdrGrafSetItem* pGrafAttr = (const SdrGrafSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pGrafAttr) +/*N*/ SetItemSet(pGrafAttr->GetItemSet()); +/*N*/ ImpSetAttrToGrafInfo(); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ UINT16 nSuroDummy; +/*?*/ rIn >> nSuroDummy; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ bCopyToPoolOnAfterRead = TRUE; +/*N*/ +/*N*/ if( bGraphicLink && aFileName.Len() ) +/*N*/ { +/*?*/ SetGraphicLink( aFileName, aFilterName ); +/*?*/ +/*?*/ if( !bDelayedLoad ) +/*?*/ ImpUpdateGraphicLink(); +/*N*/ } +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ #ifdef _MSC_VER +/*N*/ #pragma optimize ("",on) +/*N*/ #endif + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::RestartAnimation(SdrPageView* pPageView) const +/*N*/ { +/*N*/ // ToDo: hier noch entsprechend implementieren wie im TextObj +/*N*/ SdrRectObj::RestartAnimation( pPageView ); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::AfterRead() +/*N*/ { +/*N*/ SdrRectObj::AfterRead(); +/*N*/ +/*N*/ if( bCopyToPoolOnAfterRead ) +/*N*/ { +/*N*/ ImpSetGrafInfoToAttr(); +/*N*/ bCopyToPoolOnAfterRead = FALSE; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, +/*N*/ const SfxHint& rHint, const TypeId& rHintType ) +/*N*/ { +/*N*/ SetXPolyDirty(); +/*N*/ SdrRectObj::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); +/*N*/ ImpSetAttrToGrafInfo(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ForceDefaultAttr() +/*N*/ { +/*N*/ SdrRectObj::ForceDefaultAttr(); +/*N*/ +/*N*/ ImpForceItemSet(); +/*N*/ mpObjectItemSet->Put( SdrGrafLuminanceItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafContrastItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafRedItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafGreenItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafBlueItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafGamma100Item( 100 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafTransparenceItem( 0 ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafInvertItem( FALSE ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) ); +/*N*/ mpObjectItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr ) +/*N*/ { +/*N*/ SetXPolyDirty(); +/*N*/ SdrRectObj::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); +/*N*/ ImpSetAttrToGrafInfo(); +/*N*/ } + +// ----------------------------------------------------------------------------- +// ItemSet access + +/*N*/ SfxItemSet* SdrGrafObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // graf attributes +/*N*/ SDRATTR_GRAF_FIRST, SDRATTRSET_GRAF, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access +/*N*/ void SdrGrafObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // local changes +/*N*/ SetXPolyDirty(); +/*N*/ +/*N*/ // call parent +/*N*/ SdrRectObj::ItemSetChanged(rSet); +/*N*/ +/*N*/ // local changes +/*N*/ ImpSetAttrToGrafInfo(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ImpSetAttrToGrafInfo() +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ const sal_uInt16 nTrans = ( (SdrGrafTransparenceItem&) rSet.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue(); +/*N*/ const SdrGrafCropItem& rCrop = (const SdrGrafCropItem&) rSet.Get( SDRATTR_GRAFCROP ); +/*N*/ +/*N*/ aGrafInfo.SetLuminance( ( (SdrGrafLuminanceItem&) rSet.Get( SDRATTR_GRAFLUMINANCE ) ).GetValue() ); +/*N*/ aGrafInfo.SetContrast( ( (SdrGrafContrastItem&) rSet.Get( SDRATTR_GRAFCONTRAST ) ).GetValue() ); +/*N*/ aGrafInfo.SetChannelR( ( (SdrGrafRedItem&) rSet.Get( SDRATTR_GRAFRED ) ).GetValue() ); +/*N*/ aGrafInfo.SetChannelG( ( (SdrGrafGreenItem&) rSet.Get( SDRATTR_GRAFGREEN ) ).GetValue() ); +/*N*/ aGrafInfo.SetChannelB( ( (SdrGrafBlueItem&) rSet.Get( SDRATTR_GRAFBLUE ) ).GetValue() ); +/*N*/ aGrafInfo.SetGamma( ( (SdrGrafGamma100Item&) rSet.Get( SDRATTR_GRAFGAMMA ) ).GetValue() * 0.01 ); +/*N*/ aGrafInfo.SetTransparency( (BYTE) FRound( Min( nTrans, (USHORT) 100 ) * 2.55 ) ); +/*N*/ aGrafInfo.SetInvert( ( (SdrGrafInvertItem&) rSet.Get( SDRATTR_GRAFINVERT ) ).GetValue() ); +/*N*/ aGrafInfo.SetDrawMode( ( (SdrGrafModeItem&) rSet.Get( SDRATTR_GRAFMODE ) ).GetValue() ); +/*N*/ aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() ); +/*N*/ +/*N*/ SetXPolyDirty(); +/*N*/ SetRectsDirty(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::ImpSetGrafInfoToAttr() +/*N*/ { +/*N*/ SetItem( SdrGrafLuminanceItem( aGrafInfo.GetLuminance() ) ); +/*N*/ SetItem( SdrGrafContrastItem( aGrafInfo.GetContrast() ) ); +/*N*/ SetItem( SdrGrafRedItem( aGrafInfo.GetChannelR() ) ); +/*N*/ SetItem( SdrGrafGreenItem( aGrafInfo.GetChannelG() ) ); +/*N*/ SetItem( SdrGrafBlueItem( aGrafInfo.GetChannelB() ) ); +/*N*/ SetItem( SdrGrafGamma100Item( FRound( aGrafInfo.GetGamma() * 100.0 ) ) ); +/*N*/ SetItem( SdrGrafTransparenceItem( (USHORT) FRound( aGrafInfo.GetTransparency() / 2.55 ) ) ); +/*N*/ SetItem( SdrGrafInvertItem( aGrafInfo.IsInvert() ) ); +/*N*/ SetItem( SdrGrafModeItem( aGrafInfo.GetDrawMode() ) ); +/*N*/ SetItem( SdrGrafCropItem( aGrafInfo.GetLeftCrop(), aGrafInfo.GetTopCrop(), aGrafInfo.GetRightCrop(), aGrafInfo.GetBottomCrop() ) ); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, BOOL bShrinkOnly ) +/*N*/ { +/*N*/ Size aSize; +/*N*/ Size aMaxSize( rMaxRect.GetSize() ); +/*N*/ if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) +/*N*/ aSize = Application::GetDefaultDevice()->PixelToLogic( pGraphic->GetPrefSize(), MAP_100TH_MM ); +/*N*/ else +/*N*/ aSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(), +/*N*/ pGraphic->GetPrefMapMode(), +/*N*/ MapMode( MAP_100TH_MM ) ); +/*N*/ +/*N*/ if( aSize.Height() != 0 && aSize.Width() != 0 ) +/*N*/ { +/*N*/ Point aPos( rMaxRect.TopLeft() ); +/*N*/ +/*N*/ // Falls Grafik zu gross, wird die Grafik +/*N*/ // in die Seite eingepasst +/*N*/ if ( (!bShrinkOnly || +/*N*/ ( aSize.Height() > aMaxSize.Height() ) || +/*N*/ ( aSize.Width() > aMaxSize.Width() ) )&& +/*N*/ aSize.Height() && aMaxSize.Height() ) +/*N*/ { +/*N*/ float fGrfWH = (float)aSize.Width() / +/*N*/ (float)aSize.Height(); +/*N*/ float fWinWH = (float)aMaxSize.Width() / +/*N*/ (float)aMaxSize.Height(); +/*N*/ +/*N*/ // Grafik an Pagesize anpassen (skaliert) +/*N*/ if ( fGrfWH < fWinWH ) +/*N*/ { +/*N*/ aSize.Width() = (long)(aMaxSize.Height() * fGrfWH); +/*N*/ aSize.Height()= aMaxSize.Height(); +/*N*/ } +/*N*/ else if ( fGrfWH > 0.F ) +/*N*/ { +/*N*/ aSize.Width() = aMaxSize.Width(); +/*N*/ aSize.Height()= (long)(aMaxSize.Width() / fGrfWH); +/*N*/ } +/*N*/ +/*N*/ aPos = rMaxRect.Center(); +/*N*/ } +/*N*/ +/*N*/ if( bShrinkOnly ) +/*N*/ aPos = aRect.TopLeft(); +/*N*/ +/*N*/ aPos.X() -= aSize.Width() / 2; +/*N*/ aPos.Y() -= aSize.Height() / 2; +/*N*/ SetLogicRect( Rectangle( aPos, aSize ) ); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ IMPL_LINK( SdrGrafObj, ImpSwapHdl, BfGraphicObject*, pO ) +/*N*/ { +/*N*/ SvStream* pRet = GRFMGR_AUTOSWAPSTREAM_NONE; +/*N*/ +/*N*/ if( pO->IsInSwapOut() ) +/*N*/ { +/*N*/ if( pModel != NULL && pModel->IsSwapGraphics() && pGraphic->GetSizeBytes() > 20480 ) +/*N*/ { +/*N*/ SdrViewIter aIter( this ); +/*N*/ SdrView* pView = aIter.FirstView(); +/*N*/ BOOL bVisible = FALSE; +/*N*/ +/*N*/ while( !bVisible && pView ) +/*N*/ { +/*N*/ bVisible = !pView->IsGrafDraft(); +/*N*/ +/*N*/ if( !bVisible ) +/*?*/ pView = aIter.NextView(); +/*N*/ } +/*N*/ +/*N*/ if( !bVisible ) +/*N*/ { +/*N*/ const ULONG nSwapMode = pModel->GetSwapGraphicsMode(); +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ if( ( ( GRAFSTREAMPOS_INVALID != nGrafStreamPos ) || pGraphic->HasUserData() || pGraphicLink ) && +/*N*/ ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) ) +/*N*/ #else +/*N*/ if( ( ( GRAFSTREAMPOS_INVALID != nGrafStreamPos ) || pGraphic->HasUserData() || aFileName.Len() ) && +/*N*/ ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) ) +/*N*/ #endif +/*N*/ { +/*N*/ pRet = NULL; +/*N*/ } +/*N*/ else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP ) +/*N*/ { +/*N*/ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; +/*N*/ pGraphic->SetUserData(); +/*N*/ nGrafStreamPos = GRAFSTREAMPOS_INVALID; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if( pO->IsInSwapIn() ) +/*N*/ { +/*N*/ // kann aus dem original Doc-Stream nachgeladen werden... +/*N*/ if( pModel != NULL ) +/*N*/ { +/*N*/ if( ( GRAFSTREAMPOS_INVALID != nGrafStreamPos ) || pGraphic->HasUserData() ) +/*N*/ { +/*N*/ SdrDocumentStreamInfo aStreamInfo; +/*N*/ +/*N*/ aStreamInfo.mbDeleteAfterUse = FALSE; +/*N*/ aStreamInfo.maUserData = pGraphic->GetUserData(); +/*N*/ aStreamInfo.mpStorageRef = NULL; +/*N*/ +/*N*/ SvStream* pStream = pModel->GetDocumentStream( aStreamInfo ); +/*N*/ +/*N*/ if( pStream != NULL ) +/*N*/ { +/*N*/ Graphic aGraphic; +/*N*/ +/*N*/ if( pGraphic->HasUserData() ) +/*N*/ { +/*?*/ if( !GetGrfFilter()->ImportGraphic( aGraphic, String(), *pStream ) ) +/*?*/ { +/*?*/ const String aUserData( pGraphic->GetUserData() ); +/*?*/ +/*?*/ pGraphic->SetGraphic( aGraphic ); +/*?*/ pGraphic->SetUserData( aUserData ); +/*?*/ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pStream->Seek( nGrafStreamPos ); +/*N*/ *pStream >> aGraphic; +/*N*/ pGraphic->SetGraphic( aGraphic ); +/*N*/ +/*N*/ if( !pStream->GetError() ) +/*N*/ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; +/*N*/ } +/*N*/ +/*N*/ pStream->ResetError(); +/*N*/ +/*N*/ if( aStreamInfo.mbDeleteAfterUse || aStreamInfo.mpStorageRef ) +/*N*/ { +/*N*/ delete pStream; +/*N*/ delete aStreamInfo.mpStorageRef; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if( !ImpUpdateGraphicLink() ) +/*N*/ { +/*?*/ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; +/*N*/ } +/*N*/ } +/*N*/ else +/*?*/ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; +/*N*/ } +/*N*/ +/*N*/ return (long)(void*) pRet; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdogrp.cxx b/binfilter/bf_svx/source/svdraw/svx_svdogrp.cxx new file mode 100644 index 000000000000..732c7b42a02f --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdogrp.cxx @@ -0,0 +1,1030 @@ +/* -*- 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 "svdogrp.hxx" + +#ifndef SVX_LIGHT +#endif + + +#include <bf_svtools/urihelper.hxx> + +#include "xpool.hxx" + +#include "svdmodel.hxx" +#include "svdpage.hxx" +#include "svditer.hxx" +#include "svdio.hxx" +#include "svdoedge.hxx" // #32383# Die Verbinder nach Move nochmal anbroadcasten +#include "svdstr.hrc" // Objektname + + +#include "svxids.hrc" + +#include <bf_svtools/whiter.hxx> +#include "xoutx.hxx" +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +#ifndef SVX_LIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@@ @@@@@ @@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@@@@ @@ @@ @@@@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ +// @@@@ @@@@@ @@@@ @@@@@ @@ @@ @@@@ @@@@ @@ @@@@@ @@ @@ @@ @@ @@ +// +// ImpSdrObjGroupLink zur Verbindung von SdrObjGroup und LinkManager +// +// Einem solchen Link merke ich mir als SdrObjUserData am Objekt. Im Gegensatz +// zum Grafik-Link werden die ObjektDaten jedoch kopiert (fuer Paint, etc.). +// Die Information ob das Objekt ein Link ist besteht genau darin, dass dem +// Objekt ein entsprechender UserData-Record angehaengt ist oder nicht. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +// Closed() wird gerufen, wenn die Verknüpfung geloesst wird. + + + + +#endif // SVX_LIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@ @@ @@ @@ @@ @@ @@ @@@@@ @@@@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@ +// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@@ @@@@ @@ @@ @@@@ @@@@@ @@@@@ @@ @@ @@@@@@ @@ @@@@@@ +// @@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@@ @@ @@ @@ @@ @@ @@@@ @@@@@ @@@@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(ImpSdrObjGroupLinkUserData,SdrObjUserData); + + +/*N*/ ImpSdrObjGroupLinkUserData::ImpSdrObjGroupLinkUserData(SdrObject* pObj1): +/*N*/ SdrObjUserData(SdrInventor,SDRUSERDATA_OBJGROUPLINK,0), +/*N*/ pObj(pObj1), +/*N*/ nDrehWink0(0), +/*N*/ nShearWink0(0), +/*N*/ pLink(NULL), +/*N*/ nObjNum(0), +/*N*/ nPageNum(0), +/*N*/ bMasterPage(FALSE), +/*N*/ bOrigPos(FALSE), +/*N*/ bOrigSize(FALSE), +/*N*/ bOrigRotate(FALSE), +/*N*/ bOrigShear(FALSE) +/*N*/ { +/*N*/ } + + +/*N*/ ImpSdrObjGroupLinkUserData::~ImpSdrObjGroupLinkUserData() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete pLink; +/*N*/ #endif +/*N*/ } + + +/*N*/ SdrObjUserData* ImpSdrObjGroupLinkUserData::Clone(SdrObject* pObj1) const +/*N*/ { +/*N*/ ImpSdrObjGroupLinkUserData* pData=new ImpSdrObjGroupLinkUserData(pObj1); +/*N*/ pData->aFileName =aFileName; +/*N*/ pData->aObjName =aObjName; +/*N*/ pData->aFileDate0 =aFileDate0; +/*N*/ pData->aSnapRect0 =aSnapRect0; +/*N*/ pData->nDrehWink0 =nDrehWink0; +/*N*/ pData->nShearWink0=nShearWink0; +/*N*/ pData->nObjNum =nObjNum; +/*N*/ pData->nPageNum =nPageNum; +/*N*/ pData->bMasterPage=bMasterPage; +/*N*/ pData->bOrigPos =bOrigPos; +/*N*/ pData->bOrigSize =bOrigSize; +/*N*/ pData->bOrigRotate=bOrigRotate; +/*N*/ pData->bOrigShear =bOrigShear; +/*N*/ pData->pLink=NULL; +/*N*/ //pObj1->ImpLinkAnmeldung(); +/*N*/ return pData; +/*N*/ } + + +/*N*/ void ImpSdrObjGroupLinkUserData::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("ImpSdrObjGroupLinkUserData"); +/*N*/ #endif +/*N*/ +/*N*/ String aRelFileName; +/*N*/ +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*N*/ aRelFileName = ::binfilter::StaticBaseUrl::AbsToRel( aFileName, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ +/*N*/ rOut.WriteByteString( aRelFileName ); +/*N*/ +/*N*/ // UNICODE: rOut << aObjName; +/*N*/ rOut.WriteByteString(aObjName); +/*N*/ +/*N*/ rOut << UINT32(aFileDate0.GetDate()); +/*N*/ rOut << UINT32(aFileDate0.GetTime()); +/*N*/ rOut << aSnapRect0; +/*N*/ rOut << nDrehWink0; +/*N*/ rOut << nShearWink0; +/*N*/ rOut << BOOL(bMasterPage); +/*N*/ rOut << nPageNum; +/*N*/ rOut << nObjNum; +/*N*/ rOut << BOOL(bOrigPos); +/*N*/ rOut << BOOL(bOrigSize); +/*N*/ rOut << BOOL(bOrigRotate); +/*N*/ rOut << BOOL(bOrigShear); +/*N*/ } + +/*N*/ void ImpSdrObjGroupLinkUserData::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("ImpSdrObjGroupLinkUserData"); +/*N*/ #endif +/*N*/ +/*N*/ BOOL bTmp; +/*N*/ UINT32 nTmp32; +/*N*/ String aFileNameRel; +/*N*/ +/*N*/ rIn.ReadByteString(aFileNameRel); +/*N*/ +/*N*/ if( aFileNameRel.Len() ) +/*N*/ { +/*N*/ aFileName = ::binfilter::StaticBaseUrl::SmartRelToAbs( aFileNameRel, FALSE, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ else +/*N*/ aFileName.Erase(); +/*N*/ +/*N*/ // UNICODE: rIn >> aObjName; +/*N*/ rIn.ReadByteString(aObjName); +/*N*/ +/*N*/ rIn >> nTmp32; aFileDate0.SetDate(nTmp32); +/*N*/ rIn >> nTmp32; aFileDate0.SetTime(nTmp32); +/*N*/ rIn >> aSnapRect0; +/*N*/ rIn >> nDrehWink0; +/*N*/ rIn >> nShearWink0; +/*N*/ rIn >> bTmp; bMasterPage=bTmp; +/*N*/ rIn >> nPageNum; +/*N*/ rIn >> nObjNum; +/*N*/ rIn >> bTmp; bOrigPos =bTmp; +/*N*/ rIn >> bTmp; bOrigSize =bTmp; +/*N*/ rIn >> bTmp; bOrigRotate=bTmp; +/*N*/ rIn >> bTmp; bOrigShear =bTmp; +/*N*/ } + + +/*N*/ void ImpSdrObjGroupLinkUserData::AfterRead() +/*N*/ { +/*N*/ if (pObj!=NULL) { +/*N*/ ((SdrObjGroup*)pObj)->ImpLinkAnmeldung(); +/*N*/ // lt. Anweisung von MB kein automatisches Reload mehr +/*N*/ //((SdrObjGroup*)pObj)->ReloadLinkedGroup(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@ @@@@@ @@@@ @@ @@ @@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@ @@@@@ @@@@ @@@@@ @@ @@ @@@@ @@@@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrObjGroup,SdrObject); + + +/*N*/ SdrObjGroup::SdrObjGroup() +/*N*/ { +/*N*/ pSub=new SdrObjList(NULL,NULL); +/*N*/ pSub->SetOwnerObj(this); +/*N*/ pSub->SetListKind(SDROBJLIST_GROUPOBJ); +/*N*/ bRefPoint=FALSE; +/*N*/ nDrehWink=0; +/*N*/ nShearWink=0; +/*N*/ bClosedObj=FALSE; +/*N*/ mpGroupItemSet = NULL; +/*N*/ } + + +/*N*/ SdrObjGroup::~SdrObjGroup() +/*N*/ { +/*N*/ ReleaseGroupLink(); +/*N*/ delete pSub; +/*N*/ if(mpGroupItemSet) +/*?*/ delete mpGroupItemSet; +/*N*/ } + + + + +/*N*/ void SdrObjGroup::ReleaseGroupLink() +/*N*/ { +/*N*/ ImpLinkAbmeldung(); +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT nNum=nAnz; nNum>0;) { +/*N*/ nNum--; +/*N*/ SdrObjUserData* pData=GetUserData(nNum); +/*N*/ if (pData->GetInventor()==SdrInventor && pData->GetId()==SDRUSERDATA_OBJGROUPLINK) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ ImpSdrObjGroupLinkUserData* SdrObjGroup::GetLinkUserData() const +/*N*/ { +/*N*/ ImpSdrObjGroupLinkUserData* pData=NULL; +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT nNum=nAnz; nNum>0 && pData==NULL;) { +/*N*/ nNum--; +/*N*/ pData=(ImpSdrObjGroupLinkUserData*)GetUserData(nNum); +/*N*/ if (pData->GetInventor()!=SdrInventor || pData->GetId()!=SDRUSERDATA_OBJGROUPLINK) { +/*N*/ pData=NULL; +/*N*/ } +/*N*/ } +/*N*/ return pData; +/*N*/ } + + + + + + +/*N*/ void SdrObjGroup::ImpLinkAnmeldung() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + +/*N*/ void SdrObjGroup::ImpLinkAbmeldung() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ ImpSdrObjGroupLinkUserData* pData=GetLinkUserData(); +/*N*/ SvxLinkManager* pLinkManager=pModel!=NULL ? pModel->GetLinkManager() : NULL; +/*N*/ if (pLinkManager!=NULL && pData!=NULL && pData->pLink!=NULL) { // Nicht 2x Abmelden +/*N*/ // Bei Remove wird *pLink implizit deleted +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pLinkManager->Remove( pData->pLink ); +/*N*/ } +/*N*/ #endif // SVX_LIGHT +/*N*/ } + + + + +/*N*/ UINT16 SdrObjGroup::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(OBJ_GRUP); +/*N*/ } + + +/*N*/ SdrLayerID SdrObjGroup::GetLayer() const +/*N*/ { +/*N*/ FASTBOOL b1st=TRUE; +/*N*/ SdrLayerID nLay=SdrLayerID(nLayerId); +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ SdrLayerID nLay1=pOL->GetObj(i)->GetLayer(); +/*N*/ if (b1st) { nLay=nLay1; b1st=FALSE; } +/*N*/ else if (nLay1!=nLay) return 0; +/*N*/ } +/*N*/ return nLay; +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer) +/*N*/ { +/*N*/ SdrObject::NbcSetLayer(nLayer); +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ pOL->GetObj(i)->NbcSetLayer(nLayer); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::SetObjList(SdrObjList* pNewObjList) +/*N*/ { +/*N*/ SdrObject::SetObjList(pNewObjList); +/*N*/ pSub->SetUpList(pNewObjList); +/*N*/ } + + +/*N*/ void SdrObjGroup::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ FASTBOOL bLinked=IsLinkedGroup(); +/*N*/ FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL; +/*N*/ FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL; +/*N*/ +/*N*/ if (bLinked && bRemove) { +/*?*/ ImpLinkAbmeldung(); +/*N*/ } +/*N*/ +/*N*/ SdrObject::SetPage(pNewPage); +/*N*/ pSub->SetPage(pNewPage); +/*N*/ +/*N*/ if (bLinked && bInsert) { +/*?*/ ImpLinkAnmeldung(); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ FASTBOOL bLinked=IsLinkedGroup(); +/*N*/ FASTBOOL bChg=pNewModel!=pModel; +/*N*/ if (bLinked && bChg) { +/*N*/ ImpLinkAbmeldung(); +/*N*/ } +/*N*/ +/*N*/ SdrObject::SetModel(pNewModel); +/*N*/ pSub->SetModel(pNewModel); +/*N*/ +/*N*/ if (bLinked && bChg) { +/*?*/ ImpLinkAnmeldung(); +/*N*/ } +/*N*/ } + + + + + + + + +/*N*/ SdrObjList* SdrObjGroup::GetSubList() const +/*N*/ { +/*N*/ return pSub; +/*N*/ } + + + +/*N*/ void SdrObjGroup::SetName(const XubString& rStr) +/*N*/ { +/*N*/ aName=rStr; SetChanged(); +/*N*/ } + + +/*N*/ XubString SdrObjGroup::GetName() const +/*N*/ { +/*N*/ return aName; +/*N*/ } + + +/*N*/ const Rectangle& SdrObjGroup::GetBoundRect() const +/*N*/ { +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ // hier auch das aOutRect=AllObjSnapRect setzen, da GetSnapRect zu selten gerufen wird. +/*N*/ ((SdrObjGroup*)this)->aOutRect=pSub->GetAllObjSnapRect(); +/*N*/ return pSub->GetAllObjBoundRect(); +/*N*/ } else { +/*N*/ return aOutRect; +/*N*/ } +/*N*/ } + + +/*N*/ const Rectangle& SdrObjGroup::GetSnapRect() const +/*N*/ { +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ ((SdrObjGroup*)this)->aOutRect=pSub->GetAllObjSnapRect(); +/*N*/ } +/*N*/ return aOutRect; +/*N*/ } + + +/*N*/ FASTBOOL SdrObjGroup::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec) const +/*N*/ { +/*N*/ FASTBOOL bOk=TRUE; +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ bOk=pSub->Paint(rXOut,rInfoRec); +/*N*/ } else { // ansonsten ist es eine leere Gruppe +/*?*/ if (!rInfoRec.bPrinter && rInfoRec.aPaintLayer.IsSet(nLayerId)) { +/*?*/ OutputDevice* pOutDev=rXOut.GetOutDev(); +/*?*/ pOutDev->SetFillColor(); +/*?*/ pOutDev->SetLineColor(COL_LIGHTGRAY); +/*?*/ pOutDev->DrawRect(aOutRect); +/*N*/ } +/*N*/ } +/*N*/ if (bOk && (rInfoRec.nPaintMode & SDRPAINTMODE_GLUEPOINTS) !=0) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ return bOk; +/*N*/ } + + + +/*SdrObject* SdrObjGroup::Clone() const +{ + SdrObjGroup* pObj=new SdrObjGroup(); + if (pObj!=NULL) { + *pObj=*this; + } + return pObj; +}*/ + + +/*N*/ void SdrObjGroup::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ if (rObj.IsGroupObject()) { +/*N*/ SdrObject::operator=(rObj); +/*N*/ pSub->CopyObjects(*rObj.GetSubList()); +/*N*/ nDrehWink =((SdrObjGroup&)rObj).nDrehWink; +/*N*/ nShearWink =((SdrObjGroup&)rObj).nShearWink; +/*N*/ aName =((SdrObjGroup&)rObj).aName; +/*N*/ aRefPoint =((SdrObjGroup&)rObj).aRefPoint; +/*N*/ bRefPoint =((SdrObjGroup&)rObj).bRefPoint; +/*N*/ } +/*N*/ } + + + + + + +/*N*/ void SdrObjGroup::RecalcSnapRect() +/*N*/ { +/*N*/ // nicht erforderlich, da die Rects von der SubList verwendet werden. +/*N*/ } + + +/*N*/ void MergePoly(XPolyPolygon& rDst, const XPolyPolygon& rSrc) +/*N*/ { +/*N*/ USHORT nAnz=rSrc.Count(); +/*N*/ USHORT i; +/*N*/ for (i=0; i<nAnz; i++) { +/*N*/ rDst.Insert(rSrc.GetObject(i)); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const +/*N*/ { +/*N*/ rPoly.Clear(); +/*N*/ ULONG nAnz=pSub->GetObjCount(); +/*N*/ ULONG i=0; +/*N*/ while (i<nAnz) { +/*N*/ SdrObject* pObj=pSub->GetObj(i); +/*N*/ XPolyPolygon aPP; +/*N*/ pObj->TakeXorPoly(aPP,bDetail); +/*N*/ MergePoly(rPoly,aPP); +/*N*/ i++; +/*N*/ } +/*N*/ if (rPoly.Count()==0) { +/*?*/ rPoly.Insert(XPolygon(aOutRect)); +/*N*/ } +/*N*/ } + + + + + + + +/*N*/ long SdrObjGroup::GetRotateAngle() const +/*N*/ { +/*N*/ return nDrehWink; +/*N*/ } + + +/*N*/ long SdrObjGroup::GetShearAngle(FASTBOOL bVertical) const +/*N*/ { +/*N*/ return nShearWink; +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aOld(GetSnapRect()); +/*N*/ long nMulX=rRect.Right()-rRect.Left(); +/*N*/ long nDivX=aOld.Right()-aOld.Left(); +/*N*/ long nMulY=rRect.Bottom()-rRect.Top(); +/*N*/ long nDivY=aOld.Bottom()-aOld.Top(); +/*N*/ if (nDivX==0) { nMulX=1; nDivX=1; } +/*N*/ if (nDivY==0) { nMulY=1; nDivY=1; } +/*N*/ if (nMulX!=nDivX || nMulY!=nDivY) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) { +/*N*/ NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top())); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ NbcSetSnapRect(rRect); +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ MovePoint(aRefPoint,rSiz); +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ pObj->NbcMove(rSiz); +/*N*/ } +/*N*/ } else { +/*?*/ MoveRect(aOutRect,rSiz); +/*?*/ SetRectsDirty(); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); +/*N*/ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); +/*N*/ if (bXMirr || bYMirr) { +/*N*/ Point aRef1(GetSnapRect().Center()); +/*N*/ if (bXMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.Y()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ if (bYMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.X()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ } +/*N*/ ResizePoint(aRefPoint,rRef,xFact,yFact); +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ pObj->NbcResize(rRef,xFact,yFact); +/*N*/ } +/*N*/ } else { +/*N*/ ResizeRect(aOutRect,rRef,xFact,yFact); +/*N*/ SetRectsDirty(); +/*N*/ } +/*N*/ } + + + + + + + + +/*N*/ void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ aAnchor=rPnt; +/*N*/ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y()); +/*N*/ MovePoint(aRefPoint,aSiz); +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ pObj->NbcSetAnchorPos(rPnt); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::SetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ Rectangle aOld(GetSnapRect()); +/*N*/ long nMulX=rRect.Right()-rRect.Left(); +/*N*/ long nDivX=aOld.Right()-aOld.Left(); +/*N*/ long nMulY=rRect.Bottom()-rRect.Top(); +/*N*/ long nDivY=aOld.Bottom()-aOld.Top(); +/*N*/ if (nDivX==0) { nMulX=1; nDivX=1; } +/*N*/ if (nDivY==0) { nMulY=1; nDivY=1; } +/*N*/ if (nMulX!=nDivX || nMulY!=nDivY) { +/*N*/ Fraction aX(nMulX,nDivX); +/*N*/ Fraction aY(nMulY,nDivY); +/*N*/ Resize(aOld.TopLeft(),aX,aY); +/*N*/ } +/*N*/ if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) { +/*?*/ Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top())); +/*N*/ } +/*N*/ SendRepaintBroadcast(TRUE); +/*N*/ SetChanged(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + + + + +/*N*/ void SdrObjGroup::Move(const Size& rSiz) +/*N*/ { +/*N*/ if (rSiz.Width()!=0 || rSiz.Height()!=0) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ MovePoint(aRefPoint,rSiz); +/*N*/ if (pSub->GetObjCount()!=0) { +/*N*/ // #32383# Erst die Verbinder verschieben, dann den Rest +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ ULONG i; +/*N*/ for (i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ if (pObj->IsEdgeObj()) pObj->Move(rSiz); +/*N*/ } +/*N*/ for (i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ if (!pObj->IsEdgeObj()) pObj->Move(rSiz); +/*N*/ } +/*N*/ SendRepaintBroadcast(TRUE); +/*N*/ } else { +/*N*/ SendRepaintBroadcast(); +/*N*/ MoveRect(aOutRect,rSiz); +/*N*/ SetRectsDirty(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ SetChanged(); +/*N*/ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { +/*N*/ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); +/*N*/ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); +/*N*/ if (bXMirr || bYMirr) { +/*N*/ Point aRef1(GetSnapRect().Center()); +/*N*/ if (bXMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.Y()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ if (bYMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.X()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ } +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ ResizePoint(aRefPoint,rRef,xFact,yFact); +/*N*/ if (pSub->GetObjCount()!=0) { +/*?*/ // #32383# Erst die Verbinder verschieben, dann den Rest +/*?*/ SdrObjList* pOL=pSub; +/*?*/ ULONG nObjAnz=pOL->GetObjCount(); +/*?*/ ULONG i; +/*?*/ for (i=0; i<nObjAnz; i++) { +/*?*/ SdrObject* pObj=pOL->GetObj(i); +/*?*/ if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact); +/*?*/ } +/*?*/ for (i=0; i<nObjAnz; i++) { +/*?*/ SdrObject* pObj=pOL->GetObj(i); +/*?*/ if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact); +/*?*/ } +/*?*/ SendRepaintBroadcast(TRUE); +/*N*/ } else { +/*N*/ SendRepaintBroadcast(); +/*N*/ ResizeRect(aOutRect,rRef,xFact,yFact); +/*N*/ SetRectsDirty(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ SetChanged(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + + + + + + + + +/*N*/ void SdrObjGroup::SetAnchorPos(const Point& rPnt) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ FASTBOOL bChg=aAnchor!=rPnt; +/*N*/ aAnchor=rPnt; +/*N*/ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y()); +/*N*/ MovePoint(aRefPoint,aSiz); +/*N*/ // #32383# Erst die Verbinder verschieben, dann den Rest +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ ULONG i; +/*N*/ for (i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt); +/*N*/ } +/*N*/ for (i=0; i<nObjAnz; i++) { +/*N*/ SdrObject* pObj=pOL->GetObj(i); +/*N*/ if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt); +/*N*/ } +/*N*/ if (bChg) { +/*N*/ SendRepaintBroadcast(TRUE); +/*N*/ SetChanged(); +/*N*/ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); +/*N*/ } +/*N*/ } + + + + + +/*N*/ void SdrObjGroup::SetRelativePos(const Point& rPnt) +/*N*/ { +/*N*/ Point aRelPos0(GetSnapRect().TopLeft()-aAnchor); +/*N*/ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y()); +/*N*/ if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // Der ruft auch das SetRectsDirty() und Broadcast, ... +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ const SfxItemSet& SdrObjGroup::GetItemSet() const +/*N*/ { +/*N*/ // prepare ItemSet +/*N*/ if(mpGroupItemSet) +/*N*/ mpGroupItemSet->ClearItem(); +/*N*/ else +/*N*/ { +/*N*/ ((SdrObjGroup*)this)->mpGroupItemSet = +/*N*/ ((SdrObjGroup*)this)->CreateNewItemSet((SfxItemPool&)(*GetItemPool())); +/*N*/ DBG_ASSERT(mpGroupItemSet, "Could not create an SfxItemSet(!)"); +/*N*/ } +/*N*/ +/*N*/ // collect all ItemSets in mpGroupItemSet +/*N*/ sal_uInt32 nCount(pSub->GetObjCount()); +/*N*/ for(sal_uInt32 a(0); a < nCount; a++) +/*N*/ { +/*N*/ const SfxItemSet& rSet = pSub->GetObj(a)->GetItemSet(); +/*N*/ SfxWhichIter aIter(rSet); +/*N*/ sal_uInt16 nWhich(aIter.FirstWhich()); +/*N*/ +/*N*/ while(nWhich) +/*N*/ { +/*N*/ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, FALSE)) +/*N*/ mpGroupItemSet->InvalidateItem(nWhich); +/*N*/ else +/*N*/ mpGroupItemSet->MergeValue(rSet.Get(nWhich), TRUE); +/*N*/ +/*N*/ nWhich = aIter.NextWhich(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return *mpGroupItemSet; +/*N*/ } + +/*N*/ SfxItemSet* SdrObjGroup::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items +/*N*/ return new SfxItemSet(rPool, SDRATTR_START, SDRATTR_END); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access + +/*N*/ void SdrObjGroup::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) +/*N*/ { +/*N*/ if(!IsLinkedGroup()) +/*N*/ { +/*N*/ // ItemChange at all contained objects +/*N*/ List aPostItemChangeList; +/*N*/ sal_uInt32 nCount(pSub->GetObjCount()); +/*N*/ +/*N*/ sal_uInt32 a; for(a = 0; a < nCount; a++) +/*N*/ { +/*N*/ SdrObject* pObj = pSub->GetObj(a); +/*N*/ if(pObj->AllowItemChange(nWhich, pNewItem)) +/*N*/ { +/*N*/ pObj->ItemChange(nWhich, pNewItem); +/*N*/ aPostItemChangeList.Insert((void*)pObj, LIST_APPEND); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ for(a = 0; a < aPostItemChangeList.Count(); a++) +/*N*/ { +/*N*/ SdrObject* pObj = (SdrObject*)aPostItemChangeList.GetObject(a); +/*N*/ pObj->PostItemChange(nWhich); +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet was changed, maybe user wants to react + +/*N*/ void SdrObjGroup::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ if(!IsLinkedGroup()) +/*N*/ { +/*N*/ sal_uInt32 nCount(pSub->GetObjCount()); +/*N*/ for(sal_uInt32 a(0); a < nCount; a++) +/*N*/ pSub->GetObj(a)->ItemSetChanged(rSet); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrObjGroup::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::PreSave(); +/*N*/ +/*N*/ if(!IsLinkedGroup()) +/*N*/ { +/*N*/ sal_uInt32 nCount(pSub->GetObjCount()); +/*N*/ for(sal_uInt32 a(0); a < nCount; a++) +/*N*/ pSub->GetObj(a)->PreSave(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjGroup::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrObject::PostSave(); +/*N*/ +/*N*/ if(!IsLinkedGroup()) +/*N*/ { +/*N*/ sal_uInt32 nCount(pSub->GetObjCount()); +/*N*/ for(sal_uInt32 a(0); a < nCount; a++) +/*N*/ pSub->GetObj(a)->PostSave(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SfxStyleSheet* SdrObjGroup::GetStyleSheet() const +/*N*/ { +/*N*/ // Hier mit 'nem Iterator. Es koennte sonst passieren dass ein +/*N*/ // verschachteltes Gruppenobjekt wegen DontCare NULL liefert. +/*N*/ // Das koennte ich dann nicht unterscheiden von NotSet. +/*N*/ SfxStyleSheet* pRet=NULL; +/*N*/ FASTBOOL b1st=TRUE; +/*N*/ SdrObjListIter aIter(*this,IM_DEEPNOGROUPS); +/*N*/ while (aIter.IsMore()) { +/*N*/ SdrObject* pObj=aIter.Next(); +/*N*/ if (b1st) { +/*N*/ b1st=FALSE; +/*N*/ pRet=pObj->GetStyleSheet(); // Der Erste +/*N*/ } else { +/*N*/ if (pObj->GetStyleSheet()!=pRet) return NULL; // Unterschiedlich! +/*N*/ } +/*N*/ } +/*N*/ // Wenn hier angekommen, sind alle gleich. +/*N*/ return pRet; +/*N*/ } + + +/*N*/ void SdrObjGroup::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ if (!IsLinkedGroup()) { +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) { +/*N*/ pOL->GetObj(i)->NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ if (!IsLinkedGroup()) { +/*N*/ SdrObjList* pOL=pSub; +/*N*/ ULONG nObjAnz=pOL->GetObjCount(); +/*N*/ for (ULONG i=0; i<nObjAnz; i++) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ } + + + + +/*N*/ void SdrObjGroup::ReformatText() +/*N*/ { +/*N*/ pSub->ReformatAllTextObjects(); +/*N*/ } + + + + +/*N*/ void SdrObjGroup::RestartAnimation(SdrPageView* pPageView) const +/*N*/ { +/*N*/ pSub->RestartAllAnimations(pPageView); +/*N*/ } + + + + +/*N*/ void SdrObjGroup::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrObject::WriteData(rOut); +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrObjGroup"); +/*N*/ #endif +/*N*/ +/*N*/ // UNICODE: rOut << aName; +/*N*/ rOut.WriteByteString(aName); +/*N*/ +/*N*/ UINT8 nTemp = bRefPoint; rOut << nTemp; +/*N*/ rOut << aRefPoint; +/*N*/ pSub->Save(rOut); +/*N*/ rOut << INT32(nDrehWink); +/*N*/ rOut << INT32(nShearWink); +/*N*/ } + + +/*N*/ void SdrObjGroup::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if(rIn.GetError()) +/*N*/ return; +/*N*/ +/*N*/ SdrObject::ReadData(rHead, rIn); +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrObjGroup"); +/*N*/ #endif +/*N*/ +/*N*/ // UNICODE: rIn >> aName; +/*N*/ rIn.ReadByteString(aName); +/*N*/ +/*N*/ UINT8 nTemp; rIn >> nTemp; bRefPoint = nTemp; +/*N*/ rIn >> aRefPoint; +/*N*/ pSub->Load(rIn, *pPage); +/*N*/ +/*N*/ if(rHead.GetVersion() >= 2) +/*N*/ { +/*N*/ INT32 n32; +/*N*/ +/*N*/ rIn >> n32; nDrehWink = n32; +/*N*/ rIn >> n32; nShearWink = n32; +/*N*/ } +/*N*/ } + + +/*N*/ void SdrObjGroup::AfterRead() +/*N*/ { +/*N*/ SdrObject::AfterRead(); +/*N*/ pSub->AfterRead(); +/*N*/ +/*N*/ // #80049# as fix for errors after #69055# +/*N*/ if(aAnchor.X() || aAnchor.Y()) +/*N*/ NbcSetAnchorPos(aAnchor); +/*N*/ } + +// ItemPool fuer dieses Objekt wechseln + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdomeas.cxx b/binfilter/bf_svx/source/svdraw/svx_svdomeas.cxx new file mode 100644 index 000000000000..1ba74b2622c1 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdomeas.cxx @@ -0,0 +1,1012 @@ +/* -*- 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 "svdomeas.hxx" +#include <math.h> +#include "xoutx.hxx" +#include "svdoutl.hxx" +#include "svdpool.hxx" +#include "svdattrx.hxx" +#include "svdio.hxx" +#include "svdview.hxx" +#include "svdstr.hrc" // Objektname + +#include <bf_svtools/style.hxx> + + + +#include "xlnstit.hxx" + +#include "xlnstwit.hxx" + +#include "xlnedit.hxx" + +#include "xlnwtit.hxx" + +#include "xlnedwit.hxx" + +#include "xlnstcit.hxx" + +#include "xlnedcit.hxx" + + + +#include <editobj.hxx> + + +#include "itemdata.hxx" + +#include "svdfield.hxx" + + +#include <bf_svtools/syslocale.hxx> + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SV_IMPL_PERSIST1(SdrMeasureField,SvxFieldData); +/*N*/ +/*N*/ __EXPORT SdrMeasureField::~SdrMeasureField() +/*N*/ { +/*N*/ } + +/*N*/ SvxFieldData* __EXPORT SdrMeasureField::Clone() const +/*N*/ { +/*N*/ return new SdrMeasureField(*this); +/*N*/ } + +/*N*/ int __EXPORT SdrMeasureField::operator==(const SvxFieldData& rSrc) const +/*N*/ { +/*N*/ return eMeasureFieldKind==((SdrMeasureField&)rSrc).GetMeasureFieldKind(); +/*N*/ } + +/*N*/ void __EXPORT SdrMeasureField::Load(SvPersistStream& rIn) +/*N*/ { +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrMeasureField"); +/*N*/ #endif +/*N*/ UINT16 nFieldKind; +/*N*/ rIn>>nFieldKind; +/*N*/ eMeasureFieldKind=(SdrMeasureFieldKind)nFieldKind; +/*N*/ } + +/*N*/ void __EXPORT SdrMeasureField::Save(SvPersistStream& rOut) +/*N*/ { +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrMeasureField"); +/*N*/ #endif +/*N*/ rOut<<(UINT16)eMeasureFieldKind; +/*N*/ } + +/*?*/ void SdrMeasureField::TakeRepresentation(const SdrMeasureObj& rObj, XubString& rStr) const +/*?*/ { +/*?*/ rStr.Erase(); +/*?*/ Fraction aMeasureScale(1, 1); +/*?*/ BOOL bTextRota90(FALSE); +/*?*/ BOOL bShowUnit(FALSE); +/*?*/ FieldUnit eMeasureUnit(FUNIT_NONE); +/*?*/ FieldUnit eModUIUnit(FUNIT_NONE); +/*?*/ +/*?*/ const SfxItemSet& rSet = rObj.GetItemSet(); +/*?*/ bTextRota90 = ((SdrMeasureTextRota90Item&)rSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue(); +/*?*/ eMeasureUnit = ((SdrMeasureUnitItem&)rSet.Get(SDRATTR_MEASUREUNIT)).GetValue(); +/*?*/ aMeasureScale = ((SdrMeasureScaleItem&)rSet.Get(SDRATTR_MEASURESCALE)).GetValue(); +/*?*/ bShowUnit = ((SdrMeasureShowUnitItem&)rSet.Get(SDRATTR_MEASURESHOWUNIT)).GetValue(); +/*?*/ sal_Int16 nNumDigits = ((SdrMeasureDecimalPlacesItem&)rSet.Get(SDRATTR_MEASUREDECIMALPLACES)).GetValue(); +/*?*/ +/*?*/ SdrModel* pModel = rObj.pModel; +/*?*/ +/*?*/ switch(eMeasureFieldKind) +/*?*/ { +/*?*/ case SDRMEASUREFIELD_VALUE: +/*?*/ { +/*?*/ if(pModel) +/*?*/ { +/*?*/ eModUIUnit = pModel->GetUIUnit(); +/*?*/ +/*?*/ if(eMeasureUnit == FUNIT_NONE) +/*?*/ eMeasureUnit = eModUIUnit; +/*?*/ +/*?*/ INT32 nLen(GetLen(rObj.aPt2 - rObj.aPt1)); +/*?*/ Fraction aFact(1,1); +/*?*/ +/*?*/ if(eMeasureUnit != eModUIUnit) +/*?*/ { +/*?*/ // Zur Umrechnung der Einheiten +/*?*/ aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X(); +/*?*/ } +/*?*/ +/*?*/ if(aMeasureScale.GetNumerator() != aMeasureScale.GetDenominator()) +/*?*/ { +/*?*/ aFact *= aMeasureScale; +/*?*/ } +/*?*/ +/*?*/ if(aFact.GetNumerator() != aFact.GetDenominator()) +/*?*/ { +/*?*/ // Scaling ueber BigInt, um Ueberlaeufe zu vermeiden +/*?*/ nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator()); +/*?*/ } +/*?*/ +/*?*/ pModel->TakeMetricStr(nLen, rStr, TRUE, nNumDigits); +/*?*/ +/*?*/ if(!aFact.IsValid()) +/*?*/ { +/*?*/ rStr = String(); +/*?*/ rStr += sal_Unicode('?'); +/*?*/ } +/*?*/ +/*?*/ sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0)); +/*?*/ +/*?*/ if(rStr.Search(cDec) != STRING_NOTFOUND) +/*?*/ { +/*?*/ xub_StrLen nLen(rStr.Len() - 1); +/*?*/ +/*?*/ while(rStr.GetChar(nLen) == sal_Unicode('0')) +/*?*/ { +/*?*/ rStr.Erase(nLen); +/*?*/ nLen--; +/*?*/ } +/*?*/ +/*?*/ if(rStr.GetChar(nLen) == cDec) +/*?*/ { +/*?*/ rStr.Erase(nLen); +/*?*/ nLen--; +/*?*/ } +/*?*/ +/*?*/ if(!rStr.Len()) +/*?*/ rStr += sal_Unicode('0'); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // falls kein Model da ... (z.B. Preview im Dialog) +/*?*/ rStr = String(); +/*?*/ rStr.AppendAscii("4711"); +/*?*/ } +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ case SDRMEASUREFIELD_UNIT: +/*?*/ { +/*?*/ if(bShowUnit) +/*?*/ { +/*?*/ if(rObj.pModel) +/*?*/ { +/*?*/ eModUIUnit = pModel->GetUIUnit(); +/*?*/ +/*?*/ if(eMeasureUnit == FUNIT_NONE) +/*?*/ eMeasureUnit = eModUIUnit; +/*?*/ +/*?*/ if(bShowUnit) +/*?*/ pModel->TakeUnitStr(eMeasureUnit, rStr); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ case SDRMEASUREFIELD_ROTA90BLANCS: +/*?*/ { +/*?*/ if(bTextRota90) +/*?*/ { +/*?*/ rStr = String(); +/*?*/ rStr += sal_Unicode(' '); +/*?*/ } +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ } +/*?*/ } + +/*N*/ TYPEINIT1(SdrMeasureObj,SdrTextObj); + +/*N*/ void SdrMeasureObj::ForceDefaultAttr() +/*N*/ { +/*N*/ SdrTextObj::ForceDefaultAttr(); +/*N*/ +/*N*/ //#71958# by default, the show units Bool-Item is set as hard +/*N*/ // attribute to TRUE to aviod confusion when copying SdrMeasureObj's +/*N*/ // from one application to another +/*N*/ ImpForceItemSet(); +/*N*/ mpObjectItemSet->Put(SdrMeasureShowUnitItem(TRUE)); +/*N*/ +/*N*/ XPolygon aXP(4); // [] +/*N*/ aXP[0] = Point(100,0); // 0,4__[]__2,4 +/*N*/ aXP[1] = Point(200,400); // \ / +/*N*/ aXP[2] = Point(0,400); // \ / +/*N*/ aXP[3] = Point(100,0); // \/1,0 +/*N*/ +/*N*/ mpObjectItemSet->Put(XLineStartItem(String(), aXP)); +/*N*/ mpObjectItemSet->Put(XLineStartWidthItem(200)); +/*N*/ mpObjectItemSet->Put(XLineEndItem(String(), aXP)); +/*N*/ mpObjectItemSet->Put(XLineEndWidthItem(200)); +/*N*/ mpObjectItemSet->Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ } + +/*N*/ SdrMeasureObj::SdrMeasureObj(): +/*N*/ bTextDirty(FALSE) +/*N*/ { +/*N*/ } + +/*N*/ SdrMeasureObj::SdrMeasureObj(const Point& rPt1, const Point& rPt2): +/*N*/ aPt1(rPt1), +/*N*/ aPt2(rPt2), +/*N*/ bTextDirty(FALSE) +/*N*/ { +/*N*/ } + +/*N*/ SdrMeasureObj::~SdrMeasureObj() +/*N*/ { +/*N*/ } + + +/*N*/ UINT16 SdrMeasureObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return (UINT16)OBJ_MEASURE; +/*N*/ } + +/*N*/ struct ImpMeasureRec +/*N*/ { +/*N*/ Point aPt1; +/*N*/ Point aPt2; +/*N*/ SdrMeasureKind eKind; +/*N*/ SdrMeasureTextHPos eWantTextHPos; +/*N*/ SdrMeasureTextVPos eWantTextVPos; +/*N*/ long nLineDist; +/*N*/ long nHelplineOverhang; +/*N*/ long nHelplineDist; +/*N*/ long nHelpline1Len; +/*N*/ long nHelpline2Len; +/*N*/ FASTBOOL bBelowRefEdge; +/*N*/ FASTBOOL bTextRota90; +/*N*/ FASTBOOL bTextUpsideDown; +/*N*/ long nMeasureOverhang; +/*N*/ FieldUnit eMeasureUnit; +/*N*/ Fraction aMeasureScale; +/*N*/ FASTBOOL bShowUnit; +/*N*/ String aFormatString; +/*N*/ FASTBOOL bTextAutoAngle; +/*N*/ long nTextAutoAngleView; +/*N*/ FASTBOOL bTextIsFixedAngle; +/*N*/ long nTextFixedAngle; +/*N*/ }; +/*N*/ +/*N*/ struct ImpLineRec +/*N*/ { +/*N*/ Point aP1; +/*N*/ Point aP2; +/*N*/ }; +/*N*/ +/*N*/ struct ImpMeasurePoly +/*N*/ { +/*N*/ ImpLineRec aMainline1; // die mit dem 1. Pfeil +/*N*/ ImpLineRec aMainline2; // die mit dem 2. Pfeil +/*N*/ ImpLineRec aMainline3; // die dazwischen +/*N*/ ImpLineRec aHelpline1; +/*N*/ ImpLineRec aHelpline2; +/*N*/ Rectangle aTextRect; +/*N*/ Size aTextSize; +/*N*/ long nLineLen; +/*N*/ long nLineWink; +/*N*/ long nTextWink; +/*N*/ long nHlpWink; +/*N*/ double nLineSin; +/*N*/ double nLineCos; +/*N*/ double nHlpSin; +/*N*/ double nHlpCos; +/*N*/ USHORT nMainlineAnz; +/*N*/ SdrMeasureTextHPos eUsedTextHPos; +/*N*/ SdrMeasureTextVPos eUsedTextVPos; +/*N*/ long nLineWdt2; // Halbe Strichstaerke +/*N*/ long nArrow1Len; // Laenge des 1. Pfeils. Bei Center nur die Haelfte +/*N*/ long nArrow2Len; // Laenge des 2. Pfeils. Bei Center nur die Haelfte +/*N*/ long nArrow1Wdt; // Breite des 1. Pfeils +/*N*/ long nArrow2Wdt; // Breite des 2. Pfeils +/*N*/ long nShortLineLen; // Linienlaenge, wenn PfeileAussen +/*N*/ FASTBOOL bArrow1Center; // Pfeil 1 zentriert? +/*N*/ FASTBOOL bArrow2Center; // Pfeil 2 zentriert? +/*N*/ FASTBOOL bAutoUpsideDown; // UpsideDown durch Automatik +/*N*/ FASTBOOL bPfeileAussen; +/*N*/ FASTBOOL bBreakedLine; +/*N*/ }; + +/*N*/ void SdrMeasureObj::ImpTakeAttr(ImpMeasureRec& rRec) const +/*N*/ { +/*N*/ rRec.aPt1 = aPt1; +/*N*/ rRec.aPt2 = aPt2; +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ rRec.eKind =((SdrMeasureKindItem& )rSet.Get(SDRATTR_MEASUREKIND )).GetValue(); +/*N*/ rRec.eWantTextHPos =((SdrMeasureTextHPosItem& )rSet.Get(SDRATTR_MEASURETEXTHPOS )).GetValue(); +/*N*/ rRec.eWantTextVPos =((SdrMeasureTextVPosItem& )rSet.Get(SDRATTR_MEASURETEXTVPOS )).GetValue(); +/*N*/ rRec.nLineDist =((SdrMeasureLineDistItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue(); +/*N*/ rRec.nHelplineOverhang=((SdrMeasureHelplineOverhangItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue(); +/*N*/ rRec.nHelplineDist =((SdrMeasureHelplineDistItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue(); +/*N*/ rRec.nHelpline1Len =((SdrMeasureHelpline1LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue(); +/*N*/ rRec.nHelpline2Len =((SdrMeasureHelpline2LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue(); +/*N*/ rRec.bBelowRefEdge =((SdrMeasureBelowRefEdgeItem& )rSet.Get(SDRATTR_MEASUREBELOWREFEDGE )).GetValue(); +/*N*/ rRec.bTextRota90 =((SdrMeasureTextRota90Item& )rSet.Get(SDRATTR_MEASURETEXTROTA90 )).GetValue(); +/*N*/ rRec.bTextUpsideDown =((SdrMeasureTextUpsideDownItem& )rSet.Get(SDRATTR_MEASURETEXTUPSIDEDOWN )).GetValue(); +/*N*/ rRec.nMeasureOverhang =((SdrMeasureOverhangItem& )rSet.Get(SDRATTR_MEASUREOVERHANG )).GetValue(); +/*N*/ rRec.eMeasureUnit =((SdrMeasureUnitItem& )rSet.Get(SDRATTR_MEASUREUNIT )).GetValue(); +/*N*/ rRec.aMeasureScale =((SdrMeasureScaleItem& )rSet.Get(SDRATTR_MEASURESCALE )).GetValue(); +/*N*/ rRec.bShowUnit =((SdrMeasureShowUnitItem& )rSet.Get(SDRATTR_MEASURESHOWUNIT )).GetValue(); +/*N*/ rRec.aFormatString =((SdrMeasureFormatStringItem& )rSet.Get(SDRATTR_MEASUREFORMATSTRING )).GetValue(); +/*N*/ rRec.bTextAutoAngle =((SdrMeasureTextAutoAngleItem& )rSet.Get(SDRATTR_MEASURETEXTAUTOANGLE )).GetValue(); +/*N*/ rRec.nTextAutoAngleView=((SdrMeasureTextAutoAngleViewItem&)rSet.Get(SDRATTR_MEASURETEXTAUTOANGLEVIEW)).GetValue(); +/*N*/ rRec.bTextIsFixedAngle =((SdrMeasureTextIsFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTISFIXEDANGLE )).GetValue(); +/*N*/ rRec.nTextFixedAngle =((SdrMeasureTextFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTFIXEDANGLE )).GetValue(); +/*N*/ } + +/*N*/ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const +/*N*/ { +/*N*/ Point aP1(rRec.aPt1); +/*N*/ Point aP2(rRec.aPt2); +/*N*/ Point aDelt(aP2); aDelt-=aP1; +/*N*/ +/*N*/ rPol.aTextSize=GetTextSize(); +/*N*/ rPol.nLineLen=GetLen(aDelt); +/*N*/ +/*N*/ rPol.nLineWdt2=0; +/*N*/ long nArrow1Len=0; FASTBOOL bArrow1Center=FALSE; +/*N*/ long nArrow2Len=0; FASTBOOL bArrow2Center=FALSE; +/*N*/ long nArrow1Wdt=0; +/*N*/ long nArrow2Wdt=0; +/*N*/ rPol.nArrow1Wdt=0; +/*N*/ rPol.nArrow2Wdt=0; +/*N*/ long nArrowNeed=0; +/*N*/ long nShortLen=0; +/*N*/ FASTBOOL bPfeileAussen=FALSE; +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke +/*N*/ rPol.nLineWdt2 = (nLineWdt + 1) / 2; +/*N*/ +/*N*/ nArrow1Wdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue(); +/*N*/ if(nArrow1Wdt < 0) +/*N*/ nArrow1Wdt = -nLineWdt * nArrow1Wdt / 100; // <0 = relativ +/*N*/ +/*N*/ nArrow2Wdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue(); +/*N*/ if(nArrow2Wdt < 0) +/*N*/ nArrow2Wdt = -nLineWdt * nArrow2Wdt / 100; // <0 = relativ +/*N*/ +/*N*/ XPolygon aPol1(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetValue()); +/*N*/ XPolygon aPol2(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetValue()); +/*N*/ bArrow1Center = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue(); +/*N*/ bArrow2Center = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue(); +/*N*/ nArrow1Len = XOutputDevice::InitLineStartEnd(aPol1, nArrow1Wdt, bArrow1Center) - 1; +/*N*/ nArrow2Len = XOutputDevice::InitLineStartEnd(aPol2, nArrow2Wdt, bArrow2Center) - 1; +/*N*/ +/*N*/ // nArrowLen ist bei bCenter bereits halbiert +/*N*/ // Bei 2 Pfeilen a 4mm ist unter 10mm Schluss. +/*N*/ nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2; +/*N*/ if (rPol.nLineLen<nArrowNeed) bPfeileAussen=TRUE; +/*N*/ nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2; +/*N*/ +/*N*/ rPol.eUsedTextHPos=rRec.eWantTextHPos; +/*N*/ rPol.eUsedTextVPos=rRec.eWantTextVPos; +/*N*/ if (rPol.eUsedTextVPos==SDRMEASURE_TEXTVAUTO) rPol.eUsedTextVPos=SDRMEASURE_ABOVE; +/*N*/ FASTBOOL bBrkLine=rPol.eUsedTextVPos==SDRMEASURETEXT_BREAKEDLINE; +/*N*/ if (rPol.eUsedTextVPos==SDRMEASURETEXT_VERTICALCENTERED) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if (pOutlinerParaObject!=NULL && pOutlinerParaObject->GetTextObject().GetParagraphCount()==1) { +/*N*/ } +/*N*/ rPol.bBreakedLine=bBrkLine; +/*N*/ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTHAUTO) { // bei zu breitem Text diesen eventuell nach aussen schieben +/*N*/ FASTBOOL bOutside=FALSE; +/*N*/ long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height(); +/*N*/ if (nNeedSiz>rPol.nLineLen) bOutside=TRUE; // Text passt nicht in die Mitte +/*N*/ if (bBrkLine) { +/*N*/ if (nNeedSiz+nArrowNeed>rPol.nLineLen) bPfeileAussen=TRUE; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen +/*N*/ } else { +/*N*/ long nSmallNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2/4; +/*N*/ if (nNeedSiz+nSmallNeed>rPol.nLineLen) bPfeileAussen=TRUE; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen +/*N*/ } +/*N*/ rPol.eUsedTextHPos=bOutside ? SDRMEASURE_TEXTLEFTOUTSIDE : SDRMEASURE_TEXTINSIDE; +/*N*/ } +/*N*/ if (rPol.eUsedTextHPos!=SDRMEASURE_TEXTINSIDE) bPfeileAussen=TRUE; +/*N*/ rPol.nArrow1Wdt=nArrow1Wdt; +/*N*/ rPol.nArrow2Wdt=nArrow2Wdt; +/*N*/ rPol.nShortLineLen=nShortLen; +/*N*/ rPol.bPfeileAussen=bPfeileAussen; +/*N*/ rPol.nArrow1Len=nArrow1Len; +/*N*/ rPol.bArrow1Center=bArrow1Center; +/*N*/ rPol.nArrow2Len=nArrow2Len; +/*N*/ rPol.bArrow2Center=bArrow2Center; +/*N*/ +/*N*/ rPol.nLineWink=GetAngle(aDelt); +/*N*/ double a=rPol.nLineWink*nPi180; +/*N*/ double nLineSin=sin(a); +/*N*/ double nLineCos=cos(a); +/*N*/ rPol.nLineSin=nLineSin; +/*N*/ rPol.nLineCos=nLineCos; +/*N*/ +/*N*/ rPol.nTextWink=rPol.nLineWink; +/*N*/ if (rRec.bTextRota90) rPol.nTextWink+=9000; +/*N*/ +/*N*/ rPol.bAutoUpsideDown=FALSE; +/*N*/ if (rRec.bTextAutoAngle) { +/*N*/ long nTmpWink=NormAngle360(rPol.nTextWink-rRec.nTextAutoAngleView); +/*N*/ if (nTmpWink>=18000) { +/*N*/ rPol.nTextWink+=18000; +/*N*/ rPol.bAutoUpsideDown=TRUE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (rRec.bTextUpsideDown) rPol.nTextWink+=18000; +/*N*/ rPol.nTextWink=NormAngle360(rPol.nTextWink); +/*N*/ rPol.nHlpWink=rPol.nLineWink+9000; +/*N*/ if (rRec.bBelowRefEdge) rPol.nHlpWink+=18000; +/*N*/ rPol.nHlpWink=NormAngle360(rPol.nHlpWink); +/*N*/ double nHlpSin=nLineCos; +/*N*/ double nHlpCos=-nLineSin; +/*N*/ if (rRec.bBelowRefEdge) { +/*N*/ nHlpSin=-nHlpSin; +/*N*/ nHlpCos=-nHlpCos; +/*N*/ } +/*N*/ rPol.nHlpSin=nHlpSin; +/*N*/ rPol.nHlpCos=nHlpCos; +/*N*/ +/*N*/ long nLineDist=rRec.nLineDist; +/*N*/ long nOverhang=rRec.nHelplineOverhang; +/*N*/ long nHelplineDist=rRec.nHelplineDist; +/*N*/ +/*N*/ long dx= Round(nLineDist*nHlpCos); +/*N*/ long dy=-Round(nLineDist*nHlpSin); +/*N*/ long dxh1a= Round((nHelplineDist-rRec.nHelpline1Len)*nHlpCos); +/*N*/ long dyh1a=-Round((nHelplineDist-rRec.nHelpline1Len)*nHlpSin); +/*N*/ long dxh1b= Round((nHelplineDist-rRec.nHelpline2Len)*nHlpCos); +/*N*/ long dyh1b=-Round((nHelplineDist-rRec.nHelpline2Len)*nHlpSin); +/*N*/ long dxh2= Round((nLineDist+nOverhang)*nHlpCos); +/*N*/ long dyh2=-Round((nLineDist+nOverhang)*nHlpSin); +/*N*/ +/*N*/ // Masshilfslinie 1 +/*N*/ rPol.aHelpline1.aP1=Point(aP1.X()+dxh1a,aP1.Y()+dyh1a); +/*N*/ rPol.aHelpline1.aP2=Point(aP1.X()+dxh2,aP1.Y()+dyh2); +/*N*/ +/*N*/ // Masshilfslinie 2 +/*N*/ rPol.aHelpline2.aP1=Point(aP2.X()+dxh1b,aP2.Y()+dyh1b); +/*N*/ rPol.aHelpline2.aP2=Point(aP2.X()+dxh2,aP2.Y()+dyh2); +/*N*/ +/*N*/ // Masslinie(n) +/*N*/ Point aMainlinePt1(aP1.X()+dx,aP1.Y()+dy); +/*N*/ Point aMainlinePt2(aP2.X()+dx,aP2.Y()+dy); +/*N*/ if (!bPfeileAussen) { +/*N*/ rPol.aMainline1.aP1=aMainlinePt1; +/*N*/ rPol.aMainline1.aP2=aMainlinePt2; +/*N*/ rPol.aMainline2=rPol.aMainline1; +/*N*/ rPol.aMainline3=rPol.aMainline1; +/*N*/ rPol.nMainlineAnz=1; +/*N*/ if (bBrkLine) { +/*?*/ long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height(); +/*?*/ long nHalfLen=(rPol.nLineLen-nNeedSiz-nArrow1Wdt/4-nArrow2Wdt/4) /2; +/*?*/ rPol.nMainlineAnz=2; +/*?*/ rPol.aMainline1.aP2=aMainlinePt1; +/*?*/ rPol.aMainline1.aP2.X()+=nHalfLen; +/*?*/ RotatePoint(rPol.aMainline1.aP2,rPol.aMainline1.aP1,nLineSin,nLineCos); +/*?*/ rPol.aMainline2.aP1=aMainlinePt2; +/*?*/ rPol.aMainline2.aP1.X()-=nHalfLen; +/*?*/ RotatePoint(rPol.aMainline2.aP1,rPol.aMainline2.aP2,nLineSin,nLineCos); +/*N*/ } +/*N*/ } else { +/*N*/ long nLen1=nShortLen; // Pfeilbreite als Linienlaenge ausserhalb des Pfeils +/*N*/ long nLen2=nShortLen; +/*N*/ long nTextWdt=rRec.bTextRota90 ? rPol.aTextSize.Height() : rPol.aTextSize.Width(); +/*N*/ if (!bBrkLine) { +/*N*/ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTLEFTOUTSIDE) nLen1=nArrow1Len+nTextWdt; +/*N*/ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTRIGHTOUTSIDE) nLen2=nArrow2Len+nTextWdt; +/*N*/ } +/*N*/ rPol.aMainline1.aP1=aMainlinePt1; +/*N*/ rPol.aMainline1.aP2=aMainlinePt1; rPol.aMainline1.aP2.X()-=nLen1; RotatePoint(rPol.aMainline1.aP2,aMainlinePt1,nLineSin,nLineCos); +/*N*/ rPol.aMainline2.aP1=aMainlinePt2; rPol.aMainline2.aP1.X()+=nLen2; RotatePoint(rPol.aMainline2.aP1,aMainlinePt2,nLineSin,nLineCos); +/*N*/ rPol.aMainline2.aP2=aMainlinePt2; +/*N*/ rPol.aMainline3.aP1=aMainlinePt1; +/*N*/ rPol.aMainline3.aP2=aMainlinePt2; +/*N*/ rPol.nMainlineAnz=3; +/*N*/ if (bBrkLine && rPol.eUsedTextHPos==SDRMEASURE_TEXTINSIDE) rPol.nMainlineAnz=2; +/*N*/ } +/*N*/ } + +/*N*/ void SdrMeasureObj::ImpCalcXPoly(const ImpMeasurePoly& rPol, XPolyPolygon& rXPP) const +/*N*/ { +/*N*/ rXPP.Clear(); +/*N*/ XPolygon aXP(2); +/*N*/ aXP[0]=rPol.aMainline1.aP1; +/*N*/ aXP[1]=rPol.aMainline1.aP2; +/*N*/ rXPP.Insert(aXP); +/*N*/ if (rPol.nMainlineAnz>1) { +/*N*/ aXP[0]=rPol.aMainline2.aP1; +/*N*/ aXP[1]=rPol.aMainline2.aP2; +/*N*/ rXPP.Insert(aXP); +/*N*/ } +/*N*/ if (rPol.nMainlineAnz>2) { +/*N*/ aXP[0]=rPol.aMainline3.aP1; +/*N*/ aXP[1]=rPol.aMainline3.aP2; +/*N*/ rXPP.Insert(aXP); +/*N*/ } +/*N*/ aXP[0]=rPol.aHelpline1.aP1; +/*N*/ aXP[1]=rPol.aHelpline1.aP2; +/*N*/ rXPP.Insert(aXP); +/*N*/ aXP[0]=rPol.aHelpline2.aP1; +/*N*/ aXP[1]=rPol.aHelpline2.aP2; +/*N*/ rXPP.Insert(aXP); +/*N*/ } + + +/*N*/ FASTBOOL SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, USHORT nPos, +/*N*/ FASTBOOL bEdit, +/*N*/ Color*& rpTxtColor, Color*& rpFldColor, XubString& rRet) const +/*N*/ { +/*N*/ const SvxFieldData* pField=rField.GetField(); +/*N*/ SdrMeasureField* pMeasureField=PTR_CAST(SdrMeasureField,pField); +/*N*/ if (pMeasureField!=NULL) { +/*N*/ pMeasureField->TakeRepresentation(*this,rRet); +/*N*/ if (rpFldColor!=NULL) { +/*?*/ if (!bEdit) +/*?*/ { +/*?*/ delete rpFldColor; +/*?*/ rpFldColor=NULL; +/*?*/ } +/*N*/ } +/*N*/ return TRUE; +/*N*/ } else { +/*?*/ return SdrTextObj::CalcFieldValue(rField,nPara,nPos,bEdit,rpTxtColor,rpFldColor,rRet); +/*N*/ } +/*N*/ } + +/*N*/ void SdrMeasureObj::UndirtyText() const +/*N*/ { +/*N*/ if (bTextDirty) { +/*N*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ if (pOutlinerParaObject==NULL) { +/*N*/ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_ROTA90BLANCS)),ESelection(0,0)); +/*N*/ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_VALUE)),ESelection(0,1)); +/*N*/ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_UNIT)),ESelection(0,2)); +/*N*/ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_ROTA90BLANCS)),ESelection(0,3)); +/*N*/ +/*N*/ if(GetStyleSheet()) +/*N*/ rOutliner.SetStyleSheet(0, GetStyleSheet()); +/*N*/ +/*N*/ rOutliner.SetParaAttribs(0, GetItemSet()); +/*N*/ +/*N*/ // casting auf nonconst +/*N*/ ((SdrMeasureObj*)this)->pOutlinerParaObject=rOutliner.CreateParaObject(); +/*N*/ } else { +/*N*/ rOutliner.SetText(*pOutlinerParaObject); +/*N*/ } +/*N*/ rOutliner.SetUpdateMode(TRUE); +/*N*/ rOutliner.UpdateFields(); +/*N*/ Size aSiz(rOutliner.CalcTextSize()); +/*N*/ rOutliner.Clear(); +/*N*/ // 3x casting auf nonconst +/*N*/ ((SdrMeasureObj*)this)->aTextSize=aSiz; +/*N*/ ((SdrMeasureObj*)this)->bTextSizeDirty=FALSE; +/*N*/ ((SdrMeasureObj*)this)->bTextDirty=FALSE; +/*N*/ } +/*N*/ } + +/*N*/ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ ImpMeasureRec aRec; +/*N*/ ImpMeasurePoly aMPol; +/*N*/ ImpTakeAttr(aRec); +/*N*/ ImpCalcGeometrics(aRec,aMPol); +/*N*/ +/*N*/ // TextSize ermitteln inkl. Textrahmenabstaende +/*N*/ Size aTextSize(aMPol.aTextSize); +/*N*/ if (aTextSize.Width()<1) aTextSize.Width()=1; +/*N*/ if (aTextSize.Height()<1) aTextSize.Height()=1; +/*N*/ aTextSize.Width()+=GetTextLeftDistance()+GetTextRightDistance(); +/*N*/ aTextSize.Height()+=GetTextUpperDistance()+GetTextLowerDistance(); +/*N*/ +/*N*/ Point aPt1(aMPol.aMainline1.aP1); +/*N*/ long nLen=aMPol.nLineLen; +/*N*/ long nLWdt=aMPol.nLineWdt2; +/*N*/ long nArr1Len=aMPol.nArrow1Len; +/*N*/ long nArr2Len=aMPol.nArrow2Len; +/*N*/ if (aMPol.bBreakedLine) { +/*N*/ // Bei Unterbrochener Linie und Outside muss der Text nicht neben den +/*N*/ // Pfeil sondern neben die Linie an dem Pfeil plaziert werden +/*?*/ nArr1Len=aMPol.nShortLineLen+aMPol.nArrow1Wdt/4; +/*?*/ nArr2Len=aMPol.nShortLineLen+aMPol.nArrow2Wdt/4; +/*N*/ } +/*N*/ +/*N*/ Point aTextPos; +/*N*/ FASTBOOL bRota90=aRec.bTextRota90; +/*N*/ FASTBOOL bUpsideDown=aRec.bTextUpsideDown!=aMPol.bAutoUpsideDown; +/*N*/ FASTBOOL bBelowRefEdge=aRec.bBelowRefEdge; +/*N*/ SdrMeasureTextHPos eMH=aMPol.eUsedTextHPos; +/*N*/ SdrMeasureTextVPos eMV=aMPol.eUsedTextVPos; +/*N*/ if (!bRota90) { +/*N*/ switch (eMH) { +/*N*/ case SDRMEASURE_TEXTLEFTOUTSIDE: aTextPos.X()=aPt1.X()-aTextSize.Width()-nArr1Len-nLWdt; break; +/*N*/ case SDRMEASURE_TEXTRIGHTOUTSIDE: aTextPos.X()=aPt1.X()+nLen+nArr2Len+nLWdt; break; +/*N*/ default: aTextPos.X()=aPt1.X(); aTextSize.Width()=nLen; +/*N*/ } +/*N*/ switch (eMV) { +/*N*/ case SDRMEASURETEXT_VERTICALCENTERED: +/*N*/ case SDRMEASURETEXT_BREAKEDLINE: aTextPos.Y()=aPt1.Y()-aTextSize.Height()/2; break; +/*N*/ case SDRMEASURE_BELOW: { +/*N*/ if (!bUpsideDown) aTextPos.Y()=aPt1.Y()+nLWdt; +/*N*/ else aTextPos.Y()=aPt1.Y()-aTextSize.Height()-nLWdt; +/*N*/ } break; +/*N*/ default: { +/*N*/ if (!bUpsideDown) aTextPos.Y()=aPt1.Y()-aTextSize.Height()-nLWdt; +/*N*/ else aTextPos.Y()=aPt1.Y()+nLWdt; +/*N*/ } +/*N*/ } +/*N*/ if (bUpsideDown) { +/*N*/ aTextPos.X()+=aTextSize.Width(); +/*N*/ aTextPos.Y()+=aTextSize.Height(); +/*N*/ } +/*N*/ } else { // also wenn bTextRota90==TRUE +/*N*/ switch (eMH) { +/*N*/ case SDRMEASURE_TEXTLEFTOUTSIDE: aTextPos.X()=aPt1.X()-aTextSize.Height()-nArr1Len; break; +/*N*/ case SDRMEASURE_TEXTRIGHTOUTSIDE: aTextPos.X()=aPt1.X()+nLen+nArr2Len; break; +/*N*/ default: aTextPos.X()=aPt1.X(); aTextSize.Height()=nLen; +/*N*/ } +/*N*/ switch (eMV) { +/*N*/ case SDRMEASURETEXT_VERTICALCENTERED: +/*N*/ case SDRMEASURETEXT_BREAKEDLINE: aTextPos.Y()=aPt1.Y()+aTextSize.Width()/2; break; +/*N*/ case SDRMEASURE_BELOW: { +/*N*/ if (!bBelowRefEdge) aTextPos.Y()=aPt1.Y()+aTextSize.Width()+nLWdt; +/*N*/ else aTextPos.Y()=aPt1.Y()-nLWdt; +/*N*/ } break; +/*N*/ default: { +/*N*/ if (!bBelowRefEdge) aTextPos.Y()=aPt1.Y()-nLWdt; +/*N*/ else aTextPos.Y()=aPt1.Y()+aTextSize.Width()+nLWdt; +/*N*/ } +/*N*/ } +/*N*/ if (bUpsideDown) { +/*N*/ aTextPos.X()+=aTextSize.Height(); +/*N*/ aTextPos.Y()-=aTextSize.Width(); +/*N*/ } +/*N*/ } +/*N*/ if (aMPol.nTextWink!=aGeo.nDrehWink) { +/*N*/ ((SdrMeasureObj*)this)->aGeo.nDrehWink=aMPol.nTextWink; +/*N*/ ((SdrMeasureObj*)this)->aGeo.RecalcSinCos(); +/*N*/ } +/*N*/ RotatePoint(aTextPos,aPt1,aMPol.nLineSin,aMPol.nLineCos); +/*N*/ aTextSize.Width()++; aTextSize.Height()++; // wg. des komischen Verhaltens beim Rect-Ctor +/*N*/ rRect=Rectangle(aTextPos,aTextSize); +/*N*/ rRect.Justify(); +/*N*/ ((SdrMeasureObj*)this)->aRect=rRect; +/*N*/ +/*N*/ if (aMPol.nTextWink!=aGeo.nDrehWink) { +/*N*/ ((SdrMeasureObj*)this)->aGeo.nDrehWink=aMPol.nTextWink; +/*N*/ ((SdrMeasureObj*)this)->aGeo.RecalcSinCos(); +/*N*/ } +/*N*/ } + + + + + + + + + + + + + + + + + + + + + + + + + +/*N*/ void SdrMeasureObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ SdrTextObj::NbcMove(rSiz); +/*N*/ MovePoint(aPt1,rSiz); +/*N*/ MovePoint(aPt2,rSiz); +/*N*/ } + +/*N*/ void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrTextObj::NbcResize(rRef,xFact,yFact); +/*N*/ ResizePoint(aPt1,rRef,xFact,yFact); +/*N*/ ResizePoint(aPt2,rRef,xFact,yFact); +/*N*/ SetTextDirty(); +/*N*/ } + + + + + + +/*N*/ long SdrMeasureObj::GetRotateAngle() const +/*N*/ { +/*N*/ return GetAngle(aPt2-aPt1); +/*N*/ } + +/*N*/ void SdrMeasureObj::RecalcBoundRect() +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ ImpMeasureRec aRec; +/*N*/ ImpMeasurePoly aMPol; +/*N*/ ImpTakeAttr(aRec); +/*N*/ ImpCalcGeometrics(aRec,aMPol); +/*N*/ XPolyPolygon aXPP; +/*N*/ ImpCalcXPoly(aMPol,aXPP); +/*N*/ aOutRect=aXPP.GetBoundRect(); +/*N*/ +/*N*/ // Strichstaerke und Linienenden drauftun +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ long nLEndWdt=ImpGetLineEndAdd(); +/*N*/ if (nLEndWdt>nLineWdt) nLineWdt=nLEndWdt; +/*N*/ if (nLineWdt!=0) { +/*N*/ aOutRect.Left ()-=nLineWdt; +/*N*/ aOutRect.Top ()-=nLineWdt; +/*N*/ aOutRect.Right ()+=nLineWdt; +/*N*/ aOutRect.Bottom()+=nLineWdt; +/*N*/ } +/*N*/ +/*N*/ // AW 10082000 taken out, seems not to be necessary... +/*N*/ // Rectangle aTempRect; +/*N*/ // TakeUnrotatedSnapRect(aTempRect); // Damit aRect gesetzt ist +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + +/*N*/ void SdrMeasureObj::RecalcSnapRect() +/*N*/ { +/*N*/ // !!!!! nur zu Testzwecken !!!!! +/*N*/ //maSnapRect=Rectangle(aPt1,aPt2); +/*N*/ //maSnapRect.Justify(); +/*N*/ +/*N*/ // #94520# Added correct implementation here. +/*N*/ ImpMeasureRec aRec; +/*N*/ ImpMeasurePoly aMPol; +/*N*/ XPolyPolygon aXPP; +/*N*/ +/*N*/ ImpTakeAttr(aRec); +/*N*/ ImpCalcGeometrics(aRec, aMPol); +/*N*/ ImpCalcXPoly(aMPol, aXPP); +/*N*/ maSnapRect = aXPP.GetBoundRect(); +/*N*/ } + + + + + +/*N*/ const Point& SdrMeasureObj::GetPoint(USHORT i) const +/*N*/ { +/*N*/ return i==0 ? aPt1 : aPt2; +/*N*/ } + +/*N*/ void SdrMeasureObj::NbcSetPoint(const Point& rPnt, USHORT i) +/*N*/ { +/*N*/ if (i==0) aPt1=rPnt; +/*N*/ if (i==1) aPt2=rPnt; +/*N*/ SetRectsDirty(); +/*N*/ SetTextDirty(); +/*N*/ } + + + + + + +/*N*/ FASTBOOL SdrMeasureObj::BegTextEdit(SdrOutliner& rOutl) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");return FALSE; //STRIP001 +/*N*/ } + +/*N*/ void SdrMeasureObj::EndTextEdit(SdrOutliner& rOutl) +/*N*/ { +/*N*/ SdrTextObj::EndTextEdit(rOutl); +/*N*/ } + +/*N*/ const Size& SdrMeasureObj::GetTextSize() const +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ return SdrTextObj::GetTextSize(); +/*N*/ } + +/*N*/ OutlinerParaObject* SdrMeasureObj::GetOutlinerParaObject() const +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ return pOutlinerParaObject; +/*N*/ } + +/*N*/ void SdrMeasureObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) +/*N*/ { +/*N*/ SdrTextObj::NbcSetOutlinerParaObject(pTextObject); +/*N*/ if (pOutlinerParaObject==NULL) SetTextDirty(); // Text neu berechnen! +/*N*/ } + +/*N*/ void SdrMeasureObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText, +/*N*/ Rectangle* pAnchorRect, BOOL bLineWidth ) const +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ SdrTextObj::TakeTextRect( rOutliner, rTextRect, bNoEditText, pAnchorRect, bLineWidth ); +/*N*/ } + +/*N*/ void SdrMeasureObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const +/*N*/ { +/*N*/ if (bTextDirty) UndirtyText(); +/*N*/ SdrTextObj::TakeTextAnchorRect(rAnchorRect); +/*N*/ } + + + + +/*N*/ void __EXPORT SdrMeasureObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ if (HAS_BASE(SfxStyleSheet,&rBC)) { +/*?*/ SfxSimpleHint* pSimple=PTR_CAST(SfxSimpleHint,&rHint); +/*?*/ ULONG nId=pSimple==NULL ? 0 : pSimple->GetId(); +/*?*/ +/*?*/ if(nId == SFX_HINT_DATACHANGED) +/*?*/ { +/*?*/ // Alten Bereich invalidieren +/*?*/ SendRepaintBroadcast(); +/*?*/ +/*?*/ // Text hart aufVeraenderung setzen +/*?*/ SetTextDirty(); +/*?*/ } +/*N*/ } +/*N*/ SdrTextObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ } + +/*N*/ void SdrMeasureObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SetTextDirty(); +/*N*/ SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ SfxItemSet* SdrMeasureObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ // include ALL items, 2D and 3D +/*N*/ return new SfxItemSet(rPool, +/*N*/ // ranges from SdrAttrObj +/*N*/ SDRATTR_START, SDRATTRSET_SHADOW, +/*N*/ SDRATTRSET_OUTLINER, SDRATTRSET_MISC, +/*N*/ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, +/*N*/ +/*N*/ // measure attributes +/*N*/ SDRATTR_MEASURE_FIRST, SDRATTRSET_MEASURE, +/*N*/ +/*N*/ // outliner and end +/*N*/ EE_ITEMS_START, EE_ITEMS_END, +/*N*/ 0, 0); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access +/*N*/ void SdrMeasureObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::ItemSetChanged(rSet); +/*N*/ +/*N*/ // local changes +/*N*/ SetTextDirty(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrMeasureObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::PreSave(); +/*N*/ +/*N*/ // prepare SetItems for storage +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ const SfxItemSet* pParent = GetStyleSheet() ? &GetStyleSheet()->GetItemSet() : 0L; +/*N*/ SdrMeasureSetItem aMeasAttr(rSet.GetPool()); +/*N*/ aMeasAttr.GetItemSet().Put(rSet); +/*N*/ aMeasAttr.GetItemSet().SetParent(pParent); +/*N*/ mpObjectItemSet->Put(aMeasAttr); +/*N*/ } + +/*N*/ void SdrMeasureObj::PostSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::PostSave(); +/*N*/ +/*N*/ // remove SetItems from local itemset +/*N*/ mpObjectItemSet->ClearItem(SDRATTRSET_MEASURE); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMeasureObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ UndirtyText(); +/*N*/ +/*N*/ SdrTextObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrMeasureObj"); +/*N*/ #endif +/*N*/ +/*N*/ rOut << aPt1; +/*N*/ rOut << aPt2; +/*N*/ rOut << BOOL(FALSE); // bTextOverwritten wg. Kompatibilitaet. Gibt's nicht mehr. +/*N*/ +/*N*/ SfxItemPool* pPool=GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetUnmergedItemSet(); +/*N*/ +/*N*/ pPool->StoreSurrogate(rOut, &rSet.Get(SDRATTRSET_MEASURE)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rOut << sal_uInt16(SFX_ITEMS_NULL); +/*N*/ } +/*N*/ } + +/*N*/ void SdrMeasureObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrTextObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrMeasureObj"); +/*N*/ #endif +/*N*/ rIn>>aPt1; +/*N*/ rIn>>aPt2; +/*N*/ BOOL bTextOverwrittenTmp; +/*N*/ rIn>>bTextOverwrittenTmp; +/*N*/ SfxItemPool* pPool=GetItemPool(); +/*N*/ +/*N*/ if(pPool) +/*N*/ { +/*N*/ sal_uInt16 nSetID = SDRATTRSET_MEASURE; +/*N*/ const SdrMeasureSetItem* pMeasAttr = (const SdrMeasureSetItem*)pPool->LoadSurrogate(rIn, nSetID, 0); +/*N*/ if(pMeasAttr) +/*N*/ SetItemSet(pMeasAttr->GetItemSet()); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ sal_uInt16 nSuroDum; +/*N*/ rIn >> nSuroDum; +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdoole2.cxx b/binfilter/bf_svx/source/svdraw/svx_svdoole2.cxx new file mode 100644 index 000000000000..dc40cbf0cd52 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdoole2.cxx @@ -0,0 +1,902 @@ +/* -*- 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/util/XModifyBroadcaster.hpp> + + +#include <bf_sfx2/interno.hxx> +#include <comphelper/classids.hxx> + + + + +#include "svdoole2.hxx" +#include <bf_svtools/solar.hrc> + +#include "svdio.hxx" +#include "svdstr.hrc" // Objektname +#include "svdetc.hxx" +#include "svdview.hxx" +#include "unomlstr.hxx" +#include <bf_so3/client.hxx> + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED +#define SO2_DECL_SVINPLACEOBJECT_DEFINED +SO2_DECL_REF(SvInPlaceObject) +#endif + +/*N*/ class SdrOle2ObjImpl +/*N*/ { +/*N*/ public: +/*N*/ GDIMetaFile* pMetaFile; // Metafile fuer GetMtf kopieren und merken +/*N*/ BfGraphicObject* pGraphicObject; +/*N*/ String aPersistName; // name of object in persist +/*N*/ +/*N*/ // #107645# +/*N*/ // New local var to avoid repeated loading if load of OLE2 fails +/*N*/ sal_Bool mbLoadingOLEObjectFailed; +/*N*/ +/*N*/ bool mbConnected; +/*N*/ +/*N*/ }; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +// Predicate determining whether the given OLE is an internal math +// object +/*N*/ static bool ImplIsMathObj( const SvInPlaceObjectRef& rObjRef ) +/*N*/ { +/*N*/ if( !rObjRef.Is() ) +/*N*/ return false; +/*N*/ +/*N*/ SvGlobalName aClassName( rObjRef->GetClassName() ); +/*N*/ +/*N*/ if( aClassName == SvGlobalName(BF_SO3_SM_CLASSID_30) || +/*N*/ aClassName == SvGlobalName(BF_SO3_SM_CLASSID_40) || +/*N*/ aClassName == SvGlobalName(BF_SO3_SM_CLASSID_50) || +/*N*/ aClassName == SvGlobalName(BF_SO3_SM_CLASSID_60) || +/*N*/ aClassName == SvGlobalName(BF_SO3_SM_CLASSID) ) +/*N*/ { +/*N*/ return true; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ return false; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ TYPEINIT1(SdrOle2Obj,SdrRectObj); +/*N*/ +/*N*/ SdrOle2Obj::SdrOle2Obj(FASTBOOL bFrame_) +/*N*/ { +/*N*/ bInDestruction = FALSE; +/*N*/ Init(); +/*N*/ +/*N*/ ppObjRef=new SvInPlaceObjectRef; +/*N*/ bFrame=bFrame_; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrOle2Obj::SdrOle2Obj(const SvInPlaceObjectRef& rNewObjRef, const XubString& rNewObjName, const Rectangle& rNewRect, FASTBOOL bFrame_): +/*N*/ SdrRectObj(rNewRect) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::Init() +/*N*/ { +/*N*/ mpImpl = new SdrOle2ObjImpl; +/*N*/ pModifyListener = NULL; +/*N*/ pGraphic=NULL; +/*N*/ mpImpl->pMetaFile=NULL; +/*N*/ mpImpl->pGraphicObject=NULL; +/*N*/ +/*N*/ // #107645# +/*N*/ // init to start situation, loading did not fail +/*N*/ mpImpl->mbLoadingOLEObjectFailed = sal_False; +/*N*/ +/*N*/ mpImpl->mbConnected = false; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ SdrOle2Obj::~SdrOle2Obj() +/*N*/ { +/*N*/ bInDestruction = TRUE; +/*N*/ // Aus Cache entfernen +/*N*/ GetSdrGlobalData().GetOLEObjCache().RemoveObj(this); +/*N*/ +/*N*/ SvInPlaceObjectRef aRef( *ppObjRef ); +/*N*/ +/*N*/ Disconnect(); +/*N*/ +/*N*/ if(pModel && aRef.Is()) +/*N*/ { +/*N*/ SvPersist* pPers=pModel->GetPersist(); +/*N*/ if(pPers!=NULL) +/*N*/ { +/*?*/ pPers->Remove(aRef); +/*N*/ } +/*N*/ } +/*N*/ aRef.Clear(); +/*N*/ +/*N*/ delete ppObjRef; +/*N*/ +/*N*/ if(pGraphic!=NULL) +/*?*/ delete pGraphic; +/*N*/ +/*N*/ if(mpImpl->pMetaFile!=NULL) +/*?*/ delete mpImpl->pMetaFile; +/*N*/ +/*N*/ if(mpImpl->pGraphicObject!=NULL) +/*?*/ delete mpImpl->pGraphicObject; +/*N*/ +/*N*/ if(pModifyListener) +/*N*/ { +/*N*/ pModifyListener->invalidate(); +/*N*/ pModifyListener->release(); +/*N*/ pModifyListener = NULL; +/*N*/ } +/*N*/ delete mpImpl; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetGraphic(const Graphic* pGrf) +/*N*/ { +/*N*/ if ( pGraphic ) +/*N*/ { +/*?*/ delete pGraphic; +/*?*/ pGraphic = NULL; +/*?*/ delete mpImpl->pGraphicObject; +/*?*/ mpImpl->pGraphicObject = NULL; +/*N*/ } +/*N*/ +/*N*/ if (pGrf!=NULL) +/*N*/ { +/*?*/ pGraphic = new Graphic(*pGrf); +/*?*/ mpImpl->pGraphicObject = new BfGraphicObject( *pGraphic ); +/*N*/ } +/*N*/ +/*N*/ if ( ppObjRef->Is() && pGrf ) +/*?*/ SendRepaintBroadcast(); +/*N*/ +/*N*/ SetChanged(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ FASTBOOL SdrOle2Obj::IsEmpty() const +/*N*/ { +/*N*/ return !ppObjRef->Is(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::Connect() +/*N*/ { +/*N*/ if(pModel && mpImpl->aPersistName.Len()) +/*N*/ { +/*N*/ SvPersist* pPers=pModel->GetPersist(); +/*N*/ if (pPers!=NULL) +/*N*/ { +/*N*/ SvInfoObjectRef xIObj; +/*N*/ SvInfoObject* pInfo = pPers->Find(mpImpl->aPersistName); +/*N*/ +/*N*/ if (!pInfo) +/*N*/ { +/*?*/ if ( !ppObjRef->Is() ) +/*?*/ GetObjRef(); // try to load inplace object +/*?*/ +/*?*/ xIObj = pInfo = new SvEmbeddedInfoObject(*ppObjRef,mpImpl->aPersistName); +/*N*/ } +/*N*/ +/*N*/ if ( !pPers->HasObject(mpImpl->aPersistName) ) +/*N*/ { +/*?*/ pPers->Move(pInfo, mpImpl->aPersistName); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pInfo->SetDeleted(FALSE); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // In Cache einfuegen +/*N*/ GetSdrGlobalData().GetOLEObjCache().InsertObj(this); +/*N*/ } +/*N*/ +/*N*/ if ( ppObjRef->Is() && (*ppObjRef)->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) +/*N*/ { +/*N*/ if (pModel && pModel->GetRefDevice() && +/*N*/ pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER) +/*N*/ { +/*?*/ // Kein RefDevice oder RefDevice kein Printer +/*?*/ BOOL bModified = (*ppObjRef)->IsModified(); +/*?*/ Printer* pPrinter = (Printer*) pModel->GetRefDevice(); +/*?*/ (*ppObjRef)->OnDocumentPrinterChanged( pPrinter ); +/*?*/ (*ppObjRef)->SetModified( bModified ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( !IsEmpty() ) +/*N*/ { +/*?*/ // register modify listener +/*?*/ if( pModifyListener == NULL ) +/*?*/ { +/*?*/ ((SdrOle2Obj*)this)->pModifyListener = new SvxUnoShapeModifyListener( (SdrOle2Obj*)this ); +/*?*/ pModifyListener->acquire(); +/*?*/ } +/*?*/ +/*?*/ uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); +/*?*/ if( xBC.is() && pModifyListener ) +/*?*/ { +/*?*/ uno::Reference< util::XModifyListener > xListener( pModifyListener ); +/*?*/ xBC->addModifyListener( xListener ); +/*?*/ } +/*?*/ +/*?*/ mpImpl->mbConnected = true; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::Disconnect() +/*N*/ { +/*N*/ if( !mpImpl->mbConnected ) +/*N*/ return; +/*N*/ +/*N*/ if( !IsEmpty() && mpImpl->aPersistName.Len() ) +/*N*/ { +/*N*/ uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); +/*N*/ if( xBC.is() && pModifyListener ) +/*N*/ { +/*N*/ uno::Reference< util::XModifyListener > xListener( pModifyListener ); +/*N*/ xBC->removeModifyListener( xListener ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (pModel && mpImpl->aPersistName.Len() ) +/*N*/ { +/*N*/ if( pModel->IsInDestruction() ) +/*N*/ { +/*N*/ *ppObjRef = NULL; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SvPersist* pPers = pModel->GetPersist(); +/*N*/ +/*N*/ if (pPers) +/*N*/ { +/*N*/ SvInfoObject* pInfo = pPers->Find(mpImpl->aPersistName); +/*N*/ +/*N*/ if (pInfo) +/*N*/ { +/*N*/ pInfo->SetDeleted(TRUE); +/*N*/ pInfo->SetObj(0); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( ppObjRef->Is() ) +/*N*/ (*ppObjRef)->DoClose(); +/*N*/ } +/*N*/ +/*N*/ // Aus Cache entfernen +/*N*/ GetSdrGlobalData().GetOLEObjCache().RemoveObj(this); +/*N*/ +/*N*/ if ( ppObjRef->Is() ) +/*N*/ ppObjRef->Clear(); +/*N*/ } +/*N*/ +/*N*/ mpImpl->mbConnected = false; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ FASTBOOL bChg = pNewModel!=pModel; +/*N*/ +/*N*/ if( bChg ) +/*N*/ Disconnect(); // mit dem alten Namen +/*N*/ +/*N*/ if( pModel && pNewModel ) +/*N*/ { +/*?*/ SvPersist* pDestPers = pNewModel->GetPersist(); +/*?*/ SvPersist* pSrcPers = pModel->GetPersist(); +/*?*/ +/*?*/ if( pDestPers && pSrcPers && ( pDestPers != pSrcPers ) ) +/*?*/ { +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ImpCopyObject( *pSrcPers, *pDestPers, mpImpl->aPersistName ); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ SdrRectObj::SetModel( pNewModel ); +/*N*/ +/*N*/ if( bChg ) +/*N*/ Connect(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL; +/*N*/ FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL; +/*N*/ +/*N*/ if (bRemove) Disconnect(); +/*N*/ +/*N*/ SdrRectObj::SetPage(pNewPage); +/*N*/ +/*N*/ if (bInsert) Connect(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetObjRef(const SvInPlaceObjectRef& rNewObjRef) +/*N*/ { +/*N*/ if( rNewObjRef == *ppObjRef ) +/*N*/ return; +/*N*/ +/*N*/ Disconnect(); +/*N*/ +/*N*/ *ppObjRef=rNewObjRef; +/*N*/ +/*N*/ SvInPlaceObjectRef& rIPRef = *ppObjRef; +/*N*/ +/*N*/ if (rIPRef.Is() && +/*N*/ (rIPRef->GetMiscStatus() & SVOBJ_MISCSTATUS_NOTRESIZEABLE) ) +/*N*/ { +/*N*/ SetResizeProtect(TRUE); +/*N*/ } +/*N*/ +/*N*/ // #108759# For math objects, set closed state to transparent +/*N*/ if( ImplIsMathObj( *ppObjRef ) ) +/*N*/ SetClosedObj( false ); +/*N*/ +/*N*/ Connect(); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetClosedObj( bool bIsClosed ) +/*N*/ { +/*N*/ // #108759# Allow changes to the closed state of OLE objects +/*N*/ bClosedObj = bIsClosed; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ XubString SdrOle2Obj::GetName() const +/*N*/ { +/*N*/ return aName; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::SetPersistName( const String& rPersistName ) +/*N*/ { +/*N*/ mpImpl->aPersistName = rPersistName; +/*N*/ SetChanged(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ String SdrOle2Obj::GetPersistName() const +/*N*/ { +/*N*/ return mpImpl->aPersistName; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ UINT16 SdrOle2Obj::GetObjIdentifier() const +/*N*/ { +/*N*/ return bFrame ? UINT16(OBJ_FRAME) : UINT16(OBJ_OLE2); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ SdrObject* SdrOle2Obj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ return ImpCheckHit(rPnt,nTol,pVisiLayer,TRUE,TRUE); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*NBFF*/ void SdrOle2Obj::ImpSetVisAreaSize() +/*NBFF*/ { +/*NBFF*/ GetObjRef(); // try to load inplace object +/*NBFF*/ SvInPlaceObjectRef& rIPRef=*ppObjRef; +/*NBFF*/ +/*NBFF*/ if (rIPRef.Is()) +/*NBFF*/ { +/*NBFF*/ if (rIPRef->GetMiscStatus() & SVOBJ_MISCSTATUS_SERVERRESIZE) +/*NBFF*/ { +/*NBFF*/ // Server resized selbst (StarChart) +/*NBFF*/ // Neue VisArea setzen +/*NBFF*/ Rectangle aVisArea = OutputDevice::LogicToLogic( aRect, +/*NBFF*/ pModel->GetScaleUnit(), rIPRef->GetMapUnit() ); +/*NBFF*/ rIPRef->SetVisArea(aVisArea); +/*NBFF*/ +/*NBFF*/ // Wurde die VisArea akzeptiert? +/*NBFF*/ Rectangle aAcceptedVisArea(rIPRef->GetVisArea()); +/*NBFF*/ +/*NBFF*/ if (aVisArea.GetSize() != aAcceptedVisArea.GetSize()) +/*NBFF*/ { +/*NBFF*/ // VisArea wurde nicht akzeptiert -> korrigieren +/*NBFF*/ aRect.SetSize(OutputDevice::LogicToLogic( aAcceptedVisArea.GetSize(), +/*NBFF*/ rIPRef->GetMapUnit(), pModel->GetScaleUnit())); +/*NBFF*/ } +/*NBFF*/ } +/*NBFF*/ else +/*NBFF*/ { +/*NBFF*/ ///********************************************************************** +/*NBFF*/ //* Nun wird nicht mehr die VisArea gesetzt, sondern es erfolgt eine +/*NBFF*/ //* Skalierung +/*NBFF*/ //**********************************************************************/ +/*NBFF*/ SvEmbeddedClient* pClient = (*ppObjRef)->GetClient(); +/*NBFF*/ +/*NBFF*/ if (pClient) +/*NBFF*/ { +/*NBFF*/ SvClientData* pData = pClient->GetClientData(); +/*NBFF*/ Size aObjAreaSize = rIPRef->GetVisArea().GetSize(); +/*NBFF*/ aObjAreaSize = OutputDevice::LogicToLogic( aObjAreaSize, +/*NBFF*/ rIPRef->GetMapUnit(), +/*NBFF*/ pModel->GetScaleUnit() ); +/*NBFF*/ +/*NBFF*/ Size aSize = aRect.GetSize(); +/*NBFF*/ Fraction aScaleWidth (aSize.Width(), aObjAreaSize.Width() ); +/*NBFF*/ Fraction aScaleHeight(aSize.Height(), aObjAreaSize.Height() ); +/*NBFF*/ // Nun auf 10 Binaerstellen kuerzen +/*NBFF*/ Kuerzen(aScaleHeight, 10); +/*NBFF*/ Kuerzen(aScaleWidth, 10); +/*NBFF*/ +/*NBFF*/ pData->SetSizeScale(aScaleWidth, aScaleHeight); +/*NBFF*/ +/*NBFF*/ Rectangle aScaleRect(aRect.TopLeft(), aObjAreaSize); +/*NBFF*/ pData->SetObjArea(aScaleRect); +/*NBFF*/ } +/*NBFF*/ } +/*NBFF*/ } +/*NBFF*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrRectObj::NbcResize(rRef,xFact,yFact); +/*N*/ if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) { // kleine Korrekturen +/*?*/ if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000) { +/*?*/ aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom()); +/*?*/ } +/*?*/ aGeo.nDrehWink=0; +/*?*/ aGeo.nShearWink=0; +/*?*/ aGeo.nSin=0.0; +/*?*/ aGeo.nCos=1.0; +/*?*/ aGeo.nTan=0.0; +/*?*/ SetRectsDirty(); +/*N*/ } +/*N*/ if( (NULL == pModel) || !pModel->isLocked() ) +/*NBFF*/ ImpSetVisAreaSize(); +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrRectObj::NbcSetSnapRect(rRect); +/*N*/ if( (NULL == pModel) || !pModel->isLocked() ) +/*NBFF*/ ImpSetVisAreaSize(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrRectObj::NbcSetLogicRect(rRect); +/*N*/ if( (NULL == pModel) || !pModel->isLocked() ) +/*NBFF*/ ImpSetVisAreaSize(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ FASTBOOL SdrOle2Obj::HasGDIMetaFile() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ const GDIMetaFile* SdrOle2Obj::GetGDIMetaFile() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP");return NULL; //STRIP001 +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrRectObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrOle2Obj"); +/*N*/ #endif +/*N*/ +/*N*/ // UNICODE: rOut<<mpImpl->aPersistName; +/*N*/ rOut.WriteByteString(mpImpl->aPersistName); +/*N*/ +/*N*/ // UNICODE: rOut<<aProgName; +/*N*/ rOut.WriteByteString(aProgName); +/*N*/ +/*N*/ GetObjRef(); +/*N*/ BOOL bObjRefValid=ppObjRef->Is(); +/*N*/ rOut<<bObjRefValid; +/*N*/ BOOL bPreview = FALSE; +/*N*/ if( !IsEmptyPresObj() && pModel && pModel->IsSaveOLEPreview() ) +/*N*/ bPreview = TRUE; +/*N*/ +/*N*/ if( bPreview ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ BOOL bHasGraphic=pGraphic!=NULL; + + // #i27418# If there actually is no graphic, do not write one. This will lead + // to loading an empty bitmap in older OOo versions which sets an error code at + // the stream -> load breaks. + if(bHasGraphic) + { + if(GRAPHIC_NONE == pGraphic->GetType()) + { + bHasGraphic = false; + } + } + +/*N*/ rOut<<bHasGraphic; +/*N*/ if (bHasGraphic) +/*N*/ { +/*?*/ SdrDownCompat aGrafCompat(rOut,STREAM_WRITE); // ab V11 eingepackt +/*?*/ #ifdef DBG_UTIL +/*?*/ aGrafCompat.SetID("SdrOle2Obj(Graphic)"); +/*?*/ #endif +/*?*/ rOut<<*pGraphic; +/*N*/ } +/*N*/ +/*N*/ if( bPreview ) +/*?*/ ( (SdrOle2Obj*) this )->SetGraphic( NULL ); // remove preview graphic +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ rIn.SetError( 0 ); +/*N*/ +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrRectObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrOle2Obj"); +/*N*/ #endif +/*N*/ +/*N*/ // UNICODE: rIn >> mpImpl->aPersistName; +/*N*/ rIn.ReadByteString(mpImpl->aPersistName); +/*N*/ +/*N*/ // UNICODE: rIn >> aProgName; +/*N*/ rIn.ReadByteString(aProgName); +/*N*/ +/*N*/ BOOL bObjRefValid; +/*N*/ rIn>>bObjRefValid; +/*N*/ +/*N*/ BOOL bHasGraphic; +/*N*/ rIn>>bHasGraphic; +/*N*/ if (bHasGraphic) +/*N*/ { +/*?*/ if(pGraphic==NULL) +/*?*/ pGraphic=new Graphic; +/*?*/ + + // #i27418# Remember stream position to decide if something was read + const sal_Size nFilePosition(rIn.Tell()); + +/*?*/ if(rHead.GetVersion()>=11) +/*?*/ { // ab V11 eingepackt +/*?*/ SdrDownCompat aGrafCompat(rIn,STREAM_READ); +/*?*/ #ifdef DBG_UTIL +/*?*/ aGrafCompat.SetID("SdrOle2Obj(Graphic)"); +/*?*/ #endif +/*?*/ rIn>>*pGraphic; +/*?*/ } +/*?*/ else +/*?*/ rIn>>*pGraphic; +/*?*/ + + // #i27418# If 4 bytes were read but an error is set, it was tried to read an empty + // bitmap into the Graphic. This a follow-up error from previously wrong saves. + // Reset error code here, it's not really an error but leads to a crash in SO7 + if(0L != rIn.GetError() && (nFilePosition + 4L) == rIn.Tell()) + { + rIn.ResetError(); + } + +/*?*/ if( mpImpl->pGraphicObject ) +/*?*/ delete mpImpl->pGraphicObject; +/*?*/ +/*?*/ mpImpl->pGraphicObject = new BfGraphicObject( *pGraphic ); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ void SdrOle2Obj::NbcMove(const Size& rSize) +/*N*/ { +/*N*/ SdrRectObj::NbcMove(rSize); +/*N*/ if( (NULL == pModel) || !pModel->isLocked() ) +/*NBFF*/ ImpSetVisAreaSize(); +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ BOOL SdrOle2Obj::Unload() +/*N*/ { +/*N*/ BOOL bUnloaded = FALSE; +/*N*/ +/*N*/ if( ppObjRef && ppObjRef->Is() ) +/*N*/ { +/*N*/ //Nicht notwendig im Doc DTor (MM) +/*N*/ ULONG nRefCount = (*ppObjRef)->GetRefCount(); +/*N*/ // prevent Unload if there are external references +/*N*/ if( nRefCount > 2 ) +/*N*/ return FALSE; +/*N*/ DBG_ASSERT( nRefCount == 2, "Wrong RefCount for unload" ); +/*N*/ } +/*N*/ else +/*N*/ bUnloaded = TRUE; +/*N*/ +/*N*/ if (pModel && ppObjRef && ppObjRef->Is() && +/*N*/ SVOBJ_MISCSTATUS_ALWAYSACTIVATE != (*ppObjRef)->GetMiscStatus() && +/*N*/ 1 < (*ppObjRef)->GetRefCount() && +/*N*/ !(*ppObjRef)->IsModified() && +/*N*/ !(*ppObjRef)->GetProtocol().IsInPlaceActive() ) +/*N*/ { +/*N*/ SvPersist* pPersist = pModel->GetPersist(); +/*N*/ +/*N*/ if (pPersist) +/*N*/ { +/*N*/ SvPersist* pO = *ppObjRef; +/*N*/ if( pO->IsModified() ) +/*N*/ { +/*?*/ pO->DoSave(); +/*?*/ pO->DoSaveCompleted(); +/*N*/ } +/*N*/ ppObjRef->Clear(); +/*N*/ if (pPersist->Unload(pO)) +/*N*/ bUnloaded = TRUE; +/*N*/ else +/*?*/ *ppObjRef = pO; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bUnloaded; +/*N*/ } + +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- + +/*N*/ const SvInPlaceObjectRef& SdrOle2Obj::GetObjRef() const +/*N*/ { +/*N*/ if ( !ppObjRef->Is() && pModel && pModel->GetPersist() && !pModel->GetPersist()->IsHandsOff() ) +/*N*/ { +/*N*/ // #107645# +/*N*/ // Only try loading if it did not wrent wrong up to now +/*N*/ if(!mpImpl->mbLoadingOLEObjectFailed) +/*N*/ { +/*N*/ // Objekt laden +/*N*/ (*ppObjRef) = &( pModel->GetPersist()->GetObject( mpImpl->aPersistName ) ); +/*N*/ +/*N*/ // #107645# +/*N*/ // If loading of OLE object failed, remember that to not invoke a endless +/*N*/ // loop trying to load it again and again. +/*N*/ if(!ppObjRef->Is()) +/*N*/ { +/*N*/ mpImpl->mbLoadingOLEObjectFailed = sal_True; +/*N*/ } +/*N*/ +/*N*/ // #108759# For math objects, set closed state to transparent +/*N*/ if( ImplIsMathObj( *ppObjRef ) ) +/*N*/ const_cast<SdrOle2Obj*>(this)->SetClosedObj( false ); +/*N*/ } +/*N*/ +/*N*/ if ( ppObjRef->Is() ) +/*N*/ { +/*N*/ if( !IsEmptyPresObj() ) +/*N*/ { +/*N*/ // #75637# remember modified status of model +/*N*/ BOOL bWasChanged(pModel ? pModel->IsChanged() : FALSE); +/*N*/ +/*N*/ // perhaps preview not valid anymore +/*N*/ // #75637# This line changes the modified state of the model +/*N*/ ( (SdrOle2Obj*) this )->SetGraphic( NULL ); +/*N*/ +/*N*/ // #75637# if status was not set before, force it back +/*N*/ // to not set, so that SetGraphic(0L) above does not +/*N*/ // set the modified state of the model. +/*N*/ if(!bWasChanged && pModel && pModel->IsChanged()) +/*N*/ pModel->SetChanged(FALSE); +/*N*/ } +/*N*/ +/*N*/ if ( (*ppObjRef)->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) +/*N*/ { +/*N*/ if (pModel && pModel->GetRefDevice() && +/*N*/ pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER) +/*N*/ { +/*N*/ if(!bInDestruction) +/*N*/ { +/*N*/ // prevent SetModified (don't want no update here) +/*N*/ sal_Bool bWasEnabled = (*ppObjRef)->IsEnableSetModified(); +/*N*/ if ( bWasEnabled ) +/*N*/ (*ppObjRef)->EnableSetModified( sal_False ); +/*N*/ +/*N*/ // Kein RefDevice oder RefDevice kein Printer +/*N*/ Printer* pPrinter = (Printer*) pModel->GetRefDevice(); +/*N*/ (*ppObjRef)->OnDocumentPrinterChanged( pPrinter ); +/*N*/ +/*N*/ // reset state +/*N*/ (*ppObjRef)->EnableSetModified( bWasEnabled ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // register modify listener on initial load +/*N*/ if( pModifyListener == NULL ) +/*N*/ { +/*N*/ ((SdrOle2Obj*)this)->pModifyListener = new SvxUnoShapeModifyListener( (SdrOle2Obj*)this ); +/*N*/ pModifyListener->acquire(); +/*N*/ +/*N*/ uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); +/*N*/ if( xBC.is() && pModifyListener ) +/*N*/ { +/*N*/ uno::Reference< util::XModifyListener > xListener( pModifyListener ); +/*N*/ xBC->addModifyListener( xListener ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (ppObjRef->Is()) +/*N*/ { +/*N*/ // In Cache einfuegen +/*N*/ GetSdrGlobalData().GetOLEObjCache().InsertObj((SdrOle2Obj*) this); +/*N*/ } +/*N*/ +/*N*/ return *ppObjRef; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/*N*/ uno::Reference< frame::XModel > SdrOle2Obj::getXModel() const +/*N*/ { +/*N*/ uno::Reference< frame::XModel > xModel; +/*N*/ +/*N*/ if( pModel ) +/*N*/ { +/*N*/ SvInPlaceObjectRef xSvIPO( GetObjRef() ); +/*N*/ SfxInPlaceObjectRef xIPO( xSvIPO ); +/*N*/ if( xIPO.Is() ) +/*N*/ { +/*N*/ SfxObjectShell* pShell = xIPO->GetObjectShell(); +/*N*/ +/*N*/ if( pShell ) +/*N*/ xModel = pShell->GetModel(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return xModel; +/*N*/ } + +// ----------------------------------------------------------------------------- + +/// #110015# sets the visible area at the SvInPlaceObject and SvEmbeddedInfoObject +/*N*/ void SdrOle2Obj::SetVisibleArea( const Rectangle& rVisArea ) +/*N*/ { +/*N*/ const SvInPlaceObjectRef& xInplace = GetObjRef(); +/*N*/ if( xInplace.Is() ) +/*N*/ { +/*N*/ xInplace->SetVisArea( rVisArea ); +/*N*/ +/*N*/ if( pModel && (!pModel->GetPersist()->IsEnableSetModified()) ) +/*N*/ xInplace->SetModified(FALSE); +/*N*/ } +/*N*/ +/*N*/ if(pModel && mpImpl->aPersistName.Len() ) +/*N*/ { +/*N*/ SvPersist* pPers = pModel->GetPersist(); +/*N*/ +/*N*/ if (pPers) +/*N*/ { +/*N*/ SvInfoObject* pInfo = pPers->Find(mpImpl->aPersistName); +/*N*/ SvEmbeddedInfoObject * pEmbed = PTR_CAST(SvEmbeddedInfoObject, pInfo ); +/*N*/ +/*N*/ if( pEmbed ) +/*N*/ pEmbed->SetInfoVisArea( rVisArea ); +/*N*/ } +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------------- +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdopage.cxx b/binfilter/bf_svx/source/svdraw/svx_svdopage.cxx new file mode 100644 index 000000000000..928752eab97d --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdopage.cxx @@ -0,0 +1,254 @@ +/* -*- 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 "svdopage.hxx" +#include "svdstr.hrc" // Objektname +#include "svdio.hxx" +#include "svdmodel.hxx" +#include "svdpage.hxx" + + +#include <bf_svtools/itemset.hxx> +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrPageObj,SdrObject); + +/*N*/ SdrPageObj::SdrPageObj(USHORT nNewPageNum): +/*N*/ mpPageItemSet(0L), +/*N*/ nPageNum(nNewPageNum), +/*N*/ bPainting(FALSE), +/*N*/ bNotifying(FALSE) +/*N*/ { +/*N*/ } + +/*N*/ SdrPageObj::~SdrPageObj() +/*N*/ { +/*N*/ if(mpPageItemSet) +/*?*/ delete mpPageItemSet; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ const SfxItemSet& SdrPageObj::GetItemSet() const +/*N*/ { +/*N*/ if(!mpPageItemSet) +/*N*/ ((SdrPageObj*)this)->mpPageItemSet = ((SdrPageObj*)this)->CreateNewItemSet((SfxItemPool&)(*GetItemPool())); +/*N*/ return *mpPageItemSet; +/*N*/ } + +/*N*/ SfxItemSet* SdrPageObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ return new SfxItemSet(rPool); +/*N*/ } + +/*N*/ void SdrPageObj::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) +/*N*/ { +/*N*/ // #86481# simply ignore item setting on page objects +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void __EXPORT SdrPageObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId&, const SfxHint& rHint, const TypeId&) +/*N*/ { +/*N*/ SdrHint* pSdrHint = PTR_CAST(SdrHint, &rHint); +/*N*/ +/*N*/ if(pSdrHint) +/*N*/ { +/*N*/ SdrHintKind eHint = pSdrHint->GetKind(); +/*N*/ +/*N*/ if(eHint == HINT_PAGEORDERCHG) +/*N*/ { +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ const SdrPage* pChangedPage = pSdrHint->GetPage(); +/*N*/ +/*N*/ if(pSdrHint->GetObject() != this +/*N*/ && pModel +/*N*/ && bInserted +/*N*/ && pChangedPage +/*N*/ && pChangedPage != pPage) +/*N*/ { +/*N*/ const SdrPage* pShownPage = pModel->GetPage(nPageNum); +/*N*/ +/*N*/ if(pShownPage) +/*N*/ { +/*N*/ if(pShownPage == pChangedPage) +/*N*/ { +/*N*/ if(eHint == HINT_OBJCHG || eHint == HINT_OBJLISTCLEARED) +/*N*/ { +/*N*/ // do nothing, else loop with HINT_OBJCHG cause +/*N*/ // it can not be decided if hint comes from 21 lines +/*N*/ // above (SendRepaintBroadcast())or normally from +/*N*/ // object. Doing nothing leads to not updating +/*N*/ // object moves on a 2nd opened view showing the page +/*N*/ // as handout or notice page. (AW 06052000) +/*N*/ // +/*N*/ // one solution would be to invalidate without using +/*N*/ // SendRepaintBroadcast(), so I made some tries, but it +/*N*/ // did'nt work: +/*N*/ // +/*N*/ //SdrHint aHint(*this); +/*N*/ //aHint.SetNeedRepaint(TRUE); +/*N*/ //aHint.SetKind(HINT_PAGECHG); +/*N*/ //pModel->Broadcast(aHint); +/*N*/ //SdrPageView* pPV; +/*N*/ //if(pModel && (pPV = pModel->GetPaintingPageView())) +/*N*/ //{ +/*N*/ // pPV->InvalidateAllWin(pSdrHint->GetRect(), TRUE); +/*N*/ //} +/*N*/ // GetPageView(pChangedPage); +/*N*/ // SdrPageView::InvalidateAllWin(pSdrHint->GetRect(), TRUE); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // send normal +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ } +/*N*/ else if(pChangedPage->IsMasterPage()) +/*N*/ { +/*N*/ UINT16 nMaPgAnz = pShownPage->GetMasterPageCount(); +/*N*/ BOOL bDone(FALSE); +/*N*/ +/*N*/ for(UINT16 i=0; i<nMaPgAnz && !bDone; i++) +/*N*/ { +/*N*/ const SdrPage* pMaster = pShownPage->GetMasterPage(i); +/*N*/ +/*N*/ if(pMaster == pChangedPage) +/*N*/ { +/*N*/ if(eHint == HINT_OBJCHG || eHint == HINT_OBJLISTCLEARED) +/*N*/ { +/*N*/ // see comment above... +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // send normal +/*N*/ SendRepaintBroadcast(); +/*N*/ bDone = TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPageObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrModel* pOldMod=pModel; +/*N*/ SdrObject::SetModel(pNewModel); +/*N*/ if (pModel!=pOldMod) { +/*N*/ if (pOldMod!=NULL) EndListening(*pOldMod); +/*N*/ if (pModel!=NULL) StartListening(*pModel); +/*N*/ } +/*N*/ } + + +/*N*/ UINT16 SdrPageObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return UINT16(OBJ_PAGE); +/*N*/ } + + + + + + + + + + + +/*N*/ const Rectangle& SdrPageObj::GetBoundRect() const +/*N*/ { +/*N*/ return SdrObject::GetBoundRect(); +/*N*/ } + + +/*N*/ const Rectangle& SdrPageObj::GetSnapRect() const +/*N*/ { +/*N*/ return SdrObject::GetSnapRect(); +/*N*/ } + + +/*N*/ const Rectangle& SdrPageObj::GetLogicRect() const +/*N*/ { +/*N*/ return SdrObject::GetLogicRect(); +/*N*/ } + + +/*N*/ void SdrPageObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrObject::NbcSetSnapRect(rRect); +/*N*/ } + + +/*N*/ void SdrPageObj::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrObject::NbcSetLogicRect(rRect); +/*N*/ } + + + + + +/*N*/ void SdrPageObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrObject::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPageObj"); +/*N*/ #endif +/*N*/ rOut<<nPageNum; +/*N*/ } + +/*N*/ void SdrPageObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrObject::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPageObj"); +/*N*/ #endif +/*N*/ rIn>>nPageNum; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdopath.cxx b/binfilter/bf_svx/source/svdraw/svx_svdopath.cxx new file mode 100644 index 000000000000..5cd05ae2b633 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdopath.cxx @@ -0,0 +1,979 @@ +/* -*- 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 "svdopath.hxx" +#include <math.h> +#include "xpool.hxx" +#include "xoutx.hxx" +#include "svdtouch.hxx" +#include "svdio.hxx" +#include "svdview.hxx" // fuer MovCreate bei Freihandlinien +#include "svdstr.hrc" // Objektname + +#ifdef _MSC_VER +#pragma optimize ("",off) +#endif + + + +#include <vcl/salbtype.hxx> // FRound + +#include "svdoimp.hxx" + +#include <bf_goodies/matrix3d.hxx> + +namespace binfilter { + +// #104018# replace macros above with type-safe methods +inline sal_Int32 ImplTwipsToMM(sal_Int32 nVal) { return ((nVal * 127 + 36) / 72); } +inline sal_Int32 ImplMMToTwips(sal_Int32 nVal) { return ((nVal * 72 + 63) / 127); } +inline sal_Int64 ImplTwipsToMM(sal_Int64 nVal) { return ((nVal * 127 + 36) / 72); } +inline sal_Int64 ImplMMToTwips(sal_Int64 nVal) { return ((nVal * 72 + 63) / 127); } +inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } +inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } + +/*************************************************************************/ + +#define SVDOPATH_INITSIZE 20 +#define SVDOPATH_RESIZE 20 + +/*************************************************************************/ + +/*N*/ SdrPathObjGeoData::SdrPathObjGeoData() +/*N*/ { +/*N*/ } + +/*N*/ SdrPathObjGeoData::~SdrPathObjGeoData() +/*N*/ { +/*N*/ } + +/*N*/ TYPEINIT1(SdrPathObj,SdrTextObj); + +/*N*/ SdrPathObj::SdrPathObj(SdrObjKind eNewKind) +/*N*/ { +/*N*/ eKind=eNewKind; +/*N*/ bClosedObj=IsClosed(); +/*N*/ bCreating=FALSE; +/*N*/ } + +/*N*/ SdrPathObj::SdrPathObj(SdrObjKind eNewKind, const XPolyPolygon& rPathPoly) +/*N*/ { +/*N*/ eKind=eNewKind; +/*N*/ bClosedObj=IsClosed(); +/*N*/ +/*N*/ // #104640# Set local XPolyPolygon with open/close correction +/*N*/ NbcSetPathPoly(rPathPoly); +/*N*/ +/*N*/ bCreating=FALSE; +/*N*/ ImpForceKind(); +/*N*/ } + +/*?*/ SdrPathObj::SdrPathObj(const Point& rPt1, const Point& rPt2) +/*?*/ { +/*?*/ eKind=OBJ_LINE; +/*?*/ XPolygon aXP(2); +/*?*/ aXP[0]=rPt1; +/*?*/ aXP[1]=rPt2; +/*?*/ aPathPolygon.Insert(aXP); +/*?*/ bClosedObj=FALSE; +/*?*/ bCreating=FALSE; +/*?*/ ImpForceLineWink(); +/*?*/ } + +/*N*/ SdrPathObj::~SdrPathObj() +/*N*/ { +/*N*/ } + +/*N*/ FASTBOOL SdrPathObj::FindPolyPnt(USHORT nAbsPnt, USHORT& rPolyNum, +/*N*/ USHORT& rPointNum, FASTBOOL bAllPoints) const +/*N*/ { +/*N*/ USHORT nPolyCnt=aPathPolygon.Count(); +/*N*/ USHORT nPoly=0; +/*N*/ FASTBOOL bClosed=IsClosed(); +/*N*/ nAbsPnt+=1; +/*N*/ +/*N*/ while (nPoly<nPolyCnt) { +/*N*/ const XPolygon& rXPoly = aPathPolygon[nPoly]; +/*N*/ USHORT nPnt=0; +/*N*/ USHORT nCnt=0; +/*N*/ USHORT nPntCnt=rXPoly.GetPointCount(); +/*N*/ // geschlossen? Dann Endpunkt=Startpunkt +/*N*/ if (bClosed && nPntCnt>1) nPntCnt--; +/*N*/ +/*N*/ while (nPnt<nPntCnt) { +/*N*/ if (bAllPoints || rXPoly.GetFlags(nPnt)!=XPOLY_CONTROL) nCnt++; +/*N*/ if (nCnt==nAbsPnt) { +/*N*/ rPolyNum=nPoly; +/*N*/ rPointNum=nPnt; +/*N*/ return TRUE; +/*N*/ } +/*N*/ nPnt++; +/*N*/ } +/*?*/ nAbsPnt-=nCnt; +/*?*/ nPoly++; +/*?*/ } +/*?*/ return FALSE; +/*N*/ } + +/*N*/ void SdrPathObj::ImpForceLineWink() +/*N*/ { +/*N*/ if (aPathPolygon.Count()==1 && aPathPolygon[0].GetPointCount()==2 && eKind==OBJ_LINE) { +/*N*/ Point aDelt(aPathPolygon[0][1]); +/*N*/ aDelt-=aPathPolygon[0][0]; +/*N*/ aGeo.nDrehWink=GetAngle(aDelt); +/*N*/ aGeo.nShearWink=0; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ aGeo.RecalcTan(); +/*N*/ +/*N*/ // #101412# for SdrTextObj, keep aRect up to date +/*N*/ aRect = Rectangle(aPathPolygon[0][0], aPathPolygon[0][1]); +/*N*/ aRect.Justify(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPathObj::ImpForceKind() +/*N*/ { +/*N*/ if (eKind==OBJ_PATHPLIN) eKind=OBJ_PLIN; +/*N*/ if (eKind==OBJ_PATHPOLY) eKind=OBJ_POLY; +/*N*/ +/*N*/ USHORT nPolyAnz=aPathPolygon.Count(); +/*N*/ USHORT nPoly1PointAnz=nPolyAnz==0 ? 0 : aPathPolygon[0].GetPointCount(); +/*N*/ FASTBOOL bHasCtrl=FALSE; +/*N*/ FASTBOOL bHasLine=FALSE; // gemischt wird jedoch z.Zt. nicht in eKind festgehalten +/*N*/ for (USHORT nPolyNum=0; nPolyNum<nPolyAnz && (!bHasCtrl || !bHasLine); nPolyNum++) { +/*N*/ const XPolygon& rPoly=aPathPolygon[nPolyNum]; +/*N*/ USHORT nPointAnz=rPoly.GetPointCount(); +/*N*/ for (USHORT nPointNum=0; nPointNum<nPointAnz && (!bHasCtrl || !bHasLine); nPointNum++) { +/*N*/ if (rPoly.IsControl(nPointNum)) bHasCtrl=TRUE; +/*N*/ if (nPointNum+1<nPointAnz && !rPoly.IsControl(nPointNum) && !rPoly.IsControl(nPointNum+1)) bHasLine=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (!bHasCtrl) { +/*N*/ switch (eKind) { +/*N*/ case OBJ_PATHLINE: eKind=OBJ_PLIN; break; +/*N*/ case OBJ_FREELINE: eKind=OBJ_PLIN; break; +/*N*/ case OBJ_PATHFILL: eKind=OBJ_POLY; break; +/*N*/ case OBJ_FREEFILL: eKind=OBJ_POLY; break; +/*N*/ } +/*N*/ } else { +/*N*/ switch (eKind) { +/*N*/ case OBJ_LINE: eKind=OBJ_PATHLINE; break; +/*N*/ case OBJ_PLIN: eKind=OBJ_PATHLINE; break; +/*N*/ case OBJ_POLY: eKind=OBJ_PATHFILL; break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (eKind==OBJ_LINE && (nPolyAnz!=1 || nPoly1PointAnz!=2)) eKind=OBJ_PLIN; +/*N*/ if (eKind==OBJ_PLIN && (nPolyAnz==1 && nPoly1PointAnz==2)) eKind=OBJ_LINE; +/*N*/ +/*N*/ bClosedObj=IsClosed(); +/*N*/ +/*N*/ if (eKind==OBJ_LINE) +/*N*/ { +/*N*/ ImpForceLineWink(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // #i10659#, similar to #101412# but for polys with more than 2 points. +/*N*/ // +/*N*/ // Here i again need to fix something, because when Path-Polys are Copy-Pasted +/*N*/ // between Apps with different measurements (e.g. 100TH_MM and TWIPS) there is +/*N*/ // a scaling loop started from SdrExchangeView::Paste. This is principally nothing +/*N*/ // wrong, but aRect is wrong here and not even updated by RecalcSnapRect(). If +/*N*/ // this is the case, some size needs to be set here in aRect to avoid that the cyclus +/*N*/ // through Rect2Poly - Poly2Rect does something badly wrong since that cycle is +/*N*/ // BASED on aRect. That cycle is triggered in SdrTextObj::NbcResize() which is called +/*N*/ // from the local Resize() implementation. +/*N*/ // +/*N*/ // Basic problem is that the member aRect in SdrTextObj basically is a unrotated +/*N*/ // text rectangle for the text object itself and methods at SdrTextObj do handle it +/*N*/ // in that way. Many draw objects derived from SdrTextObj 'abuse' aRect as SnapRect +/*N*/ // which is basically wrong. To make the SdrText methods which deal with aRect directly +/*N*/ // work it is necessary to always keep aRect updated. This e.g. not done after a Clone() +/*N*/ // command for SdrPathObj. Since adding this update mechanism with #101412# to +/*N*/ // ImpForceLineWink() for lines was very successful, i add it to where ImpForceLineWink() +/*N*/ // was called, once here below and once on a 2nd place below. +/*N*/ +/*N*/ // #i10659# for SdrTextObj, keep aRect up to date +/*N*/ aRect=aPathPolygon.GetBoundRect(); // fuer SdrTextObj +/*N*/ } +/*N*/ } + + + +/*N*/ UINT16 SdrPathObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return USHORT(eKind); +/*N*/ } + +/*N*/ void SdrPathObj::RecalcBoundRect() +/*N*/ { +/*N*/ aOutRect=GetSnapRect(); +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ if (!IsClosed()) { // ggf. Linienenden beruecksichtigen +/*N*/ long nLEndWdt=ImpGetLineEndAdd(); +/*N*/ if (nLEndWdt>nLineWdt) nLineWdt=nLEndWdt; +/*N*/ } +/*N*/ if (nLineWdt!=0) { +/*N*/ aOutRect.Left ()-=nLineWdt; +/*N*/ aOutRect.Top ()-=nLineWdt; +/*N*/ aOutRect.Right ()+=nLineWdt; +/*N*/ aOutRect.Bottom()+=nLineWdt; +/*N*/ } +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + +/*N*/ FASTBOOL SdrPathObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec) const +/*N*/ { +/*N*/ // Hidden objects on masterpages, draw nothing +/*N*/ if((rInfoRec.nPaintMode & SDRPAINTMODE_MASTERPAGE) && bNotVisibleAsMaster) +/*N*/ return TRUE; +/*N*/ +/*N*/ BOOL bHideContour(IsHideContour()); +/*N*/ BOOL bIsFillDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTFILL)); +/*N*/ BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE)); +/*N*/ +/*N*/ // prepare ItemSet of this object +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ // perepare ItemSet to avoid old XOut line drawing +/*N*/ SfxItemSet aEmptySet(*rSet.GetPool()); +/*N*/ aEmptySet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ aEmptySet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ // #103692# prepare ItemSet for shadow fill attributes +/*N*/ SfxItemSet aShadowSet(rSet); +/*N*/ +/*N*/ // prepare line geometry +/*N*/ ::std::auto_ptr< SdrLineGeometry > pLineGeometry( ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft) ); +/*N*/ +/*N*/ // Shadows +/*N*/ if (!bHideContour && ImpSetShadowAttributes(rSet, aShadowSet)) +/*N*/ { +/*?*/ if( !IsClosed() || bIsFillDraft ) +/*?*/ rXOut.SetFillAttr(aEmptySet); +/*?*/ else +/*?*/ rXOut.SetFillAttr(aShadowSet); +/*?*/ +/*?*/ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(); +/*?*/ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue(); +/*?*/ XPolyPolygon aTmpXPoly(aPathPolygon); +/*?*/ aTmpXPoly.Move(nXDist,nYDist); +/*?*/ +/*?*/ // avoid shadow line drawing in XOut +/*?*/ rXOut.SetLineAttr(aEmptySet); +/*?*/ +/*?*/ if (!IsClosed()) { +/*?*/ USHORT nPolyAnz=aTmpXPoly.Count(); +/*?*/ for (USHORT nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) { +/*?*/ rXOut.DrawXPolyLine(aTmpXPoly.GetObject(nPolyNum)); +/*?*/ } +/*?*/ } else { +/*?*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, aShadowSet, true ); +/*?*/ +/*?*/ rXOut.DrawXPolyPolygon(aTmpXPoly); +/*?*/ } +/*?*/ +/*?*/ // new shadow line drawing +/*?*/ if( pLineGeometry.get() ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ // draw the line geometry +/*?*/ } +/*N*/ } + + // Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr); + // avoid line drawing in XOut +/*N*/ rXOut.SetLineAttr(aEmptySet); +/*N*/ +/*N*/ rXOut.SetFillAttr( bIsFillDraft || !IsClosed() ? aEmptySet : rSet ); +/*N*/ +/*N*/ if( !bHideContour ) +/*N*/ { +/*N*/ if( IsClosed() ) +/*N*/ { +/*N*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, bIsFillDraft || !IsClosed() ? aEmptySet : rSet ); +/*?*/ +/*?*/ rXOut.DrawXPolyPolygon(aPathPolygon); +/*N*/ } +/*N*/ +/*N*/ // Own line drawing +/*N*/ if( pLineGeometry.get() ) +/*N*/ { +/*N*/ // draw the line geometry +/*N*/ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ FASTBOOL bOk=TRUE; +/*N*/ if (HasText()) { +/*?*/ bOk=SdrTextObj::Paint(rXOut,rInfoRec); +/*N*/ } +/*N*/ if (bOk && (rInfoRec.nPaintMode & SDRPAINTMODE_GLUEPOINTS) !=0) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 bOk=PaintGluePoints(rXOut,rInfoRec); +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + +/*N*/ SdrObject* SdrPathObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ if (pVisiLayer!=NULL && !pVisiLayer->IsSet(nLayerId)) return NULL; +/*N*/ INT32 nMyTol=nTol; +/*N*/ FASTBOOL bFilled=IsClosed() && (bTextFrame || HasFill()); +/*N*/ +/*N*/ INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke +/*N*/ if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig +/*N*/ Rectangle aR(rPnt,rPnt); +/*N*/ aR.Left() -=nMyTol; +/*N*/ aR.Right() +=nMyTol; +/*N*/ aR.Top() -=nMyTol; +/*N*/ aR.Bottom()+=nMyTol; +/*N*/ +/*N*/ FASTBOOL bHit=FALSE; +/*N*/ unsigned nPolyAnz=aPathPolygon.Count(); +/*N*/ if (bFilled) { +/*N*/ PolyPolygon aPP; +/*N*/ for (unsigned nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) { +/*N*/ aPP.Insert(XOutCreatePolygon(aPathPolygon[nPolyNum],NULL)); +/*N*/ } +/*N*/ bHit=IsRectTouchesPoly(aPP,aR); +/*N*/ } else { +/*N*/ for (unsigned nPolyNum=0; nPolyNum<nPolyAnz && !bHit; nPolyNum++) { +/*N*/ Polygon aPoly(XOutCreatePolygon(aPathPolygon[nPolyNum],NULL)); +/*N*/ bHit=IsRectTouchesLine(aPoly,aR); +/*N*/ } +/*N*/ } +/*N*/ if (!bHit && !IsTextFrame() && HasText()) { +/*N*/ bHit=SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL; +/*N*/ } +/*N*/ return bHit ? (SdrObject*)this : NULL; +/*N*/ } + +/*N*/ void SdrPathObj::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ SdrTextObj::operator=(rObj); +/*N*/ SdrPathObj& rPath=(SdrPathObj&)rObj; +/*N*/ aPathPolygon=rPath.aPathPolygon; +/*N*/ } + + + +/*N*/ void SdrPathObj::TakeXorPoly(XPolyPolygon& rXPolyPoly, FASTBOOL bDetail) const +/*N*/ { +/*N*/ rXPolyPoly=aPathPolygon; +/*N*/ } + +/*N*/ void SdrPathObj::TakeContour(XPolyPolygon& rPoly) const +/*N*/ { +/*N*/ // am 14.1.97 wg. Umstellung TakeContour ueber Mtf und Paint. Joe. +/*N*/ SdrTextObj::TakeContour(rPoly); +/*N*/ } + + + + + + + + +/*?*/ inline USHORT GetPrevPnt(USHORT nPnt, USHORT nPntMax, FASTBOOL bClosed) +/*?*/ { +/*?*/ if (nPnt>0) { +/*?*/ nPnt--; +/*?*/ } else { +/*?*/ nPnt=nPntMax; +/*?*/ if (bClosed) nPnt--; +/*?*/ } +/*?*/ return nPnt; +/*?*/ } + +/*?*/ inline USHORT GetNextPnt(USHORT nPnt, USHORT nPntMax, FASTBOOL bClosed) +/*?*/ { +/*?*/ nPnt++; +/*?*/ if (nPnt>nPntMax || (bClosed && nPnt>=nPntMax)) nPnt=0; +/*?*/ return nPnt; +/*?*/ } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/*N*/ void SdrPathObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ SdrTextObj::NbcMove(rSiz); +/*N*/ MoveXPoly(aPathPolygon,rSiz); +/*N*/ } + +/*N*/ void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrTextObj::NbcResize(rRef,xFact,yFact); +/*N*/ ResizeXPoly(aPathPolygon,rRef,xFact,yFact); +/*N*/ } + +/*N*/ void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ SdrTextObj::NbcRotate(rRef,nWink,sn,cs); +/*N*/ RotateXPoly(aPathPolygon,rRef,sn,cs); +/*N*/ } + +/*N*/ void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear) +/*N*/ { +/*N*/ SdrTextObj::NbcShear(rRefPnt,nAngle,fTan,bVShear); +/*N*/ ShearXPoly(aPathPolygon,rRefPnt,fTan,bVShear); +/*N*/ } + + +/*N*/ void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ if (aGeo.nDrehWink==0) { +/*N*/ rRect=GetSnapRect(); +/*N*/ } else { +/*N*/ XPolyPolygon aXPP(aPathPolygon); +/*N*/ RotateXPoly(aXPP,Point(),-aGeo.nSin,aGeo.nCos); +/*N*/ rRect=aXPP.GetBoundRect(); +/*N*/ Point aTmp(rRect.TopLeft()); +/*N*/ RotatePoint(aTmp,Point(),aGeo.nSin,aGeo.nCos); +/*N*/ aTmp-=rRect.TopLeft(); +/*N*/ rRect.Move(aTmp.X(),aTmp.Y()); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPathObj::RecalcSnapRect() +/*N*/ { +/*N*/ maSnapRect=aPathPolygon.GetBoundRect(); +/*N*/ } + +/*N*/ void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ Rectangle aOld(GetSnapRect()); +/*N*/ +/*N*/ // #95736# Take RECT_EMPTY into account when calculating scale factors +/*N*/ long nMulX = (RECT_EMPTY == rRect.Right()) ? 0 : rRect.Right() - rRect.Left(); +/*N*/ +/*N*/ long nDivX = aOld.Right() - aOld.Left(); +/*N*/ +/*N*/ // #95736# Take RECT_EMPTY into account when calculating scale factors +/*N*/ long nMulY = (RECT_EMPTY == rRect.Bottom()) ? 0 : rRect.Bottom() - rRect.Top(); +/*N*/ +/*N*/ long nDivY = aOld.Bottom() - aOld.Top(); +/*N*/ if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } +/*N*/ if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } +/*N*/ Fraction aX(nMulX,nDivX); +/*N*/ Fraction aY(nMulY,nDivY); +/*N*/ NbcResize(aOld.TopLeft(), aX, aY); +/*N*/ NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); +/*N*/ } + + + +/*N*/ FASTBOOL SdrPathObj::IsPolyObj() const +/*N*/ { +/*N*/ return TRUE; +/*N*/ } + +/*N*/ USHORT SdrPathObj::GetPointCount() const +/*N*/ { +/*N*/ USHORT nPolyCnt = aPathPolygon.Count(); +/*N*/ USHORT nPntCnt = 0; +/*N*/ +/*N*/ for (USHORT i = 0; i < nPolyCnt; i++) +/*N*/ nPntCnt += aPathPolygon[i].GetPointCount(); +/*N*/ +/*N*/ return nPntCnt; +/*N*/ } + +/*N*/ const Point& SdrPathObj::GetPoint(USHORT nHdlNum) const +/*N*/ { +/*N*/ USHORT nPoly,nPnt; +/*N*/ FindPolyPnt(nHdlNum,nPoly,nPnt,FALSE); +/*N*/ return aPathPolygon[nPoly][nPnt]; +/*N*/ } + +/*N*/ void SdrPathObj::NbcSetPoint(const Point& rPnt, USHORT nHdlNum) +/*N*/ { +/*N*/ USHORT nPoly,nPnt; +/*N*/ +/*N*/ if (FindPolyPnt(nHdlNum,nPoly,nPnt,FALSE)) { +/*N*/ XPolygon& rXP=aPathPolygon[nPoly]; +/*N*/ rXP[nPnt]=rPnt; +/*N*/ if (IsClosed() && nPnt==0) rXP[rXP.GetPointCount()-1]=rXP[0]; +/*N*/ +/*N*/ if (eKind==OBJ_LINE) +/*N*/ { +/*N*/ ImpForceLineWink(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // #i10659# for SdrTextObj, keep aRect up to date +/*N*/ aRect=aPathPolygon.GetBoundRect(); // fuer SdrTextObj +/*N*/ } +/*N*/ +/*N*/ SetRectsDirty(); +/*N*/ } +/*N*/ } + +/*************************************************************************/ +// Abstand des Punktes Pt zur Strecke AB. Hat der Punkt Pt keine Senkrechte +// zur Strecke AB, so ist der Abstand zum naechstliegenden Punkt verwendet; +// dazu wird nocheinmal der einfache Abstand parallel zu AB draufaddiert +// (als Winkelersatz) (=> groesserer Abstand=unguenstigerer Winkel). + + + + + + + + + +/*N*/ SdrObjGeoData* SdrPathObj::NewGeoData() const +/*N*/ { +/*N*/ return new SdrPathObjGeoData; +/*N*/ } + +/*N*/ void SdrPathObj::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ { +/*N*/ SdrTextObj::SaveGeoData(rGeo); +/*N*/ SdrPathObjGeoData& rPGeo = (SdrPathObjGeoData&) rGeo; +/*N*/ rPGeo.aPathPolygon=aPathPolygon; +/*N*/ rPGeo.eKind=eKind; +/*N*/ } + + +/*N*/ void SdrPathObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrTextObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPathObj"); +/*N*/ #endif +/*N*/ { +/*N*/ SdrDownCompat aPathCompat(rOut,STREAM_WRITE); // ab V11 eingepackt +/*N*/ #ifdef DBG_UTIL +/*N*/ aPathCompat.SetID("SdrPathObj(PathPolygon)"); +/*N*/ #endif +/*N*/ rOut<<aPathPolygon; +/*N*/ } +/*N*/ } + +/*N*/ void SdrPathObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrTextObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPathObj"); +/*N*/ #endif +/*N*/ aPathPolygon.Clear(); +/*N*/ if (rHead.GetVersion()<=6 && (rHead.nIdentifier==OBJ_LINE || rHead.nIdentifier==OBJ_POLY || rHead.nIdentifier==OBJ_PLIN)) { +/*?*/ // SdrPolyObj importieren +/*?*/ switch (eKind) { +/*?*/ case OBJ_LINE: { +/*?*/ Polygon aP(2); +/*?*/ rIn>>aP[0]; +/*?*/ rIn>>aP[1]; +/*?*/ aPathPolygon=XPolyPolygon(PolyPolygon(aP)); +/*?*/ } break; +/*?*/ case OBJ_PLIN: { +/*?*/ Polygon aP; +/*?*/ rIn>>aP; +/*?*/ aPathPolygon=XPolyPolygon(PolyPolygon(aP)); +/*?*/ } break; +/*?*/ default: { +/*?*/ PolyPolygon aPoly; +/*?*/ rIn>>aPoly; +/*?*/ aPathPolygon=XPolyPolygon(aPoly); +/*?*/ // und nun die Polygone ggf. durch einfuegen eines weiteren Punktes schliessen +/*?*/ USHORT nPolyAnz=aPathPolygon.Count(); +/*?*/ for (USHORT nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) { +/*?*/ const XPolygon& rPoly=aPathPolygon[nPolyNum]; +/*?*/ USHORT nPointAnz=rPoly.GetPointCount(); +/*?*/ aPathPolygon[nPolyNum].GetPointCount(); +/*?*/ if (nPointAnz>=2 && rPoly[0]!=rPoly[USHORT(nPointAnz-1)]) { +/*?*/ Point aPt(rPoly[0]); +/*?*/ aPathPolygon[nPolyNum][nPointAnz]=aPt; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } else { +/*N*/ if (rHead.GetVersion()>=11) { // ab V11 ist das eingepackt +/*N*/ SdrDownCompat aPathCompat(rIn,STREAM_READ); +/*N*/ #ifdef DBG_UTIL +/*N*/ aPathCompat.SetID("SdrPathObj(PathPolygon)"); +/*N*/ #endif +/*N*/ rIn>>aPathPolygon; +/*N*/ } else { +/*N*/ rIn>>aPathPolygon; +/*N*/ } +/*N*/ } +/*N*/ ImpForceKind(); // ggf. den richtigen Identifier herstellen. +/*N*/ } + +/*N*/ void SdrPathObj::NbcSetPathPoly(const XPolyPolygon& rPathPoly) +/*N*/ { +/*N*/ aPathPolygon=rPathPoly; +/*N*/ ImpForceKind(); +/*N*/ if (IsClosed()) { +/*N*/ USHORT nPolyAnz=aPathPolygon.Count(); +/*N*/ for (USHORT nPolyNum=nPolyAnz; nPolyNum>0;) { +/*N*/ nPolyNum--; +/*N*/ const XPolygon& rConstXP=aPathPolygon[nPolyNum]; +/*N*/ USHORT nPointAnz=rConstXP.GetPointCount(); +/*N*/ if (nPointAnz!=0) { +/*N*/ Point aStartPt(rConstXP[0]); +/*N*/ if (rConstXP[nPointAnz-1]!=aStartPt) { +/*N*/ // Polygon schliessen (wird dabei um einen Punkt erweitert) +/*N*/ aPathPolygon[nPolyNum][nPointAnz]=aStartPt; +/*N*/ } +/*N*/ } else { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 aPathPolygon.Remove(nPolyNum); // leere Polygone raus +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ } + +/*N*/ void SdrPathObj::SetPathPoly(const XPolyPolygon& rPathPoly) +/*N*/ { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcSetPathPoly(rPathPoly); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// transformation interface for StarOfficeAPI. This implements support for +// homogen 3x3 matrices containing the transformation of the SdrObject. At the +// moment it contains a shearX, rotation and translation, but for setting all linear +// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon +// with the base geometry and returns TRUE. Otherwise it returns FALSE. +/*N*/ BOOL SdrPathObj::TRGetBaseGeometry(Matrix3D& rMat, XPolyPolygon& rPolyPolygon) const +/*N*/ { +/*N*/ double fRotate; +/*N*/ double fShear; +/*N*/ Rectangle aRectangle; +/*N*/ +/*N*/ if(eKind==OBJ_LINE) +/*N*/ { +/*N*/ // #85920# special handling for single line mode (2 points) +/*N*/ XPolygon aLine(2); +/*N*/ aLine[0] = GetPoint(0); +/*N*/ aLine[1] = GetPoint(1); +/*N*/ rPolyPolygon.Clear(); +/*N*/ rPolyPolygon.Insert(aLine); +/*N*/ aRectangle = rPolyPolygon.GetBoundRect(); +/*N*/ +/*N*/ // fill in values +/*N*/ fRotate = fShear = 0.0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // get turn and shear +/*N*/ fRotate = (aGeo.nDrehWink / 100.0) * F_PI180; +/*N*/ fShear = (aGeo.nShearWink / 100.0) * F_PI180; +/*N*/ +/*N*/ // get path, remove rotate and shear +/*N*/ rPolyPolygon = GetPathPoly(); +/*N*/ if(aGeo.nDrehWink) +/*N*/ RotateXPoly(rPolyPolygon, Point(), -aGeo.nSin, aGeo.nCos); +/*N*/ +/*N*/ aRectangle = rPolyPolygon.GetBoundRect(); +/*N*/ Point aTmp(aRectangle.TopLeft()); +/*N*/ +/*N*/ if(aGeo.nShearWink) +/*N*/ { +/*N*/ ShearXPoly(rPolyPolygon, aTmp, -aGeo.nTan, FALSE); +/*N*/ aRectangle = rPolyPolygon.GetBoundRect(); +/*N*/ aTmp = aRectangle.TopLeft(); +/*N*/ } +/*N*/ +/*N*/ RotatePoint(aTmp, Point(), aGeo.nSin, aGeo.nCos); +/*N*/ aTmp -= aRectangle.TopLeft(); +/*N*/ +/*N*/ // polygon to base position +/*N*/ rPolyPolygon.Move(aTmp.X(), aTmp.Y()); +/*N*/ +/*N*/ // get bound rect for values +/*N*/ aRectangle = rPolyPolygon.GetBoundRect(); +/*N*/ } +/*N*/ +/*N*/ // fill in values +/*N*/ Vector2D aScale((double)aRectangle.GetWidth(), (double)aRectangle.GetHeight()); +/*N*/ Vector2D aTranslate((double)aRectangle.Left(), (double)aRectangle.Top()); +/*N*/ +/*N*/ // polygon to (0,0) +/*N*/ rPolyPolygon.Move(-aRectangle.Left(), -aRectangle.Top()); +/*N*/ +/*N*/ // position maybe relative to anchorpos, convert +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*N*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*N*/ aTranslate -= Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } +/*N*/ +/*N*/ // force MapUnit to 100th mm +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*N*/ { +/*N*/ case SFX_MAPUNIT_TWIP : +/*N*/ { +/*N*/ // position +/*N*/ // #104018# +/*N*/ aTranslate.X() = ImplTwipsToMM(aTranslate.X()); +/*N*/ aTranslate.Y() = ImplTwipsToMM(aTranslate.Y()); +/*N*/ +/*N*/ // size +/*N*/ // #104018# +/*N*/ aScale.X() = ImplTwipsToMM(aScale.X()); +/*N*/ aScale.Y() = ImplTwipsToMM(aScale.Y()); +/*N*/ +/*N*/ // polygon +/*N*/ for(sal_uInt16 a(0); a < rPolyPolygon.Count(); a++) +/*N*/ { +/*N*/ XPolygon& rPoly = rPolyPolygon[a]; +/*N*/ for(sal_uInt16 b(0); b < rPoly.GetPointCount(); b++) +/*N*/ { +/*N*/ rPoly[b].X() = ImplTwipsToMM(rPoly[b].X()); +/*N*/ rPoly[b].Y() = ImplTwipsToMM(rPoly[b].Y()); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ { +/*N*/ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!"); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // build matrix +/*N*/ rMat.Identity(); +/*N*/ if(aScale.X() != 1.0 || aScale.Y() != 1.0) +/*N*/ rMat.Scale(aScale.X(), aScale.Y()); +/*N*/ if(fShear != 0.0) +/*N*/ rMat.ShearX(tan(fShear)); +/*N*/ if(fRotate != 0.0) +/*N*/ rMat.Rotate(fRotate); +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ rMat.Translate(aTranslate.X(), aTranslate.Y()); +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// sets the base geometry of the object using infos contained in the homogen 3x3 matrix. +// If it's an SdrPathObj it will use the provided geometry information. The Polygon has +// to use (0,0) as upper left and will be scaled to the given size in the matrix. +/*N*/ void SdrPathObj::TRSetBaseGeometry(const Matrix3D& rMat, const XPolyPolygon& rPolyPolygon) +/*N*/ { +/*N*/ // break up matrix +/*N*/ Vector2D aScale, aTranslate; +/*N*/ double fShear, fRotate; +/*N*/ rMat.DecomposeAndCorrect(aScale, fShear, fRotate, aTranslate); +/*N*/ +/*N*/ // copy poly +/*N*/ XPolyPolygon aNewPolyPolygon(rPolyPolygon); +/*N*/ +/*N*/ // reset object shear and rotations +/*N*/ aGeo.nDrehWink = 0; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ aGeo.nShearWink = 0; +/*N*/ aGeo.RecalcTan(); +/*N*/ +/*N*/ // force metric to pool metric +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*N*/ { +/*N*/ case SFX_MAPUNIT_TWIP : +/*N*/ { +/*N*/ // position +/*N*/ // #104018# +/*N*/ aTranslate.X() = ImplMMToTwips(aTranslate.X()); +/*N*/ aTranslate.Y() = ImplMMToTwips(aTranslate.Y()); +/*N*/ +/*N*/ // size +/*N*/ // #104018# +/*N*/ aScale.X() = ImplMMToTwips(aScale.X()); +/*N*/ aScale.Y() = ImplMMToTwips(aScale.Y()); +/*N*/ +/*N*/ // polygon +/*N*/ for(sal_uInt16 a(0); a < aNewPolyPolygon.Count(); a++) +/*N*/ { +/*N*/ XPolygon& rPoly = aNewPolyPolygon[a]; +/*N*/ for(sal_uInt16 b(0); b < rPoly.GetPointCount(); b++) +/*N*/ { +/*N*/ rPoly[b].X() = ImplMMToTwips(rPoly[b].X()); +/*N*/ rPoly[b].Y() = ImplMMToTwips(rPoly[b].Y()); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ { +/*N*/ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*N*/ // if anchor is used, make position relative to it +/*N*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*N*/ aTranslate -= Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } +/*N*/ +/*N*/ // set PathPoly and get type +/*N*/ SetPathPoly(aNewPolyPolygon); +/*N*/ +/*N*/ if(eKind==OBJ_LINE) +/*N*/ { +/*N*/ // #85920# special handling for single line mode (2 points) +/*N*/ Point aPoint1 = aNewPolyPolygon[0][0]; +/*N*/ Point aPoint2 = aNewPolyPolygon[0][1]; +/*N*/ +/*N*/ // shear? +/*N*/ if(fShear != 0.0) +/*N*/ { +/*?*/ GeoStat aGeoStat; +/*?*/ aGeoStat.nShearWink = FRound((atan(fShear) / F_PI180) * 100.0); +/*?*/ aGeoStat.RecalcTan(); +/*?*/ ShearPoint(aPoint1, Point(), aGeoStat.nTan, FALSE); +/*?*/ ShearPoint(aPoint2, Point(), aGeoStat.nTan, FALSE); +/*N*/ } +/*N*/ +/*N*/ // rotation? +/*N*/ if(fRotate != 0.0) +/*N*/ { +/*?*/ GeoStat aGeoStat; +/*?*/ aGeoStat.nDrehWink = FRound((fRotate / F_PI180) * 100.0); +/*?*/ aGeoStat.RecalcSinCos(); +/*?*/ RotatePoint(aPoint1, Point(), aGeoStat.nSin, aGeoStat.nCos); +/*?*/ RotatePoint(aPoint2, Point(), aGeoStat.nSin, aGeoStat.nCos); +/*N*/ } +/*N*/ +/*N*/ // translate? +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ { +/*N*/ Point aOffset((sal_Int32)FRound(aTranslate.X()), (sal_Int32)FRound(aTranslate.Y())); +/*N*/ aPoint1 += aOffset; +/*N*/ aPoint2 += aOffset; +/*N*/ } +/*N*/ +/*N*/ // put points back to poly +/*N*/ aNewPolyPolygon[0][0] = aPoint1; +/*N*/ aNewPolyPolygon[0][1] = aPoint2; +/*N*/ +/*N*/ // set PathPoly again; this sets all of JOEs old needed stati and values +/*N*/ SetPathPoly(aNewPolyPolygon); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // shear? +/*N*/ if(fShear != 0.0) +/*N*/ { +/*N*/ GeoStat aGeoStat; +/*N*/ aGeoStat.nShearWink = FRound((atan(fShear) / F_PI180) * 100.0); +/*N*/ aGeoStat.RecalcTan(); +/*N*/ Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE); +/*N*/ } +/*N*/ +/*N*/ // rotation? +/*N*/ if(fRotate != 0.0) +/*N*/ { +/*N*/ GeoStat aGeoStat; +/*N*/ aGeoStat.nDrehWink = FRound((fRotate / F_PI180) * 100.0); +/*N*/ aGeoStat.RecalcSinCos(); +/*N*/ Rotate(Point(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos); +/*N*/ } +/*N*/ +/*N*/ // translate? +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ { +/*N*/ Move(Size( +/*N*/ (sal_Int32)FRound(aTranslate.X()), +/*N*/ (sal_Int32)FRound(aTranslate.Y()))); +/*N*/ } +/*N*/ } +/*N*/ } + +// EOF +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdorect.cxx b/binfilter/bf_svx/source/svdraw/svx_svdorect.cxx new file mode 100644 index 000000000000..73ec1b758e22 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdorect.cxx @@ -0,0 +1,586 @@ +/* -*- 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 <stdlib.h> +#include "xpool.hxx" +#include "svdpool.hxx" +#include "svdtouch.hxx" +#include "svdio.hxx" +#include "svdpage.hxx" +#include "svdocapt.hxx" // fuer Import von SdrFileVersion 2 +#include "svdview.hxx" // das +#include "svdstr.hrc" // Objektname + +#include <xflclit.hxx> + +#include <xlnclit.hxx> + +#include <xlnwtit.hxx> + +#include "rectenum.hxx" + +#include "svdoimp.hxx" + +#include "xoutx.hxx" + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrRectObj,SdrTextObj); + +/*N*/ SdrRectObj::SdrRectObj(): +/*N*/ pXPoly(NULL), +/*N*/ bXPolyIsLine(FALSE) +/*N*/ { +/*N*/ bClosedObj=TRUE; +/*N*/ } + +/*N*/ SdrRectObj::SdrRectObj(const Rectangle& rRect): +/*N*/ SdrTextObj(rRect), +/*N*/ pXPoly(NULL), +/*N*/ bXPolyIsLine(FALSE) +/*N*/ { +/*N*/ bClosedObj=TRUE; +/*N*/ } + +/*N*/ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind): +/*N*/ SdrTextObj(eNewTextKind), +/*N*/ pXPoly(NULL), +/*N*/ bXPolyIsLine(FALSE) +/*N*/ { +/*N*/ DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT || +/*N*/ eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT, +/*N*/ "SdrRectObj::SdrRectObj(SdrObjKind) ist nur fuer Textrahmen gedacht"); +/*N*/ bClosedObj=TRUE; +/*N*/ } + +/*N*/ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect): +/*N*/ SdrTextObj(eNewTextKind,rRect), +/*N*/ pXPoly(NULL), +/*N*/ bXPolyIsLine(FALSE) +/*N*/ { +/*N*/ DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT || +/*N*/ eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT, +/*N*/ "SdrRectObj::SdrRectObj(SdrObjKind,...) ist nur fuer Textrahmen gedacht"); +/*N*/ bClosedObj=TRUE; +/*N*/ } + +/*N*/ SdrRectObj::~SdrRectObj() +/*N*/ { +/*N*/ if (pXPoly!=NULL) delete pXPoly; +/*N*/ } + +/*N*/ void SdrRectObj::SetXPolyDirty() +/*N*/ { +/*N*/ if (pXPoly!=NULL) { +/*N*/ delete pXPoly; +/*N*/ pXPoly=NULL; +/*N*/ } +/*N*/ } + +/*N*/ FASTBOOL SdrRectObj::PaintNeedsXPoly(long nEckRad) const +/*N*/ { +/*N*/ FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0; +/*N*/ return bNeed; +/*N*/ } + +/*N*/ XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1, FASTBOOL bContour) const +/*N*/ { +/*N*/ bContour=TRUE; // am 14.1.97 wg. Umstellung TakeContour ueber Mtf und Paint. Joe. +/*N*/ XPolygon aXPoly(rRect1,nRad1,nRad1); +/*N*/ if (bContour) { +/*N*/ unsigned nPointAnz=aXPoly.GetPointCount(); +/*N*/ XPolygon aNeuPoly(nPointAnz+1); +/*N*/ unsigned nShift=nPointAnz-2; +/*N*/ if (nRad1!=0) nShift=nPointAnz-5; +/*N*/ unsigned j=nShift; +/*N*/ for (unsigned i=1; i<nPointAnz; i++) { +/*N*/ aNeuPoly[i]=aXPoly[j]; +/*N*/ aNeuPoly.SetFlags(i,aXPoly.GetFlags(j)); +/*N*/ j++; +/*N*/ if (j>=nPointAnz) j=1; +/*N*/ } +/*N*/ aNeuPoly[0]=rRect1.BottomCenter(); +/*N*/ aNeuPoly[nPointAnz]=aNeuPoly[0]; +/*N*/ aXPoly=aNeuPoly; +/*N*/ } +/*N*/ // Die Winkelangaben beziehen sich immer auf die linke obere Ecke von !aRect! +/*N*/ if (aGeo.nShearWink!=0) ShearXPoly(aXPoly,aRect.TopLeft(),aGeo.nTan); +/*N*/ if (aGeo.nDrehWink!=0) RotateXPoly(aXPoly,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ return aXPoly; +/*N*/ } + +/*N*/ void SdrRectObj::RecalcXPoly() +/*N*/ { // #i37639# Needed for calc import +/*N*/ pXPoly=new XPolygon(ImpCalcXPoly(aRect,GetEckenradius())); +/*N*/ } + +/*N*/ const XPolygon& SdrRectObj::GetXPoly() const +/*N*/ { +/*N*/ if (pXPoly==NULL) ((SdrRectObj*)this)->RecalcXPoly(); +/*N*/ return *pXPoly; +/*N*/ } + + +/*N*/ UINT16 SdrRectObj::GetObjIdentifier() const +/*N*/ { +/*N*/ if (IsTextFrame()) return UINT16(eTextKind); +/*N*/ else return UINT16(OBJ_RECT); +/*N*/ } + +/*N*/ void SdrRectObj::RecalcBoundRect() +/*N*/ { +/*N*/ aOutRect=GetSnapRect(); +/*N*/ long nLineWdt=ImpGetLineWdt(); +/*N*/ nLineWdt++; nLineWdt/=2; +/*N*/ if (nLineWdt!=0) { +/*N*/ long a=nLineWdt; +/*N*/ if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && GetEckenradius()==0) { +/*N*/ a*=2; // doppelt, wegen evtl. spitzen Ecken +/*N*/ } +/*N*/ aOutRect.Left ()-=a; +/*N*/ aOutRect.Top ()-=a; +/*N*/ aOutRect.Right ()+=a; +/*N*/ aOutRect.Bottom()+=a; +/*N*/ } +/*N*/ ImpAddShadowToBoundRect(); +/*N*/ ImpAddTextToBoundRect(); +/*N*/ } + +/*N*/ void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ rRect=aRect; +/*N*/ if (aGeo.nShearWink!=0) { +/*N*/ long nDst=Round((aRect.Bottom()-aRect.Top())*aGeo.nTan); +/*N*/ if (aGeo.nShearWink>0) { +/*?*/ Point aRef(rRect.TopLeft()); +/*?*/ rRect.Left()-=nDst; +/*?*/ Point aTmpPt(rRect.TopLeft()); +/*?*/ RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos); +/*?*/ aTmpPt-=rRect.TopLeft(); +/*?*/ rRect.Move(aTmpPt.X(),aTmpPt.Y()); +/*N*/ } else { +/*N*/ rRect.Right()-=nDst; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ FASTBOOL SdrRectObj::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec) const +/*N*/ { +/*N*/ // Hidden objects on masterpages, draw nothing +/*N*/ if((rInfoRec.nPaintMode & SDRPAINTMODE_MASTERPAGE) && bNotVisibleAsMaster) +/*N*/ return TRUE; +/*N*/ +/*N*/ // Im Graustufenmodus/Kontrastmodus soll die Hintergrundseite NICHT angezeigt werden +/*N*/ ULONG nMode = rXOut.GetOutDev()->GetDrawMode(); +/*N*/ FASTBOOL bGrayscaleMode = ( nMode == (DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); +/*N*/ FASTBOOL bSettingsMode = ( nMode == (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ) ); +/*N*/ +/*N*/ if( ( bGrayscaleMode || bSettingsMode ) && pPage && pPage->IsMasterPage() ) +/*N*/ { +/*?*/ Size aPageSize = pPage->GetSize(); +/*?*/ long aRectWidth = aRect.GetSize().Width() - 1; +/*?*/ long aRectHeight = aRect.GetSize().Height() - 1; +/*?*/ +/*?*/ // Objekt so gross wie Seite ? -> Hintergrund +/*?*/ if( aRectWidth == aPageSize.Width() && +/*?*/ aRectHeight == aPageSize.Height() ) +/*?*/ { +/*?*/ return TRUE; +/*?*/ } +/*?*/ // oder so gross wie Seite abzueglich der Raender +/*?*/ if( aRectWidth == aPageSize.Width() - +/*?*/ pPage->GetLftBorder() - pPage->GetRgtBorder() && +/*?*/ aRectHeight == aPageSize.Height() - +/*?*/ pPage->GetUppBorder() - pPage->GetLwrBorder() ) +/*?*/ { +/*?*/ return TRUE; +/*?*/ } +/*?*/ +/*N*/ } + +/*N*/ if (bTextFrame && aGeo.nShearWink!=0) { +/*?*/ DBG_WARNING("Shearwinkel vom TextFrame innerhalb von SdrRectObj::Paint() auf 0 gesetzt"); +/*?*/ ((SdrRectObj*)this)->ImpCheckShear(); +/*?*/ ((SdrRectObj*)this)->SetRectsDirty(); +/*N*/ } +/*N*/ FASTBOOL bOk=TRUE; +/*N*/ BOOL bHideContour(IsHideContour()); +/*N*/ sal_Int32 nEckRad(GetEckenradius()); +/*N*/ BOOL bIsFillDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTFILL)); +/*N*/ BOOL bIsLineDraft(0 != (rInfoRec.nPaintMode & SDRPAINTMODE_DRAFTLINE)); +/*N*/ +/*N*/ // prepare ItemSet of this object +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ +/*N*/ // perepare ItemSet to avoid old XOut line drawing +/*N*/ SfxItemSet aEmptySet(*rSet.GetPool()); +/*N*/ aEmptySet.Put(XLineStyleItem(XLINE_NONE)); +/*N*/ aEmptySet.Put(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ // #103692# prepare ItemSet for shadow fill attributes +/*N*/ SfxItemSet aShadowSet(rSet); +/*N*/ +/*N*/ // prepare line geometry +/*N*/ ::std::auto_ptr< SdrLineGeometry > pLineGeometry( ImpPrepareLineGeometry(rXOut, rSet, bIsLineDraft) ); +/*N*/ +/*N*/ // Shadows +/*N*/ if (!bHideContour && ImpSetShadowAttributes(rSet, aShadowSet)) +/*N*/ { +/*?*/ if( bIsFillDraft ) +/*?*/ rXOut.SetFillAttr(aEmptySet); +/*?*/ else +/*?*/ rXOut.SetFillAttr(aShadowSet); +/*?*/ +/*?*/ UINT32 nXDist=((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(); +/*?*/ UINT32 nYDist=((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue(); +/*?*/ +/*?*/ // avoid shadow line drawing in XOut +/*?*/ rXOut.SetLineAttr(aEmptySet); +/*?*/ +/*?*/ { +/*?*/ // #100127# Output original geometry for metafiles +/*?*/ ImpGraphicFill aFill( *this, rXOut, aShadowSet, true ); +/*?*/ +/*?*/ if (PaintNeedsXPoly(nEckRad)) { +/*?*/ XPolygon aX(GetXPoly()); +/*?*/ aX.Move(nXDist,nYDist); +/*?*/ rXOut.DrawXPolygon(aX); +/*?*/ } else { +/*?*/ Rectangle aR(aRect); +/*?*/ aR.Move(nXDist,nYDist); +/*?*/ rXOut.DrawRect(aR,USHORT(2*nEckRad),USHORT(2*nEckRad)); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // new shadow line drawing +/*?*/ if( pLineGeometry.get() ) +/*?*/ { +/*?*/ // draw the line geometry +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ImpDrawShadowLineGeometry(rXOut, rSet, *pLineGeometry); +/*?*/ } +/*N*/ } + + // Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr); +/*N*/ rXOut.SetLineAttr(aEmptySet); +/*N*/ +/*N*/ rXOut.SetFillAttr( bIsFillDraft ? aEmptySet : rSet ); +/*N*/ +/*N*/ if (!bHideContour) { +/*N*/ // #100127# Output original geometry for metafiles +/*N*/ ImpGraphicFill aFill( *this, rXOut, bIsFillDraft ? aEmptySet : rSet ); +/*N*/ +/*N*/ if (PaintNeedsXPoly(nEckRad)) { +/*?*/ rXOut.DrawXPolygon(GetXPoly()); +/*N*/ } else { +/*N*/ DBG_ASSERT(nEckRad==0,"SdrRectObj::Paint(): XOut.DrawRect() unterstuetz kein Eckenradius!"); +/*N*/ rXOut.DrawRect(aRect/*,USHORT(2*nEckRad),USHORT(2*nEckRad)*/); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT(aRect.GetWidth()>1 && aRect.GetHeight()>1,"SdrRectObj::Paint(): Rect hat Nullgroesse (oder negativ)!"); +/*N*/ +/*N*/ // Own line drawing +/*N*/ if( !bHideContour && pLineGeometry.get() ) +/*N*/ { +/*N*/ // draw the line geometry +/*N*/ ImpDrawColorLineGeometry(rXOut, rSet, *pLineGeometry); +/*N*/ } +/*N*/ +/*N*/ if (HasText()) { +/*?*/ bOk=SdrTextObj::Paint(rXOut,rInfoRec); +/*N*/ } +/*N*/ if (bOk && (rInfoRec.nPaintMode & SDRPAINTMODE_GLUEPOINTS) !=0) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 bOk=PaintGluePoints(rXOut,rInfoRec); +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + +/*N*/ SdrObject* SdrRectObj::ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol) const +/*N*/ { +/*N*/ if (pVisiLayer!=NULL && !pVisiLayer->IsSet(nLayerId)) return NULL; +/*N*/ INT32 nMyTol=nTol; +/*N*/ FASTBOOL bFilled=bForceFilled || HasFill(); +/*N*/ FASTBOOL bPickThrough=pModel!=NULL && pModel->IsPickThroughTransparentTextFrames(); +/*N*/ if (bTextFrame && !bPickThrough) bFilled=TRUE; +/*N*/ FASTBOOL bLine=HasLine(); +/*N*/ +/*N*/ INT32 nWdt=bLine ? ImpGetLineWdt()/2 :0; // Halbe Strichstaerke +/*N*/ long nBoundWdt=aRect.GetWidth()-1; +/*N*/ long nBoundHgt=aRect.GetHeight()-1; +/*N*/ if (bFilled && nBoundWdt>short(nTol) && nBoundHgt>short(nTol) && Abs(aGeo.nShearWink)<=4500) { +/*N*/ if (!bForceTol && !bTextFrame ) nMyTol=0; // Keine Toleranz noetig hier +/*N*/ } +/*N*/ if (nWdt>nMyTol && (!bTextFrame || pEdtOutl==NULL)) nMyTol=nWdt; // Bei dicker Umrandung keine Toleranz noetig, ausser wenn bei TextEdit +/*N*/ Rectangle aR(aRect); +/*N*/ if (nMyTol!=0 && bFilled) { +/*N*/ aR.Left ()-=nMyTol; +/*N*/ aR.Top ()-=nMyTol; +/*N*/ aR.Right ()+=nMyTol; +/*N*/ aR.Bottom()+=nMyTol; +/*N*/ } +/*N*/ +/*N*/ if (bFilled || bLine || bTextFrame) { // Bei TextFrame so tun, alsob Linie da +/*N*/ unsigned nCnt=0; +/*N*/ INT32 nXShad=0,nYShad=0; +/*N*/ long nEckRad=/*bTextFrame ? 0 :*/ GetEckenradius(); +/*N*/ do { // 1 Durchlauf, bei Schatten 2 Durchlaeufe. +/*N*/ if (nCnt!=0) aR.Move(nXShad,nYShad); +/*N*/ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0 || !bFilled) { +/*N*/ Polygon aPol(aR); +/*N*/ if (nEckRad!=0) { +/*N*/ INT32 nRad=nEckRad; +/*N*/ if (bFilled) nRad+=nMyTol; // um korrekt zu sein ... +/*N*/ XPolygon aXPoly(ImpCalcXPoly(aR,nRad)); +/*N*/ aPol=XOutCreatePolygon(aXPoly,NULL); +/*N*/ } else { +/*N*/ if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan); +/*N*/ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ } +/*N*/ if (bFilled) { +/*N*/ if (IsPointInsidePoly(aPol,rPnt)) return (SdrObject*)this; +/*N*/ } else { +/*N*/ Rectangle aTouchRect(rPnt.X()-nMyTol,rPnt.Y()-nMyTol,rPnt.X()+nMyTol,rPnt.Y()+nMyTol); +/*N*/ if (IsRectTouchesLine(aPol,aTouchRect)) return (SdrObject*)this; +/*N*/ } +/*N*/ } else { +/*N*/ if (aR.IsInside(rPnt)) return (SdrObject*)this; +/*N*/ } +/*N*/ } while (nCnt++==0 && ImpGetShadowDist(nXShad,nYShad)); +/*N*/ } +/*N*/ FASTBOOL bCheckText=TRUE; +/*N*/ if (bCheckText && HasText() && (!bTextFrame || bPickThrough)) { +/*N*/ return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer); +/*N*/ } +/*N*/ return NULL; +/*N*/ } + +/*N*/ SdrObject* SdrRectObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ return ImpCheckHit(rPnt,nTol,pVisiLayer,FALSE/*,bTextFrame*/); +/*N*/ } + + + +/*N*/ void SdrRectObj::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ SdrTextObj::operator=(rObj); +/*N*/ } + +/*N*/ void SdrRectObj::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const +/*N*/ { +/*N*/ rPoly=XPolyPolygon(ImpCalcXPoly(aRect,GetEckenradius())); +/*N*/ } + +/*N*/ void SdrRectObj::TakeContour(XPolyPolygon& rPoly) const +/*N*/ { +/*N*/ SdrTextObj::TakeContour(rPoly); +/*N*/ } + + +/*N*/ void SdrRectObj::RecalcSnapRect() +/*N*/ { +/*N*/ long nEckRad=GetEckenradius(); +/*N*/ if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && nEckRad!=0) { +/*?*/ maSnapRect=GetXPoly().GetBoundRect(); +/*N*/ } else { +/*N*/ SdrTextObj::RecalcSnapRect(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrRectObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrTextObj::NbcSetSnapRect(rRect); +/*N*/ SetXPolyDirty(); +/*N*/ } + +/*N*/ void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrTextObj::NbcSetLogicRect(rRect); +/*N*/ SetXPolyDirty(); +/*N*/ } + + + + + + + + + + + +/*N*/ Pointer SdrRectObj::GetCreatePointer() const +/*N*/ { +/*N*/ if (IsTextFrame()) return Pointer(POINTER_DRAW_TEXT); +/*N*/ return Pointer(POINTER_DRAW_RECT); +/*N*/ } + +/*N*/ void SdrRectObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ SdrTextObj::NbcMove(rSiz); +/*N*/ SetXPolyDirty(); +/*N*/ } + +/*N*/ void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrTextObj::NbcResize(rRef,xFact,yFact); +/*N*/ SetXPolyDirty(); +/*N*/ } + +/*N*/ void SdrRectObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ SdrTextObj::NbcRotate(rRef,nWink,sn,cs); +/*N*/ SetXPolyDirty(); +/*N*/ } + +/*N*/ void SdrRectObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ SdrTextObj::NbcShear(rRef,nWink,tn,bVShear); +/*N*/ SetXPolyDirty(); +/*N*/ } + + + + +/*N*/ SdrGluePoint SdrRectObj::GetVertexGluePoint(USHORT nPosNum) const +/*N*/ { +/*N*/ INT32 nWdt = ((XLineWidthItem&)(GetItem(XATTR_LINEWIDTH))).GetValue(); +/*N*/ nWdt++; +/*N*/ nWdt /= 2; +/*N*/ +/*N*/ Point aPt; +/*N*/ switch (nPosNum) { +/*N*/ case 0: aPt=aRect.TopCenter(); aPt.Y()-=nWdt; break; +/*N*/ case 1: aPt=aRect.RightCenter(); aPt.X()+=nWdt; break; +/*N*/ case 2: aPt=aRect.BottomCenter(); aPt.Y()+=nWdt; break; +/*N*/ case 3: aPt=aRect.LeftCenter(); aPt.X()-=nWdt; break; +/*N*/ } +/*N*/ if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan); +/*N*/ if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ aPt-=GetSnapRect().Center(); +/*N*/ SdrGluePoint aGP(aPt); +/*N*/ aGP.SetPercent(FALSE); +/*N*/ return aGP; +/*N*/ } + + + +/*N*/ void SdrRectObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SdrTextObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ SetXPolyDirty(); // wg. Eckenradius +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access +/*N*/ void SdrRectObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // call parent +/*N*/ SdrTextObj::ItemSetChanged(rSet); +/*N*/ +/*N*/ // local changes +/*N*/ SetXPolyDirty(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrRectObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SdrTextObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ SetXPolyDirty(); // wg. Eckenradius +/*N*/ } + +/*N*/ SdrObjGeoData* SdrRectObj::NewGeoData() const +/*N*/ { // etwas umstaendlicher, damit's vielleicht unter Chicago durchgeht +/*N*/ SdrObjGeoData* pGeo=new SdrRectObjGeoData; +/*N*/ return pGeo; +/*N*/ } + +/*N*/ void SdrRectObj::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ { +/*N*/ SdrTextObj::SaveGeoData(rGeo); +/*N*/ SdrRectObjGeoData& rRGeo=(SdrRectObjGeoData&)rGeo; +/*N*/ rRGeo.nEckRad=GetEckenradius(); +/*N*/ } + +/*?*/ void SdrRectObj::RestGeoData(const SdrObjGeoData& rGeo) +/*?*/ { // RectsDirty wird von SdrObject gerufen +/*?*/ SdrTextObj::RestGeoData(rGeo); +/*?*/ SdrRectObjGeoData& rRGeo=(SdrRectObjGeoData&)rGeo; +/*?*/ long nAltRad=GetEckenradius(); +/*?*/ if (rRGeo.nEckRad!=nAltRad) NbcSetEckenradius(rRGeo.nEckRad); +/*?*/ SetXPolyDirty(); +/*?*/ } + +/*N*/ void SdrRectObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrTextObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrRectObj"); +/*N*/ #endif +/*N*/ } + +/*N*/ void SdrRectObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrTextObj::ReadData(rHead,rIn); +/*N*/ if (IsTextFrame() && rHead.GetVersion()<3 && !HAS_BASE(SdrCaptionObj,this)) { +/*N*/ // Bis einschl. Version 2 wurden Textrahmen mit SdrTextObj dargestellt, ausser CaptionObj +/*?*/ SfxItemPool* pPool=GetItemPool(); +/*?*/ if (pPool!=NULL) { +/*?*/ // Umrandung und Hintergrund des importierten Textrahmens ausschalten +/*?*/ SfxItemSet aSet(*pPool); +/*?*/ aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet +/*?*/ aSet.Put(XFillStyleItem(XFILL_NONE)); +/*?*/ aSet.Put(XLineColorItem(String(),Color(COL_BLACK))); // Falls einer auf Solid umschaltet +/*?*/ aSet.Put(XLineStyleItem(XLINE_NONE)); +/*?*/ +/*?*/ SetItemSet(aSet); +/*N*/ } +/*N*/ } else { +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrRectObj"); +/*N*/ #endif +/*N*/ if (rHead.GetVersion()<=5) { +/*N*/ long nEckRad; +/*?*/ rIn>>nEckRad; +/*?*/ long nAltRad=GetEckenradius(); +/*?*/ if (nEckRad!=nAltRad) NbcSetEckenradius(nEckRad); +/*N*/ } +/*N*/ } +/*N*/ SetXPolyDirty(); +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotext.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotext.cxx new file mode 100644 index 000000000000..d61616fbf444 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotext.cxx @@ -0,0 +1,1633 @@ +/* -*- 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 "svditext.hxx" +#include "svdview.hxx" // Objekt gerade editiert wird +#include "svdtouch.hxx" +#include "svdio.hxx" +#include "svdetc.hxx" +#include "svdoutl.hxx" +#include "svdstr.hrc" // Objektname +#include "svdtxhdl.hxx" // DrawTextToPath +#include "writingmodeitem.hxx" + + + +#include <editstat.hxx> + +#include <outlobj.hxx> + +#include <editobj.hxx> + + +#include "fhgtitem.hxx" + +#include <bf_svtools/itempool.hxx> + +#include "adjitem.hxx" + + +#include "itemdata.hxx" + +#include "flditem.hxx" + + +#include <vcl/salbtype.hxx> // FRound + +#include "xflgrit.hxx" + +#include "xoutx.hxx" + +#include <bf_goodies/matrix3d.hxx> + +namespace binfilter { + +// #104018# replace macros above with type-safe methods +inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } +inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrTextObj,SdrAttrObj); + +/*N*/ SdrTextObj::SdrTextObj(): +/*N*/ eTextKind(OBJ_TEXT), +/*N*/ pOutlinerParaObject(NULL), +/*N*/ pEdtOutl(NULL), +/*N*/ pFormTextBoundRect(NULL) +/*N*/ { +/*N*/ bTextSizeDirty=FALSE; +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ bTextFrame=FALSE; +/*N*/ bNoShear=FALSE; +/*N*/ bNoRotate=FALSE; +/*N*/ bNoMirror=FALSE; +/*N*/ bDisableAutoWidthOnDragging=FALSE; +/*N*/ +/*N*/ // #101684# +/*N*/ mbInEditMode = FALSE; +/*N*/ +/*N*/ // #108784# +/*N*/ maTextEditOffset = Point(0, 0); +/*N*/ } + +/*N*/ SdrTextObj::SdrTextObj(const Rectangle& rNewRect): +/*N*/ aRect(rNewRect), +/*N*/ eTextKind(OBJ_TEXT), +/*N*/ pOutlinerParaObject(NULL), +/*N*/ pEdtOutl(NULL), +/*N*/ pFormTextBoundRect(NULL) +/*N*/ { +/*N*/ bTextSizeDirty=FALSE; +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ bTextFrame=FALSE; +/*N*/ bNoShear=FALSE; +/*N*/ bNoRotate=FALSE; +/*N*/ bNoMirror=FALSE; +/*N*/ bDisableAutoWidthOnDragging=FALSE; +/*N*/ ImpJustifyRect(aRect); +/*N*/ +/*N*/ // #101684# +/*N*/ mbInEditMode = FALSE; +/*N*/ +/*N*/ // #108784# +/*N*/ maTextEditOffset = Point(0, 0); +/*N*/ } + +/*N*/ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind): +/*N*/ eTextKind(eNewTextKind), +/*N*/ pOutlinerParaObject(NULL), +/*N*/ pEdtOutl(NULL), +/*N*/ pFormTextBoundRect(NULL) +/*N*/ { +/*N*/ bTextSizeDirty=FALSE; +/*N*/ bTextFrame=TRUE; +/*N*/ bNoShear=TRUE; +/*N*/ bNoRotate=FALSE; +/*N*/ bNoMirror=TRUE; +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ bDisableAutoWidthOnDragging=FALSE; +/*N*/ +/*N*/ // #101684# +/*N*/ mbInEditMode = FALSE; +/*N*/ +/*N*/ // #108784# +/*N*/ maTextEditOffset = Point(0, 0); +/*N*/ } + +/*N*/ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect): +/*N*/ aRect(rNewRect), +/*N*/ eTextKind(eNewTextKind), +/*N*/ pOutlinerParaObject(NULL), +/*N*/ pEdtOutl(NULL), +/*N*/ pFormTextBoundRect(NULL) +/*N*/ { +/*N*/ bTextSizeDirty=FALSE; +/*N*/ bTextFrame=TRUE; +/*N*/ bNoShear=TRUE; +/*N*/ bNoRotate=FALSE; +/*N*/ bNoMirror=TRUE; +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ bDisableAutoWidthOnDragging=FALSE; +/*N*/ ImpJustifyRect(aRect); +/*N*/ +/*N*/ // #101684# +/*N*/ mbInEditMode = FALSE; +/*N*/ +/*N*/ // #108784# +/*N*/ maTextEditOffset = Point(0, 0); +/*N*/ } + +/*N*/ SdrTextObj::~SdrTextObj() +/*N*/ { +/*N*/ if( pModel ) +/*N*/ { +/*N*/ SdrOutliner& rOutl = pModel->GetHitTestOutliner(); +/*N*/ if( rOutl.GetTextObj() == this ) +/*N*/ rOutl.SetTextObj( NULL ); +/*N*/ } +/*N*/ +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ delete pOutlinerParaObject; +/*N*/ } +/*N*/ if (pFormTextBoundRect!=NULL) { +/*N*/ delete pFormTextBoundRect; +/*N*/ } +/*N*/ ImpLinkAbmeldung(); +/*N*/ } + +/*N*/ const Size& SdrTextObj::GetTextSize() const +/*N*/ { +/*N*/ if (bTextSizeDirty) { +/*N*/ Size aSiz; +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ rOutliner.SetText(*pOutlinerParaObject); +/*N*/ rOutliner.SetUpdateMode(TRUE); +/*N*/ aSiz=rOutliner.CalcTextSize(); +/*N*/ rOutliner.Clear(); +/*N*/ } +/*N*/ // 2x casting auf nonconst +/*N*/ ((SdrTextObj*)this)->aTextSize=aSiz; +/*N*/ ((SdrTextObj*)this)->bTextSizeDirty=FALSE; +/*N*/ } +/*N*/ return aTextSize; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::IsAutoGrowHeight() const +/*N*/ { +/*N*/ if(!bTextFrame) +/*N*/ return FALSE; // AutoGrow nur bei TextFrames +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ BOOL bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue(); +/*N*/ +/*N*/ if(bRet) +/*N*/ { +/*N*/ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue(); +/*N*/ +/*N*/ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE) +/*N*/ { +/*N*/ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue(); +/*N*/ +/*N*/ if(eDirection == SDRTEXTANI_UP || eDirection == SDRTEXTANI_DOWN) +/*N*/ { +/*N*/ bRet = FALSE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::IsAutoGrowWidth() const +/*N*/ { +/*N*/ if(!bTextFrame) +/*N*/ return FALSE; // AutoGrow nur bei TextFrames +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ BOOL bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue(); +/*N*/ +/*N*/ // #101684# +/*N*/ BOOL bInEditMOde = IsInEditMode(); +/*N*/ +/*N*/ if(!bInEditMOde && bRet) +/*N*/ { +/*N*/ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue(); +/*N*/ +/*N*/ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE) +/*N*/ { +/*?*/ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue(); +/*?*/ +/*?*/ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT) +/*?*/ { +/*?*/ bRet = FALSE; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ SdrTextHorzAdjust SdrTextObj::GetTextHorizontalAdjust() const +/*N*/ { +/*N*/ if(IsContourTextFrame()) +/*?*/ return SDRTEXTHORZADJUST_BLOCK; +/*N*/ +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrTextHorzAdjust eRet = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue(); +/*N*/ +/*N*/ // #101684# +/*N*/ BOOL bInEditMode = IsInEditMode(); +/*N*/ +/*N*/ if(!bInEditMode && eRet == SDRTEXTHORZADJUST_BLOCK) +/*N*/ { +/*N*/ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue(); +/*N*/ +/*N*/ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE) +/*N*/ { +/*?*/ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue(); +/*?*/ +/*?*/ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT) +/*?*/ { +/*?*/ eRet = SDRTEXTHORZADJUST_LEFT; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return eRet; +/*N*/ } // defaults: BLOCK fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte + +/*N*/ SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust() const +/*N*/ { +/*N*/ if(IsContourTextFrame()) +/*?*/ return SDRTEXTVERTADJUST_TOP; +/*N*/ +/*N*/ // #103516# Take care for vertical text animation here +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrTextVertAdjust eRet = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue(); +/*N*/ BOOL bInEditMode = IsInEditMode(); +/*N*/ +/*N*/ // #103516# Take care for vertical text animation here +/*N*/ if(!bInEditMode && eRet == SDRTEXTVERTADJUST_BLOCK) +/*N*/ { +/*N*/ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue(); +/*N*/ +/*N*/ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE) +/*N*/ { +/*N*/ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue(); +/*N*/ +/*N*/ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT) +/*N*/ { +/*N*/ eRet = SDRTEXTVERTADJUST_TOP; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return eRet; +/*N*/ } // defaults: TOP fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte + +/*N*/ void SdrTextObj::ImpJustifyRect(Rectangle& rRect) const +/*N*/ { +/*N*/ if (!rRect.IsEmpty()) { +/*N*/ rRect.Justify(); +/*N*/ if (rRect.Left()==rRect.Right()) rRect.Right()++; +/*N*/ if (rRect.Top()==rRect.Bottom()) rRect.Bottom()++; +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::ImpCheckShear() +/*N*/ { +/*N*/ if (bNoShear && aGeo.nShearWink!=0) { +/*N*/ aGeo.nShearWink=0; +/*N*/ aGeo.nTan=0; +/*N*/ } +/*N*/ } + + + +/*N*/ FASTBOOL SdrTextObj::HasEditText() const +/*N*/ { +/*N*/ FASTBOOL bRet=FALSE; +/*N*/ if (pEdtOutl!=NULL) { +/*N*/ Paragraph* p1stPara=pEdtOutl->GetParagraph( 0 ); +/*N*/ ULONG nParaAnz=pEdtOutl->GetParagraphCount(); +/*N*/ if (p1stPara==NULL) nParaAnz=0; +/*N*/ if (nParaAnz==1) { // bei nur einem Para nachsehen ob da ueberhaupt was drin steht +/*N*/ XubString aStr(pEdtOutl->GetText(p1stPara)); +/*N*/ +/*N*/ // Aha, steht nix drin! +/*N*/ if(!aStr.Len()) +/*N*/ nParaAnz = 0; +/*N*/ } +/*N*/ bRet=nParaAnz!=0; +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ void SdrTextObj::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL; +/*N*/ FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL; +/*N*/ FASTBOOL bLinked=IsLinkedText(); +/*N*/ +/*N*/ if (bLinked && bRemove) { +/*?*/ ImpLinkAbmeldung(); +/*N*/ } +/*N*/ +/*N*/ SdrAttrObj::SetPage(pNewPage); +/*N*/ +/*N*/ if (bLinked && bInsert) { +/*?*/ ImpLinkAnmeldung(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ const SfxItemSet& rSet = GetItemSet(); +/*N*/ SdrModel* pOldModel=pModel; +/*N*/ BOOL bLinked=IsLinkedText(); +/*N*/ BOOL bChg=pNewModel!=pModel; +/*N*/ BOOL bHgtSet = rSet.GetItemState(EE_CHAR_FONTHEIGHT, TRUE) == SFX_ITEM_SET; +/*N*/ if (bLinked && bChg) { +/*?*/ ImpLinkAbmeldung(); +/*N*/ } +/*N*/ +/*N*/ SdrAttrObj::SetModel(pNewModel); +/*N*/ +/*N*/ if (bChg && pOutlinerParaObject!=NULL && pOldModel!=NULL && pNewModel!=NULL) { +/*?*/ MapUnit aOldUnit(pOldModel->GetScaleUnit()); +/*?*/ MapUnit aNewUnit(pNewModel->GetScaleUnit()); +/*?*/ FASTBOOL bScaleUnitChanged=aNewUnit!=aOldUnit; +/*?*/ SetTextSizeDirty(); +/*?*/ // und nun dem OutlinerParaObject einen neuen Pool verpassen +/*?*/ // !!! Hier muss noch DefTab und RefDevice der beiden Models +/*?*/ // !!! verglichen werden und dann ggf. AutoGrow zuschlagen !!! +/*?*/ // !!! fehlende Implementation !!! +/*?*/ ULONG nOldFontHgt=pOldModel->GetDefaultFontHeight(); +/*?*/ ULONG nNewFontHgt=pNewModel->GetDefaultFontHeight(); +/*?*/ BOOL bDefHgtChanged=nNewFontHgt!=nOldFontHgt; +/*?*/ BOOL bSetHgtItem=bDefHgtChanged && !bHgtSet; +/*?*/ if (bSetHgtItem) { // #32665# +/*?*/ // zunaechst das HeightItem festklopfen, damit +/*?*/ // 1. Es eben bestehen bleibt und +/*?*/ // 2. DoStretchChars vom richtigen Wert ausgeht +/*?*/ SetItem(SvxFontHeightItem(nOldFontHgt)); +/*?*/ } +/*?*/ // erst jetzt den Outliner holen, etc. damit obiges SetAttr auch wirkt +/*?*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*?*/ rOutliner.SetText(*pOutlinerParaObject); +/*?*/ delete pOutlinerParaObject; +/*?*/ pOutlinerParaObject=NULL; +/*?*/ if (bScaleUnitChanged) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ SetOutlinerParaObject(rOutliner.CreateParaObject()); // #34494# +/*?*/ pOutlinerParaObject->ClearPortionInfo(); +/*?*/ bPortionInfoChecked=FALSE; +/*?*/ rOutliner.Clear(); +/*?*/ //ImpSetTextStyleSheetListeners(); +/*N*/ } + +/*N*/ if (bLinked && bChg) { +/*?*/ ImpLinkAnmeldung(); +/*N*/ } +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::NbcSetEckenradius(long nRad) +/*N*/ { +/*N*/ SetItem(SdrEckenradiusItem(nRad)); +/*N*/ return TRUE; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(FASTBOOL bAuto) +/*N*/ { +/*N*/ if(bTextFrame) +/*N*/ { +/*N*/ SetItem(SdrTextAutoGrowHeightItem(bAuto)); +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::NbcSetMinTextFrameHeight(long nHgt) +/*N*/ { +/*N*/ if(bTextFrame) +/*N*/ { +/*N*/ SetItem(SdrTextMinFrameHeightItem(nHgt)); +/*N*/ +/*N*/ // #84974# use bDisableAutoWidthOnDragging as +/*N*/ // bDisableAutoHeightOnDragging if vertical. +/*N*/ if(IsVerticalWriting() && bDisableAutoWidthOnDragging) +/*N*/ { +/*?*/ bDisableAutoWidthOnDragging = FALSE; +/*?*/ SetItem(SdrTextAutoGrowHeightItem(FALSE)); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*?*/ return FALSE; +/*N*/ } + + + +/*N*/ FASTBOOL SdrTextObj::NbcSetMinTextFrameWidth(long nWdt) +/*N*/ { +/*N*/ if(bTextFrame) +/*N*/ { +/*N*/ SetItem(SdrTextMinFrameWidthItem(nWdt)); +/*N*/ +/*N*/ // #84974# use bDisableAutoWidthOnDragging only +/*N*/ // when not vertical. +/*N*/ if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) +/*N*/ { +/*?*/ bDisableAutoWidthOnDragging = FALSE; +/*?*/ SetItem(SdrTextAutoGrowWidthItem(FALSE)); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + + + + +/*N*/ void SdrTextObj::TakeUnrotatedSnapRect(Rectangle& rRect) const +/*N*/ { +/*N*/ rRect=aRect; +/*N*/ } + +/*N*/ void SdrTextObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const +/*N*/ { +/*N*/ long nLeftDist=GetTextLeftDistance(); +/*N*/ long nRightDist=GetTextRightDistance(); +/*N*/ long nUpperDist=GetTextUpperDistance(); +/*N*/ long nLowerDist=GetTextLowerDistance(); +/*N*/ Rectangle aAnkRect(aRect); // Rect innerhalb dem geankert wird +/*N*/ FASTBOOL bFrame=IsTextFrame(); +/*N*/ if (!bFrame) { +/*N*/ TakeUnrotatedSnapRect(aAnkRect); +/*N*/ } +/*N*/ Point aRotateRef(aAnkRect.TopLeft()); +/*N*/ aAnkRect.Left()+=nLeftDist; +/*N*/ aAnkRect.Top()+=nUpperDist; +/*N*/ aAnkRect.Right()-=nRightDist; +/*N*/ aAnkRect.Bottom()-=nLowerDist; +/*N*/ +/*N*/ // #108816# +/*N*/ // Since sizes may be bigger than the object bounds it is necessary to +/*N*/ // justify the rect now. +/*N*/ ImpJustifyRect(aAnkRect); +/*N*/ +/*N*/ if (bFrame) { +/*N*/ // !!! hier noch etwas verfeinern !!! +/*N*/ if (aAnkRect.GetWidth()<2) aAnkRect.Right()=aAnkRect.Left()+1; // Mindestgroesse 2 +/*N*/ if (aAnkRect.GetHeight()<2) aAnkRect.Bottom()=aAnkRect.Top()+1; // Mindestgroesse 2 +/*N*/ } +/*N*/ if (aGeo.nDrehWink!=0) { +/*N*/ Point aTmpPt(aAnkRect.TopLeft()); +/*N*/ RotatePoint(aTmpPt,aRotateRef,aGeo.nSin,aGeo.nCos); +/*N*/ aTmpPt-=aAnkRect.TopLeft(); +/*N*/ aAnkRect.Move(aTmpPt.X(),aTmpPt.Y()); +/*N*/ } +/*N*/ rAnchorRect=aAnkRect; +/*N*/ } + +/*N*/ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText, +/*N*/ Rectangle* pAnchorRect, BOOL bLineWidth ) const +/*N*/ { +/*N*/ Rectangle aAnkRect; // Rect innerhalb dem geankert wird +/*N*/ TakeTextAnchorRect(aAnkRect); +/*N*/ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust(); +/*N*/ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust(); +/*N*/ SdrTextAniKind eAniKind=GetTextAniKind(); +/*N*/ SdrTextAniDirection eAniDirection=GetTextAniDirection(); +/*N*/ +/*N*/ SdrFitToSizeType eFit=GetFitToSize(); +/*N*/ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); +/*N*/ FASTBOOL bContourFrame=IsContourTextFrame(); +/*N*/ +/*N*/ FASTBOOL bFrame=IsTextFrame(); +/*N*/ ULONG nStat0=rOutliner.GetControlWord(); +/*N*/ Size aNullSize; +/*N*/ if (!bContourFrame) +/*N*/ { +/*N*/ rOutliner.SetControlWord(nStat0|EE_CNTRL_AUTOPAGESIZE); +/*N*/ rOutliner.SetMinAutoPaperSize(aNullSize); +/*N*/ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); +/*N*/ } +/*N*/ +/*N*/ if (!bFitToSize && !bContourFrame) +/*N*/ { +/*N*/ long nAnkWdt=aAnkRect.GetWidth(); +/*N*/ long nAnkHgt=aAnkRect.GetHeight(); +/*N*/ if (bFrame) +/*N*/ { +/*N*/ long nWdt=nAnkWdt; +/*N*/ long nHgt=nAnkHgt; +/*N*/ +/*N*/ // #101684# +/*N*/ BOOL bInEditMode = IsInEditMode(); +/*N*/ +/*N*/ if (!bInEditMode && (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE)) +/*N*/ { +/*?*/ // Grenzenlose Papiergroesse fuer Laufschrift +/*?*/ if (eAniDirection==SDRTEXTANI_LEFT || eAniDirection==SDRTEXTANI_RIGHT) nWdt=1000000; +/*?*/ if (eAniDirection==SDRTEXTANI_UP || eAniDirection==SDRTEXTANI_DOWN) nHgt=1000000; +/*N*/ } +/*N*/ rOutliner.SetMaxAutoPaperSize(Size(nWdt,nHgt)); +/*N*/ } +/*N*/ +/*N*/ // #103516# New try with _BLOCK for hor and ver after completely +/*N*/ // supporting full width for vertical text. +/*N*/ if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting()) +/*N*/ { +/*N*/ rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0)); +/*N*/ } +/*N*/ +/*N*/ if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting()) +/*N*/ { +/*N*/ rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt)); +/*N*/ } +/*N*/ +/*N*/ // #103335# back to old solution, thus #100801# will be back and needs to be solved in +/*N*/ // another way. +// if (eHAdj==SDRTEXTHORZADJUST_BLOCK) +// { +// if(IsVerticalWriting()) +// rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, nAnkHgt)); +// else +// rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0)); +// } + +// // #100801# MinAutoPaperSize needs always to be set completely +// // when Verical +// if(IsVerticalWriting()) +// { +// rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, nAnkHgt)); +// } +// +// if(SDRTEXTHORZADJUST_BLOCK == eHAdj) +// { +// // #89459# +// if(!IsVerticalWriting()) +// { +// rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0)); +// } +// } +/*N*/ } +/*N*/ +/*N*/ rOutliner.SetPaperSize(aNullSize); +/*N*/ if (bContourFrame) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ImpSetContourPolygon( rOutliner, aAnkRect, bLineWidth ); +/*N*/ +/*N*/ // Text in den Outliner stecken - ggf. den aus dem EditOutliner +/*N*/ OutlinerParaObject* pPara=pOutlinerParaObject; +/*N*/ if (pEdtOutl && !bNoEditText) +/*?*/ pPara=pEdtOutl->CreateParaObject(); +/*N*/ +/*N*/ if (pPara) +/*N*/ { +/*N*/ BOOL bHitTest = FALSE; +/*N*/ if( pModel ) +/*N*/ bHitTest = &pModel->GetHitTestOutliner() == &rOutliner; +/*N*/ +/*N*/ const SdrTextObj* pTestObj = rOutliner.GetTextObj(); +/*N*/ if( !pTestObj || !bHitTest || pTestObj != this || +/*N*/ pTestObj->GetOutlinerParaObject() != pOutlinerParaObject ) +/*N*/ { +/*N*/ if( bHitTest ) +/*N*/ rOutliner.SetTextObj( this ); +/*N*/ +/*N*/ rOutliner.SetUpdateMode(TRUE); +/*N*/ rOutliner.SetText(*pPara); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // rOutliner.Clear(); +/*?*/ rOutliner.SetTextObj( NULL ); +/*N*/ } +/*N*/ +/*N*/ if (pEdtOutl && !bNoEditText && pPara) +/*?*/ delete pPara; +/*N*/ +/*N*/ rOutliner.SetUpdateMode(TRUE); +/*N*/ rOutliner.SetControlWord(nStat0); +/*N*/ +/*N*/ if (!bPortionInfoChecked) +/*N*/ { +/*N*/ // Optimierung: ggf. BigTextObject erzeugen +/*N*/ ((SdrTextObj*)this)->bPortionInfoChecked=TRUE; +/*N*/ if (pOutlinerParaObject!=NULL && rOutliner.ShouldCreateBigTextObject()) +/*?*/ ((SdrTextObj*)this)->pOutlinerParaObject=rOutliner.CreateParaObject(); +/*N*/ } +/*N*/ +/*N*/ Point aTextPos(aAnkRect.TopLeft()); +/*N*/ Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() hat etwas Toleranz drauf, oder? +/*N*/ +/*N*/ // #106653# +/*N*/ // For draw objects containing text correct hor/ver alignment if text is bigger +/*N*/ // than the object itself. Without that correction, the text would always be +/*N*/ // formatted to the left edge (or top edge when vertical) of the draw object. +/*N*/ if(!IsTextFrame()) +/*N*/ { +/*N*/ if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting()) +/*N*/ { +/*N*/ // #110129# +/*N*/ // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK, +/*N*/ // else the alignment is wanted. +/*N*/ if(SDRTEXTHORZADJUST_BLOCK == eHAdj) +/*N*/ { +/*N*/ eHAdj = SDRTEXTHORZADJUST_CENTER; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting()) +/*N*/ { +/*N*/ // #110129# +/*N*/ // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK, +/*N*/ // else the alignment is wanted. +/*N*/ if(SDRTEXTVERTADJUST_BLOCK == eVAdj) +/*N*/ { +/*N*/ eVAdj = SDRTEXTVERTADJUST_CENTER; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (eHAdj==SDRTEXTHORZADJUST_CENTER || eHAdj==SDRTEXTHORZADJUST_RIGHT) +/*N*/ { +/*N*/ long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width(); +/*N*/ if (eHAdj==SDRTEXTHORZADJUST_CENTER) +/*N*/ aTextPos.X()+=nFreeWdt/2; +/*N*/ if (eHAdj==SDRTEXTHORZADJUST_RIGHT) +/*N*/ aTextPos.X()+=nFreeWdt; +/*N*/ } +/*N*/ if (eVAdj==SDRTEXTVERTADJUST_CENTER || eVAdj==SDRTEXTVERTADJUST_BOTTOM) +/*N*/ { +/*N*/ long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height(); +/*N*/ if (eVAdj==SDRTEXTVERTADJUST_CENTER) +/*N*/ aTextPos.Y()+=nFreeHgt/2; +/*N*/ if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) +/*N*/ aTextPos.Y()+=nFreeHgt; +/*N*/ } +/*N*/ if (aGeo.nDrehWink!=0) +/*N*/ RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ +/*N*/ if (pAnchorRect) +/*N*/ *pAnchorRect=aAnkRect; +/*N*/ +/*N*/ // rTextRect ist bei ContourFrame in einigen Faellen nicht korrekt +/*N*/ rTextRect=Rectangle(aTextPos,aTextSiz); +/*N*/ if (bContourFrame) +/*?*/ rTextRect=aAnkRect; +/*N*/ } + +/*N*/ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const +/*N*/ { +/*N*/ OutlinerParaObject* pPara=NULL; +/*N*/ if (pEdtOutl!=NULL) { // Wird gerade editiert, also das ParaObject aus dem aktiven Editor verwenden +/*?*/ Paragraph* p1stPara=pEdtOutl->GetParagraph( 0 ); +/*?*/ ULONG nParaAnz=pEdtOutl->GetParagraphCount(); +/*?*/ if (nParaAnz==1 && p1stPara!=NULL) { // bei nur einem Para nachsehen ob da ueberhaupt was drin steht +/*?*/ XubString aStr(pEdtOutl->GetText(p1stPara)); +/*?*/ +/*?*/ // Aha, steht nix drin! +/*?*/ if(!aStr.Len()) +/*?*/ nParaAnz = 0; +/*?*/ } +/*?*/ if (p1stPara!=NULL && nParaAnz!=0) { +/*?*/ pPara = pEdtOutl->CreateParaObject(0, (sal_uInt16)nParaAnz); +/*?*/ } +/*N*/ } +/*N*/ return pPara; +/*N*/ } + + + +// Geht z.Zt. nur wenn das Obj schon wenigstens einmal gepaintet wurde +// Denn dann ist der MtfAnimator initiallisiert + + + + +/*N*/ void SdrTextObj::ImpAddTextToBoundRect() +/*N*/ { +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ if (IsContourTextFrame()) return; +/*N*/ if (IsFontwork()) { +/*N*/ if (pModel!=NULL) { +/*N*/ VirtualDevice aVD; +/*N*/ ExtOutputDevice aXOut(&aVD); +/*N*/ SdrOutliner& rOutl=ImpGetDrawOutliner(); +/*N*/ rOutl.SetUpdateMode(TRUE); +/*N*/ ImpTextPortionHandler aTPHandler(rOutl,*this); +/*N*/ +/*N*/ aXOut.SetTextAttr(GetItemSet()); +/*N*/ +/*N*/ aTPHandler.DrawTextToPath(aXOut,FALSE); +/*N*/ if (pFormTextBoundRect==NULL) pFormTextBoundRect=new Rectangle; +/*N*/ *pFormTextBoundRect=aTPHandler.GetFormTextBoundRect(); +/*N*/ aOutRect.Union(*pFormTextBoundRect); +/*N*/ } +/*N*/ } else { // Ansonsten Text im Zeichenobjekt zentriert +/*N*/ if (pFormTextBoundRect!=NULL) { +/*?*/ delete pFormTextBoundRect; +/*?*/ pFormTextBoundRect=NULL; +/*N*/ } +/*N*/ FASTBOOL bCheckText=TRUE; +/*N*/ if (bTextFrame) { +/*N*/ bCheckText=GetTextLeftDistance ()<0 || +/*N*/ GetTextRightDistance()<0 || +/*N*/ GetTextUpperDistance()<0 || +/*N*/ GetTextLowerDistance()<0 || +/*N*/ (GetEckenradius()>0 && aGeo.nDrehWink!=0); +/*N*/ } +/*N*/ if (bCheckText) { +/*N*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ Rectangle aTextRect; +/*N*/ Rectangle aAnchorRect; +/*N*/ TakeTextRect(rOutliner,aTextRect,TRUE,&aAnchorRect); // EditText ignorieren! +/*N*/ SdrFitToSizeType eFit=GetFitToSize(); +/*N*/ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); +/*N*/ if (bFitToSize) aTextRect=aAnchorRect; +/*N*/ rOutliner.Clear(); +/*N*/ if (aGeo.nDrehWink!=0) { +/*N*/ Polygon aPol(aTextRect); +/*N*/ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aTextRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ aOutRect.Union(aPol.GetBoundRect()); +/*N*/ } else { +/*N*/ aOutRect.Union(aTextRect); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ if (!bTextFrame && pOutlinerParaObject==NULL) return NULL; +/*N*/ if (pVisiLayer!=NULL && !pVisiLayer->IsSet(nLayerId)) return NULL; +/*N*/ INT32 nMyTol=nTol; +/*N*/ FASTBOOL bFontwork=IsFontwork(); +/*N*/ SdrFitToSizeType eFit=GetFitToSize(); +/*N*/ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); +/*N*/ Rectangle aR(aRect); +/*N*/ Rectangle aAnchor(aR); +/*N*/ Rectangle aTextRect(aR); +/*N*/ SdrOutliner* pOutliner = NULL; +/*N*/ pOutliner = &pModel->GetHitTestOutliner(); +/*N*/ +/*N*/ if (bFontwork) { +/*?*/ if (pFormTextBoundRect!=NULL) aR=*pFormTextBoundRect; +/*?*/ else aR=GetBoundRect(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ TakeTextRect( *pOutliner, aTextRect, FALSE, &aAnchor, FALSE ); // EditText nicht mehr ignorieren! TRUE); // EditText ignorieren! +/*N*/ +/*N*/ if (bFitToSize) +/*?*/ aR=aAnchor; +/*N*/ else +/*N*/ aR=aTextRect; +/*N*/ } +/*N*/ if (aR.GetWidth()-1>short(nTol) && aR.GetHeight()-1>short(nTol)) nMyTol=0; // Keine Toleranz noetig hier +/*N*/ if (nMyTol!=0) { +/*?*/ aR.Left ()-=nMyTol; +/*?*/ aR.Top ()-=nMyTol; +/*?*/ aR.Right ()+=nMyTol; +/*?*/ aR.Bottom()+=nMyTol; +/*N*/ } +/*N*/ FASTBOOL bRet=FALSE; +/*N*/ +/*N*/ if(bFontwork) +/*N*/ { +/*N*/ bRet = aR.IsInside(rPnt); +/*N*/ +/*N*/ // #105130# Include aRect here in measurements to be able to hit a +/*N*/ // fontwork object on its border +/*N*/ if(!bRet) +/*N*/ { +/*N*/ const Rectangle aSnapRect = GetSnapRect(); +/*N*/ +/*N*/ if( (rPnt.X() >= aSnapRect.Left() - nTol && rPnt.X() <= aSnapRect.Left() + nTol) +/*N*/ || (rPnt.X() >= aSnapRect.Right() - nTol && rPnt.X() <= aSnapRect.Right() + nTol) +/*N*/ || (rPnt.Y() >= aSnapRect.Top() - nTol && rPnt.Y() <= aSnapRect.Top() + nTol) +/*N*/ || (rPnt.Y() >= aSnapRect.Bottom() - nTol && rPnt.Y() <= aSnapRect.Bottom() + nTol)) +/*N*/ { +/*N*/ bRet = TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (aGeo.nDrehWink!=0) { +/*N*/ Polygon aPol(aR); +/*N*/ RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ bRet=IsPointInsidePoly(aPol,rPnt); +/*N*/ } else { +/*N*/ bRet=aR.IsInside(rPnt); +/*N*/ } +/*N*/ if (bRet) { // und nun noch checken, ob wirklich Buchstaben getroffen sind +/*N*/ // Featurewunsch zur 4.0 +/*N*/ // Zunaechst meine Dok-Koordinaten in EE-Dok-Koordinaten umwandeln. +/*N*/ Point aPt(rPnt); aPt-=aR.TopLeft(); +/*N*/ if (bFitToSize) { // #38214#: FitToSize berueksichtigen +/*?*/ Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1); +/*?*/ Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1); +/*?*/ ResizePoint(aPt,Point(),aX,aY); +/*N*/ } +/*N*/ if (aGeo.nDrehWink!=0) RotatePoint(aPt,Point(),-aGeo.nSin,aGeo.nCos); // -sin fuer Unrotate +/*N*/ // Und nun im EE-Dok auf Buchstabensuche gehen +/*N*/ long nHitTol = 2000; +/*N*/ OutputDevice* pRef = pOutliner->GetRefDevice(); +/*N*/ if( pRef ) +/*N*/ nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() ); +/*N*/ +/*N*/ bRet = pOutliner->IsTextPos( aPt, (sal_uInt16)nHitTol ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bRet ? (SdrObject*)this : NULL; +/*N*/ } + + + +/*N*/ void SdrTextObj::operator=(const SdrObject& rObj) +/*N*/ { +/*N*/ SdrAttrObj::operator=(rObj); +/*N*/ const SdrTextObj* pText=PTR_CAST(SdrTextObj,&rObj); +/*N*/ if (pText!=NULL) { +/*N*/ aRect =pText->aRect; +/*N*/ aGeo =pText->aGeo; +/*N*/ eTextKind =pText->eTextKind; +/*N*/ bTextFrame=pText->bTextFrame; +/*N*/ aTextSize=pText->aTextSize; +/*N*/ bTextSizeDirty=pText->bTextSizeDirty; +/*N*/ +/*N*/ // #101776# Not all of the necessary parameters were copied yet. +/*N*/ bNoShear = pText->bNoShear; +/*N*/ bNoRotate = pText->bNoRotate; +/*N*/ bNoMirror = pText->bNoMirror; +/*N*/ bDisableAutoWidthOnDragging = pText->bDisableAutoWidthOnDragging; +/*N*/ +/*N*/ if (pOutlinerParaObject!=NULL) delete pOutlinerParaObject; +/*N*/ if (pText->HasText()) { +/*N*/ const Outliner* pEO=pText->pEdtOutl; +/*N*/ if (pEO!=NULL) { +/*?*/ pOutlinerParaObject=pEO->CreateParaObject(); +/*N*/ } else { +/*N*/ pOutlinerParaObject=pText->pOutlinerParaObject->Clone(); +/*N*/ } +/*N*/ } else { +/*N*/ pOutlinerParaObject=NULL; +/*N*/ } +/*N*/ ImpSetTextStyleSheetListeners(); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrTextObj::TakeContour(XPolyPolygon& rPoly) const +/*N*/ { +/*N*/ SdrAttrObj::TakeContour(rPoly); +/*N*/ +/*N*/ // #80328# using Clone()-Paint() strategy inside TakeContour() leaves a destroyed +/*N*/ // SdrObject as pointer in DrawOutliner. Set *this again in fetching the outliner +/*N*/ // in every case +/*N*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ +/*N*/ // und nun noch ggf. das BoundRect des Textes dazu +/*N*/ if (pOutlinerParaObject!=NULL && !IsFontwork() && !IsContourTextFrame()) { +/*?*/ Rectangle aAnchor; +/*?*/ Rectangle aR; +/*?*/ TakeTextRect(rOutliner,aR,FALSE,&aAnchor); +/*?*/ rOutliner.Clear(); +/*?*/ SdrFitToSizeType eFit=GetFitToSize(); +/*?*/ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); +/*?*/ if (bFitToSize) aR=aAnchor; +/*?*/ Polygon aPol(aR); +/*?*/ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos); +/*?*/ rPoly.Insert(XPolygon(aPol)); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrTextObj::RecalcSnapRect() +/*N*/ { +/*N*/ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) { +/*N*/ Polygon aPol(aRect); +/*N*/ if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan); +/*N*/ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); +/*N*/ maSnapRect=aPol.GetBoundRect(); +/*N*/ } else { +/*N*/ maSnapRect=aRect; +/*N*/ } +/*N*/ } + + + +/*N*/ void SdrTextObj::ImpCheckMasterCachable() +/*N*/ { +/*N*/ bNotMasterCachable=FALSE; +/*N*/ if (!bNotVisibleAsMaster && pOutlinerParaObject!=NULL && pOutlinerParaObject->IsEditDoc()) { +/*N*/ const EditTextObject& rText=pOutlinerParaObject->GetTextObject(); +/*N*/ bNotMasterCachable=rText.HasField(SvxPageField::StaticType()); +/*N*/ } +/*N*/ } + +// #101029#: Extracted from ImpGetDrawOutliner() +/*N*/ void SdrTextObj::ImpInitDrawOutliner( SdrOutliner& rOutl ) const +/*N*/ { +/*N*/ rOutl.SetUpdateMode(FALSE); +/*N*/ USHORT nOutlinerMode = OUTLINERMODE_OUTLINEOBJECT; +/*N*/ if ( !IsOutlText() ) +/*N*/ nOutlinerMode = OUTLINERMODE_TEXTOBJECT; +/*N*/ rOutl.Init( nOutlinerMode ); +/*N*/ +/*N*/ rOutl.SetGlobalCharStretching(100,100); +/*N*/ ULONG nStat=rOutl.GetControlWord(); +/*N*/ nStat&=~(EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE); +/*N*/ rOutl.SetControlWord(nStat); +/*N*/ Size aNullSize; +/*N*/ Size aMaxSize(100000,100000); +/*N*/ rOutl.SetMinAutoPaperSize(aNullSize); +/*N*/ rOutl.SetMaxAutoPaperSize(aMaxSize); +/*N*/ rOutl.SetPaperSize(aMaxSize); +/*N*/ rOutl.ClearPolygon(); +/*N*/ } + +/*N*/ SdrOutliner& SdrTextObj::ImpGetDrawOutliner() const +/*N*/ { +/*N*/ SdrOutliner& rOutl=pModel->GetDrawOutliner(this); +/*N*/ +/*N*/ // #101029#: Code extracted to ImpInitDrawOutliner() +/*N*/ ImpInitDrawOutliner( rOutl ); +/*N*/ +/*N*/ return rOutl; +/*N*/ } + +// #101029#: Extracted from Paint() + +/*N*/ void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrTextObj::PreSave() +/*N*/ { +/*N*/ // call parent +/*N*/ SdrAttrObj::PreSave(); +/*N*/ +/*N*/ // Prepare OutlinerParaObjects for storing +/*N*/ OutlinerParaObject* pParaObj = GetOutlinerParaObject(); +/*N*/ if(pParaObj && GetModel()) +/*N*/ pParaObj->PrepareStore((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool()); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ OutlinerParaObject* SdrTextObj::GetOutlinerParaObject() const +/*N*/ { +/*N*/ return pOutlinerParaObject; +/*N*/ } + +/*N*/ void SdrTextObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) +/*N*/ { +/*N*/ if( pModel ) +/*N*/ { +/*N*/ // Update HitTestOutliner +/*N*/ const SdrTextObj* pTestObj = pModel->GetHitTestOutliner().GetTextObj(); +/*N*/ if( pTestObj && pTestObj->GetOutlinerParaObject() == pOutlinerParaObject ) +/*?*/ pModel->GetHitTestOutliner().SetTextObj( NULL ); +/*N*/ } +/*N*/ +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ delete pOutlinerParaObject; +/*N*/ pOutlinerParaObject=NULL; +/*N*/ } +/*N*/ pOutlinerParaObject=pTextObject; +/*N*/ +/*N*/ if( pOutlinerParaObject ) +/*N*/ { +/*N*/ ImpForceItemSet(); +/*N*/ mpObjectItemSet->Put( SvxWritingModeItem( pOutlinerParaObject->IsVertical() ? ::com::sun::star::text::WritingMode_TB_RL : ::com::sun::star::text::WritingMode_LR_TB ) ); +/*N*/ } +/*N*/ +/*N*/ SetTextSizeDirty(); +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth())) { // Textrahmen anpassen! +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ if (!IsTextFrame()) { +/*N*/ // Das SnapRect behaelt seine Groesse bei +/*N*/ bBoundRectDirty=TRUE; +/*N*/ SetRectsDirty(TRUE); +/*N*/ } +/*N*/ ImpSetTextStyleSheetListeners(); +/*N*/ ImpCheckMasterCachable(); +/*N*/ } + +/*N*/ void SdrTextObj::NbcReformatText() +/*N*/ { +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ pOutlinerParaObject->ClearPortionInfo(); +/*N*/ if (bTextFrame) { +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } else { +/*N*/ // Das SnapRect behaelt seine Groesse bei +/*N*/ bBoundRectDirty=TRUE; +/*N*/ SetRectsDirty(TRUE); +/*N*/ } +/*N*/ SetTextSizeDirty(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::ReformatText() +/*N*/ { +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ SendRepaintBroadcast(); +/*N*/ NbcReformatText(); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ if (GetBoundRect()!=aBoundRect0) { +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::RestartAnimation(SdrPageView* pPageView) const +/*N*/ { +///*N*/ FASTBOOL bAnimated=GetTextAniKind()!=SDRTEXTANI_NONE; +///*N*/ if (bAnimated) { +///*N*/ ImpSdrMtfAnimator* pAnimator=((SdrTextObj*)this)->ImpGetMtfAnimator(); +///*N*/ if (pAnimator!=NULL) { +///*?*/ if (pPageView==NULL) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +////STRIP001 /*?*/ pAnimator->Stop(); +///*?*/ } else { +///*?*/ for (ULONG nInfoNum=pAnimator->GetInfoCount(); nInfoNum>0;) { +///*?*/ nInfoNum--; +///*?*/ ImpMtfAnimationInfo* pInfo=pAnimator->GetInfo(nInfoNum); +///*?*/ if (pInfo->pPageView==pPageView) { +///*?*/ pAnimator->RemoveInfo(nInfoNum); +///*?*/ } +///*?*/ } +///*?*/ } +///*N*/ } +///*N*/ } +/*N*/ } + + +/*N*/ void SdrTextObj::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ { +/*N*/ SdrAttrObj::SaveGeoData(rGeo); +/*N*/ SdrTextObjGeoData& rTGeo=(SdrTextObjGeoData&)rGeo; +/*N*/ rTGeo.aRect =aRect; +/*N*/ rTGeo.aGeo =aGeo; +/*N*/ } + +/*N*/ void SdrTextObj::RestGeoData(const SdrObjGeoData& rGeo) +/*N*/ { // RectsDirty wird von SdrObject gerufen +/*N*/ SdrAttrObj::RestGeoData(rGeo); +/*N*/ SdrTextObjGeoData& rTGeo=(SdrTextObjGeoData&)rGeo; +/*N*/ aRect =rTGeo.aRect; +/*N*/ aGeo =rTGeo.aGeo; +/*N*/ SetTextSizeDirty(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// I/O +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrTextObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrAttrObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrTextObj"); +/*N*/ #endif +/*N*/ rOut<<BYTE(eTextKind); +/*N*/ rOut<<aRect; +/*N*/ rOut<<INT32(aGeo.nDrehWink); +/*N*/ rOut<<INT32(aGeo.nShearWink); +/*N*/ +/*N*/ // Wird gerade editiert, also das ParaObject aus dem aktiven Editor verwenden +/*N*/ // Das war frueher. Jetzt wird beim Speichern sowas aehnliches wie EndTextEdit gemacht! #43095# +/*N*/ if (pEdtOutl!=NULL) { +/*?*/ // #43095# +/*?*/ OutlinerParaObject* pPara=GetEditOutlinerParaObject(); +/*?*/ // casting auf nicht-const +/*?*/ ((SdrTextObj*)this)->SetOutlinerParaObject(pPara); +/*?*/ +/*?*/ // #91254# put text to object and set EmptyPresObj to FALSE +/*?*/ if(pPara && IsEmptyPresObj()) +/*?*/ ((SdrTextObj*)this)->SetEmptyPresObj(FALSE); +/*N*/ } +/*N*/ OutlinerParaObject* pPara=pOutlinerParaObject; +/*N*/ +/*N*/ BOOL bOutlinerParaObjectValid=pPara!=NULL; +/*N*/ rOut<<bOutlinerParaObjectValid; +/*N*/ +/*N*/ if (bOutlinerParaObjectValid) +/*N*/ { +/*N*/ SdrDownCompat aTextCompat(rOut,STREAM_WRITE); // Ab V11 eingepackt +/*N*/ #ifdef DBG_UTIL +/*N*/ aTextCompat.SetID("SdrTextObj(OutlinerParaObject)"); +/*N*/ #endif +/*N*/ pPara->Store(rOut); // neues Store am Outliner ab SV303 +/*N*/ pPara->FinishStore(); +/*N*/ } +/*N*/ +/*N*/ // Ab FileVersion 10 wird das TextBoundRect gestreamt +/*N*/ BOOL bFormTextBoundRectValid=pFormTextBoundRect!=NULL; +/*N*/ rOut<<bFormTextBoundRectValid; +/*N*/ if (bFormTextBoundRectValid) { +/*N*/ rOut<<*pFormTextBoundRect; +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ if (pOutlinerParaObject!=NULL) { +/*?*/ delete pOutlinerParaObject; +/*?*/ pOutlinerParaObject=NULL; +/*N*/ } +/*N*/ +/*N*/ SdrAttrObj::ReadData(rHead,rIn); +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrTextObj"); +/*N*/ #endif +/*N*/ BYTE nTmp; +/*N*/ rIn>>nTmp; +/*N*/ eTextKind=SdrObjKind(nTmp); +/*N*/ rIn>>aRect; +/*N*/ INT32 n32; +/*N*/ rIn>>n32; aGeo.nDrehWink=n32; +/*N*/ rIn>>n32; aGeo.nShearWink=n32; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ aGeo.RecalcTan(); +/*N*/ //rIn>>aText; +/*N*/ if (rHead.GetVersion()<=5 && IsOutlText()) { // Das war bis zu diesem Zeitpunkt nicht gespeichert +/*?*/ NbcSetAutoGrowHeight(FALSE); +/*N*/ } +/*N*/ +/*N*/ BOOL bOutlinerParaObjectValid=FALSE; +/*N*/ rIn>>bOutlinerParaObjectValid; +/*N*/ if (bOutlinerParaObjectValid) +/*N*/ { +/*N*/ SfxItemPool* pOutlPool=pModel!=NULL ? &pModel->GetItemPool() : NULL; +/*N*/ if (rHead.GetVersion()>=11) { +/*N*/ SdrDownCompat aTextCompat(rIn,STREAM_READ); // ab V11 eingepackt +/*N*/ #ifdef DBG_UTIL +/*N*/ aTextCompat.SetID("SdrTextObj(OutlinerParaObject)"); +/*N*/ #endif +/*N*/ pOutlinerParaObject=OutlinerParaObject::Create(rIn,pOutlPool); +/*N*/ } else { +/*N*/ pOutlinerParaObject=OutlinerParaObject::Create(rIn,pOutlPool); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( pOutlinerParaObject ) +/*N*/ { +/*N*/ if( pOutlinerParaObject->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) +/*N*/ { +/*N*/ if( eTextKind == OBJ_TITLETEXT ) +/*N*/ pOutlinerParaObject->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); +/*N*/ else if( eTextKind == OBJ_OUTLINETEXT ) +/*N*/ pOutlinerParaObject->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT ); +/*N*/ else +/*N*/ pOutlinerParaObject->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT ); +/*N*/ } +/*N*/ +/*N*/ if( pOutlinerParaObject->IsVertical() ) +/*N*/ { +/*?*/ ImpForceItemSet(); +/*?*/ mpObjectItemSet->Put( SvxWritingModeItem( ::com::sun::star::text::WritingMode_TB_RL ) ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (rHead.GetVersion()>=10) { +/*N*/ // Ab FileVersion 10 wird das TextBoundRect gestreamt +/*N*/ BOOL bFormTextBoundRectValid=FALSE; +/*N*/ rIn>>bFormTextBoundRectValid; +/*N*/ if (bFormTextBoundRectValid) { +/*N*/ if (pFormTextBoundRect==NULL) pFormTextBoundRect=new Rectangle; +/*N*/ rIn>>*pFormTextBoundRect; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(rHead.GetVersion() < 12 && !bTextFrame) +/*N*/ { +/*N*/ mpObjectItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); +/*N*/ mpObjectItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); +/*N*/ mpObjectItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); +/*N*/ } +/*N*/ +/*N*/ if (bTextFrame && pOutlinerParaObject!=NULL) +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ +/*N*/ if ( pOutlinerParaObject && +/*N*/ pOutlinerParaObject->GetTextObject().GetVersion() < 500 && +/*N*/ !pOutlinerParaObject->IsEditDoc() ) +/*N*/ { +/*N*/ pOutlinerParaObject->MergeParaAttribs( GetItemSet() ); +/*N*/ } +/*N*/ +/*N*/ // #84529# correct gradient rotation for 5.2 and earlier +/*N*/ if(aGeo.nDrehWink != 0 && rHead.GetVersion() <= 16) +/*N*/ { +/*N*/ XFillStyle eStyle = ((const XFillStyleItem&)GetItem(XATTR_FILLSTYLE)).GetValue(); +/*N*/ if(XFILL_GRADIENT == eStyle) +/*N*/ { +/*N*/ XFillGradientItem aItem = (XFillGradientItem&)GetItem(XATTR_FILLGRADIENT); +/*N*/ XGradient aGradient = aItem.GetValue(); +/*N*/ +/*N*/ // calc new angle. aGeo.nDrehWink is 1/100th degree, aGradient.GetAngle() +/*N*/ // is 1/10th degree. Match this. +/*N*/ sal_Int32 nNewAngle = ((aGeo.nDrehWink + (aGradient.GetAngle() * 10)) + 5) / 10; +/*N*/ +/*N*/ while(nNewAngle < 0) +/*?*/ nNewAngle += 3600; +/*N*/ +/*N*/ while(nNewAngle >= 3600) +/*N*/ nNewAngle -= 3600; +/*N*/ +/*N*/ // create new item and set +/*N*/ aGradient.SetAngle(nNewAngle); +/*N*/ aItem.SetValue(aGradient); +/*N*/ SetItem(aItem); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ImpSetTextStyleSheetListeners(); +/*N*/ SetTextSizeDirty(); +/*N*/ ImpCheckMasterCachable(); +/*N*/ } + + + +/*N*/ SdrFitToSizeType SdrTextObj::GetFitToSize() const +/*N*/ { +/*N*/ SdrFitToSizeType eType = SDRTEXTFIT_NONE; +/*N*/ +/*N*/ if(!IsAutoGrowWidth()) +/*N*/ eType = ((SdrTextFitToSizeTypeItem&)(GetItem(SDRATTR_TEXT_FITTOSIZE))).GetValue(); +/*N*/ +/*N*/ return eType; +/*N*/ } + +/*N*/ void SdrTextObj::ForceOutlinerParaObject() +/*N*/ { +/*N*/ if( pOutlinerParaObject == NULL ) +/*N*/ { +/*?*/ USHORT nOutlMode = OUTLINERMODE_TEXTOBJECT; +/*?*/ if( IsTextFrame() && eTextKind == OBJ_OUTLINETEXT ) +/*?*/ nOutlMode = OUTLINERMODE_OUTLINEOBJECT; +/*?*/ +/*?*/ Outliner* pOutliner = SdrMakeOutliner( nOutlMode, pModel ); +/*?*/ if( pOutliner ) +/*?*/ { +/*?*/ Outliner& aDrawOutliner = pModel->GetDrawOutliner(); +/*?*/ pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() ); +/*?*/ +/*?*/ pOutliner->SetStyleSheet( 0, GetStyleSheet()); +/*?*/ OutlinerParaObject* pOutlinerParaObject = pOutliner->CreateParaObject(); +/*?*/ SetOutlinerParaObject( pOutlinerParaObject ); +/*?*/ +/*?*/ delete pOutliner; +/*?*/ } +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrTextObj::IsVerticalWriting() const +/*N*/ { +/*N*/ // #89459# +/*N*/ if(pOutlinerParaObject) +/*N*/ return pOutlinerParaObject->IsVertical(); +/*N*/ if(pEdtOutl) +/*?*/ return pEdtOutl->IsVertical(); +/*N*/ return FALSE; +/*N*/ } + +/*N*/ void SdrTextObj::SetVerticalWriting( BOOL bVertical ) +/*N*/ { +/*N*/ ForceOutlinerParaObject(); +/*N*/ +/*N*/ DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" ); +/*N*/ if( pOutlinerParaObject ) +/*N*/ { +/*N*/ if(pOutlinerParaObject->IsVertical() != bVertical) +/*N*/ { +/*?*/ // get item settings +/*?*/ const SfxItemSet& rSet = GetItemSet(); +/*?*/ sal_Bool bAutoGrowWidth = ((SdrTextAutoGrowWidthItem&)rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue(); +/*?*/ sal_Bool bAutoGrowHeight = ((SdrTextAutoGrowHeightItem&)rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue(); +/*?*/ +/*?*/ // #103516# Also exchange hor/ver adjust items +/*?*/ SdrTextHorzAdjust eHorz = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue(); +/*?*/ SdrTextVertAdjust eVert = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue(); +/*?*/ +/*?*/ // rescue object size +/*?*/ Rectangle aObjectRect = GetSnapRect(); +/*?*/ +/*?*/ // prepare ItemSet to set exchanged width and height items +/*?*/ SfxItemSet aNewSet(*rSet.GetPool(), +/*?*/ SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, +/*?*/ // #103516# Expanded item ranges to also support hor and ver adjust. +/*?*/ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, +/*?*/ SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST, +/*?*/ 0, 0); +/*?*/ +/*?*/ aNewSet.Put(rSet); +/*?*/ aNewSet.Put(SdrTextAutoGrowWidthItem(bAutoGrowHeight)); +/*?*/ aNewSet.Put(SdrTextAutoGrowHeightItem(bAutoGrowWidth)); +/*?*/ +/*?*/ // #103516# Exchange horz and vert adjusts +/*?*/ switch(eVert) +/*?*/ { +/*?*/ case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break; +/*?*/ case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break; +/*?*/ case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break; +/*?*/ case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break; +/*?*/ } +/*?*/ switch(eHorz) +/*?*/ { +/*?*/ case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break; +/*?*/ case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break; +/*?*/ case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break; +/*?*/ case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break; +/*?*/ } +/*?*/ +/*?*/ SetItemSet(aNewSet); +/*?*/ +/*?*/ // set ParaObject orientation accordingly +/*?*/ pOutlinerParaObject->SetVertical(bVertical); +/*?*/ +/*?*/ // restore object size +/*?*/ SetSnapRect(aObjectRect); +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// transformation interface for StarOfficeAPI. This implements support for +// homogen 3x3 matrices containing the transformation of the SdrObject. At the +// moment it contains a shearX, rotation and translation, but for setting all linear +// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon +// with the base geometry and returns TRUE. Otherwise it returns FALSE. +/*N*/ BOOL SdrTextObj::TRGetBaseGeometry(Matrix3D& rMat, XPolyPolygon& rPolyPolygon) const +/*N*/ { +/*N*/ // get turn and shear +/*N*/ double fRotate = (aGeo.nDrehWink / 100.0) * F_PI180; +/*N*/ double fShear = (aGeo.nShearWink / 100.0) * F_PI180; +/*N*/ +/*N*/ // get aRect, this is the unrotated snaprect +/*N*/ Rectangle aRectangle(aRect); +/*N*/ +/*N*/ // fill other values +/*N*/ Vector2D aScale((double)aRectangle.GetWidth(), (double)aRectangle.GetHeight()); +/*N*/ Vector2D aTranslate((double)aRectangle.Left(), (double)aRectangle.Top()); +/*N*/ +/*N*/ // position maybe relative to anchorpos, convert +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*N*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*N*/ aTranslate -= Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } +/*N*/ +/*N*/ // force MapUnit to 100th mm +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*N*/ { +/*N*/ case SFX_MAPUNIT_TWIP : +/*N*/ { +/*N*/ // position +/*N*/ // #104018# +/*N*/ aTranslate.X() = ImplTwipsToMM(aTranslate.X()); +/*N*/ aTranslate.Y() = ImplTwipsToMM(aTranslate.Y()); +/*N*/ +/*N*/ // size +/*N*/ // #104018# +/*N*/ aScale.X() = ImplTwipsToMM(aScale.X()); +/*N*/ aScale.Y() = ImplTwipsToMM(aScale.Y()); +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ { +/*N*/ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!"); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // build matrix +/*N*/ rMat.Identity(); +/*N*/ if(aScale.X() != 1.0 || aScale.Y() != 1.0) +/*N*/ rMat.Scale(aScale.X(), aScale.Y()); +/*N*/ if(fShear != 0.0) +/*N*/ rMat.ShearX(tan(fShear)); +/*N*/ if(fRotate != 0.0) +/*N*/ rMat.Rotate(fRotate); +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ rMat.Translate(aTranslate.X(), aTranslate.Y()); +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +// sets the base geometry of the object using infos contained in the homogen 3x3 matrix. +// If it's an SdrPathObj it will use the provided geometry information. The Polygon has +// to use (0,0) as upper left and will be scaled to the given size in the matrix. +/*N*/ void SdrTextObj::TRSetBaseGeometry(const Matrix3D& rMat, const XPolyPolygon& rPolyPolygon) +/*N*/ { +/*N*/ // break up matrix +/*N*/ Vector2D aScale, aTranslate; +/*N*/ double fShear, fRotate; +/*N*/ rMat.DecomposeAndCorrect(aScale, fShear, fRotate, aTranslate); +/*N*/ +/*N*/ // reset object shear and rotations +/*N*/ aGeo.nDrehWink = 0; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ aGeo.nShearWink = 0; +/*N*/ aGeo.RecalcTan(); +/*N*/ +/*N*/ // force metric to pool metric +/*N*/ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); +/*N*/ if(eMapUnit != SFX_MAPUNIT_100TH_MM) +/*N*/ { +/*N*/ switch(eMapUnit) +/*N*/ { +/*N*/ case SFX_MAPUNIT_TWIP : +/*N*/ { +/*N*/ // position +/*N*/ // #104018# +/*N*/ aTranslate.X() = ImplMMToTwips(aTranslate.X()); +/*N*/ aTranslate.Y() = ImplMMToTwips(aTranslate.Y()); +/*N*/ +/*N*/ // size +/*N*/ // #104018# +/*N*/ aScale.X() = ImplMMToTwips(aScale.X()); +/*N*/ aScale.Y() = ImplMMToTwips(aScale.Y()); +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ { +/*N*/ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // if anchor is used, make position relative to it +/*N*/ if( pModel->IsWriter() ) +/*N*/ { +/*N*/ if(GetAnchorPos().X() != 0 || GetAnchorPos().Y() != 0) +/*N*/ aTranslate += Vector2D(GetAnchorPos().X(), GetAnchorPos().Y()); +/*N*/ } +/*N*/ +/*N*/ // build and set BaseRect (use scale) +/*N*/ Point aPoint = Point(); +/*N*/ Size aSize(FRound(aScale.X()), FRound(aScale.Y())); +/*N*/ Rectangle aBaseRect(aPoint, aSize); +/*N*/ SetSnapRect(aBaseRect); +/*N*/ +/*N*/ // shear? +/*N*/ if(fShear != 0.0) +/*N*/ { +/*N*/ GeoStat aGeoStat; +/*N*/ aGeoStat.nShearWink = FRound((atan(fShear) / F_PI180) * 100.0); +/*N*/ aGeoStat.RecalcTan(); +/*N*/ Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, FALSE); +/*N*/ } +/*N*/ +/*N*/ // rotation? +/*N*/ if(fRotate != 0.0) +/*N*/ { +/*N*/ GeoStat aGeoStat; +/*N*/ aGeoStat.nDrehWink = FRound((fRotate / F_PI180) * 100.0); +/*N*/ aGeoStat.RecalcSinCos(); +/*N*/ Rotate(Point(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos); +/*N*/ } +/*N*/ +/*N*/ // translate? +/*N*/ if(aTranslate.X() != 0.0 || aTranslate.Y() != 0.0) +/*N*/ { +/*N*/ Move(Size( +/*N*/ (sal_Int32)FRound(aTranslate.X()), +/*N*/ (sal_Int32)FRound(aTranslate.Y()))); +/*N*/ } +/*N*/ } + + +///////////////////////////////////////////////////////////////////////////////////////////////// +// +// Konzept des TextObjekts: +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Attribute/Varianten: +// - BOOL Textrahmen / beschriftetes Zeichenobjekt +// - BOOL FontWork (wenn nicht Textrahmen und nicht ContourTextFrame) +// - BOOL ContourTextFrame (wenn nicht Textrahmen und nicht Fontwork) +// - long Drehwinkel (wenn nicht FontWork) +// - long Textrahmenabstaende (wenn nicht FontWork) +// - BOOL FitToSize (wenn nicht FontWork) +// - BOOL AutoGrowingWidth/Height (wenn nicht FitToSize und nicht FontWork) +// - long Min/MaxFrameWidth/Height (wenn AutoGrowingWidth/Height) +// - enum Horizontale Textverankerung Links,Mitte,Rechts,Block,Stretch(ni) +// - enum Vertikale Textverankerung Oben,Mitte,Unten,Block,Stretch(ni) +// - enum Laufschrift (wenn nicht FontWork) +// +// Jedes abgeleitete Objekt ist entweder ein Textrahmen (bTextFrame=TRUE) +// oder ein beschriftetes Zeichenobjekt (bTextFrame=FALSE). +// +// Defaultverankerung von Textrahmen: +// SDRTEXTHORZADJUST_BLOCK, SDRTEXTVERTADJUST_TOP +// = statische Pooldefaults +// Defaultverankerung von beschrifteten Zeichenobjekten: +// SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER +// durch harte Attributierung von SdrAttrObj +// +// Jedes vom SdrTextObj abgeleitete Objekt muss ein "UnrotatedSnapRect" +// (->TakeUnrotatedSnapRect()) liefern (Drehreferenz ist TopLeft dieses +// Rechtecks (aGeo.nDrehWink)), welches die Grundlage der Textverankerung +// bildet. Von diesem werden dann ringsum die Textrahmenabstaende abgezogen; +// das Ergebnis ist der Ankerbereich (->TakeTextAnchorRect()). Innerhalb +// dieses Bereichs wird dann in Abhaengigkeit von der horizontalen und +// vertikalen Ausrichtung (SdrTextVertAdjust,SdrTextHorzAdjust) der Ankerpunkt +// sowie der Ausgabebereich bestimmt. Bei beschrifteten Grafikobjekten kann +// der Ausgabebereich durchaus groesser als der Ankerbereich werden, bei +// Textrahmen ist er stets kleiner oder gleich (ausser bei negativen Textrahmen- +// abstaenden). +// +// FitToSize hat Prioritaet vor Textverankerung und AutoGrowHeight/Width. Der +// Ausgabebereich ist bei FitToSize immer genau der Ankerbereich. Weiterhin +// gibt es bei FitToSize keinen automatischen Zeilenumbruch. +// +// ContourTextFrame: +// - long Drehwinkel +// - long Textrahmenabstaende spaeter vielleicht +// - BOOL FitToSize spaeter vielleicht +// - BOOL AutoGrowingWidth/Height viel spaeter vielleicht +// - long Min/MaxFrameWidth/Height viel spaeter vielleicht +// - enum Horizontale Textverankerung spaeter vielleicht, erstmal Links, Absatz zentr. +// - enum Vertikale Textverankerung spaeter vielleicht, erstmal oben +// - enum Laufschrift spaeter vielleicht (evtl. sogar mit korrektem Clipping) +// +// Bei Aenderungen zu beachten: +// - Paint +// - HitTest +// - RecalcBoundRect +// - ConvertToPoly +// - Edit +// - Drucken,Speichern, Paint in Nachbarview waerend Edit +// - ModelChanged (z.B. durch NachbarView oder Lineale) waerend Edit +// - FillColorChanged waerend Edit +// - uvm... +// +///////////////////////////////////////////////////////////////////////////////////////////////// + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotxat.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotxat.cxx new file mode 100644 index 000000000000..8eddd194e4ef --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotxat.cxx @@ -0,0 +1,522 @@ +/* -*- 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 "svditext.hxx" +#include "svdmodel.hxx" // fuer GetMaxObjSize und GetStyleSheetPool +#include "svdoutl.hxx" +#include "svdocapt.hxx" // fuer SetDirty bei NbcAdjustTextFrameWidthAndHeight +#include "writingmodeitem.hxx" +#include "eeitem.hxx" + + +#include "itemdata.hxx" + + + + +#include <bf_svtools/smplhint.hxx> + + +#include <outlobj.hxx> + + +#include "eeitem.hxx" + +#include <editobj.hxx> + +#include "fhgtitem.hxx" + +#include <charscaleitem.hxx> + +#include <bf_svtools/style.hxx> + +#include <bf_svtools/itemiter.hxx> + +#define ITEMID_LRSPACE EE_PARA_LRSPACE + + + + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ +// +// Attribute, StyleSheets und AutoGrow +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void __EXPORT SdrTextObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ SdrAttrObj::SFX_NOTIFY(rBC,rBCType,rHint,rHintType); +/*N*/ if (pOutlinerParaObject!=NULL) +/*N*/ { +/*N*/ if (HAS_BASE(SfxStyleSheet, &rBC)) +/*N*/ { +/*N*/ SfxSimpleHint* pSimple=PTR_CAST(SfxSimpleHint,&rHint); +/*N*/ ULONG nId=pSimple==NULL ? 0 : pSimple->GetId(); +/*N*/ if (nId==SFX_HINT_DATACHANGED) +/*N*/ { +/*N*/ bPortionInfoChecked=FALSE; +/*N*/ pOutlinerParaObject->ClearPortionInfo(); +/*N*/ SetTextSizeDirty(); +/*N*/ if (bTextFrame && NbcAdjustTextFrameWidthAndHeight()) +/*N*/ { +/*?*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ } +/*N*/ if (nId==SFX_HINT_DYING) +/*N*/ { +/*?*/ bPortionInfoChecked=FALSE; +/*?*/ pOutlinerParaObject->ClearPortionInfo(); +/*N*/ } +/*N*/ } +/*N*/ else if (HAS_BASE(SfxStyleSheetBasePool, &rBC)) +/*N*/ { +/*N*/ SfxStyleSheetHintExtended* pExtendedHint = PTR_CAST(SfxStyleSheetHintExtended, &rHint); +/*N*/ +/*N*/ if (pExtendedHint && pExtendedHint->GetHint() == SFX_STYLESHEET_MODIFIED) +/*N*/ { +/*N*/ String aOldName(pExtendedHint->GetOldName()); +/*N*/ String aNewName(pExtendedHint->GetStyleSheet()->GetName()); +/*N*/ SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily(); +/*N*/ +/*N*/ if(!aOldName.Equals(aNewName)) +/*N*/ pOutlinerParaObject->ChangeStyleSheetName(eFamily, aOldName, aNewName); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrTextObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ SdrAttrObj::NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ +/*N*/ if ( pOutlinerParaObject && !pEdtOutl && !IsLinkedText() ) +/*N*/ { +/*N*/ // StyleSheet auf alle Absaetze anwenden +/*N*/ SdrOutliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ rOutliner.SetText(*pOutlinerParaObject); +/*N*/ USHORT nParaCount=(USHORT)rOutliner.GetParagraphCount(); +/*N*/ if (nParaCount!=0) +/*N*/ { +/*N*/ SfxItemSet* pTempSet; +/*N*/ for (USHORT nPara=0; nPara<nParaCount; nPara++) +/*N*/ { +/*N*/ // since setting the stylesheet removes all para attributes +/*N*/ if( bDontRemoveHardAttr ) +/*N*/ { +/*N*/ // we need to remember them if we want to keep them +/*N*/ pTempSet = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) ); +/*N*/ } +/*N*/ +/*N*/ if ( GetStyleSheet() ) +/*N*/ { +/*N*/ if( eTextKind == OBJ_OUTLINETEXT && GetObjInventor() == SdrInventor ) +/*N*/ { +/*N*/ String aNewStyleSheetName( GetStyleSheet()->GetName() ); +/*N*/ aNewStyleSheetName.Erase( aNewStyleSheetName.Len()-1, 1 ); +/*N*/ aNewStyleSheetName += String::CreateFromInt32( rOutliner.GetDepth( nPara ) ); +/*N*/ +/*N*/ SfxStyleSheetBasePool* pStylePool = pModel!=NULL ? pModel->GetStyleSheetPool() : NULL; +/*N*/ SfxStyleSheet* pNewStyle = (SfxStyleSheet*) pStylePool->Find( aNewStyleSheetName, GetStyleSheet()->GetFamily() ); +/*N*/ DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" ); +/*N*/ if ( pNewStyle ) +/*N*/ rOutliner.SetStyleSheet( nPara, pNewStyle ); +/*N*/ } +/*N*/ else +/*N*/ rOutliner.SetStyleSheet( nPara, GetStyleSheet() ); +/*N*/ } +/*N*/ else +/*N*/ rOutliner.SetStyleSheet( nPara, NULL ); // StyleSheet entfernen +/*N*/ +/*N*/ if( bDontRemoveHardAttr ) +/*N*/ { +/*N*/ // restore para attributes +/*N*/ rOutliner.SetParaAttribs( nPara, *pTempSet ); +/*N*/ delete pTempSet; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(pNewStyleSheet!=NULL) +/*N*/ { +/*N*/ // Harte Absatz-Attributierung aller im +/*N*/ // StyleSheet vorhandenen Items entfernen +/*N*/ // -> Parents beruecksichtigen !!! +/*N*/ SfxItemIter aIter(pNewStyleSheet->GetItemSet()); +/*N*/ const SfxPoolItem* pItem=aIter.FirstItem(); +/*N*/ while (pItem!=NULL) { +/*N*/ if (!IsInvalidItem(pItem)) { +/*N*/ USHORT nW=pItem->Which(); +/*N*/ if (nW>=EE_ITEMS_START && nW<=EE_ITEMS_END) { +/*N*/ // gibts noch nicht, baut Malte aber ein: +/*N*/ rOutliner.QuickRemoveCharAttribs(nPara,nW); +/*N*/ } +/*N*/ } +/*N*/ pItem=aIter.NextItem(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ OutlinerParaObject* pTemp=rOutliner.CreateParaObject( 0, nParaCount ); +/*N*/ rOutliner.Clear(); +/*N*/ NbcSetOutlinerParaObject(pTemp); +/*N*/ } +/*N*/ } +/*N*/ if (bTextFrame) { +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access + +/*N*/ void SdrTextObj::ItemSetChanged(const SfxItemSet& rSet) +/*N*/ { +/*N*/ // handle outliner attributes +/*N*/ ImpForceItemSet(); +/*N*/ +/*N*/ if(pOutlinerParaObject) +/*N*/ { +/*N*/ Outliner* pOutliner; +/*N*/ +/*N*/ if(!pEdtOutl) +/*N*/ { +/*N*/ pOutliner = &ImpGetDrawOutliner(); +/*N*/ pOutliner->SetText(*pOutlinerParaObject); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pOutliner = pEdtOutl; +/*N*/ } +/*N*/ +/*N*/ sal_uInt16 nParaCount((sal_uInt16)pOutliner->GetParagraphCount()); +/*N*/ for(sal_uInt16 nPara(0); nPara < nParaCount; nPara++) +/*N*/ { +/*N*/ SfxItemSet aSet( pOutliner->GetParaAttribs(nPara) ); +/*N*/ aSet.Put( rSet ); +/*N*/ pOutliner->SetParaAttribs(nPara, aSet); +/*N*/ } +/*N*/ +/*N*/ if(!pEdtOutl) +/*N*/ { +/*N*/ if(nParaCount) +/*N*/ { +/*N*/ SfxItemSet aNewSet(pOutliner->GetParaAttribs(0)); +/*N*/ mpObjectItemSet->Put(aNewSet); +/*N*/ } +/*N*/ +/*N*/ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, nParaCount); +/*N*/ pOutliner->Clear(); +/*N*/ NbcSetOutlinerParaObject(pTemp); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Extra-Repaint wenn das Layout so radikal geaendert wird (#43139#) +/*N*/ if(SFX_ITEM_SET == mpObjectItemSet->GetItemState(SDRATTR_TEXT_CONTOURFRAME)) +/*N*/ SendRepaintBroadcast(); +/*N*/ +/*N*/ // call parent +/*N*/ SdrAttrObj::ItemSetChanged(rSet); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrTextObj::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) +/*N*/ { +/*N*/ if( pNewItem && nWhich == SDRATTR_TEXTDIRECTION ) +/*N*/ { +/*N*/ bool bVertical = ( (SvxWritingModeItem*) pNewItem )->GetValue() == ::com::sun::star::text::WritingMode_TB_RL; +/*N*/ +/*N*/ if( bVertical || pOutlinerParaObject ) +/*N*/ { +/*N*/ SetVerticalWriting( bVertical ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // #95501# reset to default +/*N*/ if(!pNewItem && !nWhich && pOutlinerParaObject) +/*N*/ { +/*?*/ SdrOutliner& rOutliner = ImpGetDrawOutliner(); +/*?*/ rOutliner.SetText(*pOutlinerParaObject); +/*?*/ sal_uInt16 nParaCount(sal_uInt16(rOutliner.GetParagraphCount())); +/*?*/ +/*?*/ if(nParaCount) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ SdrAttrObj::ItemChange( nWhich, pNewItem ); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, FASTBOOL bWdt) const +/*N*/ { +/*N*/ if (bTextFrame && pModel!=NULL && !rR.IsEmpty()) { +/*N*/ SdrFitToSizeType eFit=GetFitToSize(); +/*N*/ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); +/*N*/ FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth(); +/*N*/ FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight(); +/*N*/ SdrTextAniKind eAniKind=GetTextAniKind(); +/*N*/ SdrTextAniDirection eAniDir=GetTextAniDirection(); +/*N*/ FASTBOOL bScroll=eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE; +/*N*/ FASTBOOL bHScroll=bScroll && (eAniDir==SDRTEXTANI_LEFT || eAniDir==SDRTEXTANI_RIGHT); +/*N*/ FASTBOOL bVScroll=bScroll && (eAniDir==SDRTEXTANI_UP || eAniDir==SDRTEXTANI_DOWN); +/*N*/ if (!bFitToSize && (bWdtGrow || bHgtGrow)) { +/*N*/ Rectangle aR0(rR); +/*N*/ long nHgt=0,nMinHgt=0,nMaxHgt=0; +/*N*/ long nWdt=0,nMinWdt=0,nMaxWdt=0; +/*N*/ Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--; +/*N*/ Size aMaxSiz(100000,100000); +/*N*/ Size aTmpSiz(pModel->GetMaxObjSize()); +/*N*/ if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width(); +/*N*/ if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height(); +/*N*/ if (bWdtGrow) { +/*N*/ nMinWdt=GetMinTextFrameWidth(); +/*N*/ nMaxWdt=GetMaxTextFrameWidth(); +/*N*/ if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width(); +/*N*/ if (nMinWdt<=0) nMinWdt=1; +/*N*/ aSiz.Width()=nMaxWdt; +/*N*/ } +/*N*/ if (bHgtGrow) { +/*N*/ nMinHgt=GetMinTextFrameHeight(); +/*N*/ nMaxHgt=GetMaxTextFrameHeight(); +/*N*/ if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height(); +/*N*/ if (nMinHgt<=0) nMinHgt=1; +/*N*/ aSiz.Height()=nMaxHgt; +/*N*/ } +/*N*/ long nHDist=GetTextLeftDistance()+GetTextRightDistance(); +/*N*/ long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); +/*N*/ aSiz.Width()-=nHDist; +/*N*/ aSiz.Height()-=nVDist; +/*N*/ if (aSiz.Width()<2) aSiz.Width()=2; // Mindestgroesse 2 +/*N*/ if (aSiz.Height()<2) aSiz.Height()=2; // Mindestgroesse 2 +/*N*/ +/*N*/ // #101684# +/*N*/ BOOL bInEditMode = IsInEditMode(); +/*N*/ +/*N*/ if(!bInEditMode) +/*N*/ { +/*N*/ if (bHScroll) aSiz.Width()=0x0FFFFFFF; // Laufschrift nicht umbrechen +/*N*/ if (bVScroll) aSiz.Height()=0x0FFFFFFF; +/*N*/ } +/*N*/ +/*N*/ if(pEdtOutl) +/*N*/ { +/*?*/ pEdtOutl->SetMaxAutoPaperSize(aSiz); +/*?*/ if (bWdtGrow) { +/*?*/ Size aSiz(pEdtOutl->CalcTextSize()); +/*?*/ nWdt=aSiz.Width()+1; // lieber etwas Tolleranz +/*?*/ if (bHgtGrow) nHgt=aSiz.Height()+1; // lieber etwas Tolleranz +/*?*/ } else { +/*?*/ nHgt=pEdtOutl->GetTextHeight()+1; // lieber etwas Tolleranz +/*?*/ } +/*N*/ } else { +/*N*/ Outliner& rOutliner=ImpGetDrawOutliner(); +/*N*/ rOutliner.SetPaperSize(aSiz); +/*N*/ rOutliner.SetUpdateMode(TRUE); +/*N*/ // !!! hier sollte ich wohl auch noch mal die Optimierung mit +/*N*/ // bPortionInfoChecked usw einbauen +/*N*/ if (pOutlinerParaObject!=NULL) rOutliner.SetText(*pOutlinerParaObject); +/*N*/ if (bWdtGrow) { +/*N*/ Size aSiz(rOutliner.CalcTextSize()); +/*N*/ nWdt=aSiz.Width()+1; // lieber etwas Tolleranz +/*N*/ if (bHgtGrow) nHgt=aSiz.Height()+1; // lieber etwas Tolleranz +/*N*/ } else { +/*N*/ nHgt=rOutliner.GetTextHeight()+1; // lieber etwas Tolleranz +/*N*/ } +/*N*/ rOutliner.Clear(); +/*N*/ } +/*N*/ if (nWdt<nMinWdt) nWdt=nMinWdt; +/*N*/ if (nWdt>nMaxWdt) nWdt=nMaxWdt; +/*N*/ nWdt+=nHDist; +/*N*/ if (nWdt<1) nWdt=1; // nHDist kann auch negativ sein +/*N*/ if (nHgt<nMinHgt) nHgt=nMinHgt; +/*N*/ if (nHgt>nMaxHgt) nHgt=nMaxHgt; +/*N*/ nHgt+=nVDist; +/*N*/ if (nHgt<1) nHgt=1; // nVDist kann auch negativ sein +/*N*/ long nWdtGrow=nWdt-(rR.Right()-rR.Left()); +/*N*/ long nHgtGrow=nHgt-(rR.Bottom()-rR.Top()); +/*N*/ if (nWdtGrow==0) bWdtGrow=FALSE; +/*N*/ if (nHgtGrow==0) bHgtGrow=FALSE; +/*N*/ if (bWdtGrow || bHgtGrow) { +/*N*/ if (bWdtGrow) { +/*N*/ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust(); +/*N*/ if (eHAdj==SDRTEXTHORZADJUST_LEFT) rR.Right()+=nWdtGrow; +/*N*/ else if (eHAdj==SDRTEXTHORZADJUST_RIGHT) rR.Left()-=nWdtGrow; +/*N*/ else { +/*N*/ long nWdtGrow2=nWdtGrow/2; +/*N*/ rR.Left()-=nWdtGrow2; +/*N*/ rR.Right()=rR.Left()+nWdt; +/*N*/ } +/*N*/ } +/*N*/ if (bHgtGrow) { +/*N*/ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust(); +/*N*/ if (eVAdj==SDRTEXTVERTADJUST_TOP) rR.Bottom()+=nHgtGrow; +/*N*/ else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) rR.Top()-=nHgtGrow; +/*N*/ else { +/*N*/ long nHgtGrow2=nHgtGrow/2; +/*N*/ rR.Top()-=nHgtGrow2; +/*N*/ rR.Bottom()=rR.Top()+nHgt; +/*N*/ } +/*N*/ } +/*N*/ if (aGeo.nDrehWink!=0) { +/*N*/ Point aD1(rR.TopLeft()); +/*N*/ aD1-=aR0.TopLeft(); +/*N*/ Point aD2(aD1); +/*N*/ RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos); +/*N*/ aD2-=aD1; +/*N*/ rR.Move(aD2.X(),aD2.Y()); +/*N*/ } +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt) +/*N*/ { +/*N*/ FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aRect,bHgt,bWdt); +/*N*/ if (bRet) { +/*N*/ SetRectsDirty(); +/*N*/ if (HAS_BASE(SdrRectObj,this)) { // mal wieder 'nen Hack +/*N*/ ((SdrRectObj*)this)->SetXPolyDirty(); +/*N*/ } +/*N*/ if (HAS_BASE(SdrCaptionObj,this)) { // mal wieder 'nen Hack +/*N*/ ((SdrCaptionObj*)this)->ImpRecalcTail(); +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + + +/*N*/ void SdrTextObj::ImpSetTextStyleSheetListeners() +/*N*/ { +/*N*/ SfxStyleSheetBasePool* pStylePool=pModel!=NULL ? pModel->GetStyleSheetPool() : NULL; +/*N*/ if (pStylePool!=NULL) { +/*N*/ Container aStyles(1024,64,64); +/*N*/ if (pOutlinerParaObject!=NULL) { +/*N*/ // Zunaechst werden alle im ParaObject enthaltenen StyleSheets +/*N*/ // im Container aStyles gesammelt. Dazu wird die Family jeweils +/*N*/ // ans Ende des StyleSheet-Namen drangehaengt. +/*N*/ const EditTextObject& rTextObj=pOutlinerParaObject->GetTextObject(); +/*N*/ XubString aStyleName; +/*N*/ SfxStyleFamily eStyleFam; +/*N*/ USHORT nParaAnz=rTextObj.GetParagraphCount(); +/*N*/ +/*N*/ for(UINT16 nParaNum(0); nParaNum < nParaAnz; nParaNum++) +/*N*/ { +/*N*/ rTextObj.GetStyleSheet(nParaNum, aStyleName, eStyleFam); +/*N*/ +/*N*/ if(aStyleName.Len()) +/*N*/ { +/*N*/ XubString aFam = UniString::CreateFromInt32((UINT16)eStyleFam); +/*N*/ aFam.Expand(5); +/*N*/ +/*N*/ aStyleName += sal_Unicode('|'); +/*N*/ aStyleName += aFam; +/*N*/ +/*N*/ BOOL bFnd(FALSE); +/*N*/ UINT32 nNum(aStyles.Count()); +/*N*/ +/*N*/ while(!bFnd && nNum > 0) +/*N*/ { +/*N*/ // kein StyleSheet doppelt! +/*N*/ nNum--; +/*N*/ bFnd = (aStyleName.Equals(*(XubString*)aStyles.GetObject(nNum))); +/*N*/ } +/*N*/ +/*N*/ if(!bFnd) +/*N*/ { +/*N*/ aStyles.Insert(new XubString(aStyleName), CONTAINER_APPEND); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // nun die Strings im Container durch StyleSheet* ersetzten +/*N*/ ULONG nNum=aStyles.Count(); +/*N*/ while (nNum>0) { +/*N*/ nNum--; +/*N*/ XubString* pName=(XubString*)aStyles.GetObject(nNum); +/*N*/ +/*N*/ // UNICODE: String aFam(pName->Cut(pName->Len()-6)); +/*N*/ String aFam = pName->Copy(0, pName->Len() - 6); +/*N*/ +/*N*/ aFam.Erase(0,1); +/*N*/ aFam.EraseTrailingChars(); +/*N*/ +/*N*/ // UNICODE: USHORT nFam=USHORT(aFam); +/*N*/ UINT16 nFam = (UINT16)aFam.ToInt32(); +/*N*/ +/*N*/ SfxStyleFamily eFam=(SfxStyleFamily)nFam; +/*N*/ SfxStyleSheetBase* pStyleBase=pStylePool->Find(*pName,eFam); +/*N*/ SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pStyleBase); +/*N*/ delete pName; +/*N*/ if (pStyle!=NULL && pStyle!=GetStyleSheet()) { +/*?*/ aStyles.Replace(pStyle,nNum); +/*N*/ } else { +/*N*/ aStyles.Remove(nNum); +/*N*/ } +/*N*/ } +/*N*/ // jetzt alle ueberfluessigen StyleSheets entfernen +/*N*/ nNum=GetBroadcasterCount(); +/*N*/ while (nNum>0) { +/*N*/ nNum--; +/*N*/ SfxBroadcaster* pBroadcast=GetBroadcasterJOE((USHORT)nNum); +/*N*/ SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pBroadcast); +/*N*/ if (pStyle!=NULL && pStyle!=GetStyleSheet()) { // Sonderbehandlung fuer den StyleSheet des Objekts +/*N*/ if (aStyles.GetPos(pStyle)==CONTAINER_ENTRY_NOTFOUND) { +/*N*/ EndListening(*pStyle); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ // und schliesslich alle in aStyles enthaltenen StyleSheets mit den vorhandenen Broadcastern mergen +/*N*/ nNum=aStyles.Count(); +/*N*/ while (nNum>0) { +/*N*/ nNum--; +/*N*/ SfxStyleSheet* pStyle=(SfxStyleSheet*)aStyles.GetObject(nNum); +/*N*/ // StartListening soll selbst nachsehen, ob hier nicht evtl. schon gehorcht wird +/*N*/ StartListening(*pStyle,TRUE); +/*N*/ } +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotxed.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotxed.cxx new file mode 100644 index 000000000000..5bca1ed45cc8 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotxed.cxx @@ -0,0 +1,73 @@ +/* -*- 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 "svdotext.hxx" + + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ +// +// TextEdit +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FASTBOOL SdrTextObj::HasTextEdit() const +/*N*/ { +/*N*/ // lt. Anweisung von MB duerfen gelinkte Textobjekte nun doch +/*N*/ // geaendert werden (kein automatisches Reload) +/*N*/ return TRUE; +/*N*/ } + +/*N*/ FASTBOOL SdrTextObj::BegTextEdit(SdrOutliner& rOutl) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*N*/ } + + +/*N*/ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ SdrObject* SdrTextObj::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const +/*N*/ { +/*N*/ return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer); +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotxfl.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotxfl.cxx new file mode 100644 index 000000000000..781f73da2530 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotxfl.cxx @@ -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. + * + ************************************************************************/ + +#include <eeitem.hxx> + + +#include "itemdata.hxx" + +#include <bf_svtools/poolitem.hxx> + +#include <tools/date.hxx> + +#include <tools/time.hxx> + +#include "svdfield.hxx" +#include "svdotext.hxx" +namespace binfilter { + +// Do not remove this, it is still used in src536a! +/*N*/ void SdrRegisterFieldClasses() +/*N*/ { +/*N*/ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER(SdrMeasureField); +/*N*/ } + +///////////////////////////////////////////////////////////////////////////////////////////////// */ + +/*N*/ FASTBOOL SdrTextObj::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, USHORT nPos, +/*N*/ FASTBOOL bEdit, Color*& rpTxtColor, Color*& rpFldColor, XubString& rRet) const +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotxln.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotxln.cxx new file mode 100644 index 000000000000..e4f481b6e1bc --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotxln.cxx @@ -0,0 +1,308 @@ +/* -*- 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 "svdotext.hxx" +#include "svdmodel.hxx" +#include "svdio.hxx" + +#ifndef SVX_LIGHT +#include <bf_so3/lnkbase.hxx> +#endif + +#include <linkmgr.hxx> + + +#include <bf_svtools/urihelper.hxx> + +// #90477# +#include <tools/tenccvt.hxx> +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +#ifndef SVX_LIGHT +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@@@ @@@@@@ @@ @@ @@@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@@@ @@ @@ @@ @@@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@@@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@@@ @@ @@ @@ @@ @@@ @@ @@ +// @@@@ @@@@@ @@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ @@ @@ @@ +// +// ImpSdrObjTextLink zur Verbindung von SdrTextObj und LinkManager +// +// Einem solchen Link merke ich mir als SdrObjUserData am Objekt. Im Gegensatz +// zum Grafik-Link werden die ObjektDaten jedoch kopiert (fuer Paint, etc.). +// Die Information ob das Objekt ein Link ist besteht genau darin, dass dem +// Objekt ein entsprechender UserData-Record angehaengt ist oder nicht. +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*?*/ class ImpSdrObjTextLink: public ::binfilter::SvBaseLink +/*?*/ { +/*?*/ SdrTextObj* pSdrObj; +/*?*/ +/*?*/ public: +/*?*/ ImpSdrObjTextLink( SdrTextObj* pObj1 ) +/*?*/ : ::binfilter::SvBaseLink( ::binfilter::LINKUPDATE_ONCALL, FORMAT_FILE ), +/*?*/ pSdrObj( pObj1 ) +/*?*/ {} +/*?*/ virtual ~ImpSdrObjTextLink(); +/*?*/ +/*?*/ virtual void Closed(); +/*?*/ virtual void DataChanged( const String& rMimeType, +/*?*/ const ::com::sun::star::uno::Any & rValue ); +/*?*/ +/*?*/ BOOL Connect() { return 0 != SvBaseLink::GetRealObject(); } +/*?*/ }; + +/*?*/ ImpSdrObjTextLink::~ImpSdrObjTextLink() +/*?*/ { +/*?*/ } + +/*?*/ void ImpSdrObjTextLink::Closed() +/*?*/ { +/*?*/ if (pSdrObj ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ SvBaseLink::Closed(); +/*?*/ } + + +/*?*/ void ImpSdrObjTextLink::DataChanged( const String& rMimeType, +/*?*/ const ::com::sun::star::uno::Any & rValue ) +/*?*/ { +/*?*/ FASTBOOL bForceReload=FALSE; +/*?*/ SdrModel* pModel = pSdrObj ? pSdrObj->GetModel() : 0; +/*?*/ SvxLinkManager* pLinkManager= pModel ? pModel->GetLinkManager() : 0; +/*?*/ if( pLinkManager ) +/*?*/ { +/*?*/ ImpSdrObjTextLinkUserData* pData=pSdrObj->GetLinkUserData(); +/*?*/ if( pData ) +/*?*/ { +/*?*/ String aFile; +/*?*/ String aFilter; +/*?*/ pLinkManager->GetDisplayNames( this, 0,&aFile, 0, &aFilter ); +/*?*/ +/*?*/ if( !pData->aFileName.Equals( aFile ) || +/*?*/ !pData->aFilterName.Equals( aFilter )) +/*?*/ { +/*?*/ pData->aFileName = aFile; +/*?*/ pData->aFilterName = aFilter; +/*?*/ pSdrObj->SetChanged(); +/*?*/ bForceReload = TRUE; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ if (pSdrObj ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pSdrObj->ReloadLinkedText( bForceReload ); +/*?*/ } +#endif // SVX_LIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@ @@ @@ @@ @@ @@ @@ @@@@@ @@@@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@ +// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@@ @@@@ @@ @@ @@@@ @@@@@ @@@@@ @@ @@ @@@@@@ @@ @@@@@@ +// @@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@@ @@ @@ @@ @@ @@ @@@@ @@@@@ @@@@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(ImpSdrObjTextLinkUserData,SdrObjUserData); + +/*N*/ ImpSdrObjTextLinkUserData::ImpSdrObjTextLinkUserData(SdrTextObj* pObj1): +/*N*/ SdrObjUserData(SdrInventor,SDRUSERDATA_OBJTEXTLINK,0), +/*N*/ pObj(pObj1), +/*N*/ pLink(NULL), +/*N*/ eCharSet(RTL_TEXTENCODING_DONTKNOW) +/*N*/ { +/*N*/ } + +/*N*/ ImpSdrObjTextLinkUserData::~ImpSdrObjTextLinkUserData() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete pLink; +/*N*/ #endif +/*N*/ } + +/*N*/ SdrObjUserData* ImpSdrObjTextLinkUserData::Clone(SdrObject* pObj1) const +/*N*/ { +/*N*/ ImpSdrObjTextLinkUserData* pData=new ImpSdrObjTextLinkUserData((SdrTextObj*)pObj1); +/*N*/ pData->aFileName =aFileName; +/*N*/ pData->aFilterName=aFilterName; +/*N*/ pData->aFileDate0 =aFileDate0; +/*N*/ pData->eCharSet =eCharSet; +/*N*/ pData->pLink=NULL; +/*N*/ return pData; +/*N*/ } + +/*N*/ void ImpSdrObjTextLinkUserData::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("ImpSdrObjTextLinkUserData"); +/*N*/ #endif +/*N*/ +/*N*/ String aRelFileName; +/*N*/ +/*N*/ if( aFileName.Len() ) +/*N*/ { +/*N*/ aRelFileName = ::binfilter::StaticBaseUrl::AbsToRel( aFileName, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ +/*N*/ rOut.WriteByteString( aRelFileName ); +/*N*/ +/*N*/ // UNICODE: rOut << aFilterName; +/*N*/ rOut.WriteByteString(aFilterName); +/*N*/ +/*N*/ // #90477# rOut << UINT16(GetStoreCharSet(eCharSet)); +/*N*/ rOut << UINT16(GetSOStoreTextEncoding(eCharSet, (sal_uInt16)rOut.GetVersion())); +/*N*/ +/*N*/ rOut << UINT32(aFileDate0.GetDate()); +/*N*/ rOut << UINT32(aFileDate0.GetTime()); +/*N*/ } + +/*N*/ void ImpSdrObjTextLinkUserData::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("ImpSdrObjTextLinkUserData"); +/*N*/ #endif +/*N*/ +/*N*/ UINT32 nTmp32; +/*N*/ UINT16 nTmp16; +/*N*/ String aFileNameRel; +/*N*/ +/*N*/ rIn.ReadByteString(aFileNameRel); +/*N*/ +/*N*/ if( aFileNameRel.Len() ) +/*N*/ { +/*N*/ +/*N*/ aFileName = ::binfilter::StaticBaseUrl::SmartRelToAbs( aFileNameRel, FALSE, +/*N*/ INetURLObject::WAS_ENCODED, +/*N*/ INetURLObject::DECODE_UNAMBIGUOUS ); +/*N*/ } +/*N*/ else +/*N*/ aFileName.Erase(); +/*N*/ +/*N*/ // UNICODE: rIn >> aFilterName; +/*N*/ rIn.ReadByteString(aFilterName); +/*N*/ +/*N*/ // #90477# rIn >> nTmp16; eCharSet = rtl_TextEncoding(nTmp16); +/*N*/ rIn >> nTmp16; +/*N*/ eCharSet = (rtl_TextEncoding)GetSOLoadTextEncoding((rtl_TextEncoding)nTmp16, (sal_uInt16)rIn.GetVersion()); +/*N*/ +/*N*/ rIn >> nTmp32; aFileDate0.SetDate(nTmp32); +/*N*/ rIn >> nTmp32; aFileDate0.SetTime(nTmp32); +/*N*/ } + +/*N*/ void ImpSdrObjTextLinkUserData::AfterRead() +/*N*/ { +/*N*/ if (pObj!=NULL) { +/*N*/ pObj->ImpLinkAnmeldung(); +/*N*/ // lt. Anweisung von MB kein automatisches Reload mehr +/*N*/ //pObj->ReloadLinkedText(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +/*N*/ ImpSdrObjTextLinkUserData* SdrTextObj::GetLinkUserData() const +/*N*/ { +/*N*/ ImpSdrObjTextLinkUserData* pData=NULL; +/*N*/ USHORT nAnz=GetUserDataCount(); +/*N*/ for (USHORT nNum=nAnz; nNum>0 && pData==NULL;) { +/*N*/ nNum--; +/*N*/ pData=(ImpSdrObjTextLinkUserData*)GetUserData(nNum); +/*N*/ if (pData->GetInventor()!=SdrInventor || pData->GetId()!=SDRUSERDATA_OBJTEXTLINK) { +/*N*/ pData=NULL; +/*N*/ } +/*N*/ } +/*N*/ return pData; +/*N*/ } + +/*N*/ void SdrTextObj::ImpLinkAnmeldung() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ ImpSdrObjTextLinkUserData* pData=GetLinkUserData(); +/*N*/ SvxLinkManager* pLinkManager=pModel!=NULL ? pModel->GetLinkManager() : NULL; +/*N*/ if (pLinkManager!=NULL && pData!=NULL && pData->pLink==NULL) { // Nicht 2x Anmelden +/*N*/ pData->pLink=new ImpSdrObjTextLink(this); +/*N*/ #ifdef GCC +/*N*/ pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName, +/*N*/ pData->aFilterName.Len() ? +/*N*/ &pData->aFilterName : (const String *)NULL, +/*N*/ (const String *)NULL); +/*N*/ #else +/*N*/ pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName, +/*N*/ pData->aFilterName.Len() ? &pData->aFilterName : NULL,NULL); +/*N*/ #endif +/*N*/ pData->pLink->Connect(); +/*N*/ } +/*N*/ #endif // SVX_LIGHT +/*N*/ } + +/*N*/ void SdrTextObj::ImpLinkAbmeldung() +/*N*/ { +/*N*/ #ifndef SVX_LIGHT +/*N*/ ImpSdrObjTextLinkUserData* pData=GetLinkUserData(); +/*N*/ SvxLinkManager* pLinkManager=pModel!=NULL ? pModel->GetLinkManager() : NULL; +/*N*/ if (pLinkManager!=NULL && pData!=NULL && pData->pLink!=NULL) { // Nicht 2x Abmelden +/*N*/ // Bei Remove wird *pLink implizit deleted +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pLinkManager->Remove( pData->pLink ); +/*N*/ } +/*N*/ #endif // SVX_LIGHT +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdotxtr.cxx b/binfilter/bf_svx/source/svdraw/svx_svdotxtr.cxx new file mode 100644 index 000000000000..5b43c2d38928 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdotxtr.cxx @@ -0,0 +1,339 @@ +/* -*- 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 "xoutx.hxx" // fuer XOutCreatePolygon +#include "svdopath.hxx" +#include "svdtxhdl.hxx" // DrawTextToPath fuer Convert +#include "svdmodel.hxx" // fuer Convert + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@ +// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@ +// +// Transformationen +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) { +/*?*/ Rectangle aSR0(GetSnapRect()); +/*?*/ long nWdt0=aSR0.Right()-aSR0.Left(); +/*?*/ long nHgt0=aSR0.Bottom()-aSR0.Top(); +/*?*/ long nWdt1=rRect.Right()-rRect.Left(); +/*?*/ long nHgt1=rRect.Bottom()-rRect.Top(); +/*?*/ SdrTextObj::NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0)); +/*?*/ SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top())); +/*N*/ } else { +/*N*/ long nHDist=GetTextLeftDistance()+GetTextRightDistance(); +/*N*/ long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); +/*N*/ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; +/*N*/ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; +/*N*/ long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0; +/*N*/ long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0; +/*N*/ aRect=rRect; +/*N*/ ImpJustifyRect(aRect); +/*N*/ if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139# +/*N*/ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); +/*N*/ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); +/*N*/ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ ImpCheckShear(); +/*N*/ SetRectsDirty(); +/*N*/ } +/*N*/ } + +/*N*/ const Rectangle& SdrTextObj::GetLogicRect() const +/*N*/ { +/*N*/ return aRect; +/*N*/ } + +/*N*/ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ long nHDist=GetTextLeftDistance()+GetTextRightDistance(); +/*N*/ long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); +/*N*/ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; +/*N*/ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; +/*N*/ long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0; +/*N*/ long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0; +/*N*/ aRect=rRect; +/*N*/ ImpJustifyRect(aRect); +/*N*/ if (bTextFrame) { +/*N*/ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); +/*N*/ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); +/*N*/ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ } + +/*N*/ long SdrTextObj::GetRotateAngle() const +/*N*/ { +/*N*/ return aGeo.nDrehWink; +/*N*/ } + +/*N*/ long SdrTextObj::GetShearAngle(FASTBOOL bVertical) const +/*N*/ { +/*N*/ return (aGeo.nDrehWink==0 || aGeo.nDrehWink==18000) ? aGeo.nShearWink : 0; +/*N*/ } + +/*N*/ void SdrTextObj::NbcMove(const Size& rSiz) +/*N*/ { +/*N*/ MoveRect(aRect,rSiz); +/*N*/ MoveRect(aOutRect,rSiz); +/*N*/ MoveRect(maSnapRect,rSiz); +/*N*/ SetRectsDirty(TRUE); +/*N*/ } + +/*N*/ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ FASTBOOL bNoShearMerk=aGeo.nShearWink==0; +/*N*/ FASTBOOL bRota90Merk=bNoShearMerk && aGeo.nDrehWink % 9000 ==0; +/*N*/ long nHDist=GetTextLeftDistance()+GetTextRightDistance(); +/*N*/ long nVDist=GetTextUpperDistance()+GetTextLowerDistance(); +/*N*/ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; +/*N*/ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; +/*N*/ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0); +/*N*/ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0); +/*N*/ if (bXMirr || bYMirr) { +/*N*/ Point aRef1(GetSnapRect().Center()); +/*N*/ if (bXMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.Y()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ if (bYMirr) { +/*N*/ Point aRef2(aRef1); +/*N*/ aRef2.X()++; +/*N*/ NbcMirrorGluePoints(aRef1,aRef2); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (aGeo.nDrehWink==0 && aGeo.nShearWink==0) { +/*N*/ ResizeRect(aRect,rRef,xFact,yFact); +/*N*/ if (bYMirr) { +/*N*/ aRect.Justify(); +/*N*/ aRect.Move(aRect.Right()-aRect.Left(),aRect.Bottom()-aRect.Top()); +/*N*/ aGeo.nDrehWink=18000; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // #100663# aRect is NOT initialized for lines (polgon objects with two +/*N*/ // exceptionally handled points). Thus, after this call the text rotaion is +/*N*/ // gone. This error must be present since day one of this old drawing layer. +/*N*/ // It's astonishing that noone discovered it earlier. +/*N*/ // Polygon aPol(Rect2Poly(aRect,aGeo)); +/*N*/ // Polygon aPol(Rect2Poly(GetSnapRect(), aGeo)); +/*N*/ +/*N*/ // #101412# go back to old method, side effects are impossible +/*N*/ // to calculate. +/*N*/ Polygon aPol(Rect2Poly(aRect,aGeo)); +/*N*/ +/*N*/ for(sal_uInt16 a(0); a < aPol.GetSize(); a++) +/*N*/ { +/*N*/ ResizePoint(aPol[a], rRef, xFact, yFact); +/*N*/ } +/*N*/ +/*N*/ if(bXMirr != bYMirr) +/*N*/ { +/*N*/ // Polygon wenden und etwas schieben +/*N*/ Polygon aPol0(aPol); +/*N*/ +/*N*/ aPol[0] = aPol0[1]; +/*N*/ aPol[1] = aPol0[0]; +/*N*/ aPol[2] = aPol0[3]; +/*N*/ aPol[3] = aPol0[2]; +/*N*/ aPol[4] = aPol0[1]; +/*N*/ } +/*N*/ +/*N*/ Poly2Rect(aPol, aRect, aGeo); +/*N*/ } +/*N*/ +/*N*/ if (bRota90Merk) { +/*N*/ FASTBOOL bRota90=aGeo.nDrehWink % 9000 ==0; +/*N*/ if (!bRota90) { // Scheinbar Rundungsfehler: Korregieren +/*N*/ long a=NormAngle360(aGeo.nDrehWink); +/*N*/ if (a<4500) a=0; +/*N*/ else if (a<13500) a=9000; +/*N*/ else if (a<22500) a=18000; +/*N*/ else if (a<31500) a=27000; +/*N*/ else a=0; +/*N*/ aGeo.nDrehWink=a; +/*N*/ aGeo.RecalcSinCos(); +/*N*/ } +/*N*/ if (bNoShearMerk!=(aGeo.nShearWink==0)) { // Shear ggf. korregieren wg. Rundungsfehler +/*N*/ aGeo.nShearWink=0; +/*N*/ aGeo.RecalcTan(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ImpJustifyRect(aRect); +/*N*/ long nTWdt1=aRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0; +/*N*/ long nTHgt1=aRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0; +/*N*/ if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139# +/*N*/ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); +/*N*/ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); +/*N*/ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); +/*N*/ } +/*?*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ ImpCheckShear(); +/*N*/ SetRectsDirty(); +/*N*/ } + +/*N*/ void SdrTextObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) +/*N*/ { +/*N*/ SetGlueReallyAbsolute(TRUE); +/*N*/ long dx=aRect.Right()-aRect.Left(); +/*N*/ long dy=aRect.Bottom()-aRect.Top(); +/*N*/ Point aP(aRect.TopLeft()); +/*N*/ RotatePoint(aP,rRef,sn,cs); +/*N*/ aRect.Left()=aP.X(); +/*N*/ aRect.Top()=aP.Y(); +/*N*/ aRect.Right()=aRect.Left()+dx; +/*N*/ aRect.Bottom()=aRect.Top()+dy; +/*N*/ if (aGeo.nDrehWink==0) { +/*N*/ aGeo.nDrehWink=NormAngle360(nWink); +/*N*/ aGeo.nSin=sn; +/*N*/ aGeo.nCos=cs; +/*N*/ } else { +/*N*/ aGeo.nDrehWink=NormAngle360(aGeo.nDrehWink+nWink); +/*N*/ aGeo.RecalcSinCos(); +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ NbcRotateGluePoints(rRef,nWink,sn,cs); +/*N*/ SetGlueReallyAbsolute(FALSE); +/*N*/ } + +/*N*/ void SdrTextObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ SetGlueReallyAbsolute(TRUE); +/*N*/ +/*N*/ // #75889# when this is a SdrPathObj aRect maybe not initialized +/*N*/ Polygon aPol(Rect2Poly(aRect.IsEmpty() ? GetSnapRect() : aRect, aGeo)); +/*N*/ +/*N*/ USHORT nPointCount=aPol.GetSize(); +/*N*/ for (USHORT i=0; i<nPointCount; i++) { +/*N*/ ShearPoint(aPol[i],rRef,tn,bVShear); +/*N*/ } +/*N*/ Poly2Rect(aPol,aRect,aGeo); +/*N*/ ImpJustifyRect(aRect); +/*N*/ if (bTextFrame) { +/*?*/ NbcAdjustTextFrameWidthAndHeight(); +/*N*/ } +/*N*/ ImpCheckShear(); +/*N*/ SetRectsDirty(); +/*N*/ NbcShearGluePoints(rRef,nWink,tn,bVShear); +/*N*/ SetGlueReallyAbsolute(FALSE); +/*N*/ } + + + + +/*N*/ void SdrTextObj::ImpConvertSetAttrAndLayer(SdrObject* pObj, FASTBOOL bNoSetAttr) const +/*N*/ { +/*N*/ if (pObj!=NULL) { +/*N*/ pObj->ImpSetAnchorPos(aAnchor); +/*N*/ pObj->NbcSetLayer(SdrLayerID(nLayerId)); +/*N*/ if (pModel!=NULL) { +/*N*/ pObj->SetModel(pModel); +/*N*/ if (!bNoSetAttr) { +/*N*/ SdrBroadcastItemChange aItemChange(*pObj); +/*N*/ pObj->ClearItem(); +/*N*/ pObj->SetItemSet(GetItemSet()); +/*N*/ pObj->BroadcastItemChange(aItemChange); +/*N*/ +/*N*/ pObj->NbcSetStyleSheet(GetStyleSheet(),TRUE); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrTextObj::ImpConvertMakeObj(const XPolyPolygon& rXPP, FASTBOOL bClosed, FASTBOOL bBezier, FASTBOOL bNoSetAttr) const +/*N*/ { +/*N*/ SdrObjKind ePathKind=bClosed?OBJ_PATHFILL:OBJ_PATHLINE; +/*N*/ XPolyPolygon aXPP(rXPP); +/*N*/ if (bClosed) { +/*N*/ // Alle XPolygone des XPolyPolygons schliessen, sonst kommt das PathObj durcheinander! +/*N*/ for (USHORT i=0; i<aXPP.Count(); i++) { +/*N*/ const XPolygon& rXP=aXPP[i]; +/*N*/ USHORT nAnz=rXP.GetPointCount(); +/*N*/ if (nAnz>0) { +/*N*/ USHORT nMax=USHORT(nAnz-1); +/*N*/ Point aPnt(rXP[0]); +/*N*/ if (aPnt!=rXP[nMax]) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (!bBezier && pModel!=NULL) { +/*N*/ // Polygon aus Bezierkurve interpolieren +/*N*/ VirtualDevice aVDev; +/*N*/ XPolyPolygon aXPolyPoly; +/*N*/ +/*N*/ MapMode aMap = aVDev.GetMapMode(); +/*N*/ aMap.SetMapUnit(pModel->GetScaleUnit()); +/*N*/ aMap.SetScaleX(pModel->GetScaleFraction()); +/*N*/ aMap.SetScaleY(pModel->GetScaleFraction()); +/*N*/ aVDev.SetMapMode(aMap); +/*N*/ +/*N*/ for (USHORT i=0; i<aXPP.Count(); i++) +/*N*/ aXPolyPoly.Insert(XOutCreatePolygon(aXPP[i],&aVDev)); +/*N*/ aXPP=aXPolyPoly; +/*N*/ ePathKind=bClosed?OBJ_POLY:OBJ_PLIN; +/*N*/ } +/*N*/ SdrPathObj* pPathObj=new SdrPathObj(ePathKind,aXPP); +/*N*/ if (bBezier) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ ImpConvertSetAttrAndLayer(pPathObj,bNoSetAttr); +/*N*/ return pPathObj; +/*N*/ } + +/*N*/ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const +/*N*/ { +/*N*/ if (!ImpCanConvTextToCurve()) return pObj; +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return pObj;//STRIP001 SdrObject* pText=ImpConvertObj(!bBezier); +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdouno.cxx b/binfilter/bf_svx/source/svdraw/svx_svdouno.cxx new file mode 100644 index 000000000000..040d8a1e6be5 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdouno.cxx @@ -0,0 +1,479 @@ +/* -*- 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/XChild.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + + +#include "svdouno.hxx" +#include "svdpagv.hxx" +#include "svdio.hxx" +#include "svdstr.hrc" // Objektname +#include "svdview.hxx" +#include "svdviter.hxx" + +#include <set> + +using namespace ::rtl; +using namespace ::com::sun::star; + +//************************************************************ +// Defines +//************************************************************ + +//************************************************************ +// Hilfsklasse SdrControlEventListenerImpl +//************************************************************ + + +#include <cppuhelper/implbase1.hxx> +namespace binfilter { + +/*N*/ class SdrControlEventListenerImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > +/*N*/ { +/*N*/ protected: +/*N*/ SdrUnoObj* pObj; +/*N*/ +/*N*/ public: +/*N*/ SdrControlEventListenerImpl(SdrUnoObj* _pObj) +/*N*/ : pObj(_pObj) +/*N*/ {} +/*N*/ +/*N*/ // XEventListener +/*N*/ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); +/*N*/ +/*N*/ void StopListening(const uno::Reference< lang::XComponent >& xComp); +/*N*/ void StartListening(const uno::Reference< lang::XComponent >& xComp); +/*N*/ }; + +// XEventListener +/*N*/ void SAL_CALL SdrControlEventListenerImpl::disposing( const ::com::sun::star::lang::EventObject& Source ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ if (pObj) +/*N*/ { +/*N*/ pObj->xUnoControlModel = NULL; +/*N*/ } +/*N*/ } + +/*N*/ void SdrControlEventListenerImpl::StopListening(const uno::Reference< lang::XComponent >& xComp) +/*N*/ { +/*N*/ if (xComp.is()) +/*N*/ xComp->removeEventListener(this); +/*N*/ } + +/*N*/ void SdrControlEventListenerImpl::StartListening(const uno::Reference< lang::XComponent >& xComp) +/*N*/ { +/*N*/ if (xComp.is()) +/*N*/ xComp->addEventListener(this); +/*N*/ } + +// ----------------------------------------------------------------------------- +/*?*/ namespace +/*?*/ { +/*?*/ void lcl_ensureControlVisibility( SdrView* _pView, const SdrUnoObj* _pObject, bool _bVisible ) +/*?*/ { +/*?*/ SdrPageView* pPageView = _pView ? _pView->GetPageView( _pObject->GetPage() ) : NULL; +/*?*/ DBG_ASSERT( pPageView, "lcl_ensureControlVisibility: no view found!" ); +/*?*/ +/*?*/ if ( pPageView ) +/*?*/ { +/*?*/ // loop through all the views windows +/*?*/ const SdrPageViewWinList& rViewWins = pPageView->GetWinList(); +/*?*/ USHORT nWins = rViewWins.GetCount(); +/*?*/ for ( USHORT i=0; i<nWins; ++i ) +/*?*/ { +/*?*/ const SdrPageViewWinRec& rWinData = rViewWins[i]; +/*?*/ +/*?*/ // loop through all controls in this window +/*?*/ const SdrUnoControlList& rControlsInThisWin = rWinData.GetControlList(); +/*?*/ USHORT nControlsInThisWin = rControlsInThisWin.GetCount(); +/*?*/ for ( USHORT j=0; j<nControlsInThisWin; ++j ) +/*?*/ { +/*?*/ const SdrUnoControlRec& rControlData = rControlsInThisWin[j]; +/*?*/ if ( rControlData.GetUnoObj() == _pObject ) +/*?*/ { +/*?*/ // yep - this control is the representation of the given FmFormObj in the +/*?*/ // given view +/*?*/ // is the control in alive mode? +/*?*/ uno::Reference< awt::XControl > xControl( rControlData.GetControl(), uno::UNO_QUERY ); +/*?*/ DBG_ASSERT( xControl.is(), "lcl_ensureControlVisibility: no control!" ); +/*?*/ if ( xControl.is() && !xControl->isDesignMode() ) +/*?*/ { +/*?*/ // yes, alive mode. Is the visibility correct? +/*?*/ if ( (bool)rControlData.IsVisible() != _bVisible ) +/*?*/ { +/*?*/ // no -> adjust it +/*?*/ uno::Reference< awt::XWindow > xControlWindow( xControl, uno::UNO_QUERY ); +/*?*/ DBG_ASSERT( xControlWindow.is(), "lcl_ensureControlVisibility: the control is no window!" ); +/*?*/ if ( xControlWindow.is() ) +/*?*/ { +/*?*/ xControlWindow->setVisible( _bVisible ); +/*?*/ DBG_ASSERT( (bool)rControlData.IsVisible() == _bVisible, "lcl_ensureControlVisibility: this didn't work!" ); +/*?*/ // now this would mean that either IsVisible is not reliable (which would +/*?*/ // be bad 'cause we used it above) or that showing/hiding the window +/*?*/ // did not work as intended. +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } + +//************************************************************ +// SdrUnoObj +//************************************************************ + +/*N*/ TYPEINIT1(SdrUnoObj, SdrRectObj); + +/*N*/ SdrUnoObj::SdrUnoObj(const String& rModelName, BOOL _bOwnUnoControlModel) +/*N*/ : bOwnUnoControlModel(_bOwnUnoControlModel) +/*N*/ { +/*N*/ bIsUnoObj = TRUE; +/*N*/ +/*N*/ pEventListener = new SdrControlEventListenerImpl(this); +/*N*/ pEventListener->acquire(); +/*N*/ +/*N*/ // nur ein owner darf eigenstaendig erzeugen +/*N*/ if (rModelName.Len()) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 CreateUnoControlModel(rModelName); +/*N*/ } + +/*N*/ SdrUnoObj::~SdrUnoObj() +/*N*/ { +/*N*/ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY); +/*N*/ if (xComp.is()) +/*N*/ { +/*N*/ // gehoert das Control seiner Umgebung? +/*N*/ uno::Reference< container::XChild > xContent(xUnoControlModel, uno::UNO_QUERY); +/*N*/ if (xContent.is() && !xContent->getParent().is()) +/*N*/ xComp->dispose(); +/*N*/ else +/*N*/ pEventListener->StopListening(xComp); +/*N*/ } +/*N*/ pEventListener->release(); +/*N*/ } + +/*N*/ void SdrUnoObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrRectObj::SetModel(pNewModel); +/*N*/ } + +/*N*/ void SdrUnoObj::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ SdrRectObj::SetPage(pNewPage); +/*N*/ } + + + +/** helper class to restore graphics at <awt::XView> object after <SdrUnoObj::Paint> + + OD 08.05.2003 #109432# + Restoration of graphics necessary to assure that paint on a window + + @author OD +*/ +/*?*/ class RestoreXViewGraphics +/*?*/ { +/*?*/ private: +/*?*/ uno::Reference< awt::XView > m_rXView; +/*?*/ uno::Reference< awt::XGraphics > m_rXGraphics; +/*?*/ +/*?*/ public: +/*?*/ RestoreXViewGraphics( const uno::Reference< awt::XView >& _rXView ) +/*?*/ { +/*?*/ m_rXView = _rXView; +/*?*/ m_rXGraphics = m_rXView->getGraphics(); +/*?*/ } +/*?*/ ~RestoreXViewGraphics() +/*?*/ { +/*?*/ m_rXView->setGraphics( m_rXGraphics ); +/*?*/ } +/*?*/ }; + + + + + + + +/*N*/ void SdrUnoObj::VisAreaChanged(const OutputDevice* pOut) +/*N*/ { +/*N*/ if (!xUnoControlModel.is()) +/*N*/ return; +/*N*/ +/*N*/ if (pOut) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 + // Nur dieses eine OutDev beruecksichtigen +/*N*/ } +/*N*/ else if (pModel) +/*N*/ { +/*N*/ // Controls aller PageViews beruecksichtigen +/*N*/ USHORT nLstPos = pModel->GetListenerCount(); +/*N*/ uno::Reference< awt::XWindow > xWindow; +/*N*/ Point aPixPos; +/*N*/ Size aPixSize; +/*N*/ SfxListener* pListener; +/*N*/ SdrPageView* pPV; +/*N*/ const SdrUnoControlRec* pControlRec = NULL; +/*N*/ +/*N*/ for (; nLstPos ;) +/*N*/ { +/*N*/ pListener = pModel->GetListener(--nLstPos); +/*N*/ +/*N*/ if (pListener && pListener->ISA(SdrPageView)) +/*N*/ { +/*N*/ pPV = (SdrPageView*) pListener; +/*N*/ const SdrPageViewWinList& rWL = pPV->GetWinList(); +/*N*/ USHORT nPos = rWL.GetCount(); +/*N*/ +/*N*/ for (; nPos ; ) +/*N*/ { +/*N*/ // Controls aller OutDevs beruecksichtigen +/*N*/ const SdrPageViewWinRec& rWR = rWL[--nPos]; +/*N*/ const SdrUnoControlList& rControlList = rWR.GetControlList(); +/*N*/ USHORT nCtrlNum = rControlList.Find(xUnoControlModel); +/*N*/ pControlRec = (nCtrlNum != SDRUNOCONTROL_NOTFOUND) ? &rControlList[nCtrlNum] : NULL; +/*N*/ if (pControlRec) +/*N*/ { +/*N*/ xWindow = uno::Reference< awt::XWindow >(pControlRec->GetControl(), uno::UNO_QUERY); +/*N*/ if (xWindow.is()) +/*N*/ { +/*N*/ // #62560 Pixelverschiebung weil mit einem Rechteck +/*N*/ // und nicht mit Point, Size gearbeitet wurde +/*N*/ aPixPos = rWR.GetOutputDevice()->LogicToPixel(aRect.TopLeft()); +/*N*/ aPixSize = rWR.GetOutputDevice()->LogicToPixel(aRect.GetSize()); +/*N*/ xWindow->setPosSize(aPixPos.X(), aPixPos.Y(), +/*N*/ aPixSize.Width(), aPixSize.Height(), +/*N*/ awt::PosSize::POSSIZE); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ SdrRectObj::NbcResize(rRef,xFact,yFact); +/*N*/ +/*N*/ if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) +/*N*/ { +/*N*/ // kleine Korrekturen +/*?*/ if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000) +/*?*/ { +/*?*/ aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom()); +/*?*/ } +/*?*/ +/*?*/ aGeo.nDrehWink = 0; +/*?*/ aGeo.nShearWink = 0; +/*?*/ aGeo.nSin = 0.0; +/*?*/ aGeo.nCos = 1.0; +/*?*/ aGeo.nTan = 0.0; +/*?*/ SetRectsDirty(); +/*N*/ } +/*N*/ +/*N*/ VisAreaChanged(); +/*N*/ } + +/*N*/ void SdrUnoObj::NbcMove(const Size& rSize) +/*N*/ { +/*N*/ SdrRectObj::NbcMove(rSize); +/*N*/ VisAreaChanged(); +/*N*/ } + +/*N*/ void SdrUnoObj::NbcSetSnapRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrRectObj::NbcSetSnapRect(rRect); +/*N*/ VisAreaChanged(); +/*N*/ } + +/*N*/ void SdrUnoObj::NbcSetLogicRect(const Rectangle& rRect) +/*N*/ { +/*N*/ SdrRectObj::NbcSetLogicRect(rRect); +/*N*/ VisAreaChanged(); +/*N*/ } + +// ----------------------------------------------------------------------------- +/*N*/ void SdrUnoObj::NbcSetLayer( SdrLayerID _nLayer ) +/*N*/ { +/*N*/ if ( GetLayer() == _nLayer ) +/*N*/ { // redundant call -> not interested in doing anything here +/*N*/ SdrRectObj::NbcSetLayer( _nLayer ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ // we need some special handling here in case we're moved from an invisible layer +/*N*/ // to a visible one, or vice versa +/*N*/ // (relative to a layer. Remember that the visibility of a layer is a view attribute +/*N*/ // - the same layer can be visible in one view, and invisible in another view, at the +/*N*/ // same time) +/*N*/ // 2003-06-03 - #110592# - fs@openoffice.org +/*N*/ +/*N*/ // collect all views in which our old layer is visible +/*N*/ ::std::set< SdrView* > aPreviouslyVisible; +/*N*/ +/*N*/ { +/*N*/ SdrViewIter aIter( this ); +/*N*/ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() ) +/*N*/ aPreviouslyVisible.insert( pView ); +/*N*/ } +/*N*/ +/*N*/ SdrRectObj::NbcSetLayer( _nLayer ); +/*N*/ +/*N*/ // collect all views in which our new layer is visible +/*N*/ ::std::set< SdrView* > aNewlyVisible; +/*N*/ +/*N*/ { +/*N*/ SdrViewIter aIter( this ); +/*N*/ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() ) +/*N*/ { +/*N*/ ::std::set< SdrView* >::iterator aPrevPos = aPreviouslyVisible.find( pView ); +/*N*/ if ( aPreviouslyVisible.end() != aPrevPos ) +/*N*/ { // in pView, we were visible _before_ the layer change, and are +/*N*/ // visible _after_ the layer change, too +/*N*/ // -> we're not interested in this view at all +/*N*/ aPreviouslyVisible.erase( aPrevPos ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // in pView, we were visible _before_ the layer change, and are +/*N*/ // _not_ visible after the layer change +/*N*/ // => remember this view, as our visibility there changed +/*N*/ aNewlyVisible.insert( pView ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // now aPreviouslyVisible contains all views where we became invisible +/*N*/ ::std::set< SdrView* >::const_iterator aLoopViews; +/*N*/ for ( aLoopViews = aPreviouslyVisible.begin(); +/*N*/ aLoopViews != aPreviouslyVisible.end(); +/*N*/ ++aLoopViews +/*N*/ ) +/*N*/ { +/*N*/ lcl_ensureControlVisibility( *aLoopViews, this, false ); +/*N*/ } +/*N*/ +/*N*/ // and aNewlyVisible all views where we became visible +/*N*/ for ( aLoopViews = aNewlyVisible.begin(); +/*N*/ aLoopViews != aNewlyVisible.end(); +/*N*/ ++aLoopViews +/*N*/ ) +/*N*/ { +/*N*/ lcl_ensureControlVisibility( *aLoopViews, this, true ); +/*N*/ } +/*N*/ } + + + +/*N*/ void SdrUnoObj::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrRectObj::WriteData(rOut); +/*N*/ SdrDownCompat aCompat(rOut, STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrUnoObj"); +/*N*/ #endif +/*N*/ +/*N*/ if (bOwnUnoControlModel) // nur als besitzt des Models dieses auch schreiben +/*N*/ { +/*?*/ // UNICODE: rOut << aUnoControlModelTypeName; +/*?*/ rOut.WriteByteString(aUnoControlModelTypeName); +/*N*/ } +/*N*/ } + +/*N*/ void SdrUnoObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError() != 0) +/*N*/ return; +/*N*/ +/*N*/ SdrRectObj::ReadData(rHead,rIn); +/*N*/ +/*N*/ SdrDownCompat aCompat(rIn, STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrUnoObj"); +/*N*/ #endif +/*N*/ +/*N*/ if (bOwnUnoControlModel) // nur als besitzt des Models dieses auch lesen +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrUnoObj::SetUnoControlModel( uno::Reference< awt::XControlModel > xModel) +/*N*/ { +/*N*/ if (xUnoControlModel.is()) +/*N*/ { +/*?*/ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY); +/*?*/ if (xComp.is()) +/*?*/ pEventListener->StopListening(xComp); +/*?*/ +/*?*/ if (pModel) +/*?*/ { +/*?*/ SdrHint aHint(*this); +/*?*/ aHint.SetKind(HINT_CONTROLREMOVED); +/*?*/ pModel->Broadcast(aHint); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ xUnoControlModel = xModel; +/*N*/ +/*N*/ // control model muss servicename des controls enthalten +/*N*/ if (xUnoControlModel.is()) +/*N*/ { +/*N*/ uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY); +/*N*/ if (xSet.is()) +/*N*/ { +/*N*/ uno::Any aValue( xSet->getPropertyValue(String("DefaultControl", gsl_getSystemTextEncoding())) ); +/*N*/ OUString aStr; +/*N*/ if( aValue >>= aStr ) +/*N*/ aUnoControlTypeName = String(aStr); +/*N*/ } +/*N*/ +/*N*/ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY); +/*N*/ if (xComp.is()) +/*N*/ pEventListener->StartListening(xComp); +/*N*/ +/*N*/ if (pModel) +/*N*/ { +/*N*/ SdrHint aHint(*this); +/*N*/ aHint.SetKind(HINT_CONTROLINSERTED); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdoutl.cxx b/binfilter/bf_svx/source/svdraw/svx_svdoutl.cxx new file mode 100644 index 000000000000..70305e673432 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdoutl.cxx @@ -0,0 +1,127 @@ +/* -*- 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 "svdoutl.hxx" +#include "svdotext.hxx" +#include <editstat.hxx> +namespace binfilter { + + +//TYPEINIT1( SdrOutliner, Outliner ); + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ +/*N*/ SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, USHORT nMode ): +/*N*/ Outliner( pItemPool, nMode ), +/*N*/ pTextObj( NULL ) +/*N*/ { +/*N*/ } + + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ +/*N*/ SdrOutliner::~SdrOutliner() +/*N*/ { +/*N*/ } + + +/************************************************************************* +|* +|* +|* +\************************************************************************/ +/*N*/ void SdrOutliner::SetTextObj( const SdrTextObj* pObj ) +/*N*/ { +/*N*/ if( pObj && pObj != pTextObj ) +/*N*/ { +/*N*/ SetUpdateMode(FALSE); +/*N*/ USHORT nOutlinerMode = OUTLINERMODE_OUTLINEOBJECT; +/*N*/ if ( !pObj->IsOutlText() ) +/*N*/ nOutlinerMode = OUTLINERMODE_TEXTOBJECT; +/*N*/ Init( nOutlinerMode ); +/*N*/ +/*N*/ SetGlobalCharStretching(100,100); +/*N*/ +/*N*/ ULONG nStat = GetControlWord(); +/*N*/ nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE ); +/*N*/ SetControlWord(nStat); +/*N*/ +/*N*/ Size aNullSize; +/*N*/ Size aMaxSize( 100000,100000 ); +/*N*/ SetMinAutoPaperSize( aNullSize ); +/*N*/ SetMaxAutoPaperSize( aMaxSize ); +/*N*/ SetPaperSize( aMaxSize ); +/*N*/ ClearPolygon(); +/*N*/ } +/*N*/ +/*N*/ pTextObj = pObj; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ +/*N*/ void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj ) +/*N*/ { +/*N*/ pTextObj = pObj; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ +/*N*/ XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, USHORT nPos, +/*N*/ Color*& rpTxtColor, Color*& rpFldColor) +/*N*/ { +/*N*/ FASTBOOL bOk = FALSE; +/*N*/ XubString aRet; +/*N*/ +/*N*/ if (pTextObj) +/*N*/ bOk = pTextObj->CalcFieldValue(rField, nPara, nPos, FALSE, rpTxtColor, rpFldColor, aRet); +/*N*/ +/*N*/ if (!bOk) +/*N*/ aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor); +/*N*/ +/*N*/ return aRet; +/*N*/ } + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdoutlinercache.cxx b/binfilter/bf_svx/source/svdraw/svx_svdoutlinercache.cxx new file mode 100644 index 000000000000..bfdad6b2e7bb --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdoutlinercache.cxx @@ -0,0 +1,111 @@ +/* -*- 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 "svdoutlinercache.hxx" +#include "svdoutl.hxx" +#include "svdmodel.hxx" +namespace binfilter { + +/*N*/ extern SdrOutliner* SdrMakeOutliner( USHORT nOutlinerMode, SdrModel* pModel ); + +/*N*/ SdrOutlinerCache::SdrOutlinerCache( SdrModel* pModel ) +/*N*/ : mpModel( pModel ), +/*N*/ mpModeOutline( NULL ), +/*N*/ mpModeText( NULL ) +/*N*/ { +/*N*/ } + +/*N*/ SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode ) +/*N*/ { +/*N*/ SdrOutliner* pOutliner = NULL; +/*N*/ +/*N*/ if( (OUTLINERMODE_OUTLINEOBJECT == nOutlinerMode) && mpModeOutline ) +/*N*/ { +/*N*/ pOutliner = mpModeOutline; +/*N*/ mpModeOutline = NULL; +/*N*/ } +/*N*/ else if( (OUTLINERMODE_TEXTOBJECT == nOutlinerMode) && mpModeText ) +/*N*/ { +/*N*/ pOutliner = mpModeText; +/*N*/ mpModeText = NULL; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel ); +/*N*/ Outliner& aDrawOutliner = mpModel->GetDrawOutliner(); +/*N*/ pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() ); +/*N*/ } +/*N*/ +/*N*/ return pOutliner; +/*N*/ } + +/*N*/ SdrOutlinerCache::~SdrOutlinerCache() +/*N*/ { +/*N*/ if( mpModeOutline ) +/*N*/ { +/*N*/ delete mpModeOutline; +/*N*/ mpModeOutline = NULL; +/*N*/ } +/*N*/ +/*N*/ if( mpModeText ) +/*N*/ { +/*N*/ delete mpModeText; +/*N*/ mpModeText = NULL; +/*N*/ } +/*N*/ } + +/*N*/ void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) +/*N*/ { +/*N*/ if( pOutliner ) +/*N*/ { +/*N*/ USHORT nOutlMode = pOutliner->GetOutlinerMode(); +/*N*/ +/*N*/ if( (OUTLINERMODE_OUTLINEOBJECT == nOutlMode) && (NULL == mpModeOutline) ) +/*N*/ { +/*N*/ mpModeOutline = pOutliner; +/*N*/ pOutliner->Clear(); +/*N*/ pOutliner->SetVertical( false ); +/*N*/ } +/*N*/ else if( (OUTLINERMODE_TEXTOBJECT == nOutlMode) && (NULL == mpModeText) ) +/*N*/ { +/*N*/ mpModeText = pOutliner; +/*N*/ pOutliner->Clear(); +/*N*/ pOutliner->SetVertical( false ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ delete pOutliner; +/*N*/ } +/*N*/ } +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdovirt.cxx b/binfilter/bf_svx/source/svdraw/svx_svdovirt.cxx new file mode 100644 index 000000000000..f4c3d806d136 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdovirt.cxx @@ -0,0 +1,318 @@ +/* -*- 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 "svdovirt.hxx" +#include "svdio.hxx" +#include "svdhdl.hxx" +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrVirtObj,SdrObject); + +/*N*/ SdrVirtObj::SdrVirtObj(SdrObject& rNewObj): +/*N*/ rRefObj(rNewObj) +/*N*/ { +/*N*/ bVirtObj=TRUE; // Ja, ich bin ein virtuelles Objekt +/*N*/ rRefObj.AddReference(*this); +/*N*/ bClosedObj=rRefObj.IsClosedObj(); +/*N*/ } + +/*N*/ SdrVirtObj::~SdrVirtObj() +/*N*/ { +/*N*/ rRefObj.DelReference(*this); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ const SdrObject& SdrVirtObj::GetReferencedObj() const +/*N*/ { +/*N*/ return rRefObj; +/*N*/ } + +/*N*/ SdrObject& SdrVirtObj::ReferencedObj() +/*N*/ { +/*N*/ return rRefObj; +/*N*/ } + +/*N*/ void __EXPORT SdrVirtObj::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ bClosedObj=rRefObj.IsClosedObj(); +/*N*/ SetRectsDirty(); // hier noch Optimieren. +/*N*/ SendRepaintBroadcast(); +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrVirtObj::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrObject::SetModel(pNewModel); +/*N*/ rRefObj.SetModel(pNewModel); +/*N*/ } + + +/*N*/ UINT32 SdrVirtObj::GetObjInventor() const +/*N*/ { +/*N*/ return rRefObj.GetObjInventor(); +/*N*/ } + +/*N*/ UINT16 SdrVirtObj::GetObjIdentifier() const +/*N*/ { +/*N*/ return rRefObj.GetObjIdentifier(); +/*N*/ } + +/*N*/ SdrObjList* SdrVirtObj::GetSubList() const +/*N*/ { +/*N*/ return rRefObj.GetSubList(); +/*N*/ } + + + +/*N*/ void SdrVirtObj::SetChanged() +/*N*/ { +/*N*/ SdrObject::SetChanged(); +/*N*/ } + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ rRefObj.NbcResize(rRef-aAnchor,xFact,yFact); +/*N*/ SetRectsDirty(); +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) { +/*N*/ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetBoundRect(); +/*N*/ rRefObj.Resize(rRef-aAnchor,xFact,yFact); +/*N*/ SetRectsDirty(); +/*N*/ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); +/*N*/ } +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrVirtObj::RecalcSnapRect() +/*N*/ { +/*N*/ aSnapRect=rRefObj.GetSnapRect(); +/*N*/ aSnapRect+=aAnchor; +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ long SdrVirtObj::GetRotateAngle() const +/*N*/ { +/*N*/ return rRefObj.GetRotateAngle(); +/*N*/ } + +/*N*/ long SdrVirtObj::GetShearAngle(FASTBOOL bVertical) const +/*N*/ { +/*N*/ return rRefObj.GetShearAngle(bVertical); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + +/*N*/ void SdrVirtObj::NbcSetPoint(const Point& rPnt, USHORT i) +/*N*/ { +/*N*/ Point aP(rPnt); +/*N*/ aP-=aAnchor; +/*N*/ rRefObj.SetPoint(aP,i); +/*N*/ SetRectsDirty(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrObjGeoData* SdrVirtObj::NewGeoData() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*N*/ } + +/*N*/ void SdrVirtObj::SaveGeoData(SdrObjGeoData& rGeo) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ void SdrVirtObj::RestGeoData(const SdrObjGeoData& rGeo) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ItemSet access + +/*N*/ const SfxItemSet& SdrVirtObj::GetItemSet() const +/*N*/ { +/*N*/ return rRefObj.GetItemSet(); +/*N*/ } + +/*N*/ SfxItemSet* SdrVirtObj::CreateNewItemSet(SfxItemPool& rPool) +/*N*/ { +/*N*/ return rRefObj.CreateNewItemSet(rPool); +/*N*/ } + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// private support routines for ItemSet access + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +/*N*/ void SdrVirtObj::PreSave() +/*N*/ { +/*N*/ } + +/*N*/ void SdrVirtObj::PostSave() +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +/*N*/ void SdrVirtObj::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ void SdrVirtObj::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, FASTBOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ rRefObj.NbcSetStyleSheet(pNewStyleSheet,bDontRemoveHardAttr); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*?*/ void SdrVirtObj::WriteData(SvStream& rOut) const +/*?*/ { +/*?*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrVirtObj"); +/*?*/ #endif +/*?*/ // fehlende Implementation +/*?*/ rOut<<aAnchor; +/*?*/ } + +/*?*/ void SdrVirtObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) +/*?*/ { +/*?*/ if (rIn.GetError()!=0) return; +/*?*/ if (rHead.GetVersion()>=4) { +/*?*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*?*/ #ifdef DBG_UTIL +/*?*/ aCompat.SetID("SdrVirtObj"); +/*?*/ #endif +/*?*/ // fehlende Implementation +/*?*/ rIn>>aAnchor; +/*?*/ } else { +/*?*/ rIn>>aAnchor; +/*?*/ } +/*?*/ } + +/*?*/ void SdrVirtObj::AfterRead() +/*?*/ { +/*?*/ // fehlende Implementation +/*?*/ } + +/*?*/ const Point SdrVirtObj::GetOffset() const +/*?*/ { +/*?*/ return Point(0,0); +/*?*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdpage.cxx b/binfilter/bf_svx/source/svdraw/svx_svdpage.cxx new file mode 100644 index 000000000000..bbdb8e7cf5c2 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdpage.cxx @@ -0,0 +1,1635 @@ +/* -*- 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. + * + ************************************************************************/ + +// HACK +#ifdef SVX_LIGHT +#define _IPOBJ_HXX +#endif + +#include <sot/clsids.hxx> +#include "svdview.hxx" +#include <string.h> +#ifndef _STRING_H +#define _STRING_H +#endif +#include <bf_so3/ipobj.hxx> + +#include "svdetc.hxx" +#include "svdio.hxx" +#include "svdograf.hxx" // fuer SwapInAll() +#include "svdoole2.hxx" // Sonderbehandlung OLE beim SdrExchangeFormat +#include "svditer.hxx" +#include "svdpagv.hxx" +#include "polysc3d.hxx" + +#ifndef SVX_LIGHT +#include "fmdpage.hxx" +#else +#endif + + +#include "xoutx.hxx" + +namespace binfilter { + +using namespace ::com::sun::star; + +/*N*/ DBG_NAME(SdrObjList) + +/*N*/ TYPEINIT0(SdrObjList); + +/*N*/ SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList): +/*N*/ aList(1024,64,64) +/*N*/ { +/*N*/ DBG_CTOR(SdrObjList,NULL); +/*N*/ pModel=pNewModel; +/*N*/ pPage=pNewPage; +/*N*/ pUpList=pNewUpList; +/*N*/ bObjOrdNumsDirty=FALSE; +/*N*/ bRectsDirty=FALSE; +/*N*/ pOwnerObj=NULL; +/*N*/ eListKind=SDROBJLIST_UNKNOWN; +/*N*/ } + +/*?*/ SdrObjList::SdrObjList(const SdrObjList& rSrcList): +/*?*/ aList(1024,64,64) +/*?*/ { +/*?*/ DBG_CTOR(SdrObjList,NULL); +/*?*/ pModel=NULL; +/*?*/ pPage=NULL; +/*?*/ pUpList=NULL; +/*?*/ bObjOrdNumsDirty=FALSE; +/*?*/ bRectsDirty=FALSE; +/*?*/ pOwnerObj=NULL; +/*?*/ eListKind=SDROBJLIST_UNKNOWN; +/*?*/ *this=rSrcList; +/*?*/ } + +/*N*/ SdrObjList::~SdrObjList() +/*N*/ { +/*N*/ DBG_DTOR(SdrObjList,NULL); +/*N*/ Clear(); // Containerinhalt loeschen! +/*N*/ } + +/*N*/ void SdrObjList::operator=(const SdrObjList& rSrcList) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) +/*N*/ { +/*N*/ Clear(); +/*N*/ bObjOrdNumsDirty=FALSE; +/*N*/ bRectsDirty =FALSE; +/*N*/ ULONG nCloneErrCnt=0; +/*N*/ ULONG nAnz=rSrcList.GetObjCount(); +/*N*/ SdrInsertReason aReason(SDRREASON_COPY); +/*N*/ ULONG no; +/*N*/ for (no=0; no<nAnz; no++) { +/*N*/ SdrObject* pSO=rSrcList.GetObj(no); +/*N*/ SdrObject* pDO=pSO->Clone(pPage,pModel); +/*N*/ if (pDO!=NULL) { +/*N*/ NbcInsertObject(pDO,CONTAINER_APPEND,&aReason); +/*N*/ } else { +/*N*/ nCloneErrCnt++; +/*N*/ } +/*N*/ } +/*N*/ // und nun zu den Konnektoren +/*N*/ // Die neuen Objekte werden auf die der rSrcList abgebildet +/*N*/ // und so die Objektverbindungen hergestellt. +/*N*/ // Aehnliche Implementation an folgenden Stellen: +/*N*/ // void SdrObjList::CopyObjects(const SdrObjList& rSrcList) +/*N*/ // SdrModel* SdrExchangeView::GetMarkedObjModel() const +/*N*/ // FASTBOOL SdrExchangeView::Paste(const SdrModel& rMod,...) +/*N*/ // void SdrEditView::CopyMarked() +/*N*/ if (nCloneErrCnt==0) { +/*N*/ for (no=0; no<nAnz; no++) { +/*N*/ const SdrObject* pSrcOb=rSrcList.GetObj(no); +/*N*/ SdrEdgeObj* pSrcEdge=PTR_CAST(SdrEdgeObj,pSrcOb); +/*N*/ if (pSrcEdge!=NULL) { +/*?*/ SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(TRUE); +/*?*/ SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(FALSE); +/*?*/ if (pSrcNode1!=NULL && pSrcNode1->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode1=NULL; // Listenuebergreifend +/*?*/ if (pSrcNode2!=NULL && pSrcNode2->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode2=NULL; // ist (noch) nicht +/*?*/ if (pSrcNode1!=NULL || pSrcNode2!=NULL) { +/*?*/ SdrObject* pEdgeObjTmp=GetObj(no); +/*?*/ SdrEdgeObj* pDstEdge=PTR_CAST(SdrEdgeObj,pEdgeObjTmp); +/*?*/ if (pDstEdge!=NULL) { +/*?*/ if (pSrcNode1!=NULL) { +/*?*/ ULONG nDstNode1=pSrcNode1->GetOrdNum(); +/*?*/ SdrObject* pDstNode1=GetObj(nDstNode1); +/*?*/ if (pDstNode1!=NULL) { // Sonst grober Fehler! +/*?*/ pDstEdge->ConnectToNode(TRUE,pDstNode1); +/*?*/ } else { +/*?*/ DBG_ERROR("SdrObjList::operator=(): pDstNode1==NULL!"); +/*?*/ } +/*?*/ } +/*?*/ if (pSrcNode2!=NULL) { +/*?*/ ULONG nDstNode2=pSrcNode2->GetOrdNum(); +/*?*/ SdrObject* pDstNode2=GetObj(nDstNode2); +/*?*/ if (pDstNode2!=NULL) { // Node war sonst wohl nicht markiert +/*?*/ pDstEdge->ConnectToNode(FALSE,pDstNode2); +/*?*/ } else { +/*?*/ DBG_ERROR("SdrObjList::operator=(): pDstNode2==NULL!"); +/*?*/ } +/*?*/ } +/*?*/ } else { +/*?*/ DBG_ERROR("SdrObjList::operator=(): pDstEdge==NULL!"); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } else { +/*N*/ #ifdef DBG_UTIL +/*?*/ ByteString aStr("SdrObjList::operator=(): Fehler beim Clonen "); +/*?*/ +/*?*/ if(nCloneErrCnt == 1) +/*?*/ { +/*?*/ aStr += "eines Zeichenobjekts."; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aStr += "von "; +/*?*/ aStr += ByteString::CreateFromInt32( nCloneErrCnt ); +/*?*/ aStr += " Zeichenobjekten."; +/*?*/ } +/*?*/ +/*?*/ aStr += " Objektverbindungen werden nicht mitkopiert."; +/*?*/ +/*?*/ DBG_ERROR(aStr.GetBuffer()); +/*?*/ #endif +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjList::Clear() +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ +/*N*/ if(pModel!=NULL && nAnz!=0) +/*N*/ { +/*N*/ SdrHint aHint(HINT_OBJLISTCLEAR); +/*N*/ aHint.SetPage(pPage); +/*N*/ aHint.SetObjList(this); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ +/*N*/ for (ULONG no=0; no<nAnz; no++) { +/*N*/ SdrObject* pObj=GetObj(no); +/*N*/ delete pObj; +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ if (pModel!=NULL && nAnz!=0) +/*N*/ { +/*N*/ pModel->SetChanged(); +/*N*/ SdrHint aHint(HINT_OBJLISTCLEARED); +/*N*/ aHint.SetPage(pPage); +/*N*/ aHint.SetObjList(this); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ } + +/*N*/ SdrPage* SdrObjList::GetPage() const +/*N*/ { +/*N*/ return pPage; +/*N*/ } + +/*N*/ void SdrObjList::SetPage(SdrPage* pNewPage) +/*N*/ { +/*N*/ if (pPage!=pNewPage) { +/*N*/ pPage=pNewPage; +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ for (ULONG no=0; no<nAnz; no++) { +/*N*/ SdrObject* pObj=GetObj(no); +/*N*/ pObj->SetPage(pPage); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ SdrModel* SdrObjList::GetModel() const +/*N*/ { +/*N*/ return pModel; +/*N*/ } + +/*N*/ void SdrObjList::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ if (pModel!=pNewModel) { +/*N*/ pModel=pNewModel; +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ for (ULONG i=0; i<nAnz; i++) { +/*N*/ SdrObject* pObj=GetObj(i); +/*N*/ pObj->SetModel(pModel); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjList::RecalcObjOrdNums() +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ for (ULONG no=0; no<nAnz; no++) { +/*N*/ SdrObject* pObj=GetObj(no); +/*N*/ pObj->SetOrdNum(no); +/*N*/ } +/*N*/ bObjOrdNumsDirty=FALSE; +/*N*/ } + +/*N*/ void SdrObjList::RecalcRects() +/*N*/ { +/*N*/ aOutRect=Rectangle(); +/*N*/ aSnapRect=aOutRect; +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ ULONG i; +/*N*/ for (i=0; i<nAnz; i++) { +/*N*/ SdrObject* pObj=GetObj(i); +/*N*/ if (i==0) { +/*N*/ aOutRect=pObj->GetBoundRect(); +/*N*/ aSnapRect=pObj->GetSnapRect(); +/*N*/ } else { +/*N*/ aOutRect.Union(pObj->GetBoundRect()); +/*N*/ aSnapRect.Union(pObj->GetSnapRect()); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjList::SetRectsDirty() +/*N*/ { +/*N*/ bRectsDirty=TRUE; +/*N*/ if (pUpList!=NULL) pUpList->SetRectsDirty(); +/*N*/ } + +/*N*/ void SdrObjList::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason) +/*N*/ { +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjList::NbcInsertObject(NULL)"); +/*N*/ if (pObj!=NULL) { +/*N*/ DBG_ASSERT(!pObj->IsInserted(),"ZObjekt hat bereits Inserted-Status"); +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ if (nPos>nAnz) nPos=nAnz; +/*N*/ aList.Insert(pObj,nPos); +/*N*/ if (nPos<nAnz) bObjOrdNumsDirty=TRUE; +/*N*/ pObj->SetOrdNum(nPos); +/*N*/ pObj->SetObjList(this); +/*N*/ pObj->SetPage(pPage); +/*N*/ if (!bRectsDirty) { +/*N*/ aOutRect.Union(pObj->GetBoundRect()); +/*N*/ aSnapRect.Union(pObj->GetSnapRect()); +/*N*/ } +/*N*/ pObj->SetInserted(TRUE); // Ruft u.a. den UserCall +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjList::InsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason) +/*N*/ { +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjList::InsertObject(NULL)"); +/*N*/ +/*N*/ if(pObj) +/*N*/ { +/*N*/ if(pOwnerObj && !GetObjCount()) +/*N*/ { +/*N*/ // damit der graue Rahmen des leeren Gruppenobjekts korrekt weggemalt wird +/*N*/ pOwnerObj->SendRepaintBroadcast(); +/*N*/ } +/*N*/ +/*N*/ // #69055# if anchor is used, reset it before grouping +/*N*/ if(GetOwnerObj()) +/*N*/ { +/*N*/ const Point& rAnchorPos = pObj->GetAnchorPos(); +/*N*/ if(rAnchorPos.X() || rAnchorPos.Y()) +/*N*/ pObj->NbcSetAnchorPos(Point()); +/*N*/ } +/*N*/ +/*N*/ // do insert to new group +/*N*/ NbcInsertObject(pObj, nPos, pReason); +/*N*/ +/*N*/ // Falls das Objekt in eine Gruppe eingefuegt wird +/*N*/ // und nicht mit seinen Bruedern ueberlappt, muss es +/*N*/ // einen eigenen Redraw bekommen +/*N*/ if(pOwnerObj) +/*N*/ { +/*N*/ pOwnerObj->SendRepaintBroadcast(); +/*N*/ } +/*N*/ +/*N*/ if(pModel) +/*N*/ { +/*N*/ // Hier muss ein anderer Broadcast her! +/*N*/ // Repaint ab Objekt Nummer ... (Achtung: GroupObj) +/*N*/ if(pObj->GetPage()) +/*N*/ { +/*N*/ SdrHint aHint(*pObj); +/*N*/ +/*N*/ aHint.SetKind(HINT_OBJINSERTED); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrObjList::NbcRemoveObject(ULONG nObjNum) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");return NULL; //STRIP001 +/*N*/ } + +/*N*/ SdrObject* SdrObjList::RemoveObject(ULONG nObjNum) +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ SdrObject* pObj=(SdrObject*)aList.Remove(nObjNum); +/*N*/ DBG_ASSERT(pObj!=NULL,"Object zum Removen nicht gefunden"); +/*N*/ if (pObj!=NULL) { +/*N*/ DBG_ASSERT(pObj->IsInserted(),"ZObjekt hat keinen Inserted-Status"); +/*N*/ if (pModel!=NULL) { +/*N*/ // Hier muss ein anderer Broadcast her! +/*N*/ if (pObj->GetPage()!=NULL) { +/*N*/ SdrHint aHint(*pObj); +/*N*/ aHint.SetKind(HINT_OBJREMOVED); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ pObj->SetInserted(FALSE); // Ruft u.a. den UserCall +/*N*/ pObj->SetObjList(NULL); +/*N*/ pObj->SetPage(NULL); +/*N*/ if (!bObjOrdNumsDirty) { // Optimierung fuer den Fall, dass das letzte Obj rausgenommen wird +/*N*/ if (nObjNum!=ULONG(nAnz-1)) { +/*N*/ bObjOrdNumsDirty=TRUE; +/*N*/ } +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ if (pOwnerObj!=NULL && GetObjCount()==0) { +/*N*/ // damit der graue Rahmen des leeren Gruppenobjekts korrekt gemalt wird +/*N*/ pOwnerObj->SendRepaintBroadcast(); +/*N*/ } +/*N*/ } +/*N*/ return pObj; +/*N*/ } + + +/*N*/ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, ULONG nObjNum) +/*N*/ { +/*N*/ //ULONG nAnz=GetObjCount(); +/*N*/ SdrObject* pObj=(SdrObject*)aList.GetObject(nObjNum); +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjList::ReplaceObject: Object zum Removen nicht gefunden"); +/*N*/ if (pObj!=NULL) { +/*N*/ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: ZObjekt hat keinen Inserted-Status"); +/*N*/ if (pModel!=NULL) { +/*N*/ // Hier muss ein anderer Broadcast her! +/*N*/ if (pObj->GetPage()!=NULL) { +/*N*/ SdrHint aHint(*pObj); +/*N*/ aHint.SetKind(HINT_OBJREMOVED); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ } +/*N*/ pObj->SetInserted(FALSE); +/*N*/ pObj->SetObjList(NULL); +/*N*/ pObj->SetPage(NULL); +/*N*/ aList.Replace(pNewObj,nObjNum); +/*N*/ pNewObj->SetOrdNum(nObjNum); +/*N*/ pNewObj->SetObjList(this); +/*N*/ pNewObj->SetPage(pPage); +/*N*/ pNewObj->SetInserted(TRUE); +/*N*/ if (pModel!=NULL) { +/*N*/ // Hier muss ein anderer Broadcast her! +/*N*/ if (pNewObj->GetPage()!=NULL) { +/*N*/ SdrHint aHint(*pNewObj); +/*N*/ aHint.SetKind(HINT_OBJINSERTED); +/*N*/ pModel->Broadcast(aHint); +/*N*/ } +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ SetRectsDirty(); +/*N*/ } +/*N*/ return pObj; +/*N*/ } + +/*N*/ SdrObject* SdrObjList::NbcSetObjectOrdNum(ULONG nOldObjNum, ULONG nNewObjNum) +/*N*/ { +/*N*/ SdrObject* pObj=(SdrObject*)aList.GetObject(nOldObjNum); +/*N*/ if (nOldObjNum==nNewObjNum) return pObj; +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjList::NbcSetObjectOrdNum: Object nicht gefunden"); +/*N*/ if (pObj!=NULL) { +/*N*/ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::NbcSetObjectOrdNum: ZObjekt hat keinen Inserted-Status"); +/*N*/ aList.Remove(nOldObjNum); +/*N*/ aList.Insert(pObj,nNewObjNum); +/*N*/ pObj->SetOrdNum(nNewObjNum); +/*N*/ bObjOrdNumsDirty=TRUE; +/*N*/ } +/*N*/ return pObj; +/*N*/ } + +/*N*/ SdrObject* SdrObjList::SetObjectOrdNum(ULONG nOldObjNum, ULONG nNewObjNum) +/*N*/ { +/*N*/ SdrObject* pObj=(SdrObject*)aList.GetObject(nOldObjNum); +/*N*/ if (nOldObjNum==nNewObjNum) return pObj; +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjList::SetObjectOrdNum: Object nicht gefunden"); +/*N*/ if (pObj!=NULL) { +/*N*/ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::SetObjectOrdNum: ZObjekt hat keinen Inserted-Status"); + /*if (pModel!=NULL) { + // Hier muss ein anderer Broadcast her! + if (pObj->GetPage()!=NULL) pModel->Broadcast(SdrHint(*pObj)); + }*/ +/*N*/ aList.Remove(nOldObjNum); +/*N*/ aList.Insert(pObj,nNewObjNum); +/*N*/ pObj->SetOrdNum(nNewObjNum); +/*N*/ bObjOrdNumsDirty=TRUE; +/*N*/ if (pModel!=NULL) { +/*N*/ // Hier muss ein anderer Broadcast her! +/*N*/ if (pObj->GetPage()!=NULL) pModel->Broadcast(SdrHint(*pObj)); +/*N*/ pModel->SetChanged(); +/*N*/ } +/*N*/ } +/*N*/ return pObj; +/*N*/ } + +/*N*/ const Rectangle& SdrObjList::GetAllObjSnapRect() const +/*N*/ { +/*N*/ if (bRectsDirty) { +/*N*/ ((SdrObjList*)this)->RecalcRects(); +/*N*/ ((SdrObjList*)this)->bRectsDirty=FALSE; +/*N*/ } +/*N*/ return aSnapRect; +/*N*/ } + +/*N*/ const Rectangle& SdrObjList::GetAllObjBoundRect() const +/*N*/ { +/*N*/ if (bRectsDirty) { +/*N*/ ((SdrObjList*)this)->RecalcRects(); +/*N*/ ((SdrObjList*)this)->bRectsDirty=FALSE; +/*N*/ } +/*N*/ return aOutRect; +/*N*/ } + +/*N*/ FASTBOOL SdrObjList::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec, FASTBOOL bRestoreColors) const +/*N*/ { +/*N*/ BOOL bOk(TRUE); +/*N*/ BOOL bWasNotActive = rInfoRec.bNotActive; +/*N*/ BOOL bIsEnteredGroup(FALSE); +/*N*/ UINT32 nWasDrawMode = rXOut.GetOutDev()->GetDrawMode(); +/*N*/ +/*N*/ if(!rInfoRec.bOriginalDrawModeSet) +/*N*/ { +/*N*/ // Original-Paintmode retten +/*N*/ ((SdrPaintInfoRec&)rInfoRec).bOriginalDrawModeSet = TRUE; +/*N*/ ((SdrPaintInfoRec&)rInfoRec).nOriginalDrawMode = rXOut.GetOutDev()->GetDrawMode(); +/*N*/ } +/*N*/ +/*N*/ if((rInfoRec.pPV && rInfoRec.pPV->GetObjList() == this) +/*N*/ || (rInfoRec.nPaintMode & SDRPAINTMODE_MASTERPAGE)) +/*N*/ { +/*N*/ bIsEnteredGroup = TRUE; +/*N*/ } +/*N*/ +/*N*/ if(bIsEnteredGroup && bWasNotActive) +/*N*/ { +/*N*/ // auf aktive Elemente schalten +/*?*/ ((SdrPaintInfoRec&)rInfoRec).bNotActive = FALSE; +/*N*/ } +/*N*/ +/*N*/ if(rInfoRec.pPV && rInfoRec.bNotActive) +/*N*/ { +/*?*/ if(rInfoRec.pPV->GetView().DoVisualizeEnteredGroup()) +/*?*/ { +/*?*/ // Darstellung schmal +/*?*/ rXOut.GetOutDev()->SetDrawMode(nWasDrawMode | ( +/*?*/ DRAWMODE_GHOSTEDLINE|DRAWMODE_GHOSTEDFILL|DRAWMODE_GHOSTEDTEXT|DRAWMODE_GHOSTEDBITMAP|DRAWMODE_GHOSTEDGRADIENT)); +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Darstellung normal +/*N*/ rXOut.GetOutDev()->SetDrawMode(rInfoRec.nOriginalDrawMode); +/*N*/ } +/*N*/ +/*N*/ bOk = Paint(rXOut, rInfoRec, bRestoreColors, IMP_PAGEPAINT_NORMAL); +/*N*/ +/*N*/ if(bIsEnteredGroup && bWasNotActive) +/*N*/ { +/*?*/ // Zurueck auf Ursprung, Zustand wieder verlassen +/*?*/ ((SdrPaintInfoRec&)rInfoRec).bNotActive = TRUE; +/*N*/ } +/*N*/ +/*N*/ // Darstellung restaurieren +/*N*/ rXOut.GetOutDev()->SetDrawMode(nWasDrawMode); +/*N*/ +/*N*/ return bOk; +/*N*/ } + +/*N*/ FASTBOOL SdrObjList::Paint(ExtOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec, FASTBOOL bRestoreColors, USHORT nImpMode) const +/*N*/ { +/*N*/ FASTBOOL bOk=TRUE; +/*N*/ FASTBOOL bBrk=FALSE; +/*N*/ ULONG nObjAnz=GetObjCount(); +/*N*/ if (nObjAnz==0) return TRUE; +/*N*/ USHORT nEvent=rInfoRec.nBrkEvent; +/*N*/ const SetOfByte* pVisiLayer=&rInfoRec.aPaintLayer; +/*N*/ FASTBOOL bPrinter=rInfoRec.bPrinter; +/*N*/ OutputDevice* pOut=rXOut.GetOutDev(); +/*N*/ Rectangle aCheckRect(rInfoRec.aCheckRect); +/*N*/ FASTBOOL bDrawAll=aCheckRect.IsEmpty(); +/*N*/ ImpSdrHdcMerk aHDCMerk(*pOut,SDRHDC_SAVEPENANDBRUSHANDFONT,bRestoreColors); +/*N*/ FASTBOOL bColorsDirty=FALSE; +/*N*/ if (bDrawAll || aCheckRect.IsOver(GetAllObjBoundRect())) { +/*N*/ Application* pAppPtr=NULL; +/*N*/ if (nEvent!=0) pAppPtr=GetpApp(); +/*N*/ SetOfByte aPaintLayer(*pVisiLayer); +/*N*/ USHORT nPaintCycles = 1; +/*N*/ SdrLayerID nLayerId = 0; +/*N*/ +/*N*/ // #85670# if pModel is NULL, try to get model of list owner +/*N*/ SdrModel *pLocalModel = pModel; +/*N*/ if(!pLocalModel && GetOwnerObj()) +/*N*/ pLocalModel = GetOwnerObj()->GetModel(); +/*N*/ +/*N*/ // #85670# use correct model to get layer ID +/*N*/ if(pLocalModel) +/*N*/ { +/*N*/ const SdrLayerAdmin& rLayerAdmin = pLocalModel->GetLayerAdmin(); +/*N*/ nLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), FALSE); +/*N*/ } +/*N*/ +/*N*/ if( pPage == NULL || ( !pPage->IsMasterPage() && aPaintLayer.IsSet( nLayerId ) ) ) +/*N*/ { +/*N*/ // Der ControlLayer soll gezeichnet werden +/*N*/ // Wenn Controls existieren, wird der ControlLayer als letztes gezeichnet +/*N*/ SetOfByte aTestLayerSet = aPaintLayer; +/*N*/ aTestLayerSet.Clear(nLayerId); +/*N*/ +/*N*/ if (!aTestLayerSet.IsEmpty()) +/*N*/ { +/*N*/ // Es soll nicht nur der ControlLayer gezeichnet werden +/*N*/ ULONG nObjNum=0; +/*N*/ while (nObjNum<nObjAnz && nPaintCycles < 2) +/*N*/ { +/*N*/ if (GetObj(nObjNum)->GetLayer() == nLayerId) +/*N*/ { +/*N*/ // Objekt auf ControlLayer gefunden +/*?*/ // Der ControlLayer wird ersteinmal unsichtbar geschaltet +/*?*/ nPaintCycles = 2; +/*?*/ aPaintLayer.Clear(nLayerId); +/*N*/ } +/*N*/ +/*N*/ nObjNum++; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ for (USHORT nCycle = 1; nCycle <= nPaintCycles; nCycle++) +/*N*/ { +/*N*/ USHORT nPaintImpMode = nImpMode; +/*N*/ FASTBOOL bNormal = ( nPaintImpMode == IMP_PAGEPAINT_NORMAL ); +/*N*/ FASTBOOL bCachePrepare = ( nPaintImpMode == IMP_PAGEPAINT_PREPARE_CACHE ); +/*N*/ FASTBOOL bBGCachePrepare = ( nPaintImpMode == IMP_PAGEPAINT_PREPARE_BG_CACHE ); +/*N*/ FASTBOOL bCachePaint = ( nPaintImpMode == IMP_PAGEPAINT_PAINT_CACHE ); +/*N*/ FASTBOOL bBGCachePaint = ( nPaintImpMode == IMP_PAGEPAINT_PAINT_BG_CACHE ); +/*N*/ FASTBOOL bPaintFlag = ( bNormal || bCachePrepare || bBGCachePrepare ); +/*N*/ +/*N*/ if( nCycle == 2 ) +/*N*/ { +/*N*/ // Im zweiten Durchgang nur den ControlLayer zeichnen +/*?*/ aPaintLayer.ClearAll(); +/*?*/ aPaintLayer.Set(nLayerId); +/*N*/ } +/*N*/ +/*N*/ ULONG nObjNum = 0UL; +/*N*/ +/*N*/ while( ( nObjNum < nObjAnz ) && !bBrk ) +/*N*/ { +/*N*/ SdrObject* pObj = GetObj( nObjNum ); +/*N*/ +/*N*/ if( nObjNum == 0 && eListKind == SDROBJLIST_MASTERPAGE && +/*N*/ pPage && pPage->IsMasterPage() && rInfoRec.pPV ) +/*N*/ { +/*?*/ // painting pages background obj instead of masterpages background obj +/*?*/ SdrPage* pPg = rInfoRec.pPV->GetPage(); +/*?*/ SdrObject* pBackgroundObj = pPg ? pPg->GetBackgroundObj() : NULL; +/*?*/ if( pBackgroundObj ) +/*?*/ { +/*?*/ if( rXOut.GetOutDev()->GetDrawMode() == DRAWMODE_DEFAULT ) +/*?*/ { +/*?*/ pObj = pBackgroundObj; +/*?*/ Point aPos ( pPage->GetLftBorder(), pPage->GetUppBorder() ); +/*?*/ Size aSize ( pPage->GetSize() ); +/*?*/ aSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder() - 1; +/*?*/ aSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder() - 1; +/*?*/ Rectangle aLogicRect( aPos, aSize ); +/*?*/ +/*?*/ if( pBackgroundObj->GetLogicRect() != aLogicRect ) +/*?*/ { +/*?*/ pBackgroundObj->SetLogicRect( aLogicRect ); +/*?*/ pBackgroundObj->RecalcBoundRect(); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ pObj = NULL; +/*?*/ +/*?*/ } +/*N*/ } + +/*N*/ if( pObj && ( bDrawAll || aCheckRect.IsOver( pObj->GetBoundRect() ) ) ) +/*N*/ { +/*N*/ SdrObjList* pSubList = pObj->GetSubList(); +/*N*/ +/*N*/ // Gruppenobjekte beruecksichtigen sichtbare Layer selbst (Ansonsten nur Painten, wenn Layer sichtbar) +/*N*/ if( pSubList!=NULL || ((!bPrinter || pObj->IsPrintable()) && aPaintLayer.IsSet(pObj->GetLayer())) ) +/*N*/ { +/*N*/ // #108937# +/*N*/ // IsMasterCachable() does not visit groups automatically. Since +/*N*/ // this mechanism should be changed to set information at the page +/*N*/ // (counter?) later, i will fix that with a SdrObjListIter here. +/*N*/ sal_Bool bHierarchyIsMasterPageCachable(pObj->IsMasterCachable()); +/*N*/ +/*N*/ if(bHierarchyIsMasterPageCachable && pObj->IsGroupObject()) +/*N*/ { +/*N*/ SdrObjListIter aIter(*pObj, IM_DEEPNOGROUPS); +/*N*/ +/*N*/ while(bHierarchyIsMasterPageCachable && aIter.IsMore()) +/*N*/ { +/*N*/ SdrObject* pNestedObj = aIter.Next(); +/*N*/ +/*N*/ if(!pNestedObj->IsMasterCachable()) +/*N*/ { +/*N*/ bHierarchyIsMasterPageCachable = sal_False; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( !bNormal && !bHierarchyIsMasterPageCachable) +/*N*/ { +/*?*/ if( bCachePrepare || bBGCachePrepare ) +/*?*/ bBrk = TRUE, bPaintFlag = FALSE; +/*?*/ else if( bCachePaint || bBGCachePaint ) +/*?*/ { +/*?*/ bPaintFlag = bNormal = TRUE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( bPaintFlag ) +/*N*/ { +/*N*/ if( pObj->IsNeedColorRestore() ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ else +/*N*/ bColorsDirty=TRUE; // andere aendern die Farben +/*N*/ +/*N*/ if( rInfoRec.pPaintProc!=NULL ) +/*N*/ { +/*?*/ SdrPaintProcRec aRec(pObj,rXOut,rInfoRec); +/*?*/ Link aLink(*rInfoRec.pPaintProc); +/*?*/ aLink.Call(&aRec); // sollte mal 'nen ReturnCode liefern +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bOk=pObj->Paint(rXOut,rInfoRec); + +////////////////////////////////////////////////////////////////////////////// +// +// Vector2D aTRScale; +// double fTRShear; +// double fTRRotate; +// Vector2D aTRTranslate; +// Matrix3D aOrigMat; +// XPolyPolygon aTRPolyPolygon; +// +// BOOL bIsPath = pObj->TRGetBaseGeometry(aOrigMat, aTRPolyPolygon); +// aOrigMat.DecomposeAndCorrect(aTRScale, fTRShear, fTRRotate, aTRTranslate); +// Vector2D aVectorTranslate; +// aVectorTranslate.X() = FRound(aTRTranslate.X()); +// aVectorTranslate.Y() = FRound(aTRTranslate.Y()); +// +// Point aPoint(aVectorTranslate.X(), aVectorTranslate.Y()); +// Rectangle aTRBaseRect( +// aPoint, +// Size(FRound(aTRScale.X()), FRound(aTRScale.Y()))); +// +// Color aLineColorMerk(rXOut.GetOutDev()->GetLineColor()); +// Color aFillColorMerk(rXOut.GetOutDev()->GetFillColor()); +// rXOut.GetOutDev()->SetFillColor(); +// +// rXOut.GetOutDev()->SetLineColor(COL_BLACK); +// rXOut.GetOutDev()->DrawRect(aTRBaseRect); +// +// if(bIsPath) +// { +// rXOut.GetOutDev()->SetLineColor(COL_LIGHTRED); +// XPolyPolygon aTRPoPo(aTRPolyPolygon); +// aTRPoPo.Move(aTRBaseRect.Left(), aTRBaseRect.Top()); +// sal_uInt16 nCount(aTRPoPo.Count()); +// for(sal_uInt16 a(0); a < nCount; a++) +// rXOut.GetOutDev()->DrawPolygon(XOutCreatePolygon(aTRPoPo[a], rXOut.GetOutDev())); +// } +// +// rXOut.GetOutDev()->SetLineColor(aLineColorMerk); +// rXOut.GetOutDev()->SetFillColor(aFillColorMerk); +// +// static BOOL bDoTestSetAllGeometry(FALSE); +// if(bDoTestSetAllGeometry) +// pObj->TRSetBaseGeometry(aOrigMat, aTRPolyPolygon); +// +// +////////////////////////////////////////////////////////////////////////////// +/*N*/ } +/*N*/ +/*N*/ // nach dem ersten Objekt bei reinem Hintergrundcache +/*N*/ // sollen die folgenden Objekte natuerlich nicht gezeichnet werden +/*N*/ if( bBGCachePrepare ) +/*N*/ bPaintFlag = FALSE; +/*N*/ } +/*N*/ else if( bBGCachePaint ) +/*N*/ bPaintFlag = TRUE; +/*N*/ } +/*N*/ +/*N*/ if( bOk && nEvent != 0 ) +/*?*/ bOk = !pAppPtr->AnyInput( nEvent ); +/*N*/ +/*N*/ if( !bOk ) +/*N*/ bBrk = TRUE; +/*N*/ } +/*N*/ nObjNum++; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (bColorsDirty && bRestoreColors) +/*N*/ aHDCMerk.Restore(*pOut); +/*N*/ +/*N*/ return bOk; +/*N*/ } + + + +/*N*/ void SdrObjList::ReformatAllTextObjects() +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ ULONG nNum=0; +/*N*/ +/*N*/ Printer* pPrinter = NULL; +/*N*/ +/*N*/ if (pModel) +/*N*/ { +/*N*/ if (pModel->GetRefDevice() && pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER) +/*N*/ { +/*N*/ // Kein RefDevice oder RefDevice kein Printer +/*N*/ pPrinter = (Printer*) pModel->GetRefDevice(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ while (nNum<nAnz) +/*N*/ { +/*N*/ SdrObject* pObj = GetObj(nNum); +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ if (pPrinter && +/*N*/ pObj->GetObjInventor() == SdrInventor && +/*N*/ pObj->GetObjIdentifier() == OBJ_OLE2 && +/*N*/ !( (SdrOle2Obj*) pObj )->IsEmpty() ) +/*N*/ { +/*?*/ const SvInPlaceObjectRef& xObjRef = ((SdrOle2Obj*) pObj)->GetObjRef(); +/*?*/ +/*?*/ if( xObjRef.Is() && ( xObjRef->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) ) +/*?*/ xObjRef->OnDocumentPrinterChanged(pPrinter); +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ pObj->ReformatText(); +/*N*/ nAnz=GetObjCount(); // ReformatText may delete an object +/*N*/ nNum++; +/*N*/ } +/*N*/ } + +/** steps over all available objects and reformats all + edge objects that are connected to other objects so that + they may reposition itselfs. + #103122# +*/ +/*N*/ void SdrObjList::ReformatAllEdgeObjects() +/*N*/ { +/*N*/ const sal_uInt32 nCount=GetObjCount(); +/*N*/ sal_uInt32 nObj; +/*N*/ +/*N*/ for( nObj = 0; nObj < nCount; nObj++ ) +/*N*/ { +/*N*/ SdrObject* pObj = GetObj(nObj); +/*N*/ if( pObj->ISA(SdrEdgeObj) ) +/*N*/ static_cast<SdrEdgeObj*>(pObj)->Reformat(); +/*N*/ } +/*N*/ } + + + +/*N*/ void SdrObjList::RestartAllAnimations(SdrPageView* pPageView) const +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ ULONG nNum=0; +/*N*/ while (nNum<nAnz) { +/*N*/ GetObj(nNum)->RestartAnimation(pPageView); +/*N*/ nNum++; +/*N*/ } +/*N*/ } + +/*N*/ ULONG SdrObjList::CountAllObjects() const +/*N*/ { +/*N*/ ULONG nCnt=GetObjCount(); +/*N*/ ULONG nAnz=nCnt; +/*N*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*N*/ SdrObjList* pSubOL=GetObj(nNum)->GetSubList(); +/*N*/ if (pSubOL!=NULL) { +/*N*/ nCnt+=pSubOL->CountAllObjects(); +/*N*/ } +/*N*/ } +/*N*/ return nCnt; +/*N*/ } + + + +/*N*/ void SdrObjList::Save(SvStream& rOut) const +/*N*/ { +/*N*/ FASTBOOL bNotPersist=pPage!=NULL && pPage->IsObjectsNotPersistent(); +/*N*/ FASTBOOL bNoOLE=pModel!=NULL && pModel->IsStreamingSdrModel(); +/*N*/ if (!bNotPersist) { +/*N*/ SdrObjListIter aIter(*this,IM_FLAT); +/*N*/ while (aIter.IsMore()) { +/*N*/ SdrObject* pObj=aIter.Next(); +/*N*/ FASTBOOL bThisObjNot=pObj->IsNotPersistent(); +/*N*/ if (!bThisObjNot && bNoOLE && pObj->ISA(SdrOle2Obj)) { +/*N*/ bThisObjNot=TRUE; +/*N*/ } +/*N*/ if (!bThisObjNot) rOut<<*pObj; +/*N*/ if (pModel!=NULL) pModel->IncProgress(); +/*N*/ } +/*N*/ } +/*N*/ SdrIOHeader(rOut,STREAM_WRITE,SdrIOEndeID); // Endemarke +/*N*/ } + +/*N*/ void SdrObjList::Load(SvStream& rIn, SdrPage& rPage) +/*N*/ { +/*N*/ Clear(); +/*N*/ +/*N*/ if (rIn.GetError()!=0) +/*N*/ return; +/*N*/ +/*N*/ SdrInsertReason aReason(SDRREASON_STREAMING); +/*N*/ FASTBOOL bEnde=FALSE; +/*N*/ +/*N*/ while( rIn.GetError()==0 && !rIn.IsEof() && !bEnde ) +/*N*/ { +/*N*/ SdrObjIOHeaderLookAhead aHead(rIn,STREAM_READ); +/*N*/ +/*N*/ if (!aHead.IsEnde()) +/*N*/ { +/*N*/ SdrObject* pObj=SdrObjFactory::MakeNewObject(aHead.nInventor,aHead.nIdentifier,&rPage); +/*N*/ +/*N*/ if( pObj!=NULL ) +/*N*/ { +/*N*/ rIn >> *pObj; +/*N*/ +/*N*/ #ifndef SVX_LIGHT +/*N*/ if( ( pObj->GetObjIdentifier() == OBJ_OLE2 ) && ( pObj->GetObjInventor() == SdrInventor ) ) +/*N*/ { +/*N*/ // convert StarImage OLE objects to normal graphic objects +/*N*/ SdrOle2Obj* pOLEObj = (SdrOle2Obj*) pObj; +/*N*/ BOOL bImageOLE = FALSE; +/*N*/ +/*N*/ if( pOLEObj->GetProgName() == String( RTL_CONSTASCII_USTRINGPARAM( "StarImage" ) ) ) +/*N*/ bImageOLE = TRUE; +/*N*/ else if( pModel->GetPersist() ) +/*N*/ { +/*N*/ SvInfoObjectRef xInfo( pModel->GetPersist()->Find( pOLEObj->GetPersistName() ) ); +/*N*/ const SvGlobalName aSim30Name( BF_SO3_SIM_CLASSID_30 ); +/*N*/ const SvGlobalName aSim40Name( BF_SO3_SIM_CLASSID_40 ); +/*N*/ const SvGlobalName aSim50Name( BF_SO3_SIM_CLASSID_50 ); +/*N*/ +/*N*/ if( xInfo.Is() && +/*N*/ ( xInfo->GetClassName() == aSim30Name || +/*N*/ xInfo->GetClassName() == aSim40Name || +/*N*/ xInfo->GetClassName() == aSim50Name ) ) +/*N*/ { +/*N*/ bImageOLE = TRUE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( bImageOLE && pOLEObj->GetPersistName().Len() ) +/*N*/ { +/*?*/ SotStorage* pModelStorage = pModel->GetModelStorage(); +/*?*/ const String aSimStorageName( pOLEObj->GetPersistName() ); +/*?*/ +/*?*/ if( pModelStorage && pModelStorage->IsStorage( aSimStorageName ) ) +/*?*/ { +/*?*/ SotStorageRef xSimStorage( pModelStorage->OpenSotStorage( aSimStorageName ) ); +/*?*/ +/*?*/ if( xSimStorage.Is() ) +/*?*/ { +/*?*/ String aStmName( RTL_CONSTASCII_USTRINGPARAM( "StarImageDocument" ) ); +/*?*/ +/*?*/ if( xSimStorage->IsStream( aStmName ) || +/*?*/ xSimStorage->IsStream( aStmName = String( RTL_CONSTASCII_USTRINGPARAM( "StarImageDocument 4.0" ) ) ) ) +/*?*/ { +/*?*/ SotStorageStreamRef xSimStm( xSimStorage->OpenSotStream( aStmName ) ); +/*?*/ +/*?*/ if( xSimStm.Is() && !xSimStm->GetError() ) +/*?*/ { +/*?*/ Graphic aGraphic; +/*?*/ +/*?*/ xSimStm->SetBufferSize( 32768 ); +/*?*/ xSimStm->SetKey( xSimStorage->GetKey() ); +/*?*/ *xSimStm >> aGraphic; +/*?*/ xSimStm->SetBufferSize( 0 ); +/*?*/ +/*?*/ SdrGrafObj* pNewObj = (SdrGrafObj*) SdrObjFactory::MakeNewObject( SdrInventor, OBJ_GRAF, &rPage ); +/*?*/ +/*?*/ if( pNewObj ) +/*?*/ { +/*?*/ pNewObj->SetGraphic( aGraphic ); +/*?*/ pNewObj->SetLogicRect( pObj->GetLogicRect() ); +/*?*/ delete pObj; +/*?*/ pObj = pNewObj; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ } +#endif // SVX_LIGHT + +/*N*/ InsertObject(pObj,CONTAINER_APPEND,&aReason); +/*N*/ } +/*N*/ else +/*N*/ { // aha, das wil keiner. Also ueberlesen. +/*N*/ #ifdef SVX_LIGHT +/*N*/ if( aHead.nInventor != FmFormInventor ) +/*N*/ { +/*N*/ #endif +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*?*/ ByteString aStr("SdrObjList::Load(): Zeichenobjekt kann von der Factory nicht erzeugt werden:\n"); +/*?*/ UINT32 nPos(GetObjCount()); +/*?*/ +/*?*/ aStr += "Listenposition: "; +/*?*/ aStr += ByteString::CreateFromInt32( nPos ); +/*?*/ aStr += "\n"; +/*?*/ aStr += "Inventor: "; +/*?*/ sal_Int32 nInv = SWAPLONG( aHead.nInventor ); +/*?*/ aStr += ByteString::CreateFromInt32( nInv ); +/*?*/ aStr += ", Identifier: "; +/*?*/ aStr += ByteString::CreateFromInt32( aHead.nIdentifier ); +/*?*/ aStr += "\n"; +/*?*/ aStr += "FilePos: "; +/*?*/ aStr += ByteString::CreateFromInt32( aHead.GetFilePos() ); +/*?*/ aStr += ", BlockSize: "; +/*?*/ aStr += ByteString::CreateFromInt32( aHead.GetBlockSize() ); +/*?*/ +/*?*/ DBG_ERROR(aStr.GetBuffer()); +/*?*/ #endif +/*?*/ +/*?*/ #ifdef SVX_LIGHT +/*?*/ } +/*?*/ #endif +/*?*/ aHead.SkipRecord(); +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bEnde=TRUE; +/*N*/ aHead.SkipRecord(); // die Endemarke weglesen +/*N*/ } +/*N*/ +/*N*/ SdrModel* pMd=pModel; +/*N*/ +/*N*/ if (pMd==NULL) +/*N*/ pMd=rPage.GetModel(); +/*N*/ +/*N*/ if (pMd!=NULL) +/*N*/ pMd->DoProgress(rIn.Tell()); +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjList::AfterRead() +/*N*/ { +/*N*/ ULONG nAnz=GetObjCount(); +/*N*/ for (ULONG i=0; i<nAnz; i++) { +/*N*/ GetObj(i)->AfterRead(); +/*N*/ } +/*N*/ } + +/*?*/ void SdrObjList::FlattenGroups() +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } + +/*?*/ void SdrObjList::UnGroupObj( ULONG nObjNum ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrMasterPageDescriptor& rMDP) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOMPgDID); +/*N*/ rOut<<rMDP.nPgNum; +/*N*/ rOut<<rMDP.aVisLayers; +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrMasterPageDescriptor& rMDP) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ rIn>>rMDP.nPgNum; +/*N*/ rIn>>rMDP.aVisLayers; +/*N*/ return rIn; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrMasterPageDescriptorList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrMasterPageDescriptorList& rMPDL) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOMPDLID); +/*N*/ USHORT nAnz=rMPDL.GetCount(); +/*N*/ rOut<<nAnz; +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ rOut<<rMPDL[i]; +/*N*/ } +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrMasterPageDescriptorList& rMPDL) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ rMPDL.Clear(); +/*N*/ USHORT nAnz; +/*N*/ rIn>>nAnz; +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ SdrMasterPageDescriptor* pMPD=new SdrMasterPageDescriptor; +/*N*/ rIn>>*pMPD; +/*N*/ rMPDL.aList.Insert(pMPD,CONTAINER_APPEND); +/*N*/ } +/*N*/ return rIn; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPageGridFrameList::Clear() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT1(SdrPage,SdrObjList); + +/*N*/ SdrPage::SdrPage(SdrModel& rNewModel, FASTBOOL bMasterPage): +/*N*/ SdrObjList(&rNewModel,this), +/*N*/ pBackgroundObj( NULL ) +/*N*/ { +/*N*/ pLayerAdmin=new SdrLayerAdmin(&rNewModel.GetLayerAdmin()); +/*N*/ bMaster=bMasterPage; +/*N*/ bInserted=FALSE; +/*N*/ aPrefVisiLayers.SetAll(); +/*N*/ nWdt=10; +/*N*/ nHgt=10; +/*N*/ nBordLft=0; +/*N*/ nBordUpp=0; +/*N*/ nBordRgt=0; +/*N*/ nBordLwr=0; +/*N*/ nPageNum=0; +/*N*/ eListKind=bMasterPage ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; +/*N*/ bSwappingLocked=FALSE; +/*N*/ bObjectsNotPersistent=FALSE; +/*N*/ } + +/*?*/ SdrPage::SdrPage(const SdrPage& rSrcPage): +/*?*/ SdrObjList(rSrcPage.pModel,this), +/*?*/ pBackgroundObj( NULL ) +/*?*/ { +/*?*/ pLayerAdmin=new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin()); +/*?*/ *this=rSrcPage; +/*?*/ eListKind=bMaster ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; +/*?*/ } + +/*N*/ SdrPage::~SdrPage() +/*N*/ { +/*N*/ delete pBackgroundObj; +/*N*/ delete pLayerAdmin; +/*N*/ } + + + + + +/*N*/ void SdrPage::SetSize(const Size& aSiz) +/*N*/ { +/*N*/ nWdt=aSiz.Width(); +/*N*/ nHgt=aSiz.Height(); +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ Size SdrPage::GetSize() const +/*N*/ { +/*N*/ return Size(nWdt,nHgt); +/*N*/ } + +/*N*/ INT32 SdrPage::GetWdt() const +/*N*/ { +/*N*/ return nWdt; +/*N*/ } + +/*N*/ void SdrPage::SetOrientation(Orientation eOri) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + +/*N*/ INT32 SdrPage::GetHgt() const +/*N*/ { +/*N*/ return nHgt; +/*N*/ } + +/*N*/ void SdrPage::SetBorder(INT32 nLft, INT32 nUpp, INT32 nRgt, INT32 nLwr) +/*N*/ { +/*N*/ nBordLft=nLft; +/*N*/ nBordUpp=nUpp; +/*N*/ nBordRgt=nRgt; +/*N*/ nBordLwr=nLwr; +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ void SdrPage::SetLftBorder(INT32 nBorder) +/*N*/ { +/*N*/ nBordLft=nBorder; +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ void SdrPage::SetUppBorder(INT32 nBorder) +/*N*/ { +/*N*/ nBordUpp=nBorder; +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ void SdrPage::SetRgtBorder(INT32 nBorder) +/*N*/ { +/*N*/ nBordRgt=nBorder; +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ void SdrPage::SetLwrBorder(INT32 nBorder) +/*N*/ { +/*N*/ nBordLwr=nBorder; +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +/*N*/ INT32 SdrPage::GetLftBorder() const +/*N*/ { +/*N*/ return nBordLft; +/*N*/ } + +/*N*/ INT32 SdrPage::GetUppBorder() const +/*N*/ { +/*N*/ return nBordUpp; +/*N*/ } + +/*N*/ INT32 SdrPage::GetRgtBorder() const +/*N*/ { +/*N*/ return nBordRgt; +/*N*/ } + +/*N*/ INT32 SdrPage::GetLwrBorder() const +/*N*/ { +/*N*/ return nBordLwr; +/*N*/ } + +// #i3694# +// This GetOffset() method is not needed anymore, it even leads to errors. +//Point SdrPage::GetOffset() const +//{ +// return Point(); +//} + +/*N*/ void SdrPage::SetModel(SdrModel* pNewModel) +/*N*/ { +/*N*/ SdrModel* pOldModel=pModel; +/*N*/ SdrObjList::SetModel(pNewModel); +/*N*/ if (pNewModel!=pOldModel) +/*N*/ { +/*?*/ if (pNewModel!=NULL) { +/*?*/ pLayerAdmin->SetParent(&pNewModel->GetLayerAdmin()); +/*?*/ } else { +/*?*/ pLayerAdmin->SetParent(NULL); +/*?*/ } +/*?*/ pLayerAdmin->SetModel(pNewModel); +/*?*/ +/*?*/ if( pBackgroundObj ) +/*?*/ pBackgroundObj->SetModel( pNewModel ); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ USHORT SdrPage::GetPageNum() const +/*N*/ { +/*N*/ if (!bInserted) return 0; +/*N*/ if (bMaster) { +/*N*/ if (pModel && pModel->IsMPgNumsDirty()) +/*N*/ ((SdrModel*)pModel)->RecalcPageNums(TRUE); +/*N*/ } else { +/*N*/ if (pModel && pModel->IsPagNumsDirty()) +/*N*/ ((SdrModel*)pModel)->RecalcPageNums(FALSE); +/*N*/ } +/*N*/ return nPageNum; +/*N*/ } + +/*N*/ void SdrPage::SetChanged() +/*N*/ { +/*N*/ if( pModel ) +/*N*/ pModel->SetChanged(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPage::SendRepaintBroadcast() const +/*N*/ { +/*N*/ if (bInserted && pModel!=NULL) pModel->Broadcast(SdrHint(*this)); +/*N*/ } + + +/*N*/ void SdrPage::InsertMasterPage(USHORT nPgNum, USHORT nPos) +/*N*/ { +/*N*/ aMasters.Insert(nPgNum,nPos); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + +/*?*/ void SdrPage::InsertMasterPage(const SdrMasterPageDescriptor& rMPD, USHORT nPos) +/*?*/ { +/*?*/ aMasters.Insert(rMPD,nPos); +/*?*/ SetChanged(); +/*?*/ SendRepaintBroadcast(); +/*?*/ } + +/*N*/ void SdrPage::RemoveMasterPage(USHORT nPos) +/*N*/ { +/*N*/ if (nPos<aMasters.GetCount()) { +/*N*/ aMasters.Remove(nPos); +/*N*/ SetChanged(); +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPage::MoveMasterPage(USHORT nPos, USHORT nNewPos) +/*N*/ { +/*N*/ if (nPos<aMasters.GetCount()) { +/*N*/ aMasters.Move(nPos,nNewPos); +/*N*/ SendRepaintBroadcast(); +/*N*/ } +/*N*/ } + +/*?*/ SdrPage* SdrPage::GetMasterPage(USHORT nPos) const +/*?*/ { +/*?*/ USHORT nPgNum=GetMasterPageNum(nPos); +/*?*/ SdrPage* pPg=NULL; +/*?*/ if( pModel ) +/*?*/ pPg = pModel->GetMasterPage(nPgNum); +/*?*/ return pPg; +/*?*/ } + + +/*N*/ void SdrPage::SetMasterPageVisibleLayers(const SetOfByte& rVL, USHORT nPos) +/*N*/ { +/*N*/ aMasters[nPos].SetVisibleLayers(rVL); +/*N*/ SendRepaintBroadcast(); +/*N*/ } + + + +/*N*/ void SdrPage::ImpMasterPageRemoved(USHORT nMasterPageNum) +/*N*/ { +/*N*/ USHORT nMasterAnz=GetMasterPageCount(); +/*N*/ for (USHORT nm=nMasterAnz; nm>0;) { +/*N*/ nm--; +/*N*/ USHORT nNum=aMasters[nm].GetPageNum(); +/*N*/ if (nNum==nMasterPageNum) { RemoveMasterPage(nm); SendRepaintBroadcast(); } +/*N*/ if (nNum>nMasterPageNum) { +/*N*/ // Hintere anpassen wegen Verschiebung durch entfernen +/*?*/ aMasters[nm].SetPageNum(USHORT(nNum-1)); +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPage::ImpMasterPageMoved(USHORT nMasterPageNum, USHORT nNewMasterPageNum) +/*N*/ { +/*N*/ USHORT nMasterAnz=GetMasterPageCount(); +/*N*/ for (USHORT nm=nMasterAnz; nm>0;) { +/*N*/ nm--; +/*N*/ USHORT nNum=aMasters[nm].GetPageNum(); +/*N*/ if (nNum==nMasterPageNum) { +/*N*/ aMasters[nm].SetPageNum(nNewMasterPageNum); +/*N*/ } else { +/*N*/ // Hintere anpassen wegen Verschiebung durch entfernen und einfuegen +/*N*/ USHORT nNeuNum=nNum; +/*N*/ if (nNeuNum>nMasterPageNum) nNeuNum--; +/*N*/ if (nNeuNum>=nNewMasterPageNum) nNeuNum++; +/*N*/ aMasters[nm].SetPageNum(nNeuNum); +/*N*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPage::ReadData(const SdrIOHeader& rHead, SvStream& rIn) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return; +/*N*/ SdrDownCompat aCompat(rIn,STREAM_READ); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPage"); +/*N*/ #endif +/*N*/ +/*N*/ if (rHead.GetVersion()>=11) { +/*N*/ // damit ich meine eigenen SubRecords erkenne (ab V11) +/*N*/ char cMagic[4]; +/*N*/ if (rIn.Read(cMagic,4)!=4 || memcmp(cMagic,SdrIOJoeMagic,4)!=0) { +/*?*/ rIn.SetError(SVSTREAM_FILEFORMAT_ERROR); +/*?*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ { // MiscellaneousData ab V11 eingepackt +/*N*/ SdrDownCompat* pPageMiscCompat=NULL; +/*N*/ if (rHead.GetVersion()>=11) { +/*N*/ pPageMiscCompat=new SdrDownCompat(rIn,STREAM_READ); +/*N*/ #ifdef DBG_UTIL +/*N*/ pPageMiscCompat->SetID("SdrPage(Miscellaneous)"); +/*N*/ #endif +/*N*/ } +/*N*/ rIn>>nWdt; +/*N*/ rIn>>nHgt; +/*N*/ rIn>>nBordLft; +/*N*/ rIn>>nBordUpp; +/*N*/ rIn>>nBordRgt; +/*N*/ rIn>>nBordLwr; +/*N*/ USHORT n; +/*N*/ rIn>>n; //aName; +/*N*/ if (pPageMiscCompat!=NULL) { +/*N*/ delete pPageMiscCompat; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ FASTBOOL bEnde=FALSE; +/*N*/ while (rIn.GetError()==0 && !rIn.IsEof() && !bEnde) { +/*N*/ SdrIOHeaderLookAhead aHead(rIn); // Layerdefinitionen lesen +/*N*/ if (aHead.IsID(SdrIOLayrID)) { +/*?*/ SdrLayer* pLay=new SdrLayer; // Layerdefinition lesen +/*?*/ rIn>>*pLay; +/*?*/ pLayerAdmin->InsertLayer(pLay); +/*N*/ } else +/*N*/ if (aHead.IsID(SdrIOLSetID)) { +/*?*/ SdrLayerSet* pSet=new SdrLayerSet; // Layersetdefinition lesen +/*?*/ rIn>>*pSet; +/*?*/ pLayerAdmin->InsertLayerSet(pSet); +/*N*/ } else +/*N*/ // Fuer den Fall der Faelle kann hier ww. MPgDscr oder MPgDscrList stehen +/*N*/ if (aHead.IsID(SdrIOMPgDID)) { // Masterpagedescriptor +/*?*/ SdrMasterPageDescriptor aDscr; +/*?*/ rIn>>aDscr; +/*?*/ aMasters.Insert(aDscr); +/*N*/ } else +/*N*/ if (aHead.IsID(SdrIOMPDLID)) { // MasterpagedescriptorList +/*N*/ SdrMasterPageDescriptorList aDscrList; +/*N*/ rIn>>aDscrList; +/*N*/ USHORT nAnz=aDscrList.GetCount(); +/*N*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*N*/ aMasters.Insert(aDscrList[nNum]); +/*N*/ } +/*N*/ } else bEnde=TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rHead.GetVersion()>=1) { +/*N*/ } else { +/*?*/ USHORT nMaAnz=0,i; +/*?*/ rIn>>nMaAnz; +/*?*/ for (i=0; i<nMaAnz; i++) { +/*?*/ USHORT nMaPgNum; +/*?*/ rIn>>nMaPgNum; +/*?*/ InsertMasterPage(nMaPgNum); +/*N*/ } +/*N*/ } +/*N*/ SdrObjList::Load(rIn,*this); // Liste der Objekte lesen +/*N*/ +/*N*/ if ( rHead.GetVersion() >= 16 ) +/*N*/ { +/*N*/ BOOL bBackgroundObj = FALSE; +/*N*/ rIn >> bBackgroundObj; +/*N*/ if( bBackgroundObj ) +/*N*/ { +/*N*/ SdrObjIOHeaderLookAhead aHead( rIn,STREAM_READ ); +/*N*/ if ( !aHead.IsEnde() ) +/*N*/ { +/*N*/ pBackgroundObj = SdrObjFactory::MakeNewObject( aHead.nInventor, aHead.nIdentifier, this ); +/*N*/ if ( bBackgroundObj ) +/*N*/ rIn >> *pBackgroundObj; +/*N*/ } +/*N*/ else +/*?*/ aHead.SkipRecord(); // skip end mark +/*N*/ } +/*N*/ } +/*N*/ + // #88340# +/*N*/ if(!aMasters.GetCount() && !IsMasterPage()) +/*N*/ { +/*N*/ if(pModel && pModel->GetMasterPageCount() > 2) +/*N*/ { +/*N*/ // This is not allowed. Create a dummy entry +/*N*/ // to compensate this error. +/*?*/ SdrMasterPageDescriptor aDscr(1/*PageMaster*/); +/*?*/ aMasters.Insert(aDscr); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SdrMasterPageDescriptor aDscr(0); +/*N*/ aMasters.Insert(aDscr); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrPage::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ SdrDownCompat aCompat(rOut,STREAM_WRITE); // Fuer Abwaertskompatibilitaet (Lesen neuer Daten mit altem Code) +/*N*/ #ifdef DBG_UTIL +/*N*/ aCompat.SetID("SdrPage"); +/*N*/ #endif +/*N*/ rOut.Write(SdrIOJoeMagic,4); // damit ich meine eigenen SubRecords erkenne (ab V11) +/*N*/ { // MiscellaneousData ab V11 eingepackt +/*N*/ SdrDownCompat aPageMiscCompat(rOut,STREAM_WRITE); +/*N*/ #ifdef DBG_UTIL +/*N*/ aPageMiscCompat.SetID("SdrPage(Miscellaneous)"); +/*N*/ #endif +/*N*/ rOut<<nWdt; +/*N*/ rOut<<nHgt; +/*N*/ rOut<<nBordLft; +/*N*/ rOut<<nBordUpp; +/*N*/ rOut<<nBordRgt; +/*N*/ rOut<<nBordLwr; +/*N*/ USHORT n=0; +/*N*/ rOut<<n; //rPg.aName; +/*N*/ } +/*N*/ +/*N*/ USHORT i; // Lokale Layerdefinitionen der Seite +/*N*/ for (i=0; i<pLayerAdmin->GetLayerCount(); i++) { +/*?*/ rOut<<*pLayerAdmin->GetLayer(i); +/*N*/ } +/*N*/ for (i=0; i<pLayerAdmin->GetLayerSetCount(); i++) { +/*?*/ rOut<<*pLayerAdmin->GetLayerSet(i); +/*N*/ } +/*N*/ +/*N*/ rOut<<aMasters; +/*N*/ SdrObjList::Save(rOut); +/*N*/ +/*N*/ BOOL bBackgroundObj = pBackgroundObj ? TRUE : FALSE; +/*N*/ rOut << bBackgroundObj; +/*N*/ if( pBackgroundObj ) +/*N*/ rOut << *pBackgroundObj; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrPage& rPg) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ rPg.ReadData(aHead,rIn); +/*N*/ return rIn; +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrPage& rPg) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,!rPg.bMaster ? SdrIOPageID : SdrIOMaPgID); +/*N*/ rPg.WriteData(rOut); +/*N*/ return rOut; +/*N*/ } + +/*N*/ XubString SdrPage::GetLayoutName() const +/*N*/ { +/*N*/ // Die wollte Dieter haben. +/*N*/ return String(); +/*N*/ } + +/*N*/ void SdrPage::SetBackgroundObj( SdrObject* pObj ) +/*N*/ { +/*N*/ if ( pObj ) +/*N*/ { +/*N*/ pObj->SetPage( this ); +/*N*/ pObj->SetModel( pModel ); +/*N*/ pObj->SetLayer( 1 ); // Nothing known about the backgroundlayer... +/*N*/ } +/*N*/ delete pBackgroundObj, pBackgroundObj = pObj; +/*N*/ } + +/*N*/ void SdrPage::SetInserted( FASTBOOL bIns ) +/*N*/ { +/*N*/ if( bInserted != bIns ) +/*N*/ { +/*N*/ bInserted = bIns; +/*N*/ +/*N*/ SdrObjListIter aIter( *this, IM_FLAT ); +/*N*/ while ( aIter.IsMore() ) +/*N*/ { +/*N*/ SdrObject* pObj = aIter.Next(); +/*N*/ if ( pObj->ISA(SdrOle2Obj) ) +/*N*/ { +/*N*/ if( bInserted ) +/*N*/ ( (SdrOle2Obj*) pObj)->Connect(); +/*N*/ else +/*N*/ ( (SdrOle2Obj*) pObj)->Disconnect(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ uno::Reference< uno::XInterface > SdrPage::getUnoPage() +/*N*/ { +/*N*/ // try weak reference first +/*N*/ uno::Reference< uno::XInterface > xPage( mxUnoPage ); +/*N*/ +/*N*/ if( !xPage.is() ) +/*N*/ { +/*N*/ // create one +/*N*/ xPage = createUnoPage(); +/*N*/ +/*N*/ mxUnoPage = xPage; +/*N*/ } +/*N*/ +/*N*/ return xPage; +/*N*/ } + +/*N*/ uno::Reference< uno::XInterface > SdrPage::createUnoPage() +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt = +/*N*/ #ifndef SVX_LIGHT +/*N*/ static_cast<cppu::OWeakObject*>( new SvxFmDrawPage( this ) ); +/*N*/ #else +/*N*/ static_cast<cppu::OWeakObject*>( new SvxDrawPage( this ) ); +/*N*/ #endif +/*N*/ return xInt; +/*N*/ } + +/*N*/ SfxStyleSheet* SdrPage::GetTextStyleSheetForObject( SdrObject* pObj ) const +/*N*/ { +/*N*/ return pObj->GetStyleSheet(); +/*N*/ } + + +/** returns an averaged background color of this page */ +/*N*/ Color SdrPage::GetBackgroundColor( SdrPageView* pView ) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); Color aColor; return aColor; +/*N*/ } + +/** *deprecated, use GetBackgroundColor with SdrPageView */ +/*N*/ Color SdrPage::GetBackgroundColor() const +/*N*/ { +/*N*/ return GetBackgroundColor( NULL ); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdpagv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdpagv.cxx new file mode 100644 index 000000000000..5df7b88a5f5a --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdpagv.cxx @@ -0,0 +1,911 @@ +/* -*- 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/awt/PosSize.hpp> + +#include <toolkit/helper/vclunohelper.hxx> + + +#include "svdpagv.hxx" +#include "svdouno.hxx" +#include "svdpage.hxx" +#include "svdio.hxx" +#include "svdview.hxx" +#include "svditer.hxx" +#include "svdogrp.hxx" + +#include "svdoole2.hxx" +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#ifdef _MSC_VER +#pragma hdrstop +#endif +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +/*N*/ TYPEINIT1(SdrPageView, SfxListener); + + +// Klasse muß als listener fungieren, um den Zustand, ob ein Object sichtbar ist oder nicht +// festzuhalten +//------------------------------------------------------------------------------ +/*N*/ SdrUnoControlRec::SdrUnoControlRec(SdrUnoControlList* _pParent, SdrUnoObj* _pObj, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _xControl) throw() +/*N*/ :pObj(_pObj) +/*N*/ ,xControl(_xControl) +/*N*/ ,bVisible(TRUE) +/*N*/ ,bIsListening(FALSE) +/*N*/ ,bDisposed(FALSE) +/*N*/ ,pParent(_pParent) +/*N*/ ,mnPaintLevel( 0 ) +/*N*/ { +/*N*/ DBG_ASSERT( xControl.is(), "SdrUnoControlRec::SdrUnoControlRec: invalid control, this will crash!" ); +/*N*/ +/*N*/ bVisible = xControl.is() ? !xControl->isDesignMode() : TRUE; +/*N*/ bool bOldVisible = bVisible; +/*N*/ +/*N*/ // if bVisible is TRUE here, then switchControlListening will also start +/*N*/ // DesignModeListening +/*N*/ switchControlListening( true ); +/*N*/ +/*N*/ // adjust the initial visibility according to the visibility of the layer +/*N*/ // 2003-06-03 - #110592# - fs@openoffice.org +/*N*/ adjustControlVisibility( true ); +/*N*/ +/*N*/ } + +//------------------------------------------------------------------------------ +/*N*/ SdrUnoControlRec::~SdrUnoControlRec() throw() +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------------ +/*?*/ void SdrUnoControlRec::adjustControlVisibility( bool _bForce ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP");}//STRIP001 +/*?*/ } + +//------------------------------------------------------------------------------ +/*?*/ void SdrUnoControlRec::switchControlListening( bool _bStart ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP");}//STRIP001 +/*?*/ } + +//------------------------------------------------------------------------------ +/*N*/ void SAL_CALL SdrUnoControlRec::disposing( const ::com::sun::star::lang::EventObject& Source ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ uno::Reference< awt::XControl > xSource( Source.Source, uno::UNO_QUERY); +/*N*/ if (xSource.is()) +/*?*/ { {DBG_BF_ASSERT(0, "STRIP");}//STRIP001 // it's the control we're responsible for +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------------------ + +// XWindowListener +/*N*/ void SAL_CALL SdrUnoControlRec::windowResized( const ::com::sun::star::awt::WindowEvent& e ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SdrUnoControlRec::windowMoved( const ::com::sun::star::awt::WindowEvent& e ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SdrUnoControlRec::windowShown( const ::com::sun::star::lang::EventObject& e ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//------------------------------------------------------------------------------ +/*N*/ void SAL_CALL SdrUnoControlRec::windowHidden( const ::com::sun::star::lang::EventObject& e ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +// XPropertyChangeListener +//------------------------------------------------------------------------------ +/*N*/ void SAL_CALL SdrUnoControlRec::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +// XImageConsumer +//------------------------------------------------------------------------------ +/*N*/ void SAL_CALL SdrUnoControlRec::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------------ +/*N*/ void SAL_CALL SdrUnoControlRec::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SdrUnoControlRec::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SdrUnoControlRec::setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SdrUnoControlRec::setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------------ +/*?*/ void SAL_CALL SdrUnoControlRec::modeChanged( const util::ModeChangeEvent& _rSource ) throw (uno::RuntimeException) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP");}//STRIP001 +/*?*/ } + +//------------------------------------------------------------------------------ +/*N*/ void SdrUnoControlRec::Clear(BOOL bDispose) +/*N*/ { +/*N*/ if (xControl.is()) +/*N*/ { +/*N*/ switchControlListening( false ); +/*N*/ +/*N*/ if (bDispose) +/*?*/ xControl->dispose(); +/*N*/ xControl = NULL; +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ SV_IMPL_OP_PTRARR_SORT( SdrUnoControlAccessArr, SdrUnoControlAccessPtr ) + +//------------------------------------------------------------------------ +/*N*/ SdrUnoControlRec* SdrUnoControlList::GetObject(USHORT i) const +/*N*/ { +/*N*/ SdrUnoControlAccess* pAccess = aAccessArr[i]; +/*N*/ return pAccess->pControlRec; +/*N*/ } + +//------------------------------------------------------------------------ +/*N*/ void SdrUnoControlList::Clear(BOOL bDispose) +/*N*/ { +/*N*/ for( USHORT i=aAccessArr.Count(); i > 0; ) +/*N*/ Delete(--i, bDispose); +/*N*/ +/*N*/ DBG_ASSERT(!aList.Count(), "SdrUnoControlList::Clear(BOOL bDispose): List not empty"); +/*N*/ } + +//------------------------------------------------------------------------ +/*N*/ void SdrUnoControlList::Insert(SdrUnoControlRec* pRec) +/*N*/ { +/*N*/ aList.Insert( pRec, LIST_APPEND ); +/*N*/ pRec->acquire(); +/*N*/ +/*N*/ SdrUnoControlAccess* pAccess = new SdrUnoControlAccess(pRec->GetControl()->getModel(), pRec); +/*N*/ aAccessArr.Insert( pAccess ); +/*N*/ } + +//------------------------------------------------------------------------ +/*N*/ void SdrUnoControlList::Delete(USHORT nPos, BOOL bDispose) +/*N*/ { +/*N*/ SdrUnoControlAccess* pAccess = aAccessArr[nPos]; +/*N*/ SdrUnoControlRec* pRec = pAccess->pControlRec; +/*N*/ +/*N*/ aList.Remove( pRec ); +/*N*/ aAccessArr.Remove( nPos ); +/*N*/ +/*N*/ // Rec laeßt alles los und wird anschließend zerstoert +/*N*/ pRec->Clear(bDispose); +/*N*/ +/*N*/ pRec->release(); +/*N*/ delete pAccess; +/*N*/ } + +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ +/*N*/ USHORT SdrUnoControlList::Find(uno::Reference< awt::XControlModel > rUnoControlModel) const +/*N*/ { +/*N*/ SdrUnoControlAccess aAccess(rUnoControlModel); +/*N*/ USHORT nPos; +/*N*/ if( !aAccessArr.Seek_Entry(&aAccess, &nPos) ) +/*N*/ return SDRUNOCONTROL_NOTFOUND; +/*N*/ +/*N*/ return nPos; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ void SdrPageViewWinList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + +/*N*/ USHORT SdrPageViewWinList::Find(OutputDevice* pOut) const +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ USHORT nRet=SDRPAGEVIEWWIN_NOTFOUND; +/*N*/ for (USHORT nNum=0; nNum<nAnz && nRet==SDRPAGEVIEWWIN_NOTFOUND; nNum++) { +/*N*/ if (GetObject(nNum)->MatchOutputDevice(pOut)) +/*N*/ nRet=nNum; +/*N*/ } +/*N*/ return nRet; +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/*N*/ SdrPageViewWinRec::SdrPageViewWinRec(SdrPageView& rNewPageView, OutputDevice* pOut) +/*N*/ :rView( rNewPageView.GetView() ) +/*N*/ ,pOutDev( pOut ) +/*N*/ ,aControlList( rNewPageView ) +/*N*/ { +/*N*/ } + +/*N*/ SdrPageViewWinRec::~SdrPageViewWinRec() +/*N*/ { +/*N*/ if (xControlContainer.is()) +/*N*/ { +/*N*/ // notify derived views +/*N*/ rView.RemoveControlContainer(xControlContainer); +/*N*/ +/*N*/ // clear the control place holders +/*N*/ aControlList.Clear(FALSE); +/*N*/ +/*N*/ // dispose the control container +/*N*/ uno::Reference< lang::XComponent > xComponent(xControlContainer, uno::UNO_QUERY); +/*N*/ xComponent->dispose(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPageViewWinRec::CreateControlContainer() +/*N*/ { +/*N*/ if (!xControlContainer.is()) +/*N*/ { +/*N*/ if (pOutDev && pOutDev->GetOutDevType() == OUTDEV_WINDOW && +/*N*/ !rView.IsPrintPreview()) +/*N*/ { +/*N*/ Window* pWindow = (Window*) pOutDev; +/*N*/ xControlContainer = VCLUnoHelper::CreateControlContainer( pWindow ); + + // #100394# xC->setVisible triggers window->Show() and this has + // problems when the view is not completely constructed which may + // happen when loading. This leads to accessibility broadcasts which + // throw asserts due to the not finished view. All this chan be avoided + // since xC->setVisible is here called only for the side effect in + // UnoControlContainer::setVisible(...) which calls createPeer(...). + // This will now be called directly from here. + + // UnoContainerModel erzeugen + // uno::Reference< awt::XWindow > xC(xControlContainer, uno::UNO_QUERY); + // CreateControlContainer() is only used from + // , thus it seems not necessary to make + // it visible her at all. + // #58917# Das Show darf nicht am VCL-Fenster landen, weil dann Assertion vom SFX + // BOOL bVis = pWindow->IsVisible(); + // xC->setVisible(TRUE); + // if ( !bVis ) + // pWindow->Hide(); + // if( !mxContext.is() && bVisible ) + // // Es ist ein TopWindow, also automatisch anzeigen + // createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () ); + +/*N*/ uno::Reference< awt::XControl > xControl(xControlContainer, uno::UNO_QUERY); +/*N*/ if(xControl.is()) +/*N*/ { +/*N*/ uno::Reference< uno::XInterface > xContext = xControl->getContext(); +/*N*/ if(!xContext.is()) +/*N*/ { +/*N*/ xControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ // Printer und VirtualDevice, bzw. kein OutDev +/*?*/ uno::Reference< lang::XMultiServiceFactory > xFactory( ::legacy_binfilters::getLegacyProcessServiceFactory() ); +/*?*/ if( xFactory.is() ) +/*?*/ { +/*?*/ xControlContainer = uno::Reference< awt::XControlContainer >(xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainer")), uno::UNO_QUERY); +/*?*/ uno::Reference< awt::XControlModel > xModel(xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainerModel")), uno::UNO_QUERY); +/*?*/ uno::Reference< awt::XControl > xControl(xControlContainer, uno::UNO_QUERY); +/*?*/ if (xControl.is()) +/*?*/ xControl->setModel(xModel); +/*?*/ +/*?*/ Point aPosPix; +/*?*/ Size aSizePix; +/*?*/ +/*?*/ if ( pOutDev ) +/*?*/ { +/*?*/ aPosPix = pOutDev->GetMapMode().GetOrigin(); +/*?*/ aSizePix = pOutDev->GetOutputSizePixel(); +/*?*/ } +/*?*/ +/*?*/ uno::Reference< awt::XWindow > xContComp(xControlContainer, uno::UNO_QUERY); +/*?*/ if( xContComp.is() ) +/*?*/ xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ rView.InsertControlContainer(xControlContainer); +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrPageViewWinRec::MatchOutputDevice(OutputDevice* pOut) const +/*N*/ { +/*N*/ BOOL bMatch = FALSE; +/*N*/ +/*N*/ if (pOutDev == pOut) +/*N*/ { +/*N*/ bMatch = TRUE; +/*N*/ } +/*N*/ +/*N*/ return (bMatch); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ DBG_NAME(SdrPageView) + + +/*N*/ SdrPageView::SdrPageView(SdrPage* pPage1, const Point& rOffs, SdrView& rNewView): +/*N*/ rView(rNewView), +/*N*/ //aRedraw(1024,16,16), +/*N*/ aOfs(rOffs), +/*N*/ pPaintingPageObj( NULL ), +/*N*/ maDocumentColor( COL_AUTO ) // #103911# col_auto color lets the view takes the default SvxColorConfig entry +/*N*/ { +/*N*/ DBG_CTOR(SdrPageView,NULL); +/*N*/ pDragPoly0=new XPolyPolygon; +/*N*/ pDragPoly=new XPolyPolygon; +/*N*/ pWinList=new SdrPageViewWinList; +/*N*/ pPage=pPage1; +/*N*/ if (pPage!=NULL) { +/*N*/ aPgOrg.X()=pPage->GetLftBorder(); +/*N*/ aPgOrg.Y()=pPage->GetUppBorder(); +/*N*/ } +/*N*/ // aOut.SetOutDev(rView.pWin); +/*N*/ // aOut.SetOffset(rOffs); +/*N*/ // eDrwStat=RS_READY; +/*N*/ bHasMarked=FALSE; +/*N*/ //aDragPoly.Clear(); +/*N*/ aLayerVisi.SetAll(); +/*N*/ aLayerPrn.SetAll(); +/*N*/ bVisible=FALSE; +/*N*/ +/*N*/ pAktList = NULL; +/*N*/ pAktGroup = NULL; +/*N*/ SetAktGroupAndList(NULL, pPage); +/*N*/ +/*N*/ StartListening(*rNewView.GetModel()); +/*N*/ USHORT nWinAnz=rNewView.GetWinCount(); +/*N*/ for (USHORT nWinNum=0; nWinNum<nWinAnz; nWinNum++) { +/*N*/ AddWin(rNewView.GetWin(nWinNum)); +/*N*/ } +/*N*/ } + + +/*N*/ SdrPageView::~SdrPageView() +/*N*/ { +/*N*/ if (rView.GetModel()->GetPaintingPageView() == this) +/*N*/ { + // Abmelden +/*?*/ rView.GetModel()->SetPaintingPageView(NULL); +/*N*/ } +/*N*/ +/*N*/ DBG_DTOR(SdrPageView,NULL); +/*N*/ delete pWinList; +/*N*/ delete pDragPoly0; +/*N*/ delete pDragPoly; +/*N*/ } + +/*N*/ SdrPageViewWinRec* SdrPageView::ImpMakePageViewWinRec(OutputDevice* pOut) +/*N*/ { +/*N*/ // MIB 3.7.08: Das WinRec muss sofort in die Liste eingetragen werden, +/*N*/ // weil sich das InsertControlContainer darauf verlaesst +/*N*/ SdrPageViewWinRec* pRec = new SdrPageViewWinRec( *this, pOut ); +/*N*/ pWinList->Insert(pRec); +/*N*/ +/*N*/ ULONG nObjAnz=pPage!=NULL?pPage->GetObjCount():0; +/*N*/ +/*N*/ for (ULONG nObjNum=0; nObjNum<nObjAnz; nObjNum++) +/*N*/ { +/*N*/ SdrObject* pObj = pPage->GetObj(nObjNum); +/*N*/ +/*N*/ if (pObj->IsUnoObj()) +/*N*/ { +/*N*/ SdrUnoObj* pSdrUnoObj = PTR_CAST(SdrUnoObj, pObj); +/*N*/ ImpInsertControl(pSdrUnoObj, pRec); +/*N*/ } +/*N*/ else if (pObj->GetObjIdentifier() == OBJ_GRUP && +/*N*/ pObj->GetObjInventor() == SdrInventor) +/*N*/ { +/*N*/ // Gruppenobjekt: sind Uno-Objekte enthalten? +/*N*/ SdrObjListIter aIter(*((SdrObjGroup*) pObj)->GetSubList(), IM_DEEPNOGROUPS); +/*N*/ +/*N*/ SdrObject* pObj = NULL; +/*N*/ +/*N*/ while (aIter.IsMore()) +/*N*/ { +/*N*/ pObj = aIter.Next(); +/*N*/ +/*N*/ if (pObj && pObj->IsUnoObj()) +/*N*/ { +/*?*/ SdrUnoObj* pSdrUnoObj = PTR_CAST(SdrUnoObj, pObj); +/*?*/ ImpInsertControl(pSdrUnoObj, pRec); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return pRec; +/*N*/ } + +/*N*/ void SdrPageView::AddWin(OutputDevice* pOutDev) +/*N*/ { +/*N*/ USHORT nPos = pWinList->Find(pOutDev); +/*N*/ +/*N*/ if (nPos == SDRPAGEVIEWWIN_NOTFOUND) +/*N*/ SdrPageViewWinRec* pWinRec = ImpMakePageViewWinRec(pOutDev); +/*N*/ } + +/*N*/ void SdrPageView::DelWin(OutputDevice* pOutDev) +/*N*/ { +/*N*/ USHORT nPos=pWinList->Find(pOutDev); +/*N*/ +/*N*/ if (nPos != SDRPAGEVIEWWIN_NOTFOUND) +/*N*/ { +/*N*/ pWinList->Delete(nPos); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPageView::ImpInsertControl(const SdrUnoObj* pSdrUnoObj, +/*N*/ SdrPageViewWinRec* pRec) +/*N*/ { +/*N*/ if (pSdrUnoObj) +/*N*/ { +/*N*/ uno::Reference< awt::XControlModel > xUnoControlModel(pSdrUnoObj->GetUnoControlModel()); +/*N*/ if (!xUnoControlModel.is()) +/*N*/ return; +/*N*/ +/*N*/ USHORT nCtrlNum = pRec->aControlList.Find(xUnoControlModel); +/*N*/ if (nCtrlNum == SDRUNOCONTROL_NOTFOUND) +/*N*/ { +/*N*/ // Control fuer die View erzeugen +/*N*/ uno::Reference< lang::XMultiServiceFactory > xFactory( ::legacy_binfilters::getLegacyProcessServiceFactory() ); +/*N*/ uno::Reference< awt::XControl > xUnoControl; +/*N*/ if( xFactory.is() ) +/*N*/ xUnoControl = uno::Reference< awt::XControl >(xFactory->createInstance(pSdrUnoObj->GetUnoControlTypeName()), uno::UNO_QUERY); +/*N*/ +/*N*/ if (xUnoControl.is()) +/*N*/ { +/*N*/ xUnoControl->setModel(xUnoControlModel); +/*N*/ if (pRec->pOutDev->GetOutDevType() != OUTDEV_WINDOW) +/*N*/ { +/*?*/ uno::Reference< awt::XView > xView = xUnoControl->getView(); +/*?*/ if (xView.is()) +/*?*/ { +/*?*/ // xView->setGraphics(pRec->pOutDev->GetGraphicsInterface(TRUE)); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ // ControlContainer ggf. erzeugen +/*N*/ pRec->CreateControlContainer(); +/*N*/ +/*N*/ // xControl in ControlContainer einfuegen (Eigentuemer-Uebergang) +/*N*/ if (pRec->GetControlContainerRef().is()) +/*N*/ { +/*N*/ uno::Reference< awt::XWindow > xWindow(xUnoControl, uno::UNO_QUERY); +/*N*/ if (xWindow.is()) +/*N*/ { +/*N*/ Rectangle aRect(pSdrUnoObj->GetLogicRect()); +/*N*/ Point aPixPos(pRec->pOutDev->LogicToPixel(aRect.TopLeft())); +/*N*/ Size aPixSize(pRec->pOutDev->LogicToPixel(aRect.GetSize())); +/*N*/ xWindow->setPosSize(aPixPos.X(), aPixPos.Y(), aPixSize.Width(), aPixSize.Height(), awt::PosSize::POSSIZE); +/*N*/ } +/*N*/ +/*N*/ // set the correct zoom +/*N*/ if (!GetView().IsDesignMode()) +/*N*/ { +/*N*/ uno::Reference< awt::XView > xView(xUnoControl, uno::UNO_QUERY); +/*N*/ if (xView.is()) +/*N*/ { +/*N*/ const MapMode& rMap = pRec->pOutDev->GetMapMode(); +/*N*/ xView->setZoom((float) double(rMap.GetScaleX()), +/*N*/ (float) double(rMap.GetScaleY())); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // #107049# set design mode before peer is created, +/*N*/ // this is also needed for accessibility +/*N*/ xUnoControl->setDesignMode(GetView().IsDesignMode()); +/*N*/ +/*N*/ SdrUnoControlRec* pUCR = new SdrUnoControlRec(&pRec->aControlList, (SdrUnoObj*)pSdrUnoObj, xUnoControl); +/*N*/ pRec->aControlList.Insert(pUCR); +/*N*/ +/*N*/ // #108327# do this last - the addition of the control triggeres processes which rely +/*N*/ // on the control already being inserted into the aControlList +/*N*/ pRec->GetControlContainerRef()->addControl(pSdrUnoObj->GetUnoControlTypeName(), xUnoControl); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPageView::ImpUnoInserted(const SdrObject* pObj) +/*N*/ { +/*N*/ SdrUnoObj* pSdrUnoObj = (SdrUnoObj*)pObj; +/*N*/ USHORT nPos = pWinList->GetCount(); +/*N*/ +/*N*/ for (; nPos; ) +/*N*/ ImpInsertControl(pSdrUnoObj, &(*pWinList)[--nPos]); +/*N*/ +/*N*/ } + + + +/*N*/ void __EXPORT SdrPageView::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ if (bVisible) { +/*N*/ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); +/*N*/ if (pSdrHint!=NULL) { +/*N*/ SdrHintKind eKind=pSdrHint->GetKind(); +/*N*/ const SdrObject* pObj=pSdrHint->GetObject(); +/*N*/ if ( pObj!=NULL && pObj->GetPage() == pPage ) +/*N*/ { +/*N*/ if (pObj->IsUnoObj()) +/*N*/ { +/*N*/ if (eKind == HINT_OBJINSERTED || +/*N*/ eKind == HINT_CONTROLINSERTED) +/*N*/ { +/*N*/ ImpUnoInserted(pObj); +/*N*/ } +/*N*/ else if (eKind == HINT_OBJREMOVED || +/*N*/ eKind == HINT_CONTROLREMOVED) +/*N*/ +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ImpUnoRemoved(pObj); +/*N*/ } +/*N*/ } +/*N*/ else if (pObj->GetObjIdentifier() == OBJ_GRUP && +/*N*/ pObj->GetObjInventor() == SdrInventor) +/*N*/ { +/*N*/ // Gruppenobjekt: sind Uno-Objekte enthalten? +/*N*/ SdrObjListIter aIter(*((SdrObjGroup*) pObj)->GetSubList(), IM_DEEPNOGROUPS); +/*N*/ +/*N*/ SdrObject* pObj = NULL; +/*N*/ +/*N*/ while (aIter.IsMore()) +/*N*/ { +/*N*/ pObj = aIter.Next(); +/*N*/ +/*N*/ if (pObj && pObj->IsUnoObj()) +/*N*/ { +/*?*/ if (eKind == HINT_OBJINSERTED || +/*?*/ eKind == HINT_CONTROLINSERTED) +/*?*/ +/*?*/ { +/*?*/ ImpUnoInserted(pObj); +/*?*/ } +/*?*/ else if (eKind == HINT_OBJREMOVED || +/*?*/ eKind == HINT_CONTROLREMOVED) +/*?*/ +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ImpUnoRemoved(pObj); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (pSdrHint->IsNeedRepaint()) { +/*N*/ if (((eKind==HINT_OBJCHG +/*N*/ || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED +/*N*/ || eKind == HINT_CONTROLINSERTED || eKind == HINT_CONTROLREMOVED) && +/*N*/ pSdrHint->GetPage()!=NULL) || +/*N*/ eKind==HINT_PAGECHG) +/*N*/ { +/*N*/ FASTBOOL bInv=FALSE; +/*N*/ if (pSdrHint->GetPage()==pPage) bInv=TRUE; +/*N*/ else if (pSdrHint->GetPage()->IsMasterPage()) { // ebenfalls Invalidate, wenn pPage die geaenderte Page als MasterPage referenziert +/*N*/ USHORT nMaPgAnz=pPage!=NULL?pPage->GetMasterPageCount():0; +/*N*/ for (USHORT i=0; i<nMaPgAnz && !bInv; i++) { +/*N*/ const SdrPage* pMPg=pPage->GetMasterPage(i); +/*N*/ bInv=pMPg==pSdrHint->GetPage(); +/*N*/ } +/*N*/ } +/*N*/ if (bInv) { +/*N*/ InvalidateAllWin(pSdrHint->GetRect(),TRUE); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (eKind==HINT_OBJLISTCLEARED && pSdrHint->GetPage()==pPage) { +/*?*/ if (GetAktGroup()!=NULL) { +/*?*/ rView.UnmarkAllObj(); +/*?*/ LeaveAllGroup(); +/*?*/ //pWinList ... +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPageView::ModelHasChanged() +/*N*/ { +/*N*/ if (GetAktGroup()!=NULL) CheckAktGroup(); +/*N*/ } + + + + +/*N*/ void SdrPageView::Show() +/*N*/ { +/*N*/ if (!bVisible) { +/*N*/ bVisible=TRUE; +/*N*/ InvalidateAllWin(); +/*N*/ USHORT nWinAnz=rView.GetWinCount(); +/*N*/ for (USHORT nWinNum=0; nWinNum<nWinAnz; nWinNum++) { +/*N*/ AddWin(rView.GetWin(nWinNum)); +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPageView::Hide() +/*N*/ { +/*N*/ if (bVisible) { +/*N*/ InvalidateAllWin(); +/*N*/ bVisible=FALSE; +/*N*/ pWinList->Clear(); +/*N*/ } +/*N*/ } + + + + +/*N*/ Rectangle SdrPageView::GetPageRect() const +/*N*/ { +/*N*/ if (pPage==NULL) return Rectangle(); +/*N*/ return Rectangle(GetOffset(),Size(pPage->GetWdt()+1,pPage->GetHgt()+1)); +/*N*/ } + + +/*N*/ void SdrPageView::InvalidateAllWin() +/*N*/ { +/*N*/ if (bVisible && pPage!=NULL) { +/*N*/ Rectangle aRect(Point(0,0),Size(pPage->GetWdt()+1,pPage->GetHgt()+1)); +/*N*/ aRect.Union(pPage->GetAllObjBoundRect()); +/*N*/ aRect.Move(aOfs.X(),aOfs.Y()); +/*N*/ rView.InvalidateAllWin(aRect); +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPageView::InvalidateAllWin(const Rectangle& rRect, FASTBOOL bPlus1Pix) +/*N*/ { +/*N*/ if (bVisible) { +/*N*/ rView.InvalidateAllWin(rRect+GetOffset(),bPlus1Pix); +/*N*/ } +/*N*/ } + +#ifdef OS2 +#define RGBCOLOR(r,g,b) ((ULONG)(((BYTE)(b) | ((USHORT)(g)<<8)) | (((ULONG)(BYTE)(r))<<16))) +#endif + +/*N*/ FASTBOOL SdrPageView::IsLayer(const XubString& rName, const SetOfByte& rBS) const +/*N*/ { +/*N*/ if(!pPage) +/*N*/ return FALSE; +/*N*/ +/*N*/ BOOL bRet(FALSE); +/*N*/ +/*N*/ if(rName.Len()) +/*N*/ { +/*N*/ SdrLayerID nId = pPage->GetLayerAdmin().GetLayerID(rName, TRUE); +/*N*/ +/*N*/ if(nId != SDRLAYER_NOTFOUND) +/*N*/ { +/*N*/ bRet = rBS.IsSet(nId); +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ FASTBOOL SdrPageView::IsObjMarkable(SdrObject* pObj) const +/*N*/ { +/*N*/ if(pObj) +/*N*/ { +/*N*/ // Vom Markieren ausgeschlossen? +/*N*/ if(pObj->IsMarkProtect()) +/*N*/ return FALSE; +/*N*/ +/*N*/ // Der Layer muss sichtbar und darf nicht gesperrt sein +/*N*/ SdrLayerID nL = pObj->GetLayer(); +/*N*/ return aLayerVisi.IsSet(BYTE(nL)) && !aLayerLock.IsSet(BYTE(nL)); +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +// Betretene Gruppe und Liste setzen +/*N*/ void SdrPageView::SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList) +/*N*/ { +/*N*/ if(pAktGroup != pNewGroup) +/*N*/ { +/*?*/ pAktGroup = pNewGroup; +/*N*/ } +/*N*/ if(pAktList != pNewList) +/*N*/ { +/*N*/ pAktList = pNewList; +/*N*/ } +/*N*/ } + + + + +/*N*/ void SdrPageView::LeaveAllGroup() +/*N*/ { +/*N*/ if(GetAktGroup()) +/*N*/ { +/*?*/ BOOL bDisInvalidate = (rView.pDisabledAttr != NULL); +/*?*/ BOOL bGlueInvalidate = (!bDisInvalidate && rView.ImpIsGlueVisible()); +/*?*/ +/*?*/ if(bGlueInvalidate) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 rView.GlueInvalidate(); +/*?*/ +/*?*/ SdrObject* pLastGroup = GetAktGroup(); +/*?*/ +/*?*/ // Alles deselektieren +/*?*/ rView.UnmarkAll(); +/*?*/ +/*?*/ // Zuweisungen, pAktGroup und pAktList muessen gesetzt sein +/*?*/ SetAktGroupAndList(NULL, pPage); +/*?*/ +/*?*/ // Oberste letzte Gruppe finden und selektieren +/*?*/ if(pLastGroup) +/*?*/ { +/*?*/ while(pLastGroup->GetUpGroup()) +/*?*/ pLastGroup = pLastGroup->GetUpGroup(); +/*?*/ +/*?*/ for(UINT16 nv = 0; nv < rView.GetPageViewCount(); nv++) +/*?*/ rView.MarkObj(pLastGroup, rView.GetPageViewPvNum(nv)); +/*?*/ } +/*?*/ +/*?*/ rView.AdjustMarkHdl(); +/*?*/ +/*?*/ // invalidate only when view wants to visualize group entering +/*?*/ if(rView.DoVisualizeEnteredGroup()) +/*?*/ InvalidateAllWin(); +/*?*/ +/*?*/ if(bGlueInvalidate) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 rView.GlueInvalidate(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPageView::CheckAktGroup() +/*N*/ { +/*N*/ SdrObject* pGrp=GetAktGroup(); +/*N*/ while (pGrp!=NULL && +/*N*/ (!pGrp->IsInserted() || pGrp->GetObjList()==NULL || +/*N*/ pGrp->GetPage()==NULL || pGrp->GetModel()==NULL)) { // irgendwas daneben? +/*N*/ pGrp=pGrp->GetUpGroup(); +/*N*/ } +/*N*/ if (pGrp!=GetAktGroup()) { +/*?*/ if (pGrp!=NULL) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 EnterGroup(pGrp); +/*N*/ else LeaveAllGroup(); +/*N*/ } +/*N*/ } + + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrPageView& rPageView) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOPgVwID); +/*N*/ { +/*N*/ if (rPageView.pPage!=NULL) { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_PAGVIEW); +/*N*/ rOut<<BOOL(rPageView.bVisible); +/*N*/ rOut<<BOOL(rPageView.pPage->IsMasterPage()); +/*N*/ rOut<<rPageView.pPage->GetPageNum(); +/*N*/ rOut<<rPageView.aOfs; +/*N*/ rOut<<rPageView.aPgOrg; +/*N*/ } +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_PAGVLAYER); +/*N*/ rOut<<rPageView.aLayerVisi; +/*N*/ rOut<<rPageView.aLayerLock; +/*N*/ rOut<<rPageView.aLayerPrn; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_PAGVHELPLINES); +/*N*/ rOut<<rPageView.aHelpLines; +/*N*/ } +/*N*/ //if (GetAktGroup()!=NULL) { +/*N*/ // // ... +/*N*/ // //rOut<<aAktGroup; +/*N*/ //} +/*N*/ return rOut; +/*N*/ } + + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrPageView& rPageView) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ while (aHead.GetBytesLeft()>0 && rIn.GetError()==0 && !rIn.IsEof()) { +/*N*/ SdrNamedSubRecord aSubRecord(rIn,STREAM_READ); +/*N*/ if (aSubRecord.GetInventor()==SdrInventor) { +/*N*/ switch (aSubRecord.GetIdentifier()) { +/*N*/ case SDRIORECNAME_PAGVIEW: { +/*N*/ BOOL bVisible; +/*N*/ BOOL bMaster; +/*N*/ USHORT nPgNum; +/*N*/ rIn>>bVisible; +/*N*/ rPageView.bVisible=bVisible; +/*N*/ rIn>>bMaster; +/*N*/ rIn>>nPgNum; +/*N*/ rIn>>rPageView.aOfs; +/*N*/ rIn>>rPageView.aPgOrg; +/*N*/ SdrModel* pMod=rPageView.GetView().GetModel(); +/*N*/ if (!bMaster) rPageView.pPage=pMod->GetPage(nPgNum); +/*N*/ else rPageView.pPage=pMod->GetMasterPage(nPgNum); +/*N*/ rPageView.pAktList=rPageView.pPage; +/*N*/ } break; +/*N*/ case SDRIORECNAME_PAGVLAYER: { +/*N*/ rIn>>rPageView.aLayerVisi; +/*N*/ rIn>>rPageView.aLayerLock; +/*N*/ rIn>>rPageView.aLayerPrn; +/*N*/ } break; +/*N*/ case SDRIORECNAME_PAGVHELPLINES: { +/*N*/ rIn>>rPageView.aHelpLines; +/*N*/ } break; +/*N*/ case SDRIORECNAME_PAGVAKTGROUP: { +/*N*/ //rIn>>aAktGroup; fehlende Implementation! +/*N*/ } break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return rIn; +/*N*/ } + +// #103834# Set background color for svx at SdrPageViews + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdpntv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdpntv.cxx new file mode 100644 index 000000000000..a06a6ca90d87 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdpntv.cxx @@ -0,0 +1,997 @@ +/* -*- 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/awt/XWindow.hpp> +#include <com/sun/star/awt/PosSize.hpp> + +#include "svdpagv.hxx" +#include "svdpage.hxx" +#include "svdvmark.hxx" +#include "svdio.hxx" +#include "svdview.hxx" +#include "svdograf.hxx" +#include "svdouno.hxx" + + + +#include <bf_svtools/whiter.hxx> + + + +#include <bf_svtools/style.hxx> + + + + +#include "xoutx.hxx" + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FrameAnimator::FrameAnimator(SdrView& rNewView): +/*N*/ rView(rNewView) +/*N*/ { +/*N*/ aTim.SetTimeoutHdl(LINK(this,FrameAnimator,Hdl)); +/*N*/ aTim.SetTimeout(50); +/*N*/ pOut=NULL; +/*N*/ } + + + +/*N*/ IMPL_LINK(FrameAnimator,Hdl,AutoTimer*,pTim) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return 0; +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//#define TEST_IAO + +/*N*/ SdrViewWinRec::SdrViewWinRec(OutputDevice* pW) +/*N*/ : pWin(pW), +/*N*/ // pVDev(NULL), +//STRIP012/*N*/ pIAOManager(NULL), +/*N*/ bXorVisible(FALSE) +/*N*/ { +/*N*/ // is it a window? +/*N*/ if(pW && pW->GetOutDevType() == OUTDEV_WINDOW) +/*N*/ { +/*N*/ // create B2dIAOManager for this window +//STRIP012/*N*/ pIAOManager = new B2dIAOManager((Window*)pW); +//STRIP012#ifdef TEST_IAO +//STRIP012/*?*/ if(pIAOManager) +//STRIP012/*?*/ { +//STRIP012/*?*/ // create some demo shapes +//STRIP012/*?*/ B2dIAOLine* pLine; +//STRIP012/*?*/ B2dIAOMarker* pMarker; +//STRIP012/*?*/ B2dIAOBitmapObj* pBitmap; +//STRIP012/*?*/ B2dIAOTriangle* pTriangle; +//STRIP012/*?*/ +//STRIP012/*?*/ static BOOL bCreateLines = FALSE; +//STRIP012/*?*/ static BOOL bCreateMarkers = FALSE; +//STRIP012/*?*/ static BOOL bCreateField = FALSE; +//STRIP012/*?*/ static BOOL bCreateSingleMarker = FALSE; +//STRIP012/*?*/ static BOOL bCreateBitmap = FALSE; +//STRIP012/*?*/ static BOOL bCreateBitmapField = FALSE; +//STRIP012/*?*/ static BOOL bCreateTriangle = FALSE; +//STRIP012/*?*/ +//STRIP012/*?*/ if(bCreateLines) +//STRIP012/*?*/ { +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, Point(5000, 5200), Point(5000, 7000)); +//STRIP012/*?*/ pLine->SetBaseColor(Color(COL_CYAN)); +//STRIP012/*?*/ pLine = new B2dIAOLineStriped(pIAOManager, Point(5100, 5200), Point(5100, 7000)); +//STRIP012/*?*/ pLine->SetBaseColor(Color(COL_BLUE)); +//STRIP012/*?*/ B2dIAOLineTwoColor* p2Line = new B2dIAOLineTwoColor(pIAOManager, Point(5200, 5200), Point(5200, 7000)); +//STRIP012/*?*/ p2Line->SetBaseColor(Color(COL_YELLOW)); +//STRIP012/*?*/ p2Line->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ B2dIAOLineTwoColorAnim* p3Line = new B2dIAOLineTwoColorAnim(pIAOManager, Point(5300, 5200), Point(5300, 7000)); +//STRIP012/*?*/ p3Line->SetBaseColor(Color(COL_YELLOW)); +//STRIP012/*?*/ p3Line->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ } +//STRIP012/*?*/ +//STRIP012/*?*/ if(bCreateMarkers) +//STRIP012/*?*/ { +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5000, 5000), B2D_IAO_MARKER_POINT); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTRED)); +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5100, 5000), B2D_IAO_MARKER_PLUS); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTGREEN)); +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5200, 5000), B2D_IAO_MARKER_CROSS); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTBLUE)); +//STRIP012/*?*/ +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5000, 5100), B2D_IAO_MARKER_RECT_5X5); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTGREEN)); +//STRIP012/*?*/ pMarker->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5100, 5100), B2D_IAO_MARKER_RECT_7X7); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTGREEN)); +//STRIP012/*?*/ pMarker->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5200, 5100), B2D_IAO_MARKER_RECT_9X9); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTGREEN)); +//STRIP012/*?*/ pMarker->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ } +//STRIP012/*?*/ +//STRIP012/*?*/ if(bCreateField || bCreateBitmapField) +//STRIP012/*?*/ { +//STRIP012/*?*/ static UINT16 nNumX = 10; +//STRIP012/*?*/ static UINT16 nNumY = 10; +//STRIP012/*?*/ static UINT16 nStart = 2000; +//STRIP012/*?*/ static UINT16 nEnd = 16000; +//STRIP012/*?*/ +//STRIP012/*?*/ for(UINT16 a=nStart;a<nEnd;a+=(nEnd-nStart)/nNumX) +//STRIP012/*?*/ { +//STRIP012/*?*/ for(UINT16 b=nStart;b<nEnd;b+=(nEnd-nStart)/nNumY) +//STRIP012/*?*/ { +//STRIP012/*?*/ if(bCreateField) +//STRIP012/*?*/ { +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(a, b), B2D_IAO_MARKER_RECT_7X7); +//STRIP012/*?*/ pMarker->SetBaseColor(Color( +//STRIP012/*?*/ (((a-nStart)*256L)/(nEnd-nStart)), +//STRIP012/*?*/ (((b-nStart)*256L)/(nEnd-nStart)), +//STRIP012/*?*/ 0x80)); +//STRIP012/*?*/ pMarker->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ } +//STRIP012/*?*/ if(bCreateBitmapField) +//STRIP012/*?*/ { +//STRIP012/*?*/ Bitmap aBitmap(Size(10, 10), 8); +//STRIP012/*?*/ pBitmap = new B2dIAOBitmapObj(pIAOManager, Point(a, b), aBitmap); +//STRIP012/*?*/ } +//STRIP012/*?*/ } +//STRIP012/*?*/ } +//STRIP012/*?*/ } +//STRIP012/*?*/ if(bCreateSingleMarker) +//STRIP012/*?*/ { +//STRIP012/*?*/ pMarker = new B2dIAOMarker(pIAOManager, Point(5000, 5000), B2D_IAO_MARKER_RECT_7X7); +//STRIP012/*?*/ pMarker->SetBaseColor(Color(COL_LIGHTGREEN)); +//STRIP012/*?*/ pMarker->Set2ndColor(Color(COL_BLACK)); +//STRIP012/*?*/ } +//STRIP012/*?*/ if(bCreateBitmap) +//STRIP012/*?*/ { +//STRIP012/*?*/ Bitmap aBitmap(Size(10, 10), 8); +//STRIP012/*?*/ pBitmap = new B2dIAOBitmapObj(pIAOManager, Point(6000, 6000), aBitmap); +//STRIP012/*?*/ } +//STRIP012/*?*/ if(bCreateTriangle) +//STRIP012/*?*/ { +//STRIP012/*?*/ pTriangle = new B2dIAOTriangle(pIAOManager, Point(5000, 5000), Point(7000, 5000), Point(6000, 7000), Color(COL_YELLOW)); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->GetBasePosition(), pTriangle->Get2ndPosition()); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->Get2ndPosition(), pTriangle->Get3rdPosition()); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->Get3rdPosition(), pTriangle->GetBasePosition()); +//STRIP012/*?*/ +//STRIP012/*?*/ pTriangle = new B2dIAOBitmapTriangle(pIAOManager, Point(8000, 5000), Point(10000, 5000), Point(9000, 7000), Color(COL_RED)); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->GetBasePosition(), pTriangle->Get2ndPosition()); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->Get2ndPosition(), pTriangle->Get3rdPosition()); +//STRIP012/*?*/ pLine = new B2dIAOLine(pIAOManager, pTriangle->Get3rdPosition(), pTriangle->GetBasePosition()); +//STRIP012/*?*/ } +//STRIP012/*?*/ } +//STRIP012#endif +/*N*/ } +/*N*/ } + +/*N*/ SdrViewWinRec::~SdrViewWinRec() +/*N*/ { +/*N*/ // if (pVDev!=NULL) +/*N*/ // delete pVDev; +/*N*/ +/*N*/ // cleanup IAOManager for this window +//STRIP012/*N*/ if(pIAOManager) +//STRIP012/*N*/ delete pIAOManager; +//STRIP012/*N*/ pIAOManager = NULL; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrViewWinList::Clear() +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ delete GetObject(i); +/*N*/ } +/*N*/ aList.Clear(); +/*N*/ } + +/*N*/ USHORT SdrViewWinList::Find(OutputDevice* pW) const +/*N*/ { +/*N*/ USHORT nAnz=GetCount(); +/*N*/ USHORT nRet=SDRVIEWWIN_NOTFOUND; +/*N*/ for (USHORT nNum=0; nNum<nAnz && nRet==SDRVIEWWIN_NOTFOUND; nNum++) { +/*N*/ if (GetObject(nNum)->pWin==pW) nRet=nNum; +/*N*/ } +/*N*/ return nRet; +/*N*/ } + +//------------------------------------------------------------------------ + +/*N*/ TYPEINIT1( SvxViewHint, SfxSimpleHint ); +/*N*/ +/*N*/ SvxViewHint::SvxViewHint( ULONG _nId ) : +/*N*/ SfxSimpleHint( _nId ) +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@ @@@@ @@ @@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@ @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@@@@@ @@ @@ @@ @@ @@ @@ @ @@ +// @@@@@ @@@@@@ @@ @@@@@@ @@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@ @@ @@ @@@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ TYPEINIT2(SdrPaintView,SfxListener,SfxRepeatTarget); + +/*N*/ DBG_NAME(SdrPaintView) + +/*N*/ void SdrPaintView::ImpClearVars() +/*N*/ { +/*N*/ pXOut=NULL; +/*N*/ bForeignXOut=FALSE; +/*N*/ pItemBrowser=NULL; +/*N*/ bLayerSortedRedraw=FALSE; +/*N*/ bPageVisible=TRUE; +/*N*/ bPageBorderVisible=TRUE; +/*N*/ bBordVisible=TRUE; +/*N*/ bGridVisible=TRUE; +/*N*/ bGridFront =FALSE; +/*N*/ bHlplVisible=TRUE; +/*N*/ bHlplFront =TRUE; +/*N*/ bGlueVisible=FALSE; +/*N*/ bGlueVisible2=FALSE; +/*N*/ bGlueVisible3=FALSE; +/*N*/ bGlueVisible4=FALSE; +/*N*/ bSwapAsynchron=FALSE; +/*N*/ bPrintPreview=FALSE; +/*N*/ bLineDraft=FALSE; +/*N*/ bFillDraft=FALSE; +/*N*/ bGrafDraft=FALSE; +/*N*/ bHideGrafDraft=FALSE; +/*N*/ bTextDraft=FALSE; +/*N*/ bLineDraftPrn=FALSE; +/*N*/ bFillDraftPrn=FALSE; +/*N*/ bGrafDraftPrn=FALSE; +/*N*/ bTextDraftPrn=FALSE; +/*N*/ +/*N*/ bObjectPaintIgnoresClipping=FALSE; +/*N*/ +/*N*/ eAnimationMode = SDR_ANIMATION_ANIMATE; +/*N*/ bAnimationPause = FALSE; +/*N*/ +/*N*/ nHitTolPix=2; +/*N*/ nMinMovPix=3; +/*N*/ nHitTolLog=0; +/*N*/ nMinMovLog=0; +/*N*/ pActualOutDev=NULL; +/*N*/ +/*N*/ bSaveHiddenPages=FALSE; +/*N*/ bPageTwice=FALSE; +/*N*/ pDragWin=NULL; +/*N*/ bRestoreColors=TRUE; +/*N*/ pDisabledAttr=NULL; +/*N*/ pDefaultStyleSheet=NULL; +/*N*/ bEncircle=FALSE; +/*N*/ bSomeObjChgdFlag=FALSE; +/*N*/ +/*N*/ bMasterBmp=FALSE; +/*N*/ pMasterBmp=NULL; +/*N*/ nMasterCacheMode = SDR_MASTERPAGECACHE_DEFAULT; +/*N*/ +/*N*/ nGraphicManagerDrawMode = GRFMGR_DRAW_STANDARD; +/*N*/ +/*N*/ aComeBackTimer.SetTimeout(1); +/*N*/ aComeBackTimer.SetTimeoutHdl(LINK(this,SdrPaintView,ImpComeBackHdl)); +/*N*/ aAfterPaintTimer.SetTimeout(1); +/*N*/ aAfterPaintTimer.SetTimeoutHdl(LINK(this,SdrPaintView,ImpAfterPaintHdl)); +/*N*/ aUserMarkerAnimator.SetTimeout(50); +/*N*/ aUserMarkerAnimator.SetTimeoutHdl(LINK(this,SdrPaintView,ImpUserMarkerAnimatorHdl)); +/*N*/ +/*N*/ String aNam; // System::GetUserName() just return an empty string +/*N*/ +/*N*/ if (pMod) +/*N*/ SetDefaultStyleSheet(pMod->GetDefaultStyleSheet(), TRUE); +/*N*/ +/*N*/ aNam.ToUpperAscii(); +/*N*/ +/*N*/ maGridColor = Color( COL_BLACK ); +/*N*/ } + + +/*N*/ SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ aPagV(1024,16,16), +/*N*/ aPagHide(1024,16,16), +/*N*/ aAni(*(SdrView*)this), +/*N*/ aDefaultAttr(pModel1->GetItemPool()), +/*N*/ aUserMarkers(1024,16,16) +/*N*/ { +/*N*/ DBG_CTOR(SdrPaintView,NULL); +/*N*/ pMod=pModel1; +/*N*/ ImpClearVars(); +/*N*/ if (pOut!=NULL) AddWin(pOut); +/*N*/ pXOut=new ExtOutputDevice(pOut); +/*N*/ +/*N*/ // Flag zur Visualisierung von Gruppen +/*N*/ bVisualizeEnteredGroup = TRUE; +/*N*/ +/*N*/ StartListening( maColorConfig ); +/*N*/ onChangeColorConfig(); +/*N*/ } + +/*N*/ SdrPaintView::~SdrPaintView() +/*N*/ { +/*N*/ DBG_DTOR(SdrPaintView,NULL); +/*N*/ aAfterPaintTimer.Stop(); +/*N*/ +/*N*/ EndListening( maColorConfig ); +/*N*/ +/*N*/ ClearAll(); +/*N*/ if (!bForeignXOut && pXOut!=NULL) { +/*N*/ delete pXOut; +/*N*/ } +/*N*/ if (pDisabledAttr!=NULL) { +/*?*/ delete pDisabledAttr; +/*N*/ } +/*N*/ if (pMasterBmp!=NULL) { +/*?*/ delete pMasterBmp; +/*N*/ } +/*N*/ #ifndef SVX_LIGHT +/*N*/ if (pItemBrowser!=NULL) { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete pItemBrowser; +/*N*/ } +/*N*/ #endif +/*N*/ USHORT nAnz=ImpGetUserMarkerCount(); +/*N*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*?*/ SdrViewUserMarker* pUM=ImpGetUserMarker(nNum); +/*?*/ pUM->pView=NULL; // Weil's mich gleich nichtmehr gibt. +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void __EXPORT SdrPaintView::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ BOOL bObjChg=!bSomeObjChgdFlag; // TRUE= auswerten fuer ComeBack-Timer +/*N*/ BOOL bMaster=pMasterBmp!=NULL; // TRUE= auswerten fuer MasterPagePaintCache +/*N*/ if (bObjChg || bMaster) { +/*N*/ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); +/*N*/ if (pSdrHint!=NULL) { +/*N*/ SdrHintKind eKind=pSdrHint->GetKind(); +/*N*/ if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) { +/*N*/ if (bObjChg) { +/*N*/ bSomeObjChgdFlag=TRUE; +/*N*/ aComeBackTimer.Start(); +/*N*/ } +/*N*/ if (bMaster) { +/*?*/ const SdrPage* pPg=pSdrHint->GetPage(); +/*?*/ if (pPg!=NULL && pPg->IsMasterPage() && pPg->GetPageNum()==pMasterBmp->GetMasterPageNum()) { +/*?*/ ReleaseMasterPagePaintCache(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (eKind==HINT_PAGEORDERCHG) { +/*N*/ const SdrPage* pPg=pSdrHint->GetPage(); +/*N*/ if (!pPg->IsInserted()) { // aha, Seite geloescht: also hiden +/*N*/ USHORT nAnz=GetPageViewCount(); +/*N*/ USHORT nv; +/*N*/ for (nv=nAnz; nv>0;) { +/*?*/ nv--; +/*?*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*?*/ if (pPV->GetPage()==pPg) { +/*?*/ HidePagePvNum(nv); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if (bMaster) ReleaseMasterPagePaintCache(); +/*N*/ } +/*N*/ if (eKind==HINT_PAGECHG) { +/*N*/ if (bMaster) ReleaseMasterPagePaintCache(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( rHint.ISA( SfxSimpleHint ) && ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_COLORS_CHANGED ) +/*N*/ { +/*?*/ onChangeColorConfig(); +/*?*/ InvalidateAllWin(); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ IMPL_LINK_INLINE_START(SdrPaintView,ImpComeBackHdl,Timer*,pTimer) +/*N*/ { +/*N*/ if (bSomeObjChgdFlag) { +/*N*/ bSomeObjChgdFlag=FALSE; +/*N*/ ModelHasChanged(); +/*N*/ } +/*N*/ return 0; +/*N*/ } + +/*N*/ IMPL_LINK_INLINE_END(SdrPaintView,ImpComeBackHdl,Timer*,pTimer) + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/*?*/ void SdrPaintView::ImpAsyncPaintDone( const SdrObject* pObj ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP");}//STRIP001 +/*?*/ } + +/*N*/ IMPL_LINK(SdrPaintView,ImpAfterPaintHdl,Timer*,pTimer) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return 0; +/*N*/ } + +/*N*/ void SdrPaintView::ModelHasChanged() +/*N*/ { +/*N*/ // Auch alle PageViews benachrichtigen +/*N*/ USHORT nv; +/*N*/ USHORT nAnz; +/*N*/ nAnz=GetPageViewCount(); +/*N*/ for (nv=nAnz; nv>0;) { +/*N*/ nv--; +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ if (!pPV->GetPage()->IsInserted()) { +/*?*/ HidePage(pPV); +/*N*/ } +/*N*/ } +/*N*/ nAnz=GetPageViewCount(); +/*N*/ for (nv=0; nv<nAnz; nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ pPV->ModelHasChanged(); +/*N*/ } +/*N*/ nAnz=GetPageHideCount(); +/*N*/ for (nv=0; nv<nAnz; nv++) { +/*?*/ SdrPageView* pPV=GetPageHidePvNum(nv); +/*?*/ pPV->ModelHasChanged(); +/*N*/ } +/*N*/ #ifndef SVX_LIGHT +/*N*/ if (pItemBrowser!=NULL) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pItemBrowser->SetDirty(); +/*N*/ #endif +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ IMPL_LINK_INLINE_START(SdrPaintView,ImpUserMarkerAnimatorHdl,AutoTimer*,pTimer) +/*N*/ { +/*N*/ USHORT nAnz=ImpGetUserMarkerCount(); +/*N*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*N*/ SdrViewUserMarker* pUM=ImpGetUserMarker(nNum); +/*N*/ if (pUM->IsAnimate() && pUM->IsVisible()) {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pUM->DoAnimateOneStep(); +/*N*/ } +/*N*/ return 0; +/*N*/ } + +/*N*/ IMPL_LINK_INLINE_END(SdrPaintView,ImpUserMarkerAnimatorHdl,AutoTimer*,pTimer) + +/*N*/ void SdrPaintView::ImpInsertUserMarker(SdrViewUserMarker* pMarker) +/*N*/ { +/*N*/ aUserMarkers.Insert(pMarker); +/*N*/ ImpCheckMarkerAnimator(); +/*N*/ } +/*N*/ +/*N*/ void SdrPaintView::ImpRemoveUserMarker(SdrViewUserMarker* pMarker) +/*N*/ { +/*N*/ aUserMarkers.Remove(pMarker); +/*N*/ ImpCheckMarkerAnimator(); +/*N*/ } +/*N*/ +/*N*/ void SdrPaintView::ImpCheckMarkerAnimator() +/*N*/ { +/*N*/ BOOL bNeed=FALSE; +/*N*/ USHORT nAnz=ImpGetUserMarkerCount(); +/*N*/ for (USHORT nNum=0; nNum<nAnz && !bNeed; nNum++) { +/*N*/ SdrViewUserMarker* pUM=ImpGetUserMarker(nNum); +/*N*/ bNeed=pUM->IsAnimate(); +/*N*/ } +/*N*/ if (bNeed) aUserMarkerAnimator.Start(); +/*N*/ else aUserMarkerAnimator.Stop(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrPaintView::IsAction() const +/*N*/ { +/*N*/ return IsEncirclement(); +/*N*/ } + + + + +/*N*/ void SdrPaintView::BrkAction() +/*N*/ { +/*N*/ BrkEncirclement(); +/*N*/ } + + +/*N*/ void SdrPaintView::ToggleShownXor(OutputDevice* pOut, const Region* pRegion) const +/*N*/ { +/*N*/ if (IsEncirclement() && aDragStat.IsShown()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ USHORT nAnz=ImpGetUserMarkerCount(); +/*N*/ for (USHORT nNum=0; nNum<nAnz; nNum++) { +/*N*/ SdrViewUserMarker* pUM=ImpGetUserMarker(nNum); +/*N*/ if (pUM->IsVisible()) {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pUM->Draw(pOut,FALSE,!bRestoreColors); // den 3. Parameter hier noch richtig setzen !!!!! +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::BrkEncirclement() +/*N*/ { +/*N*/ if (IsEncirclement()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::ShowShownXor(OutputDevice* pOut, BOOL bShow) +/*N*/ { +/*N*/ USHORT nAnz=GetWinCount(); +/*N*/ USHORT nw=0; +/*N*/ BOOL bWeiter=TRUE; +/*N*/ do { +/*N*/ if (pOut!=NULL) { +/*N*/ nw=aWinList.Find(pOut); +/*N*/ bWeiter=FALSE; +/*N*/ } +/*N*/ if (nw<nAnz && nw!=SDRVIEWWIN_NOTFOUND) { +/*N*/ BOOL bOn=IsShownXorVisibleWinNum(nw); +/*N*/ if (bOn!=bShow) { +/*N*/ ToggleShownXor(GetWin(nw),NULL); +/*N*/ SetShownXorVisible(nw,bShow); +/*N*/ } +/*N*/ } else bWeiter=FALSE; +/*N*/ } while (bWeiter); +/*N*/ } + +/*N*/ BOOL SdrPaintView::IsShownXorVisible(OutputDevice* pOut) const +/*N*/ { +/*N*/ USHORT nPos=aWinList.Find(pOut); +/*N*/ if (nPos!=SDRVIEWWIN_NOTFOUND) { +/*N*/ return IsShownXorVisibleWinNum(nPos); +/*N*/ } else { +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::ClearPageViews() +/*N*/ { +/*N*/ BrkAction(); +/*N*/ for (USHORT nv=0; nv<GetPageViewCount(); nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ InvalidateAllWin(pPV->GetPageRect()); +/*N*/ delete pPV; +/*N*/ } +/*N*/ aPagV.Clear(); +/*N*/ } + +/*N*/ void SdrPaintView::ClearHideViews() +/*N*/ { +/*N*/ for (USHORT nh=0; nh<GetPageHideCount(); nh++) { +/*?*/ SdrPageView* pPV=GetPageHidePvNum(nh); +/*?*/ delete pPV; +/*N*/ } +/*N*/ aPagHide.Clear(); +/*N*/ } + +/*N*/ void SdrPaintView::Clear() +/*N*/ { +/*N*/ ClearPageViews(); +/*N*/ ClearHideViews(); +/*N*/ } + +/*N*/ void SdrPaintView::ClearAll() +/*N*/ { +/*N*/ for( void* p = aAsyncPaintList.First(); p; p = aAsyncPaintList.Next() ) +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete (ImpAsyncStruct*) p; +/*N*/ +/*N*/ aAsyncPaintList.Clear(); +/*N*/ ClearPageViews(); +/*N*/ ClearHideViews(); +/*N*/ ImpForceSwapOut(); +/*N*/ } + +/*N*/ SdrPageView* SdrPaintView::ShowPage(SdrPage* pPage, const Point& rOffs) +/*N*/ { +/*N*/ SdrPageView* pPV=NULL; +/*N*/ if (pPage!=NULL) { +/*N*/ SdrPageView* pTmpPV=NULL; +/*N*/ if (!bPageTwice) pTmpPV=GetPageView(pPage); // Evtl. jede Seite nur einmal! +/*N*/ if (pTmpPV==NULL) { +/*N*/ USHORT nPos=GetHiddenPV(pPage); // War die schon mal da? +/*N*/ if (nPos<GetPageHideCount()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } else { +/*N*/ pPV=new SdrPageView(pPage,rOffs,*((SdrView*)this)); +/*N*/ } +/*N*/ if (pPV!=NULL) { +/*N*/ aPagV.Insert(pPV,CONTAINER_APPEND); +/*N*/ pPV->Show(); +/*N*/ +/*N*/ // #110290# Swap out graphics when switching pages +/*N*/ ImpForceSwapOut(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return pPV; +/*N*/ } + +/*N*/ void SdrPaintView::HidePage(SdrPageView* pPV) +/*N*/ { +/*N*/ if (pPV!=NULL) { +/*N*/ ULONG nPos=aPagV.GetPos(pPV); +/*N*/ if (nPos!=CONTAINER_ENTRY_NOTFOUND) { +/*N*/ aPagV.Remove(nPos); +/*N*/ pPV->Hide(); +/*N*/ if (bSaveHiddenPages) { +/*?*/ aPagHide.Insert(pPV,CONTAINER_APPEND); +/*N*/ } else { +/*N*/ delete pPV; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void SdrPaintView::HideAllPages() +/*N*/ { +/*N*/ while (GetPageViewCount()>0) HidePagePvNum(0); +/*N*/ } + + + +/*N*/ SdrPageView* SdrPaintView::GetPageView(const SdrPage* pPage) const +/*N*/ { +/*N*/ if (pPage==NULL) return NULL; +/*N*/ BOOL bWeiter=TRUE; +/*N*/ SdrPageView* pPV=NULL; +/*N*/ for (USHORT i=0; i<GetPageViewCount() && bWeiter; i++) { +/*?*/ pPV=GetPageViewPvNum(i); +/*?*/ bWeiter=(pPV->GetPage()!=pPage); +/*N*/ } +/*N*/ if (bWeiter) return NULL; +/*N*/ else return pPV; +/*N*/ } + + + + + +/*N*/ USHORT SdrPaintView::GetHiddenPV(const SdrPage* pPage) const +/*N*/ { +/*N*/ BOOL bWeiter=TRUE; +/*N*/ USHORT i; +/*N*/ for (i=0; i<GetPageHideCount() && bWeiter;) { +/*?*/ SdrPageView* pPV=GetPageHidePvNum(i); +/*?*/ bWeiter=(pPV->GetPage()!=pPage); +/*?*/ if (bWeiter) i++; +/*N*/ } +/*N*/ return i; +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::AddWin(OutputDevice* pWin1) +/*N*/ { +/*N*/ SdrViewWinRec* pWinRec=new SdrViewWinRec(pWin1); +/*N*/ pWinRec->bXorVisible=TRUE; // Normalerweise ist Xor nicht unterdrueckt +/*N*/ aWinList.Insert(pWinRec); +/*N*/ for (USHORT i=0; i<GetPageViewCount(); i++) { +/*?*/ GetPageViewPvNum(i)->AddWin(pWin1); +/*N*/ } +/*N*/ #ifndef SVX_LIGHT +/*N*/ if (pItemBrowser!=NULL) {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pItemBrowser->ForceParent(); +/*N*/ #endif +/*N*/ } + +/*N*/ void SdrPaintView::DelWin(OutputDevice* pWin1) +/*N*/ { +/*N*/ USHORT nPos=aWinList.Find(pWin1); +/*N*/ if (nPos!=SDRVIEWWIN_NOTFOUND) { +/*N*/ for (USHORT i=0; i<GetPageViewCount(); i++) { +/*N*/ GetPageViewPvNum(i)->DelWin(pWin1); +/*N*/ } +/*N*/ aWinList.Delete(nPos); +/*N*/ } +/*N*/ #ifndef SVX_LIGHT +/*N*/ if (pItemBrowser!=NULL) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pItemBrowser->ForceParent(); +/*N*/ #endif +/*N*/ } + +/*N*/ Rectangle SdrPaintView::GetVisibleArea( USHORT nNum ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return Rectangle();//STRIP001 +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::InitRedraw(OutputDevice* pOut, const Region& rReg, USHORT nPaintMode) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ void SdrPaintView::GlueInvalidate() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); +/*N*/ } + +/*N*/ void SdrPaintView::InvalidateAllWin() +/*N*/ { +/*N*/ for (USHORT i=0; i<GetWinCount(); i++) { +/*N*/ OutputDevice* pOut=GetWin(i); +/*N*/ if (pOut->GetOutDevType()==OUTDEV_WINDOW) { +/*N*/ InvalidateOneWin(*(Window*)pOut); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrPaintView::InvalidateAllWin(const Rectangle& rRect, BOOL bPlus1Pix) +/*N*/ { +/*N*/ USHORT nWinAnz=GetWinCount(); +/*N*/ for (USHORT i=0; i<nWinAnz; i++) { +/*N*/ OutputDevice* pOut=GetWin(i); +/*N*/ if (pOut->GetOutDevType()==OUTDEV_WINDOW) { +/*N*/ Rectangle aRect(rRect); +/*N*/ if (bPlus1Pix) { +/*N*/ Size aPixSiz(1,1); +/*N*/ Size aSiz(pOut->PixelToLogic(aPixSiz)); +/*N*/ aRect.Left ()-=aSiz.Width(); +/*N*/ aRect.Top ()-=aSiz.Height(); +/*N*/ aRect.Right ()+=aSiz.Width(); +/*N*/ aRect.Bottom()+=aSiz.Height(); +/*N*/ } +/*N*/ Point aOrg(pOut->GetMapMode().GetOrigin()); +/*N*/ aOrg.X()=-aOrg.X(); aOrg.Y()=-aOrg.Y(); +/*N*/ Rectangle aOutRect(aOrg,pOut->GetOutputSize()); +/*N*/ if (aRect.IsOver(aOutRect)) { +/*N*/ InvalidateOneWin(*(Window*)pOut,aRect); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrPaintView::InvalidateOneWin(Window& rWin) +/*N*/ { +/*N*/ rWin.Invalidate(); +/*N*/ } + +/*N*/ void SdrPaintView::InvalidateOneWin(Window& rWin, const Rectangle& rRect) +/*N*/ { +/*N*/ rWin.Invalidate(rRect); +/*N*/ } + + +/*N*/ void SdrPaintView::LeaveAllGroup() +/*N*/ { +/*N*/ for (USHORT nv=0; nv<GetPageViewCount(); nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ pPV->LeaveAllGroup(); +/*N*/ } +/*N*/ } + +/*N*/ void SdrPaintView::SetMasterPagePaintCaching( BOOL bOn, ULONG nCacheMode ) +/*N*/ { +/*N*/ bMasterBmp = bOn; +/*N*/ +/*N*/ if( bOn ) +/*N*/ { +/*N*/ if( SDR_MASTERPAGECACHE_DEFAULT == nCacheMode || SDR_MASTERPAGECACHE_NONE == nCacheMode ) +/*N*/ nMasterCacheMode = SDR_MASTERPAGECACHE_FULL; +/*N*/ else +/*N*/ nMasterCacheMode = nCacheMode; +/*N*/ +/*N*/ ReleaseMasterPagePaintCache(); +/*N*/ } +/*N*/ else +/*N*/ nMasterCacheMode = SDR_MASTERPAGECACHE_NONE; +/*N*/ } + +// z.B. rufen, wenn Obj der MPg geaendert +/*N*/ void SdrPaintView::ReleaseMasterPagePaintCache() +/*N*/ { +/*N*/ if (pMasterBmp!=NULL) { +/*?*/ delete pMasterBmp; +/*?*/ pMasterBmp=NULL; +/*N*/ } +/*N*/ } + + + + +/*N*/ void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr) +/*N*/ { +/*N*/ pDefaultStyleSheet=pStyleSheet; +/*N*/ if (pStyleSheet!=NULL && !bDontRemoveHardAttr) { +/*?*/ SfxWhichIter aIter(pStyleSheet->GetItemSet()); +/*?*/ USHORT nWhich=aIter.FirstWhich(); +/*?*/ while (nWhich!=0) { +/*?*/ if (pStyleSheet->GetItemSet().GetItemState(nWhich,TRUE)==SFX_ITEM_SET) { +/*?*/ aDefaultAttr.ClearItem(nWhich); +/*?*/ } +/*?*/ nWhich=aIter.NextWhich(); +/*?*/ } +/*N*/ } +#ifndef SVX_LIGHT +/*N*/ if (pItemBrowser!=NULL) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pItemBrowser->SetDirty(); +#endif +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPaintView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWPAGEVIEWS); +/*N*/ USHORT nv; +/*N*/ for (nv=0; nv<GetPageViewCount(); nv++) { +/*N*/ SdrPageView* pPV=GetPageViewPvNum(nv); +/*N*/ if (pPV->GetPage()->IsInserted()) { +/*?*/ rOut<<*pPV; +/*N*/ } +/*N*/ } +/*N*/ for (nv=0; nv<GetPageHideCount(); nv++) { +/*?*/ SdrPageView* pPV=GetPageHidePvNum(nv); +/*?*/ if (pPV->GetPage()->IsInserted()) { +/*?*/ rOut<<*pPV; +/*N*/ } +/*N*/ } +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWVISIELEM); +/*N*/ rOut<<BOOL(bLayerSortedRedraw); +/*N*/ rOut<<BOOL(bPageVisible); +/*N*/ rOut<<BOOL(bBordVisible); +/*N*/ rOut<<BOOL(bGridVisible); +/*N*/ rOut<<BOOL(bGridFront); +/*N*/ rOut<<BOOL(bHlplVisible); +/*N*/ rOut<<BOOL(bHlplFront); +/*N*/ rOut<<BOOL(bGlueVisible); +/*N*/ rOut<<aGridBig; +/*N*/ rOut<<aGridFin; +/*N*/ rOut<<aGridWdtX; +/*N*/ rOut<<aGridWdtY; +/*N*/ rOut<<aGridSubdiv; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWAKTLAYER); +/*N*/ +/*N*/ // UNICODE: rOut << aAktLayer; +/*N*/ rOut.WriteByteString(aAktLayer); +/*N*/ +/*N*/ // UNICODE: rOut << aMeasureLayer; +/*N*/ rOut.WriteByteString(aMeasureLayer); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrPaintView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) { +/*N*/ bRet=TRUE; +/*N*/ switch (rSubHead.GetIdentifier()) { +/*N*/ case SDRIORECNAME_VIEWPAGEVIEWS: { +/*N*/ while (rSubHead.GetBytesLeft()>0 && rIn.GetError()==0 && !rIn.IsEof()) { +/*N*/ SdrPageView* pPV=new SdrPageView(NULL,Point(),*(SdrView*)this); +/*N*/ rIn>>*pPV; +/*N*/ if (pPV->GetPage()!=NULL) { +/*N*/ if (pPV->IsVisible()) { +/*N*/ aPagV.Insert(pPV,CONTAINER_APPEND); +/*N*/ } else aPagHide.Insert(pPV,CONTAINER_APPEND); +/*N*/ } else { +/*N*/ DBG_ERROR("SdrPaintView::ReadRecord(): Seite der PageView nicht gefunden"); +/*N*/ delete pPV; +/*N*/ } +/*N*/ } +/*N*/ } break; +/*N*/ +/*N*/ case SDRIORECNAME_VIEWVISIELEM: +/*N*/ { +/*N*/ BOOL bTemp; +/*N*/ +/*N*/ rIn>>bTemp; bLayerSortedRedraw=bTemp; +/*N*/ rIn>>bTemp; bPageVisible =bTemp; +/*N*/ rIn>>bTemp; bBordVisible =bTemp; +/*N*/ rIn>>bTemp; bGridVisible =bTemp; +/*N*/ rIn>>bTemp; bGridFront =bTemp; +/*N*/ rIn>>bTemp; bHlplVisible =bTemp; +/*N*/ rIn>>bTemp; bHlplFront =bTemp; +/*N*/ rIn>>bTemp; bGlueVisible =bTemp; +/*N*/ rIn>>aGridBig; +/*N*/ rIn>>aGridFin; +/*N*/ +/*N*/ if(rSubHead.GetBytesLeft() > 0) +/*N*/ { +/*N*/ rIn >> aGridWdtX; +/*N*/ rIn >> aGridWdtY; +/*N*/ rIn >> aGridSubdiv; +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ case SDRIORECNAME_VIEWAKTLAYER: +/*N*/ { +/*N*/ // UNICODE: rIn >> aAktLayer; +/*N*/ rIn.ReadByteString(aAktLayer); +/*N*/ +/*N*/ if(rSubHead.GetBytesLeft() > 0) +/*N*/ { +/*N*/ // UNICODE: rIn >> aMeasureLayer; +/*N*/ rIn.ReadByteString(aMeasureLayer); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ default: +/*N*/ bRet = FALSE; +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/*N*/ void SdrPaintView::onChangeColorConfig() +/*N*/ { +/*N*/ SetGridColor( Color( maColorConfig.GetColorValue( DRAWGRID ).nColor ) ); +/*N*/ } + +/*N*/ void SdrPaintView::SetGridColor( Color aColor ) +/*N*/ { +/*N*/ maGridColor = aColor; +/*N*/ } + + +// #103834# Set background color for svx at SdrPageViews + +/*N*/ void SdrPaintView::ImpForceSwapOut() +/*N*/ { +/*N*/ // #110290# Force swap out all graphics on this page. There might be +/*N*/ // some left, since every graphic that has not received a Draw yet, +/*N*/ // but is swapped in, has its swapout handler disabled. +/*N*/ while( !maSwappedInGraphicsStack.empty() ) +/*N*/ { +/*N*/ maSwappedInGraphicsStack.front()->ForceSwapOut(); +/*N*/ maSwappedInGraphicsStack.pop_front(); +/*N*/ } +/*N*/ } + +// eof +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdpoev.cxx b/binfilter/bf_svx/source/svdraw/svx_svdpoev.cxx new file mode 100644 index 000000000000..c5f2d77f9621 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdpoev.cxx @@ -0,0 +1,163 @@ +/* -*- 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 "svdpoev.hxx" +#include <math.h> +#include "svdopath.hxx" +#include "svdstr.hrc" // Namen aus der Resource +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrPolyEditView::ImpResetPolyPossibilityFlags() +/*N*/ { +/*N*/ eMarkedPointsSmooth=SDRPATHSMOOTH_DONTCARE; +/*N*/ eMarkedSegmentsKind=SDRPATHSEGMENT_DONTCARE; +/*N*/ bSetMarkedPointsSmoothPossible=FALSE; +/*N*/ bSetMarkedSegmentsKindPossible=FALSE; +/*N*/ } + +/*N*/ void SdrPolyEditView::ImpClearVars() +/*N*/ { +/*N*/ ImpResetPolyPossibilityFlags(); +/*N*/ } + +/*N*/ SdrPolyEditView::SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrEditView(pModel1,pOut) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ } + +/*N*/ SdrPolyEditView::~SdrPolyEditView() +/*N*/ { +/*N*/ } + +/*N*/ void SdrPolyEditView::ImpCheckPolyPossibilities() +/*N*/ { +/*N*/ ImpResetPolyPossibilityFlags(); +/*N*/ ULONG nMarkAnz=aMark.GetMarkCount(); +/*N*/ if (nMarkAnz>0 && !ImpIsFrameHandles()) { +/*?*/ BOOL bReadOnly=FALSE; +/*?*/ BOOL b1stSmooth=TRUE; +/*?*/ BOOL b1stSegm=TRUE; +/*?*/ BOOL bCurve=FALSE; +/*?*/ BOOL bSmoothFuz=FALSE; +/*?*/ BOOL bSegmFuz=FALSE; +/*?*/ XPolyFlags eSmooth=XPOLY_NORMAL; +/*?*/ +/*?*/ for (ULONG nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) { +/*?*/ SdrMark* pM=aMark.GetMark(nMarkNum); +/*?*/ SdrObject* pObj=pM->GetObj(); +/*?*/ SdrUShortCont* pPts=pM->GetMarkedPoints(); +/*?*/ SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj); +/*?*/ if (pPath!=NULL && pPts!=NULL) { +/*?*/ ULONG nMarkedPntAnz=pPts->GetCount(); +/*?*/ if (nMarkedPntAnz!=0) { +/*?*/ BOOL bClosed=pPath->IsClosed(); +/*?*/ bSetMarkedPointsSmoothPossible=TRUE; +/*?*/ if (bClosed) bSetMarkedSegmentsKindPossible=TRUE; +/*?*/ const XPolyPolygon& rXPP=pPath->GetPathPoly(); +/*?*/ for (USHORT nMarkedPntNum=0; nMarkedPntNum<(USHORT)nMarkedPntAnz; nMarkedPntNum++) { +/*?*/ USHORT nNum=pPts->GetObject(nMarkedPntNum); +/*?*/ USHORT nPolyNum=0,nPntNum=0; +/*?*/ if (pPath->FindPolyPnt(nNum,nPolyNum,nPntNum,FALSE)) { +/*?*/ const XPolygon& rXP=rXPP[nPolyNum]; +/*?*/ BOOL bCanSegment=bClosed || nPntNum<rXP.GetPointCount()-1; +/*?*/ +/*?*/ if (!bSetMarkedSegmentsKindPossible && bCanSegment) { +/*?*/ bSetMarkedSegmentsKindPossible=TRUE; +/*?*/ } +/*?*/ if (!bSmoothFuz) { +/*?*/ if (b1stSmooth) { +/*?*/ b1stSmooth=FALSE; +/*?*/ eSmooth=rXP.GetFlags(nPntNum); +/*?*/ } else { +/*?*/ bSmoothFuz=eSmooth!=rXP.GetFlags(nPntNum); +/*?*/ } +/*?*/ } +/*?*/ if (!bSegmFuz) { +/*?*/ if (bCanSegment) { +/*?*/ BOOL bCrv=rXP.IsControl(nPntNum+1); +/*?*/ if (b1stSegm) { +/*?*/ b1stSegm=FALSE; +/*?*/ bCurve=bCrv; +/*?*/ } else { +/*?*/ bSegmFuz=bCrv!=bCurve; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ if (!b1stSmooth && !bSmoothFuz) { +/*?*/ if (eSmooth==XPOLY_NORMAL) eMarkedPointsSmooth=SDRPATHSMOOTH_ANGULAR; +/*?*/ if (eSmooth==XPOLY_SMOOTH) eMarkedPointsSmooth=SDRPATHSMOOTH_ASYMMETRIC; +/*?*/ if (eSmooth==XPOLY_SYMMTR) eMarkedPointsSmooth=SDRPATHSMOOTH_SYMMETRIC; +/*?*/ } +/*?*/ if (!b1stSegm && !bSegmFuz) { +/*?*/ eMarkedSegmentsKind= bCurve ? SDRPATHSEGMENT_CURVE : SDRPATHSEGMENT_LINE; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ if (bReadOnly) { +/*?*/ bSetMarkedPointsSmoothPossible=FALSE; +/*?*/ bSetMarkedSegmentsKindPossible=FALSE; +/*?*/ } +/*N*/ } +/*N*/ } + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdsnpv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdsnpv.cxx new file mode 100644 index 000000000000..2acb85cc5b13 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdsnpv.cxx @@ -0,0 +1,277 @@ +/* -*- 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 "svdsnpv.hxx" +#include <math.h> + +#include "svdio.hxx" +#include "svdpagv.hxx" +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@ +// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ +// @@@@ @@@@@@ @@@@@@ @@@@@ @@@@@ @@ @@@@ @@@@@@@ +// @@ @@ @@@ @@ @@ @@ @@@ @@ @@ @@@@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ +// @@@@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrSnapView::ClearVars() +/*N*/ { +/*N*/ nMagnSizPix=4; +/*N*/ bSnapEnab=TRUE; +/*N*/ bGridSnap=TRUE; +/*N*/ bSnapTo1Pix=TRUE; +/*N*/ bBordSnap=TRUE; +/*N*/ bHlplSnap=TRUE; +/*N*/ bOFrmSnap=TRUE; +/*N*/ bOPntSnap=FALSE; +/*N*/ bOConSnap=TRUE; +/*N*/ bMoveMFrmSnap=TRUE; +/*N*/ bMoveOFrmSnap=TRUE; +/*N*/ bMoveOPntSnap=TRUE; +/*N*/ bMoveOConSnap=TRUE; +/*N*/ bMoveSnapOnlyTopLeft=FALSE; +/*N*/ bSetPageOrg=FALSE; +/*N*/ bOrtho=FALSE; +/*N*/ bBigOrtho=TRUE; +/*N*/ nSnapAngle=1500; +/*N*/ bAngleSnapEnab=FALSE; +/*N*/ bMoveOnlyDragging=FALSE; +/*N*/ bSlantButShear=FALSE; +/*N*/ bCrookNoContortion=FALSE; +/*N*/ eCrookMode=SDRCROOK_ROTATE; +/*N*/ bHlplFixed=FALSE; +/*N*/ pDragHelpLinePV=NULL; +/*N*/ nDragHelpLineNum=0; +/*N*/ bDragHelpLine=FALSE; +/*N*/ bEliminatePolyPoints=FALSE; +/*N*/ nEliminatePolyPointLimitAngle=0; +/*N*/ } + +/*N*/ SdrSnapView::SdrSnapView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrPaintView(pModel1,pOut) +/*N*/ { +/*N*/ ClearVars(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ BOOL SdrSnapView::IsAction() const +/*N*/ { +/*N*/ return IsSetPageOrg() || IsDragHelpLine() || SdrPaintView::IsAction(); +/*N*/ } + + + + +/*N*/ void SdrSnapView::BrkAction() +/*N*/ { +/*N*/ BrkSetPageOrg(); +/*N*/ BrkDragHelpLine(); +/*N*/ SdrPaintView::BrkAction(); +/*N*/ } + + +/*N*/ void SdrSnapView::ToggleShownXor(OutputDevice* pOut, const Region* pRegion) const +/*N*/ { +/*N*/ SdrPaintView::ToggleShownXor(pOut,pRegion); +/*N*/ if (IsSetPageOrg()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ if (IsDragHelpLine()) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrSnapView::SnapMove() +/*N*/ { +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +#define NOT_SNAPPED 0x7FFFFFFF + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +/*N*/ void SdrSnapView::BrkSetPageOrg() +/*N*/ { +/*N*/ if (bSetPageOrg) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + +/*N*/ void SdrSnapView::BrkDragHelpLine() +/*N*/ { +/*N*/ if (bDragHelpLine) {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrSnapView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ SdrPaintView::WriteRecords(rOut); +/*N*/ { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWSNAP); +/*N*/ rOut<<aMagnSiz; +/*N*/ rOut<<aSnapSiz; +/*N*/ +/*N*/ rOut << (BOOL)bSnapEnab; +/*N*/ rOut << (BOOL)bGridSnap; +/*N*/ rOut << (BOOL)bBordSnap; +/*N*/ rOut << (BOOL)bHlplSnap; +/*N*/ rOut << (BOOL)bOFrmSnap; +/*N*/ rOut << (BOOL)bOPntSnap; +/*N*/ rOut << (BOOL)bOConSnap; +/*N*/ rOut << (BOOL)bMoveMFrmSnap; +/*N*/ rOut << (BOOL)bMoveOFrmSnap; +/*N*/ rOut << (BOOL)bMoveOPntSnap; +/*N*/ rOut << (BOOL)bMoveOConSnap; +/*N*/ rOut << (BOOL)bHlplFixed; +/*N*/ +/*N*/ rOut<<nMagnSizPix; +/*N*/ +/*N*/ rOut << (BOOL)bSnapTo1Pix; +/*N*/ rOut << (BOOL)bMoveSnapOnlyTopLeft; +/*N*/ +/*N*/ rOut<<aSnapWdtX; +/*N*/ rOut<<aSnapWdtY; +/*N*/ } { +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWORTHO); +/*N*/ +/*N*/ rOut << (BOOL)bOrtho; +/*N*/ rOut << (BOOL)bBigOrtho; +/*N*/ +/*N*/ rOut<<nSnapAngle; +/*N*/ +/*N*/ rOut << (BOOL)bAngleSnapEnab; +/*N*/ rOut << (BOOL)bMoveOnlyDragging; +/*N*/ rOut << (BOOL)bSlantButShear; +/*N*/ rOut << (BOOL)bCrookNoContortion; +/*N*/ +/*N*/ rOut<<USHORT(eCrookMode); +/*N*/ } +/*N*/ } + +/*N*/ BOOL SdrSnapView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) +/*N*/ { +/*N*/ bRet=TRUE; +/*N*/ BOOL bZwi; +/*N*/ +/*N*/ switch (rSubHead.GetIdentifier()) +/*N*/ { +/*N*/ case SDRIORECNAME_VIEWSNAP: +/*N*/ { +/*N*/ rIn>>aMagnSiz; +/*N*/ rIn>>aSnapSiz; +/*N*/ +/*N*/ rIn >> bZwi; bSnapEnab = bZwi; +/*N*/ rIn >> bZwi; bGridSnap = bZwi; +/*N*/ rIn >> bZwi; bBordSnap = bZwi; +/*N*/ rIn >> bZwi; bHlplSnap = bZwi; +/*N*/ rIn >> bZwi; bOFrmSnap = bZwi; +/*N*/ rIn >> bZwi; bOPntSnap = bZwi; +/*N*/ rIn >> bZwi; bOConSnap = bZwi; +/*N*/ rIn >> bZwi; bMoveMFrmSnap = bZwi; +/*N*/ rIn >> bZwi; bMoveOFrmSnap = bZwi; +/*N*/ rIn >> bZwi; bMoveOPntSnap = bZwi; +/*N*/ rIn >> bZwi; bMoveOConSnap = bZwi; +/*N*/ +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ rIn >> bZwi; bHlplFixed = bZwi; // kam erst spaeter dazu +/*N*/ } +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ // kam erst spaeter dazu +/*N*/ rIn>>nMagnSizPix; +/*N*/ rIn >> bZwi; bSnapTo1Pix = bZwi; +/*N*/ } +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ // kam erst spaeter dazu +/*N*/ rIn >> bZwi; bMoveSnapOnlyTopLeft = bZwi; +/*N*/ } +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ // kam erst spaeter dazu +/*N*/ rIn>>aSnapWdtX; +/*N*/ rIn>>aSnapWdtY; +/*N*/ } +/*N*/ } break; +/*N*/ case SDRIORECNAME_VIEWORTHO: +/*N*/ { +/*N*/ rIn >> bZwi; bOrtho = bZwi; +/*N*/ rIn >> bZwi; bBigOrtho = bZwi; +/*N*/ +/*N*/ rIn>>nSnapAngle; +/*N*/ +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ // kam erst spaeter dazu +/*N*/ rIn >> bZwi; bAngleSnapEnab = bZwi; +/*N*/ rIn >> bZwi; bMoveOnlyDragging = bZwi; +/*N*/ rIn >> bZwi; bSlantButShear = bZwi; +/*N*/ rIn >> bZwi; bCrookNoContortion = bZwi; +/*N*/ } +/*N*/ if (rSubHead.GetBytesLeft()>0) +/*N*/ { +/*N*/ // kam erst spaeter dazu +/*N*/ USHORT nCrookMode; +/*N*/ rIn>>nCrookMode; +/*N*/ eCrookMode=SdrCrookMode(nCrookMode); +/*N*/ } +/*N*/ } break; +/*N*/ default: bRet=FALSE; +/*N*/ } +/*N*/ } +/*N*/ if (!bRet) bRet=SdrPaintView::ReadRecord(rViewHead,rSubHead,rIn); +/*N*/ return bRet; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdstr.src b/binfilter/bf_svx/source/svdraw/svx_svdstr.src new file mode 100644 index 000000000000..d60739113c01 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdstr.src @@ -0,0 +1,378 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT +/* StarView resource file */ + +#include "svdstr.hrc" + // Ab hier gecachte Strings + //String STR_ObjNameSingulXTXT { + // Text="Textfortsetzungsrahmen"; + // Text[ENGLISH]="drawobject"; + // Text[norwegian]="Tegneobjekt"; + // Text[italian]="Disegna oggetto"; + // Text[portuguese_brazilian]="Desenhar objeto"; + // Text[portuguese]="Desenhar objecto"; + // Text[finnish]="Piirto-objekti"; + // Text[danish]="Tegneobjekt"; + // Text[french]="Drawobject"; + // Text[swedish]="Ritobjekt"; + // Text[dutch]="Tekenobject"; + // Text[spanish]="Objeto de dibujo"; + // Text[english_us]="drawobject"; + //}; + //String STR_ObjNamePluralXTXT { + // Text="Textfortsetzungsrahmen"; + // Text[ENGLISH]="drawobjects"; + // Text[norwegian]="Tegneobjektr"; + // Text[italian]="Disegna oggetti"; + // Text[portuguese_brazilian]="Desenhar objetos"; + // Text[portuguese]="Desenhar objectos"; + // Text[finnish]="Piirto-objektit"; + // Text[danish]="Tegneobjekter"; + // Text[french]="Drawobjects"; + // Text[swedish]="Ritobjekt"; + // Text[dutch]="Tekenobjecten"; + // Text[spanish]="Objetos de dibujo"; + // Text[english_us]="drawobjects"; + //}; + //String STR_ObjNameSingulXTXT { + // Text="Textfortsetzungsrahmen"; + // Text[ENGLISH]="drawobject"; + // Text[norwegian]="Tegneobjekt"; + // Text[italian]="Disegna oggetto"; + // Text[portuguese_brazilian]="Desenhar objeto"; + // Text[portuguese]="Desenhar objecto"; + // Text[finnish]="Piirto-objekti"; + // Text[danish]="Tegneobjekt"; + // Text[french]="Drawobject"; + // Text[swedish]="Ritobjekt"; + // Text[dutch]="Tekenobject"; + // Text[spanish]="Objeto de dibujo"; + // Text[english_us]="drawobject"; + //}; + //String STR_ObjNamePluralXTXT { + // Text="Textfortsetzungsrahmen"; + // Text[ENGLISH]="drawobjects"; + // Text[norwegian]="Tegneobjektr"; + // Text[italian]="Disegna oggetti"; + // Text[portuguese_brazilian]="Desenhar objetos"; + // Text[portuguese]="Desenhar objectos"; + // Text[finnish]="Piirto-objektit"; + // Text[danish]="Tegneobjekter"; + // Text[french]="Drawobjects"; + // Text[swedish]="Ritobjekt"; + // Text[dutch]="Tekenobjecten"; + // Text[spanish]="Objetos de dibujo"; + // Text[english_us]="drawobjects"; + //}; +// Neu ab 537: Namen fuer 3D-Objekte + + + + + + + + + + + + + + + +String STR_ViewTextEdit +{ + Text [ de ] = "TextEdit: Absatz %a, Zeile %z, Spalte %s" ; + Text [ en-US ] = "TextEdit: Paragraph %a, Row %z, Column %s" ; + Text [ x-comment ] = " "; + Text[ pt ] = "EditarTexto: Parágrafo %a, Linha %z, Coluna %s"; + Text[ ru ] = "Правка текÑта: Ðбзац %a, Строка %z, Столбец %s"; + Text[ el ] = "ΕπεξεÏγασία κειμÎνου: ΠαÏάγÏαφος %a, ΓÏαμμή %z, Στήλη %s"; + Text[ nl ] = "TextEdit: Alinea %a, Rij %r, Kolom %k"; + Text[ fr ] = "TextEdit : Paragraphe %a, Ligne %z, Colonne %s"; + Text[ es ] = "Editar Texto: Párrafo %a, LÃnea %z, Columna %s"; + Text[ fi ] = "Tekstin muokkaus: Kappale %a, Rivi %z, Sarake %s"; + Text[ ca ] = "Edita Text: Parà graf %a, LÃnia %z, Columna %s"; + Text[ it ] = "TextEdit: Paragrafo %a, Riga %z, Colonna %s"; + Text[ sk ] = "Editor textu: Odstavec %a, Riadok %z, Stĺpec %s"; + Text[ da ] = "Tekstredigering: Afsnit %a, Række %z, Kolonne %s"; + Text[ sv ] = "TextEdit: Stycke %a, Rad %z, Kolumn %s"; + Text[ pl ] = "Edytuj tekst: Akapit %a, Wiersz %z, Kolumna %s"; + Text[ pt-BR ] = "Editar Texto: Parágrafo %a, Linha %z, Coluna %s"; + Text[ th ] = "à¹à¸à¹‰à¹„ขข้à¸à¸„วาม: ย่à¸à¸«à¸™à¹‰à¸² %a, à¹à¸–ว %z, คà¸à¸¥à¸±à¸¡à¸™à¹Œ %s"; + Text[ ja ] = "テã‚スト編集: 段è½%aã€è¡Œ%zã€åˆ—%s"; + Text[ ko ] = "í…스트 편집: ë‹¨ë½ %a, í–‰ %z, ì—´ %s"; + Text[ zh-CN ] = "编辑文å—:段è½%a,行%z,æ %s"; + Text[ zh-TW ] = "編輯文å—:段è½%a,行%z,欄%s"; + Text[ tr ] = "Metin düzenleme: Paragraf %a, Satır %z, Sütun %s"; + Text[ hi-IN ] = "टेकà¥à¤¸à¥à¤Ÿà¥ संपादन: परिचà¥à¤›à¥‡à¤¦ %a, पंकà¥à¤¤à¤¿ %z, सà¥à¤¤à¤®à¥à¤ %s"; + Text[ ar ] = "تØرير النص: الÙقرة %aØŒ السطر %zØŒ العمود %s"; + Text[ he ] = "‮עריכת טקסט: פיסקה %a, שורה %z, עמודה %s‬"; +}; + +String STR_ViewMarkPoints +{ + Text [ de ] = "Markiere Punkte" ; + Text [ en-US ] = "Mark points" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Marcar pontos"; + Text[ ru ] = "Отметить точки"; + Text[ el ] = "Σήμανση σημείων"; + Text[ nl ] = "Markeer punten"; + Text[ fr ] = "Sélectionner des points"; + Text[ es ] = "Marcar puntos"; + Text[ fi ] = "Merkitse kohdat"; + Text[ ca ] = "Marca els punts"; + Text[ it ] = "Contrassegna punti"; + Text[ sk ] = "OznaÄiÅ¥ body"; + Text[ da ] = "Marker punkter"; + Text[ sv ] = "Markera punkter"; + Text[ pl ] = "Zaznacz punkty"; + Text[ pt-BR ] = "Marcar pontos"; + Text[ th ] = "ทำเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸ˆà¸¸à¸”"; + Text[ ja ] = "制御点をé¸æŠžã—ã¾ã™"; + Text[ ko ] = "ì ì„ íƒ í‘œì‹œ"; + Text[ zh-CN ] = "选择接点"; + Text[ zh-TW ] = "é¸å–接點"; + Text[ tr ] = "Noktaları seç"; + Text[ hi-IN ] = "बिनà¥à¤¦à¥à¤“ं को सूचित करो"; + Text[ ar ] = "تØديد نقاط"; + Text[ he ] = "‮סימון × ×§×•×“×•×ªâ€¬"; +}; + +String STR_ViewMarkGluePoints +{ + Text [ de ] = "Markiere Klebepunkte" ; + Text [ en-US ] = "Mark glue points" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Marcar pontos de colagem"; + Text[ ru ] = "Выделить точки ÑоединениÑ"; + Text[ el ] = "Σήμανση σημείων κόλλησης"; + Text[ nl ] = "Markeer plakpunten"; + Text[ fr ] = "Marquer les points de collage"; + Text[ es ] = "Marcar puntos de adhesión"; + Text[ fi ] = "Merkitse kiinnityskohdat"; + Text[ ca ] = "Marca els punts de cola"; + Text[ it ] = "Contrassegna punti di incollaggio"; + Text[ sk ] = "OznaÄiÅ¥ záchytné body"; + Text[ da ] = "Marker klæbepunkter"; + Text[ sv ] = "Markera fästpunkter"; + Text[ pl ] = "Zaznacz punkty sklejania"; + Text[ pt-BR ] = "Marcar pontos de adesão"; + Text[ th ] = "ทำเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸ˆà¸¸à¸”เชื่à¸à¸¡"; + Text[ ja ] = "接ç€ç‚¹ã‚’é¸æŠžã—ã¾ã™"; + Text[ ko ] = "ì ‘ì°©ì ì„ íƒ í‘œì‹œ"; + Text[ zh-CN ] = "æ ‡è®°ç²˜ç»“ç‚¹"; + Text[ zh-TW ] = "é¸å–接點"; + Text[ tr ] = "Yapıştırma noktalarını seç"; + Text[ hi-IN ] = "गà¥à¤²à¥‚ बिनà¥à¤¦à¥à¤“ं को सूचित करो"; + Text[ ar ] = "تØديد نقاط اللصق"; + Text[ he ] = "‮סימון × ×§×•×“×•×ª הדבקה‬"; +}; +String STR_ViewMarkMoreGluePoints +{ + Text [ de ] = "Markiere weitere Klebepunkte" ; + Text [ en-US ] = "Mark additional glue points" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Marcar pontos de colagem adicionais"; + Text[ ru ] = "Выделить оÑтальные точки ÑоединениÑ"; + Text[ el ] = "Σήμανση επιπλÎον σημείων κόλλησης"; + Text[ nl ] = "Markeer andere plakpunten"; + Text[ fr ] = "Sélectionner des points de collage supplémentaires"; + Text[ es ] = "Marcar puntos de adhesión adicionales"; + Text[ fi ] = "Merkitse lisäkiinnityskohdat"; + Text[ ca ] = "Marca els punts de cola addicionals"; + Text[ it ] = "Contrassegna punti di incollaggio aggiuntivi"; + Text[ sk ] = "OznaÄiÅ¥ ÄalÅ¡ie záchytné body"; + Text[ da ] = "Marker flere klæbepunkter"; + Text[ sv ] = "Markera ytterligare fästpunkter"; + Text[ pl ] = "Zaznacz dodatkowe punkty sklejania"; + Text[ pt-BR ] = "Marcar pontos de adesão adicionais"; + Text[ th ] = "ทำเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸ˆà¸¸à¸”เชื่à¸à¸¡à¹€à¸žà¸´à¹ˆà¸¡à¹€à¸•à¸´à¸¡"; + Text[ ja ] = "ã»ã‹ã®æŽ¥ç€ç‚¹ã‚‚é¸æŠž"; + Text[ ko ] = "기타 ì ‘ì°©ì ì„ íƒ í‘œì‹œ"; + Text[ zh-CN ] = "æ ‡è®°å…¶ä»–çš„ç²˜ç»“ç‚¹"; + Text[ zh-TW ] = "é¸å–其他的接點"; + Text[ tr ] = "Ek yapıştırma noktaları seç"; + Text[ hi-IN ] = "अधिकतर गà¥à¤²à¥‚ बिनà¥à¤¦à¥à¤“ं को सूचित करो"; + Text[ ar ] = "تØديد نقاط لصق أخرى"; + Text[ he ] = "‮סימון × ×§×•×“×•×ª הדבקה × ×•×¡×¤×•×ªâ€¬"; +}; + /////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Ende der gecachten Strings + + // und hier noch Bitmaps +Bitmap BMAP_GrafikEi { File = "grafikei.bmp" ; }; + +// Strings fuer den Vorlagen-Dialog + +// Strings fuer den Vorlagen-Dialog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// #100499# + +// #101928# + +// ******************************************************************* EOF diff --git a/binfilter/bf_svx/source/svdraw/svx_svdsuro.cxx b/binfilter/bf_svx/source/svdraw/svx_svdsuro.cxx new file mode 100644 index 000000000000..7f827e76d2ca --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdsuro.cxx @@ -0,0 +1,283 @@ +/* -*- 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 "svdsuro.hxx" +#include "svdobj.hxx" +#include "svdpage.hxx" +#include "svdmodel.hxx" + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +// fuer Schreiben +/*N*/ SdrObjSurrogate::SdrObjSurrogate(SdrObject* pObj1, const SdrObject* pRefObj1) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ pObj=pObj1; +/*N*/ pRefObj=pRefObj1; +/*N*/ ImpMakeSurrogate(); +/*N*/ } + +// fuer Lesen +/*N*/ SdrObjSurrogate::SdrObjSurrogate(const SdrModel& rMod, SvStream& rIn) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ pModel=&rMod; +/*N*/ ImpRead(rIn); +/*N*/ } + +// fuer Lesen +/*N*/ SdrObjSurrogate::SdrObjSurrogate(const SdrObject& rRefObj, SvStream& rIn) +/*N*/ { +/*N*/ ImpClearVars(); +/*N*/ pRefObj=&rRefObj; +/*N*/ pModel=rRefObj.GetModel(); +/*N*/ ImpRead(rIn); +/*N*/ } + +/*N*/ SdrObjSurrogate::~SdrObjSurrogate() +/*N*/ { +/*N*/ if (pGrpOrdNums!=NULL) delete [] pGrpOrdNums; +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpClearVars() +/*N*/ { +/*N*/ pObj=NULL; +/*N*/ pRefObj=NULL; +/*N*/ pList=NULL; +/*N*/ pRootList=NULL; +/*N*/ pPage=NULL; +/*N*/ pModel=NULL; +/*N*/ eList=SDROBJLIST_UNKNOWN; +/*N*/ nOrdNum=0; +/*N*/ pGrpOrdNums=NULL; +/*N*/ nGrpLevel=0; +/*N*/ nPageNum=0; +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpMakeSurrogate() +/*N*/ { +/*N*/ if (pObj!=NULL) { // ansonsten bleibt eList=SDROBJLIST_UNKNOWN, weil Obj=NULL +/*N*/ FASTBOOL bSameList=FALSE; +/*N*/ FASTBOOL bSamePage=FALSE; +/*N*/ pModel=pObj->GetModel(); +/*N*/ pList=pObj->GetObjList(); +/*N*/ pRootList=pList; +/*N*/ pPage=pObj->GetPage(); +/*N*/ nOrdNum=pObj->GetOrdNum(); +/*N*/ DBG_ASSERT(pModel!=NULL,"ImpMakeSurrogate(): Zielobjekt hat kein Model"); +/*N*/ DBG_ASSERT(pList!=NULL,"ImpMakeSurrogate(): Zielobjekt hat keine ObjList"); +/*N*/ if (pModel!=NULL && pList!=NULL) { +/*N*/ if (pRefObj!=NULL) { +/*N*/ if (pList==pRefObj->GetObjList()) bSameList=TRUE; +/*N*/ else if (pPage!=NULL && pPage==pRefObj->GetPage()) bSamePage=TRUE; +/*N*/ } +/*N*/ if (!bSameList) { +/*N*/ //if (eList==SDROBJLIST_UNKNOWN) eList=pList->GetListKind(); +/*N*/ SdrObjList* pL=pList->GetUpList(); +/*N*/ nGrpLevel=0; +/*N*/ while (pL!=NULL) { pL=pL->GetUpList(); nGrpLevel++; } +/*N*/ if (nGrpLevel!=0) { DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // Aha, verschachtelt +/*N*/ } // if (nGrpLevel!=0) +/*N*/ } // if (eList!=SDROBJLIST_SAMELIST) +/*N*/ if (bSameList) eList=SDROBJLIST_SAMELIST; +/*N*/ else if (bSamePage) eList=SDROBJLIST_SAMEPAGE; +/*N*/ else eList=pRootList->GetListKind(); +/*N*/ if (eList==SDROBJLIST_GROUPOBJ || eList==SDROBJLIST_UNKNOWN) { +/*?*/ if (pGrpOrdNums!=NULL) { +/*?*/ delete [] pGrpOrdNums; +/*?*/ pGrpOrdNums=NULL; +/*?*/ nGrpLevel=0; +/*?*/ } +/*?*/ eList=SDROBJLIST_UNKNOWN; +/*?*/ return; +/*N*/ } +/*N*/ if (SdrIsPageKind(eList)) { +/*N*/ if (pPage!=NULL) { +/*N*/ nPageNum=pPage->GetPageNum(); +/*N*/ } else { +/*?*/ DBG_ERROR("ImpMakeSurrogate(): eList ist eine Page, aber pPage==NULL"); +/*?*/ if (pGrpOrdNums!=NULL) { +/*?*/ delete [] pGrpOrdNums; +/*?*/ pGrpOrdNums=NULL; +/*?*/ nGrpLevel=0; +/*N*/ } +/*N*/ eList=SDROBJLIST_UNKNOWN; +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ // so, nun ist alles beisammen und kann gestreamt werden. +/*N*/ } // if (pModel!=NULL && pList!=NULL) +/*N*/ } // if (pObj!=NULL) +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpWriteValue(SvStream& rOut, UINT32 nVal, unsigned nByteAnz) const +/*N*/ { +/*N*/ switch (nByteAnz) { +/*N*/ case 0: rOut<<BYTE(nVal); break; +/*N*/ case 1: rOut<<UINT16(nVal); break; +/*N*/ case 3: rOut<<nVal; break; +/*N*/ default: DBG_ERROR("ImpWriteValue(): Nur Bytelaengen 1, 2 oder 4 sind erlaubt!"); +/*N*/ } // switch +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpReadValue(SvStream& rIn, UINT32& rVal, unsigned nByteAnz) const +/*N*/ { +/*N*/ switch (nByteAnz) { +/*N*/ case 0: { BYTE n; rIn>>n; rVal=n; } break; +/*N*/ case 1: { UINT16 n; rIn>>n; rVal=n; } break; +/*N*/ case 3: { rIn>>rVal; } break; +/*N*/ default: DBG_ERROR("ImpReadValue(): Nur Bytelaengen 1, 2 oder 4 sind erlaubt!"); +/*N*/ } // switch +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrObjSurrogate& rSurro) +/*N*/ { +/*N*/ BYTE nId=BYTE(rSurro.eList); +/*N*/ if (rSurro.eList==SDROBJLIST_UNKNOWN) { +/*N*/ rOut<<nId; +/*N*/ } else { +/*N*/ FASTBOOL bGrp=rSurro.nGrpLevel!=0; +/*N*/ if (bGrp) nId|=0x20; // Gruppierung +/*N*/ ULONG nMaxOrdNum=rSurro.nOrdNum; +/*N*/ unsigned i; +/*N*/ for (i=0; i<rSurro.nGrpLevel; i++) { +/*?*/ if (nMaxOrdNum<rSurro.pGrpOrdNums[i]) nMaxOrdNum=rSurro.pGrpOrdNums[i]; +/*N*/ } +/*N*/ unsigned nByteAnz=0; +/*N*/ if (nMaxOrdNum>0xFF) nByteAnz++; +/*N*/ if (nMaxOrdNum>0xFFFF) nByteAnz+=2; +/*N*/ nId|=BYTE(nByteAnz<<6); // Byteanzahl an der richtigen Stelle im ID-Byte eintragen +/*N*/ rOut<<nId; +/*N*/ rSurro.ImpWriteValue(rOut,rSurro.nOrdNum,nByteAnz); +/*N*/ if (SdrIsPageKind(rSurro.eList)) { // Seitennummer schreiben +/*N*/ rOut<<rSurro.nPageNum; +/*N*/ } +/*N*/ if (bGrp) { // Gruppierung +/*?*/ rOut<<rSurro.nGrpLevel; +/*?*/ for (i=0; i<rSurro.nGrpLevel; i++) { +/*?*/ rSurro.ImpWriteValue(rOut,rSurro.pGrpOrdNums[i],nByteAnz); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return rOut; +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpRead(SvStream& rIn) +/*N*/ { +/*N*/ BYTE nId; +/*N*/ rIn>>nId; +/*N*/ eList=SdrObjListKind(nId & 0x1F); +/*N*/ if (eList!=SDROBJLIST_UNKNOWN) { +/*N*/ FASTBOOL bGrp=(nId & 0x20)!=0; // Id-Byte +/*N*/ unsigned nByteAnz=(nId & 0xC0)>>6; // aufschluesseln +/*N*/ ImpReadValue(rIn,nOrdNum,nByteAnz); // Ordnungsnummer des Objekts +/*N*/ if (SdrIsPageKind(eList)) { // Seitennummer schreiben +/*N*/ rIn>>nPageNum; +/*N*/ } +/*N*/ if (bGrp) { // Gruppierung +/*?*/ rIn>>nGrpLevel; +/*?*/ pGrpOrdNums=new UINT32[nGrpLevel]; +/*?*/ for (unsigned i=0; i<nGrpLevel; i++) { +/*?*/ ImpReadValue(rIn,pGrpOrdNums[i],nByteAnz); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void SdrObjSurrogate::ImpFindObj() +/*N*/ { +/*N*/ if (eList!=SDROBJLIST_UNKNOWN) { +/*N*/ switch (eList) { +/*N*/ case SDROBJLIST_SAMEPAGE: case SDROBJLIST_SAMELIST: { +/*N*/ if (pRefObj!=NULL) { +/*N*/ pPage=pRefObj->GetPage(); +/*N*/ if (eList==SDROBJLIST_SAMELIST) { +/*N*/ pRootList=pRefObj->GetObjList(); +/*N*/ if (pRootList==NULL) { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): eList=SDROBJLIST_SAMELIST, pRefObj hat jedoch keine ObjList"); +/*N*/ return; +/*N*/ } +/*N*/ } else { +/*N*/ if (pPage!=NULL) { +/*N*/ pRootList=pPage; +/*N*/ } else { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): eList=SDROBJLIST_SAMEPAGE, pRefObj hat jedoch keine Page"); +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ } else { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Relatives Surrogat benoetigt Referenzobjekt"); +/*N*/ return; +/*N*/ } +/*N*/ } break; +/*N*/ case SDROBJLIST_DRAWPAGE: pPage=pModel->GetPage(nPageNum); pRootList=pPage; break; +/*N*/ case SDROBJLIST_MASTERPAGE: pPage=pModel->GetMasterPage(nPageNum); pRootList=pPage; break; +/*N*/ case SDROBJLIST_VIRTOBJECTS: { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Persistente virtuelle Objekte in dieser Version nicht verfuegbar"); +/*N*/ return; +/*N*/ } break; +/*N*/ case SDROBJLIST_SYMBOLTABLE: { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Symbole in dieser Version nicht verfuegbar"); +/*N*/ return; +/*N*/ } break; +/*N*/ default: { +/*N*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Unbekannter oder unsinniger Objektlistentyp"); +/*N*/ return; +/*N*/ } +/*N*/ } // switch +/*N*/ pList=pRootList; +/*N*/ for (unsigned i=0; i<nGrpLevel; i++) { +/*?*/ SdrObject* pO=pList->GetObj(pGrpOrdNums[i]); +/*?*/ if (pO!=NULL) { +/*?*/ pList=pO->GetSubList(); +/*?*/ if (pList==NULL) { +/*?*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Objekt ist kein Gruppenobjekt"); +/*?*/ return; +/*?*/ } +/*?*/ } else { +/*?*/ DBG_ERROR("SdrObjSurrogate::ImpFindObj(): Gruppenobjekt nicht gefunden"); +/*?*/ return; +/*?*/ } +/*N*/ } +/*N*/ pObj=pList->GetObj(nOrdNum); +/*N*/ DBG_ASSERT(pObj!=NULL,"SdrObjSurrogate::ImpFindObj(): Zielobjekt nicht gefunden"); +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* SdrObjSurrogate::GetObject() +/*N*/ { +/*N*/ if (pObj==NULL && eList!=SDROBJLIST_UNKNOWN) ImpFindObj(); +/*N*/ return pObj; +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdtouch.cxx b/binfilter/bf_svx/source/svdraw/svx_svdtouch.cxx new file mode 100644 index 000000000000..e3b3ef18a396 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdtouch.cxx @@ -0,0 +1,282 @@ +/* -*- 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/bigint.hxx> +#include <tools/poly.hxx> +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ class ImpPolyHitCalc { +/*N*/ public: +/*N*/ long x1,x2,y1,y2; // Koordinaten des Rect, muessen sortiert sein! +/*N*/ FASTBOOL bEdge; // ein Punkt lag genau auf einer Kante +/*N*/ FASTBOOL bIntersect; // mind. 2 Punkte auf verschiedenen Seiten einer Kante +/*N*/ FASTBOOL bPntInRect; // mind. 1 Punkt war vollstaendig im Rect +/*N*/ USHORT nOCnt; // wenn Counter ungerade, dann getroffen +/*N*/ USHORT nUCnt; // wenn Counter ungerade, dann getroffen +/*N*/ USHORT nLCnt; // wenn Counter ungerade, dann getroffen +/*N*/ USHORT nRCnt; // wenn Counter ungerade, dann getroffen +/*N*/ FASTBOOL bLine; // TRUE=PolyLine, kein Polygon +/*N*/ public: +/*N*/ ImpPolyHitCalc(const Rectangle& aR, FASTBOOL bIsLine=FALSE) +/*N*/ { +/*N*/ bLine=bIsLine; +/*N*/ bEdge=FALSE; +/*N*/ bIntersect=FALSE; +/*N*/ bPntInRect=FALSE; +/*N*/ x1=aR.Left(); +/*N*/ x2=aR.Right(); +/*N*/ y1=aR.Top(); +/*N*/ y2=aR.Bottom(); +/*N*/ nOCnt=0; +/*N*/ nUCnt=0; +/*N*/ nLCnt=0; +/*N*/ nRCnt=0; +/*N*/ } +/*N*/ FASTBOOL IsDecided() { return bEdge || bIntersect || bPntInRect; } +/*N*/ void CheckPntInRect(const Point& rP) +/*N*/ { +/*N*/ if (!bPntInRect) { +/*N*/ bPntInRect=rP.X()>=x1 && rP.X()<=x2 && rP.Y()>=y1 && rP.Y()<=y2; +/*N*/ } +/*N*/ } +/*N*/ FASTBOOL IsHit() { return (!bLine && (nOCnt & 1)==1) || IsDecided(); } +/*N*/ }; + +/*N*/ #define CAREFUL_MULDIV(Res,Val,Mul,Div) { \ +/*N*/ if (Abs(Val)>0xB504 || Abs(Mul)>0xB504) { \ +/*N*/ BigInt aBigTemp(Val); \ +/*N*/ aBigTemp*=Mul; \ +/*N*/ aBigTemp/=Div; \ +/*N*/ Res=long(aBigTemp); \ +/*N*/ } else { \ +/*N*/ Res=Val*Mul/Div; \ +/*N*/ } \ +/*N*/ } + +/*N*/ void ImpCheckIt(ImpPolyHitCalc& rH, long lx1, long ly1, long lx2, long ly2, +/*N*/ long rx1, long ry1, long rx2, long ry2, USHORT& nOCnt, USHORT& nUCnt) +/*N*/ { +/*N*/ if ((ly1>ly2) || ((ly1==ly2) && (lx1>lx2))) { +/*N*/ long nTmp; // die 2 Punkte nach Y sortieren +/*N*/ nTmp=lx1; +/*N*/ lx1=lx2; +/*N*/ lx2=nTmp; +/*N*/ nTmp=ly1; +/*N*/ ly1=ly2; +/*N*/ ly2=nTmp; +/*N*/ } +/*N*/ FASTBOOL b1=FALSE,b2=FALSE,b3=FALSE,b4=FALSE; // je 1 Flag fuer jeden der 4 Punkte LO,RO,LU,RU +/*N*/ FASTBOOL bx1,bx2; +/*N*/ FASTBOOL by1=ly1<=ry1 && ly2>ry1; +/*N*/ FASTBOOL by2=ly1<=ry2 && ly2>ry2; +/*N*/ long dx,dy,a; +/*N*/ if (by1 || by2) { +/*N*/ dx=lx2-lx1; +/*N*/ dy=ly2-ly1; +/*N*/ } +/*N*/ if (by1) { // Nur wer die Scanline schneidet +/*N*/ bx1=lx1<rx1; // x1,y1 +/*N*/ bx2=lx2<rx1; +/*N*/ FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen +/*N*/ if (bx1 && bx2) b1=TRUE; +/*N*/ else if (bx1 || bx2) { +/*N*/ long yTemp=ry1-ly1; +/*N*/ CAREFUL_MULDIV(a,dx,yTemp,dy); // a=dx*yTemp/dy; +/*N*/ a+=lx1; +/*N*/ bA=TRUE; +/*N*/ rH.bEdge=(a==rx1); +/*N*/ if (a<rx1) b1=TRUE; +/*N*/ } // x2,y1 +/*N*/ bx1=lx1<rx2; +/*N*/ bx2=lx2<rx2; +/*N*/ if (bx1 && bx2) b2=TRUE; +/*N*/ else if (bx1 || bx2) { +/*N*/ if (!bA) { +/*?*/ long yTemp=ry1-ly1; +/*?*/ CAREFUL_MULDIV(a,dx,yTemp,dy); +/*?*/ a+=lx1; +/*N*/ } +/*N*/ rH.bEdge=(a==rx2); +/*N*/ if (a<rx2) b2=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (by2) { // Nur wer die Scanline schneidet +/*N*/ bx1=lx1<rx1; // x1,y2 +/*N*/ bx2=lx2<rx1; +/*N*/ FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen +/*N*/ if (bx1 && bx2) b3=TRUE; +/*N*/ else if (bx1 || bx2) { +/*N*/ long yTemp=ry2-ly1; +/*N*/ CAREFUL_MULDIV(a,dx,yTemp,dy); +/*N*/ a+=lx1; +/*N*/ bA=TRUE; +/*N*/ rH.bEdge=(a==rx1); +/*N*/ if (a<rx1) b3=TRUE; +/*N*/ } +/*N*/ bx1=lx1<rx2; // x2,y2 +/*N*/ bx2=lx2<rx2; +/*N*/ if (bx1 && bx2) b4=TRUE; +/*N*/ else if (bx1 || bx2) { +/*N*/ if (!bA) { +/*N*/ long yTemp=ry2-ly1; +/*N*/ CAREFUL_MULDIV(a,dx,yTemp,dy); +/*N*/ a+=lx1; +/*N*/ } +/*N*/ rH.bEdge=(a==rx2); +/*N*/ if (a<rx2) b4=TRUE; +/*N*/ } +/*N*/ } +/*N*/ if (by1 || by2) { // nun die Ergebnisse auswerten +/*N*/ if (by1 && by2) { // Linie durch beide Scanlines +/*N*/ if (b1 && b2 && b3 && b4) { nOCnt++; nUCnt++; } // Rect komplett rechts neben der Linie +/*N*/ else if (b1 || b2 || b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt +/*N*/ } else { // ansonsten Ober- und Unterkante des Rects getrennt betrachten +/*N*/ if (by1) { // Linie durch Oberkante +/*N*/ if (b1 && b2) nOCnt++; // Oberkante komplett rechts neben der Linie +/*N*/ else if (b1 || b2) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt +/*N*/ } +/*N*/ if (by2) { // Linie durch Unterkante +/*N*/ if (b3 && b4) nUCnt++; // Unterkante komplett rechts neben der Linie +/*N*/ else if (b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void CheckPolyHit(const Polygon& rPoly, ImpPolyHitCalc& rH) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetSize(); +/*N*/ if (nAnz==0) return; +/*N*/ if (nAnz==1) { rH.CheckPntInRect(rPoly[0]); return; } +/*N*/ Point aPt0=rPoly[USHORT(nAnz-1)]; +/*N*/ rH.CheckPntInRect(aPt0); +/*N*/ USHORT i=0; +/*N*/ if (rH.bLine) { +/*N*/ aPt0=rPoly[0]; +/*N*/ i++; +/*N*/ } +/*N*/ for (; i<nAnz && !rH.IsDecided(); i++) { +/*N*/ Point aP1(aPt0); +/*N*/ Point aP2(rPoly[i]); +/*N*/ rH.CheckPntInRect(aP2); +/*N*/ if (!rH.IsDecided()) { +/*N*/ ImpCheckIt(rH,aP1.X(),aP1.Y(),aP2.X(),aP2.Y(),rH.x1,rH.y1,rH.x2,rH.y2,rH.nOCnt,rH.nUCnt); +/*N*/ ImpCheckIt(rH,aP1.Y(),aP1.X(),aP2.Y(),aP2.X(),rH.y1,rH.x1,rH.y2,rH.x2,rH.nLCnt,rH.nRCnt); +/*N*/ } +/*N*/ aPt0=rPoly[i]; +/*N*/ } +/*N*/ if (!rH.bLine) { // Sicherheitshalber nochmal checken +/*N*/ if ((rH.nOCnt&1)!=(rH.nUCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein +/*N*/ if ((rH.nLCnt&1)!=(rH.nRCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein +/*N*/ if ((rH.nOCnt&1)!=(rH.nLCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein +/*N*/ } +/*N*/ } + + +/*N*/ FASTBOOL IsRectTouchesPoly(const PolyPolygon& rPoly, const Rectangle& rHit) +/*N*/ { +/*N*/ ImpPolyHitCalc aHit(rHit); +/*N*/ USHORT nAnz=rPoly.Count(); +/*N*/ for (USHORT i=0; i<nAnz && !aHit.IsDecided(); i++) { +/*N*/ CheckPolyHit(rPoly.GetObject(i),aHit); +/*N*/ } +/*N*/ return aHit.IsHit(); +/*N*/ } + + + + +/*N*/ FASTBOOL IsRectTouchesLine(const Polygon& rLine, const Rectangle& rHit) +/*N*/ { +/*N*/ ImpPolyHitCalc aHit(rHit,TRUE); +/*N*/ CheckPolyHit(rLine,aHit); +/*N*/ return aHit.IsHit(); +/*N*/ } + + + + +/*N*/ BYTE CheckPointTouchesPoly(const Polygon& rPoly, const Point& rHit) // 0=Ausserhalb, 1=Innerhalb, 2=Beruehrung +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetSize(); +/*N*/ if (nAnz<2) return FALSE; +/*N*/ FASTBOOL bEdge=FALSE; +/*N*/ USHORT nCnt=0; +/*N*/ Point aPt0=rPoly[USHORT(nAnz-1)]; +/*N*/ for (USHORT i=0; i<nAnz && !bEdge; i++) { +/*N*/ Point aP1(rPoly[i]); +/*N*/ Point aP2(aPt0); +/*N*/ if ((aP1.Y()>aP2.Y()) || ((aP1.Y()==aP2.Y()) && (aP1.X()>aP2.X()))) { Point aTmp(aP1); aP1=aP2; aP2=aTmp; } +/*N*/ bEdge=((aP1.X()==aP2.X()) && (rHit.X()==aP1.X()) && (rHit.Y()>=aP1.Y()) && (rHit.Y()<=aP2.Y())) || +/*N*/ ((aP1.Y()==aP2.Y()) && (rHit.Y()==aP1.Y()) && (rHit.X()>=aP1.X()) && (rHit.X()<=aP2.X())) || +/*N*/ (rHit.X()==aP1.X()) && (rHit.Y()==aP1.Y()); +/*N*/ if (!bEdge && aP1.Y()<=rHit.Y() && aP2.Y()>rHit.Y()) { // Nur wer die Scanline schneidet +/*N*/ FASTBOOL bx1=aP1.X()<rHit.X(); +/*N*/ FASTBOOL bx2=aP2.X()<rHit.X(); +/*N*/ if (bx1 && bx2) nCnt++; +/*N*/ else if (bx1 || bx2) { +/*N*/ long dx=aP2.X()-aP1.X(); +/*N*/ long dy=aP2.Y()-aP1.Y(); +/*N*/ long yTemp=rHit.Y()-aP1.Y(); +/*N*/ long xTemp; +/*N*/ if (Abs(dx)>0xB504 || Abs(yTemp)>0xB504) { // gegen Integerueberlaeufe +/*?*/ BigInt aBigTemp(dx); +/*?*/ aBigTemp*=yTemp; +/*?*/ aBigTemp/=dy; +/*?*/ xTemp=long(aBigTemp); +/*N*/ } else { +/*N*/ xTemp=dx*yTemp /dy; +/*N*/ } +/*N*/ xTemp+=aP1.X(); +/*N*/ bEdge=(xTemp==rHit.X()); +/*N*/ if (xTemp<rHit.X()) nCnt++; +/*N*/ } +/*N*/ } +/*N*/ aPt0=rPoly[i]; +/*N*/ } +/*N*/ if (bEdge) return 2; +/*N*/ return (nCnt & 1)==1; +/*N*/ } + +/*N*/ FASTBOOL IsPointInsidePoly(const Polygon& rPoly, const Point& rHit) +/*N*/ { +/*N*/ return CheckPointTouchesPoly(rPoly,rHit)!=0; +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdtrans.cxx b/binfilter/bf_svx/source/svdraw/svx_svdtrans.cxx new file mode 100644 index 000000000000..41dcb0ee93f1 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdtrans.cxx @@ -0,0 +1,425 @@ +/* -*- 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 "svdtrans.hxx" +#include <math.h> +#include "xpoly.hxx" + + +#include <tools/bigint.hxx> + + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void MoveXPoly(XPolygon& rPoly, const Size& S) +/*N*/ { +/*N*/ rPoly.Move(S.Width(),S.Height()); +/*N*/ } + +/*N*/ void MoveXPoly(XPolyPolygon& rPoly, const Size& S) +/*N*/ { +/*N*/ rPoly.Move(S.Width(),S.Height()); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& rxFact, const Fraction& ryFact, FASTBOOL bNoJustify) +/*N*/ { +/*N*/ Fraction xFact(rxFact); +/*N*/ Fraction yFact(ryFact); +/*N*/ long nHgt=rRect.Bottom()-rRect.Top(); +/*N*/ +/*N*/ { +/*N*/ if (xFact.GetDenominator()==0) { +/*?*/ long nWdt=rRect.Right()-rRect.Left(); +/*?*/ if (xFact.GetNumerator()>=0) { // DivZero abfangen +/*?*/ xFact=Fraction(xFact.GetNumerator(),1); +/*?*/ if (nWdt==0) rRect.Right()++; +/*?*/ } else { +/*?*/ xFact=Fraction(xFact.GetNumerator(),-1); +/*?*/ if (nWdt==0) rRect.Left()--; +/*N*/ } +/*N*/ } +/*N*/ rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator()); +/*N*/ rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator()); +/*N*/ } +/*N*/ { +/*N*/ if (yFact.GetDenominator()==0) { +/*?*/ long nHgt=rRect.Bottom()-rRect.Top(); +/*?*/ if (yFact.GetNumerator()>=0) { // DivZero abfangen +/*?*/ yFact=Fraction(yFact.GetNumerator(),1); +/*?*/ if (nHgt==0) rRect.Bottom()++; +/*?*/ } else { +/*?*/ yFact=Fraction(yFact.GetNumerator(),-1); +/*?*/ if (nHgt==0) rRect.Top()--; +/*?*/ } +/*?*/ +/*?*/ yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen +/*N*/ } +/*N*/ rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator()); +/*N*/ rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator()); +/*N*/ } +/*N*/ if (!bNoJustify) rRect.Justify(); +/*N*/ } + + +/*?*/ void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*?*/ { +/*?*/ USHORT nAnz=rPoly.GetSize(); +/*?*/ for (USHORT i=0; i<nAnz; i++) { +/*?*/ ResizePoint(rPoly[i],rRef,xFact,yFact); +/*?*/ } +/*?*/ } + +/*N*/ void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetPointCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ ResizePoint(rPoly[i],rRef,xFact,yFact); +/*N*/ } +/*N*/ } + +/*N*/ void ResizeXPoly(XPolyPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.Count(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ ResizeXPoly(rPoly[i],rRef,xFact,yFact); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void RotatePoly(Polygon& rPoly, const Point& rRef, double sn, double cs) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetSize(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ RotatePoint(rPoly[i],rRef,sn,cs); +/*N*/ } +/*N*/ } + +/*N*/ void RotateXPoly(XPolygon& rPoly, const Point& rRef, double sn, double cs) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetPointCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ RotatePoint(rPoly[i],rRef,sn,cs); +/*N*/ } +/*N*/ } + +/*N*/ void RotateXPoly(XPolyPolygon& rPoly, const Point& rRef, double sn, double cs) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.Count(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ RotateXPoly(rPoly[i],rRef,sn,cs); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void ShearPoly(Polygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetSize(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ ShearPoint(rPoly[i],rRef,tn,bVShear); +/*N*/ } +/*N*/ } + +/*N*/ void ShearXPoly(XPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.GetPointCount(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ ShearPoint(rPoly[i],rRef,tn,bVShear); +/*N*/ } +/*N*/ } + +/*N*/ void ShearXPoly(XPolyPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear) +/*N*/ { +/*N*/ USHORT nAnz=rPoly.Count(); +/*N*/ for (USHORT i=0; i<nAnz; i++) { +/*N*/ ShearXPoly(rPoly[i],rRef,tn,bVShear); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@ @@@@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@ @@ @@ @@ @@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@ @@ @@ @@@@ @@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ long GetAngle(const Point& rPnt) +/*N*/ { +/*N*/ long a=0; +/*N*/ if (rPnt.Y()==0) { +/*N*/ if (rPnt.X()<0) a=-18000; +/*N*/ } else if (rPnt.X()==0) { +/*N*/ if (rPnt.Y()>0) a=-9000; +/*N*/ else a=9000; +/*N*/ } else { +/*N*/ a=Round((atan2((double)-rPnt.Y(),(double)rPnt.X())/nPi180)); +/*N*/ } +/*N*/ return a; +/*N*/ } + +/*N*/ long NormAngle180(long a) +/*N*/ { +/*N*/ while (a<18000) a+=36000; +/*N*/ while (a>=18000) a-=36000; +/*N*/ return a; +/*N*/ } + +/*N*/ long NormAngle360(long a) +/*N*/ { +/*N*/ while (a<0) a+=36000; +/*N*/ while (a>=36000) a-=36000; +/*N*/ return a; +/*N*/ } + +/*N*/ long GetLen(const Point& rPnt) +/*N*/ { +/*N*/ long x=Abs(rPnt.X()); +/*N*/ long y=Abs(rPnt.Y()); +/*N*/ if (x+y<0x8000) { // weil 7FFF * 7FFF * 2 = 7FFE0002 +/*N*/ x*=x; +/*N*/ y*=y; +/*N*/ x+=y; +/*N*/ x=Round(sqrt((double)x)); +/*N*/ return x; +/*N*/ } else { +/*?*/ double nx=x; +/*?*/ double ny=y; +/*?*/ nx*=nx; +/*?*/ ny*=ny; +/*?*/ nx+=ny; +/*?*/ nx=sqrt(nx); +/*?*/ if (nx>0x7FFFFFFF) { +/*?*/ return 0x7FFFFFFF; // Ueberlauf, mehr is nich! +/*?*/ } else { +/*?*/ return Round(nx); +/*?*/ } +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void GeoStat::RecalcSinCos() +/*N*/ { +/*N*/ if (nDrehWink==0) { +/*N*/ nSin=0.0; +/*N*/ nCos=1.0; +/*N*/ } else { +/*N*/ double a=nDrehWink*nPi180; +/*N*/ nSin=sin(a); +/*N*/ nCos=cos(a); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void GeoStat::RecalcTan() +/*N*/ { +/*N*/ if (nShearWink==0) { +/*N*/ nTan=0.0; +/*N*/ } else { +/*N*/ double a=nShearWink*nPi180; +/*N*/ nTan=tan(a); +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ Polygon Rect2Poly(const Rectangle& rRect, const GeoStat& rGeo) +/*N*/ { +/*N*/ Polygon aPol(5); +/*N*/ aPol[0]=rRect.TopLeft(); +/*N*/ aPol[1]=rRect.TopRight(); +/*N*/ aPol[2]=rRect.BottomRight(); +/*N*/ aPol[3]=rRect.BottomLeft(); +/*N*/ aPol[4]=rRect.TopLeft(); +/*N*/ if (rGeo.nShearWink!=0) ShearPoly(aPol,rRect.TopLeft(),rGeo.nTan); +/*N*/ if (rGeo.nDrehWink!=0) RotatePoly(aPol,rRect.TopLeft(),rGeo.nSin,rGeo.nCos); +/*N*/ return aPol; +/*N*/ } + +/*N*/ void Poly2Rect(const Polygon& rPol, Rectangle& rRect, GeoStat& rGeo) +/*N*/ { +/*N*/ rGeo.nDrehWink=GetAngle(rPol[1]-rPol[0]); +/*N*/ rGeo.nDrehWink=NormAngle360(rGeo.nDrehWink); +/*N*/ // Drehung ist damit im Kasten +/*N*/ rGeo.RecalcSinCos(); +/*N*/ +/*N*/ Point aPt1(rPol[1]-rPol[0]); +/*N*/ if (rGeo.nDrehWink!=0) RotatePoint(aPt1,Point(0,0),-rGeo.nSin,rGeo.nCos); // -Sin fuer Rueckdrehung +/*N*/ long nWdt=aPt1.X(); +/*N*/ +/*N*/ Point aPt0(rPol[0]); +/*N*/ Point aPt3(rPol[3]-rPol[0]); +/*N*/ if (rGeo.nDrehWink!=0) RotatePoint(aPt3,Point(0,0),-rGeo.nSin,rGeo.nCos); // -Sin fuer Rueckdrehung +/*N*/ long nHgt=aPt3.Y(); +/*N*/ long nShW=GetAngle(aPt3); +/*N*/ nShW-=27000; // ShearWink wird zur Senkrechten gemessen +/*N*/ nShW=-nShW; // Negieren, denn '+' ist Rechtskursivierung +/*N*/ +/*N*/ FASTBOOL bMirr=aPt3.Y()<0; +/*N*/ if (bMirr) { // "Punktetausch" bei Spiegelung +/*N*/ nHgt=-nHgt; +/*N*/ nShW+=18000; +/*N*/ aPt0=rPol[3]; +/*N*/ } +/*N*/ nShW=NormAngle180(nShW); +/*N*/ if (nShW<-9000 || nShW>9000) { +/*N*/ nShW=NormAngle180(nShW+18000); +/*N*/ } +/*N*/ if (nShW<-SDRMAXSHEAR) nShW=-SDRMAXSHEAR; // ShearWinkel begrenzen auf +/- 89.00 deg +/*N*/ if (nShW>SDRMAXSHEAR) nShW=SDRMAXSHEAR; +/*N*/ rGeo.nShearWink=nShW; +/*N*/ rGeo.RecalcTan(); +/*N*/ Point aRU(aPt0); +/*N*/ aRU.X()+=nWdt; +/*N*/ aRU.Y()+=nHgt; +/*N*/ rRect=Rectangle(aPt0,aRU); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ long BigMulDiv(long nVal, long nMul, long nDiv) +/*N*/ { +/*N*/ BigInt aVal(nVal); +/*N*/ aVal*=nMul; +/*N*/ if (aVal.IsNeg()!=(nDiv<0)) { +/*N*/ aVal-=nDiv/2; // fuer korrektes Runden +/*N*/ } else { +/*N*/ aVal+=nDiv/2; // fuer korrektes Runden +/*N*/ } +/*N*/ if(nDiv) +/*N*/ { +/*N*/ aVal/=nDiv; +/*N*/ return long(aVal); +/*N*/ } +/*N*/ return 0x7fffffff; +/*N*/ } + +/*NBFF*/ void Kuerzen(Fraction& rF, unsigned nDigits) +/*NBFF*/ { +/*NBFF*/ INT32 nMul=rF.GetNumerator(); +/*NBFF*/ INT32 nDiv=rF.GetDenominator(); +/*NBFF*/ FASTBOOL bNeg=FALSE; +/*NBFF*/ if (nMul<0) { nMul=-nMul; bNeg=!bNeg; } +/*NBFF*/ if (nDiv<0) { nDiv=-nDiv; bNeg=!bNeg; } +/*NBFF*/ if (nMul==0 || nDiv==0) return; +/*NBFF*/ UINT32 a; +/*NBFF*/ a=UINT32(nMul); unsigned nMulZ=0; // Fuehrende Nullen zaehlen +/*NBFF*/ while (a<0x00800000) { nMulZ+=8; a<<=8; } +/*NBFF*/ while (a<0x80000000) { nMulZ++; a<<=1; } +/*NBFF*/ a=UINT32(nDiv); unsigned nDivZ=0; // Fuehrende Nullen zaehlen +/*NBFF*/ while (a<0x00800000) { nDivZ+=8; a<<=8; } +/*NBFF*/ while (a<0x80000000) { nDivZ++; a<<=1; } +/*NBFF*/ // Anzahl der verwendeten Digits bestimmen +/*NBFF*/ int nMulDigits=32-nMulZ; +/*NBFF*/ int nDivDigits=32-nDivZ; +/*NBFF*/ // Nun bestimmen, wieviele Stellen hinten weg koennen +/*NBFF*/ int nMulWeg=nMulDigits-nDigits; if (nMulWeg<0) nMulWeg=0; +/*NBFF*/ int nDivWeg=nDivDigits-nDigits; if (nDivWeg<0) nDivWeg=0; +/*NBFF*/ int nWeg=Min(nMulWeg,nDivWeg); +/*NBFF*/ nMul>>=nWeg; +/*NBFF*/ nDiv>>=nWeg; +/*NBFF*/ if (nMul==0 || nDiv==0) { +/*NBFF*/ DBG_WARNING("Oups, beim kuerzen einer Fraction hat sich Joe verrechnet."); +/*NBFF*/ return; +/*NBFF*/ } +/*NBFF*/ if (bNeg) nMul=-nMul; +/*NBFF*/ rF=Fraction(nMul,nDiv); +/*NBFF*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Wieviele eU-Einheiten passen in einen mm bzw. Inch? +// Oder wie gross ist ein eU in mm bzw. Inch, und davon der Kehrwert + + + +// Den Faktor berechnen, der anzuwenden ist um n Einheiten von eS nach +// eD umzurechnen. Z.B. GetMapFactor(UNIT_MM,UNIT_100TH_MM) => 100. + + + + +/*?*/ FrPair GetMapFactor(FieldUnit eS, FieldUnit eD) +/*?*/ { +/*?*/ if (eS==eD) return FrPair(1,1,1,1); +/*?*/ {DBG_BF_ASSERT(0, "STRIP");}return FrPair(1,1,1,1);//STRIP001 //STRIP001 /*?*/ FrPair aS(GetInchOrMM(eS)); +/*?*/ }; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + // 1 mile = 8 furlong = 63.360" = 1.609.344,0mm + // 1 furlong = 10 chains = 7.920" = 201.168,0mm + // 1 chain = 4 poles = 792" = 20.116,8mm + // 1 pole = 5 1/2 yd = 198" = 5.029,2mm + // 1 yd = 3 ft = 36" = 914,4mm + // 1 ft = 12 " = 1" = 304,8mm + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdtxhdl.cxx b/binfilter/bf_svx/source/svdraw/svx_svdtxhdl.cxx new file mode 100644 index 000000000000..ce439b264116 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdtxhdl.cxx @@ -0,0 +1,396 @@ +/* -*- 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 "svdtxhdl.hxx" +#include <limits.h> +#include "svdmodel.hxx" +#include "svdotext.hxx" +#include "svdoutl.hxx" + + +#include <outlobj.hxx> + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #101499# + +#include <com/sun/star/i18n/ScriptType.hdl> + + + +#include <com/sun/star/i18n/CharacterIteratorMode.hdl> + + +#include "xoutx.hxx" + +namespace binfilter { + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::i18n; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ ImpTextPortionHandler::ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj): +/*N*/ rOutliner(rOutln), +/*N*/ rTextObj(rTxtObj), +/*N*/ // #101498# aPoly(0) +/*N*/ mpRecordPortions(0L) +/*N*/ { +/*N*/ pModel=rTextObj.GetModel(); +/*N*/ MapMode aMap=aVDev.GetMapMode(); +/*N*/ +/*N*/ aMap.SetMapUnit(pModel->GetScaleUnit()); +/*N*/ aMap.SetScaleX(pModel->GetScaleFraction()); +/*N*/ aMap.SetScaleY(pModel->GetScaleFraction()); +/*N*/ aVDev.SetMapMode(aMap); +/*N*/ } + + +/*N*/ void ImpTextPortionHandler::DrawTextToPath(ExtOutputDevice& rXOut, FASTBOOL bDrawEffect) +/*N*/ { +/*N*/ aFormTextBoundRect=Rectangle(); +/*N*/ const Rectangle& rBR = rTextObj.GetSnapRect(); +/*N*/ +/*N*/ bDraw = bDrawEffect; +/*N*/ +/*N*/ OutlinerParaObject* pPara=rTextObj.GetOutlinerParaObject(); +/*N*/ if (rTextObj.IsTextEditActive()) { +/*?*/ pPara=rTextObj.GetEditOutlinerParaObject(); +/*N*/ } +/*N*/ if (pPara!=NULL) { +/*N*/ XPolyPolygon aXPP; +/*N*/ //rTextObj.TakeContour(aXPP); +/*N*/ rTextObj.TakeXorPoly(aXPP,FALSE); +/*N*/ pXOut=&rXOut; +/*N*/ Font aFont(rXOut.GetOutDev()->GetFont()); +/*N*/ rOutliner.Clear(); +/*N*/ rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX)); +/*N*/ rOutliner.SetText(*pPara); +/*N*/ USHORT nCnt = Min(aXPP.Count(), (USHORT) rOutliner.GetParagraphCount()); +/*N*/ +/*N*/ if ( nCnt == 1 ) bToLastPoint = TRUE; +/*N*/ else bToLastPoint = FALSE; +/*N*/ +/*N*/ // #101498# completely different methodology needed here for making this BIDI-able +/*N*/ // iterate over paragraphs and Polygons, thus each paragraph will be put to +/*N*/ // one Polygon +/*N*/ const sal_uInt32 nSavedLayoutMode(rXOut.GetOutDev()->GetLayoutMode()); +/*N*/ sal_uInt32 nLayoutMode(nSavedLayoutMode); +/*N*/ +/*N*/ if(TRUE) +/*N*/ { +/*N*/ nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL); +/*N*/ nLayoutMode |= ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG); +/*N*/ } +/*N*/ +/*N*/ rXOut.GetOutDev()->SetLayoutMode(nLayoutMode); +/*N*/ +/*N*/ for(nParagraph = 0; nParagraph < nCnt; nParagraph++) +/*N*/ { +/*N*/ Polygon aPoly = XOutCreatePolygon(aXPP[sal_uInt16(nParagraph)], rXOut.GetOutDev()); +/*N*/ +/*N*/ rOutliner.SetDrawPortionHdl(LINK(this, ImpTextPortionHandler, FormTextRecordPortionHdl)); +/*N*/ rOutliner.StripPortions(); +/*N*/ +/*N*/ DrawFormTextRecordPortions(aPoly); +/*N*/ ClearFormTextRecordPortions(); +/*N*/ +/*N*/ const Rectangle& rFTBR = rXOut.GetFormTextBoundRect(); +/*N*/ aFormTextBoundRect.Union(rFTBR); +/*N*/ } +/*N*/ +/*N*/ rXOut.GetOutDev()->SetLayoutMode(nSavedLayoutMode); +/*N*/ +/*N*/ //for (nParagraph = 0; nParagraph < nCnt; nParagraph++) +/*N*/ //{ +/*N*/ // aPoly = XOutCreatePolygon(aXPP[USHORT(nParagraph)], rXOut.GetOutDev()); +/*N*/ // nTextWidth = 0; +/*N*/ // +/*N*/ // rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,FormTextWidthHdl)); +/*N*/ // rOutliner.StripPortions(); +/*N*/ // rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,FormTextDrawHdl)); +/*N*/ // rOutliner.StripPortions(); +/*N*/ // rOutliner.SetDrawPortionHdl(Link()); +/*N*/ // +/*N*/ // const Rectangle& rFTBR=rXOut.GetFormTextBoundRect(); +/*N*/ // aFormTextBoundRect.Union(rFTBR); +/*N*/ //} +/*N*/ +/*N*/ rXOut.GetOutDev()->SetFont(aFont); +/*N*/ rOutliner.Clear(); +/*N*/ } +/*N*/ if (rTextObj.IsTextEditActive()) { +/*?*/ delete pPara; +/*N*/ } +/*N*/ } + +// #101498# Record and sort all portions +/*N*/ IMPL_LINK(ImpTextPortionHandler, FormTextRecordPortionHdl, DrawPortionInfo*, pInfo) +/*N*/ { +/*N*/ if(pInfo->nPara == nParagraph) +/*N*/ { +/*N*/ SortedAddFormTextRecordPortion(pInfo); +/*N*/ } +/*N*/ +/*N*/ return 0; +/*N*/ } + +// #101498# Helper class to remember text portions in sorted manner +/*N*/ class ImpRecordPortion +/*N*/ { +/*N*/ public: +/*N*/ Point maPosition; +/*N*/ String maText; +/*N*/ xub_StrLen mnTextStart; +/*N*/ xub_StrLen mnTextLength; +/*N*/ sal_uInt16 mnPara; +/*N*/ xub_StrLen mnIndex; +/*N*/ +/*N*/ // #102819# Here SvxFont needs to be used instead of Font +/*N*/ SvxFont maFont; +/*N*/ +/*N*/ sal_Int32* mpDXArray; +/*N*/ sal_uInt8 mnBiDiLevel; +/*N*/ +/*N*/ ImpRecordPortion(DrawPortionInfo* pInfo); +/*N*/ ~ImpRecordPortion(); +/*N*/ +/*N*/ sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } +/*N*/ }; + +/*N*/ ImpRecordPortion::ImpRecordPortion(DrawPortionInfo* pInfo) +/*N*/ : maPosition(pInfo->rStartPos), +/*N*/ maText(pInfo->rText), +/*N*/ mnTextStart((xub_StrLen)pInfo->nTextStart), +/*N*/ mnTextLength((xub_StrLen)pInfo->nTextLen), +/*N*/ mnPara(pInfo->nPara), +/*N*/ mnIndex(pInfo->nIndex), +/*N*/ maFont(pInfo->rFont), +/*N*/ mpDXArray(NULL), +/*N*/ mnBiDiLevel(pInfo->GetBiDiLevel()) +/*N*/ { +/*N*/ if(pInfo->pDXArray) +/*N*/ { +/*N*/ mpDXArray = new sal_Int32[pInfo->nTextLen]; +/*N*/ +/*N*/ for(sal_uInt32 a(0L); a < pInfo->nTextLen; a++) +/*N*/ { +/*N*/ mpDXArray[a] = pInfo->pDXArray[a]; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ImpRecordPortion::~ImpRecordPortion() +/*N*/ { +/*N*/ if(mpDXArray) +/*N*/ { +/*N*/ delete[] mpDXArray; +/*N*/ } +/*N*/ } + +/*N*/ // #101498# List classes for recording portions +/*N*/ DECLARE_LIST(ImpRecordPortionList, ImpRecordPortion*)//STRIP008 ; +/*N*/ DECLARE_LIST(ImpRecordPortionListList, ImpRecordPortionList*)//STRIP008 ; + +/*N*/ // #101498# Draw recorded formtext along Poly +/*N*/ void ImpTextPortionHandler::DrawFormTextRecordPortions(Polygon aPoly) +/*N*/ { +/*N*/ sal_Int32 nTextWidth = -((sal_Int32)GetFormTextPortionsLength(pXOut->GetOutDev())); +/*N*/ +/*N*/ ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions; +/*N*/ if(pListList) +/*N*/ { +/*N*/ for(sal_uInt32 a(0L); a < pListList->Count(); a++) +/*N*/ { +/*N*/ ImpRecordPortionList* pList = pListList->GetObject(a); +/*N*/ +/*N*/ for(sal_uInt32 b(0L); b < pList->Count(); b++) +/*N*/ { +/*N*/ ImpRecordPortion* pPortion = pList->GetObject(b); +/*N*/ +/*N*/ DrawPortionInfo aNewInfo( +/*N*/ pPortion->maPosition, +/*N*/ pPortion->maText, +/*N*/ pPortion->mnTextStart, +/*N*/ pPortion->mnTextLength, +/*N*/ pPortion->maFont, +/*N*/ pPortion->mnPara, +/*N*/ pPortion->mnIndex, +/*N*/ pPortion->mpDXArray, +/*N*/ pPortion->mnBiDiLevel); +/*N*/ +/*N*/ nTextWidth = pXOut->DrawFormText(&aNewInfo, aPoly, nTextWidth, bToLastPoint, bDraw); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ // #101498# Insert new portion sorted +/*N*/ void ImpTextPortionHandler::SortedAddFormTextRecordPortion(DrawPortionInfo* pInfo) +/*N*/ { +/*N*/ // get ListList and create on demand +/*N*/ ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions; +/*N*/ if(!pListList) +/*N*/ { +/*N*/ mpRecordPortions = (void*)(new ImpRecordPortionListList(2, 2)); +/*N*/ pListList = (ImpRecordPortionListList*)mpRecordPortions; +/*N*/ } +/*N*/ +/*N*/ // create new portion +/*N*/ ImpRecordPortion* pNewPortion = new ImpRecordPortion(pInfo); +/*N*/ +/*N*/ // look for the list where to insert new portion +/*N*/ ImpRecordPortionList* pList = 0L; +/*N*/ +/*N*/ for(sal_uInt32 nListListIndex(0L); !pList && nListListIndex < pListList->Count(); nListListIndex++) +/*N*/ { +/*?*/ ImpRecordPortionList* pTmpList = pListList->GetObject(nListListIndex); +/*?*/ +/*?*/ if(pTmpList->GetObject(0)->maPosition.Y() == pNewPortion->maPosition.Y()) +/*?*/ pList = pTmpList; +/*N*/ } +/*N*/ +/*N*/ if(!pList) +/*N*/ { +/*N*/ // no list for that Y-Coordinate yet, create a new one. +/*N*/ pList = new ImpRecordPortionList(8, 8); +/*N*/ pList->Insert(pNewPortion, LIST_APPEND); +/*N*/ pListList->Insert(pList, LIST_APPEND); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // found a list for that for that Y-Coordinate, sort in +/*?*/ sal_uInt32 nInsertInd(0L); +/*?*/ +/*?*/ while(nInsertInd < pList->Count() +/*?*/ && pList->GetObject(nInsertInd)->maPosition.X() < pNewPortion->maPosition.X()) +/*?*/ { +/*?*/ nInsertInd++; +/*?*/ } +/*?*/ +/*?*/ if(nInsertInd == pList->Count()) +/*?*/ nInsertInd = LIST_APPEND; +/*?*/ +/*?*/ pList->Insert(pNewPortion, nInsertInd); +/*N*/ } +/*N*/ } + +// #101498# Calculate complete length of FormTextPortions +/*N*/ sal_uInt32 ImpTextPortionHandler::GetFormTextPortionsLength(OutputDevice* pOut) +/*N*/ { +/*N*/ sal_uInt32 nRetval(0L); +/*N*/ +/*N*/ ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions; +/*N*/ if(pListList) +/*N*/ { +/*N*/ for(sal_uInt32 a(0L); a < pListList->Count(); a++) +/*N*/ { +/*N*/ ImpRecordPortionList* pList = pListList->GetObject(a); +/*N*/ +/*N*/ for(sal_uInt32 b(0L); b < pList->Count(); b++) +/*N*/ { +/*N*/ ImpRecordPortion* pPortion = pList->GetObject(b); +/*N*/ +/*N*/ if(pPortion->mpDXArray) +/*N*/ { +/*N*/ if(pPortion->maFont.IsVertical() && pOut) +/*?*/ nRetval += pOut->GetTextHeight() * pPortion->mnTextLength; +/*N*/ else +/*N*/ nRetval += pPortion->mpDXArray[pPortion->mnTextLength - 1]; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nRetval; +/*N*/ } + +// #101498# Cleanup recorded portions +/*N*/ void ImpTextPortionHandler::ClearFormTextRecordPortions() +/*N*/ { +/*N*/ ImpRecordPortionListList* pListList = (ImpRecordPortionListList*)mpRecordPortions; +/*N*/ if(pListList) +/*N*/ { +/*N*/ for(sal_uInt32 a(0L); a < pListList->Count(); a++) +/*N*/ { +/*N*/ ImpRecordPortionList* pList = pListList->GetObject(a); +/*N*/ +/*N*/ for(sal_uInt32 b(0L); b < pList->Count(); b++) +/*N*/ { +/*N*/ delete pList->GetObject(b); +/*N*/ } +/*N*/ +/*N*/ delete pList; +/*N*/ } +/*N*/ +/*N*/ delete pListList; +/*N*/ mpRecordPortions = (void*)0L; +/*N*/ } +/*N*/ } + + + + +//IMPL_LINK(ImpTextPortionHandler, FormTextWidthHdl, DrawPortionInfo*, pInfo) +//{ +// // #101498# change calculation of nTextWidth +// if(pInfo->nPara == nParagraph && pInfo->nTextLen) +// { +// // negative value is used because of the interface of +// // XOutputDevice::ImpDrawFormText(...), please look there +// // for more info. +// nTextWidth -= pInfo->pDXArray[pInfo->nTextLen - 1]; +// } +// +// return 0; +//} + +//IMPL_LINK(ImpTextPortionHandler, FormTextDrawHdl, DrawPortionInfo*, pInfo) +//{ +// // #101498# Implementation of DrawFormText needs to be updated, too. +// if(pInfo->nPara == nParagraph) +// { +// nTextWidth = pXOut->DrawFormText(pInfo, aPoly, nTextWidth, bToLastPoint, bDraw); +// //pInfo->rText, aPoly, pInfo->rFont, nTextWidth, +// //bToLastPoint, bDraw, pInfo->pDXArray); +// } +// +// return 0; +//} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdundo.cxx b/binfilter/bf_svx/source/svdraw/svx_svdundo.cxx new file mode 100644 index 000000000000..6992a23e57be --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdundo.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 "svdundo.hxx" +#include "svdstr.hrc" // Namen aus der Resource +#include "scene3d.hxx" + + +// #i11426# + +// #109587# + +// #109587# +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoGroup::SdrUndoGroup(SdrModel& rNewMod) +/*N*/ : SdrUndoAction(rNewMod), +/*N*/ aBuf(1024,32,32), +/*N*/ eFunction(SDRREPFUNC_OBJ_NONE) /*#72642#*/ +/*N*/ {} + +/*N*/ SdrUndoGroup::~SdrUndoGroup() +/*N*/ { +/*N*/ Clear(); +/*N*/ } + +/*N*/ void SdrUndoGroup::Clear() +/*N*/ { +/*N*/ for (ULONG nu=0; nu<GetActionCount(); nu++) { +/*N*/ SdrUndoAction* pAct=GetAction(nu); +/*N*/ delete pAct; +/*N*/ } +/*N*/ aBuf.Clear(); +/*N*/ } + +/*N*/ void SdrUndoGroup::AddAction(SdrUndoAction* pAct) +/*N*/ { +/*N*/ aBuf.Insert(pAct,CONTAINER_APPEND); +/*N*/ } + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@@@@ @@ @@@@ @@ @@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@ @@@@@ @@@@ @@@@@ @@@@ @@ @@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoObj::SdrUndoObj(SdrObject& rNewObj): +/*N*/ SdrUndoAction(*rNewObj.GetModel()), +/*N*/ pObj(&rNewObj) +/*N*/ { +/*N*/ } + + +// #94278# common call method for evtl. page change when UNDO/REDO +// is triggered + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj): +/*N*/ SdrUndoObj(rNewObj), +/*N*/ pUndoGeo(NULL), +/*N*/ pRedoGeo(NULL), +/*N*/ pUndoGroup(NULL) +/*N*/ { +/*N*/ SdrObjList* pOL=rNewObj.GetSubList(); +/*N*/ if (pOL!=NULL && pOL->GetObjCount() && !rNewObj.ISA(E3dScene)) +/*N*/ { +/*?*/ // Aha, Gruppenobjekt +/*?*/ // AW: Aber keine 3D-Szene, dann nur fuer die Szene selbst den Undo anlegen +/*?*/ pUndoGroup=new SdrUndoGroup(*pObj->GetModel()); +/*?*/ ULONG nObjAnz=pOL->GetObjCount(); +/*?*/ for (ULONG nObjNum=0; nObjNum<nObjAnz; nObjNum++) { +/*?*/ pUndoGroup->AddAction(new SdrUndoGeoObj(*pOL->GetObj(nObjNum))); +/*?*/ } +/*N*/ } else { +/*N*/ pUndoGeo=pObj->GetGeoData(); +/*N*/ } +/*N*/ } + +/*N*/ SdrUndoGeoObj::~SdrUndoGeoObj() +/*N*/ { +/*N*/ if (pUndoGeo!=NULL) delete pUndoGeo; +/*N*/ if (pRedoGeo!=NULL) delete pRedoGeo; +/*N*/ if (pUndoGroup!=NULL) delete pUndoGroup; +/*N*/ } + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, FASTBOOL bOrdNumDirect): +/*N*/ pView(NULL), +/*N*/ pPageView(NULL), +/*N*/ SdrUndoObj(rNewObj), +/*N*/ bOwner(FALSE) +/*N*/ { +/*N*/ pObjList=pObj->GetObjList(); +/*N*/ if (bOrdNumDirect) { +/*?*/ nOrdNum=pObj->GetOrdNumDirect(); +/*N*/ } else { +/*N*/ nOrdNum=pObj->GetOrdNum(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ SdrUndoObjList::~SdrUndoObjList() +/*N*/ { +/*N*/ if (pObj!=NULL && IsOwner()) +/*N*/ { +/*N*/ // Attribute muessen wieder in den regulaeren Pool +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SetOwner(FALSE); +/*?*/ +/*?*/ // nun loeschen +/*N*/ } +/*N*/ } + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #i11702# + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@@@ @@ @@ @@@@@ @@@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@@@@@ @@@@ @@@@ @@@@@ +// @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ +// @@@@@ @@ @@ @@ @@@@@ @@ @@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@@@@ @@@@ @@@@ @@@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ +// @@@@@ @@@@@@ @@ @@@ @@@@ @@@@ +// @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@@@@ @@@@@ @@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoPage::SdrUndoPage(SdrPage& rNewPg): +/*N*/ SdrUndoAction(*rNewPg.GetModel()), pPage(&rNewPg) +/*N*/ { } + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrUndoPageList::SdrUndoPageList(SdrPage& rNewPg): +/*N*/ SdrUndoPage(rNewPg), +/*N*/ bItsMine(FALSE) +/*N*/ { +/*N*/ nPageNum=rNewPg.GetPageNum(); +/*N*/ } + +/*N*/ SdrUndoPageList::~SdrUndoPageList() +/*N*/ { +/*N*/ if(bItsMine && pPage) +/*N*/ { +/*?*/ delete pPage; +/*?*/ pPage = 0L; +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// @@ @@ @@@@ @@@@ @@@@@@ @@@@@ @@@@@ @@@@@ @@@@ @@@@ @@@@@ @@@@ +// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@@@@@@ @@@@@@ @@@@ @@ @@@@ @@@@@ @@@@@ @@@@@@ @@ @@@ @@@@ @@@@ +// @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ +// @@ @@ @@ @@ @@@@ @@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@@@@ @@@@ +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdview.cxx b/binfilter/bf_svx/source/svdraw/svx_svdview.cxx new file mode 100644 index 000000000000..816f77b3e9bd --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdview.cxx @@ -0,0 +1,232 @@ +/* -*- 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 <eeitem.hxx> + +#include "svdio.hxx" +#include "svdstr.hrc" // Namen aus der Resource +#include "svdglob.hxx" // StringCache +#include "svdpagv.hxx" +#include "svdopath.hxx" // fuer GetContext +#include "svdograf.hxx" // fuer GetContext +#include "svdview.hxx" +#include "editview.hxx" // fuer GetField +#define ITEMID_FIELD EE_FEATURE_FIELD /* wird fuer #include <flditem.hxx> benoetigt */ + + +#include "itemdata.hxx" + +#include "flditem.hxx" // fuer URLField +#include "svdoutl.hxx" + +// #90477# +#include <tools/tenccvt.hxx> +namespace binfilter { + +/*N*/ TYPEINIT1(SdrView,SdrCreateView); + +/*N*/ SdrView::SdrView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrCreateView(pModel1,pOut), +/*N*/ bNoExtendedMouseDispatcher(FALSE), +/*N*/ bNoExtendedKeyDispatcher(FALSE), +/*N*/ bNoExtendedCommandDispatcher(FALSE) +/*N*/ { +/*N*/ bTextEditOnObjectsWithoutTextIfTextTool=FALSE; +/*N*/ +/*N*/ +/*N*/ onAccessibilityOptionsChanged(); +/*N*/ } + +/*N*/ SdrView::SdrView(SdrModel* pModel1): +/*N*/ SdrCreateView(pModel1,(OutputDevice*)NULL), +/*N*/ bNoExtendedMouseDispatcher(FALSE), +/*N*/ bNoExtendedKeyDispatcher(FALSE), +/*N*/ bNoExtendedCommandDispatcher(FALSE) +/*N*/ { +/*N*/ bTextEditOnObjectsWithoutTextIfTextTool=FALSE; +/*N*/ +/*N*/ +/*N*/ onAccessibilityOptionsChanged(); +/*N*/ } + +/*N*/ SdrView::~SdrView() +/*N*/ { +/*N*/ } + + + + + + +/* new interface src537 */ + + + +// Mit der Maus draggen (Move) +// Beispiel beim erzeugen eines Rechtecks. MouseDown muss ohne +// ModKey erfolgen, weil sonst i.d.R. Markieren forciert wird (s.u.) +// Drueckt man dann beim MouseMove gleichzeitig Shift, Ctrl, und Alt, +// so erzeugt man ein zentrisches Quadrat ohne Fang. +// Die Doppelbelegung von Ortho und Shift stellt i.d.R. kein Problem dar, +// da sich beides meisst gegenseitig ausschliesst. Einzig Shear (das beim +// Verzerren, nicht dass beim Drehen) beruecksichtigt beides gleichzeitig. +// Dass muss der Anwender erstmal noch umschiffen (z.B. mit einer Hilfslinie). +#define MODKEY_NoSnap bCtrl /* Fang temporaer aus */ +#define MODKEY_Ortho bShift /* na eben ortho */ +#define MODKEY_Center bAlt /* Zentrisch erzeugen/resizen */ +//#define MODKEY_BigOrtho bAlt +#define MODKEY_AngleSnap bShift +#define MODKEY_CopyDrag bCtrl /* Draggen mit kopieren */ + +// irgendwo hinklicken (MouseDown) +#define MODKEY_PolyPoly bAlt /* Neues Poly bei InsPt und bei Create */ +#define MODKEY_MultiMark bShift /* MarkObj ohne vorher UnmarkAll */ +#define MODKEY_Unmark bAlt /* Unmark durch Rahmenaufziehen */ +#define MODKEY_ForceMark bCtrl /* Rahmenaufziehen erzwingen, auch wenn Obj an MausPos */ +#define MODKEY_DeepMark bAlt /* MarkNextObj */ +#define MODKEY_DeepBackw bShift /* MarkNextObj rueckwaerts */ + +} //namespace binfilter +#include "outlobj.hxx" +namespace binfilter {//STRIP009 + +/*N*/ void SdrView::UnmarkAll() +/*N*/ { +/*N*/ if (IsTextEdit()) { +/*?*/ ESelection eSel=GetTextEditOutlinerView()->GetSelection(); +/*?*/ eSel.nStartPara=eSel.nEndPara; +/*?*/ eSel.nStartPos=eSel.nEndPos; +/*?*/ GetTextEditOutlinerView()->SetSelection(eSel); +/*?*/ #ifndef SVX_LIGHT +/*?*/ if (pItemBrowser!=NULL) {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pItemBrowser->SetDirty(); +/*?*/ #endif +/*N*/ } else if (HasMarkedGluePoints()) UnmarkAllGluePoints(); +/*N*/ else if (HasMarkedPoints()) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 UnmarkAllPoints(); // ! Marked statt Markable ! +/*N*/ else UnmarkAllObj(); +/*N*/ } + + + + + + + + +/*N*/ void SdrView::DeleteMarked() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + + + +/*N*/ void SdrView::WriteRecords(SvStream& rOut) const +/*N*/ { +/*N*/ { +/*N*/ // Der CharSet muss! als erstes rausgestreamt werden +/*N*/ SdrNamedSubRecord aSubRecord(rOut,STREAM_WRITE,SdrInventor,SDRIORECNAME_VIEWCHARSET); +/*N*/ +/*N*/ // UNICODE: +/*N*/ // rtl_TextEncoding eOutCharSet=rOut.GetStreamCharSet(); +/*N*/ rtl_TextEncoding eOutCharSet = gsl_getSystemTextEncoding(); +/*N*/ +/*N*/ // #90477# rOut << UINT16( GetStoreCharSet( eOutCharSet ) ); +/*N*/ rOut << (UINT16)GetSOStoreTextEncoding(eOutCharSet, (sal_uInt16)rOut.GetVersion()); +/*N*/ } +/*N*/ SdrCreateView::WriteRecords(rOut); +/*N*/ } + +/*N*/ BOOL SdrView::ReadRecord(const SdrIOHeader& rViewHead, +/*N*/ const SdrNamedSubRecord& rSubHead, +/*N*/ SvStream& rIn) +/*N*/ { +/*N*/ BOOL bRet=FALSE; +/*N*/ if (rSubHead.GetInventor()==SdrInventor) { +/*N*/ bRet=TRUE; +/*N*/ switch (rSubHead.GetIdentifier()) { +/*N*/ case SDRIORECNAME_VIEWCHARSET: { +/*N*/ UINT16 nCharSet; +/*N*/ // #90477# rIn>>nCharSet; +/*N*/ // rIn.SetStreamCharSet(rtl_TextEncoding(nCharSet)); +/*N*/ rIn >> nCharSet; +/*N*/ rIn.SetStreamCharSet(GetSOLoadTextEncoding((rtl_TextEncoding)nCharSet, (sal_uInt16)rIn.GetVersion())); +/*N*/ } break; +/*N*/ default: bRet=FALSE; +/*N*/ } +/*N*/ } +/*N*/ if (!bRet) bRet=SdrCreateView::ReadRecord(rViewHead,rSubHead,rIn); +/*N*/ return bRet; +/*N*/ } + +/*N*/ SvStream& operator<<(SvStream& rOut, const SdrView& rView) +/*N*/ { +/*N*/ SdrIOHeader aHead(rOut,STREAM_WRITE,SdrIOViewID); +/*N*/ rView.WriteRecords(rOut); +/*N*/ return rOut; +/*N*/ } + +/*N*/ SvStream& operator>>(SvStream& rIn, SdrView& rView) +/*N*/ { +/*N*/ if (rIn.GetError()!=0) return rIn; +/*N*/ rView.BrkAction(); +/*N*/ rView.Clear(); +/*N*/ SdrIOHeader aHead(rIn,STREAM_READ); +/*N*/ if (!aHead.IsMagic()) { +/*N*/ rIn.SetError(SVSTREAM_FILEFORMAT_ERROR); // Format-Fehler +/*N*/ return rIn; +/*N*/ } +/*N*/ rtl_TextEncoding eStreamCharSetMerker=rIn.GetStreamCharSet(); // Der StreamCharSet wird von SdrView::ReadRecord() gesetzt +/*N*/ while (aHead.GetBytesLeft()>0 && rIn.GetError()==0 && !rIn.IsEof()) { +/*N*/ SdrNamedSubRecord aSubRecord(rIn,STREAM_READ); +/*N*/ rView.ReadRecord(aHead,aSubRecord,rIn); +/*N*/ } +/*N*/ +/*N*/ rIn.SetStreamCharSet(eStreamCharSetMerker); // StreamCharSet wieder restaurieren +/*N*/ +/*N*/ rView.InvalidateAllWin(); +/*N*/ return rIn; +/*N*/ } + + +/*N*/ void SdrView::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType) +/*N*/ { +/*N*/ if( rHint.ISA( SfxSimpleHint ) && ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) +/*N*/ { +/*?*/ onAccessibilityOptionsChanged(); +/*N*/ } +/*N*/ +/*N*/ SdrCreateView::SFX_NOTIFY(rBC, rBCType, rHint, rHintType ); +/*N*/ } + + +/** method is called whenever the global SvtAccessibilityOptions is changed */ +/*N*/ void SdrView::onAccessibilityOptionsChanged() +/*N*/ { +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdviter.cxx b/binfilter/bf_svx/source/svdraw/svx_svdviter.cxx new file mode 100644 index 000000000000..3de19e113612 --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdviter.cxx @@ -0,0 +1,196 @@ +/* -*- 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 "svdviter.hxx" +#include "svdpage.hxx" +#include "svdview.hxx" +#include "svdpagv.hxx" + +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SdrViewIter::ImpInitVars() +/*N*/ { +/*N*/ nListenerNum=0; +/*N*/ nPageViewNum=0; +/*N*/ nOutDevNum=0; +/*N*/ pAktView=NULL; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrViewIter::SdrViewIter(const SdrObject* pObject_, FASTBOOL bNoMasterPage_) +/*N*/ { +/*N*/ pObject=pObject_; +/*N*/ pModel=pObject_!=NULL ? pObject_->GetModel() : NULL; +/*N*/ pPage=pObject_!=NULL ? pObject_->GetPage() : NULL; +/*N*/ bNoMasterPage=bNoMasterPage_; +/*N*/ if (pModel==NULL || pPage==NULL) { +/*N*/ pModel=NULL; +/*N*/ pPage=NULL; +/*N*/ } +/*N*/ ImpInitVars(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ FASTBOOL SdrViewIter::ImpCheckPageView(SdrPageView* pPV) const +/*N*/ { +/*N*/ if (pPage!=NULL) { +/*N*/ FASTBOOL bMaster=pPage->IsMasterPage(); +/*N*/ USHORT nPageNum=pPage->GetPageNum(); +/*N*/ SdrPage* pPg=pPV->GetPage(); +/*N*/ if (pPg==pPage) { +/*N*/ if (pObject!=NULL) { +/*N*/ // Objekt gewuenscht? Na dann erstmal sehen, ob +/*N*/ // das Obj in dieser PageView auch sichtbar ist. +/*N*/ SetOfByte aObjLay; +/*N*/ pObject->GetLayer(aObjLay); +/*N*/ aObjLay&=pPV->GetVisibleLayers(); +/*N*/ return !aObjLay.IsEmpty(); +/*N*/ } else { +/*N*/ return TRUE; +/*N*/ } +/*N*/ } else { +/*N*/ if (!bNoMasterPage && bMaster && (pObject==NULL || !pObject->IsNotVisibleAsMaster())) { +/*N*/ USHORT nMasterPageAnz=pPg->GetMasterPageCount(); +/*N*/ USHORT nMasterPagePos=0; +/*N*/ while (nMasterPagePos<nMasterPageAnz) { +/*N*/ if (nPageNum==pPg->GetMasterPageNum(nMasterPagePos)) { +/*N*/ // Aha, die gewuenschte Page ist also MasterPage in dieser PageView +/*N*/ if (pObject!=NULL) { +/*N*/ // Objekt gewuenscht? Na dann erstmal sehen, ob +/*N*/ // das Obj in dieser PageView auch sichtbar ist. +/*N*/ SetOfByte aObjLay; +/*N*/ pObject->GetLayer(aObjLay); +/*N*/ aObjLay&=pPV->GetVisibleLayers(); +/*N*/ aObjLay&=pPg->GetMasterPageVisibleLayers(nMasterPagePos); +/*N*/ if (!aObjLay.IsEmpty()) { +/*N*/ return TRUE; +/*N*/ } // ansonsten die naechste MasterPage der Page ansehen... +/*N*/ } else { +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ nMasterPagePos++; +/*N*/ } +/*N*/ } +/*N*/ // MasterPage nicht erlaubt oder keine passende gefunden +/*N*/ return FALSE; +/*N*/ } +/*N*/ } else { +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrView* SdrViewIter::ImpFindView() +/*N*/ { +/*N*/ if (pModel!=NULL) { +/*N*/ USHORT nLsAnz=pModel->GetListenerCount(); +/*N*/ while (nListenerNum<nLsAnz) { +/*N*/ SfxListener* pLs=pModel->GetListener(nListenerNum); +/*N*/ pAktView=PTR_CAST(SdrView,pLs); +/*N*/ if (pAktView!=NULL) { +/*N*/ if (pPage!=NULL) { +/*N*/ USHORT nPvAnz=pAktView->GetPageViewCount(); +/*N*/ USHORT nPvNum=0; +/*N*/ while (nPvNum<nPvAnz) { +/*N*/ SdrPageView* pPV=pAktView->GetPageViewPvNum(nPvNum); +/*N*/ if (ImpCheckPageView(pPV)) { +/*N*/ return pAktView; +/*N*/ } +/*N*/ nPvNum++; +/*N*/ } +/*N*/ } else { +/*N*/ return pAktView; +/*N*/ } +/*N*/ } +/*N*/ nListenerNum++; +/*N*/ } +/*N*/ } +/*N*/ pAktView=NULL; +/*N*/ return pAktView; +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrView* SdrViewIter::FirstView() +/*N*/ { +/*N*/ ImpInitVars(); +/*N*/ return ImpFindView(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrView* SdrViewIter::NextView() +/*N*/ { +/*N*/ nListenerNum++; +/*N*/ return ImpFindView(); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdvmark.cxx b/binfilter/bf_svx/source/svdraw/svx_svdvmark.cxx new file mode 100644 index 000000000000..ba0c1b362dcf --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdvmark.cxx @@ -0,0 +1,109 @@ +/* -*- 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 "svdvmark.hxx" +#include "svdobj.hxx" +#include "svdpntv.hxx" + +namespace binfilter { + +/*N*/ SdrViewUserMarker::SdrViewUserMarker(SdrPaintView* pView_) +/*N*/ : pView(pView_), +/*N*/ pForcedOutDev(NULL), +/*N*/ pPoint(NULL), +/*N*/ pRect(NULL), +/*N*/ pPoly(NULL), +/*N*/ pPolyPoly(NULL), +/*N*/ pXPoly(NULL), +/*N*/ pXPolyPoly(NULL), +/*N*/ eAlign(SDRMARKER_ALIGNCENTER), +/*N*/ nPixelDistance(0), +/*N*/ nLineWdt(0), +/*N*/ nCrossSize(0), +/*N*/ bLineWdtLog(FALSE), +/*N*/ bCrossSizeLog(FALSE), +/*N*/ bSolidArea(FALSE), +/*N*/ bDashed(FALSE), +/*N*/ bCrossHair(FALSE), +/*N*/ bStripes(FALSE), +/*N*/ bEllipse(FALSE), +/*N*/ bPolyLine(FALSE), +/*N*/ bAnimate(FALSE), +/*N*/ bVisible(FALSE), +/*N*/ nAnimateDelay(0), +/*N*/ nAnimateSpeed(0), +/*N*/ nAnimateAnz(0), +/*N*/ bAnimateBwd(FALSE), +/*N*/ bAnimateToggle(FALSE), +/*N*/ nAnimateDelayCountDown(0), +/*N*/ nAnimateSpeedCountDown(0), +/*N*/ nAnimateNum(0), +/*N*/ bHasPointer(FALSE), +/*N*/ bMouseMovable(FALSE) +/*N*/ { +/*N*/ if (pView!=NULL) pView->ImpInsertUserMarker(this); +/*N*/ bAnimateToggle=TRUE; +/*N*/ } +/*N*/ +/*N*/ SdrViewUserMarker::~SdrViewUserMarker() +/*N*/ { +/*N*/ if (bVisible) {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 Hide(); +/*N*/ if (pView!=NULL) pView->ImpRemoveUserMarker(this); +/*N*/ ImpDelGeometrics(); +/*N*/ } +/*N*/ +/*N*/ void SdrViewUserMarker::ImpDelGeometrics() +/*N*/ { +/*N*/ if (pPoint !=NULL) { delete pPoint ; pPoint =NULL; } +/*N*/ if (pRect !=NULL) { delete pRect ; pRect =NULL; } +/*N*/ if (pPoly !=NULL) { delete pPoly ; pPoly =NULL; } +/*N*/ if (pPolyPoly !=NULL) { delete pPolyPoly ; pPolyPoly =NULL; } +/*N*/ if (pXPoly !=NULL) { delete pXPoly ; pXPoly =NULL; } +/*N*/ if (pXPolyPoly!=NULL) { delete pXPolyPoly; pXPolyPoly=NULL; } +/*N*/ } + +/*N*/ void SdrViewUserMarker::SetLineWidth(USHORT nWdt) +/*N*/ { +/*N*/ FASTBOOL bVis=bVisible; +/*N*/ if (bVis) Hide(); +/*N*/ nLineWdt=nWdt; +/*N*/ if (bVis) Show(); +/*N*/ } + +/*N*/ void SdrViewUserMarker::Show() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); +/*N*/ } + +/*N*/ void SdrViewUserMarker::Hide() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_svx/source/svdraw/svx_svdxcgv.cxx b/binfilter/bf_svx/source/svdraw/svx_svdxcgv.cxx new file mode 100644 index 000000000000..3ccad62f13bd --- /dev/null +++ b/binfilter/bf_svx/source/svdraw/svx_svdxcgv.cxx @@ -0,0 +1,49 @@ +/* -*- 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 "svdxcgv.hxx" +#include "svdstr.hrc" // Namen aus der Resource + + +// #i13033# +namespace binfilter { + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*N*/ SdrExchangeView::SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut): +/*N*/ SdrObjEditView(pModel1,pOut) +/*N*/ { +/*N*/ } + +/*?*/ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile( BOOL bNoVDevIfOneMtfMarked ) const +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); GDIMetaFile aMtf; return aMtf;//STRIP001 +/*?*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |