slideshow/source/engine/sp_debug.cxx | 8 ---- sw/source/core/txtnode/txatbase.cxx | 9 ++++ sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++ sw/source/filter/ww8/wrtw8nds.cxx | 52 +++++++++++++++++++++++---- 4 files changed, 60 insertions(+), 15 deletions(-)
New commits: commit ef82115aef668b649a80324f5cd126f93a169c4d Author: Michael Stahl <mst...@redhat.com> Date: Thu Jun 18 00:21:24 2015 +0200 sw: WW8 export: speed up attribute iteration Change-Id: I9da47d7add4fadf34fd4e3c9aa6f1e65cf100b20 diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index e478f1d..7eb5dec 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1230,6 +1230,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) } break; } + if (nPos < *pHt->GetAnyEnd()) + break; // sorted by end } for ( size_t i = 0; i < pTextAttrs->Count(); ++i ) { @@ -1282,6 +1284,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) } break; } + if (nPos < pHt->GetStart()) + break; // sorted by start } m_rExport.m_aCurrentCharPropStarts.pop(); // HasTextItem only allowed in the above range } commit e5ae9bed63a742d9fb40cf63ce92eba5ac72b23d Author: Michael Stahl <mst...@redhat.com> Date: Thu Jun 18 00:18:02 2015 +0200 sw: DOCX export: fix exporting of hyperlink inside ruby The problem is that the hints are iterated in order of start position, and if there is a hyperlink inside a ruby then its end position will be reached after the end position of the ruby due to the sort order, which leads to overlapping XML elements. So for any given position, first export the end positions, then the start positions. Change-Id: I2db28d7a36e4e34fbd394b3a69fe4549ee905250 Example: fdo82849-1.docx diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 03818f7..e478f1d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1198,6 +1198,39 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) { m_rExport.m_aCurrentCharPropStarts.push( nPos ); const sal_Int32* pEnd; + // first process ends of attributes with extent + for (size_t i = 0; i < pTextAttrs->GetEndCount(); ++i) + { + const SwTextAttr* pHt = pTextAttrs->GetEnd(i); + const SfxPoolItem* pItem = &pHt->GetAttr(); + switch ( pItem->Which() ) + { + case RES_TXTATR_INETFMT: + pEnd = pHt->End(); + if (nPos == *pEnd && nPos != pHt->GetStart()) + { + if (m_rExport.AttrOutput().EndURL(nPos == rNd.Len())) + --nRet; + } + break; + case RES_TXTATR_REFMARK: + pEnd = pHt->End(); + if (nullptr != pEnd && nPos == *pEnd && nPos != pHt->GetStart()) + { + OutSwFormatRefMark(*static_cast<const SwFormatRefMark*>(pItem), false); + --nRet; + } + break; + case RES_TXTATR_CJK_RUBY: + pEnd = pHt->End(); + if (nPos == *pEnd && nPos != pHt->GetStart()) + { + m_rExport.AttrOutput().EndRuby(); + --nRet; + } + break; + } + } for ( size_t i = 0; i < pTextAttrs->Count(); ++i ) { const SwTextAttr* pHt = (*pTextAttrs)[i]; @@ -1212,8 +1245,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) ++nRet; } pEnd = pHt->End(); - if (nPos == *pEnd ) - { + if (nPos == *pEnd && nPos == pHt->GetStart()) + { // special case: empty must be handled here if (m_rExport.AttrOutput().EndURL(nPos == rNd.Len())) --nRet; } @@ -1225,8 +1258,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) ++nRet; } pEnd = pHt->End(); - if (nullptr != pEnd && nPos == *pEnd) - { + if (nullptr != pEnd && nPos == *pEnd && nPos == pHt->GetStart()) + { // special case: empty TODO: is this possible or would empty one have pEnd null? OutSwFormatRefMark( *static_cast< const SwFormatRefMark* >( pItem ), false ); --nRet; } @@ -1242,8 +1275,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) ++nRet; } pEnd = pHt->End(); - if (nPos == *pEnd) - { + if (nPos == *pEnd && nPos == pHt->GetStart()) + { // special case: empty must be handled here m_rExport.AttrOutput().EndRuby(); --nRet; } commit 84ea33ef9a86f097a248b526554cdc3581c8d725 Author: Michael Stahl <mst...@redhat.com> Date: Thu Jun 18 00:13:57 2015 +0200 sw: DOCX export fix non-well-formed XML if hyperlink followed by ruby If a hyperlink ends on the same position as a ruby starts, the hyperlink is not closed before the ruby so its end tag is written inside the ruby element. Example: fdo82849-1.odt Change-Id: I4531327ee23a99e366c2de5d9b08ddabb1be69c7 diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index fd4af96..577fb3f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2131,6 +2131,12 @@ void DocxAttributeOutput::RawText( const OUString& /*rText*/, bool /*bForceUnico void DocxAttributeOutput::StartRuby( const SwTextNode& rNode, sal_Int32 nPos, const SwFormatRuby& rRuby ) { OSL_TRACE("TODO DocxAttributeOutput::StartRuby( const SwTextNode& rNode, const SwFormatRuby& rRuby )" ); + if (m_closeHyperlinkInThisRun) + { + EndRun(); // end hyperlink before starting ruby to avoid overlap + assert(!m_closeHyperlinkInThisRun); + assert(!m_closeHyperlinkInPreviousRun); + } m_pSerializer->startElementNS( XML_w, XML_ruby, FSEND ); m_pSerializer->startElementNS( XML_w, XML_rubyPr, FSEND ); // hps commit 1f154e31bf609dc32001a271fa13f9302f18a207 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 22:09:51 2015 +0200 sw: WW8: except refmark these attributes always have an end position Change-Id: I33c51176b4497f1fcfe5a05d07741e8b74e7243b diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 6d91436..03818f7 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1211,7 +1211,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) if ( m_rExport.AttrOutput().StartURL( rINet->GetValue(), rINet->GetTargetFrame() ) ) ++nRet; } - if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd ) + pEnd = pHt->End(); + if (nPos == *pEnd ) { if (m_rExport.AttrOutput().EndURL(nPos == rNd.Len())) --nRet; @@ -1223,7 +1224,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) OutSwFormatRefMark( *static_cast< const SwFormatRefMark* >( pItem ), true ); ++nRet; } - if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd ) + pEnd = pHt->End(); + if (nullptr != pEnd && nPos == *pEnd) { OutSwFormatRefMark( *static_cast< const SwFormatRefMark* >( pItem ), false ); --nRet; @@ -1239,7 +1241,8 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) m_rExport.AttrOutput().StartRuby( rNd, nPos, *static_cast< const SwFormatRuby* >( pItem ) ); ++nRet; } - if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd ) + pEnd = pHt->End(); + if (nPos == *pEnd) { m_rExport.AttrOutput().EndRuby(); --nRet; commit ca6667f8de0fff6af128fc27458da30a1a6e5046 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 21:23:40 2015 +0200 sw: dump ruby text in nodes dump Change-Id: Iae673ac8ed8e5817efefd665dbf5f061e80f94bc diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx index d480907..f9087b9 100644 --- a/sw/source/core/txtnode/txatbase.cxx +++ b/sw/source/core/txtnode/txatbase.cxx @@ -110,6 +110,13 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const oValue = "url: " + rFormat.GetValue().toUtf8(); break; } + case RES_TXTATR_CJK_RUBY: + { + pWhich = "ruby"; + const SwFormatRuby& rFormat = GetRuby(); + oValue = "rubytext: " + rFormat.GetText().toUtf8(); + break; + } default: break; } commit 894ce91bfd456df6101977621c69441e9338d500 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 21:19:34 2015 +0200 sw: fix duplicate whichId attributes in node dump Change-Id: I5089ce8e13d26dcc773f63b3a6f0ef17474444e0 diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx index 0d3c8da..d480907 100644 --- a/sw/source/core/txtnode/txatbase.cxx +++ b/sw/source/core/txtnode/txatbase.cxx @@ -114,7 +114,7 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const break; } if (pWhich) - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(pWhich)); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("which"), BAD_CAST(pWhich)); if (oValue) xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(oValue->getStr())); if (Which() == RES_TXTATR_AUTOFMT) commit 051bbb818fda2d84ec2b23c7c2b5337af1d4062c Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 21:29:34 2015 +0200 slideshow: [loplugin:unreffun] Change-Id: I112e85d999a160b9b6393e924e981231d17f439d diff --git a/slideshow/source/engine/sp_debug.cxx b/slideshow/source/engine/sp_debug.cxx index 660df09..2efb80e 100644 --- a/slideshow/source/engine/sp_debug.cxx +++ b/slideshow/source/engine/sp_debug.cxx @@ -229,14 +229,6 @@ void sp_scalar_destructor_hook(void *, std::size_t, void * pn) get_map().erase(pn); } -void sp_array_constructor_hook(void *) -{ -} - -void sp_array_destructor_hook(void *) -{ -} - } // namespace boost #endif // defined(BOOST_SP_ENABLE_DEBUG_HOOKS) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits