Kaydet (Commit) be61350e authored tarafından Caolán McNamara's avatar Caolán McNamara

split out printer paper page and adapt code to .ui

Change-Id: I95266926801ab5cb63ec012b37cd35757ec541ef
üst 126ec8f9
......@@ -11,6 +11,7 @@ $(eval $(call gb_UI_UI,spa))
$(eval $(call gb_UI_add_uifiles,spa,\
padmin/uiconfig/ui/printerdevicepage \
padmin/uiconfig/ui/printerpaperpage \
))
# vim: set noet sw=4 ts=4:
......@@ -28,9 +28,6 @@
#include <officecfg/Office/Common.hxx>
#define LSCAPE_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Landscape" ) )
#define PORTRAIT_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Portrait" ) )
using namespace psp;
using namespace padmin;
......@@ -187,7 +184,8 @@ IMPL_LINK( RTSDialog, ClickButton, Button*, pButton )
if( m_pPaperPage )
{
// orientation
m_aJobData.m_eOrientation = m_pPaperPage->getOrientation().Equals( LSCAPE_STRING ) ? orientation::Landscape : orientation::Portrait;
m_aJobData.m_eOrientation = m_pPaperPage->getOrientation() == 0 ?
orientation::Portrait : orientation::Landscape;
}
if( m_pDevicePage )
{
......@@ -217,40 +215,34 @@ IMPL_LINK( RTSDialog, ClickButton, Button*, pButton )
* RTSPaperPage
*/
RTSPaperPage::RTSPaperPage( RTSDialog* pParent ) :
TabPage( & pParent->m_aTabControl, PaResId( RID_RTS_PAPERPAGE ) ),
m_pParent( pParent ),
m_aPaperText( this, PaResId( RID_RTS_PAPER_PAPER_TXT ) ),
m_aPaperBox( this, PaResId( RID_RTS_PAPER_PAPER_BOX ) ),
m_aOrientText( this, PaResId( RID_RTS_PAPER_ORIENTATION_TXT ) ),
m_aOrientBox( this, PaResId( RID_RTS_PAPER_ORIENTATION_BOX ) ),
m_aDuplexText( this, PaResId( RID_RTS_PAPER_DUPLEX_TXT ) ),
m_aDuplexBox( this, PaResId( RID_RTS_PAPER_DUPLEX_BOX ) ),
m_aSlotText( this, PaResId( RID_RTS_PAPER_SLOT_TXT ) ),
m_aSlotBox( this, PaResId( RID_RTS_PAPER_SLOT_BOX ) )
RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
: TabPage(&pParent->m_aTabControl, "PrinterPaperPage", "spa/ui/printerpaperpage.ui" )
, m_pParent( pParent )
{
m_aPaperBox.SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_aOrientBox.SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_aDuplexBox.SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_aSlotBox.SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
get(m_pPaperText, "paperft");
get(m_pPaperBox, "paperlb");
get(m_pOrientBox, "orientlb");
get(m_pDuplexText, "duplexft");
get(m_pDuplexBox, "duplexlb");
get(m_pSlotText, "slotft");
get(m_pSlotBox, "slotlb");
FreeResource();
m_pPaperBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_pOrientBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_pDuplexBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
m_pSlotBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
sal_uInt16 nPos = 0;
m_aOrientBox.InsertEntry( PORTRAIT_STRING );
m_aOrientBox.InsertEntry( LSCAPE_STRING );
// duplex
nPos = m_aDuplexBox.InsertEntry( m_pParent->m_aInvalidString );
m_aDuplexBox.SetEntryData( nPos, NULL );
nPos = m_pDuplexBox->InsertEntry( m_pParent->m_aInvalidString );
m_pDuplexBox->SetEntryData( nPos, NULL );
// paper does not have an invalid entry
// input slots
nPos = m_aSlotBox.InsertEntry( m_pParent->m_aInvalidString );
m_aSlotBox.SetEntryData( nPos, NULL );
nPos = m_pSlotBox->InsertEntry( m_pParent->m_aInvalidString );
m_pSlotBox->SetEntryData( nPos, NULL );
update();
}
......@@ -268,44 +260,43 @@ void RTSPaperPage::update()
const PPDKey* pKey = NULL;
// orientation
m_aOrientBox.SelectEntry(
m_pParent->m_aJobData.m_eOrientation == orientation::Landscape
? LSCAPE_STRING : PORTRAIT_STRING );
m_pOrientBox->SelectEntryPos(
m_pParent->m_aJobData.m_eOrientation == orientation::Portrait ? 0 : 1);
// duplex
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) )) )
{
m_pParent->insertAllPPDValues( m_aDuplexBox, m_pParent->m_aJobData.m_pParser, pKey );
m_pParent->insertAllPPDValues( *m_pDuplexBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
m_aDuplexText.Enable( sal_False );
m_aDuplexBox.Enable( sal_False );
m_pDuplexText->Enable( sal_False );
m_pDuplexBox->Enable( sal_False );
}
// paper
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) )) )
{
m_pParent->insertAllPPDValues( m_aPaperBox, m_pParent->m_aJobData.m_pParser, pKey );
m_pParent->insertAllPPDValues( *m_pPaperBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
m_aPaperText.Enable( sal_False );
m_aPaperBox.Enable( sal_False );
m_pPaperText->Enable( sal_False );
m_pPaperBox->Enable( sal_False );
}
// input slots
if( m_pParent->m_aJobData.m_pParser &&
(pKey = m_pParent->m_aJobData.m_pParser->getKey( rtl::OUString("InputSlot") )) )
{
m_pParent->insertAllPPDValues( m_aSlotBox, m_pParent->m_aJobData.m_pParser, pKey );
m_pParent->insertAllPPDValues( *m_pSlotBox, m_pParent->m_aJobData.m_pParser, pKey );
}
else
{
m_aSlotText.Enable( sal_False );
m_aSlotBox.Enable( sal_False );
m_pSlotText->Enable( sal_False );
m_pSlotBox->Enable( sal_False );
}
}
......@@ -314,24 +305,24 @@ void RTSPaperPage::update()
IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
{
const PPDKey* pKey = NULL;
if( pBox == &m_aPaperBox )
if( pBox == m_pPaperBox )
{
if( m_pParent->m_aJobData.m_pParser )
pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
}
else if( pBox == &m_aDuplexBox )
else if( pBox == m_pDuplexBox )
{
if( m_pParent->m_aJobData.m_pParser )
pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
}
else if( pBox == &m_aSlotBox )
else if( pBox == m_pSlotBox )
{
if( m_pParent->m_aJobData.m_pParser )
pKey = m_pParent->m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
}
else if( pBox == &m_aOrientBox )
else if( pBox == m_pOrientBox )
{
m_pParent->m_aJobData.m_eOrientation = m_aOrientBox.GetSelectEntry().Equals( LSCAPE_STRING ) ? orientation::Landscape : orientation::Portrait;
m_pParent->m_aJobData.m_eOrientation = m_pOrientBox->GetSelectEntryPos() == 0 ? orientation::Portrait : orientation::Landscape;
}
if( pKey )
{
......
......@@ -85,17 +85,16 @@ class RTSPaperPage : public TabPage
{
RTSDialog* m_pParent;
FixedText m_aPaperText;
ListBox m_aPaperBox;
FixedText* m_pPaperText;
ListBox* m_pPaperBox;
FixedText m_aOrientText;
ListBox m_aOrientBox;
ListBox* m_pOrientBox;
FixedText m_aDuplexText;
ListBox m_aDuplexBox;
FixedText* m_pDuplexText;
ListBox* m_pDuplexBox;
FixedText m_aSlotText;
ListBox m_aSlotBox;
FixedText* m_pSlotText;
ListBox* m_pSlotBox;
DECL_LINK( SelectHdl, ListBox* );
public:
......@@ -104,7 +103,7 @@ public:
void update();
String getOrientation() { return m_aOrientBox.GetSelectEntry(); }
sal_uInt16 getOrientation() { return m_pOrientBox->GetSelectEntryPos(); }
};
class RTSDevicePage : public TabPage
......
......@@ -38,16 +38,7 @@
#define RID_RTS_OTHER_DEFAULT_BTN 11
#define RID_RTS_DEVICEPAGE 4003
#define RID_RTS_PAPERPAGE 4004
#define RID_RTS_PAPER_PAPER_TXT 1
#define RID_RTS_PAPER_PAPER_BOX 2
#define RID_RTS_PAPER_ORIENTATION_TXT 3
#define RID_RTS_PAPER_ORIENTATION_BOX 4
#define RID_RTS_PAPER_DUPLEX_TXT 5
#define RID_RTS_PAPER_DUPLEX_BOX 6
#define RID_RTS_PAPER_SLOT_TXT 7
#define RID_RTS_PAPER_SLOT_BOX 8
#define RID_RTS_FONTSUBSTPAGE 4005
#define RID_RTS_FS_SUBST_TXT 1
......
......@@ -21,6 +21,7 @@
TabDialog RID_RTS_RTSDIALOG
{
Moveable = TRUE;
Sizeable = TRUE;
Closeable = TRUE;
SVLook = TRUE;
......@@ -63,69 +64,6 @@ TabDialog RID_RTS_RTSDIALOG
Text [ en-US ] = "Properties of %s";
};
TabPage RID_RTS_PAPERPAGE
{
HelpID = "padmin:TabPage:RID_RTS_PAPERPAGE";
Hide = TRUE;
Size = MAP_APPFONT( 230, 175 );
FixedText RID_RTS_PAPER_PAPER_TXT
{
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 80, 8 );
Text [ en-US ] = "~Paper size";
};
ListBox RID_RTS_PAPER_PAPER_BOX
{
HelpID = "padmin:ListBox:RID_RTS_PAPERPAGE:RID_RTS_PAPER_PAPER_BOX";
Border = TRUE;
DropDown = TRUE;
Pos = MAP_APPFONT( 115, 5 );
Size = MAP_APPFONT( 110, 120 );
};
FixedText RID_RTS_PAPER_ORIENTATION_TXT
{
Pos = MAP_APPFONT( 5, 20 );
Size = MAP_APPFONT( 80, 8 );
Text [ en-US ] = "~Orientation";
};
ListBox RID_RTS_PAPER_ORIENTATION_BOX
{
HelpID = "padmin:ListBox:RID_RTS_PAPERPAGE:RID_RTS_PAPER_ORIENTATION_BOX";
Border = TRUE;
DropDown = TRUE;
Pos = MAP_APPFONT( 115, 20 );
Size = MAP_APPFONT( 110, 120 );
};
FixedText RID_RTS_PAPER_DUPLEX_TXT
{
Pos = MAP_APPFONT( 5, 35 );
Size = MAP_APPFONT( 80, 8 );
Text [ en-US ] = "~Duplex";
};
ListBox RID_RTS_PAPER_DUPLEX_BOX
{
HelpID = "padmin:ListBox:RID_RTS_PAPERPAGE:RID_RTS_PAPER_DUPLEX_BOX";
Border = TRUE;
DropDown = TRUE;
Pos = MAP_APPFONT( 115, 35 );
Size = MAP_APPFONT( 110, 120 );
};
FixedText RID_RTS_PAPER_SLOT_TXT
{
Pos = MAP_APPFONT( 5, 50 );
Size = MAP_APPFONT( 80, 8 );
Text [ en-US ] = "Paper tray";
};
ListBox RID_RTS_PAPER_SLOT_BOX
{
HelpID = "padmin:ListBox:RID_RTS_PAPERPAGE:RID_RTS_PAPER_SLOT_BOX";
Border = TRUE;
DropDown = TRUE;
Pos = MAP_APPFONT( 115, 50 );
Size = MAP_APPFONT( 110, 120 );
};
};
TabPage RID_RTS_FONTSUBSTPAGE
{
HelpID = "padmin:TabPage:RID_RTS_FONTSUBSTPAGE";
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkGrid" id="PrinterPaperPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="paperft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Paper size</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Orientation</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="duplexft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Duplex</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="slotft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Paper tray</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="paperlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="orientlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<items>
<item translatable="yes">Portrait</item>
<item translatable="yes">Landscape</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="duplexlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="slotlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</interface>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment