officecfg/registry/schema/org/openoffice/Office/Writer.xcs |    8 ++++
 sw/source/uibase/config/usrpref.cxx                        |    7 ++--
 sw/source/uibase/uiview/view.cxx                           |   22 ++++++++++++-
 3 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 5b07acbf3345918f450fccf7ee243ad5bcb3fd67
Author:     Dhiraj Holden <dhiraj.hol...@gmail.com>
AuthorDate: Tue Dec 7 08:16:59 2021 -0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jan 17 07:33:18 2022 +0100

    tdf#142450 add code to store showing whitespace
    
    I have put in code to store the option to show whitespace.
    This option is stored at the document level like the other
    layout options.
    
    Change-Id: I26989da2714f884a5a4d5ced3329ff669771fe7a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126497
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index af944c23c03f..c68dac23d988 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -1618,6 +1618,14 @@
           </info>
           <value>false</value>
         </prop>
+        <prop oor:name="HideWhitespace" oor:type="xs:boolean" 
oor:nillable="false">
+          <!-- UIHints: View - Show Whitespace -->
+          <info>
+            <desc>Specifies whether to hide whitespace.</desc>
+            <label>View Layout Hide Whitespace</label>
+          </info>
+          <value>false</value>
+        </prop>
       </group>
     </group>
     <group oor:name="Grid">
diff --git a/sw/source/uibase/config/usrpref.cxx 
b/sw/source/uibase/config/usrpref.cxx
index e0949660471d..ed33926492eb 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -271,9 +271,10 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() 
const
         "ViewLayout/BookMode",                  //17
         "Other/IsSquaredPageMode",              //18
         "Other/ApplyCharUnit",                  //19
-        "Window/ShowScrollBarTips"              //20
+        "Window/ShowScrollBarTips",             //20
+        "ViewLayout/HideWhitespace",            //21
     };
-    const int nCount = m_bWeb ? 14 : 21;
+    const int nCount = m_bWeb ? 14 : 22;
     Sequence<OUString> aNames(nCount);
     OUString* pNames = aNames.getArray();
     for(int i = 0; i < nCount; i++)
@@ -336,6 +337,7 @@ void SwLayoutViewConfig::ImplCommit()
             case 18: rVal <<= m_rParent.IsSquaredPageMode(); break;            
       // "Other/IsSquaredPageMode",
             case 19: rVal <<= m_rParent.IsApplyCharUnit(); break;              
       // "Other/ApplyCharUnit",
             case 20: rVal <<= m_rParent.IsShowScrollBarTips(); break;          
       // "Window/ShowScrollBarTips",
+            case 21: rVal <<= m_rParent.IsHideWhitespaceMode(); break;         
       // "ViewLayout/HideWhitespace"
         }
     }
     PutProperties(aNames, aValues);
@@ -392,6 +394,7 @@ void SwLayoutViewConfig::Load()
                 case 18: m_rParent.SetDefaultPageMode(bSet,true); break;// 
"Other/IsSquaredPageMode",
                 case 19: m_rParent.SetApplyCharUnit(bSet, true); break;// 
"Other/ApplyUserChar"
                 case 20: m_rParent.SetShowScrollBarTips(bSet); break;// 
"Window/ShowScrollBarTips",
+                case 21: m_rParent.SetHideWhitespaceMode(bSet); break;// 
"ViewLayout/HideWhitespace"
             }
         }
     }
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index aa0a4738ee55..7500f740369b 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1318,6 +1318,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < 
beans::PropertyValue >
     sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
     bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
     sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
+    bool bHideWhitespace = pVOpt->IsHideWhitespaceMode();
 
     bool bSelectedFrame = ( m_pWrtShell->GetSelFrameType() != 
FrameTypeFlags::NONE ),
              bGotVisibleLeft = false,
@@ -1325,6 +1326,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < 
beans::PropertyValue >
              bGotVisibleBottom = false, bGotZoomType = false,
              bGotZoomFactor = false, bGotIsSelectedFrame = false,
              bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
+             bGotHideWhitespace = false,
              bBrowseMode = false, bGotBrowseMode = false;
     bool bKeepRatio = pVOpt->IsKeepRatio();
     bool bGotKeepRatio = false;
@@ -1400,6 +1402,11 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
             rValue.Value >>= bKeepRatio;
             bGotKeepRatio = true;
         }
+        else if (rValue.Name == "HideWhitespace")
+        {
+            rValue.Value >>= bHideWhitespace;
+            bGotHideWhitespace = true;
+        }
         // Fallback to common SdrModel processing
         else
            
GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(&rValue);
@@ -1476,11 +1483,21 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
         m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
     }
 
+    SwViewOption aUsrPref(*pVOpt);
+    bool bUsrPrefModified = false;
     if (bGotKeepRatio && bKeepRatio != pVOpt->IsKeepRatio())
     {
         // Got a custom value, then it makes sense to trigger notifications.
-        SwViewOption aUsrPref(*pVOpt);
         aUsrPref.SetKeepRatio(bKeepRatio);
+        bUsrPrefModified = true;
+    }
+    if (bGotHideWhitespace && bHideWhitespace != pVOpt->IsHideWhitespaceMode())
+    {
+        aUsrPref.SetHideWhitespaceMode(bHideWhitespace);
+        bUsrPrefModified = true;
+    }
+    if (bUsrPrefModified)
+    {
         SW_MOD()->ApplyUsrPref(aUsrPref, this);
     }
 
@@ -1585,6 +1602,9 @@ void SwView::WriteUserDataSequence ( uno::Sequence < 
beans::PropertyValue >& rSe
     aVector.push_back(
         comphelper::makePropertyValue("KeepRatio", 
m_pWrtShell->GetViewOptions()->IsKeepRatio()));
 
+    aVector.push_back(comphelper::makePropertyValue(
+        "HideWhitespace", 
m_pWrtShell->GetViewOptions()->IsHideWhitespaceMode()));
+
     rSequence = comphelper::containerToSequence(aVector);
 
     // Common SdrModel processing

Reply via email to