100 Commits
Author SHA1 Message Date
Michael Stahl 6fb9f368c6 gbuild: don't use -Wunused-macros with sccache
In at least soltools, jurt and gperf generated files, build with GCC and
sccache 0.2.16-alpha.0 reports spurious -Werror=implicit-fallthrough=
due to comments and these go away by configuring sccache with
rewrite_includes_only = true.

But his results in
cc1: error: ‘-fdirectives-only’ is incompatible with ‘-Wunused-macros’
so disable that like for clang-with-icecream builds.

Change-Id: I6dec38e86aa6e22591d7a700a8daddf3fed88b16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111716
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-02-28 21:50:03 +01:00
Michael Stahl 4041c68ea5 ios,nss: use AARCH64 consistently
Presumably missing from 1cee06c080

Change-Id: I0f658bb36179b741f6f47264ee1400633db69d6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108064
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-12-21 18:34:11 +01:00
Michael Stahl 2344f7a25a sw: split CppunitTest_sw_uiwriter into 3
It already has 3 cxx files, and takes by far the longest to run.

The split isn't ideal at 241/71/162 but still an improvement.

Change-Id: I59215475724cbf0e38b890d7be6d60a23dccf0a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108030
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-19 22:48:03 +01:00
Michael Stahl 6c1e6b188e tdf#138897 sw: avoid creating SwUndoResetAttr in CopyImplImpl()
The problem is that SwTextNode::CopyCollFormat() both creates the
SwTextFormatColl with undo and applies it with undo.

The first is desirable, the second causes a problem because it
necessarily happens after SplitNode() and currently happens before
copying the non-start/end nodes, so the node-index may not match in
Undo, regardless if it runs before or after SwUndoCpyDoc.

But SwUndoInserts restores the SwTextFormatColl on the node itself,
so it can just be suppressed, which looks easier than refactoring this
to call SplitNode() with Undo enabled.

(regression from b4365b9851)

Change-Id: I4d15fb88cd5ae4cc53d9afb3397dec8fcf7635fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107921
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-18 09:39:28 +01:00
Michael Stahl b4365b9851 tdf#134626 sw: fix UBSan warning about deleted SwTextFormatColl
sw/source/core/txtnode/ndtxt.cxx:5254:17: runtime error: downcast of address 0x612000a321c0 which does not point to an object of type 'const SwTextFormatColl'
0x612000a321c0: note: object is of type 'SwFormat'
 00 00 00 00  50 4c 3c fa bb 7f 00 00  80 b8 ba 05 50 61 00 00  c0 81 5f 02 20 61 00 00  c0 b6 b0 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'SwFormat'
 0 in SwTextNode::TriggerNodeUpdate(sw::LegacyModifyHint const&) at sw/source/core/txtnode/ndtxt.cxx:5254:17
 1 in SwTextNode::SwClientNotify(SwModify const&, SfxHint const&) at sw/source/core/txtnode/ndtxt.cxx:5306:9
 2 in SwClient::SwClientNotifyCall(SwModify const&, SfxHint const&) at sw/inc/calbck.hxx:161:80
 3 in SwFormat::~SwFormat() at sw/source/core/attr/format.cxx:240:22
 4 in SwFormatColl::~SwFormatColl() at sw/inc/fmtcol.hxx:35:26
 5 in SwTextFormatColl::~SwTextFormatColl() at sw/inc/fmtcol.hxx:56:20
 6 in SwTextFormatColl::~SwTextFormatColl() at sw/inc/fmtcol.hxx:56:20
 7 in SwDoc::DelTextFormatColl(unsigned long, bool) at sw/source/core/doc/docfmt.cxx:983:5
 8 in SwDoc::DelTextFormatColl(SwTextFormatColl const*, bool) at sw/source/core/doc/docfmt.cxx:991:5
 9 in SwUndoTextFormatCollCreate::Delete() at sw/source/core/undo/SwUndoFmt.cxx:203:12
 10 in SwUndoFormatCreate::UndoImpl(sw::UndoRedoContext&) at sw/source/core/undo/SwUndoFmt.cxx:61:9
 11 in SwUndo::UndoWithContext(SfxUndoContext&) at sw/source/core/undo/undobj.cxx:235:5

Any SwUndoFormatCreate that is added during CopyImplImpl() must go before
SwUndoCopyDoc on the undo stack.

SwNodes::CopyNodes() is pretty much the only thing of substance there
that runs with Undo enabled; CopyBookmarks() and lcl_DeleteRedlines()
and CopyFlyInFlyImpl() have it disabled.

Let's see if the fix is really this simple...

Change-Id: I4d586923f91a02861e9a4bd40d22701ceb0a0499
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107522
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-10 13:34:32 +01:00
Michael Stahl 5dbb0403b6 sw: avoid crashing in SwFrame::dumpAsXmlAttributes()
Change-Id: I86e160341e1d391ee6eaf80ab76610d95943b092
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107521
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-10 13:34:16 +01:00
Michael Stahl c797fc7681 sw: layout: SwFlyNotify should invalidate a content or tab frame
The problem happens during layout for a temporary mail merge document,
but that is probably incidental. (The SwRootFrame is the 2nd one out of
3 being createed, the one for the target document.)

The problem is that a text frame with a fly moves backward, and
~SwFlyNotify() invalidates the position of the next frame, but the next
frame is a section frame, and this does not encourage the text frame
inside the section frame to move backward at a later time, which leads
to general user unhappiness.

So invalidate the lower of the section frame too.

Change-Id: I14fa20a279979c029c468f5c6f2e5ecad4ccd240
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107360
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-12-07 22:11:46 +01:00
Michael Stahl d350af4e0c mariadb-connector-c: enable WNT-only pvio_npipe/pvio_shmem plugins
They were already compiled in some way.

Change-Id: Ic1b8563a53bad5be03bce2c0d3d2cf841e303f02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107007
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-02 13:10:51 +01:00
Michael Stahl b746633b2b tdf#135202 mariadb-connector-c: enable native_password plugin
... and remove dialog authentication plugin; it quite uselessly defaults
to asking for a password on stdin, unless a function symbol is defined
by the library that links the connector static library.

There are more authentication plugins but no idea if those are needed.

Change-Id: I88ee9629e4763fb548c3f294b552cff3d739e6cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107006
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-02 10:40:22 +01:00
Michael Stahl dee22364c5 sw_fieldmarkhide: CID#1470358: Null pointer dereferences
Change-Id: Ia61e83d9e62bc03d69ca640d3ee9ab27995b8a92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106961
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
2020-12-01 19:28:37 +01:00
Michael Stahl 6a11f94ab3 sw_fieldmarkhide: fix getFieldMarkFor() to return innermost field
... like it's supposed to; if it finds the outer field and then the next
field is inside but ends *before* the rPos then the loop is erroneously
terminated.

Change-Id: Ic5e469d1c05cecd7feca275dc1689af2c40567f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106710
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-27 09:46:29 +01:00
Michael Stahl ecc3c621fe sw: fix SwXTextRange::createEnumeration() inside table cell
This would set CursorType::SelectionInTable but leave m_pOwnTable
and m_pOwnStartNode uninitialised, causing

sw/source/core/unocore/unoobj2.cxx:399: SwXParagraphEnumeration: table type but no start node or table

and then the enumeration would return the table it's in as the first
element, which is quite annoying.

Refactor the creation of SwXParagraphEnumeration to prevent this.

Change-Id: I4e9e3456bdf66b9822d19ad985a20b094e6bbba4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106532
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-24 19:54:36 +01:00
Michael Stahl 7ab349296d sw: fix copying and deleting of section content via API
The problem happens if a section starts or ends with a table:

SwXTextSection::getAnchor() may return a SwXTextRange with one position
in a table cell and another position in a different table cell, or
outside the table, neither of which is valid to set the cursor via
SwXTextViewCurosor::gotoRange().

Introduce a new special mode for SwXTextRange, RANGE_IS_SECTION,
analogous to RANGE_IS_TABLE but actually working.

Only SwXTextView can be used to create XTransferables, and it requires
selecting first via either the SwXTextViewCursor or select().

It's currently not possible to select the content of a section in the
ViewShell in these problematic cases, and would be some effort to add.

So add a new interface XTransferableTextSupplier that can be used to
create XTransferable from the SwXTextRange with RANGE_IS_SECTION.

The core CopyRange() and DeleteRange() functions can deal with SwPaMs
that start or end in non-text-nodes, so pass the whole section content to
these in SwXTextRange::setString() and in
SwXTextView::getTransferableFromTextRange().

Change-Id: If7e3210e8a26f5618317c294f2b2f3ed5c217f1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106293
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-24 12:09:23 +01:00
Michael Stahl 93eb6a87e3 sw: exception messages for SwXTextRange
Change-Id: Iee53473ead4151348c2f02f4a83bd0bd17c46758
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106292
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-24 12:09:11 +01:00
Michael Stahl 1ab938155c desktop: rr --ignore-nested was renamed to --nested=ignore
Change-Id: Id1c1789c24b8eec27db0b24e1e43e2eb7d562509
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106291
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
2020-11-23 14:35:25 +01:00
Michael Stahl c0864f26f3 sw_fieldmarkhide: init fieldmark mode from options
Change-Id: Ied4302a60c0d7e0937b647e4e3a6a5f78ee31dc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105989
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 14:21:10 +01:00
Michael Stahl c74a2fd835 sw_fieldmarkhide: toggle mode depending on View->Field Names
... in SwViewShell::ImplApplyViewOptions()

Change-Id: Ie7b41048fe6c222272b345995fcdca4129be8ef0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105987
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 14:20:59 +01:00
Michael Stahl 69d8e5ce82 sw_fieldmarkhide: SwTextFrame::RegisterToNode(): presumably...
... need to check the equivalent condition here, that it's not merged
by fieldmark, as it is already checked that it's not merged by redline.

Change-Id: I9877ab8efb0cef2ab6bb59df5079586475088873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106128
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 14:19:52 +01:00
Michael Stahl 4cf151aa73 sw_fieldmarkhide: adapt SwUndoInsSection with ToX
... similar to commit 405661a98f.

Change-Id: Id4faa6334816f361d5543ba38af50b85dbc2b2a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106127
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 14:19:29 +01:00
Michael Stahl 3da4164755 sw_fieldmarkhide: move cursor outside of hidden fieldmark when toggling
Change-Id: If76331fa5a65376fd210171b967736f4d356462e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105988
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 11:20:22 +01:00
Michael Stahl 06498c589f sw_fieldmarkhide: remove silly check in SwTextFrame::PaintExtraData()
Used to be pointless, now it's wrong.

Change-Id: I7eaef894afa777efdcdb5545a4d238a477dea226
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106064
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 09:30:27 +01:00
Michael Stahl 92384a8131 sw_fieldmarkhide: notify layout if fieldmark is inserted or removed
... for both TextFieldmark and DateFieldmark.

Change-Id: I571703e4b43d716046fbc1f0787881c0677846c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106063
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 09:30:05 +01:00
Michael Stahl 53f17e2a0f sw_redlinehide: fix assert on Replace with nothing
SwTextNode::ReplaceText() doesn't need to notify in that case, avoids
assert in UpdateMergedParaForInsert(), seen in
testDateFormFieldContentOperations.

Change-Id: Ie80c14bc903d91a289f470f8a732932342a283be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106062
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-19 09:29:17 +01:00
Michael Stahl 53c69d392b sw_redlinehide: use correct node in SwPaM::InvalidatePaM()
(oopsie from 93b1adf744)

Change-Id: Id48ee8686aa9a6268838fe572ccc321482314442
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106046
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-18 17:00:46 +01:00
Michael Stahl 93b1adf744 sw_redlinehide: replace bogus implementation of SwPaM::InvalidatePaM()
Sending SwInsText will mess up merged paragraphs. Instead, send
SwUpdateAttr with which-id 0, which results in InvalidateRange_() being
called with at least 1 character.

This appears to be called only by fieldmark UI, and now asserts in
UITest_writer_tests5 DateFormFieldPropertiesDialog.dateFormFieldDialog.test_date_field_with_custom_format

Change-Id: I948ddefa3acece8809e4bf3d2beee6cec3ed56f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106022
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:20:30 +01:00
Michael Stahl 00abbf7592 sw_fieldmarkhide: Copy: bookmarks before MakeFrames
DocumentContentOperationsManager::CopyWithFlyInFly() needs to copy
bookmarks before creating new layout frames.

Change-Id: Ib085cd230008149a55f1527b0bbd7bb7323340a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105986
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:20:17 +01:00
Michael Stahl 84d7a46aae sw_fieldmarkhide: adapt cursor movement in SwCursor::LeftRight()
Jump over the hidden part when moving in from either side.

Change-Id: Iff6680249dfe66d6d5b1a39c4543b51a5238b075
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105985
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:20:01 +01:00
Michael Stahl aacaa2aa91 sw_fieldmarkhide: let CheckParaRedlineMerge() hide fieldmarks
HideIterator finds the next delete redline or fieldmark, whichever is
closer.

Change-Id: I4c6eac864da4b4bf531437e555a3994fd2670367
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105984
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:19:32 +01:00
Michael Stahl c33c0a16ec sw_fieldmarkhide: replace IsHideRedlines() with HasMergedParas()
... in wsfrm.cxx

Change-Id: Iaa552f2527d47f475165a3f9da073052fc76ac51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105983
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:19:15 +01:00
Michael Stahl 8d380d1fe9 sw_fieldmarkhide: replace IsHideRedlines() with HasMergedParas()
... where obvious.

Change-Id: Id941d59feea5a3539da9006725ef376b14bc7d1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105982
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:18:58 +01:00
Michael Stahl 4fccc66345 sw_fieldmarkhide: SwRedlineItr assumption that Show means no MergedPara
... in SwRedlineItr::CheckLine() and also SwRedlineItr::Seek()

Change-Id: I711ec37bd345cbf5f5f5339b8d792bcb56c425c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105980
Tested-by: Michael Stahl <michael.stahl@cib.de>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:18:35 +01:00
Michael Stahl 0fef962854 sw_fieldmarkhide: add FieldmarkMode to SwRootFrame
Change-Id: I366fe171fbcadad7643c54d76c3e28cc4b6b5dfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105981
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-17 22:18:22 +01:00
Michael Stahl b9ef71476f tdf#134298 sw: layout: remove left-over page frame without content
Once tdf#138039 is fixed, this bugdoc has an additional empty page 3.

This is because it first goes to 3 pages, and then the SwTextFrame
on page does a MoveBwd, leaving behind a page frame with just a body
frame and nothing else.

It turns out that SwRootFrame::RemoveSuperfluous() only removes
empty frames at the end of the document, but here there's a non-empty
frame following it.  Also, this function doesn't handle cases like
right/left page styles so it can't delete pages in the middle.

SwFrame::CheckPageDescs() doesn't remove page frames that don't have
content, it only removes those that have the intentionally-empty flag set.

Extend CheckPageDescs() to also remove page frames that don't have
content, and make sure it is called when SwContentFrame::Cut()
removes the last content from a page frame (it will be called after
all pages are valid in SwLayAction::InternalAction()).

(Alternatively it might be possible to prevent the problem from
 occurring in SwTextFly::ForEach() by ignoring the fly so that the first
 paragraph never leaves page 1, but we didn't explore that.)

Change-Id: I3a3f1efe6d7ed28e05dc159a86abc3d702cc272b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105810
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-16 16:51:19 +01:00
Michael Stahl 094ee3955e (related tdf#134298) sw: layout: avoid infinite loop in InternalAction()
The condition IsInterrupt() && pPage && (m_nCheckPageNum != USHRT_MAX)
isn't handled properly and the while loop will never terminate with
the fix for tdf#134298 in several UITest_writer_tests*.

If m_nCheckPageNum is set, then it must result in a call to
CheckPageDescs() here; it's a member of SwLayAction so won't survive
until the next idle layout invocation.

There is a funny history of these loop conditions with
commit 9eff9e699e
and cee296066a so we can only hope
this time we got it right...

Change-Id: I91b63540bf4280296d747cb8e841594f8dd3b140
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105927
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-16 16:50:41 +01:00
Michael Stahl 6b92d2e852 tdf#138039 tdf#134298 sw: layout: fix overlap of fly and table
The layout is horribly borked, the fly anchored in the body-level
paragraph messed with the preceding table:

page id="1" top="284" width="11905" height="16837" bottom="17120"
    tab id="3" top="794"
        row id="4" top="17121"
            fly id="8" top="16725"
    txt id="7" top="1394"
        fly ptr="0x6ce5510" id="10" top="1302"

SwTabFrame::CalcFlyOffsets() detects an overlap with the large fly, and
since it has wrap NONE it resizes to below the large image.

Then the SwTabFrame doesn't fit on the page, so it is split, but the split
fails because nDistanceToUpperPrtBottom is -720 (negative); hence it is
joined again.

Meanwhile the fly was invalidated, so now CalcFlyOffsets() ignores it and
the table shrinks again.

Once the fly is positioned again, the process repeats from the start.

Fix this in SwTabFrame::CalcFlyOffsets() by ignoring flys with wrap NONE that
extend below the body of the document and are anchored in a frame in the
next-chain of the table frame: these must move to the next page with their
anchor frame.

For the bugdoc this gives the same layout as LO 5.2.

Reportedly this problem started to happen since commit
6f5024de2e, but it's not obvious why.

Change-Id: Iafb8a6afcba634f11c5db73869313ded0fe13bbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105809
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-16 14:44:11 +01:00
Michael Stahl 8f9bbeb561 sw: fix misleading comments - SwFlyFrame::m_bAtCnt is set...
... for both AT_PARA and AT_CHAR.

Change-Id: I13a9c9cc6f4c45b08bf178336826a37126055b3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105808
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-16 11:00:15 +01:00
Michael Stahl ed564a411b mariadb-connector-c: fix makefile for GNU make 3.82
Old make thinks that ; terminates the recipe, have to escape it.
(other changes are just cosmetic)

(regression from 8c9b8c5970)

Change-Id: Ib0119511977bbff077f037fbb5975df9f860ae58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105516
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-10 14:57:31 +01:00
Michael Stahl 03a9a80125 configure: OpenSSL needs perl-FindBin to build
Change-Id: Idcea17d2418a2e847a5713293d7a225ed86bd305
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105435
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-07 18:52:07 +01:00
Michael Stahl a83e6e96b6 writerfilter: remove leftover comment
Change-Id: Idb6dbb7ccb9a254def6029bb9ba84a3b02015d70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105196
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-03 08:40:44 +01:00
Michael Stahl dd24e21bb4 sw: return SwXFieldmark in SwXFieldEnumeration
* Implement text::XTextField in SwXFieldmark
* That requires overriding XTextContent, just forward to SwXBookmark
* Also override XServiceInfo implementation in SwXFieldmark
* Add a PropertySetInfo for SwXFieldmark, which doesn't support "Hidden"
  or "Condition" properties of SwXBookmark
* in SwXFieldmark::setFieldType(), only allow sensible new types
* fix DomainMapper_Impl assumptions that if it implements XTextField
  it can't be a fieldmark, which caused CppunitTest_sw_ooxmlexport10
  testTdf92157 to fail with a SAXException caused by some disposed
  SwXTextCursor

Change-Id: I1ae2e9cb99ea784040874517e4d1af7e59d24405
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105083
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-02 15:45:40 +01:00
Michael Stahl 4ebb3eae7b check-elf-dynamic-objects: allow libgsttag-1.0.so.0
It's linked in Fedora 33 and apparently exists in gst-plugins-base
since 1.0.0.

Change-Id: Ifc5d6a6b06e05ef4e250ac26a8588a242f21a034
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105140
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-02 10:18:30 +01:00
Michael Stahl c496792847 tdf#136453 sw_redlinehide: SwUndoDelete: only create extra frames...
... at the start if the section nodes were at the start.

m_bBackSp and m_bJoinNext can't both be true.

(regression from 740f179650)

Change-Id: I999ed3809ca8f527bc3e754b229df02da4576825
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104891
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-28 08:01:53 +01:00
Michael Stahl 142dc93d9a (related: tdf#131679) sw: only unmark if this SwFlyFrame is marked
Seems kind of pointless to unmark flys that aren't deleted.

SwFEShell::SelectObj() apparently guarantees that at most 1 SwFlyFrame
is marked.

Change-Id: I061fc640512192e6e0a916020e3ac0b91c75d5c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104818
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-27 09:46:16 +01:00
Michael Stahl f63afb95b5 tdf#131679 sw: follow-up: Unmark before SetSelection()
Backporting this to 6.4, it crashes in CppunitTest_desktop_lib because
some sidebar is loaded from SwView::AttrChangedNotify()/SelectShell()
and that ends up calling SwView::StateTabWin() about 40 stack frames
later and this calls SwFEShell::GetAnyCurRect() which gets the still
selected fly but its page frame is null.

So make sure shells don't see the deleted fly.

Change-Id: I6e994b26949d195aa9f326f4da193c69b0ee59c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104815
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-26 18:50:19 +01:00
Michael Stahl 40bff2567f tdf#131679 sw: fix crash when copying fly via context menu
sw::DocumentContentOperationsManager::CopyImplImpl() is called with a
rPam that's on an SwOLENode.

The problem (which i can't reproduce in --enable-dbgutil build,
presumably for timing reasons) is that after the context menu pops up,
some idle layout runs and reformats the document and deletes a
SwFlyFrame and that calls SdrMarkView::UnmarkAllObj().

Then when SwFEShell::Copy() is called, it finds IsFrameSelected()
returns false, and it tries to copy normal text when the cursor is on
an SwOLENode.

Fix this in SwFlyFrame::FinitDrawObj() by first moving the cursor out
of any selected flys.

(regression from 81ec0039b2
 - previously CopyImplImpl() would return early)

Change-Id: Id135fcc002c03c07c34fbdc0355f2895d8b6565b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104697
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-23 16:53:55 +02:00
Michael Stahl fc87214684 tdf#137085 writerfilter: RTF import: \trpaddfl and \trpaddl are row...
...properties, not cell properties.

What is supposed to happen here, afaict:

1. \trpaddfr3 either has an effect on the left margin too (despite being
   defined for right), or \trpaddfl3 is the default, 0 is not the
   default

2. \trgaph600 should be ignored if the \trpaddfl3 is in effect

3. \trpaddl0 should be in effect, overriding both the value from
   \trgaph600 and the built-in default of #define DEF_BORDER_DIST 190

CellMarginHandler::lcl_sprm() needs to distinguish between \trpaddfl0
and \trpaddfl3 cases, but its not possible currently because a)
\trpaddfl is processed after \trgaph/\trpaddl, and b) both \trgaph and
\trpaddl produce the same srpm-id.

This fixes \trpaddl handling just enough to import the bugdoc properly,
for more fixing a new sprm-id for \trgaph would be needed at least.

At the other end, there is a line in DomainMapperTableHandler.cxx:
  m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf )
... but nothing that would initialize the GAP_HALF there.

That this bugdoc looked right before commit
c2a5346b19c57f93f210b76c15cdba64f6871203 appears to be entirely
accidental.

Change-Id: I80dc34bdd5dadb7d7d7f5ec595907035d621a656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104638
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-22 09:38:19 +02:00
Michael Stahl 1b3310a580 tdf#136385 sw: fix Undo of changing anchor type
There were a few problems here:

1. the changes to positions in
   SwAnchoredDrawObject::AdjustPositioningAttr() weren't recorded
2. the Undo of setting the anchor type ran last, which ended up calling
   SwDrawContact::Changed_() via some callback, which changed the
   position from the correct one to a wrong one
3. if the fixup for FLY_AT_PAGE is done after AdjustPositioningAttr()
   then that doesn't need to take into account the anchor type

(regression from 1de2b0d323)

Change-Id: If70408ad6140a5bec739dea176936ffcbfe3f5ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104571
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-20 22:08:00 +02:00
Michael Stahl 9e455724e5 sw: DOCX export: don't export numPr to style from outline numrule
8e9e705de2 disabled this for paragraphs
but it appears to be unnecessary for styles as well, since w:outlineLvl
will be produced, and Word displays bullets active in the UI if numPr
exists.

Change-Id: I60f7cf6359b27a4d69450752fbc4de6595d98761
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104539
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-20 09:00:25 +02:00
Michael Stahl 7221b7638c tdf#135733 sw: fix mistake in SwUndoInserts::SetInsertRange()
First init m_nDeleteTextNodes, then check it; it is inited to 1 in the
ctor so the ++m_nSttNode was skipped.

This then caused bJoinNext to be true in UndoImpl() when it should
be false.

(regression from dc7e7b94a7)

Change-Id: I74038ef7f8036581dd77341dc8372e87139bdb6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104433
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-16 21:46:41 +02:00
Michael Stahl 9b34dc20b6 tdf#137245 sw: fix AutoFormat SetBorder deleting flys
Since commit e1629c210a ReplaceRange()
will preserve flys, so split the delete into a DeleteAndJoin() just to
join the paragraphs - which should not delete any flys because it
doesn't include the "---" so isn't at the end of the section - and
a ReplaceRange for the "---".

(regression from 28b77c89df
 and e75dd1fc992f168f24d66595265a978071cdd277)

Change-Id: Ib995e41649f69963c823a463538958d533082ee7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104380
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-16 10:25:36 +02:00
Michael Stahl d3eca4177a tdf#136577 sw: fix Undo of Replace with nothing
The UI doesn't allow to replace an empty selection anyway, but it now
happens on Undo.

(regression from e1629c210a)

Change-Id: I468f28335beaeb8c42df8ed4cfc90f2c03129239
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104308
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-14 18:33:45 +02:00
Michael Stahl 48a76ea268 sw: fix unsorted redlines in SwTable::ConvertSubtableBox()
ooo12626-10.odt asserts because MoveNodeRange() handles redlines only
with an explicit flag.

(regression from e366c92881)

Change-Id: I80c6e696e51c6d9c366af30ecf8b6df265d0fc91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104286
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
2020-10-14 16:39:23 +02:00
Michael Stahl be4616d6b4 tdf#135260 sw_redlinehide: fix insert-with-delete differently
The problem with the fix for tdf#127635 is that now the cursor doesn't
move left on backspace if change tracking is on.

(regression from 398ba26077)

Revert that and fix the autocorrect position in SwWrtShell::Insert()
instead.

Change-Id: I5989a589b654fc6e5ba3dd66922af15eff758ecc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104280
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-14 15:25:47 +02:00
Michael Stahl fefc0dfdce sw_redlinehide: fix crash in SwTextNode::SplitContentNode()
Bug happens in the "top" branch of SplitContentNode().

SwTextNode::CutImpl() sends several hints to the SwTextFrame so that it
invalidates itself; a SwInsText and a SwDelText most prominently.

The SwInsText won't have an effect because the target node doesn't have
text frames yet, but the SwDelText should be sufficient to update the
text frames' MergedPara and invalidate the text frames.

The MergedPara is re-created by SwTextFrame::RegisterToNode() anyway,
but that *doesn't* invalidate the SwTextFrame.

Then an additional SwDelText is sent, which will *not* invalidate the
SwTextFrame, because its MergedPara is up-to-date so nothing gets
deleted by the hint.

It's unclear why the LockModify() is done here, since CVS initial
import, perhaps it's some premature optimization; try to remove the
manual sending of SwDelText and just let CutImpl() do it.

Also remove an odd assert in UpdateMergedParaForMove() that i don't
understand the reason for now.

Change-Id: Iba7196556f614356dba4def74f039a88f392eb0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104219
Tested-by: Michael Stahl <michael.stahl@cib.de>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-13 19:42:36 +02:00
Michael Stahl 2cb54449b4 sdext: fix use-after-free on global AccessibleFocusManager
The problem is that the destructor of the vector maFocusableObjects
ends up dispose()-ing every element, which calls back into
AccessibleFocusManager to remove the element from the vector, which
invokes its destructor a 2nd time.

Move it to the stack so it doesn't double-free itself.

ERROR: AddressSanitizer: heap-use-after-free on address 0x612001571c00 at pc 0x7fc5e723ca72 bp 0x7fffbaa8d6d0 sp 0x7fffbaa8d6c8
READ of size 1 at 0x612001571c00 thread T0
    #0 0x7fc5e723ca71 in cppu::WeakComponentImplHelperBase::release() cppuhelper/source/implbase.cxx:84:9
    #1 0x7fc595211b27 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XWindowListener>::release() include/cppuhelper/compbase.hxx:86:36
    #2 0x7fc5952093e4 in rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject>::~Reference() include/rtl/ref.hxx:113:22
    #3 0x7fc59522acd4 in void std::_Destroy<rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject> >(rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject>*) /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_construct.h:140:19

0x612001571c00 is located 64 bytes inside of 312-byte region [0x612001571bc0,0x612001571cf8)
freed by thread T0 here:
    #0 0x4be997 in free (instdir/program/soffice.bin+0x4be997)
    #1 0x7fc5ea2a5104 in rtl_freeMemory sal/rtl/alloc_global.cxx:51:5
    #2 0x7fc5952097f4 in cppu::WeakComponentImplHelperBase::operator delete(void*) include/cppuhelper/compbase_ex.hxx:66:11
    #3 0x7fc595211e07 in sdext::presenter::PresenterAccessible::AccessibleObject::~AccessibleObject() sdext/source/presenter/PresenterAccessibility.cxx:67:28
    #4 0x7fc5e74a11b4 in cppu::OWeakObject::release() cppuhelper/source/weak.cxx:233:9
    #5 0x7fc5e723cb05 in cppu::WeakComponentImplHelperBase::release() cppuhelper/source/implbase.cxx:86:18
    #6 0x7fc595211b27 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XWindowListener>::release() include/cppuhelper/compbase.hxx:86:36
    #7 0x7fc5e7194115 in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() include/com/sun/star/uno/Reference.hxx:110:22
    #8 0x7fc5e71f3944 in com::sun::star::lang::EventObject::~EventObject() workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/lang/EventObject.hdl:18:27
    #9 0x7fc5e723d395 in cppu::WeakComponentImplHelperBase::dispose() cppuhelper/source/implbase.cxx:118:5
    #10 0x7fc595211e27 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XWindowListener>::dispose() include/cppuhelper/compbase.hxx:90:36
    #11 0x7fc5e723c6e9 in cppu::WeakComponentImplHelperBase::release() cppuhelper/source/implbase.cxx:79:13
    #12 0x7fc595211b27 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XWindowListener>::release() include/cppuhelper/compbase.hxx:86:36
    #13 0x7fc5952093e4 in rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject>::~Reference() include/rtl/ref.hxx:113:22
    #14 0x7fc59522acd4 in void std::_Destroy<rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject> >(rtl::Reference<sdext::presenter::PresenterAccessible::AccessibleObject>*) /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_construct.h:140:19

Change-Id: I95151807e9182ed5f43b63792fba86f83ee0bad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104208
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-13 10:46:46 +02:00
Michael Stahl e366c92881 sw: ODF import: convert the simplest sub-tables to rowspan tables
Before OOo 2.3, CWS swnewtable, Writer represented complex table
structures as sub-tables, i.e. <table:table table:is-sub-table="true">.

Try to convert these to the modern rowspan tables, which export to
non-ODF formats much easier.

There are some cases where the result is going to look different, or
where further work is required to adapt other things in the document;
leave these alone for now.

Change-Id: I6a6c497089ef886826484d2d723bf57c72f95b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103773
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-05 19:37:50 +02:00
Michael Stahl e65b1ba003 sw: SwTable::GCLines(): don't throw away row background
If there's a row background, and a cell in the row doesn't override it,
apply the row background to the cell.

Change-Id: I37cd33249d3ab66c898c537e3bc6bab067d6f74b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103772
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-05 12:54:09 +02:00
Michael Stahl 309868c32f sw: improve comments, dump rowspan to nodes.xml
Change-Id: Ifcd011f6d55ac534c449050d07009680dcd71d51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103771
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-05 12:53:55 +02:00
Michael Stahl 926a1a16a0 tdf#101830 sw: show field name for inline input fields too
Currently if the View->Field Names is toggled,
SwViewShell::ImplApplyViewOptions() will call Reformat() and throw away
all existing portions.

So we can just create a different kind of portion altogether depending
on the value of the setting, and avoid complex multi-inheritance portion
or copying lots of code around.

This requires correcting a few assumptions that a SwFieldPortion has a
length of 0 or 1; for the input field, its length is the length of the
entire input field including CH_TXT_ATR_INPUTFIELDSTART/END (unless it's
a follow/rest portion, those are length 0 as always).

For the cursor travelling, LeftRight() works similar to
f6a60ce214117946eef222701023dca612bf0a2b, while UpDown() and mouse click
positioning need tweaks in SwTextCursor::GetModelPositionForViewPoint()
to take the field length into account.

Due to the previous point, mouse click related functions in edtwin.cxx
require checking the position at the start now.

When enabling Field Names, move any shell cursors out of input fields.

Change-Id: I1304f419bd6fa20f0c55fd1b13165c4866d64000
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103155
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-25 10:40:49 +02:00
Michael Stahl 68aec8fd57 tdf#134782 sw,unotools,officecfg: adapt configuration and UI
Store AddParaLineSpacingToTableCells in configuration as
"AddTableLineSpacing", consistently inconsistent like AddTableSpacing
(the <desc> elements are not subject to translation).

Adapt SwCompatibilityOptPage with some ugly hacks to allow 3 different
states (TriState) for the corresponding checkbox that map to false/false,
true/false and true/true.

The checkbox widget doesn't allow to change *to* indeterminate but at
least the status of the document can be displayed this way,
with a non-obvious tweak to optcompatpage.ui to reference "checktri1"
column.

Change-Id: I5f32e05c93b5e16e782cba5d1d055809d9e5e251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103318
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-24 20:58:13 +02:00
Michael Stahl 38aa699f26 tdf#134782 sw: split AddParaSpacingToTableCells flag in 2
commit 3cccdabf19a99fd3f657985c1822436d7679df2b "extend
AddParaSpacingToTableCells with line spacing" changed how the
ADD_PARA_SPACING_TO_TABLE_CELLS compat flag works, to improve interop
with Word.

This commit splits out the change as a separate new compat flag
ADD_PARA_LINE_SPACING_TO_TABLE_CELLS ("AddParaLineSpacingToTableCells"),
to preserve compatibility with ODT documents that were produced
by LO < 6.4 (via SwXMLImport::SetConfigurationSettings()).

New documents and WW8/RTF/DOCX import have both flags enabled.

The combination false/true is invalid, and treated as equivalent
to false/false.

Change-Id: Ida20df8fe4a8192a714f91da95345f9726fd7d98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103317
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-24 20:56:27 +02:00
Michael Stahl fdc8590032 tdf#136620 tdf#136708 filter,oox,sw: fix export of 2 different wraps
This reverts commit 2cb90a5c87.

Revert the change to EscherPropertyContainer, which was completely
bogus, based on pre-existing bogus code in VMLExport::Commit().

The problem is that ESCHER_Wrap values are for wrapping text *inside* a
text box, which is "mso-wrap-style" in VML, whereas VML's w10:wrap
element defines how text wraps *around* a shape, doesn't exist as an
ESCHER property and is specific to Word formats.

Instead, export the w10:wrap element in VMLExport::EndShape().

This has 2 callers, WriteActiveXControl() and writeVMLDrawing().

Furthermore the value "none" wasn't written for WrapTextMode_THROUGH,
which caused the wrap element to be omitted in that case.

Change-Id: Id4a01fcb2ea73fa9bef4ee8769b5e0680e059f15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103009
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-21 11:02:20 +02:00
Michael Stahl 54bd2266d6 tdf#136855 writerfilter: RTF import: buffer annotations inside tables
The problem is that one of the annotations is inside a table that
happens to start with a covered cell (vertically merged).

The table row is buffered, but the annotation is not, so it is inserted
before any of the text of the table cells is inserted, so it ends up in
the covered cell.

The strucuture of annotations is a bit icky; to fix this, buffer both the
\annotation destination and \atrfstart \atrfend start and end
destinations.

Change-Id: Ie955a75a2d254f8d7e965259698b688eece7cbd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103016
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-21 10:47:42 +02:00
Michael Stahl fefcad1186 tdf#135879 sw: fix bookmark dialog's Delete button
(regression from cb5d18871b)

Change-Id: Ic8c66504a760ef26fbf95a5a1a13b37346982024
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103015
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-21 10:47:00 +02:00
Michael Stahl 806b82d89f sw: fix crash in SwInputWindow::ApplyFormula()
pView is null because the constructor is called from:

10 0x00007fcf1e4d5796 in SfxDispatcher::Update_Impl(bool) (this=0x70a8f40, bForce=false) at sfx2/source/control/dispatch.cxx:1112
11 0x00007fcf1e975c97 in SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) (this=0x72684f0, i_eConnect=SfxBaseController::E_CONNECT) at sfx2/source/view/sfxbasecontroller.cxx:1249

but the active is set later, from:

0  SfxApplication::SetViewFrame_Impl(SfxViewFrame*) (this=0x38f32d0, pFrame=0x7255b30) at sfx2/source/appl/app.cxx:265
1  0x00007fcf1e99025c in SfxViewFrame::SetViewFrame(SfxViewFrame*) (pFrame=0x7255b30) at sfx2/source/view/viewfrm.cxx:3326
2  0x00007fcf1e989181 in SfxViewFrame::MakeActive_Impl(bool) (this=0x7255b30, bGrabFocus=true) at sfx2/source/view/viewfrm.cxx:1931
3  0x00007fcf1e975d2d in SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) (this=0x72684f0, i_eConnect=SfxBaseController::E_CONNECT) at sfx2/source/view/sfxbasecontroller.cxx:1253

This can only be reproduced if the SwInputWindow is visible in the
configuration, but it is closed automatically on document close, so not
sure how i got into this situation; Ctrl+C while it's visible can
reproduce this anyway.

Change-Id: Iae2c7b6044bfea5cb627804d3b88dde2a83732bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102875
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-17 12:32:27 +02:00
Michael Stahl 8f098afced sw: remove dead code in lcl_FillBookmarkArray()
Change-Id: Idb9fbac5bd1c74f8ccd434a2337daea58b624e57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102738
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-16 16:56:43 +02:00
Michael Stahl cca02a2fbd sw: don't throw if disposed in SwXRedlinePortion::getPropertyValue()
No other SwXTextPortion method does that, so avoid it here for
consistency, just return void.

Change-Id: Iae9b6b12e21609e315a9f269feb0703657bbf3cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102691
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-15 11:15:00 +02:00
Michael Stahl 1d6e919046 tdf#135056 sw_redlinehide: when moving sections to undo nodes-array,
... delete frames with utmost prejudice - the code that was checking
for empty frames or cells was going into infinite loop because
first the *outer* section is moved to the undo nodes array, then when
the *inner* (index header) section is moved, its section node's
m_pStartOfSection points to the section node that is already in
undo nodes array and so SwNodes::GoPrevSection() goes very wrong
and CheckNodesRange() is called with positions in 2 different arrays.

(regression from a60dd9ef13)

Change-Id: I5682ebc2081ffc7dc49a9c43e613f72c26e93673
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101755
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-01 08:15:53 +02:00
Michael Stahl a609bc9cc0 tdf#135661 sw: fix Undo of text deletion of SdrObject
This creates a non-working SwXShape without m_pFormat initialised:

0  SwXShape::SwXShape(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, SwDoc const*) (this=0x278de80, xShape=uno::Reference to (SvxCustomShape *) 0x73ec840, pDoc=0x0) at sw/source/core/unocore/unodraw.cxx:889
1  SwFmDrawPage::CreateShape(SdrObject*) const (this=0x637a980, pObj=0x6409410) at sw/source/core/unocore/unodraw.cxx:372
2  SdrObject::getUnoShape() (this=0x6409410) at svx/source/svdraw/svdobj.cxx:2836
3  GetXShapeForSdrObject(SdrObject*) (pObj=0x6409410) at svx/source/unodraw/unoshape.cxx:3928
4  SdrObjCustomShape::GetCustomShapeEngine() const (this=0x6409410) at svx/source/svdraw/svdoashp.cxx:381
5  SdrObjCustomShape::GetTextBounds(tools::Rectangle&) const (this=0x6409410, rTextBound=...) at svx/source/svdraw/svdoashp.cxx:534
6  SdrObjCustomShape::AdaptTextMinSize() (this=0x6409410) at svx/source/svdraw/svdoashp.cxx:1397
7  SdrObjCustomShape::NbcSetSnapRect(tools::Rectangle const&) (this=0x6409410, rRect=...) at svx/source/svdraw/svdoashp.cxx:1421
8  SdrObjCustomShape::handlePageChange(SdrPage*, SdrPage*) (this=0x6409410, pOldPage=0x0, pNewPage=0x627fc80) at svx/source/svdraw/svdoashp.cxx:2855
9  SdrObject::setParentOfSdrObject(SdrObjList*) (this=0x6409410, pNewObjList=0x627fc80) at svx/source/svdraw/svdobj.cxx:294
10 SetParentAtSdrObjectFromSdrObjList(SdrObject&, SdrObjList*) (rSdrObject=..., pNew=0x627fc80) at svx/source/svdraw/svdpage.cxx:65
11 SdrObjList::NbcInsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/svdraw/svdpage.cxx:305
12 SdrObjList::InsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/svdraw/svdpage.cxx:358
13 FmFormPage::InsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/form/fmpage.cxx:79
14 SwDrawContact::InsertMasterIntoDrawPage() (this=0x640d6b0) at sw/source/core/draw/dcontact.cxx:1909
15 SwDrawContact::SwClientNotify(SwModify const&, SfxHint const&) (this=0x640d6b0, rMod=..., rHint=...) at sw/source/core/draw/dcontact.cxx:1457
16 SwModify::CallSwClientNotify(SfxHint const&) const (this=0x640d090, rHint=...) at sw/source/core/attr/calbck.cxx:373
17 sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const (this=0x640d090, rHint=...) at sw/source/core/attr/calbck.cxx:378
18 SwUndoFlyBase::InsFly(sw::UndoRedoContext&, bool) (this=0x78cdfd0, rContext=..., bShowSelFrame=false) at sw/source/core/undo/undobj1.cxx:97
19 SwUndoDelLayFormat::UndoImpl(sw::UndoRedoContext&) (this=0x78cdfd0, rContext=...) at sw/source/core/undo/undobj1.cxx:440
20 SwHistoryTextFlyCnt::SetInDoc(SwDoc*, bool) (this=0x60d14c0, pDoc=0x625aa30) at sw/source/core/undo/rolbck.cxx:581

Whereas if the shape is selected and deleted that way, a completely
different Undo is created, which doesn't have this problem:

0  SwXShape::SetFrameFormat(SwFrameFormat*) (this=0x2497d50, pFormat=0x564b470) at sw/inc/unodraw.hxx:206
1  SwXShape::AddExistingShapeToFormat(SdrObject const&) (_rObj=...) at sw/source/core/unocore/unodraw.cxx:945
2  SwDrawContact::SwDrawContact(SwFrameFormat*, SdrObject*) (this=0x6bad330, pToRegisterIn=0x564b470, pObj=0x5647880) at sw/source/core/draw/dcontact.cxx:709
3  SwUndoDrawDelete::UndoImpl(sw::UndoRedoContext&) (this=0x56ebcd0, rContext=...) at sw/source/core/undo/undraw.cxx:501

In SwUndoDelLayFormat, the SdrObject is apparently removed from SdrPage
and the SwDrawContact remains, whereas in SwUndoDrawDelete, the
SdrObject remains on SdrPage but is moved to invisible layer, and
SwDrawContact is destroyed (presumably).

Include obligatory rant why sw has 2 undos doing the same thing here.

(reportedly regression from 2d89b9929e
 but probably this can be triggered before, at least since
 91b2325808)

Change-Id: I4fbb3620bfe1ac07f47e4441625797db7a87cecd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101740
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-01 08:15:43 +02:00
Michael Stahl 586750da40 tdf#135001 sw_redlinehide: fix IsShown() for AT_PARA flys
There is one merged text frame from node 102 to node 328 with no
extents, and of course a shape anchored at node 271 should not be
visible at all.

This crashes because the shape was removed from the layout during
CheckParaRedlineMerge() but then moved to the visible heaven layer
again via sw::AddRemoveFlysAnchoredToFrameStartingAtNode() and the
layer determines if it's visible as far as Sdr* is concerned;
it lacks a connection to a SwFrame though.

warn:legacy.osl:3547848:3547848:sw/source/core/layout/paintfrm.cxx:3861: <SwFlyFrame::IsPaint(..)> - paint of drawing object without anchor frame!?

(regression from 6aaae44da3)

Change-Id: Ia20449b3a7d251f0c049eb979c88df1e80cd7d5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101584
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-31 12:41:22 +02:00
Michael Stahl 92f308fdc4 test: fix misleading documentation of assertXPathNoAttribute()
Change-Id: I5bb603fe1d615f7df790bcd352beb09d65dcb3a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101536
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Michael Stahl <michael.stahl@cib.de>
2020-08-28 12:33:57 +02:00
Michael Stahl d84e590486 sw: DOCX export: don't export text frames as transparent
Writer paints text frames without fill still as opaque but nothing is
written in the DOCX file and Word by default treats DrawingML text frame
as transparent (the VML fallback is opaque though).

Change-Id: I0ce539ac8084c5047b4732abc5c199589ee369ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101411
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-26 20:44:07 +02:00
Michael Stahl a64511dc92 tdf#135018 sw_redlinehide: fix accept delete redline at start of body
There is no predecessor text node.

(regression from 34b32f56e7)

Change-Id: I5f6a1a7a1a35a2a6e600166dc1afcf6c4bf9d389
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101337
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-25 19:59:41 +02:00
Michael Stahl e2fe4fde59 (related: tdf#132160) sw: fix lcl_RejectRedline if end is on table node
This happens on Undo:

sw/source/core/undo/undobj.cxx:1394: void SwRedlineSaveData::RedlineToDoc(const SwPaM&): Assertion `result != IDocumentRedlineAccess::AppendResult::IGNORED' failed.

Because the SwRedlineSaveData was created in SwUndoDelete ctor from
this:

(rr) p *pRedl
$18 = (SwRangeRedline) {
  <SwPaM> = SwPaM = {
    point = SwPosition (node 13457, offset 0),
    mark = SwPosition (node 13455, offset 0)
  },
(rr) p pRedl->GetPoint()->nNode.GetNode().GetNodes()[13457]
$19 = (SwTableNode *) 0x80bdbe0

DelFullPara() will delete the end node, see "m_rDoc.GetNodes().Delete(
aRg.aStart, nNodeDiff+1 );" or equivalent in SwUndoDelete.

So if the end is on a start node, set it back to the previous node,
because deleting just a start node is a bad idea.

Change-Id: Ib7c35c103ce05ede39e66505fa47fa70bfece018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101334
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-25 17:46:53 +02:00
Michael Stahl 0bbc397dc5 tdf#132160 sw_redlinehide: more pathological redline problems
This is similar to 63dba5203e except here
the redline starts with a section (in particular an entire alphabetical
index); this one is at node 13489 to node 14206.

There's another fun one, starts with a table but has a text node
following it, at node 8222 to 8231; this case also wasn't handled
correctly at least in one direction.  Fix that by continuing iteration
of text-nodes once table/section at the start are handled.

(regression from d258fc2956)

Change-Id: I3f75ad473881f01be80d2c3804b9ac209f430bdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101287
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-25 16:31:30 +02:00
Michael Stahl a58fe88b5b tdf#135721 sw: fix SwSpellPopup::Execute() deleting flys
Follow-up to ec579354af :
in 6.4, this is the location of the spell check menu code; not sure
how to call this but it has the same bug...

(regression from 28b77c89df)

Change-Id: I0e6ce9c97d810f7c92dff320d403c986a947c266
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101073
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-20 15:11:20 +02:00
Michael Stahl ec579354af tdf#135721 sw: fix spell check context menu deleting flys
Kind of similar to e1629c210a
but the problem is at a higher level: SwTextShell::Execute() with
SID_SPELLCHECK_APPLY_SUGGESTION should not DelLeft() + Insert() but
just Replace().

(regression from 28b77c89df)

Change-Id: I78487c7841ba22ccc6751240a8e55e08a86fba32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101014
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-20 13:47:08 +02:00
Michael Stahl dd7caf3cfd xmloff: ODF export of page style: don't export draw:fill
... attributes on header-style and footer-style in strict ODF.

Change-Id: Ic1af26b6112a5afbb70a82b29dbacd3dcec14ec3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101012
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-20 10:56:02 +02:00
Michael Stahl 6c55d0ea39 sw: remove misleading initialisation from SwUndoInsLayFormat
Change-Id: I5577b388b565cdab6dcf60721f0f90d2987dac05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101005
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-20 10:55:33 +02:00
Michael Stahl 10ae7ba661 tdf#135412 tdf#135888 sw: fix copying of linked text-boxes
The resetLink()/restoreLinks() were added in commit
00a007be5a because testMissingPath
missing-path.docx was crashing.

But then 0bcc5b3dae refactored how linking
works and introduced the isTextBox function, which is called in the
middle of DocumentContentOperationsManager::CopyFlyInFlyImpl() after
resetLink(), and this now always returns false, the same for another
call inside CopyLayoutFormat() (when called from CopyFlyInFlyImpl()),
which causes text-boxes to be copied to 2 separate flys (tdf#135888).

The problem in tdf#135412 is that somehow when called from
SwFEShell::Paste() the content-index from the clipboard document ends up
in the SwDrawFrameFormat that is created in the target document,
and this causes crash in Undo because the node index is out of bounds.

 10 SwUndoInsLayFormat::UndoImpl (this=0x7c2a760, rContext=...) at sw/source/core/undo/undobj1.cxx:310
(rr) p rContent.GetContentIdx()->GetNode().GetDoc()->IsClipBoard()
(rr) $29 = true

It turns out that missing-path.docx doesn't crash any more without
resetLink(), and removing it fixes the 2 bugs.

Change-Id: I0c6c91a42e00b9f3b79b774c814e7323f2bb3e05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101004
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-19 19:03:40 +02:00
Michael Stahl c7d1bb119d nss: fix Android build
Change-Id: I8d6704a00ee70c1cb397f8f12dac8050f24f44be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100917
Tested-by: Michael Stahl <michael.stahl@cib.de>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-18 15:38:45 +02:00
Michael Stahl 14fd4b5411 tdf#135457 sw: fix invalidation of SwXTextField
This was supposed to happen from SwNodes::ChgNode() when moving to the
undo nodes array.

There are fields with a range that contains other fields, when the outer
field's range is deleted, the contained field moves to the undo array
and its position is no longer valid to be given out by
SwXTextField::getAnchor().

(regression from c73b5e969b)

Change-Id: I38c8b3393a777ca8dc8739b5ca4233a7f124961e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100749
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-14 19:39:54 +02:00
Michael Stahl f3cb59c463 tdf#134746 sw: fix redline hiding of at-char fly on empty paragraphs
If a merged paragraph has no extents, a fly anchored at the start or at
the end should be shown.

(regression from 28b77c89df)

Change-Id: I78135f3c033cf08aad81c86b0ac693528e3f3f8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100543
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-14 16:56:58 +02:00
Michael Stahl 68cc91cd2c sw: MS Word export: don't insert section breaks in field instructions
MSWordExportBase::NeedTextNodeSplit() simply uses the soft-page-break
positions to potentially insert section breaks - but now that Writer can
display field instructions, it's quite silly to insert section breaks
inside them.

Change-Id: Ie57e6281a0287aac36984e5467920852db19a8ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100661
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-13 16:58:17 +02:00
Michael Stahl 5364c08157 sw: avoid assert when deletion starts at fieldmark end
This hit assert(bSavePos && bSaveOtherPos);

Tweak SwUndoSaveContent::DelContentIndex() for fieldmarks to only accept
an equal end position if the start position was in range as well.

(regression from 24fd14b387)

Change-Id: If6c9b049193bb7f1bc39ec66d1c965512f9d6ec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100660
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-13 16:58:09 +02:00
Michael Stahl 99ef50f97b tdf#128198 sw: text formatting: only consider upper margin for first line
The non-first lines start below the first one so the margin is already
included in the previous line's Y position.

Also move the testTdf116486 to layout.cxx.

(regression from d07fc485d4)

Change-Id: I574516ea5f9600e2d861e43162b1a69488c68819
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100440
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-11 15:02:42 +02:00
Michael Stahl 495a5944a3 nss: upgrade to release 3.55.0
Fixes CVE-2020-6829, CVE-2020-12400 CVE-2020-12401 CVE-2020-12403.
(also CVE-2020-12402 CVE-2020-12399 in older releases since 3.47)

* external/nss/nss.nspr-parallel-win-debug_build.patch:
  remove, merged upstream

Change-Id: I8b48e25ce68a2327cde1420abdaea8f9e51a7888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100345
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-10 11:39:38 +02:00
Michael Stahl 8d83c29905 oox: VML export: convert ESCHER_Prop_AnchorText to v-text-anchor
Change-Id: I903cac8d7b02138680613b5a1b6dab4b1c448158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100333
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-07 18:26:46 +02:00
Michael Stahl 2af2b9be05 oox: VML export: produce bottom-to-top in a better way
Replace code added in 090c61eb93
with something that uses the already generated ESCHER property; this
lets a warning about the unhandled property disappear too.

Change-Id: Ieed83dd8e17e92eea9901124fce5e6da2a17196a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100332
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-07 18:26:00 +02:00
Michael Stahl 2cb90a5c87 filter: MSO export: convert TextWrap property to Escher_Wrap*
There's a paucity of working wrapping modes in Escher unfortunately.

Change-Id: Ibaf99c3249a6492dc129f9c9b5707778038f9a4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100331
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-07 18:25:31 +02:00
Michael Stahl 090c61eb93 oox: VML export: for rotated text shape, produce bottom-to-top
This is for shapes that fail the lcl_isTextBox() check in
VMLExport::StartShape(), they can be rotated too but with a different
property than the "TextPreRotateAngle" that is used in
VMLExport::EndShape().

Change-Id: I530aae8b7138f47bae8434e205632f5f4adbb231
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100249
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-06 17:56:32 +02:00
Michael Stahl ee9cb297c5 schema: add fieldmarks to LO schema
Change-Id: I4ff445a9cf70a3a918d9a47f9bf615167f85958b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100180
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-06 14:01:14 +02:00
Michael Stahl 1de2b0d323 tdf#135464 sw: avoid invalid combinations of HoriOrientRelation and FLY_AT_PAGE
... when using Anchor->To Page context menu.

For shapes, in SwDoc::ChgAnchor() and for sw flys in
SwDoc::SetFlyFrameAnchor().

Change-Id: I7d747b2558ef69df99636ea0fb0409deb461a79a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100131
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-06 11:25:35 +02:00
Michael Stahl 12645900de tdf#135464 sw: ODT->DOCX: fix positioning of at-page shapes and frames
Exporting at-page anchored flys to DOCX can result in wrong positions,
because DocxSdrExport::startDMLAnchorInline() converts
text::RelOrientation::FRAME to relativeFrom="column", i.e. the margin,
but sw displays it as relative to the page.

In fact at-page and FRAME is an invalid combination according to the
table in ODF 1.3, 20.298 style:horizontal-pos, the paragraph and
character relations are not valid for page-anchored flys.

Since there are lots of ODT files with this invalid combination, try to
fix it on import, in SwXFrame and SwXShape.

Funnily, SwXShape is attached before the properties are set, while
SwXFrame is attached after the properties are set.

The anchor frame for at-page is always a SwPageFrame.

Unfortunately there is a case where PRINT_AREA and PAGE_PRINT_AREA
differ, namely the CalcClipRect() only handles PRINT_AREA so it will
crop to the right margin with that but not with PAGE_PRINT_AREA,
so don't map this value.

Change-Id: I4d5f7f87d045ac4539b9170e55c34d4afe801f4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100130
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-06 11:25:19 +02:00
Michael Stahl 2a58902f0e gpgpmepp: fix creative abuse of gbuild
The problem was that (cd sw && make CppunitTest_sw_ooxmlexport4) fails
with an error that the gpgmepp package doesn't exist, but only on WNT.

Nonobviously, this is due to the override of the rule for the gpgmepp
package in ExternalPackage_gpgmepp.mk, which copies the same file that
the package already depends on for no obvious reason.

Furthermore, RepositoryExternal.mk uses
gb_Helper_register_executables_for_install with gpgme-w32spawn,
when it should just register the package instead, because that is not a
gbuild Executable.

Change-Id: I8cb8b7a68c9681844a39de1390aa736a1ec53449
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100159
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-05 13:36:13 +02:00
Michael Stahl af38654b4b tdf#135144 sw: copy bookmarks in SwDoc::CopyMasterHeader()
... and SwDoc::CopyMasterFooter(); this is the same as commit
9f7ee38ace but for 2 other functions that
do the same thing.

Change-Id: Id7ed449a004ee3c9452d4603bf8632e2720651ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100077
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-04 15:38:53 +02:00
Michael Stahl aed92491f3 tdf#134965 sw: avoid RemoveFollowFlowLine() SNAFU
A follow-flow-line SwRowFrame is deleted in RemoveFollowFlowLine()
while it is being iterated in stack frame #18.

0  SwRowFrame::~SwRowFrame() (this=0xaa035b0, __in_chrg=<optimized out>) at sw/source/core/layout/tabfrm.cxx:3807
1  SwFrame::DestroyFrame(SwFrame*) (pFrame=0xaa035b0) at sw/source/core/layout/ssfrm.cxx:389
2  SwTabFrame::RemoveFollowFlowLine() (this=0x9c16790) at sw/source/core/layout/tabfrm.cxx:945
3  SwTabFrame::MakeAll(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2203
4  SwFrame::PrepareMake(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
5  SwFrame::Calc(OutputDevice*) const (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
6  SwFrame::PrepareMake(OutputDevice*) (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
7  SwFrame::Calc(OutputDevice*) const (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
8  SwFrame::PrepareMake(OutputDevice*) (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
9  SwFrame::Calc(OutputDevice*) const (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
10 SwFrame::PrepareMake(OutputDevice*) (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
11 SwFrame::Calc(OutputDevice*) const (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
12 SwFrame::MakePos() (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:552
13 SwTextFrame::MakePos() (this=0x925bc20) at sw/source/core/text/frmform.cxx:339
14 SwContentFrame::MakeAll(OutputDevice*) (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:1408
15 SwFrame::PrepareMake(OutputDevice*) (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
16 SwFrame::Calc(OutputDevice*) const (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
17 SwContentFrame::CalcLowers(SwLayoutFrame&, SwLayoutFrame const&, long, bool) (rLay=..., rDontLeave=..., nBottom=168478, bSkipRowSpanCells=true) at sw/source/core/layout/tabfrm.cxx:1521
18 lcl_RecalcRow(SwRowFrame&, long) (rRow=..., nBottom=168478) at sw/source/core/layout/tabfrm.cxx:1651
19 SwTabFrame::MakeAll(OutputDevice*) (this=0x93ec7e0, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2421
20 SwFrame::PrepareMake(OutputDevice*) (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:316
21 SwFrame::Calc(OutputDevice*) const (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
22 GetFrameOfModify(SwRootFrame const*, SwModify const&, SwFrameType, SwPosition const*, std::pair<Point, bool> const*) (pLayout=0x72aa850, rMod=..., nFrameType=(SwFrameType::Txt | SwFrameType::NoTxt), pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/layout/frmtool.cxx:3697
23 SwContentNode::getLayoutFrame(SwRootFrame const*, SwPosition const*, std::pair<Point, bool> const*) const (this=0x6fcfb50, _pRoot=0x72aa850, pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/docnode/node.cxx:1194
24 SwCursorShell::GetCurrFrame(bool) const (this=0x72a9730, bCalcFrame=true) at sw/source/core/crsr/crsrsh.cxx:2455
25 SwFEShell::GetAnyCurRect(CurRectType, Point const*, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&) const (this=0x72a9730, eType=CurRectType::PageCalc, pPt=0x0, xObj=empty uno::Reference) at sw/source/core/frmedt/fews.cxx:113
26 SwView::StateStatusLine(SfxItemSet&) (this=0x72af430, rSet=SfxItemSet of pool 0x6fa3d50 with parent 0x0 and Which ranges: [(10000, 10000), (10221, 10221), (10223, 10225), (11064, 11065), (21182, 21182), (21185, 21185), (21189, 21189)] = {...}) at sw/source/uibase/uiview/view2.cxx:1517

Not obvious why this changed with calling MakeFrames() instead of
SwNodes::CopyNodes(bNewFrames=true) or how to best prevent it; adding
another FrameDeleteGuard avoids the crash at least.

(regression from 166b5010b4)

Change-Id: Ifd5a0c93064c9536429dda30a2c4ebc7a31b7e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99870
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-31 16:31:00 +02:00
Michael Stahl 5f7b937e9f tdf#134931 sw_redlinehide: fix layout following paste of table
The pasted table does get a SwTabFrame but the problem is that
TurboAction() is called and formats the pre-existing SwTextFrame and
somehow that just sets all the valid flags on the new SwTabFrame without
doing any formatting.

Previously, SwNodes::CopyNodes(bNewFrames=true) would call
SwTabFrame::Paste() which invalidates the page.

In InsertCnt_(), for new SwSectionFrames InvalidatePage() is already
called so do the same for SwTabFrame which gets rid of the "turbo".

(regression from 166b5010b4)

Change-Id: I970a04bd8e76f5418bddb66af915ac466f44daf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99867
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-31 15:31:39 +02:00
Michael Stahl 22a77cb83a tdf#134436 sw: fix SwUndoDelete::RedoImpl() with section at end...
... of document; the root cause is that in some intermediate delete
operation, the delete will remove a section start/end node pair that
surrounds the last text node in the document, but
SwUndoDelete::RedoImpl() will not remove it, thus for subsequent Undo
actions the indexes are messed up and weird things happen.

Fix this in DocumentContentOperationsManager::DeleteRangeImplImpl(),
with the same weird "is point at the end" check as SwUndoDelete.

Change-Id: Iebf20d3c129c69692df8d57e3c5b9e6fec281e4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99810
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-31 11:48:51 +02:00
Michael Stahl 740f179650 tdf#134252 sw_redlinehide: fix SwUndoDelete for table before end of section
In this funny case, the SwPaM starts inside a section, and ends in the
first text node following the end of the section, which happens to be in
a different section (but that doesn't matter)... this is because
IsSelOvr() moves the end of the selection resulting in the 3rd SelAll
off of the table end node (as the section ends with a table), but then
it's on the section end node and moves forward again.

SwUndoDelete::UndoImpl() must first create the outer section frames,
skip over the start text node which has frames handled by
RecreateStartTextFrames() and then create the frames following the start
text node, where the end node of the outer section now finds its expected
outer section frame.

This relies on the code from 55576842ec
to move the existing text frame below the new section frame(s).

(regression from 6c7245e789)

Change-Id: I9f39b09e603e75ef813d5c855d828ec9bd5fdd95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99723
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-30 12:31:05 +02:00