120 Commits

Author SHA1 Message Date
Miklos Vajna
3ea80a4686 RTF import: handle column break at the very start of the document
Change-Id: Ib7d166bf1b1e5d5216d822b2b0396aa4dc535c6f
2014-06-20 12:59:11 +02:00
nrbrtx@gmail.com
7eafd8ccac fdo#79599: use \highlightN instead of \chcbpatN in RTF import and export
Reviewed on:
	https://gerrit.libreoffice.org/9776

Change-Id: I98ef606fb73368a3c275819cb83b936e2162769d
2014-06-19 21:51:06 +02:00
Michael Stahl
6c0e127088 fdo#70578: writerfilter RTF import: by default style is para style 0
quoth the spec:

"For <style>, both <styledef> and <stylename> are optional; the default
is paragraph style 0."

Of course in order to do that we need to add support for at least
recognizing the \dsN and \tsN keywords to override the default, so that
table styles don't become paragraph styles.

Change-Id: Ic100768581f9e8c327063ff776fbd61ac4242483
2014-06-17 18:42:06 +02:00
Michael Stahl
b7857e5cfe fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images
If the shape properties are inside \picprop destination, don't set
shapeType.

(regression from 9f1f7199736e2ae07b34849ba66f61a1ef5782e8)

Actually this does not fix the root cause, this is just a work-around,
the extra shape is still inserted but it's invisible now.

Change-Id: I6cf093de2a5657533f393863ed8010ae083bec16
2014-06-13 15:27:01 +02:00
Michael Stahl
061190a62f fdo#79384: RTF import: fix literal Shift-JIS text
This is a variable-length encoding, and the second byte may be a RTF
syntax character like \, {, }.

Change-Id: I813ccafda18388af3bf05eb7ce9a0253c627b1c4
2014-06-03 20:48:43 +02:00
Adam Co
76bd128ff8 Fix 'outset' and 'inset' table border type import in DOCX and RTF
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>
2014-05-08 22:19:03 +02:00
Miklos Vajna
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
Miklos Vajna
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
Miklos Vajna
904630a227 fdo#77267 RTF import: pard should reset current paragraph style
Change-Id: I8d78ce262a4e57161325231a78e48750909b1bad
2014-04-14 09:06:23 +02:00
Miklos Vajna
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
Miklos Vajna
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
Miklos Vajna
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
Miklos Vajna
ddecc21561 RTF export: handle Relative{Height,Width}{,Relation}
Change-Id: I16bef12840f45b269de18fdac4c3718ed904e1be
2014-03-27 08:31:44 +01:00
Miklos Vajna
bc5060b32f RTF import: handle Relative{Height,Width}{,Relation}
Change-Id: Ic3a578af9c0808b188a4d196b1c132c0b23f15f7
2014-03-26 11:53:09 +01:00
Miklos Vajna
e4fe3610eb RTF import: fix ordering of old-style dhght in case of equal values
Commit 1eaab77c718ffa254068ae6032862dfb5a03db67 (fdo#60722 import
RTF_SHPZ, 2013-03-06) changed how we handle z-order, in case two shapes
have the same value. Turns out for drawing-objects the order is the
opposite in this situation.

So fix this by adding a new mode, that keeps the original testcase happy
without breaking older documents.

Change-Id: Ib2d284cefc3c0dce40ac2e516ba260d6cd04ce43
2014-03-14 21:20:19 +01:00
Michael Stahl
84f4de3b65 fdo#68779: RTF import: set borders without explicit width
Word reportedly uses 0.75pt as a default if \brdrw is missing.

Change-Id: I263c56f756c65ff6bb30870aa70806564d5826a6
2014-03-14 19:15:57 +01:00
Miklos Vajna
d05b67a7b9 RTF import: anchor drawing objects at-character by default
Change-Id: I292ab1a6f12a9372b1cfdd4e8e59fbae57c6ceca
2014-03-14 16:04:15 +01:00
Miklos Vajna
7c53577f32 RTF import: fix dobxpage before dptxbx
The problem was that dobxpage arrived first, set HoriOrientRelation to
FRAME, then dptxbx tried to apply defaults, which overwrote the already
set HoriOrientRelation. Fix this by only applying properties which are
not set yet.

Change-Id: I108f3363a2758eee0242533fe92e511e8c522b68
2014-03-14 13:32:29 +01:00
Miklos Vajna
3e2cda224e fdo#69289 RTF import: handle cells with zero width
Change-Id: I31b12a5afa5d501d57b56f515ee1d2fd46a09b32
2014-03-14 10:55:41 +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
c8f83ce1db rhbz#1065629: RTF import: re-implement nested tables
The previous fix for this bug only fixed a symptom, this a fix for the
real problem; with the real problem fixed the nCellEnds is unnecessary.

Given that top-level table properties may be put either before or after the
table cells, the only way that works to import tables is to buffer a whole
top-level table row, but currently the buffer is replayed already at the
end of a nested table row.

Fortunately the RTF spec guarantees that \nesttableprops must occur
after the nested table cells of the nested row, so it should be
sufficient to remember the cell properties for the current nested table
row only, in addition to the cell properties for the top-level table row.

With this change, skipping a \nesttableprops destination when there is
a table style turns out to mangle ooo98040-1.rtf badly, so stop doing
that workaround.

RTFDocumentImpl::popState() was copying various buffers up the state
stack which is a clear indication that these shouldn't be members of
RTFParserState in the first place, move them to RTFDocumentImpl.

Change-Id: Ic2d8f7b3e00844b224d61605b405ca651239e5f7
2014-02-25 14:06:14 +01:00
Michael Stahl
07ef4cf096 rhbz#1065629: RTF import: don't drop nested cells if not enough \cellx
In this document written by "XMLmind XSL-FO Converter" there are less
\cellx than \cell and thus when reading \nestrow/\row a whole buffered
nested table \cell is lost and then subsequently the rest of the nested
table too.  Try to fix that by counting both \cell and \cellx and
replaying until the maximum of those.

Cannot count \intbl since we synthesize that in various places.

(regression in LO 3.5)

Change-Id: I3b64ad94af842e076611418589a0c83bd18841c6
2014-02-18 11:35:51 +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
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
f4db3ac593 RTF export: write RTF_FTNSEP and RTF_CHFTNSEP if necessary
Change-Id: Ie680436df68ea6287437f792d97259ee0a840ee1
2014-01-05 14:26:51 +01:00
Miklos Vajna
e1afe43187 RTF import: handle RTF_FTNSEP and RTF_CHFTNSEP
Commit 330b860205c7ba69dd6603f65324d0f89ad9cd5f (fdo#68787 DOCX import:
handle when w:separator is missing for footnotes, 2013-09-04) disabled
footnote separator by default in dmapper, as the OOXML tokenizer always
provided a uFtnEdnSep in case a separator was wanted.

Let the RTF tokenizer do the same, this way we're in sync with Word
again: if RTF_CHFTNSEP is in RTF_FTNSEP, then we show the separator,
otherwise we don't.

Change-Id: I74b46c5d71227682e093695336dc9eb6fde22121
2014-01-05 13:04:35 +01:00
Miklos Vajna
e8d10f215e fdo#41109 RTF shape import: handle fBehindDocument property
Change-Id: I9bf24eb2d3087e855d54c0ee7aba4e98dc856cc2
2013-12-29 16:28:59 +01:00
Miklos Vajna
ff7ac1a9b8 fdo#41109 RTF shape import: shpz has priority over dhgt
And not the other way around, how
24ee3df385cf2aa95cd888581c84fdf90cc682dc (RTF import: fix priority
handling of shpz vs dhgt, 2012-04-10) did, this time with a reproducer.

Change-Id: I9412341c6b35ca2760e4490a18f11bc6a0e0b78a
2013-12-29 16:07:44 +01:00
Miklos Vajna
6eb02ac8a7 fdo#65090 RTF filter: import RTF_CLMGF and RTF_CLMRG
These describe an explicit horizontal merge, that is not something Word
itself creates, but it turns out the Calc RTF export does.

Change-Id: I1b6ec10bb8e8bd40e24791ccc96f2f066dd0d5d5
2013-12-28 10:00:49 +01:00
Miklos Vajna
4663b9e494 sw: chmod -x docx, doc and rtf testcases
Change-Id: I6f6726dd99a3f894ae86de279c74270e19b49d0e
2013-12-23 11:32:29 +01:00
Miklos Vajna
9389cf78e3 cp#1000018 RTF import: empty para at the end of footnote text got lost
Updated 3 testcases, in all cases first checked that the new behavior
matches what Word does.

Also added a new test, to check that empty para at footnote end is now
kept.

Change-Id: I96b8788feb4d730b5a64ba3a743311a0180ab41f
2013-11-15 15:45:20 +01:00
Miklos Vajna
a35fa8d8b1 fdo#70221 fix RTF import of multi-group pictures
Pictures typically have a single RTF group, so we imported them at the
end of that group. Though multiple inner groups are also allowed, so
make sure we only do the import at the very end, instead of at the end
of all inner groups as well, resulting in multiple (fake) pictures.

Regression from 13c00ce322e78eb4e0f50ab84ded19cd6aae1ded (Enable the
writerfilter-based RTF import in non-experimental mode, 2011-08-18).

Change-Id: Id895b2c6d3b824d09d89bfa01ce59aba76c55d42
2013-10-21 09:36:33 +02:00
Miklos Vajna
5ebe826caf fdo#69384 fix impress -> writer copy&paste
Regression from 2ade07126971b79c92f729fae5709f2e2e2b495c (fdo#62044 RTF
import: don't overwrite existing styles when pasting, 2013-06-04),
during paste, if existing style was found, then the intention was to
skip that style, but instead we tried to create one.

Change-Id: I83adaf9fe6b8a578fa60c21b9463fabde7707d7e
2013-10-04 12:19:11 +02:00
Miklos Vajna
b226dcb50d fdo#68291 RTF paste: don't set PageDescName during paste
In general, paste should not deal with page styles. In this case, it
even caused an additional page break.

Change-Id: Ia7c5a9ad844821b6622babfbd94469ec3c04cf0a
2013-09-09 10:44:18 +02:00
Miklos Vajna
f1e5e271f9 fdo#68076 RTF import: default font had priority over the specified one
Regression from 60c17b2873506ed8b068b34840aecda0c1d9bd65.

Change-Id: Ie16d611622e6a814d5cbea00c3f992cd9ecba027
2013-08-22 11:39:31 +02:00
Miklos Vajna
b9c1a9b9aa fdo#44715 RTF import: reset styles in tables on RTF_PARD
Commit 4a507f732d82c188ad81b022cbe3037951e58ac3 added an exception to
RTF_PARD (reset paragraph properties) handling: when we're inside a
table, it should not reset the fact that we're inside a table (which is
a paragraph property).

However, instead of just re-adding that property, it disabled resetting
for all properties, and we had a growing list of exceptions since then.
The next thing to add there would be the paragraph attributes, which
contains the style information. Instead of growing that ad-hoc list,
reset everything again and just re-add the "in table" SPRM.

This makes the second and later paragraphs in the A1 cell of the bugdoc
have proper font size.

Change-Id: I2de80894fcd5da3bf45d221af9a04a307c70a29b
2013-08-17 12:30:56 +02:00
Miklos Vajna
774b689917 RTF import: handle rotation on groupshapes
Change-Id: I7892224a118b6566e26b3ffc472c88f3c7f58620
2013-08-13 11:02:19 +02:00
Miklos Vajna
c73b8072a1 fdo#63428 writerfilter: fix paste of commented text ranges
There were multiple problems here:

- xFoo->createTextCursorByRange() got a text range argument,
  where the text range wasn't from the xFoo text
- it was assumed that all XText implements text::XParagraphCursor as
  well, but this is not true for e.g. comment text
- commented text ranges were pasted as normal comments (once again, the
  insert position wasn't passed around)

Change-Id: I9a975a08b08a7f32b1ee71e42f58736cc0dbb09d
2013-08-12 12:35:19 +02:00
Miklos Vajna
aa6959ba2c fdo#53556 testcase
Change-Id: If58376aec31ab00cab19221beed73e8275a834d2
2013-08-09 16:12:18 +02:00
Miklos Vajna
b755df14a4 fdo#47440 import RTF_SHPBX/YPAGE for Writer pictures, too
Previously this was only handled for drawinglayer shapes.

Change-Id: I7ce440a27ebe44fc867b8a7f4ee62217076677f0
2013-08-06 16:57:26 +02:00
Miklos Vajna
c7884509a8 fdo#67498 RTF import: fix missing margins vs continuous section breaks
The document had 3 sections, separated by continuous section breaks.
Previously only margins from the last section were imported, this way
the first page had default margins.

Now margins are also applied when we hit continuous section breaks. This
way margin values from the last section break affecting the page wins. A
later commit could improve this further by setting the minimum of these
and setting a section margin for each non-minimal sections.

Change-Id: I4d9a4585e795220533909bd1d467d933caaa0d71
2013-08-05 17:38:20 +02:00
Miklos Vajna
83e0489217 fdo#67365 testcase
Change-Id: I921eda30f60e5466e381922193c2a46be10ad65c
2013-07-27 01:09:46 +02:00
Miklos Vajna
e849f5d84a RTF import: fix groupshape import when shapes don't contain text
Without this, the groupshape itself was created, not it had no child
shapes.

Change-Id: I5d3276498eb3ffe840f3d42dad16661849596da4
2013-07-26 12:55:02 +02:00
Miklos Vajna
50a76af9d1 Related: bnc#820504 RTF import: don't anchor shapes TO_PAGE
This is the RTF equivalent of f5b7acac624f07fa95835b6054b8d295901bb1dd,
which avoided TO_PAGE-anchored shapes in the VML importer.

Change-Id: I58a5cdb311ac43ddba00bc441005fb37a4899cee
2013-07-26 11:13:44 +02:00
Miklos Vajna
bb67e709b7 fdo#64637 RTF import: handle multiple RTF_COMPANY
Instead of unconditionally calling addProperty(), first check the
existence with hasPropertyByName() and call setPropertyValue() instead,
if necessary.

Change-Id: Ie0a075bbfe6eaa1f66726c456105dcdef9001d30
2013-07-23 12:37:06 +02:00
Miklos Vajna
431853bfae fdo#54900 RTF import: support setting para align after text
Both Word and Writer typically write all paragraph properties before the
first text in each paragraph, but at least for paragraph alignment, it's
valid to write them at the end.

Change-Id: I0337e63678ad45c662a204ab2fc59378607abe74
2013-07-15 11:44:35 +02:00
Michael Stahl
4721fbbccd writerfilter: move the crash test file to "pass" directory
Change-Id: I8a97eac789e3e8234673de87653b78c39dafe14c
2013-07-10 13:08:37 +02:00
Michael Stahl
b3944f124a rhbz#960019 : RTF import: handle extra groups in listoverride entry
This crashed because for a single listoverride entry 2 SPRMs were sent
to the domain-mapper, and the second one was empty.

Change-Id: Ic41ffd8bd4edcff065f49ecef3464efedd909d63
2013-07-10 12:44:34 +02:00
Miklos Vajna
f6a00c8848 fdo#66565 RTF import: don't produce cell widths smaller than MINLAY
In case we have a table of a given width and the second (or later) row
has fewer cells, we have to add a fake cell to such a row. However, it
doesn't make sense to do this when the difference is only a few twips:
we can't create such a small frame inside the cell later anyway.

Regression from c3b0f13546b30e5db3aecd311c7178e4e0933208.

Change-Id: Ibc0f02d4184b58bd423c3405e786e1ec25b9dd13
2013-07-09 12:58:55 +02:00