diff options
author | Uwe Fischer <ufi@openoffice.org> | 2010-04-23 10:48:45 +0200 |
---|---|---|
committer | Uwe Fischer <ufi@openoffice.org> | 2010-04-23 10:48:45 +0200 |
commit | 7061ee1d7e8d196950fa5a82b9000dc4eaac000e (patch) | |
tree | c7e238b94fb3beca82ad7d19818dd0f3941a356e /svx/source/table/viewcontactoftableobj.cxx | |
parent | 6ed48a59cf65d12799e5db469447487a35f78489 (diff) | |
parent | eeaf2f34f56d815040b0e80b5e3abd6b08400bdc (diff) |
hcshared25: merge with DEV300_m77
Diffstat (limited to 'svx/source/table/viewcontactoftableobj.cxx')
-rw-r--r-- | svx/source/table/viewcontactoftableobj.cxx | 125 |
1 files changed, 77 insertions, 48 deletions
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 48c6264caa..5f0af00fc5 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) |