Apache OpenOffice (AOO) Bugzilla – Issue 86769
WW8: Drawing objects wrongly imported and exported in vertical writing
Last modified: 2013-08-07 14:38:26 UTC
When I opened a Word document which includes WordArt object, OpenOffice.org Writer placed the object in wrong position. I will attach an example Word document later. Please open it by Word and OpenOffice.org Writer and compare the two rendered result.
Created attachment 51937 [details] An example Word document which cause the rendering problem
I have already investigated the cause of this problem from the view point of users. This problem occurs if the direction of body text is vertical. When I opened a Word document whose body text direction was horizontal (default), OpenOffice.org Writer showed WordArt objects in correct location. However, when I changed the direction vertical by Word and opened it by OpenOffice.org Writer, OpenOffice.org Writer displayed a different result. Moreover, when I checked out the values of the wrong position by OpenOffice.org Writer, Position X and Position Y were negative values. Therefore, I think the Word import filter has some bugs.
Sorry for the incorrect information. The values of the horizontal position was not negative. Only the value of the vertical position was negative.
MRU->HB: see attached document, when there is an object on vertical page layout, the position is wrong when imported in OOo.
Through an experiment aiming to look into the cause of this issue, the following facts have been found: - The measurement system of WordArt is altered in case of vertical writing. - That of Writer is NOT changed in case of vertical writing. - Measurement conversion from Word in vertical writing to Writer can be implemented in the following way: Index: ww8graf.cxx =================================================================== RCS file: /cvs/sw/sw/source/filter/ww8/ww8graf.cxx,v retrieving revision 1.151 diff -U 63 -r1.151 ww8graf.cxx --- ww8graf.cxx 10 Apr 2008 17:23:45 -0000 1.151 +++ ww8graf.cxx 26 Jun 2008 07:33:14 -0000 @@ -2435,126 +2435,142 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) { ...(omitted)... WW8_FSPA_SHADOW* pFS = (WW8_FSPA_SHADOW*)pF0; WW8_FSPA* pF; #ifdef __WW8_NEEDS_COPY WW8_FSPA aFSFA; pF = &aFSFA; WW8FSPAShadowToReal( pFS, pF ); #else pF = (WW8_FSPA*)pFS; #endif // defined __WW8_NEEDS_COPY if( !pF->nSpId ) { ASSERT( !this, "+Wo ist die Grafik (3) ?" ); return 0; } if (!pMSDffManager->GetModel()) pMSDffManager->SetModel(pDrawModel, 1440); + // --> #i86769# + fprintf(stderr, " nXaLeft = %ld, nYaTop = %ld, nXaRight = %ld, nYaBottom = %ld\n", pF->nXaLeft, pF->nYaTop, pF->nXaRight, pF->nYaBottom); + if (1) // Todo: need to determine if the TextFlow is in vertical writing. + { + // In case of vertical writing, the mesurment system of Word should be converted into that of Writer. + sal_Int32 nLeft = pF->nXaLeft; + sal_Int32 nTop = pF->nYaTop; + sal_Int32 nRight = pF->nXaRight; + sal_Int32 nBottom = pF->nYaBottom; + pF->nXaLeft = nTop; + pF->nYaTop = 0 - nRight; + pF->nXaRight = nRight - nLeft + nTop; + pF->nYaBottom = nBottom - nTop - nRight; + } + fprintf(stderr, " nXaLeft = %ld, nYaTop = %ld, nXaRight = %ld, nYaBottom = %ld\n", pF->nXaLeft, pF->nYaTop, pF->nXaRight, pF->nYaBottom); + // <-- #i86769# Rectangle aRect(pF->nXaLeft, pF->nYaTop, pF->nXaRight, pF->nYaBottom); SvxMSDffImportData aData( aRect ); ...(omitted)... Questions: (a) Is there any practical way to know if the document is in vertical writing within the method SwWW8ImplReader::Read_GrafLayer()? (b) Are there any comments to solve this issue?
Thanks to everybody. Eventually, I have got it. It seems that this issue could be fixed by the following code fragments. In the method SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) =================================================================== RCS file: /cvs/sw/sw/source/filter/ww8/ww8graf.cxx,v retrieving revision 1.151 diff -U 4 -r1.151 ww8graf.cxx --- ww8graf.cxx 10 Apr 2008 17:23:45 -0000 1.151 +++ ww8graf.cxx 16 Jul 2008 05:04:59 -0000 @@ -2494,8 +2494,23 @@ if (!pMSDffManager->GetModel()) pMSDffManager->SetModel(pDrawModel, 1440); + // --> #i86769# + if ( maSectionManager.CurrentSectionIsVertical() ) + { + // In case of vertical writing, the coordinate system of Word for + // vertical text flow should be converted into that of Writer. + sal_Int32 nLeft = pF->nXaLeft; + sal_Int32 nTop = pF->nYaTop; + sal_Int32 nRight = pF->nXaRight; + sal_Int32 nBottom = pF->nYaBottom; + pF->nXaLeft = nTop; + pF->nYaTop = 0 - nRight; + pF->nXaRight = nRight - nLeft + nTop; + pF->nYaBottom = nBottom - nTop - nRight; + } + // <-- #i86769# Rectangle aRect(pF->nXaLeft, pF->nYaTop, pF->nXaRight, pF->nYaBottom); SvxMSDffImportData aData( aRect ); I am also trying to accomplish the similar one for exporting a document into Word file format.
Here is a patch to attempt of fixing this issue. Cited from README.txt in the attachment 86769 [details]_patch_2008-07-23.zip This package includes the following files: Structure 86769_patch_2008-07-23 |-- README.txt | |-- src | `-- 86769_patch_2008-07-23.diff | `-- windows `-- _PROGRAMFILES_ `-- OpenOffice.org_2.4 `-- program `-- sw680mi.dll Files - 86769_patch_2008-07-23.diff A patch that is prepared based on DEV300_m14 - sw680mi.dll A .dll file for OpenOffice.org 2.4 Windows, which is built with the followings: - Source files of OpenOffice.org 2.4 [1] - solver of OpenOffice.org 2.4 [2] - The patch above This .dll file is primarily intended for experiment use to confirm the patch. References [1] (mirror_network)/stable/2.4.0/OOo_2.4.0_src_*.tar.bz2 [2] (mirror_network)/extended/2.4.0rc6/OOo_2.4.0_WindowsIntel_solver.zip [3] http://www.openoffice.org/issues/show_bug.cgi?id=86769 [4] http://openoffice-ja.org/wiki/issue/86769 (Japanese)
Created attachment 55319 [details] A patch and its .dll file
.
A bugdoc, its snapshots, and experimental patch are being attached. - bugdoc: 86769_wordarts_01.doc - snapshots: i86769_wordarts_01_doc_snapshots.png (Word, DEV300_m41, and patch) - patch: i86769_patch_for_DEV300_m41_2009-04-24.diff It seems that the patch could be also applied to DEV300_m44.
Created attachment 61765 [details] A bugdoc prepared with Word 2003.
Created attachment 61766 [details] Snapshots of the bugdoc.
Created attachment 61767 [details] An experimental patch to DEV300_m41
Even though the snapshots above solely illustrates a phenomenon upon loading a Word file, the patch above also covers a fix upon saving a Writer document into Word file.
I put this on my list of patches to check for OOo3.2. Experimental => decision about target after evaluation
assigned to tora
cws tora01 has been created.
fixed in the cws tora01 hbrinkm: what do you think of the fix? http://hg.services.openoffice.org/cws/tora01/rev/9eef1e4474af
tora: The fix looks good to me.
hbrinkm: thank you!
re-synchronized with DEV300_m100. changeset: 275238:ee188f881518 mru: Could you test this?
verified on the build AOO3.5_r1400796