summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-09-07 13:10:40 +0200
committerNoel Grandin <noel@peralex.com>2016-09-08 09:23:40 +0200
commit847e004e65ec3c35acff607588d15cd75a84f121 (patch)
tree1b2ac62948c9ad15d2f231b56eb45ff341f572f7 /sw/inc
parent3cac15856ade9fce161a49212c9d1861741122a5 (diff)
convert nsRedlineMode_t to typed_flags
including fixing a bug in SwXMLExport::exportDoc where it was ORing with a constant from a different type: nsRedlineType_t::REDLINE_INSERT Change-Id: I2bb154c9a35d106e64fd1a8b6e928d0384c9fafe
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx48
-rw-r--r--sw/inc/editsh.hxx6
-rw-r--r--sw/inc/undobj.hxx7
3 files changed, 34 insertions, 27 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index 1a7d5805e8ea..757394ded765 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -26,6 +26,7 @@
#include <limits.h>
#include <com/sun/star/uno/Sequence.hxx>
+#include <o3tl/typed_flags_set.hxx>
class SwRangeRedline;
class SwTableRowRedline;
@@ -37,25 +38,28 @@ struct SwPosition;
class SwStartNode;
class SwNode;
-typedef sal_uInt16 RedlineMode_t;
-namespace nsRedlineMode_t
+enum class RedlineFlags
{
- const RedlineMode_t REDLINE_NONE = 0; ///< no RedlineMode
- const RedlineMode_t REDLINE_ON = 0x01;///< RedlineMode on
- const RedlineMode_t REDLINE_IGNORE = 0x02;///< ignore Redlines
- const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;///< show all inserts
- const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;///< show all deletes
- const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE;
+ NONE = 0x000, ///< no RedlineFlags
+ On = 0x001, ///< RedlineFlags on
+ Ignore = 0x002, ///< ignore Redlines
+ ShowInsert = 0x010, ///< show all inserts
+ ShowDelete = 0x020, ///< show all deletes
+ ShowMask = ShowInsert | ShowDelete,
// For internal management:
// remove the original Redlines together with their content
// (Clipboard/text modules).
- const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100;
+ DeleteRedlines = 0x100,
// When deleting within a RedlineObject
// ignore the DeleteRedline during Append.
- const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200;
+ IgnoreDeleteRedlines = 0x200,
// don't combine any redlines. This flag may be only used in Undo.
- const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400;
+ DontCombineRedlines = 0x400,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x733> {};
}
typedef sal_uInt16 RedlineType_t;
@@ -82,17 +86,17 @@ class IDocumentRedlineAccess
{
// Static helper functions
public:
- static bool IsShowChanges(const sal_uInt16 eM)
- { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+ static bool IsShowChanges(const RedlineFlags eM)
+ { return (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete) == (eM & RedlineFlags::ShowMask); }
- static bool IsHideChanges(const sal_uInt16 eM)
- { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+ static bool IsHideChanges(const RedlineFlags eM)
+ { return RedlineFlags::ShowInsert == (eM & RedlineFlags::ShowMask); }
- static bool IsShowOriginal(const sal_uInt16 eM)
- { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+ static bool IsShowOriginal(const RedlineFlags eM)
+ { return RedlineFlags::ShowDelete == (eM & RedlineFlags::ShowMask); }
- static bool IsRedlineOn(const sal_uInt16 eM)
- { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
+ static bool IsRedlineOn(const RedlineFlags eM)
+ { return RedlineFlags::On == (eM & (RedlineFlags::On | RedlineFlags::Ignore )); }
public:
@@ -101,21 +105,21 @@ public:
@returns
the currently set redline mode
*/
- virtual RedlineMode_t GetRedlineMode() const = 0;
+ virtual RedlineFlags GetRedlineFlags() const = 0;
/** Set a new redline mode.
@param eMode
[in] the new redline mode.
*/
- virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
+ virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0;
/** Set a new redline mode.
@param eMode
[in] the new redline mode.
*/
- virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
+ virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0;
/** Query if redlining is on.
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index d874337d81ac..2105e224f8dc 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -101,6 +101,8 @@ class SwView;
struct SwConversionArgs;
enum class SvtScriptType;
enum class SfxClassificationPolicyType;
+enum class RedlineFlags;
+
namespace com { namespace sun { namespace star { namespace uno {
template < class > class Sequence;
}}}}
@@ -885,8 +887,8 @@ public:
bool GotoGlobalDocContent( const SwGlblDocContent& rPos );
/// For Redlining.
- sal_uInt16 GetRedlineMode() const;
- void SetRedlineMode( sal_uInt16 eMode );
+ RedlineFlags GetRedlineFlags() const;
+ void SetRedlineFlags( RedlineFlags eMode );
bool IsRedlineOn() const;
sal_uInt16 GetRedlineCount() const;
const SwRangeRedline& GetRedline( sal_uInt16 nPos ) const;
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 0913cea9bbbb..5d3e0d30ae8e 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -38,6 +38,7 @@ class SwNodeIndex;
class SwNodeRange;
class SwRedlineData;
class SwRedlineSaveDatas;
+enum class RedlineFlags;
namespace sw {
class UndoRedoContext;
@@ -48,7 +49,7 @@ class SwUndo
: public SfxUndoAction
{
SwUndoId const m_nId;
- sal_uInt16 nOrigRedlineMode;
+ RedlineFlags nOrigRedlineFlags;
sal_Int32 m_nViewShellId;
protected:
@@ -112,8 +113,8 @@ public:
// UndoObject remembers which mode was turned on.
// In Undo/Redo/Repeat this remembered mode is switched on.
- sal_uInt16 GetRedlineMode() const { return nOrigRedlineMode; }
- void SetRedlineMode( sal_uInt16 eMode ) { nOrigRedlineMode = eMode; }
+ RedlineFlags GetRedlineFlags() const { return nOrigRedlineFlags; }
+ void SetRedlineFlags( RedlineFlags eMode ) { nOrigRedlineFlags = eMode; }
bool IsDelBox() const;