summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-10 15:10:11 +0200
committerNoel Grandin <noel@peralex.com>2015-03-11 10:16:53 +0200
commit68c87b46fd26291463989d5bf751bc4cecf09b28 (patch)
treea416573cc62487ba2f419080a1186251ed887478 /sw/inc
parent82c37453482e6b8bd6ab7b7e96b1257a1d5b0699 (diff)
convert SetAttrMode to enum class
Change-Id: If7dd0c49480756afb7d4eaaba597ecc305c35f64
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/IDocumentContentOperations.hxx5
-rw-r--r--sw/inc/editsh.hxx4
-rw-r--r--sw/inc/ndhints.hxx2
-rw-r--r--sw/inc/ndtxt.hxx6
-rw-r--r--sw/inc/swtypes.hxx29
-rw-r--r--sw/inc/unocrsrhelper.hxx4
6 files changed, 27 insertions, 23 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 2f956c6029ae..d58121da8acb 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -22,6 +22,7 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>
+#include "swtypes.hxx"
class SwPaM;
struct SwPosition;
@@ -187,10 +188,10 @@ public:
false.
*/
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) = 0;
virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const sal_uInt16 nFlags) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT) = 0;
/** Removes any leading white space from the paragraph
*/
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 2beeb3d0bf84..8dc3098c4bee 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -231,8 +231,8 @@ public:
const bool bMergeIndentValuesOfNumRule = false ) const;
bool GetCurAttr( SfxItemSet& ,
const bool bMergeIndentValuesOfNumRule = false ) const;
- void SetAttrItem( const SfxPoolItem&, sal_uInt16 nFlags = 0 );
- void SetAttrSet( const SfxItemSet&, sal_uInt16 nFlags = 0, SwPaM* pCrsr = NULL );
+ void SetAttrItem( const SfxPoolItem&, SetAttrMode nFlags = SetAttrMode::DEFAULT );
+ void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT, SwPaM* pCrsr = NULL );
/** Get RES_CHRATR_* items of one type in the current selection.
* @param nWhich WhichId of the collected items.
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index c80424dd3d0d..86e7fd452ff8 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -218,7 +218,7 @@ public:
/// try to insert the hint
/// @return true iff hint successfully inserted
bool TryInsertHint( SwTxtAttr * const pHint, SwTxtNode & rNode,
- const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ const SetAttrMode nMode = SetAttrMode::DEFAULT );
bool HasFtn() const { return m_bFootnote; }
bool IsInSplitNode() const { return m_bInSplitNode; }
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 45e31071fadc..3e8d5cac01bb 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -287,18 +287,18 @@ public:
/// Insert pAttr into hints array. @return true iff inserted successfully
bool InsertHint( SwTxtAttr * const pAttr,
- const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ const SetAttrMode nMode = SetAttrMode::DEFAULT );
/// create new text attribute from rAttr and insert it
/// @return inserted hint; 0 if not sure the hint is inserted
SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
const sal_Int32 nStart, const sal_Int32 nEnd,
- const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ const SetAttrMode nMode = SetAttrMode::DEFAULT );
/** Set these attributes at TextNode. If the whole range is comprised
set them only in AutoAttrSet (SwCntntNode::SetAttr). */
bool SetAttr( const SfxItemSet& rSet,
sal_Int32 nStt, sal_Int32 nEnd,
- const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ const SetAttrMode nMode = SetAttrMode::DEFAULT );
/** Query the attributes of textnode over the range.
Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 24b0ea0474e0..0773da7426ee 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/uno/Reference.h>
#include "swdllapi.h"
#include <i18nlangtag/languagetag.hxx>
+#include <o3tl/typed_flags_set.hxx>
namespace com { namespace sun { namespace star {
namespace linguistic2{
@@ -172,28 +173,30 @@ const sal_Unicode cSequenceMarkSeparator = '!';
#define DB_DELIM ((sal_Unicode)0xff) // Database <-> table separator.
-typedef sal_uInt16 SetAttrMode;
-
-namespace nsSetAttrMode
+enum class SetAttrMode
{
- const SetAttrMode SETATTR_DEFAULT = 0x0000; // Default.
+ DEFAULT = 0x0000, // Default.
/// @attention: DONTEXPAND does not work very well for CHARATR
/// because it can expand only the whole AUTOFMT or nothing
- const SetAttrMode SETATTR_DONTEXPAND = 0x0001; // Don't expand text attribute any further.
- const SetAttrMode SETATTR_DONTREPLACE = 0x0002; // Don't replace another text attribute.
+ DONTEXPAND = 0x0001, // Don't expand text attribute any further.
+ DONTREPLACE = 0x0002, // Don't replace another text attribute.
- const SetAttrMode SETATTR_NOTXTATRCHR = 0x0004; // Don't insert 0xFF at attributes with no end.
+ NOTXTATRCHR = 0x0004, // Don't insert 0xFF at attributes with no end.
/// attention: NOHINTADJUST prevents MergePortions!
/// when using this need to pay attention to ignore start/end flags of hint
- const SetAttrMode SETATTR_NOHINTADJUST = 0x0008; // No merging of ranges.
- const SetAttrMode SETATTR_NOFORMATATTR = 0x0010; // Do not change into format attribute.
- const SetAttrMode SETATTR_DONTCHGNUMRULE = 0x0020; // Do not change NumRule.
- const SetAttrMode SETATTR_APICALL = 0x0040; // Called from API (all UI related
+ NOHINTADJUST = 0x0008, // No merging of ranges.
+ NOFORMATATTR = 0x0010, // Do not change into format attribute.
+ DONTCHGNUMRULE = 0x0020, // Do not change NumRule.
+ APICALL = 0x0040, // Called from API (all UI related
// functionality will be disabled).
/// Force hint expand (only matters for hints with CH_TXTATR).
- const SetAttrMode SETATTR_FORCEHINTEXPAND= 0x0080;
+ FORCEHINTEXPAND = 0x0080,
/// The inserted item is a copy -- intended for use in ndtxt.cxx.
- const SetAttrMode SETATTR_IS_COPY = 0x0100;
+ IS_COPY = 0x0100
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x1ff> {};
}
#define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c )
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index f5949ddec1b5..4d14357831b0 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -156,7 +156,7 @@ namespace SwUnoCursorHelper
const SfxItemPropertySet & rPropSet,
const OUString & rPropertyName,
const ::com::sun::star::uno::Any & rValue,
- const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
+ const SetAttrMode nAttrMode = SetAttrMode::DEFAULT,
const bool bTableMode = false)
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
@@ -169,7 +169,7 @@ namespace SwUnoCursorHelper
const SfxItemPropertySet & rPropSet,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &
rPropertyValues,
- const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
+ const SetAttrMode nAttrMode = SetAttrMode::DEFAULT,
const bool bTableMode = false)
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,