diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-11-27 13:51:55 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-12-21 10:46:39 +0100 |
commit | 785a8564ebb501e2e623133e214467b947f7e671 (patch) | |
tree | acb35956f393e3eafe8d983bb87cfd89bc6de1e8 /sw | |
parent | bf8e8cf11bc0d60ab80f5b3420dc424aec2fa626 (diff) |
tdf#79077: Load/save PapersizeFromSetup into ODF for sw and sc
Change-Id: I0fc1a771927dc7116768cfbb7f7e31006e41e1c8
Reviewed-on: https://gerrit.libreoffice.org/45332
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.hxx | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index ee86063fea52..d7009cd20b26 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -74,6 +74,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_ALIGN_TAB_STOP_POSITION, HANDLE_PRINTER_NAME, HANDLE_PRINTER_SETUP, + HANDLE_PRINTER_PAPER, HANDLE_IS_KERN_ASIAN_PUNCTUATION, HANDLE_CHARACTER_COMPRESSION_TYPE, HANDLE_APPLY_USER_DATA, @@ -150,6 +151,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0}, { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0}, { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0}, + { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0}, { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0}, { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0}, { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0}, @@ -248,6 +250,7 @@ SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel ) , mpDocSh ( nullptr ) , mpDoc ( nullptr ) , mpPrinter( nullptr ) +, mbPreferPrinterPapersize( false ) { registerSlave ( new SwXPrintSettings ( SwXPrintSettingsType::Document, mpModel->GetDocShell()->GetDoc() ) ); } @@ -441,6 +444,14 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } break; + case HANDLE_PRINTER_PAPER: + { + bool bPreferPrinterPapersize; + if(!(rValue >>= bPreferPrinterPapersize)) + throw IllegalArgumentException(); + mbPreferPrinterPapersize = bPreferPrinterPapersize; + } + break; case HANDLE_IS_KERN_ASIAN_PUNCTUATION: { bool bIsKern = *o3tl::doAccess<bool>(rValue); @@ -884,6 +895,7 @@ void SwXDocumentSettings::_postSetValues () SwAddPrinterItem aAddPrinterItem (aPrtData); aOptions.Put(aAddPrinterItem); mpPrinter->SetOptions( aOptions ); + mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize ); mpDoc->getIDocumentDeviceAccess().setPrinter( mpPrinter, true, true ); } @@ -972,6 +984,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_PRINTER_PAPER: + { + SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false ); + rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred(); + } + break; case HANDLE_IS_KERN_ASIAN_PUNCTUATION: { rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::KERN_ASIAN_PUNCTUATION); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.hxx b/sw/source/uibase/uno/SwXDocumentSettings.hxx index 5c9e28c78302..6f4adc542f2f 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.hxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx @@ -45,6 +45,7 @@ class SwXDocumentSettings final : * printer-related properties, remember the last printer and set it in * _postSetValues */ VclPtr<SfxPrinter> mpPrinter; + bool mbPreferPrinterPapersize; virtual void _preSetValues () override; virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) override; |