sc/inc/global.hxx                |   29 +++++++++++++++--------------
 sc/source/ui/inc/docfuncutil.hxx |    2 +-
 2 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit 514913074c9c3f503cbbc9b6130d52e055e2ac81
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Dec 22 10:47:23 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Dec 22 11:28:33 2023 +0100

    InsertDeleteFlags should be synchronized with css::sheet::CellFlags
    
    They get casted to each other in sc/source/ui/unoobj/cellsuno.cxx
    (see ScCellRangesBase::clearContents, which implements respective
    method of css::sheet::XSheetOperation).
    
    Commit 07b0c01857137de7e4bd02375e7c892d622d270e (CWS-TOOLING:
    integrate CWS dr66, 2009-03-02) introduced IDF_NOCAPTIONS with
    value of 0x0200, which conflicted with css::sheet::CellFlags::FORMATTED
    (itself introduced in commit b4100bbf615fd3d1cbae200ae187ccbddf8e44a6
    (INTEGRATION: CWS calcuno01 (1.5.284); FILE MERGED, 2005-03-23)).
    
    Make the underlying type of InsertDeleteFlags consistent with the
    IDL definition; and make sure to avoid the conflicting values.
    
    Change-Id: Ic348f69a1e58db84ef6203391020f45b331e6967
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161145
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index e140a7fb6ef0..fe7b8bb407b2 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -26,6 +26,7 @@
 #include <tools/ref.hxx>
 #include <sal/types.h>
 #include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <com/sun/star/sheet/CellFlags.hpp>
 #include "scdllapi.h"
 #include <rtl/ustring.hxx>
 #include <tools/long.hxx>
@@ -145,21 +146,22 @@ namespace o3tl {
     template<> struct typed_flags<ScBreakType> : is_typed_flags<ScBreakType, 
0x03> {};
 }
 
-enum class InsertDeleteFlags : sal_uInt16
+enum class InsertDeleteFlags : sal_Int32
 {
     NONE             = 0x0000,
-    VALUE            = 0x0001,   /// Numeric values (and numeric results if 
InsertDeleteFlags::FORMULA is not set).
-    DATETIME         = 0x0002,   /// Dates, times, datetime values.
-    STRING           = 0x0004,   /// Strings (and string results if 
InsertDeleteFlags::FORMULA is not set).
-    NOTE             = 0x0008,   /// Cell notes.
-    FORMULA          = 0x0010,   /// Formula cells.
-    HARDATTR         = 0x0020,   /// Hard cell attributes.
-    STYLES           = 0x0040,   /// Cell styles.
-    OBJECTS          = 0x0080,   /// Drawing objects.
-    EDITATTR         = 0x0100,   /// Rich-text attributes.
+    VALUE            = css::sheet::CellFlags::VALUE,      /// 0x0001 Numeric 
values (and numeric results if InsertDeleteFlags::FORMULA is not set).
+    DATETIME         = css::sheet::CellFlags::DATETIME,   /// 0x0002 Dates, 
times, datetime values.
+    STRING           = css::sheet::CellFlags::STRING,     /// 0x0004 Strings 
(and string results if InsertDeleteFlags::FORMULA is not set).
+    NOTE             = css::sheet::CellFlags::ANNOTATION, /// 0x0008 Cell 
notes.
+    FORMULA          = css::sheet::CellFlags::FORMULA,    /// 0x0010 Formula 
cells.
+    HARDATTR         = css::sheet::CellFlags::HARDATTR,   /// 0x0020 Hard cell 
attributes.
+    STYLES           = css::sheet::CellFlags::STYLES,     /// 0x0040 Cell 
styles.
+    OBJECTS          = css::sheet::CellFlags::OBJECTS,    /// 0x0080 Drawing 
objects.
+    EDITATTR         = css::sheet::CellFlags::EDITATTR,   /// 0x0100 Rich-text 
attributes.
+    /// No value yet for css::sheet::CellFlags::FORMATTED (0x0200)
     OUTLINE          = 0x0800,   /// Sheet / outlining (grouping) information
     SPARKLINES       = 0x4000,   /// Sparklines in a cell.
-    NOCAPTIONS       = 0x0200,   /// Internal use only (undo etc.): do not 
copy/delete caption objects of cell notes.
+    NOCAPTIONS       = 0x8000,   /// Internal use only (undo etc.): do not 
copy/delete caption objects of cell notes.
     ADDNOTES         = 0x0400,   /// Internal use only (copy from clip): do 
not delete existing cell contents when pasting notes.
     SPECIAL_BOOLEAN  = 0x1000,
     FORGETCAPTIONS   = 0x2000,   /// Internal use only (d&d undo): do not 
delete caption objects of cell notes.
@@ -172,10 +174,9 @@ enum class InsertDeleteFlags : sal_uInt16
 };
 namespace o3tl
 {
-    template<> struct typed_flags<InsertDeleteFlags> : 
is_typed_flags<InsertDeleteFlags, 0x7fff> {};
+    template<> struct typed_flags<InsertDeleteFlags> : 
is_typed_flags<InsertDeleteFlags, 0xfdff> {};
 }
-// This doesn't work at the moment, perhaps when we have constexpr we can 
modify InsertDeleteFlags to make it work.
-//static_assert((InsertDeleteFlags::ATTRIB & InsertDeleteFlags::CONTENTS) == 
InsertDeleteFlags::NONE, "these must match");
+static_assert((InsertDeleteFlags::ATTRIB & InsertDeleteFlags::CONTENTS) == 
InsertDeleteFlags::NONE, "these must match");
 
 
 enum class ScPasteFunc {
diff --git a/sc/source/ui/inc/docfuncutil.hxx b/sc/source/ui/inc/docfuncutil.hxx
index c0b439d3e9be..2ec5bce703a7 100644
--- a/sc/source/ui/inc/docfuncutil.hxx
+++ b/sc/source/ui/inc/docfuncutil.hxx
@@ -13,7 +13,7 @@
 
 class ScMarkData;
 class ScRange;
-enum class InsertDeleteFlags : sal_uInt16;
+enum class InsertDeleteFlags : sal_Int32;
 
 namespace sc {
 

Reply via email to