[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at suse.cz
Fri Mar 29 04:44:38 PDT 2013
sw/qa/extras/rtfexport/data/placeholder.odt |binary
sw/qa/extras/rtfexport/rtfexport.cxx | 11 +++++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 7 +++++--
3 files changed, 16 insertions(+), 2 deletions(-)
New commits:
commit 71ccb4b03138cc72d3106694a8c2bed2a49fe17c
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Fri Mar 29 12:30:52 2013 +0100
implement RtfAttributeOutput::PlaceholderField
Change-Id: Ib6fd380736c5567a98317ec117969d8c76a31f02
diff --git a/sw/qa/extras/rtfexport/data/placeholder.odt b/sw/qa/extras/rtfexport/data/placeholder.odt
new file mode 100644
index 0000000..5bc1097
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/placeholder.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index fffb959..ec0ff69 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -72,6 +72,7 @@ public:
void testFdo52286();
void testFdo61507();
void testFdo30983();
+ void testPlaceholder();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -118,6 +119,7 @@ void Test::run()
{"fdo52286.odt", &Test::testFdo52286},
{"fdo61507.rtf", &Test::testFdo61507},
{"fdo30983.rtf", &Test::testFdo30983},
+ {"placeholder.odt", &Test::testPlaceholder},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -495,6 +497,15 @@ void Test::testFdo30983()
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrientRelation"));
}
+void Test::testPlaceholder()
+{
+ // Only the field text was exported, make sure we still have a field with the correct Hint text.
+ uno::Reference<text::XTextRange> xRun(getRun(getParagraph(1), 2));
+ CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(xRun, "TextPortionType"));
+ uno::Reference<beans::XPropertySet> xField = getProperty< uno::Reference<beans::XPropertySet> >(xRun, "TextField");
+ CPPUNIT_ASSERT_EQUAL(OUString("place holder"), getProperty<OUString>(xField, "Hint"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 47ad371..9636254 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3074,9 +3074,12 @@ bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ )
return true;
}
-bool RtfAttributeOutput::PlaceholderField( const SwField* )
+bool RtfAttributeOutput::PlaceholderField( const SwField* pField)
{
- return true; // expand to text?
+ m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " MACROBUTTON None ");
+ RunText(pField->GetPar1());
+ m_aRunText->append("}}");
+ return false; // do not expand
}
RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
More information about the Libreoffice-commits
mailing list