diff options
author | Armin Le Grand <alg@apache.org> | 2012-08-22 13:17:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-19 15:03:25 +0100 |
commit | 42b4dc4f8cad68ebd1386c5b8ea76ffaf59fdeb4 (patch) | |
tree | 057c7c6d35fb1960f103d890bc36eca72fb1d9a3 | |
parent | 118a8ad8c6287e7a4cc81ec46504f6cdffdf826d (diff) |
Related: #i120569# Corrected 3D object creations
(cherry picked from commit 753dd9ee0c8101ce613cdc7e1a68141e0f8561d3)
Change-Id: Ic7534a310b8d8c526b2639243c9d734e26b55560
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index a879ddc91ef0..010b037e7df5 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -372,7 +372,9 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con } Rectangle aBoundRect2d; - SdrObjListIter aIter( *pShape2d, IM_DEEPWITHGROUPS ); + SdrObjListIter aIter( *pShape2d, IM_DEEPNOGROUPS ); + const bool bMultipleSubObjects(aIter.Count() > 1); + while( aIter.IsMore() ) { const SdrObject* pNext = aIter.Next(); @@ -385,19 +387,34 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con if ( pNext->ISA( SdrPathObj ) ) { const SfxItemSet& rSet = pNext->GetMergedItemSet(); - const drawinglayer::attribute::SdrLineAttribute aLine( - drawinglayer::primitive2d::createNewSdrLineAttribute(rSet)); - bool bNeedToConvertToContour(0.0 <= aLine.getWidth() || 0.0 != aLine.getFullDotDashLen()); + bool bNeedToConvertToContour(false); - if(!bNeedToConvertToContour && !aLine.isDefault()) + // do conversion only for single line objects; for all others a fill and a + // line object get created. When we have fill, we want no line. That line has + // always been there, but since it was never converted to contour, it kept + // invisible (all this 'hidden' logic should be migrated to primitives). + if(!bMultipleSubObjects) { - const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( - drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rSet, aLine.getWidth())); + const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); - if((aLineStartEnd.getStartWidth() && aLineStartEnd.isStartActive()) - || (aLineStartEnd.getEndWidth() && aLineStartEnd.isEndActive())) + if(XFILL_NONE == eStyle) { - bNeedToConvertToContour = true; + const drawinglayer::attribute::SdrLineAttribute aLine( + drawinglayer::primitive2d::createNewSdrLineAttribute(rSet)); + + bNeedToConvertToContour = (0.0 < aLine.getWidth() || 0.0 != aLine.getFullDotDashLen()); + + if(!bNeedToConvertToContour && !aLine.isDefault()) + { + const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( + drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rSet, aLine.getWidth())); + + if((aLineStartEnd.getStartWidth() && aLineStartEnd.isStartActive()) + || (aLineStartEnd.getEndWidth() && aLineStartEnd.isEndActive())) + { + bNeedToConvertToContour = true; + } + } } } @@ -413,12 +430,23 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con if(aPolyPoly.isClosed()) { // correct item properties from line to fill style - aLocalSet.Put(XLineWidthItem(0)); - aLocalSet.Put(XLineStyleItem(XLINE_NONE)); - aLocalSet.Put(XFillColorItem(XubString(), ((const XLineColorItem&)(aLocalSet.Get(XATTR_LINECOLOR))).GetColorValue())); - aLocalSet.Put(XFillStyleItem(XFILL_SOLID)); - aLocalSet.Put(XFillTransparenceItem(((const XLineTransparenceItem&)(aLocalSet.Get(XATTR_LINETRANSPARENCE))).GetValue())); - aLocalFillStyle = XFILL_SOLID; + if(eShadeMode == drawing::ShadeMode_DRAFT) + { + // for draft, create wireframe with fixed line width + aLocalSet.Put(XLineStyleItem(XLINE_SOLID)); + aLocalSet.Put(XLineWidthItem(40)); + aLocalFillStyle = XFILL_NONE; + } + else + { + // switch from line to fill, copy line attr to fill attr (color, transparence) + aLocalSet.Put(XLineWidthItem(0)); + aLocalSet.Put(XLineStyleItem(XLINE_NONE)); + aLocalSet.Put(XFillColorItem(XubString(), ((const XLineColorItem&)(aLocalSet.Get(XATTR_LINECOLOR))).GetColorValue())); + aLocalSet.Put(XFillStyleItem(XFILL_SOLID)); + aLocalSet.Put(XFillTransparenceItem(((const XLineTransparenceItem&)(aLocalSet.Get(XATTR_LINETRANSPARENCE))).GetValue())); + aLocalFillStyle = XFILL_SOLID; + } } else { |