summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-01-18 17:07:43 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-01-28 16:18:39 +0100
commitea2e74c9156f852df1bd7b73cbeab14e7a73b34c (patch)
treeb446b245fa18ec19198919487714f7f2ec2a7f31
parent9b5730f92967b6a8f4fce349bcd951f388b940df (diff)
BorderlineFix: Need to redesign Borderline paint for Calc
To fix some errors, need to change svx::frame::Array conversion to Primitives, especially regarding handling of merged cells. These make problems in the currtent form where the full extended merged cell tries to be converted. This is bad for cropped stuff and also wrong for double-line stuff attaching to a merged cell. The solution is to handle cells single and merge created primitives which is more expensive but will work. This will involve special handling for X-Ed (crossed) and 'roated' Cells. Also need to be very careful since all this is used in the meantime for all visualizations of Tables in multiple apps/situations. Change-Id: If0652a3ba97a6f27dd5d782ea22b1514303f3710
-rw-r--r--include/svx/framelink.hxx8
-rw-r--r--include/svx/framelinkarray.hxx6
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx4
-rw-r--r--svx/source/dialog/framelink.cxx12
-rw-r--r--svx/source/dialog/framelinkarray.cxx376
-rw-r--r--svx/source/dialog/frmsel.cxx4
-rw-r--r--sw/source/ui/table/tautofmt.cxx4
7 files changed, 179 insertions, 235 deletions
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index ce7f09345a80..2feaab5af8bf 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -150,11 +150,6 @@ private:
/// call to set maImplStyle on demand
void implEnsureImplStyle();
- /// need information which cell this style info comes from due to needed
- /// rotation info (which is in the cell). Rotation depends on the cell.
- friend class Cell;
- void SetUsingCell(const Cell* pCell) { mpUsingCell = pCell; }
-
public:
/** Constructs an invisible frame style. */
explicit Style();
@@ -203,9 +198,6 @@ public:
/** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
Style& MirrorSelf();
- /** return the Cell using this style (if set) */
- const Cell* GetUsingCell() const { return mpUsingCell; }
-
bool operator==( const Style& rOther) const;
bool operator<( const Style& rOther) const;
};
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 2b06d29a41b2..e135e371319c 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -291,8 +291,7 @@ public:
/** Returns the output range of the cell (nCol,nRow).
Returns total output range of merged ranges. */
- basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow ) const;
- basegfx::B2DRange GetCellRange( size_t nCellIndex ) const;
+ basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const;
// mirroring --------------------------------------------------------------
@@ -312,9 +311,6 @@ public:
/** Draws the part of the array, that is inside the clipping range. */
drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const;
- // fill the Cell::maCellIndex entries to allow referencing back from Cell to Array Col/Row coordinates
- void AddCellIndices() const;
-
private:
std::unique_ptr<ArrayImpl> mxImpl;
};
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index a6ffdfe75389..f8f2dae645a6 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -250,7 +250,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
Size aStrSize;
sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
- const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
sal_uInt16 nRightX = 0;
bool bJustify = pCurData->GetIncludeJustify();
@@ -374,7 +374,7 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.SetLineColor();
rRenderContext.SetFillColor( pItem->GetColor() );
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
rRenderContext.DrawRect(
tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 1501fca0022d..269ac3e52e49 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -51,14 +51,12 @@ void Style::implEnsureImplStyle()
}
Style::Style() :
- maImplStyle(),
- mpUsingCell(nullptr)
+ maImplStyle()
{
}
Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
- maImplStyle(new implStyle()),
- mpUsingCell(nullptr)
+ maImplStyle(new implStyle())
{
maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
@@ -66,8 +64,7 @@ Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double
}
Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
- maImplStyle(new implStyle()),
- mpUsingCell(nullptr)
+ maImplStyle(new implStyle())
{
maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
@@ -75,8 +72,7 @@ Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rCo
}
Style::Style( const editeng::SvxBorderLine* pBorder, double fScale ) :
- maImplStyle(),
- mpUsingCell(nullptr)
+ maImplStyle()
{
if(nullptr != pBorder)
{
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 560eefd775ce..ecb3eaace1c6 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -45,10 +45,8 @@ public:
long mnAddTop;
long mnAddBottom;
- SvxRotateMode meRotMode;
- double mfOrientation;
- basegfx::B2DHomMatrix maCoordinateSystem;
- size_t maCellIndex;
+ SvxRotateMode meRotMode;
+ double mfOrientation;
bool mbMergeOrig;
bool mbOverlapX;
@@ -57,12 +55,12 @@ public:
public:
explicit Cell();
- void SetStyleLeft(const Style& rStyle) { maLeft = rStyle; maLeft.SetUsingCell(this); }
- void SetStyleRight(const Style& rStyle) { maRight = rStyle; maRight.SetUsingCell(this); }
- void SetStyleTop(const Style& rStyle) { maTop = rStyle; maTop.SetUsingCell(this); }
- void SetStyleBottom(const Style& rStyle) { maBottom = rStyle; maBottom.SetUsingCell(this); }
- void SetStyleTLBR(const Style& rStyle) { maTLBR = rStyle; maTLBR.SetUsingCell(this); }
- void SetStyleBLTR(const Style& rStyle) { maBLTR = rStyle; maBLTR.SetUsingCell(this); }
+ void SetStyleLeft(const Style& rStyle) { maLeft = rStyle; }
+ void SetStyleRight(const Style& rStyle) { maRight = rStyle; }
+ void SetStyleTop(const Style& rStyle) { maTop = rStyle; }
+ void SetStyleBottom(const Style& rStyle) { maBottom = rStyle; }
+ void SetStyleTLBR(const Style& rStyle) { maTLBR = rStyle; }
+ void SetStyleBLTR(const Style& rStyle) { maBLTR = rStyle; }
const Style& GetStyleLeft() const { return maLeft; }
const Style& GetStyleRight() const { return maRight; }
@@ -76,74 +74,54 @@ public:
void MirrorSelfX();
- basegfx::B2DHomMatrix const & CreateCoordinateSystem(const Array& rArray) const;
- size_t GetCellIndex(const Array& rArray) const;
+ basegfx::B2DHomMatrix CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const;
};
typedef std::vector< long > LongVec;
typedef std::vector< Cell > CellVec;
-size_t Cell::GetCellIndex(const Array& rArray) const
+basegfx::B2DHomMatrix Cell::CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const
{
- if(static_cast<size_t>(-1) == maCellIndex)
- {
- rArray.AddCellIndices();
- }
-
- return maCellIndex;
-}
+ basegfx::B2DHomMatrix aRetval;
+ const basegfx::B2DRange aRange(rArray.GetCellRange(nCol, nRow, bExpandMerged));
-basegfx::B2DHomMatrix const & Cell::CreateCoordinateSystem(const Array& rArray) const
-{
- if(!maCoordinateSystem.isIdentity())
+ if(!aRange.isEmpty())
{
- return maCoordinateSystem;
- }
-
- const size_t nCellIndex(GetCellIndex(rArray));
+ basegfx::B2DPoint aOrigin(aRange.getMinimum());
+ basegfx::B2DVector aX(aRange.getWidth(), 0.0);
+ basegfx::B2DVector aY(0.0, aRange.getHeight());
- if(static_cast<size_t>(-1) != nCellIndex)
- {
- const basegfx::B2DRange aRange(rArray.GetCellRange(nCellIndex));
-
- if(!aRange.isEmpty())
+ if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != meRotMode)
{
- basegfx::B2DPoint aOrigin(aRange.getMinimum());
- basegfx::B2DVector aX(aRange.getWidth(), 0.0);
- basegfx::B2DVector aY(0.0, aRange.getHeight());
+ // when rotated, adapt values. Get Skew (cos/sin == 1/tan)
+ const double fSkew(aY.getY() * (cos(mfOrientation) / sin(mfOrientation)));
- if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != meRotMode)
+ switch (meRotMode)
{
- // when rotated, adapt values. Get Skew (cos/sin == 1/tan)
- const double fSkew(aY.getY() * (cos(mfOrientation) / sin(mfOrientation)));
-
- switch (meRotMode)
- {
- case SvxRotateMode::SVX_ROTATE_MODE_TOP:
- // shear Y-Axis
- aY.setX(-fSkew);
- break;
- case SvxRotateMode::SVX_ROTATE_MODE_CENTER:
- // shear origin half, Y full
- aOrigin.setX(aOrigin.getX() + (fSkew * 0.5));
- aY.setX(-fSkew);
- break;
- case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
- // shear origin full, Y full
- aOrigin.setX(aOrigin.getX() + fSkew);
- aY.setX(-fSkew);
- break;
- default: // SvxRotateMode::SVX_ROTATE_MODE_STANDARD, already excluded above
- break;
- }
+ case SvxRotateMode::SVX_ROTATE_MODE_TOP:
+ // shear Y-Axis
+ aY.setX(-fSkew);
+ break;
+ case SvxRotateMode::SVX_ROTATE_MODE_CENTER:
+ // shear origin half, Y full
+ aOrigin.setX(aOrigin.getX() + (fSkew * 0.5));
+ aY.setX(-fSkew);
+ break;
+ case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
+ // shear origin full, Y full
+ aOrigin.setX(aOrigin.getX() + fSkew);
+ aY.setX(-fSkew);
+ break;
+ default: // SvxRotateMode::SVX_ROTATE_MODE_STANDARD, already excluded above
+ break;
}
-
- // use column vectors as coordinate axes, homogen column for translation
- const_cast<Cell*>(this)->maCoordinateSystem = basegfx::utils::createCoordinateSystemTransform(aOrigin, aX, aY);
}
+
+ // use column vectors as coordinate axes, homogen column for translation
+ aRetval = basegfx::utils::createCoordinateSystemTransform(aOrigin, aX, aY);
}
- return maCoordinateSystem;
+ return aRetval;
}
Cell::Cell() :
@@ -153,8 +131,6 @@ Cell::Cell() :
mnAddBottom( 0 ),
meRotMode(SvxRotateMode::SVX_ROTATE_MODE_STANDARD ),
mfOrientation( 0.0 ),
- maCoordinateSystem(),
- maCellIndex(static_cast<size_t>(-1)),
mbMergeOrig( false ),
mbOverlapX( false ),
mbOverlapY( false )
@@ -168,8 +144,6 @@ void Cell::MirrorSelfX()
maLeft.MirrorSelf();
maRight.MirrorSelf();
mfOrientation = -mfOrientation;
- maCoordinateSystem.identity();
- maCellIndex = static_cast<size_t>(-1);
}
@@ -864,17 +838,12 @@ long Array::GetHeight() const
return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 );
}
-basegfx::B2DRange Array::GetCellRange( size_t nCellIndex ) const
-{
- return GetCellRange(nCellIndex % GetColCount(), nCellIndex / GetColCount());
-}
-
-basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow ) const
+basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const
{
- size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
- size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
- size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
- size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ size_t nFirstCol = bExpandMerged ? mxImpl->GetMergedFirstCol( nCol, nRow ) : nCol;
+ size_t nFirstRow = bExpandMerged ? mxImpl->GetMergedFirstRow( nCol, nRow ) : nRow;
+ size_t nLastCol = bExpandMerged ? mxImpl->GetMergedLastCol( nCol, nRow ) : nCol;
+ size_t nLastRow = bExpandMerged ? mxImpl->GetMergedLastRow( nCol, nRow ) : nRow;
const Point aPoint( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
const Size aSize( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
tools::Rectangle aRect(aPoint, aSize);
@@ -1023,45 +992,6 @@ void HelperCreateVerticalEntry(
);
}
-void HelperCreateEntry(const Array& rArray, const Style& rStyle, drawinglayer::primitive2d::Primitive2DContainer& rSequence, const Color* pForceColor)
-{
- const Cell* pCell = rStyle.GetUsingCell();
-
- if(nullptr != pCell)
- {
- const size_t nCellIndex(pCell->GetCellIndex(rArray));
-
- if(static_cast<size_t>(-1) != nCellIndex)
- {
- size_t col(nCellIndex % rArray.GetColCount());
- size_t row(nCellIndex / rArray.GetColCount());
- const bool bL(&rStyle == &pCell->GetStyleLeft());
- const bool bR(&rStyle == &pCell->GetStyleRight());
- const bool bT(&rStyle == &pCell->GetStyleTop());
- const bool bB(&rStyle == &pCell->GetStyleBottom());
-
- if(bL || bR || bT || bB)
- {
- const basegfx::B2DHomMatrix aCoordinateSystem(pCell->CreateCoordinateSystem(rArray));
- const basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
- const basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
- const basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
-
- if(bL || bR)
- {
- // left/right
- HelperCreateVerticalEntry(rArray, rStyle, bL ? col : col + 1, row, aOrigin, aX, aY, rSequence, bL, pForceColor);
- }
- else if(bT || bB)
- {
- // top/bottom
- HelperCreateHorizontalEntry(rArray, rStyle, col, bT ? row : row + 1, aOrigin, aX, aY, rSequence, bT, pForceColor);
- }
- }
- }
- }
-}
-
void HelperMergeInB2DPrimitiveArray(
const drawinglayer::primitive2d::Primitive2DContainer& rSource,
drawinglayer::primitive2d::Primitive2DContainer& rTarget)
@@ -1116,23 +1046,27 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
std::vector< drawinglayer::primitive2d::Primitive2DContainer > aVerticalSequences(nLastCol - nFirstCol + 1);
drawinglayer::primitive2d::Primitive2DContainer aCrossSequence;
+ // remember for which merged cells crossed lines were already created. To
+ // do so, hold the size_t cell index in a set for fast check
+ std::set< size_t > aMergedCells;
+
for (size_t nRow = nFirstRow; nRow <= nLastRow; ++nRow)
{
for (size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol)
{
+ // get Cell and CoordinateSystem (*only* for this Cell), check if used (not empty)
const Cell& rCell = CELL(nCol, nRow);
- const basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this));
- const basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
- const basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
+ basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this, nCol, nRow, false));
+ basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
+ basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
if(!aX.equalZero() && !aY.equalZero())
{
- size_t _nFirstCol = mxImpl->GetMergedFirstCol(nCol, nRow);
- size_t _nFirstRow = mxImpl->GetMergedFirstRow(nCol, nRow);
- size_t _nLastCol = mxImpl->GetMergedLastCol(nCol, nRow);
- size_t _nLastRow = mxImpl->GetMergedLastRow(nCol, nRow);
- const basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
-
+ // for getting correct Style(s) for merged Cells, we need the First(Col/Row)
+ // for access (see accessing Styles below)
+ const size_t _nFirstCol(mxImpl->GetMergedFirstCol(nCol, nRow));
+ const size_t _nFirstRow(mxImpl->GetMergedFirstRow(nCol, nRow));
+ basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
const bool bOverlapX(rCell.mbOverlapX);
const bool bOverlapY(rCell.mbOverlapY);
const bool bFirstCol(nCol == nFirstCol);
@@ -1140,116 +1074,152 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
const bool bFirstRow(nRow == nFirstRow);
const bool bLastRow(nRow == nLastRow);
- if (!bOverlapX || bFirstRow)
+ // create upper line for this Cell
+ if (!bOverlapY // true for first line in merged cells or cells
+ || bFirstRow) // true for non_Calc usages of this tooling
{
const Style& rTop = GetCellStyleTop(_nFirstCol, _nFirstRow);
if(rTop.IsUsed())
{
- HelperCreateEntry(*this, rTop, aHorizontalSequence, pForceColor);
+ HelperCreateHorizontalEntry(*this, rTop, nCol, nRow, aOrigin, aX, aY, aHorizontalSequence, true, pForceColor);
}
}
- if (bLastRow)
+ // create lower line for this Cell
+ if (bLastRow) // true for non_Calc usages of this tooling
{
const Style& rBottom = GetCellStyleBottom(_nFirstCol, _nFirstRow);
if(rBottom.IsUsed())
{
- HelperCreateEntry(*this, rBottom, aHorizontalSequence, pForceColor);
+ HelperCreateHorizontalEntry(*this, rBottom, nCol, nRow + 1, aOrigin, aX, aY, aHorizontalSequence, false, pForceColor);
}
}
- if (!bOverlapY || bFirstCol)
+ // create left line for this Cell
+ if (!bOverlapX // true for first column in merged cells or cells
+ || bFirstCol) // true for non_Calc usages of this tooling
{
const Style& rLeft(GetCellStyleLeft(_nFirstCol, _nFirstRow));
if(rLeft.IsUsed())
{
- HelperCreateEntry(*this, rLeft, aVerticalSequences[nCol - nFirstCol], pForceColor);
+ HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, aVerticalSequences[nCol - nFirstCol], true, pForceColor);
}
}
- if (bLastCol)
+ // create right line for this Cell
+ if (bLastCol) // true for non_Calc usages of this tooling
{
const Style& rRight(GetCellStyleRight(_nFirstCol, _nFirstRow));
if(rRight.IsUsed())
{
- HelperCreateEntry(*this, rRight, aVerticalSequences[nCol - nFirstCol], pForceColor);
+ HelperCreateVerticalEntry(*this, rRight, nCol + 1, nRow, aOrigin, aX, aY, aVerticalSequences[nCol - nFirstCol], false, pForceColor);
}
}
- if ((!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) || (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow))
+ // check for crossed lines, these need special treatment, especially
+ // for merged cells, see below
+ const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
+ const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);
+
+ if(rTLBR.IsUsed() || rBLTR.IsUsed())
{
- const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
- if(rTLBR.IsUsed())
+ bool bContinue(true);
+
+ if(rCell.IsMerged())
{
- /// top-left and bottom-right Style Tables
- /// Fill top-left Style Table
- const Style& rTLFromRight(GetCellStyleTop(_nFirstCol, _nFirstRow));
- const Style& rTLFromBottom(GetCellStyleLeft(_nFirstCol, _nFirstRow));
- StyleVectorTable aStart;
- const basegfx::B2DVector aAxisA(aX + aY);
-
- aStart.add(rTLFromRight, aAxisA, aX, false);
- aStart.add(rTLFromBottom, aAxisA, aY, false);
- aStart.sort();
-
- /// Fill bottom-right Style Table
- const Style& rBRFromBottom(GetCellStyleRight(_nLastCol, _nLastRow));
- const Style& rBRFromLeft(GetCellStyleBottom(_nLastCol, _nLastRow));
- StyleVectorTable aEnd;
- const basegfx::B2DVector aAxisB(-aX -aY);
-
- aEnd.add(rBRFromBottom, aAxisB, -aY, true);
- aEnd.add(rBRFromLeft, aAxisB, -aX, true);
- aEnd.sort();
-
- CreateBorderPrimitives(
- aCrossSequence,
- aOrigin,
- aX + aY,
- rTLBR,
- aStart,
- aEnd,
- pForceColor
- );
+ // first check if this merged cell was already handled
+ const size_t nIndexOfMergedCell(mxImpl->GetIndex(_nFirstCol, _nFirstRow));
+ bContinue = (aMergedCells.end() == aMergedCells.find(nIndexOfMergedCell));
+
+ if(bContinue)
+ {
+ // not found, add now to mark as handled
+ aMergedCells.insert(nIndexOfMergedCell);
+
+ // when merged, get extended coordinate system and dependent values
+ aCoordinateSystem = rCell.CreateCoordinateSystem(*this, nCol, nRow, true);
+ aX = basegfx::utils::getColumn(aCoordinateSystem, 0);
+ aY = basegfx::utils::getColumn(aCoordinateSystem, 1);
+ aOrigin = basegfx::utils::getColumn(aCoordinateSystem, 2);
+ }
}
- const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);
- if(rBLTR.IsUsed())
+ if(bContinue)
{
- /// bottom-left and top-right Style Tables
- /// Fill bottom-left Style Table
- const Style& rBLFromTop(GetCellStyleLeft(_nFirstCol, _nLastRow));
- const Style& rBLFromBottom(GetCellStyleBottom(_nFirstCol, _nLastRow));
- StyleVectorTable aStart;
- const basegfx::B2DVector aAxisA(aX - aY);
-
- aStart.add(rBLFromTop, aAxisA, -aY, true);
- aStart.add(rBLFromBottom, aAxisA, aX, false);
- aStart.sort();
-
- /// Fill top-right Style Table
- const Style& rTRFromLeft(GetCellStyleTop(_nLastCol, _nFirstRow));
- const Style& rTRFromBottom(GetCellStyleRight(_nLastCol, _nFirstRow));
- StyleVectorTable aEnd;
- const basegfx::B2DVector aAxisB(aY - aX);
-
- aEnd.add(rTRFromLeft, aAxisB, -aX, true);
- aEnd.add(rTRFromBottom, aAxisB, aY, false);
- aEnd.sort();
-
- CreateBorderPrimitives(
- aCrossSequence,
- aOrigin + aY,
- aX - aY,
- rBLTR,
- aStart,
- aEnd,
- pForceColor
- );
+ const size_t _nLastCol(mxImpl->GetMergedLastCol(nCol, nRow));
+ const size_t _nLastRow(mxImpl->GetMergedLastRow(nCol, nRow));
+
+ if(rTLBR.IsUsed())
+ {
+ /// top-left and bottom-right Style Tables
+ /// Fill top-left Style Table
+ const Style& rTLFromRight(GetCellStyleTop(_nFirstCol, _nFirstRow));
+ const Style& rTLFromBottom(GetCellStyleLeft(_nFirstCol, _nFirstRow));
+ StyleVectorTable aStart;
+ const basegfx::B2DVector aAxisA(aX + aY);
+
+ aStart.add(rTLFromRight, aAxisA, aX, false);
+ aStart.add(rTLFromBottom, aAxisA, aY, false);
+ aStart.sort();
+
+ /// Fill bottom-right Style Table
+ const Style& rBRFromBottom(GetCellStyleRight(_nLastCol, _nLastRow));
+ const Style& rBRFromLeft(GetCellStyleBottom(_nLastCol, _nLastRow));
+ StyleVectorTable aEnd;
+ const basegfx::B2DVector aAxisB(-aX -aY);
+
+ aEnd.add(rBRFromBottom, aAxisB, -aY, true);
+ aEnd.add(rBRFromLeft, aAxisB, -aX, true);
+ aEnd.sort();
+
+ CreateBorderPrimitives(
+ aCrossSequence,
+ aOrigin,
+ aX + aY,
+ rTLBR,
+ aStart,
+ aEnd,
+ pForceColor
+ );
+ }
+
+ if(rBLTR.IsUsed())
+ {
+ /// bottom-left and top-right Style Tables
+ /// Fill bottom-left Style Table
+ const Style& rBLFromTop(GetCellStyleLeft(_nFirstCol, _nLastRow));
+ const Style& rBLFromBottom(GetCellStyleBottom(_nFirstCol, _nLastRow));
+ StyleVectorTable aStart;
+ const basegfx::B2DVector aAxisA(aX - aY);
+
+ aStart.add(rBLFromTop, aAxisA, -aY, true);
+ aStart.add(rBLFromBottom, aAxisA, aX, false);
+ aStart.sort();
+
+ /// Fill top-right Style Table
+ const Style& rTRFromLeft(GetCellStyleTop(_nLastCol, _nFirstRow));
+ const Style& rTRFromBottom(GetCellStyleRight(_nLastCol, _nFirstRow));
+ StyleVectorTable aEnd;
+ const basegfx::B2DVector aAxisB(aY - aX);
+
+ aEnd.add(rTRFromLeft, aAxisB, -aX, true);
+ aEnd.add(rTRFromBottom, aAxisB, aY, false);
+ aEnd.sort();
+
+ CreateBorderPrimitives(
+ aCrossSequence,
+ aOrigin + aY,
+ aX - aY,
+ rBLTR,
+ aStart,
+ aEnd,
+ pForceColor
+ );
+ }
}
}
}
@@ -1259,6 +1229,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
// to stay compatible, create order as it was formally. Also try to
// merge primitives as far as possible
HelperMergeInB2DPrimitiveArray(aHorizontalSequence, aCrossSequence);
+
for(const auto& aVert : aVerticalSequences)
{
HelperMergeInB2DPrimitiveArray(aVert, aCrossSequence);
@@ -1279,19 +1250,9 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveArray()
return aPrimitives;
}
-void Array::AddCellIndices() const
-{
- for (size_t a(0); a < mxImpl->maCells.size(); a++)
- {
- const_cast<Array*>(this)->mxImpl->maCells[a].maCellIndex = a;
- }
-}
-
#undef ORIGCELL
#undef CELLACC
#undef CELL
-
-
#undef DBG_FRAME_CHECK_ROW_1
#undef DBG_FRAME_CHECK_COL_1
#undef DBG_FRAME_CHECK_COLROW
@@ -1299,7 +1260,6 @@ void Array::AddCellIndices() const
#undef DBG_FRAME_CHECK_COL
#undef DBG_FRAME_CHECK
-
}
}
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index d54e1b083e65..f65693d44b58 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -410,7 +410,7 @@ void FrameSelectorImpl::InitBorderGeometry()
{
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
@@ -469,7 +469,7 @@ void FrameSelectorImpl::InitBorderGeometry()
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
// the usable area between horizonal/vertical frame borders of current quadrant
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1,
basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1);
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 7a342f1ff83e..5336024736fa 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -716,7 +716,7 @@ MAKENUMSTR:
SvtScriptedTextHelper aScriptedText(rRenderContext);
Size aStrSize;
sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
const tools::Rectangle cellRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
@@ -811,7 +811,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aBrushItem.GetColor());
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
rRenderContext.DrawRect(
tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),