Commit Graph

1551 Commits

Author SHA1 Message Date
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
4034d96aee writerfilter: respect WinWordToWriter config setting
The binary filter uses this setting to decide if the embedded object is
converted into a native Writer document (so it can be edited) or not (so
it's preserved better), let's do the same.

Change-Id: I47b48867b3d0abf6cd8de2430513587a6776461e
2014-08-28 17:19:27 +02:00
6465857e02 Remove pointless WriterFilter::initialize()
Change-Id: I2341f9665835b4591d0e7c26f32a0fa120b6e7b9
2014-08-28 12:03:20 +02:00
1babe37e48 Use comphelper::SequenceAsHashMap
Change-Id: I21302361e89b9f01af04cf1a1ed78627097b9d8c
2014-08-28 08:27:27 +02:00
41aa970b31 DOCX import: fix handling of embedded DOCX files
The problem was that SwXTextEmbeddedObject::getEmbeddedObject() returned
an empty reference for those embedded objects, so the HTML filter
couldn't extract their content when it wanted to do so.

It turns out the reason for this was that the DOCX importer only handled
the replacement image + raw native data for the object. Fix this by
creating the embedded object with the correct CLSID and import the
raw data into the empty embedded document model.

This is similar to what is done for XLSX-in-PPTX in
oox::drawingml::ShapeExport::WriteOLE2Shape(), just for the import part.

Change-Id: Ieb1dcb1774d2d4da00117e3a35160053066c78aa
2014-08-27 15:34:41 +02:00
9767f9becc Use comphelper::SequenceAsVector
Change-Id: I115b17da8cc246bf1b2502ed53ef00edad70a21d
2014-08-22 16:37:30 +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
0a42632a74 empty Reference
valgrind + bff

Change-Id: Id3c039a46dec5d2d4a4642dfb53d23a76972dde2
2014-08-20 08:57:06 +01: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
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
bac420f9a8 Use DomainMapper::IsStyleSheetImport()
Change-Id: I2ae8f5ed808b7f1728a95f0e9d90d671e6ef2047
2014-08-15 09:57:25 +02:00
d1278ef484 bnc#865381 DOCX import: handle <w:hideMark> table cell property
Change-Id: Id0dd34110376168e34df4956869608895b86abfe
2014-08-14 15:55:44 +02:00
43983f8876 WaE: 'bIsSdtEndBefore' may be used uninitialized in this function
Change-Id: I8b906d495ccbb463dc91a21b03b05a40a0acdbf4
2014-08-13 07:46:15 +03:00
cc4d76145f -Werror,-Wunused-private-field
Change-Id: I4632e78feb9ad7cae91427bd99bb48e980c06f03
2014-08-12 12:16:37 +02:00
f91b81c24e Add reference to 'DomainMapper' to some DOCX import classes
The reason for adding 'DomainMapper' is to be able to check
during import in these classes whether or not the import is
in a 'styles.xml' file or not.

Also added blank handling for new XML nodes.

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

Change-Id: Ib2acde736d96f30eda40ee327991dc6ae0ed7f25
2014-08-12 08:34:47 +02:00
e24f8bb11a DOCX drawingML import: handle lack of ContourPolyPolygon shape property
Change-Id: I9dce645670f17115960b3648db24f769cd4a2635
2014-08-11 17:16:17 +02:00
628a0f313e DOCX drawingML import: handle SurroundContour shape property
Change-Id: I720a8309bdac002579cf133a9ae923ad2e800b63
2014-08-11 17:16:17 +02:00
f6e7b94042 fdo#82123 : DOCX: Corruption: File was getting corrupt fafter RT
Issue :
	- In issue file there were two runs(first run=SDT, second run=Image).
	- These two runs were consecutive(no text/space/tab was there in between two runs).
	- Due to such scenario, "SdtEndBefore" was not getting set.
	- Hence at Export EndSdtBlock() was getting called form EndParagraph()
	  Instead EndSdtBlock() should ge called from EndRun() in order to end
	  sdt after first run(as in Original file)

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

Change-Id: Id514b91f1831af371924f94388f0a404d762c042
Reviewed-on: https://gerrit.libreoffice.org/10827
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-08-11 08:28:57 +00:00
656ab07b29 Sync oox -> writerfilter alias for wordprocessingml
The motivation is that once all the namespace aliases in
writerfilter/source/ooxml/model.xml match the ones in
oox/source/token/namespaces.txt, then the writerfilter copies could be
dropped.

Change-Id: I1f9abb8bb457189997f28c99b0f6b00660252c14
2014-08-10 21:04:49 +02:00
8ae087b8fc fdo#82106 RTF import: fix missing tab after special footnote
Change-Id: I5ea45dbed652231acdcc3632ced728ed8bcb621a
2014-08-10 21:04:49 +02:00
053435d20a Fixed erroneous comment (by me).
Change-Id: Ie2430d0ef63bed95fd86f927260442814b0e5566
Reviewed-on: https://gerrit.libreoffice.org/10809
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-08-09 09:52:24 +00:00
ea258e380e DOCX export: handle date SDT on paragraphs
Date SDT's are normally imported as form controls, while most other SDT
types are just custom properties on regular text portions or paragraphs.

However, given that form controls are not supported in headers/footers,
in that case even date SDT's are just custom properties. So support such
properties on paragraphs in the exporter to properly roundtrip date
SDT's in headers/footers.

Change-Id: I19eb73a3673e387a7b8780756ce7426a1851e796
2014-08-08 18:40:24 +02:00
3820a1611b DOCX import: handle date SDT in headers/footers
Turns out form controls are not allowed in headers/footers (see the
comment in the patch), so if that happens, then just fall back to what
we already do for other SDT types.

Change-Id: Icc79c2a825e9eb2a85980489812a4178fde37576
2014-08-08 15:27:31 +02:00
024e53766c writerfilter: Move includes accordingly.
Change-Id: I35c27dfa459fff3a2ee271333980c789d01fac56
2014-08-08 10:36:38 +02:00
013b19212b coverity#1130195 Unchecked dynamic_cast
Change-Id: I10159fb938da56381989a97db7e518914db40f7e
2014-08-07 18:00:49 +01:00
00db42fec1 writerfilter: This depended on the order of attributes.
This code actually worked by mistake, thanks to the wrong ordering of
attributes that was caused by the usage of the boost::unordered_map.

Change-Id: I72cc5b54496b03183987d4d004f985d368e63deb
2014-08-07 15:21:46 +02:00
3c01c88adc DOCX import: handle <w:cnfStyle> row property
Change-Id: I178cb5591c95cc5587ac56662abf808bfca7a336
2014-08-06 15:20:47 +02:00
942f1ed93c DOCX import: handle <w:cnfStyle> cell property
Change-Id: I849daf0ddee370775fda73e04739e69acbc64246
2014-08-06 14:52:57 +02:00
5e2081fb7c DOCX import: handle <w:cnfStyle> paragraph property
Change-Id: I47d9dab17d4891d05cf7497e53026bc801f2726b
2014-08-06 14:52:57 +02:00
459603e36a writerfilter: bin OOXML_something duplication of oox::XML_something constants
workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFastTokens.hxx was a
duplication of workdir/CustomTarget/oox/generated/oox/token/tokens.hxx,
except when the oox generator changed, the writerfilter copy was not
adjusted and Bad Things happened. We don't need this.

Change-Id: Id92481f110b04ec24cb424421aa0ec029b7896f3
2014-08-05 19:16:03 +02:00
eec640d9a0 writerfilter: avoid 'using' in generated header
Change-Id: Ib9510aed34e451c529133c9c114b770c374fe403
2014-08-05 18:39:36 +02:00
4140b9b2a3 writerfilter: tokenize all attributes of CT_Cnf
Change-Id: I745dd2aa257899e398f1ae3a79e321156cba7505
2014-08-05 17:32:28 +02:00
012a759a67 more ambiguity fixes
Change-Id: I8c3af0976414ae444ec08b7e60485d8886f68a76
2014-08-04 18:36:42 +02:00
96019b4992 fix ambiguity
Change-Id: I773aa61c4430aa999c3ea94d352102a4a3f7e9f0
2014-08-04 18:33:32 +02:00
7803a5d726 DOCX import: handle all attributes of CT_TblLook
Change-Id: I3bbd65af4f52ce28e2962a1b3e0c7f1c348f3a01
2014-08-04 18:33:02 +02:00
d4b96b4572 fdo#81993: Revert "Resolves: #i119464# Update default alignment ...
... value for docx [Sub]Title"

This reverts commit acc671ec74c874ffd22803bb2ee54a1f2c027155.

The commit is clearly unnecessary:

1) commit 3f9e7e72c53ecbe8ee1ab060f811cb41eadfc7e1
   appears to be a better fix for alignment

2) commit b95d203bc17c83ec0fe5139f519d53ed1d842d3a
   should have disabled the Center default in Writer already

Change-Id: Ib0cc60af037f12be0a1ab94ab32c743f7fca2b1d
2014-08-04 17:35:01 +02:00
65facd8c79 writerfilter: tokenize all attributes of CT_TblLook
Change-Id: I0dcaef56804a6998f83afe73d01eb0d5b21a210a
2014-08-04 17:37:12 +02:00
b5e60724ac fdo#80986: disable highlight DOCX import
Highlight support is not implemented fully, so
it seems better to disable DOCX import of it until
it is finished.
Highlight can't be modified on the UI and is not
saved to ODT/DOC (regression).

Regression from:
8b949134441056a1455d67ddfdd7e0bc5f2ee682

Change-Id: I94891769766ae90017e8afa70e65d080d5270202
2014-08-04 10:57:08 +02:00
f8e8e476aa fdo#81944: writerfilter: RTF import: don't drop fonts in stylesheet
The font definitions in the style sheet meet an untimely death in
StyleSheetTable::lcl_sprm(), which special-cases LN_EG_RPrBase_rFonts,
routing it into TblStylePrHandler.

Avoid this by sending style entries to the domain mapper in the same way
as the OOXML tokenizer, i.e., with paragraph and run properties nested
below CT_Style_pPr/rPr.

This reveals that the CT_Style_basedOn was wrongly handled as paragraph
property.

Change-Id: Ic724ba48fe36bf782b1b430bdafdb1df480d5ad3
2014-08-02 19:09:44 +02:00
4b2c5a943d writerfilter: fix dbglevel=2 build
Regression from commit 4c3ba3a413be7339115ea5e6edc825a8434cd345
(fdo#75757: Remove inheritance from std::map., 2014-07-26).

Change-Id: I2a532182697ae7a5fe4ec2f880a0f5237a21b723
2014-08-01 16:27:38 +02:00
3bc61ac26f writerfilter: fix some -Werror=unused in previous patch
Change-Id: Iba7db7f9375807e97a4cdddc0c873fa3c9f6cfb6
2014-07-31 17:45:51 +02:00
4c3ba3a413 fdo#75757: Remove inheritance from std::map.
Done for writerfilter::dmapper::PropertyMap.

Added public functions getPropertyValue, bool isSet and Erase. The function
getPropertyValue returns boost::optional<PropertyMap::Property>,
where PropertyMap::Property is an alias for std::pair<PropertyIds,css::uno::Any>.

Fixed all resulting compilation errors. The functions which iterated the map
(ListLevel::GetCharStyleProperties, ListLevel::GetLevelProperties and
SectionPropertyMap::_ApplyProperties) have been written to either used
GetPropertyValues or not iterate over the PropertyMap's attributes.

The properties of the public member functions are now properly used
(Erase and Insert(...,false)).

Change-Id: Ibd90a4ad831c9b7d18b2a50d4aa4eb3f2610cff8
Reviewed-on: https://gerrit.libreoffice.org/10558
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2014-07-31 15:48:32 +00:00
8fea536ceb SdtHelper::createDateControl: clear the property list after reading it
Otherwise it may happen that the property list will be read twice, and
on export we'll create two <w:sdt> for a single imported one.

Change-Id: I57ab595f956c5e808fc73fe644ee3e249a1fc1ed
2014-07-31 17:46:38 +02:00
ddb24728b2 DOCX import: merging properties of different SDT's are not wanted
When the document starts with a table and both the A1 cell as well as
the document start has an SDT start, then we see both at the same time
when we check for pending SDT's in lcl_utext().

This leads to merging the properties of the two SDT's, which is clearly
not wanted. Fix the problem by clearning the SDT property list when we
see a start of a new property list: that produces a valid document.

Change-Id: I8fbe7bec02beebb26ed99fa7b08bc62225bff50c
2014-07-31 16:21:40 +02:00
b9b9fea12e writerfilter: fix ubsan complaints about "-42" enum value
Apparently the StyleType enum is specific to the domain-mapper, the
OOXML filter has integer constants in its model.xml file...

Also surprisingly the section styles only exist in RTF; w_ST_StyleType
in "ECMA-376 3rd Edition" only contains the 4 values of StyleType enum.

Change-Id: I5407800f801824676df309b3705e233cf1382721
2014-07-31 12:05:09 +02:00
864d018a1a DOCX import: handle exact end of paragraph w:sdt tags
Testcase will be added when the export half of this is also in place.

Change-Id: Ic6ef8ea72a45424fcb5a473c74db9e30d6fd3be8
2014-07-30 21:49:20 +02:00
a45d968888 Remove redundant casts to void
...leftovers from de02d221e104f74bfa595d5e6c41248093c640f3 "printfs in comments"

Change-Id: I0125ac2b5ea0b4450e8f707f980959443a6c4d27
2014-07-30 15:46:08 +02:00
5893a7536a fdo#81384: writerfilter: turn the horrible btLr cell text dir hack
... by 5 degrees to starboard, which lets the row in the bugdoc appear,
altough the height is a bit insufficient still.  Why that works, is a
nautic mystery to me, i'd say this whole btLr emulation nonsense needs
to be keel-hauled, but after this patch i'll need some rum, arrrr...

(regression from commit 0208ead70a9412ccd554fcef3e9308f8ca17037b
 and commit 970160f78ef6cc7abacfa252daa8451e1f0117bb)

Change-Id: Ie0c6ec88b6d6635379b9127f6460647f14776aad
2014-07-29 22:32:00 +02:00
bdca067382 writerfilter: whoever started non-reference variable names with "r"
... was evidently not a Hungarian speaker.

Change-Id: I87b0690d839057272c9653b222ed4dc61a75963a
2014-07-29 22:31:55 +02:00
28a3156943 DOCX filter: map <w:sdt> outside paragraphs to paragraph properties
Previously the type of the SDT was used to decide if the SDT will be a
character or paragraph property. Improve this situation by always
mapping <w:sdt> elements outside paragraph to paragraph properties.

In practice, this means that if the SDT was a rectangle (as it wasn't
only around a run), then it remains so, while previously it could become
a polygon instead (when painted).

Fix several testcases that tested that a <w:sdt> outside a paragraph is
exported as a character property.

Change-Id: Ia26c1a4cf6bc553b46224e4b17ee40725c5f3622
2014-07-29 18:51:33 +02:00