Commit Graph

1656 Commits

Author SHA1 Message Date
Tomaž Vajngerl
2cf94cf173 oox: roundtrip-test for w14 elements in groupshapes
Change-Id: I51152c016d6a9e9604fd93c115577020373d964c
2014-03-11 16:54:41 +01:00
Miklos Vajna
30d94b0c40 i#124106 testcase
Change-Id: I732b4f8d758aac30e039d30e059aad0597307081
2014-03-11 16:37:46 +01:00
Ravindra Vidhate
ff2f55d6f0 fdo#35324: Text and picture water are not imported and not preserved in RT.
Problem : Open docx file which has Text/Picture as water mark.
1. The text is not imported properly also picture water mark is also considered as shape.
2. It writes the watermarks in Document.xml, while it should write in only Header.xml.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx

Reviewed on:
	https://gerrit.libreoffice.org/8457

Change-Id: Ic988858da25a4cba3ae16e614d920e2e16053a5f
2014-03-11 10:57:46 +01:00
Caolán McNamara
1dec3cfba8 vexing parse
Change-Id: Ie541a8b6384cec6e067e7f7b75f5c17ce1a4d4a5
2014-03-11 09:15:32 +00:00
Jacobo Aragunde Pérez
554a0ca639 ooxml: export combo box controls
Export combo box controls as <sdt> elements. Added unit test.

Change-Id: I9eda25101240ec61f78ede0f0462d3ab8e77b09b
2014-03-10 22:36:17 +01:00
Jacobo Aragunde Pérez
c483e0eeb8 ooxml: preserve locale attribute in date controls
It is stored in the shape grab bag on import and saved back on export.
Defaults to "en-US" if not present in the bag.

Added a check for this attribute in the unit test.

Change-Id: Ib9c74f120628dbfc5e035500424cbad8caed53fe
2014-03-10 22:36:17 +01:00
Jacobo Aragunde Pérez
e172825b53 ooxml: preserve dateFormat for unchanged date controls
When saving a date control in a docx document, we were overwriting its
date format with "dd/MM/yyyy" because it's tricky to support all the
possible combinations. Nonetheless, there is no need to overwrite it
if the date in the control remains unchanged during edition.

We preserve the original date of the control, its date format and the
formatted date string on import, and we compare the date in the
control with the original one on export to check if we can write the
old values or we have to re-generate them. Only in case the date has
changed the format will be reset to "dd/MM/yyyy".

We had to add an InteropGrabBag field to the XControlShape because it
didn't have one, unlike other shapes.

Unit tests were modified to check that the dateFormat field is
preserved unchanged.

Change-Id: I01e5c990e90ff190b5a6d7ea3853e049ff24ef0a
2014-03-10 22:36:17 +01:00
Miklos Vajna
c98d649117 DOCX strict import: handle math
Change-Id: I8b1419cb71ef67f91bfa532faa283204dae0e25c
2014-03-10 10:51:26 +01:00
Miklos Vajna
d795fb224e DOCX strict import: handle lockedCanvas
Change-Id: I44c936a8972e1ae101aeab62ace61f4470d92b34
2014-03-10 10:51:26 +01:00
Miklos Vajna
f5985685dd DOCX strict import: handle SmartArt
Change-Id: I8c45f3153eafe882f3d9ee3be533c3c0e673527e
2014-03-10 10:51:25 +01:00
Miklos Vajna
49c3aff8d8 DOCX strict import: handle charts
Change-Id: I1933b3272ff735ae1ecb500fcd693e3ca99bf264
2014-03-10 10:51:25 +01:00
Markus Mohrhard
54195c53a9 add disabled support for export validation in writer tests
Still too many validation errors to enable it.

Change-Id: I45830f6cff8ef52bc63fdda61a99985f4f7d242a
2014-03-08 18:31:13 +01:00
Jacobo Aragunde Pérez
25cd2f4bb4 Fix types in a test
Change-Id: I2f857f564e100cc4cf6b885c5a8f96e506b4046f
2014-03-08 17:59:21 +01:00
Jacobo Aragunde Pérez
b238583071 ooxml: export date controls properly
Export date controls as ooxml Standard Document Tags (SDT) instead
of replacing them with plain text.

SDT date controls contain the date in ISO format as an attribute of
<date> tag, a custom date format that can be specified by the user
in the <dateFormat> tag and the date formatted in that custom format
in the <w:sdtContent> tag.

The unit test testFormControl from ooxmlexport suite was removed,
it only checked if the date control was exported as text and it
obviously fails now. A new test that checks the values of the
exported control was written instead.

A pair of date format functions were added to datetimeutils.hxx.

TODO: to avoid supporting all the posible custom formats that can be
specified in the <dateFormat> tag, it is forced to dd/mm/yyyy on
export.

Change-Id: I9d1b6f840ee9e133831fdb04ad399fe31bcb2063
2014-03-08 17:50:59 +01:00
Miklos Vajna
aaef39de32 DOCX strict import: fix pictures as well
Change-Id: I29f12eb1e5bfc39dc7d76efcff50dced061f7969
2014-03-07 18:07:56 +01:00
Miklos Vajna
195b8491d0 DOCX strict import: fix headers
Now that the document has a header, better to just test the bottom
margin, as in case there is a header, the top margin has different
semantics in Word and Writer.

Change-Id: I11212965ecd364cdc8a205c3ab3b8b71ed12944b
2014-03-07 17:36:14 +01:00
Miklos Vajna
37cc7e7471 DOCX import: handle points in ST_TwipsMeasure and ST_SignedTwipsMeasure
This fixes page size and margins in case of strict DOCX.

Change-Id: I65894eeef191a0f4bd92d1fa69a17e820aae3a43
2014-03-07 15:10:26 +01:00
Miklos Vajna
312e3c38be drawingML export: fix handling of dkVert pattern fill preset
We convert the dkVert preset to a certain hatch configuration (style,
distance, angle), but when we exported it back, then we didn't recognize
it, and wrote ltVert instead.

Change-Id: I021885496843f5ea5453af3473453bbec50d928f
2014-03-07 11:14:43 +01:00
sushil_shinde
c6b99eedda fdo#75158 : Handled unsupported fields for docx file.
- Handled unsupported fields using fieldmark API.
  - Added Unit Test.

Change-Id: I0c69458f330fa2e98821c392ea97410fe1b1e20e
Reviewed-on: https://gerrit.libreoffice.org/8391
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-03-07 03:19:07 -06:00
Muthu Subramanian
ad737e7ff4 Re-enable the unit test (BackGraphicURL). 2014-03-06 21:24:19 +05:30
Muthu Subramanian
f8062328bc Disable unit-test BackGraphicURL test temporarily. 2014-03-06 18:00:10 +05:30
Miklos Vajna
8556cd8812 cp#1000039 DOC import: ignore symbol charset of the symbol font
Otherwise characters unhandled by our OpenSymbol font (like Arabic 0-9
numbers) won't be rendered using an other font, as no other font
provides the symbol charset. Do this in
SwWW8ImplReader::GetFontParams(), where we already have font name ->
font family mappings for a few well-known fonts.

The DOCX filter does the same for quite some time, and that's how Arabic
numbers in text using the Symbol font were rendered, instead of little
rectangles.

Change-Id: Ib794cac19ad7b073e39f3cbd7d4bad3994151c14
2014-03-06 10:02:57 +01:00
Michael Stahl
2b78f2cd7b rhbz#988516: DOCX import: fix context stack when importing header/footer
When a header/footer substream is parsed, a ParagraphGroup is started,
but not ended; so the properties of the last paragraph in the
header/footer are applied to a paragraph in the body.

The obvious fix to add a call to endParagraphGroup() at the end of w:p
element breaks table cells.  So add a call to endParagraphGroup() at
the end of the "hdr"/"ftr" element.

(The problem in the bugdoc became much more visible with commit
ca555c596043c88894b964ac5e21f5a7271d5f3b, but was there before)

Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027
2014-03-06 00:20:00 +01:00
Tomaž Vajngerl
477684669a ooxml: round-trip test for w14:anchorId & wp14:anchorId
Change-Id: Iada0ba2b6d1450167977915fe95a38b5bab2559c
2014-03-05 20:24:03 +01:00
Jan Holesovsky
27e57531b4 sw tests: Fix description of the new assertXPathContent() and use it broadly.
Change-Id: I3c8d5e491fcf9f871d72fb2d138bb7094ff69746
2014-03-05 12:06:02 +01:00
Tushar Bende
7b7b64f26b fdo#75557 : OLE Objects of type .zip not being preserved in RT
Problem was Document containing ole object if RoundTripped then after Roundtripping the OLE object was not working.
Which means if doc contains .zip file as ole object then after RoundTripping that .zip object was not getting opened .

Reason found that it was because of missing o:title attribute during RoundTrip for <v:imagedata> inside <v:shape>.

XML file difference :
        In document.xml,
        Before - <v:shape id="ole_rId2" style="width:72pt;height:40.3pt" o:ole="">
                   <v:imagedata r:id="rId3" />
                 </v:shape>
	After -  <v:shape id="ole_rId2" style="width:72pt;height:40.3pt" o:ole="">
                   <v:imagedata r:id="rId3" o:title="" />
                 </v:shape>

Verified that code changes working for other ole objects as well which are: Equations ,Excel Sheet and .zip.

Change-Id: I813de38bcd6e334ce38a661fdfcfa434ef246ed0
Reviewed-on: https://gerrit.libreoffice.org/8458
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-03-05 04:22:30 -06:00
Vinaya Mandke
7691532a89 fdo#73596 [DOCX] Index:distance between columns
Import the "w:space" or the distance between multiple
columns of an Index
Modifies existing UT for the same

Reviewed on:
	https://gerrit.libreoffice.org/8444

Change-Id: I6d38e106208524cb22d0b98b0071360865e64bc0
2014-03-05 11:07:19 +01:00
PriyankaGaikwad
0415e26961 fdo#73219 File corruption: Table in header
Description:
File corrupt due to the end tag </w:tc> </w:tr> </w:tbl> are missing after roundtrip in header4.xml

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/8378

Change-Id: Ib05a50b3b3beca6c744b93360f9341ddcaa1a22a
2014-03-05 10:53:01 +01:00
Vinaya Mandke
6536826f2f fdo#74792 [DOCX] Grab-bag rels and images for SmartArt
Added support to grab-bag rels and associated Images for
data[i].xml, and drawing[i].xml.
Added UT for the same

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/8362

Change-Id: I545825f67214f14037ab72b77764a07d575b8b5b
2014-03-05 10:13:40 +01:00
Nikhil Walvekar
d043c9e3be fdo#73596 Added support to import and export \r,\h Index flags.
This supports \r flag run-in type index. If \r is specified then we don't
have to write \e flag (separator char).
\h is Alphabetic separator, where indexes are grouped as per starting
character.

Change-Id: I690b29cef3d24b2a71b01f1deef0e418162d71aa
Reviewed-on: https://gerrit.libreoffice.org/8099
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-03-05 02:48:29 -06:00
Miklos Vajna
e88ee8aa30 bnc#821208 DOC import: don't overwrite WW8Num* character styles
In general we're overwriting styles on import in case we're not pasting.
But these WW8Num* character styles are in general not from the document,
they are created because Writer needs a character style for each
numbering level to handle what's in the DOC file.

So, in case there is a character style with the same name as our
"character style for numbering" styles, prefer the later ones, as that's
intended most likely.

Change-Id: I675f867722360aca765bb96b0b43ea47deab9847
2014-03-04 15:38:55 +01:00
Miklos Vajna
f3a79ea8c3 CppunitTest_sw_ooxmlsdrexport: make this failure a bit more readable
Change-Id: Ia71f5ea712ad16d6eef3af1136613d38cd27b581
2014-03-04 10:17:47 +01:00
Norbert Thiebaud
a7db7c5ee2 make sw_ooxmlsdrexport 'work' on mac
Change-Id: I35558dfb71007932e9a371408e6306216cfbd0f9
2014-03-03 18:17:43 -06:00
Stephan Bergmann
b2371492df Use cstdlib std::abs instead of stdlib.h abs
...because the latter lacks the abs(long) overload in some popular environments,
cf. <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60401> "stdlib.h does not
provide abs(long) overload."

Similarly, stdlib.h lacks the abs(float), abs(double), abs(long double)
overloads compared to cmath there, whose use was apparently intended in
sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx.  Rewrote that to use
CPPUNIT_ASSERT_DOUBLES_EQUAL instead, which revealed that the comparisons need
rather large deltas of .1 resp. .2 (which the original code hid with an
implicit conversion to integral type, thus using an effective delta of 1).

Discovered with -Wabsolute-value ("absolute value function 'abs' given an
argument of type 'long' but has parameter of type 'int' which may cause
truncation of value") recently introduced on Clang trunk towards 3.5.

Change-Id: I4c41575ffdccb2944498b662bd3a53fd510cb0c0
2014-03-03 18:36:55 +01:00
Miklos Vajna
ec39578e5c sw/qa: clean up xray instructions
Change-Id: I34ed7b81a838a2c994bb028e92f463d7b08f242f
2014-03-03 17:34:09 +01:00
Michael Stahl
74b3f4f007 RTF import: fix paragraphs in header/footer
Change-Id: I91f04cad7a39428ce6f9555d18b974f0d45181f7
2014-03-03 13:53:22 +01:00
Michael Stahl
f03218f43e RTF import: add unit test for page break in continuous section
Change-Id: I8b766aa61b1121f9b7068f5ccbdc24ef97253432
2014-03-03 13:53:22 +01:00
Michael Stahl
e3f254ab82 RTF import: fix spurious page breaks at doc end (related: rhbz#1065629)
When a document ends with \sect it's possible that a spurious page break
is created.  In fact the spurious page break is always created by the
RTF importer, sometimes it is deleted again by
DomainMapper_Impl::RemoveLastParagraph() and sometimes not.

It is created because on the final \sect RTFDocumentImpl::sectBreak()
still calls startSectionGroup(), and the popState() for the \rtf1 group
then calls sectBreak() another time.

To prevent this, do not call startSectionGroup() from sectBreak() but
instead from setNeedSect(), and ensure that it is called as soon as
anything after \sect is read.

One unit test fails because the \page is not handled properly: the
conversion to \skbpage \sect \skbnone is not correct, because the \skb*
keywords are an exception and affect the \sect that precedes them, not
the following one; sending the \skbpage later unfortunately requires
additional cleanup later.

Change-Id: I3c1a3bceb2c8b75bbecdc748170562451ce5f5c3
2014-03-03 13:53:21 +01:00
Tomaž Vajngerl
7934120376 ooxml: rountrip test for w:compatSettings and mc:Ignorable
Change-Id: I69a602f3a5eb83f116113b1dbe8bb9f208bd5e5d
2014-02-28 20:24:39 +01:00
Miklos Vajna
440fbd6090 DOCX import: handle font theme references in group shape text
Change-Id: I1d5b86ad17b2c4a0945f483c94ac6abf410cf1d6
2014-02-28 13:51:35 +01:00
Tomaž Vajngerl
b731909d3c ooxml: extend roundtrip test - stylisticSets, cntxtAlts
Change-Id: I727df93d112e28be31b196c7f861cf1d0133bfe1
2014-02-27 17:35:04 +01:00
Tomaž Vajngerl
22d5d14d1a ooxml: extend roundtrip test - ligatures, numForm, numSpacing
Change-Id: Ibab36ef0e6352f740d339b12c81385053af84be1
2014-02-27 17:35:02 +01:00
Alexander Wilms
a27462189d Remove visual noise from sw
Conflicts:
	sw/inc/unodraw.hxx
	sw/inc/unoframe.hxx
	sw/sdi/swriter.sdi
	sw/source/core/unocore/unoframe.cxx
	sw/source/core/unocore/unoparagraph.cxx
	sw/source/filter/ww8/rtfexportfilter.cxx
	sw/source/ui/inc/unotxvw.hxx
	sw/source/ui/lingu/hyp.cxx
	sw/source/ui/lingu/sdrhhcwrap.cxx
	sw/source/ui/uno/swdetect.hxx

Change-Id: Ic0a3fb2392187c277c9b36915ffb10dcf0317908
Reviewed-on: https://gerrit.libreoffice.org/8322
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-02-27 09:41:00 -06:00
Miklos Vajna
150420cbff DOCX export: fix style's next element order
Change-Id: I03e91a448794efc2b91f3a6fb6c29dda3403ce9b
2014-02-27 16:22:25 +01:00
Miklos Vajna
743d90ca38 DOCX export: fix order of table border elements
Change-Id: I17d8634017c5b0374d30501186b338ddedbcd7ea
2014-02-27 15:22:35 +01:00
Tomaž Vajngerl
e9b6e7f6b4 ooxml: extend roundtrip test with w14:props3d
Change-Id: Ia7a3a998b07aefc94e6713c2ecf639166f1d3460
2014-02-27 09:12:05 +01:00
Tomaž Vajngerl
a9e117cfb6 ooxml: extend roundtrip test with w14:textFill
Change-Id: I9d1a426b0972211f4b04145dd8e231162d3e5845
2014-02-27 09:12:02 +01:00
Jacobo Aragunde Pérez
1c993627d8 sw: write other types of embeddings properly to docx
Improves patch 1428ec6f4e

When embedding an object into a docx, several things interact:

* The properties in the <o:OLEObject> tag in document.xml
* The ContentType for the file defined in [Content_Types].xml
* The Type of the Relationship defined in document.xml.rels

You need the right combination of those three elements for Word to
properly recognize the embeddings in exported documents.

To know which values must be written, I store some interoperability
information in the import phase in the document grab bag. The
relevant information is the value of the ProgID attribute in the
<o:OLEObject> tag.

I have defined three cases depending on the value of ProgID, but more
could be needed in the future:
* Embedded xlsx sheet.
* Embedded pptx presentation.
* Generic OLE, this should work with embedded odt/ods in combination
  with the ProgID attribute stored in the import phase.

Change-Id: I26336cb3fe47bd33e1cef11dd1c7edcf390f2e56
2014-02-26 20:18:36 +01:00
Miklos Vajna
52c5d1a70d CppunitTest_sw_ooxmlexport: restore this test
It was crashing, as a quick-fix 43feacd533
(sw: fix build, 2014-02-08) disabled the test. I wanted to fix this
properly today, but it was already working.

Change-Id: Ifbfa82bc907d6c4bd8ec398472f751714c721b09
2014-02-26 17:39:31 +01:00
Miklos Vajna
8520f61fe3 CppunitTest_sw_ooxmlsdrexport: move all AlternateContent tests
AlternateContent is used while dealing with shapes, move all those
tests. With this, the original suite has 330 asserts, the new one has
78, and they can run in parallel since
2efee3c632.

Toplevel 'make' on my machine:
- before: 3m15.237s
- after:  2m40.197s

Change-Id: Id7ac9708e29ae8c6ea7db8aa845de089ed4bdf42
2014-02-26 16:21:19 +01:00