summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)AuthorFilesLines
2016-04-18clang-tidy performance-unnecessary-copy-initializationNoel Grandin1-1/+1
probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-14Related: tdf#65642 RTF filter: import \pgnucrmMiklos Vajna2-1/+10
This as a side effect also implements support for DOCX <w:pgNumType w:fmt="upperRoman" .../>. Change-Id: Ibf3bedca03c6c2a2b96eecb36ff6c4cf6e2281b4 Reviewed-on: https://gerrit.libreoffice.org/24073 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-04-14loplugin:passstuffbyref in writerfilterNoel Grandin16-47/+47
Change-Id: Ia85f5a7a9846802de7a1495e70d16c9e3418dc3e
2016-04-12clang-tidy performance-unnecessary-value-param in writerfilterNoel Grandin39-166/+165
Change-Id: I1f61be80ac1ebe42668580b09a261e7e3af1a403
2016-04-12cleanup: remove unused com/sun/star/uno includesJochen Nitschke1-1/+0
Sequence.h(xx), Any.h(xx) and Type.h(xx) and remove unused using-declarations from these files. Add a few missing includes provided by them. Change-Id: I6b91b6d1fdf9d0496dd546c0aab9bdcc6831a5d4 Reviewed-on: https://gerrit.libreoffice.org/23805 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-08tdf#99140 DOCX import: fix table horizontal aligment to be 'from left' ...Miklos Vajna1-6/+7
... when it was 'manual'. Regression from commit c1e563f6efd09cd3463f1b92a3022ae288c92087 (fdo#76741 [DOCX] Table Alignment and width type, 2014-04-04), DOCX import code had to deal with two kinds of horizontal alignment when it came to floating tables: the alignment of the table itself, and the alignment of the float parameters. The problem is, in general it's wanted that the table is aligned according to the floating parameters, but in Writer the "from left" UI setting is described differently for tables and fly frames: tables use LEFT_AND_WIDTH for that, while fly frames use NONE. Fix the problem by touching the default only in case the floating parameters have something that's different from NONE. With this, the width of tables is no longer lost when they are described to be floating ones in the DOCX markup, but FloatingTableConversion() decides to ignore that. Change-Id: Idd41c3e03e6ded8552e9d15b6080e4b45eb18d3d Reviewed-on: https://gerrit.libreoffice.org/23923 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-04-08tdf#99140 DOCX import: fix table at the bottom of the page to span over ...Miklos Vajna1-1/+24
... multiple pages. In short, one more blacklist entry when conversion should not be performed. Change-Id: I764f02cc58ae1b7af802b81e570e4feaf73ee2c1 Reviewed-on: https://gerrit.libreoffice.org/23912 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-04-07tdf#99140 Factor out FloatingTableConversion() from CloseSectionGroup()Miklos Vajna2-19/+39
No logic changes intended, but makes it easier to add new rules when making the decision. Change-Id: I84d8e6a2b8a4b9ae6fe5cefd381292c2f68be45f Reviewed-on: https://gerrit.libreoffice.org/23901 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-04-05sequence->vector in writerfilterNoel Grandin2-5/+6
Change-Id: Ibc86ecc2b5dbeefd4d0411491a73f388ce303b4b Reviewed-on: https://gerrit.libreoffice.org/23763 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-04tdf#99074 DOCX import: handle <w:view w:val="web"/>Miklos Vajna1-0/+4
Instead of always using the Normal view, use the Web view when the DOCX file contains Web Layout. For this to work, expose sw's DocumentSettingId::BROWSE_MODE via css.document.Settings. Change-Id: I7787ca058d8cb8a346b2001a2bd70c3df86d8673 Reviewed-on: https://gerrit.libreoffice.org/23806 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-04-04Use std::size_tMiklos Vajna5-12/+12
And include <cstddef> where necessary. Change-Id: Icc1208528d6a8b04375d55ccbf3cd6ef046b454f Reviewed-on: https://gerrit.libreoffice.org/23796 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-03-31tdf#98987 sw: add AddVerticalFrameOffsets compat modeMiklos Vajna1-0/+1
The situation is the following: we have a text frame, with at least two anchored objects: one is wrapped not-wrap-through, the other is. In case the non-wrap-though one shifts the text content of the text frame right or down, then layout may or may not want to re-consider what is the top left corner of the text frame for anchoring purposes. Regarding the x position, sw layout repositioned the anchor point depending on the AddFrameOffsets compat mode: it's enabled for documents imported from Word, disabled otherwise. Regarding the y position, no repositioning was done, however the bugdoc shows that Word does the same repositioning on the vertical axis as well. Add a new AddVerticalFrameOffsets compat mode that enables vertical repositioning as well, and enable that mode for documents imported from DOCX. Change-Id: Idc5cad7d86662008a92ff3bf5fbb3806aa2c7b07 Reviewed-on: https://gerrit.libreoffice.org/23702 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-03-31use SAL_N_ELEMENTS in for loopsNoel Grandin2-6/+5
for with git grep -n 'for.*sizeof' Change-Id: I6211024385e03ac5eeeb38690d2c1c699e015c2f Reviewed-on: https://gerrit.libreoffice.org/23569 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-31tdf#98806 RTF import: handle bookmarks in table textMiklos Vajna1-4/+10
Mapper().props() was called directly, so all bookmarks pointed to the start of the A1 cell instead of the correct text range. Change-Id: I40eeb85b61d2ae9138cd666d4a6a3c08eda47da3
2016-03-30Related: tdf#65642 RTF filter: import \pgnlcltrMiklos Vajna2-1/+10
This as a side effect also implements support for DOCX <w:pgNumType w:fmt="lowerLetter" .../>. Change-Id: I47b60a0390ef081dc15b26e40393e35bf7bad130
2016-03-29loplugin:staticmethodsStephan Bergmann1-3/+3
Change-Id: I090c01ef2fc52b8bec74ec78e23f1104877c734f
2016-03-29tdf#98882 DOCX import: set default para properties on the Standard para styleMiklos Vajna1-27/+45
That's what the DOC import does, and that's the reason e.g. the strange unwanted crop of the as-char anchored picture doesn't happen there. This also needs the "reset all existing style properties back to default" logic to be adapted: the Standard style has to be reset before the default are set, and later it should be left alone, otherwise the defaults are lost. Change-Id: Ie422a0b64b80a826fa4f469145a26283fb32d734 Reviewed-on: https://gerrit.libreoffice.org/23593 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-03-22tdf#65642 RTF filter: import \pgnrestart and \pgnucltrMiklos Vajna4-1/+28
This implicitly adds support for DOCX import of <w:pgNumType w:fmt="upperLetter"> as well. Change-Id: Ib19ecb8f7ca0c867ae3be2b41e49ac4cacfd5bb6
2016-03-14remove some unused typedefs, and inline some use-onceNoel Grandin3-4/+1
Change-Id: I5ada1cff98c0a3e065d126444f8052f444323743 Reviewed-on: https://gerrit.libreoffice.org/23234 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-11writerfilter: avoid ugly cross-directory includeMiklos Vajna6-30/+30
Change-Id: I16db4e16e5c2fa3aa3bfb22f83d2c36695499b5c
2016-03-10sfx2 classification: merge common code from sw and writerfilterMiklos Vajna1-36/+2
The two versions were almost a duplicate. Change-Id: I3148150d62484a55fc8d59ca354998f211435c0b
2016-03-10writerfilter: -Werror,-Wunused-variableMiklos Vajna1-1/+0
Change-Id: Ia67b8728f3992279b89b8c212f2f9258baaf8edb
2016-03-10RTF import: handle classification during copy&pasteMiklos Vajna2-2/+55
With this, it can't happen that "paste" returns an error, but "paste as rtf" succeeds (from a classification point of view). Change-Id: Ia6807e5a6c065557cdd735a574ea858d29a97160
2016-03-10RTF import: set user-defined metadata only after parsing all of themMiklos Vajna1-11/+43
This helps setting all or no metadata in case an error would happen in the middle of parsing metadata entries. Change-Id: I349f53148627dd07f1304ebe00f0664bd23e26ea
2016-03-10Extract Directories from BootstrapFixtureBaseStephan Bergmann1-1/+1
(as some tests derive from the latter only for the Directories part, not for the setUp/tearDown overrides: those tests will be cleaned up next) Change-Id: Ib6b78eea868b8bc21d4cc6e8fd9e1d025deca05f Reviewed-on: https://gerrit.libreoffice.org/23078 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-03-09RTF import: handle \staticvalMiklos Vajna2-0/+42
With this, user-defined document properties are imported from RTF. Change-Id: I8dfb8e802bd26906827620550d6f5d88f047d364
2016-03-09RTF import: handle \proptypeMiklos Vajna2-0/+12
Change-Id: I398785ff0ac47a678e3171982119a85b107404b4
2016-03-09RTF import: handle \userprops and \propnameMiklos Vajna3-0/+22
Change-Id: I3fa0be5186603006e671779933625efff5d31867
2016-03-08tdf#97703 Removed empty setUp/tearDown methodsChirag Manwani1-11/+0
Change-Id: Ia62de30ae94bdae87cd5109c44eab40af4d020e5 Reviewed-on: https://gerrit.libreoffice.org/22985 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-03-07improve defaultparams lopluginNoel Grandin1-2/+1
to catch calling params with defaults like "= OUSString()" Change-Id: Iad060e318ed492c22f8be44e326174fe6d28fff9 Reviewed-on: https://gerrit.libreoffice.org/22932 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-04writerfilter: prefix members of RTFTokenizerMiklos Vajna2-29/+29
Change-Id: Icba6646e183bc283e3c86a223a7f76306123200b
2016-03-04writerfilter: prefix members of RTFHori/VertOrientMiklos Vajna1-8/+8
Change-Id: Icc0a4af0e5995116d65d0dea0881e10ca8d92232
2016-03-03writerfilter: prefix members of RTFFrameMiklos Vajna2-67/+67
Change-Id: I2cfc356a4bc570484b9fd1566e338aa4081c6f24
2016-03-03writerfilter: RTFParserState is meant to be a struct with no member functionsMiklos Vajna2-8/+8
So move its only member function to RTFDocumentImpl. Change-Id: I93874c729bc21f0545f62e654577e4b9842e898c
2016-03-01tdf#96326 RTF import: handle checkbox form field undefined resultMiklos Vajna1-1/+2
The RTF spec is quite terse on how the form filed result should be interpreted, but the binary equivalent documents properly that checkboxes have 3 valid states: 0, 1 and 25, the later meaning undefined. Use the default value in that case. Change-Id: I672bf8d1f63d7880227b7fa7b5c81f91e1877b2a
2016-02-25loplugin:unuseddefaultparams in writerfilter/Noel Grandin6-38/+14
Change-Id: Ib5a2f6f0404e8489a9699eac6b0c50e61f31083f
2016-02-24Indentation fixesMiklos Vajna1-1/+1
Change-Id: Icafd56488f58a5cc580912d720f91dacd110a7c2
2016-02-23tdf#59699 RTF import: handle INCLUDEPICTURE fieldMiklos Vajna8-10/+77
On one hand, don't handle a fieldmark for it in dmapper. On the other hand, handle the field in the RTF tokenizer as it would be {\pict ...hexdump... }, that will result in an inline picture, as wanted. Change-Id: I554fdf017920350144300fd86617bf74eed8995b
2016-02-19new loplugin: find write-only fieldsNoel Grandin2-6/+0
Change-Id: I0f83939babacf92485420ee63f290a297d7cb717 Reviewed-on: https://gerrit.libreoffice.org/22498 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-16Related: tdf#59699 DOCX import: fix linked graphics with relative URLsMiklos Vajna5-12/+20
Because the writerfilter::ooxml::OOXMLFastContextHandlerShape constructor only sent the input stream (and not the full media descriptor) to oox::shape::ShapeContextHandler, it's startFastElement() tried to reconstruct a media descriptor from just the input stream. As a result, the base URL of the document got lost at the time the oox::drawingml::BlipContext constructor tried to call getAbsoluteUrl(), to convert the relative URL to an absolute one. Fix the problem by sending not only the input stream, but the full media descriptor to the shape importer. As a bonus that makes code simpler, too. Change-Id: I1f06c04d0745aa7e2e06d4848cf454790d5073ca
2016-02-10writerfilter: DOCX signature is read in xmlsecurity already, remove TODOMiklos Vajna1-8/+0
Change-Id: Ibae2fdd0d56f68ab3401b5215b9b67000d05a3ca
2016-02-10tdf#87034 RTF import: fix multiple superscripts after footnote ...Miklos Vajna2-6/+1
... in the same paragraph. The intention was to avoid replaying the supertext buffer and using its contents as a custom footnote mark at the same time. However, it's enough to check if the buffer is empty to do so, and that avoids the mis-import of the bugdoc as well. Change-Id: I1e3b0c7f0c6d8eb8250d8b1d0d7d196039c40e79
2016-02-09writerfilter: silence 'failed to initialize RDF' warning on RTF importMiklos Vajna1-1/+1
After all the storage of the real docx input is not interesting, as it won't contain anything RDF-related in ODF markup. Also, the WW8 import uses the same empty storage without problems, so should be enough here, too -- to please RTF, which isn't ZIP-based, either. Change-Id: Iea14291cf56851d60caa3c3303b134067d04faac
2016-02-09Remove excess newlinesChris Sherlock13-31/+0
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-05Fix typosAndrea Gelmini2-2/+2
Change-Id: Ice72f8d9971e15dd6ef365e64cd567b8581a92d3 Reviewed-on: https://gerrit.libreoffice.org/21797 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-04writerfilter: no need to manually realloc hereMiklos Vajna1-6/+5
Change-Id: I1663109adfa83bcc191953ffeefad1b563e03c14
2016-02-04vcl: take into account the font width is the average font widthChris Sherlock1-1/+1
I'm changing the Font class function names: - SetSize -> SetFontSize - GetSize -> GetFontSize - SetHeight -> SetFontHeight - GetHeight -> GetFontHeight - SetWidth -> SetAverageFontWidth - GetWidth -> GetAverageFontWidth That's because it really makes no sense to say that there is a single constant font width because obviously proportional fonts don't have one - the best we can do is an average font width, which is what folks like Microsoft sort of do already. On a fixed font, the average is still accurate, for obvious reasons :-) I'm also not a fan of GetSize/SetSize as I find it a might too generic. Change-Id: Ib80a604ba62d6883fd6cbc7994da763976be5c70 Reviewed-on: https://gerrit.libreoffice.org/22069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-01writerfilter: tdf#97417: don't insert numbering on end-of-sectionMichael Stahl1-2/+11
... paragraph, it will be copied to every following paragraph. (Before commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2 the properties of the end-of-section paragraph would be overwritten by the properties inside the header) Change-Id: Ibe095cf873a09ef9e12f898d09b5fd6f61c914c9
2016-01-31boost::tuple -> std::tupleCaolán McNamara6-128/+126
Change-Id: Ia08c184b792ff73d3ed49d6a5d54dec1a35943e9 Reviewed-on: https://gerrit.libreoffice.org/21955 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2016-01-30Remove unused includesMiklos Vajna2-2/+0
Change-Id: I38784900d5b4fcf99d5fc881f0ec7a9833fe2d5b Reviewed-on: https://gerrit.libreoffice.org/21917 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>