summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-29 13:37:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-30 06:31:46 +0000
commit4d00ca767de19696084fc52ff3638c448233b818 (patch)
treeea9c174eca53ab497d1fefaf7910f1adfcbc118e
parentb5a1f7cbf9c83f7b1cc6ea103047147ce3d63fee (diff)
convert WRITEFIELD constants to o3tl::typed_flags
Change-Id: I6412faee844e19195d57415874022bcf8547f4d7 Reviewed-on: https://gerrit.libreoffice.org/31360 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/docxexport.cxx2
-rw-r--r--sw/source/filter/ww8/docxexport.hxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx15
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.hxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx23
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx21
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx24
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx11
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx37
13 files changed, 75 insertions, 77 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7830a3260126..c4c226d6f34d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -137,7 +137,6 @@ using namespace oox;
using namespace docx;
using namespace sax_fastparser;
using namespace nsSwDocInfoSubType;
-using namespace nsFieldFlags;
using namespace sw::util;
using namespace ::com::sun::star;
using namespace ::com::sun::star::drawing;
@@ -2384,7 +2383,7 @@ bool DocxAttributeOutput::EndURL(bool const)
void DocxAttributeOutput::FieldVanish( const OUString& rText, ww::eField eType )
{
- WriteField_Impl( nullptr, eType, rText, WRITEFIELD_ALL );
+ WriteField_Impl( nullptr, eType, rText, FieldFlags::All );
}
// The difference between 'Redline' and 'StartRedline'+'EndRedline' is that:
@@ -6752,15 +6751,15 @@ void DocxAttributeOutput::WriteExpand( const SwField* pField )
m_rExport.OutputField( pField, ww::eUNKNOWN, sCmd );
}
-void DocxAttributeOutput::WriteField_Impl( const SwField* pField, ww::eField eType, const OUString& rFieldCmd, sal_uInt8 nMode )
+void DocxAttributeOutput::WriteField_Impl( const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode )
{
struct FieldInfos infos;
if (pField)
infos.pField.reset(pField->CopyField());
infos.sCmd = rFieldCmd;
infos.eType = eType;
- infos.bClose = WRITEFIELD_CLOSE & nMode;
- infos.bOpen = WRITEFIELD_START & nMode;
+ infos.bClose = bool(FieldFlags::Close & nMode);
+ infos.bOpen = bool(FieldFlags::Start & nMode);
m_Fields.push_back( infos );
if ( pField )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 7c5149be2ff8..a870c1765a3e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -366,7 +366,7 @@ public:
const OUString &rNumberingString,
const SvxBrushItem* pBrush ) override;
- void WriteField_Impl( const SwField* pField, ww::eField eType, const OUString& rFieldCmd, sal_uInt8 nMode );
+ void WriteField_Impl( const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode );
void WriteFormData_Impl( const ::sw::mark::IFieldmark& rFieldmark );
void WriteBookmarks_Impl( std::vector< OUString >& rStarts, std::vector< OUString >& rEnds );
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index c36139ca31ac..4954bdb4e59a 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -274,7 +274,7 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
#endif
}
-void DocxExport::OutputField( const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, sal_uInt8 nMode )
+void DocxExport::OutputField( const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, FieldFlags nMode )
{
m_pAttrOutput->WriteField_Impl( pField, eFieldType, rFieldCmd, nMode );
}
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 1b0b03b345d8..ad5d9113f6b7 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -152,7 +152,7 @@ public:
/// Write the field
virtual void OutputField( const SwField* pField, ww::eField eFieldType,
- const OUString& rFieldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ) override;
+ const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All ) override;
/// Write the data of the form field
virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) override;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 699ad22fde26..91985094041a 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -81,7 +81,6 @@
using namespace ::com::sun::star;
using namespace sw::util;
-using namespace nsFieldFlags;
static OString OutTBLBorderLine(RtfExport& rExport, const editeng::SvxBorderLine* pLine, const sal_Char* pStr)
{
@@ -534,16 +533,16 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 /*nPos*/,
aStr += OUString::number(nHeight);
aStr += "(";
EndRun();
- m_rExport.OutputField(nullptr, ww::eEQ, aStr, WRITEFIELD_START | WRITEFIELD_CMD_START);
+ m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::Start | FieldFlags::CmdStart);
aStr = rRuby.GetText();
aStr += ")";
aStr += ",";
- m_rExport.OutputField(nullptr, ww::eEQ, aStr, 0);
+ m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::NONE);
}
void RtfAttributeOutput::EndRuby()
{
- m_rExport.OutputField(nullptr, ww::eEQ, ")", WRITEFIELD_END | WRITEFIELD_CLOSE);
+ m_rExport.OutputField(nullptr, ww::eEQ, ")", FieldFlags::End | FieldFlags::Close);
EndRun();
}
@@ -1567,11 +1566,11 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel,
m_rExport.Strm().WriteChar('}');
}
-void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, sal_uInt8 nMode)
+void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode)
{
// If there are no field instructions, don't export it as a field.
bool bHasInstructions = !rFieldCmd.isEmpty();
- if (WRITEFIELD_ALL == nMode)
+ if (FieldFlags::All == nMode)
{
if (bHasInstructions)
{
@@ -1587,14 +1586,14 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType
}
else if (eType == ww::eEQ)
{
- if (WRITEFIELD_START & nMode)
+ if (FieldFlags::Start & nMode)
{
m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " ");
}
if (bHasInstructions)
m_aRunText->append(msfilter::rtfutil::OutString(rFieldCmd, m_rExport.m_eCurrentEncoding));
- if (WRITEFIELD_END & nMode)
+ if (FieldFlags::End & nMode)
{
m_aRunText->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
m_aRunText->append("}}");
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 24dd7ea98c66..f204fe31a7c8 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -213,7 +213,7 @@ public:
const OUString& rNumberingString,
const SvxBrushItem* pBrush) override;//For i120928,to export graphic of bullet
- void WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, sal_uInt8 nMode);
+ void WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode);
void WriteBookmarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds);
void WriteAnnotationMarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds);
void WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, bool bTitlepg);
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index bf5c61cdd335..80dedfb8fb54 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -291,7 +291,7 @@ void RtfExport::WriteHeadersFooters(sal_uInt8 nHeadFootFlags,
WriteHeaderFooter(rFirstPageFormat, false, OOO_STRING_SVTOOLS_RTF_FOOTERF, true);
}
-void RtfExport::OutputField(const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, sal_uInt8 nMode)
+void RtfExport::OutputField(const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, FieldFlags nMode)
{
m_pAttrOutput->WriteField_Impl(pField, eFieldType, rFieldCmd, nMode);
}
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 81d18c119377..71c55f068550 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -108,7 +108,7 @@ public:
/// Write the field
virtual void OutputField(const SwField* pField, ww::eField eFieldType,
- const OUString& rFieldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL) override;
+ const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All) override;
/// Write the data of the form field
virtual void WriteFormData(const ::sw::mark::IFieldmark& rFieldmark) override;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 645116c938ce..c4bfb39f4c6f 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -106,7 +106,6 @@ using ::editeng::SvxBorderLine;
using namespace com::sun::star;
using namespace sw::util;
using namespace sw::types;
-using namespace nsFieldFlags;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::drawing::XShape;
@@ -448,7 +447,7 @@ void WW8Export::DoComboBox(const OUString &rName,
uno::Sequence<OUString> &rListItems)
{
OutputField(nullptr, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
- WRITEFIELD_START | WRITEFIELD_CMD_START);
+ FieldFlags::Start | FieldFlags::CmdStart);
// write the refence to the "picture" structure
sal_uLong nDataStt = pDataStrm->Tell();
m_pChpPlc->AppendFkpEntry( Strm().Tell() );
@@ -468,7 +467,7 @@ void WW8Export::DoComboBox(const OUString &rName,
m_pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
OutputField(nullptr, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
- WRITEFIELD_CLOSE);
+ FieldFlags::Close);
::sw::WW8FFData aFFData;
@@ -495,7 +494,7 @@ void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> const & xPropSet)
xPropSet->getPropertySetInfo();
OutputField(nullptr, ww::eFORMCHECKBOX, FieldString(ww::eFORMCHECKBOX),
- WRITEFIELD_START | WRITEFIELD_CMD_START);
+ FieldFlags::Start | FieldFlags::CmdStart);
// write the refence to the "picture" structure
sal_uLong nDataStt = pDataStrm->Tell();
m_pChpPlc->AppendFkpEntry( Strm().Tell() );
@@ -549,13 +548,13 @@ void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> const & xPropSet)
aFFData.Write(pDataStrm);
- OutputField(nullptr, ww::eFORMCHECKBOX, OUString(), WRITEFIELD_CLOSE);
+ OutputField(nullptr, ww::eFORMCHECKBOX, OUString(), FieldFlags::Close);
}
void WW8Export::DoFormText(const SwInputField * pField)
{
OutputField(nullptr, ww::eFORMTEXT, FieldString(ww::eFORMTEXT),
- WRITEFIELD_START | WRITEFIELD_CMD_START);
+ FieldFlags::Start | FieldFlags::CmdStart);
// write the refence to the "picture" structure
sal_uLong nDataStt = pDataStrm->Tell();
m_pChpPlc->AppendFkpEntry( Strm().Tell() );
@@ -582,7 +581,7 @@ void WW8Export::DoFormText(const SwInputField * pField)
aFFData.setStatus(pField->GetToolTip());
aFFData.Write(pDataStrm);
- OutputField(nullptr, ww::eFORMTEXT, OUString(), WRITEFIELD_CMD_END);
+ OutputField(nullptr, ww::eFORMTEXT, OUString(), FieldFlags::CmdEnd);
const OUString fieldStr( pField->ExpandField(true) );
SwWW8Writer::WriteString16(Strm(), fieldStr, false);
@@ -597,7 +596,7 @@ void WW8Export::DoFormText(const SwInputField * pField)
m_pChpPlc->AppendFkpEntry(Strm().Tell(),
sizeof( aArr2 ), aArr2 );
- OutputField(nullptr, ww::eFORMTEXT, OUString(), WRITEFIELD_CLOSE);
+ OutputField(nullptr, ww::eFORMTEXT, OUString(), FieldFlags::Close);
}
PlcDrawObj::~PlcDrawObj()
@@ -1037,7 +1036,7 @@ void WW8Export::AppendFlyInFlys(const ww8::Frame& rFrameFormat,
if (rFrameFormat.IsInline())
{
OutputField(nullptr, ww::eSHAPE, FieldString(ww::eSHAPE),
- WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
+ FieldFlags::Start | FieldFlags::CmdStart | FieldFlags::CmdEnd);
}
WW8_CP nCP = Fc2Cp(Strm().Tell());
@@ -1064,7 +1063,7 @@ void WW8Export::AppendFlyInFlys(const ww8::Frame& rFrameFormat,
}
if (rFrameFormat.IsInline())
- OutputField(nullptr, ww::eSHAPE, OUString(), WRITEFIELD_CLOSE);
+ OutputField(nullptr, ww::eSHAPE, OUString(), FieldFlags::Close);
}
MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr,
@@ -3240,12 +3239,12 @@ void SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrUnoObj& rFo
OUString sField = FieldString(ww::eCONTROL) + "Forms." + sUName + ".1 \\s ";
rWW8Wrt.OutputField(nullptr, ww::eCONTROL, sField,
- WRITEFIELD_START|WRITEFIELD_CMD_START|WRITEFIELD_CMD_END);
+ FieldFlags::Start|FieldFlags::CmdStart|FieldFlags::CmdEnd);
rWW8Wrt.m_pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(),sizeof(aSpecOLE),
aSpecOLE);
rWW8Wrt.WriteChar( 0x1 );
- rWW8Wrt.OutputField(nullptr, ww::eCONTROL, OUString(), WRITEFIELD_END | WRITEFIELD_CLOSE);
+ rWW8Wrt.OutputField(nullptr, ww::eCONTROL, OUString(), FieldFlags::End | FieldFlags::Close);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 94839edb59e3..738a51a18271 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -105,7 +105,6 @@ using namespace ::com::sun::star::i18n;
using namespace sw::util;
using namespace sw::types;
using namespace sw::mark;
-using namespace nsFieldFlags;
using namespace ::oox::vml;
static OUString lcl_getFieldCode( const IFieldmark* pFieldmark )
@@ -877,13 +876,13 @@ void WW8AttributeOutput::StartRuby( const SwTextNode& rNode, sal_Int32 /*nPos*/,
aStr += ";";
m_rWW8Export.OutputField( nullptr, ww::eEQ, aStr,
- WRITEFIELD_START | WRITEFIELD_CMD_START );
+ FieldFlags::Start | FieldFlags::CmdStart );
}
void WW8AttributeOutput::EndRuby()
{
m_rWW8Export.WriteChar( ')' );
- m_rWW8Export.OutputField( nullptr, ww::eEQ, OUString(), WRITEFIELD_END | WRITEFIELD_CLOSE );
+ m_rWW8Export.OutputField( nullptr, ww::eEQ, OUString(), FieldFlags::End | FieldFlags::Close );
}
/*#i15387# Better ideas welcome*/
@@ -974,7 +973,7 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget
bool bBookMarkOnly = AnalyzeURL( rUrl, rTarget, &sURL, &sMark );
- m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, sURL, WRITEFIELD_START | WRITEFIELD_CMD_START );
+ m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, sURL, FieldFlags::Start | FieldFlags::CmdStart );
// write the refence to the "picture" structure
sal_uLong nDataStt = m_rWW8Export.pDataStrm->Tell();
@@ -995,7 +994,7 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget
m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), sizeof( aArr1 ), aArr1 );
- m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, sURL, WRITEFIELD_CMD_END );
+ m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, sURL, FieldFlags::CmdEnd );
// now write the picture structure
sURL = aURL.GetURLNoMark();
@@ -1120,7 +1119,7 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget
bool WW8AttributeOutput::EndURL(bool const)
{
- m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, OUString(), WRITEFIELD_CLOSE );
+ m_rWW8Export.OutputField( nullptr, ww::eHYPERLINK, OUString(), FieldFlags::Close );
return true;
}
@@ -2233,13 +2232,13 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
}
}
- OutputField( nullptr, eFieldId, sCode, WRITEFIELD_START | WRITEFIELD_CMD_START );
+ OutputField( nullptr, eFieldId, sCode, FieldFlags::Start | FieldFlags::CmdStart );
if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
WriteFormData( *pFieldmark );
else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK )
WriteHyperlinkData( *pFieldmark );
- OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CMD_END );
+ OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::CmdEnd );
if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
@@ -2274,7 +2273,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
}
}
- OutputField( nullptr, eFieldId, OUString(), WRITEFIELD_CLOSE );
+ OutputField( nullptr, eFieldId, OUString(), FieldFlags::Close );
if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
AppendBookmark( pFieldmark->GetName() );
@@ -2292,10 +2291,10 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
AppendBookmark( pFieldmark->GetName() );
OutputField( nullptr, lcl_getFieldId( pFieldmark ),
lcl_getFieldCode( pFieldmark ),
- WRITEFIELD_START | WRITEFIELD_CMD_START );
+ FieldFlags::Start | FieldFlags::CmdStart );
if ( isDropdownOrCheckbox )
WriteFormData( *pFieldmark );
- OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CLOSE );
+ OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::Close );
if ( isDropdownOrCheckbox )
AppendBookmark( pFieldmark->GetName() );
}
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 41e673c8f65b..a42a6405c1a3 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -40,6 +40,7 @@
#include <vcl/graph.hxx>
#include <boost/optional.hpp>
+#include <o3tl/typed_flags_set.hxx>
#include <memory>
#include <map>
@@ -133,15 +134,18 @@ class SvxBrushItem;
#define OLE_PREVIEW_AS_EMF //If we want to export ole2 previews as emf in ww8+
-typedef sal_uInt8 FieldFlags;
-namespace nsFieldFlags // for InsertField- Method
+enum class FieldFlags : sal_uInt8 // for InsertField- Method
{
- const FieldFlags WRITEFIELD_START = 0x01;
- const FieldFlags WRITEFIELD_CMD_START = 0x02;
- const FieldFlags WRITEFIELD_CMD_END = 0x04;
- const FieldFlags WRITEFIELD_END = 0x10;
- const FieldFlags WRITEFIELD_CLOSE = 0x20;
- const FieldFlags WRITEFIELD_ALL = 0xFF;
+ NONE = 0x00,
+ Start = 0x01,
+ CmdStart = 0x02,
+ CmdEnd = 0x04,
+ End = 0x10,
+ Close = 0x20,
+ All = 0x37
+};
+namespace o3tl {
+ template<> struct typed_flags<FieldFlags> : is_typed_flags<FieldFlags, 0x37> {};
}
enum TextTypes //enums for TextTypes
@@ -752,7 +756,7 @@ public:
/// Write the field
virtual void OutputField( const SwField* pField, ww::eField eFieldType,
- const OUString& rFieldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ) = 0;
+ const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All ) = 0;
/// Write the data of the form field
virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
@@ -1023,7 +1027,7 @@ public:
/// Write the field
virtual void OutputField( const SwField* pField, ww::eField eFieldType,
- const OUString& rFieldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ) override;
+ const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All ) override;
void StartCommentOutput( const OUString& rName );
void EndCommentOutput( const OUString& rName );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 8834934c115c..a8ffa76d643e 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -68,7 +68,6 @@
#include <o3tl/enumrange.hxx>
using namespace ::com::sun::star;
-using namespace nsFieldFlags;
// TODO:
// 5. convert the MapModes that Widows can't handle
@@ -262,8 +261,8 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
// in the escher export
OUString sServer = FieldString(ww::eEMBED) + xOleStg->GetUserName() + " ";
- OutputField(nullptr, ww::eEMBED, sServer, WRITEFIELD_START |
- WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
+ OutputField(nullptr, ww::eEMBED, sServer, FieldFlags::Start |
+ FieldFlags::CmdStart | FieldFlags::CmdEnd);
m_pChpPlc->AppendFkpEntry( Strm().Tell(),
nSize, pSpecOLE );
@@ -309,7 +308,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
}
OutputField(nullptr, ww::eEMBED, OUString(),
- WRITEFIELD_END | WRITEFIELD_CLOSE);
+ FieldFlags::End | FieldFlags::Close);
if (bEndCR) //No newline in inline case
WriteCR();
@@ -394,7 +393,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame)
sStr += "\" \\d";
OutputField( nullptr, ww::eINCLUDEPICTURE, sStr,
- WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END );
+ FieldFlags::Start | FieldFlags::CmdStart | FieldFlags::CmdEnd );
}
WriteChar( (char)1 ); // paste graphic symbols in the main text
@@ -472,7 +471,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame)
// linked, as-character anchored graphics have to be exported as fields.
else if ( pGrfNd && pGrfNd->IsLinkedFile() )
{
- OutputField( nullptr, ww::eINCLUDEPICTURE, OUString(), WRITEFIELD_CLOSE );
+ OutputField( nullptr, ww::eINCLUDEPICTURE, OUString(), FieldFlags::Close );
}
//Added for i120568,the hyperlink info within a graphic whose anchor type is
//"As character" will be exported to ensure the fidelity
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 5d3c72637d04..1a833a9af899 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -141,7 +141,6 @@
using ::editeng::SvxBorderLine;
using namespace ::com::sun::star;
-using namespace nsFieldFlags;
using namespace nsSwDocInfoSubType;
using namespace sw::util;
using namespace sw::types;
@@ -1667,7 +1666,7 @@ WW8_WrPlcField* WW8Export::CurrentFieldPlc() const
}
void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType,
- const OUString& rFieldCmd, sal_uInt8 nMode )
+ const OUString& rFieldCmd, FieldFlags nMode )
{
OUString sFieldCmd(rFieldCmd);
switch (eFieldType)
@@ -1693,7 +1692,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType,
WW8_WrPlcField* pFieldP = CurrentFieldPlc();
const bool bIncludeEmptyPicLocation = ( eFieldType == ww::ePAGE );
- if (WRITEFIELD_START & nMode)
+ if (FieldFlags::Start & nMode)
{
sal_uInt8 aField13[2] = { 0x13, 0x00 }; // will change
//#i3958#, Needed to make this field work correctly in Word 2000
@@ -1703,7 +1702,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType,
pFieldP->Append( Fc2Cp( Strm().Tell() ), aField13 );
InsertSpecialChar( *this, 0x13, nullptr, bIncludeEmptyPicLocation );
}
- if (WRITEFIELD_CMD_START & nMode)
+ if (FieldFlags::CmdStart & nMode)
{
SwWW8Writer::WriteString16(Strm(), sFieldCmd, false);
// #i43956# - write hyperlink character including
@@ -1743,14 +1742,14 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType,
InsertSpecialChar( *this, 0x01, &aLinkStr );
}
}
- if (WRITEFIELD_CMD_END & nMode)
+ if (FieldFlags::CmdEnd & nMode)
{
static const sal_uInt8 aField14[2] = { 0x14, 0xff };
pFieldP->Append( Fc2Cp( Strm().Tell() ), aField14 );
pFieldP->ResultAdded();
InsertSpecialChar( *this, 0x14, nullptr, bIncludeEmptyPicLocation );
}
- if (WRITEFIELD_END & nMode)
+ if (FieldFlags::End & nMode)
{
OUString sOut;
if( pField )
@@ -1783,7 +1782,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType,
}
}
}
- if (WRITEFIELD_CLOSE & nMode)
+ if (FieldFlags::Close & nMode)
{
sal_uInt8 aField15[2] = { 0x15, 0x80 };
@@ -1808,15 +1807,15 @@ void WW8Export::StartCommentOutput(const OUString& rName)
{
OUString sStr(FieldString(ww::eQUOTE));
sStr += "[" + rName + "] ";
- OutputField(nullptr, ww::eQUOTE, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START);
+ OutputField(nullptr, ww::eQUOTE, sStr, FieldFlags::Start | FieldFlags::CmdStart);
}
void WW8Export::EndCommentOutput(const OUString& rName)
{
OUString sStr(" [");
sStr += rName + "] ";
- OutputField(nullptr, ww::eQUOTE, sStr, WRITEFIELD_CMD_END | WRITEFIELD_END |
- WRITEFIELD_CLOSE);
+ OutputField(nullptr, ww::eQUOTE, sStr, FieldFlags::CmdEnd | FieldFlags::End |
+ FieldFlags::Close);
}
sal_uInt16 MSWordExportBase::GetId( const SwTOXType& rTOXType )
@@ -2253,8 +2252,8 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
if (!sStr.isEmpty())
{
GetExport( ).m_bInWriteTOX = true;
- GetExport( ).OutputField( nullptr, eCode, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START |
- WRITEFIELD_CMD_END );
+ GetExport( ).OutputField( nullptr, eCode, sStr, FieldFlags::Start | FieldFlags::CmdStart |
+ FieldFlags::CmdEnd );
}
}
@@ -2267,7 +2266,7 @@ void AttributeOutputBase::EndTOX( const SwSection& rSect,bool bCareEnd )
if ( pTOX )
{
ww::eField eCode = TOX_INDEX == pTOX->GetType() ? ww::eINDEX : ww::eTOC;
- GetExport( ).OutputField( nullptr, eCode, OUString(), WRITEFIELD_CLOSE );
+ GetExport( ).OutputField( nullptr, eCode, OUString(), FieldFlags::Close );
if ( pTOX->GetType() == TOX_INDEX && GetExport().AddSectionBreaksForTOX() )
{
@@ -2393,8 +2392,8 @@ void WW8AttributeOutput::SetField( const SwField& rField, ww::eField eType, cons
sal_uLong nFrom = m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell());
- GetExport().OutputField(&rField, eType, rCmd, WRITEFIELD_START |
- WRITEFIELD_CMD_START | WRITEFIELD_CMD_END);
+ GetExport().OutputField(&rField, eType, rCmd, FieldFlags::Start |
+ FieldFlags::CmdStart | FieldFlags::CmdEnd);
/*
Is there a bookmark at the start position of this field, if so
@@ -2410,7 +2409,7 @@ void WW8AttributeOutput::SetField( const SwField& rField, ww::eField eType, cons
{
SwWW8Writer::WriteString16(m_rWW8Export.Strm(), rVar, false);
}
- GetExport().OutputField(&rField, eType, rCmd, WRITEFIELD_CLOSE);
+ GetExport().OutputField(&rField, eType, rCmd, FieldFlags::Close);
}
void WW8AttributeOutput::PostitField( const SwField* pField )
@@ -2441,14 +2440,14 @@ void WW8AttributeOutput::RefField( const SwField &rField, const OUString &rRef)
{
OUString sStr( FieldString( ww::eREF ) );
sStr += "\"" + rRef + "\" ";
- m_rWW8Export.OutputField( &rField, ww::eREF, sStr, WRITEFIELD_START |
- WRITEFIELD_CMD_START | WRITEFIELD_CMD_END );
+ m_rWW8Export.OutputField( &rField, ww::eREF, sStr, FieldFlags::Start |
+ FieldFlags::CmdStart | FieldFlags::CmdEnd );
OUString sVar = lcl_GetExpandedField( rField );
if ( !sVar.isEmpty() )
{
SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sVar, false );
}
- m_rWW8Export.OutputField( &rField, ww::eREF, sStr, WRITEFIELD_CLOSE );
+ m_rWW8Export.OutputField( &rField, ww::eREF, sStr, FieldFlags::Close );
}
void WW8AttributeOutput::WriteExpand( const SwField* pField )