[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 5 commits - include/vcl sc/inc sc/source sd/source sw/source vcl/inc vcl/source vcl/uiconfig vcl/unx
Katarina Behrens
Katarina.Behrens at cib.de
Tue Jan 2 03:10:44 UTC 2018
include/vcl/jobdata.hxx | 2 +
include/vcl/print.hxx | 6 +++-
include/vcl/printerinfomanager.hxx | 4 +-
include/vcl/prntypes.hxx | 6 ++++
sc/inc/unonames.hxx | 1
sc/source/ui/unoobj/confuno.cxx | 29 ++++++++++++++++++++-
sd/source/ui/unoidl/UnoDocumentSettings.cxx | 31 +++++++++++++++++++++-
sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 +++++++++++++
sw/source/uibase/uno/SwXDocumentSettings.hxx | 1
vcl/inc/jobset.h | 3 ++
vcl/source/gdi/jobset.cxx | 2 +
vcl/source/gdi/print.cxx | 26 +++++++++++++++++-
vcl/source/gdi/print3.cxx | 4 +-
vcl/uiconfig/ui/printerpaperpage.ui | 31 ++++++++++++++++------
vcl/unx/generic/print/genprnpsp.cxx | 3 ++
vcl/unx/generic/print/prtsetup.cxx | 37 +++++++++++++++++++++++----
vcl/unx/generic/print/prtsetup.hxx | 4 ++
vcl/unx/generic/printer/jobdata.cxx | 1
18 files changed, 185 insertions(+), 24 deletions(-)
New commits:
commit eacf6ae77ca7815f80addb90d066a7aa4c6c6a53
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Dec 21 23:09:33 2017 +0100
tdf#79077: Mildly improved user experience
Reviewed-on: https://gerrit.libreoffice.org/46936
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 2113282cf957943d08999e7c7071a76734cf2c00)
Conflicts:
include/vcl/print.hxx
vcl/inc/jobset.h
vcl/inc/printerinfomanager.hxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/print.cxx
vcl/source/gdi/print3.cxx
vcl/uiconfig/ui/printerpaperpage.ui
vcl/unx/generic/print/genprnpsp.cxx
Change-Id: I3cf63d06c3c238ed936a8dd0287cfbe02e8e39be
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 15d36be5cdb2..f0d307f72b8a 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -293,7 +293,8 @@ public:
bool SetJobSetup( const JobSetup& rSetup );
const JobSetup& GetJobSetup() const { return maJobSetup; }
- bool Setup( vcl::Window* pWindow = nullptr );
+ bool Setup( vcl::Window* pWindow = nullptr,
+ PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal );
bool SetPrinterProps( const Printer* pPrinter );
/** SetPrinterOptions is used internally only now
diff --git a/include/vcl/printerinfomanager.hxx b/include/vcl/printerinfomanager.hxx
index f548bf239e91..041b3799338f 100644
--- a/include/vcl/printerinfomanager.hxx
+++ b/include/vcl/printerinfomanager.hxx
@@ -26,6 +26,7 @@
#include <vcl/dllapi.h>
#include <vcl/helper.hxx>
#include <vcl/jobdata.hxx>
+#include <vcl/prntypes.hxx>
#include <osl/file.hxx>
#include <cstdio>
@@ -50,11 +51,10 @@ struct PrinterInfo : JobData
// a list of special features separated by ',' not used by psprint
// but assigned from the outside (currently for "fax","pdf=","autoqueue","external_dialog")
OUString m_aFeatures;
- bool m_bPapersizeFromSetup;
+ PrinterSetupMode meSetupMode;
PrinterInfo()
: JobData()
- , m_bPapersizeFromSetup(false)
{}
};
diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx
index 06cf3f800196..fccb9b6ab87c 100644
--- a/include/vcl/prntypes.hxx
+++ b/include/vcl/prntypes.hxx
@@ -84,6 +84,12 @@ enum class PrinterCapType
UsePullModel = 12,
};
+enum class PrinterSetupMode
+{
+ SingleJob = 0,
+ DocumentGlobal = 1
+};
+
#endif // INCLUDED_VCL_PRNTYPES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h
index 09480202dccb..9f77aa9555b5 100644
--- a/vcl/inc/jobset.h
+++ b/vcl/inc/jobset.h
@@ -48,6 +48,9 @@ struct ImplJobSetup
sal_uInt32 mnDriverDataLen; //< length of system specific data
sal_uInt8* mpDriverData; //< system specific data (will be streamed a byte block)
bool mbPapersizeFromSetup;
+ // setup mode
+ PrinterSetupMode meSetupMode;
+ // TODO: orig paper size
std::unordered_map< OUString, OUString, OUStringHash > maValueMap;
};
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index ae4fc75a9e98..f557a01c4b6a 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -62,6 +62,7 @@ ImplJobSetup::ImplJobSetup()
mnDriverDataLen = 0;
mpDriverData = nullptr;
mbPapersizeFromSetup = false;
+ meSetupMode = PrinterSetupMode::DocumentGlobal;
}
ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index e96cd8c76899..f0fc49bf2c6d 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1075,7 +1075,7 @@ bool Printer::SetJobSetup( const JobSetup& rSetup )
return false;
}
-bool Printer::Setup( vcl::Window* pWindow )
+bool Printer::Setup( vcl::Window* pWindow, PrinterSetupMode eMode )
{
if ( IsDisplayPrinter() )
return false;
@@ -1085,6 +1085,9 @@ bool Printer::Setup( vcl::Window* pWindow )
JobSetup aJobSetup = maJobSetup;
ImplJobSetup* pData = aJobSetup.ImplGetData();
+ pData->meSetupMode = eMode;
+ // TODO: orig page size
+
SalFrame* pFrame;
if ( !pWindow )
pWindow = ImplGetDefaultWindow();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index f48b483580ce..3fc31287aa57 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -811,13 +811,13 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
// whatever happens to be the current page
// (but only if the printer config has changed, otherwise
// don't override printer page auto-detection - tdf#91362)
- if (getPrinterModified())
+ if (getPrinterModified() || getPapersizeFromSetup())
{
resetPaperToLastConfigured();
}
// call driver setup
- bRet = mpImplData->mxPrinter->Setup( i_pParent );
+ bRet = mpImplData->mxPrinter->Setup( i_pParent, PrinterSetupMode::SingleJob );
Size aNewPaperSize(mpImplData->mxPrinter->GetPaperSize());
if (bRet)
{
diff --git a/vcl/uiconfig/ui/printerpaperpage.ui b/vcl/uiconfig/ui/printerpaperpage.ui
index 847191b1613f..7117b76a8ace 100644
--- a/vcl/uiconfig/ui/printerpaperpage.ui
+++ b/vcl/uiconfig/ui/printerpaperpage.ui
@@ -26,7 +26,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label4">
+ <object class="GtkLabel" id="orientft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -111,7 +111,6 @@
<child>
<object class="GtkCheckButton" id="papersizefromsetup">
<property name="label" translatable="yes">Use only paper size from printer preferences</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 91498caf479e..dfc8a126a812 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -561,6 +561,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup )
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
}
aInfo.m_bPapersizeFromSetup = pJobSetup->mbPapersizeFromSetup;
+ aInfo.meSetupMode = pJobSetup->meSetupMode;
if (SetupPrinterDriver(aInfo))
{
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index 310e35fe6497..c8da1cc96418 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -141,6 +141,10 @@ IMPL_LINK_TYPED( RTSDialog, ClickButton, Button*, pButton, void )
// orientation
m_aJobData.m_eOrientation = m_pPaperPage->getOrientation() == 0 ?
orientation::Portrait : orientation::Landscape;
+ // assume use of paper size from printer setup if the user
+ // got here via File > Printer Settings ...
+ m_aJobData.m_bPapersizeFromSetup =
+ ( m_aJobData.meSetupMode == PrinterSetupMode::DocumentGlobal );
}
if( m_pDevicePage )
{
@@ -166,6 +170,7 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
get(m_pCbFromSetup, "papersizefromsetup");
get(m_pPaperText, "paperft");
get(m_pPaperBox, "paperlb");
+ get(m_pOrientText, "orientft");
get(m_pOrientBox, "orientlb");
get(m_pDuplexText, "duplexft");
get(m_pDuplexBox, "duplexlb");
@@ -202,9 +207,10 @@ RTSPaperPage::~RTSPaperPage()
void RTSPaperPage::dispose()
{
m_pParent.clear();
- m_pPaperText.clear();
m_pCbFromSetup.clear();
+ m_pPaperText.clear();
m_pPaperBox.clear();
+ m_pOrientText.clear();
m_pOrientBox.clear();
m_pDuplexText.clear();
m_pDuplexBox.clear();
@@ -257,14 +263,21 @@ void RTSPaperPage::update()
m_pSlotBox->Enable( false );
}
- if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
- m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup );
- // disable those, unless user wants to use papersize from printer prefs
- // as they have no influence on what's going to be printed anyway
- else
+ if ( m_pParent->m_aJobData.meSetupMode == PrinterSetupMode::SingleJob )
{
- m_pPaperBox->Enable( false );
- m_pOrientBox->Enable( false );
+ m_pCbFromSetup->Show();
+
+ if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
+ m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup );
+ // disable those, unless user wants to use papersize from printer prefs
+ // as they have no influence on what's going to be printed anyway
+ else
+ {
+ m_pPaperText->Enable( false );
+ m_pPaperBox->Enable( false );
+ m_pOrientText->Enable( false );
+ m_pOrientBox->Enable( false );
+ }
}
}
diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx
index a0c5958c3aaa..bf2be1e5369e 100644
--- a/vcl/unx/generic/print/prtsetup.hxx
+++ b/vcl/unx/generic/print/prtsetup.hxx
@@ -83,6 +83,7 @@ class RTSPaperPage : public TabPage
VclPtr<FixedText> m_pPaperText;
VclPtr<ListBox> m_pPaperBox;
+ VclPtr<FixedText> m_pOrientText;
VclPtr<ListBox> m_pOrientBox;
VclPtr<FixedText> m_pDuplexText;
commit 386b3ceeacf1b8c20d2f777c40f3630dad5ae998
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Nov 27 13:51:55 2017 +0100
tdf#79077: Load/save PapersizeFromSetup into ODF for sw and sc
Reviewed-on: https://gerrit.libreoffice.org/45332
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 785a8564ebb501e2e623133e214467b947f7e671)
Conflicts:
sc/source/ui/unoobj/confuno.cxx
Change-Id: I0fc1a771927dc7116768cfbb7f7e31006e41e1c8
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 415399e1caef..c9dba79b7492 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -551,6 +551,7 @@
#define SC_UNO_AUTOCALC "AutoCalculate"
#define SC_UNO_PRINTERNAME "PrinterName"
#define SC_UNO_PRINTERSETUP "PrinterSetup"
+#define SC_UNO_PRINTERPAPER "PrinterPaperFromSetup"
#define SC_UNO_APPLYDOCINF "ApplyUserData"
#define SC_UNO_CHARCOMP "CharacterCompressionType"
#define SC_UNO_ASIANKERN "IsKernAsianPunctuation"
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 129e0f29c40f..00bed91b9435 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -64,6 +64,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},
@@ -224,7 +225,28 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
nullptr );
- pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
+
+ SfxPrinter* pPrinter = pDocShell->GetPrinter();
+ bool bPreferPrinterPapersize = false;
+ if ( pPrinter )
+ bPreferPrinterPapersize = pPrinter->GetPrinterSettingsPreferred();
+
+ VclPtr<SfxPrinter> pTempPrinter = SfxPrinter::Create( aStream, 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 );
}
}
}
@@ -430,6 +452,11 @@ 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 )
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 8a786f4d18ab..e114c8234001 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -66,6 +66,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,
@@ -147,6 +148,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},
@@ -243,6 +245,7 @@ SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
, mpDocSh ( nullptr )
, mpDoc ( nullptr )
, mpPrinter( nullptr )
+, mbPreferPrinterPapersize( false )
{
registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT, mpModel->GetDocShell()->GetDoc() ) );
}
@@ -443,6 +446,14 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
throw IllegalArgumentException();
}
break;
+ case HANDLE_PRINTER_PAPER:
+ {
+ bool bPreferPrinterPapersize;
+ if(!(rValue >>= bPreferPrinterPapersize))
+ throw IllegalArgumentException();
+ mbPreferPrinterPapersize = bPreferPrinterPapersize;
+ }
+ break;
case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
{
bool bIsKern = *static_cast<sal_Bool const *>(rValue.getValue());
@@ -870,6 +881,7 @@ void SwXDocumentSettings::_postSetValues ()
SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
aOptions.Put(aAddPrinterItem);
mpPrinter->SetOptions( aOptions );
+ mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
mpDoc->getIDocumentDeviceAccess().setPrinter( mpPrinter, true, true );
}
@@ -961,6 +973,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 888714148fa9..d72842032b1b 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.hxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx
@@ -46,6 +46,7 @@ protected:
* printer-related properties, remember the last printer and set it in
* _postSetValues */
VclPtr<SfxPrinter> mpPrinter;
+ bool mbPreferPrinterPapersize;
virtual void _preSetValues ()
throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException ) override;
commit 1590ecf87c820a14e2b2cb3682c9fb483a363229
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Nov 27 11:21:03 2017 +0100
tdf#79077: Load/save PapersizeFromSetup bit into ODF for sd
Reviewed-on: https://gerrit.libreoffice.org/45322
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit a07477790204c9392a31d5060ecb5478b7c001c6)
Conflicts:
sd/source/ui/unoidl/UnoDocumentSettings.cxx
Change-Id: Ibf9ae8229b62cbcbdb8f56e7353301745a12ef5b
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index dd9f4947f395..4c19a62b78d4 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -136,8 +136,8 @@ enum SdDocumentSettingsPropertyHandles
HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
- HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
- HANDLE_PRINTER_INDEPENDENT_LAYOUT
+ HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PRINTERPAPERSIZE, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT,
+ HANDLE_UPDATEFROMTEMPLATE, HANDLE_PRINTER_INDEPENDENT_LAYOUT
// #i33095#
,HANDLE_LOAD_READONLY, HANDLE_MODIFY_PASSWD, HANDLE_SAVE_VERSION
,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL, HANDLE_EMBED_FONTS
@@ -171,6 +171,7 @@ enum SdDocumentSettingsPropertyHandles
{ OUString("DefaultTabStop"), HANDLE_TABSTOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
{ OUString("PrinterName"), HANDLE_PRINTERNAME, ::cppu::UnoType<OUString>::get(), 0, 0 },
{ OUString("PrinterSetup"), HANDLE_PRINTERJOB, cppu::UnoType<uno::Sequence < sal_Int8 >>::get(), 0, MID_PRINTER },
+ { OUString("PrinterPaperFromSetup"), HANDLE_PRINTERPAPERSIZE, cppu::UnoType<bool>::get(), 0, MID_PRINTER },
{ OUString("IsPrintPageName"), HANDLE_PRINTPAGENAME, cppu::UnoType<bool>::get(), 0, MID_PRINTER },
{ OUString("IsPrintDate"), HANDLE_PRINTDATE, cppu::UnoType<bool>::get(), 0, MID_PRINTER },
@@ -750,9 +751,11 @@ throw (UnknownPropertyException, PropertyVetoException,
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
SfxItemSet* pItemSet;
+ bool bPreferPrinterPapersize = false;
if( pPrinter )
{
pItemSet = pPrinter->GetOptions().Clone();
+ bPreferPrinterPapersize = pPrinter->GetPrinterSettingsPreferred();
}
else
{
@@ -764,6 +767,7 @@ throw (UnknownPropertyException, PropertyVetoException,
}
pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ pPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize );
MapMode aMM (pPrinter->GetMapMode());
aMM.SetMapUnit(MAP_100TH_MM);
@@ -777,6 +781,22 @@ throw (UnknownPropertyException, PropertyVetoException,
}
break;
+ case HANDLE_PRINTERPAPERSIZE:
+ {
+ bool bPreferPrinterPapersize;
+ if( *pValues >>= bPreferPrinterPapersize )
+ {
+ bOk = true;
+ if( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true );
+ if (pTempPrinter)
+ pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize );
+ }
+ }
+ }
+ break;
+
case HANDLE_PARAGRAPHSUMMATION :
{
bool bIsSummationOfParagraphs = false;
@@ -1130,6 +1150,13 @@ throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::
}
break;
+ case HANDLE_PRINTERPAPERSIZE:
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( false );
+ *pValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
+ }
+ break;
+
case HANDLE_PARAGRAPHSUMMATION :
{
bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
commit 153e7927e2412ee1b9527ff2f90e2a7aa65ce271
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Nov 22 14:39:39 2017 +0100
tdf#79077: Cleanup PapersizeFromSetup related code
Reviewed-on: https://gerrit.libreoffice.org/45096
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 45429e4518fb265dc817d96f41ad4238a5d09c65)
Conflicts:
include/vcl/jobdata.hxx
include/vcl/print.hxx
vcl/inc/printerinfomanager.hxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/print.cxx
vcl/source/gdi/print3.cxx
Change-Id: If77c43a7eb97de0a2e23195a9539f00e452343d8
diff --git a/include/vcl/jobdata.hxx b/include/vcl/jobdata.hxx
index 13b34de93320..43c833bc3171 100644
--- a/include/vcl/jobdata.hxx
+++ b/include/vcl/jobdata.hxx
@@ -46,6 +46,7 @@ struct VCL_DLLPUBLIC JobData
int m_nPDFDevice; // 0: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF
orientation::type m_eOrientation;
OUString m_aPrinterName;
+ bool m_bPapersizeFromSetup;
const PPDParser* m_pParser;
PPDContext m_aContext;
@@ -61,6 +62,7 @@ struct VCL_DLLPUBLIC JobData
m_nColorDevice( 0 ),
m_nPDFDevice( 0 ),
m_eOrientation( orientation::Portrait ),
+ m_bPapersizeFromSetup( false ),
m_pParser( nullptr ) {}
JobData& operator=(const psp::JobData& rRight);
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e38372d62032..15d36be5cdb2 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -293,7 +293,7 @@ public:
bool SetJobSetup( const JobSetup& rSetup );
const JobSetup& GetJobSetup() const { return maJobSetup; }
- bool Setup( vcl::Window* pWindow = nullptr, bool bPapersizeFromSetup = false );
+ bool Setup( vcl::Window* pWindow = nullptr );
bool SetPrinterProps( const Printer* pPrinter );
/** SetPrinterOptions is used internally only now
@@ -334,6 +334,9 @@ public:
sal_uInt16 GetPaperBinCount() const;
OUString GetPaperBinName( sal_uInt16 nPaperBin ) const;
+ bool GetPrinterSettingsPreferred() const;
+ void SetPrinterSettingsPreferred( bool bPaperSizeFromSetup );
+
const Size& GetPaperSizePixel() const { return maPaperSize; }
Size GetPaperSize() const { return PixelToLogic( maPaperSize ); }
const Point& GetPageOffsetPixel() const { return maPageOffset; }
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index b5627eecda64..ae4fc75a9e98 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -206,6 +206,7 @@ bool JobSetup::operator==( const JobSetup& rJobSetup ) const
(pData1->mePaperFormat == pData2->mePaperFormat) &&
(pData1->mnPaperWidth == pData2->mnPaperWidth) &&
(pData1->mnPaperHeight == pData2->mnPaperHeight) &&
+ (pData1->mbPapersizeFromSetup == pData2->mbPapersizeFromSetup) &&
(pData1->mnDriverDataLen == pData2->mnDriverDataLen) &&
(memcmp( pData1->mpDriverData, pData2->mpDriverData, pData1->mnDriverDataLen ) == 0) &&
(pData1->maValueMap == pData2->maValueMap)
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 8c267dbb5a5d..e96cd8c76899 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1075,7 +1075,7 @@ bool Printer::SetJobSetup( const JobSetup& rSetup )
return false;
}
-bool Printer::Setup( vcl::Window* pWindow, bool bPapersizeFromSetup )
+bool Printer::Setup( vcl::Window* pWindow )
{
if ( IsDisplayPrinter() )
return false;
@@ -1085,7 +1085,6 @@ bool Printer::Setup( vcl::Window* pWindow, bool bPapersizeFromSetup )
JobSetup aJobSetup = maJobSetup;
ImplJobSetup* pData = aJobSetup.ImplGetData();
- pData->mbPapersizeFromSetup = bPapersizeFromSetup;
SalFrame* pFrame;
if ( !pWindow )
pWindow = ImplGetDefaultWindow();
@@ -1299,6 +1298,26 @@ sal_uInt16 Printer::GetPaperBin() const
return maJobSetup.ImplGetConstData()->mnPaperBin;
}
+bool Printer::GetPrinterSettingsPreferred() const
+{
+ return maJobSetup.ImplGetConstData()->mbPapersizeFromSetup;
+}
+
+// dear loplugins, DO NOT REMOVE this code
+// it will be used in follow-up commits
+void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup)
+{
+ if ( maJobSetup.ImplGetConstData()->mbPapersizeFromSetup != bPaperSizeFromSetup )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pData = aJobSetup.ImplGetData();
+ pData->mbPapersizeFromSetup = bPaperSizeFromSetup;
+
+ mbNewJobSetup = true;
+ maJobSetup = aJobSetup;
+ }
+}
+
// Map user paper format to a available printer paper formats
void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest )
{
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index bb8081e54320..f48b483580ce 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -817,7 +817,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
}
// call driver setup
- bRet = mpImplData->mxPrinter->Setup( i_pParent, getPapersizeFromSetup() );
+ bRet = mpImplData->mxPrinter->Setup( i_pParent );
Size aNewPaperSize(mpImplData->mxPrinter->GetPaperSize());
if (bRet)
{
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index d91f556ce157..91498caf479e 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -247,6 +247,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pJobSetup->mnDriverDataLen = 0;
pJobSetup->mpDriverData = nullptr;
}
+ pJobSetup->mbPapersizeFromSetup = rData.m_bPapersizeFromSetup;
}
// Needs a cleaner abstraction ...
@@ -696,6 +697,7 @@ bool PspSalInfoPrinter::SetData(
aData.m_aContext.setValue( pKey, pValue );
}
}
+ aData.m_bPapersizeFromSetup = pJobSetup->mbPapersizeFromSetup;
m_aJobData = aData;
copyJobDataToJobSetup( pJobSetup, aData );
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index aead34c96eb1..6def8ad0aec8 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -38,6 +38,7 @@ JobData& JobData::operator=(const JobData& rRight)
m_nColorDepth = rRight.m_nColorDepth;
m_eOrientation = rRight.m_eOrientation;
m_aPrinterName = rRight.m_aPrinterName;
+ m_bPapersizeFromSetup = rRight.m_bPapersizeFromSetup;
m_pParser = rRight.m_pParser;
m_aContext = rRight.m_aContext;
m_nPSLevel = rRight.m_nPSLevel;
commit ee6dad51150fd53d19f882edfefa879e18f9897d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Oct 27 18:02:35 2017 +0200
tdf#79077: copy 'paper from printer setup' toggle
into printer properties dialog, it is rather badly accessible
(almost invisible) in File > Print > Options tabpage
Reviewed-on: https://gerrit.libreoffice.org/43956
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 75fc4934c3aafcd83d9bbee63d8d24cbddae8ea0)
Conflicts:
vcl/uiconfig/ui/printerpaperpage.ui
vcl/unx/generic/print/prtsetup.hxx
Change-Id: I18d538a20dc207c359ae1e7c2c914a68daf58f31
diff --git a/vcl/uiconfig/ui/printerpaperpage.ui b/vcl/uiconfig/ui/printerpaperpage.ui
index dc6b044b006b..847191b1613f 100644
--- a/vcl/uiconfig/ui/printerpaperpage.ui
+++ b/vcl/uiconfig/ui/printerpaperpage.ui
@@ -22,7 +22,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
@@ -35,7 +35,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
@@ -48,7 +48,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
@@ -61,7 +61,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -71,7 +71,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
@@ -85,7 +85,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
@@ -95,7 +95,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
@@ -105,7 +105,21 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="papersizefromsetup">
+ <property name="label" translatable="yes">Use only paper size from printer preferences</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
</object>
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index 0bea78b66c8f..310e35fe6497 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -163,6 +163,7 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
: TabPage(pParent->m_pTabControl, "PrinterPaperPage", "vcl/ui/printerpaperpage.ui")
, m_pParent( pParent )
{
+ get(m_pCbFromSetup, "papersizefromsetup");
get(m_pPaperText, "paperft");
get(m_pPaperBox, "paperlb");
get(m_pOrientBox, "orientlb");
@@ -175,6 +176,8 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
m_pOrientBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_pDuplexBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_pSlotBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
+ m_pCbFromSetup->SetToggleHdl( LINK( this, RTSPaperPage, CheckBoxHdl ) );
+
sal_Int32 nPos = 0;
@@ -200,6 +203,7 @@ void RTSPaperPage::dispose()
{
m_pParent.clear();
m_pPaperText.clear();
+ m_pCbFromSetup.clear();
m_pPaperBox.clear();
m_pOrientBox.clear();
m_pDuplexText.clear();
@@ -253,9 +257,11 @@ void RTSPaperPage::update()
m_pSlotBox->Enable( false );
}
+ if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
+ m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup );
// disable those, unless user wants to use papersize from printer prefs
// as they have no influence on what's going to be printed anyway
- if (!m_pParent->m_aJobData.m_bPapersizeFromSetup)
+ else
{
m_pPaperBox->Enable( false );
m_pOrientBox->Enable( false );
@@ -294,6 +300,14 @@ IMPL_LINK_TYPED( RTSPaperPage, SelectHdl, ListBox&, rBox, void )
m_pParent->SetDataModified( true );
}
+IMPL_LINK_TYPED( RTSPaperPage, CheckBoxHdl, CheckBox&, /*cBox*/, void )
+{
+ bool bFromSetup = m_pCbFromSetup->IsChecked();
+ m_pParent->m_aJobData.m_bPapersizeFromSetup = bFromSetup;
+ m_pPaperBox->Enable( bFromSetup );
+ m_pOrientBox->Enable( bFromSetup );
+ m_pParent->SetDataModified( true );
+}
/*
* RTSDevicePage
*/
diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx
index 3d02468658d7..a0c5958c3aaa 100644
--- a/vcl/unx/generic/print/prtsetup.hxx
+++ b/vcl/unx/generic/print/prtsetup.hxx
@@ -78,6 +78,8 @@ class RTSPaperPage : public TabPage
{
VclPtr<RTSDialog> m_pParent;
+ VclPtr<CheckBox> m_pCbFromSetup;
+
VclPtr<FixedText> m_pPaperText;
VclPtr<ListBox> m_pPaperBox;
@@ -90,6 +92,7 @@ class RTSPaperPage : public TabPage
VclPtr<ListBox> m_pSlotBox;
DECL_LINK_TYPED( SelectHdl, ListBox&, void );
+ DECL_LINK_TYPED( CheckBoxHdl, CheckBox&, void );
public:
explicit RTSPaperPage( RTSDialog* );
virtual ~RTSPaperPage();
More information about the Libreoffice-commits
mailing list