23 #include <com/sun/star/table/XTable.hpp>
55 class SdrCellPrimitive2D :
public BufferedDecompositionPrimitive2D
63 virtual void create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& aViewInformation)
const override;
68 const attribute::SdrFillTextAttribute& rSdrFTAttribute)
69 : BufferedDecompositionPrimitive2D(),
70 maTransform(rTransform),
71 maSdrFTAttribute(rSdrFTAttribute)
77 const attribute::SdrFillTextAttribute& getSdrFTAttribute()
const {
return maSdrFTAttribute; }
80 virtual bool operator==(
const BasePrimitive2D& rPrimitive)
const override;
83 virtual sal_uInt32 getPrimitive2DID()
const override;
88 void SdrCellPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& )
const
94 if(!getSdrFTAttribute().getFill().isDefault())
98 aTransformed.transform(getTransform());
102 getSdrFTAttribute().getFill(),
103 getSdrFTAttribute().getFillFloatTransGradient()));
108 rContainer.push_back(
116 if(!getSdrFTAttribute().getText().isDefault())
118 rContainer.push_back(
122 getSdrFTAttribute().getText(),
123 attribute::SdrLineAttribute(),
129 bool SdrCellPrimitive2D::operator==(
const BasePrimitive2D& rPrimitive)
const
131 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
133 const SdrCellPrimitive2D& rCompare =
static_cast<const SdrCellPrimitive2D&
>(rPrimitive);
135 return (getTransform() == rCompare.getTransform()
136 && getSdrFTAttribute() == rCompare.getSdrFTAttribute());
158 if(nX >= 0 && nX <= nColCount && nY >= 0 && nY <= nRowCount)
181 bMirror = (bIsRTL ? 0 != nX : nX != nColCount);
190 constexpr
double fTwipsToMM(
203 const uno::Reference< css::table::XTable > xTable = rTableObj.
getTable();
212 const sal_Int32 nRowCount(xTable->getRowCount());
213 const sal_Int32 nColCount(xTable->getColumnCount());
214 const sal_Int32 nAllCount(nRowCount * nColCount);
219 const bool bIsRTL(css::text::WritingMode_RL_TB == rTableObj.
GetWritingMode());
237 for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++)
240 aArray.SetRowHeight(aCellPos.mnRow, rTableLayouter.getRowHeight(aCellPos.mnRow));
242 for(aCellPos.mnCol = 0; aCellPos.mnCol < nColCount; aCellPos.mnCol++)
246 if(0 == aCellPos.mnRow)
248 aArray.SetColWidth(aCellPos.mnCol, rTableLayouter.getColumnWidth(aCellPos.mnCol));
252 xCurrentCell.set(dynamic_cast< sdr::table::Cell* >(xTable->getCellByPosition(aCellPos.mnCol, aCellPos.mnRow).get()));
254 if(xCurrentCell.is())
257 aArray.SetCellStyleLeft(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow,
false, nColCount, nRowCount, bIsRTL));
258 aArray.SetCellStyleRight(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol + 1, aCellPos.mnRow,
false, nColCount, nRowCount, bIsRTL));
259 aArray.SetCellStyleTop(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow,
true, nColCount, nRowCount, bIsRTL));
260 aArray.SetCellStyleBottom(aCellPos.mnCol, aCellPos.mnRow,
impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow + 1,
true, nColCount, nRowCount, bIsRTL));
263 if(!xCurrentCell->isMerged())
266 const sal_Int32 nXSpan(xCurrentCell->getColumnSpan());
267 const sal_Int32 nYSpan(xCurrentCell->getRowSpan());
269 if(nXSpan > 1 || nYSpan > 1)
272 aArray.SetMergedRange(aCellPos.mnCol, aCellPos.mnRow, aCellPos.mnCol + nXSpan - 1, aCellPos.mnRow + nYSpan - 1);
277 if(xCurrentCell.is() && !xCurrentCell->isMerged())
279 if(rTableLayouter.getCellArea(xCurrentCell, aCellPos, aCellArea))
283 aCellMatrix.
set(0, 0, static_cast<double>(aCellArea.
getWidth()));
284 aCellMatrix.
set(1, 1, static_cast<double>(aCellArea.
getHeight()));
285 aCellMatrix.
set(0, 2, static_cast<double>(aCellArea.
getMinX()) + aObjectRange.
getMinX());
286 aCellMatrix.
set(1, 2, static_cast<double>(aCellArea.
getMinY()) + aObjectRange.
getMinY());
289 const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet();
290 const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol);
297 const sal_Int32 nLeft(xCurrentCell->GetTextLeftDistance());
298 const sal_Int32 nRight(xCurrentCell->GetTextRightDistance());
299 const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance());
300 const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance());
320 new drawinglayer::primitive2d::SdrCellPrimitive2D(
321 aCellMatrix, aAttribute));
322 aRetval.
append(xCellReference);
328 rCellItemSet,
nullptr);
331 new drawinglayer::primitive2d::SdrCellPrimitive2D(
332 aCellMatrix, aAttribute));
333 aRetvalForShadow.
append(xCellReference);
342 if(!aCellBorderPrimitives.empty())
356 aTransform.
scale(-1.0, 1.0);
362 const double fShearX(-rGeoStat.mfTanShearAngle);
363 const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) *
F_PI18000 : 0.0);
373 aTransform *= aObjectMatrix;
380 aCellBorderPrimitives));
384 aTransform, aCellBorderPrimitives));
406 aRetval, aNewShadowAttribute, aMatrix, &aRetvalForShadow);
412 aRetval, aNewShadowAttribute);
426 const double fShearX(-rGeoStat.mfTanShearAngle);
427 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)
constexpr auto convert(N n, sal_Int64 mul, sal_Int64 div)
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)