summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdorect.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:24:41 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:24:41 +0000
commite8103e9da949b7e7abfefb327917414d5d6086d8 (patch)
tree893f88df6f20f72313d7fe6d48ebf376b1e7622f /svx/source/svdraw/svdorect.cxx
parentae5ed340b1b5f84623807eb635589e5d3f911518 (diff)
INTEGRATION: CWS aw033 (1.21.12); FILE MERGED
2008/07/10 13:00:57 aw 1.21.12.12: #i39532# XOutputDevice removed, PrepareDelete removed 2008/06/24 15:42:27 aw 1.21.12.11: #i39532# corrections 2008/05/14 14:05:01 aw 1.21.12.10: RESYNC: (1.29-1.30); FILE MERGED 2008/01/22 12:29:33 aw 1.21.12.9: adaptions and 1st stripping 2007/12/03 16:40:54 aw 1.21.12.8: RESYNC: (1.28-1.29); FILE MERGED 2007/11/27 11:59:52 aw 1.21.12.7: #i39532# added GetRange() to B2DPolygon 2007/11/22 15:03:18 aw 1.21.12.6: #i39532# wntmsci10 correction 2007/08/09 19:03:10 aw 1.21.12.5: RESYNC: (1.27-1.28); FILE MERGED 2006/11/28 19:40:33 aw 1.21.12.4: RESYNC: (1.24-1.27); FILE MERGED 2006/09/26 19:36:36 aw 1.21.12.3: RESYNC: (1.21-1.24); FILE MERGED 2006/05/12 12:46:29 aw 1.21.12.2: code changes for primitive support 2005/10/28 11:40:31 aw 1.21.12.1: #i39532#
Diffstat (limited to 'svx/source/svdraw/svdorect.cxx')
-rw-r--r--svx/source/svdraw/svdorect.cxx191
1 files changed, 13 insertions, 178 deletions
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 3aa622818962..817234b7bf40 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: svdorect.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
* This file is part of OpenOffice.org.
*
@@ -36,7 +36,6 @@
#include <stdlib.h>
#include <svx/xpool.hxx>
#include <svx/xpoly.hxx>
-#include "svdxout.hxx"
#include <svx/svdattr.hxx>
#include <svx/svdpool.hxx>
#include "svdtouch.hxx"
@@ -57,10 +56,12 @@
#include <svx/xlnwtit.hxx>
#include "svdoimp.hxx"
#include <svx/sdr/properties/rectangleproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
sdr::properties::BaseProperties* SdrRectObj::CreateObjectSpecificProperties()
{
@@ -68,6 +69,14 @@ sdr::properties::BaseProperties* SdrRectObj::CreateObjectSpecificProperties()
}
//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrRectObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrRectObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
TYPEINIT1(SdrRectObj,SdrTextObj);
@@ -212,31 +221,6 @@ UINT16 SdrRectObj::GetObjIdentifier() const
else return UINT16(OBJ_RECT);
}
-void SdrRectObj::RecalcBoundRect()
-{
- aOutRect=GetSnapRect();
- long nLineWdt=ImpGetLineWdt();
-
- // #i25616#
- if(!LineIsOutsideGeometry())
- {
- nLineWdt++; nLineWdt/=2;
- }
-
- if (nLineWdt!=0) {
- long a=nLineWdt;
- if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && GetEckenradius()==0) {
- a*=2; // doppelt, wegen evtl. spitzen Ecken
- }
- aOutRect.Left ()-=a;
- aOutRect.Top ()-=a;
- aOutRect.Right ()+=a;
- aOutRect.Bottom()+=a;
- }
- ImpAddShadowToBoundRect();
- ImpAddTextToBoundRect();
-}
-
void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
{
rRect=aRect;
@@ -255,156 +239,6 @@ void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
}
}
-//////////////////////////////////////////////////////////////////////////////
-// #i25616#
-
-void SdrRectObj::ImpDoPaintRectObjShadow(XOutputDevice& rXOut, sal_Bool bPaintFill, sal_Bool bPaintLine) const
-{
- const bool bHideContour(IsHideContour());
- const SfxItemSet& rSet = GetObjectItemSet();
- SfxItemSet aShadowSet(rSet);
-
- if(!bHideContour && ImpSetShadowAttributes(rSet, aShadowSet))
- {
- // perepare ItemSet to avoid old XOut line drawing
- SfxItemSet aEmptySet(*rSet.GetPool());
- aEmptySet.Put(XLineStyleItem(XLINE_NONE));
- aEmptySet.Put(XFillStyleItem(XFILL_NONE));
- rXOut.SetFillAttr(aShadowSet);
-
- sal_uInt32 nXDist(((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
- sal_uInt32 nYDist(((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
-
- // avoid shadow line drawing in XOut
- rXOut.SetLineAttr(aEmptySet);
-
- if(bPaintFill)
- {
- // #100127# Output original geometry for metafiles
- ImpGraphicFill aFill( *this, rXOut, aShadowSet, true );
- const sal_Int32 nEckRad(GetEckenradius());
-
- if (PaintNeedsXPoly(nEckRad))
- {
- XPolygon aX(GetXPoly());
- aX.Move(nXDist,nYDist);
- rXOut.DrawPolygon(aX.getB2DPolygon());
- }
- else
- {
- Rectangle aR(aRect);
- aR.Move(nXDist,nYDist);
- rXOut.DrawRect(aR,USHORT(2*nEckRad),USHORT(2*nEckRad));
- }
- }
-
- if(bPaintLine)
- {
- // prepare line geometry
- // #b4899532# if not filled but fill draft, avoid object being invisible in using
- // a hair linestyle and COL_LIGHTGRAY
- SfxItemSet aItemSet(rSet);
-
- // prepare line geometry
- ::std::auto_ptr< SdrLineGeometry > pLineGeometry(ImpPrepareLineGeometry(rXOut, aItemSet));
-
- // new shadow line drawing
- if( pLineGeometry.get() )
- {
- // draw the line geometry
- ImpDrawShadowLineGeometry(rXOut, aItemSet, *pLineGeometry);
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// #i25616#
-
-void SdrRectObj::ImpDoPaintRectObj(XOutputDevice& rXOut, sal_Bool bPaintFill, sal_Bool bPaintLine) const
-{
- const bool bHideContour(IsHideContour());
-
- if(!bHideContour)
- {
- // prepare ItemSet of this object
- const SfxItemSet& rSet = GetObjectItemSet();
-
- // perepare ItemSet to avoid old XOut line drawing
- SfxItemSet aEmptySet(*rSet.GetPool());
- aEmptySet.Put(XLineStyleItem(XLINE_NONE));
- aEmptySet.Put(XFillStyleItem(XFILL_NONE));
-
- // Before here the LineAttr were set: if(pLineAttr) rXOut.SetLineAttr(*pLineAttr);
- rXOut.SetLineAttr(aEmptySet);
- rXOut.SetFillAttr( rSet );
-
- if (!bHideContour && bPaintFill)
- {
- // #100127# Output original geometry for metafiles
- ImpGraphicFill aFill( *this, rXOut, rSet );
- const sal_Int32 nEckRad(GetEckenradius());
-
- if (PaintNeedsXPoly(nEckRad))
- {
- rXOut.DrawPolygon(GetXPoly().getB2DPolygon());
- }
- else
- {
- DBG_ASSERT(nEckRad==0,"SdrRectObj::DoPaintObject(): XOut.DrawRect() unterstuetz kein Eckenradius!");
- rXOut.DrawRect(aRect/*,USHORT(2*nEckRad),USHORT(2*nEckRad)*/);
- }
- }
-
- DBG_ASSERT(aRect.GetWidth()>1 && aRect.GetHeight()>1,"SdrRectObj::DoPaintObject(): Rect hat Nullgroesse (oder negativ)!");
-
- // Own line drawing
- if( !bHideContour && bPaintLine)
- {
- // prepare line geometry
- // #b4899532# if not filled but fill draft, avoid object being invisible in using
- // a hair linestyle and COL_LIGHTGRAY
- SfxItemSet aItemSet(rSet);
-
- // prepare line geometry
- ::std::auto_ptr< SdrLineGeometry > pLineGeometry( ImpPrepareLineGeometry(rXOut, aItemSet) );
-
- if( pLineGeometry.get() )
- {
- // draw the line geometry
- ImpDrawColorLineGeometry(rXOut, aItemSet, *pLineGeometry);
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-sal_Bool SdrRectObj::DoPaintObject(XOutputDevice& rXOut, const SdrPaintInfoRec& rInfoRec) const
-{
- if (bTextFrame && aGeo.nShearWink!=0) {
- DBG_WARNING("Shearwinkel vom TextFrame innerhalb von SdrRectObj::DoPaintObject() auf 0 gesetzt");
- ((SdrRectObj*)this)->ImpCheckShear();
- ((SdrRectObj*)this)->SetRectsDirty();
- }
-
- sal_Bool bOk(sal_True);
-
- // draw shadow
- ImpDoPaintRectObjShadow(rXOut, sal_True, sal_True);
-
- // draw geometry
- ImpDoPaintRectObj(rXOut, sal_True, sal_True);
-
- // draw text
- if(HasText() && !LineIsOutsideGeometry())
- {
- bOk = SdrTextObj::DoPaintObject(rXOut,rInfoRec);
- }
-
- return bOk;
-}
-
SdrObject* SdrRectObj::ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer, FASTBOOL bForceFilled, FASTBOOL bForceTol) const
{
if(pVisiLayer && !pVisiLayer->IsSet(sal::static_int_cast< sal_uInt8 >(GetLayer())))
@@ -452,7 +286,7 @@ SdrObject* SdrRectObj::ImpCheckHit(const Point& rPnt, USHORT nTol, const SetOfBy
INT32 nRad=nEckRad;
if (bFilled) nRad+=nMyTol; // um korrekt zu sein ...
XPolygon aXPoly(ImpCalcXPoly(aR,nRad));
- aPol = Polygon(basegfx::tools::adaptiveSubdivideByAngle(aXPoly.getB2DPolygon()));
+ aPol = Polygon(aXPoly.getB2DPolygon().getDefaultAdaptiveSubdivision());
} else {
if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
@@ -832,6 +666,7 @@ SdrObject* SdrRectObj::DoConvertToPolyObj(BOOL bBezier) const
}
basegfx::B2DPolyPolygon aPolyPolygon(aXP.getB2DPolygon());
+ aPolyPolygon.removeDoublePoints();
SdrObject* pRet = 0L;
if(!IsTextFrame() || HasFill() || HasLine())