summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uno/unotxdoc.cxx
AgeCommit message (Collapse)Author
2017-06-16Make SfxItemSet ranges correct by constructionStephan Bergmann
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT) that each individual range has an upper bound not smaller than its lower bound. Arguably, all SfxItemSet instances should fulfill the stronger guarantees required and checked by MergeRange. And in many cases the ranges are statically known, so that the checking can happen at compile time. Therefore, replace the two SfxItemSet ctors taking explicit ranges with two other ctors that actually do proper checking. The (templated) overload taking an svl::Items struct should be used in all cases where the range values are statically known at compile time, while the overload taking a std::initializer_list<Pair> is for the remaining cases (that can only do runtime checking via assert). Most of those latter cases are simple cases with a single range covering a single item, but a few are more complex. (At least some of the uses of the existing SfxItemSet overload taking a const sal_uInt16* pWhichPairTable can probably also be strengthened, but that is left for another day.) This commit is the first in a series of two. Apart from the manual changes to compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and svl/source/items/itemset.cxx, it only consists of automatic rewriting of the relevant SfxItemSet ctor calls (plus a few required manual fixes, see next). But it does not yet check that the individual ranges are properly sorted (see the TODO in svl::detail::validGap). That check will be enabled, and the ensuing manual fixes will be made in a follow-up commit, to reduce the likelyhood of accidents. There were three cases of necessary manual intervention: * sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in braced-init-list syntax now, so needs explicit narrowing conversion to sal_uInt16. * In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually. * In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx, sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx, sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx, some comments had to be put back (see "TODO: the replaced range can contain relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx). A few uses of the variadic form erroneously used nullptr instead of 0 for termination. But this should have been harmless even if promoted std::nullptr_t is larger than promoted sal_uInt16, assuming that the part of the nullptr value that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly, some uses made the harmless error of using 0L instead of 0. Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35 Reviewed-on: https://gerrit.libreoffice.org/38861 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-05Improved loplugin:cstylecast to reference types: swStephan Bergmann
Change-Id: I7206d3325b4bfedb852d559b68dc1678da524b41
2017-05-19make string translation loading more uniformCaolán McNamara
change various ResId classes that use conversion operator to OUString to functions that return a OUString drop various defines drop unnecessary toString calls Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92 Reviewed-on: https://gerrit.libreoffice.org/37817 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-05-12remove unused uno::Reference varsNoel Grandin
found by temporarily marking Reference as SAL_WARN_UNUSED. Change-Id: I18809b62654467f890016adcc92576980ced393b Reviewed-on: https://gerrit.libreoffice.org/37511 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-08loplugin:checkunusedparams in sw(part1)Noel Grandin
Change-Id: I4847b0f96033016e020212fb8d7331309db25b55 Reviewed-on: https://gerrit.libreoffice.org/37287 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-04loplugin:checkunusedparams in sfx2Noel Grandin
Change-Id: Iea88ddd619f10a2a2586ee24edbf07e246dcbb49 Reviewed-on: https://gerrit.libreoffice.org/37191 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-27remove sw bitmaps from .src filesCaolán McNamara
Change-Id: I9ccd69662f9d3a77d1921b3433b0e2f541960a90 Reviewed-on: https://gerrit.libreoffice.org/37020 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-04-11loplugin:mergeclasses merge SwAnnotationWin and SwSidebarWinNoel Grandin
Change-Id: Idaf7d7e8e4da37e0ba423dca3e22dc6711ba806a Reviewed-on: https://gerrit.libreoffice.org/36380 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-06Improved loplugin:redundantcast, static_cast on arithmetic types: swStephan Bergmann
Change-Id: I1d52df4fe3f276ebf017aa7cfb7b313cefaf0844
2017-03-31tdf#82580 tools: rename Rectangle to tools::RectangleMiklos Vajna
Mostly generated using make check COMPILER_EXTERNAL_TOOL=1 CCACHE_PREFIX=clang-rename-wrapper RENAME_ARGS="-qualified-name=Rectangle -new-name=tools::Rectangle" Except some modules have their own foo::tools namespace, so there have to use ::tools::Rectangle. This commit just moves the class from the global namespace, it does not update pre/postwin.h yet. Change-Id: I42b2de3c6f769fcf28cfe086f98eb31e42a305f2 Reviewed-on: https://gerrit.libreoffice.org/35923 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-27create SfxInterfaceId o3tl::strong_intNoel Grandin
Change-Id: Ie52f63382a9fb36f9a472801be012b140bfb51f6 Reviewed-on: https://gerrit.libreoffice.org/35722 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-22loplugin:redundantcast find redundant c-style enum castsNoel Grandin
Change-Id: I2dab376d87804521aed6b6bd41ad7762830fa349 Reviewed-on: https://gerrit.libreoffice.org/35467 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-17sw lok: Use unique redline identifier, instead of array indicesPranav Kant
Use a static integer counter as identifier to each redline Change few unit-tets that was testing redlines by using a hardcoded array index. Instead use these unique redline identifiers now. Change-Id: I63aec3fc8ab10d0dad0c936600d16e96999a2bcd Reviewed-on: https://gerrit.libreoffice.org/35276 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-14sw: Simplify - no need to create a pointer herePranav Kant
Change-Id: I5c7d1d47f347b3ce8de6e2e4995da8724a464941 Reviewed-on: https://gerrit.libreoffice.org/35045 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
2017-03-08lok: Do not use UNO for fetching tracked changesPranav Kant
See inline comment for reasons. Also, move the SwRedlineTypeToOUString function as inline to same header file containing redline types. Change-Id: I9b4be4f104c095b2ccd8287d935347c81fd25974 Reviewed-on: https://gerrit.libreoffice.org/34950 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
2017-03-07convert RES_FIELDS to scoped enumNoel Grandin
and rename to SwFieldIds Change-Id: I50d2b7550f68b4b020ffc1603f931c671c8e1de6 Reviewed-on: https://gerrit.libreoffice.org/34924 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-03-06remove some unnecessary use of OUString constructorNoel Grandin
found with git grep -nP '<<= OUString\(\w*[A-Za-z]+' Change-Id: I43354842f1e0418fb292f2e8e0cb30f1229d1c67 Reviewed-on: https://gerrit.libreoffice.org/34864 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-01typesafe wrappers for css::i18nutil::TransliterationModulesNoel Grandin
and related css::util::SearchOptions2 The TransliterationModules enum has it's constants spread over multiple UNO enum/constant-collections - TransliterationModules and TransliterationModulesExtra, which means that most code simply uses sal_Int32. Wrap them up into a better bundle so that only the lowest layer needs to deal directly with the UNO constants. Change-Id: I1edeab79fcc7817a4a97c933ef84ab7015bb849b Reviewed-on: https://gerrit.libreoffice.org/34582 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-22lok: these are not always plain asciiPranav Kant
Change-Id: I9783b6b2839805189015dbad8a97128c89e0a4a9
2017-02-15Some simplifications, using UNO_QUERY_THROWStephan Bergmann
Change-Id: I1a2239b596201bc0172f2a6ade177c10491be9c2 Reviewed-on: https://gerrit.libreoffice.org/34255 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-05lok: Send complete anchor rectanglePranav Kant
... instead of just sending the X, Y coordinates Change-Id: Ie87b252ebfd64e806e1e5f66cfc27e77282cbaab Reviewed-on: https://gerrit.libreoffice.org/33875 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
2017-01-29cppcheck: postfix operatorJulien Nabet
Change-Id: I2b6f0c922b0e70ecbf79f60831ff5d71cd1438fb Reviewed-on: https://gerrit.libreoffice.org/33656 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-27Fix android buildPranav Kant
Change-Id: I3a39b7adc44a61f1bd4379c2a46e559ad12e7184
2017-01-27lok: Calculate and return parent comment idPranav Kant
... instead of just checking if its a root comment or reply one. Change-Id: I2539e6893ee69bfe12911807504df49edf422be2 Reviewed-on: https://gerrit.libreoffice.org/33470 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-27lok: New commandvalues command - .uno:ViewAnnotationsPranav Kant
Change-Id: I1c3560ab4609c64da7a77e9a65febeb569ec1a3c Reviewed-on: https://gerrit.libreoffice.org/33468 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-26Remove dynamic exception specificationsStephan Bergmann
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-25use rtl::Reference in SwXTextDocumentNoel Grandin
instead of storing both a raw pointer and an uno::Reference Change-Id: I94746e7fafcc7d2206ac0c1a6481e6006421529b
2017-01-23lok: New feature flag to turn off tiled annotationsPranav Kant
Change-Id: Ie418642242ada98d4a41f30bb6cefcd57f398ef0 Reviewed-on: https://gerrit.libreoffice.org/33472 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2017-01-21coverity#1399023 Unchecked dynamic_castCaolán McNamara
Change-Id: Id5d0a3cca9587f577000244a9776d7f1f61b5487
2017-01-20loplugin:staticaccessNoel Grandin
Change-Id: Ifed67e3c34663b056529719d78aa22f2a9f1da8d
2017-01-19Preserve whitespace with tiled rendering.Jan Holesovsky
Online is often used for taking minutes, and during that, people don't have time to play with the formatting - so it is annoying when autocorrect goes in the way. Change-Id: Ia1794c46d3003198764f666951821f693d710653
2017-01-14CreateBitmap takes a BitmapEx so no need to drop alphaCaolán McNamara
Change-Id: Ib0f70ea6d2a4733b16048e03d7019cf735b3b353
2016-12-14Disable the auto-completion for LibreOfficeKit for good.Jan Holesovsky
The editeng-like approach is terribly annoying when typing, particularly in bullet lists. Change-Id: I66175579f801fa028273d9680d7383d8eb37bf28
2016-12-05unroll IMG_NAVI_ENTRYBMP ImageListCaolán McNamara
Change-Id: Icb00102f064b845b33a072880c60a9aae5dc4a55
2016-11-25convert SW_CREATE to scoped enumNoel Grandin
Change-Id: I003785715df7e72cbf398902aabb5c3fe900a2d7
2016-11-21tdf#104023 - fix wrong boolean logic for RedlineFlagsJustin Luth
commit 847e004e65ec3c35acff607588d15cd75a84f121 convert nsRedlineMode_t to typed_flags ...introduced some logical equivalency errors. A few static redline functions utilize the correct logic, so use them to simplify the code readability. Change-Id: I4f5715b71dd4c8f2a6cea0c816637b1784892c0d Reviewed-on: https://gerrit.libreoffice.org/30974 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-15clang-cl loplugin: swStephan Bergmann
Change-Id: I1e0894f116e8288eb8b648ed3ac679be237806a3 Reviewed-on: https://gerrit.libreoffice.org/29845 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-12convert GET_POOLID constants to scoped enumNoel Grandin
Change-Id: Ifc54789d12d0b024ed28f13ec78b5c10afa902de
2016-10-05convert MapUnit to scoped enumNoel Grandin
I left a prefix on the names "Map" so that I would not have to re-arrange each name too much, since I can't start identifiers with digits like "100thMM" And remove RSC_EXTRAMAPUNIT, which doesn't seem to be doing anything anymore. Change-Id: I5187824aa87e30caf5357b51b5384b5ab919d224 Reviewed-on: https://gerrit.libreoffice.org/29096 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-21lok::Document::getCommandValues: expose sw redline author colorsMiklos Vajna
These colors are used in the tiles, so it's a good idea if the client can use matching colors for cursors and selections. But to be able to do that, we need an API to expose these colors. Change-Id: Ia688c07e6c300fecdf8dc428d5a3f000d1857387
2016-09-08convert nsRedlineMode_t to typed_flagsNoel Grandin
including fixing a bug in SwXMLExport::exportDoc where it was ORing with a constant from a different type: nsRedlineType_t::REDLINE_INSERT Change-Id: I2bb154c9a35d106e64fd1a8b6e928d0384c9fafe
2016-08-31convert SW_SERVICE constants to scoped enumNoel Grandin
Change-Id: I731d93f9ab77e60880365c8e2f5e62221d8da5ad
2016-08-31convert FindRanges to o3tl::typed_flags_setNoel Grandin
Change-Id: I745b2f469e44b79a06a18bc5264aae75b096835c
2016-08-31convert SwDocPositions to scoped enumNoel Grandin
Change-Id: Idd9414b4a10398130337e474fb8fd4063e3bd4f8
2016-08-18sw redlining: support per-view authorsMiklos Vajna
In case there are multiple SwView instances and SetRedlineAuthor() is called with a non-empty string on them, switching views will keep the SwModule redline author string up to date as expected. Change-Id: I363221049dbacd67d7c8f4ff3e778f8032a3bc43
2016-08-18convert SvXMLEmbeddedObjectHelperMode to scoped enumNoel Grandin
Change-Id: I12ccc8c7ba0885b3bacd0c17d430a853d327524b
2016-07-19sfx2 lok: expose part number in SfxLokHelper::notifyOtherViews()Miklos Vajna
This way a client can decide if the view cursor it gets is relevant (the views show the same part) or not. Change-Id: I7b274b28f0c4f0509df5071831acf50512eff640 Reviewed-on: https://gerrit.libreoffice.org/27311 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-07-18sw: prefix members of SwXTextSearchMiklos Vajna
Change-Id: I3231605c0468462a36d75318d0070e5e3c36f4d6 Reviewed-on: https://gerrit.libreoffice.org/27276 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-07-15sw lok: fix shape text editing with multiple viewsMiklos Vajna
When changing the active view shell, sw::DocumentLayoutManager::GetCurrentViewShell() is not instantly updated, only when e.g. the focus changes. This means that calling setView() + paintTile() pairs on random views typically did not use the matching view shell, but the last one. This has a visible effect when editing shape text, as the non-text-edit views had the outdated shape text visible, unlike on the desktop. Fix the problem by using SwDocShell::GetWrtShell() instead. Change-Id: Ia4b67d0a8931692ed4fc5c5e97cc1a09ef81e647
2016-07-08loplugin:redundantcast: redundant static_casts in swStephan Bergmann
Change-Id: I09c1ebaf5742e983ee05942a4c7c17c6aa5179cc