diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-07-30 18:00:59 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-07-30 18:00:59 +0200 |
commit | 34a3d99f8ca779c852452ba6bd646ed796f45247 (patch) | |
tree | 9fd03a07c6bb33eb6aabac5f6d9eca5959ce2062 /svx | |
parent | 2484e4f7faa1f052ff48d2192ffb5931a71faa8f (diff) | |
parent | c55ad3a6e59271fa6d730d3dd3100f5cb516d9ba (diff) |
merge to m53
Diffstat (limited to 'svx')
141 files changed, 4359 insertions, 5482 deletions
diff --git a/svx/inc/accessibility.hrc b/svx/inc/accessibility.hrc index 01955e04967c..c202c4611ffe 100644 --- a/svx/inc/accessibility.hrc +++ b/svx/inc/accessibility.hrc @@ -92,97 +92,3 @@ #endif -/************************************************************************* - * - * 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: accessibility.hrc,v $ - * $Revision: 1.10 $ - * - * 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 _SVX_ACCESSIBILITY_HRC -#define _SVX_ACCESSIBILITY_HRC - -#include <svx/dialogs.hrc> - -#define RID_SVXSTR_A11Y_3D_MATERIAL_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 1) -#define RID_SVXSTR_A11Y_TEXT_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 2) -#define RID_SVXSTR_A11Y_BACKGROUND_COLOR (RID_SVXSTR_ACCESSIBILITY_START + 3) -#define RID_SVXSTR_A11Y_FILLSTYLE_NONE (RID_SVXSTR_ACCESSIBILITY_START + 4) -#define RID_SVXSTR_A11Y_FILLSTYLE_SOLID (RID_SVXSTR_ACCESSIBILITY_START + 5) -#define RID_SVXSTR_A11Y_FILLSTYLE_HATCH (RID_SVXSTR_ACCESSIBILITY_START + 6) -#define RID_SVXSTR_A11Y_FILLSTYLE_GRADIENT (RID_SVXSTR_ACCESSIBILITY_START + 7) -#define RID_SVXSTR_A11Y_FILLSTYLE_BITMAP (RID_SVXSTR_ACCESSIBILITY_START + 8) -#define RID_SVXSTR_A11Y_WITH (RID_SVXSTR_ACCESSIBILITY_START + 9) -#define RID_SVXSTR_A11Y_STYLE (RID_SVXSTR_ACCESSIBILITY_START + 10) -#define RID_SVXSTR_A11Y_AND (RID_SVXSTR_ACCESSIBILITY_START + 11) - - -// SvxRectCtl & childs -#define RID_SVXSTR_RECTCTL_ACC_START (RID_SVXSTR_ACCESSIBILITY_START + 20) -#define RID_SVXSTR_RECTCTL_ACC_CORN_NAME (RID_SVXSTR_RECTCTL_ACC_START + 0) -#define RID_SVXSTR_RECTCTL_ACC_CORN_DESCR (RID_SVXSTR_RECTCTL_ACC_START + 1) -#define RID_SVXSTR_RECTCTL_ACC_ANGL_NAME (RID_SVXSTR_RECTCTL_ACC_START + 2) -#define RID_SVXSTR_RECTCTL_ACC_ANGL_DESCR (RID_SVXSTR_RECTCTL_ACC_START + 3) - -#define RID_SVXSTR_RECTCTL_ACC_CHLD_LT (RID_SVXSTR_RECTCTL_ACC_START + 4) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_MT (RID_SVXSTR_RECTCTL_ACC_START + 5) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_RT (RID_SVXSTR_RECTCTL_ACC_START + 6) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_LM (RID_SVXSTR_RECTCTL_ACC_START + 7) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_MM (RID_SVXSTR_RECTCTL_ACC_START + 8) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_RM (RID_SVXSTR_RECTCTL_ACC_START + 9) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_LB (RID_SVXSTR_RECTCTL_ACC_START + 10) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_MB (RID_SVXSTR_RECTCTL_ACC_START + 11) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_RB (RID_SVXSTR_RECTCTL_ACC_START + 12) - -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A000 (RID_SVXSTR_RECTCTL_ACC_START + 13) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A045 (RID_SVXSTR_RECTCTL_ACC_START + 14) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A090 (RID_SVXSTR_RECTCTL_ACC_START + 15) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A135 (RID_SVXSTR_RECTCTL_ACC_START + 16) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A180 (RID_SVXSTR_RECTCTL_ACC_START + 17) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A225 (RID_SVXSTR_RECTCTL_ACC_START + 18) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A270 (RID_SVXSTR_RECTCTL_ACC_START + 19) -#define RID_SVXSTR_RECTCTL_ACC_CHLD_A315 (RID_SVXSTR_RECTCTL_ACC_START + 20) -#define RID_SVXSTR_RECTCTL_ACC_END (RID_SVXSTR_RECTCTL_ACC_START + 21) - -// SvxGraphCtrlAccessibleContext -#define RID_SVXSTR_GRAPHCTRL_ACC_START (RID_SVXSTR_RECTCTL_ACC_END) -#define RID_SVXSTR_GRAPHCTRL_ACC_NAME (RID_SVXSTR_GRAPHCTRL_ACC_START + 0) -#define RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION (RID_SVXSTR_GRAPHCTRL_ACC_START + 1) - -// text paragraphs and bullets -#define RID_SVXSTR_A11Y_TEXTHELPER_START (RID_SVXSTR_ACCESSIBILITY_START + 70) -#define RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION (RID_SVXSTR_A11Y_TEXTHELPER_START + 0) -#define RID_SVXSTR_A11Y_PARAGRAPH_NAME (RID_SVXSTR_A11Y_TEXTHELPER_START + 1) -#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_SVXSTR_A11Y_TEXTHELPER_START + 2) -#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_SVXSTR_A11Y_TEXTHELPER_START + 3) - -// SvxShowCharSetAcc -#define RID_SVXSTR_CHARACTER_SELECTION (RID_SVXSTR_ACCESSIBILITY_START + 80) -#define RID_SVXSTR_CHARACTER_CODE (RID_SVXSTR_ACCESSIBILITY_START + 81) -#define RID_SVXSTR_CHAR_SEL_DESC (RID_SVXSTR_ACCESSIBILITY_START + 82) - -#endif - diff --git a/svx/inc/mscodec.hxx b/svx/inc/mscodec.hxx index 1b72976cbf01..631990657470 100644 --- a/svx/inc/mscodec.hxx +++ b/svx/inc/mscodec.hxx @@ -235,6 +235,14 @@ public: */ bool InitCipher( sal_uInt32 nCounter ); + /** Creates an MD5 digest of salt digest. */ + bool CreateSaltDigest( + const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] ); + + bool Encode( + const void* pData, sal_Size nDatLen, + sal_uInt8* pBuffer, sal_Size nBufLen ); + /** Decodes a block of memory. @see rtl_cipher_decode() @@ -276,6 +284,9 @@ public: bool Skip( sal_Size nDatLen ); private: + void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] ); + +private: SVX_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& ); SVX_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& ); diff --git a/svx/inc/svdtouch.hxx b/svx/inc/svdtouch.hxx deleted file mode 100644 index 4723eff487f0..000000000000 --- a/svx/inc/svdtouch.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * 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: svdtouch.hxx,v $ - * $Revision: 1.6 $ - * - * 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 _SVDTOUCH_HXX -#define _SVDTOUCH_HXX - -#include <tools/solar.h> - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -class Point; -class Polygon; -class PolyPolygon; -class Rectangle; - -bool IsPointInsidePoly(const Polygon& rPoly, const Point& rHit); -bool IsPointInsidePoly(const PolyPolygon& rPoly, const Point& rHit); - -bool IsRectTouchesLine(const Point& rPt1, const Point& rPt2, const Rectangle& rHit); -bool IsRectTouchesLine(const Polygon& rLine, const Rectangle& rHit); -bool IsRectTouchesLine(const PolyPolygon& rLine, const Rectangle& rHit); - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -#endif //_SVDTOUCH_HXX - diff --git a/svx/inc/svx/emphitem.hxx b/svx/inc/svx/emphitem.hxx index 2d90f4cd035a..fd80081f2d30 100644 --- a/svx/inc/svx/emphitem.hxx +++ b/svx/inc/svx/emphitem.hxx @@ -28,7 +28,7 @@ * ************************************************************************/ #ifndef _SVX_EMPHITEM_HXX -#define _SVX_EMPTITEM_HXX +#define _SVX_EMPHITEM_HXX // include --------------------------------------------------------------- diff --git a/svx/inc/svx/msocximex.hxx b/svx/inc/svx/msocximex.hxx index 679845827867..a32179a43eb4 100644 --- a/svx/inc/svx/msocximex.hxx +++ b/svx/inc/svx/msocximex.hxx @@ -230,7 +230,7 @@ class SVX_DLLPUBLIC OCX_Control { public: OCX_Control(UniString sN, OCX_Control* parent = NULL ) : nWidth( 0 ), nHeight( 0 ), mnLeft(0), mnTop(0), - mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), sName(sN), pDocSh(0), + mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), mbVisible(true), sName(sN), pDocSh(0), bSetInDialog(FALSE), mpParent( parent ) {} sal_Bool FullRead(SotStorageStream *pS) { @@ -287,6 +287,7 @@ public: sal_Int32 mnBackColor; sal_Int32 mnForeColor; sal_uInt16 mnTabPos; + bool mbVisible; UniString sName; UniString msToolTip; OCX_FontData aFontData; @@ -483,7 +484,7 @@ public: }; struct ContainerRecord { - ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0) {} + ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0), bVisible( true ) {} ::rtl::OUString cName; ::rtl::OUString controlTip; @@ -494,6 +495,7 @@ struct ContainerRecord sal_uInt32 nSubStreamLen; sal_uInt16 nTabPos; sal_uInt16 nTypeIdent; + bool bVisible; }; typedef std::vector<OCX_Control*>::iterator CtrlIterator; diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx index 3c15cd6951ef..6d77b0612e90 100644 --- a/svx/inc/svx/obj3d.hxx +++ b/svx/inc/svx/obj3d.hxx @@ -308,9 +308,6 @@ public : virtual UINT16 GetObjIdentifier() const; virtual void RecalcSnapRect(); - // Hittest, wird an Geometrie weitergegeben - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; - // Parameter Geometrieerzeugung setzen/lesen BOOL GetCreateNormals() const { return bCreateNormals; } void SetCreateNormals(BOOL bNew); diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx index ad3de9d8c837..a699c7f9a198 100644 --- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx @@ -32,6 +32,8 @@ #ifndef _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX #define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX +#include <sal/types.h> + ////////////////////////////////////////////////////////////////////////////// // predefines @@ -57,7 +59,9 @@ namespace drawinglayer SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) public: - SdrShadowTextAttribute(SdrShadowAttribute* pShadow = 0L, SdrTextAttribute* pTextAttribute = 0L); + SdrShadowTextAttribute( + SdrShadowAttribute* pShadow = 0, + SdrTextAttribute* pTextAttribute = 0); ~SdrShadowTextAttribute(); // copy constructor and assigment operator @@ -68,7 +72,7 @@ namespace drawinglayer bool operator==(const SdrShadowTextAttribute& rCandidate) const; // bool access - bool isVisible() const { return (0L != mpTextAttribute); } + bool isVisible() const { return (0 != mpTextAttribute); } // data access const SdrShadowAttribute* getShadow() const { return mpShadow; } @@ -91,7 +95,10 @@ namespace drawinglayer SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) public: - SdrFillTextAttribute(SdrFillAttribute* pFill = 0L, FillGradientAttribute* pFillFloatTransGradient = 0L, SdrTextAttribute* pTextAttribute = 0L); + SdrFillTextAttribute( + SdrFillAttribute* pFill = 0, + FillGradientAttribute* pFillFloatTransGradient = 0, + SdrTextAttribute* pTextAttribute = 0); ~SdrFillTextAttribute(); // copy constructor and assigment operator @@ -126,8 +133,10 @@ namespace drawinglayer public: SdrLineShadowTextAttribute( - SdrLineAttribute* pLine = 0L, SdrLineStartEndAttribute* pLineStartEnd = 0L, - SdrShadowAttribute* pShadow = 0L, SdrTextAttribute* pTextAttribute = 0L); + SdrLineAttribute* pLine = 0, + SdrLineStartEndAttribute* pLineStartEnd = 0, + SdrShadowAttribute* pShadow = 0, + SdrTextAttribute* pTextAttribute = 0); ~SdrLineShadowTextAttribute(); // copy constructor and assigment operator @@ -161,8 +170,12 @@ namespace drawinglayer public: SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine = 0L, SdrFillAttribute* pFill = 0L, SdrLineStartEndAttribute* pLineStartEnd = 0L, - SdrShadowAttribute* pShadow = 0L, FillGradientAttribute* pFillFloatTransGradient = 0L, SdrTextAttribute* pTextAttribute = 0L); + SdrLineAttribute* pLine = 0, + SdrFillAttribute* pFill = 0, + SdrLineStartEndAttribute* pLineStartEnd = 0, + SdrShadowAttribute* pShadow = 0, + FillGradientAttribute* pFillFloatTransGradient = 0, + SdrTextAttribute* pTextAttribute = 0); ~SdrLineFillShadowTextAttribute(); // copy constructor and assigment operator diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx new file mode 100644 index 000000000000..77273bd9cb03 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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: sdrtextattribute.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 _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX + +#include <sal/types.h> +#include <svx/xenum.hxx> +#include <tools/color.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines +class SfxItemSet; +namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFormTextAttribute + { + private: + // FormText (FontWork) Attributes + sal_Int32 mnFormTextDistance; // distance from line in upright direction + sal_Int32 mnFormTextStart; // shift from polygon start + sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees + sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling + sal_uInt16 mnFormTextShdwTransp; // shadow transparence + XFormTextStyle meFormTextStyle; // on/off and char orientation + XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale + XFormTextShadow meFormTextShadow; // shadow mode + Color maFormTextShdwColor; // shadow color + + // outline attributes; used when getFormTextOutline() is true and (for + // shadow) when getFormTextShadow() != XFTSHADOW_NONE + SdrFormTextOutlineAttribute* mpOutline; + SdrFormTextOutlineAttribute* mpShadowOutline; + + // bitfield + unsigned mbFormTextMirror : 1; // change orientation + unsigned mbFormTextOutline : 1; // show contour of objects + + public: + SdrFormTextAttribute(const SfxItemSet& rSet); + ~SdrFormTextAttribute(); + + // copy constructor and assigment operator + SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); + SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); + + // compare operator + bool operator==(const SdrFormTextAttribute& rCandidate) const; + + // data access + sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } + sal_Int32 getFormTextStart() const { return mnFormTextStart; } + sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } + sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } + sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } + XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } + XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } + Color getFormTextShdwColor() const { return maFormTextShdwColor; } + + const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; } + const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; } + + bool getFormTextMirror() const { return mbFormTextMirror; } + bool getFormTextOutline() const { return mbFormTextOutline; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFORMTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx new file mode 100644 index 000000000000..8e11c97ed5c3 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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: sdrtextattribute.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 _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX + +#include <sal/types.h> +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFormTextOutlineAttribute + { + private: + // one set of attributes for FormText (FontWork) outline visualisation + LineAttribute maLineAttribute; + StrokeAttribute maStrokeAttribute; + sal_uInt8 mnTransparence; + + public: + SdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence); + + // compare operator + bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const; + + // data read access + const LineAttribute& getLineAttribute() const { return maLineAttribute; } + const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; } + sal_uInt8 getTransparence() const { return mnTransparence; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 9033135e6caa..3873f4026ea6 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -32,18 +32,15 @@ #ifndef _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX #define _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX -#include <svx/xenum.hxx> #include <sal/types.h> -#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx> +#include <svx/xenum.hxx> +#include <svx/outlobj.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines class SdrText; -class OutlinerParaObject; - -namespace drawinglayer { namespace animation { - class AnimationEntryList; -}} +namespace drawinglayer { namespace animation { class AnimationEntryList; }} +namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }} ////////////////////////////////////////////////////////////////////////////// @@ -53,10 +50,16 @@ namespace drawinglayer { class SdrTextAttribute { - const SdrText& mrSdrText; - const OutlinerParaObject maOutlinerParaObject; - XFormTextStyle meFormTextStyle; + private: + // all-text attributes. The SdrText itself and a copy + // of te OPO + const SdrText* mpSdrText; + OutlinerParaObject maOutlinerParaObject; + // Set when it's a FormText; contains all FormText attributes + SdrFormTextAttribute* mpSdrFormTextAttribute; + + // text distances sal_Int32 maTextLeftDistance; sal_Int32 maTextUpperDistance; sal_Int32 maTextRightDistance; @@ -85,19 +88,25 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode); + ~SdrTextAttribute(); + + // copy constructor and assigment operator + SdrTextAttribute(const SdrTextAttribute& rCandidate); + SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); + + // compare operator bool operator==(const SdrTextAttribute& rCandidate) const; // data access - const SdrText& getSdrText() const { return mrSdrText; } + const SdrText& getSdrText() const { return *mpSdrText; } const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } bool isContour() const { return mbContour; } - bool isFontwork() const { return (XFT_NONE != meFormTextStyle); } bool isFitToSize() const { return mbFitToSize; } bool isHideContour() const { return mbHideContour; } bool isBlink() const { return mbBlink; } bool isScroll() const { return mbScroll; } bool isInEditMode() const { return mbInEditMode; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } sal_Int32 getTextRightDistance() const { return maTextRightDistance; } diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx index 7a40c25511e4..27359ebf9738 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -89,18 +89,6 @@ namespace sdr { namespace contact { */ void setControlDesignMode( bool _bDesignMode ) const; - /** determines whether the instance belongs to a given OutputDevice - @precond - The instance knows the device it belongs to, or can determine it. - If this is not the case, you will notice an assertion, and the method will - return false. - */ - bool belongsToDevice( const OutputDevice* _pDevice ) const; - - /** positions the control for subsequent paint operations - */ - void positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const; - /** callback from impl class to react on changes of properties form the XControlModel */ void propertyChange(); @@ -165,6 +153,8 @@ namespace sdr { namespace contact { UnoControlPrintOrPreviewContact(); // never implemented UnoControlPrintOrPreviewContact( const UnoControlPrintOrPreviewContact& ); // never implemented UnoControlPrintOrPreviewContact& operator=( const UnoControlPrintOrPreviewContact& ); // never implemented + + virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const; }; //==================================================================== diff --git a/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx index 90c546cb85cc..9acc34c8dcc8 100644 --- a/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx +++ b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -60,11 +60,8 @@ namespace sdr // Flag to remember which state to draw. Inited with sal_False (0) unsigned mbOverlayState : 1; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) void impCheckBlinkTimeValueRange(); @@ -100,11 +97,6 @@ namespace sdr // execute event from base class ::sdr::animation::Event. Default // implementation does nothing and does not create a new event. virtual void Trigger(sal_uInt32 nTime); - - // Zoom has changed. If the objects logical size - // depends on the MapMode of the used OutputDevice, use this call - // to invalidate the range in logical coordinates. - virtual void zoomHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaybitmap.hxx b/svx/inc/svx/sdr/overlay/overlaybitmap.hxx deleted file mode 100644 index 23037300259d..000000000000 --- a/svx/inc/svx/sdr/overlay/overlaybitmap.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * 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: overlaybitmap.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_OVERLAYBITMAP_HXX -#define _SDR_OVERLAY_OVERLAYBITMAP_HXX - -#include <svx/sdr/overlay/overlayobject.hxx> -#include <vcl/bitmap.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayBitmap : public OverlayObjectWithBasePosition - { - protected: - // the Bitmap itself - Bitmap maBitmap; - - // position of the basePosition inside the Bitmap, in pixels - sal_uInt16 mnCenterX; - sal_uInt16 mnCenterY; - - // bitfield - // shall the BaseColor be used to create transparence? - unsigned mbUseTransparenceColor : 1; - - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); - - public: - OverlayBitmap( - const basegfx::B2DPoint& rBasePos, - const Bitmap& rBitmap, - sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0, - sal_Bool bUseTransCol = sal_False, - Color aTransColor = Color(COL_WHITE)); - virtual ~OverlayBitmap(); - - const Bitmap& getBitmap() const { return maBitmap; } - void setBitmap(const Bitmap& rNew); - - sal_Bool isTransparenceUsed() const { return mbUseTransparenceColor; } - void setTransparenceUsed(sal_Bool bNew); - - sal_uInt16 getCenterX() const { return mnCenterX; } - sal_uInt16 getCenterY() const { return mnCenterY; } - void setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY); - - // Zoom has changed. If the objects logical size - // depends on the MapMode of the used OutputDevice, use this call - // to invalidate the range in logical coordinates. - virtual void zoomHasChanged(); - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -#endif //_SDR_OVERLAY_OVERLAYBITMAP_HXX - -// eof diff --git a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx index b19b8248eb3e..96295d0f9f80 100644 --- a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx +++ b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx @@ -50,11 +50,7 @@ namespace sdr sal_uInt16 mnCenterX; sal_uInt16 mnCenterY; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayBitmapEx( @@ -69,11 +65,6 @@ namespace sdr sal_uInt16 getCenterX() const { return mnCenterX; } sal_uInt16 getCenterY() const { return mnCenterY; } void setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY); - - // Zoom has changed. If the objects logical size - // depends on the MapMode of the used OutputDevice, use this call - // to invalidate the range in logical coordinates. - virtual void zoomHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx index c85bc3d9aae5..35223ce44d04 100644 --- a/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx +++ b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx @@ -42,39 +42,15 @@ namespace sdr class OverlayCrosshairStriped : public OverlayObjectWithBasePosition { protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos); virtual ~OverlayCrosshairStriped(); - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayCrosshair : public OverlayCrosshairStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - public: - OverlayCrosshair( - const basegfx::B2DPoint& rBasePos, - Color aLineColor = Color(COL_BLACK)); - virtual ~OverlayCrosshair(); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx index 41e55f7dbdec..aeb4c416f058 100644 --- a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx +++ b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx @@ -47,38 +47,30 @@ namespace sdr { // geometric definitions basegfx::B2DPoint maSecondPosition; - const double mfDiscreteWidth; + const double mfDiscreteGrow; + const double mfDiscreteShrink; const double mfHatchRotation; const double mfRotation; - // helper to create visualisation geometry from above values - basegfx::B2DPolyPolygon getGeometry(OutputDevice& rOutputDevice); - - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayHatchRect( const basegfx::B2DPoint& rBasePosition, const basegfx::B2DPoint& rSecondPosition, const Color& rHatchColor, - double fDiscreteWidth, + double fDiscreteGrow, + double fDiscreteShrink, double fHatchRotation, double fRotation); const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } void setSecondPosition(const basegfx::B2DPoint&); - // Zoom has changed. If the objects logical size - // depends on the MapMode of the used OutputDevice, use this call - // to invalidate the range in logical coordinates. - virtual void zoomHasChanged(); - // data read access - double getDiscreteWidth() const { return mfDiscreteWidth; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } double getHatchRotation() const { return mfHatchRotation; } double getRotation() const { return mfRotation; } }; diff --git a/svx/inc/svx/sdr/overlay/overlayhelpline.hxx b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx index b26fc8c3f565..44baf5101e02 100644 --- a/svx/inc/svx/sdr/overlay/overlayhelpline.hxx +++ b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx @@ -46,11 +46,8 @@ namespace sdr // remember HelpLineKind SdrHelpLineKind meKind; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayHelplineStriped( @@ -58,30 +55,11 @@ namespace sdr SdrHelpLineKind eNewKind = SDRHELPLINE_POINT); virtual ~OverlayHelplineStriped(); - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayHelpline : public OverlayHelplineStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); + // dat read access + SdrHelpLineKind getKind() const { return meKind; } - public: - OverlayHelpline( - const basegfx::B2DPoint& rBasePos, - Color aLineColor = Color(COL_BLACK), - SdrHelpLineKind eNewKind = SDRHELPLINE_POINT); - virtual ~OverlayHelpline(); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlayline.hxx b/svx/inc/svx/sdr/overlay/overlayline.hxx index 821a87a0a36b..5c052b778fce 100644 --- a/svx/inc/svx/sdr/overlay/overlayline.hxx +++ b/svx/inc/svx/sdr/overlay/overlayline.hxx @@ -45,11 +45,8 @@ namespace sdr // second position in pixel basegfx::B2DPoint maSecondPosition; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayLineStriped( @@ -61,33 +58,8 @@ namespace sdr const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } void setSecondPosition(const basegfx::B2DPoint& rNew); - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - - // transform object coordinates. Needs to transform maSecondPosition. - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayLine : public OverlayLineStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - public: - OverlayLine( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - Color aLineColor = Color(COL_BLACK)); - virtual ~OverlayLine(); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaylinestriped.hxx b/svx/inc/svx/sdr/overlay/overlaylinestriped.hxx deleted file mode 100644 index 7ec84401d2bd..000000000000 --- a/svx/inc/svx/sdr/overlay/overlaylinestriped.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * 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: overlaylinestriped.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_OVERLAYLINESTRIPED_HXX -#define _SDR_OVERLAY_OVERLAYLINESTRIPED_HXX - -#include <svx/sdr/overlay/overlayline.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -#endif //_SDR_OVERLAY_OVERLAYLINESTRIPED_HXX - -// eof diff --git a/svx/inc/svx/sdr/overlay/overlaymanager.hxx b/svx/inc/svx/sdr/overlay/overlaymanager.hxx index 53cb15c5d72b..557a06a5f722 100644 --- a/svx/inc/svx/sdr/overlay/overlaymanager.hxx +++ b/svx/inc/svx/sdr/overlay/overlaymanager.hxx @@ -38,7 +38,6 @@ #include <tools/color.hxx> #include "svx/svxdllapi.h" #include <svtools/optionsdrawinglayer.hxx> -#include <boost/shared_ptr.hpp> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> @@ -68,13 +67,8 @@ namespace sdr // the OutputDevice to work on, set on construction and not to be changed OutputDevice& rmOutputDevice; - // start, end and number of the double linked list of OverlayObjects - // managed by this manager - OverlayObject* mpOverlayObjectStart; - OverlayObject* mpOverlayObjectEnd; - - // MapMode for MapMode change watching - MapMode maMapMode; + // the vector of registered OverlayObjects + OverlayObjectVector maOverlayObjects; // Stripe support. All striped OverlayObjects use these stripe // values. Changes change all those objects. @@ -88,23 +82,33 @@ namespace sdr // hold buffered the logic length of discrete vector (1.0, 0.0) and the // view transformation belonging to it. Update happens in getDiscreteOne() basegfx::B2DHomMatrix maViewTransformation; + drawinglayer::geometry::ViewInformation2D maViewInformation2D; double mfDiscreteOne; // internal void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const; - void ImpCheckMapModeChange() const; void ImpStripeDefinitionChanged(); + void impApplyRemoveActions(OverlayObject& rTarget); + void impApplyAddActions(OverlayObject& rTarget); // return mfDiscreteOne to derivations, but also check for buffered local // ViewTransformation and evtl. correct mfDiscreteOne double getDiscreteOne() const; public: - OverlayManager(OutputDevice& rOutputDevice); + // when handing over another OverlayManager at construction, the OverlayObjects + // will be taken over from it. The new one will have added all OverlayObjects + // while the handed over one will have none + OverlayManager( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager = 0); virtual ~OverlayManager(); + // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D + const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const; + // complete redraw - virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const; + virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const; // flush. Do buffered updates. virtual void flush(); @@ -139,17 +143,6 @@ namespace sdr // access to maDrawinglayerOpt const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; } - - /** Return a list of all OverlayObjects that currently belong to - the called OverlayManager. Subsequent calls to add() or - remove() will not alter the content of the returned list. - Modifying the list will not change the list of - OverlayObjects that belong to the called OverlayManager. - @return - The returned pointer is never empty but the pointed-to - vector may be. - */ - ::boost::shared_ptr<OverlayObjectVector> GetOverlayObjects (void) const; }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx index 8899c1ac3194..9ced6a4d18ec 100644 --- a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx +++ b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx @@ -65,7 +65,7 @@ namespace sdr // bitfield // Flag to decide if PreRendering shall be used for overlay refreshes. - // Default is sal_False. + // Default is false. unsigned mbRefreshWithPreRendering : 1; // link for timer @@ -78,7 +78,13 @@ namespace sdr void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L); public: - OverlayManagerBuffered(OutputDevice& rOutputDevice, sal_Bool bRefreshWithPreRendering = sal_False); + // when handing over another OverlayManager at construction, the OverlayObjects + // will be taken over from it. The new one will have added all OverlayObjects + // while the handed over one will have none + OverlayManagerBuffered( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager = 0, + bool bRefreshWithPreRendering = false); virtual ~OverlayManagerBuffered(); // complete redraw @@ -97,8 +103,8 @@ namespace sdr virtual void invalidateRange(const basegfx::B2DRange& rRange); // access to RefreshWithPreRendering Flag - sal_Bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; } - void SetRefreshWithPreRendering(sal_Bool bNew); + bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; } + void SetRefreshWithPreRendering(bool bNew); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlayobject.hxx b/svx/inc/svx/sdr/overlay/overlayobject.hxx index 41c13db0e457..e5aca5651976 100644 --- a/svx/inc/svx/sdr/overlay/overlayobject.hxx +++ b/svx/inc/svx/sdr/overlay/overlayobject.hxx @@ -36,6 +36,7 @@ #include <tools/color.hxx> #include <svx/sdr/animation/scheduler.hxx> #include "svx/svxdllapi.h" +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <vector> @@ -65,60 +66,64 @@ namespace sdr { namespace overlay { - class SVX_DLLPUBLIC OverlayObject : public ::sdr::animation::Event + class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event { - // Manager is allowed access to private Members, especially - // pNext and pPrevious are used form the manager to handle the - // OverlayObject. - friend class OverlayManager; + private: + // Manager is allowed access to private Member mpOverlayManager + friend class OverlayManager; // pointer to OverlayManager, if object is added. Changed by // OverlayManager, do not chnge Yourself. - OverlayManager* mpOverlayManager; + OverlayManager* mpOverlayManager; - // Chaining of IAO's, used by OverlayManager. These will be - // used form the OverlayManager, so do not change them Yourself. - OverlayObject* mpNext; - OverlayObject* mpPrevious; + // Primitive2DSequence of the OverlayObject + drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence; protected: + // access methods to maPrimitive2DSequence. The usage of this methods may allow + // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence() + // implementations for buffering the last decomposition. + const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void setPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DSequence& rNew) { maPrimitive2DSequence = rNew; } + + // the creation method for Primitive2DSequence. Called when getPrimitive2DSequence() + // sees that maPrimitive2DSequence is empty. Needs to be supported by all + // OverlayObject implementations. Default implementation will assert + // a missing implementation + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + // region in logical coordinates - basegfx::B2DRange maBaseRange; + basegfx::B2DRange maBaseRange; // base color of this OverlayObject - Color maBaseColor; + Color maBaseColor; // bitfield // Flag for visibility - unsigned mbIsVisible : 1; - - // Flag for validity - unsigned mbIsChanged : 1; + unsigned mbIsVisible : 1; // Flag to control hittability - unsigned mbIsHittable : 1; + unsigned mbIsHittable : 1; // Flag to hold info if this objects supports animation. Default is - // sal_False. If sal_True, the Trigger() method should be overloaded + // false. If true, the Trigger() method should be overloaded // to implement the animation effect and to re-initiate the event. - unsigned mbAllowsAnimation : 1; + unsigned mbAllowsAnimation : 1; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice) = 0; - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice) = 0; + // Flag tocontrol if this OverlayObject allows AntiAliased visualisation. + // Default is true, but e.g. for selection visualisation in SC and SW, + // it is switched to false + unsigned mbAllowsAntiAliase : 1; // set changed flag. Call after change, since the old range is invalidated // and then the new one is calculated and invalidated, too. This will only // work after the change. - void objectChange(); + virtual void objectChange(); - // support method to draw striped geometries - void ImpDrawRangeStriped(OutputDevice& rOutputDevice, const basegfx::B2DRange& rRange); - void ImpDrawLineStriped(OutputDevice& rOutputDevice, double x1, double y1, double x2, double y2); - void ImpDrawLineStriped(OutputDevice& rOutputDevice, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd); - void ImpDrawPolygonStriped(OutputDevice& rOutputDevice, const basegfx::B2DPolygon& rPolygon); + // write access to AntiAliase flag. This is protected since + // only implementations are allowed to change this, preferrably in their + // constructor + void allowAntiAliase(bool bNew); public: OverlayObject(Color aBaseColor); @@ -127,19 +132,20 @@ namespace sdr // get OverlayManager OverlayManager* getOverlayManager() const { return mpOverlayManager; } - // Hittest with logical coordinates. Default tests against maBaseRange. - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; + // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and + // setPrimitive2DSequence if needed + const drawinglayer::primitive2d::Primitive2DSequence& getOverlayObjectPrimitive2DSequence() const; // access to visibility state - sal_Bool isVisible() const { return mbIsVisible; } - void setVisible(sal_Bool bNew); - - // read access to changed flag - sal_Bool isChanged() const { return mbIsChanged; } + bool isVisible() const { return mbIsVisible; } + void setVisible(bool bNew); // access to hittable flag - sal_Bool isHittable() const { return mbIsHittable; } - void setHittable(sal_Bool bNew); + bool isHittable() const { return mbIsHittable; } + void setHittable(bool bNew); + + // read access to AntiAliase flag + bool allowsAntiAliase() const { return mbAllowsAntiAliase; } // read access to baseRange. This may trigger createBaseRange() if // object is changed. @@ -154,16 +160,7 @@ namespace sdr virtual void Trigger(sal_uInt32 nTime); // acces to AllowsAnimation flag - sal_Bool allowsAnimation() const { return mbAllowsAnimation; } - - // transform object coordinates. - virtual void transform(const basegfx::B2DHomMatrix& rMatrix) = 0; - - // Zoom has changed. If the objects logical size - // depends on the MapMode of the used OutputDevice, use this call - // to invalidate the range in logical coordinates. Default is no - // change. - virtual void zoomHasChanged(); + bool allowsAnimation() const { return mbAllowsAnimation; } // stripe definition has changed. The OverlayManager does have // support data to draw graphics in two colors striped. This @@ -197,10 +194,6 @@ namespace sdr // access to basePosition const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } void setBasePosition(const basegfx::B2DPoint& rNew); - - // transform object coordinates. Transforms maBasePosition - // and invalidates on change - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx index 91add8a39758..2f40c9385674 100644 --- a/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx +++ b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx @@ -42,7 +42,7 @@ namespace sdr { namespace overlay { - enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_HATCH, CELL_OVERLAY_TRANSPARENT, CELL_OVERLAY_LIGHT_TRANSPARENT }; + enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_TRANSPARENT }; // OverlayObjectCell - used for cell cursor, selection and AutoFill handle @@ -55,14 +55,12 @@ namespace sdr CellOverlayType mePaintType; RangeVector maRectangles; - virtual void drawGeometry(OutputDevice& rOutputDevice); - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects); virtual ~OverlayObjectCell(); - - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); }; } // end of namespace overlay diff --git a/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx index 8e03cc620dd0..3f665f203e5d 100644 --- a/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx +++ b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx @@ -70,16 +70,13 @@ namespace sdr OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); } // Hittest with logical coordinates - sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; + bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const; // Hittest with pixel coordinates and pixel tolerance - sal_Bool isHitPixel(const Point& rPos, sal_uInt32 nTol = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const; + bool isHitPixel(const Point& rDiscretePosition, sal_uInt32 fDiscreteTolerance = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const; // calculate BaseRange of all included OverlayObjects and return basegfx::B2DRange getBaseRange() const; - - // transform all members coordinates - void transform(const basegfx::B2DHomMatrix& rMatrix); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx index 276ad2b6bc5b..d7dc72df4d59 100644 --- a/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx +++ b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx @@ -46,11 +46,8 @@ namespace sdr // geometry basegfx::B2DPolyPolygon maPolyPolygon; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon); @@ -60,33 +57,8 @@ namespace sdr basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; } void setPolyPolygon(const basegfx::B2DPolyPolygon& rNew); - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - - // transform object coordinates. Needs to transform maSecondPosition - // and maThirdPosition. - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayPolyPolygon : public OverlayPolyPolygonStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - public: - OverlayPolyPolygon( - const basegfx::B2DPolyPolygon& rPolyPolygon, - Color aPolygonColor = Color(COL_BLACK)); - virtual ~OverlayPolyPolygon(); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx index 1ca1a0a7d18a..e94cfefcf327 100644 --- a/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx +++ b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx @@ -41,20 +41,14 @@ namespace sdr { namespace overlay { - class OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition + class SVX_DLLPUBLIC OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition { protected: // the sequence of primitives to show const drawinglayer::primitive2d::Primitive2DSequence maSequence; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); - - // Hittest with logical coordinates. Default tests against maBaseRange. - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); private: // internal helper to create a drawinglayer::geometry::ViewInformation2D diff --git a/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx index 81233e0d0252..3120f02d950b 100644 --- a/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx +++ b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx @@ -52,18 +52,15 @@ namespace sdr // Flag to switch on/off the bounds itself unsigned mbShowBounds : 1; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayRollingRectangleStriped( const basegfx::B2DPoint& rBasePos, const basegfx::B2DPoint& rSecondPos, - sal_Bool bExtendedLines = sal_False, - sal_Bool bShowBounds = sal_True); + bool bExtendedLines = false, + bool bShowBounds = true); virtual ~OverlayRollingRectangleStriped(); // change second position @@ -71,42 +68,15 @@ namespace sdr void setSecondPosition(const basegfx::B2DPoint& rNew); // change extended lines - sal_Bool getExtendedLines() const { return mbExtendedLines; } - void setExtendedLines(sal_Bool bNew); + bool getExtendedLines() const { return mbExtendedLines; } + void setExtendedLines(bool bNew); // change show bounds - sal_Bool getShowBounds() const { return mbShowBounds; } - void setShowBounds(sal_Bool bNew); - - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - - // transform object coordinates. Needs to transform maSecondPosition. - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayRollingRectangle : public OverlayRollingRectangleStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); + bool getShowBounds() const { return mbShowBounds; } + void setShowBounds(bool bNew); - public: - OverlayRollingRectangle( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - Color aLineColor = Color(COL_BLACK), - sal_Bool bExtendedLines = sal_False, - sal_Bool bShowBounds = sal_True); - virtual ~OverlayRollingRectangle(); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaytools.hxx b/svx/inc/svx/sdr/overlay/overlaytools.hxx new file mode 100644 index 000000000000..d9a1b34dd8f6 --- /dev/null +++ b/svx/inc/svx/sdr/overlay/overlaytools.hxx @@ -0,0 +1,281 @@ +/************************************************************************* + * + * 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: overlayobject.hxx,v $ + * $Revision: 1.4 $ + * + * 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_OVERLAYTOOLS_HXX +#define _SDR_OVERLAY_OVERLAYTOOLS_HXX + +#include <drawinglayer/primitive2d/primitivetools2d.hxx> +#include <vcl/bitmapex.hxx> + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class which holds a BotmapEx which is to be visualized +// at the given logic position with the Bitmap's pixel size, unscaled and +// unrotated (like a marker). The discrete pixel on the bitmap assocciated +// with the target position is given in discrete X,Y coordinates +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D + { + private: + // The BitmapEx to use, PixelSize is used + BitmapEx maBitmapEx; + + // The logic position + basegfx::B2DPoint maBasePosition; + + // The pixel inside the BitmapEx which is assocciated with + // the target position (offset in the bitmap) + sal_uInt16 mnCenterX; + sal_uInt16 mnCenterY; + + protected: + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayBitmapExPrimitive( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rBasePosition, + sal_uInt16 nCenterX, + sal_uInt16 nCenterY); + + // data access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + sal_uInt16 getCenterX() const { return mnCenterX; } + sal_uInt16 getCenterY() const { return mnCenterY; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a crosshair +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic position + basegfx::B2DPoint maBasePosition; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayCrosshairPrimitive( + const basegfx::B2DPoint& rBasePosition, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a hatch rectangle as used e.g. for text object +// selection hilighting +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D + { + private: + // the logic rectangle definition + basegfx::B2DRange maObjectRange; + + // the hatch definition + double mfDiscreteHatchDistance; + double mfHatchRotation; + basegfx::BColor maHatchColor; + + // the dscrete grow and shrink of the box + double mfDiscreteGrow; + double mfDiscreteShrink; + + // the rotation of the primitive itself + double mfRotation; + + protected: + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayHatchRectanglePrimitive( + const basegfx::B2DRange& rObjectRange, + double fDiscreteHatchDistance, + double fHatchRotation, + const basegfx::BColor& rHatchColor, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation); + + // data access + const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } + double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; } + double getHatchRotation() const { return mfHatchRotation; } + const basegfx::BColor& getHatchColor() const { return maHatchColor; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } + double getRotation() const { return mfRotation; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a striped helpline + +namespace drawinglayer +{ + namespace primitive2d + { + enum HelplineStyle + { + HELPLINESTYLE_POINT, + HELPLINESTYLE_VERTICAL, + HELPLINESTYLE_HORIZONTAL + }; + + class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic position + basegfx::B2DPoint maBasePosition; + + // the style + HelplineStyle meStyle; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayHelplineStripedPrimitive( + const basegfx::B2DPoint& rBasePosition, + HelplineStyle eStyle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + HelplineStyle getStyle() const { return meStyle; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for rolling rectangle helplines. This primitive is +// only for the extended lines to the ends of the view + +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic range + basegfx::B2DRange maRollingRectangle; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayRollingRectanglePrimitive( + const basegfx::B2DRange& aRollingRectangle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX + +// eof diff --git a/svx/inc/svx/sdr/overlay/overlaytriangle.hxx b/svx/inc/svx/sdr/overlay/overlaytriangle.hxx index b1d7a16ac72e..97b391047ba7 100644 --- a/svx/inc/svx/sdr/overlay/overlaytriangle.hxx +++ b/svx/inc/svx/sdr/overlay/overlaytriangle.hxx @@ -39,25 +39,23 @@ namespace sdr { namespace overlay { - class OverlayTriangleStriped : public OverlayObjectWithBasePosition + class OverlayTriangle : public OverlayObjectWithBasePosition { protected: // second and third position in pixel basegfx::B2DPoint maSecondPosition; basegfx::B2DPoint maThirdPosition; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: - OverlayTriangleStriped( + OverlayTriangle( const basegfx::B2DPoint& rBasePos, const basegfx::B2DPoint& rSecondPos, - const basegfx::B2DPoint& rThirdPos); - virtual ~OverlayTriangleStriped(); + const basegfx::B2DPoint& rThirdPos, + Color aTriangleColor); + virtual ~OverlayTriangle(); // change second position const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } @@ -66,36 +64,6 @@ namespace sdr // change third position const basegfx::B2DPoint& getThirdPosition() const { return maThirdPosition; } void setThirdPosition(const basegfx::B2DPoint& rNew); - - // Hittest with logical coordinates - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; - - // transform object coordinates. Needs to transform maSecondPosition - // and maThirdPosition. - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - }; - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - class OverlayTriangle : public OverlayTriangleStriped - { - protected: - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - public: - OverlayTriangle( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - const basegfx::B2DPoint& rThirdPos, - Color aTriangleColor = Color(COL_BLACK)); - virtual ~OverlayTriangle(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 8579b87e9470..6dd60b45d2d5 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -36,8 +36,10 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <com/sun/star/drawing/XDrawPage.hpp> -#include <boost/shared_ptr.hpp> #include <svx/outlobj.hxx> +#include <tools/color.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx> +#include <tools/weakbase.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -54,11 +56,11 @@ namespace drawinglayer private: // The text model data; this sould later just be the OutlinerParaObject or // something equal - const SdrText& mrSdrText; // text model data + ::tools::WeakReference< SdrText > mrSdrText; // #i97628# - // The text content; now as OutlinerParaObject* and in exclusive, local, cloned - // form as needed in a primitive + // The text content; now as local OutlinerParaObject copy (internally RefCounted and + // COW) and in exclusive, local form as needed in a primitive const OutlinerParaObject maOutlinerParaObject; // remeber last VisualizingPage for which a decomposition was made. If the new target @@ -67,6 +69,18 @@ namespace drawinglayer // field renderings in SubGeometry and MasterPage mnode com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxLastVisualizingPage; + // remember last PageNumber for which a decomposition was made. This is only used + // when mbContainsPageField is true, else it is 0 + sal_Int16 mnLastPageNumber; + + // remember last PageCount for which a decomposition was made. This is only used + // when mbContainsPageCountField is true, else it is 0 + sal_Int16 mnLastPageCount; + + // #i101443# remember last TextBackgroundColor to decide if a new decomposition is + // needed because of background color change + Color maLastTextBackgroundColor; + // bitfield // remember if last decomposition was with or without spell checker. In this special // case the get2DDecomposition implementation has to take care of this aspect. This is @@ -75,6 +89,8 @@ namespace drawinglayer // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction unsigned mbContainsPageField : 1; + unsigned mbContainsPageCountField : 1; + unsigned mbContainsOtherFields : 1; protected: // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments @@ -85,11 +101,11 @@ namespace drawinglayer public: SdrTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr); // get data - const SdrText& getSdrText() const { return mrSdrText; } + const SdrText* getSdrText() const { return mrSdrText.get(); } const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } // compare operator @@ -100,7 +116,7 @@ namespace drawinglayer virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; // transformed clone operator - virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const = 0; + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0; }; } // end of namespace primitive2d } // end of namespace drawinglayer @@ -114,8 +130,11 @@ namespace drawinglayer class SdrContourTextPrimitive2D : public SdrTextPrimitive2D { private: - ::basegfx::B2DPolyPolygon maUnitPolyPolygon; // unit contour polygon (scaled to [0.0 .. 1.0]) - ::basegfx::B2DHomMatrix maObjectTransform; // complete contour polygon transform (scale, rotate, shear, translate) + // unit contour polygon (scaled to [0.0 .. 1.0]) + basegfx::B2DPolyPolygon maUnitPolyPolygon; + + // complete contour polygon transform (scale, rotate, shear, translate) + basegfx::B2DHomMatrix maObjectTransform; protected: // local decomposition. @@ -123,20 +142,20 @@ namespace drawinglayer public: SdrContourTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform); + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform); // get data - const ::basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } - const ::basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } + const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; // transformed clone operator - virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const; + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; // provide unique ID DeclPrimitrive2DIDBlock() @@ -153,7 +172,11 @@ namespace drawinglayer class SdrPathTextPrimitive2D : public SdrTextPrimitive2D { private: - ::basegfx::B2DPolyPolygon maPathPolyPolygon; // the path to use. Each paragraph will use one Polygon. + // the path to use. Each paragraph will use one Polygon. + basegfx::B2DPolyPolygon maPathPolyPolygon; + + // the Fontwork parameters + attribute::SdrFormTextAttribute maSdrFormTextAttribute; protected: // local decomposition. @@ -161,18 +184,20 @@ namespace drawinglayer public: SdrPathTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, - const ::basegfx::B2DPolyPolygon& rPathPolyPolygon); + const basegfx::B2DPolyPolygon& rPathPolyPolygon, + const attribute::SdrFormTextAttribute& rSdrFormTextAttribute); // get data - const ::basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; } + const basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; } + const attribute::SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; // transformed clone operator - virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const; + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; // provide unique ID DeclPrimitrive2DIDBlock() @@ -189,7 +214,8 @@ namespace drawinglayer class SdrBlockTextPrimitive2D : public SdrTextPrimitive2D { private: - ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range + // text range transformation from unit range ([0.0 .. 1.0]) to text range + basegfx::B2DHomMatrix maTextRangeTransform; // bitfield unsigned mbUnlimitedPage : 1; // force layout with no text break @@ -202,9 +228,9 @@ namespace drawinglayer public: SdrBlockTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, - const ::basegfx::B2DHomMatrix& rTextRangeTransform, + const basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, bool bWordWrap); @@ -219,7 +245,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive2D& rPrimitive) const; // transformed clone operator - virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const; + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; // provide unique ID DeclPrimitrive2DIDBlock() @@ -236,7 +262,8 @@ namespace drawinglayer class SdrStretchTextPrimitive2D : public SdrTextPrimitive2D { private: - ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range + // text range transformation from unit range ([0.0 .. 1.0]) to text range + basegfx::B2DHomMatrix maTextRangeTransform; protected: // local decomposition. @@ -244,18 +271,18 @@ namespace drawinglayer public: SdrStretchTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, - const ::basegfx::B2DHomMatrix& rTextRangeTransform); + const basegfx::B2DHomMatrix& rTextRangeTransform); // get data - const ::basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; // transformed clone operator - virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const; + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; // provide unique ID DeclPrimitrive2DIDBlock() diff --git a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx index d7dbf9f4ad9c..623158f21d68 100644 --- a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -52,6 +52,12 @@ #define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13) #define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14) #define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15) +#define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16) +#define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17) +#define PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) +#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) ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/sdr/overlay/overlaysdrobject.hxx b/svx/inc/svx/sdrhittesthelper.hxx index d5c8f7ba6ba6..037f7fa813a5 100644 --- a/svx/inc/svx/sdr/overlay/overlaysdrobject.hxx +++ b/svx/inc/svx/sdrhittesthelper.hxx @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: overlaysdrobject.hxx,v $ - * $Revision: 1.4 $ + * $RCSfile: svdetc.hxx,v $ + * $Revision: 1.4.152.1 $ * * This file is part of OpenOffice.org. * @@ -28,47 +28,54 @@ * ************************************************************************/ -#ifndef _SDR_OVERLAY_OVERLAYSDROBJECT_HXX -#define _SDR_OVERLAY_OVERLAYSDROBJECT_HXX +#ifndef _SDRHITTESTHELPER_HXX +#define _SDRHITTESTHELPER_HXX -#include <svx/sdr/overlay/overlayobject.hxx> +#include "svx/svxdllapi.h" +#include <tools/string.hxx> +#include <tools/gen.hxx> -////////////////////////////////////////////////////////////////////////////// -// predeclarations -class SdrObject; +///////////////////////////////////////////////////////////////////// +// #i101872# new Object HitTest as View-tooling -////////////////////////////////////////////////////////////////////////////// +class SdrObject; +class SdrPageView; +class SetOfByte; +class SdrObjList; +namespace sdr { namespace contact { class ViewObjectContact; }} +namespace basegfx { class B2DPoint; } -namespace sdr -{ - namespace overlay - { - class SVX_DLLPUBLIC OverlaySdrObject : public OverlayObjectWithBasePosition - { - protected: - // the SdrObject to show - const SdrObject& mrSdrObject; +///////////////////////////////////////////////////////////////////// +// Wrappers for classic Sdr* Mode/View classes - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); +SVX_DLLPUBLIC SdrObject* SdrObjectPrimitiveHit( + const SdrObject& rObject, + const Point& rPnt, + sal_uInt16 nTol, + const SdrPageView& rSdrPageView, + const SetOfByte* pVisiLayer, + bool bTextOnly); - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); +SVX_DLLPUBLIC SdrObject* SdrObjListPrimitiveHit( + const SdrObjList& rList, + const Point& rPnt, + sal_uInt16 nTol, + const SdrPageView& rSdrPageView, + const SetOfByte* pVisiLayer, + bool bTextOnly); - // Hittest with logical coordinates. Default tests against maBaseRange. - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; +///////////////////////////////////////////////////////////////////// +// the pure HitTest based on a VOC - public: - OverlaySdrObject( - const basegfx::B2DPoint& rBasePos, - const SdrObject& rObject); - virtual ~OverlaySdrObject(); - }; - } // end of namespace overlay -} // end of namespace sdr +SVX_DLLPUBLIC bool ViewObjectContactPrimitiveHit( + const sdr::contact::ViewObjectContact& rVOC, + const basegfx::B2DPoint& rHitPosition, + double fLogicHitTolerance, + bool bTextOnly); -////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////// -#endif //_SDR_OVERLAY_OVERLAYSDROBJECT_HXX +#endif //_SDRHITTESTHELPER_HXX +///////////////////////////////////////////////////////////////////// // eof diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx index ccfc74ab00af..17333ad74459 100644 --- a/svx/inc/svx/svdedxv.hxx +++ b/svx/inc/svx/svdedxv.hxx @@ -130,9 +130,6 @@ protected: void ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect) const; void ImpInvalidateOutlinerView(OutlinerView& rOutlView) const; - // Hintergrundfarbe fuer die Outlinerviews bestimmen - Color ImpGetTextEditBackgroundColor() const; - // Feststellen, ob der gesamte Text markiert ist. Liefert auch TRUE wenn // kein Text vorhanden ist. BOOL ImpIsTextEditAllSelected() const; diff --git a/svx/inc/svx/svdetc.hxx b/svx/inc/svx/svdetc.hxx index 40ece921f6a2..493c8476c459 100644 --- a/svx/inc/svx/svdetc.hxx +++ b/svx/inc/svx/svdetc.hxx @@ -344,8 +344,12 @@ SVX_DLLPUBLIC String GetResourceString(sal_uInt16 nResID); } +///////////////////////////////////////////////////////////////////// +// #i101872# isolated GetTextEditBackgroundColor for tooling +class SdrObjEditView; + +SVX_DLLPUBLIC Color GetTextEditBackgroundColor(const SdrObjEditView& rView); ///////////////////////////////////////////////////////////////////// #endif //_SVDETC_HXX - diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index ab4abfdd7458..11d400b85b8a 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -245,7 +245,7 @@ public: sal_uInt32 GetSourceHdlNum() const { return nSourceHdlNum; } virtual Pointer GetPointer() const; - virtual bool IsHdlHit(const Point& rPnt) const; + bool IsHdlHit(const Point& rPnt) const; // #97016# II virtual BOOL IsFocusHdl() const; @@ -363,7 +363,6 @@ public: virtual ~SdrHdlLine(); virtual Pointer GetPointer() const; - virtual bool IsHdlHit(const Point& rPnt) const; }; // Ein SdrHdlBezWgt hat Kenntnis von seinem "BasisHandle". Seine Draw-Methode diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx index c9a590feccc5..88d0b941273d 100644 --- a/svx/inc/svx/svdmrkv.hxx +++ b/svx/inc/svx/svdmrkv.hxx @@ -180,9 +180,8 @@ protected: void ForceUndirtyMrkPnt() const { if (bMrkPntDirty) UndirtyMrkPnt(); } //HMHvoid ImpShowMarkHdl(bool bNoRefHdl); - SdrObject* ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const; - SdrObject* ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const; - BOOL ImpIsObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions) const { return ImpCheckObjHit(rPnt,nTol,pObj,pPV,nOptions,NULL)!=NULL; } + virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const; + virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const; BOOL ImpIsFrameHandles() const; void ImpTakeDescriptionStr(USHORT nStrCacheID, String& rStr, USHORT nVal=0, USHORT nOpt=0) const; @@ -309,9 +308,9 @@ public: // SDRSEARCH_DEEP SDRSEARCH_ALSOONMASTER SDRSEARCH_TESTMARKABLE SDRSEARCH_TESTTEXTEDIT // SDRSEARCH_WITHTEXT SDRSEARCH_TESTTEXTAREA SDRSEARCH_BACKWARD SDRSEARCH_MARKED // SDRSEARCH_WHOLEPAGE - BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const; - BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const; - BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); } + virtual BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const; + virtual BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const; + // BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); } BOOL MarkObj(const Point& rPnt, short nTol=-2, BOOL bToggle=FALSE, BOOL bDeep=FALSE); // Pick: Unterstuetzte Optionen fuer nOptions sind SDRSEARCH_PASS2BOUND und SDRSEARCH_PASS3NEAREST diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index c1579cd583fe..1344bff74413 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -224,8 +224,6 @@ public: virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const; virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=FALSE, Rectangle* pAnchorRect=NULL, BOOL bLineWidth=TRUE ) const; - - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); virtual void TakeObjNameSingul(String& rName) const; diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx index 20b196443739..3bcce26ea45e 100644 --- a/svx/inc/svx/svdoattr.hxx +++ b/svx/inc/svx/svdoattr.hxx @@ -66,9 +66,6 @@ protected: // Strichstaerke ermitteln. Keine Linie -> 0. sal_Int32 ImpGetLineWdt() const; - // Schattenabstand ermitteln. FALSE=Kein Schatten. - FASTBOOL ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const; - // Zuhoeren, ob sich ein StyleSheet aendert virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index cc5c9be64438..349bf49ccf06 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -683,20 +683,10 @@ public: // Tooling for painting a single object to a OutputDevice. This will be needed as long // as not all painting is changed to use DrawContact objects. sal_Bool SingleObjectPainter(OutputDevice& rOut) const; - BOOL LineGeometryUsageIsNecessary() const; - // HitTest, 2. Stufe. nTol ist die zulaessige Toleranz in logischen Einheiten. - // rVisiLayer ist hauptsaechlich fuer Gruppenobjekte gedacht, die ja Objekte - // mit unterschiedlichen Layerzuordnungen beinhalten koennen. - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; - //SdrObject* CheckHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol,NULL); } - sal_Bool IsHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckHit(rPnt,nTol,pVisiLayer)!=NULL; } - sal_Bool IsHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol,NULL)!=NULL; } - // Clone() soll eine komplette Kopie des Objektes erzeugen. virtual SdrObject* Clone() const; - // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const; virtual void operator=(const SdrObject& rObj); // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert". @@ -878,10 +868,6 @@ public: // TextEdit virtual FASTBOOL HasTextEdit() const; - virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; - //SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol) const { return CheckTextEditHit(rPnt,nTol,NULL); } - sal_Bool IsTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckTextEditHit(rPnt,nTol,pVisiLayer)!=NULL; } - sal_Bool IsTextEditHit(const Point& rPnt, USHORT nTol) const { return CheckTextEditHit(rPnt,nTol,NULL)!=NULL; } // Return==TRUE: TextEditMode gestartet virtual sal_Bool BegTextEdit(SdrOutliner& rOutl); diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx index 8e7860c204ce..37bfd5ed2f9b 100644 --- a/svx/inc/svx/svdocapt.hxx +++ b/svx/inc/svx/svdocapt.hxx @@ -99,7 +99,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); // for calc: special shadow only for text box diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx index db31996939af..3f6a589d2cd7 100644 --- a/svx/inc/svx/svdocirc.hxx +++ b/svx/inc/svx/svdocirc.hxx @@ -111,7 +111,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index 9d2effc87c28..4fa4fd7c0d31 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -252,7 +252,6 @@ public: virtual void RecalcSnapRect(); virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 4d464d5c9836..749cd61c55f4 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -180,7 +180,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index b6d2a4519db6..5f243d451f90 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -84,7 +84,6 @@ public: virtual const Rectangle& GetCurrentBoundRect() const; virtual const Rectangle& GetSnapRect() const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); virtual void TakeObjNameSingul(String& rName) const; diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index 866fda1eff48..406c5badbcb0 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -105,7 +105,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); virtual void TakeObjNameSingul(String& rName) const; @@ -153,7 +152,6 @@ public: Rectangle* pAnchorRect=NULL, BOOL bLineWidth=TRUE ) const; virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const; virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const; - virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual USHORT GetOutlinerViewAnchorMode() const; virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject); virtual OutlinerParaObject* GetOutlinerParaObject() const; diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index a98acc6f0442..605e9463bdab 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -145,7 +145,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; @@ -185,11 +184,7 @@ public: sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ); sal_Bool AddOwnLightClient(); - // helper for ViewObjectContactOfSdrOle2Obj. As long as the OLE stuff is not - // reworked, the things the old Do_PaintObject did at this object need to be - // emulated. Isolated those things here. Return value tells if the object - // is active - bool executeOldDoPaintPreparations(SdrPageView* pPageVew) const; + 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; diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx index a43b06ffd2ab..382f968f19b2 100644 --- a/svx/inc/svx/svdopath.hxx +++ b/svx/inc/svx/svdopath.hxx @@ -99,7 +99,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator=(const SdrObject& rObj); virtual void TakeObjNameSingul(String& rName) const; diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx index 2f4a3a3120dc..d8b0d2767553 100644 --- a/svx/inc/svx/svdorect.hxx +++ b/svx/inc/svx/svdorect.hxx @@ -75,7 +75,6 @@ protected: protected: XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const; - SdrObject* ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol=FALSE) const; void SetXPolyDirty(); // RecalcXPoly sollte ueberladen werden. Dabei muss dann eine XPolygon @@ -103,7 +102,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index 04348306a7de..a524ce757898 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -226,7 +226,6 @@ public: virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=TRUE, FASTBOOL bWdt=TRUE) const; virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=TRUE, FASTBOOL bWdt=TRUE); - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; virtual void operator=(const SdrObject& rObj); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 080e20fd1a77..36afd7a670ab 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -272,14 +272,14 @@ private: Rectangle& rAnchorRect, Rectangle& rPaintRect, Fraction& aFitXKorreg ) const; - SVX_DLLPRIVATE SdrObject* ImpConvertObj(FASTBOOL bToPoly) const; + SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const; SVX_DLLPRIVATE void ImpLinkAnmeldung(); SVX_DLLPRIVATE void ImpLinkAbmeldung(); SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const; // void ImpCheckItemSetChanges(const SfxItemSet& rAttr); protected: - FASTBOOL ImpCanConvTextToCurve() const { return GetOutlinerParaObject()!=NULL && pModel!=NULL && !IsOutlText() && !IsFontwork(); } + bool ImpCanConvTextToCurve() const; SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const; SdrObject* ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const; void ImpSetTextStyleSheetListeners(); @@ -430,7 +430,6 @@ public: // Wird zur Bestimmung des Textankerbereichs benoetigt virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; virtual void operator=(const SdrObject& rObj); @@ -472,7 +471,6 @@ public: virtual sal_Bool BegTextEdit(SdrOutliner& rOutl); virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const; virtual void EndTextEdit(SdrOutliner& rOutl); - virtual SdrObject* CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual USHORT GetOutlinerViewAnchorMode() const; void StartTextAnimation(OutputDevice* pOutDev, const Point& rOffset, long nExtraData=0L); diff --git a/svx/inc/svx/svdouno.hxx b/svx/inc/svx/svdouno.hxx index b366c50cfc84..83019f6b1cc5 100644 --- a/svx/inc/svx/svdouno.hxx +++ b/svx/inc/svx/svdouno.hxx @@ -90,7 +90,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual UINT16 GetObjIdentifier() const; - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual void operator = (const SdrObject& rObj); virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index d7010cd40b48..190576fc68c6 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -83,7 +83,6 @@ public: virtual const Rectangle& GetLastBoundRect() const; virtual void RecalcBoundRect(); virtual void SetChanged(); - virtual SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const; virtual SdrObject* Clone() const; virtual void operator=(const SdrObject& rObj); diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index d817ede41406..6f2753c4e896 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -132,9 +132,7 @@ friend class SdrEditView; FASTBOOL bRectsDirty; protected: virtual void RecalcRects(); -//#if 0 // _SOLAR__PRIVATE - FASTBOOL ImpGetFillColor(SdrObject* pObj, Color& rCol) const; -//#endif // __PRIVATE + private: /// simple ActionChildInserted forwarder to have it on a central place void impChildInserted(SdrObject& rChild) const; @@ -188,12 +186,6 @@ public: const Rectangle& GetAllObjSnapRect() const; const Rectangle& GetAllObjBoundRect() const; - // HitTest auf alle Objekte der Liste - SdrObject* CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bBackward=FALSE) const; - SdrObject* CheckHit(const Point& rPnt, USHORT nTol, FASTBOOL bBackward=FALSE) const { return CheckHit(rPnt,nTol,NULL,bBackward); } - FASTBOOL IsHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { return CheckHit(rPnt,nTol,pVisiLayer)!=NULL; } - FASTBOOL IsHit(const Point& rPnt, USHORT nTol) const { return CheckHit(rPnt,nTol)!=NULL; } // #i24906# - // Alle Textobjekte neu formatieren, z.B. bei Druckerwechsel void NbcReformatAllTextObjects(); void ReformatAllTextObjects(); @@ -204,14 +196,6 @@ public: // Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln. void BurnInStyleSheetAttributes(); - // Bestimmung der FuellFarbe an einer bestimmten Position. - // FALSE=Kein Objekt mit FuellFarbe an dieser Position gefunden. - // rVisLayers gibt die zu durchsuchenden Layer an. - // bLayerSorted: TRUE=Es wird in der Reihenfolge der Layer gesucht (ni) - // rCol: Hier wird die gefundene Farbe zurueckgegeben - FASTBOOL GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /* FASTBOOL bLayerSorted, */ Color& rCol) const; - ULONG GetObjCount() const; SdrObject* GetObj(ULONG nNum) const; @@ -444,10 +428,6 @@ friend class ChXChartDocument; // this is a weak reference to a possible living api wrapper for this page ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage; - // #108867# used by GetFillColor - FASTBOOL ImplGetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /* FASTBOOL bLayerSorted, */ Color& rCol, FASTBOOL bSkipBackgroundShape) const; - protected: SdrLayerAdmin* pLayerAdmin; SdrObject* pBackgroundObj; @@ -530,15 +510,6 @@ public: const SdrLayerAdmin& GetLayerAdmin() const { return *pLayerAdmin; } SdrLayerAdmin& GetLayerAdmin() { return *pLayerAdmin; } - // Bestimmung der FuellFarbe an einer bestimmten Position. - // FALSE=Kein Objekt mit FuellFarbe an dieser Position gefunden. - // rVisLayers gibt die zu durchsuchenden Layer an. - // bLayerSorted: TRUE=Es wird in der Reihenfolge der Layer gesucht (ni) - // rCol: Hier wird die gefundene Farbe zurueckgegeben - // Auch MasterPages werden durchsucht. - FASTBOOL GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /*FASTBOOL bLayerSorted,*/ Color& rCol) const; - // GetBitmap und GetMetafile sind noch nicht implementiert. // Bitmap in Bildschirmaufloesung und -farbtiefe aus den Objekten der // Page erzeugen. diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx index dcdbe7fc1c8f..bc403b0e0e58 100644 --- a/svx/inc/svx/svdpntv.hxx +++ b/svx/inc/svx/svdpntv.hxx @@ -319,6 +319,10 @@ public: void SetHitTolerancePixel(USHORT nVal) { nHitTolPix=nVal; TheresNewMapMode(); } USHORT GetHitTolerancePixel() const { return (USHORT)nHitTolPix; } + // data read access on logic HitTolerance and MinMoveTolerance + const USHORT getHitTolLog() const { return nHitTolLog; } + const USHORT getMinMovLog() const { return nMinMovLog; } + // Flag zur Visualisierung von Gruppen abfragen/testen BOOL DoVisualizeEnteredGroup() const { return bVisualizeEnteredGroup; } void SetVisualizeEnteredGroup(BOOL bNew) { bVisualizeEnteredGroup = bNew; } @@ -559,35 +563,6 @@ public: // #103911# Set document color for svx at SdrPageViews void SetApplicationDocumentColor(Color aDocumentColor); - /** Determine typical background color for given area on given page - - This method calculates a single representative color for the - given rectangular area. This is accomplished by sampling from - various points within that area, and calculating a weighted - mean value of those samples. High contrast settings are - respected by this method, i.e. in high contrast mode, - svtools::DOCCOLOR is used as the background color. - - @attention For some cases, such as highly structured - background or huge color ranges spanned by the background, - this method cannot yield meaningful results, as the background - simply cannot be represented by a single color. Beware. - - @param rArea - Rectangular area to determine representative background color from - - @param rVisibleLayers - Set of layers visible when calculating the background color - - @param rCurrPage - Current page for which to determine background color on - - @return a representative background color. - */ - Color CalcBackgroundColor( const Rectangle& rArea, - const SetOfByte& rVisibleLayers, - const SdrPage& rCurrPage ) const; - // #i38135# // Sets the timer for Object animations and restarts. void SetAnimationTimer(sal_uInt32 nTime); diff --git a/svx/inc/svx/svdtext.hxx b/svx/inc/svx/svdtext.hxx index 24e4d651cf50..d745bbe170de 100644 --- a/svx/inc/svx/svdtext.hxx +++ b/svx/inc/svx/svdtext.hxx @@ -33,6 +33,7 @@ #include <sal/types.h> #include "svx/svxdllapi.h" +#include <tools/weakbase.hxx> // -------------------------------------------------------------------- @@ -49,7 +50,7 @@ namespace sdr { namespace properties { /** This class stores information about one text inside a shape. */ -class SVX_DLLPUBLIC SdrText +class SVX_DLLPUBLIC SdrText : public tools::WeakBase< SdrText > { public: SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject = 0 ); diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 74236afdad1c..147cfd57d862 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -218,6 +218,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\svdedtv.hxx %_DEST%\inc%_EXT%\svx\svdedtv.hxx ..\inc\svx\svdedxv.hxx %_DEST%\inc%_EXT%\svx\svdedxv.hxx ..\inc\svx\svdetc.hxx %_DEST%\inc%_EXT%\svx\svdetc.hxx +..\inc\svx\sdrhittesthelper.hxx %_DEST%\inc%_EXT%\svx\sdrhittesthelper.hxx ..\inc\svx\svdglev.hxx %_DEST%\inc%_EXT%\svx\svdglev.hxx ..\inc\svx\svdglue.hxx %_DEST%\inc%_EXT%\svx\svdglue.hxx ..\inc\svx\svdhdl.hxx %_DEST%\inc%_EXT%\svx\svdhdl.hxx @@ -254,7 +255,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\svdpoev.hxx %_DEST%\inc%_EXT%\svx\svdpoev.hxx ..\inc\svx\svdpool.hxx %_DEST%\inc%_EXT%\svx\svdpool.hxx ..\inc\svx\svdsnpv.hxx %_DEST%\inc%_EXT%\svx\svdsnpv.hxx -..\inc\svdtouch.hxx %_DEST%\inc%_EXT%\svx\svdtouch.hxx ..\inc\svx\svdtrans.hxx %_DEST%\inc%_EXT%\svx\svdtrans.hxx ..\inc\svx\svdundo.hxx %_DEST%\inc%_EXT%\svx\svdundo.hxx ..\inc\svx\svdoutl.hxx %_DEST%\inc%_EXT%\svx\svdoutl.hxx @@ -593,11 +593,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\contact mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayanimatedbitmapex.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayanimatedbitmapex.hxx -..\inc\svx\sdr\overlay\overlaybitmap.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaybitmap.hxx ..\inc\svx\sdr\overlay\overlaybitmapex.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaybitmapex.hxx ..\inc\svx\sdr\overlay\overlayline.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayline.hxx ..\inc\svx\sdr\overlay\overlayhelpline.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayhelpline.hxx -..\inc\svx\sdr\overlay\overlaylinestriped.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaylinestriped.hxx ..\inc\svx\sdr\overlay\overlaymanager.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaymanager.hxx ..\inc\svx\sdr\overlay\overlaymanagerbuffered.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaymanagerbuffered.hxx ..\inc\svx\sdr\overlay\overlayobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayobject.hxx @@ -605,7 +603,8 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlaytriangle.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytriangle.hxx ..\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\overlaysdrobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaysdrobject.hxx +..\inc\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx +..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 7882aeac6b7b..9423e6719a40 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -64,6 +64,8 @@ #include <svx/svdpage.hxx> #include <svx/unomod.hxx> #include <svx/dialmgr.hxx> +#include <svx/svdetc.hxx> +#include <svx/sdrhittesthelper.hxx> //===== namespaces =========================================================== @@ -225,7 +227,14 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt { Point aPnt( rPoint.X, rPoint.Y ); mpControl->PixelToLogic( aPnt ); - SdrObject * pObj = mpPage->CheckHit(aPnt, 1, NULL, false); + + SdrObject* pObj = 0; + + if(mpView && mpView->GetSdrPageView()) + { + pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), 0, false); + } + if( pObj ) xAccessible = getAccessible( pObj ); } diff --git a/svx/source/cui/macropg.src b/svx/source/cui/macropg.src index 84fdb5c1af7f..0de8a8c5e1dd 100644 --- a/svx/source/cui/macropg.src +++ b/svx/source/cui/macropg.src @@ -234,11 +234,11 @@ String RID_SVXSTR_EVENT_PAGECOUNTCHANGE }; String RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED { - Text = "Loaded a sub component" ; + Text [ en-US ] = "Loaded a sub component" ; }; String RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED { - Text = "Closed a sub component" ; + Text [ en-US ] = "Closed a sub component" ; }; String RID_SVXSTR_EVENT_APPROVEPARAMETER { diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 277a6a9f8372..40c94d2128c3 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -716,7 +716,7 @@ void IMapWindow::RequestHelp( const HelpEvent& rHEvt ) if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() ) { - if ( pView->PickObj( aPos, pSdrObj, pPageView ) ) + if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) ) { const IMapObject* pIMapObj = GetIMapObj( pSdrObj ); String aStr; diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx index c90de8eb5ce0..acf278e2d01f 100644 --- a/svx/source/editeng/editdoc.cxx +++ b/svx/source/editeng/editdoc.cxx @@ -258,7 +258,7 @@ USHORT aV5Map[] = { 4035, 4036, 4037, 4038 }; -SV_IMPL_PTRARR( ContentList, ContentNode* ); +SV_IMPL_PTRARR( DummyContentList, ContentNode* ); SV_IMPL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo ); SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo ); // SV_IMPL_VARARR( ExtraCharInfos, ExtraCharInfo ); diff --git a/svx/source/editeng/editdoc.hxx b/svx/source/editeng/editdoc.hxx index dd9662d366e5..872f19485ae6 100644 --- a/svx/source/editeng/editdoc.hxx +++ b/svx/source/editeng/editdoc.hxx @@ -285,7 +285,15 @@ public: }; typedef ContentNode* ContentNodePtr; -SV_DECL_PTRARR( ContentList, ContentNodePtr, 0, 4 ) +SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0, 4 ) + +class ContentList : public DummyContentList +{ + USHORT nLastCache; +public: + ContentList() : DummyContentList( 0, 4 ), nLastCache(0) {} + USHORT GetPos( const ContentNodePtr &rPtr ) const; +}; // ------------------------------------------------------------------------- // class EditPaM @@ -612,6 +620,7 @@ SV_DECL_PTRARR( DummyParaPortionList, ParaPortionPtr, 0, 4 ) // ------------------------------------------------------------------------- class ParaPortionList : public DummyParaPortionList { + USHORT nLastCache; public: ParaPortionList(); ~ParaPortionList(); @@ -623,6 +632,8 @@ public: inline ParaPortion* SaveGetObject( USHORT nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; } + USHORT GetPos( const ParaPortionPtr &rPtr ) const; + // temporaer: void DbgCheck( EditDoc& rDoc ); }; diff --git a/svx/source/editeng/editdoc2.cxx b/svx/source/editeng/editdoc2.cxx index 2b0967e173a8..030dfb1ad615 100644 --- a/svx/source/editeng/editdoc2.cxx +++ b/svx/source/editeng/editdoc2.cxx @@ -324,10 +324,42 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLin DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: Ende stimmt nicht!" ); } -// ------------------------------------------------------------------------- +// Shared reverse lookup acceleration pieces ... + +static USHORT FastGetPos( const VoidPtr *pPtrArray, USHORT nPtrArrayLen, + VoidPtr pPtr, USHORT &rLastPos ) +{ + // Through certain filter code-paths we do a lot of appends, which in + // turn call GetPos - creating some N^2 nightmares. If we have a + // non-trivially large list, do a few checks from the end first. + if( rLastPos > 16 ) + { + USHORT nEnd; + if (rLastPos > nPtrArrayLen - 2) + nEnd = nPtrArrayLen; + else + nEnd = rLastPos + 2; + + for( USHORT nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ ) + { + if( pPtrArray[ nIdx ] == pPtr ) + { + rLastPos = nIdx; + return nIdx; + } + } + } + // The world's lamest linear search from svarray ... + for( USHORT nIdx = 0; nIdx < nPtrArrayLen; nIdx++ ) + if (pPtrArray[ nIdx ] == pPtr ) + return rLastPos = nIdx; + return USHRT_MAX; +} + +// ------------------------------------------------------------------------- // class ParaPortionList // ------------------------------------------------------------------------- -ParaPortionList::ParaPortionList() +ParaPortionList::ParaPortionList() : nLastCache( 0 ) { } @@ -336,6 +368,20 @@ ParaPortionList::~ParaPortionList() Reset(); } +USHORT ParaPortionList::GetPos( const ParaPortionPtr &rPtr ) const +{ + return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ), + Count(), static_cast<VoidPtr>( rPtr ), + ((ParaPortionList *)this)->nLastCache ); +} + +USHORT ContentList::GetPos( const ContentNodePtr &rPtr ) const +{ + return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ), + Count(), static_cast<VoidPtr>( rPtr ), + ((ContentList *)this)->nLastCache ); +} + void ParaPortionList::Reset() { for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 23e73421192d..2d3408ffeb86 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -1206,22 +1206,6 @@ void E3dCompoundObject::operator=(const SdrObject& rObj) /************************************************************************* |* -|* Hittest fuer 3D-Objekte, wird an Geometrie weitergegeben -|* -\************************************************************************/ - -SdrObject* E3dCompoundObject::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* /*pVisiLayer*/) const -{ - if(checkHitSingle3DObject(basegfx::B2DPoint(rPnt.X(), rPnt.Y()), *this)) - { - return const_cast< E3dCompoundObject* >(this); - } - - return 0; -} - -/************************************************************************* -|* |* Parameter Geometrieerzeugung setzen |* \************************************************************************/ diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 80983514ede5..8f5a895e0c33 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1921,7 +1921,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V if ( 0 == PropertyName.compareToAscii( FM_PROP_TEXTLINECOLOR ) ) { - ::Color aTextLineColor(::comphelper::getINT32(Value)); + ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::comphelper::getINT32( Value ) ); if (bVoid) { pGrid->SetTextLineColor(); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index d6cd4f2d2bae..ad645992d53d 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #ifndef _COM_SUN_STAR_SCRTIP_XEVENTATTACHERMANAGER_HPP_ #include <com/sun/star/script/XEventAttacherManager.hpp> #endif @@ -90,9 +91,9 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::form; -using ::com::sun::star::util::XNumberFormatter; using ::com::sun::star::util::XNumberFormatter; +namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; String INVALIDTEXT = String::CreateFromAscii("###"); String OBJECTTEXT = String::CreateFromAscii("<OBJECT>"); @@ -836,22 +837,40 @@ void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor try { // some other common properties - Reference< XPropertySet > xModel( m_rColumn.getModel() ); - Reference< XPropertySetInfo > xModelPSI; - if ( xModel.is() ) - xModelPSI = xModel->getPropertySetInfo(); + Reference< XPropertySet > xModel( m_rColumn.getModel(), UNO_SET_THROW ); + Reference< XPropertySetInfo > xModelPSI( xModel->getPropertySetInfo(), UNO_SET_THROW ); - // the "readonly" state - if ( xModelPSI.is() && xModelPSI->hasPropertyByName( FM_PROP_READONLY ) ) + if ( xModelPSI->hasPropertyByName( FM_PROP_READONLY ) ) { implAdjustReadOnly( xModel ); } - // the "enabled" flag - if ( xModelPSI.is() && xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) ) + if ( xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) ) { implAdjustEnabled( xModel ); } + + if ( xModelPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) ) + { + sal_Int16 nWheelBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; + OSL_VERIFY( xModel->getPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) >>= nWheelBehavior ); + USHORT nVclSetting = MOUSE_WHEEL_FOCUS_ONLY; + switch ( nWheelBehavior ) + { + case MouseWheelBehavior::SCROLL_DISABLED: nVclSetting = MOUSE_WHEEL_DISABLE; break; + case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclSetting = MOUSE_WHEEL_FOCUS_ONLY; break; + case MouseWheelBehavior::SCROLL_ALWAYS: nVclSetting = MOUSE_WHEEL_ALWAYS; break; + default: + OSL_ENSURE( false, "DbCellControl::Init: invalid MouseWheelBehavior!" ); + break; + } + + AllSettings aSettings = m_pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + aMouseSettings.SetWheelBehavior( nVclSetting ); + aSettings.SetMouseSettings( aMouseSettings ); + m_pWindow->SetSettings( aSettings, TRUE ); + } } catch( const Exception& ) { diff --git a/svx/source/form/fmprop.cxx b/svx/source/form/fmprop.cxx index 2cf5f158ac1f..e328e79b9514 100644 --- a/svx/source/form/fmprop.cxx +++ b/svx/source/form/fmprop.cxx @@ -189,6 +189,7 @@ namespace svxform IMPLEMENT_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED, "InputRequired" ); IMPLEMENT_CONSTASCII_USTRING( FM_PROP_WRITING_MODE, "WritingMode" ); + IMPLEMENT_CONSTASCII_USTRING( FM_PROP_MOUSE_WHEEL_BEHAVIOR, "MouseWheelBehavior" ); } // namespace svxform diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc index adfb73ad1dc8..3deec41981d4 100644 --- a/svx/source/inc/fmprop.hrc +++ b/svx/source/inc/fmprop.hrc @@ -182,6 +182,7 @@ namespace svxform DECLARE_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS ); DECLARE_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED ); DECLARE_CONSTASCII_USTRING( FM_PROP_WRITING_MODE ); + DECLARE_CONSTASCII_USTRING( FM_PROP_MOUSE_WHEEL_BEHAVIOR ); } // namespace svxform diff --git a/svx/source/msfilter/mscodec.cxx b/svx/source/msfilter/mscodec.cxx index 428d18c20649..1e6c9de7112f 100644 --- a/svx/source/msfilter/mscodec.cxx +++ b/svx/source/msfilter/mscodec.cxx @@ -37,6 +37,13 @@ #include <string.h> #include <tools/solar.h> +#define DEBUG_MSO_ENCRYPTION_STD97 0 + +#if DEBUG_MSO_ENCRYPTION_STD97 +#include <stdio.h> +#endif + + namespace svx { // ============================================================================ @@ -241,15 +248,50 @@ MSCodec_Std97::~MSCodec_Std97 () rtl_cipher_destroy (m_hCipher); } +#if DEBUG_MSO_ENCRYPTION_STD97 +static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg) +{ + printf("pKeyData: (%s)\n", msg); + for (int j = 0; j < 4; ++j) + { + for (int i = 0; i < 16; ++i) + printf("%2.2x ", pKeyData[j*16+i]); + printf("\n"); + } +} +#else +static void lcl_PrintKeyData(const sal_uInt8* /*pKeyData*/, const char* /*msg*/) +{ +} +#endif + +#if DEBUG_MSO_ENCRYPTION_STD97 +static void lcl_PrintDigest(const sal_uInt8* pDigest, const char* msg) +{ + printf("digest: (%s)\n", msg); + for (int i = 0; i < 16; ++i) + printf("%2.2x ", pDigest[i]); + printf("\n"); +} +#else +static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/) +{ +} +#endif + void MSCodec_Std97::InitKey ( const sal_uInt16 pPassData[16], const sal_uInt8 pUnique[16]) { +#if DEBUG_MSO_ENCRYPTION_STD97 + fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout); +#endif sal_uInt8 pKeyData[64]; int i, n; // Fill PassData into KeyData. (void)memset (pKeyData, 0, sizeof(pKeyData)); + lcl_PrintKeyData(pKeyData, "initial"); for (i = 0, n = 16; (i < n) && pPassData[i]; i++) { pKeyData[2*i ] = sal::static_int_cast< sal_uInt8 >( @@ -260,12 +302,16 @@ void MSCodec_Std97::InitKey ( pKeyData[2*i] = 0x80; pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4); + lcl_PrintKeyData(pKeyData, "password data"); + // Fill raw digest of KeyData into KeyData. (void)rtl_digest_updateMD5 ( m_hDigest, pKeyData, sizeof(pKeyData)); (void)rtl_digest_rawMD5 ( m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5); + lcl_PrintKeyData(pKeyData, "raw digest of key data"); + // Update digest with KeyData and Unique. for (i = 0; i < 16; i++) { @@ -279,6 +325,8 @@ void MSCodec_Std97::InitKey ( pKeyData[56] = 0x80; pKeyData[57] = 0x0a; + lcl_PrintKeyData(pKeyData, "update digest with padding"); + rtl_digest_updateMD5 ( m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16); @@ -286,6 +334,8 @@ void MSCodec_Std97::InitKey ( rtl_digest_rawMD5 ( m_hDigest, m_pDigestValue, sizeof(m_pDigestValue)); + lcl_PrintDigest(m_pDigestValue, "digest value"); + // Erase KeyData array and leave. (void)memset (pKeyData, 0, sizeof(pKeyData)); } @@ -294,27 +344,21 @@ bool MSCodec_Std97::VerifyKey ( const sal_uInt8 pSaltData[16], const sal_uInt8 pSaltDigest[16]) { + // both the salt data and salt digest (hash) come from the document being imported. + +#if DEBUG_MSO_ENCRYPTION_STD97 + fprintf(stdout, "MSCodec_Std97::VerifyKey: \n"); + lcl_PrintDigest(pSaltData, "salt data"); + lcl_PrintDigest(pSaltDigest, "salt hash"); +#endif bool result = false; if (InitCipher(0)) { sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5]; - sal_uInt8 pBuffer[64]; - - // Decode SaltData into Buffer. - rtl_cipher_decode ( - m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer)); - - pBuffer[16] = 0x80; - (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17); - pBuffer[56] = 0x80; - - // Fill raw digest of Buffer into Digest. - rtl_digest_updateMD5 ( - m_hDigest, pBuffer, sizeof(pBuffer)); - rtl_digest_rawMD5 ( - m_hDigest, pDigest, sizeof(pDigest)); + GetDigestFromSalt(pSaltData, pDigest); + sal_uInt8 pBuffer[16]; // Decode original SaltDigest into Buffer. rtl_cipher_decode ( m_hCipher, pSaltDigest, 16, pBuffer, sizeof(pBuffer)); @@ -333,7 +377,7 @@ bool MSCodec_Std97::VerifyKey ( bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter) { rtlCipherError result; - sal_uInt8 pKeyData[64]; + sal_uInt8 pKeyData[64]; // 512-bit message block // Initialize KeyData array. (void)memset (pKeyData, 0, sizeof(pKeyData)); @@ -358,7 +402,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter) // Initialize Cipher with KeyData (for decoding). result = rtl_cipher_init ( - m_hCipher, rtl_Cipher_DirectionDecode, + m_hCipher, rtl_Cipher_DirectionBoth, pKeyData, RTL_DIGEST_LENGTH_MD5, 0, 0); // Erase KeyData array and leave. @@ -367,6 +411,38 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter) return (result == rtl_Cipher_E_None); } +bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] ) +{ +#if DEBUG_MSO_ENCRYPTION_STD97 + lcl_PrintDigest(pSaltData, "salt data"); +#endif + bool result = false; + + if (InitCipher(0)) + { + sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5]; + GetDigestFromSalt(nSaltData, pDigest); + + rtl_cipher_decode ( + m_hCipher, pDigest, 16, pDigest, sizeof(pDigest)); + + (void)memcpy(nSaltDigest, pDigest, 16); + } + + return (result); +} + +bool MSCodec_Std97::Encode( + const void *pData, sal_Size nDatLen, + sal_uInt8 *pBuffer, sal_Size nBufLen) +{ + rtlCipherError result; + result = rtl_cipher_encode ( + m_hCipher, pData, nDatLen, pBuffer, nBufLen); + + return (result == rtl_Cipher_E_None); +} + bool MSCodec_Std97::Decode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) @@ -395,6 +471,33 @@ bool MSCodec_Std97::Skip( sal_Size nDatLen ) return bResult; } +void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] ) +{ + sal_uInt8 pBuffer[64]; + sal_uInt8 pDigestLocal[16]; + + // Decode SaltData into Buffer. + rtl_cipher_decode ( + m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer)); + + // set the 129th bit to make the buffer 128-bit in length. + pBuffer[16] = 0x80; + + // erase the rest of the buffer with zeros. + (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17); + + // set the 441st bit. + pBuffer[56] = 0x80; + + // Fill raw digest of Buffer into Digest. + rtl_digest_updateMD5 ( + m_hDigest, pBuffer, sizeof(pBuffer)); + rtl_digest_rawMD5 ( + m_hDigest, pDigestLocal, sizeof(pDigestLocal)); + + memcpy(pDigest, pDigestLocal, 16); +} + // ============================================================================ } // namespace svx diff --git a/svx/source/msfilter/msocximex.cxx b/svx/source/msfilter/msocximex.cxx index 7308bbf221eb..7db08e229536 100644 --- a/svx/source/msfilter/msocximex.cxx +++ b/svx/source/msfilter/msocximex.cxx @@ -623,7 +623,11 @@ class ContainerRecReader pS->SeekRel( 4 ); // option flags if( nContentFlags & 0x00000010 ) - pS->SeekRel( 4 ); + { + sal_uInt32 nBitFlags = 0; + *pS >> nBitFlags; + rec.bVisible = ( ( nBitFlags & 0x02 ) == 0x02 ); + } // substream size if( nContentFlags & 0x00000020 ) *pS >> rec.nSubStreamLen; @@ -1212,6 +1216,13 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog xPropSet->setPropertyValue(WW8_ASCII2STR("Step"), aTmp); } + try + { + xPropSet->setPropertyValue(WW8_ASCII2STR("EnableVisible"), uno::makeAny( mbVisible ) ); + } + catch( uno::Exception& ) + { + } return sal_True; } @@ -3612,6 +3623,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream* // reflect the ms tabbing from orig MS UserForm, see below pControl->mnTabPos = rec.nTabPos; pControl->SetInDialog(true); + pControl->mbVisible = rec.bVisible; if ( mnStep ) { // If the container has a step then it should be diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index b8bf859dbc17..f1a89dd0bb8b 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -1519,7 +1519,7 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd ) // --> OD 2009-03-10 #i100014# // assure that the following for-loop does not loop forever - for ( ULONG n = nStart; n < nEnd; n++ ) + for ( USHORT n = nStart; n < nEnd; n++ ) // <-- { Paragraph* pPara = pParaList->GetParagraph( n ); diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk index adbd85f88d94..44e161a3b503 100644 --- a/svx/source/sdr/attribute/makefile.mk +++ b/svx/source/sdr/attribute/makefile.mk @@ -33,6 +33,7 @@ PRJ=..$/..$/.. PRJNAME=svx TARGET=attribute +ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- @@ -43,6 +44,8 @@ TARGET=attribute SLOFILES=\ $(SLO)$/sdrallattribute.obj \ - $(SLO)$/sdrtextattribute.obj + $(SLO)$/sdrtextattribute.obj \ + $(SLO)$/sdrformtextattribute.obj \ + $(SLO)$/sdrformtextoutlineattribute.obj .INCLUDE : target.mk diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx index 6e9d312b8357..9eee8dbccce8 100644 --- a/svx/source/sdr/attribute/sdrallattribute.cxx +++ b/svx/source/sdr/attribute/sdrallattribute.cxx @@ -30,6 +30,7 @@ ************************************************************************/ #include "precompiled_svx.hxx" + #include <svx/sdr/attribute/sdrallattribute.hxx> #include <drawinglayer/attribute/sdrattribute.hxx> #include <drawinglayer/attribute/fillattribute.hxx> @@ -45,20 +46,20 @@ namespace drawinglayer { namespace attribute { - SdrShadowTextAttribute::SdrShadowTextAttribute(SdrShadowAttribute* pShadow, SdrTextAttribute* pTextAttribute) + SdrShadowTextAttribute::SdrShadowTextAttribute( + SdrShadowAttribute* pShadow, + SdrTextAttribute* pTextAttribute) : mpShadow(pShadow), mpTextAttribute(pTextAttribute) { } - SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate) - : mpShadow(0L), - mpTextAttribute(0L) + SdrShadowTextAttribute::SdrShadowTextAttribute( + const SdrShadowTextAttribute& rCandidate) + : mpShadow(0), + mpTextAttribute(0) { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } + *this = rCandidate; } SdrShadowTextAttribute::~SdrShadowTextAttribute() @@ -72,14 +73,14 @@ namespace drawinglayer // handle mpShadow { // delete local mpShadow if necessary - if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow)))) + if(mpShadow) { delete mpShadow; - mpShadow = 0L; + mpShadow = 0; } // copy mpShadow if necessary - if(!mpShadow && rCandidate.mpShadow) + if(rCandidate.mpShadow) { mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); } @@ -88,14 +89,14 @@ namespace drawinglayer // handle mpTextAttribute { // delete local mpTextAttribute if necessary - if(mpTextAttribute && ((!rCandidate.mpTextAttribute) || (!(*mpTextAttribute == *rCandidate.mpTextAttribute)))) + if(mpTextAttribute) { delete mpTextAttribute; - mpTextAttribute = 0L; + mpTextAttribute = 0; } // copy mpTextAttribute if necessary - if(!mpTextAttribute && rCandidate.mpTextAttribute) + if(rCandidate.mpTextAttribute) { mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); } @@ -125,22 +126,23 @@ namespace drawinglayer { namespace attribute { - SdrFillTextAttribute::SdrFillTextAttribute(SdrFillAttribute* pFill, FillGradientAttribute* pFillFloatTransGradient, SdrTextAttribute* pTextAttribute) + SdrFillTextAttribute::SdrFillTextAttribute( + SdrFillAttribute* pFill, + FillGradientAttribute* pFillFloatTransGradient, + SdrTextAttribute* pTextAttribute) : mpFill(pFill), mpFillFloatTransGradient(pFillFloatTransGradient), mpTextAttribute(pTextAttribute) { } - SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate) + SdrFillTextAttribute::SdrFillTextAttribute( + const SdrFillTextAttribute& rCandidate) : mpFill(0), mpFillFloatTransGradient(0), mpTextAttribute(0) { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } + *this = rCandidate; } SdrFillTextAttribute::~SdrFillTextAttribute() @@ -155,14 +157,14 @@ namespace drawinglayer // handle mpFill { // delete local mpFill if necessary - if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill)))) + if(mpFill) { delete mpFill; - mpFill = 0L; + mpFill = 0; } // copy mpFill if necessary - if(!mpFill && rCandidate.mpFill) + if(rCandidate.mpFill) { mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); } @@ -171,14 +173,14 @@ namespace drawinglayer // handle mpFillFloatTransGradient { // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient)))) + if(mpFillFloatTransGradient) { delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0L; + mpFillFloatTransGradient = 0; } // copy mpFillFloatTransGradient if necessary - if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient) + if(rCandidate.mpFillFloatTransGradient) { mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); } @@ -187,14 +189,14 @@ namespace drawinglayer // handle mpTextAttribute { // delete local mpTextAttribute if necessary - if(mpTextAttribute && ((!rCandidate.mpTextAttribute) || (!(*mpTextAttribute == *rCandidate.mpTextAttribute)))) + if(mpTextAttribute) { delete mpTextAttribute; - mpTextAttribute = 0L; + mpTextAttribute = 0; } // copy mpTextAttribute if necessary - if(!mpTextAttribute && rCandidate.mpTextAttribute) + if(rCandidate.mpTextAttribute) { mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); } @@ -229,23 +231,23 @@ namespace drawinglayer namespace attribute { SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - SdrLineAttribute* pLine, SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, SdrTextAttribute* pTextAttribute) + SdrLineAttribute* pLine, + SdrLineStartEndAttribute* pLineStartEnd, + SdrShadowAttribute* pShadow, + SdrTextAttribute* pTextAttribute) : SdrShadowTextAttribute(pShadow, pTextAttribute), mpLine(pLine), mpLineStartEnd(pLineStartEnd) { } - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate) - : SdrShadowTextAttribute(0L, 0L), - mpLine(0L), - mpLineStartEnd(0L) + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( + const SdrLineShadowTextAttribute& rCandidate) + : SdrShadowTextAttribute(0, 0), + mpLine(0), + mpLineStartEnd(0) { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } + *this = rCandidate; } SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute() @@ -262,14 +264,14 @@ namespace drawinglayer // handle mpLine { // delete local mpLine if necessary - if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine)))) + if(mpLine) { delete mpLine; - mpLine = 0L; + mpLine = 0; } // copy mpLine if necessary - if(!mpLine && rCandidate.mpLine) + if(rCandidate.mpLine) { mpLine = new SdrLineAttribute(*rCandidate.mpLine); } @@ -278,14 +280,14 @@ namespace drawinglayer // handle mpLineStartEnd { // delete local mpLineStartEnd if necessary - if(mpLineStartEnd && ((!rCandidate.mpLineStartEnd) || (!(*mpLineStartEnd == *rCandidate.mpLineStartEnd)))) + if(mpLineStartEnd) { delete mpLineStartEnd; - mpLineStartEnd = 0L; + mpLineStartEnd = 0; } // copy mpLineStartEnd if necessary - if(!mpLineStartEnd && rCandidate.mpLineStartEnd) + if(rCandidate.mpLineStartEnd) { mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); } @@ -320,23 +322,25 @@ namespace drawinglayer namespace attribute { SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine, attribute::SdrFillAttribute* pFill, SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, FillGradientAttribute* pFillFloatTransGradient, SdrTextAttribute* pTextAttribute) + SdrLineAttribute* pLine, + attribute::SdrFillAttribute* pFill, + SdrLineStartEndAttribute* pLineStartEnd, + SdrShadowAttribute* pShadow, + FillGradientAttribute* pFillFloatTransGradient, + SdrTextAttribute* pTextAttribute) : SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute), mpFill(pFill), mpFillFloatTransGradient(pFillFloatTransGradient) { } - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate) - : SdrLineShadowTextAttribute(0L, 0L, 0L, 0L), - mpFill(0L), - mpFillFloatTransGradient(0L) + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( + const SdrLineFillShadowTextAttribute& rCandidate) + : SdrLineShadowTextAttribute(0, 0, 0, 0), + mpFill(0), + mpFillFloatTransGradient(0) { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } + *this = rCandidate; } SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute() @@ -353,14 +357,14 @@ namespace drawinglayer // handle mpFill { // delete local mpFill if necessary - if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill)))) + if(mpFill) { delete mpFill; - mpFill = 0L; + mpFill = 0; } // copy mpFill if necessary - if(!mpFill && rCandidate.mpFill) + if(rCandidate.mpFill) { mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); } @@ -369,14 +373,14 @@ namespace drawinglayer // handle mpFillFloatTransGradient { // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient)))) + if(mpFillFloatTransGradient) { delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0L; + mpFillFloatTransGradient = 0; } // copy mpFillFloatTransGradient if necessary - if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient) + if(rCandidate.mpFillFloatTransGradient) { mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); } diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx new file mode 100644 index 000000000000..0282b519499c --- /dev/null +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -0,0 +1,304 @@ +/************************************************************************* + * + * 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: sdrtextattribute.cxx,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. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrformtextattribute.hxx> +#include <svtools/itemset.hxx> + +#include <svx/xftdiit.hxx> +#include <svx/xftstit.hxx> +#include <svx/xftshxy.hxx> +#include <svx/xftshtit.hxx> +#include <svx/xtextit0.hxx> +#include <svx/xftadit.hxx> +#include <svx/xftshit.hxx> +#include <svx/xftshcit.hxx> +#include <svx/xftmrit.hxx> +#include <svx/xftouit.hxx> + +#include <svx/sdshtitm.hxx> +#include <svx/xlntrit.hxx> +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> +#include <svx/sdshcitm.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xlnwtit.hxx> +#include <xlinjoit.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xdash.hxx> +#include <svx/xlndsit.hxx> +#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// pointer compare define +#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) + +////////////////////////////////////////////////////////////////////////////// +// helper to get line, stroke and transparence attributes from SfxItemSet + +namespace +{ + basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint) + { + switch(eLineJoint) + { + case XLINEJOINT_MIDDLE : + { + return basegfx::B2DLINEJOIN_MIDDLE; + } + case XLINEJOINT_BEVEL : + { + return basegfx::B2DLINEJOIN_BEVEL; + } + case XLINEJOINT_MITER : + { + return basegfx::B2DLINEJOIN_MITER; + } + case XLINEJOINT_ROUND : + { + return basegfx::B2DLINEJOIN_ROUND; + } + default : + { + return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE + } + } + } + + sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet) + { + sal_uInt8 nRetval; + + if(bShadow) + { + nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100); + } + else + { + nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100); + } + + return nRetval; + } + + drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet) + { + basegfx::BColor aColorAttribute; + + if(bShadow) + { + const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); + aColorAttribute = aShadowColor.getBColor(); + } + else + { + const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue()); + aColorAttribute = aLineColor.getBColor(); + } + + const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); + const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); + + return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint)); + } + + drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet) + { + const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue(); + double fFullDotDashLen(0.0); + ::std::vector< double > aDotDashArray; + + if(XLINE_DASH == eLineStyle) + { + const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue(); + + if(rDash.GetDots() || rDash.GetDashes()) + { + const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); + fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth); + } + } + + return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen); + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) + : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), + mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), + mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), + mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), + mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), + meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), + meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), + meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), + maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), + mpOutline(0), + mpShadowOutline(0), + mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), + mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) + { + if(getFormTextOutline()) + { + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines + { + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + mpOutline = new SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFTSHADOW_NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + mpShadowOutline = new SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + } + } + + SdrFormTextAttribute::~SdrFormTextAttribute() + { + if(mpOutline) + { + delete mpOutline; + mpOutline = 0; + } + + if(mpShadowOutline) + { + delete mpShadowOutline; + mpShadowOutline = 0; + } + } + + SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate) + : mnFormTextDistance(rCandidate.getFormTextDistance()), + mnFormTextStart(rCandidate.getFormTextStart()), + mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()), + mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()), + mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()), + meFormTextStyle(rCandidate.getFormTextStyle()), + meFormTextAdjust(rCandidate.getFormTextAdjust()), + meFormTextShadow(rCandidate.getFormTextShadow()), + maFormTextShdwColor(rCandidate.getFormTextShdwColor()), + mpOutline(0), + mpShadowOutline(0), + mbFormTextMirror(rCandidate.getFormTextMirror()), + mbFormTextOutline(rCandidate.getFormTextOutline()) + { + if(rCandidate.getOutline()) + { + mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + } + + if(rCandidate.getShadowOutline()) + { + mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + } + } + + SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) + { + mnFormTextDistance = rCandidate.getFormTextDistance(); + mnFormTextStart = rCandidate.getFormTextStart(); + mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal(); + mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal(); + mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp(); + meFormTextStyle = rCandidate.getFormTextStyle(); + meFormTextAdjust = rCandidate.getFormTextAdjust(); + meFormTextShadow = rCandidate.getFormTextShadow(); + maFormTextShdwColor = rCandidate.getFormTextShdwColor(); + + if(mpOutline) + { + delete mpOutline; + } + + mpOutline = 0; + + if(rCandidate.getOutline()) + { + mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + } + + if(mpShadowOutline) + { + delete mpShadowOutline; + } + + mpShadowOutline = 0; + + if(rCandidate.getShadowOutline()) + { + mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + } + + mbFormTextMirror = rCandidate.getFormTextMirror(); + mbFormTextOutline = rCandidate.getFormTextOutline(); + + return *this; + } + + bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + { + return (getFormTextDistance() == rCandidate.getFormTextDistance() + && getFormTextStart() == rCandidate.getFormTextStart() + && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() + && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() + && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() + && getFormTextStyle() == rCandidate.getFormTextStyle() + && getFormTextAdjust() == rCandidate.getFormTextAdjust() + && getFormTextShadow() == rCandidate.getFormTextShadow() + && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() + && pointerOrContentEqual(getOutline(), rCandidate.getOutline()) + && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline()) + && getFormTextMirror() == rCandidate.getFormTextMirror() + && getFormTextOutline() == rCandidate.getFormTextOutline()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/overlay/overlaylinestriped.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index c00be65908e2..db2fe20ae21b 100644 --- a/svx/source/sdr/overlay/overlaylinestriped.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -6,8 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: overlaylinestriped.cxx,v $ - * $Revision: 1.4 $ + * $RCSfile: sdrtextattribute.cxx,v $ + * + * $Revision: 1.2 $ * * This file is part of OpenOffice.org. * @@ -28,20 +29,38 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include <svx/sdr/overlay/overlaylinestriped.hxx> -#include <tools/gen.hxx> -#include <vcl/outdev.hxx> + +#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// +// pointer compare define +#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) -namespace sdr +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer { - namespace overlay + namespace attribute { - } // end of namespace overlay -} // end of namespace sdr + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence) + : maLineAttribute(rLineAttribute), + maStrokeAttribute(rStrokeAttribute), + mnTransparence(nTransparence) + { + } + + bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const + { + return (getLineAttribute() == rCandidate.getLineAttribute() + && getStrokeAttribute() == rCandidate.getStrokeAttribute() + && getTransparence() == rCandidate.getTransparence()); + } + } // end of namespace attribute +} // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 394f68041d7a..37215a794d06 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -30,13 +30,19 @@ ************************************************************************/ #include "precompiled_svx.hxx" + #include <svx/sdr/attribute/sdrtextattribute.hxx> +#include <svx/sdr/attribute/sdrformtextattribute.hxx> #include <svx/svdotext.hxx> #include <svx/outlobj.hxx> #include <svx/editobj.hxx> #include <svx/flditem.hxx> ////////////////////////////////////////////////////////////////////////////// +// pointer compare define +#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) + +////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { @@ -56,9 +62,9 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode) - : mrSdrText(rSdrText), + : mpSdrText(&rSdrText), maOutlinerParaObject(rOutlinerParaObject), - meFormTextStyle(eFormTextStyle), + mpSdrFormTextAttribute(0), maTextLeftDistance(aTextLeftDistance), maTextUpperDistance(aTextUpperDistance), maTextRightDistance(aTextRightDistance), @@ -70,12 +76,79 @@ namespace drawinglayer mbScroll(bScroll), mbInEditMode(bInEditMode) { + if(XFT_NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = getSdrText().GetItemSet(); + mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); + } + } + + SdrTextAttribute::~SdrTextAttribute() + { + if(mpSdrFormTextAttribute) + { + delete mpSdrFormTextAttribute; + mpSdrFormTextAttribute = 0; + } + } + + SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) + : mpSdrText(&rCandidate.getSdrText()), + maOutlinerParaObject(rCandidate.getOutlinerParaObject()), + mpSdrFormTextAttribute(0), + maTextLeftDistance(rCandidate.getTextLeftDistance()), + maTextUpperDistance(rCandidate.getTextUpperDistance()), + maTextRightDistance(rCandidate.getTextRightDistance()), + maTextLowerDistance(rCandidate.getTextLowerDistance()), + mbContour(rCandidate.isContour()), + mbFitToSize(rCandidate.isFitToSize()), + mbHideContour(rCandidate.isHideContour()), + mbBlink(rCandidate.isBlink()), + mbScroll(rCandidate.isScroll()), + mbInEditMode(rCandidate.isInEditMode()) + { + if(rCandidate.getSdrFormTextAttribute()) + { + mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + } + } + + SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + { + mpSdrText = &rCandidate.getSdrText(); + maOutlinerParaObject = rCandidate.getOutlinerParaObject(); + + if(mpSdrFormTextAttribute) + { + delete mpSdrFormTextAttribute; + } + + mpSdrFormTextAttribute = 0; + + if(rCandidate.getSdrFormTextAttribute()) + { + mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + } + + maTextLeftDistance = rCandidate.getTextLeftDistance(); + maTextUpperDistance = rCandidate.getTextUpperDistance(); + maTextRightDistance = rCandidate.getTextRightDistance(); + maTextLowerDistance = rCandidate.getTextLowerDistance(); + mbContour = rCandidate.isContour(); + mbFitToSize = rCandidate.isFitToSize(); + mbHideContour = rCandidate.isHideContour(); + mbBlink = rCandidate.isBlink(); + mbScroll = rCandidate.isScroll(); + mbInEditMode = rCandidate.isInEditMode(); + + return *this; } bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() - && getFormTextStyle() == rCandidate.getFormTextStyle() + && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() && getTextRightDistance() == rCandidate.getTextRightDistance() @@ -92,7 +165,7 @@ namespace drawinglayer { if(isBlink()) { - mrSdrText.GetObject().impGetBlinkTextTiming(rAnimList); + mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList); } } @@ -100,7 +173,7 @@ namespace drawinglayer { if(isScroll()) { - mrSdrText.GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); + mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); } } } // end of namespace attribute diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index d5681c60463e..6145e0acc301 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -37,10 +37,13 @@ #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/svdoole2.hxx> #include <svx/sdr/contact/objectcontact.hxx> +#include <svx/svdview.hxx> #include <drawinglayer/primitive2d/chartprimitive2d.hxx> #include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
////////////////////////////////////////////////////////////////////////////// @@ -60,136 +63,194 @@ namespace sdr 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(); - const bool bIsActive(rSdrOle2.executeOldDoPaintPreparations(GetObjectContact().TryToGetSdrPageView())); - 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(GetObjectContact().isDrawModeHighContrast()) - { - // 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(); - - if(pOLEHighContrastGraphic) + // 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; { - // there is a graphic set, use it - xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(*pOLEHighContrastGraphic, rSdrOle2.IsEmptyPresObj()); + const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); + if ( xObjRef.is() ) + nState = xObjRef->getCurrentState(); } - else - { - // no HighContrast graphic, use default empty OLE bitmap - const Bitmap aEmptyOLEBitmap(rSdrOle2.GetEmtyOLEReplacementBitmap()); - const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap); + 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(); - xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true); - } - } - else - { - // call parent which will use the regular createViewIndependentPrimitive2DSequence - // at the corresponding VC - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - - if(rSdrOle2.getEmbeddedObjectRef().IsChart()) - { - // 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); - static bool bPrettyPrintingForBitmaps(false); - - // the original ChartPrettyPainter does not do it for Window - if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow()) + bool bDone = false; + if( !bDone && bIsInplaceActive ) { - bDoChartPrettyPrinting = false; + if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() ) + { + 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! + } } - // the original ChartPrettyPainter does not do it for VDEV - if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) + if( !bDone ) { - if(GetObjectContact().isOutputToPDFFile()) + 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) { - // #i97982# - // For PDF files, allow PrettyPrinting + //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()) + { + bDoChartPrettyPrinting = false; + } + + // the original ChartPrettyPainter does not do it for VDEV + if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) + { + if(GetObjectContact().isOutputToPDFFile()) + { + // #i97982# + // For PDF files, allow PrettyPrinting + } + else + { + 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; + } + } + + if(bDoChartPrettyPrinting) + { + // 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; + } } - else + + if( !bDone ) { - bDoChartPrettyPrinting = false; - } - } + //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())); - // the chart model is needed. Check if it's available - if(bDoChartPrettyPrinting) - { - // get chart model - xChartModel = rSdrOle2.getXModel(); + // 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 + + if(GetObjectContact().isDrawModeHighContrast()) + { + // 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(); + + if(pOLEHighContrastGraphic) + { + // there is a graphic set, use it + xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(*pOLEHighContrastGraphic, rSdrOle2.IsEmptyPresObj()); + } + else + { + // no HighContrast graphic, use default empty OLE bitmap + const Bitmap aEmptyOLEBitmap(rSdrOle2.GetEmtyOLEReplacementBitmap()); + const Graphic aEmtyOLEGraphic(aEmptyOLEBitmap); + + xRetval = rVC.createPrimitive2DSequenceWithGivenGraphic(aEmtyOLEGraphic, true); + } + } + else + { + // call parent which will use the regular createViewIndependentPrimitive2DSequence + // at the corresponding VC + xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); + } - if(!xChartModel.is()) - { - bDoChartPrettyPrinting = false; } - } - if(bDoChartPrettyPrinting) - { - // 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); - } - } + if(bIsOutplaceActive) + { + // 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); + } + } - if(bIsActive) - { - // 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); } - } - return xRetval; + return xRetval; } ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index ea260f3285f7..92003865fde0 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -35,6 +35,7 @@ #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/properties/properties.hxx> #include <svx/sdr/contact/objectcontactofpageview.hxx> +#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> /** === begin UNO includes === **/ #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -80,6 +81,7 @@ namespace sdr { namespace contact { using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::awt::XControl; @@ -175,7 +177,11 @@ namespace sdr { namespace contact { inline void addWindowListener( const Reference< XWindowListener >& _l ) const { m_xControlWindow->addWindowListener( _l ); } inline void removeWindowListener( const Reference< XWindowListener >& _l ) const { m_xControlWindow->removeWindowListener( _l ); } void setPosSize( const Rectangle& _rPosSize ) const; - void setZoom( const MapMode& _rMapMode ) const; + Rectangle + getPosSize() const; + void setZoom( const ::basegfx::B2DVector& _rScale ) const; + ::basegfx::B2DVector + getZoom() const; inline void setGraphics( const Reference< XGraphics >& _g ) const { m_xControlView->setGraphics( _g ); } inline Reference< XGraphics > @@ -221,10 +227,36 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - void ControlHolder::setZoom( const MapMode& _rMapMode ) const + ::Rectangle ControlHolder::getPosSize() const { // no check whether we're valid, this is the responsibility of the caller - m_xControlView->setZoom( (float)double( _rMapMode.GetScaleX() ), (float)double( _rMapMode.GetScaleY() ) ); + return VCLUnoHelper::ConvertToVCLRect( m_xControlWindow->getPosSize() ); + } + + //-------------------------------------------------------------------- + void ControlHolder::setZoom( const ::basegfx::B2DVector& _rScale ) const + { + // no check whether we're valid, this is the responsibility of the caller + m_xControlView->setZoom( (float)_rScale.getX(), (float)_rScale.getY() ); + } + + //-------------------------------------------------------------------- + ::basegfx::B2DVector ControlHolder::getZoom() const + { + // no check whether we're valid, this is the responsibility of the caller + + // Argh. Why does XView have a setZoom only, but not a getZoom? + Window* pWindow = VCLUnoHelper::GetWindow( m_xControlWindow ); + OSL_ENSURE( pWindow, "ControlHolder::setZoom: no implementation access!" ); + + ::basegfx::B2DVector aZoom( 1, 1 ); + if ( pWindow ) + { + const Fraction& rZoom( pWindow->GetZoom() ); + aZoom.setX( (double)rZoom ); + aZoom.setY( (double)rZoom ); + } + return aZoom; } //==================================================================== @@ -233,37 +265,13 @@ namespace sdr { namespace contact { class UnoControlContactHelper { public: - /** positions a control relative to a device - - @precond <arg>_pDevice</arg> is not <NULL/> + /** positions a control, and sets its zoom mode, using a given transformation and output device */ - static void positionControl_throw( + static void adjustControlGeometry_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect, - const OutputDevice* _pDevice - ); - - /** sets the zoom at a UNO control, according to a Device's MapMode - - @precond <arg>_pDevice</arg> is not <NULL/> - */ - static void setControlZoom( - const ControlHolder& _rControl, - const OutputDevice* _pDevice - ); - - /** draws a given control onto it's current XGraphics, at given coordinates - - Note that the control is not drawn onto the given device, instead you must - use ->XView::setGraphics yourself, before calling this method. The given ->OutputDevice - is only used to calculate pixel coordinates from logic coordinates - - @precond <arg>_pDevice</arg> is not <NULL/> - */ - static void drawControl( - const ControlHolder& _rControl, - const Point& _rLogicTopLeft, - const OutputDevice* _pDevice + const ::basegfx::B2DHomMatrix& _rViewTransformation, + const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization ); /** disposes the given control @@ -279,50 +287,28 @@ namespace sdr { namespace contact { }; //-------------------------------------------------------------------- - void UnoControlContactHelper::positionControl_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect, - const OutputDevice* _pDevice ) + void UnoControlContactHelper::adjustControlGeometry_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect, + const basegfx::B2DHomMatrix& _rViewTransformation, const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization ) { - OSL_PRECOND( _pDevice, "UnoControlContactHelper::positionControl_throw: no device -> no survival!" ); - - if ( _rControl.is() ) - { - const Rectangle aPaintRectPixel( - _pDevice->LogicToPixel( _rLogicBoundingRect.TopLeft() ), - _pDevice->LogicToPixel( _rLogicBoundingRect.GetSize() ) - ); - - _rControl.setPosSize( aPaintRectPixel ); - } - } - - //-------------------------------------------------------------------- - void UnoControlContactHelper::setControlZoom( const ControlHolder& _rControl, const OutputDevice* _pDevice ) - { - OSL_PRECOND( _pDevice, "UnoControlContactHelper::setControlZoom: no device -> no survival!" ); - OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::setControlZoom: illegal control!" ); - - if ( _rControl.is() ) - _rControl.setZoom( _pDevice->GetMapMode() ); - } - - //-------------------------------------------------------------------- - void UnoControlContactHelper::drawControl( const ControlHolder& _rControl, const Point& _rLogicTopLeft, - const OutputDevice* _pDevice ) - { - OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::drawControl: invalid control!" ); + OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::adjustControlGeometry_throw: illegal control!" ); if ( !_rControl.is() ) return; - try - { - _rControl.draw( - _pDevice->LogicToPixel( _rLogicTopLeft ) - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + // transform the logic bound rect, using the view transformation, to pixel coordinates + ::basegfx::B2DPoint aTopLeft( _rLogicBoundingRect.Left(), _rLogicBoundingRect.Top() ); + aTopLeft *= _rViewTransformation; + ::basegfx::B2DPoint aBottomRight( _rLogicBoundingRect.Right(), _rLogicBoundingRect.Bottom() ); + aBottomRight *= _rViewTransformation; + + const Rectangle aPaintRectPixel( (long)aTopLeft.getX(), (long)aTopLeft.getY(), (long)aBottomRight.getX(), (long)aBottomRight.getY() ); + _rControl.setPosSize( aPaintRectPixel ); + + // determine the scale from the current view transformation, and the normalization matrix + ::basegfx::B2DHomMatrix aObtainResolutionDependentScale( _rViewTransformation * _rZoomLevelNormalization ); + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + aObtainResolutionDependentScale.decompose( aScale, aTranslate, fRotate, fShearX ); + _rControl.setZoom( aScale ); } //-------------------------------------------------------------------- @@ -402,40 +388,7 @@ namespace sdr { namespace contact { } //==================================================================== - //= DummyPageViewAccess - //==================================================================== - /** is a ->IPageViewAccess implementation which defaults all attribute access, and thus can be - operated without an actual ->SdrPageView - */ - class DummyPageViewAccess : public IPageViewAccess - { - public: - virtual bool isDesignMode() const; - virtual Reference< XControlContainer > - getControlContainer( const OutputDevice& _rDevice ) const; - virtual bool isLayerVisible( SdrLayerID _nLayerID ) const; - }; - - //-------------------------------------------------------------------- - bool DummyPageViewAccess::isDesignMode() const - { - return true; - } - - //-------------------------------------------------------------------- - Reference< XControlContainer > DummyPageViewAccess::getControlContainer( const OutputDevice& /*_rDevice*/ ) const - { - return Reference< XControlContainer >(); - } - - //-------------------------------------------------------------------- - bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const - { - return true; - } - - //==================================================================== - //= DummyPageViewAccess + //= InvisibleControlViewAccess //==================================================================== /** is a ->IPageViewAccess implementation which can be used to create an invisble control for an arbitrary device @@ -510,7 +463,7 @@ namespace sdr { namespace contact { Reference< XContainer > m_xContainer; /// the output device for which the control was created - OutputDevice const* m_pOutputDeviceForWindow; + const OutputDevice* m_pOutputDeviceForWindow; /// flag indicating whether the control is currently visible bool m_bControlIsVisible; @@ -527,6 +480,8 @@ namespace sdr { namespace contact { /// is the control currently in design mode? mutable ViewControlMode m_eControlDesignMode; + ::basegfx::B2DHomMatrix m_aZoomLevelNormalization; + public: ViewObjectContactOfUnoControl_Impl( ViewObjectContactOfUnoControl* _pAntiImpl ); @@ -549,17 +504,13 @@ namespace sdr { namespace contact { */ bool getUnoObject( SdrUnoObj*& _out_rpObject ) const; - /** ensures that we have an XControl which can be painted onto the given display - */ - bool ensureControl( const DisplayInfo& _rDisplayInfo ); - /** ensures that we have an ->XControl Must only be called if a control is needed when no DisplayInfo is present, yet. - For creating a control, an ->OutputDevice is needed, and an ->SdrPageView. Both can only be - obtained from a ->DisplayInfo struct, or alternatively a ->ObjectContactOfPageView. So, if - our (anti-impl's) object contact is not a ->ObjectContactOfPageView, this method fill fail. + For creating a control, an ->OutputDevice is needed, and an ->SdrPageView. Both will be obtained + from a ->ObjectContactOfPageView. So, if our (anti-impl's) object contact is not a ->ObjectContactOfPageView, + this method fill fail. Failure of this method will be reported via an assertion in a non-product version. */ @@ -572,22 +523,16 @@ namespace sdr { namespace contact { inline const ControlHolder& getExistentControl() const { return m_aControl; } - /** positions our XControl according to the geometry settings in the SdrUnoObj, - and sets proper zoom settings according to our device + inline bool + hasControl() const { return m_aControl.is(); } + + /** positions our XControl according to the geometry settings in the SdrUnoObj, modified by the given + transformation, and sets proper zoom settings according to our device @precond ->m_pOutputDeviceForWindow and ->m_aControl are not <NULL/> - @tolerant - If the preconditions are not met, nothing is done at all */ - void positionAndZoomControl() const; - - /** positions the control for a paint onto a given device - - If we do not (yet) have a control, or the control does not belong to the - device for which a paint is requested, no positioning happens. - */ - void positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const; + void positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const; /** determines whether or not our control is printable @@ -626,6 +571,13 @@ namespace sdr { namespace contact { struct GuardAccess { friend class VOCGuard; private: GuardAccess() { } }; ::osl::Mutex& getMutex( GuardAccess ) const { return m_aMutex; } + const ViewContactOfUnoControl& + getViewContact() const + { + ENSURE_OR_THROW( !impl_isDisposed_nofail(), "already disposed" ); + return static_cast< const ViewContactOfUnoControl& >( m_pAntiImpl->GetViewContact() ); + } + protected: ~ViewObjectContactOfUnoControl_Impl(); @@ -797,10 +749,11 @@ namespace sdr { namespace contact { This method cares for this, by retrieving the very original OutputDevice. */ - const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) const; + static const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ); + const OutputDevice& imp_getPageViewDevice_nothrow() const; private: - ViewObjectContactOfUnoControl_Impl(); // never implemented + ViewObjectContactOfUnoControl_Impl(); // never implemented ViewObjectContactOfUnoControl_Impl( const ViewObjectContactOfUnoControl_Impl& ); // never implemented ViewObjectContactOfUnoControl_Impl& operator=( const ViewObjectContactOfUnoControl_Impl& ); // never implemented }; @@ -812,18 +765,65 @@ namespace sdr { namespace contact { */ class VOCGuard { - const ViewObjectContactOfUnoControl_Impl& m_rImpl; - ::osl::MutexGuard m_aMutexGuard; + private: + ::osl::MutexGuard m_aMutexGuard; public: VOCGuard( const ViewObjectContactOfUnoControl_Impl& _rImpl ) - :m_rImpl( _rImpl ) - ,m_aMutexGuard( _rImpl.getMutex( ViewObjectContactOfUnoControl_Impl::GuardAccess() ) ) + :m_aMutexGuard( _rImpl.getMutex( ViewObjectContactOfUnoControl_Impl::GuardAccess() ) ) { } }; //==================================================================== + //= LazyControlCreationPrimitive2D + //==================================================================== + class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BasePrimitive2D + { + private: + typedef ::drawinglayer::primitive2d::BasePrimitive2D BasePrimitive2D; + + protected: + virtual ::drawinglayer::primitive2d::Primitive2DSequence + get2DDecomposition( + const ::drawinglayer::geometry::ViewInformation2D& rViewInformation + ) const; + + virtual ::drawinglayer::primitive2d::Primitive2DSequence + createLocalDecomposition( + const ::drawinglayer::geometry::ViewInformation2D& rViewInformation + ) const; + + virtual ::basegfx::B2DRange + getB2DRange( + const ::drawinglayer::geometry::ViewInformation2D& rViewInformation + ) const; + + public: + LazyControlCreationPrimitive2D( const ::rtl::Reference< ViewObjectContactOfUnoControl_Impl >& _pVOCImpl ) + :m_pVOCImpl( _pVOCImpl ) + { + ENSURE_OR_THROW( m_pVOCImpl.is(), "Illegal argument." ); + getTransformation( m_pVOCImpl->getViewContact(), m_aTransformation ); + } + + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // declare unique ID for this primitive class + DeclPrimitrive2DIDBlock() + + static void getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation ); + + private: + ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pVOCImpl; + /** The geometry is part of the identity of an primitive, so we cannot calculate it on demand + (since the data the calculation is based on might have changed then), but need to calc + it at construction time, and remember it. + */ + ::basegfx::B2DHomMatrix m_aTransformation; + }; + + //==================================================================== //= ViewObjectContactOfUnoControl_Impl //==================================================================== DBG_NAME( ViewObjectContactOfUnoControl_Impl ) @@ -834,10 +834,20 @@ namespace sdr { namespace contact { ,m_bControlIsVisible( false ) ,m_bIsDesignModeListening( false ) ,m_eControlDesignMode( eUnknown ) + ,m_aZoomLevelNormalization() { DBG_CTOR( ViewObjectContactOfUnoControl_Impl, NULL ); DBG_ASSERT( m_pAntiImpl, "ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl: invalid AntiImpl!" ); - } + + const OutputDevice& rPageViewDevice( imp_getPageViewDevice_nothrow() ); + m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation(); + + ::basegfx::B2DHomMatrix aScaleNormalization; + MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); + aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); + aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() ); + m_aZoomLevelNormalization *= aScaleNormalization; + } //-------------------------------------------------------------------- ViewObjectContactOfUnoControl_Impl::~ViewObjectContactOfUnoControl_Impl() @@ -898,27 +908,21 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - void ViewObjectContactOfUnoControl_Impl::positionControlForPaint( const DisplayInfo& /* #i74769# _rDisplayInfo*/ ) const - { - if ( !m_aControl.is() ) - return; - - positionAndZoomControl(); - } - - //-------------------------------------------------------------------- - void ViewObjectContactOfUnoControl_Impl::positionAndZoomControl() const + void ViewObjectContactOfUnoControl_Impl::positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const { - OSL_PRECOND( m_pOutputDeviceForWindow && m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no output device or no control!" ); - if ( !m_pOutputDeviceForWindow || !m_aControl.is() ) + OSL_PRECOND( ( m_pOutputDeviceForWindow != NULL ) && m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no output device or no control!" ); + if ( ( m_pOutputDeviceForWindow == NULL ) || !m_aControl.is() ) return; try { SdrUnoObj* pUnoObject( NULL ); if ( getUnoObject( pUnoObject ) ) - UnoControlContactHelper::positionControl_throw( m_aControl, pUnoObject->GetLogicRect(), m_pOutputDeviceForWindow ); - UnoControlContactHelper::setControlZoom( m_aControl, m_pOutputDeviceForWindow ); + { + UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, pUnoObject->GetLogicRect(), _rViewTransformation, m_aZoomLevelNormalization ); + } + else + OSL_ENSURE( false, "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no SdrUnoObj!" ); } catch( const Exception& ) { @@ -927,37 +931,6 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - bool ViewObjectContactOfUnoControl_Impl::ensureControl( const DisplayInfo& /*_rDisplayInfo*/ ) - { - OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::ensureControl: already disposed()" ); - if ( impl_isDisposed_nofail() ) - return false; - - const OutputDevice* pDeviceForControl( NULL ); - - // if we're working for a page view, use the respective OutputDevice at the proper - // PaintWindow. The DisplayInfo might only contain a temporary (virtual) device, which - // is dangerous to remember - // 2006-10-24 / #i70604# / frank.schoenheit@sun.com - ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - if ( pPageViewContact ) - pDeviceForControl = &imp_getPageViewDevice_nothrow( *pPageViewContact ); - - if ( !pDeviceForControl && pPageViewContact) - pDeviceForControl = pPageViewContact->TryToGetOutputDevice(); - - DBG_ASSERT( pDeviceForControl, "ViewObjectContactOfUnoControl_Impl::ensureControl: no output device!" ); - if ( !pDeviceForControl ) - return false; - - SdrPageView* pPageView = m_pAntiImpl->GetObjectContact().TryToGetSdrPageView(); - - ::std::auto_ptr< IPageViewAccess > pPVAccess; - pPVAccess.reset( pPageView ? (IPageViewAccess*)new SdrPageViewAccess( *pPageView ) : (IPageViewAccess*)new DummyPageViewAccess() ); - return impl_ensureControl_nothrow( *pPVAccess, *pDeviceForControl ); - } - - //-------------------------------------------------------------------- bool ViewObjectContactOfUnoControl_Impl::ensureControl() { OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::ensureControl: already disposed()" ); @@ -977,13 +950,21 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) const + const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow() const + { + ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); + ENSURE_OR_THROW( pPageViewContact, "need a ObjectContactOfPageView." ); + return imp_getPageViewDevice_nothrow( *pPageViewContact ); + } + + //-------------------------------------------------------------------- + const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) { // if the PageWindow has a patched PaintWindow, use the original PaintWindow // this ensures that our control is _not_ re-created just because somebody // (temporarily) changed the window to paint onto. // #i72429# / 2007-02-20 / frank.schoenheit@sun.com - const SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() ); + SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() ); if ( rPageWindow.GetOriginalPaintWindow() ) return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice(); @@ -1001,7 +982,7 @@ namespace sdr { namespace contact { // Somebody requested a control for a new device, which means either of // - our PageView's paint window changed since we were last here // - we don't belong to a page view, and are simply painted onto different devices - // The first sounds strange (doens't it?), the second means we could perhaps + // The first sounds strange (doens't it?), the second means we could perhaps // optimize this in the future - there is no need to re-create the control every time, // is it? // #i74523# / 2007-02-15 / frank.schoenheit@sun.com @@ -1063,44 +1044,37 @@ namespace sdr { namespace contact { bool bSuccess = false; try { - do - { - const ::rtl::OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); + const ::rtl::OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if ( xFactory.is() ) - { - _out_rControl = Reference< XControl >( xFactory->createInstance( sControlServiceName ), UNO_QUERY ); - } - DBG_ASSERT( _out_rControl.is(), "ViewObjectContactOfUnoControl_Impl::createControlForDevice: no control could be created!" ); - if ( !_out_rControl.is() ) - break; + Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW ); + _out_rControl = Reference< XControl >( xFactory->createInstance( sControlServiceName ), UNO_QUERY_THROW ); - // knit the model and the control - _out_rControl.setModel( xControlModel ); + // knit the model and the control + _out_rControl.setModel( xControlModel ); - UnoControlContactHelper::positionControl_throw( _out_rControl, _rUnoObject.GetLogicRect(), &_rDevice ); - - // proper zoom - UnoControlContactHelper::setControlZoom( _out_rControl, &_rDevice ); + // proper geometry + UnoControlContactHelper::adjustControlGeometry_throw( + _out_rControl, + _rUnoObject.GetLogicRect(), + _rDevice.GetViewTransformation(), + _rDevice.GetInverseViewTransformation() + ); - // #107049# set design mode before peer is created, - // this is also needed for accessibility - _out_rControl.setDesignMode( _rPageView.isDesignMode() ); + // #107049# set design mode before peer is created, + // this is also needed for accessibility + _out_rControl.setDesignMode( _rPageView.isDesignMode() ); - // adjust the initial visibility according to the visibility of the layer - // 2003-06-03 - #110592# - fs@openoffice.org - impl_adjustControlVisibilityToLayerVisibility_throw( _out_rControl, _rUnoObject, _rPageView, false, true ); + // adjust the initial visibility according to the visibility of the layer + // 2003-06-03 - #110592# - fs@openoffice.org + impl_adjustControlVisibilityToLayerVisibility_throw( _out_rControl, _rUnoObject, _rPageView, false, true ); - // add the control to the respective control container - // #108327# do this last - Reference< XControlContainer > xControlContainer( _rPageView.getControlContainer( _rDevice ) ); - if ( xControlContainer.is() ) - xControlContainer->addControl( sControlServiceName, _out_rControl.getControl() ); + // add the control to the respective control container + // #108327# do this last + Reference< XControlContainer > xControlContainer( _rPageView.getControlContainer( _rDevice ) ); + if ( xControlContainer.is() ) + xControlContainer->addControl( sControlServiceName, _out_rControl.getControl() ); - bSuccess = true; - } - while ( false ); + bSuccess = true; } catch( const Exception& ) { @@ -1257,18 +1231,16 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- bool ViewObjectContactOfUnoControl_Impl::isPrintableControl() const { - if ( !m_aControl.is() ) + SdrUnoObj* pUnoObject( NULL ); + if ( !getUnoObject( pUnoObject ) ) return false; bool bIsPrintable = false; try { - Reference< XPropertySet > xModelProperties( m_aControl.getModel(), UNO_QUERY ); - Reference< XPropertySetInfo > xPropertyInfo( xModelProperties.is() ? xModelProperties->getPropertySetInfo() : Reference< XPropertySetInfo >() ); - const ::rtl::OUString sPrintablePropertyName( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ); - - if ( xPropertyInfo.is() && xPropertyInfo->hasPropertyByName( sPrintablePropertyName ) ) - OSL_VERIFY( xModelProperties->getPropertyValue( sPrintablePropertyName ) >>= bIsPrintable ); + Reference< XPropertySet > xModelProperties( pUnoObject->GetUnoControlModel(), UNO_QUERY_THROW ); + static const ::rtl::OUString s_sPrintablePropertyName( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ); + OSL_VERIFY( xModelProperties->getPropertyValue( s_sPrintablePropertyName ) >>= bIsPrintable ); } catch( const Exception& ) { @@ -1411,15 +1383,20 @@ namespace sdr { namespace contact { if ( !xNewControl.is() ) return; + ENSURE_OR_THROW( m_pOutputDeviceForWindow, "calling this without /me having an output device should be impossible." ); + DBG_ASSERT( xNewControl->getModel() == m_aControl.getModel(), "ViewObjectContactOfUnoControl_Impl::elementReplaced: another model at the new control?" ); // another model should - in the drawing layer - also imply another SdrUnoObj, which // should also result in new ViewContact, and thus in new ViewObjectContacts impl_switchControlListening_nothrow( false ); + ControlHolder aNewControl( xNewControl ); + aNewControl.setZoom( m_aControl.getZoom() ); + aNewControl.setPosSize( m_aControl.getPosSize() ); + aNewControl.setDesignMode( impl_isControlDesignMode_nothrow() ); + m_aControl = xNewControl; - positionAndZoomControl(); - m_aControl.setDesignMode( impl_isControlDesignMode_nothrow() ); m_bControlIsVisible = m_aControl.isVisible(); impl_switchControlListening_nothrow( true ); @@ -1449,30 +1426,96 @@ namespace sdr { namespace contact { } } + //==================================================================== + //= LazyControlCreationPrimitive2D + //==================================================================== //-------------------------------------------------------------------- - bool ViewObjectContactOfUnoControl_Impl::belongsToDevice( const OutputDevice* _pDevice ) const + bool LazyControlCreationPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - DBG_ASSERT( _pDevice, "ViewObjectContactOfUnoControl_Impl::belongsToDevice: invalid device!" ); + if ( !BasePrimitive2D::operator==( rPrimitive ) ) + return false; - OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::belongsToDevice: already disposed!" ); - if ( impl_isDisposed_nofail() ) + const LazyControlCreationPrimitive2D* pRHS = dynamic_cast< const LazyControlCreationPrimitive2D* >( &rPrimitive ); + if ( !pRHS ) return false; - if ( m_pOutputDeviceForWindow ) - { - if ( _pDevice == m_pOutputDeviceForWindow ) - return true; + if ( m_pVOCImpl != pRHS->m_pVOCImpl ) return false; - } - ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - if ( pPageViewContact ) - return ( _pDevice == &imp_getPageViewDevice_nothrow( *pPageViewContact ) ); + if ( m_aTransformation != pRHS->m_aTransformation ) + return false; - DBG_ERROR( "ViewObjectContactOfUnoControl_Impl::belongsToDevice: could not determine the device I belong to!" ); - return false; + return true; + } + + //-------------------------------------------------------------------- + void LazyControlCreationPrimitive2D::getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation ) + { + // Do use model data directly to create the correct geometry. Do NOT + // use getBoundRect()/getSnapRect() here; tese will use the sequence of + // primitives themselves in the long run. + const Rectangle aSdrGeoData( _rVOC.GetSdrUnoObj().GetGeoRect() ); + const basegfx::B2DRange aRange( + aSdrGeoData.Left(), + aSdrGeoData.Top(), + aSdrGeoData.Right(), + aSdrGeoData.Bottom() + ); + + _out_Transformation.identity(); + _out_Transformation.set( 0, 0, aRange.getWidth() ); + _out_Transformation.set( 1, 1, aRange.getHeight() ); + _out_Transformation.set( 0, 2, aRange.getMinX() ); + _out_Transformation.set( 1, 2, aRange.getMinY() ); } + //-------------------------------------------------------------------- + ::basegfx::B2DRange LazyControlCreationPrimitive2D::getB2DRange( const ::drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/ ) const + { + ::basegfx::B2DRange aRange( 0.0, 0.0, 1.0, 1.0 ); + aRange.transform( m_aTransformation ); + return aRange; + } + + //-------------------------------------------------------------------- + ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + { + if ( m_pVOCImpl->hasControl() ) + m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + return BasePrimitive2D::get2DDecomposition( _rViewInformation ); + } + + //-------------------------------------------------------------------- + ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + { + // force control here to make it a VCL ChildWindow. Will be fetched + // and used below by getExistentControl() + m_pVOCImpl->ensureControl(); + m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + + // get needed data + const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() ); + Reference< XControlModel > xControlModel( rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel() ); + const ControlHolder& rControl( m_pVOCImpl->getExistentControl() ); + + // check if we already have an XControl. + if ( !xControlModel.is() || !rControl.is() ) + // use the default mechanism. This will create a ControlPrimitive2D without + // handing over a XControl. If not even a XControlModel exists, it will + // create the SdrObject fallback visualisation + return rViewContactOfUnoControl.getViewIndependentPrimitive2DSequence(); + + // create a primitive and hand over the existing xControl. This will + // allow the primitive to not need to create another one on demand. + const drawinglayer::primitive2d::Primitive2DReference xRetval( new ::drawinglayer::primitive2d::ControlPrimitive2D( + m_aTransformation, xControlModel, rControl.getControl() ) ); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); + } + + //-------------------------------------------------------------------- + ImplPrimitrive2DIDBlock( LazyControlCreationPrimitive2D, PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D ) + //==================================================================== //= ViewObjectContactOfUnoControl //==================================================================== @@ -1522,20 +1565,6 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - void ViewObjectContactOfUnoControl::positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const - { - VOCGuard aGuard( *m_pImpl ); - - // ensure we have a control. If we don't, then the Drawing Layer might be tempted to - // never draw the complete form layer. - // #i75095# / 2007-03-05 / frank.schoenheit@sun.com - m_pImpl->ensureControl( _rDisplayInfo ); - - // position the control - m_pImpl->positionControlForPaint( _rDisplayInfo ); - } - - //-------------------------------------------------------------------- void ViewObjectContactOfUnoControl::ensureControlVisibility( bool _bVisible ) const { VOCGuard aGuard( *m_pImpl ); @@ -1582,70 +1611,32 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - bool ViewObjectContactOfUnoControl::belongsToDevice( const OutputDevice* _pDevice ) const + drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const { - VOCGuard aGuard( *m_pImpl ); - return m_pImpl->belongsToDevice( _pDevice ); + if ( m_pImpl->isDisposed() ) + // our control already died. + // TODO: Is it worth re-creating the control? Finally, this is a pathological situation, it means some instance + // disposed the control though it doesn't own it. So, /me thinks we should not bother here. + return drawinglayer::primitive2d::Primitive2DSequence();
+
+ ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) ); + return ::drawinglayer::primitive2d::Primitive2DSequence( &xPrimitive, 1 ); } //-------------------------------------------------------------------- - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const - { - // force control here to make it a VCL ChildWindow. Will be fetched - // and used below by getExistentControl() - m_pImpl->ensureControl(); - m_pImpl->positionControlForPaint(rDisplayInfo); - - // get needed data - const ViewContactOfUnoControl& rViewContactOfUnoControl(static_cast< const ViewContactOfUnoControl& >(GetViewContact())); - Reference< XControlModel > xControlModel(rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel()); - const ControlHolder& rControl(m_pImpl->getExistentControl()); - - // check if we already have a XControl. - if(xControlModel.is() && rControl.is()) - { - // create a primitive and hand over the existing xControl. This will - // allow the primitive to not need to create another one on demand. - // Do use model data directly to create the correct geometry. Do NOT - // use getBoundRect()/getSnapRect() here; tese will use the sequence of - // primitives themselves in the long run. - const Rectangle aUnoControlModelData(rViewContactOfUnoControl.GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(aUnoControlModelData.Left(), aUnoControlModelData.Top(), aUnoControlModelData.Right(), aUnoControlModelData.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - - // create control primitive with existing XControl - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel, rControl.getControl())); - - return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); - } - else - { - // use the default mechanism. This will create a ControlPrimitive2D without - // handing over a XControl. If not even a XControlModel exists, it will - // create the SdrObject fallback visualisation - return rViewContactOfUnoControl.getViewIndependentPrimitive2DSequence(); - } - } - void ViewObjectContactOfUnoControl::propertyChange() { // graphical invalidate at all views ActionChanged(); // #i93318# flush Primitive2DSequence to force recreation with updated XControlModel - // since e.g. background color has changed and existing decompositions are evtl. no + // since e.g. background color has changed and existing decompositions are possibly no // longer valid. Unfortunately this is not detected from ControlPrimitive2D::operator== // since it only has a uno reference to the XControlModel flushPrimitive2DSequence(); } + //-------------------------------------------------------------------- void ViewObjectContactOfUnoControl::ActionChanged() { // call parent @@ -1721,6 +1712,14 @@ namespace sdr { namespace contact { DBG_DTOR( UnoControlPrintOrPreviewContact, NULL ); } + //-------------------------------------------------------------------- + drawinglayer::primitive2d::Primitive2DSequence UnoControlPrintOrPreviewContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const + { + if ( !m_pImpl->isPrintableControl() ) + return drawinglayer::primitive2d::Primitive2DSequence(); + return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo ); + } + //==================================================================== //= UnoControlPDFExportContact //==================================================================== diff --git a/svx/source/sdr/overlay/makefile.mk b/svx/source/sdr/overlay/makefile.mk index 1243a71e2585..bb6489606283 100644 --- a/svx/source/sdr/overlay/makefile.mk +++ b/svx/source/sdr/overlay/makefile.mk @@ -43,22 +43,20 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES=\ $(SLO)$/overlayanimatedbitmapex.obj \ - $(SLO)$/overlaybitmap.obj \ $(SLO)$/overlaybitmapex.obj \ + $(SLO)$/overlaycrosshair.obj \ + $(SLO)$/overlayhatchrect.obj \ + $(SLO)$/overlayhelpline.obj \ $(SLO)$/overlayline.obj \ - $(SLO)$/overlaylinestriped.obj \ $(SLO)$/overlaymanager.obj \ $(SLO)$/overlaymanagerbuffered.obj \ $(SLO)$/overlayobject.obj \ + $(SLO)$/overlayobjectcell.obj \ $(SLO)$/overlayobjectlist.obj \ - $(SLO)$/overlaytriangle.obj \ - $(SLO)$/overlaycrosshair.obj \ - $(SLO)$/overlayhelpline.obj \ - $(SLO)$/overlayhatchrect.obj \ - $(SLO)$/overlayrollingrectangle.obj \ $(SLO)$/overlaypolypolygon.obj \ - $(SLO)$/overlaysdrobject.obj \ $(SLO)$/overlayprimitive2dsequenceobject.obj \ - $(SLO)$/overlayobjectcell.obj + $(SLO)$/overlayrollingrectangle.obj \ + $(SLO)$/overlaytools.obj \ + $(SLO)$/overlaytriangle.obj .INCLUDE : target.mk diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx index 4781cc247e7e..dcfeb0ae3dc2 100644 --- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx +++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx @@ -34,9 +34,8 @@ #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> - -// #i77674# #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -57,43 +56,30 @@ namespace sdr } } - void OverlayAnimatedBitmapEx::drawGeometry(OutputDevice& rOutputDevice) - { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= (mbOverlayState) - ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1) - : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2); - - // remember MapMode and switch to pixels - const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled()); - rOutputDevice.EnableMapMode(false); - - // draw the bitmap - const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY())); - rOutputDevice.DrawBitmapEx(aPixelTopLeft, (mbOverlayState) ? maBitmapEx1 : maBitmapEx2); - - // restore MapMode - rOutputDevice.EnableMapMode(bMapModeWasEnabled); - } - - void OverlayAnimatedBitmapEx::createBaseRange(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence() { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= (mbOverlayState) - ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1) - : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2); - - // calculate discrete range - const Size aBitmapPixelSize((mbOverlayState) ? maBitmapEx1.GetSizePixel() : maBitmapEx2.GetSizePixel()); - const basegfx::B2DRange aDiscreteRange( - aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(), - aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight()); - - // set and go back to logic range - maBaseRange = aDiscreteRange; - maBaseRange.transform(rOutputDevice.GetInverseViewTransformation()); + if(mbOverlayState) + { + const drawinglayer::primitive2d::Primitive2DReference aPrimitive( + new drawinglayer::primitive2d::OverlayBitmapExPrimitive( + getBitmapEx1(), + getBasePosition(), + getCenterX1(), + getCenterY1())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1); + } + else + { + const drawinglayer::primitive2d::Primitive2DReference aPrimitive( + new drawinglayer::primitive2d::OverlayBitmapExPrimitive( + getBitmapEx2(), + getBasePosition(), + getCenterX2(), + getCenterY2())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1); + } } OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx( @@ -111,10 +97,10 @@ namespace sdr mnCenterX1(nCenX1), mnCenterY1(nCenY1), mnCenterX2(nCenX2), mnCenterY2(nCenY2), mnBlinkTime(nBlinkTime), - mbOverlayState(sal_False) + mbOverlayState(false) { // set AllowsAnimation flag to mark this object as animation capable - mbAllowsAnimation = sal_True; + mbAllowsAnimation = true; // #i53216# check blink time value range impCheckBlinkTimeValueRange(); @@ -213,11 +199,11 @@ namespace sdr // switch state if(mbOverlayState) { - mbOverlayState = sal_False; + mbOverlayState = false; } else { - mbOverlayState = sal_True; + mbOverlayState = true; } // re-insert me as event @@ -227,12 +213,6 @@ namespace sdr objectChange(); } } - - void OverlayAnimatedBitmapEx::zoomHasChanged() - { - // reset validity of range in logical coor to force recalculation - mbIsChanged = sal_True; - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaybitmap.cxx b/svx/source/sdr/overlay/overlaybitmap.cxx deleted file mode 100644 index cc782d38bc7d..000000000000 --- a/svx/source/sdr/overlay/overlaybitmap.cxx +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * 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: overlaybitmap.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/overlaybitmap.hxx> -#include <vcl/salbtype.hxx> -#include <vcl/outdev.hxx> -#include <vcl/bitmapex.hxx> - -// #i77674# -#include <basegfx/matrix/b2dhommatrix.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayBitmap::drawGeometry(OutputDevice& rOutputDevice) - { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY); - - // remember MapMode and switch to pixels - const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled()); - rOutputDevice.EnableMapMode(false); - - // draw the bitmap - const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY())); - - if(mbUseTransparenceColor) - { - BitmapEx aBitmapEx(maBitmap, getBaseColor()); - rOutputDevice.DrawBitmapEx(aPixelTopLeft, aBitmapEx); - } - else - { - rOutputDevice.DrawBitmap(aPixelTopLeft, maBitmap); - } - - // restore MapMode - rOutputDevice.EnableMapMode(bMapModeWasEnabled); - } - - void OverlayBitmap::createBaseRange(OutputDevice& rOutputDevice) - { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY); - - // calculate discrete range - const Size aBitmapPixelSize(maBitmap.GetSizePixel()); - const basegfx::B2DRange aDiscreteRange( - aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(), - aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight()); - - // set and go back to logic range - maBaseRange = aDiscreteRange; - maBaseRange.transform(rOutputDevice.GetInverseViewTransformation()); - } - - OverlayBitmap::OverlayBitmap( - const basegfx::B2DPoint& rBasePos, - const Bitmap& rBitmap, - sal_uInt16 nCenX, sal_uInt16 nCenY, - sal_Bool bUseTransCol, - Color aTransColor) - : OverlayObjectWithBasePosition(rBasePos, aTransColor), - maBitmap(rBitmap), - mnCenterX(nCenX), - mnCenterY(nCenY), - mbUseTransparenceColor(bUseTransCol) - { - } - - OverlayBitmap::~OverlayBitmap() - { - } - - void OverlayBitmap::setBitmap(const Bitmap& rNew) - { - if(rNew != maBitmap) - { - // remember new Bitmap - maBitmap = rNew; - - // register change (after change) - objectChange(); - } - } - - void OverlayBitmap::setTransparenceUsed(sal_Bool bNew) - { - if(bNew != mbUseTransparenceColor) - { - // remember new value - mbUseTransparenceColor = bNew; - - // register change (after change) - objectChange(); - } - } - - void OverlayBitmap::setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY) - { - if(nNewX != mnCenterX || nNewY != mnCenterY) - { - // remember new values - if(nNewX != mnCenterX) - { - mnCenterX = nNewX; - } - - if(nNewY != mnCenterY) - { - mnCenterY = nNewY; - } - - // register change (after change) - objectChange(); - } - } - - void OverlayBitmap::zoomHasChanged() - { - // reset validity of range in logical coor to force recalculation - mbIsChanged = sal_True; - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx index 9f0e183f420c..cd50c9149b27 100644 --- a/svx/source/sdr/overlay/overlaybitmapex.cxx +++ b/svx/source/sdr/overlay/overlaybitmapex.cxx @@ -33,9 +33,8 @@ #include <svx/sdr/overlay/overlaybitmapex.hxx> #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> - -// #i77674# #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -43,39 +42,16 @@ namespace sdr { namespace overlay { - void OverlayBitmapEx::drawGeometry(OutputDevice& rOutputDevice) - { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY); - - // remember MapMode and switch to pixels - const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled()); - rOutputDevice.EnableMapMode(false); - - // draw the bitmap - const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY())); - rOutputDevice.DrawBitmapEx(aPixelTopLeft, maBitmapEx); - - // restore MapMode - rOutputDevice.EnableMapMode(bMapModeWasEnabled); - } - - void OverlayBitmapEx::createBaseRange(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence() { - // #i77674# calculate discrete top-left - basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY); - - // calculate discrete range - const Size aBitmapPixelSize(maBitmapEx.GetSizePixel()); - const basegfx::B2DRange aDiscreteRange( - aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(), - aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight()); - - // set and go back to logic range - maBaseRange = aDiscreteRange; - maBaseRange.transform(rOutputDevice.GetInverseViewTransformation()); + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayBitmapExPrimitive( + getBitmapEx(), + getBasePosition(), + getCenterX(), + getCenterY())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } OverlayBitmapEx::OverlayBitmapEx( @@ -124,12 +100,6 @@ namespace sdr objectChange(); } } - - void OverlayBitmapEx::zoomHasChanged() - { - // reset validity of range in logical coor to force recalculation - mbIsChanged = sal_True; - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaycrosshair.cxx b/svx/source/sdr/overlay/overlaycrosshair.cxx index 7107817fad04..90bd99bc289e 100644 --- a/svx/source/sdr/overlay/overlaycrosshair.cxx +++ b/svx/source/sdr/overlay/overlaycrosshair.cxx @@ -34,6 +34,8 @@ #include <tools/gen.hxx> #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -41,31 +43,33 @@ namespace sdr { namespace overlay { - void OverlayCrosshairStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayCrosshairStriped::createOverlayObjectPrimitive2DSequence() { - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); + drawinglayer::primitive2d::Primitive2DSequence aRetval; - const basegfx::B2DPoint aStartA(aVisibleLogic.Left(), getBasePosition().getY()); - const basegfx::B2DPoint aEndA(aVisibleLogic.Right(), getBasePosition().getY()); - ImpDrawLineStriped(rOutputDevice, aStartA, aEndA); + if(getOverlayManager()) + { + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayCrosshairPrimitive( + getBasePosition(), + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + } - const basegfx::B2DPoint aStartB(getBasePosition().getX(), aVisibleLogic.Top()); - const basegfx::B2DPoint aEndB(getBasePosition().getX(), aVisibleLogic.Bottom()); - ImpDrawLineStriped(rOutputDevice, aStartB, aEndB); + return aRetval; } - void OverlayCrosshairStriped::createBaseRange(OutputDevice& rOutputDevice) + void OverlayCrosshairStriped::stripeDefinitionHasChanged() { - // reset range and expand it - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - maBaseRange.reset(); - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top())); - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom())); + // react on OverlayManager's stripe definition change + objectChange(); } OverlayCrosshairStriped::OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos) @@ -76,64 +80,6 @@ namespace sdr OverlayCrosshairStriped::~OverlayCrosshairStriped() { } - - sal_Bool OverlayCrosshairStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - // test vertical - if(rPos.getY() >= (getBasePosition().getY() - fTol) - && rPos.getY() <= (getBasePosition().getY() + fTol)) - { - return sal_True; - } - - // test horizontal - if(rPos.getX() >= (getBasePosition().getX() - fTol) - && rPos.getX() <= (getBasePosition().getX() + fTol)) - { - return sal_True; - } - } - - return sal_False; - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayCrosshair::drawGeometry(OutputDevice& rOutputDevice) - { - const Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY())); - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); - - rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y())); - rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom())); - } - - OverlayCrosshair::OverlayCrosshair( - const basegfx::B2DPoint& rBasePos, - Color aLineColor) - : OverlayCrosshairStriped(rBasePos) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aLineColor; - } - - OverlayCrosshair::~OverlayCrosshair() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx index a15d38f16bc9..9bda13816029 100644 --- a/svx/source/sdr/overlay/overlayhatchrect.cxx +++ b/svx/source/sdr/overlay/overlayhatchrect.cxx @@ -38,6 +38,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -45,81 +46,34 @@ namespace sdr { namespace overlay { - basegfx::B2DPolyPolygon OverlayHatchRect::getGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence() { - const basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); - const basegfx::B2DPoint aDiscreteBottomRight(rOutputDevice.GetViewTransformation() * getSecondPosition()); - - basegfx::B2DRange aInnerRange( - floor(aDiscreteTopLeft.getX()), floor(aDiscreteTopLeft.getY()), - floor(aDiscreteBottomRight.getX()), floor(aDiscreteBottomRight.getY())); - basegfx::B2DRange aOuterRange(aInnerRange); - basegfx::B2DPolyPolygon aRetval; - - aOuterRange.grow(getDiscreteWidth() * 0.5); - aInnerRange.grow(getDiscreteWidth() * -0.5); - - aRetval.append(basegfx::tools::createPolygonFromRect(aOuterRange)); - aRetval.append(basegfx::tools::createPolygonFromRect(aInnerRange)); - - if(!basegfx::fTools::equalZero(mfRotation)) - { - basegfx::B2DHomMatrix aTransform; - - aTransform.translate(-aOuterRange.getMinX(), -aOuterRange.getMinY()); - aTransform.rotate(getRotation()); - aTransform.translate(aOuterRange.getMinX(), aOuterRange.getMinY()); - - aRetval.transform(aTransform); - } - - return aRetval; - } - - void OverlayHatchRect::drawGeometry(OutputDevice& rOutputDevice) - { - const basegfx::B2DPolyPolygon aB2DGeometry(getGeometry(rOutputDevice)); - const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled()); - - // use VCL polygon and methodology for paint - double fFullRotation(getHatchRotation() - getRotation()); - - while(fFullRotation < 0.0) - { - fFullRotation += F_2PI; - } - - while(fFullRotation >= F_2PI) - { - fFullRotation -= F_2PI; - } - - const Hatch aHatch(HATCH_SINGLE, getBaseColor(), 3, (sal_uInt16)basegfx::fround(fFullRotation * ( 10.0 / F_PI180))); - rOutputDevice.EnableMapMode(false); - rOutputDevice.DrawHatch(PolyPolygon(aB2DGeometry), aHatch); - rOutputDevice.EnableMapMode(bMapModeWasEnabled); - } - - void OverlayHatchRect::createBaseRange(OutputDevice& rOutputDevice) - { - // reset range and expand with fresh geometry - maBaseRange = getGeometry(rOutputDevice).getB2DRange(); - - // getGeometry data is in discrete coordinates (pixels), so transform back to - // world coordinates (logic) - maBaseRange.transform(rOutputDevice.GetInverseViewTransformation()); + const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition()); + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive( + aHatchRange, + 3.0, + getHatchRotation(), + getBaseColor().getBColor(), + getDiscreteGrow(), + getDiscreteShrink(), + getRotation())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } OverlayHatchRect::OverlayHatchRect( const basegfx::B2DPoint& rBasePosition, const basegfx::B2DPoint& rSecondPosition, const Color& rHatchColor, - double fDiscreteWidth, + double fDiscreteGrow, + double fDiscreteShrink, double fHatchRotation, double fRotation) : OverlayObjectWithBasePosition(rBasePosition, rHatchColor), maSecondPosition(rSecondPosition), - mfDiscreteWidth(fDiscreteWidth), + mfDiscreteGrow(fDiscreteGrow), + mfDiscreteShrink(fDiscreteShrink), mfHatchRotation(fHatchRotation), mfRotation(fRotation) { @@ -136,12 +90,6 @@ namespace sdr objectChange(); } } - - void OverlayHatchRect::zoomHasChanged() - { - // reset validity of range in logical coor to force recalculation - mbIsChanged = sal_True; - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayhelpline.cxx b/svx/source/sdr/overlay/overlayhelpline.cxx index 5de8d071a292..12cb5ac660ba 100644 --- a/svx/source/sdr/overlay/overlayhelpline.cxx +++ b/svx/source/sdr/overlay/overlayhelpline.cxx @@ -35,6 +35,8 @@ #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -42,79 +44,38 @@ namespace sdr { namespace overlay { - void OverlayHelplineStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayHelplineStriped::createOverlayObjectPrimitive2DSequence() { - // prepare OutputDevice - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); + drawinglayer::primitive2d::Primitive2DSequence aRetval; - switch(meKind) + if(getOverlayManager()) { - case SDRHELPLINE_VERTICAL : - { - const basegfx::B2DPoint aStart(getBasePosition().getX(), aVisibleLogic.Top()); - const basegfx::B2DPoint aEnd(getBasePosition().getX(), aVisibleLogic.Bottom()); - ImpDrawLineStriped(rOutputDevice, aStart, aEnd); - break; - } - - case SDRHELPLINE_HORIZONTAL : - { - const basegfx::B2DPoint aStart(aVisibleLogic.Left(), getBasePosition().getY()); - const basegfx::B2DPoint aEnd(aVisibleLogic.Right(), getBasePosition().getY()); - ImpDrawLineStriped(rOutputDevice, aStart, aEnd); - break; - } - - case SDRHELPLINE_POINT : - { - const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE); - const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize)); - - const basegfx::B2DPoint aStartA(getBasePosition().getX(), getBasePosition().getY() - aLogicSize.Height()); - const basegfx::B2DPoint aEndA(getBasePosition().getX(), getBasePosition().getY() + aLogicSize.Height()); - ImpDrawLineStriped(rOutputDevice, aStartA, aEndA); - - const basegfx::B2DPoint aStartB(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY()); - const basegfx::B2DPoint aEndB(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY()); - ImpDrawLineStriped(rOutputDevice, aStartB, aEndB); - - break; - } + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); + const drawinglayer::primitive2d::HelplineStyle aStyle( + SDRHELPLINE_POINT == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_POINT : + SDRHELPLINE_VERTICAL == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_VERTICAL : + drawinglayer::primitive2d::HELPLINESTYLE_HORIZONTAL); + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayHelplineStripedPrimitive( + getBasePosition(), + aStyle, + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } + + return aRetval; } - void OverlayHelplineStriped::createBaseRange(OutputDevice& rOutputDevice) + void OverlayHelplineStriped::stripeDefinitionHasChanged() { - // reset range and expand it - maBaseRange.reset(); - - if(SDRHELPLINE_POINT == meKind) - { - const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE); - const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize)); - - maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY() - aLogicSize.Height())); - maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY() + aLogicSize.Height())); - } - else - { - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - if(SDRHELPLINE_HORIZONTAL == meKind) - { - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), getBasePosition().getY())); - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), getBasePosition().getY())); - } - else if(SDRHELPLINE_VERTICAL == meKind) - { - maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Top())); - maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Bottom())); - } - } + // react on OverlayManager's stripe definition change + objectChange(); } OverlayHelplineStriped::OverlayHelplineStriped( @@ -128,102 +89,6 @@ namespace sdr OverlayHelplineStriped::~OverlayHelplineStriped() { } - - sal_Bool OverlayHelplineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - if(SDRHELPLINE_POINT == meKind) - { - // use distance to BasePosition - const basegfx::B2DVector aVector(rPos - getBasePosition()); - - return (aVector.getLength() < fTol); - } - else - { - if(SDRHELPLINE_HORIZONTAL == meKind) - { - // test vertical - if(rPos.getY() >= (getBasePosition().getY() - fTol) - && rPos.getY() <= (getBasePosition().getY() + fTol)) - { - return sal_True; - } - } - else if(SDRHELPLINE_VERTICAL == meKind) - { - // test horizontal - if(rPos.getX() >= (getBasePosition().getX() - fTol) - && rPos.getX() <= (getBasePosition().getX() + fTol)) - { - return sal_True; - } - } - } - } - - return sal_False; - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayHelpline::drawGeometry(OutputDevice& rOutputDevice) - { - Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY())); - - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); - - if(SDRHELPLINE_POINT == meKind) - { - Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE); - Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize)); - - rOutputDevice.DrawLine( - Point(aBasePos.X() - aLogicSize.Width(), aBasePos.Y()), - Point(aBasePos.X() + aLogicSize.Width(), aBasePos.Y())); - rOutputDevice.DrawLine( - Point(aBasePos.X(), aBasePos.Y() - aLogicSize.Height()), - Point(aBasePos.X(), aBasePos.Y() + aLogicSize.Height())); - } - else - { - Point aEmptyPoint; - Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - if(SDRHELPLINE_HORIZONTAL == meKind) - { - rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y())); - } - else if(SDRHELPLINE_VERTICAL == meKind) - { - rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom())); - } - } - } - - OverlayHelpline::OverlayHelpline( - const basegfx::B2DPoint& rBasePos, - Color aLineColor, - SdrHelpLineKind eNewKind) - : OverlayHelplineStriped(rBasePos, eNewKind) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aLineColor; - } - - OverlayHelpline::~OverlayHelpline() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayline.cxx b/svx/source/sdr/overlay/overlayline.cxx index 003da41ee31d..90ecb869f4f6 100644 --- a/svx/source/sdr/overlay/overlayline.cxx +++ b/svx/source/sdr/overlay/overlayline.cxx @@ -37,6 +37,9 @@ #include <basegfx/vector/b2dvector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -44,17 +47,37 @@ namespace sdr { namespace overlay { - void OverlayLineStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayLineStriped::createOverlayObjectPrimitive2DSequence() { - ImpDrawLineStriped(rOutputDevice, getBasePosition(), getSecondPosition()); + drawinglayer::primitive2d::Primitive2DSequence aRetval; + + if(getOverlayManager()) + { + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); + basegfx::B2DPolygon aLine; + + aLine.append(getBasePosition()); + aLine.append(getSecondPosition()); + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( + aLine, + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + } + + return aRetval; } - void OverlayLineStriped::createBaseRange(OutputDevice& /*rOutputDevice*/) + void OverlayLineStriped::stripeDefinitionHasChanged() { - // reset range and expand it - maBaseRange.reset(); - maBaseRange.expand(getBasePosition()); - maBaseRange.expand(getSecondPosition()); + // react on OverlayManager's stripe definition change + objectChange(); } OverlayLineStriped::OverlayLineStriped( @@ -80,63 +103,6 @@ namespace sdr objectChange(); } } - - sal_Bool OverlayLineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable() && !getBasePosition().equal(getSecondPosition())) - { - return basegfx::tools::isInEpsilonRange(getBasePosition(), getSecondPosition(), rPos, fTol); - } - - return sal_False; - } - - void OverlayLineStriped::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity()) - { - // transform base position - OverlayObjectWithBasePosition::transform(rMatrix); - - // transform maSecondPosition - const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition(); - setSecondPosition(aNewSecondPosition); - } - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayLine::drawGeometry(OutputDevice& rOutputDevice) - { - const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY())); - const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY())); - - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); - - rOutputDevice.DrawLine(aStart, aEnd); - } - - OverlayLine::OverlayLine( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - Color aLineColor) - : OverlayLineStriped(rBasePos, rSecondPos) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aLineColor; - } - - OverlayLine::~OverlayLine() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 8c682adfc166..79d493b6d9d0 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -50,33 +50,49 @@ namespace sdr { void OverlayManager::ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const { - ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart; + const sal_uInt32 nSize(maOverlayObjects.size()); - if(pCurrent) + if(nSize) { const sal_uInt16 nOriginalAA(rDestinationDevice.GetAntialiasing()); + const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing()); - // react on AntiAliasing settings - if(maDrawinglayerOpt.IsAntiAliasing()) - { - rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW); - } - else - { - rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW); - } + // create processor + drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice( + rDestinationDevice, + getCurrentViewInformation2D()); - while(pCurrent) + if(pProcessor) { - if(pCurrent->isVisible()) + for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++) { - if(rRange.overlaps(pCurrent->getBaseRange())) + OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); + const OverlayObject& rCandidate = **aIter; + + if(rCandidate.isVisible()) { - pCurrent->drawGeometry(rDestinationDevice); + const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence(); + + if(rSequence.hasElements()) + { + if(rRange.overlaps(rCandidate.getBaseRange())) + { + if(bIsAntiAliasing && rCandidate.allowsAntiAliase()) + { + rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW); + } + else + { + rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW); + } + + pProcessor->process(rSequence); + } + } } } - pCurrent = pCurrent->mpNext; + delete pProcessor; } // restore AA settings @@ -84,87 +100,162 @@ namespace sdr } } - void OverlayManager::ImpCheckMapModeChange() const + void OverlayManager::ImpStripeDefinitionChanged() { - sal_Bool bZoomHasChanged(sal_False); - MapMode aOutputDeviceMapMode(getOutputDevice().GetMapMode()); - ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart; + const sal_uInt32 nSize(maOverlayObjects.size()); - if(maMapMode != aOutputDeviceMapMode) + if(nSize) { - bZoomHasChanged = ( - maMapMode.GetScaleX() != aOutputDeviceMapMode.GetScaleX() - || maMapMode.GetScaleY() != aOutputDeviceMapMode.GetScaleY()); - - // remember MapMode - ((OverlayManager*)this)->maMapMode = aOutputDeviceMapMode; - } - - if(bZoomHasChanged && pCurrent) - { - while(pCurrent) + for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++) { - pCurrent->zoomHasChanged(); - pCurrent = pCurrent->mpNext; + OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); + OverlayObject& rCandidate = **aIter; + rCandidate.stripeDefinitionHasChanged(); } } } - void OverlayManager::ImpStripeDefinitionChanged() - { - ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart; - - while(pCurrent) - { - pCurrent->stripeDefinitionHasChanged(); - pCurrent = pCurrent->mpNext; - } - } - double OverlayManager::getDiscreteOne() const { - if(getOutputDevice().GetViewTransformation() != maViewTransformation) + if(basegfx::fTools::equalZero(mfDiscreteOne)) { - OverlayManager* pThis = const_cast< OverlayManager* >(this); - pThis->maViewTransformation = getOutputDevice().GetViewTransformation(); const basegfx::B2DVector aDiscreteInLogic(getOutputDevice().GetInverseViewTransformation() * basegfx::B2DVector(1.0, 0.0)); - pThis->mfDiscreteOne = aDiscreteInLogic.getLength(); + const_cast< OverlayManager* >(this)->mfDiscreteOne = aDiscreteInLogic.getLength(); } return mfDiscreteOne; } - OverlayManager::OverlayManager(OutputDevice& rOutputDevice) + OverlayManager::OverlayManager( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager) : Scheduler(), rmOutputDevice(rOutputDevice), - mpOverlayObjectStart(0L), - mpOverlayObjectEnd(0L), + maOverlayObjects(), maStripeColorA(Color(COL_BLACK)), maStripeColorB(Color(COL_WHITE)), - mnStripeLengthPixel(5L), + mnStripeLengthPixel(5), maDrawinglayerOpt(), maViewTransformation(), + maViewInformation2D(0), mfDiscreteOne(0.0) { + if(pOldOverlayManager) + { + // take over OverlayObjects from given OverlayManager. Copy + // the vector of pointers + maOverlayObjects = pOldOverlayManager->maOverlayObjects; + const sal_uInt32 nSize(maOverlayObjects.size()); + + if(nSize) + { + for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++) + { + OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); + OverlayObject& rCandidate = **aIter; + + // remove from old and add to new OverlayManager + pOldOverlayManager->impApplyRemoveActions(rCandidate); + impApplyAddActions(rCandidate); + } + + pOldOverlayManager->maOverlayObjects.clear(); + } + } + } + + const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const + { + if(getOutputDevice().GetViewTransformation() != maViewTransformation) + { + basegfx::B2DRange aViewRange(maViewInformation2D.getViewport()); + + if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) + { + const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel()); + aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); + aViewRange.transform(getOutputDevice().GetInverseViewTransformation()); + } + + OverlayManager* pThis = const_cast< OverlayManager* >(this); + + pThis->maViewTransformation = getOutputDevice().GetViewTransformation(); + pThis->maViewInformation2D = drawinglayer::geometry::ViewInformation2D( + maViewInformation2D.getObjectTransformation(), + maViewTransformation, + aViewRange, + maViewInformation2D.getVisualizedPage(), + maViewInformation2D.getViewTime(), + maViewInformation2D.getExtendedInformationSequence()); + pThis->mfDiscreteOne = 0.0; + } + + return maViewInformation2D; + } + + void OverlayManager::impApplyRemoveActions(OverlayObject& rTarget) + { + // handle evtl. animation + if(rTarget.allowsAnimation()) + { + // remove from event chain + RemoveEvent(&rTarget); + } + + // make invisible + invalidateRange(rTarget.getBaseRange()); + + // clear manager + rTarget.mpOverlayManager = 0; + } + + void OverlayManager::impApplyAddActions(OverlayObject& rTarget) + { + // set manager + rTarget.mpOverlayManager = this; + + // make visible + invalidateRange(rTarget.getBaseRange()); + + // handle evtl. animation + if(rTarget.allowsAnimation()) + { + // Trigger at current time to get alive. This will do the + // object-specific next time calculation and hand over adding + // again to the scheduler to the animated object, too. This works for + // a paused or non-paused animator. + rTarget.Trigger(GetTime()); + } } OverlayManager::~OverlayManager() { - // the OverlayManager is not the owner of the OverlayObjects - // and thus will not delete them, but remove them. - while(mpOverlayObjectStart) + // The OverlayManager is not the owner of the OverlayObjects + // and thus will not delete them, but remove them. Profit here + // from knowing that all will be removed + const sal_uInt32 nSize(maOverlayObjects.size()); + + if(nSize) { - remove(*mpOverlayObjectStart); + for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++) + { + OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); + OverlayObject& rCandidate = **aIter; + impApplyRemoveActions(rCandidate); + } + + // erase vector + maOverlayObjects.clear(); } } void OverlayManager::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const { - if(!rRegion.IsEmpty() && mpOverlayObjectStart) + if(!rRegion.IsEmpty() && maOverlayObjects.size()) { // check for changed MapModes. That may influence the // logical size of pixel based OverlayObjects (like BitmapHandles) - ImpCheckMapModeChange(); + //ImpCheckMapModeChange(); // paint members const Rectangle aRegionBoundRect(rRegion.GetBoundRect()); @@ -195,87 +286,38 @@ namespace sdr void OverlayManager::add(OverlayObject& rOverlayObject) { - // add to the end of chain to preserve display order in paint - DBG_ASSERT(0L == rOverlayObject.mpOverlayManager, - "OverlayManager::add: OverlayObject is added to an OverlayManager (!)"); - - if(mpOverlayObjectEnd) - { - // new element, add to end - rOverlayObject.mpNext = mpOverlayObjectEnd->mpNext; - rOverlayObject.mpPrevious = mpOverlayObjectEnd; - mpOverlayObjectEnd->mpNext = &rOverlayObject; - mpOverlayObjectEnd = &rOverlayObject; - } - else - { - // first element - rOverlayObject.mpNext = rOverlayObject.mpPrevious = 0L; - mpOverlayObjectEnd = mpOverlayObjectStart = &rOverlayObject; - } - - // set manager - rOverlayObject.mpOverlayManager = this; + OSL_ENSURE(0 == rOverlayObject.mpOverlayManager, "OverlayObject is added twice to an OverlayManager (!)"); - // make visible - invalidateRange(rOverlayObject.getBaseRange()); + // add to the end of chain to preserve display order in paint + maOverlayObjects.push_back(&rOverlayObject); - // handle evtl. animation - if(rOverlayObject.allowsAnimation()) - { - // Trigger at current time to get alive. This will do the - // object-specific next time calculation and hand over adding - // again to the scheduler to the animated object, too. This works for - // a paused or non-paused animator. - rOverlayObject.Trigger(GetTime()); - } + // execute add actions + impApplyAddActions(rOverlayObject); } void OverlayManager::remove(OverlayObject& rOverlayObject) { - // handle evtl. animation - if(rOverlayObject.allowsAnimation()) - { - // remove from event chain - RemoveEvent(&rOverlayObject); - } + OSL_ENSURE(rOverlayObject.mpOverlayManager == this, "OverlayObject is removed from wrong OverlayManager (!)"); - // Remove from chain - DBG_ASSERT(rOverlayObject.mpOverlayManager == this, - "OverlayManager::remove: OverlayObject is removed from wrong OverlayManager (!)"); + // execute remove actions + impApplyRemoveActions(rOverlayObject); - if(rOverlayObject.mpPrevious) - { - rOverlayObject.mpPrevious->mpNext = rOverlayObject.mpNext; - } + // remove from vector + const OverlayObjectVector::iterator aFindResult = ::std::find(maOverlayObjects.begin(), maOverlayObjects.end(), &rOverlayObject); + const bool bFound(aFindResult != maOverlayObjects.end()); + OSL_ENSURE(bFound, "OverlayObject NOT found at OverlayManager (!)"); - if(rOverlayObject.mpNext) + if(bFound) { - rOverlayObject.mpNext->mpPrevious = rOverlayObject.mpPrevious; + maOverlayObjects.erase(aFindResult); } - - if(&rOverlayObject == mpOverlayObjectStart) - { - mpOverlayObjectStart = rOverlayObject.mpNext; - } - - if(&rOverlayObject == mpOverlayObjectEnd) - { - mpOverlayObjectEnd = rOverlayObject.mpPrevious; - } - - // make invisible - invalidateRange(rOverlayObject.getBaseRange()); - - // clear manager - rOverlayObject.mpOverlayManager = 0L; } void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange) { if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) { - if(maDrawinglayerOpt.IsAntiAliasing()) + if(getDrawinglayerOpt().IsAntiAliasing()) { // assume AA needs one pixel more and invalidate one pixel more const double fDiscreteOne(getDiscreteOne()); @@ -331,18 +373,6 @@ namespace sdr ImpStripeDefinitionChanged(); } } - - ::boost::shared_ptr<OverlayObjectVector> OverlayManager::GetOverlayObjects (void) const - { - ::boost::shared_ptr<OverlayObjectVector> pObjectList (new OverlayObjectVector()); - sdr::overlay::OverlayObject* pObject = mpOverlayObjectStart; - while (pObject != NULL) - { - pObjectList->push_back(pObject); - pObject = pObject->mpNext; - } - return pObjectList; - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 584faedcdda2..2b664e816d42 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -36,12 +36,8 @@ #include <basegfx/range/b2drange.hxx> #include <vcl/salbtype.hxx> #include <vcl/window.hxx> - -// #i72754# #include <vcl/bitmap.hxx> #include <tools/stream.hxx> - -// #i75163# #include <basegfx/matrix/b2dhommatrix.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -63,7 +59,7 @@ namespace sdr // compare the MapModes for zoom/scroll changes if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode()) { - const sal_Bool bZoomed( + const bool bZoomed( maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX() || maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY()); @@ -71,7 +67,7 @@ namespace sdr { const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin(); const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin(); - const sal_Bool bScrolled(rOriginOld != rOriginNew); + const bool bScrolled(rOriginOld != rOriginNew); if(bScrolled) { @@ -81,8 +77,8 @@ namespace sdr const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel()); // remember and switch off MapMode - const sal_Bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled()); - maBufferDevice.EnableMapMode(sal_False); + const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled()); + maBufferDevice.EnableMapMode(false); // scroll internally buffered stuff const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel); @@ -132,10 +128,10 @@ namespace sdr Rectangle aRegionRectanglePixel; // MapModes off - const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); - const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled()); - getOutputDevice().EnableMapMode(sal_False); - ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(sal_False); + const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); + const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled()); + getOutputDevice().EnableMapMode(false); + ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false); while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel)) { @@ -200,10 +196,10 @@ namespace sdr Rectangle aRegionRectanglePixel; // MapModes off - const sal_Bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled()); - const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled()); - rSource.EnableMapMode(sal_False); - maBufferDevice.EnableMapMode(sal_False); + const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled()); + const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled()); + rSource.EnableMapMode(false); + maBufferDevice.EnableMapMode(false); while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel)) { @@ -221,7 +217,7 @@ namespace sdr static bool bDoPaintForVisualControl(false); if(bDoPaintForVisualControl) { - const sal_Bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled()); + const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled()); getOutputDevice().EnableMapMode(false); getOutputDevice().SetLineColor(COL_LIGHTRED); getOutputDevice().SetFillColor(); @@ -282,7 +278,7 @@ namespace sdr } maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode()); - maOutputBufferDevice.EnableMapMode(sal_False); + maOutputBufferDevice.EnableMapMode(false); maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode()); maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings()); maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing()); @@ -320,8 +316,8 @@ namespace sdr const Size aSize(aRegionRectanglePixel.GetSize()); { - const sal_Bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled()); - maBufferDevice.EnableMapMode(sal_False); + const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled()); + maBufferDevice.EnableMapMode(false); maOutputBufferDevice.DrawOutDev( aTopLeft, aSize, // destination @@ -334,14 +330,14 @@ namespace sdr // paint overlay content for remembered region, use // method from base class directly - maOutputBufferDevice.EnableMapMode(sal_True); + maOutputBufferDevice.EnableMapMode(true); OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice); - maOutputBufferDevice.EnableMapMode(sal_False); + maOutputBufferDevice.EnableMapMode(false); // copy to output { - const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); - getOutputDevice().EnableMapMode(sal_False); + const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); + getOutputDevice().EnableMapMode(false); getOutputDevice().DrawOutDev( aTopLeft, aSize, // destination @@ -417,8 +413,11 @@ namespace sdr return 0; } - OverlayManagerBuffered::OverlayManagerBuffered(OutputDevice& rOutputDevice, sal_Bool bRefreshWithPreRendering) - : OverlayManager(rOutputDevice), + OverlayManagerBuffered::OverlayManagerBuffered( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager, + bool bRefreshWithPreRendering) + : OverlayManager(rOutputDevice, pOldOverlayManager), mbRefreshWithPreRendering(bRefreshWithPreRendering) { // Init timer @@ -515,9 +514,9 @@ namespace sdr } } - void OverlayManagerBuffered::SetRefreshWithPreRendering(sal_Bool bNew) + void OverlayManagerBuffered::SetRefreshWithPreRendering(bool bNew) { - if(mbRefreshWithPreRendering != bNew) + if((bool)mbRefreshWithPreRendering != bNew) { mbRefreshWithPreRendering = bNew; } diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx index 658b6719709e..4c05fbd48a23 100644 --- a/svx/source/sdr/overlay/overlayobject.cxx +++ b/svx/source/sdr/overlay/overlayobject.cxx @@ -43,7 +43,6 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <svx/sdr/contact/objectcontacttools.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> -#include <drawinglayer/processor2d/baseprocessor2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -53,206 +52,94 @@ namespace sdr { void OverlayObject::objectChange() { - if(mpOverlayManager) - { - basegfx::B2DRange aPreviousRange(maBaseRange); - - if(!aPreviousRange.isEmpty()) - { - mpOverlayManager->invalidateRange(aPreviousRange); - } - - mbIsChanged = sal_True; - const basegfx::B2DRange& rCurrentRange = getBaseRange(); - - if(rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty()) - { - mpOverlayManager->invalidateRange(rCurrentRange); - } - } - } + const basegfx::B2DRange aPreviousRange(maBaseRange); + maBaseRange.reset(); + setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence()); - // support method to draw striped geometries - void OverlayObject::ImpDrawRangeStriped(OutputDevice& rOutputDevice, const basegfx::B2DRange& rRange) - { - if(getOverlayManager()) + if(getOverlayManager() && !aPreviousRange.isEmpty()) { - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange)); - - if(aPolygon.count()) - { - ImpDrawPolygonStriped(rOutputDevice, aPolygon); - } + getOverlayManager()->invalidateRange(aPreviousRange); } - } - void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, double x1, double y1, double x2, double y2) - { - if(getOverlayManager()) - { - const basegfx::B2DPoint aStart(x1, y1); - const basegfx::B2DPoint aEnd(x2, y2); + const basegfx::B2DRange& rCurrentRange = getBaseRange(); - if(!aStart.equal(aEnd)) - { - basegfx::B2DPolygon aPolygon; - aPolygon.append(aStart); - aPolygon.append(aEnd); - - ImpDrawPolygonStriped(rOutputDevice, aPolygon); - } + if(getOverlayManager() && rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty()) + { + getOverlayManager()->invalidateRange(rCurrentRange); } } - void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd) + // OverlayObject implementations. + drawinglayer::primitive2d::Primitive2DSequence OverlayObject::createOverlayObjectPrimitive2DSequence() { - if(getOverlayManager() && !rStart.equal(rEnd)) - { - basegfx::B2DPolygon aPolygon; - aPolygon.append(rStart); - aPolygon.append(rEnd); - - ImpDrawPolygonStriped(rOutputDevice, aPolygon); - } + // Default implementation has to assert a missing implementation. It cannot + // be useful to have overlay object derivations which have no visualisation + // at all + OSL_ENSURE(false, "OverlayObject derivation without visualisation definition (missing createOverlayObjectPrimitive2DSequence implementation) (!)"); + return drawinglayer::primitive2d::Primitive2DSequence(); } - void OverlayObject::ImpDrawPolygonStriped(OutputDevice& rOutputDevice, const basegfx::B2DPolygon& rPolygon) + void OverlayObject::allowAntiAliase(bool bNew) { - if(getOverlayManager() && rPolygon.count()) + if(bNew != (bool)mbAllowsAntiAliase) { - if(getOverlayManager() && getOverlayManager()->getDrawinglayerOpt().IsAntiAliasing()) - { - // prepare ViewInformation2D - const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), - rOutputDevice.GetViewTransformation(), - basegfx::B2DRange(), - 0, - 0.0, - 0); - - // create processor - drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice( - rOutputDevice, - aViewInformation2D); - - if(pProcessor) - { - // prepare primitives - const drawinglayer::primitive2d::Primitive2DReference aPolygonMarkerPrimitive2D( - new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( - rPolygon, - getOverlayManager()->getStripeColorA().getBColor(), - getOverlayManager()->getStripeColorB().getBColor(), - getOverlayManager()->getStripeLengthPixel())); - const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aPolygonMarkerPrimitive2D, 1); - - pProcessor->process(aSequence); - - delete pProcessor; - } - } - else - { - const sal_uInt32 nLenPixel(getOverlayManager()->getStripeLengthPixel()); - const Size aDashSizePixel(nLenPixel, nLenPixel); - const Size aDashSizeLogic(rOutputDevice.PixelToLogic(aDashSizePixel)); - const double fDashLength(aDashSizeLogic.Width()); - const double fFullDotDashLength(fDashLength + fDashLength); - - // fill DashDot vector - ::std::vector<double> aDotDashArray; - aDotDashArray.push_back(fDashLength); - aDotDashArray.push_back(fDashLength); - - // get dash polygons - basegfx::B2DPolyPolygon aStripesA; - basegfx::B2DPolyPolygon aStripesB; - basegfx::tools::applyLineDashing(rPolygon, aDotDashArray, &aStripesA, &aStripesB, fFullDotDashLength); - - // draw stripes A - if(aStripesA.count()) - { - rOutputDevice.SetFillColor(); - rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorA()); - - for(sal_uInt32 a(0L); a < aStripesA.count();a ++) - { - rOutputDevice.DrawPolyLine(aStripesA.getB2DPolygon(a)); - } - } - - // draw stripes B - if(aStripesB.count()) - { - rOutputDevice.SetFillColor(); - rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorB()); + // remember new value + mbAllowsAntiAliase = bNew; - for(sal_uInt32 a(0L); a < aStripesB.count();a ++) - { - rOutputDevice.DrawPolyLine(aStripesB.getB2DPolygon(a)); - } - } - } + // register change (after change) + objectChange(); } } OverlayObject::OverlayObject(Color aBaseColor) - : Event(0L), - mpOverlayManager(0L), - mpNext(0L), - mpPrevious(0L), + : Event(0), + mpOverlayManager(0), maBaseColor(aBaseColor), - mbIsVisible(sal_True), - mbIsChanged(sal_True), - mbIsHittable(sal_True), - mbAllowsAnimation(sal_False) + mbIsVisible(true), + mbIsHittable(true), + mbAllowsAnimation(false), + mbAllowsAntiAliase(true) { } OverlayObject::~OverlayObject() { - DBG_ASSERT(0L == mpOverlayManager, - "OverlayObject is destructed which is still registered at OverlayManager (!)"); + OSL_ENSURE(0 == getOverlayManager(), "OverlayObject is destructed which is still registered at OverlayManager (!)"); } - sal_Bool OverlayObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const + const drawinglayer::primitive2d::Primitive2DSequence& OverlayObject::getOverlayObjectPrimitive2DSequence() const { - if(isHittable()) + if(!getPrimitive2DSequence().hasElements()) { - if(0.0 != fTol) - { - basegfx::B2DRange aRange(getBaseRange()); - aRange.grow(fTol); - return aRange.isInside(rPos); - } - else - { - return getBaseRange().isInside(rPos); - } + // no existing sequence; create one + const_cast< OverlayObject* >(this)->setPrimitive2DSequence( + const_cast< OverlayObject* >(this)->createOverlayObjectPrimitive2DSequence()); } - return sal_False; + return getPrimitive2DSequence(); } const basegfx::B2DRange& OverlayObject::getBaseRange() const { - if(mbIsChanged) + if(getOverlayManager() && maBaseRange.isEmpty()) { - if(mpOverlayManager) + const drawinglayer::primitive2d::Primitive2DSequence& rSequence = getOverlayObjectPrimitive2DSequence(); + + if(rSequence.hasElements()) { - ((::sdr::overlay::OverlayObject*)this)->createBaseRange(mpOverlayManager->getOutputDevice()); - } + const drawinglayer::geometry::ViewInformation2D aViewInformation2D(getOverlayManager()->getCurrentViewInformation2D()); - ((::sdr::overlay::OverlayObject*)this)->mbIsChanged = sal_False; + const_cast< sdr::overlay::OverlayObject* >(this)->maBaseRange = + drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(rSequence, aViewInformation2D); + } } return maBaseRange; } - void OverlayObject::setVisible(sal_Bool bNew) + void OverlayObject::setVisible(bool bNew) { - if(bNew != mbIsVisible) + if(bNew != (bool)mbIsVisible) { // remember new value mbIsVisible = bNew; @@ -262,9 +149,9 @@ namespace sdr } } - void OverlayObject::setHittable(sal_Bool bNew) + void OverlayObject::setHittable(bool bNew) { - if(bNew != mbIsHittable) + if(bNew != (bool)mbIsHittable) { // remember new value mbIsHittable = bNew; @@ -291,11 +178,6 @@ namespace sdr // default does not register again } - void OverlayObject::zoomHasChanged() - { - // default does not need to do anything - } - void OverlayObject::stripeDefinitionHasChanged() { // default does not need to do anything @@ -330,15 +212,6 @@ namespace sdr objectChange(); } } - - void OverlayObjectWithBasePosition::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity()) - { - basegfx::B2DPoint aNewBasePosition = rMatrix * getBasePosition(); - setBasePosition(aNewBasePosition); - } - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx index 25d2dbbdd31b..5df0fc85f8f9 100644 --- a/svx/source/sdr/overlay/overlayobjectcell.cxx +++ b/svx/source/sdr/overlay/overlayobjectcell.cxx @@ -35,6 +35,11 @@ #include <vcl/outdev.hxx> #include <vcl/hatch.hxx> #include <svx/sdr/overlay/overlayobjectcell.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/invertprimitive2d.hxx> using namespace ::basegfx; @@ -48,83 +53,60 @@ namespace sdr mePaintType( eType ), maRectangles( rRects ) { + // no AA for selection overlays + allowAntiAliase(false); } OverlayObjectCell::~OverlayObjectCell() { } - void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence() { - // set colors - rOutputDevice.SetLineColor(); - rOutputDevice.SetFillColor(getBaseColor()); + drawinglayer::primitive2d::Primitive2DSequence aRetval; + const sal_uInt32 nCount(maRectangles.size()); - if ( mePaintType == CELL_OVERLAY_INVERT ) + if(nCount) { - rOutputDevice.Push(); - rOutputDevice.SetRasterOp( ROP_XOR ); - rOutputDevice.SetFillColor( COL_WHITE ); - } - - for(sal_uInt32 a(0L);a < maRectangles.size(); a++) - { - const basegfx::B2DRange& rRange(maRectangles[a]); - const Rectangle aRectangle(fround(rRange.getMinX()), fround(rRange.getMinY()), fround(rRange.getMaxX()), fround(rRange.getMaxY())); + const basegfx::BColor aRGBColor(getBaseColor().getBColor()); + aRetval.realloc(nCount); - switch(mePaintType) + // create primitives for all ranges + for(sal_uInt32 a(0); a < nCount; a++) { - case CELL_OVERLAY_INVERT : - { - rOutputDevice.DrawRect( aRectangle ); + const basegfx::B2DRange& rRange(maRectangles[a]); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange)); - // if(OUTDEV_WINDOW == rOutputDevice.GetOutDevType()) - // { - // ((Window&)rOutputDevice).Invert(aRectangle, INVERT_HIGHLIGHT); - // } - - break; - } - case CELL_OVERLAY_HATCH : - { - rOutputDevice.DrawHatch(PolyPolygon(Polygon(aRectangle)), Hatch(HATCH_SINGLE, getBaseColor(), 2, 450)); - break; - } - case CELL_OVERLAY_TRANSPARENT : - { - rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 50); - break; - } - case CELL_OVERLAY_LIGHT_TRANSPARENT : - { - rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 80); - break; - } + aRetval[a] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + aRGBColor)); } - } - if ( mePaintType == CELL_OVERLAY_INVERT ) - rOutputDevice.Pop(); - } - void OverlayObjectCell::createBaseRange(OutputDevice& /*rOutputDevice*/) - { - maBaseRange.reset(); + if(mePaintType == CELL_OVERLAY_TRANSPARENT) + { + // embed in 50% transparent paint + const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + aRetval, + 0.5)); - for(sal_uInt32 a(0L); a < maRectangles.size(); a++) - { - maBaseRange.expand(maRectangles[a]); - } - } + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + } + else // CELL_OVERLAY_INVERT + { + // embed in invert primitive + const drawinglayer::primitive2d::Primitive2DReference aInvert( + new drawinglayer::primitive2d::InvertPrimitive2D( + aRetval)); - void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix) - { - for(sal_uInt32 a(0L); a < maRectangles.size(); a++) - { - maRectangles[a].transform(rMatrix); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1); + } } - } + return aRetval; + } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index 3c9107d94bfe..370b6d66c225 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -40,6 +40,8 @@ // get access to basic algos like ::std::find #include <algorithm> +#include <drawinglayer/processor2d/hittestprocessor2d.hxx> + ////////////////////////////////////////////////////////////////////////////// namespace sdr @@ -73,63 +75,92 @@ namespace sdr void OverlayObjectList::remove(OverlayObject& rOverlayObject) { const OverlayObjectVector::iterator aFindResult = ::std::find(maVector.begin(), maVector.end(), &rOverlayObject); - DBG_ASSERT((aFindResult != maVector.end()), - "OverlayObjectList::remove: Could not find given object in list (!)"); - maVector.erase(aFindResult); + const bool bFound(aFindResult != maVector.end()); + OSL_ENSURE(bFound, "Could not find given object in list (!)"); + + if(bFound) + { + maVector.erase(aFindResult); + } } - sal_Bool OverlayObjectList::isHit(const basegfx::B2DPoint& rPos, double fTol) const + bool OverlayObjectList::isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance) const { if(maVector.size()) { OverlayObjectVector::const_iterator aStart(maVector.begin()); + sdr::overlay::OverlayObject* pFirst = *aStart; + OSL_ENSURE(pFirst, "Corrupt OverlayObjectList (!)"); + OverlayManager* pManager = pFirst->getOverlayManager(); - if(0.0 == fTol) + if(pManager) { - ::sdr::overlay::OverlayObject* pCandidate = *aStart; - OverlayManager* pManager = pCandidate->getOverlayManager(); - - if(pManager) + if(0.0 == fLogicTolerance) { - Size aSizeLogic(pManager->getOutputDevice().PixelToLogic( + const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic( Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL))); - fTol = aSizeLogic.Width(); + fLogicTolerance = aSizeLogic.Width(); } - } - for(; aStart != maVector.end(); aStart++) - { - ::sdr::overlay::OverlayObject* pCandidate = *aStart; + const drawinglayer::geometry::ViewInformation2D aViewInformation2D(pManager->getCurrentViewInformation2D()); + drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D( + aViewInformation2D, + rLogicPosition, + fLogicTolerance, + false); - if(pCandidate->isHit(rPos, fTol)) + for(; aStart != maVector.end(); aStart++) { - return sal_True; + sdr::overlay::OverlayObject* pCandidate = *aStart; + OSL_ENSURE(pCandidate, "Corrupt OverlayObjectList (!)"); + + if(pCandidate->isHittable()) + { + const drawinglayer::primitive2d::Primitive2DSequence& rSequence = pCandidate->getOverlayObjectPrimitive2DSequence(); + + if(rSequence.hasElements()) + { + aHitTestProcessor2D.process(rSequence); + + if(aHitTestProcessor2D.getHit()) + { + return true; + } + } + } } } } - return sal_False; + return false; } - sal_Bool OverlayObjectList::isHitPixel(const Point& rPos, sal_uInt32 nTol) const + bool OverlayObjectList::isHitPixel(const Point& rDiscretePosition, sal_uInt32 nDiscreteTolerance) const { if(maVector.size()) { OverlayObjectVector::const_iterator aStart(maVector.begin()); - ::sdr::overlay::OverlayObject* pCandidate = *aStart; + sdr::overlay::OverlayObject* pCandidate = *aStart; OverlayManager* pManager = pCandidate->getOverlayManager(); if(pManager) { - Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rPos)); - Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nTol, nTol))); - basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y()); + const Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rDiscretePosition)); + const basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y()); - return isHit(aPosition, (double)aSizeLogic.Width()); + if(nDiscreteTolerance) + { + const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nDiscreteTolerance, nDiscreteTolerance))); + return isHitLogic(aPosition, (double)aSizeLogic.Width()); + } + else + { + return isHitLogic(aPosition); + } } } - return sal_False; + return false; } basegfx::B2DRange OverlayObjectList::getBaseRange() const @@ -149,20 +180,6 @@ namespace sdr return aRetval; } - - void OverlayObjectList::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity() && maVector.size()) - { - OverlayObjectVector::iterator aStart(maVector.begin()); - - for(; aStart != maVector.end(); aStart++) - { - ::sdr::overlay::OverlayObject* pCandidate = *aStart; - pCandidate->transform(rMatrix); - } - } - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx index 3d859a9b0659..a94dbdb9d1c4 100644 --- a/svx/source/sdr/overlay/overlaypolypolygon.cxx +++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx @@ -35,6 +35,8 @@ #include <vcl/outdev.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -42,21 +44,33 @@ namespace sdr { namespace overlay { - void OverlayPolyPolygonStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence() { - if(maPolyPolygon.count()) + drawinglayer::primitive2d::Primitive2DSequence aRetval; + + if(getOverlayManager()) { - for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++) - { - ImpDrawPolygonStriped(rOutputDevice, maPolyPolygon.getB2DPolygon(a)); - } + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( + getPolyPolygon(), + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } + + return aRetval; } - void OverlayPolyPolygonStriped::createBaseRange(OutputDevice& /*rOutputDevice*/) + void OverlayPolyPolygonStriped::stripeDefinitionHasChanged() { - // use tooling to get range from PolyPolygon - maBaseRange = basegfx::tools::getRange(maPolyPolygon); + // react on OverlayManager's stripe definition change + objectChange(); } OverlayPolyPolygonStriped::OverlayPolyPolygonStriped( @@ -81,67 +95,6 @@ namespace sdr objectChange(); } } - - sal_Bool OverlayPolyPolygonStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - return basegfx::tools::isInEpsilonRange(maPolyPolygon, rPos, fTol); - } - - return sal_False; - } - - void OverlayPolyPolygonStriped::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity()) - { - // transform maPolyPolygon - maPolyPolygon.transform(rMatrix); - - // register change (after change) - objectChange(); - } - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayPolyPolygon::drawGeometry(OutputDevice& rOutputDevice) - { - if(maPolyPolygon.count()) - { - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); - - // iterate self, else the single polygons will be closed when - // using DrawPolyPolygon - for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++) - { - const Polygon aPaintPoly(maPolyPolygon.getB2DPolygon(a)); - rOutputDevice.DrawPolyLine(aPaintPoly); - } - } - } - - OverlayPolyPolygon::OverlayPolyPolygon( - const basegfx::B2DPolyPolygon& rPolyPolygon, - Color aPolygonColor) - : OverlayPolyPolygonStriped(rPolyPolygon) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aPolygonColor; - } - - OverlayPolyPolygon::~OverlayPolyPolygon() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx index 1383a296709b..c43a9494901f 100644 --- a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx +++ b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx @@ -43,55 +43,9 @@ namespace sdr { namespace overlay { - void OverlayPrimitive2DSequenceObject::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayPrimitive2DSequenceObject::createOverlayObjectPrimitive2DSequence() { - if(getOverlayManager()) - { - // prepare ViewInformation2D - const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), - rOutputDevice.GetViewTransformation(), - basegfx::B2DRange(), - 0, - 0.0, - 0); - - // create processor - drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice( - rOutputDevice, - aViewInformation2D); - - if(pProcessor) - { - pProcessor->process(getSequence()); - - delete pProcessor; - } - } - } - - void OverlayPrimitive2DSequenceObject::createBaseRange(OutputDevice& rOutputDevice) - { - const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), - rOutputDevice.GetViewTransformation(), - basegfx::B2DRange(), - 0, - 0.0, - 0); - - maBaseRange = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - getSequence(), aViewInformation2D); - } - - sal_Bool OverlayPrimitive2DSequenceObject::isHit(const basegfx::B2DPoint& /*rPos*/, double /*fTol*/) const - { - if(isHittable()) - { - return false; - } - - return false; + return getSequence(); } OverlayPrimitive2DSequenceObject::OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence) diff --git a/svx/source/sdr/overlay/overlayrollingrectangle.cxx b/svx/source/sdr/overlay/overlayrollingrectangle.cxx index ea5be0e4f400..42a3575288be 100644 --- a/svx/source/sdr/overlay/overlayrollingrectangle.cxx +++ b/svx/source/sdr/overlay/overlayrollingrectangle.cxx @@ -35,6 +35,11 @@ #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -42,65 +47,59 @@ namespace sdr { namespace overlay { - void OverlayRollingRectangleStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence() { - const basegfx::B2DRange aRange(getBasePosition(), getSecondPosition()); + drawinglayer::primitive2d::Primitive2DSequence aRetval; - if(getShowBounds()) + if(getOverlayManager() && (getShowBounds() || getExtendedLines())) { - ImpDrawRangeStriped(rOutputDevice, aRange); - } - - if(getExtendedLines()) - { - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - // Left lines - ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMinY(), aRange.getMinX(), aRange.getMinY()); - ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMaxY(), aRange.getMinX(), aRange.getMaxY()); - - // Right lines - ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMinY(), aVisibleLogic.Right(), aRange.getMinY()); - ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aVisibleLogic.Right(), aRange.getMaxY()); + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); + const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition()); - // Top lines - ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aVisibleLogic.Top(), aRange.getMinX(), aRange.getMinY()); - ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aVisibleLogic.Top(), aRange.getMaxX(), aRange.getMinY()); + if(getShowBounds()) + { + // view-independent part, create directly + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle)); + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( + aPolygon, + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference); + } - // Bottom lines - ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aRange.getMaxY(), aRange.getMinX(), aVisibleLogic.Bottom()); - ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aRange.getMaxX(), aVisibleLogic.Bottom()); + if(getExtendedLines()) + { + // view-dependent part, use helper primitive + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive( + aRollingRectangle, + aRGBColorA, + aRGBColorB, + fStripeLengthPixel)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference); + } } + + return aRetval; } - void OverlayRollingRectangleStriped::createBaseRange(OutputDevice& rOutputDevice) + void OverlayRollingRectangleStriped::stripeDefinitionHasChanged() { - // reset range and expand it - maBaseRange.reset(); - - if(getExtendedLines()) - { - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top())); - maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom())); - } - - if(getShowBounds()) - { - maBaseRange.expand(getBasePosition()); - maBaseRange.expand(getSecondPosition()); - } + // react on OverlayManager's stripe definition change + objectChange(); } OverlayRollingRectangleStriped::OverlayRollingRectangleStriped( const basegfx::B2DPoint& rBasePos, const basegfx::B2DPoint& rSecondPos, - sal_Bool bExtendedLines, - sal_Bool bShowBounds) + bool bExtendedLines, + bool bShowBounds) : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)), maSecondPosition(rSecondPos), mbExtendedLines(bExtendedLines), @@ -124,9 +123,9 @@ namespace sdr } } - void OverlayRollingRectangleStriped::setExtendedLines(sal_Bool bNew) + void OverlayRollingRectangleStriped::setExtendedLines(bool bNew) { - if(bNew != mbExtendedLines) + if(bNew != (bool)mbExtendedLines) { // remember new value mbExtendedLines = bNew; @@ -136,9 +135,9 @@ namespace sdr } } - void OverlayRollingRectangleStriped::setShowBounds(sal_Bool bNew) + void OverlayRollingRectangleStriped::setShowBounds(bool bNew) { - if(bNew != mbShowBounds) + if(bNew != (bool)mbShowBounds) { // remember new value mbShowBounds = bNew; @@ -147,138 +146,6 @@ namespace sdr objectChange(); } } - - sal_Bool OverlayRollingRectangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - if(getExtendedLines()) - { - const basegfx::B2DRange aRange(getBaseRange()); - const basegfx::B2DPoint aMinimum(aRange.getMinimum()); - const basegfx::B2DPoint aMaximum(aRange.getMaximum()); - - // test upper line horizontal - if(rPos.getY() > (aMinimum.getY() - fTol) && rPos.getY() < (aMinimum.getY() + fTol)) - { - return sal_True; - } - - // test lower line horizontal - if(rPos.getY() > (aMaximum.getY() - fTol) && rPos.getY() < (aMaximum.getY() + fTol)) - { - return sal_True; - } - - // test left line vertical - if(rPos.getX() > (aMinimum.getX() - fTol) && rPos.getX() < (aMinimum.getX() + fTol)) - { - return sal_True; - } - - // test rightline vertical - if(rPos.getX() > (aMaximum.getX() - fTol) && rPos.getX() < (aMaximum.getX() + fTol)) - { - return sal_True; - } - } - - if(getShowBounds()) - { - // test for inside grown range, outside shrinked one to test for border - // hit without interiour - basegfx::B2DRange aOuterRange(getBaseRange()); - aOuterRange.grow(fTol); - - if(aOuterRange.isInside(rPos)) - { - basegfx::B2DRange aInnerRange(getBaseRange()); - aInnerRange.grow(-fTol); - - return !aInnerRange.isInside(rPos); - } - } - } - - return sal_False; - } - - void OverlayRollingRectangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity()) - { - // transform base position - OverlayObjectWithBasePosition::transform(rMatrix); - - // transform maSecondPosition - const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition(); - setSecondPosition(aNewSecondPosition); - } - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayRollingRectangle::drawGeometry(OutputDevice& rOutputDevice) - { - const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY())); - const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY())); - Rectangle aRectangle(aStart, aEnd); - aRectangle.Justify(); - - if(getShowBounds()) - { - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); - - rOutputDevice.DrawRect(aRectangle); - } - - if(getExtendedLines()) - { - const Point aEmptyPoint; - const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel()); - const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel)); - - // Left lines - rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Top()), aRectangle.TopLeft()); - rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Bottom()), aRectangle.BottomLeft()); - - // Right lines - rOutputDevice.DrawLine(aRectangle.TopRight(), Point(aVisibleLogic.Right(), aRectangle.Top())); - rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aVisibleLogic.Right(), aRectangle.Bottom())); - - // Top lines - rOutputDevice.DrawLine(Point(aRectangle.Left(), aVisibleLogic.Top()), aRectangle.TopLeft()); - rOutputDevice.DrawLine(Point(aRectangle.Right(), aVisibleLogic.Top()), aRectangle.TopRight()); - - // Bottom lines - rOutputDevice.DrawLine(aRectangle.BottomLeft(), Point(aRectangle.Left(), aVisibleLogic.Bottom())); - rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aRectangle.Right(), aVisibleLogic.Bottom())); - } - } - - OverlayRollingRectangle::OverlayRollingRectangle( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - Color aLineColor, - sal_Bool bExtendedLines, - sal_Bool bShowBounds) - : OverlayRollingRectangleStriped(rBasePos, rSecondPos, bExtendedLines, bShowBounds) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aLineColor; - } - - OverlayRollingRectangle::~OverlayRollingRectangle() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaysdrobject.cxx b/svx/source/sdr/overlay/overlaysdrobject.cxx deleted file mode 100644 index 7f1dbf2d5a4f..000000000000 --- a/svx/source/sdr/overlay/overlaysdrobject.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* - * - * 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: overlaysdrobject.cxx,v $ - * $Revision: 1.7 $ - * - * 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/overlaysdrobject.hxx> -#include <svx/svdobj.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlaySdrObject::drawGeometry(OutputDevice& rOutputDevice) - { - mrSdrObject.SingleObjectPainter(rOutputDevice); - } - - void OverlaySdrObject::createBaseRange(OutputDevice& /*rOutputDevice*/) - { - // reset range and expand it - maBaseRange.reset(); - - // get BoundRect - Rectangle aBoundRect(mrSdrObject.GetCurrentBoundRect()); - const basegfx::B2DPoint aTopLeft(aBoundRect.Left(), aBoundRect.Top()); - const basegfx::B2DPoint aBottomRight(aBoundRect.Right(), aBoundRect.Bottom()); - - maBaseRange.expand(aTopLeft); - maBaseRange.expand(aBottomRight); - } - - OverlaySdrObject::OverlaySdrObject( - const basegfx::B2DPoint& rBasePos, - const SdrObject& rObject) - : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)), - mrSdrObject(rObject) - { - } - - OverlaySdrObject::~OverlaySdrObject() - { - } - - sal_Bool OverlaySdrObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - Point aPnt( (long)rPos.getX(), (long)rPos.getY() ); - return mrSdrObject.CheckHit(aPnt, (USHORT)fTol, 0) != 0 ? sal_True : sal_False; - } - - return sal_False; - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx new file mode 100644 index 000000000000..664c487c7e43 --- /dev/null +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -0,0 +1,498 @@ +/************************************************************************* + * + * 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: overlayobject.cxx,v $ + * $Revision: 1.6 $ + * + * 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/overlaytools.hxx> +#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + OverlayBitmapExPrimitive::OverlayBitmapExPrimitive( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rBasePosition, + sal_uInt16 nCenterX, + sal_uInt16 nCenterY) + : DiscreteMetricDependentPrimitive2D(), + maBitmapEx(rBitmapEx), + maBasePosition(rBasePosition), + mnCenterX(nCenterX), + mnCenterY(nCenterY) + {} + + Primitive2DSequence OverlayBitmapExPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + const Size aBitmapSize(getBitmapEx().GetSizePixel()); + + if(aBitmapSize.Width() && aBitmapSize.Height() && basegfx::fTools::more(getDiscreteUnit(), 0.0)) + { + // calculate back from internal bitmap's extreme coordinates (the edges) + // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(), + // the prepared one which expresses how many logic units form a discrete unit) + // for this step. This primitive is to be displayed always unscaled (in it's pixel size) + // and unrotated, more like a marker + const double fLeft(((0.0 - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX()); + const double fTop(((0.0 - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY()); + const double fRight((((aBitmapSize.getWidth() - 1.0) - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX()); + const double fBottom((((aBitmapSize.getHeight() - 1.0) - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY()); + + // create a BitmapPrimitive2D using those positions + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, fRight - fLeft); + aTransform.set(1, 1, fBottom - fTop); + aTransform.set(0, 2, fLeft); + aTransform.set(1, 2, fTop); + + const Primitive2DReference aPrimitive(new BitmapPrimitive2D(getBitmapEx(), aTransform)); + aRetval = Primitive2DSequence(&aPrimitive, 1); + } + + return aRetval; + } + + bool OverlayBitmapExPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) + { + const OverlayBitmapExPrimitive& rCompare = static_cast< const OverlayBitmapExPrimitive& >(rPrimitive); + + return (getBitmapEx() == rCompare.getBitmapEx() + && getBasePosition() == rCompare.getBasePosition() + && getCenterX() == rCompare.getCenterX() + && getCenterY() == rCompare.getCenterY()); + } + + return false; + } + + ImplPrimitrive2DIDBlock(OverlayBitmapExPrimitive, PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + OverlayCrosshairPrimitive::OverlayCrosshairPrimitive( + const basegfx::B2DPoint& rBasePosition, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength) + : ViewportDependentPrimitive2D(), + maBasePosition(rBasePosition), + maRGBColorA(rRGBColorA), + maRGBColorB(rRGBColorB), + mfDiscreteDashLength(fDiscreteDashLength) + {} + + Primitive2DSequence OverlayCrosshairPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // use the prepared Viewport information accessible using getViewport() + Primitive2DSequence aRetval; + + if(!getViewport().isEmpty()) + { + aRetval.realloc(2); + basegfx::B2DPolygon aPolygon; + + aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); + aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); + + aRetval[0] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aPolygon, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + aPolygon.clear(); + aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); + aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); + + aRetval[1] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aPolygon, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + } + + return aRetval; + } + + bool OverlayCrosshairPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(ViewportDependentPrimitive2D::operator==(rPrimitive)) + { + const OverlayCrosshairPrimitive& rCompare = static_cast< const OverlayCrosshairPrimitive& >(rPrimitive); + + return (getBasePosition() == rCompare.getBasePosition() + && getRGBColorA() == rCompare.getRGBColorA() + && getRGBColorB() == rCompare.getRGBColorB() + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); + } + + return false; + } + + ImplPrimitrive2DIDBlock(OverlayCrosshairPrimitive, PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + OverlayHatchRectanglePrimitive::OverlayHatchRectanglePrimitive( + const basegfx::B2DRange& rObjectRange, + double fDiscreteHatchDistance, + double fHatchRotation, + const basegfx::BColor& rHatchColor, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation) + : DiscreteMetricDependentPrimitive2D(), + maObjectRange(rObjectRange), + mfDiscreteHatchDistance(fDiscreteHatchDistance), + mfHatchRotation(fHatchRotation), + maHatchColor(rHatchColor), + mfDiscreteGrow(fDiscreteGrow), + mfDiscreteShrink(fDiscreteShrink), + mfRotation(fRotation) + {} + + Primitive2DSequence OverlayHatchRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(basegfx::fTools::more(getDiscreteUnit(), 0.0)) + { + basegfx::B2DRange aInnerRange(getObjectRange()); + basegfx::B2DRange aOuterRange(getObjectRange()); + basegfx::B2DPolyPolygon aHatchPolyPolygon; + + aOuterRange.grow(getDiscreteUnit() * getDiscreteGrow()); + aInnerRange.grow(getDiscreteUnit() * -getDiscreteShrink()); + + aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aOuterRange)); + + if(!aInnerRange.isEmpty()) + { + aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aInnerRange)); + } + + if(!basegfx::fTools::equalZero(getRotation())) + { + basegfx::B2DHomMatrix aTransform; + + aTransform.translate(-getObjectRange().getMinX(), -getObjectRange().getMinY()); + aTransform.rotate(getRotation()); + aTransform.translate(getObjectRange().getMinX(), getObjectRange().getMinY()); + + aHatchPolyPolygon.transform(aTransform); + } + + const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0); + const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute( + drawinglayer::attribute::HATCHSTYLE_SINGLE, + getDiscreteHatchDistance() * getDiscreteUnit(), + getHatchRotation() - getRotation(), + getHatchColor(), + false); + const Primitive2DReference aPrimitive( + new PolyPolygonHatchPrimitive2D( + aHatchPolyPolygon, + aEmptyColor, + aFillHatchAttribute)); + + aRetval = Primitive2DSequence(&aPrimitive, 1); + } + + return aRetval; + } + + bool OverlayHatchRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) + { + const OverlayHatchRectanglePrimitive& rCompare = static_cast< const OverlayHatchRectanglePrimitive& >(rPrimitive); + + return (getObjectRange() == rCompare.getObjectRange() + && getDiscreteHatchDistance() == rCompare.getDiscreteHatchDistance() + && getHatchRotation() == rCompare.getHatchRotation() + && getHatchColor() == rCompare.getHatchColor() + && getDiscreteGrow() == rCompare.getDiscreteGrow() + && getDiscreteShrink() == rCompare.getDiscreteShrink() + && getRotation() == rCompare.getRotation()); + } + + return false; + } + + ImplPrimitrive2DIDBlock(OverlayHatchRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + OverlayHelplineStripedPrimitive::OverlayHelplineStripedPrimitive( + const basegfx::B2DPoint& rBasePosition, + HelplineStyle eStyle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength) + : ViewportDependentPrimitive2D(), + maBasePosition(rBasePosition), + meStyle(eStyle), + maRGBColorA(rRGBColorA), + maRGBColorB(rRGBColorB), + mfDiscreteDashLength(fDiscreteDashLength) + {} + + Primitive2DSequence OverlayHelplineStripedPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + // use the prepared Viewport information accessible using getViewport() + Primitive2DSequence aRetval; + + if(!getViewport().isEmpty()) + { + switch(getStyle()) + { + case HELPLINESTYLE_VERTICAL : + { + aRetval.realloc(1); + basegfx::B2DPolygon aLine; + + aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); + aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); + + aRetval[0] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aLine, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + break; + } + + case HELPLINESTYLE_HORIZONTAL : + { + aRetval.realloc(1); + basegfx::B2DPolygon aLine; + + aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); + aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); + + aRetval[0] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aLine, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + break; + } + + default: // case HELPLINESTYLE_POINT : + { + const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); + aRetval.realloc(2); + basegfx::B2DPolygon aLineA, aLineB; + + aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit)); + aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit)); + + aRetval[0] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aLineA, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY())); + aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY())); + + aRetval[1] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aLineB, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + break; + } + } + } + + return aRetval; + } + + bool OverlayHelplineStripedPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(ViewportDependentPrimitive2D::operator==(rPrimitive)) + { + const OverlayHelplineStripedPrimitive& rCompare = static_cast< const OverlayHelplineStripedPrimitive& >(rPrimitive); + + return (getBasePosition() == rCompare.getBasePosition() + && getStyle() == rCompare.getStyle() + && getRGBColorA() == rCompare.getRGBColorA() + && getRGBColorB() == rCompare.getRGBColorB() + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); + } + + return false; + } + + ImplPrimitrive2DIDBlock(OverlayHelplineStripedPrimitive, PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + OverlayRollingRectanglePrimitive::OverlayRollingRectanglePrimitive( + const basegfx::B2DRange& aRollingRectangle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength) + : ViewportDependentPrimitive2D(), + maRollingRectangle(aRollingRectangle), + maRGBColorA(rRGBColorA), + maRGBColorB(rRGBColorB), + mfDiscreteDashLength(fDiscreteDashLength) + {} + + Primitive2DSequence OverlayRollingRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // use the prepared Viewport information accessible using getViewport() + Primitive2DSequence aRetval; + + if(!getViewport().isEmpty()) + { + basegfx::B2DPolygon aLine; + aRetval.realloc(8); + + // Left lines + aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY())); + aRetval[0] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + aLine.clear(); + aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY())); + aRetval[1] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + // Right lines + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY())); + aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY())); + aRetval[2] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY())); + aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY())); + aRetval[3] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + // Top lines + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY())); + aRetval[4] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY())); + aRetval[5] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + // Bottom lines + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY())); + aRetval[6] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + + aLine.clear(); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY())); + aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY())); + aRetval[7] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + } + + return aRetval; + } + + bool OverlayRollingRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(ViewportDependentPrimitive2D::operator==(rPrimitive)) + { + const OverlayRollingRectanglePrimitive& rCompare = static_cast< const OverlayRollingRectanglePrimitive& >(rPrimitive); + + return (getRollingRectangle() == rCompare.getRollingRectangle() + && getRGBColorA() == rCompare.getRGBColorA() + && getRGBColorB() == rCompare.getRGBColorB() + && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); + } + + return false; + } + + ImplPrimitrive2DIDBlock(OverlayRollingRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/overlay/overlaytriangle.cxx b/svx/source/sdr/overlay/overlaytriangle.cxx index 1d01ab24e388..74f23b8f845c 100644 --- a/svx/source/sdr/overlay/overlaytriangle.cxx +++ b/svx/source/sdr/overlay/overlaytriangle.cxx @@ -37,6 +37,9 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -44,7 +47,7 @@ namespace sdr { namespace overlay { - void OverlayTriangleStriped::drawGeometry(OutputDevice& rOutputDevice) + drawinglayer::primitive2d::Primitive2DSequence OverlayTriangle::createOverlayObjectPrimitive2DSequence() { basegfx::B2DPolygon aPolygon; @@ -53,33 +56,30 @@ namespace sdr aPolygon.append(getThirdPosition()); aPolygon.setClosed(true); - ImpDrawPolygonStriped(rOutputDevice, aPolygon); - } + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + getBaseColor().getBColor())); - void OverlayTriangleStriped::createBaseRange(OutputDevice& /*rOutputDevice*/) - { - // reset range and expand it - maBaseRange.reset(); - maBaseRange.expand(getBasePosition()); - maBaseRange.expand(getSecondPosition()); - maBaseRange.expand(getThirdPosition()); + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } - OverlayTriangleStriped::OverlayTriangleStriped( + OverlayTriangle::OverlayTriangle( const basegfx::B2DPoint& rBasePos, const basegfx::B2DPoint& rSecondPos, - const basegfx::B2DPoint& rThirdPos) - : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)), + const basegfx::B2DPoint& rThirdPos, + Color aTriangleColor) + : OverlayObjectWithBasePosition(rBasePos, aTriangleColor), maSecondPosition(rSecondPos), maThirdPosition(rThirdPos) { } - OverlayTriangleStriped::~OverlayTriangleStriped() + OverlayTriangle::~OverlayTriangle() { } - void OverlayTriangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew) + void OverlayTriangle::setSecondPosition(const basegfx::B2DPoint& rNew) { if(rNew != maSecondPosition) { @@ -91,7 +91,7 @@ namespace sdr } } - void OverlayTriangleStriped::setThirdPosition(const basegfx::B2DPoint& rNew) + void OverlayTriangle::setThirdPosition(const basegfx::B2DPoint& rNew) { if(rNew != maThirdPosition) { @@ -102,96 +102,6 @@ namespace sdr objectChange(); } } - - sal_Bool OverlayTriangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const - { - if(isHittable()) - { - // test with all lines and epsilon-range - if(basegfx::tools::isInEpsilonRange(getBasePosition(), getThirdPosition(), rPos, fTol)) - { - return sal_True; - } - else if(basegfx::tools::isInEpsilonRange(getSecondPosition(), getBasePosition(), rPos, fTol)) - { - return sal_True; - } - else if(basegfx::tools::isInEpsilonRange(getThirdPosition(), getSecondPosition(), rPos, fTol)) - { - return sal_True; - } - - // test if inside triangle - basegfx::B2DPolygon aTestPoly; - aTestPoly.append(getBasePosition()); - aTestPoly.append(getSecondPosition()); - aTestPoly.append(getThirdPosition()); - aTestPoly.setClosed(true); - - return basegfx::tools::isInside(aTestPoly, rPos); - } - - return sal_False; - } - - void OverlayTriangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix) - { - if(!rMatrix.isIdentity()) - { - // transform base position - OverlayObjectWithBasePosition::transform(rMatrix); - - // transform maSecondPosition - const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition(); - setSecondPosition(aNewSecondPosition); - - // transform maThirdPosition - const basegfx::B2DPoint aNewThirdPosition = rMatrix * getThirdPosition(); - setThirdPosition(aNewThirdPosition); - } - } - } // end of namespace overlay -} // end of namespace sdr - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - void OverlayTriangle::drawGeometry(OutputDevice& rOutputDevice) - { - Polygon aPolygon(4); - Point aPosition(FRound(getBasePosition().getX()), FRound(getBasePosition().getY())); - aPolygon[0] = aPolygon[3] = aPosition; - aPosition.X() = FRound(getSecondPosition().getX()); - aPosition.Y() = FRound(getSecondPosition().getY()); - aPolygon[1] = aPosition; - aPosition.X() = FRound(getThirdPosition().getX()); - aPosition.Y() = FRound(getThirdPosition().getY()); - aPolygon[2] = aPosition; - - rOutputDevice.SetLineColor(); - rOutputDevice.SetFillColor(getBaseColor()); - - rOutputDevice.DrawPolygon(aPolygon); - } - - OverlayTriangle::OverlayTriangle( - const basegfx::B2DPoint& rBasePos, - const basegfx::B2DPoint& rSecondPos, - const basegfx::B2DPoint& rThirdPos, - Color aTriangleColor) - : OverlayTriangleStriped(rBasePos, rSecondPos, rThirdPos) - { - // set base color here, OverlayCrosshairStriped constructor has set - // it to it's own default. - maBaseColor = aTriangleColor; - } - - OverlayTriangle::~OverlayTriangle() - { - } } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index a330362dddbc..0b8245b91060 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -591,10 +591,18 @@ namespace drawinglayer if(aBitmap.GetPrefMapMode() != aDestinationMapUnit) { - // #i96237# need to use LogicToLogic, source is not always pixels - aBitmap.SetPrefSize(Application::GetDefaultDevice()->LogicToLogic( - aBitmap.GetPrefSize(), aBitmap.GetPrefMapMode(), aDestinationMapUnit)); - aBitmap.SetPrefMapMode(aDestinationMapUnit); + // #i100360# for MAP_PIXEL, LogicToLogic will not work properly, + // so fallback to Application::GetDefaultDevice() + if(MAP_PIXEL == aBitmap.GetPrefMapMode().GetMapUnit()) + { + aBitmap.SetPrefSize(Application::GetDefaultDevice()->PixelToLogic( + aBitmap.GetPrefSize(), aDestinationMapUnit)); + } + else + { + aBitmap.SetPrefSize(OutputDevice::LogicToLogic( + aBitmap.GetPrefSize(), aBitmap.GetPrefMapMode(), aDestinationMapUnit)); + } } // get size @@ -665,7 +673,7 @@ namespace drawinglayer // when object has text and text is fontwork and hide contour is set for fontwork, force // line and fill style to empty - if(pText && pText->isFontwork() && pText->isHideContour()) + if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) { bFontworkHideContour = true; } @@ -730,7 +738,7 @@ namespace drawinglayer // when object has text and text is fontwork and hide contour is set for fontwork, force // line and fill style to empty - if(pText && pText->isFontwork() && pText->isHideContour()) + if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) { bFontworkHideContour = true; } @@ -1039,7 +1047,7 @@ namespace drawinglayer // when object has text and text is fontwork and hide contour is set for fontwork, force // fill style to empty - if(pText && pText->isFontwork() && pText->isHideContour()) + if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) { bFontworkHideContour = true; } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 4a27eb73de8e..366b934b5473 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -176,7 +176,7 @@ namespace drawinglayer bool bWordWrap) { ::basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform); - SdrTextPrimitive2D* pNew = 0L; + SdrTextPrimitive2D* pNew = 0; if(rText.isContour()) { @@ -206,20 +206,32 @@ namespace drawinglayer aScaledUnitPolyPolygon.transform(aScaleTransform); // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D( + &rText.getSdrText(), + rText.getOutlinerParaObject(), + aScaledUnitPolyPolygon, + rObjectTransform); } else { // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), rUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D( + &rText.getSdrText(), + rText.getOutlinerParaObject(), + rUnitPolyPolygon, + rObjectTransform); } } - else if(rText.isFontwork() && !rText.isScroll()) + else if(rText.getSdrFormTextAttribute()) { - // text on path, use scaled polygon. Not allowed when text scrolling is used. + // text on path, use scaled polygon ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon); + pNew = new SdrPathTextPrimitive2D( + &rText.getSdrText(), + rText.getOutlinerParaObject(), + aScaledPolyPolygon, + *rText.getSdrFormTextAttribute()); } else { @@ -267,12 +279,21 @@ namespace drawinglayer if(rText.isFitToSize()) { // streched text in range - pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform); + pNew = new SdrStretchTextPrimitive2D( + &rText.getSdrText(), + rText.getOutlinerParaObject(), + aAnchorTransform); } else // text in range { // build new primitive - pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); + pNew = new SdrBlockTextPrimitive2D( + &rText.getSdrText(), + rText.getOutlinerParaObject(), + aAnchorTransform, + rText.isScroll(), + bCellText, + bWordWrap); } } @@ -299,121 +320,124 @@ namespace drawinglayer return Primitive2DReference(pNew); } } - else if(rText.isScroll()) - { - // get scroll direction - const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); - const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection); - - // decompose to get separated values for the scroll box - ::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; - aSRT.shearX(fShearX); - aSRT.rotate(fRotate); - aSRT.translate(aTranslate.getX(), aTranslate.getY()); - ::basegfx::B2DHomMatrix aISRT(aSRT); - aISRT.invert(); - - // bring the primitive back to scaled only and get scaled range, create new clone for this - SdrTextPrimitive2D* pNew2 = pNew->createTransformedClone(aISRT); - OSL_ENSURE(pNew2, "createTextPrimitive: Could not create transformed clone of text primitive (!)"); - delete pNew; - pNew = pNew2; - - // create neutral geometry::ViewInformation2D for local range and decompose calls. This is okay - // since the decompose is view-independent - const uno::Sequence< beans::PropertyValue > xViewParameters; - geometry::ViewInformation2D aViewInformation2D(xViewParameters); - - // get range - 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()); - - if(bHorizontal) - { - aClipTopLeft.setY(aScaledRange.getMinY()); - aClipBottomRight.setY(aScaledRange.getMaxY()); - aLeft.translate(-aScaledRange.getMaxX(), 0.0); - aRight.translate(aScale.getX() - aScaledRange.getMinX(), 0.0); - } - else - { - aClipTopLeft.setX(aScaledRange.getMinX()); - aClipBottomRight.setX(aScaledRange.getMaxX()); - aLeft.translate(0.0, -aScaledRange.getMaxY()); - aRight.translate(0.0, aScale.getY() - aScaledRange.getMinY()); - } - - aLeft *= aSRT; - aRight *= aSRT; - - // prepare animation list - drawinglayer::animation::AnimationEntryList aAnimationList; - if(bHorizontal) - { - rText.getScrollTextTiming(aAnimationList, aScale.getX(), aScaledRange.getWidth()); - } - else + if(rText.isScroll()) + { + // suppress scroll when FontWork + if(!rText.getSdrFormTextAttribute()) { - rText.getScrollTextTiming(aAnimationList, aScale.getY(), aScaledRange.getHeight()); - } + // get scroll direction + const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); + const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection); - if(0.0 != aAnimationList.getDuration()) - { - // create a new Primitive2DSequence containing the animated text in it's scaled only state. - // use the decomposition to force to simple text primitives, those will no longer - // need the outliner for formatting (alternatively it is also possible to just add - // pNew to aNewPrimitiveSequence) - Primitive2DSequence aAnimSequence(pNew->get2DDecomposition(aViewInformation2D)); + // decompose to get separated values for the scroll box + ::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; + aSRT.shearX(fShearX); + aSRT.rotate(fRotate); + aSRT.translate(aTranslate.getX(), aTranslate.getY()); + ::basegfx::B2DHomMatrix aISRT(aSRT); + aISRT.invert(); + + // bring the primitive back to scaled only and get scaled range, create new clone for this + SdrTextPrimitive2D* pNew2 = pNew->createTransformedClone(aISRT); + OSL_ENSURE(pNew2, "createTextPrimitive: Could not create transformed clone of text primitive (!)"); delete pNew; + pNew = pNew2; + + // create neutral geometry::ViewInformation2D for local range and decompose calls. This is okay + // since the decompose is view-independent + const uno::Sequence< beans::PropertyValue > xViewParameters; + geometry::ViewInformation2D aViewInformation2D(xViewParameters); + + // get range + 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()); + + if(bHorizontal) + { + aClipTopLeft.setY(aScaledRange.getMinY()); + aClipBottomRight.setY(aScaledRange.getMaxY()); + aLeft.translate(-aScaledRange.getMaxX(), 0.0); + aRight.translate(aScale.getX() - aScaledRange.getMinX(), 0.0); + } + else + { + aClipTopLeft.setX(aScaledRange.getMinX()); + aClipBottomRight.setX(aScaledRange.getMaxX()); + aLeft.translate(0.0, -aScaledRange.getMaxY()); + aRight.translate(0.0, aScale.getY() - aScaledRange.getMinY()); + } + + aLeft *= aSRT; + aRight *= aSRT; + + // prepare animation list + drawinglayer::animation::AnimationEntryList aAnimationList; + + if(bHorizontal) + { + rText.getScrollTextTiming(aAnimationList, aScale.getX(), aScaledRange.getWidth()); + } + else + { + rText.getScrollTextTiming(aAnimationList, aScale.getY(), aScaledRange.getHeight()); + } + + if(0.0 != aAnimationList.getDuration()) + { + // create a new Primitive2DSequence containing the animated text in it's scaled only state. + // use the decomposition to force to simple text primitives, those will no longer + // need the outliner for formatting (alternatively it is also possible to just add + // pNew to aNewPrimitiveSequence) + Primitive2DSequence aAnimSequence(pNew->get2DDecomposition(aViewInformation2D)); + delete pNew; + + // create a new animatedInterpolatePrimitive and add it + std::vector< basegfx::B2DHomMatrix > aMatrixStack; + aMatrixStack.push_back(aLeft); + aMatrixStack.push_back(aRight); + const Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D(aMatrixStack, aAnimationList, aAnimSequence, true)); + const Primitive2DSequence aContent(&xRefA, 1L); + + // scrolling needs an encapsulating clipping primitive + const ::basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight); + ::basegfx::B2DPolygon aClipPolygon(::basegfx::tools::createPolygonFromRect(aClipRange)); + aClipPolygon.transform(aSRT); + return Primitive2DReference(new MaskPrimitive2D(::basegfx::B2DPolyPolygon(aClipPolygon), aContent)); + } + else + { + // add to decomposition + return Primitive2DReference(pNew); + } + } + } - // create a new animatedInterpolatePrimitive and add it - std::vector< basegfx::B2DHomMatrix > aMatrixStack; - aMatrixStack.push_back(aLeft); - aMatrixStack.push_back(aRight); - const Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D(aMatrixStack, aAnimationList, aAnimSequence, true)); - const Primitive2DSequence aContent(&xRefA, 1L); + if(rText.isInEditMode()) + { + // #i97628# + // encapsulate with TextHierarchyEditPrimitive2D to allow renderers + // to suppress actively edited content if needed + const Primitive2DReference xRefA(pNew); + const Primitive2DSequence aContent(&xRefA, 1L); - // scrolling needs an encapsulating clipping primitive - const ::basegfx::B2DRange aClipRange(aClipTopLeft, aClipBottomRight); - ::basegfx::B2DPolygon aClipPolygon(::basegfx::tools::createPolygonFromRect(aClipRange)); - aClipPolygon.transform(aSRT); - return Primitive2DReference(new MaskPrimitive2D(::basegfx::B2DPolyPolygon(aClipPolygon), aContent)); - } - else - { - // add to decomposition - return Primitive2DReference(pNew); - } + // create and add TextHierarchyEditPrimitive2D primitive + return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent)); } else { - if(rText.isInEditMode()) - { - // #i97628# - // encapsulate with TextHierarchyEditPrimitive2D to allow renderers - // to suppress actively edited content if needed - const Primitive2DReference xRefA(pNew); - const Primitive2DSequence aContent(&xRefA, 1L); - - // create and add TextHierarchyEditPrimitive2D primitive - return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent)); - } - else - { - // add to decomposition - return Primitive2DReference(pNew); - } + // add to decomposition + return Primitive2DReference(pNew); } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 7f9b47afb2d4..8d66e8b34d14 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -125,8 +125,13 @@ namespace drawinglayer } // create primitive and get text range - pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(), - aTextMatrix, pTextAttribute->isScroll(), false, false); + pBlockText = new SdrBlockTextPrimitive2D( + &pTextAttribute->getSdrText(), + pTextAttribute->getOutlinerParaObject(), + aTextMatrix, + pTextAttribute->isScroll(), + false, + false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 113cd226d8ba..0cad266f69d1 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -41,6 +41,9 @@ #include <drawinglayer/geometry/viewinformation2d.hxx> #include <unoapi.hxx> #include <svx/svdpage.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdoutl.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> ////////////////////////////////////////////////////////////////////////////// @@ -48,6 +51,46 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// +namespace +{ + sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage) + { + sal_Int16 nRetval(0); + uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY); + + if (xSet.is()) + { + try + { + const uno::Any aNumber(xSet->getPropertyValue(::rtl::OUString::createFromAscii("Number"))); + aNumber >>= nRetval; + } + catch(const uno::Exception&) + { + OSL_ASSERT(false); + } + } + + return nRetval; + } + + sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage) + { + sal_Int16 nRetval(0); + SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage); + + if(pPage && pPage->GetModel()) + { + const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount()); + nRetval = ((sal_Int16)nPageCount - 1) / 2; + } + + return nRetval; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + namespace drawinglayer { namespace primitive2d @@ -64,20 +107,28 @@ namespace drawinglayer } SdrTextPrimitive2D::SdrTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject) : BasePrimitive2D(), - mrSdrText(rSdrText), + mrSdrText(const_cast< SdrText* >(pSdrText)), maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), + mnLastPageNumber(0), + mnLastPageCount(0), + maLastTextBackgroundColor(), mbLastSpellCheck(false), - mbContainsPageField(false) + mbContainsPageField(false), + mbContainsPageCountField(false), + mbContainsOtherFields(false) { const EditTextObject& rETO = maOutlinerParaObject.GetTextObject(); - mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) - || rETO.HasField(SvxHeaderField::StaticType()) - || rETO.HasField(SvxFooterField::StaticType()) - || rETO.HasField(SvxDateTimeField::StaticType()); +
+ mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
+ mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
+ mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
+ || rETO.HasField(SvxFooterField::StaticType())
+ || rETO.HasField(SvxDateTimeField::StaticType())
+ || rETO.HasField(SvxAuthorField::StaticType());
} bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const @@ -94,21 +145,66 @@ namespace drawinglayer Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - const bool bCurrentSpellCheck(getSdrText().GetObject().impCheckSpellCheckForDecomposeTextPrimitive()); + const bool bCurrentSpellCheck(getSdrText() + ? getSdrText()->GetObject().impCheckSpellCheckForDecomposeTextPrimitive() + : false); uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage; + bool bCurrentlyVisualizingPageIsSet(false); + Color aNewTextBackgroundColor; + bool bNewTextBackgroundColorIsSet(false); + sal_Int16 nCurrentlyValidPageNumber(0); + sal_Int16 nCurrentlyValidPageCount(0); if(getLocalDecomposition().hasElements()) { bool bDoDelete(getLastSpellCheck() != bCurrentSpellCheck); - if(!bDoDelete && mbContainsPageField) + // check visualized page + if(!bDoDelete && (mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields)) { + // get visualized page and remember xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage(); + bCurrentlyVisualizingPageIsSet = true; if(xCurrentlyVisualizingPage != mxLastVisualizingPage) { bDoDelete = true; } + + // #i98870# check visualized PageNumber + if(!bDoDelete && mbContainsPageField) + { + nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage); + + if(nCurrentlyValidPageNumber != mnLastPageNumber) + { + bDoDelete = true; + } + } + + // #i98870# check visualized PageCount, too + if(!bDoDelete && mbContainsPageCountField) + { + nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage); + + if(nCurrentlyValidPageCount != mnLastPageCount) + { + bDoDelete = true; + } + } + } + + // #i101443# check change of TextBackgroundolor + if(!bDoDelete && getSdrText() && getSdrText()->GetModel()) + { + SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0); + aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); + bNewTextBackgroundColorIsSet = true; + + if(aNewTextBackgroundColor != maLastTextBackgroundColor) + { + bDoDelete = true; + } } if(bDoDelete) @@ -119,8 +215,32 @@ namespace drawinglayer if(!getLocalDecomposition().hasElements()) { + if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField) + { + xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage(); + } + + if(!nCurrentlyValidPageNumber && mbContainsPageField) + { + nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage); + } + + if(!nCurrentlyValidPageCount && mbContainsPageCountField) + { + nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage); + } + + if(!bNewTextBackgroundColorIsSet && getSdrText() && getSdrText()->GetModel()) + { + SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0); + aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); + } + const_cast< SdrTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage; + const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber; + const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount; + const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor; } // call parent @@ -138,7 +258,9 @@ namespace drawinglayer Primitive2DSequence SdrContourTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation)); + const bool bCurrentSpellCheck(getSdrText() + ? getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation) + : false); if(getLastSpellCheck() != bCurrentSpellCheck) { @@ -150,11 +272,11 @@ namespace drawinglayer } SdrContourTextPrimitive2D::SdrContourTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform) - : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform) + : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), maUnitPolyPolygon(rUnitPolyPolygon), maObjectTransform(rObjectTransform) { @@ -166,16 +288,20 @@ namespace drawinglayer { const SdrContourTextPrimitive2D& rCompare = (SdrContourTextPrimitive2D&)rPrimitive; - return (maUnitPolyPolygon == rCompare.maUnitPolyPolygon - && maObjectTransform == rCompare.maObjectTransform); + return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon() + && getObjectTransform() == rCompare.getObjectTransform()); } return false; } - SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const + SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const { - return new SdrContourTextPrimitive2D(getSdrText(), getOutlinerParaObject(), maUnitPolyPolygon, rTransform * maObjectTransform); + return new SdrContourTextPrimitive2D( + getSdrText(), + getOutlinerParaObject(), + getUnitPolyPolygon(), + rTransform * getObjectTransform()); } // provide unique ID @@ -193,7 +319,9 @@ namespace drawinglayer Primitive2DSequence SdrPathTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation)); + const bool bCurrentSpellCheck(getSdrText() + ? getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation) + : false); if(getLastSpellCheck() != bCurrentSpellCheck) { @@ -205,11 +333,13 @@ namespace drawinglayer } SdrPathTextPrimitive2D::SdrPathTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, - const ::basegfx::B2DPolyPolygon& rPathPolyPolygon) - : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), - maPathPolyPolygon(rPathPolyPolygon) + const basegfx::B2DPolyPolygon& rPathPolyPolygon, + const attribute::SdrFormTextAttribute& rSdrFormTextAttribute) + : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), + maPathPolyPolygon(rPathPolyPolygon), + maSdrFormTextAttribute(rSdrFormTextAttribute) { } @@ -219,17 +349,23 @@ namespace drawinglayer { const SdrPathTextPrimitive2D& rCompare = (SdrPathTextPrimitive2D&)rPrimitive; - return (maPathPolyPolygon == rCompare.maPathPolyPolygon); + return (getPathPolyPolygon() == rCompare.getPathPolyPolygon() + && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute()); } return false; } - SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const + SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const { - ::basegfx::B2DPolyPolygon aNewPolyPolygon(maPathPolyPolygon); + basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon()); aNewPolyPolygon.transform(rTransform); - return new SdrPathTextPrimitive2D(getSdrText(), getOutlinerParaObject(), aNewPolyPolygon); + + return new SdrPathTextPrimitive2D( + getSdrText(), + getOutlinerParaObject(), + aNewPolyPolygon, + getSdrFormTextAttribute()); } // provide unique ID @@ -247,7 +383,9 @@ namespace drawinglayer Primitive2DSequence SdrBlockTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation)); + const bool bCurrentSpellCheck(getSdrText() + ? getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation) + : false); if(getLastSpellCheck() != bCurrentSpellCheck) { @@ -259,13 +397,13 @@ namespace drawinglayer } SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, - const ::basegfx::B2DHomMatrix& rTextRangeTransform, + const basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, bool bWordWrap) - : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), + : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), @@ -288,9 +426,15 @@ namespace drawinglayer return false; } - SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const + SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const { - return new SdrBlockTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); + return new SdrBlockTextPrimitive2D( + getSdrText(), + getOutlinerParaObject(), + rTransform * getTextRangeTransform(), + getUnlimitedPage(), + getCellText(), + getWordWrap()); } // provide unique ID @@ -308,7 +452,9 @@ namespace drawinglayer Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation)); + const bool bCurrentSpellCheck(getSdrText() + ? getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation) + : false); if(getLastSpellCheck() != bCurrentSpellCheck) { @@ -320,10 +466,10 @@ namespace drawinglayer } SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( - const SdrText& rSdrText, + const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, - const ::basegfx::B2DHomMatrix& rTextRangeTransform) - : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), + const basegfx::B2DHomMatrix& rTextRangeTransform) + : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform) { } @@ -334,15 +480,18 @@ namespace drawinglayer { const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive; - return (maTextRangeTransform == rCompare.maTextRangeTransform); + return (getTextRangeTransform() == rCompare.getTextRangeTransform()); } return false; } - SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const + SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const { - return new SdrStretchTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * maTextRangeTransform); + return new SdrStretchTextPrimitive2D( + getSdrText(), + getOutlinerParaObject(), + rTransform * getTextRangeTransform()); } // provide unique ID diff --git a/svx/source/svdraw/makefile.mk b/svx/source/svdraw/makefile.mk index 0ac4b70130e6..28eeb84e29d1 100644 --- a/svx/source/svdraw/makefile.mk +++ b/svx/source/svdraw/makefile.mk @@ -91,6 +91,7 @@ SLOFILES=\ $(SLO)$/svdedtv2.obj \ $(SLO)$/svdedxv.obj \ $(SLO)$/svdetc.obj \ + $(SLO)$/sdrhittesthelper.obj \ $(SLO)$/svdfmtf.obj \ $(SLO)$/svdglev.obj \ $(SLO)$/svdglue.obj \ @@ -106,9 +107,7 @@ SLOFILES=\ $(SLO)$/sdrpaintwindow.obj \ $(SLO)$/svdpoev.obj \ $(SLO)$/svdscrol.obj \ - $(SLO)$/svdtouch.obj \ $(SLO)$/svdtrans.obj \ - $(SLO)$/svdtxhdl.obj \ $(SLO)$/svdundo.obj \ $(SLO)$/svdviter.obj \ $(SLO)$/clonelist.obj \ diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx new file mode 100644 index 000000000000..3b613f42e6ef --- /dev/null +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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: svdetc.cxx,v $ + * $Revision: 1.35.18.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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/sdrhittesthelper.hxx> +#include <svx/obj3d.hxx> +#include <svx/helperhittest3d.hxx> +#include <svx/sdrpagewindow.hxx> +#include <svx/sdr/contact/viewobjectcontact.hxx> +#include <svx/sdr/contact/displayinfo.hxx> +#include <svx/sdr/contact/objectcontact.hxx> +#include <drawinglayer/processor2d/hittestprocessor2d.hxx> +#include <svx/svdpagv.hxx> +#include <svx/sdr/contact/viewcontact.hxx> + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// #i101872# new Object HitTest as View-tooling + +SdrObject* SdrObjectPrimitiveHit( + const SdrObject& rObject, + const Point& rPnt, + sal_uInt16 nTol, + const SdrPageView& rSdrPageView, + const SetOfByte* pVisiLayer, + bool bTextOnly) +{ + SdrObject* pResult = 0; + + if(rObject.GetSubList() && rObject.GetSubList()->GetObjCount()) + { + // group or scene with content. Single 3D objects also have a + // true == rObject.GetSubList(), but no content + pResult = SdrObjListPrimitiveHit(*rObject.GetSubList(), rPnt, nTol, rSdrPageView, pVisiLayer, bTextOnly); + } + else + { + if(!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer())) + { + // single object, 3d object, empty scene or empty group. Check if + // it's a single 3D object + const E3dCompoundObject* pE3dCompoundObject = dynamic_cast< const E3dCompoundObject* >(&rObject); + + if(pE3dCompoundObject) + { + const basegfx::B2DPoint aHitPosition(rPnt.X(), rPnt.Y()); + + if(checkHitSingle3DObject(aHitPosition, *pE3dCompoundObject)) + { + pResult = const_cast< E3dCompoundObject* >(pE3dCompoundObject); + } + } + else + { + // not a single 3D object; Check in first PageWindow using prmitives (only SC + // with split views uses multiple PageWindows nowadays) + if(rSdrPageView.PageWindowCount()) + { + const double fLogicTolerance(nTol); + const basegfx::B2DPoint aHitPosition(rPnt.X(), rPnt.Y()); + const sdr::contact::ViewObjectContact& rVOC = rObject.GetViewContact().GetViewObjectContact( + rSdrPageView.GetPageWindow(0)->GetObjectContact()); + + if(ViewObjectContactPrimitiveHit(rVOC, aHitPosition, fLogicTolerance, bTextOnly)) + { + pResult = const_cast< SdrObject* >(&rObject); + } + } + } + } + } + + return pResult; +} + +///////////////////////////////////////////////////////////////////// + +SdrObject* SdrObjListPrimitiveHit( + const SdrObjList& rList, + const Point& rPnt, + sal_uInt16 nTol, + const SdrPageView& rSdrPageView, + const SetOfByte* pVisiLayer, + bool bTextOnly) +{ + sal_uInt32 nObjNum(rList.GetObjCount()); + SdrObject* pRetval = 0; + + while(!pRetval && nObjNum > 0) + { + nObjNum--; + SdrObject* pObj = rList.GetObj(nObjNum); + + pRetval = SdrObjectPrimitiveHit(*pObj, rPnt, nTol, rSdrPageView, pVisiLayer, bTextOnly); + } + + return pRetval; +} + +///////////////////////////////////////////////////////////////////// + +bool ViewObjectContactPrimitiveHit( + const sdr::contact::ViewObjectContact& rVOC, + const basegfx::B2DPoint& rHitPosition, + double fLogicHitTolerance, + bool bTextOnly) +{ + basegfx::B2DRange aObjectRange(rVOC.getObjectRange()); + + if(!aObjectRange.isEmpty()) + { + // first do a rough B2DRange based HitTest; do not forget to + // include the HitTolerance if given + if(basegfx::fTools::more(fLogicHitTolerance, 0.0)) + { + aObjectRange.grow(fLogicHitTolerance); + } + + if(aObjectRange.isInside(rHitPosition)) + { + // get primitive sequence + sdr::contact::DisplayInfo aDisplayInfo; + const drawinglayer::primitive2d::Primitive2DSequence& rSequence(rVOC.getPrimitive2DSequence(aDisplayInfo)); + + if(rSequence.hasElements()) + { + // create a HitTest processor + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D = rVOC.GetObjectContact().getViewInformation2D(); + drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D( + rViewInformation2D, + rHitPosition, + fLogicHitTolerance, + bTextOnly); + + // feed it with the primitives + aHitTestProcessor2D.process(rSequence); + + // deliver result + return aHitTestProcessor2D.getHit(); + } + } + } + + return false; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index fcf824c82921..5197b870919f 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -116,8 +116,9 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) // When the buffer usage has changed then we have to create a new // overlay manager. Save the current one so that later we can move its // overlay objects to the new one. - ::sdr::overlay::OverlayManager* pOldOverlayManager = NULL; - if (mbUseBuffer != bUseBuffer) + sdr::overlay::OverlayManager* pOldOverlayManager = NULL; + + if(mbUseBuffer != bUseBuffer) { mbUseBuffer = bUseBuffer; pOldOverlayManager = mpOverlayManager; @@ -134,15 +135,19 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) if(GetPaintView().IsBufferedOverlayAllowed() && mbUseBuffer) { // buffered OverlayManager, buffers it's background and refreshes from there - // for pure overlay changes (no system redraw). The 2nd parameter specifies + // for pure overlay changes (no system redraw). The 3rd parameter specifies // if that refresh itself will use a 2nd vdev to avoid flickering. - mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), sal_True); + // Also hand over the evtl. existing old OverlayManager; this means to take over + // the registered OverlayObjects from it + mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), pOldOverlayManager, true); } else { // unbuffered OverlayManager, just invalidates places where changes // take place - mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice()); + // Also hand over the evtl. existing old OverlayManager; this means to take over + // the registered OverlayObjects from it + mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice(), pOldOverlayManager); } OSL_ENSURE(mpOverlayManager, "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)"); @@ -169,33 +174,10 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) } } - // Because we can not notify the creators of the overlay objects that - // belong to the old overlay manager we have to move these objects from - // the old to the new overlay manager and hope for the best (ie that the - // owner of the overlay objects did not store a pointer to the overlay - // manager but asks the view for the current one.) - if (pOldOverlayManager != NULL) + // OverlayObjects are transfered for the evtl. newly created OverlayManager by handing over + // at construction time + if(pOldOverlayManager) { - if (mpOverlayManager != NULL) - { - // Get a list of all overlay objects added to the old overlay - // manager. This list is not modified when overlay objects are - // moved from one overlay manager to the other so its save to - // iterate over it. - ::boost::shared_ptr<sdr::overlay::OverlayObjectVector> pOverlayObjects ( - pOldOverlayManager->GetOverlayObjects()); - // Iterate over the list of overlay objects and move, not copy, - // them from the old to the new overlay manager. - sdr::overlay::OverlayObjectVector::iterator iOverlay; - for (iOverlay=pOverlayObjects->begin(); iOverlay!=pOverlayObjects->end(); ++iOverlay) - { - if (*iOverlay != NULL) - { - pOldOverlayManager->remove(**iOverlay); - mpOverlayManager->add(**iOverlay); - } - } - } // The old overlay manager is not used anymore and can be (has to be) deleted. delete pOldOverlayManager; } diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index ebd596ac972d..6845ce6bb619 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -41,28 +41,19 @@ #include <svx/svdetc.hxx> #include <svx/scene3d.hxx> #include <svx/view3d.hxx> - -// #116425# #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> - -// #116425# #include <svx/sdr/contact/displayinfo.hxx> #include <svx/svdouno.hxx> - #define XOR_CREATE_PEN PEN_SOLID #include <svx/svdopath.hxx> - -//////////////////////////////////////////////////////////////////////////////////////////////////// #include <svx/sdr/overlay/overlaypolypolygon.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> -#include <svx/sdr/overlay/overlaysdrobject.hxx> #include <sdrpaintwindow.hxx> - -// #i72535# #include "fmobj.hxx" - -// #i68562# #include <svx/svdocirc.hxx> +#include <svx/sdr/contact/viewcontact.hxx> +#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -172,7 +163,10 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, { if(pObject) { - ::sdr::overlay::OverlaySdrObject* pNew = new ::sdr::overlay::OverlaySdrObject(basegfx::B2DPoint(), *pObject); + const sdr::contact::ViewContact& rVC = pObject->GetViewContact(); + const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence(); + sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); + pOverlayManager->add(*pNew); maObjects.append(*pNew); } @@ -869,6 +863,18 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/) { mpCreateViewExtraData->CreateAndShowOverlay(*this, 0, pAktCreate->TakeCreatePoly(aDragStat)); } + + // #i101679# Force changed overlay to be shown + for(sal_uInt32 a(0); a < PaintWindowCount(); a++) + { + SdrPaintWindow* pCandidate = GetPaintWindow(a); + sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); + + if(pOverlayManager) + { + pOverlayManager->flush(); + } + } } aDragStat.SetShown(TRUE); diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index bbc31b803096..e427e42d80ab 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -2551,7 +2551,7 @@ bool SdrDragGradient::BeginSdrDrag() { basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y()); - if(pColHdl->getOverlayObjectList().isHit(aPosition)) + if(pColHdl->getOverlayObjectList().isHitLogic(aPosition)) { bHit = true; pIAOHandle->SetMoveSingleHandle(true); @@ -2566,7 +2566,7 @@ bool SdrDragGradient::BeginSdrDrag() { basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y()); - if(pColHdl->getOverlayObjectList().isHit(aPosition)) + if(pColHdl->getOverlayObjectList().isHitLogic(aPosition)) { bHit = true; pIAOHandle->SetMoveSingleHandle(true); @@ -2578,7 +2578,7 @@ bool SdrDragGradient::BeginSdrDrag() { basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y()); - if(pIAOHandle->getOverlayObjectList().isHit(aPosition)) + if(pIAOHandle->getOverlayObjectList().isHitLogic(aPosition)) { bHit = true; } diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 4dfc001ed6fc..69459b1bff35 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -51,6 +51,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <svx/polypolygoneditor.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> using namespace sdr; @@ -844,6 +845,9 @@ void SdrDragView::ShowDragObj() if(pOverlayManager) { mpCurrentSdrDragMethod->CreateOverlayGeometry(*pOverlayManager); + + // #i101679# Force changed overlay to be shown + pOverlayManager->flush(); } } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 75ce75240a6f..901bc0e7e5b6 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -246,7 +246,7 @@ void SdrObjEditView::ModelHasChanged() eNewAnchor=(EVAnchorMode)pTextObj->GetOutlinerViewAnchorMode(); bAnchorChg=eOldAnchor!=eNewAnchor; Color aOldColor(pTextEditOutlinerView->GetBackgroundColor()); - aNewColor=ImpGetTextEditBackgroundColor(); + aNewColor = GetTextEditBackgroundColor(*this); bColorChg=aOldColor!=aNewColor; } // #104082# refresh always when it's a contour frame. That @@ -425,52 +425,10 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const } } -Color SdrObjEditView::ImpGetTextEditBackgroundColor() const -{ - // #108759# Extracted significant parts to SdrPaintView::CalcBackgroundColor() - svtools::ColorConfig aColorConfig; - Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if(!rStyleSettings.GetHighContrastMode()) - { - bool bFound=false; - SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get()); - if (pText!=NULL && pText->IsClosedObj()) - { - ::sdr::table::SdrTableObj* pTable = dynamic_cast< ::sdr::table::SdrTableObj * >( pText ); - if( pTable ) - bFound = GetDraftFillColor(pTable->GetActiveCellItemSet(), aBackground ); - - if( !bFound ) - bFound=GetDraftFillColor(pText->GetMergedItemSet(), aBackground); - } - if (!bFound && pTextEditPV!=NULL && pText) - { - // #108784# - Point aPvOfs(pText->GetTextEditOffset()); - - const SdrPage* pPg=pTextEditPV->GetPage(); - - // #112690# - // Test existance of the page before using CalcBackgroundColor - if(pPg) - { - Rectangle aSnapRect( pText->GetSnapRect() ); - aSnapRect.Move(aPvOfs.X(), aPvOfs.Y()); - - return CalcBackgroundColor( aSnapRect, pTextEditPV->GetVisibleLayers(), *pPg ); - } - } - } - - return aBackground; -} - OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, BOOL /*bNoPaint*/, OutlinerView* pGivenView) const { // Hintergrund - Color aBackground(ImpGetTextEditBackgroundColor()); + Color aBackground(GetTextEditBackgroundColor(*this)); SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() ); BOOL bTextFrame=pText!=NULL && pText->IsTextFrame(); BOOL bContourFrame=pText!=NULL && pText->IsContourTextFrame(); diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 7e2b04591d3f..bd6bf457bdbf 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -31,10 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include "forbiddencharacterstable.hxx" - #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/EmbedStates.hpp> - #include <svx/svdetc.hxx> #include "svditext.hxx" #include <svx/svdmodel.hxx> @@ -68,15 +66,14 @@ #include <i18npool/lang.h> #include <unotools/charclass.hxx> #include <svtools/syslocale.hxx> - -// #97870# #include <svx/xflbckit.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> #include <vcl/svapp.hxx> //add CHINA001 - -//#i80528# #include <svx/sdr/contact/viewcontact.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdotable.hxx> +#include <svx/sdrhittesthelper.hxx> using namespace ::com::sun::star; @@ -847,6 +844,258 @@ void SvdProgressInfo::ReportError() } //////////////////////////////////////////////////////////////////////////////////////////////////// +// #i101872# isolate GetTextEditBackgroundColor to tooling; it woll anyways only be used as long +// as text edit is not running on overlay + +namespace +{ + bool impGetSdrObjListFillColor( + const SdrObjList& rList, + const Point& rPnt, + const SdrPageView& rTextEditPV, + const SetOfByte& rVisLayers, + Color& rCol) + { + if(!rList.GetModel()) + return false; + + bool bRet(false); + bool bMaster(rList.GetPage() ? rList.GetPage()->IsMasterPage() : false); + + for(ULONG no(rList.GetObjCount()); !bRet && no > 0; ) + { + no--; + SdrObject* pObj = rList.GetObj(no); + SdrObjList* pOL = pObj->GetSubList(); + + if(pOL) + { + // group object + bRet = impGetSdrObjListFillColor(*pOL, rPnt, rTextEditPV, rVisLayers, rCol); + } + else + { + SdrTextObj* pText = dynamic_cast< SdrTextObj * >(pObj); + + // #108867# Exclude zero master page object (i.e. background shape) from color query + if(pText + && pObj->IsClosedObj() + && (!bMaster || (!pObj->IsNotVisibleAsMaster() && 0 != no)) + && pObj->GetCurrentBoundRect().IsInside(rPnt) + && !pText->IsHideContour() + && SdrObjectPrimitiveHit(*pObj, rPnt, 0, rTextEditPV, &rVisLayers, false)) + { + bRet = GetDraftFillColor(pObj->GetMergedItemSet(), rCol); + } + } + } + + return bRet; + } + + bool impGetSdrPageFillColor( + const SdrPage& rPage, + const Point& rPnt, + const SdrPageView& rTextEditPV, + const SetOfByte& rVisLayers, + Color& rCol, + bool bSkipBackgroundShape) + { + if(!rPage.GetModel()) + return false; + + bool bRet(impGetSdrObjListFillColor(rPage, rPnt, rTextEditPV, rVisLayers, rCol)); + + if(!bRet && !rPage.IsMasterPage()) + { + if(rPage.TRG_HasMasterPage()) + { + SetOfByte aSet(rVisLayers); + aSet &= rPage.TRG_GetMasterPageVisibleLayers(); + SdrPage& rMasterPage = rPage.TRG_GetMasterPage(); + + // #108867# Don't fall back to background shape on + // master pages. This is later handled by + // GetBackgroundColor, and is necessary to cater for + // the silly ordering: 1. shapes, 2. master page + // shapes, 3. page background, 4. master page + // background. + bRet = impGetSdrPageFillColor(rMasterPage, rPnt, rTextEditPV, aSet, rCol, true); + } + } + + // #108867# Only now determine background color from background shapes + if(!bRet && !bSkipBackgroundShape) + { + rCol = rPage.GetPageBackgroundColor(); + return true; + } + + return bRet; + } + + Color impCalcBackgroundColor( + const Rectangle& rArea, + const SdrPageView& rTextEditPV, + const SdrPage& rPage) + { + svtools::ColorConfig aColorConfig; + Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if(!rStyleSettings.GetHighContrastMode()) + { + // search in page + const USHORT SPOTCOUNT(5); + Point aSpotPos[SPOTCOUNT]; + Color aSpotColor[SPOTCOUNT]; + ULONG nHeight( rArea.GetSize().Height() ); + ULONG nWidth( rArea.GetSize().Width() ); + ULONG nWidth14 = nWidth / 4; + ULONG nHeight14 = nHeight / 4; + ULONG nWidth34 = ( 3 * nWidth ) / 4; + ULONG nHeight34 = ( 3 * nHeight ) / 4; + + USHORT i; + for ( i = 0; i < SPOTCOUNT; i++ ) + { + // five spots are used + switch ( i ) + { + case 0 : + { + // Center-Spot + aSpotPos[i] = rArea.Center(); + } + break; + + case 1 : + { + // TopLeft-Spot + aSpotPos[i] = rArea.TopLeft(); + aSpotPos[i].X() += nWidth14; + aSpotPos[i].Y() += nHeight14; + } + break; + + case 2 : + { + // TopRight-Spot + aSpotPos[i] = rArea.TopLeft(); + aSpotPos[i].X() += nWidth34; + aSpotPos[i].Y() += nHeight14; + } + break; + + case 3 : + { + // BottomLeft-Spot + aSpotPos[i] = rArea.TopLeft(); + aSpotPos[i].X() += nWidth14; + aSpotPos[i].Y() += nHeight34; + } + break; + case 4 : + { + // BottomRight-Spot + aSpotPos[i] = rArea.TopLeft(); + aSpotPos[i].X() += nWidth34; + aSpotPos[i].Y() += nHeight34; + } + break; + + } + + aSpotColor[i] = Color( COL_WHITE ); + impGetSdrPageFillColor(rPage, aSpotPos[i], rTextEditPV, rTextEditPV.GetVisibleLayers(), aSpotColor[i], false); + } + + USHORT aMatch[SPOTCOUNT]; + + for ( i = 0; i < SPOTCOUNT; i++ ) + { + // were same spot colors found? + aMatch[i] = 0; + + for ( USHORT j = 0; j < SPOTCOUNT; j++ ) + { + if( j != i ) + { + if( aSpotColor[i] == aSpotColor[j] ) + { + aMatch[i]++; + } + } + } + } + + // highest weight to center spot + aBackground = aSpotColor[0]; + + for ( USHORT nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- ) + { + // which spot color was found most? + for ( i = 0; i < SPOTCOUNT; i++ ) + { + if( aMatch[i] == nMatchCount ) + { + aBackground = aSpotColor[i]; + nMatchCount = 1; // break outer for-loop + break; + } + } + } + } + + return aBackground; + } +} // end of anonymous namespace + +Color GetTextEditBackgroundColor(const SdrObjEditView& rView) +{ + svtools::ColorConfig aColorConfig; + Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if(!rStyleSettings.GetHighContrastMode()) + { + bool bFound(false); + SdrTextObj* pText = dynamic_cast< SdrTextObj * >(rView.GetTextEditObject()); + if(pText && pText->IsClosedObj()) + { + ::sdr::table::SdrTableObj* pTable = dynamic_cast< ::sdr::table::SdrTableObj * >( pText ); + + if( pTable ) + bFound = GetDraftFillColor(pTable->GetActiveCellItemSet(), aBackground ); + + if( !bFound ) + bFound=GetDraftFillColor(pText->GetMergedItemSet(), aBackground); + } + + if(!bFound && pText) + { + SdrPageView* pTextEditPV = rView.GetTextEditPageView(); + if(pTextEditPV) + { + Point aPvOfs(pText->GetTextEditOffset()); + const SdrPage* pPg = pTextEditPV->GetPage(); + + if(pPg) + { + Rectangle aSnapRect( pText->GetSnapRect() ); + aSnapRect.Move(aPvOfs.X(), aPvOfs.Y()); + + return impCalcBackgroundColor(aSnapRect, *pTextEditPV, *pPg); + } + } + } + } + + return aBackground; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 2157c1052192..727e7f0bafcc 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -34,7 +34,6 @@ #include <algorithm> #include <svx/svdhdl.hxx> -#include "svdtouch.hxx" #include <svx/svdpagv.hxx> #include <svx/svdetc.hxx> #include <svx/svdmrkv.hxx> @@ -62,8 +61,7 @@ #include <svx/sdr/overlay/overlaymanager.hxx> #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx> #include <svx/sdr/overlay/overlaybitmapex.hxx> -#include <svx/sdr/overlay/overlaybitmap.hxx> -#include <svx/sdr/overlay/overlaylinestriped.hxx> +#include <svx/sdr/overlay/overlayline.hxx> #include <svx/sdr/overlay/overlaytriangle.hxx> #include <svx/sdr/overlay/overlayhatchrect.hxx> #include <svx/sdrpagewindow.hxx> @@ -83,36 +81,63 @@ class SdrHdlBitmapSet { // the bitmap holding all infos - BitmapEx maMarkersBitmap; + BitmapEx maMarkersBitmap; + + // the cropped Bitmaps for reusage + ::std::vector< BitmapEx > maRealMarkers; + + // elpers + BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle); public: SdrHdlBitmapSet(UINT16 nResId); ~SdrHdlBitmapSet(); - BitmapEx GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd=0); + const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd=0); }; //////////////////////////////////////////////////////////////////////////////////////////////////// +#define KIND_COUNT (14) +#define INDEX_COUNT (6) +#define INDIVIDUAL_COUNT (4) SdrHdlBitmapSet::SdrHdlBitmapSet(UINT16 nResId) +: maMarkersBitmap(), + // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra + maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT) { // #101928# change color used for transparent parts to 0x00ff00ff (ImageList standard) - Color aColTransparent(0x00ff00ff); - Bitmap aBitmap(ResId(nResId, *ImpGetResMgr())); - maMarkersBitmap = BitmapEx(aBitmap, aColTransparent); + const Color aColTransparent(0x00ff00ff); + const Bitmap aBitmap(ResId(nResId, *ImpGetResMgr())); + const Bitmap aMask(aBitmap.CreateMask(aColTransparent)); + + // create a real BitmapEx with an AlphaMask + maMarkersBitmap = BitmapEx(aBitmap, aMask); + // maMarkersBitmap = BitmapEx(aBitmap, aColTransparent); } SdrHdlBitmapSet::~SdrHdlBitmapSet() { } -// #i15222# +BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle) +{ + BitmapEx& rTargetBitmap = maRealMarkers[nIndex]; + + if(rTargetBitmap.IsEmpty()) + { + rTargetBitmap = maMarkersBitmap; + rTargetBitmap.Crop(rRectangle); + } + + return rTargetBitmap; +} + // change getting of bitmap to use the big ressource bitmap -BitmapEx SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd) +const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nInd) { // fill in size and source position in maMarkersBitmap const sal_uInt16 nYPos(nInd * 11); - Rectangle aSourceRect; switch(eKindOfMarker) { @@ -123,140 +148,135 @@ BitmapEx SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UINT16 nIn } case Rect_7x7: { - aSourceRect = Rectangle(Point(0, nYPos), Size(7, 7)); - break; + return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7))); } case Rect_9x9: { - aSourceRect = Rectangle(Point(7, nYPos), Size(9, 9)); - break; + return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9))); } case Rect_11x11: { - aSourceRect = Rectangle(Point(16, nYPos), Size(11, 11)); - break; + return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11))); } case Rect_13x13: { + const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd); + switch(nInd) { - case 0: aSourceRect = Rectangle(Point(72, 66), Size(13, 13)); break; - case 1: aSourceRect = Rectangle(Point(85, 66), Size(13, 13)); break; - case 2: aSourceRect = Rectangle(Point(72, 78), Size(13, 13)); break; - case 3: aSourceRect = Rectangle(Point(85, 78), Size(13, 13)); break; - case 4: aSourceRect = Rectangle(Point(98, 78), Size(13, 13)); break; - case 5: aSourceRect = Rectangle(Point(98, 66), Size(13, 13)); break; + case 0: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13))); + } + case 1: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13))); + } + case 2: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 78), Size(13, 13))); + } + case 3: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 78), Size(13, 13))); + } + case 4: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 78), Size(13, 13))); + } + default: // case 5: + { + return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13))); + } } - - break; } case Circ_7x7: { - aSourceRect = Rectangle(Point(27, nYPos), Size(7, 7)); - break; + return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7))); } case Circ_9x9: case Customshape1: { - aSourceRect = Rectangle(Point(34, nYPos), Size(9, 9)); - break; + return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9))); } case Circ_11x11: { - aSourceRect = Rectangle(Point(43, nYPos), Size(11, 11)); - break; + return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11))); } case Elli_7x9: { - aSourceRect = Rectangle(Point(54, nYPos), Size(7, 9)); - break; + return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9))); } case Elli_9x11: { - aSourceRect = Rectangle(Point(61, nYPos), Size(9, 11)); - break; + return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11))); } case Elli_9x7: { - aSourceRect = Rectangle(Point(70, nYPos), Size(9, 7)); - break; + return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7))); } case Elli_11x9: { - aSourceRect = Rectangle(Point(79, nYPos), Size(11, 9)); - break; + return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9))); } case RectPlus_7x7: { - aSourceRect = Rectangle(Point(90, nYPos), Size(7, 7)); - break; + return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7))); } case RectPlus_9x9: { - aSourceRect = Rectangle(Point(97, nYPos), Size(9, 9)); - break; + return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9))); } case RectPlus_11x11: { - aSourceRect = Rectangle(Point(106, nYPos), Size(11, 11)); - break; + return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11))); } case Crosshair: { - aSourceRect = Rectangle(Point(0, 68), Size(15, 15)); - break; + return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15))); } case Glue: { - aSourceRect = Rectangle(Point(15, 74), Size(9, 9)); - break; + return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 74), Size(9, 9))); } - case Anchor: - // #101688# AnchorTR for SW + case Anchor: // #101688# AnchorTR for SW case AnchorTR: { - aSourceRect = Rectangle(Point(24, 68), Size(24, 23)); - break; + return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 68), Size(24, 23))); } // #98388# add AnchorPressed to be able to aninate anchor control case AnchorPressed: case AnchorPressedTR: { - aSourceRect = Rectangle(Point(48, 68), Size(24, 23)); - break; + return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 68), Size(24, 23))); } } - // construct return bitmap - BitmapEx aRetval(maMarkersBitmap); - aRetval.Crop(aSourceRect); - - return aRetval; + // cannot happen since all pathes return something; return Rect_7x7 as default (see switch) + return maRealMarkers[0]; } //////////////////////////////////////////////////////////////////////////////////////////////////// SdrHdlBitmapSet* SdrHdl::pSimpleSet = NULL; SdrHdlBitmapSet* SdrHdl::pModernSet = NULL; - -// #101928# SdrHdlBitmapSet* SdrHdl::pHighContrastSet = NULL; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -810,7 +830,7 @@ bool SdrHdl::IsHdlHit(const Point& rPnt) const { // OVERLAYMANAGER basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y()); - return maOverlayGroup.isHit(aPosition); + return maOverlayGroup.isHitLogic(aPosition); } Pointer SdrHdl::GetPointer() const @@ -984,8 +1004,9 @@ void SdrHdlColor::CreateB2dIAObject() Bitmap aBmpCol(CreateColorDropper(aMarkerColor)); basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); ::sdr::overlay::OverlayObject* pNewOverlayObject = new - ::sdr::overlay::OverlayBitmap( - aPosition, aBmpCol, + ::sdr::overlay::OverlayBitmapEx( + aPosition, + BitmapEx(aBmpCol), (UINT16)(aBmpCol.GetSizePixel().Width() - 1) >> 1, (UINT16)(aBmpCol.GetSizePixel().Height() - 1) >> 1 ); @@ -1183,11 +1204,13 @@ void SdrHdlGradient::CreateB2dIAObject() pNewOverlayObject = new ::sdr::overlay::OverlayTriangle( - aPositionLeft, aPosition2, aPositionRight + aPositionLeft, + aPosition2, + aPositionRight, + IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE) ); DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); - pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)); rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } @@ -1331,13 +1354,6 @@ void SdrHdlLine::CreateB2dIAObject() } } -bool SdrHdlLine::IsHdlHit(const Point& rPnt) const -{ - // OVERLAYMANAGER - basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y()); - return maOverlayGroup.isHit(aPosition); -} - Pointer SdrHdlLine::GetPointer() const { return Pointer(POINTER_REFHAND); @@ -1689,7 +1705,8 @@ void ImpTextframeHdl::CreateB2dIAObject() aTopLeft, aBottomRight, aHatchCol, - 6.0, + 3.0, + 3.0, 45 * F_PI180, nDrehWink * -F_PI18000); pNewOverlayObject->setHittable(false); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 805b56eb207f..7273bb49889a 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -48,26 +48,19 @@ #include <svx/svdoole2.hxx> #include <svx/xgrad.hxx> #include <svx/xflgrit.hxx> - #include "gradtrns.hxx" #include <svx/xflftrit.hxx> - #include <svx/dialmgr.hxx> #include "svdstr.hrc" #include <svx/svdundo.hxx> - -// #105722# #include <svx/svdopath.hxx> - -// #i13033# #include <svx/scene3d.hxx> - -// OD 30.06.2003 #108784# #include <svx/svdovirt.hxx> #include <svx/sdr/overlay/overlayrollingrectangle.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> #include <sdrpaintwindow.hxx> #include <svx/sdrpagewindow.hxx> +#include <svx/sdrhittesthelper.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// // predefines @@ -109,7 +102,7 @@ ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx: if(pTargetOverlay) { ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped( - rStartPos, rStartPos, sal_False); + rStartPos, rStartPos, false); pTargetOverlay->add(*pNew); maObjects.append(*pNew); } @@ -1290,7 +1283,7 @@ BOOL SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const Point aPt(rPnt); for (ULONG nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) { SdrMark* pM=GetSdrMarkByIndex(nm); - bRet=ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0); + bRet = 0 != CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0); } return bRet; } @@ -1391,7 +1384,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev) for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) { nm--; SdrMark* pM=GetSdrMarkByIndex(nm); - if (ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0)) { + if(CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0)) + { pTopMarkHit=pM; nTopMarkHit=nm; } @@ -1407,7 +1401,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev) for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) { SdrMark* pM=GetSdrMarkByIndex(nm); SdrPageView* pPV2=pM->GetPageView(); - if (pPV2==pPV && ImpIsObjHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pPV2,0)) { + if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,USHORT(nTol),pM->GetMarkedSdrObj(),pPV2,0,0)) + { pBtmMarkHit=pM; nBtmMarkHit=nm; } @@ -1464,7 +1459,8 @@ BOOL SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, BOOL bPrev) pObj = pObjList->GetObj(no); } - if (ImpIsObjHit(aPt,USHORT(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE)) { + if (CheckSingleSdrObjectHit(aPt,USHORT(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0)) + { if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) { pFndObj=pObj; } else { @@ -1590,7 +1586,7 @@ void SdrMarkView::SetMarkHdlSizePixel(USHORT nSiz) } #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ -SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const +SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const { if((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) { @@ -1636,15 +1632,13 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject aPnt.Move( -aOffset.X(), -aOffset.Y() ); } - pRet=ImpCheckObjHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj); + pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj); } else { - SdrLayerID nLay=pObj->GetLayer(); - - if(pPV->GetVisibleLayers().IsSet(nLay) && (pMVisLay==NULL || pMVisLay->IsSet(nLay))) + if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer())) { - pRet=pObj->CheckHit(rPnt,nTol2,&pPV->GetVisibleLayers()); + pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false); } } } @@ -1658,7 +1652,7 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject return pRet; } -SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const +SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObjList* pOL, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const { BOOL bBack=(nOptions & SDRSEARCH_BACKWARD)!=0; SdrObject* pRet=NULL; @@ -1685,7 +1679,7 @@ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObjLis pObj = pOL->GetObj(nObjNum); } - pRet=ImpCheckObjHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay); + pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay); if (pRet!=NULL) rpRootObj=pObj; if (bBack) nObjNum++; } @@ -1733,7 +1727,7 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP SdrMark* pM=GetSdrMarkByIndex(nMrkNum); pObj=pM->GetMarkedSdrObj(); pPV=pM->GetPageView(); - pHitObj=ImpCheckObjHit(aPt,nTol,pObj,pPV,nOptions,NULL); + pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL); if (bBack) nMrkNum++; } } @@ -1778,7 +1772,7 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE; nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER; } - pHitObj=ImpCheckObjHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj); + pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj); if (bBack) nPgNum++; } } @@ -1801,8 +1795,12 @@ BOOL SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrP if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=NULL; } if (pObj!=NULL && (nOptions & SDRSEARCH_WITHTEXT) !=0 && pObj->GetOutlinerParaObject()==NULL) pObj=NULL; - if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0) { - if (!pObj->IsTextEditHit(aPt,0/*nTol*/,NULL)) pObj=NULL; + if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0) + { + if(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true)) + { + pObj = 0; + } } if (pObj!=NULL) { rpObj=pObj; @@ -1831,7 +1829,7 @@ BOOL SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie SdrMark* pM=GetSdrMarkByIndex(nMarkNum); SdrPageView* pPV=pM->GetPageView(); SdrObject* pObj=pM->GetMarkedSdrObj(); - bFnd=ImpIsObjHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE); + bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0); if (bFnd) { rpObj=pObj; rpPV=pPV; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 0f9e2e168721..dab855fa6f41 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -3093,10 +3093,6 @@ void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRe rTextRect=Rectangle(aTextPos,aTextSiz); } -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) { SdrTextObj::NbcSetOutlinerParaObject( pTextObject ); @@ -3105,81 +3101,6 @@ void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject InvalidateRenderGeometry(); } -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - -SdrObject* SdrObjCustomShape::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - SdrObject* pHitObj = NULL; - const SdrObject* pSdrObject = GetSdrObjectFromCustomShape(); - if ( pSdrObject ) - { - SdrObjList* pOL = pSdrObject->GetSubList(); - if ( pOL ) - { - ULONG nObjNum = pOL->GetObjCount(); - while ( ( pHitObj == NULL ) && nObjNum ) - { - nObjNum--; - SdrObject* pObj = pOL->GetObj( nObjNum ); - if ( pObj->CheckHit( rPnt, nTol, pVisiLayer ) ) - pHitObj = (SdrObject*)this; - } - } - else if ( pSdrObject->CheckHit( rPnt, nTol, pVisiLayer ) ) - pHitObj = (SdrObject*)this; - } - - if ( !pHitObj && HasText() ) - { - // paint text over object - double fTextRotation = GetExtraTextRotation(); - if ( fTextRotation != 0.0 ) - { - GeoStat aOldGeoStat( aGeo ); - Rectangle aOldRect( aRect ); - Rectangle aTextBound( aRect ); - GetTextBounds( aTextBound ); - - // determining the correct refpoint - Point aRef( aTextBound.Center() ); - Rectangle aUnrotatedSnapRect( aOutRect ); - RotatePoint( aRef, aUnrotatedSnapRect.Center(), -aGeo.nSin, -aGeo.nCos ); - - long dx = aRect.Right()-aRect.Left(); - long dy = aRect.Bottom()-aRect.Top(); - Point aP( aRect.TopLeft() ); - double sn = sin( F_PI180 * fTextRotation ); - double cs = cos( F_PI180 * fTextRotation ); - RotatePoint( aP, aRef, sn, cs ); - ((SdrObjCustomShape*)this)->aRect.Left()=aP.X(); - ((SdrObjCustomShape*)this)->aRect.Top()=aP.Y(); - ((SdrObjCustomShape*)this)->aRect.Right()=aRect.Left()+dx; - ((SdrObjCustomShape*)this)->aRect.Bottom()=aRect.Top()+dy; - if ( aGeo.nDrehWink == 0 ) - { - ((SdrObjCustomShape*)this)->aGeo.nDrehWink=NormAngle360( (sal_Int32)( fTextRotation * 100.0 ) ); - ((SdrObjCustomShape*)this)->aGeo.nSin = sn; - ((SdrObjCustomShape*)this)->aGeo.nCos = cs; - } - else - { - ((SdrObjCustomShape*)this)->aGeo.nDrehWink=NormAngle360( aGeo.nDrehWink + (sal_Int32)( fTextRotation * 100.0 ) ); - ((SdrObjCustomShape*)this)->aGeo.RecalcSinCos(); - } - pHitObj = SdrTextObj::CheckHit( rPnt, nTol, pVisiLayer ); - ((SdrObjCustomShape*)this)->aGeo = aOldGeoStat; - ((SdrObjCustomShape*)this)->aRect = aOldRect; - - } - else - pHitObj = SdrTextObj::CheckHit( rPnt, nTol, pVisiLayer ); - } - - return pHitObj; -} - void SdrObjCustomShape::operator=(const SdrObject& rObj) { SdrTextObj::operator=( rObj ); diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx index f192221bd880..d4d4717535b8 100644 --- a/svx/source/svdraw/svdoattr.cxx +++ b/svx/source/svdraw/svdoattr.cxx @@ -34,7 +34,6 @@ #include <svx/svdoattr.hxx> #include <svx/xpool.hxx> #include "svditext.hxx" -#include "svdtouch.hxx" #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> #include <svx/svdattr.hxx> @@ -171,26 +170,6 @@ sal_Int32 SdrAttrObj::ImpGetLineWdt() const return nRetval; } -////////////////////////////////////////////////////////////////////////////// - -FASTBOOL SdrAttrObj::ImpGetShadowDist(sal_Int32& nXDist, sal_Int32& nYDist) const -{ - const SfxItemSet& rSet = GetMergedItemSet(); - - nXDist = 0L; - nYDist = 0L; - - BOOL bShadOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue(); - if(bShadOn) - { - nXDist = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(); - nYDist = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue(); - return TRUE; - } - - return FALSE; -} - BOOL SdrAttrObj::HasFill() const { return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index c1abb3add6b9..263279691979 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -127,6 +127,7 @@ #include <svx/polysc3d.hxx> #include "svx/svdotable.hxx" #include "svx/shapepropertynotifier.hxx" +#include <svx/sdrhittesthelper.hxx> using namespace ::com::sun::star; @@ -175,8 +176,15 @@ FASTBOOL SdrObjUserData::HasMacro(const SdrObject* /*pObj*/) const SdrObject* SdrObjUserData::CheckMacroHit(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const { - if (pObj==NULL) return NULL; - return pObj->CheckHit(rRec.aPos,rRec.nTol,rRec.pVisiLayer); + if(pObj) + { + if(rRec.pPageView) + { + return SdrObjectPrimitiveHit(*pObj, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false); + } + } + + return 0; } Pointer SdrObjUserData::GetMacroPointer(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const @@ -902,6 +910,10 @@ const Rectangle& SdrObject::GetLastBoundRect() const void SdrObject::RecalcBoundRect() { + // #i101680# suppress BoundRect calculations on import(s) + if(pModel && pModel->isLocked() ) + return; + // central new method which will calculate the BoundRect using primitive geometry if(aOutRect.IsEmpty()) { @@ -982,19 +994,6 @@ BOOL SdrObject::LineGeometryUsageIsNecessary() const return (eXLS != XLINE_NONE); } -SdrObject* SdrObject::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return 0L; - } - - Rectangle aO(GetCurrentBoundRect()); - aO.Left()-=nTol; aO.Top()-=nTol; aO.Right()+=nTol; aO.Bottom()+=nTol; - FASTBOOL bRet=aO.IsInside(rPnt); - return bRet ? (SdrObject*)this : NULL; -} - SdrObject* SdrObject::Clone() const { SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL); @@ -1730,11 +1729,6 @@ FASTBOOL SdrObject::HasTextEdit() const return FALSE; } -SdrObject* SdrObject::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return CheckHit(rPnt,nTol,pVisiLayer); -} - sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/) { return FALSE; @@ -1806,11 +1800,19 @@ FASTBOOL SdrObject::HasMacro() const SdrObject* SdrObject::CheckMacroHit(const SdrObjMacroHitRec& rRec) const { - SdrObjUserData* pData=ImpGetMacroUserData(); - if (pData!=NULL) { - return pData->CheckMacroHit(rRec,this); + SdrObjUserData* pData = ImpGetMacroUserData(); + + if(pData) + { + return pData->CheckMacroHit(rRec, this); + } + + if(rRec.pPageView) + { + return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false); } - return CheckHit(rRec.aPos,rRec.nTol,rRec.pVisiLayer); + + return 0; } Pointer SdrObject::GetMacroPointer(const SdrObjMacroHitRec& rRec) const diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 47fc34dba5ba..7d41191c99a9 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -40,7 +40,6 @@ #include <svx/svdpool.hxx> #include <svx/svdetc.hxx> #include <svx/svdtrans.hxx> -#include "svdtouch.hxx" #include <svx/svdhdl.hxx> #include <svx/svddrag.hxx> #include <svx/svdmodel.hxx> @@ -61,6 +60,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <svx/sdrhittesthelper.hxx> // #i32599# inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } @@ -253,31 +253,6 @@ UINT16 SdrCaptionObj::GetObjIdentifier() const return UINT16(OBJ_CAPTION); } -SdrObject* SdrCaptionObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - sal_Bool bHit(SdrRectObj::CheckHit(rPnt,nTol,pVisiLayer) != NULL); - if (!bHit) { - INT32 nMyTol=nTol; - INT32 nWdt = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue(); - nWdt++; - nWdt /= 2; - - if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig - Rectangle aR(rPnt,rPnt); - aR.Left() -=nMyTol; - aR.Right() +=nMyTol; - aR.Top() -=nMyTol; - aR.Bottom()+=nMyTol; - bHit = IsRectTouchesLine(aTailPoly,aR); - } - return bHit ? (SdrObject*)this : NULL; -} - void SdrCaptionObj::operator=(const SdrObject& rObj) { SdrRectObj::operator=(rObj); @@ -377,8 +352,10 @@ bool SdrCaptionObj::beginSpecialDrag(SdrDragStat& rDrag) const Point aHit(rDrag.GetStart()); - if(SdrRectObj::CheckHit(aHit, 0, NULL)) + if(rDrag.GetPageView() && SdrObjectPrimitiveHit(*this, aHit, 0, *rDrag.GetPageView(), 0, false)) + { return true; + } } else { diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 9c8b8bf81937..6af31224ee45 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -40,7 +40,6 @@ #include <svx/svdocirc.hxx> #include <math.h> #include <svx/xpool.hxx> -#include "svdtouch.hxx" #include <svx/svdattr.hxx> #include <svx/svdpool.hxx> #include <svx/svdattrx.hxx> @@ -312,127 +311,6 @@ void SdrCircObj::RecalcXPoly() mpXPoly = new XPolygon(aPolyCirc); } -SdrObject* SdrCircObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - Point aPt(rPnt); - Point aZero; - aPt.X()-=aRect.Left(); - aPt.Y()-=aRect.Top(); - - INT32 nMyTol=nTol; - FASTBOOL bFilled=meCircleKind!=OBJ_CARC && (bTextFrame || HasFill()); - - INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke - long nBoundWdt=aRect.GetWidth()-1; - long nBoundHgt=aRect.GetHeight()-1; - if (meCircleKind==OBJ_SECT) { - long nTmpWink=NormAngle360(nEndWink-nStartWink); - if (nTmpWink<9000) { - nBoundWdt=0; - nBoundHgt=0; - } else if (nTmpWink<27000) { - nBoundWdt/=2; - nBoundHgt/=2; - } - } - if (bFilled && nBoundWdt>short(nTol) && nBoundHgt>short(nTol) && Abs(aGeo.nShearWink)<=4500) nMyTol=0; // Keine Toleranz noetig hier - if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Umrandung keine Toleranz noetig - - // Den uebergebenen Punkt auf den gedrehten, geshearten Kreis transformieren - // Unrotate: - if (aGeo.nDrehWink!=0) RotatePoint(aPt,aZero,-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung - // Unshear: - if (aGeo.nShearWink!=0) ShearPoint(aPt,aZero,-aGeo.nTan); // -tan fuer Umkehrung - - long nXRad=aRect.GetWidth()/2; if (nXRad<1) nXRad=1; - long nYRad=aRect.GetHeight()/2; if (nYRad<1) nYRad=1; - - // Die wirklichen Radien fuer spaeter merken - long nXRadReal=nXRad; - long nYRadReal=nYRad; - aPt.X()-=nXRad; - aPt.Y()-=nYRad; - Point aPtNoStretch(aPt); - - if (nXRad>nYRad) { - aPt.Y()=BigMulDiv(aPt.Y(),nXRad,nYRad); - // Da die Strichstaerke bei Ellipsen ueberall gleich ist: - if (Abs(aPt.X())<Abs(aPt.Y())) { - nMyTol=BigMulDiv(nMyTol,nXRad,nYRad); - } - nYRad=nXRad; - } - if (nYRad>nXRad) { - aPt.X()=BigMulDiv(aPt.X(),nYRad,nXRad); - // Da die Strichstaerke bei Ellipsen ueberall gleich ist: - if (Abs(aPt.Y())<Abs(aPt.X())) { - nMyTol=BigMulDiv(nMyTol,nYRad,nXRad); - } - nXRad=nYRad; - } - - // Die BigInts haben bei *= leider ein Vorzeichenproblem (a*=a;) - // (SV250A), deshalb hier soviele Instanzen. (JOE) - long nAussen=nXRad+nMyTol; - BigInt nBigTmpA(nAussen); - BigInt nAusRadQ(nBigTmpA*nBigTmpA); - long nInnen=nXRad-nMyTol; if (nInnen<=0) nInnen=0; - BigInt nBigTmpI(nInnen); - // wird sonst nicht benoetigt, ggf. BugMul sparen: - BigInt nInnRadQ((!bFilled && nInnen!=0) ? nBigTmpI*nBigTmpI : nBigTmpI); - - // Radius von aPt berechnen - BigInt nBigTmpX(aPt.X()); - BigInt nBigTmpY(aPt.Y()); - BigInt nPntRadQ(nBigTmpX*nBigTmpX+nBigTmpY*nBigTmpY); - - sal_Bool bRet(sal_False); - if (nPntRadQ<=nAusRadQ) { // sonst ausserhalb - if (nInnen==0) bRet = sal_True; - else if (meCircleKind==OBJ_CIRC) { // Vollkreis - if (bFilled) bRet = sal_True; - else if (nPntRadQ>=nInnRadQ) bRet = sal_True; - } else { // Teilkreise - long nWink=NormAngle360(GetAngle(aPt)); - long a=nStartWink; - long e=nEndWink; - if (e<a) e+=36000; - if (nWink<a) nWink+=36000; - if (nWink>=a && nWink<=e) { - if (bFilled) bRet = sal_True; - else if (nPntRadQ>=nInnRadQ) bRet = sal_True; - } - if (!bRet) { - Rectangle aR(aPtNoStretch.X()-nMyTol,aPtNoStretch.Y()-nMyTol, - aPtNoStretch.X()+nMyTol,aPtNoStretch.Y()+nMyTol); - Point aP1(GetWinkPnt(aRect,nStartWink)); - aP1.X()-=aRect.Left()+nXRadReal; - aP1.Y()-=aRect.Top()+nYRadReal; - Point aP2(GetWinkPnt(aRect,nEndWink)); - aP2.X()-=aRect.Left()+nXRadReal; - aP2.Y()-=aRect.Top()+nYRadReal; - if (meCircleKind==OBJ_SECT) { // Kreissektor: nur noch die beiden Strecken testen - bRet=IsRectTouchesLine(aZero,aP1,aR) || IsRectTouchesLine(aZero,aP2,aR); - } - if (meCircleKind==OBJ_CCUT) { // Kreisabschnitt noch die Sehne und die MaeuseEcke (Dreieck) testen - if (IsRectTouchesLine(aP1,aP2,aR)) bRet = sal_True; // die Sehne - else if (bFilled) { // und nun die Maeusescke - const Polygon aPoly(GetXPoly().getB2DPolygon().getDefaultAdaptiveSubdivision()); - bRet=IsPointInsidePoly(aPoly,rPnt); - } - } - } - } - } - if (!bRet && HasText()) bRet=SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL; - return bRet ? (SdrObject*)this : NULL; -} - void SdrCircObj::TakeObjNameSingul(XubString& rName) const { USHORT nID=STR_ObjNameSingulCIRC; diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 4d4b9a985e15..abadbf094981 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -44,7 +44,6 @@ #include <svx/svddrgv.hxx> #include "svddrgm1.hxx" #include <svx/svdhdl.hxx> -#include "svdtouch.hxx" #include <svx/svdtrans.hxx> #include <svx/svdetc.hxx> #include "svdglob.hxx" // StringCache @@ -58,6 +57,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdrhittesthelper.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -417,30 +417,6 @@ void SdrEdgeObj::TakeUnrotatedSnapRect(Rectangle& rRect) const rRect=GetSnapRect(); } -SdrObject* SdrEdgeObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - INT32 nMyTol=nTol; - INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke - if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig - Rectangle aR(rPnt,rPnt); - aR.Left() -=nMyTol; - aR.Right() +=nMyTol; - aR.Top() -=nMyTol; - aR.Bottom()+=nMyTol; - - sal_Bool bHit(sal_False); - - const Polygon aPoly(pEdgeTrack->getB2DPolygon().getDefaultAdaptiveSubdivision()); - bHit = IsRectTouchesLine(aPoly,aR); - if (!bHit && HasText()) bHit = SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL; - return bHit ? (SdrObject*)this : NULL; -} - FASTBOOL SdrEdgeObj::IsNode() const { return TRUE; @@ -2134,7 +2110,8 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, USHORT nGesAnz=nConAnz+9; FASTBOOL bUserFnd=FALSE; ULONG nBestDist=0xFFFFFFFF; - for (USHORT i=0; i<nGesAnz; i++) { + for (USHORT i=0; i<nGesAnz; i++) + { FASTBOOL bUser=i<nConAnz; FASTBOOL bVertex=i>=nConAnz+0 && i<nConAnz+4; FASTBOOL bCorner=i>=nConAnz+4 && i<nConAnz+8; @@ -2191,7 +2168,9 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, } // Falls kein Konnektor getroffen wird nochmal // HitTest versucht fuer BestConnector (=bCenter) - if (!bFnd && !bEdge && pObj->IsHit(rPt,nBoundHitTol,&rVisLayer)) + if(!bFnd && + !bEdge && + SdrObjectPrimitiveHit(*pObj, rPt, nBoundHitTol, rPV, &rVisLayer, false)) { // #109007# // Suppress default connect at object inside bound diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 805577df9b72..f317551079b5 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -581,13 +581,6 @@ sal_Bool SdrGrafObj::ImpUpdateGraphicLink() const // ----------------------------------------------------------------------------- -SdrObject* SdrGrafObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return ImpCheckHit( rPnt, nTol, pVisiLayer, TRUE ); -} - -// ----------------------------------------------------------------------------- - void SdrGrafObj::TakeObjNameSingul(XubString& rName) const { switch( pGraphic->GetType() ) diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 879a53851919..5782ca91b74b 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -295,32 +295,6 @@ const Rectangle& SdrObjGroup::GetSnapRect() const // <-- } -SdrObject* SdrObjGroup::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if (pSub->GetObjCount()!=0) { - return pSub->CheckHit(rPnt,nTol,pVisiLayer); - } else { // ansonsten ist es eine leere Gruppe - if(!pVisiLayer || pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - Rectangle aAussen(aOutRect); - aAussen.Top() -=nTol; - aAussen.Left() -=nTol; - aAussen.Bottom()+=nTol; - aAussen.Right() +=nTol; - nTol++; - Rectangle aInnen(aOutRect); - aInnen.Top() +=nTol; - aInnen.Left() +=nTol; - aInnen.Bottom()-=nTol; - aInnen.Right() -=nTol; - if (aAussen.IsInside(rPnt) && !aInnen.IsInside(rPnt)) { - return (SdrObject*)this; - } - } - } - return NULL; -} - void SdrObjGroup::operator=(const SdrObject& rObj) { if(rObj.IsGroupObject()) diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 6f97d4051b28..330b7f5c37f6 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -36,7 +36,6 @@ #include "svditext.hxx" // #include <svx/xpoly.hxx> #include <svx/svdtrans.hxx> -#include "svdtouch.hxx" #include <svx/svdhdl.hxx> #include <svx/svdoutl.hxx> #include <svx/svddrag.hxx> @@ -766,37 +765,6 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const } } -SdrObject* SdrMeasureObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - sal_Bool bHit(sal_False); - INT32 nMyTol=nTol; - INT32 nWdt=ImpGetLineWdt()/2; // Halbe Strichstaerke - if (nWdt>nMyTol) nMyTol=nWdt; // Bei dicker Linie keine Toleranz noetig - Rectangle aR(rPnt,rPnt); - aR.Left() -=nMyTol; - aR.Right() +=nMyTol; - aR.Top() -=nMyTol; - aR.Bottom()+=nMyTol; - - if (bTextDirty) UndirtyText(); - ImpMeasureRec aRec; - ImpMeasurePoly aMPol; - ImpTakeAttr(aRec); - ImpCalcGeometrics(aRec,aMPol); - bHit=IsRectTouchesLine(aMPol.aMainline1.aP1,aMPol.aMainline1.aP2,aR) || - IsRectTouchesLine(aMPol.aMainline2.aP1,aMPol.aMainline2.aP2,aR) || - IsRectTouchesLine(aMPol.aHelpline1.aP1,aMPol.aHelpline1.aP2,aR) || - IsRectTouchesLine(aMPol.aHelpline2.aP1,aMPol.aHelpline2.aP2,aR); - // und nun noch ggf. den Textbereich checken - bHit=bHit || SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)!=NULL; - return bHit ? (SdrObject*)this : NULL; -} - void SdrMeasureObj::operator=(const SdrObject& rObj) { SdrTextObj::operator=(rObj); @@ -1381,12 +1349,6 @@ void SdrMeasureObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle SdrTextObj::TakeTextEditArea(pPaperMin,pPaperMax,pViewInit,pViewMin); } -SdrObject* SdrMeasureObj::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if (bTextDirty) UndirtyText(); - return SdrTextObj::CheckTextEditHit(rPnt,nTol,pVisiLayer); -} - USHORT SdrMeasureObj::GetOutlinerViewAnchorMode() const { if (bTextDirty) UndirtyText(); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index f71b45e928ee..01ef392e941a 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1578,13 +1578,6 @@ UINT16 SdrOle2Obj::GetObjIdentifier() const // ----------------------------------------------------------------------------- -SdrObject* SdrOle2Obj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return ImpCheckHit(rPnt,nTol,pVisiLayer,TRUE,TRUE); -} - -// ----------------------------------------------------------------------------- - void SdrOle2Obj::TakeObjNameSingul(XubString& rName) const { rName = ImpGetResStr(bFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2); @@ -2215,79 +2208,11 @@ sal_Bool SdrOle2Obj::AddOwnLightClient() ////////////////////////////////////////////////////////////////////////////// -bool SdrOle2Obj::executeOldDoPaintPreparations(SdrPageView* pPageVew) const +bool SdrOle2Obj::executeOldDoPaintPreparations(SdrPageView* /*pPageVew*/) const { - bool bIsActive(false); - // copy of the old SdrOle2Obj::Do_PaintObject stuff which evtl. needs - // to be emulated. - - // //charts must be painted resolution dependent!! #i82893#, #i75867# - // if( ChartPrettyPainter::IsChart(xObjRef) && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( rOut.GetOutDev() ) ) - // if( !rOut.GetOffset().nA && !rOut.GetOffset().nB )//offset!=0 is the scenario 'copy -> past special gdi metafile' which does not work with direct painting so far - // if( ChartPrettyPainter::DoPrettyPaintChart( this->getXModel(), rOut.GetOutDev(), aRect ) ) - // return bOk; - // - // if( !GetGraphic() ) - // ( (SdrOle2Obj*) this)->GetObjRef_Impl(); // try to create embedded object - - // this one can be used directly, just reformatting a bit - if(!GetGraphic()) - { - // try to create embedded object - const_cast< SdrOle2Obj* >(this)->GetObjRef_Impl(); - } - - // if ( xObjRef.is() ) - // { - // sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() ); - // if( !bSizProt && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE) ) - // ( (SdrOle2Obj*) this)->bSizProt = TRUE; - - // old stuff which relies on xObjRef and nMiscStatus - if(xObjRef.is()) - { - const sal_Int64 nMiscStatus(xObjRef->getStatus(GetAspect())); - - // this hack (to change model data during PAINT argh(!)) can also be reproduced - // directly - if(!IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE)) - { - const_cast< SdrOle2Obj* >(this)->SetResizeProtect(true); - } - - // OutputDevice* pOut = rOut.GetOutDev(); - // - // //TODO/LATER: currently it's not possible to compare the windows, the XOutDev contains a virtual device - // sal_Int32 nState = xObjRef->getCurrentState(); - // //if ( ( nState != embed::EmbedStates::INPLACE_ACTIVE && nState != embed::EmbedStates::UI_ACTIVE ) || - // // pModel && SfxInPlaceClient::GetActiveWindow( pModel->GetPersist(), xObjRef ) != pOut ) - // { - // if ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) - // { - // // PlugIn-Objekt connecten - // if (rInfoRec.pPV!=NULL) - // { - // SdrOle2Obj* pOle2Obj = (SdrOle2Obj*) this; - // SdrView* pSdrView = (SdrView*) &rInfoRec.pPV->GetView(); - // pSdrView->DoConnect(pOle2Obj); - // } - // } - - // nState is used in old paint to see if OLE is activated and to do - // a different paint - const sal_Int32 nState(xObjRef->getCurrentState()); - - bIsActive = (nState == embed::EmbedStates::ACTIVE); - - // for this one i need the view. - if(pPageVew && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) - { - // connect plugin object - pPageVew->GetView().DoConnect(const_cast< SdrOle2Obj* >(this)); - } - } - - return bIsActive; + //#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 diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 7d128cf79746..4831945dfcf3 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -37,7 +37,6 @@ #include <svx/xpool.hxx> #include <svx/xpoly.hxx> #include <svx/svdattr.hxx> -#include "svdtouch.hxx" #include <svx/svdtrans.hxx> #include <svx/svdetc.hxx> #include <svx/svddrag.hxx> @@ -79,6 +78,10 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include <basegfx/curve/b2dcubicbezier.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +// #i89784# +#include <svx/sdr/attribute/sdrtextattribute.hxx> +#include <svx/sdr/primitive2d/sdrattributecreator.hxx> + using namespace sdr; inline USHORT GetPrevPnt(USHORT nPnt, USHORT nPntMax, FASTBOOL bClosed) @@ -1825,51 +1828,6 @@ UINT16 SdrPathObj::GetObjIdentifier() const return USHORT(meKind); } -SdrObject* SdrPathObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - sal_Bool bHit(sal_False); - const basegfx::B2DPoint aHitPoint(rPnt.X(), rPnt.Y()); - - if(GetPathPoly().isClosed() && (bTextFrame || HasFill())) - { - // hit in filled polygon? Subdivbide needed for better precision - if(GetPathPoly().areControlPointsUsed()) - { - bHit = basegfx::tools::isInside(GetPathPoly().getDefaultAdaptiveSubdivision(), aHitPoint); - } - else - { - bHit = basegfx::tools::isInside(GetPathPoly(), aHitPoint); - } - } - - if(!bHit) - { - // hit polygon line? - const double fHalfLineWidth(ImpGetLineWdt() / 2.0); - double fDistance(nTol); - - if(fHalfLineWidth > fDistance) - { - fDistance = fHalfLineWidth; - } - - bHit = basegfx::tools::isInEpsilonRange(GetPathPoly(), aHitPoint, fDistance); - } - - if(!bHit && !IsTextFrame() && HasText()) - { - bHit = (0L != SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer)); - } - - return bHit ? (SdrObject*)this : 0L; -} - void SdrPathObj::operator=(const SdrObject& rObj) { SdrTextObj::operator=(rObj); @@ -2717,7 +2675,19 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index) SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const { - SdrObject* pRet = ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier); + // #i89784# check for FontWork with activated HideContour + bool bHideContour(false); + + { + drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)); + bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour(); + delete pText; + } + + SdrObject* pRet = bHideContour ? + 0 : + ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier); + SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet); if(pPath) diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index ed841692a5f8..837b75bcf849 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -38,7 +38,6 @@ #include <svx/xpoly.hxx> #include <svx/svdattr.hxx> #include <svx/svdpool.hxx> -#include "svdtouch.hxx" #include <svx/svdtrans.hxx> #include <svx/svdetc.hxx> #include <svx/svddrag.hxx> @@ -239,81 +238,6 @@ void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const } } -SdrObject* SdrRectObj::ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - INT32 nMyTol=nTol; - FASTBOOL bFilled=bForceFilled || HasFill(); - FASTBOOL bPickThrough=pModel!=NULL && pModel->IsPickThroughTransparentTextFrames(); - if (bTextFrame && !bPickThrough) bFilled=TRUE; - FASTBOOL bLine=HasLine(); - - INT32 nWdt=bLine ? ImpGetLineWdt() :0; // Halbe Strichstaerke - - // #i25616# - if(nWdt && !LineIsOutsideGeometry()) - { - nWdt /= 2; - } - - long nBoundWdt=aRect.GetWidth()-1; - long nBoundHgt=aRect.GetHeight()-1; - if (bFilled && nBoundWdt>short(nTol) && nBoundHgt>short(nTol) && Abs(aGeo.nShearWink)<=4500) { - if (!bForceTol && !bTextFrame ) nMyTol=0; // Keine Toleranz noetig hier - } - if (nWdt>nMyTol && (!bTextFrame || pEdtOutl==NULL)) nMyTol=nWdt; // Bei dicker Umrandung keine Toleranz noetig, ausser wenn bei TextEdit - Rectangle aR(aRect); - if (nMyTol!=0 && bFilled) { - aR.Left ()-=nMyTol; - aR.Top ()-=nMyTol; - aR.Right ()+=nMyTol; - aR.Bottom()+=nMyTol; - } - - if (bFilled || bLine || bTextFrame) { // Bei TextFrame so tun, alsob Linie da - unsigned nCnt=0; - INT32 nXShad=0,nYShad=0; - long nEckRad=/*bTextFrame ? 0 :*/ GetEckenradius(); - do { // 1 Durchlauf, bei Schatten 2 Durchlaeufe. - if (nCnt!=0) aR.Move(nXShad,nYShad); - if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0 || !bFilled) { - Polygon aPol(aR); - if (nEckRad!=0) { - INT32 nRad=nEckRad; - if (bFilled) nRad+=nMyTol; // um korrekt zu sein ... - XPolygon aXPoly(ImpCalcXPoly(aR,nRad)); - aPol = Polygon(aXPoly.getB2DPolygon().getDefaultAdaptiveSubdivision()); - } else { - if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan); - if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); - } - if (bFilled) { - if (IsPointInsidePoly(aPol,rPnt)) return (SdrObject*)this; - } else { - Rectangle aTouchRect(rPnt.X()-nMyTol,rPnt.Y()-nMyTol,rPnt.X()+nMyTol,rPnt.Y()+nMyTol); - if (IsRectTouchesLine(aPol,aTouchRect)) return (SdrObject*)this; - } - } else { - if (aR.IsInside(rPnt)) return (SdrObject*)this; - } - } while (nCnt++==0 && ImpGetShadowDist(nXShad,nYShad)); - } - FASTBOOL bCheckText=TRUE; - if (bCheckText && HasText() && (!bTextFrame || bPickThrough)) { - return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer); - } - return NULL; -} - -SdrObject* SdrRectObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return ImpCheckHit(rPnt,nTol,pVisiLayer,FALSE/*,bTextFrame*/); -} - void SdrRectObj::TakeObjNameSingul(XubString& rName) const { if (IsTextFrame()) diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 9abf3950d694..6b2f02299d4a 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -36,7 +36,6 @@ #include <svx/svdpagv.hxx> // fuer Abfrage im Paint, ob das #include <svx/svdview.hxx> // Objekt gerade editiert wird #include <svx/svdpage.hxx> // und fuer AnimationHandler (Laufschrift) -#include "svdtouch.hxx" #include <svx/svdetc.hxx> #include <svx/svdoutl.hxx> #include "svdscrol.hxx" // fuer Laufschrift @@ -1129,101 +1128,6 @@ void SdrTextObj::StopTextAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData* SetTextAnimationAllowed(sal_False); } -SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - if(!bTextFrame && !GetOutlinerParaObject() ) - { - return NULL; - } - - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - INT32 nMyTol=nTol; - FASTBOOL bFontwork=IsFontwork(); - SdrFitToSizeType eFit=GetFitToSize(); - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); - Rectangle aR(aRect); - Rectangle aAnchor2(aR); - Rectangle aTextRect(aR); - SdrOutliner* pOutliner = NULL; - pOutliner = &pModel->GetHitTestOutliner(); - - if (bFontwork) { - if (pFormTextBoundRect!=NULL) aR=*pFormTextBoundRect; - else aR=GetCurrentBoundRect(); - } - else - { - TakeTextRect( *pOutliner, aTextRect, FALSE, &aAnchor2, FALSE ); // EditText nicht mehr ignorieren! TRUE); // EditText ignorieren! - - if (bFitToSize) - aR=aAnchor2; - else - aR=aTextRect; - } - if (aR.GetWidth()-1>short(nTol) && aR.GetHeight()-1>short(nTol)) nMyTol=0; // Keine Toleranz noetig hier - if (nMyTol!=0) { - aR.Left ()-=nMyTol; - aR.Top ()-=nMyTol; - aR.Right ()+=nMyTol; - aR.Bottom()+=nMyTol; - } - FASTBOOL bRet=FALSE; - - if(bFontwork) - { - bRet = aR.IsInside(rPnt); - - // #105130# Include aRect here in measurements to be able to hit a - // fontwork object on its border - if(!bRet) - { - const Rectangle aSnapRect = GetSnapRect(); - - if( (rPnt.X() >= aSnapRect.Left() - nTol && rPnt.X() <= aSnapRect.Left() + nTol) - || (rPnt.X() >= aSnapRect.Right() - nTol && rPnt.X() <= aSnapRect.Right() + nTol) - || (rPnt.Y() >= aSnapRect.Top() - nTol && rPnt.Y() <= aSnapRect.Top() + nTol) - || (rPnt.Y() >= aSnapRect.Bottom() - nTol && rPnt.Y() <= aSnapRect.Bottom() + nTol)) - { - bRet = TRUE; - } - } - } - else - { - if (aGeo.nDrehWink!=0) { - Polygon aPol(aR); - RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos); - bRet=IsPointInsidePoly(aPol,rPnt); - } else { - bRet=aR.IsInside(rPnt); - } - if (bRet) { // und nun noch checken, ob wirklich Buchstaben getroffen sind - // Featurewunsch zur 4.0 - // Zunaechst meine Dok-Koordinaten in EE-Dok-Koordinaten umwandeln. - Point aPt(rPnt); aPt-=aR.TopLeft(); - if (bFitToSize) { // #38214#: FitToSize berueksichtigen - Fraction aX(aTextRect.GetWidth()-1,aAnchor2.GetWidth()-1); - Fraction aY(aTextRect.GetHeight()-1,aAnchor2.GetHeight()-1); - ResizePoint(aPt,Point(),aX,aY); - } - if (aGeo.nDrehWink!=0) RotatePoint(aPt,Point(),-aGeo.nSin,aGeo.nCos); // -sin fuer Unrotate - // Und nun im EE-Dok auf Buchstabensuche gehen - long nHitTol = 2000; - OutputDevice* pRef = pOutliner->GetRefDevice(); - if( pRef ) - nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() ); - - bRet = pOutliner->IsTextPos( aPt, (sal_uInt16)nHitTol ); - } - } - - return bRet ? (SdrObject*)this : NULL; -} - void SdrTextObj::TakeObjNameSingul(XubString& rName) const { XubString aStr; diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index fe56b2da4e61..673b7432f662 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -731,7 +731,9 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // prepare outliner const bool bIsCell(rSdrBlockTextPrimitive.getCellText()); - const SfxItemSet& rTextItemSet = rSdrBlockTextPrimitive.getSdrText().GetItemSet(); + const SfxItemSet& rTextItemSet = rSdrBlockTextPrimitive.getSdrText() + ? rSdrBlockTextPrimitive.getSdrText()->GetItemSet() + : GetObjectItemSet(); SdrOutliner& rOutliner = ImpGetDrawOutliner(); SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet); SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet); @@ -903,7 +905,9 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( // prepare outliner SdrOutliner& rOutliner = ImpGetDrawOutliner(); const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord()); - const SfxItemSet& rTextItemSet = rSdrStretchTextPrimitive.getSdrText().GetItemSet(); + const SfxItemSet& rTextItemSet = rSdrStretchTextPrimitive.getSdrText() + ? rSdrStretchTextPrimitive.getSdrText()->GetItemSet() + : GetObjectItemSet(); const Size aNullSize; rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE); @@ -1196,4 +1200,5 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL } } +////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 57fec8fbfaaa..f3bdeeb4811c 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -70,6 +70,7 @@ #include <editstat.hxx> #include <unoapi.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -223,65 +224,13 @@ namespace } // end of anonymous namespace ////////////////////////////////////////////////////////////////////////////// -// TextBreakup data helper - -namespace -{ - class impFormTextValues - { - sal_Int32 mnFormTextDistance; // distance from line in upright direction - sal_Int32 mnFormTextStart; // shift from polygon start - sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees - sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling - sal_uInt16 mnFormTextShdwTransp; // shadow transparence - XFormTextStyle meFormTextStyle; // on/off and char orientation - XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale - XFormTextShadow meFormTextShadow; // shadow mode - Color maFormTextShdwColor; // shadow color - - // bitfield - unsigned mbFormTextMirror : 1; // change orientation - unsigned mbFormTextOutline : 1; // show contour of objects - - public: - impFormTextValues(const SfxItemSet& rSet) - : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), - mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), - mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), - mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), - mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), - meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), - meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), - meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), - maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), - mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), - mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) - { - } - - // data access - sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } - sal_Int32 getFormTextStart() const { return mnFormTextStart; } - sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } - sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } - sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } - XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } - XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } - Color getFormTextShdwColor() const { return maFormTextShdwColor; } - bool getFormTextMirror() const { return mbFormTextMirror; } - bool getFormTextOutline() const { return mbFormTextOutline; } - }; -} // end of anonymous namespace - -////////////////////////////////////////////////////////////////////////////// // TextBreakup one poly and one paragraph helper namespace { class impPolygonParagraphHandler { - const impFormTextValues& mrVal; // FormText parameters + const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator @@ -321,10 +270,10 @@ namespace public: impPolygonParagraphHandler( - const impFormTextValues& rVal, + const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) - : mrVal(rVal), + : mrSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) { @@ -348,16 +297,18 @@ namespace double fPolyStart(0.0); double fScaleFactor(1.0); - if(mrVal.getFormTextMirror()) + if(mrSdrFormTextAttribute.getFormTextMirror()) { aPolygonCandidate.flip(); } - if(mrVal.getFormTextStart() && (XFT_LEFT == mrVal.getFormTextAdjust() || XFT_RIGHT == mrVal.getFormTextAdjust())) + if(mrSdrFormTextAttribute.getFormTextStart() + && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust() + || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())) { - if(XFT_LEFT == mrVal.getFormTextAdjust()) + if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()) { - fPolyStart += mrVal.getFormTextStart(); + fPolyStart += mrSdrFormTextAttribute.getFormTextStart(); if(fPolyStart > fPolyEnd) { @@ -366,7 +317,7 @@ namespace } else { - fPolyEnd -= mrVal.getFormTextStart(); + fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart(); if(fPolyEnd < fPolyStart) { @@ -375,7 +326,7 @@ namespace } } - if(XFT_LEFT != mrVal.getFormTextAdjust()) + if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust()) { // calculate total text length of this paragraph, some layout needs to be done const double fParagraphTextLength(getParagraphTextLength(rTextPortions)); @@ -384,7 +335,7 @@ namespace // but still take care of XFT_AUTOSIZE in that case const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart)); - if(XFT_RIGHT == mrVal.getFormTextAdjust()) + if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -392,7 +343,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength); } } - else if(XFT_CENTER == mrVal.getFormTextAdjust()) + else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -400,7 +351,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0; } } - else if(XFT_AUTOSIZE == mrVal.getFormTextAdjust()) + else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) { // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) @@ -434,7 +385,7 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == mrVal.getFormTextAdjust()) + if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand portion length fPortionLength *= fScaleFactor; @@ -449,25 +400,27 @@ namespace aNewTransformA.scale(aSize.getX(), aSize.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == mrVal.getFormTextAdjust()) + if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand text primitive scaling aNewTransformA.scale(fScaleFactor, fScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition - const bool bShadow(XFTSHADOW_NONE != mrVal.getFormTextShadow()); + const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow()); if(bShadow) { - if(XFTSHADOW_NORMAL == mrVal.getFormTextShadow()) + if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow()) { - aNewShadowTransform.translate(mrVal.getFormTextShdwXVal(), -mrVal.getFormTextShdwYVal()); + aNewShadowTransform.translate( + mrSdrFormTextAttribute.getFormTextShdwXVal(), + -mrSdrFormTextAttribute.getFormTextShdwYVal()); } else // XFTSHADOW_SLANT { - double fScaleValue(mrVal.getFormTextShdwYVal() / 100.0); - double fShearValue(-mrVal.getFormTextShdwXVal() * F_PI1800); + double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); + double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); aNewShadowTransform.scale(1.0, fScaleValue); aNewShadowTransform.shearX(sin(fShearValue)); @@ -475,7 +428,7 @@ namespace } } - switch(mrVal.getFormTextStyle()) + switch(mrSdrFormTextAttribute.getFormTextStyle()) { case XFT_ROTATE : { @@ -533,7 +486,7 @@ namespace } // distance from path? - if(mrVal.getFormTextDistance()) + if(mrSdrFormTextAttribute.getFormTextDistance()) { if(aEndPos.equal(aStartPos)) { @@ -541,7 +494,9 @@ namespace } // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff - const basegfx::B2DVector aPerpendicular(basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * mrVal.getFormTextDistance()); + const basegfx::B2DVector aPerpendicular( + basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * + mrSdrFormTextAttribute.getFormTextDistance()); aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } @@ -550,7 +505,7 @@ namespace { if(pCandidate->getText().Len() && nNextGlyphLen) { - const Color aShadowColor(mrVal.getFormTextShdwColor()); + const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); const ::std::vector< double > aNewDXArray( @@ -611,101 +566,6 @@ namespace namespace { - basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint) - { - switch(eLineJoint) - { - case XLINEJOINT_MIDDLE : - { - return basegfx::B2DLINEJOIN_MIDDLE; - } - case XLINEJOINT_BEVEL : - { - return basegfx::B2DLINEJOIN_BEVEL; - } - case XLINEJOINT_MITER : - { - return basegfx::B2DLINEJOIN_MITER; - } - case XLINEJOINT_ROUND : - { - return basegfx::B2DLINEJOIN_ROUND; - } - default : - { - return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE - } - } - } -} // end of anonymous namespace - -////////////////////////////////////////////////////////////////////////////// - -namespace -{ - sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet) - { - sal_uInt8 nRetval; - - if(bShadow) - { - nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100); - } - else - { - nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100); - } - - return nRetval; - } - - drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet) - { - basegfx::BColor aColorAttribute; - - if(bShadow) - { - const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); - aColorAttribute = aShadowColor.getBColor(); - } - else - { - const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue()); - aColorAttribute = aLineColor.getBColor(); - } - - const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); - const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); - - return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint)); - } - - drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet) - { - const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue(); - double fFullDotDashLen(0.0); - ::std::vector< double > aDotDashArray; - - if(XLINE_DASH == eLineStyle) - { - const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue(); - - if(rDash.GetDots() || rDash.GetDashes()) - { - const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); - fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth); - } - } - - return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen); - } -} // end of anonymous namespace - -////////////////////////////////////////////////////////////////////////////// -// primitive decomposition helpers - -namespace -{ void impAddPolygonStrokePrimitives( const basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, const basegfx::B2DHomMatrix& rTransform, @@ -732,8 +592,7 @@ namespace drawinglayer::primitive2d::Primitive2DSequence impAddPathTextOutlines( const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rSource, - bool bShadow, - const SfxItemSet& rSet) + const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute) { std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives; @@ -751,19 +610,19 @@ namespace if(aB2DPolyPolyVector.size()) { - // prepare Line and Stroke Attribute - const drawinglayer::attribute::LineAttribute aLineAttribute(impGetLineAttribute(bShadow, rSet)); - const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(bShadow, rSet)); - // create stroke primitives std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aStrokePrimitives; - impAddPolygonStrokePrimitives(aB2DPolyPolyVector, aPolygonTransform, aLineAttribute, aStrokeAttribute, aStrokePrimitives); + impAddPolygonStrokePrimitives( + aB2DPolyPolyVector, + aPolygonTransform, + rOutlineAttribute.getLineAttribute(), + rOutlineAttribute.getStrokeAttribute(), + aStrokePrimitives); const sal_uInt32 nStrokeCount(aStrokePrimitives.size()); if(nStrokeCount) { - if(nTransparence) + if(rOutlineAttribute.getTransparence()) { // create UnifiedAlphaPrimitive2D drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount); @@ -773,7 +632,10 @@ namespace aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]); } - drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aStrokePrimitiveSequence, (double)nTransparence / 100.0); + drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + aStrokePrimitiveSequence, + (double)rOutlineAttribute.getTransparence() / 100.0); aNewPrimitives.push_back(pNew2); } else @@ -822,7 +684,7 @@ bool SdrTextObj::impDecomposePathTextPrimitive( rOutliner.SetUpdateMode(true); rOutliner.Clear(); rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX)); - rOutliner.SetText(*rSdrPathTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrPathTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); @@ -833,11 +695,8 @@ bool SdrTextObj::impDecomposePathTextPrimitive( if(rPathTextPortions.size()) { - // get FormText values - const SfxItemSet& rSet = rSdrPathTextPrimitive.getSdrText().GetItemSet(); - const impFormTextValues aVal(rSet); - - // get polygon values + // get FormText and polygon values + const drawinglayer::attribute::SdrFormTextAttribute& rFormTextAttribute = rSdrPathTextPrimitive.getSdrFormTextAttribute(); const basegfx::B2DPolyPolygon& rPathPolyPolygon(rSdrPathTextPrimitive.getPathPolyPolygon()); // get loop count @@ -848,12 +707,13 @@ bool SdrTextObj::impDecomposePathTextPrimitive( nLoopCount = rOutliner.GetParagraphCount(); } - if(nLoopCount && XFT_NONE != aVal.getFormTextStyle()) + if(nLoopCount) { // prepare common decomposition stuff std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; - impPolygonParagraphHandler aPolygonParagraphHandler(aVal, aRegularDecomposition, aShadowDecomposition); + impPolygonParagraphHandler aPolygonParagraphHandler( + rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); sal_uInt32 a; for(a = 0L; a < nLoopCount; a++) @@ -892,10 +752,10 @@ bool SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add shadow outlines - if(aVal.getFormTextOutline()) + if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline()) { - const SfxItemSet& rLocalSet = rSdrPathTextPrimitive.getSdrText().GetObject().GetMergedItemSet(); - const drawinglayer::primitive2d::Primitive2DSequence aOutlines(impAddPathTextOutlines(aShadowDecomposition, true, rLocalSet)); + const drawinglayer::primitive2d::Primitive2DSequence aOutlines( + impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline())); drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines); } } @@ -911,10 +771,10 @@ bool SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add outlines - if(aVal.getFormTextOutline()) + if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline()) { - const SfxItemSet& rLocalSet = rSdrPathTextPrimitive.getSdrText().GetObject().GetMergedItemSet(); - const drawinglayer::primitive2d::Primitive2DSequence aOutlines(impAddPathTextOutlines(aRegularDecomposition, false, rLocalSet)); + const drawinglayer::primitive2d::Primitive2DSequence aOutlines( + impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline())); drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines); } } diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx index 3b1a304bf9d4..f384cc9b4326 100644 --- a/svx/source/svdraw/svdotxed.cxx +++ b/svx/source/svdraw/svdotxed.cxx @@ -291,11 +291,6 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl) mbInEditMode = FALSE; } -SdrObject* SdrTextObj::CheckTextEditHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return SdrTextObj::CheckHit(rPnt,nTol,pVisiLayer); -} - USHORT SdrTextObj::GetOutlinerViewAnchorMode() const { SdrTextHorzAdjust eH=GetTextHorizontalAdjust(); diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index addc538efb25..aaed882cae3d 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -43,9 +43,13 @@ #include <svx/sdr/properties/itemsettools.hxx> #include <svx/sdr/properties/properties.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include "svdtxhdl.hxx" #include <svtools/itemset.hxx> #include <svditer.hxx> +#include <drawinglayer/processor2d/textaspolygonextractor2d.hxx> +#include <svx/sdr/contact/viewcontact.hxx> +#include <svx/xflclit.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xlnwtit.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -335,37 +339,139 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2) SetGlueReallyAbsolute(FALSE); } -SdrObject* SdrTextObj::ImpConvertObj(FASTBOOL bToPoly) const +////////////////////////////////////////////////////////////////////////////// + +SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const { - if (!ImpCanConvTextToCurve()) return NULL; - SdrObjGroup* pGroup=new SdrObjGroup(); + SdrObject* pRetval = 0; - boost::shared_ptr< SdrOutliner > xOutl( const_cast< SdrTextObj* >(this)->CreateDrawOutliner() ); - xOutl->SetUpdateMode(TRUE); - ImpTextPortionHandler aConverter(*(xOutl.get()),*this); + if(!ImpCanConvTextToCurve()) + { + // suppress HelpTexts from PresObj's + return 0; + } - aConverter.ConvertToPathObj(*pGroup,bToPoly); + // get primitives + const drawinglayer::primitive2d::Primitive2DSequence xSequence(GetViewContact().getViewIndependentPrimitive2DSequence()); - // Nachsehen, ob ueberhaupt was drin ist: - SdrObjList* pOL=pGroup->GetSubList(); + if(xSequence.hasElements()) + { + // create an extractor with neutral ViewInformation + const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0); + drawinglayer::processor2d::TextAsPolygonExtractor2D aExtractor(aViewInformation2D); - if (pOL->GetObjCount()==0) { - delete pGroup; - return NULL; - } - // Ein einzelnes Objekt muss nicht gruppiert werden: - if (pOL->GetObjCount()==1) { - SdrObject* pObj=pOL->RemoveObject(0); - delete pGroup; - return pObj; + // extract text as polygons + aExtractor.process(xSequence); + + // get results + const drawinglayer::processor2d::TextAsPolygonDataNodeVector& rResult = aExtractor.getTarget(); + const sal_uInt32 nResultCount(rResult.size()); + + if(nResultCount) + { + // prepare own target + SdrObjGroup* pGroup = new SdrObjGroup(); + SdrObjList* pObjectList = pGroup->GetSubList(); + + // process results + for(sal_uInt32 a(0); a < nResultCount; a++) + { + const drawinglayer::processor2d::TextAsPolygonDataNode& rCandidate = rResult[a]; + basegfx::B2DPolyPolygon aPolyPolygon(rCandidate.getB2DPolyPolygon()); + + if(aPolyPolygon.count()) + { + // take care of wanted polygon type + if(bToPoly) + { + if(aPolyPolygon.areControlPointsUsed()) + { + aPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aPolyPolygon); + } + } + else + { + if(!aPolyPolygon.areControlPointsUsed()) + { + aPolyPolygon = basegfx::tools::expandToCurve(aPolyPolygon); + } + } + + // create ItemSet with object attributes + SfxItemSet aAttributeSet(GetObjectItemSet()); + SdrPathObj* pPathObj = 0; + + // always clear objectshadow; this is included in the extraction + aAttributeSet.Put(SdrShadowItem(false)); + + if(rCandidate.getIsFilled()) + { + // set needed items + aAttributeSet.Put(XFillColorItem(String(), Color(rCandidate.getBColor()))); + aAttributeSet.Put(XLineStyleItem(XLINE_NONE)); + aAttributeSet.Put(XFillStyleItem(XFILL_SOLID)); + + // create filled SdrPathObj + pPathObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon); + } + else + { + // set needed items + aAttributeSet.Put(XLineColorItem(String(), Color(rCandidate.getBColor()))); + aAttributeSet.Put(XLineStyleItem(XLINE_SOLID)); + aAttributeSet.Put(XLineWidthItem(0)); + aAttributeSet.Put(XFillStyleItem(XFILL_NONE)); + + // create line SdrPathObj + pPathObj = new SdrPathObj(OBJ_PATHLINE, aPolyPolygon); + } + + // copy basic information from original + pPathObj->ImpSetAnchorPos(GetAnchorPos()); + pPathObj->NbcSetLayer(GetLayer()); + + if(GetModel()) + { + pPathObj->SetModel(GetModel()); + pPathObj->NbcSetStyleSheet(GetStyleSheet(), true); + } + + // apply prepared ItemSet and add to target + pPathObj->SetMergedItemSet(aAttributeSet); + pObjectList->InsertObject(pPathObj); + } + } + + // postprocess; if no result and/or only one object, simplify + if(!pObjectList->GetObjCount()) + { + delete pGroup; + } + else if(1 == pObjectList->GetObjCount()) + { + pRetval = pObjectList->RemoveObject(0); + delete pGroup; + } + else + { + pRetval = pGroup; + } + } } - // Ansonsten die Gruppe zurueckgeben - return pGroup; + + return pRetval; } +////////////////////////////////////////////////////////////////////////////// + SdrObject* SdrTextObj::DoConvertToPolyObj(BOOL bBezier) const { - return ImpConvertObj(!bBezier); + return ImpConvertContainedTextToSdrPathObjs(!bBezier); +} + +bool SdrTextObj::ImpCanConvTextToCurve() const +{ + return !IsOutlText(); } SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr) const @@ -388,25 +494,23 @@ SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPol pPathObj->SetPathPoly(basegfx::tools::expandToCurve(pPathObj->GetPathPoly())); } + if(pPathObj) { - if(pPathObj) + pPathObj->ImpSetAnchorPos(aAnchor); + pPathObj->NbcSetLayer(SdrLayerID(GetLayer())); + + if(pModel) { - pPathObj->ImpSetAnchorPos(aAnchor); - pPathObj->NbcSetLayer(SdrLayerID(GetLayer())); + pPathObj->SetModel(pModel); - if(pModel) + if(!bNoSetAttr) { - pPathObj->SetModel(pModel); + sdr::properties::ItemChangeBroadcaster aC(*pPathObj); - if(!bNoSetAttr) - { - sdr::properties::ItemChangeBroadcaster aC(*pPathObj); - - pPathObj->ClearMergedItem(); - pPathObj->SetMergedItemSet(GetObjectItemSet()); - pPathObj->GetProperties().BroadcastItemChange(aC); - pPathObj->NbcSetStyleSheet(GetStyleSheet(), sal_True); - } + pPathObj->ClearMergedItem(); + pPathObj->SetMergedItemSet(GetObjectItemSet()); + pPathObj->GetProperties().BroadcastItemChange(aC); + pPathObj->NbcSetStyleSheet(GetStyleSheet(), sal_True); } } } @@ -421,7 +525,7 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons return pObj; } - SdrObject* pText = ImpConvertObj(!bBezier); + SdrObject* pText = ImpConvertContainedTextToSdrPathObjs(!bBezier); if(!pText) { @@ -433,40 +537,6 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons return pText; } - // #i97874# - // if shadow is set, apply it to created text, too - const bool bShadowOn(((SdrShadowItem&)GetObjectItem(SDRATTR_SHADOW)).GetValue()); - SfxItemSet aShadowSet(*(GetObjectItemSet().GetPool()), SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST); - - if(bShadowOn) - { - // filter shadow items - aShadowSet.Put(GetObjectItemSet()); - } - - { // #i97874# - // copy needed attributes from local object to all newly created objects - SdrObjListIter aIter(*pText); - - while(aIter.IsMore()) - { - SdrObject* pCandidate = aIter.Next(); - - // make sure Layer and model are correct - pCandidate->NbcSetLayer(SdrLayerID(GetLayer())); - pCandidate->SetModel(pModel); - - // set shadow if needed - if(bShadowOn) - { - pCandidate->SetMergedItemSet(aShadowSet); - } - - // set used StyleSheet - pCandidate->NbcSetStyleSheet(GetStyleSheet(), true); - } - } - if(pText->IsGroupObject()) { // is already group object, add partial shape in front @@ -487,4 +557,5 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) cons } } +////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index abf9574f9172..74a3b0a49ada 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -297,11 +297,6 @@ namespace }; } -SdrObject* SdrUnoObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - return ImpCheckHit(rPnt, nTol, pVisiLayer, TRUE, TRUE); -} - void SdrUnoObj::TakeObjNameSingul(XubString& rName) const { rName = ImpGetResStr(STR_ObjNameSingulUno); diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index a93905fe21ed..18840cde18e0 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -161,13 +161,6 @@ void SdrVirtObj::SetChanged() SdrObject::SetChanged(); } -SdrObject* SdrVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const -{ - Point aPnt(rPnt-aAnchor); - FASTBOOL bRet=rRefObj.CheckHit(aPnt,nTol,pVisiLayer)!=NULL; - return bRet ? (SdrObject*)this : NULL; -} - SdrObject* SdrVirtObj::Clone() const { SdrObject* pObj=new SdrVirtObj(((SdrVirtObj*)this)->rRefObj); // Nur eine weitere Referenz diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 2986cb482aae..05b5b5e5aca6 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -678,33 +678,6 @@ const Rectangle& SdrObjList::GetAllObjBoundRect() const return aOutRect; } -SdrObject* SdrObjList::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bBackward) const -{ - SdrObject* pHit=NULL; - Rectangle R(rPnt.X()-nTol,rPnt.Y()-nTol,rPnt.X()+nTol,rPnt.Y()+nTol); - if (R.IsOver(GetAllObjBoundRect())) { - ULONG nObjAnz=GetObjCount(); - ULONG nObjNum=bBackward ? 0 : nObjAnz; - while (pHit==NULL && (bBackward ? nObjNum<nObjAnz : nObjNum>0)) { - if (!bBackward) nObjNum--; - SdrObject* pObj=GetObj(nObjNum); - if (R.IsOver(pObj->GetCurrentBoundRect())) { - SdrObjList* pSubList=pObj->GetSubList(); - if (pSubList!=NULL || pVisiLayer==NULL) { // Gruppenobjekte beruecksichtigen sichtbare Layer selbst - pHit=pObj->CheckHit(rPnt,nTol,pVisiLayer/*,bBackward*/); - } else { // Ansonsten nur wenn Layer sichtbar - SdrLayerID nLayer=pObj->GetLayer(); - if (pVisiLayer->IsSet(nLayer)) { - pHit=pObj->CheckHit(rPnt,nTol,pVisiLayer/*,bBackward*/); - } - } - } - if (bBackward) nObjNum++; - } - } - return pHit; -} - void SdrObjList::NbcReformatAllTextObjects() { ULONG nAnz=GetObjCount(); @@ -773,42 +746,6 @@ void SdrObjList::BurnInStyleSheetAttributes() } } -FASTBOOL SdrObjList::ImpGetFillColor(SdrObject* pObj, Color& rCol) const -{ - return GetDraftFillColor(pObj->GetMergedItemSet(), rCol); -} - -FASTBOOL SdrObjList::GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /*FASTBOOL bLayerSorted,*/ Color& rCol) const -{ - if (pModel==NULL) return FALSE; - FASTBOOL bRet=FALSE; - FASTBOOL bMaster=pPage!=NULL ? pPage->IsMasterPage() : FALSE; - for (ULONG no=GetObjCount(); !bRet && no>0; ) { - no--; - SdrObject* pObj=GetObj(no); - SdrObjList* pOL=pObj->GetSubList(); - if (pOL!=NULL) { // Aha, Gruppenobjekt - bRet=pOL->GetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol); - } else { - SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pObj); - // #108867# Exclude zero master page object (i.e. background - // shape) from color query - if (pTextObj!=NULL && - pObj->IsClosedObj() && rVisLayers.IsSet(pObj->GetLayer()) && - (!bMaster || (!pObj->IsNotVisibleAsMaster() && no!=0)) && - pObj->GetCurrentBoundRect().IsInside(rPnt) && - !pTextObj->IsHideContour() && pObj->IsHit(rPnt,0,NULL)) - { // Nachfolgend extra Funktion um Stack zu sparen, - // da diese Methode hier rekursiv ist. - bRet=ImpGetFillColor(pObj,rCol); - } - } - } - return bRet; -} - - ULONG SdrObjList::GetObjCount() const { return maList.size(); @@ -1706,56 +1643,6 @@ void SdrPage::TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage) } } -// MasterPage interface -//////////////////////////////////////////////////////////////////////////////////////////////////// - -FASTBOOL SdrPage::ImplGetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /* FASTBOOL bLayerSorted,*/ Color& rCol, FASTBOOL bSkipBackgroundShape) const -{ - if (pModel==NULL) return FALSE; - FASTBOOL bRet=SdrObjList::GetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol); - if (!bRet && !mbMaster) - { - // nun zu den Masterpages - if(TRG_HasMasterPage()) - { - SetOfByte aSet(rVisLayers); - aSet &= TRG_GetMasterPageVisibleLayers(); - SdrPage& rMasterPage = TRG_GetMasterPage(); - - // #108867# Don't fall back to background shape on - // master pages. This is later handled by - // GetBackgroundColor, and is necessary to cater for - // the silly ordering: 1. shapes, 2. master page - // shapes, 3. page background, 4. master page - // background. - bRet = rMasterPage.ImplGetFillColor(rPnt, aSet, rCol, TRUE); - } - } - - // #108867# Only now determine background color from background shapes - if( !bRet && !bSkipBackgroundShape ) - { - rCol = GetPageBackgroundColor(); - return TRUE; - } - - return bRet; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -FASTBOOL SdrPage::GetFillColor(const Point& rPnt, const SetOfByte& rVisLayers, - /*FASTBOOL bLayerSorted,*/ Color& rCol) const -{ - // #108867# Wrapper for ImplGetFillColor. Used to properly set the - // bSkipBackgroundShape parameter. Never skip background shape on - // first level of recursion - return ImplGetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol,FALSE); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - const SdrPageGridFrameList* SdrPage::GetGridFrameList(const SdrPageView* /*pPV*/, const Rectangle* /*pRect*/) const { return NULL; diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index c42497d73507..c89c458aa9c7 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -113,7 +113,7 @@ ImplEncirclementOverlay::ImplEncirclementOverlay(const SdrPaintView& rView, cons if(pTargetOverlay) { ::sdr::overlay::OverlayRollingRectangleStriped* aNew = new ::sdr::overlay::OverlayRollingRectangleStriped( - rStartPos, rStartPos, sal_False); + rStartPos, rStartPos, false); pTargetOverlay->add(*aNew); maObjects.append(*aNew); } @@ -1466,130 +1466,6 @@ void SdrPaintView::SetApplicationDocumentColor(Color aDocumentColor) } } -// declaration extracted from svdedxv.cxx -#define SPOTCOUNT 5 - -Color SdrPaintView::CalcBackgroundColor( const Rectangle& rArea, - const SetOfByte& rVisibleLayers, - const SdrPage& rCurrPage ) const -{ - // code extracted from SdrObjEditView::ImpGetTextEditBackgroundColor - svtools::ColorConfig aColorConfig; - Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); - - // #98988# test if we are in High contrast mode; if yes, take - // application background color - // #10049# wrong, always use svtools::DOCCOLOR as default and use document settings if - // not hc mode - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if(!rStyleSettings.GetHighContrastMode()) - { - // Ok, dann eben die Page durchsuchen! - Point aSpotPos[SPOTCOUNT]; - Color aSpotColor[SPOTCOUNT]; - ULONG nHeight( rArea.GetSize().Height() ); - ULONG nWidth( rArea.GetSize().Width() ); - ULONG nWidth14 = nWidth / 4; - ULONG nHeight14 = nHeight / 4; - ULONG nWidth34 = ( 3 * nWidth ) / 4; - ULONG nHeight34 = ( 3 * nHeight ) / 4; - - USHORT i; - for ( i = 0; i < SPOTCOUNT; i++ ) - { - // Es wird anhand von fuenf Spots die Farbe untersucht - switch ( i ) - { - case 0 : - { - // Center-Spot - aSpotPos[i] = rArea.Center(); - } - break; - - case 1 : - { - // TopLeft-Spot - aSpotPos[i] = rArea.TopLeft(); - aSpotPos[i].X() += nWidth14; - aSpotPos[i].Y() += nHeight14; - } - break; - - case 2 : - { - // TopRight-Spot - aSpotPos[i] = rArea.TopLeft(); - aSpotPos[i].X() += nWidth34; - aSpotPos[i].Y() += nHeight14; - } - break; - - case 3 : - { - // BottomLeft-Spot - aSpotPos[i] = rArea.TopLeft(); - aSpotPos[i].X() += nWidth14; - aSpotPos[i].Y() += nHeight34; - } - break; - - case 4 : - { - // BottomRight-Spot - aSpotPos[i] = rArea.TopLeft(); - aSpotPos[i].X() += nWidth34; - aSpotPos[i].Y() += nHeight34; - } - break; - - } - - aSpotColor[i] = Color( COL_WHITE ); - rCurrPage.GetFillColor(aSpotPos[i], rVisibleLayers, /*bLayerSortedRedraw,*/ aSpotColor[i]); - } - - USHORT aMatch[SPOTCOUNT]; - - for ( i = 0; i < SPOTCOUNT; i++ ) - { - // Wurden gleiche Spot-Farben gefuden? - aMatch[i] = 0; - - for ( USHORT j = 0; j < SPOTCOUNT; j++ ) - { - if( j != i ) - { - if( aSpotColor[i] == aSpotColor[j] ) - { - aMatch[i]++; - } - } - } - } - - // Das hoechste Gewicht hat der Spot in der Mitte - aBackground = aSpotColor[0]; - - for ( USHORT nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- ) - { - // Welche Spot-Farbe wurde am haeufigsten gefunden? - for ( i = 0; i < SPOTCOUNT; i++ ) - { - if( aMatch[i] == nMatchCount ) - { - aBackground = aSpotColor[i]; - nMatchCount = 1; // Abbruch auch der aeusseren for-Schleife - break; - } - } - } - } - - return aBackground; -} - // #114898# bool SdrPaintView::IsBufferedOutputAllowed() const { diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index be0e871d61bf..0f126e2ec701 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -93,11 +93,16 @@ void ImplPageOriginOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition) if(rNewPosition != maPosition) { // apply to OverlayObjects - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( - rNewPosition.getX() - maPosition.getX(), - rNewPosition.getY() - maPosition.getY()); - maObjects.transform(aMatrix); + for(sal_uInt32 a(0); a < maObjects.count(); a++) + { + sdr::overlay::OverlayCrosshairStriped* pCandidate = + static_cast< sdr::overlay::OverlayCrosshairStriped* >(&maObjects.getOverlayObject(a)); + + if(pCandidate) + { + pCandidate->setBasePosition(rNewPosition); + } + } // remember new position maPosition = rNewPosition; @@ -167,11 +172,17 @@ void ImplHelpLineOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition) if(rNewPosition != maPosition) { // apply to OverlayObjects - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( - rNewPosition.getX() - maPosition.getX(), - rNewPosition.getY() - maPosition.getY()); - maObjects.transform(aMatrix); + // apply to OverlayObjects + for(sal_uInt32 a(0); a < maObjects.count(); a++) + { + sdr::overlay::OverlayHelplineStriped* pCandidate = + static_cast< sdr::overlay::OverlayHelplineStriped* >(&maObjects.getOverlayObject(a)); + + if(pCandidate) + { + pCandidate->setBasePosition(rNewPosition); + } + } // remember new position maPosition = rNewPosition; diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index cbf80e23c91d..772811f6ccec 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -53,6 +53,7 @@ SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject / SdrText::~SdrText() { + clearWeak(); delete mpOutlinerParaObject; } diff --git a/svx/source/svdraw/svdtouch.cxx b/svx/source/svdraw/svdtouch.cxx deleted file mode 100644 index 918855b6d665..000000000000 --- a/svx/source/svdraw/svdtouch.cxx +++ /dev/null @@ -1,299 +0,0 @@ -/************************************************************************* - * - * 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: svdtouch.cxx,v $ - * $Revision: 1.11 $ - * - * 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 "svdtouch.hxx" -#include <svx/xpoly.hxx> -#include <tools/bigint.hxx> -#include <tools/poly.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -class ImpPolyHitCalc { -public: - long x1,x2,y1,y2; // Koordinaten des Rect, muessen sortiert sein! - FASTBOOL bEdge; // ein Punkt lag genau auf einer Kante - FASTBOOL bIntersect; // mind. 2 Punkte auf verschiedenen Seiten einer Kante - FASTBOOL bPntInRect; // mind. 1 Punkt war vollstaendig im Rect - USHORT nOCnt; // wenn Counter ungerade, dann getroffen - USHORT nUCnt; // wenn Counter ungerade, dann getroffen - USHORT nLCnt; // wenn Counter ungerade, dann getroffen - USHORT nRCnt; // wenn Counter ungerade, dann getroffen - FASTBOOL bLine; // TRUE=PolyLine, kein Polygon -public: - ImpPolyHitCalc(const Rectangle& aR, FASTBOOL bIsLine=FALSE) - { - bLine=bIsLine; - bEdge=FALSE; - bIntersect=FALSE; - bPntInRect=FALSE; - x1=aR.Left(); - x2=aR.Right(); - y1=aR.Top(); - y2=aR.Bottom(); - nOCnt=0; - nUCnt=0; - nLCnt=0; - nRCnt=0; - } - FASTBOOL IsDecided() { return bEdge || bIntersect || bPntInRect; } - void CheckPntInRect(const Point& rP) - { - if (!bPntInRect) { - bPntInRect=rP.X()>=x1 && rP.X()<=x2 && rP.Y()>=y1 && rP.Y()<=y2; - } - } - bool IsHit() { return (!bLine && (nOCnt & 1)==1) || IsDecided(); } -}; - -#define CAREFUL_MULDIV(Res,Val,Mul,Div) { \ - if (Abs(Val)>0xB504 || Abs(Mul)>0xB504) { \ - BigInt aBigTemp(Val); \ - aBigTemp*=Mul; \ - aBigTemp/=Div; \ - Res=long(aBigTemp); \ - } else { \ - Res=Val*Mul/Div; \ - } \ -} - -void ImpCheckIt(ImpPolyHitCalc& rH, long lx1, long ly1, long lx2, long ly2, - long rx1, long ry1, long rx2, long ry2, USHORT& nOCnt, USHORT& nUCnt) -{ - if ((ly1>ly2) || ((ly1==ly2) && (lx1>lx2))) { - long nTmp; // die 2 Punkte nach Y sortieren - nTmp=lx1; - lx1=lx2; - lx2=nTmp; - nTmp=ly1; - ly1=ly2; - ly2=nTmp; - } - FASTBOOL b1=FALSE,b2=FALSE,b3=FALSE,b4=FALSE; // je 1 Flag fuer jeden der 4 Punkte LO,RO,LU,RU - FASTBOOL bx1,bx2; - FASTBOOL by1=ly1<=ry1 && ly2>ry1; - FASTBOOL by2=ly1<=ry2 && ly2>ry2; - long dx(0),dy(0),a(0); - if (by1 || by2) { - dx=lx2-lx1; - dy=ly2-ly1; - } - if (by1) { // Nur wer die Scanline schneidet - bx1=lx1<rx1; // x1,y1 - bx2=lx2<rx1; - FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen - if (bx1 && bx2) b1=TRUE; - else if (bx1 || bx2) { - long yTemp=ry1-ly1; - CAREFUL_MULDIV(a,dx,yTemp,dy); // a=dx*yTemp/dy; - a+=lx1; - bA=TRUE; - rH.bEdge=(a==rx1); - if (a<rx1) b1=TRUE; - } // x2,y1 - bx1=lx1<rx2; - bx2=lx2<rx2; - if (bx1 && bx2) b2=TRUE; - else if (bx1 || bx2) { - if (!bA) { - long yTemp=ry1-ly1; - CAREFUL_MULDIV(a,dx,yTemp,dy); - a+=lx1; - } - rH.bEdge=(a==rx2); - if (a<rx2) b2=TRUE; - } - } - if (by2) { // Nur wer die Scanline schneidet - bx1=lx1<rx1; // x1,y2 - bx2=lx2<rx1; - FASTBOOL bA=FALSE; // Optimierung: ggf eine Division sparen - if (bx1 && bx2) b3=TRUE; - else if (bx1 || bx2) { - long yTemp=ry2-ly1; - CAREFUL_MULDIV(a,dx,yTemp,dy); - a+=lx1; - bA=TRUE; - rH.bEdge=(a==rx1); - if (a<rx1) b3=TRUE; - } - bx1=lx1<rx2; // x2,y2 - bx2=lx2<rx2; - if (bx1 && bx2) b4=TRUE; - else if (bx1 || bx2) { - if (!bA) { - long yTemp=ry2-ly1; - CAREFUL_MULDIV(a,dx,yTemp,dy); - a+=lx1; - } - rH.bEdge=(a==rx2); - if (a<rx2) b4=TRUE; - } - } - if (by1 || by2) { // nun die Ergebnisse auswerten - if (by1 && by2) { // Linie durch beide Scanlines - if (b1 && b2 && b3 && b4) { nOCnt++; nUCnt++; } // Rect komplett rechts neben der Linie - else if (b1 || b2 || b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt - } else { // ansonsten Ober- und Unterkante des Rects getrennt betrachten - if (by1) { // Linie durch Oberkante - if (b1 && b2) nOCnt++; // Oberkante komplett rechts neben der Linie - else if (b1 || b2) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt - } - if (by2) { // Linie durch Unterkante - if (b3 && b4) nUCnt++; // Unterkante komplett rechts neben der Linie - else if (b3 || b4) rH.bIntersect=TRUE; // Nur zum Teil->Schnittpunkt - } - } - } -} - -void CheckPolyHit(const Polygon& rPoly, ImpPolyHitCalc& rH) -{ - USHORT nAnz=rPoly.GetSize(); - if (nAnz==0) return; - if (nAnz==1) { rH.CheckPntInRect(rPoly[0]); return; } - Point aPt0=rPoly[USHORT(nAnz-1)]; - rH.CheckPntInRect(aPt0); - USHORT i=0; - if (rH.bLine) { - aPt0=rPoly[0]; - i++; - } - for (; i<nAnz && !rH.IsDecided(); i++) { - Point aP1(aPt0); - Point aP2(rPoly[i]); - rH.CheckPntInRect(aP2); - if (!rH.IsDecided()) { - ImpCheckIt(rH,aP1.X(),aP1.Y(),aP2.X(),aP2.Y(),rH.x1,rH.y1,rH.x2,rH.y2,rH.nOCnt,rH.nUCnt); - ImpCheckIt(rH,aP1.Y(),aP1.X(),aP2.Y(),aP2.X(),rH.y1,rH.x1,rH.y2,rH.x2,rH.nLCnt,rH.nRCnt); - } - aPt0=rPoly[i]; - } - if (!rH.bLine) { // Sicherheitshalber nochmal checken - if ((rH.nOCnt&1)!=(rH.nUCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein - if ((rH.nLCnt&1)!=(rH.nRCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein - if ((rH.nOCnt&1)!=(rH.nLCnt&1)) rH.bIntersect=TRUE; // da wird wohl eine durchgegangen sein - } -} - -bool IsRectTouchesLine(const Point& rPt1, const Point& rPt2, const Rectangle& rHit) -{ - Polygon aPol(2); - aPol[0]=rPt1; - aPol[1]=rPt2; - ImpPolyHitCalc aHit(rHit,TRUE); - CheckPolyHit(aPol,aHit); - return aHit.IsHit(); -} - -bool IsRectTouchesLine(const Polygon& rLine, const Rectangle& rHit) -{ - ImpPolyHitCalc aHit(rHit,TRUE); - CheckPolyHit(rLine,aHit); - return aHit.IsHit(); -} - -bool IsRectTouchesLine(const PolyPolygon& rLine, const Rectangle& rHit) -{ - ImpPolyHitCalc aHit(rHit,TRUE); - USHORT nAnz=rLine.Count(); - for (USHORT nNum=0; nNum<nAnz && !aHit.IsHit(); nNum++) { - CheckPolyHit(rLine[nNum],aHit); - } - return aHit.IsHit(); -} - -BYTE CheckPointTouchesPoly(const Polygon& rPoly, const Point& rHit) // 0=Ausserhalb, 1=Innerhalb, 2=Beruehrung -{ - USHORT nAnz=rPoly.GetSize(); - if (nAnz<2) return FALSE; - FASTBOOL bEdge=FALSE; - USHORT nCnt=0; - Point aPt0=rPoly[USHORT(nAnz-1)]; - for (USHORT i=0; i<nAnz && !bEdge; i++) { - Point aP1(rPoly[i]); - Point aP2(aPt0); - if ((aP1.Y()>aP2.Y()) || ((aP1.Y()==aP2.Y()) && (aP1.X()>aP2.X()))) { Point aTmp(aP1); aP1=aP2; aP2=aTmp; } - bEdge=((aP1.X()==aP2.X()) && (rHit.X()==aP1.X()) && (rHit.Y()>=aP1.Y()) && (rHit.Y()<=aP2.Y())) || - ((aP1.Y()==aP2.Y()) && (rHit.Y()==aP1.Y()) && (rHit.X()>=aP1.X()) && (rHit.X()<=aP2.X())) || - (rHit.X()==aP1.X()) && (rHit.Y()==aP1.Y()); - if (!bEdge && aP1.Y()<=rHit.Y() && aP2.Y()>rHit.Y()) { // Nur wer die Scanline schneidet - FASTBOOL bx1=aP1.X()<rHit.X(); - FASTBOOL bx2=aP2.X()<rHit.X(); - if (bx1 && bx2) nCnt++; - else if (bx1 || bx2) { - long dx=aP2.X()-aP1.X(); - long dy=aP2.Y()-aP1.Y(); - long yTemp=rHit.Y()-aP1.Y(); - long xTemp; - if (Abs(dx)>0xB504 || Abs(yTemp)>0xB504) { // gegen Integerueberlaeufe - BigInt aBigTemp(dx); - aBigTemp*=yTemp; - aBigTemp/=dy; - xTemp=long(aBigTemp); - } else { - xTemp=dx*yTemp /dy; - } - xTemp+=aP1.X(); - bEdge=(xTemp==rHit.X()); - if (xTemp<rHit.X()) nCnt++; - } - } - aPt0=rPoly[i]; - } - if (bEdge) return 2; - return (nCnt & 1)==1; -} - -bool IsPointInsidePoly(const Polygon& rPoly, const Point& rHit) -{ - return CheckPointTouchesPoly(rPoly,rHit)!=0; -} - -bool IsPointInsidePoly(const PolyPolygon& rPoly, const Point& rHit) -{ - FASTBOOL bInside=FALSE; - FASTBOOL bEdge=FALSE; - USHORT nAnz=rPoly.Count(); - for (USHORT i=0; i<nAnz && !bEdge; i++) { - BYTE n=CheckPointTouchesPoly(rPoly.GetObject(i),rHit); - bEdge=n==2; - if (n==1) bInside=!bInside; - } - return bInside || bEdge; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx deleted file mode 100644 index e78b85ff10d0..000000000000 --- a/svx/source/svdraw/svdtxhdl.cxx +++ /dev/null @@ -1,400 +0,0 @@ -/************************************************************************* - * - * 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: svdtxhdl.cxx,v $ - * $Revision: 1.29 $ - * - * 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 "svdtxhdl.hxx" -#include <limits.h> -#include "svditext.hxx" -#include <svx/svdmodel.hxx> -#include <svx/svdpage.hxx> -#include <svx/svdogrp.hxx> -#include <svx/svdotext.hxx> -#include <svx/svdoutl.hxx> -#include <svx/outliner.hxx> -#include <svx/outlobj.hxx> -#include <svx/svxfont.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xlnwtit.hxx> -#include <svx/xflclit.hxx> -#include <vcl/metric.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <com/sun/star/i18n/ScriptType.hdl> -#include <com/sun/star/i18n/XBreakIterator.hpp> -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/i18n/CharacterIteratorMode.hdl> -#include "unolingu.hxx" -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <svtools/itemset.hxx> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::i18n; - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -ImpTextPortionHandler::ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj): - rOutliner(rOutln), - rTextObj(rTxtObj) -{ - SdrModel* pModel = rTextObj.GetModel(); - MapMode aMap=aVDev.GetMapMode(); - - aMap.SetMapUnit(pModel->GetScaleUnit()); - aMap.SetScaleX(pModel->GetScaleFraction()); - aMap.SetScaleY(pModel->GetScaleFraction()); - aVDev.SetMapMode(aMap); -} - -void ImpTextPortionHandler::ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bPoly) -{ - bToPoly=bPoly; - pGroup=&rGroup; - - Rectangle aAnchorRect; - Rectangle aTextRect; - SdrFitToSizeType eFit=rTextObj.GetFitToSize(); - FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); - // Bei TakeTextRect wird u.a. auch der Text in - // den Outliner gesteckt - rTextObj.TakeTextRect(rOutliner,aTextRect,FALSE,&aAnchorRect); - maTextRect=aTextRect; - if (bFitToSize) maTextRect=aAnchorRect; - rOutliner.SetDrawPortionHdl(LINK(this,ImpTextPortionHandler,ConvertHdl)); - rOutliner.StripPortions(); - rOutliner.SetDrawPortionHdl(Link()); - rOutliner.Clear(); - - if(bFitToSize) - { - Fraction nX(aAnchorRect.Right()-aAnchorRect.Left(),aTextRect.Right()-aTextRect.Left()); - Fraction nY(aAnchorRect.Bottom()-aAnchorRect.Top(),aTextRect.Bottom()-aTextRect.Top()); - - // #95395# scale from top-right when vertical text - if(rOutliner.IsVertical()) - pGroup->NbcResize(aAnchorRect.TopRight(),nX,nY); - else - pGroup->NbcResize(aAnchorRect.TopLeft(),nX,nY); - } - if (rTextObj.aGeo.nDrehWink!=0) { // #35825# Rotieren erst nach Resize (wg. FitToSize) - pGroup->NbcRotate(maTextRect.TopLeft(),rTextObj.aGeo.nDrehWink,rTextObj.aGeo.nSin,rTextObj.aGeo.nCos); - } -} - -// #101498# Helper class to remember text portions in sorted manner -class ImpRecordPortion -{ -public: - Point maPosition; - String maText; - xub_StrLen mnTextStart; - xub_StrLen mnTextLength; - sal_uInt16 mnPara; - xub_StrLen mnIndex; - - // #102819# Here SvxFont needs to be used instead of Font - SvxFont maFont; - - sal_Int32* mpDXArray; - sal_uInt8 mnBiDiLevel; - - ImpRecordPortion(DrawPortionInfo* pInfo); - ~ImpRecordPortion(); - - sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } -}; - -ImpRecordPortion::ImpRecordPortion(DrawPortionInfo* pInfo) -: maPosition(pInfo->mrStartPos), - maText(pInfo->mrText), - mnTextStart((xub_StrLen)pInfo->mnTextStart), - mnTextLength((xub_StrLen)pInfo->mnTextLen), - mnPara(pInfo->mnPara), - mnIndex(pInfo->mnIndex), - maFont(pInfo->mrFont), - mpDXArray(NULL), - mnBiDiLevel(pInfo->GetBiDiLevel()) -{ - if(pInfo->mpDXArray) - { - mpDXArray = new sal_Int32[pInfo->mnTextLen]; - - for(sal_uInt32 a(0L); a < pInfo->mnTextLen; a++) - { - mpDXArray[a] = pInfo->mpDXArray[a]; - } - } -} - -ImpRecordPortion::~ImpRecordPortion() -{ - if(mpDXArray) - { - delete[] mpDXArray; - } -} - -IMPL_LINK(ImpTextPortionHandler,ConvertHdl,DrawPortionInfo*,pInfo) -{ - // maTextRect enthaelt den Ausgabebereich des Textobjekts - BOOL bIsVertical(rOutliner.IsVertical()); - Point aPos2(maTextRect.TopLeft() + pInfo->mrStartPos); - Color aColor(pInfo->mrFont.GetColor()); - - if(bIsVertical) - aPos2 = maTextRect.TopRight() + pInfo->mrStartPos; - - Point aStartPos(aPos2); - SfxItemSet aAttrSet((SfxItemPool&)(*rTextObj.GetObjectItemPool())); - long nHochTief(pInfo->mrFont.GetEscapement()); - FontMetric aFontMetric(aVDev.GetFontMetric()); - sal_Int32 nLineLen(0L); - - Font aFont( pInfo->mrFont ); - - if( nHochTief) - { - // shrink the font for sub-/superscripting - long nPercent(pInfo->mrFont.GetPropr()); - - if(nPercent != 100) - { - Size aSize(aFont.GetSize()); - aSize.Height() = (aSize.Height() * nPercent +50) / 100; - aSize.Width() = (aSize.Width() * nPercent +50) / 100; - aFont.SetSize(aSize); - } - - sal_Bool bNeg(nHochTief < 0); - - if(bNeg) - nHochTief = -nHochTief; - - nHochTief = (nHochTief * pInfo->mrFont.GetSize().Height() +50) /100; - - if(bNeg) - nHochTief = -nHochTief; - } - - aFont.SetOrientation( 0 ); - aVDev.SetFont( aFont ); - - if(bIsVertical) - // #83068# - aPos2.X() += aFontMetric.GetAscent() + nHochTief; - else - aPos2.Y() -= aFontMetric.GetAscent() + nHochTief; - - if (pInfo->mrFont.IsOutline()) - { - aAttrSet.Put(XLineColorItem(String(),aColor)); - aAttrSet.Put(XLineStyleItem(XLINE_SOLID)); - aAttrSet.Put(XLineWidthItem(0)); - aAttrSet.Put(XFillStyleItem(XFILL_NONE)); - } - else - { - aAttrSet.Put(XFillColorItem(String(),aColor)); - aAttrSet.Put(XLineStyleItem(XLINE_NONE)); - aAttrSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - // #100318# convert in a single step - // #101499# Use GetTextOutlines and a PolyPolyVector now - PolyPolyVector aPolyPolyVector; - if(aVDev.GetTextOutlines(aPolyPolyVector, pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextStart, pInfo->mnTextLen) - && aPolyPolyVector.size()) - { - for(sal_uInt32 a(0); a < aPolyPolyVector.size(); a++) - { - PolyPolygon aPolyPoly(aPolyPolyVector[a]); - - if(aPolyPoly.Count() > 0 && aPolyPoly[0].GetSize() > 0) - { - basegfx::B2DPolyPolygon aPolyPolygon(aPolyPoly.getB2DPolyPolygon()); - basegfx::B2DHomMatrix aMatrix; - - // rotate 270 degree if vertical since result is unrotated - if(pInfo->mrFont.GetOrientation()) - { - double fAngle(F_PI * (pInfo->mrFont.GetOrientation() % 3600) / 1800.0); - aMatrix.rotate(fAngle); - } - - // result is baseline oriented, thus move one line height, too - if(bIsVertical) - { - aMatrix.translate(-aFontMetric.GetAscent(), 0.0); - } - else - { - aMatrix.translate(0.0, aFontMetric.GetAscent()); - } - - // move to output coordinates - aMatrix.translate(aPos2.X(), aPos2.Y()); - - // transform - aPolyPolygon.transform(aMatrix); - - // create object - SdrObject* pObj = rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True); - pObj->SetMergedItemSet(aAttrSet); - pGroup->GetSubList()->InsertObject(pObj); - } - } - - nLineLen = pInfo->mpDXArray[pInfo->mnTextLen - 1]; - } - - FontUnderline eUndl=pInfo->mrFont.GetUnderline(); - FontStrikeout eStrk=pInfo->mrFont.GetStrikeout(); - if (eUndl!=UNDERLINE_NONE) { - FASTBOOL bDouble=eUndl==UNDERLINE_DOUBLE; - long nDescent=aFontMetric.GetDescent(); - long nAscend=aFontMetric.GetAscent(); - long nDick=nDescent / (bDouble ? 5 : 3); - long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt - basegfx::B2DPolyPolygon aPolyPolygon; - - if (eUndl!=UNDERLINE_DOTTED) { - Point aPoint(0,0); - XPolygon aXP(Rectangle(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick))); - if(bIsVertical) - aXP.Move(nAscend-nDist,0); - aPolyPolygon.append(aXP.getB2DPolygon()); - if (bDouble) { - if(bIsVertical) - aXP.Move(-(nDick+nDist),0); - else - aXP.Move(0,nDick+nDist); - aPolyPolygon.append(aXP.getB2DPolygon()); - } - } else { - Point aPoint(0,0); - XPolygon aXP(Rectangle(aPoint,Point(nDick,nDick))); - long n=0; - while (n<=nLineLen) { - if (n+nDick>nLineLen) { // ler letzte Dot ggf. etwas schmaler - aXP=XPolygon(Rectangle( - bIsVertical ? Point(0,n) : Point(n,0), - bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick))); - } - aPolyPolygon.append(aXP.getB2DPolygon()); - if(bIsVertical) - aXP.Move(0,2*nDick); - else - aXP.Move(2*nDick,0); - n+=2*nDick; - } - } - - long y=nDescent-nDick; // y-Position der Striche zur Baseline bestimmen - if (bDouble) y-=nDick+nDist; - y=(y+1)/2; - - basegfx::B2DHomMatrix aMatrix; - - if(bIsVertical) - { - aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y()); - } - else - { - aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief); - } - - aPolyPolygon.transform(aMatrix); - - // maTextRect enthaelt den Ausgabebereich des Textobjekts - SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True); - pObj->SetMergedItemSet(aAttrSet); - pGroup->GetSubList()->InsertObject(pObj); - } - if (eStrk!=STRIKEOUT_NONE) { - FASTBOOL bDouble=eStrk==STRIKEOUT_DOUBLE; - long nDescent=aFontMetric.GetDescent(); - //long nAscend=aFontMetric.GetAscent(); - long nDick=nDescent / (bDouble ? 5 : 3); - long nDist=(nDescent-nDick*2)/3; // Linienabstand bei doppelt - basegfx::B2DPolyPolygon aPolyPolygon; - - const Point aPoint(0,0); - const Rectangle aRect(aPoint,bIsVertical ? Point(nDick,nLineLen) : Point(nLineLen,nDick)); - const basegfx::B2DRange aRectRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); - basegfx::B2DPolygon aPolyFromRect(basegfx::tools::createPolygonFromRect(aRectRange)); - aPolyPolygon.append(aPolyFromRect); - - if (bDouble) - { - basegfx::B2DHomMatrix aMatrix; - - if(bIsVertical) - aMatrix.translate(-(nDick+nDist), 0.0); - else - aMatrix.translate(0.0, nDick+nDist); - - aPolyFromRect.transform(aMatrix); - aPolyPolygon.append(aPolyFromRect); - } - - // y-Position der Striche zur Baseline bestimmen - long y=-(long)(aFontMetric.GetAscent()-aFontMetric.GetIntLeading()+1)/3; - if (!bDouble) y-=(nDick+1)/2; - else y-=nDick+(nDist+1)/2; - - basegfx::B2DHomMatrix aMatrix; - - if(bIsVertical) - { - aMatrix.translate(aStartPos.X() - (y - nHochTief), aStartPos.Y()); - } - else - { - aMatrix.translate(aStartPos.X(), aStartPos.Y() + y - nHochTief); - } - - aPolyPolygon.transform(aMatrix); - - // maTextRect enthaelt den Ausgabebereich des Textobjekts - SdrObject* pObj=rTextObj.ImpConvertMakeObj(aPolyPolygon, sal_True, !bToPoly, sal_True); - pObj->SetMergedItemSet(aAttrSet); - pGroup->GetSubList()->InsertObject(pObj); - } - - return 0; -} - -// eof diff --git a/svx/source/svdraw/svdtxhdl.hxx b/svx/source/svdraw/svdtxhdl.hxx deleted file mode 100644 index 82fd38519171..000000000000 --- a/svx/source/svdraw/svdtxhdl.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * 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: svdtxhdl.hxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVDTXHDL_HXX -#define _SVDTXHDL_HXX - -#include <vcl/virdev.hxx> -#include <tools/poly.hxx> -#include <tools/link.hxx> - -//************************************************************ -// Vorausdeklarationen -//************************************************************ - -class SdrOutliner; -class DrawPortionInfo; -class SdrTextObj; -class SdrObjGroup; -class SdrModel; - -//************************************************************ -// ImpTextPortionHandler -//************************************************************ - -class ImpTextPortionHandler -{ - VirtualDevice aVDev; - SdrOutliner& rOutliner; - const SdrTextObj& rTextObj; - - // Variablen fuer ConvertToPathObj - SdrObjGroup* pGroup; - FASTBOOL bToPoly; - Rectangle maTextRect; - -public: - ImpTextPortionHandler(SdrOutliner& rOutln, const SdrTextObj& rTxtObj); - void ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bToPoly); - - DECL_LINK(ConvertHdl,DrawPortionInfo*); -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -#endif //_SVDTXHDL_HXX - diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 0d47c0e81170..c7702b0d372a 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -55,13 +55,12 @@ #include "svx/svddrgmt.hxx" #include "svx/svdoutl.hxx" #include "svx/svdotable.hxx" - -// #90477# #include <tools/tenccvt.hxx> #include <svx/sdr/overlay/overlaypolypolygon.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> #include <sdrpaintwindow.hxx> #include <svx/sdrpagewindow.hxx> +#include <svx/sdrhittesthelper.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -489,7 +488,9 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj); if (pTextObj!=NULL && pTextObj->HasText()) { - BOOL bTEHit=pTextObj->IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/,&pPV->GetVisibleLayers()); + bool bTEHit(pPV && + SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true)); + if (bTEHit) { Rectangle aTextRect; @@ -566,11 +567,15 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co if(!bBoundRectHit) { - BOOL bTEHit=pHitObj->IsTextEditHit(aLocalLogicPosition,0,&pPV->GetVisibleLayers()); + bool bTEHit(pPV && + SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true)); // TextEdit an Objekten im gesperrten Layer if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer())) + { bTEHit=FALSE; + } + if (bTEHit) { rVEvt.pRootObj=pObj; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index c42feb83c742..44caaee6c148 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1930,21 +1930,6 @@ void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom, // -------------------------------------------------------------------- -SdrObject* SdrTableObj::CheckHit(const Point& rPnt, USHORT /*nTol*/, const SetOfByte* pVisiLayer) const -{ - if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer()))) - { - return NULL; - } - - if( (rPnt.X() >= aOutRect.Left()) && (rPnt.X() <= aOutRect.Right()) && (rPnt.Y() >= aOutRect.Top()) && rPnt.Y() <= aOutRect.Bottom() ) - return const_cast<SdrObject*>(static_cast<const SdrObject*>(this)); - - return NULL; -} - -// -------------------------------------------------------------------- - void SdrTableObj::TakeObjNameSingul(XubString& rName) const { rName = ImpGetResStr(STR_ObjNameSingulTable); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 1d7b3f8a3295..3c6ec81cabdb 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1952,7 +1952,6 @@ void SvxTableController::updateSelectionOverlay() if( pOverlayManager ) { // sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_INVERT; - // sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_HATCH; sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_TRANSPARENT; sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 6b88e1d9a0ac..72e10e29c336 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -38,60 +38,36 @@ #include <vcl/salbtype.hxx> #include <vcl/canvastools.hxx> #include <vcl/hatch.hxx> - #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/range/b2drectangle.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> - #include <svx/sdr/overlay/overlayobject.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> #include <svx/sdrpagewindow.hxx> #include <sdrpaintwindow.hxx> #include <svx/svdmrkv.hxx> #include <svx/svdpagv.hxx> - +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <svx/sdr/overlay/overlayhatchrect.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> namespace sdr { namespace table { -class OverlayTableEdge : public sdr::overlay::OverlayObject -{ -protected: - basegfx::B2DPolyPolygon maPolyPolygon; - - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); - - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - -public: - OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon ); - virtual ~OverlayTableEdge(); -}; - // -------------------------------------------------------------------- -class OverlayTableBorder : public sdr::overlay::OverlayObject +class OverlayTableEdge : public sdr::overlay::OverlayObject { protected: basegfx::B2DPolyPolygon maPolyPolygon; + bool mbVisible; - // Draw geometry - virtual void drawGeometry(OutputDevice& rOutputDevice); - - // Create the BaseRange. This method needs to calculate maBaseRange. - virtual void createBaseRange(OutputDevice& rOutputDevice); - - virtual void transform(const basegfx::B2DHomMatrix& rMatrix); - - virtual sal_Bool isHit(const basegfx::B2DPoint& rPos, double fTol = 0.0) const; + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: - OverlayTableBorder( const basegfx::B2DPolyPolygon& rPolyPolygon ); - virtual ~OverlayTableBorder(); + OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible ); + virtual ~OverlayTableEdge(); }; // -------------------------------------------------------------------- @@ -134,40 +110,23 @@ sal_Int32 TableEdgeHdl::GetValidDragOffset( const SdrDragStat& rDrag ) const basegfx::B2DPolyPolygon TableEdgeHdl::getSpecialDragPoly(const SdrDragStat& rDrag) const { - return GetPolyPolygon(false, &rDrag); -} + basegfx::B2DPolyPolygon aVisible; + basegfx::B2DPolyPolygon aInvisible; -bool TableEdgeHdl::IsHdlHit(const Point& rPnt) const -{ - if( GetPointNum() != 0 ) - { - double fTol = 0.0; - if( pHdlList ) - { - SdrMarkView* pView = pHdlList->GetView(); - if( pView ) - { - OutputDevice* pOutDev = pView->GetFirstOutputDevice(); - if( pOutDev ) - { - fTol = static_cast<double>(pOutDev->PixelToLogic(Size(3, 3)).Width()); - } - } - } + // create and return visible and non-visible parts for drag + getPolyPolygon(aVisible, aInvisible, &rDrag); + aVisible.append(aInvisible); - basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y()); - if( basegfx::tools::isInEpsilonRange( maVisiblePolygon, aPosition, fTol ) ) - return sal_True; - } - return false; + return aVisible; } - -basegfx::B2DPolyPolygon TableEdgeHdl::GetPolyPolygon( bool bOnlyVisible, const SdrDragStat* pDrag /*= 0*/ ) const +void TableEdgeHdl::getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const { - basegfx::B2DPolyPolygon aRetValue; - + // changed method to create visible and invisible partial polygons in one run in + // separate PolyPolygons; both kinds are used basegfx::B2DPoint aOffset(aPos.X(), aPos.Y()); + rVisible.clear(); + rInvisible.clear(); if( pDrag ) { @@ -176,37 +135,35 @@ basegfx::B2DPolyPolygon TableEdgeHdl::GetPolyPolygon( bool bOnlyVisible, const S } basegfx::B2DPoint aStart(aOffset), aEnd(aOffset); - int nPos = mbHorizontal ? 0 : 1; - - // base line hit, check for edges TableEdgeVector::const_iterator aIter( maEdges.begin() ); + while( aIter != maEdges.end() ) { TableEdge aEdge(*aIter++); - if( aEdge.meState == Visible || ( aEdge.meState == Invisible && !bOnlyVisible ) ) - { - aStart[nPos] = aOffset[nPos] + aEdge.mnStart; - aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd; + aStart[nPos] = aOffset[nPos] + aEdge.mnStart; + aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd; - basegfx::B2DPolygon aPolygon; - aPolygon.append( aStart ); - aPolygon.append( aEnd ); + basegfx::B2DPolygon aPolygon; + aPolygon.append( aStart ); + aPolygon.append( aEnd ); - aRetValue.append( aPolygon ); + if(aEdge.meState == Visible) + { + rVisible.append(aPolygon); + } + else + { + rInvisible.append(aPolygon); } } - - return aRetValue; } void TableEdgeHdl::CreateB2dIAObject() { GetRidOfIAObject(); - maVisiblePolygon = GetPolyPolygon(false); - if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden()) { SdrMarkView* pView = pHdlList->GetView(); @@ -214,20 +171,40 @@ void TableEdgeHdl::CreateB2dIAObject() if(pPageView) { - for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++) - { - // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b]; - const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow); + basegfx::B2DPolyPolygon aVisible; + basegfx::B2DPolyPolygon aInvisible; - if(rPageWindow.GetPaintWindow().OutputToWindow()) + // get visible and invisible parts + getPolyPolygon(aVisible, aInvisible, 0); + + if(aVisible.count() || aInvisible.count()) + { + for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++) { - if(rPageWindow.GetOverlayManager()) - { - ::sdr::overlay::OverlayObject* pOverlayObject = - new OverlayTableEdge( GetPolyPolygon(true) ); + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow); - rPageWindow.GetOverlayManager()->add(*pOverlayObject); - maOverlayGroup.append(*pOverlayObject); + if(rPageWindow.GetPaintWindow().OutputToWindow()) + { + if(rPageWindow.GetOverlayManager()) + { + if(aVisible.count()) + { + // create overlay object for visible parts + sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aVisible, true); + rPageWindow.GetOverlayManager()->add(*pOverlayObject); + maOverlayGroup.append(*pOverlayObject); + } + + if(aInvisible.count()) + { + // also create overlay object vor invisible parts to allow + // a standard HitTest using the primitives from that overlay object + // (see OverlayTableEdge implementation) + sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aInvisible, false); + rPageWindow.GetOverlayManager()->add(*pOverlayObject); + maOverlayGroup.append(*pOverlayObject); + } + } } } } @@ -237,9 +214,10 @@ void TableEdgeHdl::CreateB2dIAObject() ////////////////////////////////////////////////////////////////////////////// -OverlayTableEdge::OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon ) +OverlayTableEdge::OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible ) : OverlayObject(Color(COL_GRAY)) , maPolyPolygon( rPolyPolygon ) +, mbVisible(bVisible) { } @@ -247,47 +225,35 @@ OverlayTableEdge::~OverlayTableEdge() { } -void OverlayTableEdge::drawGeometry(OutputDevice& rOutputDevice) +drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayObjectPrimitive2DSequence() { - rOutputDevice.SetLineColor(getBaseColor()); - rOutputDevice.SetFillColor(); + drawinglayer::primitive2d::Primitive2DSequence aRetval; - for(sal_uInt32 a(0L); a < maPolyPolygon.count();a ++) + if(maPolyPolygon.count()) { -/* - const basegfx::B2DPolygon aPolygon = maPolyPolygon.getB2DPolygon(a); - const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(0L)); - const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() - 1L)); - const Point aStartPoint(FRound(aStart.getX()), FRound(aStart.getY())); - const Point aEndPoint(FRound(aEnd.getX()), FRound(aEnd.getY())); - rOutputDevice.DrawLine(aStartPoint, aEndPoint); -*/ - PolyPolygon aPolyPolygon( maPolyPolygon ); - rOutputDevice.DrawTransparent( aPolyPolygon, 50 ); - } -} - -void OverlayTableEdge::transform(const basegfx::B2DHomMatrix& rMatrix) -{ - maPolyPolygon.transform( rMatrix ); -} - -void OverlayTableEdge::createBaseRange(OutputDevice& /*rOutputDevice*/) -{ - // reset range and expand it - maBaseRange.reset(); - - if(isHittable()) - { - for(sal_uInt32 a(0L); a < maPolyPolygon.count();a ++) + // Discussed with CL. Currently i will leave the transparence out since this + // a little bit expensive. We may check the look with drag polygons later + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( + maPolyPolygon, + getBaseColor().getBColor())); + + if(mbVisible) + { + // visible, just return as sequence + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + } + else { - const basegfx::B2DPolygon aPolygon = maPolyPolygon.getB2DPolygon(a); - const basegfx::B2DPoint aStart(aPolygon.getB2DPoint(0L)); - const basegfx::B2DPoint aEnd(aPolygon.getB2DPoint(aPolygon.count() - 1L)); - maBaseRange.expand(aStart); - maBaseRange.expand(aEnd); + // embed in HitTest primitive to support HitTest of this overlay object + const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); + const drawinglayer::primitive2d::Primitive2DReference aNewReference( + new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } + + return aRetval; } // ==================================================================== @@ -325,16 +291,15 @@ void TableBorderHdl::CreateB2dIAObject() { if(rPageWindow.GetOverlayManager()) { - OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice(); - - Size aBorderSize( rOutDev.PixelToLogic( Size( 6, 6 ) ) ); - basegfx::B2DRectangle aRect( vcl::unotools::b2DRectangleFromRectangle( maRectangle ) ); - basegfx::B2DPolyPolygon aPolyPolygon; - aPolyPolygon.append(basegfx::tools::createPolygonFromRect( aRect ) ); - aRect.grow( aBorderSize.nA ); - aPolyPolygon.append(basegfx::tools::createPolygonFromRect( aRect ) ); - - ::sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableBorder( aPolyPolygon ); + const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(maRectangle)); + sdr::overlay::OverlayObject* pOverlayObject = new sdr::overlay::OverlayHatchRect( + aRange.getMinimum(), + aRange.getMaximum(), + Color(0x80, 0x80, 0x80), + 6.0, + 0.0, + 45 * F_PI180, + 0.0); rPageWindow.GetOverlayManager()->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); @@ -345,55 +310,7 @@ void TableBorderHdl::CreateB2dIAObject() } } -OverlayTableBorder::OverlayTableBorder( const basegfx::B2DPolyPolygon& rPolyPolygon ) -: OverlayObject(Color(COL_GRAY)) -, maPolyPolygon( rPolyPolygon ) -{ -} - -OverlayTableBorder::~OverlayTableBorder() -{ -} - -// Hittest with logical coordinates -sal_Bool OverlayTableBorder::isHit(const basegfx::B2DPoint& rPos, double /*fTol = 0.0*/) const -{ - if(isHittable()) - { - if( basegfx::tools::isInside( maPolyPolygon.getB2DPolygon(1), rPos, true ) ) - if( !basegfx::tools::isInside( maPolyPolygon.getB2DPolygon(0), rPos, false ) ) - return sal_True; - } - return sal_False; -} - -// Draw geometry -void OverlayTableBorder::drawGeometry(OutputDevice& rOutputDevice) -{ - svtools::ColorConfig aColorConfig; - Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 ); - PolyPolygon aPolyPolygon( maPolyPolygon ); - rOutputDevice.DrawHatch( aPolyPolygon, aHatch ); -} - -// Create the BaseRange. This method needs to calculate maBaseRange. -void OverlayTableBorder::createBaseRange(OutputDevice& /*rOutputDevice*/) -{ - if(isHittable()) - { - maBaseRange = basegfx::tools::getRange(maPolyPolygon); - } - else - { - maBaseRange.reset(); - } -} - -void OverlayTableBorder::transform(const basegfx::B2DHomMatrix& rMatrix) -{ - maPolyPolygon.transform( rMatrix ); -} +////////////////////////////////////////////////////////////////////////////// } // end of namespace table } // end of namespace sdr diff --git a/svx/source/table/tablehandles.hxx b/svx/source/table/tablehandles.hxx index a6831f72bc88..e78d7fc4bdd3 100644 --- a/svx/source/table/tablehandles.hxx +++ b/svx/source/table/tablehandles.hxx @@ -57,8 +57,6 @@ class TableEdgeHdl : public SdrHdl public: TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges ); - virtual bool IsHdlHit(const Point& rPnt) const; - sal_Int32 GetValidDragOffset( const SdrDragStat& rDrag ) const; virtual Pointer GetPointer() const; @@ -68,7 +66,7 @@ public: bool IsHorizontalEdge() const { return mbHorizontal; } basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const; - basegfx::B2DPolyPolygon GetPolyPolygon( bool bOnlyVisible, const SdrDragStat* pDrag = 0 ) const; + void getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const; protected: // create marker for this kind @@ -77,7 +75,6 @@ protected: private: bool mbHorizontal; sal_Int32 mnMin, mnMax; - basegfx::B2DPolyPolygon maVisiblePolygon; TableEdgeVector maEdges; }; |