[Libreoffice-commits] .: sw/qa writerfilter/source
sw/qa/extras/rtftok/data/fdo48876.rtf |5 + sw/qa/extras/rtftok/rtftok.cxx | 17 + writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 -- 3 files changed, 30 insertions(+), 2 deletions(-) New commits: commit 99b875aee04a808fb28715fb0e143a2b00332832 Author: Miklos Vajna vmik...@suse.cz Date: Sat Apr 21 12:53:22 2012 +0200 fdo#48876 fix RTF import of \sl without \slmult diff --git a/sw/qa/extras/rtftok/data/fdo48876.rtf b/sw/qa/extras/rtftok/data/fdo48876.rtf new file mode 100644 index 000..49a6eb0 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo48876.rtf @@ -0,0 +1,5 @@ +{\rtf +\sl54 +C +\par +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 6870f02..0bb45e4 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -29,6 +29,8 @@ #include com/sun/star/drawing/XDrawPageSupplier.hpp #include com/sun/star/lang/XServiceInfo.hpp #include com/sun/star/style/CaseMap.hpp +#include com/sun/star/style/LineSpacing.hpp +#include com/sun/star/style/LineSpacingMode.hpp #include com/sun/star/style/XStyleFamiliesSupplier.hpp #include com/sun/star/table/BorderLine2.hpp #include com/sun/star/table/BorderLineStyle.hpp @@ -83,6 +85,7 @@ public: void testFdo39053(); void testFdo48356(); void testFdo48023(); +void testFdo48876(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) !defined(WNT) @@ -108,6 +111,7 @@ public: CPPUNIT_TEST(testFdo39053); CPPUNIT_TEST(testFdo48356); CPPUNIT_TEST(testFdo48023); +CPPUNIT_TEST(testFdo48876); #endif CPPUNIT_TEST_SUITE_END(); @@ -599,6 +603,19 @@ void RtfModelTest::testFdo48023() CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString()); } +void RtfModelTest::testFdo48876() +{ +load(fdo48876.rtf); +uno::Referencetext::XTextDocument xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XEnumerationAccess xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY); +uno::Referencecontainer::XEnumeration xParaEnum = xParaEnumAccess-createEnumeration(); +CPPUNIT_ASSERT(xParaEnum-hasMoreElements()); +uno::Referencebeans::XPropertySet xPropertySet(xParaEnum-nextElement(), uno::UNO_QUERY); +style::LineSpacing aSpacing; +xPropertySet-getPropertyValue(ParaLineSpacing) = aSpacing; +CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, aSpacing.Mode); +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e50cc1f..750e473 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2379,9 +2379,15 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_SL: -if (nParam 0) { -// NS_sprm::LN_PDyaLine could be used, but that won't work with slmult +// This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'. +RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast)); +if (nParam 0) +{ +pValue.reset(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact)); +pIntValue.reset(new RTFValue(-nParam)); +} + m_aStates.top().aParagraphAttributes-push_back(make_pair(NS_ooxml::LN_CT_Spacing_lineRule, pValue)); m_aStates.top().aParagraphAttributes-push_back(make_pair(NS_ooxml::LN_CT_Spacing_line, pIntValue)); } break; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa writerfilter/source
sw/qa/extras/ooxmltok/data/n750935.docx |binary sw/qa/extras/ooxmltok/ooxmltok.cxx | 14 ++ writerfilter/source/dmapper/PropertyMap.cxx | 11 +-- 3 files changed, 23 insertions(+), 2 deletions(-) New commits: commit 0ef7dbcb365534c4203760c86d089d50f7eb9562 Author: Miklos Vajna vmik...@suse.cz Date: Sat Apr 14 16:11:46 2012 +0200 dmapper: fix import of odd/even page breaks diff --git a/sw/qa/extras/ooxmltok/data/n750935.docx b/sw/qa/extras/ooxmltok/data/n750935.docx new file mode 100644 index 000..0dd0159 Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n750935.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 5beb577..5aff21c 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -31,7 +31,9 @@ #include com/sun/star/text/SetVariableType.hpp #include com/sun/star/text/TextContentAnchorType.hpp #include com/sun/star/text/XDependentTextField.hpp +#include com/sun/star/text/XPageCursor.hpp #include com/sun/star/text/XTextFieldsSupplier.hpp +#include com/sun/star/text/XTextViewCursorSupplier.hpp #include test/bootstrapfixture.hxx #include unotest/macros_test.hxx @@ -50,12 +52,14 @@ public: void testN751054(); void testN751117(); void testN751017(); +void testN750935(); CPPUNIT_TEST_SUITE(OoxmlModelTest); #if !defined(MACOSX) !defined(WNT) CPPUNIT_TEST(testN751054); CPPUNIT_TEST(testN751117); CPPUNIT_TEST(testN751017); +CPPUNIT_TEST(testN750935); #endif CPPUNIT_TEST_SUITE_END(); @@ -171,6 +175,16 @@ void OoxmlModelTest::testN751017() CPPUNIT_ASSERT(bFoundGet); } +void OoxmlModelTest::testN750935() +{ +load(n750935.docx); +uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY); +uno::Referencetext::XTextViewCursorSupplier xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY); +uno::Referencetext::XPageCursor xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY); +xCursor-jumpToLastPage(); +CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor-getPage()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 471f9b8..3f6b18c 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -39,6 +39,7 @@ #include com/sun/star/container/XEnumerationAccess.hpp #include com/sun/star/container/XNameContainer.hpp #include com/sun/star/style/BreakType.hpp +#include com/sun/star/style/PageStyleLayout.hpp #include com/sun/star/text/RelOrientation.hpp #include com/sun/star/text/WritingMode.hpp #include com/sun/star/text/XTextColumns.hpp @@ -974,8 +975,14 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl rDM_Impl ) 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */ xRangeProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName )); -// todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number -// or add even/odd page break types +// handle page breaks with odd/even page numbering +style::PageStyleLayout nPageStyleLayout; +if (m_nBreakType == 3) +nPageStyleLayout = style::PageStyleLayout_LEFT; +else if (m_nBreakType == 4) +nPageStyleLayout = style::PageStyleLayout_RIGHT; +if (nPageStyleLayout) +xFollowPageStyle-setPropertyValue(PageStyleLayout, uno::makeAny(nPageStyleLayout)); if(m_bPageNoRestart || m_nPageNumber = 0) { sal_Int16 nPageNumber = m_nPageNumber = 0 ? static_cast sal_Int16 (m_nPageNumber) : 1; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa writerfilter/source
sw/qa/extras/rtftok/data/fdo45182.rtf | 11 +++ sw/qa/extras/rtftok/rtftok.cxx | 15 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 +++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++ 4 files changed, 43 insertions(+), 2 deletions(-) New commits: commit f4e0cbaa15c2861e87149a62c9c80a9e9b4094b3 Author: Miklos Vajna vmik...@suse.cz Date: Tue Apr 3 16:49:41 2012 +0200 fdo#45182 fix RTF import of character encoding in footnotes There were two problems here: 1) \plain reset the character properties, but did not touch the current encoding 2) the default properties were not passed to substreams diff --git a/sw/qa/extras/rtftok/data/fdo45182.rtf b/sw/qa/extras/rtftok/data/fdo45182.rtf new file mode 100644 index 000..b076106 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo45182.rtf @@ -0,0 +1,11 @@ +{\rtf1\deff0 +{\fonttbl +{\f0\fcharset238 +Times New Roman;} +} +a\chftn +{\footnote +\ltrpar \pard\plain\'9eivnost\'ed +\par +} +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 45eabbf..9267967 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -35,6 +35,7 @@ #include com/sun/star/text/RelOrientation.hpp #include com/sun/star/text/SizeType.hpp #include com/sun/star/text/TextContentAnchorType.hpp +#include com/sun/star/text/XFootnotesSupplier.hpp #include com/sun/star/text/XPageCursor.hpp #include com/sun/star/text/XTextDocument.hpp #include com/sun/star/text/XTextGraphicObjectsSupplier.hpp @@ -77,6 +78,7 @@ public: void testFdo45394(); void testFdo48104(); void testFdo47107(); +void testFdo45182(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) !defined(WNT) @@ -97,6 +99,7 @@ public: CPPUNIT_TEST(testFdo45394); CPPUNIT_TEST(testFdo48104); CPPUNIT_TEST(testFdo47107); +CPPUNIT_TEST(testFdo45182); #endif CPPUNIT_TEST_SUITE_END(); @@ -500,6 +503,18 @@ void RtfModelTest::testFdo47107() xNumberingStyles-getByName(WWNum2); } +void RtfModelTest::testFdo45182() +{ +load(fdo45182.rtf); + +uno::Referencetext::XFootnotesSupplier xFootnotesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xFootnotes(xFootnotesSupplier-getFootnotes(), uno::UNO_QUERY); +uno::Referencetext::XTextRange xTextRange(xFootnotes-getByIndex(0), uno::UNO_QUERY); +// Encoding in the footnote was wrong. +OUString aExpected(živnostÃ, 10, RTL_TEXTENCODING_UTF8); +CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5ceeaeb..e938f98 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -541,6 +541,14 @@ int RTFDocumentImpl::getFontIndex(int nIndex) return m_pSuperstream-getFontIndex(nIndex); } +RTFParserState RTFDocumentImpl::getDefaultState() +{ +if (!m_pSuperstream) +return m_aDefaultState; +else +return m_pSuperstream-getDefaultState(); +} + void RTFDocumentImpl::resolve(Stream rMapper) { m_pMapperStream = rMapper; @@ -1762,8 +1770,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; break; case RTF_PLAIN: -m_aStates.top().aCharacterSprms = m_aDefaultState.aCharacterSprms; -m_aStates.top().aCharacterAttributes = m_aDefaultState.aCharacterAttributes; +{ +m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; +RTFValue::Pointer_t pValue = m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0); +if (pValue.get()) +m_aStates.top().nCurrentEncoding = getEncoding(pValue-getInt()); +m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; +} break; case RTF_PARD: m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 1747958..1d72ece 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -372,6 +372,8 @@ namespace writerfilter { int getFontIndex(int nIndex); /// Return the encoding associated with a dmapper font index. rtl_TextEncoding getEncoding(sal_uInt32 nFontIndex); +/// Get the default parser state. +RTFParserState getDefaultState(); private: SvStream Strm(); ___
[Libreoffice-commits] .: sw/qa writerfilter/source
sw/qa/extras/rtftok/rtftok.cxx | 24 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 + 2 files changed, 25 insertions(+) New commits: commit 04cae9ec1e1f04833b06fe9f24e23cfaf5265599 Author: Miklos Vajna vmik...@suse.cz Date: Sat Mar 24 17:14:12 2012 +0100 fdo#46955 fix RTF import of all capitals char prop diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 0628268..472e775 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -28,6 +28,7 @@ #include com/sun/star/beans/XPropertySet.hpp #include com/sun/star/drawing/XDrawPageSupplier.hpp #include com/sun/star/lang/XServiceInfo.hpp +#include com/sun/star/style/CaseMap.hpp #include com/sun/star/style/XStyleFamiliesSupplier.hpp #include com/sun/star/table/BorderLine2.hpp #include com/sun/star/table/BorderLineStyle.hpp @@ -71,6 +72,7 @@ public: void testN751020(); void testFdo47326(); void testFdo47036(); +void testFdo46955(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) !defined(WNT) @@ -87,6 +89,7 @@ public: CPPUNIT_TEST(testN751020); CPPUNIT_TEST(testFdo47326); CPPUNIT_TEST(testFdo47036); +CPPUNIT_TEST(testFdo46955); #endif CPPUNIT_TEST_SUITE_END(); @@ -425,6 +428,27 @@ void RtfModelTest::testFdo47036() CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess-getCount()); } +void RtfModelTest::testFdo46955() +{ +load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo46955.rtf))); + +uno::Referencetext::XTextDocument xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XEnumerationAccess xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY); +uno::Referencecontainer::XEnumeration xParaEnum = xParaEnumAccess-createEnumeration(); +while (xParaEnum-hasMoreElements()) +{ +uno::Referencecontainer::XEnumerationAccess xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY); +uno::Referencecontainer::XEnumeration xRangeEnum = xRangeEnumAccess-createEnumeration(); +while (xRangeEnum-hasMoreElements()) +{ +uno::Referencebeans::XPropertySet xPropertySet(xRangeEnum-nextElement(), uno::UNO_QUERY); +sal_Int16 nValue; + xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CharCaseMap))) = nValue; +CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, nValue); +} +} +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e4d4e50..85f70f9 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2768,6 +2768,7 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam case RTF_STRIKED: nSprm = NS_sprm::LN_CFDStrike; break; case RTF_SCAPS: nSprm = NS_sprm::LN_CFSmallCaps; break; case RTF_IMPR: nSprm = NS_sprm::LN_CFImprint; break; +case RTF_CAPS: nSprm = NS_sprm::LN_CFCaps; break; default: break; } if (nSprm = 0) ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sw/qa writerfilter/source
sw/qa/extras/rtftok/data/fdo47326.rtf |5 + sw/qa/extras/rtftok/rtftok.cxx |9 + writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 3 files changed, 22 insertions(+) New commits: commit f84e0e6b1b0ec5f52ee963a62ac420cd872a771e Author: Miklos Vajna vmik...@suse.cz Date: Fri Mar 23 12:47:41 2012 +0100 fdo#47326 fix RTF import of mixed super/nonsuper text In most cases \super has its own group, but it's valid to have mixed super and non-super text in a single group, as long as \super and \nosupersub keywords are used: handle this. diff --git a/sw/qa/extras/rtftok/data/fdo47326.rtf b/sw/qa/extras/rtftok/data/fdo47326.rtf new file mode 100644 index 000..264e719 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo47326.rtf @@ -0,0 +1,5 @@ +{\rtf1 +Windows\super\'ae\nosupersub XP: +\pard + Cartes:\par +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 7483634..f4a0c4d 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -68,6 +68,7 @@ public: void testFdo45563(); void testFdo43965(); void testN751020(); +void testFdo47326(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) !defined(WNT) @@ -82,6 +83,7 @@ public: CPPUNIT_TEST(testFdo45563); CPPUNIT_TEST(testFdo43965); CPPUNIT_TEST(testN751020); +CPPUNIT_TEST(testFdo47326); #endif CPPUNIT_TEST_SUITE_END(); @@ -389,6 +391,13 @@ void RtfModelTest::testN751020() CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), nValue); } +void RtfModelTest::testFdo47326() +{ +load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo47326.rtf))); +// This was 15 only, as \super buffered text, then the contents of it got lost. +CPPUNIT_ASSERT_EQUAL(19, getLength()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 84267f3..d378694 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1932,6 +1932,14 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().aCharacterSprms-push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); } break; +case RTF_NOSUPERSUB: +if (m_pCurrentBuffer == m_aSuperBuffer) +{ +replayBuffer(m_aSuperBuffer); +m_pCurrentBuffer = 0; +} + m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign); +break; case RTF_LINEPPAGE: case RTF_LINECONT: { ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits