summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-13 16:33:56 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-04-15 11:36:13 +0000
commitba9acdf799bf556c8a20b1dc27eb116e23d481db (patch)
treea4d3cb636b3369a7fb0e8ea027e1944dd3d48645
parentfe73ed7c79b96eaa5aa84314a07ae11f188575a1 (diff)
convert TXTFORMAT constants to scoped enum
and move them to the SW module since that is the only place they are used Change-Id: Ic037e5ac9d2514377669c5f583b856e1da429a19 Reviewed-on: https://gerrit.libreoffice.org/15303 Tested-by: Noel Grandin <noelgrandin@gmail.com> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/svl/mailenum.hxx10
-rw-r--r--sw/inc/modcfg.hxx26
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx16
-rw-r--r--sw/source/uibase/config/modcfg.cxx6
4 files changed, 32 insertions, 26 deletions
diff --git a/include/svl/mailenum.hxx b/include/svl/mailenum.hxx
index ceee806f1a7d..85595c2c51cc 100644
--- a/include/svl/mailenum.hxx
+++ b/include/svl/mailenum.hxx
@@ -19,8 +19,6 @@
#ifndef INCLUDED_SVL_MAILENUM_HXX
#define INCLUDED_SVL_MAILENUM_HXX
-// enum ------------------------------------------------------------------
-
enum MailState
{
MAIL_STATE_SUCCESS = 0,
@@ -75,14 +73,6 @@ enum MailAction
MAIL_ACTION_PREV // jump to previous mail
};
-// text format for the sending of messages ------------------------------
-
-#define TXTFORMAT_ASCII ((sal_uInt8)0x01)
-#define TXTFORMAT_HTML ((sal_uInt8)0x02)
-#define TXTFORMAT_RTF ((sal_uInt8)0x04)
-#define TXTFORMAT_OFFICE ((sal_uInt8)0x08)
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 7242ed6b8ae6..e79c23689211 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -30,10 +30,26 @@
#include "itabenum.hxx"
#include <tools/globname.hxx>
#include <editeng/svxenum.hxx>
-class SwModuleOptions;
+#include <o3tl/typed_flags_set.hxx>
+class SwModuleOptions;
class InsCaptionOpt;
+// text format for the sending of messages ------------------------------
+enum class MailTxtFormats
+{
+ NONE = 0x00,
+ ASCII = 0x01,
+ HTML = 0x02,
+ RTF = 0x04,
+ OFFICE = 0x08
+};
+namespace o3tl
+{
+ template<> struct typed_flags<MailTxtFormats> : is_typed_flags<MailTxtFormats, 0x0f> {};
+}
+
+
class InsCaptionOptArr
{
private:
@@ -161,7 +177,7 @@ class SwMiscConfig : public utl::ConfigItem
bool bSinglePrintJob; // FormLetter/PrintOutput/SinglePrintJobs
bool bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation
bool bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged'
- sal_Int16 nMailingFormats; // FormLetter/MailingOutput/Formats
+ MailTxtFormats nMailingFormats; // FormLetter/MailingOutput/Formats
OUString sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
OUString sMailingPath; // FormLetter/FileOutput/Path
OUString sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!)
@@ -286,9 +302,9 @@ public:
void SetGrfToGalleryAsLnk( bool b ) { aMiscConfig.bGrfToGalleryAsLnk = b;
aMiscConfig.SetModified();}
- sal_Int16 GetMailingFormats() const { return aMiscConfig.nMailingFormats;}
- void SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet;
- aMiscConfig.SetModified();}
+ MailTxtFormats GetMailingFormats() const { return aMiscConfig.nMailingFormats;}
+ void SetMailingFormats( MailTxtFormats nSet ) { aMiscConfig.nMailingFormats = nSet;
+ aMiscConfig.SetModified();}
bool IsSinglePrintJob() const { return aMiscConfig.bSinglePrintJob; }
void SetSinglePrintJob( bool b ) { aMiscConfig.bSinglePrintJob = b;
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index 00da8162d562..dac471ea8bc3 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -256,10 +256,10 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
pModOpt = SW_MOD()->GetModuleConfig();
- sal_Int16 nMailingMode(pModOpt->GetMailingFormats());
- m_pFormatSwCB->Check((nMailingMode & TXTFORMAT_OFFICE) != 0);
- m_pFormatHtmlCB->Check((nMailingMode & TXTFORMAT_HTML) != 0);
- m_pFormatRtfCB->Check((nMailingMode & TXTFORMAT_RTF) != 0);
+ MailTxtFormats nMailingMode(pModOpt->GetMailingFormats());
+ m_pFormatSwCB->Check(bool(nMailingMode & MailTxtFormats::OFFICE));
+ m_pFormatHtmlCB->Check(bool(nMailingMode & MailTxtFormats::HTML));
+ m_pFormatRtfCB->Check(bool(nMailingMode & MailTxtFormats::RTF));
m_pAllRB->Check(true);
@@ -578,14 +578,14 @@ bool SwMailMergeDlg::ExecQryShell()
pModOpt->SetSinglePrintJob(m_pSingleJobsCB->IsChecked());
- sal_uInt8 nMailingMode = 0;
+ MailTxtFormats nMailingMode = MailTxtFormats::NONE;
if (m_pFormatSwCB->IsChecked())
- nMailingMode |= TXTFORMAT_OFFICE;
+ nMailingMode |= MailTxtFormats::OFFICE;
if (m_pFormatHtmlCB->IsChecked())
- nMailingMode |= TXTFORMAT_HTML;
+ nMailingMode |= MailTxtFormats::HTML;
if (m_pFormatRtfCB->IsChecked())
- nMailingMode |= TXTFORMAT_RTF;
+ nMailingMode |= MailTxtFormats::RTF;
pModOpt->SetMailingFormats(nMailingMode);
return true;
}
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 94a651f58ee2..a9d5392a1ef5 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1196,7 +1196,7 @@ SwMiscConfig::SwMiscConfig() :
bSinglePrintJob(false),
bIsNameFromColumn(true),
bAskForMailMergeInPrint(true),
- nMailingFormats(0)
+ nMailingFormats(MailTxtFormats::NONE)
{
Load();
}
@@ -1255,7 +1255,7 @@ void SwMiscConfig::ImplCommit()
case 3 : pValues[nProp] <<= bGrfToGalleryAsLnk; break;
case 4 : pValues[nProp] <<= bNumAlignSize; break;
case 5 : pValues[nProp] <<= bSinglePrintJob; break;
- case 6 : pValues[nProp] <<= nMailingFormats; break;
+ case 6 : pValues[nProp] <<= static_cast<sal_uInt8>(nMailingFormats); break;
case 7 : pValues[nProp] <<= sNameFromColumn; break;
case 8 : pValues[nProp] <<= sMailingPath; break;
case 9 : pValues[nProp] <<= sMailName; break;
@@ -1289,7 +1289,7 @@ void SwMiscConfig::Load()
case 3 : bGrfToGalleryAsLnk = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
case 4 : bNumAlignSize = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
case 5 : bSinglePrintJob = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 6 : pValues[nProp] >>= nMailingFormats; ; break;
+ case 6 : nMailingFormats = static_cast<MailTxtFormats>(*static_cast<sal_uInt8 const *>(pValues[nProp].getValue())); break;
case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; break;
case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; break;