Commit Graph

111 Commits

Author SHA1 Message Date
Noel Grandin
4b2262ab5b new loplugin unnecessaryparen
Change-Id: Ic883a07b30069ca6342d7521c8ad890f4326f0ec
Reviewed-on: https://gerrit.libreoffice.org/39549
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-05 11:08:48 +02:00
Rosemary Sebastian
054dab1b9d nitpick, tdf#107340 follow-up
Remove unwanted variable

Change-Id: Ie1f193b55a5c957e38e8499d6d5701441bc2b7e3
Reviewed-on: https://gerrit.libreoffice.org/39547
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Rosemary Sebastian <rosemaryseb8@gmail.com>
Tested-by: Rosemary Sebastian <rosemaryseb8@gmail.com>
2017-07-05 08:07:59 +02:00
Rosemary Sebastian
fe25f95c3d tdf#107340 - Incorrect undo label with Track Changes set
Override the GetRewriter() function for the class SwUndoRedlineDelete

Change-Id: I4f7080d9d8eb79757e3e915b51f157bee29e9334
Reviewed-on: https://gerrit.libreoffice.org/39472
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2017-07-04 16:49:25 +02:00
Stephan Bergmann
1e3a00f0c7 Make SfxItemSet ranges correct by construction: Fix static cases
...with the aid of an extended compilerplugins/clang/store/sfxitemsetrewrite.cxx
(which in turn needed a small addition to compilerplugins/clang/check.hxx).

Enable svl::detail::validGap check for the static case, but keep it disabled for
now for the dynamic case.

Change-Id: I4846ba8e99aff94a86518e2cb5044e575093386e
2017-06-19 09:38:05 +02:00
Stephan Bergmann
13bb5a4b09 Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d "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-16 17:28:41 +02:00
Stephan Bergmann
6b95231a2c Improved loplugin:cstylecast to reference types: sw
Change-Id: I7206d3325b4bfedb852d559b68dc1678da524b41
2017-06-05 21:18:01 +02:00
Stephan Bergmann
b6aac4e597 Improved loplugin:redundantcast const_cast handling: sw
Change-Id: I7a420427f7be1b42907272b314cf3b864e1fe7ba
2017-06-02 13:31:09 +02:00
Michael Stahl
60901e880b sw: remove overloading of IDocumentContentOperations::Insert
Change-Id: I29114e7057262f8fd169927abc9d3186a4c74c0c
2017-05-10 18:01:08 +02:00
Caolán McNamara
6e531f337b SwBreakIt::m_xBreak is always available
this all is a hold over from the initial tentitive changeover to using it in
the first place

Change-Id: I70e28023798d8ea637c61f9fac252bc698e8100d
Reviewed-on: https://gerrit.libreoffice.org/36683
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-04-19 21:45:02 +02:00
Noel Grandin
77c1431ee8 convert SwComparePosition to scoped enum
Change-Id: I95c03e02078a1dc8878e44763502bb344dc3ac26
Reviewed-on: https://gerrit.libreoffice.org/36412
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-12 10:11:18 +02:00
Noel Grandin
3d6c84f2d9 loplugin:constantparam
Change-Id: I1996319e5b664dff95f7a9b2346aea6092d333ec
Reviewed-on: https://gerrit.libreoffice.org/36070
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-05 06:40:10 +00:00
Noel Grandin
d99d143900 convert RndStdIds to scoped enum
Change-Id: I029ad67dfcbc40f3953adf485957efcbd97f23d0
Reviewed-on: https://gerrit.libreoffice.org/35328
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-20 06:52:34 +00:00
Noel Grandin
8ae9dcec65 convert SwUndoId to scoped enum
Change-Id: I782fdd53641c0d7c629265b6179de70aa54382f9
Reviewed-on: https://gerrit.libreoffice.org/35246
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-16 07:56:25 +00:00
Noel Grandin
7f8bc0af4b convert MirrorGraph to scoped enum
Change-Id: I2eae815a10e23a7904e1aa54577a959cb8579172
Reviewed-on: https://gerrit.libreoffice.org/35179
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-15 06:45:52 +00:00
Noel Grandin
427678b9cf remove noise UUUU tags in comments
Change-Id: Id8a2940ae7348bf75ca967f31adf8489dc678d00
Reviewed-on: https://gerrit.libreoffice.org/35161
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-14 08:23:53 +00:00
Stephan Bergmann
2fdd5760b4 Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff "Use consistent integer types
in the SwRedlineTable interface".  This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about.  Lets see where it ends...

SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times.  I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed.  Some notes:

* The original code used USHRT_MAX as a "not found" value.  I replaced that with
  a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
  now of value USHRT_MAX.  This should eventually be changed to something more
  sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
  best done after we have constexpr support in all toolchains, so that npos can
  be constexpr).  It is important that the value of npos is towards positive
  infinity, as many places in the code use

    for (i = f(); // may return npos
         i < table.size(); ++i)
      table[i] ...

* There are some borders where values of SwRedlineTable::size_type are converted
  into different types, for various reasons.  But all of those other types
  should be large enough for practical purposes (at least 32 bits wide):

    MakrEntry::m_nIdx: long int
    SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
    SwRangeRedline: size_t
    SwRedlineItr: sal_Int32
    SwVbaRevision::GetPosition: sal_Int32
    SwXRedlines: sal_Int32

* .uno:TrackedChangeIndex= transports textual representations of such values.
   libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
   strings, while SwTiledRenderingTest converts them to int.

* TODO:  The one place I'm unsure about is SfxUInt16Items with IDs
  FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
  in sw/source/uibase/uiview/view2.cxx.  For now, I kept those as
  SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
  those items.  But I have no idea where instances of those items would actually
  be created, and what it would mean to change those items' types?

Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 10:06:34 +00:00
Mike Kaganski
d4036d3a89 tdf#105625 related: don't duplicate dummy character on copy
Change-Id: I5881887c7a0fd0c9ccd954a36482a3ada5103098
Reviewed-on: https://gerrit.libreoffice.org/34025
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-02-10 08:47:39 +00:00
Michael Stahl
5df348a26a sw: translate german comments
Change-Id: I1f2a4e249274a2dfd74da11553d7bb9fb35b5d53
2017-02-03 23:56:07 +01:00
Noel Grandin
b8aa1def37 convert ND constants to o3tl::typed_flags
Change-Id: I5fe3df5515017ec24db1184e8aca823714fcfdb3
Reviewed-on: https://gerrit.libreoffice.org/31343
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-29 08:20:23 +00:00
Mike Kaganski
de524d2051 tdf#95699: allow copy FORMCHECKBOX and FORMDROPDOWN ...
... when they are selected alone (no adjacent text selected).
Unit test included.

Change-Id: Ia278ae2ea86a3e6d83e1a628880f770f1eb11cd7
Reviewed-on: https://gerrit.libreoffice.org/30954
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-11-21 08:51:17 +00:00
Noel Grandin
0d05173015 loplugin:constantparam
Change-Id: Iced8ff99d52d55e6b6c3126affafbea6786e94f0
Reviewed-on: https://gerrit.libreoffice.org/30858
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-15 12:56:26 +00:00
Caolán McNamara
e8baf2d2f1 coverity#1371270 Missing move assignment operator
Change-Id: I9a5656fa3a4d4283a1daec957da9d909390d9eb2
2016-10-19 15:49:33 +01:00
Noel Grandin
ed3a4fcc87 convert GET_POOLID constants to scoped enum
Change-Id: Ifc54789d12d0b024ed28f13ec78b5c10afa902de
2016-10-12 10:11:19 +02:00
Noel Grandin
579426f798 loplugin:constantparam in sw
Change-Id: Ic49d1c3c7b57fb213964ddc21b0f774c762aad94
2016-09-08 09:23:40 +02:00
Noel Grandin
847e004e65 convert nsRedlineMode_t to typed_flags
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-09-08 09:23:40 +02:00
Tor Lillqvist
6f9750ef54 Get rid of pointless indirect function pointer variables
Change-Id: Ic8eddec51d59b531ae22421b796a148267b9f3c1
2016-08-29 14:45:32 +03:00
Stephan Bergmann
e26dfe3a29 loplugin:redundantcast: redundant static_casts in sw
Change-Id: I09c1ebaf5742e983ee05942a4c7c17c6aa5179cc
2016-07-08 16:47:31 +02:00
Mark Page
d2106d8c8c Remove the :: prefix in ::std for sw
This patch was created using a script
Variable name textual alignment is preserved to the same level

Change-Id: I6b4858f8059b8cf71fc253e87d6df634362d62e9
Reviewed-on: https://gerrit.libreoffice.org/26306
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-06-16 08:02:23 +00:00
Michael Stahl
bc387975b1 tdf#100275 sw: fix target node of bookmark copy
Replaces the defensive programming band-aid of
5c1a1d1c66 with a real fix.

The problem is that lcl_NonCopyCount() has some special case code
to ignore the first node in the target document, which erroneously is
executed for every bookmark, which results in the 2 bookmarks in the
bugdoc being created with nDelCount 1 and 2 so they land on the same
node, which is not allowed for cross-reference marks.

Extract the adjustment into a separate function that is called once.

(regression from 689962feae)

Change-Id: Ie14c650f7fdb259c13cb9048226da30971d2ab3c
2016-06-15 10:08:10 +02:00
Caolán McNamara
5c1a1d1c66 Resolves: tdf#100275 makeMark may return null under some circumstances
Change-Id: If3b83413c028c6cd1c055e632b6f050ec7f2475d
2016-06-10 14:59:27 +01:00
Noel Grandin
b415494bf0 clang-tidy modernize-loop-convert in sw
Change-Id: I1f4a0ad6658bd3154c48940296aa8edc1ea1612c
Reviewed-on: https://gerrit.libreoffice.org/24876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-12 07:12:44 +00:00
Stephan Bergmann
85825e0fd5 Avoid reserved identifiers
Change-Id: I27ff0f4f0eb395d7e0a60dd604758c220a3134c4
2016-04-22 10:08:07 +02:00
Noel Grandin
88e5fa24ea loplugin:constantparam in sw
Change-Id: I68f1594ca3f647d055f5087def74452452f86910
Reviewed-on: https://gerrit.libreoffice.org/23718
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-01 11:11:04 +00:00
Wastack
9af411abce tdf#97966 Drop 'static' keywords
Including no keywords from extern "C" blocks

Change-Id: Ie3160af9decf04ceeda02dc20a6518afaa80f972
Reviewed-on: https://gerrit.libreoffice.org/23677
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-01 06:46:33 +00:00
Noel Grandin
c17ead7dc9 loplugin:commaoperator in sw/
Change-Id: I9b00755707687e4c10c02bf49866571f2c44d8ba
2016-02-22 16:04:36 +02:00
Michael Stahl
fabc45a6a9 sw: tdf#63022 fix drag-and-drop of text in same paragraph
SplitNode() inserts new node before the existing one, so pEndTextNd and
aRg.aEnd point one node too far.

Change-Id: I6cea44fafd9d2b47e77e76892a260c5a8c6849fc
2016-02-19 17:48:10 +01:00
Juergen Funk
b0facbbedf tdf#97526 - in copy/paste ignore unwanted page break on first paragraph
In copy/paste ignore the page break attribute from the first paragraph 
of the document (see also tdf#39400)

Change-Id: I838c21c14647d4692673bd30df320e6704de1455
Reviewed-on: https://gerrit.libreoffice.org/22270
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Tested-by: Oliver Specht <oliver.specht@cib.de>
2016-02-17 07:29:40 +00:00
Andrea Gelmini
534b2a4b58 Fix typos
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-05 06:48:38 +00:00
Julien Nabet
96d6ceac91 cppcheck: fix a duplicateExpression
Change-Id: If3fadffa9b43c88552e8e2cbf213bd840ab9204a
2016-01-24 12:07:09 +01:00
Matúš Kukan
5b22663e37 Make SotFactory private to sot/ and clean a bit
Change-Id: Ia683280a3e95eee995e036db6bde5d28852f92ff
2016-01-05 20:41:11 +01:00
Caolán McNamara
533077e629 crashtesting: post NPAPI removal crash fixing
Change-Id: I99d79735c375f3d632382a8efa0202517a293b1f
2015-12-21 21:24:27 +00:00
Jan-Marek Glogowski
689962feae tdf#92623 Handle StartOfContent node for copying bookmarks
For SwDoc::AppendDoc we use the StartOfContent node as the
starting copy node to prevent merging of the first node in
CopyRange and to get a 2nd node needed for CopyRange in case
of single content node documents.

This correctly counts StartOfContent as a non-copy node when
adapting the bookmark ranges for copying.

Change-Id: Ia3ee0328a1be5548f8751aa2240812c4662fb73f
Reviewed-on: https://gerrit.libreoffice.org/20383
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2015-12-09 18:46:55 +00:00
Robinson Tryon
49c2b9808d bin/rename-sw-abbreviations.sh
This commit renames the most annoying abbreviations in Writer (and
partially in the shared code too).

Change-Id: I77e5134f42f25e3786afa36b7a505c7e3237a9e8
2015-11-25 06:07:38 -05:00
Noel Grandin
db17d3c17c new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to
use std::unique_ptr

Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc
Reviewed-on: https://gerrit.libreoffice.org/19884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-11 07:16:20 +00:00
Stephan Bergmann
01b49802c7 loplugin:nullptr (automatic rewrite)
Change-Id: I01e11fa956a249974e77dce9deebe79311f098d0
2015-11-10 10:31:53 +01:00
Michael Stahl
618fe33665 sw: replace boost::ptr_vector with std::vector
Change-Id: Ic31f92dba347017c4e25f210728d63a4048c5a25
2015-10-21 17:55:28 +02:00
Noel Grandin
ed7361ef0b cppcheck:variableScope
Change-Id: I7cbd5a9e9bb5417f754d4e2445df309140fd40af
Reviewed-on: https://gerrit.libreoffice.org/19329
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-13 06:22:33 +00:00
Oliver Specht
89d39bc100 tdf#94559: 4th step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
    idl, editeng, sc, sd, sw, sfx2, sot, starmath

Change-Id: I4a5bba4fdc4829099618c09b690c83f876a3d653
Reviewed-on: https://gerrit.libreoffice.org/19132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
2015-10-06 07:29:37 +00:00
Michael Stahl
c95ba3ef26 sw: fix copying of bookmarks in CopyRange
If the copied range starts with a not fully selected paragraph, the
bookmarks that are copied will be created on the wrong paragraphs,
on the node after the correct one.

This also happens when hinding the redlines, and causes asserts from
attempting to create CrossRefBookmarks on table nodes on WW8 export of
fdo66302-1.odt and fdo66312-1.odt.

Change-Id: Id576be3e38a89527d967f02b39d9aabbf6368354
2015-10-02 15:26:45 +02:00
Andrea Gelmini
db494c6b34 Fix typos
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-10-02 06:08:53 +00:00