sw/CppunitTest_sw_uiwriter.mk | 1 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, 54 insertions(+)
New commits: commit 7c49d84d8725b3decf77334888276bcbbed5ad0f Author: LuboÅ¡ LuÅák <[email protected]> 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()). Change-Id: I88b563b88beebcd1c3cb21fe61bb56cdb12cdc41 diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index 721cbf6..62c7c4e 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ cppu \ cppuhelper \ sal \ + 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 e30db24..98bde55 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -9,6 +9,10 @@ #include <swmodeltestbase.hxx> #include <ndtxt.hxx> #include <wrtsh.hxx> +#include <docary.hxx> +#include <redline.hxx> +#include <section.hxx> +#include <fmtclds.hxx> #include "UndoManager.hxx" @@ -25,6 +29,7 @@ public: void testFdo69893(); void testFdo75110(); void testFdo75898(); + void testCp1000071(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -32,6 +37,7 @@ public: CPPUNIT_TEST(testFdo69893); CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); + CPPUNIT_TEST(testCp1000071); CPPUNIT_TEST_SUITE_END(); private: @@ -145,6 +151,45 @@ void SwUiWriterTest::testFdo69893() CPPUNIT_ASSERT_EQUAL(OUString("Para after table."), rEnd.GetTxt()); } +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 00de819..88e9ac3 100644 --- a/sw/source/core/inc/UndoSection.hxx +++ b/sw/source/core/inc/UndoSection.hxx @@ -39,6 +39,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 9a760a6..4f8bc23 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -75,6 +75,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) @@ -87,6 +88,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() ) @@ -157,6 +161,9 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext) } AddUndoRedoPaM(rContext); + + if( m_pRedlineSaveData.get()) + SetSaveData( rDoc, *m_pRedlineSaveData ); } void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext)
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
