diff options
Diffstat (limited to 'svx')
41 files changed, 1284 insertions, 585 deletions
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx index d75c2bfa3919..27235de9e097 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx @@ -64,15 +64,15 @@ namespace sdr ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj); virtual ~ViewContactOfSdrOle2Obj(); - // helper for creating a OLE sequence for this object for a specified Graphic. This is locally - // used from createViewIndependentPrimitive2DSequence and also allows the VOC which knows about - // HighContrast mode to easily do the same with the HighContrast OLE metafile. It also allows - // to give a hint for scaling down the content what is needed for EmptyPresObjs - drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithGivenGraphic(const Graphic& rOLEGraphic, bool bScaleContent) const; + // helper for creating a OLE sequence for this object. It takes care od attributes, needed + // scaling (e.g. for EmptyPresObj's), the correct graphic and other stuff. It is used from + // createViewIndependentPrimitive2DSequence with false, and with evtl. HighContrast true + // from the VOC which knows that + drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters(bool bHighContrast) const; protected: // This method is responsible for creating the graphical visualisation data - // ONLY based on model data + // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false) virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const; }; } // end of namespace contact diff --git a/svx/inc/svx/sdr/overlay/overlayobject.hxx b/svx/inc/svx/sdr/overlay/overlayobject.hxx index e5aca5651976..ae31df8f6dee 100644 --- a/svx/inc/svx/sdr/overlay/overlayobject.hxx +++ b/svx/inc/svx/sdr/overlay/overlayobject.hxx @@ -133,8 +133,9 @@ namespace sdr OverlayManager* getOverlayManager() const { return mpOverlayManager; } // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and - // setPrimitive2DSequence if needed - const drawinglayer::primitive2d::Primitive2DSequence& getOverlayObjectPrimitive2DSequence() const; + // setPrimitive2DSequence if needed. Overloading may be used to allow disposal of last + // created primitives to react on changed circumstances and to re-create primitives + virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const; // access to visibility state bool isVisible() const { return mbIsVisible; } diff --git a/svx/inc/svx/sdr/overlay/overlayselection.hxx b/svx/inc/svx/sdr/overlay/overlayselection.hxx new file mode 100644 index 000000000000..fe725a577eec --- /dev/null +++ b/svx/inc/svx/sdr/overlay/overlayselection.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: overlayline.hxx,v $ + * $Revision: 1.3 $ + * + * 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 _SDR_OVERLAY_OVERLAYSELECTION_HXX +#define _SDR_OVERLAY_OVERLAYSELECTION_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/region.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + // overlay type definition + enum OverlayType + { + OVERLAY_INVERT, + OVERLAY_SOLID, + OVERLAY_TRANSPARENT + }; + + class SVX_DLLPUBLIC OverlaySelection : public OverlayObject + { + protected: + // type of overlay + OverlayType meOverlayType; + + // geometry of overlay + std::vector< basegfx::B2DRange > maRanges; + + // Values of last primitive creation. These are checked in getOverlayObjectPrimitive2DSequence + // to evtl. get rid of last Primitive2DSequence. This ensures that these values are up-to-date + // and are usable when creating primitives + OverlayType maLastOverlayType; + sal_uInt16 mnLastTransparence; + + // bitfield + unsigned mbBorder : 1; + + // geometry creation for OverlayObject, can use local *Last* values + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlaySelection( + OverlayType eType, + const Color& rColor, + const std::vector< basegfx::B2DRange >& rRanges, + bool bBorder); + virtual ~OverlaySelection(); + + // data read access + const OverlayType getOverlayType() const { return meOverlayType; } + const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; } + bool getBorder() const { return mbBorder; } + + // overloaded to check conditions for last createOverlayObjectPrimitive2DSequence + virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const; + + // data write access + void setRanges(const std::vector< basegfx::B2DRange >& rNew); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYSELECTION_HXX + +// eof diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index b5b8867b1ae5..01bb7794e9f3 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -76,7 +76,7 @@ namespace drawinglayer const ::basegfx::B2DPolygon& getTail() const { return maTail; } double getCornerRadiusX() const { return mfCornerRadiusX; } double getCornerRadiusY() const { return mfCornerRadiusY; } - bool hasCornerRadius() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } + bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } // provide unique ID DeclPrimitrive2DIDBlock() diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 2f4702e62b07..798e5b53d6de 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -77,8 +77,8 @@ namespace drawinglayer bool bCellText, bool bWordWrap); - Primitive2DReference createShadowPrimitive( - const Primitive2DSequence& rSource, + Primitive2DSequence createEmbeddedShadowPrimitive( + const Primitive2DSequence& rContent, const attribute::SdrShadowAttribute& rShadow); } // end of namespace primitive2d diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 7ee46630bf5b..1e68a61432a0 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -63,8 +63,8 @@ namespace drawinglayer { private: attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; - ::basegfx::B2DPoint maStart; - ::basegfx::B2DPoint maEnd; + basegfx::B2DPoint maStart; + basegfx::B2DPoint maEnd; MeasureTextPosition meHorizontal; MeasureTextPosition meVertical; double mfDistance; @@ -80,9 +80,9 @@ namespace drawinglayer // internal decomposition helper Primitive2DReference impCreatePart( - const ::basegfx::B2DHomMatrix& rObjectMatrix, - const ::basegfx::B2DPoint& rStart, - const ::basegfx::B2DPoint& rEnd, + const basegfx::B2DHomMatrix& rObjectMatrix, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, bool bLeftActive, bool bRightActive) const; @@ -93,7 +93,8 @@ namespace drawinglayer public: SdrMeasurePrimitive2D( const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, - const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rEnd, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, MeasureTextPosition eHorizontal, MeasureTextPosition eVertical, double fDistance, @@ -107,8 +108,8 @@ namespace drawinglayer // data access const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; } - const ::basegfx::B2DPoint& getStart() const { return maStart; } - const ::basegfx::B2DPoint& getEnd() const { return maEnd; } + const basegfx::B2DPoint& getStart() const { return maStart; } + const basegfx::B2DPoint& getEnd() const { return maEnd; } MeasureTextPosition getHorizontal() const { return meHorizontal; } MeasureTextPosition getVertical() const { return meVertical; } double getDistance() const { return mfDistance; } diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx new file mode 100644 index 000000000000..70e28d599a44 --- /dev/null +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrcaptionprimitive2d.hxx,v $ + * + * $Revision: 1.2 $ + * + * 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 INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/svdobj.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefinitions + +class SdrOle2Obj; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrOleContentPrimitive2D : public BasePrimitive2D + { + private: + SdrObjectWeakRef mpSdrOle2Obj; + basegfx::B2DHomMatrix maObjectTransform; + + // bitfield + unsigned mbHighContrast : 1; + + protected: + // local decomposition. + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrOleContentPrimitive2D( + const SdrOle2Obj& rSdrOle2Obj, + const basegfx::B2DHomMatrix& rObjectTransform, + bool bHighContrast); + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // The default implementation will use getDecomposition results to create the range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // data access + const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + bool getHighContrast() const { return mbHighContrast; } + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX + +// eof diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 6a3983835ef9..650cc1a882c5 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -49,28 +49,35 @@ namespace drawinglayer class SdrRectanglePrimitive2D : public BasePrimitive2D { private: - ::basegfx::B2DHomMatrix maTransform; + basegfx::B2DHomMatrix maTransform; attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height + // bitfield + // flag which decides if this is a text frame. If Yes, the HitArea + // should be the filled geometry + bool mbTextFrame : 1; + protected: // local decomposition. virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrRectanglePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, - double fCornerRadiusX = 0.0, - double fCornerRadiusY = 0.0); + double fCornerRadiusX, + double fCornerRadiusY, + bool bTextFrame); // data access - const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } double getCornerRadiusX() const { return mfCornerRadiusX; } double getCornerRadiusY() const { return mfCornerRadiusY; } - bool hasCornerRadius() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } + bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } + bool getTextFrame() const { return mbTextFrame; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx index 623158f21d68..d1b857f510c3 100644 --- a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -58,6 +58,7 @@ #define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19) #define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20) #define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21) +#define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22) ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 605e9463bdab..2b5a19f7b60b 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -184,10 +184,8 @@ public: sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ); sal_Bool AddOwnLightClient(); - bool executeOldDoPaintPreparations(SdrPageView* pPageVew) const; //remove me with the next incompatible build - // handy to get the empty replacement bitmap without accessing all the old stuff - Bitmap GetEmtyOLEReplacementBitmap() const; + static Bitmap GetEmtyOLEReplacementBitmap(); void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow); }; diff --git a/svx/prj/d.lst b/svx/prj/d.lst index fd5182344531..227dac4db601 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -604,6 +604,7 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlaypolypolygon.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaypolypolygon.hxx ..\inc\svx\sdr\overlay\overlayobjectcell.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayobjectcell.hxx ..\inc\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx +..\inc\svx\sdr\overlay\overlayselection.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayselection.hxx ..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation diff --git a/svx/source/cui/optgdlg.cxx b/svx/source/cui/optgdlg.cxx index ed93ab97c7d6..2f39bdc7a7b3 100644 --- a/svx/source/cui/optgdlg.cxx +++ b/svx/source/cui/optgdlg.cxx @@ -699,6 +699,12 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) : aMousePosLB ( this, SVX_RES( LB_MOUSEPOS ) ), aMouseMiddleFT ( this, SVX_RES( FT_MOUSEMIDDLE ) ), aMouseMiddleLB ( this, SVX_RES( LB_MOUSEMIDDLE ) ), + + // #i97672# + maSelectionFL(this, SVX_RES(FL_SELECTION)), + maSelectionCB(this, SVX_RES(CB_SELECTION)), + maSelectionMF(this, SVX_RES(MF_SELECTION)), + nSizeLB_InitialSelection(0), nStyleLB_InitialSelection(0), pAppearanceCfg(new SvtTabAppearanceCfg), @@ -761,6 +767,9 @@ OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) : #endif + // #i97672# + maSelectionCB.SetToggleHdl( LINK( this, OfaViewTabPage, OnSelectionToggled ) ); + FreeResource(); if( ! Application::ValidateSystemFont() ) @@ -815,6 +824,15 @@ IMPL_LINK( OfaViewTabPage, OnAntialiasingToggled, void*, NOTINTERESTEDIN ) } #endif +// #i97672# +IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN ) +{ + (void)NOTINTERESTEDIN; + const bool bSelectionEnabled(maSelectionCB.IsChecked()); + maSelectionMF.Enable(bSelectionEnabled); + return 0; +} + /*-----------------06.12.96 11.50------------------- --------------------------------------------------*/ @@ -836,6 +854,7 @@ BOOL OfaViewTabPage::FillItemSet( SfxItemSet& ) BOOL bModified = FALSE; BOOL bMenuOptModified = FALSE; + bool bRepaintWindows(false); SvtMiscOptions aMiscOptions; UINT16 nSizeLB_NewSelection = aIconSizeLB.GetSelectEntryPos(); @@ -961,16 +980,30 @@ BOOL OfaViewTabPage::FillItemSet( SfxItemSet& ) { mpDrawinglayerOpt->SetAntiAliasing(aUseAntiAliase.IsChecked()); bModified = TRUE; + bRepaintWindows = true; + } + } - // react on AA change; invalidate all windows to force - // a repaint when changing from AA to non-AA or vice-versa - Window* pAppWindow = Application::GetFirstTopLevelWindow(); + // #i97672# + if(maSelectionCB.IsEnabled()) + { + const bool bNewSelection(maSelectionCB.IsChecked()); + const sal_uInt16 nNewTransparence((sal_uInt16)maSelectionMF.GetValue()); - while(pAppWindow) - { - pAppWindow->Invalidate(); - pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); - } + if(bNewSelection != (bool)mpDrawinglayerOpt->IsTransparentSelection()) + { + mpDrawinglayerOpt->SetTransparentSelection(maSelectionCB.IsChecked()); + bModified = TRUE; + bRepaintWindows = true; + } + + // #i104150# even read the value when maSelectionMF is disabled; it may have been + // modified by enabling-modify-disabling by the user + if(nNewTransparence != mpDrawinglayerOpt->GetTransparentSelectionPercent()) + { + mpDrawinglayerOpt->SetTransparentSelectionPercent(nNewTransparence); + bModified = TRUE; + bRepaintWindows = true; } } @@ -1001,6 +1034,17 @@ BOOL OfaViewTabPage::FillItemSet( SfxItemSet& ) pAppearanceCfg->SetApplicationDefaults ( GetpApp() ); } + if(bRepaintWindows) + { + Window* pAppWindow = Application::GetFirstTopLevelWindow(); + + while(pAppWindow) + { + pAppWindow->Invalidate(); + pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); + } + } + return bModified; } @@ -1090,6 +1134,27 @@ void OfaViewTabPage::Reset( const SfxItemSet& ) aUseAntiAliase.SaveValue(); } + { + // #i97672# Selection + // check if transparent selection is possible on this system + const bool bTransparentSelectionPossible( + !GetSettings().GetStyleSettings().GetHighContrastMode() + && supportsOperation(OutDevSupport_TransparentRect)); + + // enter values + if(bTransparentSelectionPossible) + { + maSelectionCB.Check(mpDrawinglayerOpt->IsTransparentSelection()); + } + else + { + maSelectionCB.Enable(false); + } + + maSelectionMF.SetValue(mpDrawinglayerOpt->GetTransparentSelectionPercent()); + maSelectionMF.Enable(mpDrawinglayerOpt->IsTransparentSelection() && bTransparentSelectionPossible); + } + #if defined( UNX ) aFontAntiAliasing.SaveValue(); aAAPointLimit.SaveValue(); diff --git a/svx/source/cui/optgdlg.hrc b/svx/source/cui/optgdlg.hrc index b8dc903879ed..3ad985caa706 100644 --- a/svx/source/cui/optgdlg.hrc +++ b/svx/source/cui/optgdlg.hrc @@ -91,6 +91,10 @@ #define ROW_FT_MOUSEMIDDLE (ROW_LB_MOUSEPOS + RSC_CD_DROPDOWN_HEIGHT + ROWSPACE) #define ROW_LB_MOUSEMIDDLE (ROW_FT_MOUSEMIDDLE + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE) +// #i97672# +#define ROW_FL_SELECTION (ROW_LB_MOUSEMIDDLE + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_X) +#define ROW_CB_SELECTION (ROW_FL_SELECTION + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) + // tabpage general ------------------------------------------------------- #define FL_HELP 10 @@ -150,6 +154,11 @@ #define CB_USE_HARDACCELL 68 #define CB_USE_ANTIALIASE 69 +// #i97672# +#define FL_SELECTION 70 +#define CB_SELECTION 71 +#define MF_SELECTION 72 + // tabpage languages ----------------------------------------------------- #define FL_UI_LANG 1 diff --git a/svx/source/cui/optgdlg.hxx b/svx/source/cui/optgdlg.hxx index c44087708b31..4b86896fa58f 100644 --- a/svx/source/cui/optgdlg.hxx +++ b/svx/source/cui/optgdlg.hxx @@ -129,6 +129,11 @@ private: FixedText aMouseMiddleFT; ListBox aMouseMiddleLB; + // #i97672# + FixedLine maSelectionFL; + CheckBox maSelectionCB; + MetricField maSelectionMF; + UINT16 nSizeLB_InitialSelection; UINT16 nStyleLB_InitialSelection; BOOL bSfxSymbolsAuto; @@ -140,6 +145,9 @@ private: #if defined( UNX ) DECL_LINK( OnAntialiasingToggled, void* ); #endif + // #i97672# + DECL_LINK( OnSelectionToggled, void* ); + public: OfaViewTabPage( Window* pParent, const SfxItemSet& rSet ); ~OfaViewTabPage(); diff --git a/svx/source/cui/optgdlg.src b/svx/source/cui/optgdlg.src index 7f3ad6968079..a711be6bf0fc 100644 --- a/svx/source/cui/optgdlg.src +++ b/svx/source/cui/optgdlg.src @@ -404,6 +404,38 @@ TabPage OFA_TP_VIEW }; }; + // #i97672# + FixedLine FL_SELECTION + { + Pos = MAP_APPFONT ( 133 , ROW_FL_SELECTION ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "Selection"; + }; + + CheckBox CB_SELECTION + { + Pos = MAP_APPFONT ( 139, ROW_CB_SELECTION + (((12 - RSC_CD_CHECKBOX_HEIGHT) / 2) + 1)) ; + Size = MAP_APPFONT ( 118 - 34 , RSC_CD_CHECKBOX_HEIGHT ) ; + Text [ en-US ] = "Transparency" ; + }; + + MetricField MF_SELECTION + { + Pos = MAP_APPFONT ( 139 + (95 - 12), ROW_CB_SELECTION ) ; + Size = MAP_APPFONT ( 31 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 10 ; + Maximum = 90 ; + DecimalDigits = 0 ; + First = 10 ; + Last = 90 ; + SpinSize = 5 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = "%" ; + }; }; // ******************************************************************* diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 3df2e40b8145..821c0ba07c32 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -92,7 +92,12 @@ namespace drawinglayer basegfx::B3DPoint maBack; // the found cut points - ::std::vector< basegfx::B3DPoint > mo_rResult; + ::std::vector< basegfx::B3DPoint > maResult; + + // #i102956# the transformation change from TransformPrimitive3D processings + // needs to be remembered to be able to transform found cuts to the + // basic coordinate system the processor starts with + basegfx::B3DHomMatrix maCombinedTransform; // as tooling, the process() implementation takes over API handling and calls this // virtual render method when the primitive implementation is BasePrimitive3D-based. @@ -105,11 +110,12 @@ namespace drawinglayer : BaseProcessor3D(rViewInformation), maFront(rFront), maBack(rBack), - mo_rResult() + maResult(), + maCombinedTransform() {} // data access - const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return mo_rResult; } + const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } }; void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) @@ -119,9 +125,8 @@ namespace drawinglayer { case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : { - // transform group. Remember current transformations + // transform group. const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate); - const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); // remember old and transform front, back to object coordinates const basegfx::B3DPoint aLastFront(maFront); @@ -131,7 +136,8 @@ namespace drawinglayer maFront *= aInverseTrans; maBack *= aInverseTrans; - // create new transformation; add new object transform from right side + // remember current and create new transformation; add new object transform from right side + const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); const geometry::ViewInformation3D aNewViewInformation3D( aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(), aLastViewInformation3D.getOrientation(), @@ -141,10 +147,15 @@ namespace drawinglayer aLastViewInformation3D.getExtendedInformationSequence()); updateViewInformation(aNewViewInformation3D); + // #i102956# remember needed back-transform for found cuts (combine from right side) + const basegfx::B3DHomMatrix aLastCombinedTransform(maCombinedTransform); + maCombinedTransform = maCombinedTransform * rPrimitive.getTransformation(); + // let break down process(rPrimitive.getChildren()); // restore transformations and front, back + maCombinedTransform = aLastCombinedTransform; updateViewInformation(aLastViewInformation3D); maFront = aLastFront; maBack = aLastBack; @@ -207,7 +218,10 @@ namespace drawinglayer if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false)) { - mo_rResult.push_back(aCutPoint); + // #i102956# add result. Do not forget to do this in the coordinate + // system the processor get started with, so use the collected + // combined transformation from processed TransformPrimitive3D's + maResult.push_back(maCombinedTransform * aCutPoint); } } } @@ -376,9 +390,9 @@ SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack( ::std::vector< basegfx::B3DPoint > aHitsWithObject; getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject); - if(aHitsWithObject.size()) + for(sal_uInt32 a(0); a < aHitsWithObject.size(); a++) { - const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[0]); + const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[a]); aDepthAndObjectResults.push_back(ImplPairDephAndObject(pCandidate, aPointInViewCoordinates.getZ())); } } diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index e1b2867b0d66..3c239b12113c 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -45,6 +45,7 @@ #include <svtools/colorcfg.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <vcl/svapp.hxx> +#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -71,7 +72,8 @@ namespace sdr { } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithGivenGraphic(const Graphic& rOLEGraphic, bool bScaleContent) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( + bool bHighContrast) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; SdrText* pSdrText = GetOle2Obj().getText(0); @@ -103,80 +105,24 @@ namespace sdr pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); } - // Prepare OLE filling. This is normally the metafile describing OLE content, but may also - // be the empty OLE bitmap for empty/not loaded OLEs - const GraphicObject aGraphicObject(rOLEGraphic); - const GraphicAttr aGraphicAttr; - drawinglayer::primitive2d::Primitive2DSequence xOLEContent; - - if(bScaleContent) - { - // Create outline and placeholder graphic with some scaling - // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic - // into account. Since EmptyPresObj's are only used in Draw/Impress, it is - // safe to assume 100th mm as target. - Size aPrefSize(rOLEGraphic.GetPrefSize()); - - if(MAP_PIXEL == rOLEGraphic.GetPrefMapMode().GetMapUnit()) - { - aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM); - } - else - { - aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, rOLEGraphic.GetPrefMapMode(), MAP_100TH_MM); - } - - const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0); - const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0); - - if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) - { - // if content fits into frame, create it - basegfx::B2DHomMatrix aInnerObjectMatrix; - - aInnerObjectMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aInnerObjectMatrix.translate(fOffsetX, fOffsetY); - aInnerObjectMatrix.shearX(fShearX); - aInnerObjectMatrix.rotate(fRotate); - aInnerObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); - - drawinglayer::primitive2d::Primitive2DReference xScaledContent( - new drawinglayer::primitive2d::GraphicPrimitive2D(aInnerObjectMatrix, aGraphicObject, aGraphicAttr)); - xOLEContent = drawinglayer::primitive2d::Primitive2DSequence(&xScaledContent, 1); - } - } - else - { - // create graphic primitive for content - drawinglayer::primitive2d::Primitive2DReference xDirectContent( - new drawinglayer::primitive2d::GraphicPrimitive2D(aObjectMatrix, aGraphicObject, aGraphicAttr)); - xOLEContent = drawinglayer::primitive2d::Primitive2DSequence(&xDirectContent, 1); - } + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + bHighContrast)); // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, *pAttribute)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); delete pAttribute; - - // a standard gray outline is created for scaled content - if(bScaleContent) - { - const svtools::ColorConfig aColorConfig; - const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); - - if(aColor.bIsVisible) - { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0, 0, 1, 1))); - const Color aVclColor(aColor.nColor); - aOutline.transform(aObjectMatrix); - const drawinglayer::primitive2d::Primitive2DReference xOutline( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aVclColor.getBColor())); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xOutline); - } - } } return xRetval; @@ -184,21 +130,8 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const { - const Graphic* pOLEGraphic = GetOle2Obj().GetGraphic(); - - if(pOLEGraphic) - { - // there is a graphic set, use it - return createPrimitive2DSequenceWithGivenGraphic(*pOLEGraphic, GetOle2Obj().IsEmptyPresObj()); - } - else - { - // no graphic, use default empty OLE bitmap - const Bitmap aEmptyOLEBitmap(GetOle2Obj().GetEmtyOLEReplacementBitmap()); - const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap); - - return createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true); - } + // do as if no HC and call standard creator + return createPrimitive2DSequenceWithParameters(false); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index c48d110faaf2..8ba8ae8ab4c9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -105,8 +105,14 @@ namespace sdr drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, *pAttribute, fCornerRadiusX, fCornerRadiusY)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + *pAttribute, + fCornerRadiusX, + fCornerRadiusY, + GetRectObj().IsTextFrame())); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx index 902e8e7d8153..5e9ab788e392 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx @@ -220,6 +220,11 @@ namespace sdr SdrGrafObj& rGrafObj = getSdrGrafObj(); rGrafObj.ForceSwapIn(); + // #i103720# forget event to avoid possible deletion by the following ActionChanged call + // which may use createPrimitive2DSequence/impPrepareGraphicWithAsynchroniousLoading again. + // Deletion is actally done by the scheduler who leaded to coming here + mpAsynchLoadEvent = 0; + // Invalidate all paint areas and check existing animation (which may have changed). GetViewContact().ActionChanged(); } @@ -230,11 +235,15 @@ namespace sdr void ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent* pEvent) { (void) pEvent; // suppress warning - DBG_ASSERT(mpAsynchLoadEvent, "ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: I did not trigger a event, why am i called (?)"); - DBG_ASSERT(mpAsynchLoadEvent == pEvent, "ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: Forced to forget another event then i have scheduled (?)"); - // forget event - mpAsynchLoadEvent = 0; + if(mpAsynchLoadEvent) + { + OSL_ENSURE(!pEvent || mpAsynchLoadEvent == pEvent, + "ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: Forced to forget another event then i have scheduled (?)"); + + // forget event + mpAsynchLoadEvent = 0; + } } SdrGrafObj& ViewObjectContactOfGraphic::getSdrGrafObj() diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 6145e0acc301..635ae9c7fcc8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -60,197 +60,176 @@ namespace sdr return static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).GetOle2Obj(); } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const + drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence( + const DisplayInfo& /*rDisplayInfo*/) const { // this method is overloaded to do some things the old SdrOle2Obj::DoPaintObject did. - // In the future, some of these may be solved different, but ATM try to stay compatible - // with the old behaviour - drawinglayer::primitive2d::Primitive2DSequence xRetval; - const SdrOle2Obj& rSdrOle2 = getSdrOle2Object(); - sal_Int32 nState = -1; + // In the future, some of these may be solved different, but ATM try to stay compatible + // with the old behaviour + drawinglayer::primitive2d::Primitive2DSequence xRetval; + const SdrOle2Obj& rSdrOle2 = getSdrOle2Object(); + sal_Int32 nState(-1); + + { + const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); + if ( xObjRef.is() ) + nState = xObjRef->getCurrentState(); + } + + const bool bIsOutplaceActive(nState == embed::EmbedStates::ACTIVE); + const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE)); + const bool bIsChart(rSdrOle2.IsChart()); + bool bDone(false); + + if(!bDone && bIsInplaceActive) + { + if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() ) { - const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); - if ( xObjRef.is() ) - nState = xObjRef->getCurrentState(); + //no need to create a primitive sequence here as the OLE object does render itself + //in case of charts the superfluous creation of a metafile is strongly performance relevant! + bDone = true; } - const bool bIsOutplaceActive = (nState == embed::EmbedStates::ACTIVE); - const bool bIsInplaceActive = (nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE); - const bool bIsChart = rSdrOle2.IsChart(); + } - bool bDone = false; - if( !bDone && bIsInplaceActive ) + if( !bDone ) + { + const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect()); + const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aObjectTransform; + aObjectTransform.set(0, 0, aObjectRange.getWidth()); + aObjectTransform.set(1, 1, aObjectRange.getHeight()); + aObjectTransform.set(0, 2, aObjectRange.getMinX()); + aObjectTransform.set(1, 2, aObjectRange.getMinY()); + + if(bIsChart) { - if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() ) + //charts must be painted resolution dependent!! #i82893#, #i75867# + + // for chart, to not lose the current better quality visualisation which + // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers + // will then ATM paint it to an OutputDevice directly. + // In later versions this should be replaced by getting the Primitive2DSequnce from + // the chart and using it. + // to be able to render something in non-VCL using renderers, the wrapper is a + // GroupPrimitive2D which automatically decomposes to the already created Metafile + // content. + // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed. + // It works in the VCL renderers, though. So for activating again with VCL primitive + // renderers, change conditions here. + + // determine if embedding and PrettyPrinting shall be done at all + uno::Reference< frame::XModel > xChartModel; + bool bDoChartPrettyPrinting(true); + + // the original ChartPrettyPainter does not do it for Window + if(bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow()) { - bDone = true; - //no need to create a primitive sequence here as the OLE object does render itself - //in case of charts the superfluous creation of a metafile is strongly performance relevant! + bDoChartPrettyPrinting = false; } - } - - if( !bDone ) - { - const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect()); - const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom()); - // create object transform - basegfx::B2DHomMatrix aObjectTransform; - aObjectTransform.set(0, 0, aObjectRange.getWidth()); - aObjectTransform.set(1, 1, aObjectRange.getHeight()); - aObjectTransform.set(0, 2, aObjectRange.getMinX()); - aObjectTransform.set(1, 2, aObjectRange.getMinY()); - - if(bIsChart) + // the original ChartPrettyPainter does not do it for VDEV + if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) { - //charts must be painted resolution dependent!! #i82893#, #i75867# - - // for chart, to not lose the current better quality visualisation which - // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers - // will then ATM paint it to an OutputDevice directly. - // In later versions this should be replaced by getting the Primitive2DSequnce from - // the chart and using it. - // to be able to render something in non-VCL using renderers, the wrapper is a - // GroupPrimitive2D which automatically decomposes to the already created Metafile - // content. - // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed. - // It works in the VCL renderers, though. So for activating again with VCL primitive - // renderers, change conditions here. - - // determine if embedding and PrettyPrinting shall be done at all - uno::Reference< frame::XModel > xChartModel; - bool bDoChartPrettyPrinting(true); - - // the original ChartPrettyPainter does not do it for Window - if(bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow()) + if(GetObjectContact().isOutputToPDFFile()) { - bDoChartPrettyPrinting = false; + // #i97982# + // For PDF files, allow PrettyPrinting } - - // the original ChartPrettyPainter does not do it for VDEV - if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) + else { - if(GetObjectContact().isOutputToPDFFile()) - { - // #i97982# - // For PDF files, allow PrettyPrinting - } - else - { - bDoChartPrettyPrinting = false; - } + bDoChartPrettyPrinting = false; } + } - // the chart model is needed. Check if it's available - if(bDoChartPrettyPrinting) - { - // get chart model - xChartModel = rSdrOle2.getXModel(); - - if(!xChartModel.is()) - { - bDoChartPrettyPrinting = false; - } - } + // the chart model is needed. Check if it's available + if(bDoChartPrettyPrinting) + { + // get chart model + xChartModel = rSdrOle2.getXModel(); - if(bDoChartPrettyPrinting) + if(!xChartModel.is()) { - // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed - // for PrettyPrinting - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D( - xChartModel, aObjectTransform, xRetval)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - bDone = true; + bDoChartPrettyPrinting = false; } } - if( !bDone ) + if(bDoChartPrettyPrinting) { - //old stuff that should be reworked - { - //if no replacement image is available load the OLE object - if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925# - { - // try to create embedded object - rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already - } - const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); - if(xObjRef.is()) - { - const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect())); - - // this hack (to change model data during PAINT argh(!)) should be reworked - if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE)) - { - const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true); - } - - SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); - if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) - { - // connect plugin object - pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2)); - } - } - }//end old stuff to rework + // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed + // for PrettyPrinting + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D( + xChartModel, aObjectTransform, xRetval)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + bDone = true; + } + } - if(GetObjectContact().isDrawModeHighContrast()) + if( !bDone ) + { + //old stuff that should be reworked + { + //if no replacement image is available load the OLE object + if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925# + { + // try to create embedded object + rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already + } + const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); + if(xObjRef.is()) { - // directly call at the corresponding VC and force OLE Graphic to HighContrast - const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact()); - Graphic* pOLEHighContrastGraphic = rSdrOle2.getEmbeddedObjectRef().GetHCGraphic(); + const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect())); - if(pOLEHighContrastGraphic) + // this hack (to change model data during PAINT argh(!)) should be reworked + if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE)) { - // there is a graphic set, use it - xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(*pOLEHighContrastGraphic, rSdrOle2.IsEmptyPresObj()); + const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true); } - else - { - // no HighContrast graphic, use default empty OLE bitmap - const Bitmap aEmptyOLEBitmap(rSdrOle2.GetEmtyOLEReplacementBitmap()); - const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap); - xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true); + SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); + if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) + { + // connect plugin object + pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2)); } } - else - { - // call parent which will use the regular createViewIndependentPrimitive2DSequence - // at the corresponding VC - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } + }//end old stuff to rework - } + // create OLE primitive stuff directly at VC with HC as parameter + const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact()); + xRetval = rVC.createPrimitive2DSequenceWithParameters(GetObjectContact().isDrawModeHighContrast()); + } - if(bIsOutplaceActive) + if(bIsOutplaceActive) + { + // do not shade when printing or PDF exporting + if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { - // do not shade when printing or PDF exporting - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aObjectOutline.transform(aObjectTransform); - - // Use a FillHatchPrimitive2D with necessary attributes - const drawinglayer::attribute::FillHatchAttribute aFillHatch( - drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch - 125.0, // 1.25 mm - 45.0 * F_PI180, // 45 degree diagonal - Color(COL_BLACK).getBColor(), // black color - false); // no filling - - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D( - basegfx::B2DPolyPolygon(aObjectOutline), - Color(COL_BLACK).getBColor(), - aFillHatch)); - - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference); - } + // shade the representation if the object is activated outplace + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aObjectOutline.transform(aObjectTransform); + + // Use a FillHatchPrimitive2D with necessary attributes + const drawinglayer::attribute::FillHatchAttribute aFillHatch( + drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch + 125.0, // 1.25 mm + 45.0 * F_PI180, // 45 degree diagonal + Color(COL_BLACK).getBColor(), // black color + false); // no filling + + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D( + basegfx::B2DPolyPolygon(aObjectOutline), + Color(COL_BLACK).getBColor(), + aFillHatch)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference); } - } - return xRetval; + } + + return xRetval; } ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/overlay/makefile.mk b/svx/source/sdr/overlay/makefile.mk index bb6489606283..d202992c090d 100644 --- a/svx/source/sdr/overlay/makefile.mk +++ b/svx/source/sdr/overlay/makefile.mk @@ -56,6 +56,7 @@ SLOFILES=\ $(SLO)$/overlaypolypolygon.obj \ $(SLO)$/overlayprimitive2dsequenceobject.obj \ $(SLO)$/overlayrollingrectangle.obj \ + $(SLO)$/overlayselection.obj \ $(SLO)$/overlaytools.obj \ $(SLO)$/overlaytriangle.obj diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx index 4c05fbd48a23..5cddc3c63627 100644 --- a/svx/source/sdr/overlay/overlayobject.cxx +++ b/svx/source/sdr/overlay/overlayobject.cxx @@ -107,7 +107,7 @@ namespace sdr OSL_ENSURE(0 == getOverlayManager(), "OverlayObject is destructed which is still registered at OverlayManager (!)"); } - const drawinglayer::primitive2d::Primitive2DSequence& OverlayObject::getOverlayObjectPrimitive2DSequence() const + drawinglayer::primitive2d::Primitive2DSequence OverlayObject::getOverlayObjectPrimitive2DSequence() const { if(!getPrimitive2DSequence().hasElements()) { diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx new file mode 100644 index 000000000000..2411ca3c31b4 --- /dev/null +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: overlayline.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" +#include <svx/sdr/overlay/overlayselection.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <svtools/optionsdrawinglayer.hxx> +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <drawinglayer/primitive2d/invertprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + // combine rages geometrically to a single, ORed polygon + basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges) + { + const sal_uInt32 nCount(rRanges.size()); + basegfx::B2DPolyPolygon aRetval; + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a])); + + if(0 == a) + { + aRetval.append(aDiscretePolygon); + } + else + { + aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon)); + } + } + + return aRetval; + } + + // check if wanted type OVERLAY_TRANSPARENT or OVERLAY_SOLID + // is possible. If not, fallback to invert mode (classic mode) + OverlayType impCheckPossibleOverlayType(OverlayType aOverlayType) + { + if(OVERLAY_INVERT != aOverlayType) + { + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + + if(!aSvtOptionsDrawinglayer.IsTransparentSelection()) + { + // not possible when switched off by user + return OVERLAY_INVERT; + } + else + { + const OutputDevice *pOut = Application::GetDefaultDevice(); + + if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode()) + { + // not possible when in high contrast mode + return OVERLAY_INVERT; + } + + if(!pOut->supportsOperation(OutDevSupport_TransparentRect)) + { + // not possible when no fast transparence paint is supported on the system + return OVERLAY_INVERT; + } + } + } + + return aOverlayType; + } + + drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::createOverlayObjectPrimitive2DSequence() + { + drawinglayer::primitive2d::Primitive2DSequence aRetval; + const sal_uInt32 nCount(getRanges().size()); + + if(nCount) + { + // create range primitives + const basegfx::BColor aRGBColor(getBaseColor().getBColor()); + aRetval.realloc(nCount); + + for(sal_uInt32 a(0);a < nCount; a++) + { + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a])); + aRetval[a] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + aRGBColor)); + } + + if(OVERLAY_INVERT == maLastOverlayType) + { + // embed all in invert primitive + const drawinglayer::primitive2d::Primitive2DReference aInvert( + new drawinglayer::primitive2d::InvertPrimitive2D( + aRetval)); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1); + } + else if(OVERLAY_TRANSPARENT == maLastOverlayType) + { + // embed all rectangles in transparent paint + const double fTransparence(mnLastTransparence / 100.0); + const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + aRetval, + fTransparence)); + + if(getBorder()) + { + const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges())); + const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline( + new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( + aPolyPolygon, + aRGBColor)); + + // add both to result + aRetval.realloc(2); + aRetval[0] = aUnifiedAlpha; + aRetval[1] = aSelectionOutline; + } + else + { + // just add transparent part + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + } + } + } + + return aRetval; + } + + OverlaySelection::OverlaySelection( + OverlayType eType, + const Color& rColor, + const std::vector< basegfx::B2DRange >& rRanges, + bool bBorder) + : OverlayObject(rColor), + meOverlayType(eType), + maRanges(rRanges), + maLastOverlayType(eType), + mnLastTransparence(0), + mbBorder(bBorder) + { + // no AA for selection overlays + allowAntiAliase(false); + } + + OverlaySelection::~OverlaySelection() + { + if(getOverlayManager()) + { + getOverlayManager()->remove(*this); + } + } + + drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::getOverlayObjectPrimitive2DSequence() const + { + // get current values + const OverlayType aNewOverlayType(impCheckPossibleOverlayType(meOverlayType)); + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const sal_uInt16 nNewTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent()); + + if(getPrimitive2DSequence().hasElements()) + { + if(aNewOverlayType != maLastOverlayType + || nNewTransparence != mnLastTransparence) + { + // conditions of last local decomposition have changed, delete + const_cast< OverlaySelection* >(this)->setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence()); + } + } + + if(!getPrimitive2DSequence().hasElements()) + { + // remember new values + const_cast< OverlaySelection* >(this)->maLastOverlayType = aNewOverlayType; + const_cast< OverlaySelection* >(this)->mnLastTransparence = nNewTransparence; + } + + // call base implementation + return OverlayObject::getOverlayObjectPrimitive2DSequence(); + } + + void OverlaySelection::setRanges(const std::vector< basegfx::B2DRange >& rNew) + { + if(rNew != maRanges) + { + maRanges = rNew; + objectChange(); + } + } + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/primitive2d/makefile.mk b/svx/source/sdr/primitive2d/makefile.mk index e9e976d434ed..7510b6a23b35 100644 --- a/svx/source/sdr/primitive2d/makefile.mk +++ b/svx/source/sdr/primitive2d/makefile.mk @@ -51,6 +51,7 @@ SLOFILES=\ $(SLO)$/sdrcaptionprimitive2d.obj \ $(SLO)$/sdrgrafprimitive2d.obj \ $(SLO)$/sdrole2primitive2d.obj \ + $(SLO)$/sdrolecontentprimitive2d.obj \ $(SLO)$/sdrpathprimitive2d.obj \ $(SLO)$/sdrprimitivetools.obj \ $(SLO)$/sdrmeasureprimitive2d.obj \ diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 80067901483b..3c8feb7ff2b2 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -50,62 +50,95 @@ namespace drawinglayer Primitive2DSequence SdrCaptionPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; + Primitive2DSequence aHitTestContent; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), getCornerRadiusX(), getCornerRadiusY())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), + getCornerRadiusX(), + getCornerRadiusY())); // add fill if(getSdrLFSTAttribute().getFill()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill, create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line if(getSdrLFSTAttribute().getLine()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getTail(), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + *getSdrLFSTAttribute().getLine())); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + getTail(), + getTransform(), + *getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - Primitive2DSequence aLineSequence(2); - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - - aLineSequence[0] = createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline); - aLineSequence[1] = createPolygonLinePrimitive(getTail(), getTransform(), aBlackHairline); + // if initially no line is defined, create one for HitTest and BoundRect. It + // is sufficient to use the tail; the body is already ensured with fill creation + appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + createPolygonLinePrimitive( + getTail(), + getTransform(), + attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); + } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(aLineSequence))); + // add HitTest and BoundRect helper geometry (if exists) + if(aHitTestContent.hasElements()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); } // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + *getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false)); } // add shadow if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrCaptionPrimitive2D::SdrCaptionPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, - const ::basegfx::B2DPolygon& rTail, + const basegfx::B2DPolygon& rTail, double fCornerRadiusX, double fCornerRadiusY) : BasePrimitive2D(), @@ -118,7 +151,7 @@ namespace drawinglayer // transform maTail to unit polygon if(getTail().count()) { - ::basegfx::B2DHomMatrix aInverse(getTransform()); + basegfx::B2DHomMatrix aInverse(getTransform()); aInverse.invert(); maTail.transform(aInverse); } diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 5ee00133588f..0edbe1a35046 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -78,15 +78,7 @@ namespace drawinglayer // add shadow if(getSdrLSTAttribute().getShadow()) { - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 51be7cd03033..c8847624bcdd 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -60,18 +60,9 @@ namespace drawinglayer } // add shadow - if(getSdrSTAttribute().getShadow()) + if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 366b934b5473..9666bd2c1ac1 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -67,13 +67,13 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference createPolyPolygonFillPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, const attribute::FillGradientAttribute* pFillGradient) { // prepare fully scaled polygon - ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); + basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); BasePrimitive2D* pNewFillPrimitive = 0L; @@ -87,7 +87,7 @@ namespace drawinglayer } else if(rFill.isBitmap()) { - const ::basegfx::B2DRange aRange(::basegfx::tools::getRange(aScaledPolyPolygon)); + const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getBitmap()->getFillBitmapAttribute(aRange)); } else @@ -110,7 +110,7 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways - const ::basegfx::B2DRange aRange(::basegfx::tools::getRange(aScaledPolyPolygon)); + const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); @@ -125,13 +125,13 @@ namespace drawinglayer } Primitive2DReference createPolygonLinePrimitive( - const ::basegfx::B2DPolygon& rUnitPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, const attribute::SdrLineStartEndAttribute* pStroke) { // prepare fully scaled polygon - ::basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); + basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); aScaledPolygon.transform(rObjectTransform); // create line and stroke attribute @@ -168,14 +168,14 @@ namespace drawinglayer } Primitive2DReference createTextPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, const attribute::SdrLineAttribute* pStroke, bool bCellText, bool bWordWrap) { - ::basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform); + basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform); SdrTextPrimitive2D* pNew = 0; if(rText.isContour()) @@ -185,20 +185,20 @@ namespace drawinglayer { // take line width into account and shrink contour polygon accordingly // decompose to get scale - ::basegfx::B2DVector aScale, aTranslate; + basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; rObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX); // scale outline to object's size to allow growing with value relative to that size // and also to keep aspect ratio - ::basegfx::B2DHomMatrix aScaleTransform; + basegfx::B2DHomMatrix aScaleTransform; aScaleTransform.set(0, 0, fabs(aScale.getX())); aScaleTransform.set(1, 1, fabs(aScale.getY())); - ::basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); + basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); aScaledUnitPolyPolygon.transform(aScaleTransform); // grow the polygon. To shrink, use negative value (half width) - aScaledUnitPolyPolygon = ::basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); + aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); // scale back to unit polygon aScaleTransform.set(0, 0, 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0); @@ -225,7 +225,7 @@ namespace drawinglayer else if(rText.getSdrFormTextAttribute()) { // text on path, use scaled polygon - ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); + basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); pNew = new SdrPathTextPrimitive2D( &rText.getSdrText(), @@ -237,29 +237,29 @@ namespace drawinglayer { // rObjectTransform is the whole SdrObject transformation from unit rectangle // to it's size and position. Decompose to allow working with single values. - ::basegfx::B2DVector aScale, aTranslate; + basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; rObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX); // extract mirroring - const bool bMirrorX(::basegfx::fTools::less(aScale.getX(), 0.0)); - const bool bMirrorY(::basegfx::fTools::less(aScale.getY(), 0.0)); + const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); + const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); aScale = basegfx::absolute(aScale); // Get the real size, since polygon ountline and scale // from the object transformation may vary (e.g. ellipse segments) - ::basegfx::B2DHomMatrix aJustScaleTransform; + basegfx::B2DHomMatrix aJustScaleTransform; aJustScaleTransform.set(0, 0, aScale.getX()); aJustScaleTransform.set(1, 1, aScale.getY()); - ::basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); + basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); aScaledUnitPolyPolygon.transform(aJustScaleTransform); - const ::basegfx::B2DRange aSnapRange(::basegfx::tools::getRange(aScaledUnitPolyPolygon)); + const basegfx::B2DRange aSnapRange(basegfx::tools::getRange(aScaledUnitPolyPolygon)); // create a range describing the wanted text position and size (aTextAnchorRange). This // means to use the text distance values here - const ::basegfx::B2DPoint aTopLeft(aSnapRange.getMinX() + rText.getTextLeftDistance(), aSnapRange.getMinY() + rText.getTextUpperDistance()); - const ::basegfx::B2DPoint aBottomRight(aSnapRange.getMaxX() - rText.getTextRightDistance(), aSnapRange.getMaxY() - rText.getTextLowerDistance()); - ::basegfx::B2DRange aTextAnchorRange; + const basegfx::B2DPoint aTopLeft(aSnapRange.getMinX() + rText.getTextLeftDistance(), aSnapRange.getMinY() + rText.getTextUpperDistance()); + const basegfx::B2DPoint aBottomRight(aSnapRange.getMaxX() - rText.getTextRightDistance(), aSnapRange.getMaxY() - rText.getTextLowerDistance()); + basegfx::B2DRange aTextAnchorRange; aTextAnchorRange.expand(aTopLeft); aTextAnchorRange.expand(aBottomRight); @@ -331,16 +331,16 @@ namespace drawinglayer const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection); // decompose to get separated values for the scroll box - ::basegfx::B2DVector aScale, aTranslate; + basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; aAnchorTransform.decompose(aScale, aTranslate, fRotate, fShearX); // build transform from scaled only to full AnchorTransform and inverse - ::basegfx::B2DHomMatrix aSRT; + basegfx::B2DHomMatrix aSRT; aSRT.shearX(fShearX); aSRT.rotate(fRotate); aSRT.translate(aTranslate.getX(), aTranslate.getY()); - ::basegfx::B2DHomMatrix aISRT(aSRT); + basegfx::B2DHomMatrix aISRT(aSRT); aISRT.invert(); // bring the primitive back to scaled only and get scaled range, create new clone for this @@ -355,13 +355,13 @@ namespace drawinglayer geometry::ViewInformation2D aViewInformation2D(xViewParameters); // get range - const ::basegfx::B2DRange aScaledRange(pNew->getB2DRange(aViewInformation2D)); + const basegfx::B2DRange aScaledRange(pNew->getB2DRange(aViewInformation2D)); // create left outside and right outside transformations. Also take care // of the clip rectangle - ::basegfx::B2DHomMatrix aLeft, aRight; - ::basegfx::B2DPoint aClipTopLeft(0.0, 0.0); - ::basegfx::B2DPoint aClipBottomRight(aScale.getX(), aScale.getY()); + basegfx::B2DHomMatrix aLeft, aRight; + basegfx::B2DPoint aClipTopLeft(0.0, 0.0); + basegfx::B2DPoint aClipBottomRight(aScale.getX(), aScale.getY()); if(bHorizontal) { @@ -410,10 +410,10 @@ namespace drawinglayer const Primitive2DSequence aContent(&xRefA, 1L); // scrolling needs an encapsulating clipping primitive - const ::basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight); - ::basegfx::B2DPolygon aClipPolygon(::basegfx::tools::createPolygonFromRect(aClipRange)); + const basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight); + basegfx::B2DPolygon aClipPolygon(basegfx::tools::createPolygonFromRect(aClipRange)); aClipPolygon.transform(aSRT); - return Primitive2DReference(new MaskPrimitive2D(::basegfx::B2DPolyPolygon(aClipPolygon), aContent)); + return Primitive2DReference(new MaskPrimitive2D(basegfx::B2DPolyPolygon(aClipPolygon), aContent)); } else { @@ -441,36 +441,43 @@ namespace drawinglayer } } - Primitive2DReference createShadowPrimitive( - const Primitive2DSequence& rSource, + Primitive2DSequence createEmbeddedShadowPrimitive( + const Primitive2DSequence& rContent, const attribute::SdrShadowAttribute& rShadow) { - // create Shadow primitives. Need to be added in front, should use already created primitives - if(rSource.hasElements()) + if(rContent.hasElements()) { + Primitive2DSequence aRetval(2); + basegfx::B2DHomMatrix aShadowOffset; + // prepare shadow offset - ::basegfx::B2DHomMatrix aShadowOffset; aShadowOffset.set(0, 2, rShadow.getOffset().getX()); aShadowOffset.set(1, 2, rShadow.getOffset().getY()); // create shadow primitive and add content - const Primitive2DReference xRefShadow(new ShadowPrimitive2D(aShadowOffset, rShadow.getColor(), rSource)); + aRetval[0] = Primitive2DReference( + new ShadowPrimitive2D( + aShadowOffset, + rShadow.getColor(), + rContent)); if(0.0 != rShadow.getTransparence()) { // create SimpleTransparencePrimitive2D - const Primitive2DSequence aContent(&xRefShadow, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rShadow.getTransparence())); - } - else - { - // return directly - return xRefShadow; + const Primitive2DSequence aTempContent(&aRetval[0], 1); + + aRetval[0] = Primitive2DReference( + new UnifiedAlphaPrimitive2D( + aTempContent, + rShadow.getTransparence())); } + + aRetval[1] = Primitive2DReference(new GroupPrimitive2D(rContent)); + return aRetval; } else { - return Primitive2DReference(); + return rContent; } } } // end of namespace primitive2d diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 814c20b681ac..ed3062184f1a 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -100,16 +100,7 @@ namespace drawinglayer // add shadow if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; @@ -206,16 +197,7 @@ namespace drawinglayer // add shadow if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index f1f88684dc6c..f5f2f4e876dc 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -110,16 +110,7 @@ namespace drawinglayer // add shadow if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 8d66e8b34d14..f515b9b6a5e9 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -52,71 +52,71 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference SdrMeasurePrimitive2D::impCreatePart( - const ::basegfx::B2DHomMatrix& rObjectMatrix, - const ::basegfx::B2DPoint& rStart, - const ::basegfx::B2DPoint& rEnd, + const basegfx::B2DHomMatrix& rObjectMatrix, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, bool bLeftActive, bool bRightActive) const { - ::basegfx::B2DPolygon aPolygon; + basegfx::B2DPolygon aPolygon; aPolygon.append(rStart); aPolygon.append(rEnd); - if(!maSdrLSTAttribute.getLineStartEnd() || (!bLeftActive && !bRightActive)) + if(!getSdrLSTAttribute().getLineStartEnd() || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), 0L); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), 0L); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), maSdrLSTAttribute.getLineStartEnd()); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()); } - const attribute::SdrLineStartEndAttribute* pLineStartEnd = maSdrLSTAttribute.getLineStartEnd(); - const ::basegfx::B2DPolyPolygon aEmpty; + const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), &aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; SdrBlockTextPrimitive2D* pBlockText = 0L; - ::basegfx::B2DRange aTextRange; - double fTextX((maStart.getX() + maEnd.getX()) * 0.5); - double fTextY((maStart.getX() + maEnd.getX()) * 0.5); - const ::basegfx::B2DVector aLine(maEnd - maStart); + basegfx::B2DRange aTextRange; + double fTextX((getStart().getX() + getEnd().getX()) * 0.5); + double fTextY((getStart().getX() + getEnd().getX()) * 0.5); + const basegfx::B2DVector aLine(getEnd() - getStart()); const double fDistance(aLine.getLength()); const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); - const attribute::SdrTextAttribute* pTextAttribute = maSdrLSTAttribute.getText(); + const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); - ::basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DHomMatrix aObjectMatrix; aObjectMatrix.rotate(fAngle); - aObjectMatrix.translate(maStart.getX(), maStart.getY()); + aObjectMatrix.translate(getStart().getX(), getStart().getY()); if(pTextAttribute) { - ::basegfx::B2DHomMatrix aTextMatrix; + basegfx::B2DHomMatrix aTextMatrix; double fTestAngle(fAngle); - if(mbTextRotation) + if(getTextRotation()) { aTextMatrix.rotate(-90.0 * F_PI180); fTestAngle -= (90.0 * F_PI180); - if(mbTextAutoAngle && fTestAngle < -F_PI) + if(getTextAutoAngle() && fTestAngle < -F_PI) { fTestAngle += F_2PI; } } - if(mbTextAutoAngle) + if(getTextAutoAngle()) { if(fTestAngle > (F_PI / 4.0) || fTestAngle < (-F_PI * (3.0 / 4.0))) { @@ -136,7 +136,7 @@ namespace drawinglayer } // prepare line attribute and result - const attribute::SdrLineAttribute* pLineAttribute(maSdrLSTAttribute.getLine()); + const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine()); if(!pLineAttribute) { @@ -147,7 +147,7 @@ namespace drawinglayer { bool bArrowsOutside(false); bool bMainLineSplitted(false); - const attribute::SdrLineStartEndAttribute* pLineStartEnd = maSdrLSTAttribute.getLineStartEnd(); + const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); double fStartArrowW(0.0); double fStartArrowH(0.0); double fEndArrowW(0.0); @@ -157,7 +157,7 @@ namespace drawinglayer { if(pLineStartEnd->isStartActive()) { - const ::basegfx::B2DRange aArrowRange(::basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); fStartArrowW = pLineStartEnd->getStartWidth(); fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth(); @@ -169,7 +169,7 @@ namespace drawinglayer if(pLineStartEnd->isEndActive()) { - const ::basegfx::B2DRange aArrowRange(::basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); fEndArrowW = pLineStartEnd->getEndWidth(); fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth(); @@ -189,8 +189,8 @@ namespace drawinglayer bArrowsOutside = true; } - MeasureTextPosition eHorizontal(meHorizontal); - MeasureTextPosition eVertical(meVertical); + MeasureTextPosition eHorizontal(getHorizontal()); + MeasureTextPosition eVertical(getVertical()); if(MEASURETEXTPOSITION_AUTOMATIC == eVertical) { @@ -237,7 +237,7 @@ namespace drawinglayer } // switch text above/below? - if(mbBelow || (bAutoUpsideDown && !mbTextRotation)) + if(getBelow() || (bAutoUpsideDown && !getTextRotation())) { if(MEASURETEXTPOSITION_NEGATIVE == eVertical) { @@ -249,9 +249,9 @@ namespace drawinglayer } } - const double fMainLineOffset(mbBelow ? mfDistance : -mfDistance); - const ::basegfx::B2DPoint aMainLeft(0.0, fMainLineOffset); - const ::basegfx::B2DPoint aMainRight(fDistance, fMainLineOffset); + const double fMainLineOffset(getBelow() ? getDistance() : -getDistance()); + const basegfx::B2DPoint aMainLeft(0.0, fMainLineOffset); + const basegfx::B2DPoint aMainRight(fDistance, fMainLineOffset); // main line if(bArrowsOutside) @@ -271,8 +271,8 @@ namespace drawinglayer } } - const ::basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); - const ::basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); + const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); + const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainRight, aMainRightRight, true, false)); @@ -287,8 +287,8 @@ namespace drawinglayer if(bMainLineSplitted) { const double fHalfLength((fDistance - (aTextRange.getWidth() + (fStartArrowH + fEndArrowH) * 0.25)) * 0.5); - const ::basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); - const ::basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); + const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); + const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainInnerRight, aMainRight, false, true)); @@ -300,19 +300,19 @@ namespace drawinglayer } // left/right help line value preparation - const double fTopEdge(mbBelow ? mfUpper + mfDistance : -mfUpper - mfDistance); - const double fBottomLeft(mbBelow ? mfLower - mfLeftDelta : mfLeftDelta - mfLower); - const double fBottomRight(mbBelow ? mfLower - mfRightDelta : mfRightDelta - mfLower); + const double fTopEdge(getBelow() ? getUpper() + getDistance() : -getUpper() - getDistance()); + const double fBottomLeft(getBelow() ? getLower() - getLeftDelta() : getLeftDelta() - getLower()); + const double fBottomRight(getBelow() ? getLower() - getRightDelta() : getRightDelta() - getLower()); // left help line - const ::basegfx::B2DPoint aLeftUp(0.0, fTopEdge); - const ::basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); + const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); + const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line - const ::basegfx::B2DPoint aRightUp(fDistance, fTopEdge); - const ::basegfx::B2DPoint aRightDown(fDistance, fBottomRight); + const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); + const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aRightDown, aRightUp, false, false)); @@ -395,7 +395,7 @@ namespace drawinglayer } } - if(!maSdrLSTAttribute.getLine()) + if(!getSdrLSTAttribute().getLine()) { // embed line geometry to invisible line group const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); @@ -408,7 +408,7 @@ namespace drawinglayer if(pBlockText) { // create transformation to text primitive end position - ::basegfx::B2DHomMatrix aChange; + basegfx::B2DHomMatrix aChange; // handle auto text rotation if(bAutoUpsideDown) @@ -432,18 +432,9 @@ namespace drawinglayer } // add shadow - if(maSdrLSTAttribute.getShadow()) + if(getSdrLSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *maSdrLSTAttribute.getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); } return aRetval; @@ -451,8 +442,8 @@ namespace drawinglayer SdrMeasurePrimitive2D::SdrMeasurePrimitive2D( const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, - const ::basegfx::B2DPoint& rStart, - const ::basegfx::B2DPoint& rEnd, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, MeasureTextPosition eHorizontal, MeasureTextPosition eVertical, double fDistance, @@ -486,19 +477,19 @@ namespace drawinglayer { const SdrMeasurePrimitive2D& rCompare = (SdrMeasurePrimitive2D&)rPrimitive; - return (maStart == rCompare.maStart - && maEnd == rCompare.maEnd - && meHorizontal == rCompare.meHorizontal - && meVertical == rCompare.meVertical - && mfDistance == rCompare.mfDistance - && mfUpper == rCompare.mfUpper - && mfLower == rCompare.mfLower - && mfLeftDelta == rCompare.mfLeftDelta - && mfRightDelta == rCompare.mfRightDelta - && mbBelow == rCompare.mbBelow - && mbTextRotation == rCompare.mbTextRotation - && mbTextAutoAngle == rCompare.mbTextAutoAngle - && maSdrLSTAttribute == rCompare.maSdrLSTAttribute); + return (getStart() == rCompare.getStart() + && getEnd() == rCompare.getEnd() + && getHorizontal() == rCompare.getHorizontal() + && getVertical() == rCompare.getVertical() + && getDistance() == rCompare.getDistance() + && getUpper() == rCompare.getUpper() + && getLower() == rCompare.getLower() + && getLeftDelta() == rCompare.getLeftDelta() + && getRightDelta() == rCompare.getRightDelta() + && getBelow() == rCompare.getBelow() + && getTextRotation() == rCompare.getTextRotation() + && getTextAutoAngle() == rCompare.getTextAutoAngle() + && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 2cedb1bfce29..ab5d23962719 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -116,16 +116,7 @@ namespace drawinglayer // add shadow if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx new file mode 100644 index 000000000000..67fee9215b73 --- /dev/null +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrcaptionprimitive2d.cxx,v $ + * + * $Revision: 1.2.18.1 $ + * + * 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 "precompiled_svx.hxx" +#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> +#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <svx/svdoole2.hxx> +#include <vcl/svapp.hxx> +#include <drawinglayer/primitive2d/graphicprimitive2d.hxx> +#include <svtools/colorcfg.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence SdrOleContentPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + { + Primitive2DSequence aRetval; + const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0); + bool bScaleContent(false); + Graphic aGraphic; + + if(pSource) + { + Graphic* pOLEGraphic = (getHighContrast()) + ? pSource->getEmbeddedObjectRef().GetHCGraphic() + : pSource->GetGraphic(); + + if(pOLEGraphic) + { + aGraphic = *pOLEGraphic; + bScaleContent = pSource->IsEmptyPresObj(); + } + } + + if(GRAPHIC_NONE == aGraphic.GetType()) + { + // no source, use fallback ressource emty OLE graphic + const Bitmap aEmptyOLEBitmap(SdrOle2Obj::GetEmtyOLEReplacementBitmap()); + aGraphic = Graphic(aEmptyOLEBitmap); + bScaleContent = true; + } + + if(GRAPHIC_NONE != aGraphic.GetType()) + { + const GraphicObject aGraphicObject(aGraphic); + const GraphicAttr aGraphicAttr; + drawinglayer::primitive2d::Primitive2DSequence xOLEContent; + + if(bScaleContent) + { + // get transformation atoms + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX); + + // get PrefSize from the graphic in 100th mm + Size aPrefSize(aGraphic.GetPrefSize()); + + if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit()) + { + aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM); + } + else + { + aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aGraphic.GetPrefMapMode(), MAP_100TH_MM); + } + + const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0); + const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0); + + if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) + { + // if content fits into frame, create it + basegfx::B2DHomMatrix aInnerObjectMatrix; + + aInnerObjectMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); + aInnerObjectMatrix.translate(fOffsetX, fOffsetY); + aInnerObjectMatrix.shearX(fShearX); + aInnerObjectMatrix.rotate(fRotate); + aInnerObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); + + const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( + new drawinglayer::primitive2d::GraphicPrimitive2D( + aInnerObjectMatrix, + aGraphicObject, + aGraphicAttr)); + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); + } + } + else + { + // create graphic primitive for content + const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( + new drawinglayer::primitive2d::GraphicPrimitive2D( + getObjectTransform(), + aGraphicObject, + aGraphicAttr)); + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); + } + + // a standard gray outline is created for scaled content + if(bScaleContent) + { + const svtools::ColorConfig aColorConfig; + const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); + + if(aColor.bIsVisible) + { + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const Color aVclColor(aColor.nColor); + aOutline.transform(getObjectTransform()); + const drawinglayer::primitive2d::Primitive2DReference xOutline( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aVclColor.getBColor())); + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xOutline); + } + } + } + + // get graphic and check scale content state + return aRetval; + } + + SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( + const SdrOle2Obj& rSdrOle2Obj, + const basegfx::B2DHomMatrix& rObjectTransform, + bool bHighContrast) + : BasePrimitive2D(), + mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), + maObjectTransform(rObjectTransform), + mbHighContrast(bHighContrast) + { + } + + bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive; + const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is()); + const bool bBothAndEqual(mpSdrOle2Obj.is() && rCompare.mpSdrOle2Obj.is() + && mpSdrOle2Obj.get() == rCompare.mpSdrOle2Obj.get()); + + return ((bBothNot || bBothAndEqual) + && getObjectTransform() == rCompare.getObjectTransform() + && getHighContrast() == rCompare.getHighContrast()); + } + + return false; + } + + basegfx::B2DRange SdrOleContentPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0); + aRange.transform(getObjectTransform()); + + return aRange; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(SdrOleContentPrimitive2D, PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 3b6a653a7bc6..91ed0bd2adce 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -52,22 +52,22 @@ namespace drawinglayer Primitive2DSequence aRetval; // add fill - if(maSdrLFSTAttribute.getFill() && maUnitPolyPolygon.isClosed()) + if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed()) { // take care for orientations - ::basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(::basegfx::tools::correctOrientations(maUnitPolyPolygon)); + basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon())); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, maTransform, *maSdrLFSTAttribute.getFill(), maSdrLFSTAttribute.getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(maSdrLFSTAttribute.getLine()) + if(getSdrLFSTAttribute().getLine()) { - Primitive2DSequence aTemp(maUnitPolyPolygon.count()); + Primitive2DSequence aTemp(getUnitPolyPolygon().count()); - for(sal_uInt32 a(0L); a < maUnitPolyPolygon.count(); a++) + for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++) { - aTemp[a] = createPolygonLinePrimitive(maUnitPolyPolygon.getB2DPolygon(a), maTransform, *maSdrLFSTAttribute.getLine(), maSdrLFSTAttribute.getLineStartEnd()); + aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()); } appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); @@ -76,44 +76,35 @@ namespace drawinglayer { // if initially no line is defined, create one for HitTest and BoundRect const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - Primitive2DSequence xHiddenLineSequence(maUnitPolyPolygon.count()); + Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count()); - for(sal_uInt32 a(0); a < maUnitPolyPolygon.count(); a++) + for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++) { - xHiddenLineSequence[a] = createPolygonLinePrimitive(maUnitPolyPolygon.getB2DPolygon(a), maTransform, aBlackHairline); + xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline); } appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); } // add text - if(maSdrLFSTAttribute.getText()) + if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(maUnitPolyPolygon, maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); } // add shadow - if(maSdrLFSTAttribute.getShadow()) + if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *maSdrLFSTAttribute.getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrPathPrimitive2D::SdrPathPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon) + const basegfx::B2DPolyPolygon& rUnitPolyPolygon) : BasePrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), @@ -127,9 +118,9 @@ namespace drawinglayer { const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive; - return (maUnitPolyPolygon == rCompare.maUnitPolyPolygon - && maTransform == rCompare.maTransform - && maSdrLFSTAttribute == rCompare.maSdrLFSTAttribute); + return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon() + && getTransform() == rCompare.getTransform() + && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 97aaf2735630..64ac716b40e9 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -50,65 +50,90 @@ namespace drawinglayer Primitive2DSequence SdrRectanglePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; + Primitive2DSequence aHitTestContent; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), getCornerRadiusX(), getCornerRadiusY())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), + getCornerRadiusX(), + getCornerRadiusY())); // add fill if(getSdrLFSTAttribute().getFill()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); + } + else if(getTextFrame()) + { + // if no fill and it's a text frame, create a fill for HitTest and + // BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line if(getSdrLFSTAttribute().getLine()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + *getSdrLFSTAttribute().getLine())); } - else + else if(!getTextFrame()) { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + // if initially no line is defined and it's not a text frame, create + // a line for HitTest and BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); + } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + // add HitTest and BoundRect helper geometry (if exists) + if(aHitTestContent.hasElements()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); } // add text if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false)); } // add shadow if(getSdrLFSTAttribute().getShadow()) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); - - if(xShadow.is()) - { - Primitive2DSequence aContentWithShadow(2L); - aContentWithShadow[0L] = xShadow; - aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval)); - aRetval = aContentWithShadow; - } + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrRectanglePrimitive2D::SdrRectanglePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fCornerRadiusX, - double fCornerRadiusY) + double fCornerRadiusY, + bool bTextFrame) : BasePrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), mfCornerRadiusX(fCornerRadiusX), - mfCornerRadiusY(fCornerRadiusY) + mfCornerRadiusY(fCornerRadiusY), + mbTextFrame(bTextFrame) { } @@ -121,7 +146,8 @@ namespace drawinglayer return (getCornerRadiusX() == rCompare.getCornerRadiusX() && getCornerRadiusY() == rCompare.getCornerRadiusY() && getTransform() == rCompare.getTransform() - && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()); + && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute() + && getTextFrame() == rCompare.getTextFrame()); } return false; diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 49e3fc87ae68..30c3ff62531a 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -476,6 +476,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction& rAct) bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly) { + // #i102706# Do not merge closed polygons + if(rSrcPoly.isClosed()) + { + return false; + } + // #i73407# reformulation to use new B2DPolygon classes if(bLastObjWasLine && (aOldLineColor == aVD.GetLineColor()) && rSrcPoly.count()) { @@ -489,6 +495,12 @@ bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrc bool bOk(false); basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L)); + // #i102706# Do not merge closed polygons + if(aDstPoly.isClosed()) + { + return false; + } + if(aDstPoly.count()) { const sal_uInt32 nMaxDstPnt(aDstPoly.count() - 1L); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 01ef392e941a..8c30bfb88018 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -2208,14 +2208,7 @@ sal_Bool SdrOle2Obj::AddOwnLightClient() ////////////////////////////////////////////////////////////////////////////// -bool SdrOle2Obj::executeOldDoPaintPreparations(SdrPageView* /*pPageVew*/) const -{ - //#i101925# moved this stuff to method ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence and reorganized it further to avoid superfluous metafile creation for charts - //this method can be removed with the next incompatible build - return false; -} - -Bitmap SdrOle2Obj::GetEmtyOLEReplacementBitmap() const +Bitmap SdrOle2Obj::GetEmtyOLEReplacementBitmap() { return Bitmap(ResId(BMP_SVXOLEOBJ, *ImpGetResMgr())); } diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 23f3981228e1..b9a197ed89fb 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -697,17 +697,16 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* aOut.EnableOutput( FALSE ); aOut.SetMapMode( aMap ); aMtf.Record( &aOut ); - - // aXOut.SetOffset( Point( -aBoundRect.Left(), -aBoundRect.Top() ) ); - // #i92760# offset set in wrong direction, corrected - MapMode aOffsetMapMode(aOut.GetMapMode()); - aOffsetMapMode.SetOrigin(Point(-aBoundRect.Left(), -aBoundRect.Top())); - aOut.SetMapMode(aOffsetMapMode); - pObj->SingleObjectPainter( aOut ); // #110094#-17 - aMtf.Stop(); aMtf.WindStart(); + + // #i99268# replace the original offset from using XOutDev's SetOffset + // NOT (as tried with #i92760#) with another MapMode which gets recorded + // by the Metafile itself (what always leads to problems), but by hardly + // moving the result + aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top()); + aMtf.SetPrefMapMode( aMap ); aMtf.SetPrefSize( aBoundRect.GetSize() ); diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index f740bf60258c..45a24211f7b2 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -687,17 +687,7 @@ namespace sdr if(pNewShadowAttribute) { - // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const drawinglayer::primitive2d::Primitive2DReference xShadow(drawinglayer::primitive2d::createShadowPrimitive(xRetval, *pNewShadowAttribute)); - - if(xShadow.is()) - { - drawinglayer::primitive2d::Primitive2DSequence xContentWithShadow(2); - xContentWithShadow[0] = xShadow; - xContentWithShadow[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GroupPrimitive2D(xRetval)); - xRetval = xContentWithShadow; - } - + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); delete pNewShadowAttribute; } } diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index dc24ad21ddca..f7826c546d60 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -760,7 +760,10 @@ Svx3DLatheObject::~Svx3DLatheObject() throw() { } -static bool PolyPolygonShape3D_to_B3dPolyPolygon( const Any& rValue, basegfx::B3DPolyPolygon& rResultPolygon ) +bool PolyPolygonShape3D_to_B3dPolyPolygon( + const Any& rValue, + basegfx::B3DPolyPolygon& rResultPolygon, + bool bCorrectPolygon) { drawing::PolyPolygonShape3D aSourcePolyPolygon; if( !(rValue >>= aSourcePolyPolygon) ) @@ -791,7 +794,14 @@ static bool PolyPolygonShape3D_to_B3dPolyPolygon( const Any& rValue, basegfx::B3 pInnerSequenceX++; pInnerSequenceY++; pInnerSequenceZ++; - basegfx::tools::checkClosed(aNewPolygon); + + // #i101520# correction is needed for imported polygons of old format, + // see callers + if(bCorrectPolygon) + { + basegfx::tools::checkClosed(aNewPolygon); + } + rResultPolygon.append(aNewPolygon); } return true; @@ -855,7 +865,9 @@ bool Svx3DLatheObject::setPropertyValueImpl( const ::rtl::OUString& rName, const { // Polygondefinition in das Objekt packen basegfx::B3DPolyPolygon aNewB3DPolyPolygon; - if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon ) ) + + // #i101520# Probably imported + if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) ) { // #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number // of points of the polygon. Thus, value gets lost. To avoid this, rescue @@ -973,7 +985,9 @@ bool Svx3DExtrudeObject::setPropertyValueImpl( const ::rtl::OUString& rName, con { // Polygondefinition in das Objekt packen basegfx::B3DPolyPolygon aNewB3DPolyPolygon; - if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon ) ) + + // #i101520# Probably imported + if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) ) { // Polygon setzen const basegfx::B3DHomMatrix aIdentity; @@ -1082,7 +1096,9 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const ::rtl::OUString& rName, con { // Polygondefinition in das Objekt packen basegfx::B3DPolyPolygon aNewB3DPolyPolygon; - if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon ) ) + + // #i101520# Direct API data (e.g. from chart) + if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) ) { // Polygon setzen static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon); @@ -1094,7 +1110,9 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const ::rtl::OUString& rName, con { // Normalendefinition in das Objekt packen basegfx::B3DPolyPolygon aNewB3DPolyPolygon; - if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon ) ) + + // #i101520# Direct API data (e.g. from chart) + if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) ) { // Polygon setzen static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon); @@ -1106,7 +1124,9 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const ::rtl::OUString& rName, con { // Texturdefinition in das Objekt packen basegfx::B3DPolyPolygon aNewB3DPolyPolygon; - if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon ) ) + + // #i101520# Direct API data (e.g. from chart) + if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) ) { // Polygon setzen const basegfx::B3DHomMatrix aIdentity; diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 08e83fc889fb..81439effcfc1 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -620,25 +620,29 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() mpTextForwarder->flushCache(); OutlinerParaObject* pOutlinerParaObject = NULL; - bool bTextEditActive = false; SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject ); if( pTextObj && pTextObj->getActiveText() == mpText ) pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active + bool bOwnParaObj(false); if( pOutlinerParaObject ) - bTextEditActive = true; // text edit active + bOwnParaObj = true; // text edit active else pOutlinerParaObject = mpText->GetOutlinerParaObject(); - if( pOutlinerParaObject && ( bTextEditActive || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) ) + if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) ) { mpOutliner->SetText( *pOutlinerParaObject ); // #91254# put text to object and set EmptyPresObj to FALSE - if( mpText && bTextEditActive && pOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() ) + if( mpText && bOwnParaObj && pOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() ) { mpObject->SetEmptyPresObj( FALSE ); static_cast< SdrTextObj* >( mpObject)->NbcSetOutlinerParaObjectForText( pOutlinerParaObject, mpText ); + + // #i103982# Here, due to mpObject->NbcSetOutlinerParaObjectForText, we LOSE ownership of the + // OPO, so do NOT delete it when leaving this method (!) + bOwnParaObj = false; } } else @@ -676,7 +680,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() mbDataValid = TRUE; - if( bTextEditActive ) + if( bOwnParaObj ) delete pOutlinerParaObject; } |