Kaydet (Commit) c20276eb authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Andras Timar

tdf#109229: Set "TextBox" prop before filling textbox-related props

Otherwise those properties aren't set, and defaults are used

Change-Id: Ib6671c019ff652ec5b59d9cbbf02a4e536a17817
Reviewed-on: https://gerrit.libreoffice.org/60267
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit c3422cd2)
Reviewed-on: https://gerrit.libreoffice.org/60297Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst ff1500df
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include <comphelper/propertysequence.hxx>
#include <swmodeltestbase.hxx> #include <swmodeltestbase.hxx>
#include <test/mtfxmldump.hxx> #include <test/mtfxmldump.hxx>
...@@ -21,6 +22,7 @@ public: ...@@ -21,6 +22,7 @@ public:
void testTdf117028(); void testTdf117028();
void testTdf117923(); void testTdf117923();
void testTdf118058(); void testTdf118058();
void testTdf117188();
CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testTdf116830); CPPUNIT_TEST(testTdf116830);
...@@ -28,6 +30,7 @@ public: ...@@ -28,6 +30,7 @@ public:
CPPUNIT_TEST(testTdf117028); CPPUNIT_TEST(testTdf117028);
CPPUNIT_TEST(testTdf117923); CPPUNIT_TEST(testTdf117923);
CPPUNIT_TEST(testTdf118058); CPPUNIT_TEST(testTdf118058);
CPPUNIT_TEST(testTdf117188);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -132,6 +135,27 @@ void SwLayoutWriter::testTdf118058() ...@@ -132,6 +135,27 @@ void SwLayoutWriter::testTdf118058()
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
} }
void SwLayoutWriter::testTdf117188()
{
createDoc("tdf117188.docx");
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({
{ "FilterName", uno::Any(OUString("writer8")) },
}));
xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
loadURL(aTempFile.GetURL(), "tdf117188.odt");
xmlDocPtr pXmlDoc = parseLayoutDump();
OUString sWidth = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "width");
OUString sHeight = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height");
// The text box must have zero border distances
assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "left", "0");
assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "top", "0");
assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "width", sWidth);
assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "height", sHeight);
}
CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -690,6 +690,15 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) ...@@ -690,6 +690,15 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
} }
} }
// Writer shapes: if this one has a TextBox, set it here. We need to do it before
// pDocStyle->FillPropertySet, because setting some properties depend on the format
// having RES_CNTNT attribute (e.g., UNO_NAME_TEXT_(LEFT|RIGHT|UPPER|LOWER)DIST; see
// SwTextBoxHelper::syncProperty, which indirectly calls SwTextBoxHelper::isTextBox)
uno::Reference<beans::XPropertySetInfo> xPropertySetInfo
= xPropSet->getPropertySetInfo();
if (xPropertySetInfo->hasPropertyByName("TextBox"))
xPropSet->setPropertyValue("TextBox", uno::makeAny(mbTextBox));
// if this is an auto style, set its properties // if this is an auto style, set its properties
if(bAutoStyle && pDocStyle) if(bAutoStyle && pDocStyle)
{ {
...@@ -697,11 +706,6 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) ...@@ -697,11 +706,6 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
pDocStyle->FillPropertySet(xPropSet); pDocStyle->FillPropertySet(xPropSet);
} }
// Writer shapes: if this one has a TextBox, set it here.
uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropSet->getPropertySetInfo();
if (xPropertySetInfo->hasPropertyByName("TextBox"))
xPropSet->setPropertyValue("TextBox", uno::makeAny(mbTextBox));
} while(false); } while(false);
// try to set text auto style // try to set text auto style
......
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