Kaydet (Commit) 71053a36 authored tarafından Armin Le Grand's avatar Armin Le Grand

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
üst e3e2f691
...@@ -150,11 +150,6 @@ private: ...@@ -150,11 +150,6 @@ private:
/// call to set maImplStyle on demand /// call to set maImplStyle on demand
void implEnsureImplStyle(); 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: public:
/** Constructs an invisible frame style. */ /** Constructs an invisible frame style. */
explicit Style(); explicit Style();
...@@ -203,9 +198,6 @@ public: ...@@ -203,9 +198,6 @@ public:
/** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */ /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
Style& MirrorSelf(); 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;
bool operator<( const Style& rOther) const; bool operator<( const Style& rOther) const;
}; };
......
...@@ -291,8 +291,7 @@ public: ...@@ -291,8 +291,7 @@ public:
/** Returns the output range of the cell (nCol,nRow). /** Returns the output range of the cell (nCol,nRow).
Returns total output range of merged ranges. */ Returns total output range of merged ranges. */
basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow ) const; basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const;
basegfx::B2DRange GetCellRange( size_t nCellIndex ) const;
// mirroring -------------------------------------------------------------- // mirroring --------------------------------------------------------------
...@@ -312,9 +311,6 @@ public: ...@@ -312,9 +311,6 @@ public:
/** Draws the part of the array, that is inside the clipping range. */ /** Draws the part of the array, that is inside the clipping range. */
drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const; 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: private:
std::unique_ptr<ArrayImpl> mxImpl; std::unique_ptr<ArrayImpl> mxImpl;
}; };
......
...@@ -250,7 +250,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo ...@@ -250,7 +250,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
Size aStrSize; Size aStrSize;
sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow ); 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())); Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
sal_uInt16 nRightX = 0; sal_uInt16 nRightX = 0;
bool bJustify = pCurData->GetIncludeJustify(); bool bJustify = pCurData->GetIncludeJustify();
...@@ -374,7 +374,7 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext) ...@@ -374,7 +374,7 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.SetLineColor(); rRenderContext.SetLineColor();
rRenderContext.SetFillColor( pItem->GetColor() ); rRenderContext.SetFillColor( pItem->GetColor() );
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow )); const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
rRenderContext.DrawRect( rRenderContext.DrawRect(
tools::Rectangle( tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()), basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
......
...@@ -51,14 +51,12 @@ void Style::implEnsureImplStyle() ...@@ -51,14 +51,12 @@ void Style::implEnsureImplStyle()
} }
Style::Style() : Style::Style() :
maImplStyle(), maImplStyle()
mpUsingCell(nullptr)
{ {
} }
Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) : Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
maImplStyle(new implStyle()), maImplStyle(new implStyle())
mpUsingCell(nullptr)
{ {
maImplStyle->mnType = nType; maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale; maImplStyle->mfPatternScale = fScale;
...@@ -66,8 +64,7 @@ Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double ...@@ -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 ) : 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()), maImplStyle(new implStyle())
mpUsingCell(nullptr)
{ {
maImplStyle->mnType = nType; maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale; maImplStyle->mfPatternScale = fScale;
...@@ -75,8 +72,7 @@ Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rCo ...@@ -75,8 +72,7 @@ Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rCo
} }
Style::Style( const editeng::SvxBorderLine* pBorder, double fScale ) : Style::Style( const editeng::SvxBorderLine* pBorder, double fScale ) :
maImplStyle(), maImplStyle()
mpUsingCell(nullptr)
{ {
if(nullptr != pBorder) if(nullptr != pBorder)
{ {
......
...@@ -410,7 +410,7 @@ void FrameSelectorImpl::InitBorderGeometry() ...@@ -410,7 +410,7 @@ void FrameSelectorImpl::InitBorderGeometry()
{ {
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) 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( const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()), basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())); basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
...@@ -469,7 +469,7 @@ void FrameSelectorImpl::InitBorderGeometry() ...@@ -469,7 +469,7 @@ void FrameSelectorImpl::InitBorderGeometry()
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{ {
// the usable area between horizonal/vertical frame borders of current quadrant // 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( const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1, basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1,
basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1); basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1);
......
...@@ -716,7 +716,7 @@ MAKENUMSTR: ...@@ -716,7 +716,7 @@ MAKENUMSTR:
SvtScriptedTextHelper aScriptedText(rRenderContext); SvtScriptedTextHelper aScriptedText(rRenderContext);
Size aStrSize; Size aStrSize;
sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow ); 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( const tools::Rectangle cellRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()), basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())); basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
...@@ -811,7 +811,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext) ...@@ -811,7 +811,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR); rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
rRenderContext.SetLineColor(); rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aBrushItem.GetColor()); rRenderContext.SetFillColor(aBrushItem.GetColor());
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow )); const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
rRenderContext.DrawRect( rRenderContext.DrawRect(
tools::Rectangle( tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()), basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment