summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-06-07 18:03:33 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-06-07 18:49:07 +0200
commit02c435082058ecf7f9d4d73cb47d31d0218dc10d (patch)
tree4331d97262dc82150152d2cb93c68a2813bfcb53 /sw/source
parenta0bbeef0a8d9eeccc9ab9857851e0658139f2e1c (diff)
sw keep aspect ratio: add filter for this setting
SwViewOption::IsKeepRatio() was only in-memory, so ticking that checkbox and restarting soffice disabled it again. Handle this similar to e.g. the zoom factor which is mapped to a view-specific settings.xml key. Change-Id: I8d2de7d2c7ae0dbf34230e2011f6b07f63e02fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116791 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/uiview/view.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 5612191cc77a..7880e4fcacd8 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1316,6 +1316,8 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
bGotZoomFactor = false, bGotIsSelectedFrame = false,
bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
bBrowseMode = false, bGotBrowseMode = false;
+ bool bKeepRatio = pVOpt->IsKeepRatio();
+ bool bGotKeepRatio = false;
for (const beans::PropertyValue& rValue : rSequence)
{
@@ -1383,6 +1385,11 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
rValue.Value >>= bBrowseMode;
bGotBrowseMode = true;
}
+ else if (rValue.Name == "KeepRatio")
+ {
+ rValue.Value >>= bKeepRatio;
+ bGotKeepRatio = true;
+ }
// Fallback to common SdrModel processing
else
GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(&rValue);
@@ -1459,6 +1466,14 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
}
+ if (bGotKeepRatio && bKeepRatio != pVOpt->IsKeepRatio())
+ {
+ // Got a custom value, then it makes sense to trigger notifications.
+ SwViewOption aUsrPref(*pVOpt);
+ aUsrPref.SetKeepRatio(bKeepRatio);
+ SW_MOD()->ApplyUsrPref(aUsrPref, this);
+ }
+
// Set ViewLayoutSettings
const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
@@ -1557,6 +1572,9 @@ void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSe
aVector.push_back(comphelper::makePropertyValue("IsSelectedFrame", FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType()));
+ aVector.push_back(
+ comphelper::makePropertyValue("KeepRatio", m_pWrtShell->GetViewOptions()->IsKeepRatio()));
+
rSequence = comphelper::containerToSequence(aVector);
// Common SdrModel processing