diff options
-rw-r--r-- | svx/qa/unit/unodraw.cxx | 33 | ||||
-rw-r--r-- | svx/source/unodraw/unoshtxt.cxx | 12 |
2 files changed, 33 insertions, 12 deletions
diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index d31bba03eb77..f4b727e5a938 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/ControlCharacter.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> @@ -177,6 +178,38 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect) // which has no shadow for cell text (only for cell borders and cell background). assertXPath(pDocument, "//shadow//sdrblocktext", /*nNumberOfNodes=*/0); } + +CPPUNIT_TEST_FIXTURE(UnodrawTest, testTitleShapeBullets) +{ + // Create a title shape with 2 paragraphs in it. + mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); + uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPages> xDrawPages = xSupplier->getDrawPages(); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY); + // A default document contains a title shape and a text shape on the first slide. + uno::Reference<drawing::XShape> xTitleShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<lang::XServiceInfo> xTitleShapeInfo(xTitleShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xTitleShapeInfo->supportsService("com.sun.star.presentation.TitleTextShape")); + uno::Reference<text::XTextRange> xTitleShapeText(xTitleShape, uno::UNO_QUERY); + uno::Reference<text::XText> xText = xTitleShapeText->getText(); + uno::Reference<text::XTextRange> xCursor = xText->createTextCursor(); + xText->insertString(xCursor, "foo", /*bAbsorb=*/false); + xText->insertControlCharacter(xCursor, text::ControlCharacter::APPEND_PARAGRAPH, + /*bAbsorb=*/false); + xText->insertString(xCursor, "bar", /*bAbsorb=*/false); + + // Check that the title shape has 2 paragraphs. + uno::Reference<container::XEnumerationAccess> xTextEA(xText, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xTextE = xTextEA->createEnumeration(); + // Has a first paragraph. + CPPUNIT_ASSERT(xTextE->hasMoreElements()); + xTextE->nextElement(); + // Has a second paragraph. + // Without the accompanying fix in place, this test would have failed, because the 2 paragraphs + // were merged together (e.g. 1 bullet instead of 2 bullets for bulleted paragraphs). + CPPUNIT_ASSERT(xTextE->hasMoreElements()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index adabc3c061ec..a8bbece64e65 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -776,18 +776,6 @@ void SvxTextEditSourceImpl::UpdateData() { if( mpOutliner->GetParagraphCount() != 1 || mpOutliner->GetEditEngine().GetTextLen( 0 ) ) { - if( mpOutliner->GetParagraphCount() > 1 ) - { - if (pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_TITLETEXT) - { - while( mpOutliner->GetParagraphCount() > 1 ) - { - ESelection aSel( 0,mpOutliner->GetEditEngine().GetTextLen( 0 ), 1,0 ); - mpOutliner->QuickInsertLineBreak( aSel ); - } - } - } - pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText ); } else |