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

split out printer device page and adapt code to .ui

Change-Id: I7eacd837aacba452ab55ce707c3c032b2efadfb3
üst c60ef32a
......@@ -27,6 +27,7 @@ $(eval $(call gb_Module_add_targets,padmin,\
Library_spa \
AllLangResTarget_spa \
Package_inc \
UI_spa \
))
endif
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_UI_UI,spa))
$(eval $(call gb_UI_add_uifiles,spa,\
padmin/uiconfig/ui/printerdevicepage \
))
# vim: set noet sw=4 ts=4:
......@@ -94,8 +94,7 @@ RTSDialog::RTSDialog( const PrinterInfo& rJobData, const String& rPrinter, bool
m_pOtherPage( NULL ),
m_pFontSubstPage( NULL ),
m_pCommandPage( NULL ),
m_aInvalidString( PaResId( RID_RTS_RTSDIALOG_INVALID_TXT ) ),
m_aFromDriverString( PaResId( RID_RTS_RTSDIALOG_FROMDRIVER_TXT ) )
m_aInvalidString( PaResId( RID_RTS_RTSDIALOG_INVALID_TXT ) )
{
FreeResource();
......@@ -350,37 +349,28 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
* RTSDevicePage
*/
RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
TabPage( & pParent->m_aTabControl, PaResId( RID_RTS_DEVICEPAGE ) ),
RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
: TabPage(&pParent->m_aTabControl, "PrinterDevicePage", "spa/ui/printerdevicepage.ui" )
, m_pParent( pParent )
{
get(m_pPPDKeyBox, "options");
get(m_pPPDValueBox, "values");
m_pParent( pParent ),
m_pPPDKeyBox->SetDropDownLineCount(12);
m_pPPDValueBox->SetDropDownLineCount(12);
m_aSpaceColor( PaResId( RID_RTS_DEVICE_COLOR_TXT ) ),
m_aSpaceGray( PaResId( RID_RTS_DEVICE_GRAY_TXT ) ),
m_aPPDKeyText( this, PaResId( RID_RTS_DEVICE_PPDKEY_TXT ) ),
m_aPPDKeyBox( this, PaResId( RID_RTS_DEVICE_PPDKEY_BOX ) ),
m_aPPDValueText( this, PaResId( RID_RTS_DEVICE_PPDVALUE_TXT ) ),
m_aPPDValueBox( this, PaResId( RID_RTS_DEVICE_PPDVALUE_BOX ) ),
m_aLevelText( this, PaResId( RID_RTS_DEVICE_PRINTLANG_TXT ) ),
m_aLevelBox( this, PaResId( RID_RTS_DEVICE_PRINTLANG_BOX ) ),
m_aSpaceText( this, PaResId( RID_RTS_DEVICE_SPACE_TXT ) ),
m_aSpaceBox( this, PaResId( RID_RTS_DEVICE_SPACE_BOX ) ),
m_aDepthText( this, PaResId( RID_RTS_DEVICE_DEPTH_TXT ) ),
m_aDepthBox( this, PaResId( RID_RTS_DEVICE_DEPTH_BOX ) )
{
FreeResource();
get(m_pLevelBox, "level");
get(m_pSpaceBox, "colorspace");
get(m_pDepthBox, "colordepth");
m_aPPDKeyBox.SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
m_aPPDValueBox.SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
m_pPPDKeyBox->SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
m_pPPDValueBox->SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
m_aSpaceBox.InsertEntry( m_pParent->m_aFromDriverString );
m_aSpaceBox.InsertEntry( m_aSpaceColor );
m_aSpaceBox.InsertEntry( m_aSpaceGray );
switch( m_pParent->m_aJobData.m_nColorDevice )
{
case -1: m_aSpaceBox.SelectEntry( m_aSpaceGray );break;
case 0: m_aSpaceBox.SelectEntry( m_pParent->m_aFromDriverString );break;
case 1: m_aSpaceBox.SelectEntry( m_aSpaceColor );break;
case 0: m_pSpaceBox->SelectEntryPos(0);break;
case 1: m_pSpaceBox->SelectEntryPos(1);break;
case -1: m_pSpaceBox->SelectEntryPos(2);break;
}
sal_uLong nLevelEntryData = 0; //automatic
......@@ -397,21 +387,24 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
assert(nLevelEntryData != 0 || bAutoIsPDF == m_pParent->m_aJobData.m_nPDFDevice);
OUString sStr = m_aLevelBox.GetEntry(0);
m_aLevelBox.InsertEntry(sStr.replaceAll("%s", bAutoIsPDF ? m_aLevelBox.GetEntry(5) : m_aLevelBox.GetEntry(1)), 0);
m_aLevelBox.SetEntryData(0, m_aLevelBox.GetEntryData(1));
m_aLevelBox.RemoveEntry(1);
OUString sStr = m_pLevelBox->GetEntry(0);
m_pLevelBox->InsertEntry(sStr.replaceAll("%s", bAutoIsPDF ? m_pLevelBox->GetEntry(5) : m_pLevelBox->GetEntry(1)), 0);
m_pLevelBox->SetEntryData(0, m_pLevelBox->GetEntryData(1));
m_pLevelBox->RemoveEntry(1);
for( sal_uInt16 i = 0; i < m_aLevelBox.GetEntryCount(); i++ )
for( sal_uInt16 i = 0; i < m_pLevelBox->GetEntryCount(); i++ )
{
if( (sal_uLong)m_aLevelBox.GetEntryData( i ) == nLevelEntryData )
if( (sal_uLong)m_pLevelBox->GetEntryData( i ) == nLevelEntryData )
{
m_aLevelBox.SelectEntryPos( i );
m_pLevelBox->SelectEntryPos( i );
break;
}
}
m_aDepthBox.SelectEntry( String::CreateFromInt32( m_pParent->m_aJobData.m_nColorDepth ).AppendAscii( " Bit" ) );
if (m_pParent->m_aJobData.m_nColorDepth == 8)
m_pDepthBox->SelectEntryPos(0);
else if (m_pParent->m_aJobData.m_nColorDepth == 24)
m_pDepthBox->SelectEntryPos(1);
// fill ppd boxes
if( m_pParent->m_aJobData.m_pParser )
......@@ -427,8 +420,8 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
)
{
String aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
sal_uInt16 nPos = m_aPPDKeyBox.InsertEntry( aEntry );
m_aPPDKeyBox.SetEntryData( nPos, (void*)pKey );
sal_uInt16 nPos = m_pPPDKeyBox->InsertEntry( aEntry );
m_pPPDKeyBox->SetEntryData( nPos, (void*)pKey );
}
}
}
......@@ -446,11 +439,35 @@ void RTSDevicePage::update()
{
}
sal_uLong RTSDevicePage::getDepth()
{
sal_uInt16 nSelectPos = m_pDepthBox->GetSelectEntryPos();
if (nSelectPos == 0)
return 8;
else
return 24;
}
sal_uLong RTSDevicePage::getColorDevice()
{
sal_uInt16 nSelectPos = m_pSpaceBox->GetSelectEntryPos();
switch (nSelectPos)
{
case 0:
return 0;
case 1:
return 1;
case 2:
return -1;
}
return 0;
}
// ------------------------------------------------------------------
sal_uLong RTSDevicePage::getLevel()
{
sal_uLong nLevel = (sal_uLong)m_aLevelBox.GetEntryData( m_aLevelBox.GetSelectEntryPos() );
sal_uLong nLevel = (sal_uLong)m_pLevelBox->GetEntryData( m_pLevelBox->GetSelectEntryPos() );
if (nLevel == 0)
return 0; //automatic
return nLevel < 10 ? nLevel-1 : 0;
......@@ -460,7 +477,7 @@ sal_uLong RTSDevicePage::getLevel()
sal_uLong RTSDevicePage::getPDFDevice()
{
sal_uLong nLevel = (sal_uLong)m_aLevelBox.GetEntryData( m_aLevelBox.GetSelectEntryPos() );
sal_uLong nLevel = (sal_uLong)m_pLevelBox->GetEntryData( m_pLevelBox->GetSelectEntryPos() );
if (nLevel > 9)
return 2; //explictly PDF
else if (nLevel == 0)
......@@ -472,15 +489,15 @@ sal_uLong RTSDevicePage::getPDFDevice()
IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox )
{
if( pBox == &m_aPPDKeyBox )
if( pBox == m_pPPDKeyBox )
{
const PPDKey* pKey = (PPDKey*)m_aPPDKeyBox.GetEntryData( m_aPPDKeyBox.GetSelectEntryPos() );
const PPDKey* pKey = (PPDKey*)m_pPPDKeyBox->GetEntryData( m_pPPDKeyBox->GetSelectEntryPos() );
FillValueBox( pKey );
}
else if( pBox == &m_aPPDValueBox )
else if( pBox == m_pPPDValueBox )
{
const PPDKey* pKey = (PPDKey*)m_aPPDKeyBox.GetEntryData( m_aPPDKeyBox.GetSelectEntryPos() );
const PPDValue* pValue = (PPDValue*)m_aPPDValueBox.GetEntryData( m_aPPDValueBox.GetSelectEntryPos() );
const PPDKey* pKey = (PPDKey*)m_pPPDKeyBox->GetEntryData( m_pPPDKeyBox->GetSelectEntryPos() );
const PPDValue* pValue = (PPDValue*)m_pPPDValueBox->GetEntryData( m_pPPDValueBox->GetSelectEntryPos() );
if( pKey && pValue )
{
m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
......@@ -494,7 +511,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox )
void RTSDevicePage::FillValueBox( const PPDKey* pKey )
{
m_aPPDValueBox.Clear();
m_pPPDValueBox->Clear();
if( ! pKey )
return;
......@@ -507,12 +524,12 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
m_pParent->m_aJobData.m_pParser )
{
String aEntry( m_pParent->m_aJobData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ) );
sal_uInt16 nPos = m_aPPDValueBox.InsertEntry( aEntry );
m_aPPDValueBox.SetEntryData( nPos, (void*)pValue );
sal_uInt16 nPos = m_pPPDValueBox->InsertEntry( aEntry );
m_pPPDValueBox->SetEntryData( nPos, (void*)pValue );
}
}
pValue = m_pParent->m_aJobData.m_aContext.getValue( pKey );
m_aPPDValueBox.SelectEntryPos( m_aPPDValueBox.GetEntryPos( (void*)pValue ) );
m_pPPDValueBox->SelectEntryPos( m_pPPDValueBox->GetEntryPos( (void*)pValue ) );
}
// --------------------------------------------------------------------------
......
......@@ -68,7 +68,6 @@ class RTSDialog : public TabDialog
// some resources
String m_aInvalidString;
String m_aFromDriverString;
DECL_LINK( ActivatePage, TabControl* );
DECL_LINK( ClickButton, Button* );
......@@ -115,20 +114,12 @@ class RTSDevicePage : public TabPage
String m_aSpaceColor;
String m_aSpaceGray;
FixedText m_aPPDKeyText;
ListBox m_aPPDKeyBox;
ListBox* m_pPPDKeyBox;
ListBox* m_pPPDValueBox;
FixedText m_aPPDValueText;
ListBox m_aPPDValueBox;
FixedText m_aLevelText;
ListBox m_aLevelBox;
FixedText m_aSpaceText;
ListBox m_aSpaceBox;
FixedText m_aDepthText;
ListBox m_aDepthBox;
ListBox* m_pLevelBox;
ListBox* m_pSpaceBox;
ListBox* m_pDepthBox;
void FillValueBox( const ::psp::PPDKey* );
......@@ -141,12 +132,8 @@ public:
sal_uLong getLevel();
sal_uLong getPDFDevice();
sal_uLong getDepth() { return m_aDepthBox.GetSelectEntry().ToInt32(); }
sal_uLong getColorDevice()
{
String aSpace( m_aSpaceBox.GetSelectEntry() );
return aSpace == m_aSpaceColor ? 1 : ( aSpace == m_aSpaceGray ? -1 : 0 );
}
sal_uLong getDepth();
sal_uLong getColorDevice();
};
class RTSOtherPage : public TabPage
......
......@@ -38,18 +38,6 @@
#define RID_RTS_OTHER_DEFAULT_BTN 11
#define RID_RTS_DEVICEPAGE 4003
#define RID_RTS_DEVICE_COLOR_TXT 1
#define RID_RTS_DEVICE_GRAY_TXT 2
#define RID_RTS_DEVICE_PPDKEY_TXT 3
#define RID_RTS_DEVICE_PPDKEY_BOX 4
#define RID_RTS_DEVICE_PPDVALUE_TXT 5
#define RID_RTS_DEVICE_PPDVALUE_BOX 6
#define RID_RTS_DEVICE_PRINTLANG_TXT 7
#define RID_RTS_DEVICE_PRINTLANG_BOX 8
#define RID_RTS_DEVICE_SPACE_TXT 9
#define RID_RTS_DEVICE_SPACE_BOX 10
#define RID_RTS_DEVICE_DEPTH_TXT 11
#define RID_RTS_DEVICE_DEPTH_BOX 12
#define RID_RTS_PAPERPAGE 4004
#define RID_RTS_PAPER_PAPER_TXT 1
......
......@@ -56,10 +56,6 @@ TabDialog RID_RTS_RTSDIALOG
};
};
};
String RID_RTS_RTSDIALOG_FROMDRIVER_TXT
{
Text [ en-US ] = "from driver";
};
String RID_RTS_RTSDIALOG_INVALID_TXT
{
Text [ en-US ] = "<ignore>";
......@@ -130,103 +126,6 @@ TabPage RID_RTS_PAPERPAGE
};
};
TabPage RID_RTS_DEVICEPAGE
{
HelpID = "padmin:TabPage:RID_RTS_DEVICEPAGE";
Hide = TRUE;
Size = MAP_APPFONT( 230, 175 );
String RID_RTS_DEVICE_COLOR_TXT
{
Text [ en-US ] = "Color";
};
String RID_RTS_DEVICE_GRAY_TXT
{
Text [ en-US ] = "Grayscale";
};
FixedText RID_RTS_DEVICE_PPDKEY_TXT
{
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 85, 8 );
Text [ en-US ] = "~Option";
};
ListBox RID_RTS_DEVICE_PPDKEY_BOX
{
HelpID = "padmin:ListBox:RID_RTS_DEVICEPAGE:RID_RTS_DEVICE_PPDKEY_BOX";
Border = TRUE;
Pos = MAP_APPFONT( 5, 14 );
Size = MAP_APPFONT( 105, 111 );
};
FixedText RID_RTS_DEVICE_PPDVALUE_TXT
{
Pos = MAP_APPFONT( 120, 5 );
Size = MAP_APPFONT( 105, 8 );
Text [ en-US ] = "Current ~value";
};
ListBox RID_RTS_DEVICE_PPDVALUE_BOX
{
HelpID = "padmin:ListBox:RID_RTS_DEVICEPAGE:RID_RTS_DEVICE_PPDVALUE_BOX";
Border = TRUE;
Pos = MAP_APPFONT( 120, 14 );
Size = MAP_APPFONT( 105, 111 );
};
FixedText RID_RTS_DEVICE_PRINTLANG_TXT
{
Pos = MAP_APPFONT( 5, 130 );
Size = MAP_APPFONT( 100, 8 );
Text [ en-US ] = "Printer ~Language type";
};
ListBox RID_RTS_DEVICE_PRINTLANG_BOX
{
HelpID = "padmin:ListBox:RID_RTS_DEVICEPAGE:RID_RTS_DEVICE_LEVEL_BOX";
DropDown = TRUE;
Pos = MAP_APPFONT( 120, 130 );
Size = MAP_APPFONT( 105, 200 );
StringList [en-US] =
{
< "Automatic : %s" ; 0; > ;
< "PostScript (Level from driver)" ; 1; > ;
< "PostScript Level 1" ; 2; > ;
< "PostScript Level 2"; 3; > ;
< "PostScript Level 3"; 4; > ;
< "PDF"; 10; > ;
};
};
FixedText RID_RTS_DEVICE_SPACE_TXT
{
Pos = MAP_APPFONT( 5, 145 );
Size = MAP_APPFONT( 100, 8 );
Text [ en-US ] = "~Color";
};
ListBox RID_RTS_DEVICE_SPACE_BOX
{
HelpID = "padmin:ListBox:RID_RTS_DEVICEPAGE:RID_RTS_DEVICE_SPACE_BOX";
DropDown = TRUE;
Pos = MAP_APPFONT( 120, 145 );
Size = MAP_APPFONT( 105, 200 );
};
FixedText RID_RTS_DEVICE_DEPTH_TXT
{
Pos = MAP_APPFONT( 5, 160 );
Size = MAP_APPFONT( 80, 8 );
Text [ en-US ] = "Color ~depth";
};
ListBox RID_RTS_DEVICE_DEPTH_BOX
{
HelpID = "padmin:ListBox:RID_RTS_DEVICEPAGE:RID_RTS_DEVICE_DEPTH_BOX";
DropDown = TRUE;
Pos = MAP_APPFONT( 120, 160 );
Size = MAP_APPFONT( 105, 200 );
StringList =
{
"8 Bit";
"24 Bit";
};
};
};
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="PrinterDevicePage">
<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="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Option</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</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="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Current _value</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</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="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Printer _Language type</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="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Color</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="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Color _depth</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="colorspace">
<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">From driver</item>
<item translatable="yes">Color</item>
<item translatable="yes">Grayscale</item>
</items>
</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>
<child>
<object class="GtkComboBoxText" id="colordepth">
<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">8 Bit</item>
<item translatable="yes">24 Bit</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="level">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore1</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="GtkTreeView" id="options">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</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="GtkTreeView" id="values">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2"/>
</child>
</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>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gint1 -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Automatic : %s</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes">PostScript (Level from driver)</col>
<col id="1">1</col>
</row>
<row>
<col id="0" translatable="yes">PostScript Level 1</col>
<col id="1">2</col>
</row>
<row>
<col id="0" translatable="yes">PostScript Level 2</col>
<col id="1">3</col>
</row>
<row>
<col id="0" translatable="yes">PostScript Level 3</col>
<col id="1">4</col>
</row>
<row>
<col id="0" translatable="yes">PDF</col>
<col id="1">10</col>
</row>
</data>
</object>
</interface>
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