136 Commits

Author SHA1 Message Date
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
Stephan Bergmann
9d6c36dee3 ambiguity
Change-Id: Id0e3a969ff282673efd874980c25570b7ea1087b
2014-02-25 15:08:47 +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
Tobias Lippert
a18a1a4545 Remove vcl/settings.hxx from vcl/svapp.hxx and vcl/outdev.hxx
Added vcl/settings.hxx to all cxx files which require it.
This helps to speed up compilation after changes to the settings.

Conflicts:
	sc/source/ui/dbgui/pvlaydlg.cxx

Change-Id: I211a0735c47f72d6879f6f15339355abfe0e3cf4
Reviewed-on: https://gerrit.libreoffice.org/7933
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-02-20 16:22:17 +00: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
Thomas Arnhold
326bec33e0 some more continuous corrections 2014-02-03 14:01:40 +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
347d83d1cc RTF import: handle RTF_ATNREF
Otherwise dmapper won't create an annotation mark for us.

Change-Id: I868c3ffd65fbaa9a5115ba7300310fa3585d2d05
2014-01-09 12:21:26 +01:00
Oliver-Rainer Wittmann
0761f81643 123792: complete annotations on text ranges feature
- rely annotations on text ranges on new annotation marks
- support arbitrary text ranges for annotations
- fix undo/redo regarding annotations an text ranges
- support annotations on overlapping text ranges
- fix *.docx import for annotations on overlapping text ranges
- fix ODF import of annotations on text ranges

cherry-picked from branch ooxml-osba

(cherry picked from commit ebd2922ebd3cf2d3899fb80780d38f367197aadf)

Conflicts:
	sw/Library_sw.mk
	sw/inc/IDocumentMarkAccess.hxx
	sw/inc/SidebarWin.hxx
	sw/inc/doc.hxx
	sw/inc/docufld.hxx
	sw/inc/hintids.hxx
	sw/inc/ndhints.hxx
	sw/inc/txatbase.hxx
	sw/inc/unobookmark.hxx
	sw/inc/unofield.hxx
	sw/inc/unoport.hxx
	sw/source/core/access/accpara.cxx
	sw/source/core/bastyp/init.cxx
	sw/source/core/crsr/bookmrk.cxx
	sw/source/core/crsr/findtxt.cxx
	sw/source/core/doc/dbgoutsw.cxx
	sw/source/core/doc/docbm.cxx
	sw/source/core/doc/doccorr.cxx
	sw/source/core/doc/docdde.cxx
	sw/source/core/doc/docedt.cxx
	sw/source/core/doc/docfld.cxx
	sw/source/core/doc/doclay.cxx
	sw/source/core/doc/tblrwcl.cxx
	sw/source/core/docnode/ndcopy.cxx
	sw/source/core/docnode/nodes.cxx
	sw/source/core/docnode/section.cxx
	sw/source/core/edit/edfld.cxx
	sw/source/core/fields/docufld.cxx
	sw/source/core/fields/postithelper.cxx
	sw/source/core/fields/reffld.cxx
	sw/source/core/inc/MarkManager.hxx
	sw/source/core/inc/crossrefbookmark.hxx
	sw/source/core/text/inftxt.cxx
	sw/source/core/text/itratr.cxx
	sw/source/core/text/txtfrm.cxx
	sw/source/core/txtnode/atrfld.cxx
	sw/source/core/txtnode/ndtxt.cxx
	sw/source/core/txtnode/thints.cxx
	sw/source/core/undo/undel.cxx
	sw/source/core/undo/undobj.cxx
	sw/source/core/unocore/unofield.cxx
	sw/source/core/unocore/unoport.cxx
	sw/source/core/unocore/unoportenum.cxx
	sw/source/filter/html/htmlatr.cxx
	sw/source/filter/html/htmlgrin.cxx
	sw/source/filter/html/wrthtml.cxx
	sw/source/filter/writer/writer.cxx
	sw/source/filter/ww1/fltshell.cxx
	sw/source/filter/ww8/wrtw8nds.cxx
	sw/source/filter/ww8/ww8par.cxx
	sw/source/ui/dialog/uiregionsw.cxx
	sw/source/ui/dochdl/swdtflvr.cxx
	sw/source/ui/docvw/PostItMgr.cxx
	sw/source/ui/docvw/SidebarWin.cxx
	sw/source/ui/fldui/fldmgr.cxx
	sw/source/ui/fldui/fldref.cxx
	sw/source/ui/inc/fldmgr.hxx
	sw/source/ui/inc/wrtsh.hxx
	sw/source/ui/shells/textfld.cxx
	sw/source/ui/uiview/view2.cxx
	sw/source/ui/utlui/navipi.cxx
	sw/source/ui/wrtsh/wrtsh2.cxx
	writerfilter/source/dmapper/DomainMapper_Impl.cxx
	writerfilter/source/dmapper/DomainMapper_Impl.hxx
	writerfilter/source/dmapper/PropertyMap.cxx
	xmloff/inc/txtfldi.hxx
	xmloff/source/text/txtfldi.cxx
	xmloff/source/text/txtparae.cxx

Change-Id: Ie4cc467dbb837054c73742262ee20f35c151ff3f
2014-01-08 15:58:35 +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
Andras Timar
b55259eeb5 typo fixes
Change-Id: Ia5f104bfd707bcf4e159c78ca2764c861fb0b6d9
2013-12-20 15:55:00 +01:00
Michael Stahl
fb9d14f6a6 RTF: use "InsertMode" insead of "IsNewDoc" for consistency
... with other filters.

Change-Id: I563d6f7713d882b834978699c492a43a70e072cd
2013-12-05 13:00:28 +01:00
Miklos Vajna
b38629ae21 cp#1000017 DOCX/RTF import: avoid fake tab char in footnotes
Word wants this, so it's added by the exporter to the document, but on
import we should ignore it.

Change-Id: Idcb669ba624bf462a50a85eb4aacf397afb6efe6
2013-12-05 11:50:42 +01:00
Tor Lillqvist
3e7b69ae35 WaE: macro is not used
Change-Id: I7748517d2298c20e4fd6c6ebf403a2ccc8228054
2013-11-23 09:33:00 +02:00
Miklos Vajna
a56bfe734a cp#1000016 DOCX/RTF import: fix RemoveLastParagraph() on Windows
Change-Id: I3f9d69ddbb2144c60a724e4242128b65ae167455
2013-11-22 16:59:56 +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
a76daca815 Make CppunitTest_sw_rtfimport use DECLARE_SW_IMPORT_TEST()
Change-Id: I670e0460f15951f99f0f750d2798c771f64c3095
2013-11-04 21:33:11 +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
d9f1c11dfa Reduce copy&paste by adding SwModelTestBase::getShape()
Change-Id: I3b73405c546427bb5676db30e297af36c18043e6
2013-08-27 18:26:39 +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
Tor Lillqvist
3e48277e36 Convert utf-8 bytes to \xNN hex representation
Change-Id: I5d1cc0331278f09a6e32345980c660d877d606fa
2013-07-31 12:46:45 +02:00
Fridrich Štrba
c7a8462b83 Revert "fdo#66246 fdo#66395 BOM for MSVC with UTF-8 unfriendly codepage"
This breaks tinderbox builds. Better fix on the way.

This reverts commit ded871e9c1a69f640d6283ae6f79820689f0d612.
2013-07-31 11:36:27 +02:00
Isamu Mogi
ded871e9c1 fdo#66246 fdo#66395 BOM for MSVC with UTF-8 unfriendly codepage
MSVC misinterprets UTF-8 source code without BOM as ANSI/OEM codepage.
For that reason if local codepage is unfriendly to UTF-8, it sometimes
causes compilation error.

Change-Id: I8acd5500e581e020fd60b5a2ec20629f92fdf87c
2013-07-31 09:29:07 +01: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
Miklos Vajna
2e11cb276e Related: fdo#66040 RTF import: by default, do create a group shape for \shpgrp
The bugfix was just for the special case when we must create textframes
due to the contained tables, this one add support for the default case
when we want a real group shape.

Change-Id: I74b77b233235959266a24660c970a79e41d8b272
2013-07-08 17:16:10 +02:00
Miklos Vajna
4108f28520 fdo#39001 RTF import: fix fake empty page at the end of the doc
In case we have a \sect, there was no \sbknone (so it counts as a page
break as well) and there is nothing after it, we should not make extra
efforts to make that have some effect, but adding at least one empty
paragraph to that new page.

Change-Id: Ibcbecabcb590ed34ef96a97698e4ab8f638d3483
2013-07-05 12:02:07 +02:00
Miklos Vajna
d892671c11 fdo#47802 testcase
Change-Id: Ib3e399efb0d1116473bc5ff0e1b858b2cfa4aec8
2013-07-01 11:43:57 +02:00
Miklos Vajna
55162d7422 bnc#823675 RTF import: fix import of numbering bullet associated font
There were multiple problems here:

- \f had a special handler for the listlevel destination, \af had not
- in case of multiple \f or \af, the first one is used for the bullet
  font
- in case only \af is used for the bullet font, its value should be used
  for \f as well

Change-Id: I6631504c1aa9f2e0792a3469a5fdce5b7bd49518
2013-06-26 17:30:02 +02:00
Miklos Vajna
a8ee2ee752 fdo#66040 RTF import: initial groupshape support
There are two cases here: if the shapes contain tables (or other
Writer-specific features), we should use text frames and we should not
create the actual group shape, as Writer textframes can't be part of
such group shapes.  The other case is when the shapes contain simple
text, OTOH there are groupshape-level transformations defined, in that
case we should choose drawinglayer rectangles and actually create a
group shape.

This commit implements support for the first case only.

Change-Id: I9dc99b0711ce5c7a29ea0b14539df0121f9de3d0
2013-06-25 15:35:02 +02:00