[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sw/CppunitTest_sw_uiwriter.mk sw/qa sw/source
LuboÅ¡ LuÅák
l.lunak at collabora.com
Wed Jun 25 04:04:11 PDT 2014
sw/CppunitTest_sw_uiwriter.mk | 2 +
sw/qa/extras/uiwriter/data/cp1000071.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 45 +++++++++++++++++++++++++++++++
sw/source/core/inc/UndoSection.hxx | 1
sw/source/core/undo/unsect.cxx | 7 ++++
5 files changed, 55 insertions(+)
New commits:
commit 4f90a678a0239f72fa14d48d0275728da7adef00
Author: LuboÅ¡ LuÅák <l.lunak at collabora.com>
Date: Tue Jun 24 16:55:02 2014 +0200
fix broken redlines after undoing column count change (cp#1000071)
Changing a document with redlines to two columns and then using undo
set some redlines to point to the end of the document (done by
the call to RemoveIdxFromSection() in SwUndoInsSection::UndoImpl()).
(cherry picked from commit a531676d6ddcda78f126781ca628cc2d5fc20277)
(cherry picked from commit f511a2915ed856f048fd7dd91fd9f7537b1e0479)
Change-Id: I88b563b88beebcd1c3cb21fe61bb56cdb12cdc41
Reviewed-on: https://gerrit.libreoffice.org/9882
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk
index 54152f5..0f29e7e 100644
--- a/sw/CppunitTest_sw_uiwriter.mk
+++ b/sw/CppunitTest_sw_uiwriter.mk
@@ -20,6 +20,8 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \
cppu \
cppuhelper \
sal \
+ sfx \
+ svl \
svt \
sw \
test \
diff --git a/sw/qa/extras/uiwriter/data/cp1000071.odt b/sw/qa/extras/uiwriter/data/cp1000071.odt
new file mode 100644
index 0000000..109e399
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/cp1000071.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 3b7cfcf..6ec70b6 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -12,6 +12,10 @@
#include <crsskip.hxx>
#include <shellio.hxx>
#include <expfld.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <section.hxx>
+#include <fmtclds.hxx>
#include "UndoManager.hxx"
@@ -32,6 +36,7 @@ public:
void testFdo75110();
void testFdo75898();
void testFdo74981();
+ void testCp1000071();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -43,6 +48,7 @@ public:
CPPUNIT_TEST(testFdo75110);
CPPUNIT_TEST(testFdo75898);
CPPUNIT_TEST(testFdo74981);
+ CPPUNIT_TEST(testCp1000071);
CPPUNIT_TEST_SUITE_END();
private:
@@ -261,6 +267,45 @@ void SwUiWriterTest::testFdo74981()
CPPUNIT_ASSERT(!pTxtNode->HasHints());
}
+void SwUiWriterTest::testCp1000071()
+{
+ SwDoc* pDoc = createDoc("cp1000071.odt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ CPPUNIT_ASSERT_EQUAL( size_t( 2 ), rTbl.size());
+ sal_uLong redlineStart0NodeIndex = rTbl[ 0 ]->Start()->nNode.GetIndex();
+ sal_Int32 redlineStart0Index = rTbl[ 0 ]->Start()->nContent.GetIndex();
+ sal_uLong redlineEnd0NodeIndex = rTbl[ 0 ]->End()->nNode.GetIndex();
+ sal_Int32 redlineEnd0Index = rTbl[ 0 ]->End()->nContent.GetIndex();
+ sal_uLong redlineStart1NodeIndex = rTbl[ 1 ]->Start()->nNode.GetIndex();
+ sal_Int32 redlineStart1Index = rTbl[ 1 ]->Start()->nContent.GetIndex();
+ sal_uLong redlineEnd1NodeIndex = rTbl[ 1 ]->End()->nNode.GetIndex();
+ sal_Int32 redlineEnd1Index = rTbl[ 1 ]->End()->nContent.GetIndex();
+
+ // Change the document layout to be 2 columns, and then undo.
+ pWrtShell->SelAll();
+ SwSectionData section(CONTENT_SECTION, pWrtShell->GetUniqueSectionName());
+ SfxItemSet set( pDoc->GetDocShell()->GetPool(), RES_COL, RES_COL, 0 );
+ SwFmtCol col;
+ col.Init( 2, 0, 10000 );
+ set.Put( col );
+ pWrtShell->InsertSection( section, &set );
+ sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+ rUndoManager.Undo();
+
+ // Check that redlines are the same like at the beginning.
+ CPPUNIT_ASSERT_EQUAL( size_t( 2 ), rTbl.size());
+ CPPUNIT_ASSERT_EQUAL( redlineStart0NodeIndex, rTbl[ 0 ]->Start()->nNode.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineStart0Index, rTbl[ 0 ]->Start()->nContent.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineEnd0NodeIndex, rTbl[ 0 ]->End()->nNode.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineEnd0Index, rTbl[ 0 ]->End()->nContent.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineStart1NodeIndex, rTbl[ 1 ]->Start()->nNode.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineStart1Index, rTbl[ 1 ]->Start()->nContent.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineEnd1NodeIndex, rTbl[ 1 ]->End()->nNode.GetIndex());
+ CPPUNIT_ASSERT_EQUAL( redlineEnd1Index, rTbl[ 1 ]->End()->nContent.GetIndex());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/inc/UndoSection.hxx b/sw/source/core/inc/UndoSection.hxx
index 7252412..4c769a6 100644
--- a/sw/source/core/inc/UndoSection.hxx
+++ b/sw/source/core/inc/UndoSection.hxx
@@ -38,6 +38,7 @@ private:
const ::std::auto_ptr<SfxItemSet> m_pAttrSet;
::std::auto_ptr<SwHistory> m_pHistory;
::std::auto_ptr<SwRedlineData> m_pRedlData;
+ ::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
sal_uLong m_nSectionNodePos;
bool m_bSplitAtStart : 1;
bool m_bSplitAtEnd : 1;
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index b229aa3..2b9e19f 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -70,6 +70,7 @@ SwUndoInsSection::SwUndoInsSection(
, m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : 0 )
, m_pHistory(0)
, m_pRedlData(0)
+ , m_pRedlineSaveData(0)
, m_nSectionNodePos(0)
, m_bSplitAtStart(false)
, m_bSplitAtEnd(false)
@@ -82,6 +83,9 @@ SwUndoInsSection::SwUndoInsSection(
rDoc.GetRedlineAuthor() ));
SetRedlineMode( rDoc.GetRedlineMode() );
}
+ m_pRedlineSaveData.reset( new SwRedlineSaveDatas );
+ if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
+ m_pRedlineSaveData.reset( NULL );
if( !rPam.HasMark() )
{
@@ -151,6 +155,9 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext)
}
AddUndoRedoPaM(rContext);
+
+ if( m_pRedlineSaveData.get())
+ SetSaveData( rDoc, *m_pRedlineSaveData );
}
void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext)
More information about the Libreoffice-commits
mailing list