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 /sc/source | |
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 'sc/source')
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index d2afa88c659e..6894813441e4 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -70,6 +70,7 @@ static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap() {OUString(SC_UNO_AUTOCALC), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_PRINTERNAME), 0, cppu::UnoType<OUString>::get(), 0, 0}, {OUString(SC_UNO_PRINTERSETUP), 0, cppu::UnoType<uno::Sequence<sal_Int8>>::get(), 0, 0}, + {OUString(SC_UNO_PRINTERPAPER), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_APPLYDOCINF), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_FORBIDDEN), 0, cppu::UnoType<i18n::XForbiddenCharacters>::get(), beans::PropertyAttribute::READONLY, 0}, {OUString(SC_UNO_CHARCOMP), 0, cppu::UnoType<sal_Int16>::get(), 0, 0}, @@ -240,7 +241,28 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET, SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS>{} ); - pDocShell->SetPrinter( SfxPrinter::Create( aStream, std::move(pSet) ) ); + + SfxPrinter* pPrinter = pDocShell->GetPrinter(); + bool bPreferPrinterPapersize = false; + if ( pPrinter ) + bPreferPrinterPapersize = pPrinter->GetPrinterSettingsPreferred(); + + VclPtr<SfxPrinter> pTempPrinter = SfxPrinter::Create( aStream, std::move(pSet) ); + pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize ); + pDocShell->SetPrinter( pTempPrinter ); + } + } + } + else if ( aPropertyName == SC_UNO_PRINTERPAPER ) + { + bool bPreferPrinterPapersize; + if( aValue >>= bPreferPrinterPapersize ) + { + if( pDocShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) + { + SfxPrinter *pTempPrinter = pDocShell->GetPrinter( true ); + if (pTempPrinter) + pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize ); } } } @@ -462,6 +484,12 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr else aRet <<= uno::Sequence<sal_Int8>(); } + else if ( aPropertyName == SC_UNO_PRINTERPAPER) + { + SfxPrinter *pTempPrinter = pDocShell->GetPrinter( false ); + aRet <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred(); + + } else if ( aPropertyName == SC_UNO_APPLYDOCINF ) aRet <<= pDocShell->IsUseUserData(); else if ( aPropertyName == SC_UNO_FORBIDDEN ) |