diff options
Diffstat (limited to 'svx/source/table')
-rw-r--r-- | svx/source/table/tablehandles.cxx | 7 | ||||
-rw-r--r-- | svx/source/table/viewcontactoftableobj.cxx | 125 |
2 files changed, 81 insertions, 51 deletions
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 02fdf1c1c888..33833f8b81b1 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -47,7 +47,7 @@ #include <svx/svdpagv.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <svx/sdr/overlay/overlayhatchrect.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> namespace sdr { namespace table { @@ -242,10 +242,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in HitTest primitive to support HitTest of this overlay object + // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible + // overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 05ac0b9aeb75..63d1066e7149 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -34,19 +34,20 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/attribute/sdrtextattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <editeng/borderline.hxx> #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> +#include <svx/sdr/attribute/sdrfilltextattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "cell.hxx" #include "tablelayouter.hxx" @@ -94,34 +95,42 @@ namespace drawinglayer Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { + // prepare unit polygon Primitive2DSequence aRetval; + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - if(getSdrFTAttribute().getFill() || getSdrFTAttribute().getText()) + // add fill + if(!getSdrFTAttribute().getFill().isDefault()) { - // prepare unit polygon - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)); - - // add fill - if(getSdrFTAttribute().getFill()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( aUnitPolyPolygon, getTransform(), - *getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFill(), getSdrFTAttribute().getFillFloatTransGradient())); - } + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); + } - // add text - if(getSdrFTAttribute().getText()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( + // add text + if(!getSdrFTAttribute().getText().isDefault()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( aUnitPolyPolygon, getTransform(), - *getSdrFTAttribute().getText(), - 0, - true, false, false)); - } + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } return aRetval; @@ -536,14 +545,13 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const sdr::table::SdrTableObj& rTableObj = GetTableObj(); const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable(); - const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); if(xTable.is()) { // create primitive representation for table + drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); @@ -596,7 +604,7 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + drawinglayer::attribute::SdrFillTextAttribute aAttribute; if(pSdrText) { @@ -606,7 +614,7 @@ namespace sdr const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText, &nLeft, @@ -616,21 +624,17 @@ namespace sdr } else { - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText); } - if(pAttribute) + // always create cell primitives for BoundRect and HitTest { - if(pAttribute->isVisible()) - { - const drawinglayer::primitive2d::Primitive2DReference xCellReference(new drawinglayer::primitive2d::SdrCellPrimitive2D( - aCellMatrix, *pAttribute)); - xCellSequence[nCellInsert++] = xCellReference; - } - - delete pAttribute; + const drawinglayer::primitive2d::Primitive2DReference xCellReference( + new drawinglayer::primitive2d::SdrCellPrimitive2D( + aCellMatrix, aAttribute)); + xCellSequence[nCellInsert++] = xCellReference; } // handle cell borders @@ -675,21 +679,46 @@ namespace sdr xRetval = xCellSequence; drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence); } - } - - if(xRetval.hasElements()) - { - // check and create evtl. shadow for created content - drawinglayer::attribute::SdrShadowAttribute* pNewShadowAttribute = drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet); - if(pNewShadowAttribute) + if(xRetval.hasElements()) { - xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); - delete pNewShadowAttribute; + // check and create evtl. shadow for created content + const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); + const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet)); + + if(!aNewShadowAttribute.isDefault()) + { + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute); + } } - } - return xRetval; + return xRetval; + } + else + { + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rTableObj.GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(rTableObj.GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // credate an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aObjectMatrix)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj) |