diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter6.cxx | 69 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 38 |
2 files changed, 107 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index edfc5c153afc..316181c37cff 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -689,6 +689,75 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937) dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988) +{ + createSwDoc("tdf130088.docx"); + SwDoc* pDoc = getSwDoc(); + + // select the second word + dispatchCommand(mxComponent, ".uno:GoToNextWord", {}); + dispatchCommand(mxComponent, ".uno:SelectWord", {}); + + // enable redlining + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + + // show changes + CPPUNIT_ASSERT_MESSAGE( + "redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + + // cycle case with change tracking + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + // This was false (missing revert of the tracked change) + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSODALES")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt")); + + // tdf#141198 cycle case without selection: the word under the cursor + + dispatchCommand(mxComponent, ".uno:Escape", {}); + + dispatchCommand(mxComponent, ".uno:GoRight", {}); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSODALES")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales")); + + dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + + CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048) { createSwDoc(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 47e5b818b2fb..bac73a325a5f 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3036,6 +3036,44 @@ void DocumentContentOperationsManager::TransliterateText( return; } } + else + { + bool bHasTrackedChange = false; + IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess(); + if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) && + pEnd->GetContentIndex() > 0 ) + { + SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 1); + SwRedlineTable::size_type n = 0; + + const SwRangeRedline* pFnd = + rIDRA.GetRedlineTable().FindAtPosition( aPos, n ); + if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 ) + { + const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1]; + if ( RedlineType::Delete == pFnd2->GetType() && + m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() && + *pFnd2->End() == *pFnd->Start() && + pFnd->GetAuthor() == pFnd2->GetAuthor() ) + { + bHasTrackedChange = true; + SwPosition aPos2(*pFnd2->Start()); + rIDRA.RejectRedline(*pFnd, true); + + rIDRA.RejectRedline(*pFnd2, true); + // positionate the text cursor before the changed word to select it + if ( SwWrtShell *pWrtShell = dynamic_cast<SwWrtShell*>( + m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) ) + { + pWrtShell->GetCursor()->GetPoint()-> + Assign(*aPos2.GetContentNode(), aPos2.GetContentIndex()); + } + } + } + } + if ( bHasTrackedChange ) + return; + } bool bUseRedlining = m_rDoc.getIDocumentRedlineAccess().IsRedlineOn(); // as a workaround for a known performance problem, switch off redlining |