summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/global.hxx89
-rw-r--r--sc/inc/scabstdlg.hxx4
2 files changed, 29 insertions, 64 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 8ecfedfc62b1..c61b20951c7e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -135,72 +135,37 @@ const ScBreakType BREAK_NONE = 0;
const ScBreakType BREAK_PAGE = 1;
const ScBreakType BREAK_MANUAL = 2;
-// insert/delete flags - typesafe bitfield
-struct InsertDeleteFlags final {
-private:
- sal_uInt16 v;
- // hidden so that it doesn't accidentally get called in constructor initialiser lists
- explicit InsertDeleteFlags(sal_uInt16 _v) : v(_v) {}
-public:
- static InsertDeleteFlags fromInt(sal_uInt16 v) { return InsertDeleteFlags(v); }
- operator bool() const { return v != 0; }
- sal_uInt16 val() const { return v; }
- bool operator ==(const InsertDeleteFlags& other) const { return v == other.v; }
- bool operator !=(const InsertDeleteFlags& other) const { return v != other.v; }
-private:
- // disallow implicit conversion to int
- operator int() const { return v; }
-};
-// make combining these type-safe
-inline InsertDeleteFlags operator| (const InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
-{
- return InsertDeleteFlags::fromInt(lhs.val() | rhs.val());
-}
-inline InsertDeleteFlags operator& (const InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
-{
- return InsertDeleteFlags::fromInt(lhs.val() & rhs.val());
-}
-inline InsertDeleteFlags& operator|= (InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
+enum class InsertDeleteFlags : sal_uInt16
{
- lhs = InsertDeleteFlags::fromInt(lhs.val() | rhs.val());
- return lhs;
-}
-inline InsertDeleteFlags& operator&= (InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
-{
- lhs = InsertDeleteFlags::fromInt(lhs.val() & rhs.val());
- return lhs;
-}
-
-const InsertDeleteFlags IDF_NONE = InsertDeleteFlags::fromInt(0x0000);
-const InsertDeleteFlags IDF_VALUE = InsertDeleteFlags::fromInt(0x0001); /// Numeric values (and numeric results if IDF_FORMULA is not set).
-const InsertDeleteFlags IDF_DATETIME = InsertDeleteFlags::fromInt(0x0002); /// Dates, times, datetime values.
-const InsertDeleteFlags IDF_STRING = InsertDeleteFlags::fromInt(0x0004); /// Strings (and string results if IDF_FORMULA is not set).
-const InsertDeleteFlags IDF_NOTE = InsertDeleteFlags::fromInt(0x0008); /// Cell notes.
-const InsertDeleteFlags IDF_FORMULA = InsertDeleteFlags::fromInt(0x0010); /// Formula cells.
-const InsertDeleteFlags IDF_HARDATTR = InsertDeleteFlags::fromInt(0x0020); /// Hard cell attributes.
-const InsertDeleteFlags IDF_STYLES = InsertDeleteFlags::fromInt(0x0040); /// Cell styles.
-const InsertDeleteFlags IDF_OBJECTS = InsertDeleteFlags::fromInt(0x0080); /// Drawing objects.
-const InsertDeleteFlags IDF_EDITATTR = InsertDeleteFlags::fromInt(0x0100); /// Rich-text attributes.
-const InsertDeleteFlags IDF_OUTLINE = InsertDeleteFlags::fromInt(0x0800); /// Sheet / outlining (grouping) information
-const InsertDeleteFlags IDF_NOCAPTIONS = InsertDeleteFlags::fromInt(0x0200); /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
-const InsertDeleteFlags IDF_ADDNOTES = InsertDeleteFlags::fromInt(0x0400); /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
-const InsertDeleteFlags IDF_SPECIAL_BOOLEAN = InsertDeleteFlags::fromInt(0x1000);
-const InsertDeleteFlags IDF_FORGETCAPTIONS = InsertDeleteFlags::fromInt(0x2000); /// Internal use only (d&d undo): do not delete caption objects of cell notes.
-const InsertDeleteFlags IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
-const InsertDeleteFlags IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA | IDF_OUTLINE;
-const InsertDeleteFlags IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
-const InsertDeleteFlags IDF_ALL_USED_BITS = IDF_ALL | IDF_EDITATTR | IDF_NOCAPTIONS | IDF_ADDNOTES | IDF_SPECIAL_BOOLEAN | IDF_FORGETCAPTIONS;
-
-inline InsertDeleteFlags operator~ (const InsertDeleteFlags& rhs)
+ 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.
+ OUTLINE = 0x0800, /// Sheet / outlining (grouping) information
+ NOCAPTIONS = 0x0200, /// 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.
+ ATTRIB = HARDATTR | STYLES,
+ CONTENTS = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE,
+ ALL = CONTENTS | ATTRIB | OBJECTS,
+ ALL_USED_BITS = ALL | EDITATTR | NOCAPTIONS | ADDNOTES | SPECIAL_BOOLEAN | FORGETCAPTIONS,
+ /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
+ AUTOFILL = ALL & ~(NOTE | OBJECTS)
+};
+namespace o3tl
{
- return IDF_ALL_USED_BITS & InsertDeleteFlags::fromInt(~rhs.val());
+ template<> struct typed_flags<InsertDeleteFlags> : is_typed_flags<InsertDeleteFlags, 0x3fff> {};
}
+// 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");
-// This doesnt work at the moment, perhaps when we have constexpr we can modify InsertDeleteFlags to make it work.
-//static_assert((IDF_ATTRIB & IDF_CONTENTS) == IDF_NONE, "these must match");
-
-/// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
-const InsertDeleteFlags IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
enum class ScPasteFunc {
NONE, ADD, SUB, MUL, DIV
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 1fd7e12f65f2..82c866ecd01d 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -361,7 +361,7 @@ public:
ScTabViewShell* pTabViewShell) = 0;
virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(vcl::Window* pParent,
- InsertDeleteFlags nCheckDefaults = IDF_NONE) = 0;
+ InsertDeleteFlags nCheckDefaults = InsertDeleteFlags::NONE) = 0;
virtual AbstractScFillSeriesDlg * CreateScFillSeriesDlg( vcl::Window* pParent,
ScDocument& rDocument,
FillDir eFillDir,
@@ -381,7 +381,7 @@ public:
bool bDisallowCellMove = false ) = 0;
virtual AbstractScInsertContentsDlg * CreateScInsertContentsDlg( vcl::Window* pParent,
- InsertDeleteFlags nCheckDefaults = IDF_NONE,
+ InsertDeleteFlags nCheckDefaults = InsertDeleteFlags::NONE,
const OUString* pStrTitle = NULL ) = 0;
virtual AbstractScInsertTableDlg * CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData,