diff options
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 4 | ||||
-rw-r--r-- | svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 6 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 245 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.hxx | 5 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 4 | ||||
-rw-r--r-- | svx/source/msfilter/msdffimp.cxx | 19 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 14 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 16 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdfppt.cxx | 33 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 69 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 13 | ||||
-rw-r--r-- | svx/source/table/cellcursor.cxx | 17 | ||||
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 41 | ||||
-rw-r--r-- | svx/source/table/tablelayouter.cxx | 1 | ||||
-rw-r--r-- | svx/source/table/tablemodel.cxx | 14 |
17 files changed, 357 insertions, 155 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 24f54d3ddc58..1c040545eedd 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -614,13 +614,13 @@ namespace drawinglayer { const GraphicAttr& rAttr = rGraphicPrimitive.getGraphicAttr(); - if(!rAttr.IsSpecialDrawMode() && !rAttr.IsMirrored() && !rAttr.IsRotated() && !rAttr.IsAdjusted()) + if(!rAttr.IsSpecialDrawMode() && !rAttr.IsAdjusted()) { const basegfx::B2DHomMatrix& rTransform = rGraphicPrimitive.getTransform(); double fRotate, fShearX; rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - if(aScale.getX() > 0.0 && aScale.getY() > 0.0) + if( basegfx::fTools::equalZero( fRotate ) && ( aScale.getX() > 0.0 ) && ( aScale.getY() > 0.0 ) ) { bUsingPDFExtOutDevData = true; mpPDFExtOutDevData->BeginGroup(); diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index a29ecb890df6..4eddc4386a0d 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -56,6 +56,8 @@ namespace drawinglayer // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means // that the text needs to be block formatted unsigned mbWordWrap : 1; + // #SJ# Allow text clipping against TextBox in special cases (used for SC)
+ unsigned mbForceTextClipToTextRange : 1;
protected: // local decomposition. @@ -66,13 +68,15 @@ namespace drawinglayer const attribute::SdrShadowTextAttribute& rSdrSTAttribute, const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, - bool bWordWrap); + bool bWordWrap, + bool bForceTextClipToTextRange); // data access const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; } const Primitive2DSequence& getSubPrimitives() const { return maSubPrimitives; } const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; } bool getWordWrap() const { return mbWordWrap; } + bool isForceTextClipToTextRange() const { return mbForceTextClipToTextRange; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index f066cd6a4729..804db0c58a16 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -55,6 +55,12 @@ #include <svx/xlnedwit.hxx> #include <svx/xlnstcit.hxx> #include <svx/xlnedcit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xgrad.hxx> +#include <svx/xbitmap.hxx> +#include <svx/xhatch.hxx> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> #ifndef __COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPESEGMENTCOMMAND_HPP__ @@ -64,6 +70,7 @@ #include <boost/shared_ptr.hpp> #endif #include <basegfx/numeric/ftools.hxx> +#include <basegfx/color/bcolortools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> // #i76201# @@ -724,23 +731,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : /*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem ); switch( eSpType ) { - case mso_sptCan : nColorData = 0x20200000; break; - case mso_sptCube : nColorData = 0x302d0000; break; - case mso_sptActionButtonBlank : nColorData = 0x502ad400; break; - case mso_sptActionButtonHome : nColorData = 0x702ad4ad; break; - case mso_sptActionButtonHelp : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonInformation : nColorData = 0x702ad4a5; break; - case mso_sptActionButtonBackPrevious : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonForwardNext : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonBeginning : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonEnd : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonReturn : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonDocument : nColorData = 0x702ad4da; break; - case mso_sptActionButtonSound : nColorData = 0x602ad4a0; break; - case mso_sptActionButtonMovie : nColorData = 0x602ad4a0; break; - case mso_sptBevel : nColorData = 0x502ad400; break; - case mso_sptFoldedCorner : nColorData = 0x20d00000; break; - case mso_sptSmileyFace : nColorData = 0x20d00000; break; + case mso_sptCan : nColorData = 0x20400000; break;
+ case mso_sptCube : nColorData = 0x302e0000; break;
+ case mso_sptActionButtonBlank : nColorData = 0x502ce400; break;
+ case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break;
+ case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break;
+ case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break;
+ case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break;
+ case mso_sptBevel : nColorData = 0x502ce400; break;
+ case mso_sptFoldedCorner : nColorData = 0x20e00000; break;
+ case mso_sptSmileyFace : nColorData = 0x20e00000; break;
case mso_sptNil : { if( sShapeType.getLength() > 4 && @@ -754,14 +761,14 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : case mso_sptCurvedRightArrow : case mso_sptCurvedUpArrow : case mso_sptCurvedDownArrow : nColorData = 0x2d000000; break; - case mso_sptRibbon2 : nColorData = 0x30dd0000; break; - case mso_sptRibbon : nColorData = 0x30dd0000; break; + case mso_sptRibbon2 : nColorData = 0x30ee0000; break; + case mso_sptRibbon : nColorData = 0x30ee0000; break; - case mso_sptEllipseRibbon2 : nColorData = 0x30dd0000; break; - case mso_sptEllipseRibbon : nColorData = 0x30dd0000; break; + case mso_sptEllipseRibbon2 : nColorData = 0x30ee0000; break; + case mso_sptEllipseRibbon : nColorData = 0x30ee0000; break; - case mso_sptVerticalScroll : nColorData = 0x30dd0000; break; - case mso_sptHorizontalScroll : nColorData = 0x30dd0000; break; + case mso_sptVerticalScroll : nColorData = 0x30ee0000; break; + case mso_sptHorizontalScroll : nColorData = 0x30ee0000; break; default: break; } @@ -1022,41 +1029,48 @@ sal_Bool EnhancedCustomShape2d::GetParameter( double& rRetValue, const EnhancedC // nLumDat 27-24 = nLumDatEntry 0 // nLumDat 23-20 = nLumDatEntry 1 ... // each 4bit entry is to be interpreted as a 10 percent signed luminance changing -Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) +sal_Int32 EnhancedCustomShape2d::GetLuminanceChange( sal_uInt32 nIndex ) const { - Color aRetColor; + const sal_uInt32 nCount = nColorData >> 28; + if ( !nCount ) + return 0; - sal_uInt32 i, nColor, nTmp, nCount = nColorData >> 28; + if ( nIndex >= nCount ) + nIndex = nCount - 1; - if ( nCount ) + const sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 ); + return ( nLumDat >> 28 ) * 10; +} + +Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const +{ + const sal_Int32 nLuminance = GetLuminanceChange(nIndex); + if( !nLuminance ) + return rFillColor; + + basegfx::BColor aHSVColor= + basegfx::tools::rgb2hsv( + basegfx::BColor(rFillColor.GetRed()/255.0, + rFillColor.GetGreen()/255.0, + rFillColor.GetBlue()/255.0)); + if( nLuminance > 0 ) + { + aHSVColor.setGreen( + aHSVColor.getGreen() * (1.0-nLuminance/100.0)); + aHSVColor.setBlue( + nLuminance/100.0 + + (1.0-nLuminance/100.0)*aHSVColor.getBlue()); + } + else if( nLuminance < 0 ) { - if ( nIndex >= nCount ) - nIndex = nCount - 1; - - sal_uInt32 nFillColor = (sal_uInt32)rFillColor.GetRed() | - ((sal_uInt32)rFillColor.GetGreen() << 8 ) | - ((sal_uInt32)rFillColor.GetBlue() << 16 ); - - sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 ); - sal_Int32 nLuminance = ( nLumDat >> 28 ) * 12; - - nTmp = nFillColor; - nColor = 0; - for ( i = 0; i < 3; i++ ) - { - sal_Int32 nC = (sal_uInt8)nTmp; - nTmp >>= 8; - nC += ( ( nLuminance * nC ) >> 8 ); - if ( nC < 0 ) - nC = 0; - else if ( nC &~ 0xff ) - nC = 0xff; - nColor >>= 8; - nColor |= nC << 16; - } - aRetColor = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); + aHSVColor.setBlue( + (1.0+nLuminance/100.0)*aHSVColor.getBlue()); } - return aRetColor; + + aHSVColor = basegfx::tools::hsv2rgb(aHSVColor); + return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 ), + (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 ), + (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 ) ); } Rectangle EnhancedCustomShape2d::GetTextRect() const @@ -1687,6 +1701,19 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { + if( !bLineGeometryNeededOnly )
+ {
+ // hack aNewB2DPolyPolygon to fill logic rect - this is
+ // needed to produce gradient fills that look like mso
+ aNewB2DPolygon.clear();
+ aNewB2DPolygon.append(basegfx::B2DPoint(0,0));
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+
+ aNewB2DPolygon.clear();
+ aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(),
+ aLogicRect.GetHeight()));
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
// #i37011# bool bForceCreateTwoObjects(false); @@ -1856,6 +1883,78 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve } } +void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet, + sal_uInt32& nColorIndex, sal_uInt32 nColorCount) +{ + if ( !rObj.IsLine() ) + { + const XFillStyle eFillStyle = ((const XFillStyleItem&)rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue(); + switch( eFillStyle ) + { + default: + case XFILL_SOLID: + { + Color aFillColor; + if ( nColorCount ) + { + aFillColor = GetColorData( + ((XFillColorItem&)rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue(), + std::min(nColorIndex, nColorCount-1) ); + rObj.SetMergedItem( XFillColorItem( String(), aFillColor ) ); + } + break; + } + case XFILL_GRADIENT: + { + XGradient aXGradient(((const XFillGradientItem&)rObj.GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue()); + if ( nColorCount ) + { + aXGradient.SetStartColor( + GetColorData( + aXGradient.GetStartColor(), + std::min(nColorIndex, nColorCount-1) )); + aXGradient.SetEndColor( + GetColorData( + aXGradient.GetEndColor(), + std::min(nColorIndex, nColorCount-1) )); + } + + rObj.SetMergedItem( XFillGradientItem( String(), aXGradient ) ); + break; + } + case XFILL_HATCH: + { + XHatch aXHatch(((const XFillHatchItem&)rObj.GetMergedItem(XATTR_FILLHATCH)).GetHatchValue()); + if ( nColorCount ) + { + aXHatch.SetColor( + GetColorData( + aXHatch.GetColor(), + std::min(nColorIndex, nColorCount-1) )); + } + + rObj.SetMergedItem( XFillHatchItem( String(), aXHatch ) ); + break; + } + case XFILL_BITMAP: + { + Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap()); + if ( nColorCount ) + { + aBitmap.Adjust( + static_cast< short > ( GetLuminanceChange( + std::min(nColorIndex, nColorCount-1)))); + } + + rObj.SetMergedItem( XFillBitmapItem( String(), aBitmap ) ); + break; + } + } + + if ( nColorIndex < nColorCount ) + nColorIndex++; + } +} SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnly ) { @@ -1880,18 +1979,10 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl if ( vObjectList.size() ) { const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet(); - // For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here - // const sal_Bool bShadow(((SdrShadowItem&)rCustomShapeSet.Get( SDRATTR_SHADOW )).GetValue()); - Color aBasicColor( COL_WHITE ); Color aFillColor; sal_uInt32 nColorCount = nColorData >> 28; sal_uInt32 nColorIndex = 0; - if ( nColorCount ) - { - aBasicColor = ((XFillColorItem&)rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue(); - } - // #i37011# remove invisible objects if(vObjectList.size()) { @@ -1916,26 +2007,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl if(1L == vObjectList.size()) { // a single object, correct some values - SdrPathObj* pObj(vObjectList[0L]); - -// For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here -// if(bShadow) -// { -// pObj->SetMergedItem(SdrShadowItem(sal_True)); -// } - - if(!pObj->IsLine()) - { - if ( nColorIndex < nColorCount ) - { - aFillColor = GetColorData( aBasicColor, nColorIndex++ ); - } - - if ( nColorCount ) - { - pObj->SetMergedItem( XFillColorItem( String(), aFillColor ) ); - } - } + AdaptObjColor(*vObjectList[0L],rCustomShapeSet,nColorIndex,nColorCount); } else { @@ -1954,16 +2026,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl else { nAreaObjectCount++; - - if ( nColorIndex < nColorCount ) - { - aFillColor = GetColorData( aBasicColor, nColorIndex++ ); - } - - if ( nColorCount ) - { - pObj->SetMergedItem( XFillColorItem( String(), aFillColor ) ); - } + AdaptObjColor(*pObj,rCustomShapeSet,nColorIndex,nColorCount); } } diff --git a/svx/source/customshapes/EnhancedCustomShape2d.hxx b/svx/source/customshapes/EnhancedCustomShape2d.hxx index 25a537db072a..6be05a9e588d 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.hxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.hxx @@ -120,7 +120,10 @@ class EnhancedCustomShape2d : public SfxItemSet sal_Int32 nRotateAngle; sal_Bool SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex ); - Color GetColorData( const Color& rFillColor, sal_uInt32 nIndex ); + sal_Int32 GetLuminanceChange( sal_uInt32 nIndex ) const; + Color GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const; + void AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet, + sal_uInt32& nColorIndex, sal_uInt32 nColorCount); sal_Bool GetParameter( double& rParameterReturnValue, const com::sun::star::drawing::EnhancedCustomShapeParameter&, const sal_Bool bReplaceGeoWidth, const sal_Bool bReplaceGeoHeight ) const; Point GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair&, diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 426c94adcab8..abe6178cc800 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -683,7 +683,7 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW break; const Polygon& rOutlinePoly( aOutlines2d[ nOutline2dIdx++ ] ); const sal_uInt16 nPointCount = rOutlinePoly.GetSize(); - if ( nPointCount ) + if ( nPointCount > 1 ) { std::vector< double > vDistances; vDistances.reserve( nPointCount ); @@ -745,7 +745,7 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW const Polygon& rOutlinePoly2( aOutlines2d[ nOutline2dIdx++ ] ); const sal_uInt16 nPointCount = rOutlinePoly.GetSize(); const sal_uInt16 nPointCount2 = rOutlinePoly2.GetSize(); - if ( nPointCount && nPointCount2 ) + if ( ( nPointCount > 1 ) && ( nPointCount2 > 1 ) ) { std::vector< double > vDistances; vDistances.reserve( nPointCount ); diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 5830a737e790..544546149645 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -1912,12 +1912,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co XGradientStyle eGrad = XGRAD_LINEAR; sal_Int32 nChgColors = 0; - if ( !nAngle ) - nChgColors ^= 1; - - if ( !nFocus ) - nChgColors ^= 1; - else if ( nFocus < 0 ) // Bei negativem Focus sind die Farben zu tauschen + if ( nFocus < 0 ) // Bei negativem Focus sind die Farben zu tauschen { nFocus =- nFocus; nChgColors ^= 1; @@ -1925,8 +1920,8 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co if( nFocus > 40 && nFocus < 60 ) { eGrad = XGRAD_AXIAL; // Besser gehts leider nicht - nChgColors ^= 1; } + USHORT nFocusX = (USHORT)nFocus; USHORT nFocusY = (USHORT)nFocus; @@ -4955,6 +4950,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ApplyAttributes( rSt, aSet, aObjData ); pRet->SetMergedItemSet(aSet); } + else if ( aObjData.eShapeType == mso_sptLine )
+ {
+ basegfx::B2DPolygon aPoly;
+ aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top()));
+ aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom()));
+ pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly));
+ pRet->SetModel( pSdrModel );
+ ApplyAttributes( rSt, aSet, aObjData );
+ pRet->SetMergedItemSet(aSet);
+ }
else { if ( GetCustomShapeContent( aObjData.eShapeType ) || IsProperty( DFF_Prop_pVertices ) ) diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 0f4716e2d513..5f632f60ab85 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -66,10 +66,11 @@ namespace sdr // no need to correct if no extra text range if(aTextRange != aObjectRange) { + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); // only correct when rotation and/or shear is used - if(rGeoStat.nShearWink || rGeoStat.nDrehWink) + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) { // text range needs to be corrected by // aObjectRange.getCenter() - aRotObjectRange.getCenter() since it's @@ -93,6 +94,11 @@ namespace sdr aRotMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); } + if(!basegfx::fTools::equalZero(fExtraTextRotation)) + { + aRotMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + } + aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); aRotObjectRange.transform(aRotMatrix); @@ -210,7 +216,11 @@ namespace sdr // create primitive const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, xGroup, aTextBoxMatrix, bWordWrap)); + *pAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + false)); // #SJ# New parameter to force to clipped BlockText for SC xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index c8847624bcdd..497266433d67 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -56,7 +56,12 @@ namespace drawinglayer { 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())); + basegfx::B2DPolyPolygon(aUnitOutline), + getTextBox(), + *getSdrSTAttribute().getText(), + 0, + isForceTextClipToTextRange(), // #SJ# use CellText mode; text upper-left + getWordWrap())); } // add shadow @@ -72,12 +77,14 @@ namespace drawinglayer const attribute::SdrShadowTextAttribute& rSdrSTAttribute, const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, - bool bWordWrap) + bool bWordWrap, + bool bForceTextClipToTextRange) : BasePrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), - mbWordWrap(bWordWrap) + mbWordWrap(bWordWrap), + mbForceTextClipToTextRange(bForceTextClipToTextRange) { } @@ -90,7 +97,8 @@ namespace drawinglayer return (getSdrSTAttribute() == rCompare.getSdrSTAttribute() && getSubPrimitives() == rCompare.getSubPrimitives() && getTextBox() == rCompare.getTextBox() - && getWordWrap() == rCompare.getWordWrap()); + && getWordWrap() == rCompare.getWordWrap() + && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange()); } return false; diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 8b893788363a..b95c13864776 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -937,7 +937,12 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO const bool bUndo = IsUndoEnabled(); if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj)); + + if( IsObjMarked( pOldObj ) ) + MarkObj( pOldObj, &rPV, TRUE /*unmark!*/ ); + pOL->ReplaceObject(pNewObj,pOldObj->GetOrdNum()); + if( !bUndo ) SdrObject::Free( pOldObj ); diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index e12ed76d52ce..94d1ae4b4e70 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -7601,6 +7601,11 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab CreateTableRows( xColumnRowRange->getRows(), aRows, pGroup->GetSnapRect().Bottom() ); CreateTableColumns( xColumnRowRange->getColumns(), aColumns, pGroup->GetSnapRect().Right() ); + sal_Int32 nCellCount = aRows.size() * aColumns.size(); + sal_Int32 *pMergedCellIndexTable = new sal_Int32[ nCellCount ]; + for ( sal_Int32 i = 0; i < nCellCount; i++ ) + pMergedCellIndexTable[ i ] = i; + aGroupIter.Reset(); while( aGroupIter.IsMore() ) { @@ -7621,7 +7626,16 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab ApplyCellAttributes( pObj, xCell ); if ( ( nRowCount > 1 ) || ( nColumnCount > 1 ) ) // cell merging + { MergeCells( xTable, nColumn, nRow, nColumnCount, nRowCount ); + for ( sal_Int32 nRowIter = 0; nRowIter < nRowCount; nRowIter++ ) + { + for ( sal_Int32 nColumnIter = 0; nColumnIter < nColumnCount; nColumnIter++ ) + { // now set the correct index for the merged cell + pMergedCellIndexTable[ ( ( nRow + nRowIter ) * aColumns.size() ) + nColumn + nColumnIter ] = nTableIndex; + } + } + } // applying text OutlinerParaObject* pParaObject = pObj->GetOutlinerParaObject(); @@ -7633,13 +7647,30 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab } } } - else + } + aGroupIter.Reset(); + while( aGroupIter.IsMore() ) + { + SdrObject* pObj( aGroupIter.Next() ); + if ( IsLine( pObj ) ) { std::vector< sal_Int32 > vPositions; // containing cell indexes + cell position GetLinePositions( pObj, aRows, aColumns, vPositions, pGroup->GetSnapRect() ); + + // correcting merged cell position + std::vector< sal_Int32 >::iterator aIter( vPositions.begin() ); + while( aIter != vPositions.end() ) + { + sal_Int32 nOldPosition = *aIter & 0xffff; + sal_Int32 nOldFlags = *aIter & 0xffff0000; + sal_Int32 nNewPosition = pMergedCellIndexTable[ nOldPosition ] | nOldFlags; + *aIter++ = nNewPosition; + } ApplyCellLineAttributes( pObj, xTable, vPositions, aColumns.size() ); } } + delete[] pMergedCellIndexTable; + // we are replacing the whole group object by a single table object, so // possibly connections to the group object have to be removed. if ( pSolverContainer ) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 7273bb49889a..f80b14503914 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -208,6 +208,12 @@ void __EXPORT SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) bMarkedObjRectDirty=TRUE; bMarkedPointsRectsDirty=TRUE; } +/* removed for now since this breaks existing code who iterates over the mark list and sequentially replaces objects + if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast<SdrObject*>(pSdrHint->GetObject()) ) )
+ {
+ MarkObj( const_cast<SdrObject*>(pSdrHint->GetObject()), GetSdrPageView(), TRUE );
+ } +*/ } SdrSnapView::Notify(rBC,rHint); } diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 76c29de8d480..8ce4390ad6ac 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -119,6 +119,12 @@ namespace // the visible area for contour text decomposition basegfx::B2DVector maScale; + // #SJ# ClipRange for BlockText decomposition; only text portions completely
+ // inside are to be accepted, so this is different from geometric clipping
+ // (which would allow e.g. upper parts of portions to remain). Only used for
+ // BlockText (see there)
+ basegfx::B2DRange maClipRange; + DECL_LINK(decomposeContourTextPrimitive, DrawPortionInfo* ); DECL_LINK(decomposeBlockTextPrimitive, DrawPortionInfo* ); DECL_LINK(decomposeStretchTextPrimitive, DrawPortionInfo* ); @@ -137,7 +143,14 @@ namespace public: impTextBreakupHandler(SdrOutliner& rOutliner) - : mrOutliner(rOutliner) + : maTextPortionPrimitives(), + maLinePrimitives(),
+ maParagraphPrimitives(),
+ mrOutliner(rOutliner),
+ maNewTransformA(),
+ maNewTransformB(),
+ maScale(),
+ maClipRange() { } @@ -153,10 +166,14 @@ namespace mrOutliner.SetDrawBulletHdl(Link()); } - void decomposeBlockTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB) + void decomposeBlockTextPrimitive( + const basegfx::B2DHomMatrix& rNewTransformA, + const basegfx::B2DHomMatrix& rNewTransformB, + const basegfx::B2DRange& rClipRange) { maNewTransformA = rNewTransformA; maNewTransformB = rNewTransformB; + maClipRange = rClipRange; mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeBlockTextPrimitive)); mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeBlockBulletPrimitive)); mrOutliner.StripPortions(); @@ -588,6 +605,43 @@ namespace { if(pInfo) { + // #SJ# Is clipping wanted? This is text clipping; only accept a portion
+ // if it's completely in the range
+ if(!maClipRange.isEmpty())
+ {
+ // Test start position first; this allows to not get the text range at
+ // all if text is far outside
+ const basegfx::B2DPoint aStartPosition(pInfo->mrStartPos.X(), pInfo->mrStartPos.Y());
+
+ if(!maClipRange.isInside(aStartPosition))
+ {
+ return 0;
+ }
+
+ // Start position is inside. Get TextBoundRect and TopLeft next
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
+ aTextLayouterDevice.setFont(pInfo->mrFont);
+
+ const basegfx::B2DRange aTextBoundRect(
+ aTextLayouterDevice.getTextBoundRect(
+ pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextLen));
+ const basegfx::B2DPoint aTopLeft(aTextBoundRect.getMinimum() + aStartPosition);
+
+ if(!maClipRange.isInside(aTopLeft))
+ {
+ return 0;
+ }
+
+ // TopLeft is inside. Get BottomRight and check
+ const basegfx::B2DPoint aBottomRight(aTextBoundRect.getMaximum() + aStartPosition);
+
+ if(!maClipRange.isInside(aBottomRight))
+ {
+ return 0;
+ }
+
+ // all inside, clip was successful
+ }
impHandleDrawPortionInfo(*pInfo); } @@ -903,9 +957,18 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( aNewTransformB.rotate(fRotate); aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + // #SJ# create ClipRange (if needed)
+ basegfx::B2DRange aClipRange;
+
+ if(bIsCell)
+ {
+ aClipRange.expand(basegfx::B2DTuple(0.0, 0.0));
+ aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()));
+ } + // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); - aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB); + aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB, aClipRange); // cleanup outliner rOutliner.Clear(); diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 46268a68ca02..42034f2bd0cb 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -278,19 +278,6 @@ namespace sdr void CellProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) { TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); - - if( bDontRemoveHardAttr && pNewStyleSheet ) - { - GetObjectItemSet(); - - const SfxItemSet& rStyleAttribs = pNewStyleSheet->GetItemSet(); - - for ( USHORT nWhich = SDRATTR_START; nWhich <= SDRATTR_TABLE_LAST; nWhich++ ) - { - if ( rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON ) - mpItemSet->ClearItem( nWhich ); - } - } } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx index 681546b9ebd9..f3b33a12f932 100644 --- a/svx/source/table/cellcursor.cxx +++ b/svx/source/table/cellcursor.cxx @@ -269,7 +269,9 @@ void SAL_CALL CellCursor::merge( ) throw (NoSupportException, RuntimeException) throw DisposedException(); SdrModel* pModel = mxTable->getSdrTableObj()->GetModel(); - if( pModel ) + const bool bUndo = pModel && mxTable->getSdrTableObj()->IsInserted() && pModel->IsUndoEnabled(); + + if( bUndo ) pModel->BegUndo( ImpGetResStr(STR_TABLE_MERGE) ); try @@ -283,8 +285,11 @@ void SAL_CALL CellCursor::merge( ) throw (NoSupportException, RuntimeException) DBG_ERROR("sdr::table::CellCursor::merge(), exception caught!"); } - if( pModel ) + if( bUndo ) pModel->EndUndo(); + + if( pModel ) + pModel->SetChanged(); } // ----------------------------------------------------------------------------- @@ -530,7 +535,8 @@ void SAL_CALL CellCursor::split( sal_Int32 nColumns, sal_Int32 nRows ) throw (No throw DisposedException(); SdrModel* pModel = mxTable->getSdrTableObj()->GetModel(); - if( pModel ) + const bool bUndo = pModel && mxTable->getSdrTableObj()->IsInserted() && pModel->IsUndoEnabled(); + if( bUndo ) pModel->BegUndo( ImpGetResStr(STR_TABLE_SPLIT) ); try @@ -550,8 +556,11 @@ void SAL_CALL CellCursor::split( sal_Int32 nColumns, sal_Int32 nRows ) throw (No throw NoSupportException(); } - if( pModel ) + if( bUndo ) pModel->EndUndo(); + + if( pModel ) + pModel->SetChanged(); } // ----------------------------------------------------------------------------- diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index c99c2b3c2262..d7f64c852fc6 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -568,9 +568,6 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) if( bUndo ) mpModel->EndUndo(); - if( mpModel ) - mpModel->SetChanged(); - aStart.mnCol = nNewStartColumn; aStart.mnRow = 0; aEnd.mnCol = aStart.mnCol + nNewColumns - 1; @@ -602,13 +599,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) } if( bUndo ) - { mpModel->EndUndo(); - mpModel->SetChanged(); - } - - if( mpModel ) - mpModel->SetChanged(); aStart.mnCol = 0; aStart.mnRow = nNewRowStart; @@ -879,7 +870,8 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs ) pModel->AddUndo( new TableStyleUndo( *pTableObj ) ); } -/* + pTableObj->setTableStyle( xNewTableStyle ); + const sal_Int32 nRowCount = mxTable->getRowCount(); const sal_Int32 nColCount = mxTable->getColumnCount(); for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ ) @@ -889,9 +881,26 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs ) CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); if( xCell.is() ) { - if( bUndo ) - xCell->AddUndo(); - xCell->setAllPropertiesToDefault(); + SfxItemSet aSet( xCell->GetItemSet() ); + bool bChanges = false; + const SfxItemSet& rStyleAttribs = xCell->GetStyleSheet()->GetItemSet(); + + for ( USHORT nWhich = SDRATTR_START; nWhich <= SDRATTR_TABLE_LAST; nWhich++ ) + { + if( (rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON) && (aSet.GetItemState( nWhich ) == SFX_ITEM_ON) ) + { + aSet.ClearItem( nWhich ); + bChanges = true; + } + } + + if( bChanges ) + { + if( bUndo ) + xCell->AddUndo(); + + xCell->SetMergedItemSetAndBroadcast( aSet, sal_True ); + } } } catch( Exception& e ) @@ -900,9 +909,6 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs ) DBG_ERROR( "svx::SvxTableController::SetTableStyle(), exception caught!" ); } } -*/ - - pTableObj->setTableStyle( xNewTableStyle ); if( bUndo ) pModel->EndUndo(); @@ -1067,9 +1073,6 @@ void SvxTableController::SplitMarkedCells() if( bUndo ) mpModel->EndUndo(); - - if( mpModel ) - mpModel->SetChanged(); } aEnd.mnRow += mxTable->getRowCount() - nRowCount; aEnd.mnCol += mxTable->getColumnCount() - nColCount; diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index b2620452d31a..2d19a9994c41 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -118,7 +118,6 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const width += maColumns[aPos.mnCol++].mnSize; nColSpan--; - nColSpan--; } } } diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index ce79dad77b4c..34ef52f6d701 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -795,6 +795,9 @@ void TableModel::insertColumns( sal_Int32 nIndex, sal_Int32 nCount ) if( bUndo ) pModel->EndUndo(); + if( pModel ) + pModel->SetChanged(); + } catch( Exception& ) { @@ -900,10 +903,10 @@ void TableModel::removeColumns( sal_Int32 nIndex, sal_Int32 nCount ) maRows[nRows]->removeColumns( nIndex, nCount ); if( bUndo ) - { pModel->EndUndo(); + + if( pModel ) pModel->SetChanged(); - } } catch( Exception& ) { @@ -970,6 +973,9 @@ void TableModel::insertRows( sal_Int32 nIndex, sal_Int32 nCount ) if( bUndo ) pModel->EndUndo(); + if( pModel ) + pModel->SetChanged(); + updateRows(); setModified(sal_True); } @@ -1056,10 +1062,10 @@ void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount ) remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount ); if( bUndo ) - { pModel->EndUndo(); + + if( pModel ) pModel->SetChanged(); - } } catch( Exception& ) { |