83 Commits

Author SHA1 Message Date
Miklos Vajna
8100100298 fdo#80167 RTF export: don't loose page breaks
DOCX export tries to write accurately both <w:br> and
<w:pageBreakBefore>, while DOC/RTF prefers just the page break before
paragraph attribute. Given that these later two exporters are not
adapted to write their equivalent of <w:br> at all, add a virtual method
to determine if writing page breaks as "page break before" is preferred
or not, that'll give the expected RTF export result.

This conditionally reverts commit
a31fbb53dba76736b37213b98b64937f05929a67 (fdo#74566:DOCX: Preservation
<w:br> tag for Break to Next Page, 2014-02-06).

Change-Id: I4a5dd295b07739a570cd8cc6709561e64d031273
2014-06-27 22:34:17 +02:00
Miklos Vajna
085424074d identation fixes
Change-Id: Ie9a95b99e1f6de65985b295076f5f89e5d99ec93
2014-06-27 22:34:16 +02:00
Michael Stahl
b8907bf3d3 fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink
Ensure that we export only one \fldresult per hyperlink by doing that in
StartURL() and EndURL(); the TextINetFormat() is called once per text
portion.  This shouldn't cause problems as there can't be anything
between the end of the \field group and the start of \fldresult anyway.

Replace the annoying call to EndURL() from EndRun() with a special case
in EndURL() to store things in the right buffer (hopefully).

(somehow this is regression from c4498251cb7181a9f272b0720f398597c0daef09)

Change-Id: I209ea7a384fb1cb5d1505a70ecc4a4536bbf26a2
2014-06-27 16:15:19 +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
Miklos Vajna
b577c99adc sw, writerfilter: identation fixes
Change-Id: I1f1db08447006515e7e6842792241aca992984c0
2014-06-14 11:38:32 +02:00
Stephan Bergmann
809c8d4c99 Spell out UTF-8
Change-Id: Iea5f79fb12ac86d4348f46f8ad93a13aaf0f7eb6
2014-06-12 15:34:49 +02:00
Michael Stahl
e47a02b152 fdo#77979: sw: RTF export: write non-ASCII font names encoded
Currently font names like "微软雅黑" (Microsoft YaHei) are
written as "????" in the RTF export; to avoid that, set the \fcharset
of the font entry to something that at least is able to encode
the font name and alternate name.

This requires a new function since the existing
rtl_TextEncodingToWinCharset was changed in
b88fe998ce8c80d7629fe70118311096615d959d to return "default" 0x01
(for OOXML) which is quite unhelpful for RTF.

This is not entirely satisfactory, as of course that is no guarantee
that the encoding can represent all of the actual text that has the
font applied; hence there are some \'3f in the fall-back encoded text
of the heading of the bugdoc, which indicates that the detected
Shift-JIS is insufficient and GB-2132 would be required; but it's not
obvious how to do better here without iterating over all the text
twice, and that still leaves the possibility that all text that has a
particular font applied cannot be represented by a single non-Unicode
encoding.

But since we always write text as the \u Unicode + legacy fall-back,
this should not be a big problem since modern RTF readers will simply
read the Unicode.

Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb
2014-06-12 12:39:00 +02:00
Miklos Vajna
04ab7b8e16 sw: fix indentation in rtf{export,import} test
Change-Id: Ie777de47dc70da136b145028a08ea17a0de7a87d
2014-05-16 23:00:33 +02:00
Miklos Vajna
55c832d86e fdo#77600 RTF export: always close URL's before the end of run
In case the URL text has multiple portions, then MSWordExportBase
generates multiple URL's anyway, and this helps to avoid loosing some
direct formatting of the remaining portions of the paragraph.

Change-Id: Ifd72741de610ce69b9ae0978aa8f9a532a3aeed2
2014-04-22 15:08:48 +02:00
Tor Lillqvist
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
Miklos Vajna
dcb88d170b Testcase for RtfAttributeOutput::SectionLineNumbering()
lcov pointed out this method wasn't ever invoked in any of the tests.

Change-Id: I6cccf4fc1d870938a2f218bedc0b8d195a299cd1
2014-04-06 18:14:03 +02:00
Miklos Vajna
84c40768f8 MSWordExportBase::OutputItemSet: handle fill attributes as frame ones
Fill attributes with their original WhichId are only used for frames at
the moment, replacing RES_BACKGROUND. To keep export filters working,
handle those fill attributes as frame ones as well.

Change-Id: I1e59b483b706d9fd3f9b947e83244740e3293f9e
2014-03-31 17:15:23 +02:00
Miklos Vajna
c7837b8caa sw: fix DOC/DOCX/RTF export of TextFrame background color
Change-Id: I8b7c23af7548a0eb073e046eedfbabfb9f78fafe
2014-03-31 15:39:52 +02:00
Armin Le Grand
6e61ecd096 Merge back branch alg_writerframes to trunk
(cherry picked from commit b635b4fa4e42053d30ab639643d2236a20243f62)

Conflicts:
	comphelper/inc/comphelper/TypeGeneration.hxx
	comphelper/source/property/TypeGeneration.cxx
	cui/source/factory/dlgfact.hxx
	cui/source/inc/cuitabarea.hxx
	cui/source/tabpages/tabarea.cxx
	cui/source/tabpages/tabarea.hrc
	cui/source/tabpages/tabarea.src
	cui/source/tabpages/tparea.cxx
	drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
	drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
	drawinglayer/source/texture/texture.cxx
	editeng/inc/editeng/unotext.hxx
	editeng/source/items/frmitems.cxx
	include/drawinglayer/texture/texture.hxx
	include/editeng/brushitem.hxx
	include/svx/sdr/primitive2d/sdrdecompositiontools.hxx
	include/svx/svxids.hrc
	include/xmloff/xmltypes.hxx
	reportdesign/source/ui/misc/UITools.cxx
	sc/source/ui/drawfunc/drawsh.cxx
	sfx2/source/dialog/tabdlg.cxx
	svl/source/undo/undo.cxx
	svx/inc/svx/unoshprp.hxx
	sw/Library_sw.mk
	sw/inc/doc.hxx
	sw/inc/format.hxx
	sw/inc/frmfmt.hxx
	sw/inc/swatrset.hxx
	sw/inc/unomap.hxx
	sw/inc/unoprnms.hxx
	sw/source/core/access/accpara.cxx
	sw/source/core/attr/format.cxx
	sw/source/core/attr/swatrset.cxx
	sw/source/core/doc/docdraw.cxx
	sw/source/core/doc/docfly.cxx
	sw/source/core/doc/notxtfrm.cxx
	sw/source/core/inc/frame.hxx
	sw/source/core/inc/frmtool.hxx
	sw/source/core/layout/atrfrm.cxx
	sw/source/core/layout/paintfrm.cxx
	sw/source/core/text/inftxt.cxx
	sw/source/core/text/porfld.cxx
	sw/source/core/text/txtfly.cxx
	sw/source/core/txtnode/fntcache.cxx
	sw/source/core/uibase/app/docst.cxx
	sw/source/core/uibase/app/docstyle.cxx
	sw/source/core/uibase/shells/drawdlg.cxx
	sw/source/core/uibase/shells/frmsh.cxx
	sw/source/core/unocore/unoframe.cxx
	sw/source/core/unocore/unomap.cxx
	sw/source/core/unocore/unoprnms.cxx
	sw/source/core/unocore/unostyle.cxx
	sw/source/ui/fmtui/tmpdlg.cxx
	sw/source/ui/fmtui/tmpdlg.src
	sw/source/ui/frmdlg/frmdlg.cxx
	sw/source/ui/frmdlg/frmpage.src
	sw/source/ui/inc/frmsh.hxx
	xmloff/source/text/txtprhdl.cxx
	xmloff/source/text/txtprmap.cxx

Change-Id: Id3ffaa83bb5594d287f1ac8f2c1c9cf55c70946d
2014-03-28 14:31:08 +01:00
Stephan Bergmann
567ef6d578 Second batch of adding SAL_OVERRIDE to overriding function declarations
...mostly done with a rewriting Clang plugin, with just some manual tweaking
necessary to fix poor macro usage.

Change-Id: Ie656f9d653fc716f72ac175925272696d509038f
2014-03-27 18:12:18 +01:00
Miklos Vajna
ddecc21561 RTF export: handle Relative{Height,Width}{,Relation}
Change-Id: I16bef12840f45b269de18fdac4c3718ed904e1be
2014-03-27 08:31:44 +01:00
Miklos Vajna
ccf74f3149 CppunitTest_sw_rtfexport: enable on MACOSX
Change-Id: Id125f7b2293f7813391ca583f60bcbf53f455afc
Reviewed-on: https://gerrit.libreoffice.org/8562
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-03-12 16:27:24 -05:00
Miklos Vajna
6b5ef795ed fdo#74709 RTF import: implement RTF_CLPAD*
Change-Id: I482735e3fc4091be983b2c7484e086f5d0dd283a
2014-02-10 09:58:14 +01:00
Miklos Vajna
30696e8426 RTF export: fix nested comments
Change-Id: I9986855f3160ed6f5856aec9f7d33fc416962e77
2014-01-15 20:32:44 +01:00
Miklos Vajna
03eb7ac908 RTF export of annotation marks
Change-Id: I079516ad0f30886d175748fdee19fbd71c2704f8
2014-01-09 14:49:37 +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
d0f8b02627 SwFiltersTest::filter: detect import filter on export test
This allows e.g. crash-testing the RTF export, even if the input source
is not RTF but ODT.

Change-Id: I3cf6afd1bc44bb475f1bd8da622d10dac0d3baa6
2013-12-18 19:21:06 +01:00
Miklos Vajna
73a808f6b3 test::FiltersTest: add support for export tests
For now, this is only implemented for the Writer RTF filter.

Change-Id: I0c7ae5b0e544bd4738652a38474f4d262ce65661
2013-12-17 20:52:35 +01:00
Miklos Vajna
adc68965d5 i#23357 RTF export: fix crash on groupshapes
Change-Id: I3329663060aeb06ac552bd5d1615d19efe160091
2013-12-10 10:55:21 +01:00
Miklos Vajna
1cc1a89376 abi#10201 RTF export: fix crash when handling table::BorderLineStyle::NONE
Change-Id: I811820c0d550ce24ad2180a8917ef0087968c30b
2013-12-09 09:48:12 +01:00
Miklos Vajna
8299924b75 cp#1000018 RTF export: avoid additional paragraph at footnote end
Change-Id: I430a7d705208f197050a7d521c9c20b267c33f26
2013-11-18 11:37:41 +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
325cee9a60 Make CppunitTest_sw_rtfexport use DECLARE_SW_ROUNDTRIP_TEST()
Change-Id: I50babe172d3c9a46256ac3dc95a3b7591cd3c777
2013-11-01 20:55:26 +01:00
Miklos Vajna
21e07d473d fdo#66743 fix import of some RTF_CLSHDNG values
This should be in sync with model.xml, got broken when the somewhat
random values got fixed to be the same as the ones which are in the ww8
spec.

(Regression from 26d40686128e70916a636e20f5ccc5763bbb6cc8.)

Change-Id: Id62047e0b2d5d8402a7c8bce95de487afe627e32
2013-09-23 10:39:44 +02:00
Zolnai Tamás
f4dad76732 Improve border equal check in filter tests 2.
Change the order of words BORDER and EQUAL in the
macro name to become consistent with other macro names.
e.g. CPPUNIT_ASSERT_DOUBLES_EQUAL
Use a function inside the macro to make it type safe.
Add additional message to make clear why the test failed.

Change-Id: I9fc7a5813adf2cac36ae831d438cec498232b06c
Reviewed-on: https://gerrit.libreoffice.org/5885
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2013-09-10 07:27:09 +00:00
Zolnai Tamás
3b6ad403dd Use hex color code in character border filter tests
Change-Id: I19bd1cbedd42101186fd4afbcd7af9afb630f857
2013-09-09 13:07:52 +02:00
Zolnai Tamás
05e1439107 CharBrd 9.3: RTF filters
-Use sprm:CBrc attribute for all MS filter (for ooxml too).
-Extract general code to FormatCharBorder() method, it selects
the border side and decides whether add shadow to the border.
-RTF export has a color table, which must be filled with border
colors before the actual export.temp

Change-Id: Ic3ceae6e19ddc2ed5aaa8de85617f9a592289b4f
2013-09-08 11:23:46 +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
e06e0fd5ea RTF import/export of paragraph drop shadow
Change-Id: I8d2485962947eac8acc9ada384a9c1bd4cb22503
2013-08-15 17:13:35 +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
8422d1f504 fdo#66682 RTF export: fix level text of SVX_NUM_ARABIC
Even if level text is not ASCII, we should just write the placeholder
values (0x00, 0x01, etc.) in a hex encoded form, without Unicode.
Regression from 07d01742c69f1c0335bc7e1b57abd8341ce255e7.

Also, fix the import side, so the previous bad output now looks bad in
Writer as well.

Change-Id: I2f93892006c07eec243ec7dfcb23372d243a2db4
2013-07-10 13:31:37 +02:00
Miklos Vajna
f0ed219c8f sw: move the textframe-table testcase from rtfimport to rtfexport
Change-Id: I7e9d26ec1f47d16e35e24fc4bd9482f5d899e79c
2013-06-16 18:34:09 +02:00
Miklos Vajna
ae85b56a9a Import/export RTF_REVISIONS
File -> Properties -> Security -> Record Changes on the UI.

Change-Id: I96d321f407abd33e15a4a133e6723d48efa5bc53
2013-06-16 14:47:07 +02:00
Michael Meeks
62badf3828 Move to MPLv2 license headers, with ESC decision and author's permission. 2013-04-22 09:37:38 +01:00
Miklos Vajna
92da8fc4eb sw: add textframe gradient RTF roundtrip testcase
Change-Id: I8e4f6b926123c79ad1a62ddd4c5feebf5fe06cf0
2013-04-15 16:05:53 +02:00
Miklos Vajna
bb9fce28d6 sw: RTF export of TextFrame border/shadow testcase
Change-Id: I85b85afb6d1b170d71633f93d56f7ce4fffdf0a3
2013-04-15 13:36:56 +02:00
Miklos Vajna
85c8252e13 test RtfAttributeOutput::StartURL()
Change-Id: I66f527ff7463852f65e1a3f02ddcea60d329147a
2013-04-08 14:45:53 +02:00
Miklos Vajna
7b515a57eb test RTF_BKMKSTART and RTF_BKMKEND
Change-Id: I00b258ef3ed89db3b9b8c97bea5ad6673b006398
2013-04-08 12:25:34 +02:00
Miklos Vajna
3867728286 RTF_LISTPICTURE and RTF_LEVELPICTURE testcase
Change-Id: Ia6838d205ce25a22e2e5e8763f7bf4323c40879a
2013-04-07 20:23:49 +02:00
Miklos Vajna
e68bfafdcb implement import/export of RTF_MNOR
Change-Id: I9caea7fbea4643e57d81ad3b7812d0cc10f54c11
2013-04-02 16:47:34 +02:00
Miklos Vajna
71ccb4b031 implement RtfAttributeOutput::PlaceholderField
Change-Id: Ib6fd380736c5567a98317ec117969d8c76a31f02
2013-03-29 12:44:15 +01:00
Miklos Vajna
b4845db426 fdo#30983 RTF filter: fix handling of RTF_PVPG and RTF_PHPG
There were two issues here:

1) The export filter never exported these keywords.

2) The "flymaincnt" RTF extension we inherited from OOo actually never
worked (i.e. it's like this since 7b0b5cdf, the initial import...), as
RTFVertOrient / RTFHoriOrient's second parameter was stored in 1 bit, so
text::RelOrientation::PAGE_FRAME (7) was read back as 1 instead.

Note that I want to get rid of this flymaincnt extension in the exporter
anyway soon, so killing the RTFVertOrient / RTFHoriOrient duplication is
pointless: the sw version will go away.

Change-Id: I5335567833ecf87e6b0ba7c73150a7b95c57f237
2013-03-27 11:02:59 +01:00