When Word applies an artistic effect, it creates two embedded files;
one contains the bitmap with the effect and the other one contains the
original bitmap to be able to undo the effect.
This patch reads the original bitmap, stores it in the shape grab bag
and saves it back to the docx file. Added unit tests too.
TODO: right now, if two effects point to the same original bitmap it
is stored twice, we should improve this.
Change-Id: Ia72034a257739abe4ffafa0f42b2a912e4bf9436
Bitmaps can define artistic effects like in the following example:
<a:blip r:embed="rId5">
<a:extLst>
<a:ext uri="{BEBA8EAE-BF5A-486C-A8C5-ECC9F3942E4B}">
<a14:imgProps
xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main">
<a14:imgLayer r:embed="rId6">
<a14:imgEffect>
<a14:artisticMarker trans="14000" size="80" />
</a14:imgEffect>
</a14:imgLayer>
</a14:imgProps>
</a:ext>
</a:extLst>
</a:blip>
LO core doesn't support them, but I'm preserving them using the shape
grab bag. Bitmaps must not be transformed to a SwXTextGraphicObject
so the grab bag of the XShape is not discarded.
Added several Context and Properties objects on the import side to
traverse and save the relevant tags, and added the corresponding code
on the export side to extract the grab bag and output the effect back.
Also added a unit test for a selection of artistic effects.
TODO: Word saves the original bitmap as an embedded wdp file so the
effect can be undone. We must preserve it too and add the reference to
the a14:imgLayer tag.
Change-Id: I61d427f83e4c8f353eb073da0114cd73ba50ba4b
Issue :
- Document contains a Section break(Next Page) with a drawing.
- Section break is manullay adjusted before the drawing.
Hence in original document.xml it wsectPr comes as
a part of w:pPr of paragraph.
- But in RT in document.xml, section break is written
by adding a dummy paragraph.
- This is because <w:drawing> also contains a paragraph
and hence when encounters section property LO creates
a dummy paragraph and writes it in between runs.
- This was causing the corruption.
Implementation :
- Added a member varaible m_bDMLAndVMLDrawingOpen.
- It is set to true when it writes drawing.
- It's value is checked in DocxAttributeOutput::EndParagraph()
If m_bDMLAndVMLDrawingOpen is true Do Not make
m_bParagraphOpened to false, as one more paragraph is still
open.
- This will postpone the writing od Section property and will
be written inside w:pPr and no dummy paragraph will get
created.
- Added Export Unit test case.
Change-Id: Ifa26fcaf8f02e62d020339670c8ba58ba92d9f40
Reviewed-on: https://gerrit.libreoffice.org/9430
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
The motivation is that this test takes time to execute (and we're
testing a limit here, so it's not easy to speed it up), though moving it
out of CppunitTest_sw_ooxmlexport is still possible (which is the
current critical path during a toplevel 'make').
Change-Id: Ibe6580f8aea1439f4feb281996f2f4bbd46ff4ce
File is getting crashed while saving in LO, as it tries
to access the value of vector after erasing that value.
Code changed to access the vector value first and
then erase that value from vector.
Change-Id: I29369b7582fdbd7363d0e6fdae091a30c79a747d
Reviewed-on: https://gerrit.libreoffice.org/9433
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Problem Description:
1. On 19th May windows daily build
[Build ID: dd0f844728a53a337233a3c687b792e725803da5, TinderBox: Win-x86@42, Branch:master],
if we RT document, RT get corrupted due to the exceeding the limit of extend height & width.
2. As per ECMA standard, extend height & width is of type long, but MSO only
support int32.Hence added code changes to check the same.
3. On 20th May windows daily build
[Build ID: f3a46244a07b76d633ccc7f83da3fa502612e978, TinderBox: Win-x86@42, Branch:master],
if we RT document, it get corrupted due to exceeding value of posOffset.
4. Added code changes to make sure posOffset value is within the allowed range.
Reviewed on:
https://gerrit.libreoffice.org/9424
Change-Id: Ib0b55314f54c51f39a492485992356f71eb062e3
Originally a Field began inside a hyperlink but ended after the hyperlink.
This causes the corruption in MS Word.
Incremented the field count if the field is added for the current new hyperlink.
Added another variable to store the Field-Count from previous hyperlink.
Added UT for the same.
Change-Id: Id3c3bee1c8ed9c0755f8fff7efd5d1c5662f2c82
Reviewed-on: https://gerrit.libreoffice.org/9421
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
When we have <w:br> tag continuous like in the following cases...
"Title: Superstition\v\vComposer: Stevie Wonder\v\v"
or "\vLyrics: \v"
where "\n" is internally replaced by "\v" LO.
Before text "\v" or after text multiple "\v" is not preserved.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9420
Change-Id: I2a6d0a7d2382dfbc2f0ab04f150653c9b17bbfd1
In a hyperlink, extra field with fldCharType="end" is getting added
even though there is no begin and separate fldCharType. When hyperlink is
closing pageref was not set to false. Due to which LO was adding extra
end fldCharType.
Change-Id: I0f54ab03c38cec2888cf9a1638ec5435da90099c
Reviewed-on: https://gerrit.libreoffice.org/9414
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
- Normally if there is a case where text/shape is overlapped with (another)
shape then LO used to write the text and the AlternateContent in the same run.
- This is supported in MSO and there is no visual difference.
- But in case if the SdtContent(with text) is overlapped with the Shape then LO
processes sdtContent as a text and ends up putting the alternateContent and the
text in a single run. Ultimately it includes the entire run in a SdtContent,
which is incorrect.
- The fix checks for the aforementioned scenario and puts them in a different run
and also restricts the sdtContent being written in an invalid AlternateContent.
Change-Id: I36f4cdb1b583523dd8f717ae094bdf09c7a61f62
Reviewed-on: https://gerrit.libreoffice.org/9374
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
A file contains a 2007 word art within a drawing tool.
In Original file, the xml structure is as below:
sample xml:
<p> <r> <ac> <drawing> <txbx> <txbxContent> .. <pict> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
LO was preserving this as :
<p> <r> <ac> <drawing> <txbx> <txbxContent> .. <drawing> <txbx> <txbxContent> ..
</txbxContent></txbx> </drawing> .. </txbxContent></txbx> </drawing> </ac> </r> </p>
Now after this fix, If there is a custom shape within a text box, then we should postpone it and write it in
a separate run.
This approach is followed on the fact that LO writes nested TextBoxes in separate run.
NOTE1 :Due to this fix, xpath related to the below UT needs to be updated.
testFdo76249 in ooxmlsdrexport.cxx
NOTE2: In docxsdrexport.cxx : 'm_bIsInDMLTextFrame' is no more required.
For adding LockedCanvas, we only need to check if the property exists in the property set.
Therefoew removing the above bool variable.
Reviewed on:
https://gerrit.libreoffice.org/9392
Change-Id: I00e94712e912ad1977fcb65a945fefb927795d77
Description :
Docx file corrupt after roundtrip.
Root cause: For some documents During export LO was not checking for the content of sdt and Even if sdt contains Drawing object
LO was writing text data related tags <w:text/> & <w:dataBinding> in <w:sdtPr>,This was the reason for corruption.
To Fix this checking is there is any Drawing Object in run if yes skip writing <w:dataBinding> tag in <w:sdtPr>
And if sdt content is Text and Drawing both do not write <Text> or <Picture> as these tags will again result in corruption.
Presently, while writing the sdtContent tag LO does not check for the content type due to which LO ends up adding the dataBinding along with the
Drawing/AlternateContent which is incorrect according ecma ECMA-376, Second Edition, Part 1 : 17.5.2.6. This cause in file corruption.
Added a check to restrict the aforementioned.
Reviewed on:
https://gerrit.libreoffice.org/9371
Change-Id: Id31437db0309b0a2159389a4a9a1f5e13c1ac3a5
While export, locked Canvas is missing and drawing is
exported inside textbox. However a locked Canvas has to be exported
inside a text-box and drawing should fall under locked Canvas
for the RT file to work in MS Office 2010.
Reviewed on:
https://gerrit.libreoffice.org/9377
Change-Id: Iea2c411302b552db18527001cc4c6d0290085afe
In a hyperlink, the field with fieldchartype="end" is getting addeded eventhough there is no begin for that field.
Change-Id: I50df6efc63fc9a66b146d4a861ae4bd654b4a3c6
Reviewed-on: https://gerrit.libreoffice.org/9368
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
If docx file contains multiple hyperlinks in one paragraph
and one of the hyperlink contains "PAGEREF" field. End tag
for "PAGEREF" field was not exported hence it was causing
corruption in exported file.
Fixed export part of field end tags in case of "PAGEREF".
Added unit test.
Change-Id: I18a3625213bf7269e3f441859a27acc38cf6ff45
Reviewed-on: https://gerrit.libreoffice.org/9364
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
The original file contains two text boxes one contains image and the other contains chart.
Image in text box is not getting imported in LO which leads to no contents inside the a:graphicData tag which is causing the corruption.
Root cause is found in ShapeContextHandler::getShape.
mxChartShapeContext.is() returns true even when mnStartToken is not set as NMSP_dmlChart which is causing the issue.
I have added one more condition to handle this.
Change-Id: I6c567d7618b34c1a24f6809801e4460af6894c67
Reviewed-on: https://gerrit.libreoffice.org/9363
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
As the m_oldTableReference->m_pOldTablepInner was not cleared
the same tabled was incorrectly nested with itself.
Another issue was that the same table was mirrored in RT file
as LO was trying to export a Section break within a table cell.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewe on:
https://gerrit.libreoffice.org/9361
Change-Id: I09b730a10f1a0bc4434050e0078aeab3185de817
If a picture contains some 2D (glow, shadow...) or 3D effect
(rotation, extrusion...), we prevent the importer from transforming
it into a XTextContent so the XShape grab bag is not removed and
the effects are preserved using the existing mechanisms. Added a unit
test for this issue, and modified some existing unit tests to match
the new behaviour.
Change-Id: I3b87069ea208604383a592d34d0a4ceb6b0f9fc7
Transformed the preservation process of shape effects to be able to
store more than one effect. For that we:
* Created the Effect struct and added a vector member to the
EffectProperties struct.
* Changed the shadow effect to use the new Effect struct,
EffectShadowProperties struct is preserved because the direction
field still has some use but we should remove it.
* Changed the structure of the grab bag to store more than one effect.
* Modified an existing unit test to check shapes with several effects.
Change-Id: I0dd908fa1d9578827c02ef6272fc9e2b914391be
Issue :
- In RT in document.xml, value of Absolute Position Offset
<wp:posOffset> was going out of bounds.
- <wp:posOffset> is of type Int(32-bits), hence it's value
should not cross the MAX and MIN limits of Int.
Implementation :
- Added check for <wp:posOffset> should not cross
Maximum/Minimum limit of Int.
- Written Export Unit test case.
Reviewed on:
https://gerrit.libreoffice.org/9328
Change-Id: I22e75d7e603ebbf6a49e764fb1a3e6a4d2fd8b23
Description :
Docx file corrupt after roundtrip.
LO insert <w:drawing> inside the <wps:txbx> under choice after RT,
if the file created in MS word 2007 and contains Word Art inside the text box.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
sw/source/filter/ww8/docxsdrexport.cxx
sw/source/filter/ww8/docxsdrexport.hxx
Change-Id: I7421ed353cd7e9bae17b2447122090a4113f52b5
Field inside a hyperlink closed after the ending tag of hyperlink, which corrupted the RT file.
Change-Id: Ib89ead8d2f8a9eb6c8473ffd14853495ee1b2f62
Reviewed-on: https://gerrit.libreoffice.org/9330
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
* In case of symbol, symbol character get imported first and then font of symbols.
* So we are storing symbol character and when we parse symbol font then create UNO object for text.
Change-Id: If5b79521c6a59aec02b165e8120dafdd472cdaeb
Reviewed-on: https://gerrit.libreoffice.org/9281
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Shapes 3D effects can specify colors for extrusion and contours like
in the following example:
<a:sp3d extrusionH="25400" prstMaterial="metal">
<a:extrusionClr>
<a:schemeClr val="accent5">
<a:lumMod val="40000"/>
<a:lumOff val="60000"/>
</a:schemeClr>
</a:extrusionClr>
<a:contourClr>
<a:srgbClr val="3333FF"/>
</a:contourClr>
</a:sp3d>
Colors can be theme-defined or set in RGB and can contain
transformations.
This patch preserves all the color information using the shape grab
bag and modifies an existing unit test to add this check.
Change-Id: Ida168affd4ca2135d0bd8f97135dc1cd1e74165a
Shapes 3D effects can specify a material like in the following example:
<a:sp3d prstMaterial="metal" z="488950" />
This patch preserves the prstMaterial attribute in the sp3d tag using
the shape grab bag and modifies an existing unit test to add this
check.
Change-Id: I7be2dbbcc7e599d5f0fb8fa53ec1d180c18d8ebd
It is not creating .rels file for Header3.xml. While the Header3.xml contains the images.
Change-Id: I3d1eb187eaf23fc05783fbfd3576d9a585de791f
Reviewed-on: https://gerrit.libreoffice.org/9286
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Problem Description :
- After RT, table preferred width in percent is change to '0'.
- After RT, width type change to 'auto' instead of 'pct'.
XML Difference:
In Original : <w:tblW w:w="3000" w:type="pct" />
In Roundtrip : <w:tblW w:w="0" w:type="auto" />
Change-Id: I20f4011520715b7c1555e82dd1ca590c4b1b9b3a
Reviewed-on: https://gerrit.libreoffice.org/9277
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Shapes 3D effects can specify top and bottom bevels like in the
following example:
<a:sp3d z="488950" extrusionH="63500" contourW="50800">
<a:bevelT w="139700" h="88900" prst="cross"/>
<a:bevelB h="88900" prst="relaxedInset"/>
</a:sp3d>
This patch preserves the a:bevel* tags and their attributes using the
shape grab bag and modifies an existing unit test to add this check.
Change-Id: I4762111e4d2f75ba2fd3721a126aa324a28a853c
Shapes can contain 3D effects like in the following example:
<a:sp3d z="488950" extrusionH="63500" contourW="50800"/>
This patch preserves the a:sp3d tag and its attributes using the shape
grab bag and modifies an existing unit test to add this check.
Change-Id: Ice3cae39c71784be0f6c7f2700b07c21a5e1fb6e
Shapes can contain 3D effects like in the following example:
<a:scene3d>
<a:camera prst="isometricLeftDown" zoom="150000"/>
<a:lightRig rig="threePt" dir="t">
<a:rot lat="0" lon="0" rev="4800000"/>
</a:lightRig>
</a:scene3d>
This patch preserves the a:lightRig tag, its attributes and the child
element a:rot using the shape grab bag. It also adds a unit test for
this case.
Change-Id: I66b6de3c2b5ef89223b10da54006e28113b8ba5f
- The parent node for checked, checkedState, uncheckedState is getting overwritten by "text"
- text node is a leaf node, and should not have any children.
Change-Id: Ic269525001e914adc1aa328c92be5fe4d5d1b3e7
Reviewed-on: https://gerrit.libreoffice.org/9278
Reviewed-by: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Tested-by: Jacobo Aragunde Pérez <jaragunde@igalia.com>
In the past, LO did not support 'outset' and 'inset' border types
for tables, so when encountering them - LO converted them to other
types of border. Now that LO supports it - DOCX and RTF filters
were changed to import these border types correctly.
DOC filter was not changed, because creating a proper DOC sample
file that has these border types (needed for the 'bordertest.hxx'
file) was not possible right now. So at least DOCX and RTF filters
are fixed.
Change-Id: Ida2449d45a0ac138388f3cbfeb41657db1d4cda9
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Content-type for 'png' images was not getting added in
[Content_Types].xml. This was as only 'jpeg' and 'wmf'
extensions were handled. Modified DocxSdrExport::writeDiagramRels
to handle all types of extensions.
Added UT for the same.
Reviewed on:
https://gerrit.libreoffice.org/9252
Change-Id: I5e068d4db14f3a43be08a4b7c9bf265f388bf356
Issue :
LO was exporting DOCX containing MultiColumns with additional
Section break Continuos.
Implementation :
1] Added check for Column_count in MSWordExportBase::WriteText()
If Column_count > 1 and Text node is empty then do not
export Section Break.
2] Written Export unit test case.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9200
Change-Id: Ibf3e6bd2d4827aa77a659b1600939cc56d65a63b