summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)AuthorFilesLines
2014-06-27writerfilter: RTF import: fix handling of associated char propertiesMichael Stahl1-14/+27
These are all dependent on the active \lrtch \rtlch \loch \hich \dbch. There does not appear to be a SPRM Id for CJK bold / italic / fontsize. Change-Id: I055ac29700ccd3b32b02c3f7685629254a6c3fd6 (cherry picked from commit fc49c052dbdbb5ab3b0a02a13143705f769b9662) Reviewed-on: https://gerrit.libreoffice.org/9915 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-24fdo#76260 - Switch from vector to std::stack.Michael Meeks2-4/+4
std::stack uses std::deque which is extremely expensive for this case. This change saves 43bn of 98bn cycles spent in createFastChildContext. Change-Id: I63919a9826563171f128e09d7206ac6cfdde336f (cherry picked from commit 295b97b2a654e00ac5a8e6a3545284fa583fce78) Signed-off-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-17writerfilter: try to make tinderbox happy againMichael Stahl1-1/+1
Change-Id: I445303e52fbfaa58e68c01970e21941537484506 (cherry picked from commit 31376a31d12a22d4870bbe4033dbbce18c13f07d)
2014-06-17n#825305: writerfilter RTF import: override style properties like WordMichael Stahl5-16/+93
It would certainly be immediately obvious to any reader of the RTF spec that \sN will apply the style with index N to the current paragraph. But actually, that is not what Word does when it reads \sN... what it really does is to apply the style with index N, and then for every attribute in that style, apply the same attribute with a default value to the paragraph, effectively overriding what's in the style. If that doesn't make any sense to you, well, have you heard the joke about how many Microsoft engineers it takes to change a light bulb? Also, \pard apparently implies \s0. To implement that, change RTFSprms::deduplicate() to recursively look for style SPRMs that are missing in the properties, and put in default ones, currently just for 2 keywords \sa and \sb. This requires changing deduplicate() to be const and return a new value, since it is no longer idempotent, as the erased SPRMs would get defaulted on the next run. While at it, fix RTFValue::equals() which did not compare m_sValue. This fixes the testParaBottomMargin test that was broken by the fix for fdo#70578. Change-Id: I4ced38628d76f6c41b488d608a804883493ff00b (cherry picked from commit 1be0a3fa9ebb22b607c54b47739d4467acfed259)
2014-06-17fdo#70578: writerfilter RTF import: by default style is para style 0Michael Stahl1-0/+24
quoth the spec: "For <style>, both <styledef> and <stylename> are optional; the default is paragraph style 0." Of course in order to do that we need to add support for at least recognizing the \dsN and \tsN keywords to override the default, so that table styles don't become paragraph styles. Change-Id: Ic100768581f9e8c327063ff776fbd61ac4242483 (cherry picked from commit 6c0e1270889deb513f961f864dfc1c02ee8705f4)
2014-06-16DOCX import: fix additional empty paragraphs around footnote textMiklos Vajna3-1/+8
Regression from commit abe1e852a232e3bdab7b9177d099fe3929f5a4aa (handle properly page breaks even if a page contains only a frame (fdo#55381), 2014-04-21), DomainMapper::lcl_endSectionGroup() inserted an empty paragraph before and after the real footnote text. Disable addition of the dummy paragraph for footnotes. (cherry picked from commit 4d120b6ab181f530d3fedc963b1c6ec777f2608a) Signed-off-by: Luboš Luňák <l.lunak@collabora.com> Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I6e1954c9bd5520ac284d66244ce1c9004e970305
2014-06-13fdo#76633: writerfilter: RTF import: do not leak the XShape of imageMichael Stahl3-9/+27
RTFSdrImport::resolve() is called for \picprop and creates an XShape that is stored in RTFSdrImport::m_xShape and also DomainMapper_Impl::m_aPendingShapes; later RTFDocumentImpl::resolvePict() completely ignores that XShape and creates a new one, which is also inserted in the document; the first XShape is effectively leaked. Try to avoid that by re-using the exising m_xShape in resolvePict(). Not sure if there are any problems with doing this, it's all a bit confusing. Change-Id: I98456242acb0766f547eb8f7d877f51d53323f3a (cherry picked from commit ba9b63d8101197d3fd8612193b1ca188271dfc1a)
2014-06-13fdo#76633: writerfilter RTF import: disappear the rectangle shapes on imagesMichael Stahl3-6/+15
If the shape properties are inside \picprop destination, don't set shapeType. (regression from 9f1f7199736e2ae07b34849ba66f61a1ef5782e8) Actually this does not fix the root cause, this is just a work-around, the extra shape is still inserted but it's invisible now. Change-Id: I6cf093de2a5657533f393863ed8010ae083bec16 (cherry picked from commit b7857e5cfe9d5d007785ae93e5505620fc8ed475)
2014-06-12related: fdo#77979: writerfilter RTF import: read encoded font nameMichael Stahl1-4/+5
The font name is encoded in the font's charset given by \fcharset. (cherry picked from commit 04d5a280beeeb6e056df68395dc9c3b3a674361b) Conflicts: writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: Id9520649a1eb3b55f4314e140abda7399f23d925
2014-06-03writerfilter: fix log areaMichael Stahl1-1/+1
Change-Id: Iddedd58dbcdd122ec4177bfdd5e97b9ceca18435 (cherry picked from commit 634f647912c07d366e31bfc168fa1294f1613cd6)
2014-06-03(related: bnc#823675) RTF import: get rid of hacks for \f in LISTLEVELMichael Stahl1-6/+3
These weird hacks are apparently needed only because the \loch \hich \dbch were mapped wrongly; for the list level destination it's only important that the existing fonts are not overwritten. Change-Id: Ie2b9adf332b74c2744e9b1dbc4e878638e5ee078 (cherry picked from commit c087b60b0dd70c4a711ba1b4d556206a136fa468)
2014-06-03RTF import: fix handling of \loch \hich \dbch \ltrch \rtlchMichael Stahl2-5/+20
The logic is not immediately obvious from the RTF spec; let's do what the editengine RTF import does, but without the unnecessary complexity. Change-Id: I60e69130e6e5aed1f5d237f64b1656c3141e402a (cherry picked from commit 36246aa9fb57c9fe4e546c91a8274d8828b1424e)
2014-06-03fdo#79384: replace the work-around with a different oneMichael Stahl1-7/+7
Word will reject Shift-JIS following \loch, but apparently OOo could read and (worse) write such documents, so accept Shift-JIS regardless of run charset type. Change-Id: Ib181956e9f218548a52037dd76fa1d3ecdc006bd (cherry picked from commit d71387ca81b61416b9a7b82cd6cf67d496b81fc2)
2014-06-03fdo#79384: RTF import: fix literal Shift-JIS textMichael Stahl2-5/+31
This is a variable-length encoding, and the second byte may be a RTF syntax character like \, {, }. Change-Id: I813ccafda18388af3bf05eb7ce9a0253c627b1c4 (cherry picked from commit 061190a62fcdbfb3a0b266d5afffbd257a3e692e)
2014-06-03oox, writerfilter: Support for artistic effects on picturesJacobo Aragunde Pérez3-1/+415
Bitmaps can define artistic effects like in the following example: <a:blip r:embed="rId5"> <a:extLst> <a:ext uri="{BEBA8EAE-BF5A-486C-A8C5-ECC9F3942E4B}"> <a14:imgProps xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"> <a14:imgLayer r:embed="rId6"> <a14:imgEffect> <a14:artisticMarker trans="14000" size="80" /> </a14:imgEffect> </a14:imgLayer> </a14:imgProps> </a:ext> </a:extLst> </a:blip> They are defined in the MS-ODRAWXML extension. Ref: http://msdn.microsoft.com/en-us/library/dd905216(v=office.12).aspx LO core doesn't support them, but I'm preserving them using the shape grab bag. Bitmaps must not be transformed to a SwXTextGraphicObject so the grab bag of the XShape is not discarded. Added several Context and Properties objects on the import side to traverse and save the relevant tags, and added the corresponding code on the export side to extract the grab bag and output the effect back. When Word applies an artistic effect, it creates two embedded files; one contains the bitmap with the effect and the other one contains the original bitmap to be able to undo the effect. We also read the original bitmap, store it in the shape grab bag and save it back to the docx file. When two pictures apply different effects to the same picture, it is only saved once in the original document. Added a cache to DrawingML to know if the picture has already been exported. Finally, added unit tests for a selection of artistic effects. [Squashing commits from master: 21d4cfe19e2796ebf89c408e292c4473924b2bc4 642a252cf1a2f1d08c4bbfcae15527bb82c7664d 2e68a1468c035fc3bb4d02ad0b3187872fe1e67b b5f6a5cfc517ecd8aa6ba96471d854b07b92ebaa 38d7b82c277599f2e613256c4353aa7dfdc219ec] Change-Id: I39327a8118e23829c029122154a31ce3af5b48cd Reviewed-on: https://gerrit.libreoffice.org/9495 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-02fdo#79384 RTF import: allow { without } in style namesMiklos Vajna1-1/+6
This is not valid, but LO 3.4 supported it, so add a workaround... (cherry picked from commit 6092e2eba3f74c9632f7862b2368b0fcf7732f85) Change-Id: Ib8eefdf41fe9801db6f7e5873eaa1436518912fb
2014-05-30fdo#78883: Writer getting Hang while opening documentTushar Bende4-3/+30
Description: Writer getting Hang while opening document because of loop in layout. Root cause: For Documents containing table with direct formatting for Para line spacing along with style w:type="table" in style.xml LO was erasing PROP_PARA_LINE_SPACING Prop from pAllCellProps in DomainMapperTableHandler::endTableGetCellProperties(). But for Documents without direct formatting for Para line spacing this deletion was causing problem, as after deletion there is no formatting available to apply. To fix this checking whether there is a Direct formatting available for table, if Yes then proceed with this deletion logic. Change-Id: Ibaf51ebd1aca93eff44a9edfbe8fa13832ab2b70 Signed-off-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 489611732319dec36ec630f6bfffd0c6ff03b9bf)
2014-05-29handle direct formatting for numbering in .docx (bnc#875717)Luboš Luňák3-0/+5
Change-Id: I3ed0f926e79f3878c5702c2becae97d99d00e201
2014-05-27fdo#78348 DOCX import: end progressbar after parsing is doneMiklos Vajna1-0/+3
Change-Id: Id3db99a7ea341bcfc9bf2cd2b718e70a17d41f76 (cherry picked from commit cd1abdce1eafa7f2225e4050d1a075154b5e7d67)
2014-05-26fdo#78900 RTF import: allow \dpxsize inside \dptxbxtextMiklos Vajna1-0/+11
Previously we assumed that they always appear under \do directly. Change-Id: Ie3a978da856986f604a3815d6127abb4191323c0 (cherry picked from commit 21c11ffe254612ac46aa891addacb0024d5b93f0)
2014-05-24discard more header/footer stuff when discarding headers/footers (bnc#875718)Luboš Luňák1-4/+10
782adba4d436c65cdf85d48f28486321873b15ed discards unneeded headers/footers, but only the text, not e.g. frames or fields. The test document therefore ends up with a frame with a page number inside the body text, because the text in the footer it should be anchored to was discarded. This commit fixes this by discarding more (although probably the whole header/footer shouldn't even be parsed to begin with). The test from b349d2483e1fe64316d87b55d0b3b4c8f2293e2e actually checked for this incorrect frame, so change that (the whole test is suspicious, as the end result is quite far away from what the original doc looks like). Change-Id: I2e7192e00237db1f030d0524c5667fe92c9e496b
2014-05-20enhance pass-by-ref plugin to detect large argumentsNoel Grandin2-4/+4
Detect arguments larger than 64 chars passed by value. Change-Id: I9b0ea9ccb99d115984a26eab67c9cf6afd5f6cae Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-05-19writerfilter: remove using namespace from headersThomas Arnhold9-73/+76
Change-Id: Ibbb234a15de9ddb71552ef083ade72d2ac724ee0
2014-05-19DOCX import: tokenize v:background (VML description of page background)Miklos Vajna2-2/+24
Change-Id: I4ee2f01e714265b2684a9eb379e56654d34e2441
2014-05-18writerfilter: drop last 'using' statement from headersMiklos Vajna11-136/+122
Change-Id: I08a13793c40bec0b9a657e01f4c973cc0e393d4d
2014-05-18writerfilter: drop remaining non-css global 'using' from headersMiklos Vajna7-76/+64
Change-Id: I70e5e276a084d951d73879aa2aa4f19e9d2d32f8
2014-05-18writerfilter: drop remaining 'using' statements from headers in dmapperMiklos Vajna3-13/+9
Change-Id: I4c84388b4fae7fe27bcc6266e9978fe9d230435d
2014-05-18writerfilter: drop global 'using css' from WrapPolygonHandler.hxxMiklos Vajna3-8/+6
Change-Id: Ibecc12f74e55360ee03baf7d170ab5589d3ed3ab
2014-05-18writerfilter: drop global 'using' from XPathLoggerMiklos Vajna2-12/+9
Change-Id: I8686a0aa3786284ab946d3c58b458ad211eb347d
2014-05-18writerfilter: drop global 'using css' from WW8ResourceModel.hxxMiklos Vajna38-206/+213
Change-Id: I2196a1df09a6f35e4de3ab3cc84bc1e149cd8f61
2014-05-18writerfilter: clean up two 'using' statement from header filesMiklos Vajna2-8/+5
Change-Id: I47f3d0c68668d03db3c5f3187414833aa3097424
2014-05-17Correct common misspellings, and remove some ASCII art along the way.Chris Laplante2-3/+3
Change-Id: I42787db31769e8bde984c5f4f0aa90335e889b1c Reviewed-on: https://gerrit.libreoffice.org/9356 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
2014-05-16DOCX import: make sure inline shapes are not in the backgroundMiklos Vajna1-0/+4
Change-Id: I80d684662ac3f94bff4448fcdae94f9e69fd1590
2014-05-16ooxml: Preserve effects on picturesJacobo Aragunde Pérez1-1/+12
If a picture contains some 2D (glow, shadow...) or 3D effect (rotation, extrusion...), we prevent the importer from transforming it into a XTextContent so the XShape grab bag is not removed and the effects are preserved using the existing mechanisms. Added a unit test for this issue, and modified some existing unit tests to match the new behaviour. Change-Id: I3b87069ea208604383a592d34d0a4ceb6b0f9fc7
2014-05-15DOCX import: fix chart size when it's inside a TextFrameMiklos Vajna1-0/+4
Change-Id: I3edb253238db182054b7688061916a2432b687b5
2014-05-14DomainMapper_Impl::AddDummyParaForTableInSection: shapes can't have sectionsMiklos Vajna1-0/+3
Trying to add (and later remove) a dummy paragraph is just not needed at the moment, but it'll cause a real problem for textboxes. Change-Id: I9f90b515171ce4b498de49c2381b7324002e3c20
2014-05-14Find places where uno::Sequence is passed by value.Noel Grandin7-15/+15
Implement a clang plugin to find them, and clean up existing code to pass them by reference. Change-Id: If642d87407c73346d9c0164b9fc77c5c3c4354b8 Reviewed-on: https://gerrit.libreoffice.org/9351 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-05-14writerfilter: DomainMapper_Impl::SetSymbolData() should take an intMiklos Vajna2-2/+2
One wonders how did this work so far. Change-Id: I6aee6a2f7e15c1c4931ca5d65b6ad39d025ff9ed
2014-05-14fdo#78384: Fix for corruption if file contains symbols.Rohit Deshmukh3-1/+25
* In case of symbol, symbol character get imported first and then font of symbols. * So we are storing symbol character and when we parse symbol font then create UNO object for text. Change-Id: If5b79521c6a59aec02b165e8120dafdd472cdaeb Reviewed-on: https://gerrit.libreoffice.org/9281 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-05-13fdo#78657 writerfilter: tokenize a:hlinkClickMiklos Vajna2-7/+27
This is just the tokenizer part, though all the heavy-lifing in model.xml should be now done. Change-Id: I42a13637a29411d4ee8925d7f06336584d69f25a
2014-05-13writerfilter: unused mnRefCountThomas Arnhold2-3/+0
Change-Id: Ideab32a5cb6a2ccc4ee91ca60ede70cd325d2b93
2014-05-12writerfilter: write out table::BorderLineStyle::NONEMiklos Vajna1-2/+1
Change-Id: Ifc9e42f12c8e3d6ae1f98396fddf5bd6adcf3ba1
2014-05-12writerfilter: unused 'using' in dmapperMiklos Vajna2-3/+0
Change-Id: Id6a8362872bb4602b840da388189fecc046dd97e
2014-05-12writerfilter: unused 'using' in rtftokMiklos Vajna1-2/+0
Change-Id: Ie28d898d490ff695143e9f09502fa10db092ccc7
2014-05-08Fix 'outset' and 'inset' table border type import in DOCX and RTFAdam Co2-4/+4
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-05-06DomainMapperTableManager::endOfRowAction(): valgrind warningsMichael Stahl1-2/+2
Change-Id: I9e59ec2d45508d8f4dee8415411182576dacc45f
2014-05-06ooxml: fix cell theme color and shade preservationJacobo Aragunde Pérez2-1/+14
The cell property w:shd was not being properly preserved when the shade value was different from "clear". The shading affects the cell color and the exporter was not taking that into account when comparing the cell color with the original color to know if the user had changed it. Besides, we were not preserving the attributes themeColor, themeTint and themeShade. I have modified the existing unit test testTableThemePreservation to add a check for those new attributes. Change-Id: I06d2e668486803cba039eacb717a69413bd5a1df
2014-05-06writerfilter: try to fix 32-bit buildsMichael Stahl1-6/+6
Change-Id: I7fb61144d8ff263e97de8cb7088b9eefdaafe52f
2014-05-06fdo#77887 : Floating Table positions are not preserved when doing ExportRavindra Vidhate4-11/+105
The margin of the floating table from top of the page is not being preserved correctly and it also get increased. The w:tblpPr tag is also not preserved. Reviewed on: https://gerrit.libreoffice.org/9185 Change-Id: I8a27a4bab94a1afd27a7ba49ca55ff014918fffc
2014-05-06simplify ternary conditions "xxx ? true : yyy"Noel Grandin2-2/+2
Look for code like: xxx ? true : yyy; Which can be simplified to: xxx || yyy Change-Id: Ib7ca86580bfd0cf04674328a3c0cf3747de4758d