[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4b' - 7 commits - sw/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 21:41:25 UTC 2018


Rebased ref, commits from common ancestor:
commit f03da46aaaf234f8221fcb86911738ef3d231090
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 17 22:37:32 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:52 2018 +0100

    Revert "HACK: ODF import: always hide redlines"
    
    This reverts commit da23ebcb675ce57d84bb02a3db04751b8988afa9.

diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 60c8445d59b0..138dc19981c8 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -856,11 +856,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode ||
           m_aOption.IsFormatsOnly() ||
             // sw_redlinehide: disable layout cache for now
-#if 0
           !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))))
-#else
-          true))
-#endif
     {
         try
         {
@@ -893,10 +889,8 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     // restore redline mode from import info property set
     RedlineFlags nRedlineFlags = RedlineFlags::ShowInsert;
     aAny = xInfoSet->getPropertyValue( sShowChanges );
-#if 0
     if ( *o3tl::doAccess<bool>(aAny) )
         nRedlineFlags |= RedlineFlags::ShowDelete;
-#endif
     aAny = xInfoSet->getPropertyValue( sRecordChanges );
     if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
         nRedlineFlags |= RedlineFlags::On;
commit 51afbd862d42e3637fe400203ef10378fb8bd019
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 30 18:00:19 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:51 2018 +0100

    HACK: ODF import: always hide redlines
    
    Change-Id: I275c6738943ee0d74ccacea69af1c1f4c9ede1df

diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 138dc19981c8..60c8445d59b0 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -856,7 +856,11 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode ||
           m_aOption.IsFormatsOnly() ||
             // sw_redlinehide: disable layout cache for now
+#if 0
           !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))))
+#else
+          true))
+#endif
     {
         try
         {
@@ -889,8 +893,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     // restore redline mode from import info property set
     RedlineFlags nRedlineFlags = RedlineFlags::ShowInsert;
     aAny = xInfoSet->getPropertyValue( sShowChanges );
+#if 0
     if ( *o3tl::doAccess<bool>(aAny) )
         nRedlineFlags |= RedlineFlags::ShowDelete;
+#endif
     aAny = xInfoSet->getPropertyValue( sRecordChanges );
     if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
         nRedlineFlags |= RedlineFlags::On;
commit 0f26e42214fb628903a7f2caac8c6c1b0c9bd0e8
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 30 17:54:41 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:51 2018 +0100

    sw_redlinehide: make layout based Show/Hide mode the default
    
    remove ExperimentalMode checks
    
    Change-Id: Ie098eda0840bbd3231696cae43cc572ad61379fc

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index dcfe450037a1..130d67cfb396 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2272,21 +2272,14 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const &
                          m_pDoc->GetDocShell() );
     }
 
-    uno::Reference<uno::XComponentContext> const xContext(
-            comphelper::getProcessComponentContext());
-    bool const isExp(officecfg::Office::Common::Misc::ExperimentalMode::get(xContext));
     RedlineFlags eRedlMode = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
     if( m_aFlags.bWithRedlining )
     {
         m_pDoc->SetAutoFormatRedline( true );
-        eRedlMode = isExp
-            ? RedlineFlags::On | (eOldMode & RedlineFlags::ShowMask)
-            : RedlineFlags::On | RedlineFlags::ShowInsert;
+        eRedlMode = RedlineFlags::On | (eOldMode & RedlineFlags::ShowMask);
     }
     else
-      eRedlMode = isExp
-          ? RedlineFlags::Ignore | (eOldMode & RedlineFlags::ShowMask)
-          : RedlineFlags::ShowInsert | RedlineFlags::Ignore;
+      eRedlMode = RedlineFlags::Ignore | (eOldMode & RedlineFlags::ShowMask);
     m_pDoc->getIDocumentRedlineAccess().SetRedlineFlags( eRedlMode );
 
     // save undo state (might be turned off)
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index cec28a9b596a..d78e7e6b4849 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -344,19 +344,12 @@ XMLRedlineImportHelper::~XMLRedlineImportHelper()
         aAny <<= bShowChanges;
         if ( bHandleShowChanges )
         {
-            if (!utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Misc::ExperimentalMode::get(comphelper::getProcessComponentContext()))
-            {
-                aAny <<= true;
-                xModelPropertySet->setPropertyValue( g_sShowChanges, aAny );
-                // TODO maybe we need some property for the view-setting?
-                SwDoc *const pDoc(SwImport::GetDocFromXMLImport(m_rImport));
-                assert(pDoc);
-                pDoc->GetDocumentRedlineManager().SetHideRedlines(!bShowChanges);
-            }
-            else
-            {
-                xModelPropertySet->setPropertyValue( g_sShowChanges, aAny );
-            }
+            aAny <<= true;
+            xModelPropertySet->setPropertyValue( g_sShowChanges, aAny );
+            // TODO maybe we need some property for the view-setting?
+            SwDoc *const pDoc(SwImport::GetDocFromXMLImport(m_rImport));
+            assert(pDoc);
+            pDoc->GetDocumentRedlineManager().SetHideRedlines(!bShowChanges);
         }
         else
             xImportInfoPropertySet->setPropertyValue( g_sShowChanges, aAny );
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index f36ffb47a147..138dc19981c8 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -856,8 +856,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode ||
           m_aOption.IsFormatsOnly() ||
             // sw_redlinehide: disable layout cache for now
-          (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext) &&
-            !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges)))))
+          !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))))
     {
         try
         {
@@ -905,14 +904,8 @@ 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();
-    if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
-    {   // 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);
-    }
+    // can't set it on the layout or view shell because it doesn't exist yet
+    rDoc.GetDocumentRedlineManager().SetHideRedlines(!(nRedlineFlags & RedlineFlags::ShowDelete));
 
     lcl_EnsureValidPam( rPaM ); // move Pam into valid content
 
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 34e51e8f2ed9..495cd765aaa3 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -165,7 +165,6 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
 
     xInfoSet->setPropertyValue( "TargetStorage", Any( xStg ) );
 
-    uno::Any aAny;
     if (m_bShowProgress)
     {
         // set progress range and start status indicator
@@ -188,15 +187,9 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
     RedlineFlags const nOrigRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
     RedlineFlags nRedlineFlags(nOrigRedlineFlags);
     bool isShowChanges;
-    if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
-    {   // TODO: ideally this would be stored per-view...
-        SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
-        isShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines();
-    }
-    else
-    {
-        isShowChanges = IDocumentRedlineAccess::IsShowChanges(nRedlineFlags);
-    }
+    // TODO: ideally this would be stored per-view...
+    SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+    isShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines();
     xInfoSet->setPropertyValue(sShowChanges, makeAny(isShowChanges));
     // ... and hide redlines for export
     nRedlineFlags &= ~RedlineFlags::ShowMask;
@@ -415,19 +408,10 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
     xObjectResolver = nullptr;
 
     // restore redline mode
-    aAny = xInfoSet->getPropertyValue( sShowChanges );
     nRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
     nRedlineFlags &= ~RedlineFlags::ShowMask;
     nRedlineFlags |= RedlineFlags::ShowInsert;
-    if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
-    {
-        nRedlineFlags |= nOrigRedlineFlags & RedlineFlags::ShowMask;
-    }
-    else
-    {
-        if (*o3tl::doAccess<bool>(aAny))
-            nRedlineFlags |= RedlineFlags::ShowDelete;
-    }
+    nRedlineFlags |= nOrigRedlineFlags & RedlineFlags::ShowMask;
     m_pDoc->getIDocumentRedlineAccess().SetRedlineFlags( nRedlineFlags );
 
     if (xStatusIndicator.is())
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 0fd2296e97e8..3e408bed91bb 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -278,15 +278,8 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
         }
     }
     RedlineFlags nRedlineFlags = RedlineFlags::NONE;
-    if (officecfg::Office::Common::Misc::ExperimentalMode::get(getComponentContext()))
-    {
-        SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
-        m_bSavedShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines();
-    }
-    else
-    {
-        m_bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
-    }
+    SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+    m_bSavedShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines();
     if( bSaveRedline )
     {
         // now save and switch redline mode
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 4de245a22243..1116f863b2a0 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -653,17 +653,10 @@ void SwView::Execute(SfxRequest &rReq)
                 if( static_cast<const SfxBoolItem*>(pItem)->GetValue() )
                     nMode |= RedlineFlags::ShowDelete;
 
-                uno::Reference<uno::XComponentContext> const xContext(
-                        comphelper::getProcessComponentContext());
-                if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
-                {
-                    m_pWrtShell->GetLayout()->SetHideRedlines(
-                        !static_cast<const SfxBoolItem*>(pItem)->GetValue());
-                    if (m_pWrtShell->IsRedlineOn())
-                        m_pWrtShell->SetInsMode();
-                }
-                else
-                    m_pWrtShell->SetRedlineFlagsAndCheckInsMode( nMode );
+                m_pWrtShell->GetLayout()->SetHideRedlines(
+                    !static_cast<const SfxBoolItem*>(pItem)->GetValue());
+                if (m_pWrtShell->IsRedlineOn())
+                    m_pWrtShell->SetInsMode();
             }
             break;
         case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index 38ffb27df5da..909ba9a67225 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -284,12 +284,7 @@ void SwView::GetState(SfxItemSet &rSet)
             {
                 uno::Reference<uno::XComponentContext> const xContext(
                         comphelper::getProcessComponentContext());
-                if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
-                {
-                    rSet.Put(SfxBoolItem(nWhich, !m_pWrtShell->GetLayout()->IsHideRedlines()));
-                }
-                else
-                    rSet.Put( SfxBoolItem( nWhich, IDocumentRedlineAccess::IsShowChanges(m_pWrtShell->GetRedlineFlags()) ));
+                rSet.Put(SfxBoolItem(nWhich, !m_pWrtShell->GetLayout()->IsHideRedlines()));
             }
             break;
             case SID_AVMEDIA_PLAYER :
commit 389cbe77ba9d68054a21051c01878bca67c0f3c3
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Dec 5 16:37:18 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:51 2018 +0100

    sw_redlinehide_4b: temporarily add an assert that is wrong
    
    This assert is wrong, because there may be a legimate need to query
    a position that is currently hidden.
    
    However, oddly enough, we haven't found a legitimate document yet that
    triggers this, and it has pointed us to several interesting functions
    that needed adapting to merged frames... so keep it a little while and
    remove it (and return something other than COMPLETE_STRING from mapping
    functions) later...
    
    Change-Id: Ide2abf0c2ce054b75c917063a5d5aa8d13430426

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 7b6411163cb3..c756aedf4cd2 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -267,6 +267,7 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
 
         bool bGoOn = true;
         TextFrameIndex const nOffset = MapModelToViewPos(rPos);
+        assert(nOffset != TextFrameIndex(COMPLETE_STRING)); // not going to end well
         TextFrameIndex nNextOfst;
 
         do
commit ddf873942393b43ea328a1c5ba47dac96d2ab50a
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 17 21:46:13 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:51 2018 +0100

    sw_redlinehide_4b: ODF export: restore previous redline show flags
    
    There's a test for that, testRedlineFlags() in sw_globalfilter
    
    Change-Id: I9c821732910298d74271d95f0bfd0e902af84dbd

diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 0d5e53d4c319..34e51e8f2ed9 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -185,7 +185,8 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
 
     // save show redline mode ...
     const OUString sShowChanges("ShowChanges");
-    RedlineFlags nRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
+    RedlineFlags const nOrigRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
+    RedlineFlags nRedlineFlags(nOrigRedlineFlags);
     bool isShowChanges;
     if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
     {   // TODO: ideally this would be stored per-view...
@@ -420,7 +421,7 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
     nRedlineFlags |= RedlineFlags::ShowInsert;
     if (officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
     {
-        nRedlineFlags |= RedlineFlags::ShowDelete;
+        nRedlineFlags |= nOrigRedlineFlags & RedlineFlags::ShowMask;
     }
     else
     {
commit ed22750ec30c3aa7cdd78f91cc97bb39d9ac36d1
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 17 19:39:22 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:51 2018 +0100

    sw_redlinehide_4b: export flag to flat-ODF
    
    Change-Id: Ief227f3f5b03ec186178f4d68c3a415969d65507

diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 4887e14075fb..0fd2296e97e8 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/xforms/XFormsSupplier.hpp>
 
 #include <o3tl/any.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <sax/tools/converter.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
@@ -46,6 +47,7 @@
 #include <swmodule.hxx>
 #include <docsh.hxx>
 #include <viewsh.hxx>
+#include <rootfrm.hxx>
 #include <docstat.hxx>
 #include <swerror.h>
 #include <unotext.hxx>
@@ -276,7 +278,15 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
         }
     }
     RedlineFlags nRedlineFlags = RedlineFlags::NONE;
-    m_bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
+    if (officecfg::Office::Common::Misc::ExperimentalMode::get(getComponentContext()))
+    {
+        SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+        m_bSavedShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines();
+    }
+    else
+    {
+        m_bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
+    }
     if( bSaveRedline )
     {
         // now save and switch redline mode
commit d8807484b9eeb46624ad523ee4ea2367124560d7
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 17 19:16:05 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Dec 17 22:40:44 2018 +0100

    sw_redlinehide_4b: xmloff: destroy TextImportHelper before Model
    
    nullpointer in ~XMLRedlineImportHelper in
    SwUiWriterTest::testThreadedException()
    
    Change-Id: Ic4a79ceffa831aced4db47836333a15a13773887

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index d68a9debcfc2..556e39299454 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -431,6 +431,7 @@ void SvXMLImport::cleanup() throw ()
             pStylesContext->Clear();
         maContexts.pop();
     }
+    mxTextImport.clear(); // XMLRedlineImportHelper needs model
     DisposingModel();
 }
 


More information about the Libreoffice-commits mailing list