summaryrefslogtreecommitdiff
path: root/sw/source/filter/rtf/swparrtf.cxx
AgeCommit message (Collapse)Author
2020-10-07RTF import: copy direct para formatting for first para in insert modeMiklos Vajna
This is really similar to commit ae9fe9d7107b2e25c9316033651e49c08537c0e9 (ODT import: copy direct para formatting for first para in insert mode, 2020-10-02), except that was for the ODT import. Change-Id: I5f4e82162f1c18335f472c004c742e0e0f0664f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104060 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-10use more std::make_sharedNoel Grandin
found using 'git grep', I tried using clang-tidy, but it only successfully found a tiny fraction of these Change-Id: I61c7d85105ff7a911722750e759d6641d578da33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-03Remove some unused includesMiklos Vajna
See tdf#42949 for motivation. Change-Id: I89c082d62409b40c8472b865cc60b0d10923c9c1 Reviewed-on: https://gerrit.libreoffice.org/75015 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-06-18loplugin:logexceptionnicely in swNoel Grandin
Change-Id: I92c84f5c869e5ccab344f7e3591d68a90a20eefa Reviewed-on: https://gerrit.libreoffice.org/74243 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-13fix wrong SET/QUERY flags passed to uno::ReferenceNoel Grandin
By creating deleted methods for the wrong calls. Avoids the compiler needing to construct a temporary Change-Id: I3b8c648d6bb22d22827bf74f21ea5a2a17fc0f6a Reviewed-on: https://gerrit.libreoffice.org/72103 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-01tdf#42949 Fix IWYU warnings in include/sfx2/[sS]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I4a3baffa8944b522b16b50975185759081662020 Reviewed-on: https://gerrit.libreoffice.org/69945 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-08-03Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directory sw Change-Id: I1ede3f86e390bfec1a2d3ee8e8bb6ec67083b194 Reviewed-on: https://gerrit.libreoffice.org/58372 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-13sw, writerfilter: various small cleanupsMiklos Vajna
Different parameter name in declaration and definition, repeating type name inside the very same line when initializing from a cast, and so on. Change-Id: I52dc29ed845fb1a780dfab586bfd67db0d4a9e54 Reviewed-on: https://gerrit.libreoffice.org/57370 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-23sw: prefix members of ReaderMiklos Vajna
Change-Id: Ia4210410047ce3b37113cfe0d4dff5bb7122baf2 Reviewed-on: https://gerrit.libreoffice.org/53307 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-12-11loplugin:salcall fix functionsNoel Grandin
since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-22RTF filter: drop now redundant astyle.optionsMiklos Vajna
I (tried to) keep the RTF filter style consistent locally with astyle in the past, but now that's redundant when we have an enforcing clang-format mechanism in place. So drop the astyle config and switch to clang-format in the RTF filter case. To minimize backport pain, do this shortly before the libreoffice-6-0 branch-off. Change-Id: I708dbeb0b5ad2afacc90029ee5abba9495f4601f
2017-10-04add << operator for css::uno::ExceptionNoel Grandin
Change-Id: Ia23dafd07133779144965682df3b7125a3214235 Reviewed-on: https://gerrit.libreoffice.org/43046 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-09-28RTF export: various minor cleanupsMiklos Vajna
Change-Id: I6bdbe246bf65dcfa193289210f7c464769d5e2ad Reviewed-on: https://gerrit.libreoffice.org/42887 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-06-21convert ErrCode to strong typedefNoel Grandin
would have preferred to re-use o3tl::strong_int, of which this is a modified copy, but there are lots of convenience accessors which are nice to define on the class. Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a Reviewed-on: https://gerrit.libreoffice.org/38497 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-12sw, xmlsecurity: indentation fixesMiklos Vajna
Change-Id: I3bc916c8318b63a829ec391a72976829815fa987
2017-06-09use comphelper::InitPropertySequence in more placesNoel Grandin
Change-Id: I72d7b13a23ce306b752b39187a0e9fbb7028643a Reviewed-on: https://gerrit.libreoffice.org/38606 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-03sw: indentation fixesMiklos Vajna
Change-Id: I81076414ee335f34bb687f93e89d65343d2f3c57
2017-04-01add rtf fuzzerCaolán McNamara
Change-Id: I36a6294c158232bef8fceeaf5159527f467f5786
2017-02-21loplugin:subtlezeroinit: swStephan Bergmann
Change-Id: Ibd5342b39de2fe9da14bbcc243736ae21b78072d
2016-11-09sw: clean up redundant get() calls on smart pointers in rtfattributeoutputMiklos Vajna
And a few more similar nitpicks. Change-Id: Iac343800171658a9623bcc4d5b7aadaae56830ad
2016-10-27loplugin:literaltoboolconversionStephan Bergmann
Change-Id: I886f4fcb3de5a931f94b2f45f5f0cdb841af26d1
2016-10-27I'm testing inserting a rtf, but really want to test simple loadingCaolán McNamara
Change-Id: I13c6e8394de9b7214f3e4d448a7b18cbf3b637e9
2016-09-10fftester: this mode is intended for paste into an existing docCaolán McNamara
so rearrange this to avoid (with G_SLICE=always-alloc) use after free after the joinnext that expects to be able to safely join the last node ==3439== Invalid read of size 8 ==3439== at 0x269362FE: SwIndex::Remove() (index.cxx:165) ==3439== by 0x26885591: SwIndex::~SwIndex() (index.hxx:59) ==3439== by 0x26885829: SwPosition::~SwPosition() (pam.hxx:51) ==3439== by 0x269AAF0D: SwPaM::~SwPaM() (pam.cxx:437) ==3439== by 0x208D9AA5: TestImportRTF (swparrtf.cxx:182) ==3439== by 0x404054: sal_main_with_args(int, char**) (fftester.cxx:384) ==3439== by 0x40230D: main (fftester.cxx:77) ==3439== Address 0x19143e48 is 104 bytes inside a block of size 248 free'd ==3439== at 0x4C2CD5A: free (vg_replace_malloc.c:530) ==3439== by 0x518A7F4: rtl_freeMemory_SYSTEM(void*) (alloc_global.cxx:279) ==3439== by 0x518AAD8: rtl_freeMemory (alloc_global.cxx:349) ==3439== by 0x51895C3: rtl_cache_free (alloc_cache.cxx:1230) ==3439== by 0x4EC7A8D: FixedMemPool::Free(void*) (mempool.cxx:49) ==3439== by 0x26AC52FC: SwTextNode::operator delete(void*, unsigned long) (ndtxt.hxx:799) ==3439== by 0x270BE0C0: SwTextNode::~SwTextNode() (ndtxt.cxx:275) ==3439== by 0x26CC16D1: SwNodes::RemoveNode(unsigned long, unsigned long, bool) (nodes.cxx:2298) ==3439== by 0x26CBD766: SwNodes::Delete(SwNodeIndex const&, unsigned long) (nodes.cxx:1210) ==3439== by 0x270BFB60: SwTextNode::JoinNext() (ndtxt.cxx:715) ==3439== by 0x208D9282: SwRTFReader::Read(SwDoc&, rtl::OUString const&, SwPaM&, rtl::OUString const&) (swparrtf.cxx:128) ==3439== by 0x208D9A3E: TestImportRTF (swparrtf.cxx:187) Change-Id: I1cf70faae542a56f61fa651d6158774c28462999
2016-08-01sw, writerfilter: fix indentationMiklos Vajna
These files had a consistent style before, keep it that way. Change-Id: I325e13e402abb01c347d1185b85468f23a18bba3 Reviewed-on: https://gerrit.libreoffice.org/27773 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-07-28unreferenced local variableCaolán McNamara
Change-Id: I33c2c9b1c4ea3979f16b36af170c515df1f6b0c2
2016-07-28not interested in exceptions for fftester testingCaolán McNamara
Change-Id: I825e89a9d515f2f19eca190b1e3cc2d2ad565df3
2016-07-28add rtf to fftesterCaolán McNamara
Change-Id: If00b1de1e1be16214df78d15554d95847e3239e7
2016-04-20loplugin:salbool: Automatic rewrite of sal_False/TrueStephan Bergmann
Change-Id: I5c33d8ed3551d9ad4432824995bfdc3f73cfc5f8
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I01e11fa956a249974e77dce9deebe79311f098d0
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-05-20bin/rename-sw-abbreviations.shlibreoffice-5-0-branch-pointChristian Lohmaier
renames the most annoying abbreviations in Writer (and partially in the shared code too). Change-Id: I9a62759138126c1537cc5c985ba05cf54d6132d9
2015-05-12tdf#70318: don't forget to clean up second fake paragraphMike Kaganski
RTF insert is made into an empty paragraph. To do that, two splits are made before the insert, but only one is reverted afterwards. This patch removes the second. Also fixes a memory leak from unreleased heap object The corresponding unit test is corrected. It was incorrect because \par doesn't begin new paragraph; it only ends paragraph. If a RTF is ended with \par } then no newline is added to its end. The old unit test only worked because of the bug fixed by this patch. Correct way of inserting new paragraph in the end of a RTF is \par \par} Change-Id: I63d50a940d7960beb35f7d774c833ed8499acbef
2015-03-14Unused includesMiklos Vajna
Change-Id: Ie273e88bd12321726f1717e4e09b1928fcadb6f9
2015-02-11sw: identation fixes in swparrtfMiklos Vajna
Change-Id: I225464e2b517cd10fd055eaf1e5d23d660419628
2014-08-12Refactored IDocumentStylePoolAccess out of SwDoc.Valentin Kettner
Added non const SwDoc::GetDfltTxtFmtColl and SwDoc::GetTxtFmtColls and SwDoc::GetCharFmts. Had to make the manager friend of SwTxtFmtColl and SwConditionTxtFmtColl Had to make SwDoc::_MakeCharFmt and SwDoc::_MakeFrmFmt public. Change-Id: I19a36d91f92b3781a6c4313ec12eb8f7d4dfacc3
2014-07-15Refactored IDocumentContentOperations out of SwDoc.Valentin Kettner
Into the new class DocumentContentOperationsManager. Made SwNodes in sw/inc/ndarr.hxx friend class to DocumentContentOperationsManager so it can call DelNodes at end of DocumentContentOperationsManager::DeleteSection . Added DeleteAutoCorrExceptWord to SwDoc, its needed in the Manager. Added a non const version of SwDoc::GetDfltGrfFmtColl() to SwDoc because its needed in the Manager. Made SwDoc a friend class to DocumentContentOperationsManager so it can call SwDoc::checkRedlining and SwDocL::_MakeFlySection. Moved SwDoc::CopyImpl_ , SwDoc::CopyWithFlyInFly and SwDoc::CopyFlyInFlyImpl into the Manager. Moved "struct ParaRstFmt" and "lcl_RstTxtAttr" from docfmt.cxx in DocumentContentOperationsManager.hxx . Change-Id: Icaab57f4a8c158a85e549ecb4aacc752bc95bbc9
2014-03-27Second batch of adding SAL_OVERRIDE to overriding function declarationsStephan Bergmann
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: Ie656f9d653fc716f72ac175925272696d509038f
2013-12-05RTF: use "InsertMode" insead of "IsNewDoc" for consistencyMichael Stahl
... with other filters. Change-Id: I563d6f7713d882b834978699c492a43a70e072cd
2013-08-15String to OUString, some formattingMatteo Casalin
Conflicts: sw/source/filter/basflt/fltini.cxx sw/source/ui/dialog/ascfldlg.cxx Change-Id: Ifa12105aa6f747e2797891b6c71128bd96f78bf3
2013-02-18sw: let SwTxtNode::GetTxt() return OUStringMichael Stahl
Change-Id: I36e777b2f623429773277e092284f7d2ba61e6ef
2012-12-11sw: splitted -> split in SwRTFReaderMiklos Vajna
Change-Id: Iffa3296a15cbfaef8b7eca0648d9d954c92b3d4a
2012-12-10callcatcher: remove unused rtf filter and associated methodsCaolán McNamara
update and remove newly unused code, mostly original rtf filter Change-Id: I2dd302851ee6fad62d79fbc81cb8a61a861396db
2012-12-10sw: unused SwRTFParserMiklos Vajna
Change-Id: Iaabd3d992f5e8cd8166afd3520fa8552b6219e27
2012-12-07sw: unused RtfReaderMiklos Vajna
2012-11-30Revert "fdo#43869 use the old rtf importer for paste"Miklos Vajna
This reverts commit bb147bbb801b53dba8928340df7e2aa2d4545349. It's no longer needed, now the new importer supports importing to an existing document.
2012-11-30re-base on ALv2 code. Includes:Michael Meeks
Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2012-11-28SwRTFReader::Read: catch all exceptionsMichael Stahl
... so the filter does not crash soffice with unhandled exceptions. Change-Id: Ia09815009dfb0c9e5163b94aecb76e3e70e6f945
2012-11-28API CHANGE: add a "position" parameter to XParagraph/TextPortionAppend methodsMiklos Vajna
So we can use the new RTF import for clipboard pastes in Writer without inserting text content to the end of the document only. Notes: - SwXText::insertTextPortion: the MovePara() call is removed, as all it did was trying to move the cursor beyond the end of the document. - SwRTFReader::Read: the double fake paragraph insertion / deletion is motivated by the ODT filter. - RtfFilter::filter: if TextInsertModeRange is not passed, then the behaviour is not changed. v2: - added missing @since tags - added insertTextContentWithProperties() method - removed unused appendParagraph() method Change-Id: I24cddb00a78e3b798e7d88764e59e6a77a6e98a4 Helped-by: Michael Stahl <mstahl@redhat.com>