summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/tdf85161.docxbin0 -> 15730 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx44
3 files changed, 47 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf85161.docx b/sw/qa/extras/ooxmlexport/data/tdf85161.docx
new file mode 100755
index 000000000000..e079b4906617
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf85161.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index db20995238e3..c3b2af4bc065 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -687,6 +687,11 @@ DECLARE_OOXMLEXPORT_TEST(testOO39845, "ooo39845-7.odt")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "Figure4|graphic");
}
+DECLARE_OOXMLEXPORT_TEST( testTdf85161, "tdf85161.docx" )
+{
+ CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName"));
+ CPPUNIT_ASSERT_EQUAL(OUString(u'\x5e'),getParagraph(1)->getString());
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4c29c1f7cc34..4949deb0a030 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/awt/CharSet.hpp>
#include <oox/mathml/import.hxx>
#include <rtl/uri.hxx>
@@ -2937,7 +2938,7 @@ if(!bFilled)
// {OUString("SKIPIF"),"", FIELD_SKIPIF },
// {OUString("STYLEREF"),"", FIELD_STYLEREF },
{OUString("SUBJECT"), "DocInfo.Subject", FIELD_SUBJECT },
-// {OUString("SYMBOL"),"", FIELD_SYMBOL },
+ {OUString("SYMBOL"),"", FIELD_SYMBOL },
{OUString("TEMPLATE"), "TemplateName", FIELD_TEMPLATE},
{OUString("TIME"), "DateTime", FIELD_TIME },
{OUString("TITLE"), "DocInfo.Title", FIELD_TITLE },
@@ -3733,6 +3734,7 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_TC:
case FIELD_EQ:
case FIELD_INCLUDEPICTURE:
+ case FIELD_SYMBOL:
bCreateField = false;
break;
case FIELD_FORMCHECKBOX :
@@ -4239,7 +4241,45 @@ void DomainMapper_Impl::CloseFieldCommand()
}
}
break;
- case FIELD_SYMBOL : break;
+ case FIELD_SYMBOL:
+ {
+ uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
+ OUString sSymbol( sal_Unicode( sFirstParam.startsWithIgnoreAsciiCase("0x") ? sFirstParam.copy(2).toUInt32(16) : sFirstParam.toUInt32() ) );
+ OUString sFont;
+ bool bHasFont = lcl_FindInCommand( pContext->GetCommand(), 'f', sFont);
+ if ( bHasFont )
+ {
+ sFont = sFont.trim();
+ if (sFont.startsWith("\""))
+ sFont = sFont.copy(1);
+ if (sFont.endsWith("\""))
+ sFont = sFont.copy(0,sFont.getLength()-1);
+ }
+
+
+
+ if (xTextAppend.is())
+ {
+ uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
+ uno::Reference< text::XText > xText = xTextAppend->getText();
+ if(xCrsr.is() && xText.is())
+ {
+ xCrsr->gotoEnd(false);
+ xText->insertString(xCrsr, sSymbol, true);
+ uno::Reference< beans::XPropertySet > xProp( xCrsr, uno::UNO_QUERY );
+ xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_CHAR_SET), uno::makeAny(awt::CharSet::SYMBOL));
+ if(bHasFont)
+ {
+ uno::Any aVal = uno::makeAny( sFont );
+ xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), aVal);
+ xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME_ASIAN), aVal);
+ xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME_COMPLEX), aVal);
+
+ }
+ }
+ }
+ }
+ break;
case FIELD_TEMPLATE: break;
case FIELD_TIME :
{