diff options
author | Noel Grandin <noel@peralex.com> | 2016-08-31 16:15:27 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-09-01 11:05:21 +0200 |
commit | a53e6e2b3cc92e46961260137208eacec474093f (patch) | |
tree | a47369a1bb4b76af34bbd94e194a681606ce5085 | |
parent | 3a897f7cbf44f44f2baa750f85d9aecbbbd2b6f9 (diff) |
convert RefDevMode to scoped enum
and fix the bForceZeroExtleadBug TODO
Change-Id: Iac9295c6ce31112d69a870e3a229823eb1e9a4f2
-rw-r--r-- | drawinglayer/source/primitive2d/textlayoutdevice.cxx | 2 | ||||
-rw-r--r-- | include/vcl/virdev.hxx | 24 | ||||
-rw-r--r-- | sc/source/core/data/documen8.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod.cxx | 2 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentDeviceManager.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 31 |
8 files changed, 36 insertions, 35 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 22290230ec81..4f6d40701c79 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -100,7 +100,7 @@ namespace if(!mpVirDev) { mpVirDev = VclPtr<VirtualDevice>::Create(); - mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); + mpVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); } if(!mnUseCount) diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 084ed9b97a1e..3ec857345df7 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -33,6 +33,14 @@ class VCL_DLLPUBLIC VirtualDevice : public OutputDevice friend class Application; friend class ::OutputDevice; friend class Printer; +public: + // reference device modes for different compatibility levels + enum class RefDevMode { NONE = 0, + Dpi600 = 1, // 600 dpi + MSO1 = 3, + PDF1 = 4, + Custom = 5 + }; private: SalVirtualDevice* mpVirDev; @@ -42,7 +50,8 @@ private: bool mbScreenComp; DeviceFormat meFormat; DeviceFormat meAlphaFormat; - sal_uInt8 meRefDevMode; + RefDevMode meRefDevMode; + bool mbForceZeroExtleadBug; SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ); SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, @@ -59,10 +68,7 @@ private: */ SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const Rectangle& rRect ); - // TODO: add extra member for refdev backward compatibility options - #define REFDEV_FORCE_ZERO_EXTLEAD 0x80 - SAL_DLLPRIVATE bool ForceZeroExtleadBug() const - { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); } + SAL_DLLPRIVATE bool ForceZeroExtleadBug() const { return mbForceZeroExtleadBug; } protected: virtual bool AcquireGraphics() const override; @@ -131,14 +137,6 @@ public: bool SetOutputSize( const Size& rNewSize ) { return SetOutputSizePixel( LogicToPixel( rNewSize ) ); } - // reference device modes for different compatibility levels - enum RefDevMode { REFDEV_NONE = 0, - REFDEV_MODE06 = 1, // 600 dpi - REFDEV_MODE_MSO1 = 3, - REFDEV_MODE_PDF1 = 4, - REFDEV_CUSTOM = 5 - }; - void SetReferenceDevice( RefDevMode ); void Compat_ZeroExtleadBug(); // enable workaround for #i60495# diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index e7bef1ad39fe..85957cc9d1ac 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -195,7 +195,7 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm() #else pVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK); #endif - pVirtualDevice_100th_mm->SetReferenceDevice(VirtualDevice::REFDEV_MODE_MSO1); + pVirtualDevice_100th_mm->SetReferenceDevice(VirtualDevice::RefDevMode::MSO1); MapMode aMapMode( pVirtualDevice_100th_mm->GetMapMode() ); aMapMode.SetMapUnit( MAP_100TH_MM ); pVirtualDevice_100th_mm->SetMapMode( aMapMode ); diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 9f0ff7de6be2..3da56e0ece1d 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -94,7 +94,7 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) // formatting of text in small sizes (6 point and below.) mpVirtualRefDevice.reset(VclPtr<VirtualDevice>::Create()); mpVirtualRefDevice->SetMapMode( MAP_100TH_MM ); - mpVirtualRefDevice->SetReferenceDevice ( VirtualDevice::REFDEV_MODE06 ); + mpVirtualRefDevice->SetReferenceDevice ( VirtualDevice::RefDevMode::Dpi600 ); } // Dtor diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index e4d544569818..014620ac4700 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -230,7 +230,7 @@ VirtualDevice &SmModule::GetDefaultVirtualDev() if (!mpVirtualDev) { mpVirtualDev.reset( VclPtr<VirtualDevice>::Create() ); - mpVirtualDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); + mpVirtualDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); } return *mpVirtualDev; } diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index e6bc91d264cb..2aae3a1ca6ce 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -151,9 +151,9 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /* { VirtualDevice* pMyVirDev = getVirtualDevice( true ); if ( !bNewHiRes ) - pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE06 ); + pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::Dpi600 ); else - pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); + pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev ); @@ -265,7 +265,7 @@ VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK); #endif - pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); + pNewVir->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); // #i60945# External leading compatibility for unix systems. if ( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING ) ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e80d9864d5fe..6a62eacc9e28 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2203,7 +2203,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() m_pReferenceDevice = pVDev; if( m_aContext.DPIx == 0 || m_aContext.DPIy == 0 ) - pVDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_PDF1 ); + pVDev->SetReferenceDevice( VirtualDevice::RefDevMode::PDF1 ); else pVDev->SetReferenceDevice( m_aContext.DPIx, m_aContext.DPIy ); diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 3dac7a87f514..af95978c0a6a 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -209,7 +209,8 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, VirtualDevice::VirtualDevice(DeviceFormat eFormat) : mpVirDev( nullptr ), - meRefDevMode( REFDEV_NONE ) + meRefDevMode( RefDevMode::NONE ), + mbForceZeroExtleadBug( false ) { SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" ); @@ -218,7 +219,8 @@ VirtualDevice::VirtualDevice(DeviceFormat eFormat) VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat eFormat) : mpVirDev( nullptr ), - meRefDevMode( REFDEV_NONE ) + meRefDevMode( RefDevMode::NONE ), + mbForceZeroExtleadBug( false ) { SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" ); @@ -227,7 +229,8 @@ VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat eFormat) VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat eFormat, DeviceFormat eAlphaFormat) : mpVirDev( nullptr ) - , meRefDevMode( REFDEV_NONE ) + , meRefDevMode( RefDevMode::NONE ) + , mbForceZeroExtleadBug( false ) { SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << ", " << static_cast<int>(eAlphaFormat) << " )" ); @@ -241,7 +244,8 @@ VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat eFormat, VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize, DeviceFormat eFormat) : mpVirDev( nullptr ), - meRefDevMode( REFDEV_NONE ) + meRefDevMode( RefDevMode::NONE ), + mbForceZeroExtleadBug( false ) { SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" ); @@ -456,17 +460,17 @@ void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) sal_Int32 nDPIX = 600, nDPIY = 600; switch( i_eRefDevMode ) { - case REFDEV_NONE: + case RefDevMode::NONE: default: SAL_WARN( "vcl", "VDev::SetRefDev illegal argument!" ); break; - case REFDEV_MODE06: + case RefDevMode::Dpi600: nDPIX = nDPIY = 600; break; - case REFDEV_MODE_MSO1: + case RefDevMode::MSO1: nDPIX = nDPIY = 6*1440; break; - case REFDEV_MODE_PDF1: + case RefDevMode::PDF1: nDPIX = nDPIY = 720; break; } @@ -475,7 +479,7 @@ void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) { - ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY ); + ImplSetReferenceDevice( RefDevMode::Custom, i_nDPIX, i_nDPIY ); } void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) @@ -492,10 +496,9 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 mbNewFont = true; // avoid adjusting font lists when already in refdev mode - sal_uInt8 nOldRefDevMode = meRefDevMode; - sal_uInt8 nOldCompatFlag = (sal_uInt8)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD; - meRefDevMode = (sal_uInt8)(i_eRefDevMode | nOldCompatFlag); - if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE ) + RefDevMode nOldRefDevMode = meRefDevMode; + meRefDevMode = i_eRefDevMode; + if( nOldRefDevMode != RefDevMode::NONE ) return; // the reference device should have only scalable fonts @@ -543,7 +546,7 @@ bool VirtualDevice::UsePolyPolygonForComplexGradient() void VirtualDevice::Compat_ZeroExtleadBug() { - meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD; + mbForceZeroExtleadBug = true; } long VirtualDevice::GetFontExtLeading() const |