Kaydet (Commit) 9d9e5b40 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#78727 sw: fix missing textbox text when anchored inside flying table

It was missing as the shape text range was deleted twice, as
DelFlyInRange() thought both the fly and the draw frame format own its
contents range, while only the fly one does (when called by
SwDoc::MakeFlyAndMove(), called by SwXText::convertToTextFrame()).

Thanks Red Hat for the pizza!

Change-Id: I26e23550df085511e0e87f593f1a461057413d0e
üst 93b1279c
......@@ -204,6 +204,7 @@ public:
void testTableStyleUndo();
void testRedlineParam();
void testRedlineViewAuthor();
void testTdf78727();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
......@@ -309,6 +310,7 @@ public:
CPPUNIT_TEST(testTableStyleUndo);
CPPUNIT_TEST(testRedlineParam);
CPPUNIT_TEST(testRedlineViewAuthor);
CPPUNIT_TEST(testTdf78727);
CPPUNIT_TEST_SUITE_END();
private:
......@@ -3899,6 +3901,15 @@ void SwUiWriterTest::testRedlineViewAuthor()
CPPUNIT_ASSERT_EQUAL(aAuthor, xField->getPropertyValue("Author").get<OUString>());
}
void SwUiWriterTest::testTdf78727()
{
SwDoc* pDoc = createDoc("tdf78727.docx");
SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
// This was 1: make sure we don't loose the TextBox anchored inside the
// table that is moved inside a text frame.
CPPUNIT_ASSERT(SwTextBoxHelper::getCount(pPage) > 1);
}
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -212,7 +212,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
{
// If the Fly is deleted, all Flys in its content have to be deleted too.
const SwFormatContent &rContent = pFormat->GetContent();
if( rContent.GetContentIdx() )
// But only fly formats own their content, not draw formats.
if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
{
DelFlyInRange( *rContent.GetContentIdx(),
SwNodeIndex( *rContent.GetContentIdx()->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment