[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Sun Jan 18 12:18:22 PST 2015
sw/qa/extras/odfexport/data/gerrit13858.odt |binary
sw/qa/extras/odfexport/odfexport.cxx | 5 ++++
sw/source/core/doc/textboxhelper.cxx | 31 +++++++++++++++++++++++-----
sw/source/filter/xml/xmltble.cxx | 4 +--
4 files changed, 33 insertions(+), 7 deletions(-)
New commits:
commit 8d758d0764beb78a49f3035c254eb085b112c2b1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sun Jan 18 21:17:03 2015 +0100
SwTextBoxHelper::findTextBoxes: optimize unnecessary O(n^2)
Change-Id: Ib127b6cf44a69709673465db99cc79417b18c266
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index d447b5b..f5096a0 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -114,17 +114,38 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
std::set<const SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
{
- std::set<const SwFrmFmt*> aRet;
+ std::set<const SwFrmFmt*> aTextBoxes;
+ std::map<SwNodeIndex, const SwFrmFmt*> aFlyFormats, aDrawFormats;
const SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
for (SwFrmFmts::const_iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
{
- SwFrmFmt* pTextBox = findTextBox(*it);
- if (pTextBox)
- aRet.insert(pTextBox);
+ const SwFrmFmt* pFormat = *it;
+
+ // A TextBox in the context of this class is a fly frame that has a
+ // matching (same RES_CNTNT) draw frame.
+ if (!pFormat->GetAttrSet().HasItem(RES_CNTNT) || !pFormat->GetCntnt().GetCntntIdx())
+ continue;
+
+ const SwNodeIndex& rIndex = *pFormat->GetCntnt().GetCntntIdx();
+
+ if (pFormat->Which() == RES_FLYFRMFMT)
+ {
+ if (aDrawFormats.find(rIndex) != aDrawFormats.end())
+ aTextBoxes.insert(pFormat);
+ else
+ aFlyFormats[rIndex] = pFormat;
+ }
+ else if (pFormat->Which() == RES_DRAWFRMFMT)
+ {
+ if (aFlyFormats.find(rIndex) != aFlyFormats.end())
+ aTextBoxes.insert(aFlyFormats[rIndex]);
+ else
+ aDrawFormats[rIndex] = pFormat;
+ }
}
- return aRet;
+ return aTextBoxes;
}
std::set<const SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwNode& rNode)
commit 80eb001e6a861c68f2915d4eebded5e36e1875f6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sun Jan 18 21:16:55 2015 +0100
ODT export: fix namespace of <table:covered-table-cell> inside shapes
Change-Id: If96b46bac7f8212cfb83dc8b4528986137f1eaea
diff --git a/sw/qa/extras/odfexport/data/gerrit13858.odt b/sw/qa/extras/odfexport/data/gerrit13858.odt
new file mode 100644
index 0000000..9b3dd37
Binary files /dev/null and b/sw/qa/extras/odfexport/data/gerrit13858.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 77ae4ec..f23c2a3 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -432,6 +432,11 @@ DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
}
+DECLARE_ODFEXPORT_TEST(testGerrit13858, "gerrit13858.odt")
+{
+ // Just make sure the output is valid.
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index de682f2..b1db68f 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -897,7 +897,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine,
const long nRowSpan = pBox->getRowSpan();
if( nRowSpan < 1 )
{
- SvXMLElementExport aElem2( *this, XML_NAMESPACE_TABLE,
+ SvXMLElementExport aElem2( *this, rTblInfo.GetPrefix(),
XML_COVERED_TABLE_CELL, true,
false );
}
@@ -930,7 +930,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine,
for( size_t i=nOldCol; i<nCol; ++i )
{
- SvXMLElementExport aElemExport( *this, XML_NAMESPACE_TABLE,
+ SvXMLElementExport aElemExport( *this, rTblInfo.GetPrefix(),
XML_COVERED_TABLE_CELL, true,
false );
}
More information about the Libreoffice-commits
mailing list