You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/08/15 12:58:10 UTC
svn commit: r1373329 - in /incubator/ooo/trunk/main/svx:
inc/svx/sdr/primitive2d/sdrattributecreator.hxx
source/customshapes/EnhancedCustomShape3d.cxx
Author: alg
Date: Wed Aug 15 10:58:09 2012
New Revision: 1373329
URL: http://svn.apache.org/viewvc?rev=1373329&view=rev
Log:
#120569# Enhanced 3D visualisation of line custom shapes
Modified:
incubator/ooo/trunk/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx
Modified: incubator/ooo/trunk/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx?rev=1373329&r1=1373328&r2=1373329&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx Wed Aug 15 10:58:09 2012
@@ -25,6 +25,7 @@
#define INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX
#include <sal/types.h>
+#include <svx/svxdllapi.h>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -59,10 +60,10 @@ namespace drawinglayer
namespace primitive2d
{
// SdrAttribute creators
- attribute::SdrLineAttribute createNewSdrLineAttribute(
+ attribute::SdrLineAttribute SVX_DLLPUBLIC createNewSdrLineAttribute(
const SfxItemSet& rSet);
- attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+ attribute::SdrLineStartEndAttribute SVX_DLLPUBLIC createNewSdrLineStartEndAttribute(
const SfxItemSet& rSet,
double fWidth);
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=1373329&r1=1373328&r2=1373329&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShape3d.cxx Wed Aug 15 10:58:09 2012
@@ -56,6 +56,12 @@
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drange.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
using namespace com::sun::star;
@@ -394,15 +400,61 @@ SdrObject* EnhancedCustomShape3d::Create
sal_Bool bIsPlaceholderObject = (((XFillStyleItem&)pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() == XFILL_NONE )
&& (((XLineStyleItem&)pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue() == XLINE_NONE );
basegfx::B2DPolyPolygon aPolyPoly;
+ SfxItemSet aLocalSet(aSet);
+ XFillStyle aLocalFillStyle(eFillStyle);
if ( pNext->ISA( SdrPathObj ) )
{
- aPolyPoly = ((SdrPathObj*)pNext)->GetPathPoly();
+ const SfxItemSet& rSet = pNext->GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineAttribute aLine(
+ drawinglayer::primitive2d::createNewSdrLineAttribute(rSet));
+ bool 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(aPolyPoly.areControlPointsUsed())
- {
- aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly);
- }
+ if((aLineStartEnd.getStartWidth() && aLineStartEnd.isStartActive())
+ || (aLineStartEnd.getEndWidth() && aLineStartEnd.isEndActive()))
+ {
+ bNeedToConvertToContour = true;
+ }
+ }
+
+ if(bNeedToConvertToContour)
+ {
+ SdrObject* pNewObj = pNext->ConvertToContourObj(const_cast< SdrObject* >(pNext));
+ SdrPathObj* pNewPathObj = dynamic_cast< SdrPathObj* >(pNewObj);
+
+ if(pNewPathObj)
+ {
+ aPolyPoly = pNewPathObj->GetPathPoly();
+
+ 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;
+ }
+ else
+ {
+ // correct item properties to hairlines
+ aLocalSet.Put(XLineWidthItem(0));
+ aLocalSet.Put(XLineStyleItem(XLINE_SOLID));
+ }
+ }
+
+ SdrObject::Free(pNewObj);
+ }
+ else
+ {
+ aPolyPoly = ((SdrPathObj*)pNext)->GetPathPoly();
+ }
}
else
{
@@ -415,13 +467,18 @@ SdrObject* EnhancedCustomShape3d::Create
if( aPolyPoly.count() )
{
- const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
+ if(aPolyPoly.areControlPointsUsed())
+ {
+ aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly);
+ }
+
+ const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY()));
aBoundRect2d.Union( aBoundRect );
E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
- p3DObj->SetMergedItemSet( aSet );
+ p3DObj->SetMergedItemSet( aLocalSet );
if ( bIsPlaceholderObject )
aPlaceholderObjectList.push_back( p3DObj );
else if ( bUseTwoFillStyles )
@@ -465,7 +522,7 @@ SdrObject* EnhancedCustomShape3d::Create
pScene->Insert3DObj( p3DObj );
p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
- p3DObj->SetMergedItemSet( aSet );
+ p3DObj->SetMergedItemSet( aLocalSet );
if ( bUseExtrusionColor )
p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) );
p3DObj->SetMergedItem( XFillStyleItem( XFILL_SOLID ) );
@@ -474,18 +531,18 @@ SdrObject* EnhancedCustomShape3d::Create
pScene->Insert3DObj( p3DObj );
p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 10 );
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
- p3DObj->SetMergedItemSet( aSet );
+ p3DObj->SetMergedItemSet( aLocalSet );
basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetTransform() );
aFrontTransform.translate( 0.0, 0.0, fDepth );
p3DObj->NbcSetTransform( aFrontTransform );
- if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
+ if ( ( aLocalFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
{
p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
}
}
- else if ( eFillStyle == XFILL_NONE )
+ else if ( aLocalFillStyle == XFILL_NONE )
{
XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR );
p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) );