1217 Commits

Author SHA1 Message Date
Miklos Vajna
62b63d9f4b DOCX export: write wp14:sizeRelH and wp14:sizeRelV for Writer TextFrames
Change-Id: I16ee2682b6fa8c7b194e442d6dbe1437e7743c60
2014-02-06 18:38:07 +01:00
Miklos Vajna
8ae90efb8a DOC export: fix nested comments
For one, replace m_nLastRangeStartPos with a map, so that we can keep
track of the start positions when multiple comments are open at the same
time.

For another, sort PlcfAtnBkl and PlcfAtnBkf by position as Word requires
it; with non-nested comments such explicit sorting wasn't necessary.
This also required building two maps, so that we can know what
PlcfAtnBkl index to reference in PlcfandRef, and what PlcfAtnBkf index
to reference in PlcfAtnBkl after sorting.

Change-Id: I2d7096b0c68a6b327efc4b5593ac96cdd297b3bd
2014-02-06 16:13:30 +01:00
Miklos Vajna
f69e8483a4 CppunitTest_sw_ooxmlexport: fix testcase that didn't fail without the fix
Change-Id: I87308b38bb44864db3531366ab354567847b1340
2014-02-06 15:54:57 +01:00
Rohit Deshmukh
dcea8ba3b4 Fix for Footer is missing if fisrt page different header/footer is set
Reviewed on:
	https://gerrit.libreoffice.org/7589

Change-Id: I2a2f2abc0dcf5542b7b950f9a232d7155a055fdd
2014-02-06 15:54:57 +01:00
Zolnai Tamás
a468e38669 drawingML import: paragraph adjustment inside group shape
Change-Id: I875cb1f12c9f81d329d7fe9cd3aa32a4cd818573
2014-02-05 10:48:37 +01:00
Zolnai Tamás
c53dd7ea94 drawingML import: capitalization inside group shape
There are two types of capitalization in DOCX:
-uppercase: <w:caps>
-smallcaps: <w:smallCaps>

Change-Id: I6a5d238bed68aa3fd3478a77cf1942f009480eb6
2014-02-05 10:48:37 +01:00
Jacobo Aragunde Pérez
2fcf3a871c ooxml: preserve gradient shape fill
LibreOffice is unable to properly import the custom gradient fills
defined in ooxml documents. To prevent data loss, we save the
original gradient fill definition in the shape interopgrabbag and we
write it back to the document on export.

In case the user has changed the fill properties of a shape, the
original fill will be discarded in favor of the new fill.

We have added a new ooxmlexport unit test to test this feature.

We have also added some missing transformations to the methods
getColorTransformationName and getColorTransformationToken in Color
class, and refactored some code in class DrawingML to the method
WriteColor( OUString, Sequence ).

Change-Id: Ie71f89eaa20313561aa9180ea33b76f3fb5e5df6
2014-02-05 02:00:03 +01:00
Thomas Arnhold
326bec33e0 some more continuous corrections 2014-02-03 14:01:40 +01:00
Miklos Vajna
e034fa4607 DOCX import: make sure rotation is not changed when we alter size
Change-Id: I5dd344fe06a0b700cebccfece44b622d00adfb5f
2014-02-03 12:36:08 +01:00
Zolnai Tamás
5c39b6b997 drawingML export: custom geometry with cubic bezier curves
When the custom shape is not a preset shape then construct a
PolyPolygon and use DrawingML::WritePolyPolygon() to export it.

Change-Id: I6598976a475bfcb92305338af9016e09df4c9456
2014-02-03 02:46:30 +01:00
Miklos Vajna
22e6916a82 oox: clear the saved shape when the shape really ends
Change-Id: Id0d644407bf1f5672e654082328434b9464c140a
2014-02-01 17:06:57 +01:00
Miklos Vajna
1af6cf096a DOCX import: round wp14:pctWidth/Height
sw core supports integers only ATM, so at least let e.g. 9.8 be 10, not
9.

Change-Id: I94842d7190bfa264f0fa0331d7418c411ef191d9
2014-01-30 15:56:58 +01:00
Miklos Vajna
da5b9bc95c DOCX import of wp14:sizeRelH/V relativeFrom="page"
Change-Id: Idd9dcc60f415081cb7a727b46a89d45af04465d0
2014-01-30 14:58:23 +01:00
Miklos Vajna
5013d67f0d swpagerelsize: add layout tests
Change-Id: I0c5b606518ce782ffb5e48a859910c4e9e09c76d
2014-01-30 14:11:00 +01:00
Miklos Vajna
0b20f01a88 swpagerelsize: implement ODF import/export
Export rel-height-rel / rel-width-rel only in case rel-height /
rel-width is non-zero, though.

Change-Id: I36120cbd8679ac4fc072d1e7cf4dfc024836b5ac
2014-01-30 11:52:11 +01:00
Nikhil Walvekar
36c5078d24 fdo#73550 : Fix for files having spacing issues due to missing pPr/rPr
for empty paragraphs.

Change-Id: I7e73a750982a0bd57da602379ea47c8bf9c194fe
Reviewed-on: https://gerrit.libreoffice.org/7587
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-01-30 09:09:57 +00:00
Zolnai Tamás
4fa88a5a63 drawingML export: transparency of solid filled shape
Change-Id: I97968dd5f5233e17870bdfdf2864ae8ce9179080
2014-01-30 09:17:28 +01:00
Pallavi Jadhav
0fc0acb525 Fix for :DOCX-Preservation of Line style Dash type of "Shape with text inside"
Issue :
        File containing Shape with text inside it having Line style as
        Dash type is not getting preserved after RT.

    Implementation :
        1] Added XML element <a:prstDash> with attribute  val="dash".
        2] Written Export Unit test case.

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

Change-Id: I27ca9f8786426a224b32dbd2aeabc40be244c9db
2014-01-29 10:24:51 +01:00
Stephan Bergmann
8bc3751ea3 bool improvements
Change-Id: Ibeb658e73b588f90242c95d23149f2ef45a7a815
2014-01-28 20:26:21 +01:00
Jacobo Aragunde Pérez
0d6cb9c123 ooxml: Preserve shape style effect attributes
Preserve <a:effectRef> tag and its contents from inside shape style
properties tag <wps:style>.

Added some lines to existing unit tests to check for the preservation
of these attributes.

Change-Id: I6e47b228dcc9788a4a2dfe87bd1186d2f04dbeea
2014-01-28 17:07:26 +01:00
Jacobo Aragunde Pérez
5391d4872e ooxml: Preserve shape style and theme attributes for line
Line style and color can be defined by the shape style attributes or
can be directly assigned by the user (and even using a theme color in
the case of color attribute). This patch aims to preserve the
relevant attributes of this feature after a roundtrip.

For style attributes (wps:style/a:lnRef), they are kept and preserved
in the "StyleLnRef" property of the shape InteropGrabBag. To be able
to access to some of them, the methods getLineStyle, getLineJoint and
getLineWidth were added to LineProperties object.

For the line theme color (a:ln/a:solidFill/a:schemeClr), the original
line color and the theme color name are preserved in the properties
"OriginalLnSolidFillClr" and "SpPrLnSolidFillSchemeClr"of the Shape
InteropGrabBag.

On export time, we must check if the user has changed any properties
of the shape line, this is done comparing the new shape attributes
with the original values coming from the style and theme definitions.
In case some of the attributes is different, the new attribute must
be saved overwriting the old one.

The data files for some /sd/qa/ unit tests were updated to reflect
the new properties inside the Shape InteropGrabBag. Besides, an
existing unit test in ooxmlexport was modified to include checks for
the preservation of line style, line theme color and custom line
style that override the style attributes.

Change-Id: Iabb0cef9e3cc433676c201bc296fb7b373839a3f
2014-01-28 11:00:37 +01:00
PriyankaGaikwad
d71d16958f fdo#73545 Shape position is wrong
Issue:
The <wp:align> is missing after roundtrip

XML Difference:
Original:
<wp:positionH relativeFrom="page">
 <wp:align>
 center
 </wp:align>
</wp:positionH>

Roundtrip:
<wp:positionH relativeFrom="page">
 <wp:posOffset>
 0
 </wp:posOffset>
</wp:positionH>

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

Change-Id: I3c8ef2f0ee3dd84a23fab197ab95f152b850067e
2014-01-28 09:47:52 +01:00
Vinaya Mandke
c035c3dc52 fdo#73556 Docx was exported with incorrect column width
The file contains a table with 3 columns. The girdcols
are as follows: {1210, 1331, 1210}, whereas the
individual cells have {1210, 400, 1210}.
The table column separators were taken from the grid while
the table width was calculated as 2820 from cells
instead of 3751 from the grid.
Hence the table width reduced after export to DOCX

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

Change-Id: I2c590ad6b5ec9fe3e8559971ca8cfa69c5343f47
2014-01-27 10:57:35 +01:00
Miklos Vajna
aeb1e8fd92 RTF import: fix handling of font color from paragraph style
Change-Id: I6bbad2d69863020ea870be800f49e13e763b80bf
2014-01-26 11:50:59 +01:00
Zolnai Tamás
ba697931a7 drawingML import: parse shape text run inside w:sdt and s:sdtContent
Change-Id: I6dc5939ae66967785cdc5dab318024b8cb17d1cd
2014-01-25 06:47:05 +01:00
Rohit Deshmukh
f1ec5dcfca fdo#69616: Fix for VML part missing for group.
Cause:
 - In altenrate content, Fallback contains only group tag.
Implementation:
 - Added export logic in Vml export.
 - Added unit test case for vml group.

Change-Id: Ia1c9834950528dc892caea1cb675a7f42165d9ba
Reviewed-on: https://gerrit.libreoffice.org/7276
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-01-24 08:43:08 +00:00
Jan-Marek Glogowski
c4ffca21ff Depend unit test on existing font.
Commit 734cf8395 introduced a unit test, which depends on a Calibri
metric-compatible font. So this adds a fonctconfig based check to
configure and just runs this test, if configure finds a correctly
mapped font.

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

Change-Id: I5255a4366684b115d88adca78ab2002864b63766
2014-01-23 18:13:04 +01:00
Miklos Vajna
6063555744 drawingML export: fix position of shape in case rotation is 180 degrees
This is the other case when position shouldn't be adjusted.

Change-Id: I9265bf1c762fd519e3a12e97d767b5d213644e6d
2014-01-23 15:30:11 +01:00
umeshkadam
896714db52 fdo#73546 : faulty value of attribute value in <wp:anchor> tag
Issue :
    - The margins for distL & distR were getting exported as a negative
      value viz ( distL="-635" distR="-635" ).
    - While setting the default frame properties the values for distL
      & distR were getting defaulted to -1, this value was further
      considered while exporting for calculations hence the value
      -635 used to appear.

   Implementation :
    - according to Ecma 20.4.3.6 the values of distL & distR should
      be positive.
    - Added a condition to check the negativity of the value while
      setting it to default.
    - observed that horizontal orientation values were being populated
      to distT & distB( top & bottom margin respectively) and
      vertical orientation values were being populated to distL & distR
      (Left and right margin respectively). The values should have been
      vice versa. Corrected the same.

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

Change-Id: I056e5845b64cd755429297899eeb972f6009efec
2014-01-23 11:05:55 +01:00
Miklos Vajna
8766011bcc DOCX import: set document-level font size default based on default para style
DOCX has two defaults: there can be default paragraph/run properties,
and also a paragraph/character style can be marked as default.

In this case the problem was that no doc-level default was specified,
but the default para style set a char height, and shape text is expected
to inherit that. Fix this by setting doc-level font size to default para
style, in case it's not set yet -- that matches what the binary import
does.

Also, adjust the export side, so that these duplicated default font size
is not written on export.

Change-Id: I63b368e7704142171d58f48d08052ac7616ab166
2014-01-22 16:21:51 +01:00
Miklos Vajna
f2d1e5ef1c VML import: parse shape text run inside w:smartTag
Change-Id: I26c2f9e3f5e560f22d3de0a7378c5cd7d0413184
2014-01-22 11:30:13 +01:00
Tushar Bende
92414c42cd fdo#73534 : Table row data was getting displayed twice after RT
There was a problem for some documents(containing table on page spanning across multiple pages
& pages having different Header-Footer type), during export Invalid sectPr was getting added
because of wrong condition check in the code.
Because of this:
1)Table row data was getting displayed twice after RT.
2)Increased number of pages after RT.
3)Header & footer were also divided into sections (like: Header-Section1 Footer-Section1 & Header-Section2 Footer-Section2).

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

Change-Id: I6c07e47321353e84af306c6285702852303ccee0
2014-01-22 09:41:21 +01:00
Miklos Vajna
3aef7b3b3d drawingML export: fix position of wrapped shapes in DOCX
In case of DOCX, the DOCX wrapper around the drawingML fragment already
contains the real position of the shape (which talks about paragraphs
and other concepts which are unavailable in a spreadsheet /
presentation), and the inner position should be 0, otherwise the shape
is shifted towards the bottom right corner.

Note that this only affects drawinglayer shapes in DOCX, Writer pictures
are handled in sw, and those always had a 0,0 position in the inner
drawingML fragment.

Change-Id: I582b1ae64387b50ffb051e1f5017eab0e5d5ab34
2014-01-21 15:02:11 +01:00
Miklos Vajna
305077c6c3 drawingML export: zero rotation shouldn't alter the shape position
I'm not exactly sure why existing code didn't do this implicitly, but at
least this improves the situation.

Change-Id: Id2bb169c513827b7ef48640dc88fad90a83d2bee
2014-01-20 16:22:05 +01:00
Zolnai Tamás
d0c383256e fdo#73389 Writer does not show a docx-document with nested table correctly
The table manager can work with more table simultaneously
and so m_aCellWidths contains more table's properties.Only one
item of it belongs to the current table (getCurrentCellwidths).
Regression from 74c5ed19f430327988194cdcd6bdff09591a93fa

Change-Id: I93efac0c004af1b2524c955ffb20c3ecd74a2920
2014-01-20 13:46:22 +01:00
Miklos Vajna
106c82706e drawingML export: write TextShape outline properties
Change-Id: I3742c960016bbe1d82b58a16d464b329d2612c10
2014-01-20 12:15:29 +01:00
Pallavi Jadhav
04a7ac6f06 fdo#69613 : Fix for TOC with flag '\u' should get preserved after RT.
Issue :
	DOCX contatining TOC Code field '\u' was not getting
	preserved after RT.

	Implementation :
	1] Provided import & export support for TOC field flag '\u'.
	2] Written export Unit Test for code field '\u'.

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

Change-Id: I43872c7db21c25e0586bf874d5bb0c9115ab76af
2014-01-20 09:24:46 +01:00
Jacobo Aragunde Pérez
d185daec68 ooxml: unit test for shape theme attributes preservation
This tests checks that the shape style attribute for fill color is
preserved, that the theme attibute for shape fill is preserved too
and that the interaction between them and direct assignment of some
color works properly.

Change-Id: Ia934c46731ed38be14ed851e083d0ed6fc151b01
2014-01-18 14:51:43 +01:00
Miklos Vajna
4144858f99 sw: add testcase for RTF_LEVELFOLLOW import
I almost broke this during refactoring...

Change-Id: If38e73f3b7d66e97bbcbad87447b8aa611ff79d1
2014-01-18 14:03:51 +01:00
Miklos Vajna
75934fc178 VML import: handle shape with text inside groupshape as TextShape
This matches the behavior of the WW8 import and gives us the required
text wrapping when the shape text doesn't fit in a single line.

Change-Id: I32a13516503620344d313593834be29a3dc9f726
2014-01-17 17:39:07 +01:00
Miklos Vajna
734cf8395d VML import: fix height of textboxes when border distance is non-zero
The VML concept is that the height / width of a textbox is absolute, and
border distances only affect the position of the shape text, not the
size of it. OTOH, when we set the Text*Distance UNO properties on a
textbox, the size may change. Make sure that during VML import setting
those properties doesn't change the size.

Change-Id: I53b328b66572fc05027be344869bc1a78d855558
2014-01-17 16:35:02 +01:00
Miklos Vajna
40a8b1f92c VML import: fix rotation of simple shapes inside group shapes
Change-Id: I28d2e2d801b06b92b5348123d88604fb4d10d828
2014-01-17 12:48:03 +01:00
Stephan Bergmann
7b3e7c46d7 Assert SwReaderWriter::GetReader returning non-null
...happened to fail for me once, for unclear reasons.

Change-Id: Idf88ff4952924a814e465b039fbae384691ba7a6
2014-01-16 18:40:06 +01:00
Miklos Vajna
70f360f34a missing sal_Int32
Change-Id: Id93a7945365b82ae600c6dfe0d17d13ad41256fb
2014-01-16 16:10:28 +01:00
Miklos Vajna
8477394f9b CppunitTest_sw_uiwriter: add testcase for ExportRTF()
Change-Id: I49a86e6a5cd525118d902b37825cfdb7dc8e70d2
2014-01-16 15:17:45 +01:00
Miklos Vajna
82587e9bd4 CppunitTest_sw_uiwriter: add testcase for ImportRTF()
Change-Id: I334b21532337c1895a148c949dde60ad774b4759
2014-01-16 11:19:43 +01:00
Miklos Vajna
30696e8426 RTF export: fix nested comments
Change-Id: I9986855f3160ed6f5856aec9f7d33fc416962e77
2014-01-15 20:32:44 +01:00
Miklos Vajna
6e216adedd filter: audit customshape type -> drawingML preset shape table
It turns out that this table contained entries which are not valid
drawingML preset shape names.

Invalid entries are now either have a valid name instead (based on the
oox/source/export/preset-definitions-to-shape-types.pl mapping, which
already tries to map VML shape ID's to drawingML preset strings), or in
case I found no mapping there, the entry is now simply commented out.

It's still better to fall back to export a shape as a rectangle than
corrupting the whole document.

Change-Id: Ic2d8926e5819f3312aaca55d50a1492332e52a9d
2014-01-15 15:04:36 +01:00
Miklos Vajna
28c89909a4 DOCX drawingML shape filter: export title and description
Change-Id: I6c740c8b2634785e794704ce0f2d89878e01ac51
2014-01-14 12:06:18 +01:00
Adam Co
c2c08b7d0e Add unit-test for 'track changes - paragraph properties changed' preservation
This is a unit-test added to complement the patch that added support
for the preservation of 'Track Changes - Paragraph Properties Changed'
from a DOCX file.

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

Change-Id: Ic81a5ac9ee369ae0f1d2f8d1a1fe54ea5e6b7402
2014-01-14 10:40:22 +01:00