summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-01-07 11:53:42 +0200
committerNoel Grandin <noel@peralex.com>2015-01-07 12:53:39 +0200
commit306f04830300c239fd74677bcc61efcb5a4532ea (patch)
tree99e45a78bdf3a7ed307ac87306737e976302b649
parentf536699304e951ab2e104118ad36335ee0f1b268 (diff)
fdo#84938: convert COMPRESSMODE_ #defines to 'enum class'
Change-Id: Ica501fc73e7e5f9dbd30dd9da3f337b2dc7e6f02
-rw-r--r--editeng/source/items/bulitem.cxx2
-rw-r--r--include/svx/svdmodel.hxx1
-rw-r--r--include/tools/stream.hxx18
-rw-r--r--svtools/source/misc/transfer.cxx2
-rw-r--r--svx/source/gallery2/galobj.cxx6
-rw-r--r--svx/source/svdraw/svdmodel.cxx1
-rw-r--r--svx/source/xml/xmlgrhlp.cxx4
-rw-r--r--tools/source/stream/stream.cxx2
-rw-r--r--vcl/source/gdi/dibtools.cxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx4
-rw-r--r--vcl/source/gdi/impgraph.cxx6
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx2
12 files changed, 27 insertions, 23 deletions
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index a0dd0eca3956..0936d982345e 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -328,7 +328,7 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
sal_Size _nStart = rStrm.Tell();
// Small preliminary estimate of the size ...
- sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1;
+ sal_uInt16 nFac = ( rStrm.GetCompressMode() != SvStreamCompressFlags::NONE ) ? 3 : 1;
const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() );
sal_uLong nBytes = aBmp.GetSizeBytes();
if ( nBytes < sal_uLong(0xFF00*nFac) )
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index bbca71019c30..30db1efdb21a 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -205,7 +205,6 @@ protected:
bool bSaveNative:1;
bool bStarDrawPreviewMode:1;
bool mbDisableTextEditUsesCommonUndoManager:1;
- sal_uInt16 nStreamCompressMode; // write compressedly?
SvStreamEndian nStreamNumberFormat;
sal_uInt16 nDefaultTabulator;
sal_uInt32 nMaxUndoCount;
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index e80d0978e845..59561de1d9c2 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -79,9 +79,15 @@ namespace o3tl
enum class SvStreamEndian { BIG, LITTLE };
-#define COMPRESSMODE_NONE (sal_uInt16)0x0000
-#define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001
-#define COMPRESSMODE_NATIVE (sal_uInt16)0x0010
+enum class SvStreamCompressFlags {
+ NONE = 0x0000,
+ ZBITMAP = 0x0001,
+ NATIVE = 0x0010,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvStreamCompressFlags> : is_typed_flags<SvStreamCompressFlags, 0x0011> {};
+}
class SvStream;
@@ -222,7 +228,7 @@ private:
bool bIsEof;
sal_uInt32 nError;
SvStreamEndian nEndian;
- sal_uInt16 nCompressMode;
+ SvStreamCompressFlags nCompressMode;
LineEnd eLineDelimiter;
rtl_TextEncoding eStreamCharSet;
@@ -278,9 +284,9 @@ public:
/// returns status of endian swap flag
bool IsEndianSwap() const { return bSwap; }
- void SetCompressMode( sal_uInt16 nNewMode )
+ void SetCompressMode( SvStreamCompressFlags nNewMode )
{ nCompressMode = nNewMode; }
- sal_uInt16 GetCompressMode() const { return nCompressMode; }
+ SvStreamCompressFlags GetCompressMode() const { return nCompressMode; }
void SetCryptMaskKey(const OString& rCryptMaskKey);
const OString& GetCryptMaskKey() const { return m_aCryptMaskKey; }
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 81defcc9f04f..d963953b6ca0 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -801,7 +801,7 @@ bool TransferableHelper::SetGraphic( const Graphic& rGraphic, const DataFlavor&
SvMemoryStream aMemStm( 65535, 65535 );
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
- aMemStm.SetCompressMode( COMPRESSMODE_NATIVE );
+ aMemStm.SetCompressMode( SvStreamCompressFlags::NATIVE );
WriteGraphic( aMemStm, rGraphic );
maAny <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
}
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 4fe3e054e6bc..3205a9ca0927 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -178,10 +178,10 @@ void SgaObject::WriteData( SvStream& rOut, const OUString& rDestDir ) const
if( bIsThumbBmp )
{
- const sal_uInt16 nOldCompressMode = rOut.GetCompressMode();
- const sal_uIntPtr nOldVersion = rOut.GetVersion();
+ const SvStreamCompressFlags nOldCompressMode = rOut.GetCompressMode();
+ const sal_uIntPtr nOldVersion = rOut.GetVersion();
- rOut.SetCompressMode( COMPRESSMODE_ZBITMAP );
+ rOut.SetCompressMode( SvStreamCompressFlags::ZBITMAP );
rOut.SetVersion( SOFFICE_FILEFORMAT_50 );
WriteDIBBitmapEx(aThumbBmp, rOut);
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 84efe695a76e..60aec9453890 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -154,7 +154,6 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
bPasteResize=false;
bNoBitmapCaching=false;
bReadOnly=false;
- nStreamCompressMode=COMPRESSMODE_NONE;
nStreamNumberFormat=SvStreamEndian::BIG;
nDefaultTabulator=0;
mpNumberFormatter = NULL;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 568d76b0e4f2..07d475a9703b 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -134,7 +134,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
{
pStm->SetVersion( SOFFICE_FILEFORMAT_8 );
- pStm->SetCompressMode( COMPRESSMODE_ZBITMAP );
+ pStm->SetCompressMode( SvStreamCompressFlags::ZBITMAP );
( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm );
bRet = ( pStm->GetError() == 0 );
}
@@ -554,7 +554,7 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName,
else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
{
pStream->SetVersion( SOFFICE_FILEFORMAT_8 );
- pStream->SetCompressMode( COMPRESSMODE_ZBITMAP );
+ pStream->SetCompressMode( SvStreamCompressFlags::ZBITMAP );
// SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 4287fb7a88e0..19ebddf20a96 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -378,7 +378,7 @@ void SvStream::SetSize(sal_uInt64 const nSize)
void SvStream::ImpInit()
{
m_nActPos = 0;
- nCompressMode = COMPRESSMODE_NONE;
+ nCompressMode = SvStreamCompressFlags::NONE;
eStreamCharSet = osl_getThreadTextEncoding();
nCryptMask = 0;
bIsEof = false;
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 054c070264cd..d226edc23cd9 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -1259,7 +1259,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess&
}
}
- if((rOStm.GetCompressMode() & COMPRESSMODE_ZBITMAP) && (rOStm.GetVersion() >= SOFFICE_FILEFORMAT_40))
+ if((rOStm.GetCompressMode() & SvStreamCompressFlags::ZBITMAP) && (rOStm.GetVersion() >= SOFFICE_FILEFORMAT_40))
{
aHeader.nCompression = ZCOMPRESS;
}
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3a6159ec9313..ac83c6da11a0 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2856,7 +2856,7 @@ SvStream& GDIMetaFile::Read( SvStream& rIStm )
SvStream& GDIMetaFile::Write( SvStream& rOStm )
{
VersionCompat* pCompat;
- const sal_uInt32 nStmCompressMode = rOStm.GetCompressMode();
+ const SvStreamCompressFlags nStmCompressMode = rOStm.GetCompressMode();
SvStreamEndian nOldFormat = rOStm.GetEndian();
rOStm.SetEndian( SvStreamEndian::LITTLE );
@@ -2864,7 +2864,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
pCompat = new VersionCompat( rOStm, StreamMode::WRITE, 1 );
- rOStm.WriteUInt32( nStmCompressMode );
+ rOStm.WriteUInt32( static_cast<sal_uInt32>(nStmCompressMode) );
WriteMapMode( rOStm, aPrefMapMode );
WritePair( rOStm, aPrefSize );
rOStm.WriteUInt32( GetActionSize() );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 308d65d667c2..d0b74f4e7f74 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1172,7 +1172,7 @@ bool ImpGraphic::ImplSwapOut()
if( pOStm )
{
pOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
- pOStm->SetCompressMode( COMPRESSMODE_NATIVE );
+ pOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
if( ( bRet = ImplSwapOut( pOStm.get() ) ) )
{
@@ -1271,7 +1271,7 @@ bool ImpGraphic::ImplSwapIn()
if( pIStm )
{
pIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
- pIStm->SetCompressMode( COMPRESSMODE_NATIVE );
+ pIStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
bRet = ImplSwapIn( pIStm.get() );
pIStm.reset();
@@ -1580,7 +1580,7 @@ SvStream& WriteImpGraphic( SvStream& rOStm, const ImpGraphic& rImpGraphic )
if( !rImpGraphic.ImplIsSwapOut() )
{
if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) &&
- ( rOStm.GetCompressMode() & COMPRESSMODE_NATIVE ) &&
+ ( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) &&
rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() )
{
VersionCompat* pCompat;
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index c87993434880..73344f990bd1 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -162,7 +162,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap
{ // to determine if jpeg compression is useful
SvMemoryStream aTemp;
- aTemp.SetCompressMode( aTemp.GetCompressMode() | COMPRESSMODE_ZBITMAP );
+ aTemp.SetCompressMode( aTemp.GetCompressMode() | SvStreamCompressFlags::ZBITMAP );
aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
WriteDIBBitmapEx(aBitmapEx, aTemp); // is capable of zlib stream compression
aTemp.Seek( STREAM_SEEK_TO_END );