diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-07-26 14:12:53 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-19 10:18:20 +0200 |
commit | 4532845e22c10f252840887e55002307227b2390 (patch) | |
tree | 741de848b9080b867a0042617a4c38b70b419630 | |
parent | d76b06da2eae5a8d62761ad95c92295cddd7b440 (diff) |
sw_redlinehide_2: add *another* flag to DocumentRedlineManager
Sadly the SwRootFrame is created too late, so we have to store the
"ShowRedlineChanges" value that is imported from ODF settings.xml
somewhere, and we can't store it in SfxBaseModel::setViewData() because
it's not in "Views" map.
Change-Id: I30eefcb0262048f7141a719917aff77182765946
-rw-r--r-- | sw/source/core/inc/DocumentRedlineManager.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/newfrm.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 10 |
3 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx index 9a3bd2cbd6ab..518c7e601643 100644 --- a/sw/source/core/inc/DocumentRedlineManager.hxx +++ b/sw/source/core/inc/DocumentRedlineManager.hxx @@ -122,6 +122,8 @@ public: void checkRedlining(RedlineFlags& _rReadlineMode); + bool IsHideRedlines() const { return m_bHideRedlines; } + void SetHideRedlines(bool const bHideRedlines) { m_bHideRedlines = bHideRedlines; } virtual ~DocumentRedlineManager() override; @@ -141,6 +143,10 @@ private: sal_uInt16 mnAutoFormatRedlnCommentNo; /**< SeqNo for conjoining of AutoFormat-Redlines. by the UI. Managed by SwAutoFormat! */ css::uno::Sequence <sal_Int8 > maRedlinePasswd; + + /// this flag is necessary for file import because the ViewShell/layout is + /// created "too late" and the ShowRedlineChanges item is not below "Views" + bool m_bHideRedlines = false; }; } diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index e5dffd9ba05f..7a5ff2ac591c 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -41,6 +41,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <DocumentLayoutManager.hxx> +#include <DocumentRedlineManager.hxx> #include <ndindex.hxx> SwLayVout *SwRootFrame::s_pVout = nullptr; @@ -354,7 +355,7 @@ SwRootFrame::SwRootFrame( SwFrameFormat *pFormat, SwViewShell * pSh ) : mbIsNewLayout( true ), mbCallbackActionEnabled ( false ), mbLayoutFreezed ( false ), - mbHideRedlines( false ), + mbHideRedlines(pFormat->GetDoc()->GetDocumentRedlineManager().IsHideRedlines()), mnBrowseWidth(MIN_BROWSE_WIDTH), mpTurbo( nullptr ), mpLastPage( nullptr ), diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 70ddb6a53487..0dab7e4cedc3 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -59,6 +59,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> +#include <DocumentRedlineManager.hxx> #include <docary.hxx> #include <docsh.hxx> #include <unotextrange.hxx> @@ -899,7 +900,14 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con // tdf#83260 ensure that the first call of CompressRedlines after loading // the document is a no-op by calling it now rDoc.getIDocumentRedlineAccess().CompressRedlines(); - rDoc.getIDocumentRedlineAccess().SetRedlineFlags( nRedlineFlags ); + if (getenv("SW_REDLINEHIDE")) + { // can't set it on the layout or view shell because it doesn't exist yet + rDoc.GetDocumentRedlineManager().SetHideRedlines(!(nRedlineFlags & RedlineFlags::ShowDelete)); + } + else + { + rDoc.getIDocumentRedlineAccess().SetRedlineFlags(nRedlineFlags); + } lcl_EnsureValidPam( rPaM ); // move Pam into valid content |