diff options
Diffstat (limited to 'sc/source/ui/view/output.cxx')
-rw-r--r-- | sc/source/ui/view/output.cxx | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 0aa76721e54a..3585908d7e07 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -39,6 +39,7 @@ #include <sal/log.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <tools/UnitConversion.hxx> #include <output.hxx> #include <document.hxx> @@ -289,7 +290,7 @@ void ScOutputData::SetSyntaxMode( bool bNewMode ) void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool bPage, bool bMergeCover) { // bMergeCover : Draw lines in sheet bgcolor to cover lok client grid lines in merged cell areas. - // (Used when scNoGridBackground is set in lok mode.) + // When scNoGridBackground is set in lok mode, bMergeCover is set to true and bGrid to false. SCCOL nX; SCROW nY; @@ -353,10 +354,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool long nLayoutSign = bLayoutRTL ? -1 : 1; long nSignedOneX = nOneX * nLayoutSign; - if (bGrid) - rRenderContext.SetLineColor(aGridColor); - else if (bMergeCover) - rRenderContext.SetLineColor(aSheetBGColor); + rRenderContext.SetLineColor(bMergeCover ? aSheetBGColor : aGridColor); ScGridMerger aGrid(&rRenderContext, nOneX, nOneY); @@ -399,14 +397,9 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool aPageColor ); bDashed = true; } - else if (bGrid) - { - rRenderContext.SetLineColor( aGridColor ); - bDashed = false; - } - else if (bMergeCover) + else { - rRenderContext.SetLineColor(aSheetBGColor); + rRenderContext.SetLineColor(bMergeCover ? aSheetBGColor : aGridColor); bDashed = false; } @@ -464,18 +457,14 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool } } - if (pThisRowInfo->bChanged && !bHOver && bGrid) - { - aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed); - } - else if (bHOver && bMergeCover) + if ((pThisRowInfo->bChanged && !bHOver && !bMergeCover) || (bHOver && bMergeCover)) { aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed); } nPosY = nNextY; } } - else if (bGrid) + else if (!bMergeCover) { aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nScrY, nScrY+nScrH-nOneY, bDashed); } @@ -525,14 +514,9 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool aPageColor ); bDashed = true; } - else if (bGrid) - { - rRenderContext.SetLineColor( aGridColor ); - bDashed = false; - } - else if (bMergeCover) + else { - rRenderContext.SetLineColor(aSheetBGColor); + rRenderContext.SetLineColor(bMergeCover ? aSheetBGColor : aGridColor); bDashed = false; } @@ -579,11 +563,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool //! nVisY from Array ?? } - if (!bVOver && bGrid) - { - aGrid.AddHorLine(bWorksInPixels, nPosX, nNextX-nSignedOneX, nPosY-nOneY, bDashed); - } - else if (bVOver && bMergeCover) + if ((!bVOver && !bMergeCover) || (bVOver && bMergeCover)) { aGrid.AddHorLine(bWorksInPixels, nPosX, nNextX-nSignedOneX, nPosY-nOneY, bDashed); } @@ -591,7 +571,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool nPosX = nNextX; } } - else if (bGrid) + else if (!bMergeCover) { aGrid.AddHorLine(bWorksInPixels, nScrX, nScrX+nScrW-nOneX, nPosY-nOneY, bDashed); } @@ -926,20 +906,42 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & rIconSetBitmapMap, ScIconSetType } void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldIconSetInfo, const tools::Rectangle& rRect, long nOneX, long nOneY, - sc::IconSetBitmapMap & rIconSetBitmapMap) + sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels) { - //long nSize = 16; ScIconSetType eType = pOldIconSetInfo->eIconSetType; sal_Int32 nIndex = pOldIconSetInfo->nIconIndex; const BitmapEx& rIcon = getIcon(rIconSetBitmapMap, eType, nIndex); - long aOrigSize = std::max<long>(0,std::min(rRect.GetSize().getWidth() - 4 * nOneX, rRect.GetSize().getHeight() -4 * nOneY)); - rRenderContext.DrawBitmapEx( Point( rRect.Left() + 2 * nOneX, rRect.Top() + 2 * nOneY), Size(aOrigSize, aOrigSize), rIcon ); + + long aHeight = 300; + + if (pOldIconSetInfo->mnHeight) + { + if (bWorksInPixels) + { + aHeight = rRenderContext.LogicToPixel(Size(0, pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height(); + if (comphelper::LibreOfficeKit::isActive()) + { + aHeight *= comphelper::LibreOfficeKit::getDPIScale(); + } + } + else + aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight); + } + + Size aSize = rIcon.GetSizePixel(); + double fRatio = aSize.Width() / aSize.Height(); + long aWidth = fRatio * aHeight; + + rRenderContext.Push(); + rRenderContext.SetClipRegion(vcl::Region(rRect)); + rRenderContext.DrawBitmapEx(Point(rRect.Left() + 2 * nOneX, rRect.Bottom() - 2 * nOneY - aHeight), Size(aWidth, aHeight), rIcon); + rRenderContext.Pop(); } void drawCells(vcl::RenderContext& rRenderContext, boost::optional<Color> const & pColor, const SvxBrushItem* pBackground, boost::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground, tools::Rectangle& rRect, long nPosX, long nLayoutSign, long nOneX, long nOneY, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo, const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo, - sc::IconSetBitmapMap & rIconSetBitmapMap) + sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels) { long nSignedOneX = nOneX * nLayoutSign; // need to paint if old color scale has been used and now @@ -956,7 +958,7 @@ void drawCells(vcl::RenderContext& rRenderContext, boost::optional<Color> const if( pOldDataBarInfo ) drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY); if( pOldIconSetInfo ) - drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap); + drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap, bWorksInPixels); rRect.SetLeft( nPosX - nSignedOneX ); } @@ -976,7 +978,7 @@ void drawCells(vcl::RenderContext& rRenderContext, boost::optional<Color> const if( pOldDataBarInfo ) drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY); if( pOldIconSetInfo ) - drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap); + drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap, bWorksInPixels); rRect.SetLeft( nPosX - nSignedOneX ); } @@ -1139,7 +1141,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) if (bWorksInPixels) nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 0)).X(); - drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap()); + drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap(), bWorksInPixels); // extend for all merged cells nMergedCols = 1; @@ -1163,7 +1165,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) if (bWorksInPixels) nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 0)).X(); - drawCells(rRenderContext, boost::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap()); + drawCells(rRenderContext, boost::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap(), bWorksInPixels); nArrY += nSkip; } |