[Libreoffice-commits] core.git: sw/qa sw/source
Sourav
sourav.mahajan at synerzip.com
Fri Apr 4 02:39:38 PDT 2014
sw/qa/extras/ooxmlexport/data/test76734_2K7.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 8 ++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 13 ++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
New commits:
commit df098f6207fdf79d566bf50cc2c2c87fcd295ff8
Author: Sourav <sourav.mahajan at synerzip.com>
Date: Fri Mar 28 18:25:39 2014 +0530
fdo76734-Text Box is not preserved for file created in MSWord 2007.
Issue:Only one AlternateContent is getting written in the RT file irrespective of
the number of TextBoxes in the original file which is causing the issue.
RootCause is found in DocxAttributeOutput::OutputFlyFrame_Impl where under case
sw::Frame::eTxtBox,m_aFramesOfParagraph.push_back(sw::Frame(rFrame)); is getting executed only once.
push_back should happen as many number of times as there are TextBoxes in the original file.
if(rFrame.GetFrmFmt().GetName() == m_aFramesOfParagraph[nIndex].GetFrmFmt().GetName())
bDuplicate = true;
In the above check both the GetName() are returning values as empty which leads to
bDuplicate equals TRUE and hence push_back does not happen.
I have introduced one more check to handle this.
Also changes are made in for loop to make it more efficient.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/8782
Change-Id: I397aa3c4548cb57e8dacbf3fbf9ebaf87c0daa80
diff --git a/sw/qa/extras/ooxmlexport/data/test76734_2K7.docx b/sw/qa/extras/ooxmlexport/data/test76734_2K7.docx
new file mode 100644
index 0000000..5e0e114
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/test76734_2K7.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1e1fd6d..68ef7ebb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3041,6 +3041,14 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76586, "fdo76586.docx")
assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[2]", "w", "7843");
}
+DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4ba7f2b..04f5d37 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4179,10 +4179,17 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
{
// The frame output is postponed to the end of the anchor paragraph
bool bDuplicate = false;
- for( unsigned nIndex = 0; nIndex < m_aFramesOfParagraph.size(); ++nIndex )
+ const OUString& rName = rFrame.GetFrmFmt().GetName();
+ unsigned nSize = m_aFramesOfParagraph.size();
+ for( unsigned nIndex = 0; nIndex < nSize; ++nIndex )
{
- if( rFrame.GetFrmFmt().GetName() == m_aFramesOfParagraph[nIndex].GetFrmFmt().GetName() )
- bDuplicate = true;
+ const OUString& rNameExisting = m_aFramesOfParagraph[nIndex].GetFrmFmt().GetName();
+
+ if (!rName.isEmpty() && !rNameExisting.isEmpty())
+ {
+ if (rName == rNameExisting)
+ bDuplicate = true;
+ }
}
if( !bDuplicate )
More information about the Libreoffice-commits
mailing list