chart2/source/model/main/PageBackground.cxx | 11 ++++++++--- drawinglayer/source/geometry/viewinformation2d.cxx | 13 ++++++++++++- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 6 +++++- include/basegfx/color/bcolor.hxx | 4 ++++ include/drawinglayer/geometry/viewinformation2d.hxx | 4 ++++ include/tools/color.hxx | 5 ++++- svx/source/sdr/contact/objectcontactofpageview.cxx | 4 ++++ 7 files changed, 41 insertions(+), 6 deletions(-)
New commits: commit 36529a48420f4e11a0d8865f326910a1abe98547 Author: offtkp <parisop...@gmail.com> AuthorDate: Wed Dec 13 03:39:14 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Jan 16 22:56:24 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/+/160659 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx index c866bdbb3f4a..b4c21df55fb4 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> @@ -51,10 +52,14 @@ const ::chart::tPropertyValueMap& StaticPageBackgroundDefaults() // override other defaults Color aDocColor = COL_WHITE; - if (SfxViewShell::Current()) { - aDocColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); + if (comphelper::LibreOfficeKit::isActive()) { + aDocColor = COL_AUTO; } else { - SAL_WARN("chart2", "SfxViewShell::Current() returned nullptr"); + if (SfxViewShell::Current()) { + aDocColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); + } else { + SAL_WARN("chart2", "SfxViewShell::Current() returned nullptr"); + } } ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::FillProperties::PROP_FILL_COLOR, aDocColor ); ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 03089e41e36f..4a9805acf7c1 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -87,6 +87,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; @@ -106,6 +109,7 @@ public: , maDiscreteViewport() , mxVisualizedPage() , mfViewTime(0.0) + , maAutoColor(COL_AUTO) , mbReducedDisplayQuality(false) , mbUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing()) , mbPixelSnapHairline(mbUseAntiAliasing && bForwardPixelSnapHairline) @@ -190,6 +194,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; } @@ -205,7 +212,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); @@ -342,6 +349,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 e71cda4a0bb6..8748b78cd34e 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 a88488117ce2..584f9572e585 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 bAutomatic = false; + public: /** Create a Color with red, green and blue components from [0.0 to 1.0] @@ -78,11 +80,13 @@ namespace basegfx double getRed() const { return mnX; } double getGreen() const { return mnY; } double getBlue() const { return mnZ; } + bool isAutomatic() const { return bAutomatic; } // data access write void setRed(double fNew) { mnX = fNew; } void setGreen(double fNew) { mnY = fNew; } void setBlue(double fNew) { mnZ = fNew; } + void setAutomatic(bool bNew) { bAutomatic = bNew; } /** *=operator to allow usage from BColor, too */ diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index 8f1bd634fd58..79b07018c384 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 @@ -159,6 +160,9 @@ public: bool getPixelSnapHairline() const; void setPixelSnapHairline(bool bNew); + Color getAutoColor() const; + void setAutoColor(Color aNew); + static void setGlobalAntiAliasing(bool bAntiAliasing, bool bTemporary); static bool getGlobalAntiAliasing(); static void forwardPixelSnapHairline(bool bPixelSnapHairline); diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 8ab35445893f..898524ac14a4 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -420,7 +420,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 c777d069eaf2..005f90f3c97d 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> @@ -216,6 +218,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;