diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 10:34:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-01 09:20:08 +0200 |
commit | da64ad86e9f2dd66fbcecb46dcc22626e9f5a6a6 (patch) | |
tree | 6d566510d16fbf0d9525bde5ac435cf23c39fe48 /sw/source/core/doc/DocumentDeviceManager.cxx | |
parent | 5dccc6130242a67b6c471245d289cd4a0419602a (diff) |
loplugin:flatten in sw/core/doc
Change-Id: If7738d47ec0273f24eee99b7336380cfa78c1243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99896
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/doc/DocumentDeviceManager.cxx')
-rw-r--r-- | sw/source/core/doc/DocumentDeviceManager.cxx | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index 18da1249341c..5dadd15d2130 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -143,38 +143,38 @@ OutputDevice* DocumentDeviceManager::getReferenceDevice(/*[in]*/ bool bCreate ) void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*[in]*/ bool bNewHiRes ) { - if ( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual || - m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) != bNewHiRes ) - { - if ( bNewVirtual ) - { - VirtualDevice* pMyVirDev = getVirtualDevice( true ); - if ( !bNewHiRes ) - pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::Dpi600 ); - else - pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); + if ( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_VIRTUAL_DEVICE) == bNewVirtual && + m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) == bNewHiRes ) + return; - if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) - m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev ); - } + if ( bNewVirtual ) + { + VirtualDevice* pMyVirDev = getVirtualDevice( true ); + if ( !bNewHiRes ) + pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::Dpi600 ); else - { - // #i41075# - // We have to take care that a printer exists before calling - // PrtDataChanged() in order to prevent that PrtDataChanged() - // triggers this funny situation: - // getReferenceDevice()->getPrinter()->CreatePrinter_() - // ->setPrinter()-> PrtDataChanged() - SfxPrinter* pPrinter = getPrinter( true ); - if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) - m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter ); - } + pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); - m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_VIRTUAL_DEVICE, bNewVirtual ); - m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes ); - PrtDataChanged(); - m_rDoc.getIDocumentState().SetModified(); + if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) + m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev ); + } + else + { + // #i41075# + // We have to take care that a printer exists before calling + // PrtDataChanged() in order to prevent that PrtDataChanged() + // triggers this funny situation: + // getReferenceDevice()->getPrinter()->CreatePrinter_() + // ->setPrinter()-> PrtDataChanged() + SfxPrinter* pPrinter = getPrinter( true ); + if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) + m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter ); } + + m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_VIRTUAL_DEVICE, bNewVirtual ); + m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes ); + PrtDataChanged(); + m_rDoc.getIDocumentState().SetModified(); } const JobSetup* DocumentDeviceManager::getJobsetup() const |