From be61350e8b078fbc34d820868d67f7e393bf93df Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 14 Dec 2012 16:06:18 +0000 Subject: split out printer paper page and adapt code to .ui Change-Id: I95266926801ab5cb63ec012b37cd35757ec541ef --- padmin/UI_spa.mk | 1 + padmin/source/prtsetup.cxx | 81 ++++++------ padmin/source/prtsetup.hxx | 17 ++- padmin/source/rtsetup.hrc | 9 -- padmin/source/rtsetup.src | 64 +--------- padmin/uiconfig/ui/printerpaperpage.ui | 133 +++++++++++++++++++ padmin/uiconfig/ui/printerproperties.ui | 218 -------------------------------- 7 files changed, 179 insertions(+), 344 deletions(-) create mode 100644 padmin/uiconfig/ui/printerpaperpage.ui delete mode 100644 padmin/uiconfig/ui/printerproperties.ui (limited to 'padmin') diff --git a/padmin/UI_spa.mk b/padmin/UI_spa.mk index 70008c266227..ce10748729cb 100644 --- a/padmin/UI_spa.mk +++ b/padmin/UI_spa.mk @@ -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: diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index 6b398f1e5fd2..47b800c53d9b 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -28,9 +28,6 @@ #include -#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 ) { diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx index 9e8d098d6211..1de4f8956c62 100644 --- a/padmin/source/prtsetup.hxx +++ b/padmin/source/prtsetup.hxx @@ -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 diff --git a/padmin/source/rtsetup.hrc b/padmin/source/rtsetup.hrc index 75bf2f9040fe..711e303578de 100644 --- a/padmin/source/rtsetup.hrc +++ b/padmin/source/rtsetup.hrc @@ -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 diff --git a/padmin/source/rtsetup.src b/padmin/source/rtsetup.src index 9005c09686e9..56128c7fe302 100644 --- a/padmin/source/rtsetup.src +++ b/padmin/source/rtsetup.src @@ -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"; diff --git a/padmin/uiconfig/ui/printerpaperpage.ui b/padmin/uiconfig/ui/printerpaperpage.ui new file mode 100644 index 000000000000..0ecf42cf1eef --- /dev/null +++ b/padmin/uiconfig/ui/printerpaperpage.ui @@ -0,0 +1,133 @@ + + + + + True + False + True + True + 6 + 12 + True + + + True + False + 0 + _Paper size + True + + + 0 + 0 + 1 + 1 + + + + + True + False + 0 + _Orientation + True + + + 0 + 1 + 1 + 1 + + + + + True + False + 0 + _Duplex + True + + + 0 + 2 + 1 + 1 + + + + + True + False + 0 + Paper tray + True + + + 0 + 3 + 1 + 1 + + + + + True + False + 0 + 1 + + + 1 + 0 + 1 + 1 + + + + + True + False + 0 + 1 + + Portrait + Landscape + + + + 1 + 1 + 1 + 1 + + + + + True + False + 0 + 1 + + + 1 + 2 + 1 + 1 + + + + + True + False + 0 + 1 + + + 1 + 3 + 1 + 1 + + + + diff --git a/padmin/uiconfig/ui/printerproperties.ui b/padmin/uiconfig/ui/printerproperties.ui deleted file mode 100644 index f78d12c7883c..000000000000 --- a/padmin/uiconfig/ui/printerproperties.ui +++ /dev/null @@ -1,218 +0,0 @@ - - - - - False - 5 - dialog - - - False - vertical - 2 - - - False - end - - - gtk-ok - False - True - True - True - False - True - - - False - True - 0 - - - - - gtk-cancel - False - True - True - True - False - True - - - False - True - 1 - - - - - False - True - end - 0 - - - - - True - True - - - True - False - True - True - 6 - 12 - True - - - True - False - 0 - _Paper size - True - - - 0 - 0 - 1 - 1 - - - - - True - False - 0 - _Orientataion - True - - - 0 - 1 - 1 - 1 - - - - - True - False - 0 - _Duplex - True - - - 0 - 2 - 1 - 1 - - - - - True - False - 0 - Paper tray - True - - - 0 - 3 - 1 - 1 - - - - - True - False - 0 - 1 - - - 1 - 0 - 1 - 1 - - - - - True - False - 0 - 1 - - - 1 - 1 - 1 - 1 - - - - - True - False - 0 - 1 - - - 1 - 2 - 1 - 1 - - - - - True - False - 0 - 1 - - - 1 - 3 - 1 - 1 - - - - - - - True - False - Paper - - - False - - - - - - - - - - - False - True - 1 - - - - - - ok - cancel - - - -- cgit v1.2.3