diff options
author | Dhiraj Holden <dhiraj.holden@gmail.com> | 2021-12-07 08:16:59 -0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-01-17 07:33:18 +0100 |
commit | 5b07acbf3345918f450fccf7ee243ad5bcb3fd67 (patch) | |
tree | 83469040b27024d4c04f82034ab07e49beb30629 /sw | |
parent | e3206e67402f623bac17ca94a20dfb45391dcb48 (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/config/usrpref.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 22 |
2 files changed, 26 insertions, 3 deletions
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 |