[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4a' - 2 commits - sw/source

2018-11-30 Thread Libreoffice Gerrit user
 sw/source/core/edit/autofmt.cxx |   11 ++-
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |   19 ++-
 sw/source/filter/xml/swxml.cxx  |   15 +--
 sw/source/filter/xml/wrtxml.cxx |   22 --
 sw/source/uibase/uiview/view2.cxx   |   15 ---
 sw/source/uibase/uiview/viewstat.cxx|7 +--
 6 files changed, 22 insertions(+), 67 deletions(-)

New commits:
commit 6be6ab406ca0338f562b0ee872a3ada51e70ee42
Author: Michael Stahl 
AuthorDate: Fri Nov 30 18:00:19 2018 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 30 18:00:19 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..5b10130d6e8f 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -889,8 +889,10 @@ ErrCode XMLReader::Read( SwDoc , const OUString& 
rBaseURL, SwPaM , con
 // restore redline mode from import info property set
 RedlineFlags nRedlineFlags = RedlineFlags::ShowInsert;
 aAny = xInfoSet->getPropertyValue( sShowChanges );
+#if 0
 if ( *o3tl::doAccess(aAny) )
 nRedlineFlags |= RedlineFlags::ShowDelete;
+#endif
 aAny = xInfoSet->getPropertyValue( sRecordChanges );
 if ( *o3tl::doAccess(aAny) || (aKey.getLength() > 0) )
 nRedlineFlags |= RedlineFlags::On;
commit ef505113d382183f17264b48e100236ac4b0318a
Author: Michael Stahl 
AuthorDate: Fri Nov 30 17:54:41 2018 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 30 17:54:41 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 7089ce157de3..048706bbce41 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2267,21 +2267,14 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, 
SvxSwAutoFormatFlags const &
  m_nEndNdIdx = m_aEndNdIdx.GetIndex(),
  m_pDoc->GetDocShell() );
 
-uno::Reference 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 ce3573b7b946..f956bbd85953 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -343,19 +343,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
+++ 

[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4a' - 2 commits - sw/source sw/uiconfig

2018-11-23 Thread Libreoffice Gerrit user
 sw/source/core/edit/autofmt.cxx  |   61 ---
 sw/uiconfig/swriter/ui/queryredlinedialog.ui |2 
 2 files changed, 57 insertions(+), 6 deletions(-)

New commits:
commit a2a046bb0d13e05215ac67dabcdcab637aa545c6
Author: Michael Stahl 
AuthorDate: Fri Nov 23 18:02:49 2018 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 23 18:02:49 2018 +0100

sw_redlinehide_4a: SwAutoFormat: manually skip redlines when deleting

Change-Id: I001e61305ee8416f851f834d3068bd91de8281f8

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index fac1e373b1bb..1fad5bd5e5b1 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -38,6 +38,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -172,6 +174,7 @@ class SwAutoFormat
 static bool HasSelBlanks( SwPaM& rPam );
 static bool HasBreakAttr( const SwTextNode& );
 void DeleteSel( SwPaM& rPam );
+void DeleteSelImpl(SwPaM & rDelPam, SwPaM & rPamToCorrect);
 bool DeleteCurNxtPara( const OUString& rNxtPara );
 /// delete in the node start and/or end
 void DeleteLeadingTrailingBlanks( bool bStart = true, bool bEnd = true );
@@ -1079,7 +1082,55 @@ void SwAutoFormat::DeleteLeadingTrailingBlanks(bool 
bStart, bool bEnd)
 }
 }
 
-void SwAutoFormat::DeleteSel( SwPaM& rDelPam )
+bool GetRanges(std::vector> & rRanges,
+SwDoc & rDoc, SwPaM const& rDelPam)
+{
+bool isNoRedline(true);
+SwRedlineTable::size_type tmp;
+IDocumentRedlineAccess const& rIDRA(rDoc.getIDocumentRedlineAccess());
+rIDRA.GetRedline(*rDelPam.Start(), );
+SwPosition const* pCurrent(rDelPam.Start());
+for ( ; tmp < rIDRA.GetRedlineTable().size(); ++tmp)
+{
+SwRangeRedline const*const pRedline(rIDRA.GetRedlineTable()[tmp]);
+if (rDelPam.End() <= pRedline->Start())
+{
+break;
+}
+if (pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE)
+{
+assert(*pRedline->Start() != *pRedline->End());
+isNoRedline = false;
+if (*pCurrent < *pRedline->Start())
+{
+rRanges.push_back(rDoc.CreateUnoCursor(*pCurrent, 
pRedline->Start()));
+}
+else
+{
+pCurrent = pRedline->End();
+}
+}
+}
+return isNoRedline;
+}
+
+void SwAutoFormat::DeleteSel(SwPaM & rDelPam)
+{
+std::vector> ranges; // need correcting cursor
+if (GetRanges(ranges, *m_pDoc, rDelPam))
+{
+DeleteSelImpl(rDelPam, rDelPam);
+}
+else
+{
+for (auto const& pCursor : ranges)
+{
+DeleteSelImpl(*pCursor, rDelPam);
+}
+}
+}
+
+void SwAutoFormat::DeleteSelImpl(SwPaM & rDelPam, SwPaM & rPamToCorrect)
 {
 if( m_aFlags.bWithRedlining )
 {
@@ -1087,18 +1138,18 @@ void SwAutoFormat::DeleteSel( SwPaM& rDelPam )
 SwPaM* pShCursor = m_pEditShell->GetCursor_();
 SwPaM aTmp( *m_pCurTextNd, 0, pShCursor );
 
-SwPaM* pPrev = rDelPam.GetPrev();
-rDelPam.GetRingContainer().merge( pShCursor->GetRingContainer() );
+SwPaM* pPrev = rPamToCorrect.GetPrev();
+rPamToCorrect.GetRingContainer().merge( pShCursor->GetRingContainer() 
);
 
 m_pEditShell->DeleteSel( rDelPam );
 
 // and remove Pam again:
 SwPaM* p;
-SwPaM* pNext = 
+SwPaM* pNext = 
 do {
 p = pNext;
 pNext = p->GetNext();
-p->MoveTo(  );
+p->MoveTo(  );
 } while( p != pPrev );
 
 m_aNdIdx = aTmp.GetPoint()->nNode;
commit cc5d238e74e588aab4bd3dea696acacf904b744d
Author: Michael Stahl 
AuthorDate: Fri Nov 23 14:14:17 2018 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 23 14:14:17 2018 +0100

sw: fix wrong title of AutoFormat with redlining dialog

(regression from 9fcef57a34dbd88a98621dfaf8668fa076dd98f1)

Change-Id: Id6ea5841dd25a30519deb825c3ae0aaa7469c250

diff --git a/sw/uiconfig/swriter/ui/queryredlinedialog.ui 
b/sw/uiconfig/swriter/ui/queryredlinedialog.ui
index 946547f6fb43..490d09a7ebbc 100644
--- a/sw/uiconfig/swriter/ui/queryredlinedialog.ui
+++ b/sw/uiconfig/swriter/ui/queryredlinedialog.ui
@@ -4,7 +4,7 @@
   
   
 False
-Delete this theme?
+AutoCorrect
 False
 True
 dialog
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits