summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-16 14:41:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-16 16:14:46 +0200
commitfe1b87eb831d6e85b2db0591f933a9eede2e78cf (patch)
treea76fb5394821abc1280df7aa0cef73f6185affec
parentd22cc61705239d9fcf6ee9597da8c883e3c79da4 (diff)
convert SW*READER constants to scoped enum
Change-Id: I7cf635e238a16e7ec96e585e6eb5e2e9c39b545a Reviewed-on: https://gerrit.libreoffice.org/57497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/shellio.hxx15
-rw-r--r--sw/source/filter/basflt/fltini.cxx2
-rw-r--r--sw/source/filter/basflt/shellio.cxx14
-rw-r--r--sw/source/filter/docx/swdocxreader.cxx4
-rw-r--r--sw/source/filter/docx/swdocxreader.hxx2
-rw-r--r--sw/source/filter/inc/fltini.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/xml/swxml.cxx4
-rw-r--r--sw/source/uibase/app/docsh.cxx4
10 files changed, 30 insertions, 23 deletions
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 126374395895..efe86a0c2dbd 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -29,6 +29,7 @@
#include <tools/ref.hxx>
#include <rtl/ref.hxx>
#include <osl/thread.h>
+#include <o3tl/typed_flags_set.hxx>
#include "swdllapi.h"
#include "docfac.hxx"
@@ -172,8 +173,14 @@ protected:
};
// Special Readers can be both!! (Excel, W4W, .. ).
-#define SW_STREAM_READER 1
-#define SW_STORAGE_READER 2
+enum class SwReaderType {
+ NONE = 0x00,
+ Stream = 0x01,
+ Storage = 0x02
+};
+namespace o3tl {
+ template<> struct typed_flags<SwReaderType> : is_typed_flags<SwReaderType, 0x03> {};
+};
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOC(SvStream &rStream, const OUString &rFltName);
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportRTF(SvStream &rStream);
@@ -215,7 +222,7 @@ public:
Reader();
virtual ~Reader();
- virtual int GetReaderType();
+ virtual SwReaderType GetReaderType();
SwgReaderOption& GetReaderOpt() { return m_aOption; }
virtual void SetFltName( const OUString& rFltNm );
@@ -277,7 +284,7 @@ class SW_DLLPUBLIC StgReader : public Reader
OUString aFltName;
public:
- virtual int GetReaderType() override;
+ virtual SwReaderType GetReaderType() override;
const OUString& GetFltName() { return aFltName; }
virtual void SetFltName( const OUString& r ) override;
};
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 6c283a4cd9d0..64f607331d69 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -277,7 +277,7 @@ void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
void StgReader::SetFltName( const OUString& rFltNm )
{
- if( SW_STORAGE_READER & GetReaderType() )
+ if( SwReaderType::Storage & GetReaderType() )
aFltName = rFltNm;
}
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 24e92e23412b..ccfd9d69c74e 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -574,7 +574,7 @@ bool Reader::SetStrmStgPtr()
if( m_pMedium->IsStorage() )
{
- if( SW_STORAGE_READER & GetReaderType() )
+ if( SwReaderType::Storage & GetReaderType() )
{
m_xStorage = m_pMedium->GetStorage();
return true;
@@ -583,12 +583,12 @@ bool Reader::SetStrmStgPtr()
else
{
m_pStream = m_pMedium->GetInStream();
- if ( m_pStream && SotStorage::IsStorageFile(m_pStream) && (SW_STORAGE_READER & GetReaderType()) )
+ if ( m_pStream && SotStorage::IsStorageFile(m_pStream) && (SwReaderType::Storage & GetReaderType()) )
{
m_pStorage = new SotStorage( *m_pStream );
m_pStream = nullptr;
}
- else if ( !(SW_STREAM_READER & GetReaderType()) )
+ else if ( !(SwReaderType::Stream & GetReaderType()) )
{
m_pStream = nullptr;
return false;
@@ -599,9 +599,9 @@ bool Reader::SetStrmStgPtr()
return false;
}
-int Reader::GetReaderType()
+SwReaderType Reader::GetReaderType()
{
- return SW_STREAM_READER;
+ return SwReaderType::Stream;
}
void Reader::SetFltName( const OUString& )
@@ -678,9 +678,9 @@ bool Reader::ReadGlossaries( SwTextBlocks&, bool ) const
return false;
}
-int StgReader::GetReaderType()
+SwReaderType StgReader::GetReaderType()
{
- return SW_STORAGE_READER;
+ return SwReaderType::Storage;
}
/*
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 7c9a59f863f9..90a6a9f1224f 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -99,9 +99,9 @@ ErrCode SwDOCXReader::Read(SwDoc& rDoc, const OUString& /* rBaseURL */, SwPaM& r
return ret;
}
-int SwDOCXReader::GetReaderType()
+SwReaderType SwDOCXReader::GetReaderType()
{
- return SW_STORAGE_READER | SW_STREAM_READER;
+ return SwReaderType::Storage | SwReaderType::Stream;
}
bool SwDOCXReader::HasGlossaries() const
diff --git a/sw/source/filter/docx/swdocxreader.hxx b/sw/source/filter/docx/swdocxreader.hxx
index 8035b6b746b0..57900c12143b 100644
--- a/sw/source/filter/docx/swdocxreader.hxx
+++ b/sw/source/filter/docx/swdocxreader.hxx
@@ -28,7 +28,7 @@
class SwDOCXReader : public StgReader
{
public:
- virtual int GetReaderType() override;
+ virtual SwReaderType GetReaderType() override;
virtual bool HasGlossaries() const override;
virtual bool ReadGlossaries( SwTextBlocks& rBlocks, bool bSaveRelFiles ) const override;
diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx
index c20859fa5250..70cafaa46e94 100644
--- a/sw/source/filter/inc/fltini.hxx
+++ b/sw/source/filter/inc/fltini.hxx
@@ -43,7 +43,7 @@ class XMLReader : public Reader
{
virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override;
public:
- virtual int GetReaderType() override;
+ virtual SwReaderType GetReaderType() override;
XMLReader();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 8d38f4a4e0f7..f3f45bfc4970 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6347,9 +6347,9 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons
return nRet;
}
-int WW8Reader::GetReaderType()
+SwReaderType WW8Reader::GetReaderType()
{
- return SW_STORAGE_READER | SW_STREAM_READER;
+ return SwReaderType::Storage | SwReaderType::Stream;
}
bool WW8Reader::HasGlossaries() const
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 8bf8db6195ea..bf342b0b4345 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -134,7 +134,7 @@ class WW8Reader : public StgReader
virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override;
ErrCode OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize );
public:
- virtual int GetReaderType() override;
+ virtual SwReaderType GetReaderType() override;
virtual bool HasGlossaries() const override;
virtual bool ReadGlossaries( SwTextBlocks&, bool bSaveRelFiles ) const override;
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 3d64af5c5c57..ea8c6eacdc1c 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -121,9 +121,9 @@ XMLReader::XMLReader()
{
}
-int XMLReader::GetReaderType()
+SwReaderType XMLReader::GetReaderType()
{
- return SW_STORAGE_READER;
+ return SwReaderType::Storage;
}
namespace
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index d1ed88666246..1692517501c5 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -191,8 +191,8 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
return nullptr;
if( rMedium.IsStorage()
- ? SW_STORAGE_READER & pRead->GetReaderType()
- : SW_STREAM_READER & pRead->GetReaderType() )
+ ? SwReaderType::Storage & pRead->GetReaderType()
+ : SwReaderType::Stream & pRead->GetReaderType() )
{
*ppRdr = pPaM ? new SwReader( rMedium, aFileName, *pPaM ) :
pCursorShell ?