chart2/source/model/main/PageBackground.cxx | 16 ++++++++++++---- drawinglayer/source/geometry/viewinformation2d.cxx | 13 ++++++++++++- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 6 +++++- include/basegfx/color/bcolor.hxx | 5 +++++ include/drawinglayer/geometry/viewinformation2d.hxx | 5 +++++ include/tools/color.hxx | 5 ++++- svx/source/sdr/contact/objectcontactofpageview.cxx | 4 ++++ 7 files changed, 47 insertions(+), 7 deletions(-)
New commits: commit 9d971b719b74013ff9d63044092fd832bfa8d7b0 Author: offtkp <[email protected]> AuthorDate: Wed Dec 13 03:39:14 2023 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Jan 16 14:20:29 2024 +0100 chart2: Make automatic area coloring for charts work for tiled rendering Charts now get a temporary colored applied to the area property set if their color was set to automatic, which is done by default in tiled rendering mode. Change-Id: Ic6bd19b97d2a0ffa2a1ad516cfa202e2f4921db7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162174 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx index 776e751b2934..55cee4483a3c 100644 --- a/chart2/source/model/main/PageBackground.cxx +++ b/chart2/source/model/main/PageBackground.cxx @@ -18,6 +18,7 @@ */ #include "PageBackground.hxx" +#include <comphelper/lok.hxx> #include <LinePropertiesHelper.hxx> #include <FillProperties.hxx> #include <UserDefinedProperties.hxx> @@ -57,10 +58,17 @@ private: // override other defaults Color aDocColor = COL_WHITE; - if (SfxViewShell::Current()) { - aDocColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); - } else { - SAL_WARN("chart2", "SfxViewShell::Current() returned nullptr"); + if (comphelper::LibreOfficeKit::isActive()) + { + aDocColor = COL_AUTO; + } + else + { + if (SfxViewShell::Current()) { + aDocColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); + } else { + SAL_WARN("chart2", "SfxViewShell::Current() returned nullptr"); + } } ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, aDocColor ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 7e0240690a68..3d61c538541c 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -85,6 +85,9 @@ protected: // the point in time double mfViewTime; + // color to use for automatic color + Color maAutoColor; + // allow to reduce DisplayQuality (e.g. sw 3d fallback renderer for interactions) bool mbReducedDisplayQuality : 1; @@ -104,6 +107,7 @@ public: , maDiscreteViewport() , mxVisualizedPage() , mfViewTime(0.0) + , maAutoColor(COL_AUTO) , mbReducedDisplayQuality(false) , mbUseAntiAliasing(bForwardedAntiAliasing) , mbPixelSnapHairline(bForwardedAntiAliasing && bForwardPixelSnapHairline) @@ -188,6 +192,9 @@ public: mxVisualizedPage = rNew; } + Color getAutoColor() const { return maAutoColor; } + void setAutoColor(Color aNew) { maAutoColor = aNew; } + bool getReducedDisplayQuality() const { return mbReducedDisplayQuality; } void setReducedDisplayQuality(bool bNew) { mbReducedDisplayQuality = bNew; } @@ -203,7 +210,7 @@ public: && maViewTransformation == rCandidate.maViewTransformation && maViewport == rCandidate.maViewport && mxVisualizedPage == rCandidate.mxVisualizedPage - && mfViewTime == rCandidate.mfViewTime + && mfViewTime == rCandidate.mfViewTime && maAutoColor == rCandidate.maAutoColor && mbReducedDisplayQuality == rCandidate.mbReducedDisplayQuality && mbUseAntiAliasing == rCandidate.mbUseAntiAliasing && mbPixelSnapHairline == rCandidate.mbPixelSnapHairline); @@ -341,6 +348,10 @@ void ViewInformation2D::setUseAntiAliasing(bool bNew) mpViewInformation2D->setUseAntiAliasing(bNew); } +Color ViewInformation2D::getAutoColor() const { return mpViewInformation2D->getAutoColor(); } + +void ViewInformation2D::setAutoColor(Color aNew) { mpViewInformation2D->setAutoColor(aNew); } + bool ViewInformation2D::getPixelSnapHairline() const { return mpViewInformation2D->getPixelSnapHairline(); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index dd3ae6b6c8e9..43b8a4fa55bc 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -115,7 +115,11 @@ void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect( const basegfx::BColor aPolygonColor( maBColorModifierStack.getModifiedColor(rSource.getBColor())); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); + if (comphelper::LibreOfficeKit::isActive() && aPolygonColor.isAutomatic()) + mpOutputDevice->SetFillColor(getViewInformation2D().getAutoColor()); + else + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); mpOutputDevice->DrawTransparent(maCurrentTransformation, rSource.getB2DPolyPolygon(), fTransparency); diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx index d8788b1cfef1..2859fd767fc6 100644 --- a/include/basegfx/color/bcolor.hxx +++ b/include/basegfx/color/bcolor.hxx @@ -39,6 +39,8 @@ namespace basegfx */ class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColor : public B3DTuple { + bool mbAutomatic = false; + public: /** Create a Color with red, green and blue components from [0.0 to 1.0] @@ -84,6 +86,9 @@ namespace basegfx void setGreen(double fNew) { mfY = fNew; } void setBlue(double fNew) { mfZ = fNew; } + bool isAutomatic() const { return mbAutomatic; } + void setAutomatic(bool bNew) { mbAutomatic = bNew; } + /** *=operator to allow usage from BColor, too */ BColor& operator*=( const BColor& rPnt ) diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index e71ab08faead..99120a8ff507 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -23,6 +23,7 @@ #include <sal/config.h> #include <o3tl/cow_wrapper.hxx> +#include <tools/color.hxx> // predefines @@ -160,6 +161,10 @@ public: void setPixelSnapHairline(bool bNew); static void forwardAntiAliasing(bool bAntiAliasing); + + Color getAutoColor() const; + void setAutoColor(Color aNew); + static void forwardPixelSnapHairline(bool bPixelSnapHairline); }; diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 296d6064c40a..4cef9c846e61 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -417,7 +417,10 @@ public: */ basegfx::BColor getBColor() const { - return basegfx::BColor(R / 255.0, G / 255.0, B / 255.0); + basegfx::BColor aColor(R / 255.0, G / 255.0, B / 255.0); + if (mValue == Color(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF).mValue) + aColor.setAutomatic(true); + return aColor; } }; diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index 26c295472e0b..e3cb09ae0472 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -30,6 +30,8 @@ #include <svx/sdr/animation/objectanimator.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrpaintwindow.hxx> +#include <svtools/colorcfg.hxx> +#include <sfx2/viewsh.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/processor2dtools.hxx> @@ -214,6 +216,8 @@ namespace sdr::contact aNewViewInformation2D.setViewport(aViewRange); aNewViewInformation2D.setVisualizedPage(GetXDrawPageForSdrPage(GetSdrPage())); aNewViewInformation2D.setViewTime(fCurrentTime); + if (SfxViewShell::Current()) + aNewViewInformation2D.setAutoColor(SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR)); updateViewInformation2D(aNewViewInformation2D); drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
