[Libreoffice-commits] core.git: sw/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 2 16:39:56 UTC 2019
sw/source/uibase/app/appopt.cxx | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
New commits:
commit d23c52cbf7e48130fec1e48bf726c563035a3497
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Dec 2 10:56:17 2019 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Dec 2 17:38:57 2019 +0100
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 at posteo.de>
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 );
}
}
More information about the Libreoffice-commits
mailing list