summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSourav <sourav.mahajan@synerzip.com>2014-03-28 18:25:39 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-04 11:39:06 +0200
commitdf098f6207fdf79d566bf50cc2c2c87fcd295ff8 (patch)
treeb2fd4dc6fd5b9f7890a01403e3dbfacd0a371236
parentc067735f222d41698f4353fa7cbeaeb432573405 (diff)
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
-rw-r--r--sw/qa/extras/ooxmlexport/data/test76734_2K7.docxbin0 -> 10446 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx13
3 files changed, 18 insertions, 3 deletions
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 000000000000..5e0e114a5dc1
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/test76734_2K7.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1e1fd6dac6a3..68ef7ebbe7bd 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 4ba7f2b79384..04f5d3780fb0 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 )