Author: alg
Date: Wed Aug 22 14:17:43 2012
New Revision: 1376067

URL: http://svn.apache.org/viewvc?rev=1376067&view=rev
Log:
#120569# Corrected 3D object creations

Modified:
    incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx

Modified: 
incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx?rev=1376067&r1=1376066&r2=1376067&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx 
(original)
+++ incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx 
Wed Aug 22 14:17:43 2012
@@ -393,7 +393,9 @@ SdrObject* EnhancedCustomShape3d::Create
                }
 
                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();
@@ -405,20 +407,35 @@ SdrObject* EnhancedCustomShape3d::Create
 
                        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());
+                const SfxItemSet& rSet = pNext->GetMergedItemSet();
+                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;
+                            }
+                        }
                     }
                 }
 
@@ -434,12 +451,23 @@ SdrObject* EnhancedCustomShape3d::Create
                         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
                         {


Reply via email to