Commit Graph

929 Commits

Author SHA1 Message Date
Stephan Bergmann
9fc05ce275 Simplify uses of OUString::replaceAll with literal arguments
Change-Id: I769cc6e11909c7f4c6394fdc4dec8a12b9a67af8
2015-06-19 11:04:17 +02:00
Stephan Bergmann
b2c8ea3a02 loplugin:cstylecast: deal with remaining pointer casts
Change-Id: I8d27ae80d209159690182ab91e272cf00e9f863d
2015-06-08 16:28:47 +02:00
Caolán McNamara
afe5672fbc cppcheck: noExplicitConstructor
Change-Id: I27c24d3284a8e0678fc5c041426b4a7e71cbd363
2015-05-27 13:54:54 +01:00
Jan Holesovsky
9fadc1dc47 Global CptlSttWrd and CptlSttWord -> CapitalStartWord
Change-Id: I550456ae319a6a865f2ee951a1ddf70384ce33ef
2015-05-26 12:20:27 +02:00
Jan Holesovsky
42f0f1397a Global CptlSttSntnc -> CapitalStartSentence
Change-Id: Id428332201f14b172af1590baed6aa2a67e0557a
2015-05-26 12:20:26 +02:00
Miklos Vajna
6365469272 bCptlSttSntnc -> bCapitalStartSentence
Change-Id: Ie22198837257163fd7211e93d97d97be2bca4b64
2015-05-26 09:08:03 +02:00
László Németh
86782d5dfc AutoCorrect: direct replacement of keywords surrounded by colons
Replacing immediately (without pressing space or enter) and
inside words, too. For example, fixing tdf#55292 – complete input
method for n-dash, m-dash – is possible now by  :--: -> n-dash,
:---: -> m-dash AutoCorrect replacements.

Change-Id: I54462d7482838523a47b844da6a84f08a1518b07
2015-05-25 05:21:30 +02:00
Matteo Casalin
1700fa84cd Use size_t consistently for GetFldTypeCount/GetFldType/RemoveFldType
Change-Id: Ie88af20e20f788c0d8b53f99da3decd98dec5078
2015-05-25 00:30:53 +02:00
Christian Lohmaier
ab465b90f6 bin/rename-sw-abbreviations.sh
renames the most annoying abbreviations in Writer (and partially
in the shared code too).

Change-Id: I9a62759138126c1537cc5c985ba05cf54d6132d9
2015-05-20 13:05:49 +02:00
Miklos Vajna
3c0805e1f4 tdf#86639 SwEditShell: when setting para style, reset char attrs if needed
The old internal RTF filter used to call SwTxtNode::SetAttr() without
setting SetAttrMode::NOFORMATATTR, so character attributes which cover
the whole node got converted to paragraph attributes.  The new UNO
filter goes through SwXText::insertTextPortion(), which sets
SetAttrMode::NOFORMATATTR, so this doesn't happen. The result of this is
that when the UI sets a new paragraph style on the text node, then such
character attributes are no longer removed.

Given that in RTF you can't really have character properties on a
paragraph, going back to the document model produced by the old internal
filter doesn't sound like the good direction -- not to mention that
changing SwXText::insertTextPortion() this way would be an implicit API
change.

Fix the problem by tweaking SwEditShell::SetTxtFmtColl() instead, so
that it removes these full-text-node character attributes, too. The
logic in SwTxtNode::RstTxtAttr() can be extended later if necessary to
delete more attributes, but to be on the safe side, just handle the bare
minimum necessary to fix the problem for now.

Change-Id: I5faa3226fc0f9c18e005da185fe0830d8c393256
2015-05-14 11:39:16 +02:00
Jan Holesovsky
ffae8ac241 sw: Prefix SwAutoCorrExceptWord member variables.
Change-Id: I2849aafc407e4fd0a24ea3d98043c399a9414ffe
2015-05-12 11:16:39 +02:00
Stephan Bergmann
80c2dfa225 loplugin:cstylecast: nop between pointer types of exactly same spelling
Change-Id: I0e42e757a6f7b0c28758193aad8b3cb01607b8b1
2015-05-11 12:51:13 +02:00
Noel Grandin
259820af71 loplugin:staticmethods
Change-Id: I90dd921077bbfc57200e398e7959306f26c65cfe
2015-05-05 09:30:41 +02:00
Vasily Melenchuk
bc9d02b0ca tdf#89783: sal_uInt16 replacement by size_t: sections
These replacements allow LO to load, save and mail merge documents having
more than 65536 sections in total.

Change-Id: I0e70889b1edc6e472a39f1f2638ac3c70a0d7058

Signed-off-by: Katarina Behrens <Katarina.Behrens@cib.de>
2015-05-03 23:23:00 +02:00
Matteo Casalin
358bd7bc83 Use auto and range-based for loops
Change-Id: I400bce4479eb0ab8105384f88a379c3ea90b9f66
2015-05-03 22:31:56 +02:00
Matteo Casalin
9fbb74b5b6 sal_uInt16 to size_type
Change-Id: Ib6715c5b61c718302b910a19ef557960e0f7aa93
2015-05-03 22:31:56 +02:00
Tor Lillqvist
c07a3b0396 Get rid of initial :: for the svx namespace
Change-Id: I03e428a749bca409ebac9c142acaddafcbfeca23
2015-04-30 09:11:40 +03:00
Stephan Bergmann
ff37332a81 SwEditShell::Copy return type wants to be bool
Change-Id: Id39077324630cead2584bae48dd8470335f4d1fb
2015-04-28 13:44:17 +02:00
Stephan Bergmann
a390d178b0 More loplugin:simplifybool
Change-Id: I91848b0a5a5110ca557375d8c432832033237249
2015-04-27 15:31:02 +02:00
Michael Stahl
c55599fd0e rhbz#1205072: sw: resource mangement SNAFU caused by SwPaM copy ctor
SwPaM copy ctor has the surprising habit of linking the new one into the
old one's Ring.  If you copy a shell cursor, *this* epic fail happens:

==948== Thread 6 SelectionManager:
==948== Invalid free() / delete / delete[] / realloc()
==948==    at 0x4A07CE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==948==    by 0x222F542B: SwPaM::operator delete(void*, unsigned long) (in /libreoffice-4-3/instdir/program/libswlo.so)
==948==    by 0x2239E20E: SwPaM::~SwPaM() (pam.cxx:422)
==948==    by 0x22368630: CheckRange(SwCursor*) (crsrsh.cxx:111)
==948==    by 0x2236DECC: SwCrsrShell::UpdateCrsr(unsigned short, bool) (crsrsh.cxx:1397)
==948==    by 0x22369113: SwCrsrShell::EndAction(bool) (crsrsh.cxx:290)
==948==    by 0x2268971F: SwEditShell::EndAllAction() (edws.cxx:87)
==948==    by 0x2262BEF3: SwBaseLink::DataChanged(rtl::OUString const&, com::sun::uno::Any const&) (swbaslnk.cxx:274)
==948==    by 0x2262C78E: SwBaseLink::SwapIn(bool, bool) (swbaslnk.cxx:411)
==948==    by 0x227102EC: SwGrfNode::SwapIn(bool) (ndgrf.cxx:539)
==948==    by 0x227121BC: SwGrfNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndgrf.cxx:999)
==948==    by 0x22610E4D: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1862)
==948==    by 0x225B98E0: SwDoc::CopyWithFlyInFly(SwNodeRange const&, int, SwNodeIndex const&, SwPaM const*, bool, bool, bool) const (ndcopy.cxx:1336)
==948==    by 0x224AC1FF: SwDoc::CopyLayoutFmt(SwFrmFmt const&, SwFmtAnchor const&, bool, bool) (doclay.cxx:446)
==948==    by 0x2294D2D4: SwTxtFlyCnt::CopyFlyFmt(SwDoc*) (atrflyin.cxx:130)
==948==    by 0x229A5B96: MakeTxtAttr(SwDoc&, SfxPoolItem&, int, int, CopyOrNew_t, SwTxtNode*) (thints.cxx:1060)
==948==    by 0x229A64E6: SwTxtNode::InsertItem(SfxPoolItem&, int, int, unsigned short) (thints.cxx:1224)
==948==    by 0x2298E536: SwTxtNode::CopyText(SwTxtNode*, SwIndex const&, SwIndex const&, int, bool) (ndtxt.cxx:1773)
==948==    by 0x2298DC08: SwTxtNode::CopyText(SwTxtNode*, SwIndex const&, int, bool) (ndtxt.cxx:1555)
==948==    by 0x225B4C9D: SwTxtNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndcopy.cxx:286)
==948==    by 0x22610E4D: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1862)
==948==    by 0x223EF3C2: SwNodes::_Copy(SwNodeRange const&, SwNodeIndex const&, bool) const (ndarr.hxx:182)
==948==    by 0x225B5D8D: SwTableNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndcopy.cxx:475)
==948==    by 0x22610ACA: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1790)
==948==    by 0x223EF3C2: SwNodes::_Copy(SwNodeRange const&, SwNodeIndex const&, bool) const (ndarr.hxx:182)
==948==    by 0x225CA663: SwSectionNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndsect.cxx:1270)
==948==    by 0x22610BFC: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1817)
==948==    by 0x223EF3C2: SwNodes::_Copy(SwNodeRange const&, SwNodeIndex const&, bool) const (ndarr.hxx:182)
==948==    by 0x225CA663: SwSectionNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndsect.cxx:1270)
==948==    by 0x22610BFC: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1817)
==948==    by 0x223EF3C2: SwNodes::_Copy(SwNodeRange const&, SwNodeIndex const&, bool) const (ndarr.hxx:182)
==948==    by 0x225CA663: SwSectionNode::MakeCopy(SwDoc*, SwNodeIndex const&) const (ndsect.cxx:1270)
==948==    by 0x22610BFC: SwNodes::_CopyNodes(SwNodeRange const&, SwNodeIndex const&, bool, bool) const (nodes.cxx:1817)
==948==    by 0x225B98E0: SwDoc::CopyWithFlyInFly(SwNodeRange const&, int, SwNodeIndex const&, SwPaM const*, bool, bool, bool) const (ndcopy.cxx:1336)
==948==    by 0x225B8F15: SwDoc::CopyImpl(SwPaM&, SwPosition&, bool, bool, SwPaM*) const (ndcopy.cxx:1239)
==948==    by 0x225B6EE0: SwDoc::CopyRange(SwPaM&, SwPosition&, bool) const (ndcopy.cxx:707)
==948==    by 0x22667E69: SwEditShell::_CopySelToDoc(SwDoc*, SwNodeIndex*) (edglss.cxx:244)
==948==    by 0x226C8400: SwFEShell::Copy(SwDoc*, rtl::OUString const*) (fecopy.cxx:214)
==948==    by 0x22DBF72B: (anonymous namespace)::lclOverWriteDoc(SwWrtShell&, SwDoc&) (swdtflvr.cxx:373)
==948==    by 0x22DBFBC6: SwTransferable::GetData(com::sun::datatransfer::DataFlavor const&, rtl::OUString const&) (swdtflvr.cxx:439)
==948==    by 0x7CB36C7: TransferableHelper::getTransferData2(com::sun::datatransfer::DataFlavor const&, rtl::OUString const&) (transfer.cxx:332)
==948==    by 0x7CB34B5: TransferableHelper::getTransferData(com::sun::datatransfer::DataFlavor const&) (transfer.cxx:306)
==948==    by 0x17A7E949: x11::SelectionManager::convertData(com::sun::uno::Reference<com::sun::datatransfer::XTransferable> const&, unsigned long, unsigned long, int&, com::sun::uno::Sequence<signed char>&) (X11_selection.cxx:655)
==948==    by 0x17A823CA: x11::SelectionManager::sendData(x11::SelectionAdaptor*, unsigned long, unsigned long, unsigned long, unsigned long) (X11_selection.cxx:1503)
==948==    by 0x17A82E03: x11::SelectionManager::handleSelectionRequest(XSelectionRequestEvent&) (X11_selection.cxx:1729)
==948==    by 0x17A8A08A: x11::SelectionManager::handleXEvent(_XEvent&) (X11_selection.cxx:3574)
==948==  Address 0x21e31a60 is on thread 6's stack
==948==  in frame #40, created by SwEditShell::_CopySelToDoc(SwDoc*, SwNodeIndex*) (edglss.cxx:158)

(regression from 49505336a6)

Change-Id: I3d0a288a83b4719dda7977b4898dea656ea67388
2015-04-25 23:01:13 +02:00
Stephan Bergmann
746a717ed4 loplugin:simplifybool
Change-Id: Ic90d247e6c8e36e27ff444ace10fd37e06d46b50
2015-04-24 12:36:29 +02:00
Stephan Bergmann
0b49aaf09b loplugin:implicitboolconversion gold?
The code was like that ever since 84a3db80b4
"initial import" but looks very much like the intent was to make the conditional
operator bind tighter than the less-than operator.

Change-Id: I810aa5dc56f02e98111f4879db50c59a9b69b8d6
2015-04-17 15:20:43 +02:00
Noel Grandin
a7b7c64afc convert SCRIPTTYPE_ constants to scoped enum
Change-Id: I5be3980ac865162d8d7626556ca47eca4b0ee433
Reviewed-on: https://gerrit.libreoffice.org/15344
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-04-17 07:21:08 +00:00
Stephan Bergmann
373a9b9bb6 loplugin:redundantcast: redundant const_cast followed by implicit upcast
Change-Id: I58297ba336d96358eb0683684bbd763870ef56cb
2015-04-13 12:36:36 +02:00
Tor Lillqvist
17d714eef4 WaE: variable 'i' is uninitialized when used here
Change-Id: I6c8dc01f5fb81557e3be5289ccd171037e69ae79
2015-04-12 23:48:13 +03:00
Matteo Casalin
a4c222af62 sal_uInt16 to sal_Int32
Change-Id: I163c88ff2d6e8ac2ac14b7ff585bf09f6262270e
2015-04-12 22:36:30 +02:00
Matteo Casalin
bafc6196c5 Use size() on array filled by SwEditShell::GetINetAttrs to get number of items
Change-Id: I10d05c6b635c220f2ec833e4207afbd46651aec8
2015-04-12 22:36:29 +02:00
Matteo Casalin
6106d7a237 USHRT_MAX ==> COMPLETE_STRING
Change-Id: Ie8ba1fee144177d48a91143da8bdf6f2ab05e295
2015-04-12 22:36:28 +02:00
Matteo Casalin
e456f1e86f Use more proper integer types
Change-Id: I62235badde4d7b108f7545e07c1afe96df6a3114
2015-04-12 22:36:27 +02:00
Matteo Casalin
975e35565e Use auto instead of sal_uInt16
Change-Id: Iaaf71bd7e1137ef0536c46c7fa4e78d2a6e6e162
2015-04-12 22:36:27 +02:00
Matteo Casalin
85b6a8a43c Simplify by early bail-out
Change-Id: Ia98b0712de66315b42fac4bb2978cfa206932523
2015-04-12 22:36:27 +02:00
Matteo Casalin
d9639f2226 return value of SwEditShell::GetGlobalDocContent is always discarded
Change-Id: Ib1d6ff89f378aa1e1e311cce5aaf186d843b0bef
2015-04-12 22:36:26 +02:00
Matteo Casalin
2002c37ae1 Use more proper integer types and reduce scope
Change-Id: Ib5483f857c4bddd7d0ece6b54e4d57a0347ee13a
2015-04-12 22:36:26 +02:00
Matteo Casalin
b8ca608a2a Use more proper integer types and range-for loops
Change-Id: Ie32cef06ecb742e8545e4081d7f99181f5289397
2015-04-12 22:36:25 +02:00
Matteo Casalin
721024be23 Avoid else branches after return statements
Change-Id: Ia64d2b6c94c8ead92a2f44a3c554acae5a54917f
2015-04-12 22:36:25 +02:00
Matteo Casalin
6753a14a49 getMaxLookup() can return by value and also be local inline
Change-Id: Ic8975e931992f9010dcb86761d0716c0dffb84ba
2015-04-12 22:36:24 +02:00
Matteo Casalin
4b16c2e873 Fix indentation and simplify
Change-Id: I7557fa22ffe14dd62cf6c0a3ab99323118d97b29
2015-04-12 22:36:24 +02:00
Matteo Casalin
6fbdc7cb86 Use range-for loop
Change-Id: I971bdbe38b78a9d0cba2ddbf189171fb9a21013f
2015-04-12 22:36:23 +02:00
Matteo Casalin
c860df99d2 Evaluate expression just once
Change-Id: I7557234d31dcf73c784c98cb046e40c9b11fe486
2015-04-12 22:36:23 +02:00
Matteo Casalin
243d89dd04 Simplify DelLeadingBlanks interface
Change-Id: I79d29272e8665404d08674c9853d87bba7b68694
2015-04-12 22:36:22 +02:00
Matteo Casalin
9e88862956 Use range-for loops
Change-Id: I00a7af83acd1b67e913c444aaffbe74986b589a3
2015-04-12 22:36:22 +02:00
Miklos Vajna
b23d55ccc2 tdf#88812 sw: speed up SwDoc::MakeFlyAndMove()
In this function the anchor is not set by the time CopyRange() is
called, so the check always returns false, but in worst case it's O(n^3)
wrt. the number of fly frames in the document, so it's a significant
cost to perform that check.

Before:

$ time OOO_EXIT_POST_STARTUP=1 instdir/program/soffice.bin --headless /home/vmiklos/orig.rtf
real    0m46.833s

After:

$ time OOO_EXIT_POST_STARTUP=1 instdir/program/soffice.bin --headless /home/vmiklos/orig.rtf
real    0m26.832s

Change-Id: I7ab9565634e4df7e0adc701908815f778dc59d32
Reviewed-on: https://gerrit.libreoffice.org/15197
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2015-04-08 18:39:54 +00:00
Caolán McNamara
db41e27474 Resolves: tdf#87548 don't create a new list for each multiselection portion
create one list and share it among all the subsections

possibly a regression from/triggered by

 author	Oliver-Rainer Wittmann <orw@apache.org>	2014-03-18 14:33:39 (GMT)

 Resolves: #i124371# When changing the numbering or bullet styling...  of a set
 of paragraph which have more than one different List Style applied create a new
 List Style and put the paragraphs into a new list.

 (cherry picked from commit 0087ca89e3905009ed947c651f3dc70f3d61ea93)

Change-Id: I9416b97d6afe323ac99150fdcc23f71ecea98a58
2015-04-03 12:39:12 +01:00
Michael Stahl
b24a15a0aa sw: fix crash on SwUndoDelete after select-all with table at start
Somehow the Redo leaves the shell cursor at an invalid offset into the
paragraph, which then leads to out-of-bounds string access.

Noticed that SwUndRng::SetPaM() leaves an invalid nContent.m_nIndex on
the start position, due to a surprising omission in SwIndex::ChgValue().

(regression from 555ff26501)

Change-Id: I6e6ad7f70835d7e9d6da1fb680e2ae15469fad71
2015-04-02 23:53:30 +02:00
Michael Stahl
41e4998cde tdf#87400: sw: fix ~SwIndexReg assertion in AutoCorrect
SwAutoFormat::DoUnderline() calls DeleteSel() with a SwPaM that is not
corrected, except if it's passed along directly to SwDoc methods.

(regression from f9b62506b2)

Change-Id: I741e0391e7f8e09a64bcfe99ca4d650f1016aaa7
2015-04-02 23:53:30 +02:00
Noel Grandin
4b66829390 convert BOX_LINE and BOXINFO_LINE to enum class
since their usage is intertwined.

Also introduce new o3tl utilities enumrange and enumarray to make
working with scoped enums a little simpler.

Change-Id: I2e1cc65dd7c638e59f17d96dfae504747cad6533
2015-04-01 09:36:19 +02:00
Michael Stahl
109717c9a2 sw: prefix members of SwEditShell
Change-Id: I8a06e0660767f23518952e22cca1b56c16d0bbd1
2015-03-31 20:08:39 +02:00
Stephan Bergmann
2828d92eee Clean up C-style casts from pointers to void
Change-Id: I2ec58d0bfe13fae4fc2141f9b017b5a72e0ba2c2
2015-03-28 19:09:27 +01:00
Stephan Bergmann
6f3c52bb37 const_cast: convert some C-style casts and remove some redundant ones
Change-Id: Icb14a036ea9d7636359b6bc5e0af17568c0d54cb
2015-03-26 15:33:38 +01:00
Julien Nabet
5584d73f2d Typos
Change-Id: I434be0034b26ac4719590238817538ecd90b8923
2015-03-25 20:42:37 +01:00