summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ww8import/ww8import.cxx
AgeCommit message (Collapse)AuthorFilesLines
2017-03-27tdf#106799 WW8: Accept TTP Mark without Cell MarkMike Kaganski1-0/+15
Paragraph mark of inner table (0x0D) sometimes has sprmPFInnerTtp, but no sprmPFInnerTableCell. This still counts as cell end (at least, MS Word treats it that way). Unit test included. Reviewed-on: https://gerrit.libreoffice.org/35763 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 59af9cbbccee600408c89e872d548d153523ab1f) Change-Id: I5589cdd486c03ca4567d61882826cc7c245a40c9
2017-03-07tdf#106291: WW8 import: Properly treat column spansMike Kaganski1-0/+9
Previous code unconditionally treated all cells in merge groups as rows span, thus in some conditions it merged incorrectly when there were cells from same row. The fix is inspired by SwTable::PrepareMerge(). Also, fixed improper adjustment of too narrow cells in WW8TabDesc::CalcDefaults(), which also happens in files where column spans are represented by spanned 1-twip-wide cells. Unit test included. Change-Id: If043cfc466879d45141c655f7be1588792f898d3 Reviewed-on: https://gerrit.libreoffice.org/34820 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/34884 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-07-07DOC filter: mark SmartTag support non-experimentalMiklos Vajna1-41/+0
And also relax two import conditions, as it turns out Word accept those. So instead of checking for each offset/length one by one, only check once. It's now as good as the DOCX one, I believe. Change-Id: I1890ef61fdbbd2ab6facaf3e787f75b791adcfdc (cherry picked from commit d737f8220f97f3060b87c05cca3ecaf3e80f9878)
2016-07-07DOC import: initialize RDF metadata before importing document propertiesMiklos Vajna1-0/+41
With this, it is possible to import part of the document as RDF statements later when SwFltControlStack::SetAttrInDoc() gets an SwFltRDFMark. Previously SfxBaseModel member functions like getMetadataGraphsWithType() and addMetadataFile() failed, as they tried to find the already imported document in UCB, which failed, as the import was still in progress. To prevent that, do the same as the ODT import in XMLReader::Read(), part "RDF metadata". One trick here is the call to comphelper::OStorageHelper::GetTemporaryStorage(), which gives an empty storage. Ideally a wrapper class would be needed that works on a SotStorage, but implements embed::XStorage, but that would be only used to find that the real storage doesn't provide a manifest.rdf stream, which is always the case. So instead of writing such a wrapper, just give loadMetadataFromStorage() an empty storage, which will have the same result without writing lots of dead code. Change-Id: Id1897838b1477eee0489b706d51cb6f59898877b (cherry picked from commit b7c2e9ae95ff41570f752ca43c361b249a65da77)
2016-04-07tdf#99100 DOC import: handle subset of STYLEREF nativelyMiklos Vajna1-0/+18
Commit 4215bca95511af8e4ee96e3c8f521b35f638aef3 (export 'Chapter' field type as 'StyleRef' into .doc, 2015-08-21) mapped SwChapterField to STYLEREF in the DOC export. This field type was handled as a field mark on import. Instead of always handling it as a field mark, recognize the case when it's the subset we write and we can handle natively, and in that case create an SwChapterField again on import. Leave the complex case unchanged as before and keep using field marks for that. Also (because the header where STYLEREF is used is completely empty otherwise): tdf#99120 DOC import: fix lack of first share after odd section break Commit 848b1a05c5c41b5e7ff19c984f60c297a8143990 (fix for bnc#659631, 2011-02-04) made wwSectionManager::InsertSegments() use SwPageDesc::WriteUseOn() directly, instead of going via SwPageDesc::SetUseOn() that takes care of not throwing away the higher share bits of the bitfield. This way the "is first shared" flag of the bitfield got cleared, even when the input document had no title page declared, so first header/footer must be shared. Fix the problem by using SetUseOn() in the DOC import as well when it comes to handling odd/even page section breaks. (cherry picked from commits d635b351849b8b576c907abf22500d0fa89ab54f and 44a3eb37cd982c59f8350d53db3798b675230b35) Change-Id: Icfa8c4be6538da5e02e2d5071af30a46ccfa712b Reviewed-on: https://gerrit.libreoffice.org/23888 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
2015-11-11Resolves: tdf#95321 tables in headers/footers with wrong contentCaolán McNamara1-0/+10
Change-Id: I937ed893dfd9919bf48b8fd38a1b83c524200532
2015-10-02Fix typosAndrea Gelmini1-1/+1
Change-Id: I9bae7b6fd8d66b4877fc96d93fc8f57d17987002 Reviewed-on: https://gerrit.libreoffice.org/18984 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2015-05-19Update Apache Bugzilla’s URLAdolfo Jayme Barrientos1-1/+1
Change-Id: I6ef4ae530b7fb4e615100803ae6e3972d9b4545f
2015-05-05loplugin:staticmethodsNoel Grandin1-1/+1
Change-Id: I5d02ba0db00e11af3c17eaf77ce19c635a52077f
2015-03-14tdf#89482 fix __refheading__ regression, set only CrossRefs as TOC.Justin Luth1-0/+2
bugfix tdf#68963 marked all __refheading__ bookmarks at TOC, but those crossreferences were deleted if they are not recorded in aReferencedTOCBookmarks. Redesigned the fix to include _Toc in the crossreference name that is auto-generated, which is how MSWord differentiates the markers. Updated the test document to include even more combinations of cross-references and numbered heading references. Change-Id: I3d60d2b528ebfa1ffb108bbfc9e7db2c604af49b Reviewed-on: https://gerrit.libreoffice.org/14822 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-01-22loplugin:stringconstantStephan Bergmann1-1/+1
Change-Id: Ia23865a38eff10304a1c1748b2b4f17af7b4d3ae
2015-01-22fdo#68963 recognize __RefHeading__ bookmarks as TOC in .doc filesJustin Luth1-0/+7
LibreOffice recognizes MS Office Table Of Contents, but LO files saved as .doc didn't show the Cross-Refence heading - it was blank. Now bookmarks using the LO naming convention are also imported as TOC bookmarks from .doc files. Testcase included. Change-Id: Icae5c0de31856ccc75ede9a97c0ea046dd97325f Reviewed-on: https://gerrit.libreoffice.org/14018 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-12-02add mode linesTakeshi Abe1-0/+1
Change-Id: Id7825ecd076a5d8cbe926a26bc74fc7d0da1d621
2014-09-16Resolves: fdo#68967 looping layoutCaolán McNamara1-0/+4
RemoveFollowFlowLine() marks the layout invalid, but the next cycle through does everything exactly the same again. Try the same foul horror as nUnSplitted. But at least with a test-case that nails down reproducing the bug if a better fix is needed. Change-Id: Id6698bcb2364bd0253bedd4a7c313e25f705be8d
2014-08-17fix reading a .doc that has frame anchored to the end of page (bnc#787942)Luboš Luňák1-0/+7
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-07-21ww8import create a pagedesc if continuous section changes margins (bnc#875383)Luboš Luňák1-0/+12
This is similar to what writerfilter does. MSWord can have one page with several different margins, which are saved using continuous sections, which causes all kinds of trouble, because either we treat them as Writer sections, which means we lose some of the data, or we treat them as Writer page styles, which causes spurious page breaks if in the wrong place. Either option has its problems, but here it seems slightly better to go for keeping the data and hoping the page break will be in a place where a break will be anyway. Change-Id: I8f52aa820750da6788ea04180a15ac334f6bf87b
2014-07-21fix floating table over section with several columns (part of bnc#875383)Luboš Luňák1-0/+7
Change-Id: Ic6e75cc2cedb61754b45bc4678a1185f580d5ed6
2014-07-13fdo#81102: fix .doc import of blank even page headerLuke Deller1-0/+16
Honour the "different odd & even pages" header/footer setting from the doc file even if there is no content for an even page header or footer. Conflicts: sw/qa/extras/ww8import/ww8import.cxx Reviewed on: https://gerrit.libreoffice.org/10191 Change-Id: I963f7f7189e399b1d859db0788fbfd291e868c54
2014-07-12fdo#80333: .doc has large black rectangles between paragraphsZolnai Tamás1-0/+9
These black rectangles are character shadows, because checking whether there is a border at all was missing. In Word there is no shadow without a border. Change-Id: Ib3cb4e904fdd33f215c81d7c02762a196f484b1b
2014-07-10CppunitTest_sw_ww8{im,ex}port: enable on WindowsMiklos Vajna1-4/+0
Change-Id: I503e737b00c033ff6186805724e57d445c0ab674
2014-07-10enable ww8import/export tests for macLuke Deller1-1/+1
Change-Id: I6b29040a2cd4ad24f18dfafb51d95d2b7627dd27 Reviewed-on: https://gerrit.libreoffice.org/10144 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-07-09fix fdo#77844: header wrongly enabled from .docLuke Deller1-0/+47
The LO page style needs page headers to be turned on if the corresponding .doc file section has a left (=even) page header or a first page header. However this should not be triggered in the case where a first page header is present but hidden due to the "different first page" header option being disabled. This case is fixed by this commit. Change-Id: If3de0df45378587fdbdecc6a091d2f4b60940b43 Reviewed-on: https://gerrit.libreoffice.org/10100 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2014-06-25error: no matching function for call to 'assertEquals'Matúš Kukan1-1/+1
Change-Id: I0b87c2abeec30e9e4eab3ce488a5828b8a5b475d
2014-06-24fix reading of section margins (bnc#875715)Luboš Luňák1-0/+8
The reason the section ended up with incorrect margins was because that is computed as 'page margin' - 'section offset', and the order of setting these up was backwards: First InsertSection() created the section using the page margin of the old page, and only afterwards SetSwFmtPageDesc() set the page margin that should be used. Change-Id: I18ddcb0b5928879a2297b6caca766eab979abd45
2014-05-26bnc#863018 WW8 import: fix upper margin of multi-page floating tableMiklos Vajna1-0/+11
A vert orient position was already handled in case a floating table was imported as a TextFrame, but in case we didn't do that, the vert orient position was simply lost. Fix this by importing it as the upper margin of the table (assuming that the position is relative from the anchor position). Change-Id: I3e96f3068605fd6313dfb3e55483e1bce6c063a5
2014-05-08Fix 'outset' and 'inset' table border type import in DOCX and RTFAdam Co1-1/+1
In the past, LO did not support 'outset' and 'inset' border types for tables, so when encountering them - LO converted them to other types of border. Now that LO supports it - DOCX and RTF filters were changed to import these border types correctly. DOC filter was not changed, because creating a proper DOC sample file that has these border types (needed for the 'bordertest.hxx' file) was not possible right now. So at least DOCX and RTF filters are fixed. Change-Id: Ida2449d45a0ac138388f3cbfeb41657db1d4cda9 Signed-off-by: Michael Stahl <mstahl@redhat.com>
2014-04-30tests for msoffice brightness+contrastLuboš Luňák1-0/+21
For commits 1139d618b8bc6ab823a96184bd0f0257980aad24 and 893fe88469dec5b727d96f8ea1b4edb9e88288a7 . Change-Id: Ia59ec5c4226944280c4b585c87179d28303bda4b
2014-04-11Introduce twip/mm100 conversion functions instead of duplicated macrosTor Lillqvist1-2/+2
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-03bnc#821208 DOC import: fix unwanted char background in numbering char styleMiklos Vajna1-0/+3
Word supports formatting the paragraph parker itself, and we import that as a formatting at a position after the last character (e.g. "foo" will have that formatting at char pos 3, which is ignored by the layout). In addition to this hack, commit 1c22545edf9085b9f2656ca92781158b6b123db3 (Fix issue #i119405: Numbering text style changed after importing the *.doc, 2012-08-24) added a SwTxtNode::TryCharSetExpandToNum() hack to Writer core, where in case such a paragraph marker attribute is set, and the SwTxtNode has a numbering, then also modify the associated character style as well. As that commit already noticed, there are attributes which should not be propagated to that character style. Extend this blacklist to ignore RES_CHRATR_BACKGROUND as well, as Word does. Change-Id: Idcb40d37d8688c76fbd61f28428f6e3bc995f799
2014-03-27Unit test for .doc import of full colour bordersLuke Deller1-0/+116
This test exercises the import component of commit ad51d4952dc30e0d1cdcc6037556cd7c66a61542 which adds support for full colour borders in .doc import/export. Also this test showed that page border import was not actually covered by ad51d4952dc30e0d1cdcc6037556cd7c66a61542, so that omission is fixed here. Change-Id: I6272e9b22415b5af012145e99360c5765d5aec60 Reviewed-on: https://gerrit.libreoffice.org/8759 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2014-03-26cp#1000044 DOC import: fProtEnabled means document is not totally read-onlyMiklos Vajna1-0/+7
Reading the spec, it seems that we have two cases here: - if lKeyProtDoc is set and fProtEnabled is 1, then editing forms is allowed - if lKeyProtDoc is set, but fProtEnabled is 0, then the document is totally read-only So in the first case avoid the SetModifyPasswordHash() call to allow form field editing. Change-Id: Id0c48e8eb4bde75c5520a7b108fcfada51148faf
2014-03-06cp#1000039 DOC import: ignore symbol charset of the symbol fontMiklos Vajna1-0/+6
Otherwise characters unhandled by our OpenSymbol font (like Arabic 0-9 numbers) won't be rendered using an other font, as no other font provides the symbol charset. Do this in SwWW8ImplReader::GetFontParams(), where we already have font name -> font family mappings for a few well-known fonts. The DOCX filter does the same for quite some time, and that's how Arabic numbers in text using the Symbol font were rendered, instead of little rectangles. Change-Id: Ib794cac19ad7b073e39f3cbd7d4bad3994151c14
2014-03-04bnc#821208 DOC import: don't overwrite WW8Num* character stylesMiklos Vajna1-0/+9
In general we're overwriting styles on import in case we're not pasting. But these WW8Num* character styles are in general not from the document, they are created because Writer needs a character style for each numbering level to handle what's in the DOC file. So, in case there is a character style with the same name as our "character style for numbering" styles, prefer the later ones, as that's intended most likely. Change-Id: I675f867722360aca765bb96b0b43ea47deab9847
2014-01-03cp#2013101510000026: doc export of commented text rangesZolnai Tamás1-24/+0
Change-Id: I2d31da5d659edcbebc682d5604d2db24b5e341fb
2014-01-03cp#2013101510000026: wrong highlight of commented text range imported from docZolnai Tamás1-1/+0
When makeFieldBookmark() method is called with ODF_COMMENTRANGE it will ignore the added field name and generate an own one. We have to set the name of the SwPostItField to this generated name so these two names will match. Note: lTagBkmk is only an identifier but not the exported name of the fieldmark so we don't need to stick to use it as a name. Change-Id: I499abdcce1be0563c308bcf9f5c0a959a07f858b
2013-11-09Make CppunitTest_sw_ww8import use DECLARE_SW_IMPORT_TEST()Miklos Vajna1-69/+24
Change-Id: Id2efe1cacd8b1e7ceb31ee2b7d7ed4671266231b
2013-10-15WW8 import: fix handling of sprmPIlfo when sprmPIlvl is missingMiklos Vajna1-0/+10
Commit 542a0d7260e4767d8aff839eb593e748a82ced48 (#100044# Cleanup for optimization defines->enums, 2002-08-14) added the problematic "else" without mentioning the reason, so I assume it's safe to just revert that part. Change-Id: Id90fbdfb1116be458a76c9653fec0633edc34fac
2013-10-15fdo#36868 WW8 import: allow outline numbering and list style in the same ...Miklos Vajna1-0/+9
.. paragraph style The original problem (from a user's point of view) was that the second level of the numbering started from 1.1 instead of 2.1 in the bugdoc. This was fixed by using outline numbering for level 2 as well, but this is problematic in many cases: we want to have outline numbering exactly when outline numbering is enabled for the given paragraph style. So revert the change in SwWW8ImplReader::SetStylesList() and fix it differently: SwWW8ImplReader::RegisterNumFmtOnStyle() explicitly ignores list style if outline numbering is available with no good reason. Both the WW8 format and Writer core allows to have outline numbering and a list style at the same time, so set list style even when outline numbering is available. This fixes the original issue, too -- without introducing nasty fake outline numbering usage. Also add a testcase for the original issue. (regression from e3d5c3e0746916c4056389dd8c2daa6c451c8f6e) Change-Id: Id7d2d67a96a858aee3230110cb518fea51d19d38
2013-09-03typoMiklos Vajna1-1/+1
Change-Id: Icea791684399fb15b5f7940b5691cdc76b3dde1f
2013-08-27Reduce copy&paste by adding SwModelTestBase::getShape()Miklos Vajna1-8/+1
Change-Id: I3b73405c546427bb5676db30e297af36c18043e6
2013-08-08bnc#823651 WW8 import: fix paragraph style in empty first page headerMiklos Vajna1-0/+10
The problem was that the first page SwFmtHeader / SwFmtFooter wasn't created in case the header/footer text was empty, even if fTitlePage was set. Change-Id: I5e58419161bcc663e2beb0338b95877469e0fd3c
2013-06-06wwSectionManager: fix import of page bordersMiklos Vajna1-0/+11
Regression from 1e113cb7604e1509e7d598a9be329f1f7b6e9322. According to the spec (see 2.9.181), the first bit disables border of "all but first" pages, the second bit disables the border of first pages. Change-Id: Ie49c9b7b76d34c2a93350481965790976f49d7df
2013-05-13bnc#816593 WW8 import testcaseMiklos Vajna1-0/+11
This always worked, but I almost broke it with 8fe8bd6c3b5b1a539b7370f8c457fa69c061d2de. Change-Id: I6b7817830da23afea758d1eb90395aeb01e32f67
2013-05-13bnc#816603 testcaseMiklos Vajna1-1/+11
Make sure that at least full-page-width multi-page floating tables are imported on multiple pages. Change-Id: Ifb974d50c50b1495634ac2652a3ae46235bb5f52
2013-04-22Move to MPLv2 license headers, with ESC decision and author's permission.Michael Meeks1-23/+4
2013-03-12times are represented using local machines time, bah, just check for am/pmCaolán McNamara1-1/+2
Change-Id: I3f0f76884e62cc7ec151a890ff0dd10e75194e3d
2013-03-12Related: #i120158# add a test-case for tricky am/pm escape problemCaolán McNamara1-0/+15
Change-Id: I4905fb384694c3f1dadccc6d8513c9a050e3f67b
2013-01-21fdo#59530 WW8 import of commented text rangesMiklos Vajna1-0/+26
Change-Id: I3e2928922ebcec8188c1b5416108373c4f26dd62
2012-12-21sw: add csv output for extra filter testsMiklos Vajna1-1/+3
Like the minimal filter tests, these tests are invoked from a single cppunit method since commit 0a30cb22a141c26b4eab43a478d32df0769596ec, so some info about exactly what file failed is necessary. If we are at it, also print the (re)loading time as well.
2012-11-18sw: move swmodeltestbase.hxx to qa/extras/inc/Miklos Vajna1-3/+3
If we already have such an include dir, let's have all headers there. Change-Id: I2100b5308e7fdad9d98cfde76434ff485aca20c7