summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/attribute/makefile.mk5
-rw-r--r--svx/source/sdr/attribute/sdrallattribute.cxx408
-rw-r--r--svx/source/sdr/attribute/sdrfilltextattribute.cxx92
-rw-r--r--svx/source/sdr/attribute/sdrformtextattribute.cxx335
-rw-r--r--svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx143
-rw-r--r--svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx95
-rw-r--r--svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx93
-rw-r--r--svx/source/sdr/attribute/sdrshadowtextattribute.cxx85
-rw-r--r--svx/source/sdr/attribute/sdrtextattribute.cxx461
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx3
-rw-r--r--svx/source/sdr/contact/viewcontactofe3d.cxx30
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dcube.cxx17
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dextrude.cxx22
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx24
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx18
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dscene.cxx117
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dsphere.cxx20
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx236
-rw-r--r--svx/source/sdr/contact/viewcontactofgroup.cxx26
-rw-r--r--svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx65
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx194
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcircobj.cxx91
-rw-r--r--svx/source/sdr/contact/viewcontactofsdredgeobj.cxx43
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx149
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx13
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx189
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx93
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx68
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx163
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrrectobj.cxx105
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx45
-rw-r--r--svx/source/sdr/contact/viewcontactofvirtobj.cxx41
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3d.cxx1
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx11
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgroup.cxx14
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx25
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx4
-rw-r--r--svx/source/sdr/overlay/overlayobjectcell.cxx8
-rw-r--r--svx/source/sdr/overlay/overlayselection.cxx10
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx417
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx65
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx44
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx27
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx58
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx116
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx66
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx130
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx72
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx63
-rw-r--r--svx/source/sdr/primitive2d/sdrprimitivetools.cxx17
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx55
-rw-r--r--svx/source/sdr/primitive3d/sdrattributecreator3d.cxx5
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx16
-rw-r--r--svx/source/sdr/properties/makefile.mk1
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx80
57 files changed, 2600 insertions, 2204 deletions
diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk
index 5ca44ee5c240..177654ff1e1c 100644
--- a/svx/source/sdr/attribute/makefile.mk
+++ b/svx/source/sdr/attribute/makefile.mk
@@ -39,7 +39,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES=\
- $(SLO)$/sdrallattribute.obj \
+ $(SLO)$/sdrfilltextattribute.obj \
+ $(SLO)$/sdrlinefillshadowtextattribute.obj \
+ $(SLO)$/sdrlineshadowtextattribute.obj \
+ $(SLO)$/sdrshadowtextattribute.obj \
$(SLO)$/sdrtextattribute.obj \
$(SLO)$/sdrformtextattribute.obj \
$(SLO)$/sdrformtextoutlineattribute.obj
diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx
deleted file mode 100644
index b1dd2d37dd69..000000000000
--- a/svx/source/sdr/attribute/sdrallattribute.cxx
+++ /dev/null
@@ -1,408 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_svx.hxx"
-
-#include <svx/sdr/attribute/sdrallattribute.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
-#include <svx/sdr/attribute/sdrtextattribute.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// pointer compare define
-#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace attribute
- {
- SdrShadowTextAttribute::SdrShadowTextAttribute(
- SdrShadowAttribute* pShadow,
- SdrTextAttribute* pTextAttribute)
- : mpShadow(pShadow),
- mpTextAttribute(pTextAttribute)
- {
- }
-
- SdrShadowTextAttribute::SdrShadowTextAttribute(
- const SdrShadowTextAttribute& rCandidate)
- : mpShadow(0),
- mpTextAttribute(0)
- {
- *this = rCandidate;
- }
-
- SdrShadowTextAttribute::~SdrShadowTextAttribute()
- {
- delete mpShadow;
- delete mpTextAttribute;
- }
-
- SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate)
- {
- // handle mpShadow
- {
- // delete local mpShadow if necessary
- if(mpShadow)
- {
- delete mpShadow;
- mpShadow = 0;
- }
-
- // copy mpShadow if necessary
- if(rCandidate.mpShadow)
- {
- mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
- }
- }
-
- // handle mpTextAttribute
- {
- // delete local mpTextAttribute if necessary
- if(mpTextAttribute)
- {
- delete mpTextAttribute;
- mpTextAttribute = 0;
- }
-
- // copy mpTextAttribute if necessary
- if(rCandidate.mpTextAttribute)
- {
- mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute);
- }
- }
-
- return *this;
- }
-
- bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const
- {
- // handle mpShadow
- if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow))
- return false;
-
- // handle mpTextAttribute
- if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute))
- return false;
-
- return true;
- }
- } // end of namespace attribute
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace attribute
- {
- SdrFillTextAttribute::SdrFillTextAttribute(
- SdrFillAttribute* pFill,
- FillGradientAttribute* pFillFloatTransGradient,
- SdrTextAttribute* pTextAttribute)
- : mpFill(pFill),
- mpFillFloatTransGradient(pFillFloatTransGradient),
- mpTextAttribute(pTextAttribute)
- {
- }
-
- SdrFillTextAttribute::SdrFillTextAttribute(
- const SdrFillTextAttribute& rCandidate)
- : mpFill(0),
- mpFillFloatTransGradient(0),
- mpTextAttribute(0)
- {
- *this = rCandidate;
- }
-
- SdrFillTextAttribute::~SdrFillTextAttribute()
- {
- delete mpFill;
- delete mpFillFloatTransGradient;
- delete mpTextAttribute;
- }
-
- SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate)
- {
- // handle mpFill
- {
- // delete local mpFill if necessary
- if(mpFill)
- {
- delete mpFill;
- mpFill = 0;
- }
-
- // copy mpFill if necessary
- if(rCandidate.mpFill)
- {
- mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill);
- }
- }
-
- // handle mpFillFloatTransGradient
- {
- // delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient)
- {
- delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0;
- }
-
- // copy mpFillFloatTransGradient if necessary
- if(rCandidate.mpFillFloatTransGradient)
- {
- mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
- }
- }
-
- // handle mpTextAttribute
- {
- // delete local mpTextAttribute if necessary
- if(mpTextAttribute)
- {
- delete mpTextAttribute;
- mpTextAttribute = 0;
- }
-
- // copy mpTextAttribute if necessary
- if(rCandidate.mpTextAttribute)
- {
- mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute);
- }
- }
-
- return *this;
- }
-
- bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const
- {
- // handle mpFill
- if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
- return false;
-
- // handle mpFillFloatTransGradient
- if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
- return false;
-
- // handle mpTextAttribute
- if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute))
- return false;
-
- return true;
- }
- } // end of namespace attribute
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace attribute
- {
- SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
- SdrLineAttribute* pLine,
- SdrLineStartEndAttribute* pLineStartEnd,
- SdrShadowAttribute* pShadow,
- SdrTextAttribute* pTextAttribute)
- : SdrShadowTextAttribute(pShadow, pTextAttribute),
- mpLine(pLine),
- mpLineStartEnd(pLineStartEnd)
- {
- }
-
- SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
- const SdrLineShadowTextAttribute& rCandidate)
- : SdrShadowTextAttribute(0, 0),
- mpLine(0),
- mpLineStartEnd(0)
- {
- *this = rCandidate;
- }
-
- SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute()
- {
- delete mpLine;
- delete mpLineStartEnd;
- }
-
- SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate)
- {
- // call parent
- SdrShadowTextAttribute::operator=(rCandidate);
-
- // handle mpLine
- {
- // delete local mpLine if necessary
- if(mpLine)
- {
- delete mpLine;
- mpLine = 0;
- }
-
- // copy mpLine if necessary
- if(rCandidate.mpLine)
- {
- mpLine = new SdrLineAttribute(*rCandidate.mpLine);
- }
- }
-
- // handle mpLineStartEnd
- {
- // delete local mpLineStartEnd if necessary
- if(mpLineStartEnd)
- {
- delete mpLineStartEnd;
- mpLineStartEnd = 0;
- }
-
- // copy mpLineStartEnd if necessary
- if(rCandidate.mpLineStartEnd)
- {
- mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
- }
- }
-
- return *this;
- }
-
- bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const
- {
- // call parent
- if(!(SdrShadowTextAttribute::operator==(rCandidate)))
- return false;
-
- // handle mpLine
- if(!pointerOrContentEqual(mpLine, rCandidate.mpLine))
- return false;
-
- // handle mpLineStartEnd
- if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd))
- return false;
-
- return true;
- }
- } // end of namespace attribute
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace attribute
- {
- SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(
- 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(0, 0, 0, 0),
- mpFill(0),
- mpFillFloatTransGradient(0)
- {
- *this = rCandidate;
- }
-
- SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute()
- {
- delete mpFill;
- delete mpFillFloatTransGradient;
- }
-
- SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate)
- {
- // call parent
- SdrLineShadowTextAttribute::operator=(rCandidate);
-
- // handle mpFill
- {
- // delete local mpFill if necessary
- if(mpFill)
- {
- delete mpFill;
- mpFill = 0;
- }
-
- // copy mpFill if necessary
- if(rCandidate.mpFill)
- {
- mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill);
- }
- }
-
- // handle mpFillFloatTransGradient
- {
- // delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient)
- {
- delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0;
- }
-
- // copy mpFillFloatTransGradient if necessary
- if(rCandidate.mpFillFloatTransGradient)
- {
- mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
- }
- }
-
- return *this;
- }
-
- bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const
- {
- // call parent
- if(!(SdrLineShadowTextAttribute::operator==(rCandidate)))
- return false;
-
- // handle mpFill
- if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
- return false;
-
- // handle mpFillFloatTransGradient
- if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
- return false;
-
- return true;
- }
- } // end of namespace attribute
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
new file mode 100644
index 000000000000..e281c77068c5
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrfilltextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrFillTextAttribute::SdrFillTextAttribute(
+ const SdrFillAttribute& rFill,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute)
+ : maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient),
+ maTextAttribute(rTextAttribute)
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute()
+ : maFill(),
+ maFillFloatTransGradient(),
+ maTextAttribute()
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate)
+ : maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()),
+ maTextAttribute(rCandidate.getText())
+ {
+ }
+
+ SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate)
+ {
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+ maTextAttribute = rCandidate.getText();
+
+ return *this;
+ }
+
+ bool SdrFillTextAttribute::isDefault() const
+ {
+ return(getFill().isDefault()
+ && getFillFloatTransGradient().isDefault()
+ && getText().isDefault());
+ }
+
+ bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const
+ {
+ return(getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()
+ && getText() == rCandidate.getText());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx
index a4f15d916215..39037faa5031 100644
--- a/svx/source/sdr/attribute/sdrformtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -28,8 +28,8 @@
#include "precompiled_svx.hxx"
#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <basegfx/vector/b2enums.hxx>
#include <svl/itemset.hxx>
-
#include <svx/xftdiit.hxx>
#include <svx/xftstit.hxx>
#include <svx/xftshxy.hxx>
@@ -40,11 +40,8 @@
#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>
@@ -52,13 +49,11 @@
#include <svx/xlineit0.hxx>
#include <svx/xdash.hxx>
#include <svx/xlndsit.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.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
@@ -154,144 +149,272 @@ 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())
+ class ImpSdrFormTextAttribute
{
- if(getFormTextOutline())
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // 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 maOutline;
+ SdrFormTextOutlineAttribute maShadowOutline;
+
+ // bitfield
+ unsigned mbFormTextMirror : 1; // change orientation
+ unsigned mbFormTextOutline : 1; // show contour of objects
+
+ ImpSdrFormTextAttribute(const SfxItemSet& rSet)
+ : mnRefCount(0),
+ 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()),
+ maOutline(),
+ maShadowOutline(),
+ mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()),
+ mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue())
{
- const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
-
- // also need to prepare attributes for outlines
+ if(getFormTextOutline())
{
- const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet));
- const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet));
-
- mpOutline = new SdrFormTextOutlineAttribute(
- aLineAttribute, aStrokeAttribute, nTransparence);
+ 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));
+
+ maOutline = 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));
+
+ maShadowOutline = 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);
- }
+ ImpSdrFormTextAttribute()
+ : mnRefCount(0),
+ mnFormTextDistance(0),
+ mnFormTextStart(0),
+ mnFormTextShdwXVal(0),
+ mnFormTextShdwYVal(0),
+ mnFormTextShdwTransp(0),
+ meFormTextStyle(XFT_NONE),
+ meFormTextAdjust(XFT_CENTER),
+ meFormTextShadow(XFTSHADOW_NONE),
+ maFormTextShdwColor(),
+ maOutline(),
+ maShadowOutline(),
+ mbFormTextMirror(false),
+ mbFormTextOutline(false)
+ {
}
- }
- SdrFormTextAttribute::~SdrFormTextAttribute()
- {
- if(mpOutline)
+ // data read 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 maOutline; }
+ const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; }
+ bool getFormTextMirror() const { return mbFormTextMirror; }
+ bool getFormTextOutline() const { return mbFormTextOutline; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextAttribute& rCandidate) const
{
- delete mpOutline;
- mpOutline = 0;
+ 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()
+ && getOutline() == rCandidate.getOutline()
+ && getShadowOutline() == rCandidate.getShadowOutline()
+ && getFormTextMirror() == rCandidate.getFormTextMirror()
+ && getFormTextOutline() == rCandidate.getFormTextOutline());
}
- if(mpShadowOutline)
+ static ImpSdrFormTextAttribute* get_global_default()
{
- delete mpShadowOutline;
- mpShadowOutline = 0;
+ static ImpSdrFormTextAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpSdrFormTextAttribute();
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
}
+ };
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
+ : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet))
+ {
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute()
+ : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default())
+ {
+ mpSdrFormTextAttribute->mnRefCount++;
}
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())
+ : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
{
- if(rCandidate.getOutline())
+ mpSdrFormTextAttribute->mnRefCount++;
+ }
+
+ SdrFormTextAttribute::~SdrFormTextAttribute()
+ {
+ if(mpSdrFormTextAttribute->mnRefCount)
{
- mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline());
+ mpSdrFormTextAttribute->mnRefCount--;
}
-
- if(rCandidate.getShadowOutline())
+ else
{
- mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline());
+ delete mpSdrFormTextAttribute;
}
}
+ bool SdrFormTextAttribute::isDefault() const
+ {
+ return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default();
+ }
+
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)
+ if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute)
{
- delete mpOutline;
+ if(mpSdrFormTextAttribute->mnRefCount)
+ {
+ mpSdrFormTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextAttribute;
+ }
+
+ mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
+ mpSdrFormTextAttribute->mnRefCount++;
}
- mpOutline = 0;
+ return *this;
+ }
- if(rCandidate.getOutline())
+ bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
+ {
+ if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute)
{
- mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline());
+ return true;
}
- if(mpShadowOutline)
+ if(rCandidate.isDefault() != isDefault())
{
- delete mpShadowOutline;
+ return false;
}
- mpShadowOutline = 0;
+ return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute);
+ }
- if(rCandidate.getShadowOutline())
- {
- mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline());
- }
+ sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
+ {
+ return mpSdrFormTextAttribute->getFormTextDistance();
+ }
- mbFormTextMirror = rCandidate.getFormTextMirror();
- mbFormTextOutline = rCandidate.getFormTextOutline();
+ sal_Int32 SdrFormTextAttribute::getFormTextStart() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStart();
+ }
- return *this;
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwXVal();
}
- bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwYVal();
+ }
+
+ sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwTransp();
+ }
+
+ XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStyle();
+ }
+
+ XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const
+ {
+ return mpSdrFormTextAttribute->getFormTextAdjust();
+ }
+
+ XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShadow();
+ }
+
+ Color SdrFormTextAttribute::getFormTextShdwColor() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwColor();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const
+ {
+ return mpSdrFormTextAttribute->getOutline();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const
+ {
+ return mpSdrFormTextAttribute->getShadowOutline();
+ }
+
+ bool SdrFormTextAttribute::getFormTextMirror() const
+ {
+ return mpSdrFormTextAttribute->getFormTextMirror();
+ }
+
+ bool SdrFormTextAttribute::getFormTextOutline() 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());
+ return mpSdrFormTextAttribute->getFormTextOutline();
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
index 67cadf41b831..6f1925f1f5a8 100644
--- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
+++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
@@ -28,10 +28,8 @@
#include "precompiled_svx.hxx"
#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// pointer compare define
-#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -39,21 +37,146 @@ namespace drawinglayer
{
namespace attribute
{
+ class ImpSdrFormTextOutlineAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // one set of attributes for FormText (FontWork) outline visualisation
+ LineAttribute maLineAttribute;
+ StrokeAttribute maStrokeAttribute;
+ sal_uInt8 mnTransparence;
+
+ ImpSdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : mnRefCount(0),
+ maLineAttribute(rLineAttribute),
+ maStrokeAttribute(rStrokeAttribute),
+ mnTransparence(nTransparence)
+ {
+ }
+
+ // data read access
+ const LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+ sal_uInt8 getTransparence() const { return mnTransparence; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const
+ {
+ return (getLineAttribute() == rCandidate.getLineAttribute()
+ && getStrokeAttribute() == rCandidate.getStrokeAttribute()
+ && getTransparence() == rCandidate.getTransparence());
+ }
+
+ static ImpSdrFormTextOutlineAttribute* get_global_default()
+ {
+ static ImpSdrFormTextOutlineAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpSdrFormTextOutlineAttribute(
+ LineAttribute(),
+ StrokeAttribute(),
+ 0);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
const LineAttribute& rLineAttribute,
const StrokeAttribute& rStrokeAttribute,
sal_uInt8 nTransparence)
- : maLineAttribute(rLineAttribute),
- maStrokeAttribute(rStrokeAttribute),
- mnTransparence(nTransparence)
+ : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute(
+ rLineAttribute, rStrokeAttribute, nTransparence))
+ {
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
+ : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default())
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate)
+ : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
+ {
+ if(mpSdrFormTextOutlineAttribute->mnRefCount)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextOutlineAttribute;
+ }
+ }
+
+ bool SdrFormTextOutlineAttribute::isDefault() const
+ {
+ return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default();
+ }
+
+ SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate)
{
+ if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute)
+ {
+ if(mpSdrFormTextOutlineAttribute->mnRefCount)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextOutlineAttribute;
+ }
+
+ mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ return *this;
}
bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
{
- return (getLineAttribute() == rCandidate.getLineAttribute()
- && getStrokeAttribute() == rCandidate.getStrokeAttribute()
- && getTransparence() == rCandidate.getTransparence());
+ if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute);
+ }
+
+ const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getLineAttribute();
+ }
+
+ const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getStrokeAttribute();
+ }
+
+ sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const
+ {
+ return mpSdrFormTextOutlineAttribute->getTransparence();
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx
new file mode 100644
index 000000000000..6d8356833829
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute)
+ : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute),
+ maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient)
+ {
+ }
+
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute()
+ : SdrLineShadowTextAttribute(),
+ maFill(),
+ maFillFloatTransGradient()
+ {
+ }
+
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate)
+ : SdrLineShadowTextAttribute(rCandidate),
+ maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient())
+ {
+ }
+
+ SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate)
+ {
+ SdrLineShadowTextAttribute::operator=(rCandidate);
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+
+ return *this;
+ }
+
+ bool SdrLineFillShadowTextAttribute::isDefault() const
+ {
+ return (SdrLineShadowTextAttribute::isDefault()
+ && getFill().isDefault()
+ && getFillFloatTransGradient().isDefault());
+ }
+
+ bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const
+ {
+ return(SdrLineShadowTextAttribute::operator==(rCandidate)
+ && getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx
new file mode 100644
index 000000000000..6b863a11aa03
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrlineshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute)
+ : SdrShadowTextAttribute(rShadow, rTextAttribute),
+ maLine(rLine),
+ maLineStartEnd(rLineStartEnd)
+ {
+ }
+
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute()
+ : SdrShadowTextAttribute(),
+ maLine(),
+ maLineStartEnd()
+ {
+ }
+
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate)
+ : SdrShadowTextAttribute(rCandidate),
+ maLine(rCandidate.getLine()),
+ maLineStartEnd(rCandidate.getLineStartEnd())
+ {
+ }
+
+ SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate)
+ {
+ SdrShadowTextAttribute::operator=(rCandidate);
+ maLine = rCandidate.getLine();
+ maLineStartEnd = rCandidate.getLineStartEnd();
+
+ return *this;
+ }
+
+ bool SdrLineShadowTextAttribute::isDefault() const
+ {
+ return(SdrShadowTextAttribute::isDefault()
+ && getLine().isDefault()
+ && getLineStartEnd().isDefault());
+ }
+
+ bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const
+ {
+ return(SdrShadowTextAttribute::operator==(rCandidate)
+ && getLine() == rCandidate.getLine()
+ && getLineStartEnd() == rCandidate.getLineStartEnd());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx
new file mode 100644
index 000000000000..34485b57399c
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrShadowTextAttribute::SdrShadowTextAttribute(
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute)
+ : maShadow(rShadow),
+ maTextAttribute(rTextAttribute)
+ {
+ }
+
+ SdrShadowTextAttribute::SdrShadowTextAttribute()
+ : maShadow(),
+ maTextAttribute()
+ {
+ }
+
+ SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate)
+ : maShadow(rCandidate.getShadow()),
+ maTextAttribute(rCandidate.getText())
+ {
+ }
+
+ SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate)
+ {
+ maShadow = rCandidate.getShadow();
+ maTextAttribute = rCandidate.getText();
+
+ return *this;
+ }
+
+ bool SdrShadowTextAttribute::isDefault() const
+ {
+ return (getShadow().isDefault()
+ && getText().isDefault());
+ }
+
+ bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const
+ {
+ return (getShadow() == rCandidate.getShadow()
+ && getText() == rCandidate.getText());
+ }
+ } // 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 72c2a97aa77b..a28430f127c1 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -36,15 +36,230 @@
#include <svx/sdr/properties/properties.hxx>
//////////////////////////////////////////////////////////////////////////////
-// pointer compare define
-#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
-
-//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace attribute
{
+ class ImpSdrTextAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // all-text attributes. The SdrText itself and a copy
+ // of te OPO
+ const SdrText* mpSdrText;
+ const OutlinerParaObject* mpOutlinerParaObject;
+
+ // Set when it's a FormText; contains all FormText attributes
+ SdrFormTextAttribute maSdrFormTextAttribute;
+
+ // text distances
+ sal_Int32 maTextLeftDistance;
+ sal_Int32 maTextUpperDistance;
+ sal_Int32 maTextRightDistance;
+ sal_Int32 maTextLowerDistance;
+
+ // #i101556# use versioning from text attributes to detect changes
+ sal_uInt32 maPropertiesVersion;
+
+ // text alignments
+ SdrTextHorzAdjust maSdrTextHorzAdjust;
+ SdrTextVertAdjust maSdrTextVertAdjust;
+
+ // bitfield
+ unsigned mbContour : 1;
+ unsigned mbFitToSize : 1;
+ unsigned mbHideContour : 1;
+ unsigned mbBlink : 1;
+ unsigned mbScroll : 1;
+ unsigned mbInEditMode : 1;
+ unsigned mbFixedCellHeight : 1;
+ unsigned mbWrongSpell : 1;
+
+ public:
+ ImpSdrTextAttribute(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell)
+ : mnRefCount(0),
+ mpSdrText(pSdrText),
+ mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)),
+ maSdrFormTextAttribute(),
+ maTextLeftDistance(aTextLeftDistance),
+ maTextUpperDistance(aTextUpperDistance),
+ maTextRightDistance(aTextRightDistance),
+ maTextLowerDistance(aTextLowerDistance),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(aSdrTextHorzAdjust),
+ maSdrTextVertAdjust(aSdrTextVertAdjust),
+ mbContour(bContour),
+ mbFitToSize(bFitToSize),
+ mbHideContour(bHideContour),
+ mbBlink(bBlink),
+ mbScroll(bScroll),
+ mbInEditMode(bInEditMode),
+ mbFixedCellHeight(bFixedCellHeight),
+ mbWrongSpell(bWrongSpell)
+ {
+ if(pSdrText)
+ {
+ if(XFT_NONE != eFormTextStyle)
+ {
+ // text on path. Create FormText attribute
+ const SfxItemSet& rSet = pSdrText->GetItemSet();
+ maSdrFormTextAttribute = SdrFormTextAttribute(rSet);
+ }
+
+ // #i101556# init with version number to detect changes of single text
+ // attribute and/or style sheets in primitive data without having to
+ // copy that data locally (which would be better from principle)
+ maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion();
+ }
+ }
+
+ ImpSdrTextAttribute()
+ : mnRefCount(0),
+ mpSdrText(0),
+ mpOutlinerParaObject(0),
+ maSdrFormTextAttribute(),
+ maTextLeftDistance(0),
+ maTextUpperDistance(0),
+ maTextRightDistance(0),
+ maTextLowerDistance(0),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT),
+ maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP),
+ mbContour(false),
+ mbFitToSize(false),
+ mbHideContour(false),
+ mbBlink(false),
+ mbScroll(false),
+ mbInEditMode(false),
+ mbFixedCellHeight(false),
+ mbWrongSpell(false)
+ {
+ }
+
+ ~ImpSdrTextAttribute()
+ {
+ if(mpOutlinerParaObject)
+ {
+ delete mpOutlinerParaObject;
+ }
+ }
+
+ // data read access
+ const SdrText& getSdrText() const
+ {
+ OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)");
+ return *mpSdrText;
+ }
+ const OutlinerParaObject& getOutlinerParaObject() const
+ {
+ OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)");
+ return *mpOutlinerParaObject;
+ }
+ bool isContour() const { return mbContour; }
+ 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; }
+ bool isFixedCellHeight() const { return mbFixedCellHeight; }
+ bool isWrongSpell() const { return mbWrongSpell; }
+ const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
+ sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; }
+ sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; }
+ sal_Int32 getTextRightDistance() const { return maTextRightDistance; }
+ sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; }
+ sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; }
+ SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; }
+ SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; }
+
+ // compare operator
+ bool operator==(const ImpSdrTextAttribute& rCandidate) const
+ {
+ if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject)
+ {
+ if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject)
+ {
+ // compares OPO and it's contents, but traditionally not the RedLining
+ // which is not seen as model, but as temporary information
+ if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject()))
+ {
+ return false;
+ }
+
+ // #i102062# for primitive visualisation, the WrongList (SpellChecking)
+ // is important, too, so use isWrongListEqual since there is no WrongList
+ // comparison in the regular OutlinerParaObject compare (since it's
+ // not-persistent data)
+ if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject())))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // only one is zero; not equal
+ return false;
+ }
+ }
+
+ return (
+ getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute()
+ && getTextLeftDistance() == rCandidate.getTextLeftDistance()
+ && getTextUpperDistance() == rCandidate.getTextUpperDistance()
+ && getTextRightDistance() == rCandidate.getTextRightDistance()
+ && getTextLowerDistance() == rCandidate.getTextLowerDistance()
+ && getPropertiesVersion() == rCandidate.getPropertiesVersion()
+
+ && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust()
+ && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust()
+
+ && isContour() == rCandidate.isContour()
+ && isFitToSize() == rCandidate.isFitToSize()
+ && isHideContour() == rCandidate.isHideContour()
+ && isBlink() == rCandidate.isBlink()
+ && isScroll() == rCandidate.isScroll()
+ && isInEditMode() == rCandidate.isInEditMode()
+ && isFixedCellHeight() == rCandidate.isFixedCellHeight()
+ && isWrongSpell() == rCandidate.isWrongSpell());
+ }
+
+ static ImpSdrTextAttribute* get_global_default()
+ {
+ static ImpSdrTextAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ // use default constructor
+ pDefault = new ImpSdrTextAttribute();
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
SdrTextAttribute::SdrTextAttribute(
const SdrText& rSdrText,
const OutlinerParaObject& rOutlinerParaObject,
@@ -61,146 +276,174 @@ namespace drawinglayer
bool bBlink,
bool bScroll,
bool bInEditMode,
- bool bFixedCellHeight)
- : mpSdrText(&rSdrText),
- maOutlinerParaObject(rOutlinerParaObject),
- mpSdrFormTextAttribute(0),
- maTextLeftDistance(aTextLeftDistance),
- maTextUpperDistance(aTextUpperDistance),
- maTextRightDistance(aTextRightDistance),
- maTextLowerDistance(aTextLowerDistance),
- maPropertiesVersion(0),
- maSdrTextHorzAdjust(aSdrTextHorzAdjust),
- maSdrTextVertAdjust(aSdrTextVertAdjust),
- mbContour(bContour),
- mbFitToSize(bFitToSize),
- mbHideContour(bHideContour),
- mbBlink(bBlink),
- mbScroll(bScroll),
- mbInEditMode(bInEditMode),
- mbFixedCellHeight(bFixedCellHeight)
- {
- if(XFT_NONE != eFormTextStyle)
- {
- // text on path. Create FormText attribute
- const SfxItemSet& rSet = getSdrText().GetItemSet();
- mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet);
- }
+ bool bFixedCellHeight,
+ bool bWrongSpell)
+ : mpSdrTextAttribute(new ImpSdrTextAttribute(
+ &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance,
+ aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour,
+ bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell))
+ {
+ }
- // #i101556# init with version number to detect changes of single text
- // attribute and/or style sheets in primitive data without having to
- // copy that data locally (which would be better from principle)
- maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion();
+ SdrTextAttribute::SdrTextAttribute()
+ : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default())
+ {
+ mpSdrTextAttribute->mnRefCount++;
+ }
+
+ SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate)
+ : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute)
+ {
+ mpSdrTextAttribute->mnRefCount++;
}
SdrTextAttribute::~SdrTextAttribute()
{
- if(mpSdrFormTextAttribute)
+ if(mpSdrTextAttribute->mnRefCount)
{
- delete mpSdrFormTextAttribute;
- mpSdrFormTextAttribute = 0;
+ mpSdrTextAttribute->mnRefCount--;
}
- }
-
- 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()),
- maPropertiesVersion(rCandidate.getPropertiesVersion()),
- maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()),
- maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()),
- mbContour(rCandidate.isContour()),
- mbFitToSize(rCandidate.isFitToSize()),
- mbHideContour(rCandidate.isHideContour()),
- mbBlink(rCandidate.isBlink()),
- mbScroll(rCandidate.isScroll()),
- mbInEditMode(rCandidate.isInEditMode()),
- mbFixedCellHeight(rCandidate.isFixedCellHeight())
- {
- if(rCandidate.getSdrFormTextAttribute())
+ else
{
- mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute());
+ delete mpSdrTextAttribute;
}
}
- SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
+ bool SdrTextAttribute::isDefault() const
{
- mpSdrText = &rCandidate.getSdrText();
- maOutlinerParaObject = rCandidate.getOutlinerParaObject();
+ return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default();
+ }
- if(mpSdrFormTextAttribute)
+ SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
+ {
+ if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute)
{
- delete mpSdrFormTextAttribute;
+ if(mpSdrTextAttribute->mnRefCount)
+ {
+ mpSdrTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrTextAttribute;
+ }
+
+ mpSdrTextAttribute = rCandidate.mpSdrTextAttribute;
+ mpSdrTextAttribute->mnRefCount++;
}
- mpSdrFormTextAttribute = 0;
+ return *this;
+ }
- if(rCandidate.getSdrFormTextAttribute())
+ bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
+ {
+ if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute)
{
- mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute());
+ return true;
}
- maTextLeftDistance = rCandidate.getTextLeftDistance();
- maTextUpperDistance = rCandidate.getTextUpperDistance();
- maTextRightDistance = rCandidate.getTextRightDistance();
- maTextLowerDistance = rCandidate.getTextLowerDistance();
- maPropertiesVersion = rCandidate.getPropertiesVersion();
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
- maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust();
- maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust();
+ return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute);
+ }
- mbContour = rCandidate.isContour();
- mbFitToSize = rCandidate.isFitToSize();
- mbHideContour = rCandidate.isHideContour();
- mbBlink = rCandidate.isBlink();
- mbScroll = rCandidate.isScroll();
- mbInEditMode = rCandidate.isInEditMode();
- mbFixedCellHeight = rCandidate.isFixedCellHeight();
+ const SdrText& SdrTextAttribute::getSdrText() const
+ {
+ return mpSdrTextAttribute->getSdrText();
+ }
- return *this;
+ const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const
+ {
+ return mpSdrTextAttribute->getOutlinerParaObject();
}
- bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
+ bool SdrTextAttribute::isContour() const
+ {
+ return mpSdrTextAttribute->isContour();
+ }
+
+ bool SdrTextAttribute::isFitToSize() const
+ {
+ return mpSdrTextAttribute->isFitToSize();
+ }
+
+ bool SdrTextAttribute::isHideContour() const
+ {
+ return mpSdrTextAttribute->isHideContour();
+ }
+
+ bool SdrTextAttribute::isBlink() const
+ {
+ return mpSdrTextAttribute->isBlink();
+ }
+
+ bool SdrTextAttribute::isScroll() const
+ {
+ return mpSdrTextAttribute->isScroll();
+ }
+
+ bool SdrTextAttribute::isInEditMode() const
+ {
+ return mpSdrTextAttribute->isInEditMode();
+ }
+
+ bool SdrTextAttribute::isFixedCellHeight() const
+ {
+ return mpSdrTextAttribute->isFixedCellHeight();
+ }
+
+ bool SdrTextAttribute::isWrongSpell() const
{
- return (
- // compares OPO and it's contents, but traditionally not the RedLining
- // which is not seen as model, but as temporary information
- getOutlinerParaObject() == rCandidate.getOutlinerParaObject()
+ return mpSdrTextAttribute->isWrongSpell();
+ }
- // #i102062# for primitive visualisation, the WrongList (SpellChecking)
- // is important, too, so use isWrongListEqual since there is no WrongList
- // comparison in the regular OutlinerParaObject compare (since it's
- // not-persistent data)
- && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject())
+ const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const
+ {
+ return mpSdrTextAttribute->getSdrFormTextAttribute();
+ }
- && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute())
- && getTextLeftDistance() == rCandidate.getTextLeftDistance()
- && getTextUpperDistance() == rCandidate.getTextUpperDistance()
- && getTextRightDistance() == rCandidate.getTextRightDistance()
- && getTextLowerDistance() == rCandidate.getTextLowerDistance()
- && getPropertiesVersion() == rCandidate.getPropertiesVersion()
+ sal_Int32 SdrTextAttribute::getTextLeftDistance() const
+ {
+ return mpSdrTextAttribute->getTextLeftDistance();
+ }
- && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust()
- && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust()
+ sal_Int32 SdrTextAttribute::getTextUpperDistance() const
+ {
+ return mpSdrTextAttribute->getTextUpperDistance();
+ }
- && isContour() == rCandidate.isContour()
- && isFitToSize() == rCandidate.isFitToSize()
- && isHideContour() == rCandidate.isHideContour()
- && isBlink() == rCandidate.isBlink()
- && isScroll() == rCandidate.isScroll()
- && isInEditMode() == rCandidate.isInEditMode()
- && isFixedCellHeight() == rCandidate.isFixedCellHeight());
+ sal_Int32 SdrTextAttribute::getTextRightDistance() const
+ {
+ return mpSdrTextAttribute->getTextRightDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextLowerDistance() const
+ {
+ return mpSdrTextAttribute->getTextLowerDistance();
+ }
+
+ sal_uInt32 SdrTextAttribute::getPropertiesVersion() const
+ {
+ return mpSdrTextAttribute->getPropertiesVersion();
+ }
+
+ SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextHorzAdjust();
+ }
+
+ SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextVertAdjust();
}
void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
{
if(isBlink())
{
- mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList);
+ getSdrText().GetObject().impGetBlinkTextTiming(rAnimList);
}
}
@@ -208,7 +451,7 @@ namespace drawinglayer
{
if(isScroll())
{
- mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
+ getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
}
}
} // end of namespace attribute
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index ef8894b70da0..3057acf55df1 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -277,7 +277,8 @@ namespace sdr
DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)");
const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0)));
const basegfx::BColor aYellow(1.0, 1.0, 0.0);
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx
index 082f4ba733fd..9d6b253a676a 100644
--- a/svx/source/sdr/contact/viewcontactofe3d.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3d.cxx
@@ -33,10 +33,12 @@
#include <svx/obj3d.hxx>
#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <svx/scene3d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -124,13 +126,14 @@ namespace sdr
// create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl.
// 3D shadow extraction for correct B2DRange calculation (shadow is part of the object)
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D(
- rxContent3D,
- pVCOfE3DScene->getObjectTransformation(),
- aViewInformation3D,
- aLightNormal,
- fShadowSlant,
- rAllContentRange));
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::Embedded3DPrimitive2D(
+ rxContent3D,
+ pVCOfE3DScene->getObjectTransformation(),
+ aViewInformation3D,
+ aLightNormal,
+ fShadowSlant,
+ rAllContentRange));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
@@ -175,9 +178,12 @@ namespace sdr
if(!rObjectTransform.isIdentity())
{
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D(
- rObjectTransform, xRetval));
- return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::TransformPrimitive3D(
+ rObjectTransform,
+ xRetval));
+
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
}
}
diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
index 23e0ca426acd..84d456a7a430 100644
--- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -54,16 +54,8 @@ namespace sdr
{
drawinglayer::primitive3d::Primitive3DSequence xRetval;
const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false);
-
- // for 3D Objects, always create a primitive even when not visible. This is necessary ATM
- // since e.g. chart geometries rely on the occupied space of non-visible objects
- if(!pAttribute)
- {
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute(
- impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)),
- 0, 0, 0, 0);
- }
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
// get cube geometry and use as traslation and scaling for unit cube
basegfx::B3DRange aCubeRange;
@@ -96,12 +88,13 @@ namespace sdr
const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY());
// create primitive and add
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute));
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrCubePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
// delete 3D Object Attributes
delete pSdr3DObjectAttribute;
- delete pAttribute;
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
index 9b5ac5c5889d..1ff1d81c827c 100644
--- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -54,16 +54,8 @@ namespace sdr
{
drawinglayer::primitive3d::Primitive3DSequence xRetval;
const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false);
-
- // for 3D Objects, always create a primitive even when not visible. This is necessary ATM
- // since e.g. chart geometries rely on the occupied space of non-visible objects
- if(!pAttribute)
- {
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute(
- impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)),
- 0, 0, 0, 0);
- }
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
// get extrude geometry
const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
@@ -89,15 +81,15 @@ namespace sdr
// create primitive and add
const basegfx::B3DHomMatrix aWorldTransform;
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
- aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute,
- aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids,
- bCharacterMode, bCloseFront, bCloseBack));
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids,
+ bCharacterMode, bCloseFront, bCloseBack));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
// delete 3D Object Attributes
delete pSdr3DObjectAttribute;
- delete pAttribute;
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
index 1d8784d31f8b..3cd55fcde828 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -54,16 +54,8 @@ namespace sdr
{
drawinglayer::primitive3d::Primitive3DSequence xRetval;
const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false);
-
- // for 3D Objects, always create a primitive even when not visible. This is necessary ATM
- // since e.g. chart geometries rely on the occupied space of non-visible objects
- if(!pAttribute)
- {
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute(
- impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)),
- 0, 0, 0, 0);
- }
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
// get extrude geometry
const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D());
@@ -103,16 +95,16 @@ namespace sdr
// create primitive and add
const basegfx::B3DHomMatrix aWorldTransform;
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D(
- aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute,
- aPolyPolygon, nHorizontalSegments, nVerticalSegments,
- fDiagonal, fBackScale, fRotation,
- bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack));
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrLathePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ aPolyPolygon, nHorizontalSegments, nVerticalSegments,
+ fDiagonal, fBackScale, fRotation,
+ bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
// delete 3D Object Attributes
delete pSdr3DObjectAttribute;
- delete pAttribute;
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index 393353249d86..ee6943bccd4a 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -56,16 +56,8 @@ namespace sdr
drawinglayer::primitive3d::Primitive3DSequence xRetval;
const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet();
const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly());
- drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill);
-
- // for 3D Objects, always create a primitive even when not visible. This is necessary ATM
- // since e.g. chart geometries rely on the occupied space of non-visible objects
- if(!pAttribute)
- {
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute(
- impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)),
- 0, 0, 0, 0);
- }
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill));
// get extrude geometry
basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D());
@@ -177,13 +169,13 @@ namespace sdr
// create primitive and add
const basegfx::B3DHomMatrix aWorldTransform;
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D(
- aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute));
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D(
+ aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
// delete 3D Object Attributes
delete pSdr3DObjectAttribute;
- delete pAttribute;
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
index 6bb066e369f9..8a7d7694a315 100644
--- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
@@ -38,11 +38,11 @@
#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/range/b3drange.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
#include <svx/sdr/contact/viewcontactofe3d.hxx>
#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -164,21 +164,13 @@ namespace sdr
ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene)
: ViewContactOfSdrObj(rScene),
- mpViewInformation3D(0),
- mpObjectTransformation(0),
- mpSdrSceneAttribute(0),
- mpSdrLightingAttribute(0)
+ maViewInformation3D(),
+ maObjectTransformation(),
+ maSdrSceneAttribute(),
+ maSdrLightingAttribute()
{
}
- ViewContactOfE3dScene::~ViewContactOfE3dScene()
- {
- delete mpViewInformation3D;
- delete mpObjectTransformation;
- delete mpSdrSceneAttribute;
- delete mpSdrLightingAttribute;
- }
-
void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange)
{
basegfx::B3DHomMatrix aTransformation;
@@ -262,34 +254,36 @@ namespace sdr
}
const uno::Sequence< beans::PropertyValue > aEmptyProperties;
- mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties);
+ maViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aTransformation, aOrientation, aProjection,
+ aDeviceToView, 0.0, aEmptyProperties);
}
void ViewContactOfE3dScene::createObjectTransformation()
{
// create 2d Object Transformation from relative point in 2d scene to world
- mpObjectTransformation = new basegfx::B2DHomMatrix;
const Rectangle& rRectangle = GetE3dScene().GetSnapRect();
- mpObjectTransformation->set(0, 0, rRectangle.getWidth());
- mpObjectTransformation->set(1, 1, rRectangle.getHeight());
- mpObjectTransformation->set(0, 2, rRectangle.Left());
- mpObjectTransformation->set(1, 2, rRectangle.Top());
+ maObjectTransformation.set(0, 0, rRectangle.getWidth());
+ maObjectTransformation.set(1, 1, rRectangle.getHeight());
+ maObjectTransformation.set(0, 2, rRectangle.Left());
+ maObjectTransformation.set(1, 2, rRectangle.Top());
}
void ViewContactOfE3dScene::createSdrSceneAttribute()
{
const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet();
- mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet);
+ maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet);
}
void ViewContactOfE3dScene::createSdrLightingAttribute()
{
const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet();
- mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet);
+ maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet);
}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(
+ const SetOfByte* pLayerVisibility) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
const sal_uInt32 nChildrenCount(GetObjectCount());
@@ -329,19 +323,27 @@ namespace sdr
// on identity and the time on 0.0.
const uno::Sequence< beans::PropertyValue > aEmptyProperties;
const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties);
- const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D));
+ const basegfx::B3DRange aContentRange(
+ drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D));
// create 2d primitive 3dscene with generated sub-list from collector
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D(
- bTestVisibility ? aVisibleSequence : aAllSequence,
- getSdrSceneAttribute(),
- getSdrLightingAttribute(),
- getObjectTransformation(),
- getViewInformation3D(aContentRange)));
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::ScenePrimitive2D(
+ bTestVisibility ? aVisibleSequence : aAllSequence,
+ getSdrSceneAttribute(),
+ getSdrLightingAttribute(),
+ getObjectTransformation(),
+ getViewInformation3D(aContentRange)));
+
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
}
+ // always append an invisible outline for the cases where no visible content exists
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, getObjectTransformation()));
+
return xRetval;
}
@@ -355,27 +357,7 @@ namespace sdr
xRetval = createScenePrimitive2DSequence(0);
}
- if(xRetval.hasElements())
- {
- return xRetval;
- }
- else
- {
- // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size
- // model information directly, NOT getBoundRect()/getSnapRect() since these will
- // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data
- // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here
- const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect());
- const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(
- aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(),
- aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom())));
- const double fGrayTone(0xc0 / 255.0);
- const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone);
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone));
-
- // The replacement object may also get a text like 'empty 3D Scene' here later
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
+ return xRetval;
}
void ViewContactOfE3dScene::ActionChanged()
@@ -384,22 +366,15 @@ namespace sdr
ViewContactOfSdrObj::ActionChanged();
// mark locally cached values as invalid
- delete mpViewInformation3D;
- mpViewInformation3D = 0;
-
- delete mpObjectTransformation;
- mpObjectTransformation = 0;
-
- delete mpSdrSceneAttribute;
- mpSdrSceneAttribute = 0;
-
- delete mpSdrLightingAttribute;
- mpSdrLightingAttribute = 0;
+ maViewInformation3D = drawinglayer::geometry::ViewInformation3D();
+ maObjectTransformation.identity();
+ maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute();
+ maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute();
}
const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const
{
- if(!mpViewInformation3D)
+ if(maViewInformation3D.isDefault())
{
// this version will create the content range on demand locally and thus is less
// performant than the other one. Since the information is buffered the planned
@@ -418,47 +393,47 @@ namespace sdr
const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange);
}
- return *mpViewInformation3D;
+ return maViewInformation3D;
}
const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const
{
- if(!mpViewInformation3D)
+ if(maViewInformation3D.isDefault())
{
const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange);
}
- return *mpViewInformation3D;
+ return maViewInformation3D;
}
const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const
{
- if(!mpObjectTransformation)
+ if(maObjectTransformation.isIdentity())
{
const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation();
}
- return *mpObjectTransformation;
+ return maObjectTransformation;
}
const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const
{
- if(!mpSdrSceneAttribute)
+ if(maSdrSceneAttribute.isDefault())
{
const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute();
}
- return *mpSdrSceneAttribute;
+ return maSdrSceneAttribute;
}
const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const
{
- if(!mpSdrLightingAttribute)
+ if(maSdrLightingAttribute.isDefault())
{
const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute();
}
- return *mpSdrLightingAttribute;
+ return maSdrLightingAttribute;
}
drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const
diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
index 5533a9e9ed8e..c16633f7f2c9 100644
--- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -53,16 +53,8 @@ namespace sdr
{
drawinglayer::primitive3d::Primitive3DSequence xRetval;
const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false);
-
- // for 3D Objects, always create a primitive even when not visible. This is necessary ATM
- // since e.g. chart geometries rely on the occupied space of non-visible objects
- if(!pAttribute)
- {
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute(
- impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)),
- 0, 0, 0, 0);
- }
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
// get sphere center and size for geometry
basegfx::B3DRange aSphereRange;
@@ -88,14 +80,14 @@ namespace sdr
F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d
// create primitive and add
- const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D(
- aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute,
- nHorizontalSegments, nVerticalSegments));
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrSpherePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ nHorizontalSegments, nVerticalSegments));
xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
// delete 3D Object Attributes
delete pSdr3DObjectAttribute;
- delete pAttribute;
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 656edfdddb20..7172b0840476 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -30,7 +30,6 @@
#include <svx/sdr/contact/viewcontactofgraphic.hxx>
#include <svx/sdr/contact/viewobjectcontactofgraphic.hxx>
#include <svx/svdograf.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svl/itemset.hxx>
@@ -39,7 +38,6 @@
#endif
#include <svx/sdgcpitm.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
@@ -59,6 +57,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/colritem.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -148,10 +147,9 @@ namespace sdr
* aSmallerMatrix;
const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
- const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0);
const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
aSmallerMatrix,
- aEmptyAttributes,
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute(),
rGraphicObject,
rLocalGrafInfo));
@@ -177,14 +175,12 @@ namespace sdr
aEmptyGraphicAttr));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
- if(!rAttribute.getLine())
+ if(rAttribute.getLine().isDefault())
{
// create a surrounding frame when no linestyle given
const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
const basegfx::BColor aBColor(aColor.getBColor());
- const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
-
- basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
aOutline.transform(rObjectMatrix);
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
@@ -314,127 +310,123 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- SdrText* pSdrText = GetGrafObject().getText(0);
-
- if(pSdrText)
+ const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetGrafObject().getText(0)));
+
+ // create and fill GraphicAttr
+ GraphicAttr aLocalGrafInfo;
+ const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue());
+ const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP));
+ aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue());
+ aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue());
+ aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue());
+ aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue());
+ aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue());
+ aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01);
+ aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55));
+ aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue());
+ aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue());
+ aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom());
+
+ if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency())
{
- const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute =
- drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
- bool bVisible(pAttribute && pAttribute->isVisible());
-
- // create and fill GraphicAttr
- GraphicAttr aLocalGrafInfo;
- const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue());
- const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP));
- aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue());
- aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue());
- aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue());
- aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue());
- aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue());
- aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01);
- aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55));
- aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue());
- aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue());
- aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom());
-
- if(!bVisible && 255L != aLocalGrafInfo.GetTransparency())
+ // no fill, no line, no text (invisible), but the graphic content is visible.
+ // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet
+ const drawinglayer::attribute::SdrShadowAttribute aShadow(
+ drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet));
+
+ if(!aShadow.isDefault())
{
- // content is visible, so force some fill stuff
- delete pAttribute;
- bVisible = true;
+ // create new attribute set if indeed shadow is used
+ aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute(
+ aAttribute.getLine(),
+ aAttribute.getFill(),
+ aAttribute.getLineStartEnd(),
+ aShadow,
+ aAttribute.getFillFloatTransGradient(),
+ aAttribute.getText());
+ }
+ }
- // check shadow
- drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet);
+ // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect()
+ // which will use the primitive data we just create in the near future
+ const Rectangle& rRectangle = GetGrafObject().GetGeoRect();
+ const ::basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+
+ // look for mirroring
+ const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
+ const sal_Int32 nDrehWink(rGeoStat.nDrehWink);
+ const bool bRota180(18000 == nDrehWink);
+ const bool bMirrored(GetGrafObject().IsMirrored());
+ const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
+ bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
+ bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase));
+
+ // set mirror flags at LocalGrafInfo. Take into account that the geometry in
+ // aObjectRange is already changed and rotated when bRota180 is used. To rebuild
+ // that old behaviour (as long as part of the model data), correct the H/V flags
+ // accordingly. The created bitmapPrimitive WILL use the rotation, too.
+ if(bRota180)
+ {
+ // if bRota180 which is used for vertical mirroring, the graphic will already be rotated
+ // by 180 degrees. To correct, switch off VMirror and invert HMirroring.
+ bHMirr = !bHMirr;
+ bVMirr = false;
+ }
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
+ if(bHMirr || bVMirr)
+ {
+ aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0));
+ }
- // create new attribute set
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L);
- }
+ // fill object matrix
+ const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
+ const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0);
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ fShearX, fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
- if(pAttribute)
- {
- if(pAttribute->isVisible() || bVisible)
- {
- // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect()
- // which will use the primitive data we just create in the near future
- const Rectangle& rRectangle = GetGrafObject().GetGeoRect();
- const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
-
- // look for mirroring
- const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
- const sal_Int32 nDrehWink(rGeoStat.nDrehWink);
- const bool bRota180(18000 == nDrehWink);
- const bool bMirrored(GetGrafObject().IsMirrored());
- const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
- bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
- bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase));
-
- // set mirror flags at LocalGrafInfo. Take into account that the geometry in
- // aObjectRange is already changed and rotated when bRota180 is used. To rebuild
- // that old behaviour (as long as part of the model data), correct the H/V flags
- // accordingly. The created bitmapPrimitive WILL use the rotation, too.
- if(bRota180)
- {
- // if bRota180 which is used for vertical mirroring, the graphic will already be rotated
- // by 180 degrees. To correct, switch off VMirror and invert HMirroring.
- bHMirr = !bHMirr;
- bVMirr = false;
- }
-
- if(bHMirr || bVMirr)
- {
- aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0));
- }
-
- // fill object matrix
- const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
- const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0);
- const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(),
- fShearX, fRotate,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
-
- // get the current, unchenged graphic obect from SdrGrafObj
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
-
- if(visualisationUsesPresObj())
- {
- // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
- // with the content which is the placeholder graphic
- xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo);
- }
- else if(visualisationUsesDraft())
- {
- // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism
- // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious
- // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent
- // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster
- // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages
- xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute);
- }
- else
- {
- // create primitive. Info: Calling the copy-constructor of GraphicObject in this
- // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
- aObjectMatrix,
- *pAttribute,
- rGraphicObject,
- aLocalGrafInfo));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- }
-
- delete pAttribute;
- }
+ // get the current, unchenged graphic obect from SdrGrafObj
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+
+ if(visualisationUsesPresObj())
+ {
+ // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
+ // with the content which is the placeholder graphic
+ xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo);
+ }
+ else if(visualisationUsesDraft())
+ {
+ // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism
+ // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious
+ // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent
+ // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster
+ // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages
+ xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute);
}
+ else
+ {
+ // create primitive. Info: Calling the copy-constructor of GraphicObject in this
+ // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ rGraphicObject,
+ aLocalGrafInfo));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ // always append an invisible outline for the cases where no visible content exists
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectMatrix));
return xRetval;
}
diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx
index 1e0ed6bb4734..6252811d32a3 100644
--- a/svx/source/sdr/contact/viewcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewcontactofgroup.cxx
@@ -36,6 +36,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/color/bcolor.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -78,25 +79,22 @@ namespace sdr
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
}
}
-
- if(xRetval.hasElements())
- {
- return xRetval;
- }
else
{
- // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups,
- // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect()
- // to not execute anything.
+ // append an invisible outline for the cases where no visible content exists
const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect());
- const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(
- aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom())));
- const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone));
+ const basegfx::B2DRange aCurrentRange(
+ aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
+ aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
- // The replacement object may also get a text like 'empty group' here later
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aCurrentRange));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+
+ return xRetval;
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
index e0c1e46c4e69..ba260e79bba9 100644
--- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -38,12 +38,14 @@
#include <svx/svdview.hxx>
#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
#include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <svx/svdpage.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -59,33 +61,30 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject();
- if(pBackgroundCandidate)
- {
- // build primitive from pBackgroundCandidate's attributes
- const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet();
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
-
- if(pFill)
- {
- if(pFill->isVisible())
- {
- // direct model data is the page size, get and use it
- const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage();
- const basegfx::B2DRange aInnerRange(
- rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
- rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
- const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
- const basegfx::B2DHomMatrix aEmptyTransform;
- const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
- basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
+ // build primitive from page fill attributes
+ const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes));
- delete pFill;
- }
+ if(!aFill.isDefault())
+ {
+ // direct model data is the page size, get and use it
+ const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage();
+ const basegfx::B2DRange aInnerRange(
+ rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
+ rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(),
+ rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
return xRetval;
@@ -105,23 +104,11 @@ namespace sdr
sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const
{
- sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount());
-
- if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
- {
- nRetval--;
- }
-
- return nRetval;
+ return GetMasterPageDescriptor().GetUsedPage().GetObjCount();
}
ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
{
- if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
- {
- nIndex++;
- }
-
return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
index 05ff5e26308f..84e60392a88f 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx>
#include <svx/svdocapt.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -66,107 +65,108 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SdrCaptionObj& rCaptionObj(GetCaptionObj());
const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet();
- SdrText* pSdrText = rCaptionObj.getText(0);
-
- if(pSdrText)
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ rCaptionObj.getText(0)));
+
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = rCaptionObj.GetGeoRect();
+ const ::basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(rCaptionObj.GetGeoStat());
+
+ // fill object matrix
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // calculate corner radius
+ double fCornerRadiusX;
+ double fCornerRadiusY;
+ drawinglayer::primitive2d::calculateRelativeCornerRadius(
+ rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY);
+
+ // create primitive. Always create one (even if invisible) to let the decomposition
+ // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrCaptionPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ rCaptionObj.getTailPolygon(),
+ fCornerRadiusX,
+ fCornerRadiusY));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+
+ if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow())
{
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
-
- if(pAttribute)
+ // for SC, the caption object may have a specialized shadow. The usual object shadow is off
+ // and a specialized shadow gets created here (see old paint)
+ const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR));
+ const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
+ const Color aShadCol(rShadColItem.GetColorValue());
+ const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+ // Create own ItemSet and modify as needed
+ // Always hide lines for special calc shadow
+ SfxItemSet aSet(rItemSet);
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+
+ if(XFILL_HATCH == eStyle)
+ {
+ // #41666# Hatch color is set hard to shadow color
+ XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue();
+ aHatch.SetColor(aShadCol);
+ aSet.Put(XFillHatchItem(String(),aHatch));
+ }
+ else
{
- if(pAttribute->isVisible())
+ if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle)
{
- // take unrotated snap rect (direct model data) for position and size
- const Rectangle& rRectangle = rCaptionObj.GetGeoRect();
- const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
- const GeoStat& rGeoStat(rCaptionObj.GetGeoStat());
-
- // fill object matrix
- basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(),
- rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
- rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
-
- // calculate corner radius
- double fCornerRadiusX;
- double fCornerRadiusY;
- drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY);
-
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D(
- aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
-
- if(rCaptionObj.GetSpecialTextBoxShadow())
- {
- // for SC, the caption object may have a specialized shadow. The usual object shadow is off
- // and a specialized shadow gets created here (see old paint)
- const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR));
- const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
- const Color aShadCol(rShadColItem.GetColorValue());
- const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue();
-
- // Create own ItemSet and modify as needed
- // Always hide lines for special calc shadow
- SfxItemSet aSet(rItemSet);
- aSet.Put(XLineStyleItem(XLINE_NONE));
-
- if(XFILL_HATCH == eStyle)
- {
- // #41666# Hatch color is set hard to shadow color
- XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue();
- aHatch.SetColor(aShadCol);
- aSet.Put(XFillHatchItem(String(),aHatch));
- }
- else
- {
- if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle)
- {
- // force fill to solid (for Gradient and Bitmap)
- aSet.Put(XFillStyleItem(XFILL_SOLID));
- }
-
- aSet.Put(XFillColorItem(String(),aShadCol));
- aSet.Put(XFillTransparenceItem(nTransp));
- }
-
- // crete FillAttribute from modified ItemSet
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet);
- drawinglayer::primitive2d::Primitive2DReference xSpecialShadow;
-
- if(pFill)
- {
- if(pFill->isVisible())
- {
- // add shadow offset to object matrix
- const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
- const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
- aObjectMatrix.translate(nXDist, nYDist);
-
- // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition)
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY));
-
- // create the specialized shadow primitive
- xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill);
- }
-
- delete pFill;
- }
-
- if(xSpecialShadow.is())
- {
- // if we really got a special shadow, create a two-element retval with the shadow
- // behind the standard object's geometry
- xRetval.realloc(2);
-
- xRetval[0] = xSpecialShadow;
- xRetval[1] = xReference;
- }
- }
+ // force fill to solid (for Gradient and Bitmap)
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
}
- delete pAttribute;
+ aSet.Put(XFillColorItem(String(),aShadCol));
+ aSet.Put(XFillTransparenceItem(nTransp));
+ }
+
+ // crete FillAttribute from modified ItemSet
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(aSet));
+ drawinglayer::primitive2d::Primitive2DReference xSpecialShadow;
+
+ if(!aFill.isDefault() && 1.0 != aFill.getTransparence())
+ {
+ // add shadow offset to object matrix
+ const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
+ const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
+ aObjectMatrix.translate(nXDist, nYDist);
+
+ // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition)
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY));
+
+ // create the specialized shadow primitive
+ xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ aObjectMatrix,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute());
+ }
+
+ if(xSpecialShadow.is())
+ {
+ // if we really got a special shadow, create a two-element retval with the shadow
+ // behind the standard object's geometry
+ xRetval.realloc(2);
+
+ xRetval[0] = xSpecialShadow;
+ xRetval[1] = xReference;
}
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
index 18898463b266..f6f2f094001b 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrcircobj.hxx>
#include <svx/svdocirc.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx>
#include <svl/itemset.hxx>
#include <svx/sxciaitm.hxx>
@@ -54,56 +53,62 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet();
- SdrText* pSdrText = GetCircObj().getText(0);
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetCircObj().getText(0)));
- if(pSdrText)
- {
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
-
- if(pAttribute)
- {
- if(pAttribute->isVisible())
- {
- // take unrotated snap rect (direct model data) for position and size
- const Rectangle& rRectangle = GetCircObj().GetGeoRect();
- const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
- const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetCircObj().GetGeoRect();
+ const basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
- // fill object matrix
- const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(),
- rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
- rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
+ // fill object matrix
+ const basegfx::B2DHomMatrix aObjectMatrix(
+ basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
- // create primitive data
- const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
+ // create primitive data
+ const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
- if(OBJ_CIRC == nIdentifier)
- {
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- else
- {
- const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue());
- const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue());
- const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
- const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
- const bool bCloseSegment(OBJ_CARC != nIdentifier);
- const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- }
+ // always create primitives to allow the decomposition of SdrEllipsePrimitive2D
+ // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ if(OBJ_CIRC == nIdentifier)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrEllipsePrimitive2D(
+ aObjectMatrix,
+ aAttribute));
- delete pAttribute;
- }
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+ else
+ {
+ const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue());
+ const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue());
+ const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
+ const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
+ const bool bCloseSegment(OBJ_CARC != nIdentifier);
+ const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ fStart,
+ fEnd,
+ bCloseSegment,
+ bCloseUsingCenter));
- return xRetval;
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
index 7d9da0707dce..7b4ec93afb38 100644
--- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdredgeobj.hxx>
#include <svx/svdoedge.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -51,35 +50,27 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack());
+ const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack();
- // base visualisation on EdgeTrack
- if(aEdgeTrack.count())
- {
- // ckeck attributes
- const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet();
- SdrText* pSdrText = GetEdgeObj().getText(0);
+ // what to do when no EdgeTrack is provided (HitTest and selectability) ?
+ OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)");
- if(pSdrText)
- {
- drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText);
+ // ckeck attributes
+ const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(
+ rItemSet,
+ GetEdgeObj().getText(0)));
- if(pAttribute)
- {
- if(pAttribute->isVisible())
- {
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrConnectorPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrConnectorPrimitive2D(
+ aAttribute,
+ rEdgeTrack));
- delete pAttribute;
- }
- }
- }
-
- return xRetval;
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
index 237efa3e75e5..9d0d38f688eb 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrmeasureobj.hxx>
#include <svx/svdomeas.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svl/itemset.hxx>
#include <svx/sxmbritm.hxx>
#include <svx/sxmlhitm.hxx>
@@ -57,91 +56,85 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet();
- SdrText* pSdrText = GetMeasureObj().getText(0);
+ const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(
+ rItemSet,
+ GetMeasureObj().getText(0)));
- if(pSdrText)
- {
- drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText);
+ // take properties which are the model data.
+ const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y());
+ const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y());
+ const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue());
+ const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue());
+ const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue());
+ const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue());
+ const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue());
+ const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue());
+ const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue());
+ const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue());
+ drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
+ drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
- if(pAttribute)
+ switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue())
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE :
{
- if(pAttribute->isVisible())
- {
- // take properties which are the model data.
- const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y());
- const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y());
- const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue());
- const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue());
- const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue());
- const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue());
- const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue());
- const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue());
- const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue());
- const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue());
- drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
- drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
-
- switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue())
- {
- case SDRMEASURE_TEXTLEFTOUTSIDE :
- {
- aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
- break;
- }
- case SDRMEASURE_TEXTINSIDE :
- {
- aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
- break;
- }
- case SDRMEASURE_TEXTRIGHTOUTSIDE :
- {
- aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
- break;
- }
- default : // SDRMEASURE_TEXTHAUTO
- {
- break;
- }
- }
-
- switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue())
- {
- case SDRMEASURE_ABOVE :
- {
- aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
- break;
- }
- case SDRMEASURETEXT_BREAKEDLINE :
- case SDRMEASURETEXT_VERTICALCENTERED :
- {
- aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
- break;
- }
- case SDRMEASURE_BELOW :
- {
- aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
- break;
- }
- default : // SDRMEASURE_TEXTVAUTO
- {
- break;
- }
- }
-
- // create primitive with the model data
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute,
- aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta,
- bBelow, bTextRotation, bTextAutoAngle));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
+ break;
+ }
+ case SDRMEASURE_TEXTINSIDE :
+ {
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
+ break;
+ }
+ case SDRMEASURE_TEXTRIGHTOUTSIDE :
+ {
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
+ break;
+ }
+ default : // SDRMEASURE_TEXTHAUTO
+ {
+ break;
+ }
+ }
- delete pAttribute;
+ switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue())
+ {
+ case SDRMEASURE_ABOVE :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
+ break;
+ }
+ case SDRMEASURETEXT_BREAKEDLINE :
+ case SDRMEASURETEXT_VERTICALCENTERED :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
+ break;
+ }
+ case SDRMEASURE_BELOW :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
+ break;
+ }
+ default : // SDRMEASURE_TEXTVAUTO
+ {
+ break;
}
}
- return xRetval;
+ // create primitive with the model data. Always create primitives to allow the
+ // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrMeasurePrimitive2D(
+ aAttribute, aStart, aEnd,
+ aMTPHor, aMTPVer, fDistance,
+ fUpperDistance, fLowerDistance,
+ fLeftDelta, fRightDelta, bBelow,
+ bTextRotation, bTextAutoAngle));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
index 8da5a6426d06..ab6598840a8e 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
@@ -154,7 +154,9 @@ namespace sdr
// create range using the model data directly. This is in SdrTextObj::aRect which i will access using
// GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect());
- const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+ const basegfx::B2DRange aRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
// create object transform
basegfx::B2DHomMatrix aTransform;
@@ -163,12 +165,15 @@ namespace sdr
aTransform.set(0, 2, aRange.getMinX());
aTransform.set(1, 2, aRange.getMinY());
- // create media primitive
+ // create media primitive. Always create primitives to allow the
+ // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0);
const rtl::OUString& rURL(GetSdrMediaObj().getURL());
const sal_uInt32 nPixelBorder(4L);
- const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D(
- aTransform, rURL, aBackgroundColor, nPixelBorder));
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ new drawinglayer::primitive2d::MediaPrimitive2D(
+ aTransform, rURL, aBackgroundColor, nPixelBorder));
return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 60ce678527f5..6fa63f7c073e 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -31,13 +31,13 @@
#include <svx/svdoashp.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svditer.hxx>
#include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/obj3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -112,131 +112,126 @@ namespace sdr
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet();
- SdrText* pSdrText = GetCustomShapeObj().getText(0);
- if(pSdrText)
- {
- // #i98072# Get shandow and text; eventually suppress the text if it's
- // a TextPath FontworkGallery object
- drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute(
+ // #i98072# Get shandow and text; eventually suppress the text if it's
+ // a TextPath FontworkGallery object
+ const drawinglayer::attribute::SdrShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrShadowTextAttribute(
rItemSet,
- *pSdrText,
- GetCustomShapeObj().IsTextPath());
- drawinglayer::primitive2d::Primitive2DSequence xGroup;
- bool bHasText(pAttribute && pAttribute->getText());
+ GetCustomShapeObj().getText(0),
+ GetCustomShapeObj().IsTextPath()));
+ drawinglayer::primitive2d::Primitive2DSequence xGroup;
+ bool bHasText(!aAttribute.getText().isDefault());
+
+ // create Primitive2DSequence from sub-geometry
+ const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape();
+ bool b3DShape(false);
- // create Primitive2DSequence from sub-geometry
- const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape();
- bool b3DShape(false);
+ if(pSdrObjRepresentation)
+ {
+ SdrObjListIter aIterator(*pSdrObjRepresentation);
- if(pSdrObjRepresentation)
+ while(aIterator.IsMore())
{
- SdrObjListIter aIterator(*pSdrObjRepresentation);
+ SdrObject& rCandidate = *aIterator.Next();
- while(aIterator.IsMore())
+ if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate))
{
- SdrObject& rCandidate = *aIterator.Next();
-
- if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate))
- {
- b3DShape = true;
- }
-
- const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence());
- drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew);
+ b3DShape = true;
}
+
+ const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew);
}
+ }
+
+ if(bHasText || xGroup.hasElements())
+ {
+ // prepare text box geometry
+ basegfx::B2DHomMatrix aTextBoxMatrix;
+ bool bWordWrap(false);
- if(bHasText || xGroup.hasElements())
+ if(bHasText)
{
- // prepare text box geometry
- basegfx::B2DHomMatrix aTextBoxMatrix;
- bool bWordWrap(false);
+ // take unrotated snap rect as default, then get the
+ // unrotated text box. Rotation needs to be done centered
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom());
- if(bHasText)
- {
- // take unrotated snap rect as default, then get the
- // unrotated text box. Rotation needs to be done centered
- const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
- const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom());
+ // #i101684# get the text range unrotated and absolute to the object range
+ const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
- // #i101684# get the text range unrotated and absolute to the object range
- const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
+ // give text object a size
+ aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight());
- // give text object a size
- aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight());
+ // check if we have a rotation/shear at all to take care of
+ const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation());
+ const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
- // check if we have a rotation/shear at all to take care of
- const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation());
- const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
+ if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation))
+ {
+ if(aObjectRange != aTextRange)
+ {
+ // move relative to unrotated object range
+ aTextBoxMatrix.translate(
+ aTextRange.getMinX() - aObjectRange.getMinimum().getX(),
+ aTextRange.getMinY() - aObjectRange.getMinimum().getY());
+ }
- if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation))
+ if(!basegfx::fTools::equalZero(fExtraTextRotation))
{
- if(aObjectRange != aTextRange)
- {
- // move relative to unrotated object range
- aTextBoxMatrix.translate(
- aTextRange.getMinX() - aObjectRange.getMinimum().getX(),
- aTextRange.getMinY() - aObjectRange.getMinimum().getY());
- }
-
- if(!basegfx::fTools::equalZero(fExtraTextRotation))
- {
- basegfx::B2DVector aTranslation(
- ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
- ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
- aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
- aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
- aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
- }
-
- if(rGeoStat.nShearWink)
- {
- aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
- }
-
- if(rGeoStat.nDrehWink)
- {
- aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
- }
-
- // give text it's target position
- aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ basegfx::B2DVector aTranslation(
+ ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
+ ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
+ aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
+ aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
+ aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
- else
+
+ if(rGeoStat.nShearWink)
{
- aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());
+ aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
}
- // check if SdrTextWordWrapItem is set
- bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
- }
+ if(rGeoStat.nDrehWink)
+ {
+ aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+ }
- // make sure a (even empty) SdrShadowTextAttribute exists for
- // primitive creation
- if(!pAttribute)
+ // give text it's target position
+ aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ }
+ else
{
- pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L);
+ aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());
}
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrCustomShapePrimitive2D(
- *pAttribute,
- xGroup,
- aTextBoxMatrix,
- bWordWrap,
- b3DShape,
- false)); // #SJ# New parameter to force to clipped BlockText for SC
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ // check if SdrTextWordWrapItem is set
+ bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
}
- if(pAttribute)
- {
- delete pAttribute;
- }
+ // create primitive
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrCustomShapePrimitive2D(
+ aAttribute,
+ xGroup,
+ aTextBoxMatrix,
+ bWordWrap,
+ b3DShape,
+ false)); // #SJ# New parameter to force to clipped BlockText for SC
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+ // always append an invisible outline for the cases where no visible content exists
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange(
+ aObjectBound.Left(), aObjectBound.Top(),
+ aObjectBound.Right(), aObjectBound.Bottom());
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectRange));
+
return xRetval;
}
} // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index a0960a5eb7c5..b88578113c5d 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -30,7 +30,6 @@
#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
#include <svx/svdoole2.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svx/sdr/primitive2d/sdrole2primitive2d.hxx>
@@ -72,59 +71,51 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(
bool bHighContrast) const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- SdrText* pSdrText = GetOle2Obj().getText(0);
-
- if(pSdrText)
- {
- // take unrotated snap rect (direct model data) for position and size
- const Rectangle& rRectangle = GetOle2Obj().GetGeoRect();
- const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
-
- // create object matrix
- const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
- const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
- const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
- const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
-
- // Prepare attribute settings, will be used soon anyways
- const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
-
- if(!pAttribute)
- {
- // force existence, even when not visible
- pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0);
- }
-
- // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
- // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
- // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
- // It will also take care of HighContrast and ScaleContent
- const drawinglayer::primitive2d::Primitive2DReference xOleContent(
- new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
- GetOle2Obj(),
- aObjectMatrix,
-
- // #i104867# add GraphicVersion number to be able to check for
- // content change in the primitive later
- GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(),
-
- bHighContrast));
-
- // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways.
- const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1);
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D(
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetOle2Obj().GetGeoRect();
+ const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ // create object matrix
+ const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
+ const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
+ const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // Prepare attribute settings, will be used soon anyways
+ const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetOle2Obj().getText(0)));
+
+ // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
+ // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
+ // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
+ // It will also take care of HighContrast and ScaleContent
+ const drawinglayer::primitive2d::Primitive2DReference xOleContent(
+ new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+ GetOle2Obj(),
+ aObjectMatrix,
+
+ // #i104867# add GraphicVersion number to be able to check for
+ // content change in the primitive later
+ GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(),
+
+ bHighContrast));
+
+ // create primitive. Use Ole2 primitive here. Prepare attribute settings, will
+ // be used soon anyways. Always create primitives to allow the decomposition of
+ // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrOle2Primitive2D(
xOLEContent,
aObjectMatrix,
- *pAttribute));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- delete pAttribute;
- }
+ aAttribute));
- return xRetval;
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index c4a51200d5fc..e486f978fafb 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -42,9 +42,9 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,8 @@ namespace sdr
const svtools::ColorConfig aColorConfig;
const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
const basegfx::BColor aRGBColor(aInitColor.getBColor());
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
@@ -202,38 +203,27 @@ namespace sdr
}
else
{
- OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
+ // build primitive from pObject's attributes
+ const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes));
- if(rPage.GetObjCount())
+ if(!aFill.isDefault())
{
- SdrObject* pObject = rPage.GetObj(0);
- OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)");
-
- if(pObject && pObject->IsMasterPageBackgroundObject())
- {
- // build primitive from pObject's attributes
- const SfxItemSet& rFillProperties = pObject->GetMergedItemSet();
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
-
- if(pFill)
- {
- if(pFill->isVisible())
- {
- // direct model data is the page size, get and use it
- const basegfx::B2DRange aInnerRange(
- rPage.GetLftBorder(), rPage.GetUppBorder(),
- rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
- const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
- const basegfx::B2DHomMatrix aEmptyTransform;
- const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
- basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
-
- delete pFill;
- }
- }
+ // direct model data is the page size, get and use it
+ const basegfx::B2DRange aInnerRange(
+ rPage.GetLftBorder(), rPage.GetUppBorder(),
+ rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
}
}
@@ -455,23 +445,11 @@ namespace sdr
sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
{
- sal_uInt32 nSubObjectCount(getPage().GetObjCount());
-
- if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
- {
- nSubObjectCount--;
- }
-
- return nSubObjectCount;
+ return getPage().GetObjCount();
}
ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
{
- if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
- {
- nIndex++;
- }
-
SdrObject* pObj = getPage().GetObj(nIndex);
DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
return pObj->GetViewContact();
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index d7a45de423fd..bc4c500ff155 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrpathobj.hxx>
#include <svx/svdopath.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -53,93 +52,91 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
- SdrText* pSdrText = GetPathObj().getText(0);
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetPathObj().getText(0)));
+ basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
+ sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
+ sal_uInt32 nPointCount(0);
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count();
+ }
+
+ if(!nPointCount)
+ {
+ OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)");
+ basegfx::B2DPolygon aFallbackLine;
+ aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
+ aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
+ aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
+
+ nPolyCount = 1;
+ }
+
+ // prepare object transformation and unit polygon (direct model data)
+ basegfx::B2DHomMatrix aObjectMatrix;
+ const bool bIsLine(
+ !aUnitPolyPolygon.areControlPointsUsed()
+ && 1 == nPolyCount
+ && 2 == aUnitPolyPolygon.getB2DPolygon(0).count());
- if(pSdrText)
+ if(bIsLine)
{
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute =
- drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
- rItemSet,
- *pSdrText);
-
- if(pAttribute)
- {
- if(pAttribute->isVisible())
- {
- basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
- const sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
-
- if(nPolyCount)
- {
- // prepare object transformation and unit polygon (direct model data)
- basegfx::B2DHomMatrix aObjectMatrix;
- const bool bIsLine(
- !aUnitPolyPolygon.areControlPointsUsed()
- && 1 == nPolyCount
- && 2 == aUnitPolyPolygon.getB2DPolygon(0).count());
-
- if(bIsLine)
- {
- // special handling for single line mode (2 points)
- const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0));
- const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0));
- const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1));
- const basegfx::B2DVector aLine(aEnd - aStart);
-
- // #i102548# create new unit polygon for line (horizontal)
- basegfx::B2DPolygon aNewPolygon;
- aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
- aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
- aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon);
-
- // #i102548# fill objectMatrix with rotation and offset (no shear for lines)
- aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aLine.getLength(), 1.0,
- 0.0,
- atan2(aLine.getY(), aLine.getX()),
- aStart.getX(), aStart.getY());
- }
- else
- {
- // #i102548# create unscaled, unsheared, unrotated and untranslated polygon
- // (unit polygon) by creating the object matrix and back-transforming the polygon
- const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon));
- const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
- const double fWidth(aObjectRange.getWidth());
- const double fHeight(aObjectRange.getHeight());
- const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth);
- const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight);
-
- aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- fScaleX, fScaleY,
- rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
- rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
- aObjectRange.getMinX(), aObjectRange.getMinY());
-
- // ceate unit polygon from object's absolute path
- basegfx::B2DHomMatrix aInverse(aObjectMatrix);
- aInverse.invert();
- aUnitPolyPolygon.transform(aInverse);
- }
-
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrPathPrimitive2D(
- aObjectMatrix,
- *pAttribute,
- aUnitPolyPolygon));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- }
-
- delete pAttribute;
- }
+ // special handling for single line mode (2 points)
+ const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0));
+ const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0));
+ const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1));
+ const basegfx::B2DVector aLine(aEnd - aStart);
+
+ // #i102548# create new unit polygon for line (horizontal)
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+ aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon);
+
+ // #i102548# fill objectMatrix with rotation and offset (no shear for lines)
+ aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aLine.getLength(), 1.0,
+ 0.0,
+ atan2(aLine.getY(), aLine.getX()),
+ aStart.getX(), aStart.getY());
}
+ else
+ {
+ // #i102548# create unscaled, unsheared, unrotated and untranslated polygon
+ // (unit polygon) by creating the object matrix and back-transforming the polygon
+ const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon));
+ const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
+ const double fWidth(aObjectRange.getWidth());
+ const double fHeight(aObjectRange.getHeight());
+ const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth);
+ const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight);
+
+ aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ fScaleX, fScaleY,
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY());
+
+ // ceate unit polygon from object's absolute path
+ basegfx::B2DHomMatrix aInverse(aObjectMatrix);
+ aInverse.invert();
+ aUnitPolyPolygon.transform(aInverse);
+ }
+
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrPathPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ aUnitPolyPolygon));
- return xRetval;
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
index 11d1e0d004f7..fdbfa16dd584 100644
--- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
#include <svx/svdorect.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
#include <svl/itemset.hxx>
#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
@@ -55,70 +54,48 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
- SdrText* pSdrText = GetRectObj().getText(0);
-
- if(pSdrText)
- {
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
-
- if(pAttribute)
- {
- if(pAttribute->isVisible())
- {
- // take unrotated snap rect (direct model data) for position and size
- const Rectangle& rRectangle = GetRectObj().GetGeoRect();
- const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
- const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
-
- // fill object matrix
- basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(),
- rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
- rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
-
- // calculate corner radius
- sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue());
- double fCornerRadiusX;
- double fCornerRadiusY;
- drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
-
- // #i105856# use knowledge about pickthrough from the model
- const bool bPickThroughTransparentTextFrames(
- GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
-
- // create primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::SdrRectanglePrimitive2D(
- aObjectMatrix,
- *pAttribute,
- fCornerRadiusX,
- fCornerRadiusY,
- // #i105856# use fill for HitTest when TextFrame and not PickThrough
- GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
-
- delete pAttribute;
- }
-
- if(!xRetval.hasElements())
- {
- // #i99123#
- // Object is invisible. Create a fallback primitive for HitTest
- basegfx::B2DHomMatrix aObjectMatrix;
- basegfx::B2DPolyPolygon aObjectPolyPolygon;
- GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- }
- }
-
- return xRetval;
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetRectObj().getText(0)));
+
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetRectObj().GetGeoRect();
+ const ::basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
+
+ // fill object matrix
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // calculate corner radius
+ sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue());
+ double fCornerRadiusX;
+ double fCornerRadiusY;
+ drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
+
+ // #i105856# use knowledge about pickthrough from the model
+ const bool bPickThroughTransparentTextFrames(
+ GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
+
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrRectanglePrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ fCornerRadiusX,
+ fCornerRadiusY,
+ // #i105856# use fill for HitTest when TextFrame and not PickThrough
+ GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index 4262f0fe190f..2a4d527fdcdd 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -47,6 +47,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//........................................................................
namespace sdr { namespace contact {
@@ -135,35 +136,43 @@ namespace sdr { namespace contact {
//--------------------------------------------------------------------
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const
{
+ // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use
+ // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj)
+ // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything
+ const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect());
+ const basegfx::B2DRange aRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.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());
+
Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel();
if(xControlModel.is())
{
- // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use
- // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj)
- // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything
- const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect());
- const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.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 WITHOUT possibly existing XControl; this would be done in
// the VOC in createPrimitive2DSequence()
- const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D(
- aTransform, xControlModel));
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ new drawinglayer::primitive2d::ControlPrimitive2D(
+ aTransform,
+ xControlModel));
return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
}
else
{
- // #i93161# This UnoControl does not yet have a xControlModel (can happen
- // during diverse creations). Without a model, create no visualisation.
- return drawinglayer::primitive2d::Primitive2DSequence();
+ // always append an invisible outline for the cases where no visible content exists
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aTransform));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
}
}
diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
index a58ad8a586ea..54d7e6ddae97 100644
--- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
@@ -33,6 +33,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -74,29 +75,39 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ // create displacement transformation if we have content
+ basegfx::B2DHomMatrix aObjectMatrix;
+ Point aAnchor(GetVirtObj().GetAnchorPos());
+
+ if(aAnchor.X() || aAnchor.Y())
+ {
+ aObjectMatrix.set(0, 2, aAnchor.X());
+ aObjectMatrix.set(1, 2, aAnchor.Y());
+ }
// use method from referenced object to get the Primitive2DSequence
- const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence());
+ const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(
+ GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence());
if(xSequenceVirtual.hasElements())
{
- // create displacement transformation if we have content
- ::basegfx::B2DHomMatrix aObjectMatrix;
- Point aAnchor(GetVirtObj().GetAnchorPos());
-
- if(aAnchor.X() || aAnchor.Y())
- {
- aObjectMatrix.set(0, 2, aAnchor.X());
- aObjectMatrix.set(1, 2, aAnchor.Y());
- }
-
// create transform primitive
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ aObjectMatrix,
+ xSequenceVirtual));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
+ else
+ {
+ // always append an invisible outline for the cases where no visible content exists
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectMatrix));
- return xRetval;
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
index 780f89dfd249..ec8cdb4ef5ba 100644
--- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
@@ -35,7 +35,6 @@
#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
//////////////////////////////////////////////////////////////////////////////
// predeclarations
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
index 91e157aeb966..a549b1db1233 100644
--- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
@@ -121,17 +121,6 @@ namespace sdr
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
}
- else
- {
- // do neither print nor PDF export the fallback visualisation
- if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
- {
- // empty group, fallback to parent method which will create the default
- // grayed frame for empty 3d scenes by using model data and
- // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene
- xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
- }
- }
if(bIsActiveVC)
{
diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
index 7c17f0bb9144..47c2cccbd02d 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -55,20 +55,6 @@ namespace sdr
{
}
- bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
- {
- const bool bHasChildren(0 != GetViewContact().GetObjectCount());
-
- if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile()))
- {
- // empty group uses fallback gray empty frame display. Do neither print nor PDF export it
- return false;
- }
-
- // call parent
- return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo);
- }
-
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
{
const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
index 728536151608..e779cac4151e 100644
--- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
@@ -94,15 +94,13 @@ namespace sdr
rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
rDisplayInfo.SetSubContentActive(true);
- // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet
- const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject();
-
- if(pBackgroundCandidate && aPreprocessedLayers.IsSet(pBackgroundCandidate->GetLayer()))
+ // check layer visibility (traditionally was member of layer 1)
+ if(aPreprocessedLayers.IsSet(1))
{
// hide PageBackground for special DrawModes; historical reasons
if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast())
{
- // if yes, create the default background primitive sequence
+ // if visible, create the default background primitive sequence
xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence();
}
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 9539d79549ff..5ef26193d4b3 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -40,7 +40,7 @@
#include <svx/svdpage.hxx>
#include <unoapi.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -292,28 +292,19 @@ namespace sdr
else if(bCreateGrayFrame)
{
// #i105146# no content, but frame display. To make hitting the page preview objects
- // on the handout page more simple, add a HitTest fill primitive
- const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
- basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange));
- aOutline.transform(aPageObjectTransform);
-
- const drawinglayer::primitive2d::Primitive2DReference xHitFill(
- new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aOutline),
- basegfx::BColor(0.0, 0.0, 0.0)));
-
- const drawinglayer::primitive2d::Primitive2DReference xHit(
- new drawinglayer::primitive2d::HitTestPrimitive2D(
- drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1)));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1);
+ // on the handout page more simple, add hidden fill geometry
+ const drawinglayer::primitive2d::Primitive2DReference xFrameHit(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false,
+ aPageObjectTransform));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1);
}
// add a gray outline frame, except not when printing
if(bCreateGrayFrame)
{
const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor);
- basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon());
aOwnOutline.transform(aPageObjectTransform);
const drawinglayer::primitive2d::Primitive2DReference xGrayFrame(
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 4b22ec562e6d..b1a4826609f9 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -35,11 +35,11 @@
#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>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -203,7 +203,7 @@ namespace sdr
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)));
+ basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon());
aObjectOutline.transform(aObjectTransform);
// Use a FillHatchPrimitive2D with necessary attributes
diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx
index ce2563169827..dbf38a8cd0f1 100644
--- a/svx/source/sdr/overlay/overlayobjectcell.cxx
+++ b/svx/source/sdr/overlay/overlayobjectcell.cxx
@@ -35,7 +35,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
using namespace ::basegfx;
@@ -84,12 +84,12 @@ namespace sdr
if(mePaintType == CELL_OVERLAY_TRANSPARENT)
{
// embed in 50% transparent paint
- const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
- new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
aRetval,
0.5));
- aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1);
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
}
else // CELL_OVERLAY_INVERT
{
diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx
index 54a5f3e06616..2115d3c63120 100644
--- a/svx/source/sdr/overlay/overlayselection.cxx
+++ b/svx/source/sdr/overlay/overlayselection.cxx
@@ -35,7 +35,7 @@
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
@@ -141,8 +141,8 @@ namespace sdr
{
// embed all rectangles in transparent paint
const double fTransparence(mnLastTransparence / 100.0);
- const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
- new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
aRetval,
fTransparence));
@@ -156,13 +156,13 @@ namespace sdr
// add both to result
aRetval.realloc(2);
- aRetval[0] = aUnifiedAlpha;
+ aRetval[0] = aUnifiedTransparence;
aRetval[1] = aSelectionOutline;
}
else
{
// just add transparent part
- aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1);
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
}
}
}
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 5c61ec81401a..4ff335a04125 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -54,14 +54,11 @@
#include <svx/sdsxyitm.hxx>
#include <svx/sdshcitm.hxx>
#include <svx/sdshtitm.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/svdotext.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#include <svx/sdr/attribute/sdrtextattribute.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/xbtmpit.hxx>
#include <svl/itempool.hxx>
#include <vcl/svapp.hxx>
@@ -69,10 +66,22 @@
#include <svx/svx3ditems.hxx>
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/attribute/sdrallattribute3d.hxx>
#include <svx/rectenum.hxx>
#include <svx/sdtfchim.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/editstat.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <svx/sdr/attribute/sdrfilltextattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -214,9 +223,8 @@ namespace drawinglayer
{
namespace primitive2d
{
- attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet)
+ attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet)
{
- attribute::SdrLineAttribute* pRetval(0L);
const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
if(XLINE_NONE != eStyle)
@@ -246,7 +254,7 @@ namespace drawinglayer
}
}
- pRetval = new attribute::SdrLineAttribute(
+ return attribute::SdrLineAttribute(
XLineJointtoB2DLineJoin(eJoint),
(double)nWidth,
(double)nTransparence * 0.01,
@@ -256,12 +264,13 @@ namespace drawinglayer
}
}
- return pRetval;
+ return attribute::SdrLineAttribute();
}
- attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth)
+ attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+ const SfxItemSet& rSet,
+ double fWidth)
{
- attribute::SdrLineStartEndAttribute* pRetval(0L);
const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue());
const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue());
basegfx::B2DPolyPolygon aStartPolyPolygon;
@@ -321,15 +330,16 @@ namespace drawinglayer
if(bStartActive || bEndActive)
{
- pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered);
+ return attribute::SdrLineStartEndAttribute(
+ aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth,
+ bStartActive, bEndActive, bStartCentered, bEndCentered);
}
- return pRetval;
+ return attribute::SdrLineStartEndAttribute();
}
- attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet)
+ attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet)
{
- attribute::SdrShadowAttribute* pRetval(0L);
const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue());
if(bShadow)
@@ -367,16 +377,15 @@ namespace drawinglayer
(double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
- pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
+ return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
}
}
- return pRetval;
+ return attribute::SdrShadowAttribute();
}
- attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet)
+ attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet)
{
- attribute::SdrFillAttribute* pRetval(0L);
const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
if(XFILL_NONE != eStyle)
@@ -391,9 +400,9 @@ namespace drawinglayer
if(100 != nTransparence)
{
const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
- attribute::FillGradientAttribute* pGradient(0L);
- attribute::FillHatchAttribute* pHatch(0L);
- attribute::SdrFillBitmapAttribute* pBitmap(0L);
+ attribute::FillGradientAttribute aGradient;
+ attribute::FillHatchAttribute aHatch;
+ attribute::SdrFillBitmapAttribute aBitmap;
switch(eStyle)
{
@@ -405,10 +414,10 @@ namespace drawinglayer
}
case XFILL_GRADIENT :
{
- XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
+ XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
- const Color aStartColor(aGradient.GetStartColor());
- const sal_uInt16 nStartIntens(aGradient.GetStartIntens());
+ const Color aStartColor(aXGradient.GetStartColor());
+ const sal_uInt16 nStartIntens(aXGradient.GetStartIntens());
basegfx::BColor aStart(aStartColor.getBColor());
if(nStartIntens != 100)
@@ -417,8 +426,8 @@ namespace drawinglayer
aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
}
- const Color aEndColor(aGradient.GetEndColor());
- const sal_uInt16 nEndIntens(aGradient.GetEndIntens());
+ const Color aEndColor(aXGradient.GetEndColor());
+ const sal_uInt16 nEndIntens(aXGradient.GetEndIntens());
basegfx::BColor aEnd(aEndColor.getBColor());
if(nEndIntens != 100)
@@ -427,12 +436,12 @@ namespace drawinglayer
aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
}
- pGradient = new attribute::FillGradientAttribute(
- XGradientStyleToGradientStyle(aGradient.GetGradientStyle()),
- (double)aGradient.GetBorder() * 0.01,
- (double)aGradient.GetXOffset() * 0.01,
- (double)aGradient.GetYOffset() * 0.01,
- (double)aGradient.GetAngle() * F_PI1800,
+ aGradient = attribute::FillGradientAttribute(
+ XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
+ (double)aXGradient.GetBorder() * 0.01,
+ (double)aXGradient.GetXOffset() * 0.01,
+ (double)aXGradient.GetYOffset() * 0.01,
+ (double)aXGradient.GetAngle() * F_PI1800,
aStart,
aEnd,
((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue());
@@ -444,7 +453,7 @@ namespace drawinglayer
const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue());
const Color aColorB(rHatch.GetColor());
- pHatch = new attribute::FillHatchAttribute(
+ aHatch = attribute::FillHatchAttribute(
XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
(double)rHatch.GetDistance(),
(double)rHatch.GetAngle() * F_PI1800,
@@ -455,23 +464,25 @@ namespace drawinglayer
}
case XFILL_BITMAP :
{
- pBitmap = createNewSdrFillBitmapAttribute(rSet);
+ aBitmap = createNewSdrFillBitmapAttribute(rSet);
break;
}
}
- pRetval = new attribute::SdrFillAttribute(
+ return attribute::SdrFillAttribute(
(double)nTransparence * 0.01,
aColor.getBColor(),
- pGradient, pHatch, pBitmap);
+ aGradient,
+ aHatch,
+ aBitmap);
}
}
- return pRetval;
+ return attribute::SdrFillAttribute();
}
// #i101508# Support handing over given text-to-border distances
- attribute::SdrTextAttribute* createNewSdrTextAttribute(
+ attribute::SdrTextAttribute createNewSdrTextAttribute(
const SfxItemSet& rSet,
const SdrText& rText,
const sal_Int32* pLeft,
@@ -479,7 +490,6 @@ namespace drawinglayer
const sal_Int32* pRight,
const sal_Int32* pLower)
{
- attribute::SdrTextAttribute* pRetval(0);
const SdrTextObj& rTextObj = rText.GetObject();
if(rText.GetOutlinerParaObject() && rText.GetModel())
@@ -519,7 +529,11 @@ namespace drawinglayer
const SdrFitToSizeType eFit(rTextObj.GetFitToSize());
const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
- pRetval = new attribute::SdrTextAttribute(
+ // #i107346#
+ const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
+ const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING);
+
+ return attribute::SdrTextAttribute(
rText,
aOutlinerParaObject,
((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(),
@@ -535,18 +549,19 @@ namespace drawinglayer
SDRTEXTANI_BLINK == eAniKind,
SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
bInEditMode,
- ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(),
+ bWrongSpell);
}
- return pRetval;
+ return attribute::SdrTextAttribute();
}
- attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
+ attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
{
- attribute::FillGradientAttribute* pRetval = 0L;
const SfxPoolItem* pGradientItem;
- if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
+ if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem)
+ && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
{
// test if float transparence is completely transparent
const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
@@ -559,7 +574,7 @@ namespace drawinglayer
const double fStartLum(nStartLuminance / 255.0);
const double fEndLum(nEndLuminance / 255.0);
- pRetval = new attribute::FillGradientAttribute(
+ return attribute::FillGradientAttribute(
XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
(double)rGradient.GetBorder() * 0.01,
(double)rGradient.GetXOffset() * 0.01,
@@ -571,12 +586,11 @@ namespace drawinglayer
}
}
- return pRetval;
+ return attribute::FillGradientAttribute();
}
- attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
+ attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
{
- attribute::SdrFillBitmapAttribute* pRetval(0L);
Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap());
// make sure it's not empty, use default instead
@@ -623,7 +637,7 @@ namespace drawinglayer
(double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(),
(double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
- pRetval = new attribute::SdrFillBitmapAttribute(
+ return attribute::SdrFillBitmapAttribute(
aBitmap,
aSize,
aOffset,
@@ -632,252 +646,174 @@ namespace drawinglayer
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(),
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(),
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue());
-
- return pRetval;
}
- attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText)
+ attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText,
+ bool bSuppressText)
{
- attribute::SdrShadowTextAttribute* pRetval(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrTextAttribute aText;
// #i98072# added option to suppress text
// look for text first
- if(!bSuppressText)
+ if(!bSuppressText && pText)
{
- pText = createNewSdrTextAttribute(rSet, rText);
+ aText = createNewSdrTextAttribute(rSet, *pText);
}
// try shadow
- pShadow = createNewSdrShadowAttribute(rSet);
-
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
-
- if(pText || pShadow)
- {
- pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText);
- }
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
- return pRetval;
+ return attribute::SdrShadowTextAttribute(aShadow, aText);
}
- attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
{
- attribute::SdrLineShadowTextAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- pText = createNewSdrTextAttribute(rSet, rText);
-
- // 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->getSdrFormTextAttribute() && pText->isHideContour())
+ if(pText)
{
- bFontworkHideContour = true;
+ aText = createNewSdrTextAttribute(rSet, *pText);
+
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.isDefault()
+ && !aText.getSdrFormTextAttribute().isDefault()
+ && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
}
// try line style
if(!bFontworkHideContour)
{
- pLine = createNewSdrLineAttribute(rSet);
+ aLine = createNewSdrLineAttribute(rSet);
- if(pLine && !pLine->isVisible())
- {
- delete pLine;
- pLine = 0L;
- }
-
- if(pLine)
+ if(!aLine.isDefault())
{
// try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
}
- // try shadow
- if(pLine || pText)
+ if(!aLine.isDefault() || !aText.isDefault())
{
- pShadow = createNewSdrShadowAttribute(rSet);
+ // try shadow
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
+ return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText);
}
- if(pLine || pText)
- {
- pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText);
- }
-
- return pRetval;
+ return attribute::SdrLineShadowTextAttribute();
}
- attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
{
- attribute::SdrLineFillShadowTextAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- pText = createNewSdrTextAttribute(rSet, rText);
-
- // 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->getSdrFormTextAttribute() && pText->isHideContour())
+ if(pText)
{
- bFontworkHideContour = true;
- }
-
- // try line style
- if(!bFontworkHideContour)
- {
- pLine = createNewSdrLineAttribute(rSet);
-
- if(pLine && !pLine->isVisible())
- {
- delete pLine;
- pLine = 0L;
- }
+ aText = createNewSdrTextAttribute(rSet, *pText);
- if(pLine)
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
{
- // try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ bFontworkHideContour = true;
}
}
- // try fill style
if(!bFontworkHideContour)
{
- pFill = createNewSdrFillAttribute(rSet);
+ // try line style
+ aLine = createNewSdrLineAttribute(rSet);
- if(pFill && !pFill->isVisible())
+ if(!aLine.isDefault())
{
- delete pFill;
- pFill = 0L;
+ // try LineStartEnd
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
- if(pFill)
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
+
+ if(!aFill.isDefault())
{
// try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- // try shadow
- if(pLine || pFill || pText)
+ if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault())
{
- pShadow = createNewSdrShadowAttribute(rSet);
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
+ return attribute::SdrLineFillShadowTextAttribute(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText);
}
- if(pLine || pFill || pText)
- {
- pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText);
- }
-
- return pRetval;
+ return attribute::SdrLineFillShadowTextAttribute();
}
- attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
+ attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
{
- attribute::SdrLineFillShadowAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
// try line style
- pLine = createNewSdrLineAttribute(rSet);
+ const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet));
- if(pLine && !pLine->isVisible())
- {
- delete pLine;
- pLine = 0L;
- }
-
- if(pLine)
+ if(!aLine.isDefault())
{
// try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
// try fill style
- pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet);
-
- if(pFill && !pFill->isVisible())
+ if(!bSuppressFill)
{
- delete pFill;
- pFill = 0L;
- }
-
- if(pFill)
- {
- // try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
- }
+ aFill = createNewSdrFillAttribute(rSet);
- // try shadow
- if(pLine || pFill)
- {
- pShadow = createNewSdrShadowAttribute(rSet);
-
- if(pShadow && !pShadow->isVisible())
+ if(!aFill.isDefault())
{
- delete pShadow;
- pShadow = 0L;
+ // try fillfloattransparence
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- if(pLine || pFill)
+ if(!aLine.isDefault() || !aFill.isDefault())
{
- pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient);
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
+
+ return attribute::SdrLineFillShadowAttribute3D(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient);
}
- return pRetval;
+ return attribute::SdrLineFillShadowAttribute3D();
}
- attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet)
+ attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet)
{
// get perspective
::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL);
@@ -914,10 +850,10 @@ namespace drawinglayer
// get two sided lighting
const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue());
- return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
+ return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
}
- attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet)
+ attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet)
{
// extract lights from given SfxItemSet (from scene)
::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
@@ -982,7 +918,7 @@ namespace drawinglayer
const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
- return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
+ return attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
}
void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY)
@@ -1039,57 +975,50 @@ namespace drawinglayer
}
// #i101508# Support handing over given text-to-border distances
- attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(
+ attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(
const SfxItemSet& rSet,
- const SdrText* pSdrText,
+ const SdrText* pText,
const sal_Int32* pLeft,
const sal_Int32* pUpper,
const sal_Int32* pRight,
const sal_Int32* pLower)
{
- attribute::SdrFillTextAttribute* pRetval(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrFillAttribute aFill;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- if(pSdrText)
+ if(pText)
{
- pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower);
- }
+ aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower);
- // when object has text and text is fontwork and hide contour is set for fontwork, force
- // fill style to empty
- if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
- {
- bFontworkHideContour = true;
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // fill style to empty
+ if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
}
- // try fill style
if(!bFontworkHideContour)
{
- pFill = createNewSdrFillAttribute(rSet);
-
- if(pFill && !pFill->isVisible())
- {
- delete pFill;
- pFill = 0L;
- }
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
- if(pFill)
+ if(!aFill.isDefault())
{
// try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- if(pFill || pText)
+ if(!aFill.isDefault() || !aText.isDefault())
{
- pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText);
+ return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText);
}
- return pRetval;
+ return attribute::SdrFillTextAttribute();
}
} // end of namespace primitive2d
diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
index b0b76484526d..3757d60a3d27 100644
--- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
@@ -31,7 +31,7 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -46,7 +46,6 @@ namespace drawinglayer
Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
{
Primitive2DSequence aRetval;
- Primitive2DSequence aHitTestContent;
// create unit outline polygon
const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
@@ -55,68 +54,66 @@ namespace drawinglayer
getCornerRadiusY()));
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(getSdrLFSTAttribute().getFill().isDefault())
{
+ // create invisible fill for HitTest
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(
+ createHiddenGeometryPrimitives2D(
+ true,
basegfx::B2DPolyPolygon(aUnitOutline),
- getTransform(),
- *getSdrLFSTAttribute().getFill(),
- getSdrLFSTAttribute().getFillFloatTransGradient()));
+ getTransform()));
}
else
{
- // if no fill, create one for HitTest and BoundRect fallback
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolyPolygonFillPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)),
+ getSdrLFSTAttribute().getFill(),
getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
+ // create invisible line for HitTest/BoundRect
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolygonLinePrimitive(
- aUnitOutline,
- getTransform(),
- *getSdrLFSTAttribute().getLine()));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolygonLinePrimitive(
- getTail(),
- getTransform(),
- *getSdrLFSTAttribute().getLine(),
- getSdrLFSTAttribute().getLineStartEnd()));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getTail()),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect. It
- // is sufficient to use the tail; the body is already ensured with fill creation
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolygonLinePrimitive(
- getTail(),
+ aUnitOutline,
getTransform(),
- attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0))));
- }
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
- // add HitTest and BoundRect helper geometry (if exists)
- if(aHitTestContent.hasElements())
- {
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- Primitive2DReference(new HitTestPrimitive2D(aHitTestContent)));
+ createPolygonLinePrimitive(
+ getTail(),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createTextPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- *getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getText(),
getSdrLFSTAttribute().getLine(),
false,
false,
@@ -124,9 +121,9 @@ namespace drawinglayer
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
index ec2033a702d1..6b52837c3eca 100644
--- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
@@ -31,7 +31,8 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -47,34 +48,45 @@ namespace drawinglayer
{
Primitive2DSequence aRetval;
- // prepare unit transform
- ::basegfx::B2DHomMatrix aEmptyMatrix;
-
// add line
- if(getSdrLSTAttribute().getLine())
+ if(getSdrLSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getUnitPolygon())));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ getUnitPolygon(),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getLine(),
+ getSdrLSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLSTAttribute().getText())
+ if(!getSdrLSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(getUnitPolygon()),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getText(),
+ getSdrLSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLSTAttribute().getShadow())
+ if(!getSdrLSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
index d4182bc0ab24..710beeb444f2 100644
--- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -32,6 +32,7 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -48,21 +49,23 @@ namespace drawinglayer
Primitive2DSequence aRetval(getSubPrimitives());
// add text
- if(getSdrSTAttribute().getText())
+ if(!getSdrSTAttribute().getText().isDefault())
{
- const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(
- basegfx::B2DPolyPolygon(aUnitOutline),
- getTextBox(),
- *getSdrSTAttribute().getText(),
- 0,
- false,
- getWordWrap(),
- isForceTextClipToTextRange()));
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTextBox(),
+ getSdrSTAttribute().getText(),
+ attribute::SdrLineAttribute(),
+ false,
+ getWordWrap(),
+ isForceTextClipToTextRange()));
}
// add shadow
- if(aRetval.hasElements() && getSdrSTAttribute().getShadow())
+ if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault())
{
// #i105323# add generic shadow only for 2D shapes. For
// 3D shapes shadow will be set at the individual created
@@ -76,7 +79,7 @@ namespace drawinglayer
// shadow will be correct (using ColorModifierStack), but expensive.
if(!get3DShape())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow());
}
}
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index c274289c09e3..76e6d81bb252 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -27,12 +27,10 @@
#include "precompiled_svx.hxx"
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
#include <drawinglayer/attribute/strokeattribute.hxx>
@@ -51,6 +49,10 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -66,25 +68,25 @@ namespace drawinglayer
const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrFillAttribute& rFill,
- const attribute::FillGradientAttribute* pFillGradient)
+ const attribute::FillGradientAttribute& rFillGradient)
{
// prepare fully scaled polygon
basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
aScaledPolyPolygon.transform(rObjectTransform);
BasePrimitive2D* pNewFillPrimitive = 0;
- if(rFill.isGradient())
+ if(!rFill.getGradient().isDefault())
{
- pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient());
+ pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient());
}
- else if(rFill.isHatch())
+ else if(!rFill.getHatch().isDefault())
{
- pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch());
+ pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch());
}
- else if(rFill.isBitmap())
+ else if(!rFill.getBitmap().isDefault())
{
const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
- pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange));
+ pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange));
}
else
{
@@ -96,9 +98,9 @@ namespace drawinglayer
// create simpleTransparencePrimitive, add created fill primitive
const Primitive2DReference xRefA(pNewFillPrimitive);
const Primitive2DSequence aContent(&xRefA, 1L);
- return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence()));
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence()));
}
- else if(pFillGradient)
+ else if(!rFillGradient.isDefault())
{
// create sequence with created fill primitive
const Primitive2DReference xRefA(pNewFillPrimitive);
@@ -107,11 +109,11 @@ namespace drawinglayer
// create FillGradientPrimitive2D for transparence and add to new sequence
// fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways
const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
- const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient));
+ const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient));
const Primitive2DSequence aAlpha(&xRefB, 1L);
- // create AlphaPrimitive2D using alpha and content
- return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha));
+ // create TransparencePrimitive2D using alpha and content
+ return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha));
}
else
{
@@ -124,7 +126,7 @@ namespace drawinglayer
const basegfx::B2DPolygon& rUnitPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrLineAttribute& rLine,
- const attribute::SdrLineStartEndAttribute* pStroke)
+ const attribute::SdrLineStartEndAttribute& rStroke)
{
// prepare fully scaled polygon
basegfx::B2DPolygon aScaledPolygon(rUnitPolygon);
@@ -135,10 +137,10 @@ namespace drawinglayer
const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen());
BasePrimitive2D* pNewLinePrimitive = 0L;
- if(!rUnitPolygon.isClosed() && pStroke)
+ if(!rUnitPolygon.isClosed() && !rStroke.isDefault())
{
- attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered());
- attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered());
+ attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered());
+ attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered());
// create data
pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd);
@@ -154,7 +156,7 @@ namespace drawinglayer
// create simpleTransparencePrimitive, add created fill primitive
const Primitive2DReference xRefA(pNewLinePrimitive);
const Primitive2DSequence aContent(&xRefA, 1L);
- return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence()));
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence()));
}
else
{
@@ -167,7 +169,7 @@ namespace drawinglayer
const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrTextAttribute& rText,
- const attribute::SdrLineAttribute* pStroke,
+ const attribute::SdrLineAttribute& rStroke,
bool bCellText,
bool bWordWrap,
bool bClipOnBounds)
@@ -178,7 +180,7 @@ namespace drawinglayer
if(rText.isContour())
{
// contour text
- if(pStroke && 0.0 != pStroke->getWidth())
+ if(!rStroke.isDefault() && 0.0 != rStroke.getWidth())
{
// take line width into account and shrink contour polygon accordingly
// decompose to get scale
@@ -193,7 +195,7 @@ namespace drawinglayer
fabs(aScale.getX()), fabs(aScale.getY())));
// grow the polygon. To shrink, use negative value (half width)
- aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5));
+ aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5));
// scale back to unit polygon
aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(
@@ -217,7 +219,7 @@ namespace drawinglayer
rObjectTransform);
}
}
- else if(rText.getSdrFormTextAttribute())
+ else if(!rText.getSdrFormTextAttribute().isDefault())
{
// text on path, use scaled polygon
basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
@@ -226,7 +228,7 @@ namespace drawinglayer
&rText.getSdrText(),
rText.getOutlinerParaObject(),
aScaledPolyPolygon,
- *rText.getSdrFormTextAttribute());
+ rText.getSdrFormTextAttribute());
}
else
{
@@ -323,7 +325,7 @@ namespace drawinglayer
if(rText.isScroll())
{
// suppress scroll when FontWork
- if(!rText.getSdrFormTextAttribute())
+ if(rText.getSdrFormTextAttribute().isDefault())
{
// get scroll direction
const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection());
@@ -464,7 +466,7 @@ namespace drawinglayer
const Primitive2DSequence aTempContent(&aRetval[0], 1);
aRetval[0] = Primitive2DReference(
- new UnifiedAlphaPrimitive2D(
+ new UnifiedTransparencePrimitive2D(
aTempContent,
rShadow.getTransparence()));
}
diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
index 243c55b3a0b3..02de307bee77 100644
--- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
@@ -32,10 +32,9 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <basegfx/color/bcolor.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -55,52 +54,73 @@ namespace drawinglayer
// Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation.
// This is needed to have the same look when stroke is used since the polygon start point defines the
// stroke start, too.
- ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1));
// scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
- const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
// apply to the geometry
aUnitOutline.transform(aUnitCorrectionMatrix);
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(!getSdrLFSTAttribute().getFill().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
}
SdrEllipsePrimitive2D::SdrEllipsePrimitive2D(
- const ::basegfx::B2DHomMatrix& rTransform,
+ const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
@@ -138,7 +158,7 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle));
if(mbCloseSegment)
{
@@ -146,57 +166,77 @@ namespace drawinglayer
{
// for compatibility, insert the center point at polygon start to get the same
// line stroking pattern as the old painting mechanisms.
- aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0));
+ aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0));
}
aUnitOutline.setClosed(true);
}
// move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
- basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0));
- aUnitCorrectionMatrix.scale(0.5, 0.5);
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
// apply to the geometry
aUnitOutline.transform(aUnitCorrectionMatrix);
// add fill
- if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed())
+ if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
}
SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D(
- const ::basegfx::B2DHomMatrix& rTransform,
+ const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
double fStartAngle,
double fEndAngle,
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index 77957c809890..e981af91896b 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -32,7 +32,8 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -45,21 +46,25 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
// add fill, but only when graphic ist transparent
- if(getSdrLFSTAttribute().getFill() && isTransparent())
+ if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(!getSdrLFSTAttribute().getLine().isDefault())
{
// if line width is given, polygon needs to be grown by half of it to make the
// outline to be outside of the bitmap
- if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
{
// decompose to get scale
basegfx::B2DVector aScale, aTranslate;
@@ -67,46 +72,61 @@ namespace drawinglayer
getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
// create expanded range (add relative half line width to unit rectangle)
- double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline, getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
}
- else
- {
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
- }
// add graphic content
if(255L != getGraphicAttr().GetTransparency())
{
- Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr()));
+ const Primitive2DReference xGraphicContentPrimitive(
+ new GraphicPrimitive2D(
+ getTransform(),
+ getGraphicObject(),
+ getGraphicAttr()));
+
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive);
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 40c116271a85..e4403cd6df49 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -35,8 +35,8 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -56,36 +56,44 @@ namespace drawinglayer
bool bLeftActive,
bool bRightActive) const
{
- const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
basegfx::B2DPolygon aPolygon;
aPolygon.append(rStart);
aPolygon.append(rEnd);
- if(!pLineStartEnd || (!bLeftActive && !bRightActive))
+ if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive))
{
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0);
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ attribute::SdrLineStartEndAttribute());
}
if(bLeftActive && bRightActive)
{
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd);
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ rLineStartEnd);
}
const basegfx::B2DPolyPolygon aEmpty;
const attribute::SdrLineStartEndAttribute aLineStartEnd(
- bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty,
- bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0,
- bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false,
- bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false);
+ bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty,
+ bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0,
+ bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false,
+ bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false);
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd);
+ return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd);
}
Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- SdrBlockTextPrimitive2D* pBlockText = 0L;
+ SdrBlockTextPrimitive2D* pBlockText = 0;
basegfx::B2DRange aTextRange;
double fTextX((getStart().getX() + getEnd().getX()) * 0.5);
double fTextY((getStart().getX() + getEnd().getX()) * 0.5);
@@ -93,11 +101,13 @@ namespace drawinglayer
const double fDistance(aLine.getLength());
const double fAngle(atan2(aLine.getY(), aLine.getX()));
bool bAutoUpsideDown(false);
- const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText();
+ const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText();
const basegfx::B2DHomMatrix aObjectMatrix(
basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart()));
- if(pTextAttribute)
+ // preapare text, but do not add yet; it needs to be aligned to
+ // the line geometry
+ if(!rTextAttribute.isDefault())
{
basegfx::B2DHomMatrix aTextMatrix;
double fTestAngle(fAngle);
@@ -123,58 +133,52 @@ namespace drawinglayer
// create primitive and get text range
pBlockText = new SdrBlockTextPrimitive2D(
- &pTextAttribute->getSdrText(),
- pTextAttribute->getOutlinerParaObject(),
+ &rTextAttribute.getSdrText(),
+ rTextAttribute.getOutlinerParaObject(),
aTextMatrix,
SDRTEXTHORZADJUST_CENTER,
SDRTEXTVERTADJUST_CENTER,
- pTextAttribute->isScroll(),
+ rTextAttribute.isScroll(),
false,
false,
false,
false);
+
aTextRange = pBlockText->getB2DRange(aViewInformation);
}
// prepare line attribute and result
- const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine());
-
- if(!pLineAttribute)
- {
- // if initially no line is defined, create one for HitTest and BoundRect
- pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0));
- }
-
{
+ const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine());
bool bArrowsOutside(false);
bool bMainLineSplitted(false);
- const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
double fStartArrowW(0.0);
double fStartArrowH(0.0);
double fEndArrowW(0.0);
double fEndArrowH(0.0);
- if(pLineStartEnd)
+ if(!rLineStartEnd.isDefault())
{
- if(pLineStartEnd->isStartActive())
+ if(rLineStartEnd.isStartActive())
{
- const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon()));
- fStartArrowW = pLineStartEnd->getStartWidth();
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon()));
+ fStartArrowW = rLineStartEnd.getStartWidth();
fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth();
- if(pLineStartEnd->isStartCentered())
+ if(rLineStartEnd.isStartCentered())
{
fStartArrowH *= 0.5;
}
}
- if(pLineStartEnd->isEndActive())
+ if(rLineStartEnd.isEndActive())
{
- const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon()));
- fEndArrowW = pLineStartEnd->getEndWidth();
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon()));
+ fEndArrowW = rLineStartEnd.getEndWidth();
fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth();
- if(pLineStartEnd->isEndCentered())
+ if(rLineStartEnd.isEndCentered())
{
fEndArrowH *= 0.5;
}
@@ -183,7 +187,7 @@ namespace drawinglayer
const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5));
const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5);
- const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5);
+ const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5);
if(fSpaceNeededByArrows > fDistance)
{
@@ -275,12 +279,12 @@ namespace drawinglayer
const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY());
const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY());
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false));
if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal)
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false));
}
}
else
@@ -291,12 +295,12 @@ namespace drawinglayer
const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY());
const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY());
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true));
}
}
@@ -309,13 +313,13 @@ namespace drawinglayer
const basegfx::B2DPoint aLeftUp(0.0, fTopEdge);
const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft);
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false));
// right help line
const basegfx::B2DPoint aRightUp(fDistance, fTopEdge);
const basegfx::B2DPoint aRightDown(fDistance, fBottomRight);
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false));
// text horizontal position
if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal)
@@ -329,9 +333,9 @@ namespace drawinglayer
fTextX -= (fArrowsOutsideLen - fStartArrowH);
}
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX -= pTextAttribute->getTextRightDistance();
+ fTextX -= rTextAttribute.getTextRightDistance();
}
}
else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal)
@@ -345,9 +349,9 @@ namespace drawinglayer
fTextX += (fArrowsOutsideLen - fEndArrowH);
}
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX += pTextAttribute->getTextLeftDistance();
+ fTextX += rTextAttribute.getTextLeftDistance();
}
}
else // MEASURETEXTPOSITION_CENTERED
@@ -355,9 +359,9 @@ namespace drawinglayer
// centered
fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L;
+ fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L;
}
}
@@ -368,9 +372,9 @@ namespace drawinglayer
const double fSmall(fArrowsOutsideLen * 0.10);
fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY -= pTextAttribute->getTextLowerDistance();
+ fTextY -= rTextAttribute.getTextLowerDistance();
}
}
else if(MEASURETEXTPOSITION_POSITIVE == eVertical)
@@ -379,9 +383,9 @@ namespace drawinglayer
const double fSmall(fArrowsOutsideLen * 0.10);
fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY += pTextAttribute->getTextUpperDistance();
+ fTextY += rTextAttribute.getTextUpperDistance();
}
}
else // MEASURETEXTPOSITION_CENTERED
@@ -389,21 +393,19 @@ namespace drawinglayer
// centered
fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L;
+ fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L;
}
}
}
- if(!getSdrLSTAttribute().getLine())
+ if(getSdrLSTAttribute().getLine().isDefault())
{
- // embed line geometry to invisible line group
- const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval));
- aRetval = Primitive2DSequence(&xHiddenLines, 1);
+ // embed line geometry to invisible (100% transparent) line group for HitTest
+ const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval));
- // delete temporary LineAttribute again
- delete pLineAttribute;
+ aRetval = Primitive2DSequence(&xHiddenLines, 1);
}
if(pBlockText)
@@ -433,9 +435,11 @@ namespace drawinglayer
}
// add shadow
- if(getSdrLSTAttribute().getShadow())
+ if(!getSdrLSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
index b99486669e93..43e3cf72ffbb 100644
--- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -30,7 +30,8 @@
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -59,7 +60,13 @@ namespace drawinglayer
{
const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive;
- if(getOLEContent() == rCompare.getOLEContent()
+ // #i108636# The standard operator== on two UNO sequences did not work as i
+ // would have expected; it just checks the .is() states and the data type
+ // of the sequence. What i need here is detection of equality of the whole
+ // sequence content, thus i need to use the arePrimitive2DSequencesEqual helper
+ // here instead of the operator== which lead to always returning false and thus
+ // always re-decompositions of the subcontent.
+ if(arePrimitive2DSequencesEqual(getOLEContent(), rCompare.getOLEContent())
&& getTransform() == rCompare.getTransform()
&& getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute())
{
@@ -80,23 +87,29 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
// add fill
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getFill().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
// #i97981# condition was inverse to purpose. When being compatible to paint version,
// border needs to be suppressed
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getLine().isDefault())
{
// if line width is given, polygon needs to be grown by half of it to make the
// outline to be outside of the bitmap
- if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
{
// decompose to get scale
basegfx::B2DVector aScale, aTranslate;
@@ -104,27 +117,37 @@ namespace drawinglayer
getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
// create expanded range (add relative half line width to unit rectangle)
- double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
}
else
{
// if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
// add graphic content
@@ -132,15 +155,26 @@ namespace drawinglayer
// add text, no need to supress to stay compatible since text was
// always supported by the old paints, too
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
index 0254d84a5ae0..70c1feda75a8 100644
--- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -134,7 +134,7 @@ namespace drawinglayer
if(aColor.bIsVisible)
{
- basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
const Color aVclColor(aColor.nColor);
aOutline.transform(getObjectTransform());
const drawinglayer::primitive2d::Primitive2DReference xOutline(
diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
index 73db4cffe352..ac9b6307dd05 100644
--- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
@@ -31,7 +31,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -48,50 +48,67 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// add fill
- if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed())
+ if(!getSdrLFSTAttribute().getFill().isDefault()
+ && getUnitPolyPolygon().isClosed())
{
// take care for orientations
- basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon()));
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(
+ basegfx::tools::correctOrientations(getUnitPolyPolygon()));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ aOrientedUnitPolyPolygon,
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- Primitive2DSequence aTemp(getUnitPolyPolygon().count());
-
- for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++)
- {
- aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd());
- }
-
- appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
+ // if initially no line is defined, create one for HitTest and BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ getUnitPolyPolygon(),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count());
+ Primitive2DSequence aTemp(getUnitPolyPolygon().count());
for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
{
- xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline);
+ aTemp[a] = createPolygonLinePrimitive(
+ getUnitPolyPolygon().getB2DPolygon(a),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd());
}
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ getUnitPolyPolygon(),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
index 8473ba14d6f4..8f188e9fcf6f 100644
--- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
+++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
@@ -29,10 +29,6 @@
#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
#include <vcl/bmpacc.hxx>
#include <osl/mutex.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <vcl/lazydelete.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -173,19 +169,6 @@ namespace drawinglayer
return aRetVal.get() ? *aRetVal.get() : BitmapEx();
}
- // #i99123#
- Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix)
- {
- // create PolygonHairlinePrimitive2D
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- aUnitOutline.transform(rMatrix);
- const basegfx::BColor aBlack(0.0, 0.0, 0.0);
- const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack));
-
- // create HitTestPrimitive2D with it
- const Primitive2DSequence xSequence(&xReference, 1);
- return Primitive2DReference(new HitTestPrimitive2D(xSequence));
- }
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
index 6a0293f2ace3..60b8ca1c7817 100644
--- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -31,7 +31,8 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -46,7 +47,6 @@ namespace drawinglayer
Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
{
Primitive2DSequence aRetval;
- Primitive2DSequence aHitTestContent;
// create unit outline polygon
const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
@@ -55,64 +55,67 @@ namespace drawinglayer
getCornerRadiusY()));
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(!getSdrLFSTAttribute().getFill().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolyPolygonFillPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- *getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFill(),
getSdrLFSTAttribute().getFillFloatTransGradient()));
}
else if(getForceFillForHitTest())
{
// if no fill and it's a text frame, create a fill for HitTest and
// BoundRect fallback
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
- createPolyPolygonFillPrimitive(
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ true,
basegfx::B2DPolyPolygon(aUnitOutline),
- getTransform(),
- attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)),
- getSdrLFSTAttribute().getFillFloatTransGradient()));
+ getTransform()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(!getSdrLFSTAttribute().getLine().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolygonLinePrimitive(
aUnitOutline,
getTransform(),
- *getSdrLFSTAttribute().getLine()));
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else if(!getForceFillForHitTest())
{
// if initially no line is defined and it's not a text frame, create
// a line for HitTest and BoundRect
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
- createPolygonLinePrimitive(
- aUnitOutline,
- getTransform(),
- attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0))));
- }
-
- // add HitTest and BoundRect helper geometry (if exists)
- if(aHitTestContent.hasElements())
- {
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- Primitive2DReference(new HitTestPrimitive2D(aHitTestContent)));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
index db9f957280ef..3a15c3a392d9 100644
--- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
+++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
@@ -30,8 +30,11 @@
#include <svl/itemset.hxx>
#include <com/sun/star/drawing/NormalsKind.hpp>
#include <com/sun/star/drawing/TextureProjectionMode.hpp>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
+#include <com/sun/star/drawing/TextureKind2.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
#include <svx/xflclit.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 138505cadf61..15142a86b9cf 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -584,22 +584,6 @@ namespace sdr
bHintUsed = sal_True;
}
- // #111111#
- // When it's the BackgroundObject, set the MasterPage to changed to
- // get a refresh for the evtl. changed BackgroundStyle
-
- // #114265#
- // To only invalidate the page when the StyleSheet change happens,
- // some more rigid testing is necessary.
- const SfxSimpleHint *pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
-
- if(pSimpleHint
- && pSimpleHint->GetId() == SFX_HINT_DATACHANGED
- && GetSdrObject().IsMasterPageBackgroundObject())
- {
- GetSdrObject().GetPage()->ActionChanged();
- }
-
if(!bHintUsed)
{
// forward to SdrObject ATM. Not sure if this will be necessary
diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk
index 2ab52e18aec1..5296765769b1 100644
--- a/svx/source/sdr/properties/makefile.mk
+++ b/svx/source/sdr/properties/makefile.mk
@@ -47,6 +47,7 @@ SLOFILES=\
$(SLO)$/textproperties.obj \
$(SLO)$/customshapeproperties.obj \
$(SLO)$/rectangleproperties.obj \
+ $(SLO)$/oleproperties.obj \
$(SLO)$/captionproperties.obj \
$(SLO)$/circleproperties.obj \
$(SLO)$/connectorproperties.obj \
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
new file mode 100644
index 000000000000..b2a103bd8cfc
--- /dev/null
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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: graphicproperties.cxx,v $
+ * $Revision: 1.12.76.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/properties/oleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ OleProperties::OleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ OleProperties::~OleProperties()
+ {
+ }
+
+ BaseProperties& OleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new OleProperties(*this, rObj));
+ }
+
+ void OleProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ // #i108221#
+ mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
+ mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof