include/svx/svdmodel.hxx                                 |    3 +++
 officecfg/registry/schema/org/openoffice/Office/Draw.xcs |    7 +++++++
 sd/source/ui/view/drawview.cxx                           |    7 +++++++
 svx/source/sdr/contact/viewcontactofsdrpage.cxx          |    7 ++++---
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx    |    5 +++--
 5 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 8b5d4c360c359adf787d466164377c05ac8f7d14
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Thu Jan 9 10:16:26 2025 +0100
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Thu Jan 16 10:24:49 2025 +0100

    Resolves tdf#164185 & tdf#89420 - Show text boundaries in Draw
    
    Show margins by default and hide per expert setting
    Draw::Misc::TextObject::ShowBoundary
    
    This patch reverts/improves I3e31bec65ab34772bd2f8137be7e5e5258758184
    
    Change-Id: I177ab0491e85aea327a512ab9d336949ddfa6e3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179995
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index a31e8d61b31a..2d7118be583f 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -250,6 +250,7 @@ private:
     // used to disable unique name checking during page move
     bool mbMakePageObjectsNamesUnique = true;
     bool m_bIsImpress = false;
+    bool m_bShowMargin = true;
 
 public:
     SVX_DLLPRIVATE virtual bool IsCreatingDataObj() const { return false; }
@@ -258,6 +259,8 @@ public:
     bool     IsPasteResize() const        { return m_bPasteResize; }
     bool     IsImpress() const { return m_bIsImpress; }
     void     SetImpress(bool bIsImpress) { m_bIsImpress = bIsImpress; };
+    bool     IsShowMargin() const { return m_bShowMargin; }
+    void     SetShowMargin(bool bShowMargin) { m_bShowMargin = bShowMargin; }
     void     SetPasteResize(bool bOn) { m_bPasteResize=bOn; }
     // If a custom Pool is put here, the class will call methods
     // on it (Put(), Remove()). On disposal of SdrModel the pool
diff --git a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
index 0cb747cf8cc2..fb9da1bdf4a7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs
@@ -339,6 +339,13 @@
           </info>
           <value>false</value>
         </prop>
+        <prop oor:name="ShowBoundary" oor:type="xs:boolean" 
oor:nillable="false">
+          <info>
+            <desc>Indicates whether margins get a virtual frame.</desc>
+            <label>Show boundary for margins</label>
+          </info>
+          <value>true</value>
+        </prop>
       </group>
       <group oor:name="CrossFading">
         <info>
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index efa3cad6a619..c6da08c44f29 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -27,6 +27,7 @@
 #include <svl/whiter.hxx>
 #include <sal/log.hxx>
 #include <tools/debug.hxx>
+#include <officecfg/Office/Draw.hxx>
 
 #include <svx/svdundo.hxx>
 #include <svx/strings.hrc>
@@ -506,6 +507,12 @@ void DrawView::CompleteRedraw(OutputDevice* pOutDev, const 
vcl::Region& rReg, sd
             }
         }
     }
+    else if( pDoc && pDoc->GetDocumentType() == DocumentType::Draw)
+    {
+        //tdf#164185 & tdf#89420
+        bool 
bShowMargin(officecfg::Office::Draw::Misc::TextObject::ShowBoundary::get());
+        pDoc->SetShowMargin(bShowMargin);
+    }
 
     ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
 }
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx 
b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index 9a1d32dc6345..a2e970e4352d 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -20,6 +20,7 @@
 #include <sdr/contact/viewcontactofsdrpage.hxx>
 #include <svx/sdr/contact/viewobjectcontact.hxx>
 #include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
 #include <sdr/contact/viewobjectcontactofsdrpage.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
@@ -346,9 +347,9 @@ void 
ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence(draw
     }
     else
     {
-        svtools::ColorConfigValue aBorderConfig = 
aColorConfig.GetColorValue(svtools::DOCBOUNDARIES);
-        aBorderColor = aBorderConfig.bIsVisible ? aBorderConfig.nColor :
-                           
aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+        const bool bShowMargin = rPage.getSdrModelFromSdrPage().IsShowMargin();
+        aBorderColor = bShowMargin ? 
aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor
+                                   : 
aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
     }
 
     // create page outer border primitive
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx 
b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 46dca806420b..b7b0e1744259 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -29,6 +29,7 @@
 #include <sdr/contact/objectcontactofobjlistpainter.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
 #include <svx/unoapi.hxx>
 #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
@@ -230,8 +231,8 @@ void 
ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& /*
             // Recursion is possible. Create a replacement primitive
             xPageContent.resize(2);
             const Color 
aDocColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
-            svtools::ColorConfigValue aBorderConfig = 
aColorConfig.GetColorValue(svtools::DOCBOUNDARIES);
-            const Color aBorderColor = aBorderConfig.bIsVisible ? 
aBorderConfig.nColor : aDocColor;
+            const bool bShowMargin = 
pPage->getSdrModelFromSdrPage().IsShowMargin();
+            const Color aBorderColor = bShowMargin ? 
aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor : aDocColor;
             const basegfx::B2DRange aPageBound(0.0, 0.0, fPageWidth, 
fPageHeight);
             basegfx::B2DPolygon 
aOutline(basegfx::utils::createPolygonFromRect(aPageBound));
 

Reply via email to