Commit Graph

3485 Commits

Author SHA1 Message Date
5aeaba2e65 Resolves: rhbz#1089377 crash on loading a specific rtf
Change-Id: I26864f3a2247f5d7184f395cfed91eaf92e36295
2014-04-22 17:24:11 +01:00
b2e4ea31ec Accidentally removed "s"
Change-Id: I1b693f767fd7fc1170cd396ee037243fa5a1fffa
2014-04-22 14:40:33 +02:00
28fc951233 loplugin:passstringbyref
Change-Id: Iee0ad3898e109add96daac693633c0921c3d7c97
2014-04-22 14:38:33 +02:00
9b7e3511b3 -Werror,-Wparentheses-equality
Change-Id: I65f41ace03071fdb420736e373684b592ddf5fab
2014-04-22 14:35:47 +02:00
8e8f9388c3 Related: fdo#77600 RTF import: RTFValue::equals: compare attribute content
Previously only the number of nested sprms / attributes was compared.
With this, the font of the bugdoc is correctly Arial, not Times.

Change-Id: I351de414b6734336b31c1334dbd2349072f16002
2014-04-22 13:10:57 +02:00
255194801e fod#77122 DOCX filter: link between textboxes is not being preserved
Added support for linked textboxes for docx interoperability.

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

Change-Id: I7db4f5a1783afff53c64908d182788b262f5e863
2014-04-22 12:09:40 +02:00
abe1e852a2 handle properly page breaks even if a page contains only a frame (fdo#55381)
The test document has 4 pages which only contain frames, first 3 pages
(sections) have <p> block with <framePr> and another <p> with just <sectPr>,
and the second paragraph would be removed, thus there would be no nodes on which
to actually set the page style and they would be set on nodes for the previous
page, overwriting its page style. The last page does not have its own <p>
at all, so it needs to be faked.

The changes in finishParagraph() are because of e.g. the comments-nested.odt
sw test, which there causes exception because of unknown property ParaStyleName
(comments do not use those it seems) and the code is skipped over (which
is probably a bug on its own, but it's unrelated to this change otherwise).

Change-Id: I9d37f992407a9b649c710d2a031ec4447fb11771
2014-04-21 19:18:40 +02:00
fdb9807a10 writerfilter: fix indentation in rtfsdrimport
Change-Id: Ibecedba7a8a6e6b3218f64aefdd05897a6612a71
2014-04-21 11:47:05 +02:00
04fc3bc911 writerfilter: fix indentation in rtfvalue
Change-Id: I40edb3980fe9cf9e88a7bd75b542dc44509fd74b
2014-04-20 11:17:39 +02:00
bde1e4dce3 writerfilter: fix indentation in rtfsprm
Change-Id: Id81cb97033e616acf071f386630b49ccb83dfedc
2014-04-19 12:12:45 +02:00
9e83bdb713 fixincludeguards.sh: writerfilter 2014-04-19 11:10:08 +02:00
6b6e4d471c fdo#75735 RTF import: fix COW when writing a nested structure
Regression from a48e2fd9049797110b3b2505c363557284987ca8 (fdo#44736 -
convert RTFSprms to a copy-on-write structure., 2012-12-07)

Change-Id: I2538f440e29cef6d40db2ea914e4afcbfe411890
2014-04-18 17:34:36 +02:00
2496eaa5c4 fdo#77219 Image property Z-index [behindDoc] not preserved after RT
Problem description:
For the images who has the "Text wrapping" property set as Behind Text
 is not preserved after saving the file in DOCX format using LO.

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

Change-Id: Ic8555103909c0f1ed1cb58fba4dc2ef2f84cc9dd
2014-04-17 10:10:37 +02:00
7ec515a716 writerfilter: Hide more debug strings we don't need in production builds.
Change-Id: If30d3a94cd3f18bd5c4856d8a88f6c78e0da3e76
2014-04-16 17:46:09 +02:00
cebb4abec1 fdo#74652 : Extra image gets added to the document body after RT.
Description: There was a problem for some documents, that when opened in LibreOffice
extra image was getting added to the first page of the doc and same could be noticed
even in RoundTripped doc.

The root cause was if picture bullet is added to the doc and there is no <w:lvlPicBulletId> tag
in <w:lvl> of <w:abstractNum> then removal of extra added graphic object from document body was
getting missed because currently that is handled in ListsManager::lcl_sprm() inside "case NS_ooxml::LN_CT_Lvl_lvlPicBulletId".

Checking if there is any remaining item in m_aNumPicBullets when LO hits the ListsManager destructor.
If there is any calling dispose() for all of them.

Change-Id: Ibfc3c93b68ff7d6ef0909fe789dda6db67ac11e2
Reviewed-on: https://gerrit.libreoffice.org/8940
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-16 08:43:57 +00:00
1f274be55e Line spacing is not preserved for styles.
Description :
In StyleSheetTable.cxx, while setting the property "ParaInteropGrabBag" throws an exception.
Hence rest of the properties are not set.

Implimentation :
Skip that property so that rest of the properties will not be lost.

Change-Id: Id488de71bc5f893a7401420d9e63e4405b90f760
Reviewed-on: https://gerrit.libreoffice.org/8902
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-15 08:55:29 +00:00
26d8861166 Properly #ifdef debug-only code
Change-Id: Iebf7ed1fb034ab2c2bee36ca6bf23408bf060d8d
2014-04-15 08:42:43 +02:00
f2b815de56 writerfilter: QNameToString is for debugging, avoid using that in real code.
Change-Id: I8462204bb0fe4da8de1d05a42347466e40e54169
2014-04-14 20:13:35 +02:00
fabea153cf Compile the debugging strings in only if we are about to use them.
Saves us tons of string literals.

Change-Id: Ieb7ac52e7493d692e7ed56552350b8781ec6b500
2014-04-14 16:43:28 +02:00
904630a227 fdo#77267 RTF import: pard should reset current paragraph style
Change-Id: I8d78ce262a4e57161325231a78e48750909b1bad
2014-04-14 09:06:23 +02:00
c1e563f6ef fdo#76741 [DOCX] Table Alignment and width type
There are two issue related to table in the saved(exported) file
     - the table alignment in saved file is "left" instead of "center"
     - the table width type in properties is "auto" instead of "dxa"

     In the issue file alignment was specified in w:tblpXSpec="center"
     and so were missed at import. Added support to fetch
     HORI_ORIENT from frame properties if its not set in Table Properties

     The ::GetTablePageSize returns 0 if the table width is FIXED.
     Modified it to return the tableWidth in such case.

Conflicts:
	writerfilter/source/dmapper/DomainMapperTableHandler.cxx
Reviewed on:
	https://gerrit.libreoffice.org/8846

Change-Id: I02a3af5e9d8ef3746c4d6bec0a07a24e01cc12a4
2014-04-14 08:49:58 +02:00
6180d7164a RTFTokenizer::resolveParse: use SvStream::remainingSize()
Change-Id: Ia09c4cf67390e24573174ff701a72f7bac367599
2014-04-13 18:04:22 +02:00
2df53ef500 fdo#74599 RTF import: enable StylesNoDefault compat setting
The Writer 'Heading 3' paragraph style is gray by default, but (just
like in case of DOCX) that shouldn't have any influence on the RTF
import result.

Fix this by moving the compat setting from the DOCX filter
implementation to the common dmapper.

Change-Id: I86c7cf1a66f82b438ce8379467773a88c9e229af
2014-04-12 16:46:26 +02:00
8f2c47739f writerfilter: remove no longer needed WRITERFILTER_WRITERFILTER_DLLPUBLIC
Change-Id: Idedee38be19bc770518b85af62c9fc2b5b64e822
2014-04-11 21:26:11 +02:00
07f90c89ef fdo#76635 : Table borders not preserved after RT
The document containing a custom table is getting crashed.
In the document the user has created his own costume table styles and
in the created custom table style the user has set  repeat first row as header property.
The corresponding tag for this property is 'tblHeader'
LO was adding this property as a part of cellProperties in DomainMapperTableHandler.cxx.
But it is a part of a Row Property. That is why there was a crash @ open.

In DomainMapperTableHandler.cxx : 'endTableGetCellProperties' tblHeader property is removed from
style as it is not allowed for a cell.

Change-Id: I83cd369aa4497ec3f4b567174f23ddee9be2864e
Reviewed-on: https://gerrit.libreoffice.org/8848
Tested-by: David Tardon <dtardon@redhat.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
2014-04-11 12:30:45 +00:00
a1ea3838ad check that stacks are not empty before top()
Change-Id: Iad5b3381b8201c5ac32a5bdf99bd3d5872ea3afc
2014-04-11 11:19:32 +01:00
84272d115d Introduce twip/mm100 conversion functions instead of duplicated macros
Change-Id: Ib689e35b417e0e9016cd6a239c986e0603a99d62
Reviewed-on: https://gerrit.libreoffice.org/8837
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-11 10:19:05 +00:00
518bdcce5c writerfilter: clean up duplicated PROP_PARA_*_MARGIN_*_AUTO_SPACING insertions
Change-Id: If3f7a54a48541935295515bae47233e53c228fe5
2014-04-11 09:59:46 +02:00
05c5da4c37 fdo#76597: Fix preservation issue of Spacing between paragraph
Change-Id: I458bed111893a8d2fef79b11e28263a5bd2ed9cf
Reviewed-on: https://gerrit.libreoffice.org/8842
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-11 07:52:57 +00:00
83c888bdb0 writerfilter: remove dead doctok detection code
Change-Id: Ib39d54ce37b9e41ab6aff742d7680a7cd76168cd
2014-04-10 22:08:37 +02:00
6835d9f307 It's "its", not "it's"
Change-Id: Ieaa787afd7cc622b4750a2ee8f17f6dad934ba63
2014-04-10 20:22:50 +03:00
5cfbf353db loplugin:bodynotinblock
Change-Id: I7262f0114f3bde17d81e14e0813cc7906e73fceb
2014-04-10 12:53:22 +02:00
a7bc9c1e49 fdo#77051: Preservation of Index field flag '\f'.
Problem Description:
- In LibreOffice, the index field flag '\f' was not
  getting preserved after roundtrip as there was no
  support for it.
- '\f' field flag is used for Specific Entry Type.
  ex. In our case it is "Syn"

Implementation:
- Provided import & export support for Index field flag '\f'
  and added UT for the same.

Change-Id: I97c2456dd73c8bdf89ab105f8cac71bf7e2ad164
Reviewed-on: https://gerrit.libreoffice.org/8839
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-10 08:15:54 +00:00
dcb2fbdae5 WaE: passing OUString by value, rather pass by reference
Change-Id: I2577234385257ed0512403e5c9e34aa71ed5ce1f
2014-04-09 11:25:24 +03:00
48dd437039 fdo#76583 DOCX import: Floating table information is not preserved in RT file.
- Earlier the table width was compared with the text area to decide if the
  fly has to be created for the floating table.
- In most of the cases such floating tables were the ones which did not have
  any text around them and not importing such tables as fly made sense.
- But there are some scenarios where in the floating tables have width
  greater than the text area but are positioned in a way such that they begin
  before left margin and end before the right margin moreover they appear to be
  really floating (unlike in first scenario) as they have text around them since
  there is still room for the text.
- Handled this scenario and added a UT.

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

Change-Id: I7ea25e04ed7c6315e4e4fe4b67badf451c30cd0c
2014-04-09 10:06:36 +02:00
d356395ec3 WaE: -Werror=maybe-uninitialized
Change-Id: Idc72dde52280fd3dc1721ad9f4d8df38017e18f0
2014-04-08 15:03:59 +01:00
69eebf8735 fdo76591:-Textbox property (order-> send behind text) is not preserved.
Z-Index was not handledin LO for vml.
I have made the changes to handle that using aGrabBag.

Change-Id: I2af3b2974c8eb699bc6a7b743dc438584d6517ac
Reviewed-on: https://gerrit.libreoffice.org/8833
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-08 03:20:50 -05:00
69c950ae86 RTFSprms::set: replace two bool arguments with an enum
The primary motivation is that the two bools allow 4 combinations, but
we only handle 3 of them. Also, caller code is much more readable, now
that a non-default overwrite mode is written explicitly.

Change-Id: Iedf7dee1ab2d33de849aef6d7a51138d35048e5a
2014-04-06 18:14:03 +02:00
0a215b9a98 fdo#74823 RTF import: work around wrong table column width on invalid input
This scenario is not a valid one, Word doesn't handle it, either -- but
the old LO 3.4 parser did. So add minimal support for it to avoid
the regression.

Change-Id: Icc2e8d3bf314e9cadda57956668033aa6d092457
2014-04-05 16:06:26 +02:00
8baff038be fdo#76628 RTF import: allow the same font to have multiple encodings
Commit bbe3627eece0c3486e7ea11f2f13377aaa3a8fed (rtftok: stop sending
sprm:CRgFtc{0,1,2} tokens, 2014-03-05) dropped support for case when a
font name is used in multiple entries in the font table, but with
different encodings.

Turns out that this is a valid use-case, so revert back to the old
behavior where the key of the encoding table is the font index, not the
font name.

Change-Id: I048dff58af801d704fd4bc75a6a4dcb0f03bf185
2014-04-04 10:53:27 +02:00
ae61569eea oox: Do not overwrite table style properties
Some table properties can be defined by the table style but cells can
overwrite them in their cell properties section. Our exporter was
writing all the cell properties in all cases, regardless of them
being defined by the theme or not, and we shouldn't do that if we
want the document to work properly in Word.

To fix the issue I store the style-defined cell properties (the
format of all four borders) in the table grab bag. The exporter
recovers them and compares with the cell properties before writing
them; if the cell property matches the stlye-defined one, we don't
write it to the document.

An existing unit test was slightly modified to check that the actual
cell properties are not being skipped.

Change-Id: I3aa12d76fb8f73d3fd300f254d19e1683fb6146c
2014-04-03 22:19:20 +02:00
6a38047ff8 Typos
Change-Id: Ia406e2efb1eb2685eeffdf07dcc5fad4fc2b6e94
2014-04-03 21:21:32 +02:00
0695236cd7 writerfilter: DEBUG_PROTOCOL is never defined
Change-Id: I0f6de2041237282c770bd3926140836008d7d12b
2014-04-03 20:35:29 +02:00
3e9d9b073f oox: Preserve table style.
Table style is a property that defines a set of background and line
attributes for cells. These attributes depend on theme settings (e.g.
theme colors).

We added a grabbag to the table object to save the table style name.
We detect that name on export and write it back to the document.

Finally, modified an existing unit test to check this attribute too.

TODO: To get the table style working properly after a roundtrip, we
must preserve it and also check that its values are not being
overwritten by different cell or table properties.

Change-Id: Id0e022a389561960c21ab874db33649499735024
2014-04-03 09:59:18 +02:00
a3efbb5d33 oox: Preserve cell theme color.
When some background color is set to a table cell, it is stored in the
cell properties tag <tcPr> like this:

  <w:shd w:fill="ECD2B6" w:color="auto"
         w:themeFill="accent6" w:themeFillTint="66" w:val="clear"/>

The theme-related attributes in w:shd were not being preserved. To
fix this I added an InteropGrabBag to the cell properties object,
which is filled with the attributes of w:shd to be checked on export.

The exporter checks if the cell color is still the original color that
was imported from the file, if it is not it means the user has
manually changed it during the edition and the new color is written
instead.

Finally, added a unit test for theme attributes on tables.

Change-Id: Ica8091b5eb4075e51912a255650a1d9d64f5767a
2014-04-03 09:59:17 +02:00
62d551cd65 unused WRITERFILTER_RESOURCEMODEL_DLLPUBLIC
Change-Id: Ia09cd8738e7bfbb942690efb193c0de30e93f69c
2014-04-02 21:18:47 +02:00
54d913aa74 fdo#76586 Table column separators from individual cell widths
In the test file Table Grid had only one value for entire table width
while there are two cells in a table row. So the table was not
imported with the correct Column Separators.

Added fix to calculate column seperators from cell widths if
unable to calculate from Table Grid, and all the cells have individual cell widths and
there are no after and before cells.

Change-Id: I466737437a18d3373e75fea5ad56c9e31eb149ec
Reviewed-on: https://gerrit.libreoffice.org/8767
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-04-02 07:26:22 +00:00
362d4f0cd4 Explicitly mark overriding destructors as "virtual"
It appears that the C++ standard allows overriding destructors to be marked
"override," but at least some MSVC versions complain about it, so at least make
sure such destructors are explicitly marked "virtual."

Change-Id: I0e1cafa7584fd16ebdce61f569eae2373a71b0a1
2014-04-01 19:22:54 +02:00
80932c9e27 oox, writerfilter: add missing headers for C++ containers
Change-Id: Ied05627a0b5fdb8e5fd4a1b071ce32d901f07961
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-03-31 13:37:03 +02:00
de2050c022 writerfilter: unused sprmcodetostr*
Change-Id: Ia35b098033c92fdc7d2313d12b01324ef7232b1f
2014-03-30 16:25:50 +02:00