Commit Graph

1814 Commits

Author SHA1 Message Date
c369013edb fdo#83178 fix Chinese Conversion crash
Reviewed on:
	https://gerrit.libreoffice.org/11187

Change-Id: Ifa9c7c1a29d7076903e038d3132c635b1143e2d8
2014-09-01 10:10:42 +02:00
61ed5a1f95 fdo#83048: DOCX: Corrupt: LO exports wrong SDT properties of Date
Issue :
	-File was getting corrupt due to wrong SDT Properties were getting export
 	 and only one SDT tag was getting written.
	-Issue file contained a Date SDT and a FieldChar SDT(Page numbers)
	-Issue was at Import side.
 	 LO GRAB BAGS Properties of SDT using PARA_GRAB_BAG or CHAR_GRAB_BAG
	-For Date SDT it should be grab bagged using CHAR_GRAB_BAG in order to get
         correct data inside <w:sdtPr>
 	 But LO was handling it with PARA_GRAB_BAG due to which wrong properties were
         getting written and
 	file was getting corrupt.

	Implementation :
	-Added a check for Date SDT to handle it through CHAR_GRAB_BAG
	-Now correct SDT properties are getting exported due to which Date is getting
         written inside an SDT tag.
	-Added UT at export side.

Change-Id: Ibcfb6dbbec1c23ffd14ba924ab56dc4122b98595
Reviewed-on: https://gerrit.libreoffice.org/11160
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-09-01 00:54:10 -05:00
675073a776 CppunitTest_sw_htmlexport: enable on OS X
Change-Id: I2aa954b0f97de9ae7657ae3a12d1a15389c13ef2
Reviewed-on: https://gerrit.libreoffice.org/11159
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-08-30 03:41:10 -05:00
305ecd1848 fdo#79959 RTF import: trim whitespace around style names
Change-Id: Id23cbd62b057442c577fef124a5705e4d551076f
2014-08-29 18:32:49 +02:00
cb01957aa0 fdo#32613 RTF export: implemented anchored picture export
RTF originally didn't support anchored pictures: they were always
inline. Then it was invented that pictures can be exported anchored, if
they are in fact shapes, but their "pib" property is set to the hexdump
of the picture contents.

The RTF importer handled this situation for quite some time, but not the
exporter -- this commit implements that.

Change-Id: I173ad9f4f2e24620508ca63c0b892b7d5da4e5b2
2014-08-29 15:23:06 +02:00
96dc17221c fdo#83044:Fix for corruption of file with SDT content.
Issue:
  w:text has a wrong child w:docPartGallery and w:docPartUnique.

Change-Id: If1dd6ff15cbba2868c93795051a5328a074721d0
Reviewed-on: https://gerrit.libreoffice.org/11146
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-08-29 03:07:55 -05:00
eb213e490d Revert "sw: _one_ unit test with use_library_objects sw ought to be enough"
This reverts commit d2a4e7c7f70a0ff0769ed228320833fa6b29bff9.

We now export SwGlobals::ensure for another test, so no need to use
sw objects in this one...
2014-08-28 22:08:41 +02:00
365b075e84 sw: why is swdll.hxx included everywhere?
Change-Id: Ic401ca83666a887be9e5efe8369440e78fa4eeac
2014-08-28 22:08:41 +02:00
125cbcbe6b sw: fix htmlexport test failure
Somehow this test failed on Windows, because of restoring a "NONE" field
unit to SW_MOD()... apparently the "charborder.odt" test is run first,
and preTest() sees a null SW_MOD() then postTest restores a NONE metric.

Hack around that by calling SwGlobals::ensure() to create SW_MOD().

Change-Id: I6c0cda3aae397071bca16bf0e5d9f8105635550f
2014-08-28 21:55:14 +02:00
54bdfe0a89 fdo#74229 import RTF_TRGAPH
Regression from commit c4b91ae3178011c66c76c711c1a6469ba658872e
(fdo#55525 import RTF_TRLEFT, 2012-11-13).

Change-Id: I90f2c6399cfaf8399de0cf3488a23af6cc84710d
2014-08-28 16:35:18 +02:00
8760b2b05c sw HTML export: avoid invalid output for embedded documents
When an sw document is embedded inside an sw one, then the inner sw HTML export
should just write what's inside the <body>. Add a filter option for that in sw,
similar to the one already existing in sc.

Change-Id: Id2cef966c1022ba45a3540bff234029c1d396778
2014-08-27 16:21:22 +02:00
58fc5c6a51 sw HTML export: avoid <table> directly inside <p>
Wrapping the embedded object output in a <span> at least makes the
parser errors go away.

Change-Id: I010d0257b5386a36f40103e3531737db6937ce85
2014-08-26 10:13:45 +02:00
8995bb0b63 CppunitTest_sw_htmlexport: enable on Windows
Change-Id: Id5a82aafc50f4758cff777e3e5b7560e37044443
2014-08-25 22:34:30 +02:00
1ee98159f7 HTML export: avoid invalid output for embedded spreadsheets
When the sc document is embedded inside an sw one, then the sc HTML
export should just write what's inside the <body>. Add a filter option
for that in sc and use it from sw.

Change-Id: I3a9605bd62f0628b78cd782c11661f12bc2c3ae4
2014-08-25 17:46:16 +02:00
971ffe1058 sw HTML export: avoid loosing embedded objects when skipping images
Change-Id: If795af5430b319922cd8242ca82352e148dd680b
2014-08-25 14:51:46 +02:00
e85bf96baa CppunitTest_sw_ooxmlfieldexport: enable on Windows
Change-Id: I768bce2398098195f4e5c7d7683f2c8b22f23cc0
2014-08-22 18:07:54 +02:00
7c02c7b021 DOCX import: list styles don't support automatic updates
The problem was the following: setPropertyValue("IsAutoUpdate") on the
style failed -> a number of styles was not imported in
StyleSheetTable::ApplyStyleSheets() due to the exception, then when we
tried to use one of the not imported styles, we also got an exception in
DomainMapper_Impl::finishParagraph(), which resulted in not calling
DomainMapperTableManager::handle(), so multiple cells of the same table
wanted the same range for cell contents, and that resulted in a crash.

Regression from cf33af732ed0d3d553bb74636e3b14c55d44c153 (handle
w:gridBefore by faking cells (fdo#38414), 2014-04-23), but that commit
just made the previously hidden problem visible.

Change-Id: I788cb6b4a2c7b7efbfa48297c658bb26450bf583
2014-08-22 14:13:31 +02:00
d2a4e7c7f7 sw: _one_ unit test with use_library_objects sw ought to be enough
Linking those things takes a lot of RAM.

Change-Id: I4db9ee3f07f97601d526ab3f905ecadbf4c552ca
2014-08-21 21:49:42 +02:00
60974f5643 DOCX export: prevent multiple paragraphs in some SDT containers
E.g. Word doesn't do anything if you hit return in the middle of a
title; if that's so, then we should handle this situation on export as
well.

Change-Id: Ib5b52a59250b09c97023b53906b8046f530d0e31
2014-08-21 15:28:20 +02:00
f97583711b DOCX export: handle anchored TextFrames inside shapes
The exporter already handled TextFrames inside TextFrames, a feature
supported by Writer, and not by Word.

Similarly, if DocxSdrExport::writeDMLAndVMLDrawing() starts a shape,
then anchored TextFrames should be posponed till the end of that shape.

Change-Id: I597a8a46b1cf2348a8ccb9af668ea5afab27541b
2014-08-21 12:02:36 +02:00
252ed1708a double-checked locking is not thread-safe in Java
found by PMD

Change-Id: Ibd4a9139c626932bec56c0b1dd32b4d59c8440b1
2014-08-20 10:35:51 +02:00
788632dcb0 DOCX export: handle SDT end right before a section break introducing headers
Change-Id: I0fab5ae4335ed6016d31aa243b131899c3154388
2014-08-19 18:19:04 +02:00
869a3e1b7f split CppunitTest_sw_ooxmlexport into several tests
In order to allow running them in parallel. There are already enough
tests to make it run for a couple of minutes and it's annoying to
see only once core busy with it.
I intentionally left the original file at the same name, without 1
appended, in order to avoid merge problems.

Change-Id: I097c45c34797cc68f5d1790cf31eefc96fbaf44e
2014-08-19 17:25:00 +02:00
0764292c5d java: use 'Short.valueOf' instead of 'new Short'
Change-Id: Icef19ef61ee0af2dd3bda527263934006271f219
2014-08-19 14:57:18 +02:00
be1bb7b1cc java: use Boolean.valueOf instead of instantiating Boolean objects
Change-Id: Ie41d6b0170a035a694dd270c311a137fd1810e74
2014-08-19 14:57:16 +02:00
b3f4709d73 DOCX export: handle SDT around floating tables
Change-Id: I07fedc201c51008baca3254dcc099f0182aa4c72
2014-08-19 13:03:33 +02:00
914431e165 DOCX export: handle multi-para SDT's ending right before a table
Change-Id: I47ea5fd6e1b4d9d5a2893112efdcd810c4c84cfb
2014-08-19 10:34:52 +02:00
f6b681a136 DOCX export: don't forget to close SDT elements inside the TextBoxes of shapes
A usual problem with SDT is that in case it should end after the last
paragrah of a container, there is no "next" paragraph that could have
the relevant "EndSdtBefore" property. This is usually handled by closing
the SDT tag before the container is closed.

The problem here was that DocxAttributeOutput::WriteSdtBlock() did not
notify DocxSdrExport about opening the SDT, as it thought there is no
draw export in progress. This is because in case of "shape with a
TextBox", the common writeDMLAndVMLDrawing() method is not called,
instead the separate writeDMLTextFrame() and writeVMLTextFrame() methods
are invoked.

Fix the problem by adjusting these methods to writeDMLAndVMLDrawing(),
so that they also set m_bDMLAndVMLDrawingOpen to true during the TextBox
export.

Change-Id: Ie08b0b955cd2d6a645970da3d485e447abfd6495
2014-08-18 15:51:16 +02:00
8b9988163c fdo#82492 : DOCX: Corruption: File was getting corrupt fafter RT
Issue :
	- In issue file there were two runs(first run=SDT, second run=Shape).
	- These two runs were consecutive(no text/space/tab was there in between two runs).
	- Due to such scenario, "SdtEndBefore" was not getting set on Shape.
	- Hence at Export EndSdtBlock() was getting called from EndParagraph().
	  Due to this SDT was not getting end after first run.
	  In order to end SDT after run, EndSdtBlock() should get called from EndRun()
	  (as in Original file)

	Implementation :
	- Set "SdtEndBefore" on Shape in DomainMapper_Impl::PushShapeContext()
	- Retrieved same property at export.
	- Added export unit test case.

	Note :
	Added common functions at Import and Export with reference to
	https://gerrit.libreoffice.org/#/c/10827/

Conflicts:
	sw/source/filter/ww8/docxattributeoutput.cxx
Reviewed on:
	https://gerrit.libreoffice.org/10912

Change-Id: I357d77cd179c83b8ae976db331ee46c8993b6cb8
2014-08-18 12:52:30 +02:00
be515af4d9 DOCX filter: improve qFormat export handling
The old rule was: write qFormat for everything that's not a custom
style.

The new rule: write qFormat for everything that's a custom style + have
a whitelist of non-custom, but qFormat styles.

This matches better what Word does (whitelist is from the latent style
section of an empty document, created by Word).

Change-Id: Ie7a0802e886c41b8d26ca9aa154913aa2f3ff87a
2014-08-18 11:58:30 +02:00
b32881b672 fix reading even/odd page breaks from .docx (bnc#519228)
We map Word's even/odd page breaks to Writer's left/right page styles. And we cannot
just set any page style to be left/right, because that could set e.g. the default
page style as such, which would make all normal pages that way. So instead we need
to make a copy of the relevant page style, as the original page style as its follow,
copy all the properties and headers/footers, and use this copy to get the page break.

Change-Id: Id0d2568de91ac2de4afb0ba3a6eedd9cec46f878
2014-08-17 21:39:39 +02:00
4a1888a97e fix reading a .doc that has frame anchored to the end of page (bnc#787942)
MSWord, unlike Writer, can anchor even to a page break (i.e. after the last
paragraph). When this document was read, what happended was:
- the last paragraph was read and the current position PaM was set to point
  after it
- frame was read and anchored to the PaM
- page break was read, making everything following be moved to the next page;
  including whatever ended up at the PaM position
Handle this by checking for this case and inserting an extra empty paragraph
before the break. This shouldn't affect layout of the page itself anyway,
since the break should leave room for it (and MSWord shows a page break
there if control characters are enabled, so there is room).

Change-Id: Ia2a13bf5cf1c959b5aa228254365019a00a22679
2014-08-17 18:16:42 +02:00
e99535df4d remove executable bits
Change-Id: Iec785ae538de81325812b1e6fe33115789b39770
2014-08-17 05:50:13 +02:00
47e2fd0dc8 Consistently use size_t and SAL_MAX_SIZE
Change-Id: Ibab89984ec94556ec368653b6db50c6c2e380dec
2014-08-16 21:52:32 +02:00
63fa1a7bc8 RTF import: handle pWrapPolygonVertices shape property
Change-Id: I512713e9b9aa1ceb3d98af7a1a6abd144e370689
2014-08-16 18:26:00 +02:00
c7307c7725 fdo#82191 sw::DocumentLayoutManager: copy textbox content of draw formats
The SwFmtCntnt, i.e. the content of the draw format was already copied,
but that's only a pointer to the real content: instead duplicate the
real contents on copy&paste, that's how we copy fly frames as well.

Change-Id: I42475e356aaa1c54c08fb23a6a395d1726e5f33e
2014-08-15 16:48:58 +02:00
d1278ef484 bnc#865381 DOCX import: handle <w:hideMark> table cell property
Change-Id: Id0dd34110376168e34df4956869608895b86abfe
2014-08-14 15:55:44 +02:00
29f0b74a74 sw: use less confusing variable names in python test
Change-Id: Ie07fe4761a634c3ae55e82e1ed70c9424dc33213
2014-08-14 14:39:02 +02:00
ac5954d7c5 java: remove commented out code
Change-Id: I05c907a38b562231e968c17f14e09ef80e0a6ed1
2014-08-14 10:59:48 +02:00
0cddb93eb4 check_table.py: use assertEqual()
To fix
DeprecationWarning: Please use assertEqual instead.

Change-Id: Iae7cb50dd968d055b106e35baa7eee526a50bf6d
2014-08-13 22:24:56 +02:00
37ecf08237 RTF import: fix handling of RTF_SHPFBLWTXT
Commit 6cac123a8de8357cf11d9b5f818233889d729939 (fdo#45183 import
RTF_SHPFBLWTXT, 2012-12-27) fixed this already once in the past -- fix
it again, this time with a testcase.

Change-Id: I0cbbfb1ba4eef42b2ee32f6f77065afaad3ddc1b
2014-08-13 14:45:59 +02:00
1cb2573cd3 DOCX export: write qFormat for style names having an STI number
Change-Id: I1f1bf0cf14bbd7b6253489f27753bdb2ec81fe35
2014-08-13 13:12:54 +02:00
34bcf9b498 java: remove dead methods
found by UCDetector

Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
2014-08-13 10:24:10 +02:00
1e61e18169 warning C4245: 'initializing' : conversion from 'int' to 'sal_uLong'...
...signed/unsigned mismatch

In history this was sal_Long and then converted to sal_uLong, but the
test never got aligned.

Fix it by adding arbitrary element counts starting from 30.

old: getCount():
{-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9}

(With -5 silently converted to SAL_MAX_UINT32 - 5)

new: getCount():
{30,31,32,33,34,0,1,2,3,4,5,6,7,8,9}

Change-Id: Ic13678094c7bb4dcd122727f028c910513609cef
2014-08-13 10:10:51 +02:00
68cd011c90 java: reduce scope, make some methods private
found by UCDetector

Change-Id: Ib1425edde146193a65c242dc159b7e3fbf0e4a2e
2014-08-13 08:49:23 +02:00
da677dfd59 java: reduce scope, make fields private
found by UCDetector

Change-Id: I7f97e15667159cf8ee776e8f32fdcdec8ec00ed6
2014-08-13 08:49:22 +02:00
5494954b26 Refactored IDocumentLayoutAccess out of SwDoc.
Into the new class DocumentLayoutManager.

Change-Id: I02d0cfcc63633d0bdab380508b2ef563187fd269
2014-08-12 23:26:38 +02:00
9cc617afcd Refactored IDocumentStatistics our of SwDoc.
Into the new class DocumentStatisticsManager.

Change-Id: I281232dc09dbd79c2faf3c2a78ae49625bbe88ee
2014-08-12 23:26:37 +02:00
69e5f335ab Refactored IDocumentFieldsAccess out of SwDoc.
Into the new class DocumentFieldsManager.
Removed SwDoc::_MakeFldList because it is not defined anywhere.
Also moved a few non interface methods that belong to the manager.

Change-Id: Icefd7ca7adcbb05a18d6fae0529fc54150b862fd
2014-08-12 23:26:36 +02:00
274f1811b9 Refactored IDocumentRedlineAccess out of SwDoc.
Into the new class DocumentRedlineManager.
Added an non const version of GetRedlineTbl to the interface.
Also Moved SetAutoFmtRedlineComment which is not part of interface.

Change-Id: I600d5821d5d5831557f5fc5375fb1203fe67a295
2014-08-12 23:26:36 +02:00