Kaydet (Commit) ba9acdf7 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

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/15303Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst fe73ed7c
......@@ -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: */
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment