drawinglayer/qa/unit/border.cxx | 21 +++++++++- sc/source/ui/inc/output.hxx | 2 - sc/source/ui/view/output.cxx | 77 +--------------------------------------- svx/source/dialog/framelink.cxx | 13 +++++- svx/source/dialog/frmsel.cxx | 3 - 5 files changed, 32 insertions(+), 84 deletions(-)
New commits: commit 682502f231d95b3af2ad5047b58267fb00ff98bd Author: arminl <arminl@KRANIX> Date: Thu Jul 27 16:03:48 2017 +0200 borderline: corrections for calc and writer Made corrections/finetuning for Calc and Writer. Had to remove some former code which tried to do corrections Added some finetuning for UnitTests and warnings Change-Id: Ia7669c9eb7f3338d250cd350bfa5c2bc8e61763b diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx index ce99965b13f9..326c5deaa163 100644 --- a/drawinglayer/qa/unit/border.cxx +++ b/drawinglayer/qa/unit/border.cxx @@ -61,7 +61,15 @@ void DrawinglayerBorderTest::testDoubleDecompositionSolid() basegfx::BColor aColorGap; bool const bHasGapColor = false; SvxBorderLineStyle const nStyle = SvxBorderLineStyle::DOUBLE; - rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder(new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, fLeftWidth, fDistance, fRightWidth, fExtendLeftStart, fExtendLeftEnd, fExtendRightStart, fExtendRightEnd, aColorRight, aColorLeft, aColorGap, bHasGapColor, nStyle)); + rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder( + new drawinglayer::primitive2d::BorderLinePrimitive2D( + aStart, + aEnd, + drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd), + drawinglayer::primitive2d::BorderLine(fDistance, aColorGap), + drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd), + bHasGapColor, + nStyle)); // Decompose it into polygons. drawinglayer::geometry::ViewInformation2D aView; @@ -109,7 +117,16 @@ void DrawinglayerBorderTest::testDoublePixelProcessing() basegfx::BColor aColorGap; bool const bHasGapColor = false; SvxBorderLineStyle const nStyle = SvxBorderLineStyle::DOUBLE; - rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> xBorder(new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, fLeftWidth, fDistance, fRightWidth, fExtendLeftStart, fExtendLeftEnd, fExtendRightStart, fExtendRightEnd, aColorRight, aColorLeft, aColorGap, bHasGapColor, nStyle)); + rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> xBorder( + new drawinglayer::primitive2d::BorderLinePrimitive2D( + aStart, + aEnd, + drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd), + drawinglayer::primitive2d::BorderLine(fDistance, aColorGap), + drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd), + bHasGapColor, + nStyle)); + drawinglayer::primitive2d::Primitive2DContainer aPrimitives; aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(xBorder.get())); diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 5345b69141bb..acc7ec251264 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -231,7 +231,7 @@ private: double GetStretch(); - void DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Color* pForceColor); // pixel + void DrawRotatedFrame(vcl::RenderContext& rRenderContext); // pixel drawinglayer::processor2d::BaseProcessor2D* CreateProcessor2D( ); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index f4db5fec5b09..87e495fac4bc 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1387,7 +1387,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) if (mrTabInfo.maArray.HasCellRotation()) { - DrawRotatedFrame(rRenderContext, pForceColor); // removes the lines that must not be painted here + DrawRotatedFrame(rRenderContext); // removes the lines that must not be painted here } long nInitPosX = nScrX; @@ -1474,74 +1474,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) rRenderContext.SetDrawMode(nOldDrawMode); } -// Line below the cell - -static const ::editeng::SvxBorderLine* lcl_FindHorLine( ScDocument* pDoc, - SCCOL nCol, SCROW nRow, SCTAB nTab, ScRotateDir nRotDir, - bool bTopLine ) -{ - if ( nRotDir != ScRotateDir::Left && nRotDir != ScRotateDir::Right ) - return nullptr; - - bool bFound = false; - while (!bFound) - { - if ( nRotDir == ScRotateDir::Left ) - { - // text to the left -> line from the right - if ( nCol < MAXCOL ) - ++nCol; - else - return nullptr; // couldn't find it - } - else - { - // text to the right -> line from the left - if ( nCol > 0 ) - --nCol; - else - return nullptr; // couldn't find it - } - const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); - const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - if ( !pPattern->GetRotateVal( pCondSet ) || - static_cast<const SvxRotateModeItem&>(pPattern->GetItem( - ATTR_ROTATE_MODE, pCondSet)).GetValue() == SVX_ROTATE_MODE_STANDARD ) - bFound = true; - } - - if (bTopLine) - --nRow; - const ::editeng::SvxBorderLine* pThisBottom; - if ( ValidRow(nRow) ) - pThisBottom = static_cast<const SvxBoxItem*>(pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ))->GetBottom(); - else - pThisBottom = nullptr; - const ::editeng::SvxBorderLine* pNextTop; - if ( nRow < MAXROW ) - pNextTop = static_cast<const SvxBoxItem*>(pDoc->GetAttr( nCol, nRow+1, nTab, ATTR_BORDER ))->GetTop(); - else - pNextTop = nullptr; - - if ( ScHasPriority( pThisBottom, pNextTop ) ) - return pThisBottom; - else - return pNextTop; -} - -static long lcl_getRotate( ScDocument* pDoc, SCTAB nTab, SCCOL nX, SCROW nY ) -{ - long nRotate = 0; - - const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); - const SfxItemSet* pCondSet = pDoc->GetCondResult( nX, nY, nTab ); - - nRotate = pPattern->GetRotateVal( pCondSet ); - - return nRotate; -} - -void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Color* pForceColor) +void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) { //! save nRotMax SCCOL nRotMax = nX2; @@ -1555,8 +1488,6 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); bool bCellContrast = mbUseStyleColor && rStyleSettings.GetHighContrastMode(); - // color (pForceColor) is determined externally, including DrawMode changes - long nInitPosX = nScrX; if ( bLayoutRTL ) { @@ -1575,9 +1506,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co else rRenderContext.SetClipRegion( vcl::Region( aClipRect ) ); - svx::frame::Array& rArray = mrTabInfo.maArray; std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(CreateProcessor2D( )); - long nPosY = nScrY; for (SCSIZE nArrY=1; nArrY<nArrCount; nArrY++) { @@ -1587,8 +1516,6 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co RowInfo& rThisRowInfo = pRowInfo[nArrY]; RowInfo& rNextRowInfo = pRowInfo[nArrY+1]; - size_t nRow = static_cast< size_t >( nArrY ); - long nRowHeight = rThisRowInfo.nHeight; if ( rThisRowInfo.nRotMaxCol != SC_ROTMAX_NONE && ( rThisRowInfo.bChanged || rPrevRowInfo.bChanged || diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index faa408c29dcc..987b84610f4c 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -652,7 +652,10 @@ void CreateBorderPrimitives( else if (2 == myOffsets.size()) { // we are a double edge, calculate cuts with edges coming from above/below - // for both edges to detect the line start/end extensions + // for both edges to detect the line start/end extensions. In the furure this + // needs to be extended to use two values per extension, getComplexExtendedLineValues + // internally prepares these already. drawinglayer::primitive2d::BorderLine will + // then need to take these double entries (maybe a pair) and use them internally. double mfExtendLeftStart(0.0); double mfExtendLeftEnd(0.0); double mfExtendRightStart(0.0); @@ -687,8 +690,12 @@ void CreateBorderPrimitives( drawinglayer::primitive2d::BorderLine( rBorder.Dist(), (pForceColor ? *pForceColor : rBorder.GetColorGap()).getBColor(), - (mfExtendLeftStart + mfExtendRightStart) * 0.5, - (mfExtendLeftEnd + mfExtendRightEnd) * 0.5), + // needs to be determined in detail later, for now use the max prolongation + // from left/right, butz do not less than half (0.0). This works decently, + // but not perfect (see Writer, use three-color-style, look at upper/lower# + // connections) + std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)), + std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd))), drawinglayer::primitive2d::BorderLine( rBorder.Secn(), (pForceColor ? *pForceColor : rBorder.GetColorSecn()).getBColor(), diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 93567852d1a9..e3ccf03eebc0 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -667,9 +667,6 @@ void FrameSelectorImpl::DrawAllFrameBorders() for( size_t nRow = 0; nRow < maArray.GetRowCount(); ++nRow ) maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() ); - // Let the helper array draw itself - static bool bUsePrimitives(true); - // This is used in the dialog/control for 'Border' attributes. When using // the original paint below instead of primitives, the advantage currently // is the correct visualization of diagonal line(s) including overlaying, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits