summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-09-09 09:19:53 +0000
committerOliver Bolte <obo@openoffice.org>2009-09-09 09:19:53 +0000
commit36bff0ce9171dcb81e9c733e2c03fbe06ae1225a (patch)
treeb198cf9cd216aee6ffa77f40c2f4330a424de35d /svx/source
parent7510cc3ff1359d2f3c9d5654260721056740e566 (diff)
CWS-TOOLING: integrate CWS impress174
2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled. 2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element 2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason 2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error 2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word 2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation 2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork) 2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics 2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines 2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes 2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode) 2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied 2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled 2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies 2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service 2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page 2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning 2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines 2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified 2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog 2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx245
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.hxx5
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx4
-rw-r--r--svx/source/msfilter/msdffimp.cxx19
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx14
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx16
-rw-r--r--svx/source/svdraw/svdedtv.cxx5
-rw-r--r--svx/source/svdraw/svdfppt.cxx33
-rw-r--r--svx/source/svdraw/svdmrkv.cxx6
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx69
-rw-r--r--svx/source/table/cell.cxx13
-rw-r--r--svx/source/table/cellcursor.cxx17
-rw-r--r--svx/source/table/tablecontroller.cxx41
-rw-r--r--svx/source/table/tablelayouter.cxx1
-rw-r--r--svx/source/table/tablemodel.cxx14
15 files changed, 350 insertions, 152 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 1f411f35bb..16f48581bc 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 134118e3bf..e8f40b49dd 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 d4e8ca883b..1769009824 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 31e7716651..159ffee2e7 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 0545052012..ef7df1ae32 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 926967314a..2a433ecadd 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 7b7881eaa3..ec5d5ba7ab 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 38ca4899e5..aedaad1fce 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 d5afb80d15..d8a14f17c3 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 cd760c7a44..18b53f4eca 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 b63ce98791..0f399fa73d 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 d996af5395..7ed2328745 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 180485f3fc..4d6eb39511 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 9818f0ad39..b27529a323 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 bd1fe4dd93..901f7775e1 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -794,6 +794,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& )
{
@@ -969,6 +972,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& )
{