[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/bnc884615.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |6 ++ writerfilter/source/dmapper/DomainMapper.cxx |2 +- writerfilter/source/dmapper/OLEHandler.cxx | 10 -- writerfilter/source/dmapper/OLEHandler.hxx |4 +++- 5 files changed, 18 insertions(+), 4 deletions(-) New commits: commit c52cb57cc893a6b42d77ceb4cf08a3816824ca4f Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Jul 4 16:38:40 2014 +0200 bnc#884615 VML import: import OLE objects in header with background wrapping We already do this for drawingML shapes since commit 500343105707a9905f5198a4af6ad58fe307b7c2 (DOCX drawingML shape import: always set Opaque, 2013-12-04), make the VML / OLE case behave the same as well. (cherry picked from commit 15c3a08b8b1e8060f9659c7bc98480a39d1802c5) Conflicts: sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx Change-Id: Ic22f1f3cfd325ccbbb9bd6fe9814553683e4de55 diff --git a/sw/qa/extras/ooxmlexport/data/bnc884615.docx b/sw/qa/extras/ooxmlexport/data/bnc884615.docx new file mode 100755 index 000..51ee5ca Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc884615.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 456eae2..460d497 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2082,6 +2082,12 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, fdo69649.docx) CPPUNIT_ASSERT(contents.match(15)); } +DECLARE_OOXMLEXPORT_TEST(testBnc884615, bnc884615.docx) +{ +// The problem was that the shape in the header wasn't in the background. +CPPUNIT_ASSERT_EQUAL(false, bool(getPropertysal_Bool(getShape(1), Opaque))); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index a824f6e..eb0fb89 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3467,7 +3467,7 @@ void DomainMapper::sprmWithProps( Sprm rSprm, PropertyMapPtr rContext, SprmType writerfilter::ReferenceProperties::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get( ) ) { -OLEHandlerPtr pOLEHandler( new OLEHandler ); +OLEHandlerPtr pOLEHandler( new OLEHandler(*this) ); pProperties-resolve(*pOLEHandler); if ( pOLEHandler-isOLEObject( ) ) { diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 44e4f4b..1ace46d 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include OLEHandler.hxx +#include dmapper/DomainMapper.hxx #include PropertyMap.hxx #include GraphicHelpers.hxx @@ -45,11 +46,12 @@ namespace dmapper { using namespace ::com::sun::star; -OLEHandler::OLEHandler() : +OLEHandler::OLEHandler(DomainMapper rDomainMapper) : LoggedProperties(dmapper_logger, OLEHandler), m_nDxaOrig(0), m_nDyaOrig(0), -m_nWrapMode(1) +m_nWrapMode(1), +m_rDomainMapper(rDomainMapper) { } @@ -104,6 +106,10 @@ void OLEHandler::lcl_attribute(Id rName, Value rVal) try { +// Shapes in the header or footer should be in the background. +if (m_rDomainMapper.IsInHeaderFooter()) +xShapeProps-setPropertyValue(Opaque, uno::makeAny(false)); + m_aShapeSize = xTempShape-getSize(); m_aShapePosition = xTempShape-getPosition(); diff --git a/writerfilter/source/dmapper/OLEHandler.hxx b/writerfilter/source/dmapper/OLEHandler.hxx index 63e9207..d7106b1 100644 --- a/writerfilter/source/dmapper/OLEHandler.hxx +++ b/writerfilter/source/dmapper/OLEHandler.hxx @@ -41,6 +41,7 @@ namespace com{ namespace sun{ namespace star{ namespace writerfilter { namespace dmapper { +class DomainMapper; /** Handler for OLE objects */ class WRITERFILTER_DLLPRIVATE OLEHandler : public LoggedProperties @@ -64,13 +65,14 @@ class WRITERFILTER_DLLPRIVATE OLEHandler : public LoggedProperties ::com::sun::star::uno::Reference ::com::sun::star::graphic::XGraphic m_xReplacement; ::com::sun::star::uno::Reference ::com::sun::star::io::XInputStream m_xInputStream; +DomainMapper m_rDomainMapper; // Properties virtual void lcl_attribute(Id Name, Value val); virtual void lcl_sprm(Sprm sprm); public: -OLEHandler(); +OLEHandler(DomainMapper rDomainMapper); virtual ~OLEHandler(); inline ::com::sun::star::uno::Reference ::com::sun::star::drawing::XShape getShape( ) { return m_xShape; }; ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/table-btlr-center.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |9 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 17 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 ++ writerfilter/source/dmapper/PropertyIds.cxx |1 writerfilter/source/dmapper/PropertyIds.hxx |1 6 files changed, 35 insertions(+) New commits: commit 6e20fc2414a625f9f2419af6bbba46bccd93d2b1 Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Jul 2 17:33:03 2014 +0200 bnc#865381 DOCX import: handle w:jc=center inside w:textDirection=btLr Change-Id: I102c70429457515b34e74cb8e82e1417e6276d1d (cherry picked from commit 3325e0f206ce864730468c3556ce06760042c157) diff --git a/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx new file mode 100644 index 000..79cb53e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 88acef8..26e0e36 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1703,6 +1703,15 @@ DECLARE_OOXMLIMPORT_TEST(testFootnote, footnote.docx) CPPUNIT_ASSERT(aFootnote.endsWith(bar)); } +DECLARE_OOXMLIMPORT_TEST(testTableBtlrCenter, table-btlr-center.docx) +{ +uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xTables(xTablesSupplier-getTextTables(), uno::UNO_QUERY); +uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), uno::UNO_QUERY); +// Cell vertical alignment was NONE, should be CENTER. +CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getPropertysal_Int16(xTable-getCellByName(A2), VertOrient)); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 0827cc9..7b8d9cd 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -28,6 +28,8 @@ #include com/sun/star/text/HoriOrientation.hpp #include com/sun/star/text/RelOrientation.hpp #include com/sun/star/text/SizeType.hpp +#include com/sun/star/text/VertOrientation.hpp +#include com/sun/star/style/ParagraphAdjust.hpp #include dmapperLoggers.hxx #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -715,6 +717,21 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl } aCellIterator-get()-erase(PROP_HORIZONTAL_MERGE); } + +// Cell direction is not an UNO Property, either. +const PropertyMap::const_iterator aCellDirectionIter = aCellIterator-get()-find(PROP_CELL_DIRECTION); +if (aCellDirectionIter != aCellIterator-get()-end()) +{ +if (aCellDirectionIter-second.getValue().getsal_Int32() == 3) +{ +// btLr, so map ParagraphAdjust_CENTER to VertOrientation::CENTER. +uno::Referencebeans::XPropertySet xPropertySet((*m_pTableSeq)[nRow][nCell][0], uno::UNO_QUERY); +if (xPropertySet-getPropertyValue(ParaAdjust).getsal_Int16() == style::ParagraphAdjust_CENTER) +aCellIterator-get()-Insert(PROP_VERT_ORIENT, uno::makeAny(text::VertOrientation::CENTER)); +} +aCellIterator-get()-erase(PROP_CELL_DIRECTION); +} + pSingleCellProperties[nCell] = aCellIterator-get()-GetPropertyValues(); #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger-endElement(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 764a065..6a95be3 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -324,6 +324,13 @@ bool DomainMapperTableManager::sprm(Sprm rSprm) case NS_ooxml::LN_CT_TcPrBase_textDirection: { TablePropertyMapPtr pPropMap( new TablePropertyMap ); + +// Remember the cell direction, so later in +// DomainMapperTableHandler::endTableGetCellProperties() can we +// handle the combination of the cell direction and paragraph +// alignment as necessary. +pPropMap-Insert(PROP_CELL_DIRECTION, uno::Any(sal_Int32(3))); + bool bInsertCellProps = true; switch ( nIntValue ) { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/footnote.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 +++ writerfilter/source/dmapper/DomainMapper.cxx |4 +++- writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 +++ writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 79299cd95f9b52d2ccd6973781e922381aa74281 Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Jun 11 12:39:33 2014 +0200 DOCX import: fix additional empty paragraphs around footnote text Regression from commit abe1e852a232e3bdab7b9177d099fe3929f5a4aa (handle properly page breaks even if a page contains only a frame (fdo#55381), 2014-04-21), DomainMapper::lcl_endSectionGroup() inserted an empty paragraph before and after the real footnote text. Disable addition of the dummy paragraph for footnotes. (cherry picked from commit 4d120b6ab181f530d3fedc963b1c6ec777f2608a) Signed-off-by: LuboÅ¡ LuÅák l.lu...@collabora.com Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapper.cxx Change-Id: I6e1954c9bd5520ac284d66244ce1c9004e970305 diff --git a/sw/qa/extras/ooxmlimport/data/footnote.docx b/sw/qa/extras/ooxmlimport/data/footnote.docx new file mode 100644 index 000..f5c94bd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/footnote.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 47c499a..88acef8 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1692,6 +1692,17 @@ DECLARE_OOXMLIMPORT_TEST(testFdo69649, fdo69649.docx) xTocString = xTocString.copy(256); CPPUNIT_ASSERT(xTocString.startsWithIgnoreAsciiCase( Heading 15.1:\t15 ) ); } + +DECLARE_OOXMLIMPORT_TEST(testFootnote, footnote.docx) +{ +uno::Referencetext::XFootnotesSupplier xFootnotesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xFootnotes(xFootnotesSupplier-getFootnotes(), uno::UNO_QUERY); +uno::Referencetext::XTextRange xFootnote(xFootnotes-getByIndex(0), uno::UNO_QUERY); +OUString aFootnote = xFootnote-getString(); +// Ensure there are no additional newlines after bar. +CPPUNIT_ASSERT(aFootnote.endsWith(bar)); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4c5337e..a824f6e 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3655,7 +3655,9 @@ void DomainMapper::lcl_endSectionGroup() { m_pImpl-CheckUnregisteredFrameConversion(); m_pImpl-ExecuteFrameConversion(); -if(m_pImpl-GetIsFirstParagraphInSection()) +// First paragraph in a footnote doesn't count: that would create +// additional paragraphs before and after the real footnote content. +if(m_pImpl-GetIsFirstParagraphInSection() !m_pImpl-IsInFootOrEndnote()) { // This section has no paragraph at all (e.g. they are all actually in a frame). // If this section has a page break, there would be nothing to apply to the page diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a1b1128..a92b120 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -164,6 +164,7 @@ DomainMapper_Impl::DomainMapper_Impl( m_bInAnyTableImport( false ), m_bInHeaderFooterImport( false ), m_bDiscardHeaderFooter( false ), +m_bInFootOrEndnote(false), m_bLineNumberingSet( false ), m_bIsInFootnoteProperties( true ), m_bIsCustomFtnMark( false ), @@ -1553,6 +1554,7 @@ void DomainMapper_Impl::PopPageHeaderFooter() void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) { +m_bInFootOrEndnote = true; try { // Redlines outside the footnote should not affect footnote content @@ -1716,6 +1718,7 @@ void DomainMapper_Impl::PopFootOrEndnote() return; } m_aRedlines.pop(); +m_bInFootOrEndnote = false; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index c5d76b5..b7d01d9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -370,6 +370,7 @@ private: boolm_bInAnyTableImport; //in import of fonts, styles, lists or lfos boolm_bInHeaderFooterImport; boolm_bDiscardHeaderFooter; +boolm_bInFootOrEndnote; boolm_bLineNumberingSet; bool