svx/source/dialog/pagectrl.cxx    |   12 +++++-------
 sw/source/ui/frmdlg/column.cxx    |    1 +
 sw/source/uibase/frmdlg/colex.cxx |   25 ++++---------------------
 sw/source/uibase/inc/colex.hxx    |    4 +++-
 4 files changed, 13 insertions(+), 29 deletions(-)

New commits:
commit 47ef490e4244dc804502729b8c29206bf841f02b
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Tue Jun 3 11:02:40 2025 +0200
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Tue Jun 3 13:35:41 2025 +0200

    Resolves tdf#132286, Related 165604 - Page/Column Preview
    
    Blank background showing the margins correctly
    and feedback for column line color (columns dialog only)
    
    Change-Id: I9f2a277e91ed7644d90cc12a5f1bfd0f4e97e0fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186141
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 1002a1ca21b6..1bf5bc0b395b 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -105,11 +105,11 @@ void SvxPageWindow::Paint(vcl::RenderContext& 
rRenderContext, const tools::Recta
             aSz = rRenderContext.PixelToLogic(GetOutputSizePixel());
             nYPos = (aSz.Height() - aSize.Height()) / 2;
             tools::Long nXPos = (aSz.Width() - aSize.Width()) / 2;
-            DrawPage(rRenderContext, Point(nXPos,nYPos),true,true);
+            DrawPage(rRenderContext, Point(nXPos,nYPos),false,true);
         }
         else
             // Portrait
-            DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 
2,nYPos),true,true);
+            DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 
2,nYPos),false,true);
     }
     else
     {
@@ -125,7 +125,7 @@ void SvxPageWindow::Paint(vcl::RenderContext& 
rRenderContext, const tools::Recta
 void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& 
rOrg, const bool bSecond, const bool bEnabled)
 {
     const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
-    const Color& rFieldColor = rStyleSettings.GetFieldColor();
+    const Color& rFieldColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
     const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor();
     const Color& rDisableColor = rStyleSettings.GetDisableColor();
     const Color& rDlgColor = rStyleSettings.GetDialogColor();
@@ -142,6 +142,7 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& 
rRenderContext, const Point& rO
             bResetBackground = false;
     }
     rRenderContext.SetLineColor(rFieldTextColor);
+    rRenderContext.SetTextColor(COL_GRAY);
 
     // Shadow
     Size aTempSize = aSize;
@@ -178,13 +179,10 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& 
rRenderContext, const Point& rO
 
     if (bHeader || bFooter)
     {
-        // Header and/or footer used
-        const Color aLineColor(rRenderContext.GetLineColor());
-
         // draw PageFill first and on the whole page, no outline
         rRenderContext.SetLineColor();
         drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect);
-        rRenderContext.SetLineColor(aLineColor);
+        rRenderContext.SetLineColor(COL_GRAY);
 
         if (bHeader)
         {
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 55872553ee98..2dad1a1df3fc 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -725,6 +725,7 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, 
weld::MetricSpinButton&, void )
         if(m_bFrame)
         {
             m_aFrameExampleWN.SetColumns(m_xColMgr->GetColumns());
+            m_aFrameExampleWN.SetLineColor(m_xColMgr->GetLineColor());
             m_aFrameExampleWN.Invalidate();
         }
         else
diff --git a/sw/source/uibase/frmdlg/colex.cxx 
b/sw/source/uibase/frmdlg/colex.cxx
index e0aaed8904f1..6ddde5ecaabc 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -210,18 +210,6 @@ void SwColExample::DrawPage(vcl::RenderContext& 
rRenderContext, const Point& rOr
     rRenderContext.DrawRect(aRect);
 
     const tools::Rectangle aDefineRect(aRect);
-    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& 
rFillAttributes = getPageFillAttributes();
-
-    if (!rFillAttributes || !rFillAttributes->isUsed())
-    {
-        // If there is no fill, use fallback color
-        const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
-        const Color& rFieldColor = rStyleSettings.GetFieldColor();
-
-        setPageFillAttributes(
-            
std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(
-                rFieldColor));
-    }
 
     // #97495# make sure that the automatic column width's are always equal
     bool bAutoWidth = m_pColMgr->IsAutoWidth();
@@ -326,6 +314,7 @@ SwColumnOnlyExample::SwColumnOnlyExample()
 void SwColumnOnlyExample::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& /*rRect*/)
 {
     rRenderContext.Push(vcl::PushFlags::MAPMODE);
+    rRenderContext.Erase();
 
     Fraction aScale(m_aWinSize.Height(), m_aFrameSize.Height());
     MapMode aMapMode(MapUnit::MapTwip);
@@ -334,12 +323,9 @@ void SwColumnOnlyExample::Paint(vcl::RenderContext& 
rRenderContext, const tools:
     rRenderContext.SetMapMode(aMapMode);
 
     const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
-    const Color& rFieldColor = rStyleSettings.GetFieldColor();
     const Color& rDlgColor = rStyleSettings.GetDialogColor();
     const Color& rFieldTextColor = 
SwViewOption::GetCurrentViewOptions().GetFontColor();
-    Color aGrayColor(COL_LIGHTGRAY);
-    if (rFieldColor == aGrayColor)
-        aGrayColor.Invert();
+    const Color& rDocColor = 
SwViewOption::GetCurrentViewOptions().GetDocColor();
 
     Size aLogSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
     tools::Rectangle aCompleteRect(Point(0,0), aLogSize);
@@ -358,11 +344,10 @@ void SwColumnOnlyExample::Paint(vcl::RenderContext& 
rRenderContext, const tools:
     aShadowRect.Move(aTL.Y(), aTL.Y());
     rRenderContext.DrawRect(aShadowRect);
 
-    rRenderContext.SetFillColor(rFieldColor);
+    rRenderContext.SetFillColor(rDocColor);
+    rRenderContext.SetLineColor(m_aLineColor);
     rRenderContext.DrawRect(aRect);
 
-    rRenderContext.SetFillColor(aGrayColor);
-
     //column separator?
     tools::Long nLength = aLogSize.Height() - 2 * aTL.Y();
     Point aUp(aTL);
@@ -394,8 +379,6 @@ void SwColumnOnlyExample::Paint(vcl::RenderContext& 
rRenderContext, const tools:
     sal_uInt16 nColCount = rCols.size();
     if (nColCount)
     {
-        rRenderContext.DrawRect(aRect);
-        rRenderContext.SetFillColor(rFieldColor);
         tools::Rectangle aFrameRect(aTL, m_aFrameSize);
         tools::Long nSum = aTL.X();
         for (sal_uInt16 i = 0; i < nColCount; i++)
diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx
index 2abe4429825e..06578f8ce4d0 100644
--- a/sw/source/uibase/inc/colex.hxx
+++ b/sw/source/uibase/inc/colex.hxx
@@ -88,6 +88,7 @@ private:
 
     Size        m_aFrameSize;
     SwFormatCol    m_aCols;
+    Color m_aLineColor;
 
     virtual void Resize() override;
     virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
@@ -95,7 +96,8 @@ private:
 public:
     SwColumnOnlyExample();
 
-    void        SetColumns(const SwFormatCol& rCol);
+    void SetColumns(const SwFormatCol& rCol);
+    void SetLineColor(const Color& rColor) { m_aLineColor = rColor; };
 
     virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
 };

Reply via email to