summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-12-02 10:56:17 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2019-12-02 17:38:57 +0100
commitd23c52cbf7e48130fec1e48bf726c563035a3497 (patch)
tree9a18bbb8dd62f2b21f7f1f016953a88b3e608e77
parent0a616e7e6cbeed4a689cacb6d6d8c6ed6779abd5 (diff)
tdf#47583 sw: Don't mix doc print settings into option dialog
Show and manage the default Writer print options in the "Tools" -> "Options" -> "LibreOfficeDev Writer" -> "Print" dialog and don't mix in the document-specific values of the currently opened document, as this is rather confusing as described in tdf#47583. There is a separate dialog to manage the settings for the currently opened document available via "File" -> "Printer Settings" -> "Options". At a quick glance, this also matches the behaviour for Calc, which doesn't mix in the current doc's settings either. This handles the case for the Writer-specific print options. For a more general approach on whether and how document-specific options should be handled in the "Tools" -> "Options" dialog at all, there are already tdf#43786 ("Intransparent Use of Options") and tdf#105751 ("Separate document saved options from global options in Options dialog"). Side note: The previous implementation also wasn't synchronizing the settings both ways. Changes made in the "File" -> "Printer Settings" -> "Options" dialog did show up in the "Tools" -> "Options" -> "LibreOfficeDev Writer" -> "Print" dialog at once, but not the other way around. The reason is that Writer-specific print settings are currently managed in two places in DocumentDeviceManager: (1) its SwPrintData, accessible via 'DocumentDeviceManager::{g,s}etPrintData' (2) the print data set in its 'SfxPrinter*' ('DocumentDeviceManager::{g,s}etPrinter') The "File" -> "Printer Settings" -> "Options" dialog uses the settings from the SfxPrinter. So, to make synchronization work both ways with the previous implementation, the changes made in the "Tools" -> "Options" dialog would also have to be applied for (2), not just (1), e.g. this way: diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 9c7e24592014..83bae7eb71b9 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -371,8 +371,15 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) const SwAddPrinterItem* pAddPrinterAttr = static_cast<const SwAddPrinterItem*>(pItem); *pOpt = *pAddPrinterAttr; - if(pAppView) + if(pAppView) { pAppView->GetWrtShell().getIDocumentDeviceAccess().setPrintData( *pOpt ); + SfxPrinter* pDocPrinter = pAppView->GetWrtShell().getIDocumentDeviceAccess().getPrinter(false); + if (pDocPrinter) { + SfxItemSet aOptions(pDocPrinter->GetOptions()); + aOptions.Put(*pAddPrinterAttr); + pDocPrinter->SetOptions(aOptions); + } + } } } (Maybe that should be consolidated at some point in time...) Change-Id: I74961f4d8947e200b415e6e32e128a0ce3d317f5 Reviewed-on: https://gerrit.libreoffice.org/84212 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--sw/source/uibase/app/appopt.cxx11
1 files changed, 1 insertions, 10 deletions
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 9c7e24592014..f071b85997fe 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -209,13 +209,7 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
pRet->Put(aGridItem);
// Options for PrintTabPage
- const SwPrintData* pOpt = pAppView ?
- &pAppView->GetWrtShell().getIDocumentDeviceAccess().getPrintData() :
- nullptr;
-
- if(!pOpt)
- pOpt = GetPrtOptions(!bTextDialog);
-
+ const SwPrintData* pOpt = GetPrtOptions(!bTextDialog);
SwAddPrinterItem aAddPrinterItem(*pOpt );
pRet->Put(aAddPrinterItem);
@@ -370,9 +364,6 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
{
const SwAddPrinterItem* pAddPrinterAttr = static_cast<const SwAddPrinterItem*>(pItem);
*pOpt = *pAddPrinterAttr;
-
- if(pAppView)
- pAppView->GetWrtShell().getIDocumentDeviceAccess().setPrintData( *pOpt );
}
}