[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source xmloff/source
sw/qa/extras/odfexport/data/tdf114287.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 45 + sw/qa/extras/ooxmlexport/data/image_through_shape.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |9 +++ writerfilter/source/dmapper/DomainMapper.cxx | 14 ++--- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 22 writerfilter/source/dmapper/DomainMapper_Impl.hxx |5 + writerfilter/source/dmapper/GraphicImport.cxx | 44 +--- writerfilter/source/dmapper/GraphicImport.hxx |2 xmloff/source/text/XMLTextListBlockContext.hxx |2 xmloff/source/text/txtimp.cxx | 11 +++- 11 files changed, 112 insertions(+), 42 deletions(-) New commits: commit 043c349f144b615836091707147e57616a1261e7 Author: Michael Stahl AuthorDate: Tue Feb 28 14:40:08 2023 +0100 Commit: Michael Stahl CommitDate: Tue Feb 28 15:43:55 2023 + tdf#153874 writerfilter: fix anchoring of decorative shapes Turns out as-char flys can be decorative too. The confusing GraphicImport takes a GraphicImportType by value but everything else is a reference to a DomainMapper_Impl member. The latter appears to work better so handle GraphicImportType the same way and remove the function parameter. (regression from commit 31084ebb59093be7dfe5ab53a20fdb3bcfde34b6) Change-Id: I18c1d47d39751e8ddcaa52498077d89c43a934e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147998 Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/image_through_shape.docx b/sw/qa/extras/ooxmlexport/data/image_through_shape.docx new file mode 100644 index ..dd90f9d9bf29 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/image_through_shape.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 99c0b2c9ffe7..9eb7eabd2434 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -823,6 +823,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133473_shadowSize, "tdf133473.docx") CPPUNIT_ASSERT_EQUAL(static_cast(20), nSize1); } +DECLARE_OOXMLEXPORT_TEST(testTdf153874, "image_through_shape.docx") +{ +uno::Reference const xShape1(getShapeByName(u"Test1"), uno::UNO_QUERY); +uno::Reference const xShape2(getShapeByName(u"Rectangle 1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, xShape1->getPropertyValue("AnchorType").get()); +CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, xShape2->getPropertyValue("AnchorType").get()); +CPPUNIT_ASSERT_LESS(xShape2->getPropertyValue("ZOrder").get(), xShape1->getPropertyValue("ZOrder").get()); +} + DECLARE_OOXMLEXPORT_TEST(testTextBoxZOrder, "testTextBoxZOrder.docx") { // Is load successful? diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 242a0d655e39..573a1b41f4a5 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -776,8 +776,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { //looks a bit like a hack - and it is. The graphic import is split into the inline_inline part and //afterwards the adding of the binary data. -m_pImpl->GetGraphicImport( IMPORT_AS_DETECTED_INLINE )->attribute(nName, val); -m_pImpl->ImportGraphic( val.getProperties(), IMPORT_AS_DETECTED_INLINE ); +m_pImpl->m_eGraphicImportType = IMPORT_AS_DETECTED_INLINE; // really ??? +m_pImpl->GetGraphicImport()->attribute(nName, val); +m_pImpl->ImportGraphic(val.getProperties()); } break; case NS_ooxml::LN_Value_math_ST_Jc_centerGroup: @@ -1337,7 +1338,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } break; case NS_ooxml::LN_OfficeArtExtension_Decorative_val: - m_pImpl->GetGraphicImport(IMPORT_AS_DETECTED_ANCHOR)->attribute(nName, val); +m_pImpl->GetGraphicImport()->attribute(nName, val); break; default: SAL_WARN("writerfilter", "DomainMapper::lcl_attribute: unhandled token: " << nName); @@ -2539,15 +2540,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference::Pointer_t pProperties = rSprm.getProps(); if( pProperties ) { -GraphicImportType eGraphicType = +m_pImpl->m_eGraphicImportType = (NS_ooxml::LN_anchor_anchor == sal::static_int_cast(nSprmId)) ? IMPORT_AS_DETECTED_ANCHOR : IMPORT_AS_DETECTED_INLINE; -GraphicImportPtr
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/invalid_date_form_field.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 78 + sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 16 +- writerfilter/source/dmapper/DomainMapper.cxx | 17 +- 4 files changed, 100 insertions(+), 11 deletions(-) New commits: commit 52205f85582aaaee04fcfffd1c1729454f512400 Author: Tamás Zolnai AuthorDate: Mon Jul 1 15:49:01 2019 +0200 Commit: Tamás Zolnai CommitDate: Fri Jul 12 06:10:11 2019 +0200 MSForms: DOCX filter: import manually set date field as plain text In MSO the user can add any text in the date field without having it in the specified date format. We import this kind of date as plain text. Change-Id: Ied4bf03a3ac4c9b6f1cfc78d91e6a52ad3d6e179 Reviewed-on: https://gerrit.libreoffice.org/75452 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 0e49295227f0..5e917d09a0b4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -35,13 +35,19 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108545_embeddedDocxIcon, "tdf108545_embeddedDocx CPPUNIT_ASSERT_EQUAL(embed::Aspects::MSOLE_ICON, xSupplier->getAspect()); } -/*DECLARE_OOXMLIMPORT_TEST(testTdf121203, "tdf121203.docx") +DECLARE_OOXMLIMPORT_TEST(testTdf121203, "tdf121203.docx") { -// Make sure that the date SDT's content is imported as plain text, as it -// has no ISO date, so we have no idea how to represent that with our date -// control. +// Make sure that the date SDT's content is imported as plain text, as +// the field has no fullDate attribute which we can use to find out the actual date. CPPUNIT_ASSERT_EQUAL(OUString("17-Oct-2018 09:00"), getRun(getParagraph(1), 1)->getString()); -}*/ + +// Make sure we did not import a date field. +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); +} DECLARE_OOXMLIMPORT_TEST(testTdf109053, "tdf109053.docx") { diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 72b647cb24b8..e1493a31fcb3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1029,10 +1029,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue); break; case NS_ooxml::LN_CT_SdtDate_fullDate: -if (!IsInHeaderFooter()) -m_pImpl->m_pSdtHelper->getDate().append(sStringValue); -else -m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_fullDate", sStringValue); +m_pImpl->m_pSdtHelper->getDate().append(sStringValue); break; case NS_ooxml::LN_CT_Background_color: if (m_pImpl->GetSettingsTable()->GetDisplayBackgroundShape()) @@ -3233,8 +3230,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) // Form controls are not allowed in headers / footers; see sw::DocumentContentOperationsManager::InsertDrawObj() else if (m_pImpl->m_pSdtHelper->validateDateFormat() && !IsInHeaderFooter()) { -// date field is imported, we don't need the corresponding date text -return; +// Date field will be imported, so we don't need the corresponding date text in most of the cases +// however when fullDate is not specified, but we have a date string we need to import it as +// simple text (this is the case when user sets date field manually in MSO). +if(!m_pImpl->m_pSdtHelper->getDate().toString().isEmpty() || sText.isEmpty()) +{ +return; +} +// Remove date field attributes to avoid to import an actual date field +m_pImpl->m_pSdtHelper->getDateFormat().truncate(); +m_pImpl->m_pSdtHelper->getLocale().truncate(); } else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty()) { commit 2f4ccb1d5ea4258da42f2f6a0b62161399e13bcc Author: Tamás Zolnai AuthorDate: Mon Jul 1 14:51:38 2019 +0200 Commit: Tamás Zolnai CommitDate: Fri Jul 12 06:10:00 2019 +0200 MSForms: DOCX filter: add a test case about invalid date form fields Change-Id: I2048198d81ea4abf58b2b499b89495cd51b5c7ff Reviewed-on: https://gerrit.libreoffice.org/75451 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/sw/qa/extras/ooxmlexport/data/invalid_date_form_field.docx b/sw/qa/extras/ooxmlexport/data/invalid_date_form_field.docx new file mode 100644 index ..9dc24e768b0f Binary files
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/core/data/rtf/fail/forcepoint-5.rtf| 1592 +++ sw/qa/core/data/rtf/pass/forcepoint-6.rtf| 847 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |2 writerfilter/source/dmapper/DomainMapper_Impl.cxx|2 4 files changed, 2441 insertions(+), 2 deletions(-) New commits: commit 4c041561952894bf50427be643e751aa67cc8810 Author: Caolán McNamaraDate: Mon Mar 12 10:04:29 2018 + forcepoint #23 Null dereference Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: I2e68a6c3fe1846fbfaaa0305c02da135a930d863 Reviewed-on: https://gerrit.libreoffice.org/51120 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/core/data/rtf/pass/forcepoint-6.rtf b/sw/qa/core/data/rtf/pass/forcepoint-6.rtf new file mode 100755 index ..b9a7517da071 --- /dev/null +++ b/sw/qa/core/data/rtf/pass/forcepoint-6.rtf @@ -0,0 +1,847 @@ +{\rtf1\adeflang1054\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs1054{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fprq2{\*\panose 0500}Wingdings;} +{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt \'cb\'ce\'cc\'e5};}{\f22\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Angsana New;} +{\f23\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0304020202020204}Cordia New;}{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f40\fbidi \froman\fcharset0\fprq2{\*\panose }Cambria;}{\f41\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@SimSun;} +{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt \'cb\'ce\'cc\'e5};} +{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose }Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Angsana New;} +{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt \'cb\'ce\'cc\'e5};} +{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0304020202020204}Cordia New;}{\f42\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\f43\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f45\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f46\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f47\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f48\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f49\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f50\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f62\fbidi \fmodern\fcharset238\fprq1 Courier New CE;} +{\f63\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;}{\f65\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f66\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f67\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);} +{\f68\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f69\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f70\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);} +{\f174\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt \'cb\'ce\'cc\'e5};}{\f271\fbidi \froman\fcharset222\fprq2 Angsana New (Thai);}{\f281\fbidi \fswiss\fcharset222\fprq2 Cordia New (Thai);}{\f412\fbidi \fswiss\fcharset238\fprq2 Calibri CE;} +{\f413\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f415\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f416\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f419\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;} +{\f420\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\f442\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f443\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f445\fbidi \froman\fcharset161\fprq2 Cambria Greek;} +{\f446\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\f449\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f450\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f454\fbidi \fnil\fcharset0\fprq2 @SimSun Western;} +{\flomajor\f31508\fbidi
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/pgnlcltr.rtf | 23 +++ sw/qa/extras/rtfexport/data/tdf65642.rtf | 23 +++ sw/qa/extras/rtfexport/rtfexport.cxx | 14 ++ sw/qa/extras/rtfimport/data/tdf65642.rtf | 23 --- sw/qa/extras/rtfimport/rtfimport.cxx |8 writerfilter/source/dmapper/DomainMapper.cxx |4 writerfilter/source/rtftok/rtfdocumentimpl.cxx |7 ++- 7 files changed, 70 insertions(+), 32 deletions(-) New commits: commit 43a17602fb894c10931581b20deec4a47889f310 Author: Miklos VajnaDate: Wed Mar 30 09:05:04 2016 +0200 Related: tdf#65642 RTF filter: import \pgnlcltr This as a side effect also implements support for DOCX . Change-Id: I47b60a0390ef081dc15b26e40393e35bf7bad130 diff --git a/sw/qa/extras/rtfexport/data/pgnlcltr.rtf b/sw/qa/extras/rtfexport/data/pgnlcltr.rtf new file mode 100644 index 000..6bc3035 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/pgnlcltr.rtf @@ -0,0 +1,23 @@ +{\rtf1 +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 +{\field\fldedit +{\*\fldinst +{ PAGE \\* MERGEFORMAT } +} +{\fldrslt +{1} +} +} +\sect +\sectd\pgnrestart\pgnlcltr +{\field\fldedit +{\*\fldinst +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT } +} +{\fldrslt +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 A} +} +} +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 8a544ce..da0712a 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -1007,6 +1007,12 @@ DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf") CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(getParagraph(2), "PageNumberOffset")); } +DECLARE_RTFEXPORT_TEST(testPgnlcltr, "pgnlcltr.rtf") +{ +// The second page's numbering type: this was style::NumberingType::ARABIC. +CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_LOWER_LETTER_N, getProperty(getStyles("PageStyles")->getByName("Converted1"), "NumberingType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 137f5b8..9863c59 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -993,6 +993,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // A, B, ... pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N); break; +case NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter: +// a, b, ... + pSectionContext->SetPageNumberType(style::NumberingType::CHARS_LOWER_LETTER_N); +break; } } break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 46fbdf4..d0631c5 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3280,7 +3280,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_PGNDEC: case RTF_PGNUCRM: case RTF_PGNLCRM: -case RTF_PGNLCLTR: case RTF_PGNBIDIA: case RTF_PGNBIDIB: // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment. @@ -3604,6 +3603,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); } break; +case RTF_PGNLCLTR: +{ +auto pIntValue = std::make_shared(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter); +lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); +} +break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); commit 1250ad9561e8f7d3227bb97b9e1f7b2968b5c900 Author: Miklos Vajna Date: Wed Mar 30 09:04:57 2016 +0200 Related: tdf#65642 RTF export: \pgnucltr testcase There is no reason this unit test is import-only, this area of the export filter was untested so far. Change-Id: Ia271bccf59c1b21474e7b854cbaa0992b722e552 diff --git a/sw/qa/extras/rtfimport/data/tdf65642.rtf b/sw/qa/extras/rtfexport/data/tdf65642.rtf similarity index 100% rename from sw/qa/extras/rtfimport/data/tdf65642.rtf rename to
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 100 ++ sw/qa/extras/rtfimport/data/tdf96308-tabpos.rtf | 12 sw/qa/extras/rtfimport/rtfimport.cxx | 16 + writerfilter/source/dmapper/DomainMapper_Impl.cxx|4 writerfilter/source/dmapper/PropertyMap.cxx | 173 +++ writerfilter/source/dmapper/PropertyMap.hxx | 21 + writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 8 files changed, 274 insertions(+), 54 deletions(-) New commits: commit faa767dbef7ee9a0a7ab80bf4ad0fb529cec54a8 Author: Luke DellerDate: Sun Jan 3 23:12:56 2016 +1100 tdf#93640 Fix import of linked left page header/footer In a docx section, any header/footer which is not defined in the section is considered to be linked to the previous section. In the Word UI this is shown as an option named "Link to Previous", and editing the header/footer in either section affects both sections. LO imports this by copying the header/footer contents from the previous section, but it did not handle the case where a section had different headers for left pages vs right pages. Fix this, which involved changing the mechanism used to detect whether a section has defined a certain header/footer (which unlinks it from the previous section): rather than trying to figure it out from the converted LO page styles, explicitly track which headers/footers have been defined using boolean member variables on the SectionPropertyMap instance. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ic43a867356c2cd5df09d39f2a3ddefa584b6765c diff --git a/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx new file mode 100644 index 000..cc4ddc8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fe67d76..a245be0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3047,6 +3047,106 @@ DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx") CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty(xStyle, "CharWeight")); } +// base class to supply a helper method for testHFLinkToPrev +class testHFBase : public Test +{ +protected: +OUString +getHFText(const uno::Reference& xPageStyle, + const OUString ) +{ +auto xTextRange = getProperty< uno::Reference >( +xPageStyle, sPropName); +return xTextRange->getString(); +} +}; + +DECLARE_SW_IMPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.docx", +testHFBase) +{ +uno::Reference xPageStyles = getStyles("PageStyles"); + +// get a page cursor +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier( +xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor( +xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + +// get LO page style for page 1, corresponding to docx section 1 first page +xCursor->jumpToFirstPage(); +OUString pageStyleName = getProperty(xCursor, "PageStyleName"); +uno::Reference xPageStyle( +xPageStyles->getByName(pageStyleName), uno::UNO_QUERY); +// check page 1 header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("First page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("First page footer for section 1 only")); + +// get LO page style for page 2, corresponding to docx section 1 +xCursor->jumpToPage(2); +pageStyleName = getProperty(xCursor, "PageStyleName"); +xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY ); +// check header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"), +OUString("Even page header for section 1 only")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"), +OUString("Even page footer for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("Odd page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("Odd page footer for section 1 only")); + +// get LO page style for page 4, corresponding to docx section 2 first page +xCursor->jumpToPage(4); +pageStyleName = getProperty(xCursor, "PageStyleName"); +xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY ); +// check header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n779627b.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 ++-- writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) New commits: commit fccd44a01e2092b587bbab43f5c5f56cd7ece4cd Author: László Németh laszlo.nem...@collabora.com Date: Mon May 4 14:50:49 2015 +0200 tdf#91077 unit tests for shape import of discarded DOCX header/footer Change-Id: I3e78e3104af97eed91c102e9ca5546e0785c5f8c diff --git a/sw/qa/extras/ooxmlimport/data/n779627b.docx b/sw/qa/extras/ooxmlimport/data/n779627b.docx new file mode 100644 index 000..1873715 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n779627b.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index eebdc08..c9c0368 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -839,8 +839,20 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, n779627.docx) sal_Int32(0), nLeftMargin); /* - * Another problem tested with this document is that the roundrect is - * centered vertically and horizontally. + * Another problem tested with this document is the unnecessary loading of the shapes + * anchored to a discarded header or footer + */ +uno::Referencetext::XTextDocument textDocument(mxComponent, uno::UNO_QUERY); +uno::Referencedrawing::XDrawPageSupplier drawPageSupplier(textDocument, uno::UNO_QUERY); +uno::Referencedrawing::XDrawPage drawPage = drawPageSupplier-getDrawPage(); +CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), drawPage-getCount()); +} + +DECLARE_OOXMLIMPORT_TEST(testN779627b, n779627b.docx) +{ +/* + * Another problem tested with the original n779627.docx document (before removing its unnecessary + * shape loading) is that the roundrect is centered vertically and horizontally. */ uno::Referencebeans::XPropertySet xShapeProperties( getShape(1), uno::UNO_QUERY ); uno::Referencedrawing::XShapeDescriptor xShapeDescriptor(xShapeProperties, uno::UNO_QUERY); commit da0c3b50c79697dd595b00922ede004b9f2960f4 Author: László Németh laszlo.nem...@collabora.com Date: Mon May 4 14:48:48 2015 +0200 tdf#91077 don't import shapes from discarded DOCX header/footer Change-Id: I674eadb84fc870031244a61f5c07d2cdf18a8dd1 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5188ca4..337930b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2032,7 +2032,8 @@ void DomainMapper_Impl::PopShapeContext() } // Remove the shape if required (most likely replacement shape for OLE object) -if ( m_aAnchoredStack.top().bToRemove ) +// or anchored to a discarded header or footer +if ( m_aAnchoredStack.top().bToRemove || m_bDiscardHeaderFooter ) { try { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo84685.rtf |7 ++ sw/qa/extras/rtfimport/rtfimport.cxx | 20 +++ writerfilter/source/rtftok/rtfcontrolwords.hxx |2 + writerfilter/source/rtftok/rtfdocumentimpl.cxx | 26 + 4 files changed, 55 insertions(+) New commits: commit 1dd1dfc152c7cbeb374fe4f38b08c6af9cef2c06 Author: Michael Stahl mst...@redhat.com Date: Tue Dec 16 23:45:15 2014 +0100 (related fdo#84685): writerfilter: RTF import: support \tc TOC entry Change-Id: Icda252e1f092707728d3a24df50fba7080e759bb diff --git a/sw/qa/extras/rtfimport/data/fdo84685.rtf b/sw/qa/extras/rtfimport/data/fdo84685.rtf index 431dbd3..af73b1a 100644 --- a/sw/qa/extras/rtfimport/data/fdo84685.rtf +++ b/sw/qa/extras/rtfimport/data/fdo84685.rtf @@ -2,4 +2,6 @@ \pard {\v {\xe {\v {\f0\fs20 Key the 1st Some text \par +{\v {\tc {\v {\f0\fs20 foo Some text +\par } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e80f727..0e651d0 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2093,6 +2093,14 @@ DECLARE_RTFIMPORT_TEST(testFdo84685, fdo84685.rtf) DocumentIndexMark)); CPPUNIT_ASSERT(xMark.is()); CPPUNIT_ASSERT_EQUAL(OUString(Key the 1st), getPropertyOUString(xMark, PrimaryKey)); +// let's test toc entry too +uno::Referencetext::XDocumentIndexMark xTOCMark( +getPropertyuno::Referencetext::XDocumentIndexMark( +getRun(getParagraph(2), 1), +DocumentIndexMark)); +CPPUNIT_ASSERT(xTOCMark.is()); +uno::Referencelang::XServiceInfo xTOCSI(xTOCMark, uno::UNO_QUERY); + CPPUNIT_ASSERT(xTOCSI-supportsService(com.sun.star.text.ContentIndexMark)); } DECLARE_RTFIMPORT_TEST(testFdo83204, fdo83204.rtf) diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx b/writerfilter/source/rtftok/rtfcontrolwords.hxx index ac45593..f2f8ad5 100644 --- a/writerfilter/source/rtftok/rtfcontrolwords.hxx +++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx @@ -150,6 +150,7 @@ enum RTFDestinationState DESTINATION_SHAPEGROUP, DESTINATION_FOOTNOTESEPARATOR, DESTINATION_INDEXENTRY, +DESTINATION_TOCENTRY, }; enum RTFKeyword diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3d7922a..6df07ce 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1260,6 +1260,7 @@ void RTFDocumentImpl::text(OUString rString) case DESTINATION_MTYPE: case DESTINATION_MGROW: case DESTINATION_INDEXENTRY: +case DESTINATION_TOCENTRY: m_aStates.top().pDestinationText-append(rString); break; default: @@ -1733,6 +1734,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_XE: m_aStates.top().nDestinationState = DESTINATION_INDEXENTRY; break; +case RTF_TC: +case RTF_TCN: +m_aStates.top().nDestinationState = DESTINATION_TOCENTRY; +break; case RTF_REVTBL: m_aStates.top().nDestinationState = DESTINATION_REVISIONTABLE; break; @@ -5191,12 +5196,15 @@ int RTFDocumentImpl::popState() } break; case DESTINATION_INDEXENTRY: +case DESTINATION_TOCENTRY: { if (m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group OUString str(m_aStates.top().pDestinationText-makeStringAndClear()); // dmapper expects this as a field, so let's fake something... -str = XE \ + str.replaceAll(\, \\\) + \; +OUString const field( +(DESTINATION_INDEXENTRY == aState.nDestinationState) ? XE : TC); +str = field + \ + str.replaceAll(\, \\\) + \; singleChar(0x13); Mapper().utext(reinterpret_castsal_uInt8 const*(str.getStr()), str.getLength()); singleChar(0x14); commit f14e6e06b9e3c82c267649d63512a3538e5ee2f5 Author: Michael Stahl mst...@redhat.com Date: Tue Dec 16 23:17:28 2014 +0100 fdo#84685: writerfilter: RTF import: support \xe index entry Change-Id: Ia957541a5997961aa86b2eb8537ebd29d3092691 diff --git a/sw/qa/extras/rtfimport/data/fdo84685.rtf b/sw/qa/extras/rtfimport/data/fdo84685.rtf new file mode 100644 index 000..431dbd3 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo84685.rtf @@ -0,0 +1,5 @@ +{\rtf1\ansi\ansicpg1252\uc1 +\pard +{\v {\xe {\v {\f0\fs20 Key the 1st Some text +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 0a688ef..e80f727 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -33,6 +33,7 @@ #include com/sun/star/text/SizeType.hpp #include com/sun/star/text/TableColumnSeparator.hpp #include com/sun/star/text/TextContentAnchorType.hpp
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx|7 +++ writerfilter/source/dmapper/NumberingManager.cxx|3 ++- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) New commits: commit 122d97673d762cc5fc043bdadfdf4cb80ac871cf Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Nov 19 17:34:45 2014 +0100 writerfilter: indentation fixes Change-Id: Ib9bee587931cd020848b033ce4429f36d04e61b1 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1234e37..5481466 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -5865,7 +5865,7 @@ int RTFDocumentImpl::popState() RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true)); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); } -break; +break; case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE: if (!m_aStates.empty()) { @@ -5873,7 +5873,7 @@ int RTFDocumentImpl::popState() RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true)); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); } -break; +break; case DESTINATION_LISTNAME: break; case DESTINATION_LISTLEVEL: @@ -5888,7 +5888,7 @@ int RTFDocumentImpl::popState() else m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); } -break; +break; case DESTINATION_LFOLEVEL: if (!m_aStates.empty()) { @@ -5898,7 +5898,7 @@ int RTFDocumentImpl::popState() RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms)); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue); } -break; +break; // list override table case DESTINATION_LISTOVERRIDEENTRY: if (!m_aStates.empty()) @@ -5916,14 +5916,14 @@ int RTFDocumentImpl::popState() m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, OVERWRITE_NO_APPEND); } } -break; +break; case DESTINATION_LEVELTEXT: if (!m_aStates.empty()) { RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes)); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); } -break; +break; case DESTINATION_LEVELNUMBERS: if (!m_aStates.empty()) m_aStates.top().aTableSprms = aState.aTableSprms; @@ -5947,7 +5947,7 @@ int RTFDocumentImpl::popState() // both \sp and \sv are destinations, copy the text up-ward for later m_aStates.top().aDestinationText = aState.aDestinationText; } -break; +break; case DESTINATION_FALT: if (!m_aStates.empty()) m_aStates.top().aTableSprms = aState.aTableSprms; commit d9f0c19edde7cb28086860ea6b3519be0d49a3e0 Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Nov 19 17:25:04 2014 +0100 DOCX import: handle w:lvlOverride without w:lvlText Change-Id: I0b941bd7a733408655db192b8608ed3987b9c1fc diff --git a/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx new file mode 100644 index 000..5ee3602 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 964ec96..8c78d45 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -591,6 +591,13 @@ DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, num-parent-style.docx) CPPUNIT_ASSERT(getPropertyOUString(getParagraph(4), NumberingStyleName).startsWith(WWNum)); } +DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, num-override-lvltext.docx) +{ +uno::Referencecontainer::XIndexAccess xRules = getProperty uno::Referencecontainer::XIndexAccess (getStyles(NumberingStyles)-getByName(WWNum1), NumberingRules); +// This was 1, i.e. the numbering on the second level was 1, not 1.1. +CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules-getByIndex(1))[ParentNumbering].getsal_Int16()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 2d5618d..af2c2e3 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -614,7 +614,8 @@ void
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/num-parent-style.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx|6 sw/qa/extras/rtfimport/rtfimport.cxx|6 ++-- writerfilter/source/dmapper/DomainMapper.cxx| 29 ++-- 4 files changed, 36 insertions(+), 5 deletions(-) New commits: commit c03b691a7cd8eba128204c851b99e0b75c580c0c Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Nov 17 16:54:12 2014 +0100 DOCX import: handle w:numId from parent styles as well Without this, we may miss the w:numId of a paragraph and set no numbering style name; and that leads to not restarting numberings when needed. Change-Id: I9a4896266c5b7f1d7cc2adc43b84e227c004da7c diff --git a/sw/qa/extras/ooxmlexport/data/num-parent-style.docx b/sw/qa/extras/ooxmlexport/data/num-parent-style.docx new file mode 100644 index 000..4b8c657 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/num-parent-style.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 851d72e..39c559a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -565,6 +565,12 @@ DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist35, cjklist35.docx) CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat); } +DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, num-parent-style.docx) +{ +// This was Outline, i.e. w:numId was not imported from the Heading 2 paragraph style. +CPPUNIT_ASSERT(getPropertyOUString(getParagraph(4), NumberingStyleName).startsWith(WWNum)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c393ad9..5b00fd6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1099,6 +1099,30 @@ static bool ExchangeLeftRight( const PropertyMapPtr rContext, DomainMapper_Impl* return bExchangeLeftRight; } +/// Check if the style or its parent has a list id, recursively. +static sal_Int32 lcl_getListId(const StyleSheetEntryPtr pEntry, const StyleSheetTablePtr pStyleTable) +{ +const StyleSheetPropertyMap* pEntryProperties = dynamic_castconst StyleSheetPropertyMap*(pEntry-pProperties.get()); +if (!pEntryProperties) +return -1; + +sal_Int32 nListId = pEntryProperties-GetListId(); +// The style itself has a list id. +if (nListId = 0) +return nListId; + +// The style has no parent. +if (pEntry-sBaseStyleIdentifier.isEmpty()) +return -1; + +const StyleSheetEntryPtr pParent = pStyleTable-FindStyleSheetByISTD(pEntry-sBaseStyleIdentifier); +// No such parent style or loop in the style hierarchy. +if (!pParent || pParent == pEntry) +return -1; + +return lcl_getListId(pParent, pStyleTable); +} + void DomainMapper::sprmWithProps( Sprm rSprm, PropertyMapPtr rContext ) { // These SPRM's are not specific to any section, so it's expected that there is no context yet. @@ -1976,10 +2000,11 @@ void DomainMapper::sprmWithProps( Sprm rSprm, PropertyMapPtr rContext ) OSL_ENSURE( pEntry.get(), no style sheet found ); const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_castconst StyleSheetPropertyMap*(pEntry ? pEntry-pProperties.get() : nullptr); -if( pStyleSheetProperties pStyleSheetProperties-GetListId() = 0 ) +sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, pStyleTable) : -1; +if( pStyleSheetProperties nListId = 0 ) { rContext-Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( -ListDef::GetStyleName( pStyleSheetProperties-GetListId( ) ) ), false); +ListDef::GetStyleName( nListId ) ), false); // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style. sal_Int32 nParaRightMargin = 0; commit 521185705d062e9526a8a3e0bc485c943e83eb0e Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Nov 17 08:54:10 2014 +0100 CppunitTest_sw_rtfimport: indentation fixes Change-Id: I696489a60729426b9b14df6c9e79a2d8247d21fb diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 645cf7c..6a1a23b 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2083,7 +2083,7 @@ DECLARE_RTFIMPORT_TEST(testFdo83204, fdo83204.rtf) } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). -DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, cp950listleveltext1.rtf ) +DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, cp950listleveltext1.rtf) { // suffix with Chinese only ( most common case generated
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/core/data/ooxml/pass/fdo73608-1.docx |binary sw/qa/core/data/ooxml/pass/fdo73608-2.docx |binary writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 16 ++- 3 files changed, 15 insertions(+), 1 deletion(-) New commits: commit be18133e84120625734a09380594ee89b23c4322 Author: Caolán McNamara caol...@redhat.com Date: Sun Sep 28 17:00:50 2014 +0100 Resolves: fdo#73608 bail out on loop in style sheet hierarchy Change-Id: I03975d1ce8eaceceb4d5c263eb11c1521bcd57eb diff --git a/sw/qa/core/data/ooxml/pass/fdo73608-2.docx b/sw/qa/core/data/ooxml/pass/fdo73608-2.docx new file mode 100644 index 000..f558878 Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo73608-2.docx differ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 91e3860..0287adf 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -90,6 +90,10 @@ PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntr if(!pStyleSheet-sBaseStyleIdentifier.isEmpty()) { const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable-FindStyleSheetByISTD( pStyleSheet-sBaseStyleIdentifier ); +//a loop in the style hierarchy, bail out +if (pParentStyleSheet == pStyleSheet) +return pRet; + pRet = lcl_SearchParentStyleSheetAndMergeProperties( pParentStyleSheet, pStyleSheetTable ); } else commit 5fd7382651d64f77e8ad1d9a5c053f52f3641f9f Author: Caolán McNamara caol...@redhat.com Date: Sun Sep 28 16:47:13 2014 +0100 Related: fdo#73608 don't crash on missing table styles Change-Id: I340b43b7afc4c5c4d6dc8e4ed182279240306540 diff --git a/sw/qa/core/data/ooxml/pass/fdo73608-1.docx b/sw/qa/core/data/ooxml/pass/fdo73608-1.docx new file mode 100644 index 000..d3cc84a Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo73608-1.docx differ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 7d2e4f3..91e3860 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -83,6 +83,10 @@ void DomainMapperTableHandler::startTable(unsigned int nRows, PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntryPtr pStyleSheet, StyleSheetTablePtr pStyleSheetTable) { PropertyMapPtr pRet; + +if (!pStyleSheet) +return pRet; + if(!pStyleSheet-sBaseStyleIdentifier.isEmpty()) { const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable-FindStyleSheetByISTD( pStyleSheet-sBaseStyleIdentifier ); @@ -93,7 +97,10 @@ PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntr pRet.reset( new PropertyMap ); } -pRet-InsertProps(pStyleSheet-pProperties); +if (pRet) +{ +pRet-InsertProps(pStyleSheet-pProperties); +} return pRet; } @@ -254,6 +261,9 @@ namespace bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const PropertyIds nId, TableInfo rInfo, table::BorderLine2 rLine) { +if (!pTableProperties) +return false; + const boost::optionalPropertyMap::Property aTblBorder = pTableProperties-getProperty(nId); if( aTblBorder ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/README| 26 +- writerfilter/source/ooxml/model.xml | 14 +++--- 2 files changed, 24 insertions(+), 16 deletions(-) New commits: commit 4f917d47776addcd041a0ce3ec719f752643f8ef Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Sep 22 16:35:30 2014 +0200 sw/qa/README: document that complex/unoapi are Java tests Change-Id: Ibaeefe795c8318824fe3d158871eae0477ef0fc4 diff --git a/sw/qa/README b/sw/qa/README index fba0bdb..9395e0d 100644 --- a/sw/qa/README +++ b/sw/qa/README @@ -1,10 +1,18 @@ -You can find different types of Writer tests here, the most interesting ones: +You can find different types of Writer tests here, the following directories +are available: -- core/filters-test: loads different file types (see SwFiltersTest::testCVEs() - for the list of supported filter types), and only makes sure Writer does not - crash. To add new tests, you just need to drop in the test files to the - relevant directory, no code change is necessary. -- core/uwriter: this test has access to private Writer symbols, add new tests - here if you need that. -- extras: see its own README -- executes import and export filters and asserts - the UNO model to verify the resulting document is the expected one. +- core: + - filters-test: loads different file types (see SwFiltersTest::testCVEs() for +the list of supported filter types), and only makes sure Writer does not +crash. To add new tests, you just need to drop in the test files to the +relevant directory, no code change is necessary. + - uwriter: this test has access to private Writer symbols, add new tests here +if you need that. +- extras: + - see its own README -- executes import and export filters and asserts the +UNO model to verify the resulting document is the expected one. + - also, any new C++ test that links to libsw (but does not need access to +private Writer symbols) should go in this directory, whether using the UNO +API or the internal one. +- complex: JUnit-based tests using the UNO API +- unoapi: JUnit-based test trying to get/set every UNO property, etc. commit eeb8297e47bae11f2aeaa7bae6e51eee921e9e58 Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Sep 22 12:39:20 2014 +0200 Use constants for ST_TextEffect values Change-Id: If4226bbe1124ca21893840558559b2b0e24440d3 diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index f194a13..1bb6cc1 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -16701,13 +16701,13 @@ attribute name=themeShade tokenid=ooxml:CT_Underline_themeShade/ /resource resource name=ST_TextEffect resource=List - value tokenid=0none/value - value tokenid=1lights/value - value tokenid=2blinkBackground/value - value tokenid=3sparkle/value - value tokenid=4antsBlack/value - value tokenid=5antsRed/value - value tokenid=6shimmer/value + value tokenid=ooxml:Value_ST_TextEffect_nonenone/value + value tokenid=ooxml:Value_ST_TextEffect_lightslights/value + value tokenid=ooxml:Value_ST_TextEffect_blinkBackgroundblinkBackground/value + value tokenid=ooxml:Value_ST_TextEffect_sparklesparkle/value + value tokenid=ooxml:Value_ST_TextEffect_antsBlackantsBlack/value + value tokenid=ooxml:Value_ST_TextEffect_antsRedantsRed/value + value tokenid=ooxml:Value_ST_TextEffect_shimmershimmer/value /resource resource name=CT_TextEffect resource=Value attribute name=val tokenid=ooxml:CT_TextEffect_val action=setValue/ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/picture-wrap-polygon.rtf | 47 +++ sw/qa/extras/rtfimport/rtfimport.cxx | 16 ++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |9 ++- writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 writerfilter/source/rtftok/rtfsdrimport.cxx | 38 +++ 5 files changed, 110 insertions(+), 2 deletions(-) New commits: commit 63fa1a7bc8a99800f490fb4dcd968eeb5710a631 Author: Miklos Vajna vmik...@collabora.co.uk Date: Sat Aug 16 18:00:21 2014 +0200 RTF import: handle pWrapPolygonVertices shape property Change-Id: I512713e9b9aa1ceb3d98af7a1a6abd144e370689 diff --git a/sw/qa/extras/rtfimport/data/picture-wrap-polygon.rtf b/sw/qa/extras/rtfimport/data/picture-wrap-polygon.rtf new file mode 100644 index 000..4fec72f --- /dev/null +++ b/sw/qa/extras/rtfimport/data/picture-wrap-polygon.rtf @@ -0,0 +1,47 @@ +{\rtf1\pard\plain +{\shp +{\*\shpinst\shpleft-1177\shptop-67\shpright1613\shpbottom2723\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr4\shpwrk0\shpfblwtxt1\shpz0\shplid1026 +{\sp{\sn shapeType}{\sv 75}} +{\sp +{\sn pib} +{\sv +{\pict\picscalex218\picscaley218\piccropl0\piccropr0\piccropt0\piccropb0 +\picw2258\pich2258\picwgoal1280\pichgoal1280\pngblip\bliptag1974568719 +89504e470d0a1a0a000d4948445200400040080600aa6971de000473424954080808087c0864880009704859730b120b +1201d2dd7efc001874455874536f6674776172650041646f62652046697265776f726b734fb31f4e059049444154789ced9bdd8bd45518c73fcff9bd +ccecbc38abbbea14b551a94890a4d04579515646d44d4160443782418410485df50f14417411dde47528845117929ba85d488808dbcb85a5bdd9a6bbae2f3bed +b8cefce6f73b4f1733b3ad26eeac737676dcf10be7665ece79ce73bee77b9ee739bf9fa82a4dbcfe4da918faec0a3dd966842161694001ab9c8912dd1bc57cf8 +e9d6c258f33b693ae0cd43a56db994ec2ea44d2e1b0a812798c5b2d8312c504b942b9152aad872b9aa3b3e79aab0171a0ed879b8b46d2063f60c663d72a1107a +82b75466df4062214a9472a45cb8927071dabef2f196c25e79e3e0647155ce9c2ae6bd5c3e6596dcc4af476261aa6a199b4acae7cb76ad9f4bc9ae155993cba5 +0463149dbb8fdb1ac6402e25acb026375dd39dfeb2b4bc940d0423a04b7df60d18816c202c4bc94b7e5f60867c4fb08b6d5587e179423a9435beef118a61c953 +ff7a18038127a12f8dc3bed71c0020023eda3b7bff7f50f02df4dcfe6fc202bea2688f5240517ca537f73fd4e77d670bdc1141dc3240808dcb03d6e43d065286 +52a4fc5a8e397eb1d6754cab8ba04306580b2fde9be29eac37f359211436ad0818ca78ecfbab4adc4574d3ff18d0be5156e1e14270cde46763306dd8b4dce3e8 +855ad7649c1630cd53a0dd564b944756f8371df0a1fe80285127e3b96abe6a7df5da4535864278f3a5cdf8825a71329e0bccda02ed23d67a9a39172c8aa53baa +8d4e45b0d5556d32ae1b5cd060803a6140abb5a4e678dde0008bbad38056fb7877437ede7d8f5db57c3f5963e4720d71e839a71ab090414eb1cf50ec4b715fc6 +63df6805e3e81875aa019d886fd6177cd6977c4e4ec54e98a00aa6c980765ba74eb647070222ab4e6c9ea907b8d180ceb8a03f3444b13a892615bd3d3460362e +572d89bab3d95d32d4a13d7062a2561fce916edd560c385d8a393c1e91ed73cc804ec601b782f169cbd1b18803a315b219831137f984d348b0d5947afba149aa +f3b05e043c03e940c8648430001537779816c5b78e18d06a17858c901899d7396e1a4ef03d0171c736abd4abc29dd4003f1082e0d67201d715ec997a40272341 +e37005dbc5a29c02abd31e7f4789d3a4e6566101dfaa9b485055998e958c7ff3993d3618b06734ee8abaa055add7045de502172a73f3e0f155211bfb8399686e +319b530d00f86d2a612877e3aaf06c6c7f20c3ba8988e3976b8c4e27448b542a77aa011818b954e3c9bbc2967ebe7965c8e695adfd76ac623971a9c6f07885a4 +1d1baf435d0370a4ca22fc3819538a9442e856e18a69c30b77a7589ff7f8e8f4348923c634ee05b451a76baf214a622c5ffe79d5897137c283799fa7570624ea +c66645314d0d68b741fdc1a3e17355fe987249d46bb1b13f2449dcd8ecb422640131600278ff87294ad1c2e4878550a839ac0899662ee0a229751694acf2de48 +99a99a7b751f9fb658ebce66677783cd26068250f8bd92f0f6b17f182dbbdd0e87ce55415cde0d3a4a8767433c0852301925bc756c92678a695e5b97211fb477 +3a1c395be5c844953025b8b8d1d6e6c5c842c421c640180ac6c0c1f35586cf56d8b03c64f3ea90fb9779e403433133773c1c5b383919b3ff4c85ef2e45f4a5eb +a974d795c46e08035e20a43c4812f8e94a8d915f6a58aba86d28f11c5dd40b22f5143a95168c0f2a6ed262b745d19bc0183046f03c080250ad2f61abc38ad4ff +3bf354ab237b179e01d7c330eb5a6bfe7ad0142e57b080dfecb857d1d802bde982ce6f812e43c744b05ba1ca9d67857d8548a1b5cac4128342e45be58c55d62c +b6318b01abfc6cacd52f9a995c2f35ab60ad7e25cf0e4f14c33e39653c726efc7a7bc02694ab5775ad39b075702c8ed9d14b2cb00a71cc8ee1ad8363332f4f3f +ffedc5573d9fdd22f4397171974295ab49cc8efd4f0c7c06b3de1e0778eef0c5a2e7f38e185e166168d1ac5c00a872462d9f27311f7cbd6560e6f5f97f01f618b11f3ea2336949454e44ae426082} +} +} +{\sp +{\sn pWrapPolygonVertices} +{\sv 8;11;(7781,4181);(5923,4994);(5458,14284);(7200,16839);(15445,16490);(15678,13355);(15910,11497);(16026,7432);(12078,6271);(10219,5110);(7781,4181)} +} +{\sp +{\sn fBehindDocument} +{\sv 1} +} +} +} +Suddenly next to him, with a barely noticeable squeak, a door swung quietly to and fro in the night's breeze. Could this be the haven he'd prayed for? Slowly he slid toward the door, pressing himself more and more into the wall, into the dark, away from his enemy. Would
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/rtfimport.cxx | 13 + writerfilter/source/rtftok/rtfdocumentimpl.cxx | 25 + 2 files changed, 38 insertions(+) New commits: commit 008d1187a9f3b36d6cbf31742632d237afecf1bd Author: Michael Stahl mst...@redhat.com Date: Fri Aug 1 10:47:49 2014 +0200 fdo#81893: writerfilter: RTF import: \qc before \page was lost The paragraph properties need to be applied to the paragraph following the \page too, which did not happen in this case. Also the minimized test doc shows that checkNeedPap() must be preceded by checkFirstRun(), since there is no run preceding the \page. (regression from 94765a1b3f543b3b60f8c1de05048d12f2576be4) Change-Id: Id286c4fbdeee688fa4f6b24063b634bac637eab6 diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 5c033c2..dd4367a 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -343,6 +343,10 @@ DECLARE_RTFIMPORT_TEST(testFdo81892, fdo81892.rtf) uno::Referencecontainer::XIndexAccess xTables(xTextTablesSupplier-getTextTables(), uno::UNO_QUERY); uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getPropertysal_Int16(xTable, HoriOrient)); + +// fdo#81893: paragraph with \page was not centered +uno::Referencetext::XTextRange xPara(getParagraph(2, Performance)); +CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_caststyle::ParagraphAdjust(getPropertysal_Int16(xPara, ParaAdjust))); } DECLARE_RTFIMPORT_TEST(testFdo45394, fdo45394.rtf) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 61398ea..de0bdaa 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2291,11 +2291,15 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } else { +checkFirstRun(); checkNeedPap(); sal_uInt8 sBreak[] = { 0xc }; Mapper().text(sBreak, 1); if (!m_bNeedPap) +{ parBreak(); +m_bNeedPap = true; +} m_bNeedCr = true; } } commit df041e468baf604f6e2606e5b632aa654b19a65d Author: Michael Stahl mst...@redhat.com Date: Fri Aug 1 10:44:00 2014 +0200 fdo#81892: writerfilter: RTF import: add support for table row alignment These keywords were simply not implemented. Change-Id: Ib4d07a4b2dfb07cfd56a4ee07d7c14d1c59323f9 diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index bb9cbb4..5c033c2 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -336,6 +336,15 @@ DECLARE_RTFIMPORT_TEST(testFdo46955, fdo46955.rtf) } } +DECLARE_RTFIMPORT_TEST(testFdo81892, fdo81892.rtf) +{ +// table was not centered +uno::Referencetext::XTextTablesSupplier xTextTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTextTablesSupplier-getTextTables(), uno::UNO_QUERY); +uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getPropertysal_Int16(xTable, HoriOrient)); +} + DECLARE_RTFIMPORT_TEST(testFdo45394, fdo45394.rtf) { uno::Referencetext::XText xHeaderText = getProperty uno::Referencetext::XText (getStyles(PageStyles)-getByName(DEFAULT_STYLE), HeaderText); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3bba4c4..61398ea 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2683,6 +2683,27 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) return 0; } +switch (nKeyword) +{ +case RTF_TRQL: +nParam = 0; +break; +case RTF_TRQC: +nParam = 1; +break; +case RTF_TRQR: +nParam = 2; +break; +default: +break; +} +if (nParam = 0) +{ +RTFValue::Pointer_t const pValue(new RTFValue(nParam)); +m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_jc, pValue); +return 0; +} + // Cell Text Flow switch (nKeyword) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo81033.rtf | 12 sw/qa/extras/rtfimport/rtfimport.cxx | 14 ++ writerfilter/source/dmapper/DomainMapper.cxx |5 - writerfilter/source/dmapper/DomainMapper_Impl.hxx |9 +++-- 4 files changed, 37 insertions(+), 3 deletions(-) New commits: commit c0b6aadedc9429eee4f4df85957e00e29ccb0c8f Author: Michael Stahl mst...@redhat.com Date: Mon Jul 28 18:14:16 2014 +0200 (related: fdo#81033) writerfilter: default tab fill character is space This avoids an ugly Character box in the dialog with a null byte in it. Change-Id: Iee35a8e1bd6b57fb4eb8ae06722bd79ee1d5d8de diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f72c331f..bb9cbb4 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1388,7 +1388,7 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, fdo81033.rtf) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabs.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(5808), tabs[0].Position); CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[0].Alignment); -CPPUNIT_ASSERT_EQUAL(sal_Unicode(0), tabs[0].FillChar); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(' '), tabs[0].FillChar); CPPUNIT_ASSERT_EQUAL(sal_Int32(16002), tabs[1].Position); CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[1].Alignment); CPPUNIT_ASSERT_EQUAL(sal_Unicode('_'), tabs[1].FillChar); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ebf7426..21c66af 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -215,8 +215,13 @@ typedef std::stack AnchoredContext TextContentStack; struct DeletableTabStop : public ::com::sun::star::style::TabStop { bool bDeleted; -DeletableTabStop() : -bDeleted( false ){} +DeletableTabStop() +: bDeleted(false) +{ +// same defaults as SvxXMLTabStopContext_Impl +FillChar = ' '; +DecimalChar = ','; +} DeletableTabStop( const ::com::sun::star::style::TabStop rTabStop ) : TabStop( rTabStop ), bDeleted( false ){} commit 7f6e26917d4aa682ed9c422c83b1df20d78177d2 Author: Michael Stahl mst...@redhat.com Date: Mon Jul 28 17:57:53 2014 +0200 fdo#81033: writerfilter: RTF import: fix tab stop inheritance from style For RTF, the tab stops that are set directly on the paragraph are the tab stops the paragraph has effectively; there is no equivalent of OOXML w:tab w:val=clear w:pos=4536/ that would override a tab stop of the applied style; that is done by simply omitting the tab stop. It would perhaps be possible to implement something to synthesize a NS_ooxml::LN_Value_ST_TabJc_clear in the RTF tokenizer for this case, but it's simpler to just generally disable domain mapper's InitTabStopFromStyle() for RTF. Change-Id: I7b0581be8db19ffda81c8d1da290abf0a0f69529 diff --git a/sw/qa/extras/rtfimport/data/fdo81033.rtf b/sw/qa/extras/rtfimport/data/fdo81033.rtf new file mode 100644 index 000..500aeb7 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo81033.rtf @@ -0,0 +1,12 @@ +{\rtf1 +{\stylesheet +{\s15\ql \tqc\tx4536\tqr\tx9072 header;} +} + +\deftab709 +\pard\plain \s15\ql \tx3293\tlul\tx9072 +\tab +\tab + +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f7763b3..f72c331f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1380,6 +1380,20 @@ DECLARE_RTFIMPORT_TEST(testGroupshape_notext, groupshape-notext.rtf) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape-getCount()); } +DECLARE_RTFIMPORT_TEST(testFdo81033, fdo81033.rtf) +{ +// Number of tabstops in the paragraph should be 2, was 3. +uno::Sequencestyle::TabStop tabs( +getProperty uno::Sequencestyle::TabStop (getParagraph(1), ParaTabStops)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabs.getLength()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(5808), tabs[0].Position); +CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[0].Alignment); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(0), tabs[0].FillChar); +CPPUNIT_ASSERT_EQUAL(sal_Int32(16002), tabs[1].Position); +CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[1].Alignment); +CPPUNIT_ASSERT_EQUAL(sal_Unicode('_'), tabs[1].FillChar); +} + DECLARE_RTFIMPORT_TEST(testFdo66565, fdo66565.rtf) { uno::Referencetext::XTextTablesSupplier xTextTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index a6c71b1..7e598d7 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1718,7 +1718,10 @@ void DomainMapper::sprmWithProps( Sprm rSprm, PropertyMapPtr rContext )
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/footer-body-distance.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx|7 ++ writerfilter/source/dmapper/PropertyMap.cxx | 53 +++- 3 files changed, 31 insertions(+), 29 deletions(-) New commits: commit f3145f74a2829526169a44696dbd3c16b2c5ae77 Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Jul 14 15:38:51 2014 +0200 Clean up SectionPropertyMap::PrepareHeaderFooterProperties() If you copy the class members on the stack and tweak those (and not class members), then there is no need to manually restore the copy at the end of the method. Change-Id: I42b50cd6b99b6b277dd9809b40385ef6512ef141 diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index eb83a35..ff76c13 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -791,32 +791,32 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) sal_Int32 nHeaderTop = m_nHeaderTop; if(HasHeader(bFirstPage)) { -m_nTopMargin = m_nHeaderTop; -if( nTopMargin 0 nTopMargin m_nHeaderTop ) -m_nHeaderTop = nTopMargin - m_nHeaderTop; +nTopMargin = nHeaderTop; +if( m_nTopMargin 0 m_nTopMargin nHeaderTop ) +nHeaderTop = m_nTopMargin - nHeaderTop; else -m_nHeaderTop = 0; +nHeaderTop = 0; //minimum header height 1mm -if( m_nHeaderTop MIN_HEAD_FOOT_HEIGHT ) -m_nHeaderTop = MIN_HEAD_FOOT_HEIGHT; +if( nHeaderTop MIN_HEAD_FOOT_HEIGHT ) +nHeaderTop = MIN_HEAD_FOOT_HEIGHT; } -if( nTopMargin = 0 ) //fixed height header - see WW8Par6.hxx +if( m_nTopMargin = 0 ) //fixed height header - see WW8Par6.hxx { operator[](PROP_HEADER_IS_DYNAMIC_HEIGHT) = uno::makeAny( true ); operator[](PROP_HEADER_DYNAMIC_SPACING) = uno::makeAny( true ); -operator[](PROP_HEADER_BODY_DISTANCE) = uno::makeAny( m_nHeaderTop - MIN_HEAD_FOOT_HEIGHT );// ULSpace.Top() -operator[](PROP_HEADER_HEIGHT) = uno::makeAny( m_nHeaderTop ); +operator[](PROP_HEADER_BODY_DISTANCE) = uno::makeAny( nHeaderTop - MIN_HEAD_FOOT_HEIGHT );// ULSpace.Top() +operator[](PROP_HEADER_HEIGHT) = uno::makeAny( nHeaderTop ); } else { //todo: old filter fakes a frame into the header/footer to support overlapping //current setting is completely wrong! -operator[](PROP_HEADER_HEIGHT) = uno::makeAny( m_nHeaderTop ); -operator[](PROP_HEADER_BODY_DISTANCE) = uno::makeAny( nTopMargin - m_nHeaderTop ); +operator[](PROP_HEADER_HEIGHT) = uno::makeAny( nHeaderTop ); +operator[](PROP_HEADER_BODY_DISTANCE) = uno::makeAny( m_nTopMargin - nHeaderTop ); operator[](PROP_HEADER_IS_DYNAMIC_HEIGHT) = uno::makeAny( false ); operator[](PROP_HEADER_DYNAMIC_SPACING) = uno::makeAny( false ); } @@ -825,21 +825,21 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) sal_Int32 nHeaderBottom = m_nHeaderBottom; if( HasFooter( bFirstPage ) ) { -m_nBottomMargin = m_nHeaderBottom; -if( nBottomMargin 0 nBottomMargin m_nHeaderBottom ) -m_nHeaderBottom = nBottomMargin - m_nHeaderBottom; +nBottomMargin = nHeaderBottom; +if( m_nBottomMargin 0 m_nBottomMargin nHeaderBottom ) +nHeaderBottom = m_nBottomMargin - nHeaderBottom; else -m_nHeaderBottom = 0; -if( m_nHeaderBottom MIN_HEAD_FOOT_HEIGHT ) -m_nHeaderBottom = MIN_HEAD_FOOT_HEIGHT; +nHeaderBottom = 0; +if( nHeaderBottom MIN_HEAD_FOOT_HEIGHT ) +nHeaderBottom = MIN_HEAD_FOOT_HEIGHT; } -if( nBottomMargin = 0 ) //fixed height footer - see WW8Par6.hxx +if( m_nBottomMargin = 0 ) //fixed height footer - see WW8Par6.hxx { operator[](PROP_FOOTER_IS_DYNAMIC_HEIGHT) = uno::makeAny( true ); operator[](PROP_FOOTER_DYNAMIC_SPACING) = uno::makeAny( true ); -operator[](PROP_FOOTER_BODY_DISTANCE) = uno::makeAny( m_nHeaderBottom - MIN_HEAD_FOOT_HEIGHT); -operator[](PROP_FOOTER_HEIGHT) = uno::makeAny( m_nHeaderBottom ); +operator[](PROP_FOOTER_BODY_DISTANCE) = uno::makeAny( nHeaderBottom - MIN_HEAD_FOOT_HEIGHT); +operator[](PROP_FOOTER_HEIGHT) = uno::makeAny( nHeaderBottom ); } else { @@ -847,19 +847,13 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) //current setting is completely wrong! operator[](PROP_FOOTER_IS_DYNAMIC_HEIGHT) = uno::makeAny( false ); operator[](PROP_FOOTER_DYNAMIC_SPACING) = uno::makeAny( false ); -operator[](PROP_FOOTER_HEIGHT) = uno::makeAny( nBottomMargin - m_nHeaderBottom ); -operator[](PROP_FOOTER_BODY_DISTANCE) =
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo70578.rtf | 11 +++ sw/qa/extras/rtfimport/rtfimport.cxx | 21 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 48 - writerfilter/source/rtftok/rtfsprm.cxx | 70 + writerfilter/source/rtftok/rtfsprm.hxx |6 +- writerfilter/source/rtftok/rtfvalue.cxx|8 ++ writerfilter/source/rtftok/rtfvalue.hxx|1 7 files changed, 149 insertions(+), 16 deletions(-) New commits: commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 Author: Michael Stahl mst...@redhat.com Date: Tue Jun 17 18:40:04 2014 +0200 n#825305: writerfilter RTF import: override style properties like Word It would certainly be immediately obvious to any reader of the RTF spec that \sN will apply the style with index N to the current paragraph. But actually, that is not what Word does when it reads \sN... what it really does is to apply the style with index N, and then for every attribute in that style, apply the same attribute with a default value to the paragraph, effectively overriding what's in the style. If that doesn't make any sense to you, well, have you heard the joke about how many Microsoft engineers it takes to change a light bulb? Also, \pard apparently implies \s0. To implement that, change RTFSprms::deduplicate() to recursively look for style SPRMs that are missing in the properties, and put in default ones, currently just for 2 keywords \sa and \sb. This requires changing deduplicate() to be const and return a new value, since it is no longer idempotent, as the erased SPRMs would get defaulted on the next run. While at it, fix RTFValue::equals() which did not compare m_sValue. This fixes the testParaBottomMargin test that was broken by the fix for fdo#70578. Change-Id: I4ced38628d76f6c41b488d608a804883493ff00b diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3699db8..79a4494 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1173,8 +1173,18 @@ DECLARE_RTFIMPORT_TEST(testN825305, n825305.rtf) DECLARE_RTFIMPORT_TEST(testParaBottomMargin, para-bottom-margin.rtf) { +uno::Referencebeans::XPropertySet xPropertySet( +getStyles(ParagraphStyles)-getByName(Standard), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(353), +getPropertysal_Int32(xPropertySet, ParaBottomMargin)); + // This was 353, i.e. bottom margin of the paragraph was 0.35cm instead of 0. +// The reason why this is 0 despite the default style containing \sa200 +// is that Word will actually interpret \sN (or \pard which apparently +// implies \s0) as set style N and for every attribute of that style, +// set an attribute with default value on the paragraph CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getPropertysal_Int32(getParagraph(1), ParaBottomMargin)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getPropertysal_Int32(getParagraph(1), ParaTopMargin)); } DECLARE_RTFIMPORT_TEST(testN823655, n823655.rtf) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2d2dad7..465ada3 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -443,8 +443,12 @@ writerfilter::ReferenceProperties::Pointer_t RTFDocumentImpl::getProperties(RT { RTFReferenceProperties rProps = *(RTFReferenceProperties*)it-second.get(); // Get rid of direct formatting what is already in the style. -rSprms.deduplicate(rProps.getSprms()); -rAttributes.deduplicate(rProps.getAttributes()); +RTFSprms const sprms( +rSprms.cloneAndDeduplicate(rProps.getSprms())); +RTFSprms const attributes( +rAttributes.cloneAndDeduplicate(rProps.getAttributes())); +return writerfilter::ReferenceProperties::Pointer_t( +new RTFReferenceProperties(attributes, sprms)); } writerfilter::ReferenceProperties::Pointer_t pRet(new RTFReferenceProperties(rAttributes, rSprms)); return pRet; @@ -2759,6 +2763,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; + if (m_nTopLevelCells == 0 m_nNestedCells == 0) { // Reset that we're in a table. @@ -2772,7 +2777,20 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().resetFrame(); // Reset currently selected paragraph style as well. -m_aStates.top().nCurrentStyleIndex = -1; +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo76633.rtf | 32 +++ sw/qa/extras/rtfimport/rtfimport.cxx | 12 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 41 ++--- writerfilter/source/rtftok/rtfsdrimport.cxx| 11 -- writerfilter/source/rtftok/rtfsdrimport.hxx|5 ++- 5 files changed, 86 insertions(+), 15 deletions(-) New commits: commit ba9b63d8101197d3fd8612193b1ca188271dfc1a Author: Michael Stahl mst...@redhat.com Date: Fri Jun 13 14:47:05 2014 +0200 fdo#76633: writerfilter: RTF import: do not leak the XShape of image RTFSdrImport::resolve() is called for \picprop and creates an XShape that is stored in RTFSdrImport::m_xShape and also DomainMapper_Impl::m_aPendingShapes; later RTFDocumentImpl::resolvePict() completely ignores that XShape and creates a new one, which is also inserted in the document; the first XShape is effectively leaked. Try to avoid that by re-using the exising m_xShape in resolvePict(). Not sure if there are any problems with doing this, it's all a bit confusing. Change-Id: I98456242acb0766f547eb8f7d877f51d53323f3a diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 50b2b27..89366d0 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -577,14 +577,11 @@ DECLARE_RTFIMPORT_TEST(testFdo76633, fdo76633.rtf) // check that there is only a graphic object, not an additional rectangle uno::Referencelang::XServiceInfo xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xShape.is()); -#if 0 -// disabled - fails currently CPPUNIT_ASSERT(xShape-supportsService(com.sun.star.text.TextGraphicObject)); try { uno::Referencedrawing::XShape xShape2(getShape(2), uno::UNO_QUERY); CPPUNIT_FAIL(exception expected); } catch (lang::IndexOutOfBoundsException const) { /* expected */ } -#endif } DECLARE_RTFIMPORT_TEST(testFdo48033, fdo48033.rtf) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d882378..5f67432 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -771,16 +771,29 @@ int RTFDocumentImpl::resolvePict(bool bInline) // Wrap it in an XShape. uno::Referencedrawing::XShape xShape; -if (m_xModelFactory.is()) - xShape.set(m_xModelFactory-createInstance(com.sun.star.drawing.GraphicObjectShape), uno::UNO_QUERY); -uno::Referencebeans::XPropertySet xPropertySet(xShape, uno::UNO_QUERY); -uno::Referencedrawing::XDrawPageSupplier xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); -if (xDrawSupplier.is()) +xShape = m_pSdrImport-getCurrentShape();//Mapper().PopPendingShape(); +if (xShape.is()) { -uno::Reference drawing::XShapes xShapes(xDrawSupplier-getDrawPage(), uno::UNO_QUERY); -if (xShapes.is()) -xShapes-add(xShape); +uno::Referencelang::XServiceInfo xSI(xShape, uno::UNO_QUERY_THROW); + assert(xSI-supportsService(com.sun.star.drawing.GraphicObjectShape)); } +else +{ +if (m_xModelFactory.is()) +xShape.set(m_xModelFactory-createInstance( +com.sun.star.drawing.GraphicObjectShape), uno::UNO_QUERY); +uno::Referencedrawing::XDrawPageSupplier const xDrawSupplier( +m_xDstDoc, uno::UNO_QUERY); +if (xDrawSupplier.is()) +{ +uno::Referencedrawing::XShapes xShapes( +xDrawSupplier-getDrawPage(), uno::UNO_QUERY); +if (xShapes.is()) +xShapes-add(xShape); +} +} + +uno::Referencebeans::XPropertySet xPropertySet(xShape, uno::UNO_QUERY); // check if the picture is in an OLE object and if the \objdata element is used // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 5d0424a..a47731d 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -226,7 +226,10 @@ void RTFSdrImport::resolve(RTFShape rShape, bool bClose, uno::Referencedrawing::XShape xShape; uno::Referencebeans::XPropertySet xPropertySet; // Create this early, as custom shapes may have properties before the type arrives. -createShape(com.sun.star.drawing.CustomShape, xShape, xPropertySet); +if (PICT == shapeOrPict) +createShape(com.sun.star.drawing.GraphicObjectShape, xShape, xPropertySet); +else +createShape(com.sun.star.drawing.CustomShape, xShape, xPropertySet); uno::Any aAny; beans::PropertyValue aPropertyValue; awt::Rectangle aViewBox; diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 770aff4..0b69589 100644 ---
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/linenumbering.rtf |8 +++ sw/qa/extras/rtfexport/rtfexport.cxx |8 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 65 - writerfilter/source/rtftok/rtfsprm.cxx |8 +-- writerfilter/source/rtftok/rtfsprm.hxx | 16 +++--- 5 files changed, 61 insertions(+), 44 deletions(-) New commits: commit dcb88d170b6ced0ee805b787c1e9be820ff90d25 Author: Miklos Vajna vmik...@collabora.co.uk Date: Sun Apr 6 18:05:43 2014 +0200 Testcase for RtfAttributeOutput::SectionLineNumbering() lcov pointed out this method wasn't ever invoked in any of the tests. Change-Id: I6cccf4fc1d870938a2f218bedc0b8d195a299cd1 diff --git a/sw/qa/extras/rtfexport/data/linenumbering.rtf b/sw/qa/extras/rtfexport/data/linenumbering.rtf new file mode 100644 index 000..7cafe2a --- /dev/null +++ b/sw/qa/extras/rtfexport/data/linenumbering.rtf @@ -0,0 +1,8 @@ +{\rtf1 +\linemod5\linex283\linecont +1\par +2\par +3\par +4\par +5\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 0aba10b..3f277cb 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -611,6 +611,14 @@ DECLARE_RTFEXPORT_TEST(testRelsize, relsize.rtf) CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getPropertysal_Int16(xShape, RelativeHeightRelation)); } +DECLARE_RTFEXPORT_TEST(testLineNumbering, linenumbering.rtf) +{ +uno::Referencetext::XLineNumberingProperties xLineNumberingProperties(mxComponent, uno::UNO_QUERY_THROW); +uno::Referencebeans::XPropertySet xPropertySet = xLineNumberingProperties-getLineNumberingProperties(); +CPPUNIT_ASSERT_EQUAL(true, bool(getPropertysal_Bool(xPropertySet, IsOn))); +CPPUNIT_ASSERT_EQUAL(sal_Int32(5), getPropertysal_Int32(xPropertySet, Interval)); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); commit 69c950ae862f9ea9c5f56d8bdba895fb9a07ff0f Author: Miklos Vajna vmik...@collabora.co.uk Date: Sun Apr 6 17:19:03 2014 +0200 RTFSprms::set: replace two bool arguments with an enum The primary motivation is that the two bools allow 4 combinations, but we only handle 3 of them. Also, caller code is much more readable, now that a non-default overwrite mode is written explicitly. Change-Id: Iedf7dee1ab2d33de849aef6d7a51138d35048e5a diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 287fb03..39da5cc 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -75,7 +75,7 @@ static Id lcl_getParagraphBorder(sal_uInt32 nIndex) } static void lcl_putNestedAttribute(RTFSprms rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue, -bool bOverwrite = true, bool bAttribute = true, bool bAppend = true) +RTFOverwrite eOverwrite = OVERWRITE_YES, bool bAttribute = true) { RTFValue::Pointer_t pParent = rSprms.find(nParent); if (!pParent.get()) @@ -88,16 +88,16 @@ static void lcl_putNestedAttribute(RTFSprms rSprms, Id nParent, Id nId, RTFValu aAttributes.set(NS_ooxml::LN_CT_Shd_fill, RTFValue::Pointer_t(new RTFValue(0x0a))); } RTFValue::Pointer_t pParentValue(new RTFValue(aAttributes)); -rSprms.set(nParent, pParentValue, bOverwrite, bAppend); +rSprms.set(nParent, pParentValue, eOverwrite); pParent = pParentValue; } RTFSprms rAttributes = (bAttribute ? pParent-getAttributes() : pParent-getSprms()); -rAttributes.set(nId, pValue, bOverwrite, bAppend); +rAttributes.set(nId, pValue, eOverwrite); } -static void lcl_putNestedSprm(RTFSprms rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue, bool bOverwrite = false) +static void lcl_putNestedSprm(RTFSprms rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue, RTFOverwrite eOverwrite = OVERWRITE_NO_APPEND) { -lcl_putNestedAttribute(rSprms, nParent, nId, pValue, bOverwrite, false); +lcl_putNestedAttribute(rSprms, nParent, nId, pValue, eOverwrite, false); } static RTFValue::Pointer_t lcl_getNestedAttribute(RTFSprms rSprms, Id nParent, Id nId) @@ -2247,7 +2247,7 @@ void RTFDocumentImpl::restoreTableRowProperties() void RTFDocumentImpl::resetTableRowProperties() { m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms; -m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, RTFValue::Pointer_t(new RTFValue(-1)), false); +m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, RTFValue::Pointer_t(new RTFValue(-1)), OVERWRITE_NO_APPEND); m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes; if (DESTINATION_NESTEDTABLEPROPERTIES == m_aStates.top().nDestinationState) m_nNestedCurrentCellX = 0; @@ -3542,7 +3542,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) rCurrentCellX = nParam;
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/strict.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 +++ writerfilter/source/ooxml/OOXMLFactory.cxx | 12 +++ writerfilter/source/ooxml/OOXMLFactory.hxx |3 + writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 34 + writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx | 15 + writerfilter/source/ooxml/factoryimpl.xsl |1 writerfilter/source/ooxml/model.xml|6 +-- 8 files changed, 79 insertions(+), 4 deletions(-) New commits: commit 37cc7e7471ba3b11cefcb0218c27e2c745886a6d Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Mar 7 14:44:10 2014 +0100 DOCX import: handle points in ST_TwipsMeasure and ST_SignedTwipsMeasure This fixes page size and margins in case of strict DOCX. Change-Id: I65894eeef191a0f4bd92d1fa69a17e820aae3a43 diff --git a/sw/qa/extras/ooxmlimport/data/strict.docx b/sw/qa/extras/ooxmlimport/data/strict.docx new file mode 100644 index 000..4195398 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/strict.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4f384d8..2503c81 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1903,6 +1903,18 @@ DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeRunFonts, dml-groupshape-runfonts.doc CPPUNIT_ASSERT_EQUAL(OUString(Arial Unicode MS), getPropertyOUString(xRun, CharFontNameComplex)); CPPUNIT_ASSERT_EQUAL(OUString(MS Mincho), getPropertyOUString(xRun, CharFontNameAsian)); } + +DECLARE_OOXMLIMPORT_TEST(testStrict, strict.docx) +{ +uno::Referencebeans::XPropertySet xPageStyle(getStyles(PageStyles)-getByName(DEFAULT_STYLE), uno::UNO_QUERY); +// This was only 127, pt suffix was ignored, so this got parsed as twips instead of points. +CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(72 * 20)), getPropertysal_Int32(xPageStyle, TopMargin)); +// This was only 1397, same issue +CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(792 * 20)), getPropertysal_Int32(xPageStyle, Height)); +// Text was missing, due to not handling the strict namespaces. +getParagraph(1, Hello world!); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx index cb7f1b7..6d227af1 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx @@ -670,7 +670,10 @@ OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(sal_uInt32 nValue) OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const OUString rValue) { -mnValue = rValue.toInt32(); +if (rValue.endsWith(pt)) +mnValue = rValue.copy(0, rValue.getLength() - 2).toInt32() * 20; +else +mnValue = rValue.toInt32(); } OOXMLUniversalMeasureValue::~OOXMLUniversalMeasureValue() diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 406609a..0a84d4f 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -22996,7 +22996,7 @@ attribute name=val tokenid=ooxml:CT_TwipsMeasure_val action=setValue/ action name=start action=setDefaultIntegerValue/ /resource -resource name=ST_SignedTwipsMeasure resource=Integer/ +resource name=ST_SignedTwipsMeasure resource=UniversalMeasure/ resource name=CT_SignedTwipsMeasure resource=Value tag=attribute attribute name=val tokenid=ooxml:CT_SignedTwipsMeasure_val action=setValue/ action name=start action=setDefaultIntegerValue/ commit d5d7c7d3b281e1a9060d60bc4ac7738ae616f167 Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Mar 7 14:27:11 2014 +0100 writerfilter: introduce ooxml::OOXMLUniversalMeasureValue In transitional DOCX, ST_UniversalMeasure is in practice a simple integer, which means twips. But in case of strict, ST_UniversalMeasure is in points in practice -- which is perfectly valid, but we didn't handle it so far. Add a separate Value class that is used only for handling ST_UniversalMeasure, then there we can handle the various additional suffixes. Change-Id: Iebb1ee859076595594d1455a1f826841dae77a0b diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx index 5d683cb..8e2fa15 100644 --- a/writerfilter/source/ooxml/OOXMLFactory.cxx +++ b/writerfilter/source/ooxml/OOXMLFactory.cxx @@ -202,6 +202,18 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler, pFactory-attributeAction(pHandler, aIt-first, pValue); } break; +case RT_UniversalMeasure: +{ +#ifdef DEBUG_FACTORY +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 +++--- writerfilter/source/dmapper/DomainMapperTableManager.cxx | 11 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) New commits: commit 08ab57473236b0a34917d8c24c56f157e9ae5be6 Author: Miklos Vajna vmik...@collabora.co.uk Date: Thu Feb 13 10:20:54 2014 +0100 CppunitTest_sw_ooxmlimport: make this actually test something again Change-Id: I05d8b0dafcdea68d57137873ea52d4ab28a9b12b diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index c9d578b..3b3a227 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1339,11 +1339,10 @@ DECLARE_OOXMLIMPORT_TEST(testFdo65632, fdo65632.docx) DECLARE_OOXMLIMPORT_TEST(testFdo66474, fdo66474.docx) { -// The table wasn't relative (relative with was 0), so the table didn't -// take the full available width, like it would have to. +// The table width was too small, so the text in the second cell was unreadable: this was 1397. uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getPropertysal_Int16(xTables-getByIndex(0), RelativeWidth)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(10492), getPropertysal_Int32(xTables-getByIndex(0), Width)); } DECLARE_OOXMLIMPORT_TEST(testGroupshapeRotation, groupshape-rotation.docx) commit 4d34d43b29be2b14a02b001b35fcde2459fb1993 Author: sushil_shinde sushil.shi...@synerzip.com Date: Wed Jan 22 17:10:11 2014 +0530 fdo#69656 table with auto-width and at least one column with auto-width. - In case of auto width of table and atleast one cell of table is auto width It was setting table width to 100% relative width. - hence it was causing rederening problem, table width was wrong while rendering. - Changed 100% hardcoded value, now setting total width of table as per grid values. - modified one UT since we no longer setting width of table to 100% default in case of 'auto' width. - Added one UT to check proper table width while importing. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Reviewed on: https://gerrit.libreoffice.org/7593 Change-Id: Iae396c632eb1ef0c06efaa8c1965e4a68f12c6b1 diff --git a/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx b/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx new file mode 100644 index 000..10b8f9d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/Table_cell_auto_width_fdo69656.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f9a0240..c9d578b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1343,7 +1343,7 @@ DECLARE_OOXMLIMPORT_TEST(testFdo66474, fdo66474.docx) // take the full available width, like it would have to. uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getPropertysal_Int16(xTables-getByIndex(0), RelativeWidth)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getPropertysal_Int16(xTables-getByIndex(0), RelativeWidth)); } DECLARE_OOXMLIMPORT_TEST(testGroupshapeRotation, groupshape-rotation.docx) @@ -1842,6 +1842,13 @@ DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, picture-with-schemecolor.d CPPUNIT_ASSERT_EQUAL( static_castsal_Int8(110), aDIB[136] ); CPPUNIT_ASSERT_EQUAL( static_castsal_Int8(49), aDIB[137] ); } + +DECLARE_OOXMLIMPORT_TEST(testFdo69656, Table_cell_auto_width_fdo69656.docx) +{ +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(8154), getPropertysal_Int32(xTables-getByIndex(0), Width)); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 2b66761..29d28b4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -169,7 +169,7 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) { // Set the width type of table with 'Auto' and set the width value to 100(%) pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE ); -
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/fdo65295.docx |binary sw/qa/extras/ooxmlimport/data/mce-nested.docx |binary sw/qa/extras/ooxmlimport/data/wps-only.docx |binary writerfilter/source/dmapper/GraphicImport.cxx | 50 -- 4 files changed, 31 insertions(+), 19 deletions(-) New commits: commit 41acd107e78bb45ac8a6bb632ed5432d6d9deb9f Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Dec 6 16:21:42 2013 +0100 DOCX drawingml shape import: handle name and z-order Change-Id: Ib4e17723ba9e2bb4dae0eb86cf55513a4b68de6f diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index fab8788..e293b0c 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -378,6 +378,33 @@ public: xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ), uno::makeAny(nVertRelation)); } + +void applyZOrder(uno::Referencebeans::XPropertySet xGraphicObjectProperties) const +{ +PropertyNameSupplier rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); +if (zOrder = 0) +{ +GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper(); + xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper-findZOrder(zOrder))); +pZOrderHelper-addItem(xGraphicObjectProperties, zOrder); +} +} + +void applyName(uno::Referencebeans::XPropertySet xGraphicObjectProperties) const +{ +try +{ +if( !sName.isEmpty() ) +{ +uno::Reference container::XNamed xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW ); +xNamed-setName( sName ); +} +} +catch( const uno::Exception e ) +{ +SAL_WARN(writerfilter, failed. Message : e.Message); +} +} }; @@ -1045,6 +1072,8 @@ void GraphicImport::lcl_attribute(Id nName, Value val) bool bOpaque = m_pImpl-bOpaque !m_pImpl-rDomainMapper.IsInHeaderFooter(); xShapeProps-setPropertyValue(Opaque, uno::makeAny(bOpaque)); xShapeProps-setPropertyValue(Surround, uno::makeAny(m_pImpl-nWrap)); +m_pImpl-applyZOrder(xShapeProps); +m_pImpl-applyName(xShapeProps); } } } @@ -1581,13 +1610,7 @@ uno::Reference text::XTextContent GraphicImport::createGraphicObject( const b xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_BACK_COLOR ), uno::makeAny( m_pImpl-nFillColor )); -if( m_pImpl-zOrder = 0 ) -{ -GraphicZOrderHelper* zOrderHelper = m_pImpl-rDomainMapper.graphicZOrderHelper(); - xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_Z_ORDER ), -uno::makeAny( zOrderHelper-findZOrder( m_pImpl-zOrder ))); -zOrderHelper-addItem( xGraphicObjectProperties, m_pImpl-zOrder ); -} +m_pImpl-applyZOrder(xGraphicObjectProperties); //there seems to be no way to detect the original size via _real_ API uno::Reference beans::XPropertySet xGraphicProperties( xGraphic, uno::UNO_QUERY_THROW ); @@ -1635,18 +1658,7 @@ uno::Reference text::XTextContent GraphicImport::createGraphicObject( const b xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName(PROP_SIZE), uno::makeAny( awt::Size( m_pImpl-getXSize(), m_pImpl-getYSize() ))); m_pImpl-applyMargins(xGraphicObjectProperties); -try -{ -if( !m_pImpl-sName.isEmpty() ) -{ -uno::Reference container::XNamed xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW ); -xNamed-setName( m_pImpl-sName ); -} -} -catch( const uno::Exception e ) -{ -SAL_WARN(writerfilter, failed. Message : e.Message); -} +m_pImpl-applyName(xGraphicObjectProperties); } } } commit 627bfee26354fe59926607138d162a3dd1c8e3f6 Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Dec 6 16:28:53 2013 +0100 sw: remove unused zorder data from bugdocs Expecting that the shapes are on the drawpage in the same order as they are in the file and providing zorder info at the same time doesn't work. Either using names is required or the simpler way is not providing zorder info. Fixed earlier bugdocs not to provide
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/mce.docx|binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |6 ++ sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 writerfilter/source/dmapper/GraphicImport.cxx | 11 +-- writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |4 6 files changed, 23 insertions(+), 6 deletions(-) New commits: commit 197ec9cf1b7f50e0221c12e05dbc3e0064a82352 Author: Miklos Vajna vmik...@collabora.co.uk Date: Tue Dec 3 15:19:56 2013 +0100 DOCX drawingML groupshape import: fix relative position Change-Id: Ice07f423707b48a013a9b6325b11f88206c38e60 diff --git a/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx new file mode 100644 index 000..cd853f9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 853c316..b0903b6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1555,6 +1555,14 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, wpg-only.docx) CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape-getPosition().X); } +DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, textbox-wpg-only.docx) +{ +uno::Referencedrawing::XShape xShape = getShape(1); +// The relativeFrom attribute was ignored for groupshapes, i.e. these were text::RelOrientation::FRAME. +CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getPropertysal_Int16(xShape, HoriOrientRelation)); +CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getPropertysal_Int16(xShape, VertOrientRelation)); +} + DECLARE_OOXMLIMPORT_TEST(testFdo70457, fdo70457.docx) { // The document contains a rotated bitmap diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index f1c161b..8962f39 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -360,14 +360,19 @@ public: PropertyNameSupplier rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT ), uno::makeAny(nHoriOrient)); +xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT ), +uno::makeAny(nVertOrient)); +} + +void applyRelativePosition(uno::Reference beans::XPropertySet xGraphicObjectProperties) const +{ +PropertyNameSupplier rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_POSITION), uno::makeAny(nLeftPosition)); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_RELATION ), uno::makeAny(nHoriRelation)); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_TOGGLE ), uno::makeAny(bPageToggle)); -xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT ), -uno::makeAny(nVertOrient)); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_POSITION), uno::makeAny(nTopPosition)); xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ), @@ -1034,6 +1039,7 @@ void GraphicImport::lcl_attribute(Id nName, Value val) // Position of the groupshape should be set after children have been added. m_xShape-setPosition(awt::Point(m_pImpl-nLeftPosition, m_pImpl-nTopPosition)); } +m_pImpl-applyRelativePosition(xShapeProps); m_pImpl-applyMargins(xShapeProps); bool bOpaque = m_pImpl-bOpaque !m_pImpl-rDomainMapper.IsInHeaderFooter(); @@ -1517,6 +1523,7 @@ uno::Reference text::XTextContent GraphicImport::createGraphicObject( const b } m_pImpl-applyPosition(xGraphicObjectProperties); +m_pImpl-applyRelativePosition(xGraphicObjectProperties); bool bOpaque = m_pImpl-bOpaque !m_pImpl-rDomainMapper.IsInHeaderFooter( ); if( !bOpaque ) { commit 57450afb768c085df0ba2344aa94b5f843060178 Author: Miklos Vajna vmik...@collabora.co.uk Date: Tue Dec 3 11:59:42 2013 +0100 DOCX import: declare wps as a supported feature This means in case we hit an mc:AlternateContent element, we will read the mc:Choice branch of it, in case wps is the required feature, not
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 +++--- writerfilter/source/dmapper/DomainMapperTableHandler.cxx |8 writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 +++ writerfilter/source/dmapper/PropertyIds.cxx |1 + writerfilter/source/dmapper/PropertyIds.hxx |1 + 5 files changed, 24 insertions(+), 3 deletions(-) New commits: commit 74bf915fb48c660bd1e3a04bec6c3a20c754b6af Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Nov 25 16:59:56 2013 +0100 DOCX import: tblHeader implies firstRow If a table row is marked as tblHeader, then the firstRow section of the table style should be applied, even if that row is in fact not the first row. Change-Id: I10605f404160e72c620e9204503203fea1c6d6d8 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 42f250c..5a3a554 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1395,6 +1395,9 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar2, calendar2.docx) uno::Referencetext::XTextTable xTable(getParagraphOrTable(1), uno::UNO_QUERY); uno::Referencetext::XTextRange xCell(xTable-getCellByName(A1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getPropertysal_Int16(getRun(getParagraphOfText(1, xCell-getText()), 1), CharCaseMap)); +// Font size in the second row was 11. +xCell.set(xTable-getCellByName(A2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(16.f, getPropertyfloat(getRun(getParagraphOfText(1, xCell-getText()), 1), CharHeight)); // This paragraph property was missing in table style. xmlDocPtr pXmlStyles = parseExport(word/styles.xml); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index a8e51b0..1a9ad2d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -562,6 +562,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl //it's a uno::Sequence beans::PropertyValues * RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray(); +PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin(); while( aRowOfCellsIterator != aRowOfCellsIteratorEnd ) { //aRowOfCellsIterator points to a vector of PropertyMapPtr @@ -580,6 +581,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl if(rInfo.nTblLook0x40) nRowStyleMask |= CNF_LAST_ROW; // last row style used } +else if (aRowIter-get() aRowIter-get()-find(PROP_TBL_HEADER) != aRowIter-get()-end()) +nRowStyleMask |= CNF_FIRST_ROW; // table header implies first row if(!nRowStyleMask) // if no row style used yet { // banding used only if not first and or last row style used @@ -729,6 +732,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl #endif ++nRow; ++aRowOfCellsIterator; +++aRowIter; } #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -758,6 +762,10 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties() //set default to 'break across pages if( aRowIter-get()-find(PROP_IS_SPLIT_ALLOWED) == aRowIter-get()-end()) aRowIter-get()-Insert( PROP_IS_SPLIT_ALLOWED, uno::makeAny(sal_True ) ); +// tblHeader is only our property, remove before the property map hits UNO +PropertyMap::const_iterator aIter = aRowIter-get()-find(PROP_TBL_HEADER); +if (aIter != aRowIter-get()-end()) +aRowIter-get()-erase(aIter); aRowProperties[nRow] = (*aRowIter)-GetPropertyValues(); #ifdef DEBUG_DMAPPER_TABLE_HANDLER diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index ac75e07..7db941d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -201,6 +201,13 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) } else m_nHeaderRepeat = -1; +if (nIntValue) +{ +// Store the info that this is a header, we'll need that when we apply table styles. +TablePropertyMapPtr pPropMap( new TablePropertyMap ); +pPropMap-Insert( PROP_TBL_HEADER, uno::makeAny(nIntValue)); +insertRowProps(pPropMap); +} break; case 0xd608: // TDefTable { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/table-floating.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 19 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 30 +++ writerfilter/source/dmapper/DomainMapperTableHandler.hxx |4 +- writerfilter/source/dmapper/DomainMapperTableManager.cxx |2 + writerfilter/source/dmapper/TablePositionHandler.cxx | 12 -- writerfilter/source/dmapper/TablePositionHandler.hxx |2 + 7 files changed, 58 insertions(+), 11 deletions(-) New commits: commit 53d27a30ce5f2c9f7d37a4089286116854c16215 Author: Miklos Vajna vmik...@suse.cz Date: Wed Aug 14 15:54:30 2013 +0200 DOCX import: fixed horizontal position of floating tables In Word, just like normal tables, floating tables should be positioned in a way that the start of the cell text has the same horizontal position as normal paragraph text. To emulate this, first the table should be moved left by the table border distance, then also by the border with / 2; as done for non-floating tables already. Change-Id: I581311fbb08009e6c1839106e8f615d078a4a705 diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx b/sw/qa/extras/ooxmlimport/data/table-floating.docx new file mode 100755 index 000..1e0cb30 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-floating.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f9d3416..c85b288 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -128,6 +128,7 @@ public: void testFdo66474(); void testGroupshapeRotation(); void testBnc780044Spacing(); +void testTableFloating(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -221,6 +222,7 @@ void Test::run() {fdo66474.docx, Test::testFdo66474}, {groupshape-rotation.docx, Test::testGroupshapeRotation}, {bnc780044_spacing.docx, Test::testBnc780044Spacing}, +{table-floating.docx, Test::testTableFloating}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1550,6 +1552,23 @@ void Test::testBnc780044Spacing() CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor-getPage()); } +void Test::testTableFloating() +{ +// Both the size and the position of the table was incorrect. +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables(), uno::UNO_QUERY); +// Second table was too wide: 16249, i.e. as wide as the first table. +CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), getPropertysal_Int32(xTables-getByIndex(1), Width)); + +uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xIndexAccess(xTextFramesSupplier-getTextFrames(), uno::UNO_QUERY); +uno::Referencebeans::XPropertySet xFrame(xIndexAccess-getByIndex(0), uno::UNO_QUERY); +// This was 0, should be the the opposite of (left margin + half of the border width). +CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getPropertysal_Int32(xFrame, HoriOrientPosition)); +// Was 0 as well, should be the right margin. +CPPUNIT_ASSERT_EQUAL(sal_Int32(191), getPropertysal_Int32(xFrame, RightMargin)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 3d695fe..72d7c74 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -38,8 +38,6 @@ namespace dmapper { using namespace ::com::sun::star; using namespace ::std; -#define DEF_BORDER_DIST 190 //0,19cm - #ifdef DEBUG_DMAPPER_TABLE_HANDLER static void lcl_printProperties( PropertyMapPtr pProps ) { @@ -308,7 +306,7 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope } -TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo rInfo) +TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo rInfo, uno::Sequencebeans::PropertyValue rFrameProperties) { // will receive the table style if any TableStyleSheetEntry* pTableStyle = NULL; @@ -428,7 +426,25 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo aTableBorder.IsLeftLineValid = sal_True; // Only top level table position depends on border width if (rInfo.nNestLevel == 1) -rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5; +{ +if (!rFrameProperties.hasElements()) +rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5; +else +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/rhbz960019.rtf| 12 sw/qa/extras/rtfimport/rtfimport.cxx |7 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 ++--- writerfilter/source/rtftok/rtfdocumentimpl.cxx| 14 -- 4 files changed, 37 insertions(+), 5 deletions(-) New commits: commit b3944f124ab3dc87332796a46387f837ad29e8d5 Author: Michael Stahl mst...@redhat.com Date: Wed Jul 10 12:41:57 2013 +0200 rhbz#960019 : RTF import: handle extra groups in listoverride entry This crashed because for a single listoverride entry 2 SPRMs were sent to the domain-mapper, and the second one was empty. Change-Id: Ic41ffd8bd4edcff065f49ecef3464efedd909d63 diff --git a/sw/qa/extras/rtfimport/data/rhbz960019.rtf b/sw/qa/extras/rtfimport/data/rhbz960019.rtf new file mode 100644 index 000..869aa33 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/rhbz960019.rtf @@ -0,0 +1,12 @@ +{\rtf1 +{\*\listtable +{\list\listtemplateid-723955400\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent0\levelstartat1{\leveltext\'03\'00. ;}{\levelnumbers\'01;}\f0 }{\listname ;}\listid-1155484576} +} +{\*\listoverridetable +{\*\listoverride{\listid-1155484576\listoverridecount0\ls1}} +} +\pard\plain \pvpg\phpg\posx1143\posy4743\absw9615\absh-2922\dfrmtxtx72\dfrmtxty72\nowrap +Hello\par +\pard\plain\par +} + diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index bc8c7fc..4a861d5 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -153,6 +153,7 @@ public: void testFdo39001(); void testGroupshape(); void testFdo66565(); +void testRhbz960019(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -291,6 +292,7 @@ void Test::run() {fdo39001.rtf, Test::testFdo39001}, {groupshape.rtf, Test::testGroupshape}, {fdo66565.rtf, Test::testFdo66565}, +{rhbz960019.rtf, Test::testRhbz960019}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1419,6 +1421,11 @@ void Test::testFdo66565() CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(1), TableColumnSeparators)[0].Position); } +void Test::testRhbz960019() +{ +// used to crash due to extra group in listoverride entry +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 38dd6dc..18b3f96 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4563,8 +4563,18 @@ int RTFDocumentImpl::popState() // list override table case DESTINATION_LISTOVERRIDEENTRY: { -RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms)); -m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, false); +if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY) +{ // copy properties upwards so upper popState inserts it +m_aStates.top().aTableAttributes = aState.aTableAttributes; +m_aStates.top().aTableSprms = aState.aTableSprms; +} +else +{ +RTFValue::Pointer_t pValue(new RTFValue( +aState.aTableAttributes, aState.aTableSprms)); +m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, +pValue, false); +} } break; case DESTINATION_LEVELTEXT: commit 1c90902cbccd4e4f5946dfc454da351c33c24f71 Author: Michael Stahl mst...@redhat.com Date: Wed Jul 10 12:38:16 2013 +0200 writerfilter: not every field has a Content property ... so don't try to get it unconditionally (but SetExpression does have it). (regression from c7e4264bed4e77daccf2f72063e5e00f1008c3cf) Change-Id: I14d24bd70f569ba0bc4f1e48d56ebf43c1441783 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f3fc0ee..badcb44 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3399,9 +3399,12 @@ void DomainMapper_Impl::SetFieldResult( OUString rResult ) bool bIsSetExpression = xServiceInfo-supportsService(com.sun.star.text.TextField.SetExpression); // If we already have content set, then use the current presentation rtl::OUString sValue; -uno::Any aValue = xFieldProperties-getPropertyValue( -rPropNameSupplier.GetName(PROP_CONTENT)); -
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/groupshape.rtf | 76 + sw/qa/extras/rtfimport/rtfimport.cxx | 12 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 20 +- writerfilter/source/rtftok/rtfdocumentimpl.hxx |1 writerfilter/source/rtftok/rtfsdrimport.cxx| 21 +- writerfilter/source/rtftok/rtfsdrimport.hxx|8 ++ 6 files changed, 131 insertions(+), 7 deletions(-) New commits: commit 2e11cb276e54c6fe4e903c7f44e36bc36798ba63 Author: Miklos Vajna vmik...@suse.cz Date: Mon Jul 8 16:21:28 2013 +0200 Related: fdo#66040 RTF import: by default, do create a group shape for \shpgrp The bugfix was just for the special case when we must create textframes due to the contained tables, this one add support for the default case when we want a real group shape. Change-Id: I74b77b233235959266a24660c970a79e41d8b272 diff --git a/sw/qa/extras/rtfimport/data/groupshape.rtf b/sw/qa/extras/rtfimport/data/groupshape.rtf new file mode 100644 index 000..b237570 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/groupshape.rtf @@ -0,0 +1,76 @@ +{\rtf1 +\paperw16840\paperh11907\margl567\margr567\margt567\margb567 +{\shpgrp +{\*\shpinst\shpleft-201\shptop-585\shpright16112\shpbottom11321 +{\sp +{\sn groupLeft} +{\sv 288} +} +{\sp +{\sn groupTop} +{\sv -18} +} +{\sp +{\sn groupRight} +{\sv 16601} +} +{\sp +{\sn groupBottom} +{\sv 11888} +} +{\shp +{\*\shpinst +{\sp +{\sn relLeft} +{\sv 288} +} +{\sp +{\sn relTop} +{\sv -18} +} +{\sp +{\sn relRight} +{\sv 8225} +} +{\sp +{\sn relBottom} +{\sv 11888} +} +{\sp +{\sn shapeType} +{\sv 202} +} +{\shptxt foo +} +} +} +{\shp +{\*\shpinst +{\sp +{\sn relLeft} +{\sv 8664} +} +{\sp +{\sn relTop} +{\sv -18} +} +{\sp +{\sn relRight} +{\sv 16601} +} +{\sp +{\sn relBottom} +{\sv 11888} +} +{\sp +{\sn shapeType} +{\sv 202} +} +{\shptxt baz +} +} +} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index b22e729..3aa8d19 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -151,6 +151,7 @@ public: void testN823675(); void testFdo47802(); void testFdo39001(); +void testGroupshape(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -287,6 +288,7 @@ void Test::run() {n823675.rtf, Test::testN823675}, {fdo47802.rtf, Test::testFdo47802}, {fdo39001.rtf, Test::testFdo39001}, +{groupshape.rtf, Test::testGroupshape}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1395,6 +1397,16 @@ void Test::testFdo39001() CPPUNIT_ASSERT_EQUAL(3, getPages()); } +void Test::testGroupshape() +{ +uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY); +// There should be a single groupshape with 2 children. +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws-getCount()); +uno::Referencedrawing::XShapes xGroupshape(xDraws-getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape-getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 73d06c4..1cd2ad2 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1682,7 +1682,18 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_SHPGRP: { RTFLookahead aLookahead(Strm(), m_pTokenizer-getGroupStart()); -SAL_WARN_IF(!aLookahead.hasTable(), writerfilter, no table in groupshape, should create it!); +if (!aLookahead.hasTable()) +{ +uno::Referencedrawing::XShapes xGroupShape(m_xModelFactory-createInstance(com.sun.star.drawing.GroupShape), uno::UNO_QUERY); +uno::Referencedrawing::XDrawPageSupplier xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); +if (xDrawSupplier.is()) +{ +uno::Referencedrawing::XShape xShape(xGroupShape, uno::UNO_QUERY); +xDrawSupplier-getDrawPage()-add(xShape); +} +m_pSdrImport-pushParent(xGroupShape); +m_aStates.top().bCreatedShapeGroup = true; +} m_aStates.top().nDestinationState = DESTINATION_SHAPEGROUP; m_aStates.top().bInShapeGroup = true; } @@ -4404,6 +4415,10 @@ int RTFDocumentImpl::popState() case DESTINATION_MEQARR: m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr)); break; +case DESTINATION_SHAPEGROUP: +if (aState.bCreatedShapeGroup) +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/n820504.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 12 writerfilter/source/dmapper/StyleSheetTable.cxx |3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) New commits: commit f9610ed634318c27382d79089d022fb8175eb90a Author: Cédric Bosdonnat cedric.bosdon...@free.fr Date: Tue Jun 18 09:50:41 2013 +0200 added unit test for n#820504 Change-Id: I804e081a564d24d3896160f817051b19da884c34 diff --git a/sw/qa/extras/ooxmlimport/data/n820504.docx b/sw/qa/extras/ooxmlimport/data/n820504.docx new file mode 100644 index 000..36279a9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820504.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index c0987d1..676fbbb 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -118,6 +118,7 @@ public: void testN816593(); void testN820509(); void testN820788(); +void testN820504(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -203,6 +204,7 @@ void Test::run() {n816593.docx, Test::testN816593}, {n820509.docx, Test::testN820509}, {n820788.docx, Test::testN820788}, +{n820504.docx, Test::testN820504}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1437,6 +1439,16 @@ void Test::testN820788() CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getPropertysal_Int16(xFrame, SizeType)); } +void Test::testN820504() +{ +uno::Referencestyle::XStyleFamiliesSupplier xFamiliesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XNameAccess xFamiliesAccess(xFamiliesSupplier-getStyleFamilies(), uno::UNO_QUERY); +uno::Referencecontainer::XNameAccess xStylesAccess(xFamiliesAccess-getByName(ParagraphStyles), uno::UNO_QUERY); +uno::Referencebeans::XPropertySet xStyle(xStylesAccess-getByName(Default Style), uno::UNO_QUERY); +// The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set +CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getPropertysal_Int32(xStyle, CharColor)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 122db845e057cfd83bb2b5fde442200bc742eb8d Author: Cédric Bosdonnat cedric.bosdon...@free.fr Date: Mon Jun 17 13:42:34 2013 +0200 n#820504: default color hidden by Default style in writerfilter Setting the font color of the default paragraph style to Auto makes the color set in the Writer defaults (from rPrDefault) ignored. Change-Id: I1dcd92bcd0774f5229785373242899a492ab7b7c (cherry picked from commit d7acb5ba0924f848f1ae96eceab50a0169d18445) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 74adb0b..8352b1b 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -786,8 +786,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable ) pEntry-pProperties-Insert(PROP_PARA_ORPHANS, true, aTwo, false); // Left-to-right direction if not already set pEntry-pProperties-Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false); -// font color COL_AUTO if not already set -pEntry-pProperties-Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0x) ), false); +// Don't set font color to Auto if not already set: this could hide the default font color setting } uno::Sequence beans::PropertyValue aPropValues = pEntry-pProperties-GetPropertyValues(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/page-border-shadow.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 + writerfilter/source/dmapper/BorderHandler.cxx |9 ++- writerfilter/source/dmapper/BorderHandler.hxx |2 + writerfilter/source/dmapper/DomainMapper.cxx |2 - writerfilter/source/dmapper/PageBordersHandler.cxx|6 +++- writerfilter/source/dmapper/PageBordersHandler.hxx|1 writerfilter/source/dmapper/PropertyMap.cxx | 23 +- writerfilter/source/dmapper/PropertyMap.hxx |3 +- 9 files changed, 52 insertions(+), 6 deletions(-) New commits: commit 1727b268645ae4f7328ed00135abe1e316311ba8 Author: Miklos Vajna vmik...@suse.cz Date: Thu May 30 12:18:30 2013 +0200 bnc#817956 page border shadow testcase Change-Id: I1ded79d89dcceb3bae5926a2f217cde8bf6aa830 diff --git a/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx b/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx new file mode 100755 index 000..65a2273 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 36fc883..5a268e4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -115,6 +115,7 @@ public: void testIndentation(); void testPageBackground(); void testWatermark(); +void testPageBorderShadow(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -198,6 +199,7 @@ void Test::run() {indentation.docx, Test::testIndentation}, {page-background.docx, Test::testPageBackground}, {watermark.docx, Test::testWatermark}, +{page-border-shadow.docx, Test::testPageBorderShadow}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1418,6 +1420,16 @@ void Test::testWatermark() CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getPropertysal_Int16(xShape, VertOrientRelation)); } +void Test::testPageBorderShadow() +{ +// The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored. +table::ShadowFormat aShadow = getPropertytable::ShadowFormat(getStyles(PageStyles)-getByName(DEFAULT_STYLE), ShadowFormat); +CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); +CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); +// w:sz=48 is in eights of a point, 1 pt is 20 twips. +CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow.ShadowWidth); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 59db0cb6752f269893e2697bf561643aec92bdf1 Author: Miklos Vajna vmik...@suse.cz Date: Thu May 30 11:55:37 2013 +0200 bnc#817956 DOCX import of page border shadow See the comment in SectionPropertyMap::ApplyBorderToPageStyles() on what and how is mapped. The control flow is like this: BorderHandler::lcl_attribute() notices w:shadow, then PageBordersHandler::lcl_sprm() gets it, passes it to SectionPropertyMap::SetBorder(), finally SectionPropertyMap::ApplyBorderToPageStyles() uses the UNO API. Change-Id: Ib0aef3245f58c62655769357f1f4dd07eef77f62 diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index 068c210..c219d39 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -39,6 +39,7 @@ m_nLineWidth(15), // Word default, in twips m_nLineType(0), m_nLineColor(0), m_nLineDistance(0), +m_bShadow(false), m_bOOXML( bOOXML ) { const int nBorderCount(BORDER_COUNT); @@ -83,7 +84,8 @@ void BorderHandler::lcl_attribute(Id rName, Value rVal) m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 ); break; case NS_rtf::LN_FSHADOW:// 0x2875 -//if 1 then line has shadow - unsupported +m_bShadow = nIntValue; +break; case NS_rtf::LN_FFRAME: // 0x2876 case NS_rtf::LN_UNUSED2_15: // 0x2877 // ignored @@ -173,6 +175,11 @@ table::BorderLine2 BorderHandler::getBorderLine() return aBorderLine; } +bool BorderHandler::getShadow() +{ +return m_bShadow; +} + } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/BorderHandler.hxx b/writerfilter/source/dmapper/BorderHandler.hxx index 7a6eec9..3d43c4a 100644 --- a/writerfilter/source/dmapper/BorderHandler.hxx +++ b/writerfilter/source/dmapper/BorderHandler.hxx @@ -50,6 +50,7 @@ private: sal_Int32 m_nLineType; sal_Int32 m_nLineColor; sal_Int32 m_nLineDistance; +boolm_bShadow; boolm_bOOXML; boolm_aFilledLines[BORDER_COUNT];
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 +- writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 16 +++- 2 files changed, 16 insertions(+), 2 deletions(-) New commits: commit 391c45ce86ad8de44089ecde6800301a854136df Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Fri Apr 26 18:30:14 2013 +0200 Revert temporarily disable conditionalstyles-tbllook.docx test Already worked around. This reverts commit f853a20839ab08244dc1b3b1c881822bd593bc04. diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 27387ed..25e4495 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -182,7 +182,7 @@ void Test::run() {fdo60922.docx, Test::testFdo60922}, {fdo59273.docx, Test::testFdo59273}, {table_width.docx, Test::testTableWidth}, -//{conditionalstyles-tbllook.docx, Test::testConditionalstylesTbllook}, +{conditionalstyles-tbllook.docx, Test::testConditionalstylesTbllook}, {fdo63685.docx, Test::testFdo63685}, }; header(); commit 76336334e669519cfa42413b851584fa321c004d Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Fri Apr 26 18:29:17 2013 +0200 ugly hack for NS_ooxml::LN_CT_Style_type being the first attribute processed Change-Id: I32e91c1a42619676467ac121865673733e8053f2 diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx index a97759e..b8f5aa3 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx @@ -25,6 +25,7 @@ #include com/sun/star/drawing/XShape.hpp #include ooxml/OOXMLFastTokens.hxx #include ooxmlLoggers.hxx +#include ooxml/resourceids.hxx namespace writerfilter { namespace ooxml @@ -467,7 +468,20 @@ void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty) if (pProperty.get() != NULL pProperty-getId() != 0x0) { -mProperties.push_back(pProperty); +/* + HACK: Ugly hack. This retarded overdesigned writerfilter thing + processes attributes in random order (as given by boost::unordered_map + when iterating it), but StyleSheetTable::lcl_attribute() needs + to know whether NS_ooxml::LN_CT_Style_type is STYLE_TYPE_TABLE first. + And all this overdesigned machinery doesn't even give a reasonable + way to find out if an attribute is there before encountering it + in random order in lcl_attribute(), so just make sure here that + the attribute comes first. +*/ +if( pProperty-getId() == NS_ooxml::LN_CT_Style_type ) +mProperties.insert( mProperties.begin(), pProperty ); +else +mProperties.push_back(pProperty); } #ifdef DEBUG_PROPERTY_SET else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx|2 +- writerfilter/source/dmapper/StyleSheetTable.cxx | 15 --- 2 files changed, 13 insertions(+), 4 deletions(-) New commits: commit 29dcdf6b56f8dbc1b7de0478afb04122f8dbf0f9 Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Wed Apr 24 20:48:53 2013 +0200 check for NS_ooxml::LN_CT_Style_type being processed first The code relies on NS_ooxml::LN_CT_Style_type being handled first (because of m_pImpl-m_pCurrentEntry being reset there), so at least check for it. Still no idea how to actually ensure the correct ordering in this overdesigned $#%@! writerfilter thing. Change-Id: Ib6a2129a078728e162257275ac2a1243dbaf4017 diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 8766d73..f0569fa 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -63,9 +63,6 @@ StyleSheetEntry::StyleSheetEntry() : ,sNextStyleIdentifier() ,pProperties(new StyleSheetPropertyMap) { -#if OSL_DEBUG_LEVEL 1 -nStyleTypeCode = STYLE_TYPE_PARA; -#endif } StyleSheetEntry::~StyleSheetEntry() @@ -370,6 +367,14 @@ void StyleSheetTable::lcl_attribute(Id Name, Value val) (void)nIntValue; OUString sValue = val.getString(); +// The default type is paragraph, and it needs to be processed first, +// because the NS_ooxml::LN_CT_Style_type handling may set m_pImpl-m_pCurrentEntry +// to point to a different object. +if( m_pImpl-m_pCurrentEntry-nStyleTypeCode == STYLE_TYPE_UNKNOWN ) +{ +if( Name != NS_rtf::LN_SGC Name != NS_ooxml::LN_CT_Style_type ) +m_pImpl-m_pCurrentEntry-nStyleTypeCode = STYLE_TYPE_PARA; +} switch(Name) { case NS_rtf::LN_ISTD: @@ -385,6 +390,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value val) } break; case NS_rtf::LN_SGC: +SAL_WARN_IF( m_pImpl-m_pCurrentEntry-nStyleTypeCode != STYLE_TYPE_UNKNOWN, +writerfilter, Style type needs to be processed first ); m_pImpl-m_pCurrentEntry-nStyleTypeCode = (StyleType)nIntValue; break; case NS_rtf::LN_ISTDBASE: @@ -421,6 +428,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value val) break; case NS_ooxml::LN_CT_Style_type: { +SAL_WARN_IF( m_pImpl-m_pCurrentEntry-nStyleTypeCode != STYLE_TYPE_UNKNOWN, +writerfilter, Style type needs to be processed first ); StyleType nType = ( StyleType ) nIntValue; if ( nType == STYLE_TYPE_TABLE ) { commit f853a20839ab08244dc1b3b1c881822bd593bc04 Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Wed Apr 24 20:48:04 2013 +0200 temporarily disable conditionalstyles-tbllook.docx test writerfilter relies on boost::unordered_map being ordered in a specific way, temporarily disable until that's sorted out somehow Change-Id: I5fdb70223e39e2048a45e0b81ffc2c714e1c4532 diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 25e4495..27387ed 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -182,7 +182,7 @@ void Test::run() {fdo60922.docx, Test::testFdo60922}, {fdo59273.docx, Test::testFdo59273}, {table_width.docx, Test::testTableWidth}, -{conditionalstyles-tbllook.docx, Test::testConditionalstylesTbllook}, +//{conditionalstyles-tbllook.docx, Test::testConditionalstylesTbllook}, {fdo63685.docx, Test::testFdo63685}, }; header(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/table_width.docx |binary writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 15 + writerfilter/source/dmapper/DomainMapperTableManager.cxx | 39 ++- writerfilter/source/dmapper/MeasureHandler.hxx |3 + writerfilter/source/dmapper/PropertyIds.cxx |2 writerfilter/source/dmapper/PropertyIds.hxx |2 writerfilter/source/dmapper/PropertyMap.hxx |1 7 files changed, 47 insertions(+), 15 deletions(-) New commits: commit d9f882a5e399708cb0eecedebee49e7ed4a511a3 Author: SJacobi sven-jac...@gmx.de Date: Thu Mar 28 14:42:07 2013 +0100 added table width test document Change-Id: I313eda77cef5f4747decb5ab7c261012954a0a32 Reviewed-on: https://gerrit.libreoffice.org/3112 Reviewed-by: Miklos Vajna vmik...@suse.cz Tested-by: Miklos Vajna vmik...@suse.cz diff --git a/sw/qa/extras/ooxmlimport/data/table_width.docx b/sw/qa/extras/ooxmlimport/data/table_width.docx new file mode 100644 index 000..26deb6d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table_width.docx differ commit 6718482c072defe5d885030826fef5ef833732e9 Author: SJacobi sven-jac...@gmx.de Date: Thu Mar 28 14:12:09 2013 +0100 fixed table width, supporting rel table width, fixed grid handling Change-Id: I28e66ed19e22f0e520f6b16a86a9e032e03d5bd8 Reviewed-on: https://gerrit.libreoffice.org/3110 Reviewed-by: Miklos Vajna vmik...@suse.cz Tested-by: Miklos Vajna vmik...@suse.cz diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 8474a2f..176f3c9 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -24,6 +24,7 @@ #include com/sun/star/table/BorderLine2.hpp #include com/sun/star/text/HoriOrientation.hpp #include com/sun/star/text/RelOrientation.hpp +#include com/sun/star/text/SizeType.hpp #include dmapperLoggers.hxx #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -318,6 +319,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo sal_Int32 nGapHalf = 0; sal_Int32 nLeftMargin = 0; sal_Int32 nTableWidth = 0; +sal_Int32 nTableWidthType = text::SizeType::FIX; PropertyMap::iterator aTableStyleIter = m_aTableProperties-find( PropertyDefinition( META_PROP_TABLE_STYLE_NAME, false ) ); @@ -457,8 +459,17 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } m_aTableProperties-getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); -if( nTableWidth 0 ) -m_aTableProperties-Insert( PROP_WIDTH, false, uno::makeAny( nTableWidth )); +m_aTableProperties-getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType ); +if( nTableWidthType == text::SizeType::FIX ) +{ +if( nTableWidth 0 ) +m_aTableProperties-Insert( PROP_WIDTH, false, uno::makeAny( nTableWidth )); +} +else +{ +m_aTableProperties-Insert( PROP_RELATIVE_WIDTH, false, uno::makeAny( sal_Int16( nTableWidth ) ) ); +m_aTableProperties-Insert( PROP_IS_WIDTH_RELATIVE, false, uno::makeAny( sal_Bool( sal_True ) ) ); +} sal_Int32 nHoriOrient = text::HoriOrientation::LEFT_AND_WIDTH; m_aTableProperties-getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) ; diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 1119709..167 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -115,7 +115,23 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) { m_nTableWidth = pMeasureHandler-getMeasureValue(); if( m_nTableWidth ) +{ +pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX ); pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); +} +else if( pMeasureHandler-getUnit() == NS_ooxml::LN_Value_ST_TblWidth_pct ) +{ +sal_Int32 nPercent = pMeasureHandler-getValue() / 50; +if(nPercent 100) +nPercent = 100; +pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE ); +pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, nPercent ); +} +else if( pMeasureHandler-getUnit() == NS_ooxml::LN_Value_ST_TblWidth_auto ) +{ +
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 +- sw/qa/extras/rtfimport/rtfimport.cxx |4 ++-- writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 584322cbbd063e0a8d2c18a5e6a12f213af56057 Author: Miklos Vajna vmik...@suse.cz Date: Thu Mar 28 16:47:28 2013 +0100 fix failing testcases Change-Id: I2f4deaca308b64f1dc923e3d0a9c10c6f974a33b diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index e3f1618..bf153a2 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1297,7 +1297,7 @@ void Test::testFdo59273() uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), uno::UNO_QUERY); uno::Referencetable::XTableRows xTableRows(xTextTable-getRows(), uno::UNO_QUERY); // Was 9997, so the 4th column had ~zero width -CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[2].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(7499), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[2].Position); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 895082a..b19bd4d 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1000,7 +1000,7 @@ void Test::testFdo55525() CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getPropertysal_Int32(xTable, LeftMargin)); // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width) uno::Referencetable::XTableRows xTableRows(xTable-getRows(), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(1016), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); } void Test::testFdo57708() @@ -1133,7 +1133,7 @@ void Test::testFdo59953() uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), uno::UNO_QUERY); // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width) uno::Referencetable::XTableRows xTableRows(xTable-getRows(), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); +CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[0].Position); } void Test::testFdo59638() commit 84f1fa190fc2b91d21b685f4d0ea99aaeea26fe0 Author: Miklos Vajna vmik...@suse.cz Date: Thu Mar 28 16:47:11 2013 +0100 WaE: -Wsign-compare Change-Id: I4de04e5ba43735e5ed236109cdf5bfbfc9d1a220 diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 167..af64ffe 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -119,7 +119,7 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX ); pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); } -else if( pMeasureHandler-getUnit() == NS_ooxml::LN_Value_ST_TblWidth_pct ) +else if( sal::static_int_castId(pMeasureHandler-getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_pct ) { sal_Int32 nPercent = pMeasureHandler-getValue() / 50; if(nPercent 100) @@ -127,7 +127,7 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE ); pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, nPercent ); } -else if( pMeasureHandler-getUnit() == NS_ooxml::LN_Value_ST_TblWidth_auto ) +else if( sal::static_int_castId(pMeasureHandler-getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_auto ) { pPropMap-setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE ); pPropMap-setValue( TablePropertyMap::TABLE_WIDTH, 100 ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/fdo59273.docx |binary sw/qa/extras/ooxmlimport/data/n780645.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 + writerfilter/source/dmapper/DomainMapperTableManager.cxx | 10 +-- writerfilter/source/dmapper/DomainMapperTableManager.hxx |7 + writerfilter/source/dmapper/TablePropertiesHandler.cxx |7 + writerfilter/source/ooxml/model.xml | 19 --- 7 files changed, 44 insertions(+), 11 deletions(-) New commits: commit 7329df74df134a77d078f47d5c8b70d54c5d1edb Author: Miklos Vajna vmik...@suse.cz Date: Tue Mar 26 11:15:59 2013 +0100 fdo#59273 import w:tblLayout of DOCX tables Change-Id: I9af50a4c176168e2794eaa9b0e8eaeb6b9d06b13 diff --git a/sw/qa/extras/ooxmlimport/data/fdo59273.docx b/sw/qa/extras/ooxmlimport/data/fdo59273.docx new file mode 100644 index 000..fcdfd77 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo59273.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a5b41e3..e3f1618 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -122,6 +122,7 @@ public: void testFdo61343(); void testToolsLineNumbering(); void testFdo60922(); +void testFdo59273(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) !defined(WNT) @@ -195,6 +196,7 @@ void Test::run() {fdo61343.docx, Test::testFdo61343}, {tools-line-numbering.docx, Test::testToolsLineNumbering}, {fdo60922.docx, Test::testFdo60922}, +{fdo59273.docx, Test::testFdo59273}, }; header(); for (unsigned int i = 0; i SAL_N_ELEMENTS(aMethods); ++i) @@ -1288,6 +1290,16 @@ void Test::testFdo60922() CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getPropertysal_Int32(getRun(getParagraph(1), 1), CharEscapementHeight)); } +void Test::testFdo59273() +{ +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY); +uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), uno::UNO_QUERY); +uno::Referencetable::XTableRows xTableRows(xTextTable-getRows(), uno::UNO_QUERY); +// Was 9997, so the 4th column had ~zero width +CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), TableColumnSeparators)[2].Position); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index be4e05f..1119709 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -53,6 +53,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : m_bOOXML( bOOXML ), m_bPushCurrentWidth(false), m_bRowSizeTypeInserted(false), +m_nLayoutType(0), m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) ) { m_pTablePropsHandler-SetTableManager( this ); @@ -403,6 +404,7 @@ void DomainMapperTableManager::startLevel( ) m_aTablePositions.push_back( pNewPositionHandler ); m_nCell.push_back( 0 ); m_nTableWidth = 0; +m_nLayoutType = 0; // And push it back to the right level. if (oCurrentWidth) @@ -416,6 +418,7 @@ void DomainMapperTableManager::endLevel( ) m_aCellWidths.pop_back( ); m_nCell.pop_back( ); m_nTableWidth = 0; +m_nLayoutType = 0; DomainMapperTableManager_Base_t::endLevel( ); @@ -556,12 +559,13 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } -else if (pCellWidths-size() 0) +else if (pCellWidths-size() 0 m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed) { // If we're here, then the number of cells does not equal to the amount // defined by the grid, even after taking care of // gridSpan/gridBefore/gridAfter. Handle this by ignoring the grid and -// providing the separators based on the provided cell widths. +// providing the separators based on the provided cell widths, as long +// as we have a fixed layout. uno::Sequence text::TableColumnSeparator aSeparators(pCellWidths-size() - 1); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nSum = 0; @@ -602,7 +606,7 @@ void DomainMapperTableManager::endOfRowAction() void DomainMapperTableManager::clearData() { -m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0; +m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = m_nLayoutType = 0; m_sTableStyleName = OUString(); m_pTableStyleTextProperies.reset(); }
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/fdo53594.rtf | 42 + sw/qa/extras/rtfimport/rtfimport.cxx | 10 +++-- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 41 ++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 +- 4 files changed, 89 insertions(+), 8 deletions(-) New commits: commit 50822d440519bcc95fc4e5d45844c1328e72d6b2 Author: Maxime de Roucy mdero...@linagora.com Date: Mon Feb 25 09:45:52 2013 +0100 testcase for fdo#53594 Change-Id: I834b3cf0b5a46627ff0b532e27a73deeaefe7c47 Reviewed-on: https://gerrit.libreoffice.org/2376 Reviewed-by: Miklos Vajna vmik...@suse.cz Tested-by: Miklos Vajna vmik...@suse.cz diff --git a/sw/qa/extras/rtfimport/data/fdo53594.rtf b/sw/qa/extras/rtfimport/data/fdo53594.rtf new file mode 100644 index 000..55468a6 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo53594.rtf @@ -0,0 +1,42 @@ +{\rtf1\ansi\deff3\adeflang1025 +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Nimbus Roman No9 L{\*\falt Times New Roman};}{\f4\fswiss\fprq2\fcharset0 Nimbus Sans L{\*\falt Arial};}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}} +{\colortbl;\red0\green0\blue0;\red128\green128\blue128;} +{\stylesheet{\s0\snext0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\dbch\af5\langfe2052\dbch\af5\afs24\alang1081\loch\f3\fs24\lang1036 Standard;} +{\s15\sbasedon0\snext16\sb240\sa120\keepn\dbch\af5\dbch\af5\afs28\loch\f4\fs28 Titre;} +{\s16\sbasedon0\snext16\sb0\sa120 Corps de texte;} +{\s17\sbasedon16\snext17\sb0\sa120 Liste;} +{\s18\sbasedon0\snext18\sb120\sa120\noline\i\afs24\ai\fs24 L\u233\'e9gende;} +{\s19\sbasedon0\snext19\noline Index;} +{\s20\sbasedon0\snext20\noline Contenu de tableau;} +}{\info{\author Maxime DE\~ROUCY}{\creatim\yr2013\mo2\dy22\hr18\min15}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment LibreOffice}{\vern3600}}\deftab709 +\viewscale150 +{\*\pgdsctbl +{\pgdsc0\pgdscuse195\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}} +\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrt\brdrhair\brdrw1\brdrcf1\clbrdrl\brdrhair\brdrw1\brdrcf1\clbrdrb\brdrhair\brdrw1\brdrcf1\cellx4819\clbrdrt\brdrhair\brdrw1\brdrcf1\clbrdrl\brdrhair\brdrw1\brdrcf1\clbrdrb\brdrhair\brdrw1\brdrcf1\clbrdrr\brdrhair\brdrw1\brdrcf1\cellx9638\pgndec\pard\plain \s20\noline\intbl\rtlch \ltrch\loch +\cell\pard\plain \s20\noline\intbl{\rtlch \ltrch +{\object\objemb{\*\objdata }{\result{\dn1{\*\shppict{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv }}}\picscalex99\picscaley95\piccropl0\piccropr0\piccropt0\piccropb0\picw2258\pich480\picwgoal1280\pichgoal272\wmetafile8 +01000903a8021000d401d40126060f009e03574d464301000100599901007c037c030100 +6c0054001100d108df0120454d4601007c031c000200 +55001200160004003458c01211000c0008000b0010006000 +69001000ec09ec090c001a00100014000c000d00 +12000c000100210008002100080022000c0014000c000d0052004c010100 +9ffe900100224e0069006d006200750073002000530061006e00730020004c00 + + + + +16000c00180018000c0025000c0001005400880023003601c804f7020100 +230036010a004c00020060006f006c00650020006f0062006a00 +6500630074009f0035009e0050009f009e0035009f0084007b002100080022000c00 +14000c000d002100080022000c0014000c000d002100080022000c00