[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4a' - 2 commits - sw/source sw/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 23 17:56:06 UTC 2018
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 <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 23 18:02:49 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
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 <IDocumentUndoRedo.hxx>
#include <DocumentRedlineManager.hxx>
#include <IDocumentStylePoolAccess.hxx>
+#include <redline.hxx>
+#include <unocrsr.hxx>
#include <docary.hxx>
#include <editsh.hxx>
#include <index.hxx>
@@ -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<std::shared_ptr<SwUnoCursor>> & rRanges,
+ SwDoc & rDoc, SwPaM const& rDelPam)
+{
+ bool isNoRedline(true);
+ SwRedlineTable::size_type tmp;
+ IDocumentRedlineAccess const& rIDRA(rDoc.getIDocumentRedlineAccess());
+ rIDRA.GetRedline(*rDelPam.Start(), &tmp);
+ 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<std::shared_ptr<SwUnoCursor>> 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 = &rDelPam;
+ SwPaM* pNext = &rPamToCorrect;
do {
p = pNext;
pNext = p->GetNext();
- p->MoveTo( &rDelPam );
+ p->MoveTo( &rPamToCorrect );
} while( p != pPrev );
m_aNdIdx = aTmp.GetPoint()->nNode;
commit cc5d238e74e588aab4bd3dea696acacf904b744d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 23 14:14:17 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
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 @@
<requires lib="gtk+" version="3.18"/>
<object class="GtkMessageDialog" id="QueryRedlineDialog">
<property name="can_focus">False</property>
- <property name="title" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">Delete this theme?</property>
+ <property name="title" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">AutoCorrect</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
More information about the Libreoffice-commits
mailing list