summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)Author
2017-04-05loplugin:redundantcast find c-style bool castsNoel Grandin
Change-Id: I3237b93babc67de12c3771aa84766c2141ca93b2 Reviewed-on: https://gerrit.libreoffice.org/36137 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-04tdf#106690 DOCX import: fix automatic spacing before/after numbered para blockMiklos Vajna
The context is text nodes with automatic before/after spacing and numbering rules set, like: A * B * C * D E The correct behavior seems to be (though I haven't found this explicitly written in the OOXML spec) to drop spacing between B and C and C and D, but not before B and not after D. Originally no spacing was dropped, then commit c486e875de7c8e845594f5043a37ee8800865782 (tdf#95031 DOCX import: auto spacing inside numbering means no spacing, 2016-10-18) removed spacing around all B/C/D. Fix the problem by checking the numbering rules and automatic after spacing of the previous paragraph, so spacing before B and after D is not removed. Change-Id: Icbdb36e31057ab0e8ac033888cf5cc7c52dad5d0 Reviewed-on: https://gerrit.libreoffice.org/36062 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-04-04loplugin:unusedmethodsNoel Grandin
Change-Id: I30f9b6e68a7aa73782c980749e34f8f8d40ae57b Reviewed-on: https://gerrit.libreoffice.org/36047 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-03tdf#39468 Translate German commentsJens Carl
Translate German comments and terms in UnoControls/, editeng/, filter/, odk/, reportdesign/, sd/, sfx2/, starmath/, svl/, svtools/, toolkit/, tools/, writerfilter/, and xmloff/. Change-Id: Ibc401a425ddfdf41e4e4a78600f3fbce8cfaa2b1 Reviewed-on: https://gerrit.libreoffice.org/35992 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-04-03use actual UNO enums in vcl..xmlsecurityNoel Grandin
Change-Id: Id862544f27ebcbe8363f93dc83192d0f0cddb5cc Reviewed-on: https://gerrit.libreoffice.org/36041 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-01ubsan: use WrapTextMode_MAKE_FIXED_SIZE instead of -1 as unset flagCaolán McNamara
Change-Id: I0d460c5a0c14d078623fb1669a529a411002cad0 Reviewed-on: https://gerrit.libreoffice.org/36009 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-03-31tdf#106849: don't reduce quality of picture in bullet list.Vitaliy Anderson
An image saved in cache when NS_ooxml::LN_CT_NumPicBullet_pict property is processed should not to be resized. It reduce quality the image. Just set the property "GraphicSize" of current level of the NumRule instead of resize the image when processing NS_ooxml::LN_CT_Lvl_lvlPicBulletId property. Change-Id: I8ac80643decb7794de7a295cc7c2895a5bd24e2d Reviewed-on: https://gerrit.libreoffice.org/35592 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-31writerfilter: default break type identified as _nextPageJustin Luth
Change-Id: I9247c75819425a97d19c95c48fbaf7a4f8d92c62 Reviewed-on: https://gerrit.libreoffice.org/35379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
2017-03-31use actual UNO enums in writerfilterNoel Grandin
Change-Id: I59afe1ec7096cc7d173baab2042254eb647587b5 Reviewed-on: https://gerrit.libreoffice.org/35918 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-30writerfilter: DOCX import: fix handling of w:hideMark vs. w:vMergeMichael Stahl
The problem is that Writer's layout can't handle the case where cells are vertically merged and the last row has a fixed height; the vertically merged cell will grow up to the height of the other cells in the non- fixed rows plus the fixed row height, but no larger. So for now, avoid setting fixed row heights in this case. (regression from d1278ef4849661b9ae0eb7aaf4d74fbf91ccaf11) Change-Id: Iac3689e0bb0d5b8a62115ca0fb1f2c553a6e6bbc
2017-03-30tdf#105975 Add Formula field parsing (docx) in SWriterJean-Sebastien Bevilacqua
Introduction ------------ In MSWord, you can create a formula field (starting with =). When you save your file as `docx`, this `FORMULA` field is registered in you file (a field starting with `=`). In its current state, LibreOffice can't parse the `FORMULA` field in `docx` file. Context of this fix ------------------- This fix is entirely located in the `DomainMapper_Impl.cxx` file because it's where the parsing is done. How this fix works ------------------ First, we add `FORMULA` support by adding it to the `aFields[]` variable. Next, to handle the `FORMULA` constant, we add a condition (swith case) in `DomainMapper_Impl::CloseFieldCommand()` to call `handleFieldFormula`. Note ---- In function `lcl_ExtractToken`, if command starts with `=`, it's a `FORMULA` field. Change-Id: If7d25de5413aa3133b22523d8a3f34ab6961adfc Reviewed-on: https://gerrit.libreoffice.org/34334 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-30Related: tdf#105454 DOCX import: fix unwanted enabled-by-default kerningMiklos Vajna
Similar to DOC, DOCX doesn't enable kerning by default. Change-Id: I070ff5f0d43c27107593d629a1ad681d29d2038c Reviewed-on: https://gerrit.libreoffice.org/35890 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-30tdf#106606: Don't dispose NumPicBullet in sprm handler.Vitaliy Anderson
An image saved in cache once when NS_ooxml::LN_CT_NumPicBullet_pict is processed, may then be used multiple times (for each NumRule that requires it) when NS_ooxml::LN_CT_Lvl_lvlPicBulletId is processed for each of them. If the image was released here for first processing, subsequent rules couldn't find the image in cache and failed to create NumberingType::BITMAP style for the rule. The image is ultimately released in ListsManager::~ListsManager() after it is no more needed. Change-Id: Ib4c351437ba94d5a9d3e2927ccf459ec01f1b15f Reviewed-on: https://gerrit.libreoffice.org/35591 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-28tdf#106694 RTF import: fix missing paragraph tab positionMiklos Vajna
The problem here was that while in general paragraph style / direct formatting deduplication is supposed to happen in the tokenizer, paragraph tab positions is an exception, and dmapper expects to see the duplicated tokens. Fix the problem by introducing a blacklist that contains tokens not to deduplicate. Change-Id: I1cca53e99cfdb082df389ff295f3447cc8f9d3b8 Reviewed-on: https://gerrit.libreoffice.org/35790 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-28tdf#105975 Add Set field parsing (docx) in LibreOffice WriterJean-Sebastien Bevilacqua
Introduction ------------ In MSWord, you can create a variable with `SET` field and then reference it later in a formula. When you save your file as `docx`, this `SET` field is registered in you file. In its current state, LibreOffice can't parse the `SET` field in `docx` file. Context of this fix ------------------- This fix is entirely located in the `DomainMapper_Impl.cxx` file because it's where the parsing is done. How this fix works ------------------ First, we add `SET` support by adding it to the `aFields[]` variable. Next, to handle the `SET` constant, we add a condition (swith case) in `DomainMapper_Impl::CloseFieldCommand()` to call `handleFieldSet`. Finally, `handleFieldSet` works like `handleFieldAsk` with small differences. Note ---- I have renamed `lcl_ExctractAskVariableAndHint` to `lcl_ExctractVariableAndHint` because this function is used for both `ASK` and `SET` fields. Change-Id: I2bf948e26e8506ac151d1d0bc8556721bbe0392b Reviewed-on: https://gerrit.libreoffice.org/34333 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-27Indentation fixesMiklos Vajna
Change-Id: Idbd31b84f252abdab1787945c4964173ad5765ba
2017-03-25Fix typosAndrea Gelmini
Change-Id: I80b6d080aa31ff8b9d043b983993f4d26d8dc87c Reviewed-on: https://gerrit.libreoffice.org/35662 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-24Resolves: tdf#106724 crash when Title property doesn't already existCaolán McNamara
because we just write past the end instead of resizing before hand Change-Id: I4742980a331b14ca39aff8aa6cfc27db154091ff
2017-03-23loplugins:redundantcast teach it about c-style typedef castsNoel Grandin
Change-Id: I1ac11a2481c0f4d8be1e1fd7c7637ac0ece3d65c Reviewed-on: https://gerrit.libreoffice.org/35558 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-22Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)Stephan Bergmann
and add rtl::isAsciiWhiteSpace Change-Id: Iac71975f718b9360ea9dc94485c069c5e7cb91c7
2017-03-19fix typo/grammar: "the the" --> thedennisroczek
* also removing pointless ASCII art (tdf#62475) * truncate ending whitespace in Doxyfile Change-Id: I59b012f41ac0d170216229da85a49aa41689dee5 Reviewed-on: https://gerrit.libreoffice.org/35151 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-17cleanup double includes and declarationsJochen Nitschke
Change-Id: I770e09f48b1a3e8299f59a8e475ba3c18d436d7b Reviewed-on: https://gerrit.libreoffice.org/35312 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-03-17convert SvxBorderStyle to scoped enumNoel Grandin
and rename to SvxBorderLineStyle Change-Id: I19e530f162e4ca6290a0ad076e7fe3d5775ae6bc Reviewed-on: https://gerrit.libreoffice.org/35265 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-14tdf#105729 RTF import: \ltrpar should not override \qc from styleMiklos Vajna
This is similar to commit 92fd894ea18672cba4cf961bdc4c0bc98f168102 (tdf#94435 RTF import: \ltrpar should not override \qc, 2015-10-05), except that here the \qc is inherited from the style, it's not a direct formatting. The problematic code was added in commit 2638faa2e834c2da4c195224fd88d32c29b3d0cc (writerfilter08ooo330: applied patch for writerfilter08, 2010-07-28), and it's not really clear to me what is its purpose, given that the DOC import equivalent in SwWW8ImplReader::Read_ParaBiDi() doesn't set the paragraph alignment. Fix the situation by not touching the paragraph alignment for the RTF case at least. Change-Id: I2baa2c8c8012d972740da7cf3f710117812859b3 Reviewed-on: https://gerrit.libreoffice.org/35163 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-13tdf#103931 writerfilter breaktype: same for implicit and explicitJustin Luth
MSWord normally does NOT specify "nextPage" for the sectionBreak, since that is the default type. That is imported as BreakType == -1. However, Writer ALWAYS exports the section type name, which of course is imported explicitly. **There is an import hack that treats the very first -1 section as continuous IF there are columns**. Since Writer explicitly defines the section type, these documents import differently. When Writer round-trips these types of files, they get totally messed up in Writer, although they look fine in Word. So, treat both implicit and explicit nextPage identically for bTreatAsContinuous during import. Another unit test demonstrated that headers/footers are lost when treating as continuous, so preventing that situation now also. This fix allows several import-only unit tests to round-trip. Change-Id: I37fa861d82e8da564d28d8e9089fe0f2777650fb Reviewed-on: https://gerrit.libreoffice.org/35013 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-11Fix typosAndrea Gelmini
Change-Id: I2be7113bfe86476acfd6550f1eed53eed83c9747 Reviewed-on: https://gerrit.libreoffice.org/35063 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-07loplugin:loopvartoosmallStephan Bergmann
Change-Id: I089affb48717d64846064b61344820f1b87ac317
2017-03-07tdf#104287 RTF import: handle bitmap shapes inside tablesMiklos Vajna
Regression from commit 015fd55c94b7b650ed8e572cafaf3b0f903b01b9 (tdf#96275 RTF import: fix anchor of shapes inside tables, 2016-05-10), the problem was that since shapes inside tables are now buffered, some previously hidden problems in the buffering became visible. For one, there was no code to make sure that a bitmap shape is not appended at the end of the buffer again when it gets re-played. For another, only the bitmap shape itself was buffered, not its size. Change-Id: I04d65eb794ff6b160ef77af85479ba25ea5f8aa7 Reviewed-on: https://gerrit.libreoffice.org/34940 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-03Remove redundant 'inline' keywordStephan Bergmann
...from function definitions occurring within class definitions. Done with a rewriting Clang plugin (to be pushed later). Change-Id: I9c6f2818a57ccdb361548895a7743107cbacdff8 Reviewed-on: https://gerrit.libreoffice.org/34874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02Fix typosAndrea Gelmini
Change-Id: Ibc81246e615d7c68c93e01b84584e78a79bece16 Reviewed-on: https://gerrit.libreoffice.org/34779 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2017-03-02xmlsecurity: avoid using the SerialNumberAdapter wrapperMiklos Vajna
This service is only used in xmlsecurity and it's a wrapper around two free functions in the same module. Change-Id: Ibc5a026b51eda6c2b4b27b7254dedc220dbf909a Reviewed-on: https://gerrit.libreoffice.org/34772 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-01writerfilter: avoid repeating the return type from the declarationMiklos Vajna
Change-Id: I4fb7993482e71c936d820b559aa6b4a212c8175d Reviewed-on: https://gerrit.libreoffice.org/34729 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-02-28new loplugin unoanyNoel Grandin
Change-Id: I5d6c4a67cb2a09e7cd5bd620c6b262d188701b89 Reviewed-on: https://gerrit.libreoffice.org/34714 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-28tdf#103931 DOCX import: fix lost section breakMiklos Vajna
When there are multiple sections in a document, every <w:p> element triggers a handleLastParagraphInSection() call, and that's how the previous section is ended and the next one is started if necessary. In case the section contains no paragraphs at all, the section was lost on import. Fix this by also calling handleLastParagraphInSection() on <w:sectPr> as well. It's not a problem if there are both <w:p> and <w:sectPr> in a section (which is the usual situation) as only the first call closes the previous section / starts the next one. Change-Id: I64f2c403dcb2ceca76d444ab06df3052235d2795 Reviewed-on: https://gerrit.libreoffice.org/34715 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-02-25re org things a little to quieten coverity warningsCaolán McNamara
Change-Id: I97d1e5cce279031cb1d855132cc6695fc4b59c93
2017-02-24vcl PDF import: there is no PNG encoding hereMiklos Vajna
It was a copy&paste error from xmlsecurity/workben/pdfverify.cxx, which does PNG encoding. Change-Id: I7b5108a7cddffdc859276b656a6e1168f23d3863
2017-02-24tdf#105490: writerfilter exception - ULSpace must be >= 0Justin Luth
Instead of a minimal margin, default margins were being applied because an exception was thrown when trying to set a negative value to top and bottom margins in SvxULSpaceItem::PutValue Change-Id: I0a9fc2c7cb996efbd26abfdbed27ea0bcb86d9a5 Reviewed-on: https://gerrit.libreoffice.org/34598 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
2017-02-23writerfilter: RTF import: hex-escaped \r and \n create paragraph breakMichael Stahl
... in Word 2010, while the spec doesn't say what they do. So just handle \'0d and \'0a like \par. This fixes an assert failure on importing lp556169-2.rtf, where insertTextPortion was called with a string containing "\r", which split the paragraph and that messed up the SwPaM. Change-Id: Iee8b5b47e15d18232de841adfbc9c6498727c384
2017-02-21tdf#104081 RTF import: handle \htmautspMiklos Vajna
It's the opposite of OOXML's <w:doNotUseHTMLParagraphAutoSpacing/>, so the default is different. Also adapt the fdo82006 bugdoc where the original bugdoc contained this flag, but the testcase did not. Change-Id: I2fd757a8f95be9b1bee63570c9f587c17d3b22bc Reviewed-on: https://gerrit.libreoffice.org/34507 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-02-20remove some unused enumeratorsNoel Grandin
Change-Id: Idb9080f9c2edd838385d78b64e61ab49e93fe54b Reviewed-on: https://gerrit.libreoffice.org/34373 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-17tdf#106001: Treat CharScaleWidth outliers as 100 in DOCX importAron Budea
Spec limit is [1..600], sometimes documents contain 0, which, similar to other values outside the limit should be treated as 100. Change-Id: I04aec25b638762392de3f9881cd72588f2753e71 Reviewed-on: https://gerrit.libreoffice.org/34341 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-02-15writerfilter: can use std::move() hereMiklos Vajna
Change-Id: I48980ae44cd68b9526d915f877a37f6a559910e5
2017-02-14RTF import: handle target of hyperlinkMiklos Vajna
lcov pointed out that there is no testcase for the export of this, and turns out the import part wasn't implemented. As a side effect this implements the same for DOCX import as well. Change-Id: I016ebc100ec3856bf3a43aea8ea55af72c2ead1e
2017-02-09tdf#105852: don't merge cells if there were no merge continuationMike Kaganski
In RTF, it's possible to start a cells merge using \clmgf, and simply omit following cells in the row - they must merge automatically. This makes HorizontallyMergedCell::m_nLastCol/Row uninitialized. Previously, the uninitialized values arrived as 0,0 - thus the first range's cell got merged with cell 0,0. This change prevents the merge; in scenario above, absence of additional cells in row will create merged cell automatically. Change-Id: I68b84b7ec70d9512c541a077689369fa4a8dc0c5 Reviewed-on: https://gerrit.libreoffice.org/34079 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-02-08loplugin:unusedenumconstants read-only constants in writerfilterNoel Grandin
Change-Id: I3cc0d696059b130a8f1f1d8d3b1908d2e84d1a75 Reviewed-on: https://gerrit.libreoffice.org/34017 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06tdf#101626: replace soft-hyphen by hard-hyphen in ooxml importPatrick J
If a list bulletChar is a soft-hyphen, it will disappear in PDF export. Therefore, replace it by a hard-hyphen. Change-Id: If0b535e7d2e23454136f25a2b7acf4b294b8dd27 Reviewed-on: https://gerrit.libreoffice.org/33707 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-02-06Add missing #includesStephan Bergmann
...and remove some unncessary using directives/declarations, in preparation of removing now-unnecessary #includes from cppumaker-generated files, post e57ca02849c3d87142ff5ff9099a212e72b8139c "Remove dynamic exception specifications". Change-Id: Iaf1f268871e2ee1d1c76cf90f03557527ebc9067
2017-02-06writerfilter: convert ResourceType to scoped enumNoel Grandin
and drop unused constant StreamProperties Change-Id: I6a358cf7914412231d6c8f926a0d2fbd4bb8009b Reviewed-on: https://gerrit.libreoffice.org/33885 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-02writerfilter: remove gperf related declarationsMichael Stahl
Reportedly gperf 3.1 changes the signature of in_word_set(), where the len parameter changes from unsigned int to size_t. It turns out the only forward declaration for this function is currently unused, so just remove it. Change-Id: Ifbc582cd31ca37fff9ff95a3706ee902ecfe5223
2017-01-31tdf#103976 DOCX import: disable incomplete w:before/afterLines style handlingMiklos Vajna
Regression from commit 9e7eb63989ef1cf4b9a0e0404b84ef890db3d8e3 (DOCX import: parse <w:spacing>'s w:before/afterLines attribute, 2014-10-17), the problem is that OOXML has 3 different attributes for the paragraph bottom margin (and other 3 for the top one), while in Writer we just have a top margin. Now the import filter tries to work out which one of these should have priority and ignore the rest, but this is way more complicated when style inheritance has to be taken into account as well. To avoid the regression just restrict w:before/afterLines handling for the case when it's used as direct formatting, that's why this was introduced after all. Change-Id: Ie8642c7a9771596def6b8899e098b26c4f8be0b4 Reviewed-on: https://gerrit.libreoffice.org/33738 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>