include/svtools/rtfkeywd.hxx | 2 + sw/qa/extras/ooxmlexport/data/em.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 +++++++ sw/qa/extras/rtfexport/data/em.rtf | 8 ++++ sw/qa/extras/rtfexport/rtfexport.cxx | 13 +++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 20 ++++++++--- sw/source/filter/ww8/rtfattributeoutput.cxx | 12 +++++- writerfilter/source/dmapper/DomainMapper.cxx | 43 ++----------------------- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 ++--- writerfilter/source/rtftok/rtfsdrimport.cxx | 10 ++--- 10 files changed, 73 insertions(+), 58 deletions(-)
New commits: commit 22f92b86069e7e130d96c6e124476b0c496d0df6 Author: Miklos Vajna <[email protected]> Date: Sun Oct 12 16:19:01 2014 +0200 Remove dead code Only doctok produced these tokens, so no need to handle them anymore. Change-Id: Ied7df2515ac86562dd5ce782a1f01158fe3f684e diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 641cc49..d1aec85 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1133,9 +1133,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) switch(nSprmId) { - case 2: // sprmPIstd - case 0x4600: - break; // sprmPIstd - style code case NS_ooxml::LN_CT_PPrBase_jc: handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, m_pImpl )); break; @@ -1671,9 +1668,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) rContext->Insert( PROP_HEIGHT, uno::makeAny( PaperInfo::sloppyFitPageDimension( nHeight ) ) ); } break; - case 0x703a: //undocumented, grid related? - OSL_FAIL( "TODO: not handled yet"); //nIntValue like 0x008a2373 ? - break; case NS_ooxml::LN_EG_SectPrContents_textDirection: { /* 0 HoriLR 1 Vert TR 2 Vert TR 3 Vert TT 4 HoriLT @@ -1705,35 +1699,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) } break; // sprmSTextFlow // the following are not part of the official documentation - case 0x6870: //TxtForeColor - { - sal_Int32 nColor = msfilter::util::BGRToRGB(nIntValue); - rContext->Insert(PROP_CHAR_COLOR, uno::makeAny( nColor ) ); - } - break; - case 0x6877: //underlining color - { - rContext->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR, uno::makeAny( true ) ); - rContext->Insert(PROP_CHAR_UNDERLINE_COLOR, uno::makeAny( nIntValue ) ); - } - break; - case 0x6815: - break; //undocumented - case 0x6467: - break; //undocumented - case 0xF617: - break; //undocumented - case 0xd634: // sprmTNewSpacing - table spacing ( see WW8TabBandDesc::ProcessSpacing() ) - break; - case 0x4888: - case 0x6887: - //properties of list levels - undocumented - break; - case 0xd234: - case 0xd235: - case 0xd236: - case 0xd237: - break;//undocumented section properties case NS_ooxml::LN_CT_Tabs_tab: resolveSprmProps(*this, rSprm); m_pImpl->IncorporateTabStop(m_pImpl->m_aCurrentTabStop); commit b92cfa8829e6d26048f96cced12251db0f11c1ac Author: Miklos Vajna <[email protected]> Date: Sun Oct 12 16:18:09 2014 +0200 Clean up now unnecessary boost::bind() magic in RTFSdrImport::initShape() Change-Id: Ie373098959f8b3e04fe955a08031a4221faab3cc diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 7105084..fcb5b9c 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -234,12 +234,10 @@ int RTFSdrImport::initShape(uno::Reference<drawing::XShape>& o_xShape, // first, find the shape type int nType = -1; - std::vector< std::pair<OUString, OUString> >::const_iterator const iter( - std::find_if(rShape.aProperties.begin(), - rShape.aProperties.end(), - boost::bind(&OUString::equals, - boost::bind(&std::pair<OUString, OUString>::first, _1), - OUString("shapeType")))); + auto iter = std::find_if(rShape.aProperties.begin(), rShape.aProperties.end(), [](std::pair<OUString, OUString> aProperty) + { + return aProperty.first == "shapeType"; + }); if (iter == rShape.aProperties.end()) { commit f99ebf4681ceb8803ea32f70835dafa368d74722 Author: Miklos Vajna <[email protected]> Date: Sun Oct 12 16:17:40 2014 +0200 RTF filter: fix \acc* handling The exporter didn't write circle and underdot at all. Change-Id: Ia8f45f2b03fb14e9a0027ec24ee7f36adc8c018d diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx index 8518f69..cffa649 100644 --- a/include/svtools/rtfkeywd.hxx +++ b/include/svtools/rtfkeywd.hxx @@ -1047,6 +1047,8 @@ #define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone" #define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot" #define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma" +#define OOO_STRING_SVTOOLS_RTF_ACCCIRCLE "\\acccircle" +#define OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT "\\accunderdot" #define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone" #define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert" #define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang" diff --git a/sw/qa/extras/rtfexport/data/em.rtf b/sw/qa/extras/rtfexport/data/em.rtf new file mode 100644 index 0000000..c255105 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/em.rtf @@ -0,0 +1,8 @@ +{\rtf1 +none +{\accdot dot} +{\acccomma comma} +{\acccircle circle} +{\accunderdot underDot} +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 954dc2f..5c74c53 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -16,6 +16,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/text/FontEmphasis.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/XFootnotesSupplier.hpp> @@ -689,6 +690,18 @@ DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt") // Just make sure that we don't crash after exporting a fully calculated layout. } +DECLARE_RTFEXPORT_TEST(testEm, "em.rtf") +{ + // Test all possible \acc* control words. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis")); + // This was missing. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis")); + // This one, too. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis")); +} + DECLARE_RTFEXPORT_TEST(testNumberingFont, "numbering-font.rtf") { uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a576ddc..a7eecbc 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2330,11 +2330,17 @@ void RtfAttributeOutput::CharEmphasisMark(const SvxEmphasisMarkItem& rEmphasisMa case EMPHASISMARK_NONE: pStr = OOO_STRING_SVTOOLS_RTF_ACCNONE; break; - case EMPHASISMARK_SIDE_DOTS: + case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE: + pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT; + break; + case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE: pStr = OOO_STRING_SVTOOLS_RTF_ACCCOMMA; break; - default: - pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT; + case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE: + pStr = OOO_STRING_SVTOOLS_RTF_ACCCIRCLE; + break; + case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW: + pStr = OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT; break; } m_aStyles.append(pStr); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d266183..85884f94 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4714,19 +4714,19 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam switch (nKeyword) { case RTF_ACCNONE: - nSprm = 0; + nSprm = NS_ooxml::LN_Value_ST_Em_none; break; case RTF_ACCDOT: - nSprm = 1; + nSprm = NS_ooxml::LN_Value_ST_Em_dot; break; case RTF_ACCCOMMA: - nSprm = 2; + nSprm = NS_ooxml::LN_Value_ST_Em_comma; break; case RTF_ACCCIRCLE: - nSprm = 3; + nSprm = NS_ooxml::LN_Value_ST_Em_circle; break; case RTF_ACCUNDERDOT: - nSprm = 4; + nSprm = NS_ooxml::LN_Value_ST_Em_underDot; break; default: break; commit 997ce52eb7ef5d1418784bc16afb495ec43fe64c Author: Miklos Vajna <[email protected]> Date: Sun Oct 12 16:17:01 2014 +0200 DOCX filter: fix <w:em> handling The real news here is that "comma" and "dot" was swapped on export, the rest is just a fixup of recent breakage. Change-Id: I54045f5837652dc38a30361e21ced25aeaf58257 diff --git a/sw/qa/extras/ooxmlexport/data/em.docx b/sw/qa/extras/ooxmlexport/data/em.docx new file mode 100644 index 0000000..ee3137e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/em.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1277f7b..1101e2d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> +#include <com/sun/star/text/FontEmphasis.hpp> #include <string> @@ -456,6 +457,18 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtent, "effect-extent.docx") assertXPath(pXmlDoc, "//wp:effectExtent", "l", "114300"); } +DECLARE_OOXMLEXPORT_TEST(testEm, "em.docx") +{ + // Test all possible <w:em> arguments. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis")); + // This was ACCENT_ABOVE. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis")); + // This was DOT_ABOVE. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 015531e..8843331 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6332,11 +6332,21 @@ void DocxAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasis switch ( rEmphasisMark.GetValue() ) { - case EMPHASISMARK_NONE: pEmphasis = "none"; break; - case EMPHASISMARK_SIDE_DOTS: pEmphasis = "dot"; break; - case EMPHASISMARK_CIRCLE_ABOVE: pEmphasis = "circle"; break; - case EMPHASISMARK_DOTS_BELOW: pEmphasis = "underDot"; break; - default: pEmphasis = "comma"; break; + case EMPHASISMARK_NONE: + pEmphasis = "none"; + break; + case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE: + pEmphasis = "dot"; + break; + case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE: + pEmphasis = "comma"; + break; + case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE: + pEmphasis = "circle"; + break; + case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW: + pEmphasis = "underDot"; + break; } m_pSerializer->singleElementNS( XML_w, XML_em, FSNS( XML_w, XML_val ), pEmphasis, FSEND ); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index aa0b80e..641cc49 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3274,13 +3274,13 @@ sal_Int16 DomainMapper::getEmphasisValue(const sal_Int32 nIntValue) { switch (nIntValue) { - case 1: + case NS_ooxml::LN_Value_ST_Em_dot: return com::sun::star::text::FontEmphasis::DOT_ABOVE; - case 2: + case NS_ooxml::LN_Value_ST_Em_comma: return com::sun::star::text::FontEmphasis::ACCENT_ABOVE; - case 3: + case NS_ooxml::LN_Value_ST_Em_circle: return com::sun::star::text::FontEmphasis::CIRCLE_ABOVE; - case 4: + case NS_ooxml::LN_Value_ST_Em_underDot: return com::sun::star::text::FontEmphasis::DOT_BELOW; default: return com::sun::star::text::FontEmphasis::NONE; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
