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@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@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 dc6b044..847191b 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 0bea78b..310e35f 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 3d02468..a0c5958 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();