23 #include <com/sun/star/table/XTable.hpp>
54 class SdrCellPrimitive2D :
public BufferedDecompositionPrimitive2D
62 virtual void create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& aViewInformation)
const override;
67 const attribute::SdrFillTextAttribute& rSdrFTAttribute)
68 : BufferedDecompositionPrimitive2D(),
69 maTransform(rTransform),
70 maSdrFTAttribute(rSdrFTAttribute)
76 const attribute::SdrFillTextAttribute& getSdrFTAttribute()
const {
return maSdrFTAttribute; }
79 virtual bool operator==(
const BasePrimitive2D& rPrimitive)
const override;
82 virtual sal_uInt32 getPrimitive2DID()
const override;
87 void SdrCellPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& )
const
93 if(!getSdrFTAttribute().getFill().isDefault())
97 aTransformed.transform(getTransform());
101 getSdrFTAttribute().getFill(),
102 getSdrFTAttribute().getFillFloatTransGradient()));
107 rContainer.push_back(
115 if(!getSdrFTAttribute().getText().isDefault())
117 rContainer.push_back(
121 getSdrFTAttribute().getText(),
122 attribute::SdrLineAttribute(),
128 bool SdrCellPrimitive2D::operator==(
const BasePrimitive2D& rPrimitive)
const
130 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
132 const SdrCellPrimitive2D& rCompare =
static_cast<const SdrCellPrimitive2D&
>(rPrimitive);
134 return (getTransform() == rCompare.getTransform()
135 && getSdrFTAttribute() == rCompare.getSdrFTAttribute());
157 if(nX >= 0 && nX <= nColCount && nY >= 0 && nY <= nRowCount)
180 bMirror = (bIsRTL ? 0 != nX : nX != nColCount);
189 const double fTwipsToMM(127.0 / 72.0);
201 const uno::Reference< css::table::XTable > xTable = rTableObj.
getTable();
210 const sal_Int32 nRowCount(xTable->getRowCount());
211 const sal_Int32 nColCount(xTable->getColumnCount());
212 const sal_Int32 nAllCount(nRowCount * nColCount);
217 const bool bIsRTL(css::text::WritingMode_RL_TB == rTableObj.
GetWritingMode());
235 for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++)
238 aArray.SetRowHeight(aCellPos.mnRow, rTableLayouter.getRowHeight(aCellPos.mnRow));
240 for(aCellPos.mnCol = 0; aCellPos.mnCol < nColCount; aCellPos.mnCol++)
244 if(0 == aCellPos.mnRow)
246 aArray.SetColWidth(aCellPos.mnCol, rTableLayouter.getColumnWidth(aCellPos.mnCol));
250 xCurrentCell.set(dynamic_cast< sdr::table::Cell* >(xTable->getCellByPosition(aCellPos.mnCol, aCellPos.mnRow).get()));
252 if(xCurrentCell.is())
255 aArray.SetCellStyleLeft(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow,
false, nColCount, nRowCount, bIsRTL));
256 aArray.SetCellStyleRight(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol + 1, aCellPos.mnRow,
false, nColCount, nRowCount, bIsRTL));
257 aArray.SetCellStyleTop(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow,
true, nColCount, nRowCount, bIsRTL));
258 aArray.SetCellStyleBottom(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow + 1,
true, nColCount, nRowCount, bIsRTL));
261 if(!xCurrentCell->isMerged())
264 const sal_Int32 nXSpan(xCurrentCell->getColumnSpan());
265 const sal_Int32 nYSpan(xCurrentCell->getRowSpan());
267 if(nXSpan > 1 || nYSpan > 1)
270 aArray.SetMergedRange(aCellPos.mnCol, aCellPos.mnRow, aCellPos.mnCol + nXSpan - 1, aCellPos.mnRow + nYSpan - 1);
275 if(xCurrentCell.is() && !xCurrentCell->isMerged())
277 if(rTableLayouter.getCellArea(xCurrentCell, aCellPos, aCellArea))
281 aCellMatrix.
set(0, 0, static_cast<double>(aCellArea.
getWidth()));
282 aCellMatrix.
set(1, 1, static_cast<double>(aCellArea.
getHeight()));
283 aCellMatrix.
set(0, 2, static_cast<double>(aCellArea.
getMinX()) + aObjectRange.
getMinX());
284 aCellMatrix.
set(1, 2, static_cast<double>(aCellArea.
getMinY()) + aObjectRange.
getMinY());
287 const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet();
288 const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol);
295 const sal_Int32 nLeft(xCurrentCell->GetTextLeftDistance());
296 const sal_Int32 nRight(xCurrentCell->GetTextRightDistance());
297 const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance());
298 const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance());
318 new drawinglayer::primitive2d::SdrCellPrimitive2D(
319 aCellMatrix, aAttribute));
320 aRetval.
append(xCellReference);
326 rCellItemSet,
nullptr);
329 new drawinglayer::primitive2d::SdrCellPrimitive2D(
330 aCellMatrix, aAttribute));
331 aRetvalForShadow.
append(xCellReference);
340 if(!aCellBorderPrimitives.empty())
354 aTransform.
scale(-1.0, 1.0);
360 const double fShearX(-rGeoStat.mfTanShearAngle);
361 const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) *
F_PI18000 : 0.0);
371 aTransform *= aObjectMatrix;
378 aCellBorderPrimitives));
382 aTransform, aCellBorderPrimitives));
404 aRetval, aNewShadowAttribute, aMatrix, &aRetvalForShadow);
410 aRetval, aNewShadowAttribute);
424 const double fShearX(-rGeoStat.mfTanShearAngle);
425 const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) *
F_PI18000 : 0.0);
css::uno::Reference< css::table::XTable > getTable() const
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
B2DPolygon const & createUnitPolygon()
sal_Int32 getMinY() const
#define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D
editeng::SvxBorderLine * getBorderLine(sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const
returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge...
virtual SdrText * getText(sal_Int32 nIndex) const override
Returns the nth available text.
Primitive2DContainer createEmbeddedShadowPrimitive(const Primitive2DContainer &rContent, const attribute::SdrShadowAttribute &rShadow, const basegfx::B2DHomMatrix &rObjectMatrix, const Primitive2DContainer *pContentForShadow)
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
const GeoStat & GetGeoStat() const
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
sal_Int64 getWidth() const
void scale(double fX, double fY)
virtual void append(const Primitive2DReference &) override
void Initialize(size_t nWidth, size_t nHeight)
Reinitializes the array with the specified size.
sal_Int32 getMinX() const
Primitive2DReference createTextPrimitive(const basegfx::B2DPolyPolygon &rUnitPolyPolygon, const basegfx::B2DHomMatrix &rObjectTransform, const attribute::SdrTextAttribute &rText, const attribute::SdrLineAttribute &rStroke, bool bCellText, bool bWordWrap)
css::text::WritingMode GetWritingMode() const
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
sal_Int64 getHeight() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet &rSet)
const SfxItemSet & GetMergedItemSet() const
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
Contains the widths of primary and secondary line of a frame style.
attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(const SfxItemSet &rSet, const SdrText *pText, const sal_Int32 *pLeft, const sal_Int32 *pUpper, const sal_Int32 *pRight, const sal_Int32 *pLower)
void translate(double fX, double fY)
Stores frame styles of an array of cells, supports merged ranges.
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
const tools::Rectangle & GetGeoRect() const
const TableLayouter & getTableLayouter() const
Primitive2DReference createPolyPolygonFillPrimitive(const basegfx::B2DPolyPolygon &rPolyPolygon, const attribute::SdrFillAttribute &rFill, const attribute::FillGradientAttribute &rFillGradient)