diff options
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 49 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 21 |
2 files changed, 0 insertions, 70 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 4a50e0423608..5aa4df1f0b73 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -220,7 +220,6 @@ public: void testCaretPositionMovingUp(); void testTdf93441(); void testTdf81226(); - void testTdf79717(); void testTdf137532(); void testFdo87448(); void testTextCursorInvalidation(); @@ -341,7 +340,6 @@ public: CPPUNIT_TEST(testCaretPositionMovingUp); CPPUNIT_TEST(testTdf93441); CPPUNIT_TEST(testTdf81226); - CPPUNIT_TEST(testTdf79717); CPPUNIT_TEST(testTdf137532); CPPUNIT_TEST(testFdo87448); CPPUNIT_TEST(testTextCursorInvalidation); @@ -1657,53 +1655,6 @@ void SwUiWriterTest::testTdf81226() CPPUNIT_ASSERT_EQUAL(OUString("beforeafter"), getParagraph(1)->getString()); } -void SwUiWriterTest::testTdf79717() -{ - SwDoc* const pDoc = createSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - pWrtShell->Insert("normal"); - lcl_setWeight(pWrtShell, WEIGHT_BOLD); - pWrtShell->Insert("bold"); - pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); - // Select 'bol' and replace it - pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false); - pWrtShell->Insert("bol"); - - // Without the fix in place, 'bol' would have been replaced with normal font weight - - auto xText = getParagraph(1)->getText(); - CPPUNIT_ASSERT(xText.is()); - { - auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); - CPPUNIT_ASSERT(xCursor.is()); - CPPUNIT_ASSERT_EQUAL(OUString("normal"), xCursor->getString()); - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xCursor, "CharWeight")); - } - { - auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2))); - CPPUNIT_ASSERT(xCursor.is()); - CPPUNIT_ASSERT_EQUAL(OUString("bold"), xCursor->getString()); - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xCursor, "CharWeight")); - } - - // Now select characters from both runs and replace them - pWrtShell->EndPara(); - pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 5, /*bBasicCall=*/false); - pWrtShell->Insert("new"); - { - auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); - CPPUNIT_ASSERT(xCursor.is()); - CPPUNIT_ASSERT_EQUAL(OUString("norma"), xCursor->getString()); - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xCursor, "CharWeight")); - } - { - auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2))); - CPPUNIT_ASSERT(xCursor.is()); - CPPUNIT_ASSERT_EQUAL(OUString("new"), xCursor->getString()); - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xCursor, "CharWeight")); - } -} - void SwUiWriterTest::testTdf137532() { SwDoc* const pDoc = createSwDoc(); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index c8a3cae408fe..215cdf2980a5 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -219,11 +219,6 @@ void SwWrtShell::Insert( const OUString &rStr ) bCallIns = m_bIns /*|| bHasSel*/; bool bDeleted = false; - const auto CharItems = svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_RSID - 1, - RES_CHRATR_RSID + 1, RES_CHRATR_END - 1, - RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT>; - SfxItemSet aCharAttrSet(GetAttrPool(), CharItems); - if( bHasSel || ( !m_bIns && SelectHiddenRange() ) ) { // Only here parenthesizing, because the normal @@ -241,12 +236,6 @@ void SwWrtShell::Insert( const OUString &rStr ) aRewriter.AddRule(UndoArg3, aTmpStr); } - // tdf#79717 Save character formatting of the start of the selection - const SwPosition *pStart = GetCursor()->Start(); - SwPaM aPaM(pStart->nNode.GetNode(), pStart->nContent.GetIndex(), - pStart->nNode.GetNode(), pStart->nContent.GetIndex() + 1); - GetPaMAttr(&aPaM, aCharAttrSet); - StartUndo(SwUndoId::REPLACE, &aRewriter); bStarted = true; Push(); @@ -259,16 +248,6 @@ void SwWrtShell::Insert( const OUString &rStr ) bCallIns ? SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr ); - if( bDeleted ) - { - // tdf#79717 Restore formatting of the deleted selection - SwPosition* pEnd = GetCursor()->Start(); - SwPaM aPaM(pEnd->nNode.GetNode(), pEnd->nContent.GetIndex() - rStr.getLength(), - pEnd->nNode.GetNode(), pEnd->nContent.GetIndex()); - - SetAttrSet(aCharAttrSet, SetAttrMode::DEFAULT, &aPaM); - } - if( bStarted ) { EndUndo(); |