diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-02-04 12:36:41 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-02-04 18:34:49 +0100 |
commit | c598e0accf24e149520a22a8c062249f147844c7 (patch) | |
tree | dcb9a4eca26228ab76886853dc00b0f1c08a3011 /sw/inc | |
parent | 97abf85bb152b8a665dff6fd8b65fffea5365dc8 (diff) |
sw: fix copying and deleting of table in section via API
This is a follow-up to 7ab349296dac79dad3fec09f60348efcbb9ea17e.
The first problem was that tables that contain protected cells refused
to be deleted, which caused an infinite loop in
SwXTextRange::DeleteAndInsert().
This also affected SwXTextTable::dispose(), and DDE tables.
Fix this by forcibly deleting even protected cells from UNO APIs;
protection is an UI feature.
The second problem was that pasting the table SwFEShell::Paste() would
set up aCpyPam so that it selects from the start node of the table to
the last text node in the table, excluding the table cell and table end
nodes, which caused:
DocumentContentOperationsManager.cxx:3548: An insufficient number of nodes were copied!
Fix this by setting up aCpyPam over the entire body section of the
clipboard document.
Change-Id: I8c6caee5e75260dff79f106efc11f9669feddc0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110411
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/doc.hxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 987f660960c2..124403befa9b 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -21,6 +21,7 @@ // SwDoc interfaces #include <o3tl/deleter.hxx> +#include <o3tl/typed_flags_set.hxx> #include <o3tl/sorted_vector.hxx> #include <vcl/idle.hxx> #include "swdllapi.h" @@ -1196,7 +1197,8 @@ public: sal_uInt16 nCnt = 1, bool bBehind = true ); // Delete Columns/Rows in table. - bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false ); + enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 2 }; + bool DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode eMode = RowColMode::DeleteRow); void DeleteRow( const SwCursor& rCursor ); void DeleteCol( const SwCursor& rCursor ); @@ -1668,6 +1670,10 @@ private: }; +namespace o3tl { + template<> struct typed_flags<SwDoc::RowColMode> : is_typed_flags<SwDoc::RowColMode, 3> {}; +} + // This method is called in Dtor of SwDoc and deletes cache of ContourObjects. void ClrContourCache(); |