summaryrefslogtreecommitdiff
path: root/padmin/source
diff options
context:
space:
mode:
Diffstat (limited to 'padmin/source')
-rw-r--r--padmin/source/adddlg.cxx1128
-rw-r--r--padmin/source/adddlg.hxx248
-rw-r--r--padmin/source/cmddlg.cxx551
-rw-r--r--padmin/source/cmddlg.hxx122
-rw-r--r--padmin/source/desktopcontext.cxx59
-rw-r--r--padmin/source/desktopcontext.hxx52
-rw-r--r--padmin/source/fontentry.cxx668
-rw-r--r--padmin/source/fontentry.hxx137
-rw-r--r--padmin/source/helper.cxx327
-rw-r--r--padmin/source/helper.hxx126
-rw-r--r--padmin/source/makefile.mk115
-rw-r--r--padmin/source/newppdlg.cxx226
-rw-r--r--padmin/source/newppdlg.hxx76
-rw-r--r--padmin/source/padialog.cxx755
-rw-r--r--padmin/source/padialog.hrc285
-rw-r--r--padmin/source/padialog.hxx120
-rw-r--r--padmin/source/padialog.src1153
-rw-r--r--padmin/source/pamain.cxx176
-rw-r--r--padmin/source/progress.cxx103
-rw-r--r--padmin/source/progress.hxx66
-rw-r--r--padmin/source/prtsetup.cxx817
-rw-r--r--padmin/source/prtsetup.hxx213
-rw-r--r--padmin/source/psetupl.xpm76
-rw-r--r--padmin/source/rtsetup.hrc120
-rw-r--r--padmin/source/rtsetup.src568
-rw-r--r--padmin/source/spadmin.sh76
-rw-r--r--padmin/source/titlectrl.cxx102
-rw-r--r--padmin/source/titlectrl.hxx66
28 files changed, 8531 insertions, 0 deletions
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx
new file mode 100644
index 000000000000..0f398c7e480a
--- /dev/null
+++ b/padmin/source/adddlg.cxx
@@ -0,0 +1,1128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <unistd.h>
+
+#include "adddlg.hxx"
+#include "newppdlg.hxx"
+#include "cmddlg.hxx"
+#include "padialog.hrc"
+
+#include "vcl/msgbox.hxx"
+#include "vcl/strhelper.hxx"
+
+#include "osl/thread.h"
+
+#include <hash_set>
+
+
+using namespace rtl;
+using namespace psp;
+using namespace padmin;
+using namespace std;
+
+APTabPage::APTabPage( AddPrinterDialog* pParent, const ResId& rResId )
+ : TabPage( pParent, rResId ),
+ m_aTitle( PaResId( RID_ADDP_STR_TITLE ) ),
+ m_pParent( pParent )
+{
+}
+
+APChooseDevicePage::APChooseDevicePage( AddPrinterDialog* pParent ) :
+ APTabPage( pParent, PaResId( RID_ADDP_PAGE_CHOOSEDEV ) ),
+ m_aPrinterBtn( this, PaResId( RID_ADDP_CHDEV_BTN_PRINTER ) ),
+ m_aFaxBtn( this, PaResId( RID_ADDP_CHDEV_BTN_FAX ) ),
+ m_aPDFBtn( this, PaResId( RID_ADDP_CHDEV_BTN_PDF ) ),
+ m_aOldBtn( this, PaResId( RID_ADDP_CHDEV_BTN_OLD ) ),
+ m_aOverTxt( this, PaResId( RID_ADDP_CHDEV_TXT_OVER ) )
+{
+ FreeResource();
+ m_aPrinterBtn.Check( TRUE );
+ m_aFaxBtn.Check( FALSE );
+ m_aPDFBtn.Check( FALSE );
+ m_aOldBtn.Check( FALSE );
+ if( ! AddPrinterDialog::getOldPrinterLocation().Len() )
+ m_aOldBtn.Enable( FALSE );
+ if( ! PrinterInfoManager::get().addOrRemovePossible() )
+ {
+ m_aPrinterBtn.Check( FALSE );
+ m_aFaxBtn.Check( TRUE );
+ m_aPrinterBtn.Enable( FALSE );
+ m_aOldBtn.Enable( FALSE );
+ }
+}
+
+APChooseDevicePage::~APChooseDevicePage()
+{
+}
+
+bool APChooseDevicePage::check()
+{
+ return true;
+}
+
+void APChooseDevicePage::fill( PrinterInfo& rInfo )
+{
+ if( m_aPDFBtn.IsChecked() )
+ {
+ rInfo.m_aFeatures = OUString::createFromAscii( "pdf=" );
+ }
+ else if( m_aFaxBtn.IsChecked() )
+ {
+ rInfo.m_aFeatures = OUString::createFromAscii( "fax" );
+ }
+ else
+ rInfo.m_aFeatures = OUString();
+}
+
+//--------------------------------------------------------------------
+
+APChooseDriverPage::APChooseDriverPage( AddPrinterDialog* pParent )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_CHOOSEDRIVER ) ),
+ m_aDriverTxt( this, PaResId( RID_ADDP_CHDRV_TXT_DRIVER ) ),
+ m_aDriverBox( this, PaResId( RID_ADDP_CHDRV_BOX_DRIVER ) ),
+ m_aAddBtn( this, PaResId( RID_ADDP_CHDRV_BTN_ADD ) ),
+ m_aRemBtn( this, PaResId( RID_ADDP_CHDRV_BTN_REMOVE ) ),
+ m_aRemStr( PaResId( RID_ADDP_CHDRV_STR_REMOVE ) )
+{
+ FreeResource();
+ m_aAddBtn.SetClickHdl( LINK( this, APChooseDriverPage, ClickBtnHdl ) );
+ m_aRemBtn.SetClickHdl( LINK( this, APChooseDriverPage, ClickBtnHdl ) );
+ m_aDriverBox.setDelPressedLink( LINK( this, APChooseDriverPage, DelPressedHdl ) );
+ updateDrivers();
+}
+
+APChooseDriverPage::~APChooseDriverPage()
+{
+ for( int i = 0; i < m_aDriverBox.GetEntryCount(); i++ )
+ delete (String*)m_aDriverBox.GetEntryData( i );
+}
+
+bool APChooseDriverPage::check()
+{
+ return m_aDriverBox.GetSelectEntryCount() > 0;
+}
+
+void APChooseDriverPage::fill( PrinterInfo& rInfo )
+{
+ USHORT nPos = m_aDriverBox.GetSelectEntryPos();
+ String* pDriver = (String*)m_aDriverBox.GetEntryData( nPos );
+ rInfo.m_aDriverName = *pDriver;
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "m_aLastPrinterName = \"%s\", rInfo.m_aPrinterName = \"%s\"\n",
+ OUStringToOString( m_aLastPrinterName, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
+ OUStringToOString( rInfo.m_aPrinterName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+#endif
+ if( rInfo.m_aPrinterName.equals( m_aLastPrinterName ) )
+ {
+ String aPrinter( AddPrinterDialog::uniquePrinterName( m_aDriverBox.GetEntry( nPos ) ) );
+ rInfo.m_aPrinterName = m_aLastPrinterName = aPrinter;
+ }
+}
+
+void APChooseDriverPage::updateDrivers( bool bRefresh, const rtl::OUString& rSelectDriver )
+{
+ for( int k = 0; k < m_aDriverBox.GetEntryCount(); k++ )
+ delete (String*)m_aDriverBox.GetEntryData( k );
+ m_aDriverBox.Clear();
+
+ std::list< rtl::OUString > aDrivers;
+ psp::PPDParser::getKnownPPDDrivers( aDrivers, bRefresh );
+
+ rtl::OUString aSelectDriver( psp::PPDParser::getPPDPrinterName( rSelectDriver ) );
+
+ rtl::OUString aSelectedEntry;
+ for( std::list< rtl::OUString >::const_iterator it = aDrivers.begin(); it != aDrivers.end(); ++it )
+ {
+ rtl::OUString aDriver( psp::PPDParser::getPPDPrinterName( *it ) );
+ if( aDriver.getLength() )
+ {
+ int nPos = m_aDriverBox.InsertEntry( aDriver );
+ m_aDriverBox.SetEntryData( nPos, new String( *it ) );
+ if( aDriver == aSelectDriver )
+ aSelectedEntry = aDriver;
+ }
+ }
+
+ m_aDriverBox.SelectEntry( aSelectedEntry );
+ m_aRemBtn.Enable( m_aDriverBox.GetEntryCount() > 0 );
+}
+
+IMPL_LINK( APChooseDriverPage, DelPressedHdl, ListBox*, pListBox )
+{
+ if( pListBox == &m_aDriverBox )
+ ClickBtnHdl( &m_aRemBtn );
+
+ return 0;
+}
+
+IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aAddBtn )
+ {
+ PPDImportDialog aDlg( this );
+ if( aDlg.Execute() )
+ {
+ const std::list< rtl::OUString >& rImported( aDlg.getImportedFiles() );
+ if( rImported.empty() )
+ updateDrivers( true );
+ else
+ updateDrivers( true, rImported.front() );
+ }
+ }
+ else if( pButton == &m_aRemBtn )
+ {
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+ PrinterInfoManager& rPIManager( PrinterInfoManager::get() );
+
+ for( int i = 0; i < m_aDriverBox.GetSelectEntryCount(); i++ )
+ {
+ int nSelect = m_aDriverBox.GetSelectEntryPos(i);
+ String aDriver( *(String*)m_aDriverBox.GetEntryData( nSelect ) );
+ if( aDriver.Len() )
+ {
+ // never delete the default driver
+ if( aDriver.EqualsIgnoreCaseAscii( "SGENPRT" ) )
+ {
+ String aText( PaResId( RID_ERR_REMOVESGENPRT ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s" ), m_aDriverBox.GetSelectEntry( i ) );
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aText );
+ aErrorBox.SetText( m_aRemStr );
+ aErrorBox.Execute();
+ continue;
+ }
+
+ PrinterInfo aDefInfo( rPIManager.getPrinterInfo( rPIManager.getDefaultPrinter() ) );
+ // for comparisons convert to a OUString
+ OUString aPPD( aDriver );
+ if( aDefInfo.m_aDriverName == aPPD )
+ {
+ String aText( PaResId( RID_ERR_REMOVEDEFAULTDRIVER ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s" ), m_aDriverBox.GetSelectEntry( i ) );
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aText );
+ aErrorBox.SetText( m_aRemStr );
+ aErrorBox.Execute();
+ continue;
+ }
+
+ ::std::list< OUString > aPrinters;
+ ::std::list< OUString >::iterator it;
+ rPIManager.listPrinters( aPrinters );
+ for( it = aPrinters.begin(); it != aPrinters.end(); ++it )
+ {
+ PrinterInfo aInfo( rPIManager.getPrinterInfo( *it ) );
+ if( aInfo.m_aDriverName == aPPD )
+ break;
+ }
+
+ if( it != aPrinters.end() )
+ {
+ String aText( PaResId( RID_QUERY_DRIVERUSED ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s" ), m_aDriverBox.GetSelectEntry( i ) );
+ QueryBox aBox( this, WB_YES_NO | WB_DEF_NO, aText );
+ aBox.SetText( m_aRemStr );
+ if( aBox.Execute() == RET_NO )
+ continue;
+ }
+ else
+ {
+ String aText( PaResId( RID_QUERY_REMOVEDRIVER ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s" ), m_aDriverBox.GetSelectEntry( i ) );
+ QueryBox aBox( this, WB_YES_NO | WB_DEF_NO, aText );
+ aBox.SetText( m_aRemStr );
+ if( aBox.Execute() == RET_NO )
+ continue;
+ }
+
+ // remove the printers using this driver
+ for( it = aPrinters.begin(); it != aPrinters.end(); ++it )
+ {
+ PrinterInfo aInfo( rPIManager.getPrinterInfo( *it ) );
+ if( aInfo.m_aDriverName == aPPD )
+ rPIManager.removePrinter( *it );
+ }
+
+ std::list< rtl::OUString > aDirs;
+ // get only psprint's directories, not eventual system dirs
+ psp::getPrinterPathList( aDirs, NULL );
+ std::list< rtl::OUString >::iterator dir;
+ for( dir = aDirs.begin(); dir != aDirs.end(); ++dir )
+ {
+ ::std::list< String > aFiles;
+ ::std::list< String >::iterator file;
+ OUStringBuffer aDir( *dir );
+ aDir.append( sal_Unicode( '/' ) );
+ aDir.appendAscii( PRINTER_PPDDIR );
+ rtl::OUString aPPDDir( aDir.makeStringAndClear() );
+ FindFiles( aPPDDir, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true );
+ for( file = aFiles.begin(); file != aFiles.end(); ++file )
+ {
+ String aFile( aPPDDir );
+ if( aFile.GetChar( aFile.Len() ) != '/' )
+ aFile.AppendAscii( "/" );
+ aFile.Append( *file );
+
+ int nPos = file->SearchBackward( '.' );
+ if( file->Copy( 0, nPos ) == String( aPPD ) )
+ {
+ ByteString aSysPath( aFile, aEncoding );
+ if( unlink( aSysPath.GetBuffer() ) )
+ {
+ String aText( PaResId( RID_ERR_REMOVEDRIVERFAILED ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s1" ), m_aDriverBox.GetSelectEntry( i ) );
+ aText.SearchAndReplace( String::CreateFromAscii( "%s2" ), aFile );
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aText );
+ aErrorBox.SetText( m_aRemStr );
+ aErrorBox.Execute();
+ }
+ }
+ }
+ }
+ }
+ }
+ updateDrivers();
+ }
+ return 0;
+}
+
+//--------------------------------------------------------------------
+
+APNamePage::APNamePage( AddPrinterDialog* pParent, const String& rInitName, DeviceKind::type eKind )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_NAME ) ),
+ m_aNameTxt(
+ this,
+ PaResId(
+ eKind == DeviceKind::Printer ? RID_ADDP_NAME_TXT_NAME :
+ eKind == DeviceKind::Fax ? RID_ADDP_NAME_TXT_FAXNAME : RID_ADDP_NAME_TXT_PDFNAME
+ )
+ ),
+ m_aNameEdt(
+ this,
+ PaResId(
+ eKind == DeviceKind::Printer ? RID_ADDP_NAME_EDT_NAME :
+ eKind == DeviceKind::Fax ? RID_ADDP_NAME_EDT_FAXNAME : RID_ADDP_NAME_EDT_PDFNAME
+ )
+ ),
+ m_aDefaultBox( this, PaResId( RID_ADDP_NAME_BOX_DEFAULT ) ),
+ m_aFaxSwallowBox( this, PaResId( RID_ADDP_NAME_BOX_FAXSWALLOW ) )
+{
+ FreeResource();
+ if( eKind != DeviceKind::Printer )
+ m_aDefaultBox.Show( FALSE );
+ else
+ m_aNameEdt.SetText( rInitName );
+ if( eKind != DeviceKind::Fax )
+ m_aFaxSwallowBox.Show( FALSE );
+
+ m_aNameEdt.SetText( AddPrinterDialog::uniquePrinterName( m_aNameEdt.GetText() ) );
+ m_aDefaultBox.Check( FALSE );
+ m_aFaxSwallowBox.Check( FALSE );
+}
+
+APNamePage::~APNamePage()
+{
+}
+
+bool APNamePage::check()
+{
+ return m_aNameEdt.GetText().Len();
+}
+
+void APNamePage::fill( PrinterInfo& rInfo )
+{
+ rInfo.m_aPrinterName = m_aNameEdt.GetText();
+}
+
+//--------------------------------------------------------------------
+
+APCommandPage::APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_COMMAND ) ),
+ m_aCommandTxt( this, PaResId( RID_ADDP_CMD_TXT_COMMAND ) ),
+ m_aCommandBox( this, PaResId( eKind == DeviceKind::Pdf ? RID_ADDP_CMD_BOX_PDFCOMMAND : RID_ADDP_CMD_BOX_COMMAND ) ),
+ m_aHelpBtn( this, PaResId( RID_ADDP_CMD_BTN_HELP ) ),
+ m_aHelpTxt( PaResId( eKind == DeviceKind::Fax ? RID_ADDP_CMD_STR_FAXHELP : RID_ADDP_CMD_STR_PDFHELP ) ),
+ m_aPdfDirTxt( this, PaResId( RID_ADDP_CMD_TXT_PDFDIR ) ),
+ m_aPdfDirEdt( this, PaResId( RID_ADDP_CMD_EDT_PDFDIR ) ),
+ m_aPdfDirBtn( this, PaResId( RID_ADDP_CMD_BTN_PDFDIR ) ),
+ m_eKind( eKind )
+{
+ FreeResource();
+ ::std::list< String > aCommands;
+ if( m_eKind == DeviceKind::Printer )
+ {
+ m_aHelpBtn.Show( FALSE );
+ Size aSize = m_aCommandTxt.GetSizePixel();
+ aSize.Width() = m_aCommandBox.GetSizePixel().Width();
+ m_aCommandTxt.SetSizePixel( aSize );
+ }
+ if( m_eKind != DeviceKind::Pdf )
+ {
+ m_aPdfDirBtn.Show( FALSE );
+ m_aPdfDirEdt.Show( FALSE );
+ m_aPdfDirTxt.Show( FALSE );
+ }
+ switch( m_eKind )
+ {
+ case DeviceKind::Printer: CommandStore::getPrintCommands( aCommands );break;
+ case DeviceKind::Fax: CommandStore::getFaxCommands( aCommands );break;
+ case DeviceKind::Pdf: CommandStore::getPdfCommands( aCommands );break;
+ }
+ // adjust height of command text and help button
+ Rectangle aPosSize( m_aCommandTxt.GetPosPixel(), m_aCommandTxt.GetSizePixel() );
+ Rectangle aTextSize = m_aCommandTxt.GetTextRect( Rectangle( Point(), aPosSize.GetSize() ), m_aCommandTxt.GetText() );
+ if( aTextSize.GetWidth() <= 2*(aPosSize.GetWidth()+1) )
+ {
+ Size aNewSize( aPosSize.GetWidth(), aPosSize.GetHeight()*2/3 );
+ if( aNewSize.Height() < m_aHelpBtn.GetSizePixel().Height()+2 )
+ aNewSize.Height() = m_aHelpBtn.GetSizePixel().Height()+2;
+ Point aNewPos( aPosSize.Left(), aPosSize.Top() + aPosSize.GetHeight() - aNewSize.Height() );
+ m_aCommandTxt.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.X() = m_aHelpBtn.GetPosPixel().X();
+ m_aHelpBtn.SetPosPixel( aNewPos );
+ }
+
+ // fill in commands
+ ::std::list< String >::iterator it;
+ for( it = aCommands.begin(); it != aCommands.end(); ++it )
+ m_aCommandBox.InsertEntry( *it );
+
+ m_aHelpBtn.SetClickHdl( LINK( this, APCommandPage, ClickBtnHdl ) );
+ m_aPdfDirBtn.SetClickHdl( LINK( this, APCommandPage, ClickBtnHdl ) );
+ if( m_eKind != DeviceKind::Printer )
+ {
+ m_aCommandBox.SetModifyHdl( LINK( this, APCommandPage, ModifyHdl ) );
+ m_pParent->enableNext( false );
+ }
+}
+
+APCommandPage::~APCommandPage()
+{
+ ::std::list< String > aCommands;
+ String aLastCommand( m_aCommandBox.GetText() );
+ for( int i = 0; i < m_aCommandBox.GetEntryCount(); i++ )
+ {
+ String aCommand( m_aCommandBox.GetEntry( i ) );
+ if( aCommand != aLastCommand )
+ aCommands.push_back( aCommand );
+ }
+ aCommands.push_back( aLastCommand );
+ switch( m_eKind )
+ {
+ case DeviceKind::Printer: CommandStore::setPrintCommands( aCommands );break;
+ case DeviceKind::Fax: CommandStore::setFaxCommands( aCommands );break;
+ case DeviceKind::Pdf: CommandStore::setPdfCommands( aCommands );break;
+ }
+}
+
+IMPL_LINK( APCommandPage, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aHelpBtn )
+ {
+ InfoBox aBox( this, m_aHelpTxt );
+ aBox.Execute();
+ }
+ else if( pButton == &m_aPdfDirBtn )
+ {
+ String aPath( m_aPdfDirEdt.GetText() );
+ if( chooseDirectory( aPath ) )
+ m_aPdfDirEdt.SetText( aPath );
+ }
+ return 0;
+}
+
+IMPL_LINK( APCommandPage, ModifyHdl, ComboBox*, pBox )
+{
+ if( pBox == &m_aCommandBox )
+ {
+ m_pParent->enableNext( m_aCommandBox.GetText().Len() );
+ }
+ return 0;
+}
+
+bool APCommandPage::check()
+{
+ return true;
+}
+
+void APCommandPage::fill( PrinterInfo& rInfo )
+{
+ rInfo.m_aCommand = m_aCommandBox.GetText();
+}
+
+//--------------------------------------------------------------------
+
+APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_OLDPRINTERS ) ),
+ m_aOldPrinterTxt( this, PaResId( RID_ADDP_OLD_TXT_PRINTERS ) ),
+ m_aOldPrinterBox( this, PaResId( RID_ADDP_OLD_BOX_PRINTERS ) ),
+ m_aSelectAllBtn( this, PaResId( RID_ADDP_OLD_BTN_SELECTALL ) )
+{
+ FreeResource();
+
+ m_aSelectAllBtn.SetClickHdl( LINK( this, APOldPrinterPage, ClickBtnHdl ) );
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+
+ String aFileName( AddPrinterDialog::getOldPrinterLocation() );
+ Config aConfig( aFileName );
+
+ // read defaults
+ aConfig.SetGroup( "Xprinter,PostScript" );
+ ByteString aDefPageSize( aConfig.ReadKey( "PageSize" ) );
+ ByteString aDefOrientation( aConfig.ReadKey( "Orientation" ) );
+ ByteString aDefMarginLeft( aConfig.ReadKey( "MarginLeft" ) );
+ ByteString aDefMarginRight( aConfig.ReadKey( "MarginRight" ) );
+ ByteString aDefMarginTop( aConfig.ReadKey( "MarginTop" ) );
+ ByteString aDefMarginBottom( aConfig.ReadKey( "MarginBottom" ) );
+ ByteString aDefScale( aConfig.ReadKey( "Scale" ) );
+ ByteString aDefCopies( aConfig.ReadKey( "Copies" ) );
+ ByteString aDefDPI( aConfig.ReadKey( "DPI" ) );
+
+ aConfig.SetGroup( "devices" );
+ int nDevices = aConfig.GetKeyCount();
+ for( int nKey = 0; nKey < nDevices; nKey++ )
+ {
+ aConfig.SetGroup( "devices" );
+ ByteString aPrinter( aConfig.GetKeyName( nKey ) );
+ ByteString aValue( aConfig.ReadKey( aPrinter ) );
+ ByteString aPort( aValue.GetToken( 1, ',' ) );
+ ByteString aDriver( aValue.GetToken( 0, ' ' ) );
+ ByteString aPS( aValue.GetToken( 0, ',' ).GetToken( 1, ' ' ) );
+ ByteString aNewDriver( aDriver );
+ if( aDriver == "GENERIC" )
+ aNewDriver = "SGENPRT";
+
+ if( aPS != "PostScript" )
+ continue;
+
+ const PPDParser* pParser = PPDParser::getParser( String( aNewDriver, aEncoding ) );
+ if( pParser == NULL )
+ {
+ String aText( PaResId( RID_TXT_DRIVERDOESNOTEXIST ) );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s1" ) ), String( aPrinter, aEncoding ) );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s2" ) ), String( aDriver, aEncoding ) );
+ InfoBox aBox( this, aText );
+ aBox.Execute();
+ continue;
+ }
+
+ // read the command
+ aConfig.SetGroup( "ports" );
+ ByteString aCommand( aConfig.ReadKey( aPort ) );
+ if( ! aCommand.Len() )
+ {
+ String aText( PaResId( RID_TXT_PRINTERWITHOUTCOMMAND ) );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), String( aPrinter, aEncoding ) );
+ InfoBox aBox( this, aText );
+ aBox.Execute();
+ continue;
+ }
+
+
+ String aUPrinter( AddPrinterDialog::uniquePrinterName( String( aPrinter, aEncoding ) ) );
+
+ PrinterInfo aInfo;
+ aInfo.m_aDriverName = String( aNewDriver, aEncoding );
+ aInfo.m_pParser = pParser;
+ aInfo.m_aContext.setParser( pParser );
+ aInfo.m_aPrinterName = aUPrinter;
+ aInfo.m_aCommand = String( aCommand, aEncoding );
+
+ // read the printer settings
+ ByteString aGroup( aDriver );
+ aGroup += ",PostScript,";
+ aGroup += aPort;
+ aConfig.SetGroup( aGroup );
+
+ aValue = aConfig.ReadKey( "PageSize", aDefPageSize );
+ int nLeft, nRight, nTop, nBottom;
+ if( aValue.Len() &&
+ aInfo.m_pParser->getMargins( String( aValue, aEncoding ),
+ nLeft, nRight, nTop, nBottom ) )
+ {
+ const PPDKey* pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
+ const PPDValue* pValue = pKey ? pKey->getValue( String( aValue, aEncoding ) ) : NULL;
+ if( pKey && pValue )
+ aInfo.m_aContext.setValue( pKey, pValue );
+ aValue = aConfig.ReadKey( "MarginLeft", aDefMarginLeft );
+ if( aValue.Len() )
+ aInfo.m_nLeftMarginAdjust = aValue.ToInt32() - (int)((double)nLeft * 35.27777778 );
+ aValue = aConfig.ReadKey( "MarginRight", aDefMarginRight );
+ if( aValue.Len() )
+ aInfo.m_nRightMarginAdjust = aValue.ToInt32() - (int)((double)nRight * 35.27777778 );
+ aValue = aConfig.ReadKey( "MarginTop", aDefMarginTop );
+ if( aValue.Len() )
+ aInfo.m_nTopMarginAdjust = aValue.ToInt32() - (int)((double)nTop * 35.27777778 );
+ aValue = aConfig.ReadKey( "MarginBottom", aDefMarginBottom );
+ if( aValue.Len() )
+ aInfo.m_nBottomMarginAdjust = aValue.ToInt32() - (int)((double)nBottom * 35.27777778 );
+ }
+
+ aValue = aConfig.ReadKey( "Copies", aDefScale );
+ if( aValue.Len() )
+ aInfo.m_nCopies = aValue.ToInt32();
+
+ aValue = aConfig.ReadKey( "Comment" );
+ aInfo.m_aComment = String( aValue, aEncoding );
+
+ aValue = aConfig.ReadKey( "Level" );
+ if( aValue.Len() )
+ aInfo.m_nPSLevel = aValue.ToInt32();
+
+ aValue = aConfig.ReadKey( "Orientation", aDefOrientation );
+ if( aValue.Len() )
+ aInfo.m_eOrientation = aValue.CompareIgnoreCaseToAscii( "landscape" ) == COMPARE_EQUAL ? orientation::Landscape : orientation::Portrait;
+ int nGroupKeys = aConfig.GetKeyCount();
+ for( int nPPDKey = 0; nPPDKey < nGroupKeys; nPPDKey++ )
+ {
+ ByteString aPPDKey( aConfig.GetKeyName( nPPDKey ) );
+ // ignore page region
+ // there are some ppd keys in old Xpdefaults that
+ // should never have been writte because they are defaults
+ // PageRegion leads to problems in conjunction
+ // with a not matching PageSize
+ if( aPPDKey.CompareTo( "PPD_", 4 ) == COMPARE_EQUAL &&
+ aPPDKey != "PPD_PageRegion"
+ )
+ {
+ aValue = aConfig.ReadKey( nPPDKey );
+ aPPDKey.Erase( 0, 4 );
+ const PPDKey* pKey = aInfo.m_pParser->getKey( String( aPPDKey, RTL_TEXTENCODING_ISO_8859_1 ) );
+ const PPDValue* pValue = pKey ? ( aValue.Equals( "*nil" ) ? NULL : pKey->getValue( String( aValue, RTL_TEXTENCODING_ISO_8859_1 ) ) ) : NULL;
+ if( pKey )
+ aInfo.m_aContext.setValue( pKey, pValue, true );
+ }
+ }
+
+ m_aOldPrinters.push_back( aInfo );
+ int nPos = m_aOldPrinterBox.InsertEntry( aInfo.m_aPrinterName );
+ m_aOldPrinterBox.SetEntryData( nPos, & m_aOldPrinters.back() );
+ }
+}
+
+APOldPrinterPage::~APOldPrinterPage()
+{
+}
+
+IMPL_LINK( APOldPrinterPage, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aSelectAllBtn )
+ {
+ for( int i = 0; i < m_aOldPrinterBox.GetEntryCount(); i++ )
+ m_aOldPrinterBox.SelectEntryPos( i );
+ }
+ return 0;
+}
+
+void APOldPrinterPage::addOldPrinters()
+{
+ PrinterInfoManager& rManager( PrinterInfoManager::get() );
+ for( int i = 0; i < m_aOldPrinterBox.GetSelectEntryCount(); i++ )
+ {
+ PrinterInfo* pInfo = (PrinterInfo*)m_aOldPrinterBox.GetEntryData( m_aOldPrinterBox.GetSelectEntryPos( i ) );
+ pInfo->m_aPrinterName = AddPrinterDialog::uniquePrinterName( pInfo->m_aPrinterName );
+ if( ! rManager.addPrinter( pInfo->m_aPrinterName, pInfo->m_aDriverName ) )
+ {
+ String aText( PaResId( RID_TXT_PRINTERADDFAILED ) );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), pInfo->m_aPrinterName );
+ ErrorBox aBox( this, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+ continue;
+ }
+ rManager.changePrinterInfo( pInfo->m_aPrinterName, *pInfo );
+ }
+}
+
+bool APOldPrinterPage::check()
+{
+ return m_aOldPrinterBox.GetEntryCount() > 0;
+}
+
+void APOldPrinterPage::fill( PrinterInfo& )
+{
+}
+
+//--------------------------------------------------------------------
+
+APFaxDriverPage::APFaxDriverPage( AddPrinterDialog* pParent )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_FAXDRIVER ) ),
+ m_aFaxTxt( this, PaResId( RID_ADDP_FAXDRV_TXT_DRIVER ) ),
+ m_aDefBtn( this, PaResId( RID_ADDP_FAXDRV_BTN_DEFAULT ) ),
+ m_aSelectBtn( this, PaResId( RID_ADDP_FAXDRV_BTN_SELECT ) )
+{
+ FreeResource();
+
+ m_aDefBtn.Check( TRUE );
+ m_aSelectBtn.Check( FALSE );
+ m_aSelectBtn.SetStyle( m_aSelectBtn.GetStyle() | WB_WORDBREAK );
+}
+
+APFaxDriverPage::~APFaxDriverPage()
+{
+}
+
+bool APFaxDriverPage::check()
+{
+ return true;
+}
+
+void APFaxDriverPage::fill( PrinterInfo& rInfo )
+{
+ if( isDefault() )
+ {
+ rInfo.m_aDriverName = OUString::createFromAscii( "SGENPRT" );
+ }
+}
+
+//--------------------------------------------------------------------
+
+APPdfDriverPage::APPdfDriverPage( AddPrinterDialog* pParent )
+ : APTabPage( pParent, PaResId( RID_ADDP_PAGE_PDFDRIVER ) ),
+ m_aPdfTxt( this, PaResId( RID_ADDP_PDFDRV_TXT_DRIVER ) ),
+ m_aDefBtn( this, PaResId( RID_ADDP_PDFDRV_BTN_DEFAULT ) ),
+ m_aDistBtn( this, PaResId( RID_ADDP_PDFDRV_BTN_DIST ) ),
+ m_aSelectBtn( this, PaResId( RID_ADDP_PDFDRV_BTN_SELECT ) )
+{
+ FreeResource();
+
+ m_aDefBtn.Check( TRUE );
+ m_aDistBtn.Check( FALSE );
+ m_aSelectBtn.Check( FALSE );
+ m_aSelectBtn.SetStyle( m_aSelectBtn.GetStyle() | WB_WORDBREAK );
+}
+
+APPdfDriverPage::~APPdfDriverPage()
+{
+}
+
+bool APPdfDriverPage::check()
+{
+ return true;
+}
+
+void APPdfDriverPage::fill( PrinterInfo& rInfo )
+{
+ if( isDefault() )
+ rInfo.m_aDriverName = OUString::createFromAscii( "SGENPRT" );
+ else if( isDist() )
+ rInfo.m_aDriverName = OUString::createFromAscii( "ADISTILL" );
+}
+
+//--------------------------------------------------------------------
+
+AddPrinterDialog::AddPrinterDialog( Window* pParent )
+ : ModalDialog( pParent, PaResId( RID_ADD_PRINTER_DIALOG ) ),
+ m_aCancelPB( this, PaResId( RID_ADDP_BTN_CANCEL ) ),
+ m_aPrevPB( this, PaResId( RID_ADDP_BTN_PREV ) ),
+ m_aNextPB( this, PaResId( RID_ADDP_BTN_NEXT ) ),
+ m_aFinishPB( this, PaResId( RID_ADDP_BTN_FINISH ) ),
+ m_aLine( this, PaResId( RID_ADDP_LINE ) ),
+ m_aTitleImage( this, PaResId( RID_ADDP_CTRL_TITLE ) ),
+ m_pCurrentPage( NULL ),
+ m_pChooseDevicePage( NULL ),
+ m_pCommandPage( NULL ),
+ m_pChooseDriverPage( NULL ),
+ m_pNamePage( NULL ),
+ m_pOldPrinterPage( NULL ),
+ m_pFaxDriverPage( NULL ),
+ m_pFaxSelectDriverPage( NULL ),
+ m_pFaxNamePage( NULL ),
+ m_pFaxCommandPage( NULL ),
+ m_pPdfDriverPage( NULL ),
+ m_pPdfSelectDriverPage( NULL ),
+ m_pPdfNamePage( NULL ),
+ m_pPdfCommandPage( NULL )
+{
+ FreeResource();
+ m_pCurrentPage = m_pChooseDevicePage = new APChooseDevicePage( this );
+ m_pCurrentPage->Show( TRUE );
+ m_aFinishPB.Enable( FALSE );
+ m_aPrevPB.Enable( FALSE );
+
+ m_aNextPB.SetClickHdl( LINK( this, AddPrinterDialog, ClickBtnHdl ) );
+ m_aPrevPB.SetClickHdl( LINK( this, AddPrinterDialog, ClickBtnHdl ) );
+ m_aFinishPB.SetClickHdl( LINK( this, AddPrinterDialog, ClickBtnHdl ) );
+ m_aCancelPB.SetClickHdl( LINK( this, AddPrinterDialog, ClickBtnHdl ) );
+
+ m_aTitleImage.SetBackgroundColor( Color( 0xff, 0xff, 0xff ) );
+ m_aTitleImage.SetText( m_pCurrentPage->getTitle() );
+ updateSettings();
+}
+
+AddPrinterDialog::~AddPrinterDialog()
+{
+ if( m_pChooseDevicePage )
+ delete m_pChooseDevicePage;
+ if( m_pChooseDriverPage )
+ delete m_pChooseDriverPage;
+ if( m_pNamePage )
+ delete m_pNamePage;
+ if( m_pCommandPage )
+ delete m_pCommandPage;
+ if( m_pOldPrinterPage )
+ delete m_pOldPrinterPage;
+ if( m_pFaxDriverPage )
+ delete m_pFaxDriverPage;
+ if( m_pFaxSelectDriverPage )
+ delete m_pFaxSelectDriverPage;
+ if( m_pFaxCommandPage )
+ delete m_pFaxCommandPage;
+ if( m_pFaxNamePage )
+ delete m_pFaxNamePage;
+ if( m_pPdfDriverPage )
+ delete m_pPdfDriverPage;
+ if( m_pPdfSelectDriverPage )
+ delete m_pPdfSelectDriverPage;
+ if( m_pPdfNamePage )
+ delete m_pPdfNamePage;
+ if( m_pPdfCommandPage )
+ delete m_pPdfCommandPage;
+}
+
+void AddPrinterDialog::updateSettings()
+{
+ if( ! GetSettings().GetStyleSettings().GetHighContrastMode() )
+ m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER ) ) ) );
+ else
+ m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER_HC ) ) ) );
+}
+
+void AddPrinterDialog::DataChanged( const DataChangedEvent& rEv )
+{
+ ModalDialog::DataChanged( rEv );
+ if( (rEv.GetType() == DATACHANGED_SETTINGS) &&
+ (rEv.GetFlags() & SETTINGS_STYLE) )
+ {
+ updateSettings();
+ }
+}
+
+void AddPrinterDialog::advance()
+{
+ m_pCurrentPage->Show( FALSE );
+ if( m_pCurrentPage == m_pChooseDevicePage )
+ {
+ if( m_pChooseDevicePage->isPrinter() )
+ {
+ if( ! m_pChooseDriverPage )
+ m_pChooseDriverPage = new APChooseDriverPage( this );
+ m_pCurrentPage = m_pChooseDriverPage;
+ m_aPrevPB.Enable( TRUE );
+ }
+ else if( m_pChooseDevicePage->isOld() )
+ {
+ if( ! m_pOldPrinterPage )
+ m_pOldPrinterPage = new APOldPrinterPage( this );
+ m_pCurrentPage = m_pOldPrinterPage;
+ m_aPrevPB.Enable( TRUE );
+ m_aFinishPB.Enable( TRUE );
+ m_aNextPB.Enable( FALSE );
+ }
+ else if( m_pChooseDevicePage->isFax() )
+ {
+ if( ! m_pFaxDriverPage )
+ m_pFaxDriverPage = new APFaxDriverPage( this );
+ m_pCurrentPage = m_pFaxDriverPage;
+ m_aPrevPB.Enable( TRUE );
+ }
+ else if( m_pChooseDevicePage->isPDF() )
+ {
+ if( ! m_pPdfDriverPage )
+ m_pPdfDriverPage = new APPdfDriverPage( this );
+ m_pCurrentPage = m_pPdfDriverPage;
+ m_aPrevPB.Enable( TRUE );
+ }
+ }
+ else if( m_pCurrentPage == m_pChooseDriverPage )
+ {
+ if( ! m_pCommandPage )
+ m_pCommandPage = new APCommandPage( this, DeviceKind::Printer );
+ m_pCurrentPage = m_pCommandPage;
+ }
+ else if( m_pCurrentPage == m_pCommandPage )
+ {
+ if( ! m_pNamePage )
+ m_pNamePage = new APNamePage( this, m_aPrinter.m_aPrinterName, DeviceKind::Printer );
+ else
+ m_pNamePage->setText( m_aPrinter.m_aPrinterName );
+ m_pCurrentPage = m_pNamePage;
+ m_aFinishPB.Enable( TRUE );
+ m_aNextPB.Enable( FALSE );
+ }
+ else if( m_pCurrentPage == m_pFaxDriverPage )
+ {
+ if( ! m_pFaxDriverPage->isDefault() )
+ {
+ if( ! m_pFaxSelectDriverPage )
+ m_pFaxSelectDriverPage = new APChooseDriverPage( this );
+ m_pCurrentPage = m_pFaxSelectDriverPage;
+ }
+ else
+ {
+ if( ! m_pFaxCommandPage )
+ m_pFaxCommandPage = new APCommandPage( this, DeviceKind::Fax );
+ m_pCurrentPage = m_pFaxCommandPage;
+ }
+ }
+ else if( m_pCurrentPage == m_pFaxSelectDriverPage )
+ {
+ if( ! m_pFaxCommandPage )
+ m_pFaxCommandPage = new APCommandPage( this, DeviceKind::Fax );
+ m_pCurrentPage = m_pFaxCommandPage;
+ }
+ else if( m_pCurrentPage == m_pFaxCommandPage )
+ {
+ if( ! m_pFaxNamePage )
+ m_pFaxNamePage = new APNamePage( this, String(), DeviceKind::Fax );
+ m_pCurrentPage = m_pFaxNamePage;
+ m_aNextPB.Enable( FALSE );
+ m_aFinishPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pPdfDriverPage )
+ {
+ if( ! m_pPdfDriverPage->isDefault() && ! m_pPdfDriverPage->isDist() )
+ {
+ if( ! m_pPdfSelectDriverPage )
+ m_pPdfSelectDriverPage = new APChooseDriverPage( this );
+ m_pCurrentPage = m_pPdfSelectDriverPage;
+ }
+ else
+ {
+ if( ! m_pPdfCommandPage )
+ m_pPdfCommandPage = new APCommandPage( this, DeviceKind::Pdf );
+ m_pCurrentPage = m_pPdfCommandPage;
+ }
+ }
+ else if( m_pCurrentPage == m_pPdfSelectDriverPage )
+ {
+ if( ! m_pPdfCommandPage )
+ m_pPdfCommandPage = new APCommandPage( this, DeviceKind::Pdf );
+ m_pCurrentPage = m_pPdfCommandPage;
+ }
+ else if( m_pCurrentPage == m_pPdfCommandPage )
+ {
+ if( ! m_pPdfNamePage )
+ m_pPdfNamePage = new APNamePage( this, String(), DeviceKind::Pdf );
+ m_pCurrentPage = m_pPdfNamePage;
+ m_aNextPB.Enable( FALSE );
+ m_aFinishPB.Enable( TRUE );
+ }
+
+ m_pCurrentPage->Show( TRUE );
+ m_aTitleImage.SetText( m_pCurrentPage->getTitle() );
+}
+
+void AddPrinterDialog::back()
+{
+ m_pCurrentPage->Show( FALSE );
+ if( m_pCurrentPage == m_pChooseDriverPage )
+ {
+ m_pCurrentPage = m_pChooseDevicePage;
+ m_aPrevPB.Enable( FALSE );
+ }
+ else if( m_pCurrentPage == m_pNamePage )
+ {
+ m_pCurrentPage = m_pCommandPage;
+ m_aNextPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pCommandPage )
+ {
+ m_pCurrentPage = m_pChooseDriverPage;
+ }
+ else if( m_pCurrentPage == m_pOldPrinterPage )
+ {
+ m_pCurrentPage = m_pChooseDevicePage;
+ m_aPrevPB.Enable( FALSE );
+ m_aNextPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pFaxDriverPage )
+ {
+ m_pCurrentPage = m_pChooseDevicePage;
+ m_aPrevPB.Enable( FALSE );
+ }
+ else if( m_pCurrentPage == m_pFaxSelectDriverPage )
+ {
+ m_pCurrentPage = m_pFaxDriverPage;
+ }
+ else if( m_pCurrentPage == m_pFaxNamePage )
+ {
+ m_pCurrentPage = m_pFaxCommandPage;
+ m_aNextPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pFaxCommandPage )
+ {
+ m_pCurrentPage = m_pFaxDriverPage->isDefault() ? (APTabPage*)m_pFaxDriverPage : (APTabPage*)m_pFaxSelectDriverPage;
+ m_aNextPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pPdfDriverPage )
+ {
+ m_pCurrentPage = m_pChooseDevicePage;
+ m_aPrevPB.Enable( FALSE );
+ }
+ else if( m_pCurrentPage == m_pPdfSelectDriverPage )
+ {
+ m_pCurrentPage = m_pPdfDriverPage;
+ }
+ else if( m_pCurrentPage == m_pPdfNamePage )
+ {
+ m_pCurrentPage = m_pPdfCommandPage;
+ m_aNextPB.Enable( TRUE );
+ }
+ else if( m_pCurrentPage == m_pPdfCommandPage )
+ {
+ m_pCurrentPage = m_pPdfDriverPage->isDefault() || m_pPdfDriverPage->isDist() ? (APTabPage*)m_pPdfDriverPage : (APTabPage*)m_pPdfSelectDriverPage;
+ m_aNextPB.Enable( TRUE );
+ }
+ m_pCurrentPage->Show( TRUE );
+ m_aTitleImage.SetText( m_pCurrentPage->getTitle() );
+}
+
+void AddPrinterDialog::addPrinter()
+{
+ PrinterInfoManager& rManager( PrinterInfoManager::get() );
+ if( ! m_pChooseDevicePage->isOld() )
+ {
+ m_aPrinter.m_aPrinterName = uniquePrinterName( m_aPrinter.m_aPrinterName );
+ if( rManager.addPrinter( m_aPrinter.m_aPrinterName, m_aPrinter.m_aDriverName ) )
+ {
+ PrinterInfo aInfo( rManager.getPrinterInfo( m_aPrinter.m_aPrinterName ) );
+ aInfo.m_aCommand = m_aPrinter.m_aCommand;
+ if( m_pChooseDevicePage->isPrinter() )
+ {
+ if( m_pNamePage->isDefault() )
+ rManager.setDefaultPrinter( m_aPrinter.m_aPrinterName );
+ }
+ else if( m_pChooseDevicePage->isFax() )
+ {
+ aInfo.m_aFeatures = OUString::createFromAscii( "fax=" );
+ if( m_pFaxNamePage->isFaxSwallow() )
+ aInfo.m_aFeatures += OUString::createFromAscii( "swallow" );
+ }
+ else if( m_pChooseDevicePage->isPDF() )
+ {
+ OUString aPdf( OUString::createFromAscii( "pdf=" ) );
+ aPdf += m_pPdfCommandPage->getPdfDir();
+ aInfo.m_aFeatures = aPdf;
+ }
+ rManager.changePrinterInfo( m_aPrinter.m_aPrinterName, aInfo );
+ }
+ }
+ else if( m_pOldPrinterPage )
+ m_pOldPrinterPage->addOldPrinters();
+}
+
+IMPL_LINK( AddPrinterDialog, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aNextPB )
+ {
+ if( m_pCurrentPage->check() )
+ {
+ m_pCurrentPage->fill( m_aPrinter );
+ advance();
+ }
+ }
+ else if( pButton == &m_aPrevPB )
+ {
+ if( m_pCurrentPage->check() )
+ m_pCurrentPage->fill( m_aPrinter );
+ back();
+ }
+ else if( pButton == &m_aFinishPB )
+ {
+ if( m_pCurrentPage->check() )
+ {
+ m_pCurrentPage->fill( m_aPrinter );
+ addPrinter();
+ PrinterInfoManager::get().writePrinterConfig();
+ EndDialog( 1 );
+ }
+ }
+ else if( pButton == &m_aCancelPB )
+ EndDialog( 0 );
+
+ return 0;
+}
+
+String AddPrinterDialog::uniquePrinterName( const String& rBase )
+{
+ String aResult( rBase );
+
+ PrinterInfoManager& rManager( PrinterInfoManager::get() );
+
+ int nVersion = 1;
+ list< OUString > aPrinterList;
+ rManager.listPrinters( aPrinterList );
+ hash_set< OUString, OUStringHash > aPrinters;
+ for( list< OUString >::const_iterator it = aPrinterList.begin(); it != aPrinterList.end(); ++it )
+ aPrinters.insert( *it );
+ while( aPrinters.find( aResult ) != aPrinters.end() )
+ {
+ aResult = rBase;
+ aResult.AppendAscii( "_" );
+ aResult += String::CreateFromInt32( nVersion++ );
+ }
+
+ return aResult;
+}
+
+String AddPrinterDialog::getOldPrinterLocation()
+{
+ static const char* pHome = getenv( "HOME" );
+ String aRet;
+ ByteString aFileName;
+
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+ if( pHome )
+ {
+ aFileName = pHome;
+ aFileName.Append( "/.Xpdefaults" );
+ if( access( aFileName.GetBuffer(), F_OK ) )
+ {
+ aFileName = pHome;
+ aFileName.Append( "/.sversionrc" );
+ Config aSVer( String( aFileName, aEncoding ) );
+ aSVer.SetGroup( "Versions" );
+ aFileName = aSVer.ReadKey( "StarOffice 5.2" );
+ if( aFileName.Len() )
+ aFileName.Append( "/share/xp3/Xpdefaults" );
+ else if(
+ (aFileName = aSVer.ReadKey( "StarOffice 5.1" ) ).Len()
+ ||
+ (aFileName = aSVer.ReadKey( "StarOffice 5.0" ) ).Len()
+ ||
+ (aFileName = aSVer.ReadKey( "StarOffice 4.0" ) ).Len()
+ )
+ {
+ aFileName.Append( "/xp3/Xpdefaults" );
+ }
+ if( aFileName.Len() && access( aFileName.GetBuffer(), F_OK ) )
+ aFileName.Erase();
+ }
+ }
+ if( aFileName.Len() )
+ aRet = String( aFileName, aEncoding );
+ return aRet;
+}
diff --git a/padmin/source/adddlg.hxx b/padmin/source/adddlg.hxx
new file mode 100644
index 000000000000..6cf545e130db
--- /dev/null
+++ b/padmin/source/adddlg.hxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_ADDDLG_HXX_
+#define _PAD_ADDDLG_HXX_
+
+#include "helper.hxx"
+#include "titlectrl.hxx"
+
+#include "vcl/dialog.hxx"
+#include "vcl/tabpage.hxx"
+#include "vcl/button.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/printerinfomanager.hxx"
+
+namespace padmin
+{
+
+class AddPrinterDialog;
+
+namespace DeviceKind { enum type { Printer, Fax, Pdf }; }
+
+class APTabPage : public TabPage
+{
+ String m_aTitle;
+protected:
+ AddPrinterDialog* m_pParent;
+public:
+ APTabPage( AddPrinterDialog* pParent, const ResId& rResId );
+
+ // returns false if information is incomplete or invalid
+ virtual bool check() = 0;
+ virtual void fill( ::psp::PrinterInfo& rInfo ) = 0;
+ const String& getTitle() const { return m_aTitle; }
+};
+
+class APChooseDevicePage : public APTabPage
+{
+ RadioButton m_aPrinterBtn;
+ RadioButton m_aFaxBtn;
+ RadioButton m_aPDFBtn;
+ RadioButton m_aOldBtn;
+ FixedText m_aOverTxt;
+public:
+ APChooseDevicePage( AddPrinterDialog* pParent );
+ ~APChooseDevicePage();
+
+ bool isPrinter() { return m_aPrinterBtn.IsChecked(); }
+ bool isFax() { return m_aFaxBtn.IsChecked(); }
+ bool isPDF() { return m_aPDFBtn.IsChecked(); }
+ bool isOld() { return m_aOldBtn.IsChecked(); }
+
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+};
+
+class APChooseDriverPage : public APTabPage
+{
+ FixedText m_aDriverTxt;
+ DelListBox m_aDriverBox;
+ PushButton m_aAddBtn;
+ PushButton m_aRemBtn;
+
+ String m_aRemStr;
+ String m_aLastPrinterName;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+ DECL_LINK( DelPressedHdl, ListBox* );
+
+ void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) );
+public:
+ APChooseDriverPage( AddPrinterDialog* pParent );
+ ~APChooseDriverPage();
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+};
+
+class APNamePage : public APTabPage
+{
+ FixedText m_aNameTxt;
+ Edit m_aNameEdt;
+ CheckBox m_aDefaultBox;
+ CheckBox m_aFaxSwallowBox;
+public:
+ APNamePage( AddPrinterDialog* pParent, const String& rInitName, DeviceKind::type eKind );
+ ~APNamePage();
+
+ bool isDefault() { return m_aDefaultBox.IsChecked(); }
+ bool isFaxSwallow() { return m_aFaxSwallowBox.IsChecked(); }
+
+ void setText( const String& rText ) { m_aNameEdt.SetText( rText ); }
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+};
+
+class APCommandPage : public APTabPage
+{
+ FixedText m_aCommandTxt;
+ ComboBox m_aCommandBox;
+ PushButton m_aHelpBtn;
+ String m_aHelpTxt;
+ FixedText m_aPdfDirTxt;
+ Edit m_aPdfDirEdt;
+ PushButton m_aPdfDirBtn;
+
+ DeviceKind::type m_eKind;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+ DECL_LINK( ModifyHdl, ComboBox* );
+public:
+
+ APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind );
+ ~APCommandPage();
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+
+ String getPdfDir() { return m_aPdfDirEdt.GetText(); }
+};
+
+class APOldPrinterPage : public APTabPage
+{
+ FixedText m_aOldPrinterTxt;
+ MultiListBox m_aOldPrinterBox;
+ PushButton m_aSelectAllBtn;
+
+ ::std::list< ::psp::PrinterInfo > m_aOldPrinters;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+public:
+ APOldPrinterPage( AddPrinterDialog* pParent );
+ ~APOldPrinterPage();
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+
+ void addOldPrinters();
+};
+
+class APFaxDriverPage : public APTabPage
+{
+ FixedText m_aFaxTxt;
+ RadioButton m_aDefBtn;
+ RadioButton m_aSelectBtn;
+public:
+ APFaxDriverPage( AddPrinterDialog* pParent );
+ ~APFaxDriverPage();
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+
+ bool isDefault() { return m_aDefBtn.IsChecked(); }
+};
+
+class APPdfDriverPage : public APTabPage
+{
+ FixedText m_aPdfTxt;
+ RadioButton m_aDefBtn;
+ RadioButton m_aDistBtn;
+ RadioButton m_aSelectBtn;
+public:
+ APPdfDriverPage( AddPrinterDialog* pParent );
+ ~APPdfDriverPage();
+
+ virtual bool check();
+ virtual void fill( ::psp::PrinterInfo& rInfo );
+
+ bool isDefault() { return m_aDefBtn.IsChecked(); }
+ bool isDist() { return m_aDistBtn.IsChecked(); }
+};
+
+class AddPrinterDialog : public ModalDialog
+{
+ CancelButton m_aCancelPB;
+ PushButton m_aPrevPB;
+ PushButton m_aNextPB;
+ OKButton m_aFinishPB;
+ FixedLine m_aLine;
+ TitleImage m_aTitleImage;
+
+ ::psp::PrinterInfo m_aPrinter;
+
+ APTabPage* m_pCurrentPage;
+
+ APChooseDevicePage* m_pChooseDevicePage;
+ APCommandPage* m_pCommandPage;
+ APChooseDriverPage* m_pChooseDriverPage;
+ APNamePage* m_pNamePage;
+ APOldPrinterPage* m_pOldPrinterPage;
+ APFaxDriverPage* m_pFaxDriverPage;
+ APChooseDriverPage* m_pFaxSelectDriverPage;
+ APNamePage* m_pFaxNamePage;
+ APCommandPage* m_pFaxCommandPage;
+ APPdfDriverPage* m_pPdfDriverPage;
+ APChooseDriverPage* m_pPdfSelectDriverPage;
+ APNamePage* m_pPdfNamePage;
+ APCommandPage* m_pPdfCommandPage;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+
+ void advance();
+ void back();
+ void addPrinter();
+
+ void updateSettings();
+ virtual void DataChanged( const DataChangedEvent& rEv );
+
+public:
+ AddPrinterDialog( Window* pParent );
+ ~AddPrinterDialog();
+
+ static String uniquePrinterName( const String& rString );
+ static String getOldPrinterLocation();
+
+ void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); }
+};
+
+} // namespace
+
+#endif
diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx
new file mode 100644
index 000000000000..76d181fb8e5e
--- /dev/null
+++ b/padmin/source/cmddlg.cxx
@@ -0,0 +1,551 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#ifndef _PAD_RTSETUP_HRC_
+#include <rtsetup.hrc>
+#endif
+#include <cmddlg.hxx>
+#include <padialog.hxx>
+#include <helper.hxx>
+#include <prtsetup.hxx>
+
+using namespace psp;
+using namespace rtl;
+using namespace padmin;
+
+#define PRINTER_PERSISTENCE_GROUP "KnownPrinterCommands"
+#define FAX_PERSISTENCE_GROUP "KnownFaxCommands"
+#define PDF_PERSISTENCE_GROUP "KnowPdfCommands"
+#define MAX_COMMANDS 50
+
+void CommandStore::getSystemPrintCommands( ::std::list< String >& rCommands )
+{
+ static ::std::list< OUString > aSysCommands;
+ static bool bOnce = false;
+ if( ! bOnce )
+ {
+ bOnce = true;
+ PrinterInfoManager::get().getSystemPrintCommands( aSysCommands );
+ }
+
+ ::std::list< OUString >::const_iterator it;
+ for( it = aSysCommands.begin(); it != aSysCommands.end(); ++it )
+ rCommands.push_back( *it );
+}
+
+void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
+{
+ static bool bOnce = false;
+ static ::std::list< String > aSysCommands;
+
+ if( ! bOnce )
+ {
+ bOnce = true;
+ char pBuffer[1024];
+ FILE* pPipe;
+ String aCommand;
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+
+ pPipe = popen( "which gs 2>/dev/null", "r" );
+ if( pPipe )
+ {
+ if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL)
+ {
+ int nLen = strlen( pBuffer );
+ if( pBuffer[nLen-1] == '\n' ) // strip newline
+ pBuffer[--nLen] = 0;
+ aCommand = String( ByteString( pBuffer ), aEncoding );
+ if( ( ( aCommand.GetChar( 0 ) == '/' )
+ || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
+ || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
+ && nLen > 2
+ && aCommand.GetChar( nLen-2 ) == 'g'
+ && aCommand.GetChar( nLen-1 ) == 's' )
+ {
+ aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" );
+ aSysCommands.push_back( aCommand );
+ }
+ }
+ pclose( pPipe );
+ }
+
+ pPipe = popen( "which distill 2>/dev/null", "r" );
+ if( pPipe )
+ {
+ if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL)
+ {
+ int nLen = strlen( pBuffer );
+ if( pBuffer[nLen-1] == '\n' ) // strip newline
+ pBuffer[--nLen] = 0;
+ aCommand = String( ByteString( pBuffer ), aEncoding );
+ if( ( ( aCommand.GetChar( 0 ) == '/' )
+ || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
+ || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
+ && nLen > 7
+ && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) )
+ {
+ aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" );
+ aSysCommands.push_back( aCommand );
+ }
+ }
+ pclose( pPipe );
+ }
+ }
+ ::std::list< String >::const_iterator it;
+ for( it = aSysCommands.begin(); it != aSysCommands.end(); ++it )
+ rCommands.push_back( *it );
+}
+
+
+
+void CommandStore::getStoredCommands( const char* pGroup, ::std::list< String >& rCommands )
+{
+ Config& rConfig( getPadminRC() );
+ rConfig.SetGroup( pGroup );
+ int nKeys = rConfig.GetKeyCount();
+ ::std::list< String >::const_iterator it;
+ while( nKeys-- )
+ {
+ String aCommand( rConfig.ReadKey( ByteString::CreateFromInt32( nKeys ), RTL_TEXTENCODING_UTF8 ) );
+ if( aCommand.Len() )
+ {
+ for( it = rCommands.begin(); it != rCommands.end() && *it != aCommand; ++it )
+ ;
+ if( it == rCommands.end() )
+ rCommands.push_back( aCommand );
+ }
+ }
+}
+
+void CommandStore::setCommands(
+ const char* pGroup,
+ const ::std::list< String >& rCommands,
+ const ::std::list< String >& rSysCommands
+ )
+{
+ Config& rConfig( getPadminRC() );
+ rConfig.DeleteGroup( pGroup );
+ rConfig.SetGroup( pGroup );
+ ::std::list< String >::const_iterator it, loop;
+ ::std::list< String > aWriteList;
+
+ int nWritten = 0;
+ for( it = rCommands.begin(); it != rCommands.end(); ++it )
+ {
+ if( it->Len() )
+ {
+ for( loop = rSysCommands.begin(); loop != rSysCommands.end() && *loop != *it; ++loop )
+ ;
+ if( loop == rSysCommands.end() )
+ {
+ aWriteList.push_back( *it );
+ nWritten++;
+ }
+ }
+ }
+ while( nWritten > MAX_COMMANDS )
+ {
+ aWriteList.pop_front();
+ nWritten--;
+ }
+ for( nWritten = 0, it = aWriteList.begin(); it != aWriteList.end(); ++it, ++nWritten )
+ rConfig.WriteKey( ByteString::CreateFromInt32( nWritten ), ByteString( *it, RTL_TEXTENCODING_UTF8 ) );
+}
+
+
+void CommandStore::getPrintCommands( ::std::list< String >& rCommands )
+{
+ rCommands.clear();
+ getSystemPrintCommands( rCommands );
+ getStoredCommands( PRINTER_PERSISTENCE_GROUP, rCommands );
+}
+
+void CommandStore::getPdfCommands( ::std::list< String >& rCommands )
+{
+ rCommands.clear();
+ getSystemPdfCommands( rCommands );
+ getStoredCommands( PDF_PERSISTENCE_GROUP, rCommands );
+}
+
+void CommandStore::getFaxCommands( ::std::list< String >& rCommands )
+{
+ rCommands.clear();
+ getStoredCommands( FAX_PERSISTENCE_GROUP, rCommands );
+}
+
+void CommandStore::setPrintCommands( const ::std::list< String >& rCommands )
+{
+ ::std::list< String > aSysCmds;
+ getSystemPrintCommands( aSysCmds );
+ setCommands( PRINTER_PERSISTENCE_GROUP, rCommands, aSysCmds );
+}
+
+void CommandStore::setPdfCommands( const ::std::list< String >& rCommands )
+{
+ ::std::list< String > aSysCmds;
+ getSystemPdfCommands( aSysCmds );
+ setCommands( PDF_PERSISTENCE_GROUP, rCommands, aSysCmds );
+}
+
+void CommandStore::setFaxCommands( const ::std::list< String >& rCommands )
+{
+ ::std::list< String > aSysCmds;
+ setCommands( FAX_PERSISTENCE_GROUP, rCommands, aSysCmds );
+}
+
+
+RTSCommandPage::RTSCommandPage( RTSDialog* pParent ) :
+ TabPage( &pParent->m_aTabControl, PaResId( RID_RTS_COMMANDPAGE ) ),
+ m_pParent( pParent ),
+ m_aCommandsCB( this, PaResId( RID_RTS_CMD_CB_COMMANDS ) ),
+ m_aExternalCB( this, PaResId( RID_RTS_CMD_CB_EXTERNAL ) ),
+ m_aQuickFT( this, PaResId( RID_RTS_CMD_FT_QUICKCMD ) ),
+ m_aQuickCB( this, PaResId( RIT_RTS_CMD_CB_QUICKCMD ) ),
+ m_aCommandTitle( this, PaResId( RID_RTS_CMD_FL_INSTALL ) ),
+ m_aPrinterName( this, PaResId( RID_RTS_CMD_TXT_PRTNAME ) ),
+ m_aConnectedTo( this, PaResId( RID_RTS_CMD_TXT_CONNECT ) ),
+ m_aPrinterFL( this, PaResId( RID_RTS_CMD_FL_DEFAULT ) ),
+ m_aConfigureText( this, PaResId( RID_RTS_CMD_TXT_CONFIGURE ) ),
+ m_aConfigureBox( this, PaResId( RID_RTS_CMD_LB_CONFIGURE ) ),
+ m_aPdfDirectoryText( this, PaResId( RID_RTS_CMD_TXT_PDFDIR ) ),
+ m_aPdfDirectoryButton( this, PaResId( RID_RTS_CMD_BTN_PDFDIR ) ),
+ m_aPdfDirectoryEdit( this, PaResId( RID_RTS_CMD_EDT_PDFDIR ) ),
+ m_aFaxSwallowBox( this, PaResId( RID_RTS_CMD_BOX_SWALLOWFAXNO ) ),
+ m_aHelpButton( this, PaResId( RID_RTS_CMD_BTN_HELP ) ),
+ m_aRemovePB( this, PaResId( RID_RTS_CMD_BTN_REMOVE ) ),
+ m_aFaxHelp( PaResId( RID_RTS_CMD_STR_FAXHELP ) ),
+ m_aPrinterHelp( PaResId( RID_RTS_CMD_STR_PRINTERHELP ) ),
+ m_aPdfHelp( PaResId( RID_RTS_CMD_STR_PDFHELP ) )
+{
+ // configuring as printer is only sensible in default print system
+ PrinterInfoManager& rMgr( PrinterInfoManager::get() );
+ if( rMgr.getType() == PrinterInfoManager::Default || rMgr.isCUPSDisabled() )
+ m_nPrinterEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_PRINTER ) ) );
+ else
+ m_nPrinterEntry = ~0;
+ m_nFaxEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_FAX ) ) );
+ m_nPdfEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_PDF ) ) );
+
+ FreeResource();
+
+ CommandStore::getPrintCommands( m_aPrinterCommands );
+ CommandStore::getFaxCommands( m_aFaxCommands );
+ CommandStore::getPdfCommands( m_aPdfCommands );
+
+ m_aPrinterName.SetText( m_pParent->m_aPrinter );
+
+ m_aCommandsCB.SetDoubleClickHdl( LINK( this, RTSCommandPage, DoubleClickHdl ) );
+ m_aCommandsCB.SetSelectHdl( LINK( this, RTSCommandPage, SelectHdl ) );
+ m_aCommandsCB.SetModifyHdl( LINK( this, RTSCommandPage, ModifyHdl ) );
+ m_aConfigureBox.SetSelectHdl( LINK( this, RTSCommandPage, SelectHdl ) );
+ m_aHelpButton.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
+ m_aRemovePB.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
+ m_aPdfDirectoryButton.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
+ m_aExternalCB.SetToggleHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
+
+ m_aPdfDirectoryButton.Show( FALSE );
+ m_aPdfDirectoryEdit.Show( FALSE );
+ m_aPdfDirectoryText.Show( FALSE );
+ m_aFaxSwallowBox.Show( FALSE );
+ m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
+ m_aQuickCB.SetText( m_pParent->m_aJobData.m_aQuickCommand );
+
+ m_bWasFax = false;
+ m_bWasPdf = false;
+ m_aConfigureBox.SelectEntryPos( m_nPrinterEntry );
+ sal_Int32 nIndex = 0;
+ while( nIndex != -1 )
+ {
+ OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) );
+ if( ! aToken.compareToAscii( "fax", 3 ) )
+ {
+ m_bWasFax = true;
+ m_aFaxSwallowBox.Show( TRUE );
+ sal_Int32 nPos = 0;
+ m_aFaxSwallowBox.Check( ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? TRUE : FALSE );
+ m_aConfigureBox.SelectEntryPos( m_nFaxEntry );
+ }
+ else if( ! aToken.compareToAscii( "pdf=", 4 ) )
+ {
+ m_bWasPdf = true;
+ sal_Int32 nPos = 0;
+ m_aPdfDirectoryEdit.SetText( aToken.getToken( 1, '=', nPos ) );
+ m_aPdfDirectoryEdit.Show( TRUE );
+ m_aPdfDirectoryButton.Show( TRUE );
+ m_aPdfDirectoryText.Show( TRUE );
+ m_aConfigureBox.SelectEntryPos( m_nPdfEntry );
+ }
+ else if( ! aToken.compareToAscii( "external_dialog" ) )
+ {
+ m_aExternalCB.Check();
+ m_bWasExternalDialog = true;
+ }
+ }
+
+ m_aQuickCB.Enable( m_aExternalCB.IsChecked() );
+
+ String aString( m_aConnectedTo.GetText() );
+ aString += String( m_pParent->m_aJobData.m_aCommand );
+ m_aConnectedTo.SetText( aString );
+
+ UpdateCommands();
+}
+
+RTSCommandPage::~RTSCommandPage()
+{
+}
+
+void RTSCommandPage::save()
+{
+ String aCommand,aQuickCommand;
+ bool bHaveFax = m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry ? true : false;
+ bool bHavePdf = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? true : false;
+ ::std::list< String >::iterator it;
+
+ String aFeatures;
+ sal_Int32 nIndex = 0;
+ String aOldPdfPath;
+ bool bOldFaxSwallow = false;
+ bool bFaxSwallow = m_aFaxSwallowBox.IsChecked() ? true : false;
+ bool bOldExternalDialog = false, bExternalDialog = m_aExternalCB.IsChecked() ? true : false;
+
+ while( nIndex != -1 )
+ {
+ OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) );
+ if( aToken.compareToAscii( "fax", 3 ) &&
+ aToken.compareToAscii( "pdf", 3 ) &&
+ aToken.compareToAscii( "external_dialog" )
+ )
+ {
+ if( aToken.getLength() )
+ {
+ if( aFeatures.Len() )
+ aFeatures += ',';
+ aFeatures += String( aToken );
+ }
+ }
+ else if( ! aToken.compareToAscii( "pdf=", 4 ) )
+ {
+ sal_Int32 nPos = 0;
+ aOldPdfPath = aToken.getToken( 1, '=', nPos );
+ }
+ else if( ! aToken.compareToAscii( "fax=", 4 ) )
+ {
+ sal_Int32 nPos = 0;
+ bOldFaxSwallow = aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? false : true;
+ }
+ else if( ! aToken.compareToAscii( "external_dialog" ) )
+ {
+ bOldExternalDialog = true;
+ }
+ }
+ ::std::list< String >* pList = &m_aPrinterCommands;
+ if( bExternalDialog )
+ {
+ if( aFeatures.Len() )
+ aFeatures += ',';
+ aFeatures.AppendAscii( "external_dialog" );
+ }
+ if( bHaveFax )
+ {
+ if( aFeatures.Len() )
+ aFeatures += ',';
+ aFeatures.AppendAscii( "fax=" );
+ if( bFaxSwallow )
+ aFeatures.AppendAscii( "swallow" );
+ pList = &m_aFaxCommands;
+ }
+ if( bHavePdf )
+ {
+ if( aFeatures.Len() )
+ aFeatures += ',';
+ aFeatures.AppendAscii( "pdf=" );
+ aFeatures.Append( m_aPdfDirectoryEdit.GetText() );
+ pList = &m_aPdfCommands;
+ }
+ aCommand = m_aCommandsCB.GetText();
+ aQuickCommand = m_aQuickCB.GetText();
+ for( it = pList->begin(); it != pList->end() && *it != aCommand; ++it )
+ ;
+ if( it == pList->end() )
+ pList->push_back( aCommand );
+
+ if( aCommand != String( m_pParent->m_aJobData.m_aCommand ) ||
+ aQuickCommand != String( m_pParent->m_aJobData.m_aQuickCommand ) ||
+ ( m_bWasFax && ! bHaveFax ) ||
+ ( ! m_bWasFax && bHaveFax ) ||
+ ( m_bWasPdf && ! bHavePdf ) ||
+ ( ! m_bWasPdf && bHavePdf ) ||
+ ( bHavePdf && aOldPdfPath != m_aPdfDirectoryEdit.GetText() ) ||
+ ( bHaveFax && bFaxSwallow != bOldFaxSwallow ) ||
+ ( m_bWasExternalDialog && ! bExternalDialog ) ||
+ ( ! m_bWasExternalDialog && bExternalDialog )
+ )
+ {
+ m_pParent->m_aJobData.m_aCommand = aCommand;
+ m_pParent->m_aJobData.m_aQuickCommand = aQuickCommand;
+ m_pParent->m_aJobData.m_aFeatures = aFeatures;
+
+ PrinterInfoManager::get().changePrinterInfo( m_pParent->m_aPrinter, m_pParent->m_aJobData );
+ }
+ CommandStore::setPrintCommands( m_aPrinterCommands );
+ CommandStore::setFaxCommands( m_aFaxCommands );
+ CommandStore::setPdfCommands( m_aPdfCommands );
+}
+
+
+IMPL_LINK( RTSCommandPage, SelectHdl, Control*, pBox )
+{
+ if( pBox == &m_aConfigureBox )
+ {
+ BOOL bEnable = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? TRUE : FALSE;
+ m_aPdfDirectoryButton.Show( bEnable );
+ m_aPdfDirectoryEdit.Show( bEnable );
+ m_aPdfDirectoryText.Show( bEnable );
+ bEnable = m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry ? TRUE : FALSE;
+ m_aFaxSwallowBox.Show( bEnable );
+ UpdateCommands();
+ }
+ else if( pBox == &m_aCommandsCB )
+ {
+ m_aRemovePB.Enable( TRUE );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( RTSCommandPage, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == & m_aPdfDirectoryButton )
+ {
+ String aPath( m_aPdfDirectoryEdit.GetText() );
+ if( chooseDirectory( aPath ) )
+ m_aPdfDirectoryEdit.SetText( aPath );
+ }
+ else if( pButton == &m_aRemovePB )
+ {
+ String aEntry( m_aCommandsCB.GetText() );
+ ::std::list< String >* pList;
+ if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
+ pList = &m_aPrinterCommands;
+ else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
+ pList = &m_aFaxCommands;
+ else
+ pList = &m_aPdfCommands;
+
+ pList->remove( aEntry );
+ m_aCommandsCB.RemoveEntry( aEntry );
+ m_aQuickCB.RemoveEntry( aEntry );
+ }
+ else if( pButton == &m_aHelpButton )
+ {
+ String aHelpText;
+ if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
+ aHelpText = m_aPrinterHelp;
+ else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
+ aHelpText = m_aFaxHelp;
+ else if( m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry )
+ aHelpText = m_aPdfHelp;
+
+ InfoBox aBox( this, aHelpText );
+ aBox.Execute();
+ }
+ else if( pButton == &m_aExternalCB )
+ {
+ m_aQuickCB.Enable( m_aExternalCB.IsChecked() );
+ }
+ return 0;
+}
+
+IMPL_LINK( RTSCommandPage, DoubleClickHdl, ComboBox*, pComboBox )
+{
+ if( pComboBox == &m_aCommandsCB )
+ ConnectCommand();
+ return 0;
+}
+
+IMPL_LINK( RTSCommandPage, ModifyHdl, Edit*, pEdit )
+{
+ if( pEdit == &m_aCommandsCB )
+ m_aRemovePB.Enable( m_aCommandsCB.GetEntryPos( m_aCommandsCB.GetText() ) != LISTBOX_ENTRY_NOTFOUND );
+
+ return 0;
+}
+
+void RTSCommandPage::UpdateCommands()
+{
+ m_aCommandsCB.Clear();
+ ::std::list< String >::iterator it;
+ if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
+ {
+ for( it = m_aPrinterCommands.begin(); it != m_aPrinterCommands.end(); ++it )
+ {
+ m_aCommandsCB.InsertEntry( *it );
+ m_aQuickCB.InsertEntry( *it );
+ }
+ if( ! m_bWasFax )
+ m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
+ else
+ m_aCommandsCB.SetText( String() );
+ }
+ else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
+ {
+ for( it = m_aFaxCommands.begin(); it != m_aFaxCommands.end(); ++it )
+ {
+ m_aCommandsCB.InsertEntry( *it );
+ m_aQuickCB.InsertEntry( *it );
+ }
+ if( m_bWasFax )
+ m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
+ else
+ m_aCommandsCB.SetText( String() );
+ }
+ else if( m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry )
+ {
+ for( it = m_aPdfCommands.begin(); it != m_aPdfCommands.end(); ++it )
+ {
+ m_aCommandsCB.InsertEntry( *it );
+ m_aQuickCB.InsertEntry( *it );
+ }
+ if( m_bWasPdf )
+ m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
+ else
+ m_aCommandsCB.SetText( String() );
+ }
+}
+
+void RTSCommandPage::ConnectCommand()
+{
+ String aString( m_aConnectedTo.GetText().GetToken( 0, ':' ) );
+ aString.AppendAscii( ": " );
+ aString += m_aCommandsCB.GetText();
+
+ m_aConnectedTo.SetText( aString );
+}
diff --git a/padmin/source/cmddlg.hxx b/padmin/source/cmddlg.hxx
new file mode 100644
index 000000000000..9e6d12cf4277
--- /dev/null
+++ b/padmin/source/cmddlg.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_COMMANDDLG_HXX_
+#define _PAD_COMMANDDLG_HXX_
+
+#include <vcl/dialog.hxx>
+#include <tools/config.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/tabpage.hxx>
+
+#include <list>
+
+namespace padmin {
+
+class RTSDialog;
+
+class CommandStore
+{
+ static void getStoredCommands( const char* pGroup, ::std::list< String >& rCommands );
+ static void getSystemPrintCommands( ::std::list< String >& rCommands );
+ static void getSystemPdfCommands( ::std::list< String >& rCommands );
+ static void setCommands( const char* pGroup, const ::std::list< String >& rCommands, const ::std::list< String >& rSysCommands );
+
+public:
+ static void getPrintCommands( ::std::list< String >& rCommands );
+ static void getFaxCommands( ::std::list< String >& rCommands );
+ static void getPdfCommands( ::std::list< String >& rCommands );
+
+ static void setPrintCommands( const ::std::list< String >& rCommands );
+ static void setFaxCommands( const ::std::list< String >& rCommands );
+ static void setPdfCommands( const ::std::list< String >& rCommands );
+};
+
+class RTSCommandPage : public TabPage
+{
+private:
+ RTSDialog* m_pParent;
+
+ ComboBox m_aCommandsCB;
+ CheckBox m_aExternalCB;
+ FixedText m_aQuickFT;
+ ComboBox m_aQuickCB;
+ FixedLine m_aCommandTitle;
+ FixedText m_aPrinterName;
+ FixedText m_aConnectedTo;
+ FixedLine m_aPrinterFL;
+
+ FixedText m_aConfigureText;
+ ListBox m_aConfigureBox;
+ USHORT m_nPrinterEntry;
+ USHORT m_nFaxEntry;
+ USHORT m_nPdfEntry;
+ FixedText m_aPdfDirectoryText;
+ PushButton m_aPdfDirectoryButton;
+ Edit m_aPdfDirectoryEdit;
+ CheckBox m_aFaxSwallowBox;
+
+ PushButton m_aHelpButton;
+ PushButton m_aRemovePB;
+
+ ::std::list< String > m_aPrinterCommands;
+ ::std::list< String > m_aFaxCommands;
+ ::std::list< String > m_aPdfCommands;
+
+ String m_aFaxHelp;
+ String m_aPrinterHelp;
+ String m_aPdfHelp;
+
+ bool m_bWasFax;
+ bool m_bWasPdf;
+ bool m_bWasExternalDialog;
+
+ DECL_LINK( DoubleClickHdl, ComboBox* );
+ DECL_LINK( ClickBtnHdl, Button* );
+ DECL_LINK( SelectHdl, Control* );
+ DECL_LINK( ModifyHdl, Edit* );
+
+ void ConnectCommand();
+ void UpdateCommands();
+
+public:
+ RTSCommandPage( RTSDialog* );
+ ~RTSCommandPage();
+
+ void save();
+};
+
+} // namespace
+
+#endif
diff --git a/padmin/source/desktopcontext.cxx b/padmin/source/desktopcontext.cxx
new file mode 100644
index 000000000000..25db25bfaa31
--- /dev/null
+++ b/padmin/source/desktopcontext.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "desktopcontext.hxx"
+
+#include <vcl/svapp.hxx>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+namespace padmin
+{
+
+DesktopContext::DesktopContext( const Reference< XCurrentContext > & ctx )
+ : m_xNextContext( ctx )
+{
+}
+
+Any SAL_CALL DesktopContext::getValueByName( const OUString& Name) throw (RuntimeException)
+{
+ Any retVal;
+
+ if ( 0 == Name.compareToAscii( DESKTOP_ENVIRONMENT_NAME ) )
+ {
+ retVal = makeAny( Application::GetDesktopEnvironment() );
+ }
+ else if( m_xNextContext.is() )
+ {
+ // Call next context in chain if found
+ retVal = m_xNextContext->getValueByName( Name );
+ }
+ return retVal;
+}
+
+}
diff --git a/padmin/source/desktopcontext.hxx b/padmin/source/desktopcontext.hxx
new file mode 100644
index 000000000000..13dcdd4c0105
--- /dev/null
+++ b/padmin/source/desktopcontext.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PADMIN_DESKTOPCONTEXT_HXX_
+#define _PADMIN_DESKTOPCONTEXT_HXX_
+
+#include <cppuhelper/implbase1.hxx>
+#include <uno/current_context.hxx>
+
+#define DESKTOP_ENVIRONMENT_NAME "system.desktop-environment"
+
+namespace padmin
+{
+ class DesktopContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
+ {
+ public:
+ DesktopContext( const com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > & ctx);
+
+ // XCurrentContext
+ virtual com::sun::star::uno::Any SAL_CALL getValueByName( const rtl::OUString& Name )
+ throw (com::sun::star::uno::RuntimeException);
+
+ private:
+ com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext;
+ };
+}
+
+#endif // _PADMIN_DESKTOPCONTEXT_HXX_
diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx
new file mode 100644
index 000000000000..f67d2c0d18d6
--- /dev/null
+++ b/padmin/source/fontentry.cxx
@@ -0,0 +1,668 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "fontentry.hxx"
+#include "helper.hxx"
+#include "padialog.hrc"
+#include "vcl/strhelper.hxx"
+
+#include "vcl/msgbox.hxx"
+#include "vcl/fontmanager.hxx"
+
+#include "osl/thread.h"
+
+#include "tools/config.hxx"
+
+using namespace padmin;
+using namespace osl;
+using namespace rtl;
+using namespace psp;
+
+#if 0
+static void CreateAfmFile( const INetURLObject& rFontFile )
+{
+ rtl_TextEncoding aEncoding = gsl_getSystemTextEncoding();
+
+ INetURLObject aFontMap( rFontFile.GetPath(), INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ aFontMap.Append( String( RTL_CONSTASCII_USTRINGPARAM( "Fontmap" ) ) );
+ INetURLObject aAfmFile( rFontFile );
+ aAfmFile.setExtension( String::CreateFromAscii( "afm", 3 ) );
+
+
+ SvFileStream aMap( aFontMap.PathToFileName(), STREAM_WRITE | STREAM_TRUNC );
+ if( aMap.IsOpen() )
+ {
+ SvFileStream aRead( rFontFile.GetFull(), STREAM_READ );
+ ByteString aLine;
+ ByteString aFullName;
+ int nPos;
+ while( ! aRead.IsEof() &&
+ ( nPos = aLine.Search( "/FullName" ) ) == STRING_NOTFOUND )
+ aRead.ReadLine( aLine );
+ aRead.Close();
+ if( nPos != STRING_NOTFOUND )
+ {
+ aLine.Erase( 0, nPos );
+ aFullName = aLine.GetToken( 1, '(' ).GetToken( 0, ')' );
+
+ aLine = '/';
+ aLine += aFullName;
+ aLine += ' ';
+ aLine += '(';
+ aLine += ByteString( rFontFile.GetName(), aEncoding );
+ aLine += ')';
+ aLine += ';';
+
+ aMap.WriteLine( aLine );
+ }
+ aMap.Close();
+ pid_t nPID = fork();
+ if( ! nPID )
+ {
+ INetURLObject aTmp( rFontFile );
+ aTmp.CutName();
+ ByteString aEnv( "GS_LIB=" );
+ aEnv += ByteString( aTmp.PathToFileName(), aEncoding );
+ putenv( const_cast<char*>(aEnv.GetBuffer()) );
+
+ int nDescr = open( ByteString( aAfmFile.PathToFileName(), aEncoding ).GetBuffer(),
+ O_CREAT | O_TRUNC| O_WRONLY,
+ 00755 );
+#if OSL_DEBUG_LEVEL > 1
+ if( nDescr < 0 )
+ fprintf( stderr, "open( %s ) failed because of %d\n", ByteString( aAfmFile.GetFull(), aEncoding ).GetBuffer(), errno );
+#endif
+ if( dup2( nDescr, STDOUT_FILENO ) > 0 )
+ {
+ execlp( "gs",
+ "-q",
+ "-dNODISPLAY",
+ "--", "printafm.ps",
+ aFullName.GetBuffer(),
+ NULL );
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ fprintf( stderr, "dup2( %d, %d ) failed because of %d\n", nDescr, STDOUT_FILENO, errno );
+#endif
+ _exit( 0 );
+ }
+ if( nPID > 0 )
+ waitpid( nPID, NULL, 0 );
+ MetricConverter::ConvertAFM( aAfmFile );
+ }
+
+ struct stat aStat;
+ ByteString aSysFile( aAfmFile.PathToFileName(), aEncoding );
+ if( stat( aSysFile.GetBuffer(), &aStat ) || ! aStat.st_size )
+ unlink( aSysFile.GetBuffer() );
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, " %s\n", ! access( aSysFile.GetBuffer(), F_OK ) ? "success" : "failed" );
+#endif
+ unlink( ByteString( aFontMap.PathToFileName(), aEncoding ).GetBuffer() );
+}
+
+#endif
+
+FontNameDlg::FontNameDlg( Window *pParent ) :
+ ModalDialog( pParent, PaResId( RID_FONTNAMEDIALOG ) ),
+ m_aOKButton( this, PaResId( RID_FNTNM_BTN_OK ) ),
+ m_aRenameButton( this, PaResId( RID_FNTNM_BTN_RENAME ) ),
+ m_aRemoveButton( this, PaResId( RID_FNTNM_BTN_REMOVE ) ),
+ m_aImportButton( this, PaResId( RID_FNTNM_BTN_IMPORT ) ),
+ m_aFontBox( this, PaResId( RID_FNTNM_LB_FONTS ) ),
+ m_aFixedText( this, PaResId( RID_FNTNM_FIXED ) ),
+ m_aRenameString( PaResId( RID_FNTNM_STR_RENAME ) ),
+ m_aRenameTTCString( PaResId( RID_FNTNM_STR_TTCRENAME ) ),
+ m_aNoRenameString( PaResId( RID_FNTNM_STR_NOTRENAMABLE ) ),
+ m_rFontManager( PrintFontManager::get() )
+{
+ FreeResource();
+
+ m_aFontBox.EnableMultiSelection( TRUE );
+
+ m_aOKButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
+ m_aRenameButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
+ m_aRemoveButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
+ m_aImportButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
+ m_aFontBox.setDelPressedLink( LINK( this, FontNameDlg, DelPressedHdl ) );
+ m_aFontBox.SetSelectHdl( LINK( this, FontNameDlg, SelectHdl ) );
+
+ init();
+}
+
+FontNameDlg::~FontNameDlg()
+{
+}
+
+String FontNameDlg::fillFontEntry( FastPrintFontInfo& rInfo, const String& rFile, bool bAddRegular )
+{
+ static String aThinTxt( PaResId( RID_TXT_FONT_THIN ) );
+ static String aUltraLightTxt( PaResId( RID_TXT_FONT_ULTRALIGHT ) );
+ static String aLightTxt( PaResId( RID_TXT_FONT_LIGHT ) );
+ static String aSemiLightTxt( PaResId( RID_TXT_FONT_SEMILIGHT ) );
+ static String aSemiBoldTxt( PaResId( RID_TXT_FONT_SEMIBOLD ) );
+ static String aBoldTxt( PaResId( RID_TXT_FONT_BOLD ) );
+ static String aUltraBoldTxt( PaResId( RID_TXT_FONT_ULTRABOLD ) );
+
+ static String aItalicTxt( PaResId( RID_TXT_FONT_ITALIC ) );
+ static String aObliqueTxt( PaResId( RID_TXT_FONT_OBLIQUE ) );
+
+ static String aUltraCondensedTxt( PaResId( RID_TXT_FONT_ULTRACONDENSED ) );
+ static String aExtraCondensedTxt( PaResId( RID_TXT_FONT_EXTRACONDENSED ) );
+ static String aCondensedTxt( PaResId( RID_TXT_FONT_CONDENSED ) );
+ static String aSemiCondensedTxt( PaResId( RID_TXT_FONT_SEMICONDENSED ) );
+ static String aSemiExpandedTxt( PaResId( RID_TXT_FONT_SEMIEXPANDED ) );
+ static String aExpandedTxt( PaResId( RID_TXT_FONT_EXPANDED ) );
+ static String aExtraExpandedTxt( PaResId( RID_TXT_FONT_EXTRAEXPANDED ) );
+ static String aUltraExpandedTxt( PaResId( RID_TXT_FONT_ULTRAEXPANDED ) );
+
+ static String aRegularTxt( PaResId( RID_TXT_FONT_REGULAR ) );
+
+ String aEntry( rInfo.m_aFamilyName );
+ bool bWeight = true, bItalic = true, bWidth = true;
+ switch( rInfo.m_eWeight )
+ {
+ case weight::Thin: aEntry.AppendAscii( ", " ); aEntry.Append( aThinTxt ); break;
+ case weight::UltraLight: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraLightTxt ); break;
+ case weight::Light: aEntry.AppendAscii( ", " ); aEntry.Append( aLightTxt ); break;
+ case weight::SemiLight: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiLightTxt ); break;
+ case weight::SemiBold: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiBoldTxt ); break;
+ case weight::Bold: aEntry.AppendAscii( ", " ); aEntry.Append( aBoldTxt ); break;
+ case weight::UltraBold: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraBoldTxt ); break;
+ default:
+ bWeight = false;
+ break;
+ }
+ switch( rInfo.m_eItalic )
+ {
+ case italic::Oblique: aEntry.AppendAscii( ", " ); aEntry.Append( aObliqueTxt ); break;
+ case italic::Italic: aEntry.AppendAscii( ", " ); aEntry.Append( aItalicTxt ); break;
+ default:
+ bItalic = false;
+ break;
+ }
+ switch( rInfo.m_eWidth )
+ {
+ case width::UltraCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraCondensedTxt ); break;
+ case width::ExtraCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraCondensedTxt ); break;
+ case width::Condensed: aEntry.AppendAscii( ", " ); aEntry.Append( aCondensedTxt ); break;
+ case width::SemiCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiCondensedTxt ); break;
+ case width::SemiExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiExpandedTxt ); break;
+ case width::Expanded: aEntry.AppendAscii( ", " ); aEntry.Append( aExpandedTxt ); break;
+ case width::ExtraExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraExpandedTxt ); break;
+ case width::UltraExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraExpandedTxt ); break;
+ default:
+ bWidth = false;
+ break;
+ }
+
+ if( bAddRegular && ! bItalic && ! bWidth && ! bWeight )
+ {
+ aEntry.AppendAscii( ", " );
+ aEntry.Append( aRegularTxt );
+ }
+
+ aEntry.AppendAscii( " (" );
+ aEntry.Append( rFile );
+ aEntry.AppendAscii( ")" );
+ return aEntry;
+}
+
+String FontNameDlg::fillFontEntry( const ::std::list< FastPrintFontInfo >& rInfos, const String& rFile )
+{
+ String aEntry;
+ bool bFirst = true;
+ for( ::std::list< FastPrintFontInfo >::const_iterator it = rInfos.begin(); it != rInfos.end(); ++it )
+ {
+ if( ! bFirst )
+ aEntry.AppendAscii( " & " );
+ aEntry.Append( String( it->m_aFamilyName ) );
+ bFirst = false;
+ }
+
+ aEntry.AppendAscii( " (" );
+ aEntry.Append( rFile );
+ aEntry.AppendAscii( ")" );
+ return aEntry;
+}
+
+void FontNameDlg::init()
+{
+ ::std::list< fontID > aFonts;
+ m_rFontManager.getFontList( aFonts );
+ m_aFontBox.Clear();
+ m_aRemoveButton.Enable( FALSE );
+ m_aRenameButton.Enable( FALSE );
+
+ ::std::hash_map< OUString, int, OUStringHash > aFamilies;
+ ::std::list< fontID >::iterator font_it;
+ for( font_it = aFonts.begin(); font_it != aFonts.end(); ++font_it )
+ {
+ if( m_rFontManager.isPrivateFontFile( *font_it ) )
+ {
+ const OUString& rFamily( m_rFontManager.getFontFamily( *font_it ) );
+ if( aFamilies.find( rFamily ) == aFamilies.end() )
+ aFamilies[rFamily] = 0;
+ aFamilies[rFamily]++;
+ }
+ }
+
+ for( font_it = aFonts.begin(); font_it != aFonts.end(); ++font_it )
+ {
+ if( m_rFontManager.isPrivateFontFile( *font_it ) )
+ {
+ OString aFile( m_rFontManager.getFontFileSysPath( *font_it ) );
+ int nLast = aFile.lastIndexOf( '/' );
+ if( nLast != -1 )
+ aFile = aFile.copy( nLast+1 );
+
+ FastPrintFontInfo aInfo;
+ m_rFontManager.getFontFastInfo( *font_it, aInfo );
+ std::list< fontID > aDups;
+ String aEntry;
+ if( m_rFontManager.getFileDuplicates( *font_it, aDups ) )
+ {
+ FastPrintFontInfo aDupInfo;
+ std::list< FastPrintFontInfo > aInfos;
+ aInfos.push_back( aInfo );
+ for( std::list< fontID >::iterator dup = aDups.begin(); dup != aDups.end(); ++dup )
+ {
+ m_rFontManager.getFontFastInfo( *dup, aDupInfo );
+ aInfos.push_back( aDupInfo );
+ aFonts.remove( *dup );
+ }
+ aEntry = fillFontEntry( aInfos, String( ByteString( aFile ), osl_getThreadTextEncoding() ) );
+ }
+ else
+ aEntry = fillFontEntry( aInfo, String( ByteString( aFile ), osl_getThreadTextEncoding() ), aFamilies[ aInfo.m_aFamilyName ] > 1 );
+ USHORT nEntry = m_aFontBox.InsertEntry( aEntry );
+ m_aFontBox.SetEntryData( nEntry, (void*)(*font_it) );
+ }
+ }
+}
+
+IMPL_LINK( FontNameDlg, SelectHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aFontBox )
+ {
+ BOOL bEnable = m_aFontBox.GetSelectEntryCount() ? TRUE : FALSE;
+ m_aRemoveButton.Enable( bEnable );
+ m_aRenameButton.Enable( bEnable );
+ }
+ return 0;
+}
+
+IMPL_LINK( FontNameDlg, DelPressedHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aFontBox && m_aRemoveButton.IsEnabled() )
+ {
+ ClickBtnHdl( &m_aRemoveButton );
+ }
+ return 0;
+}
+
+IMPL_LINK( FontNameDlg, ClickBtnHdl, Button*, pButton )
+{
+
+ int i;
+
+ if( pButton == &m_aOKButton )
+ {
+ EndDialog();
+ }
+ else if( pButton == &m_aRemoveButton && AreYouSure( this, RID_QUERY_REMOVEFONTFROMLIST ) && m_aFontBox.GetSelectEntryCount() )
+ {
+ ::std::list< fontID > aRemoveIDs;
+ for( i = 0; i < m_aFontBox.GetSelectEntryCount(); i++ )
+ {
+ int nSelect = m_aFontBox.GetSelectEntryPos( i );
+ aRemoveIDs.push_back( (fontID)(sal_IntPtr)m_aFontBox.GetEntryData( nSelect ) );
+ }
+ m_rFontManager.removeFonts( aRemoveIDs );
+ init();
+ }
+ else if( pButton == &m_aImportButton )
+ {
+ FontImportDialog aDialog( this );
+ aDialog.Execute();
+ init();
+ }
+ else if( pButton == &m_aRenameButton && m_aFontBox.GetSelectEntryCount() )
+ {
+ for( i = 0; i < m_aFontBox.GetSelectEntryCount(); i++ )
+ {
+ fontID aFont = (fontID)(sal_IntPtr)m_aFontBox.GetEntryData( m_aFontBox.GetSelectEntryPos( i ) );
+ if( ! m_rFontManager.checkChangeFontPropertiesPossible( aFont ) )
+ {
+ String aErrorText( m_aNoRenameString );
+ aErrorText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), m_aFontBox.GetSelectEntry( i ) );
+ ErrorBox aBox( this, WB_OK | WB_DEF_OK, aErrorText );
+ aBox.Execute();
+ continue;
+ }
+ ::std::list< fontID > aDuplicates;
+ m_rFontManager.getFileDuplicates( aFont, aDuplicates );
+ aDuplicates.push_front( aFont );
+ int nFonts = aDuplicates.size();
+ for( int n = 0; n < nFonts; n++ )
+ {
+ aFont = aDuplicates.front();
+ aDuplicates.pop_front();
+ String aFamily( m_rFontManager.getFontFamily( aFont ) );
+ ::std::list< OUString > aAlternatives;
+ m_rFontManager.getAlternativeFamilyNames( aFont, aAlternatives );
+ ::std::list< String > aChoices;
+ while( aAlternatives.size() )
+ {
+ aChoices.push_back( aAlternatives.front() );
+ aAlternatives.pop_front();
+ }
+ String aQueryTxt( m_aRenameString );
+ if( nFonts > 1 )
+ {
+ aQueryTxt = m_aRenameTTCString;
+ aQueryTxt.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%d1" ) ), String::CreateFromInt32( n+1 ) );
+ aQueryTxt.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%d2" ) ), String::CreateFromInt32( nFonts ) );
+ }
+ aQueryTxt.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aFamily );
+ QueryString aQuery( this, aQueryTxt, aFamily, aChoices );
+ if( aQuery.Execute() )
+ {
+ aFamily.SearchAndReplaceAll( '-', ' ' );
+ aFamily.SearchAndReplaceAll( '?', ' ' );
+ aFamily.SearchAndReplaceAll( '*', ' ' );
+ aFamily = WhitespaceToSpace( aFamily );
+ if( aFamily.Len() )
+ {
+ String aXLFD = m_rFontManager.getFontXLFD( aFont );
+ aXLFD.SetToken( 2, '-', aFamily );
+ m_rFontManager.changeFontProperties( aFont, aXLFD );
+ }
+ }
+ }
+ }
+ init();
+ }
+ return 0;
+}
+
+//--------------------------------------------------
+
+FontImportDialog::FontImportDialog( Window* pParent ) :
+ ModalDialog( pParent, PaResId( RID_FONTIMPORT_DIALOG ) ),
+ m_aOKBtn( this, PaResId( RID_FIMP_BTN_OK ) ),
+ m_aCancelBtn( this, PaResId( RID_FIMP_BTN_CANCEL ) ),
+ m_aSelectAllBtn( this, PaResId( RID_FIMP_BTN_SELECTALL ) ),
+ m_aNewFontsBox( this, PaResId( RID_FIMP_BOX_NEWFONTS ) ),
+ m_aFromFL( this, PaResId( RID_FIMP_FL_FROM ) ),
+ m_aFromDirEdt( this, PaResId( RID_FIMP_EDT_FROM ) ),
+ m_aFromBtn( this, PaResId( RID_FIMP_BTN_FROM ) ),
+ m_aSubDirsBox( this, PaResId( RID_FIMP_BOX_SUBDIRS ) ),
+ m_aTargetOptFL( this, PaResId( RID_FIMP_FL_TARGETOPTS ) ),
+ m_aLinkOnlyBox( this, PaResId( RID_FIMP_BOX_LINKONLY ) ),
+ m_aFixedText( this, PaResId( RID_FIMP_TXT_HELP ) ),
+ m_bOverwriteAll( false ),
+ m_bOverwriteNone( false ),
+ m_pProgress( NULL ),
+ m_aImportOperation( PaResId( RID_FIMP_STR_IMPORTOP ) ),
+ m_aOverwriteQueryText( PaResId( RID_FIMP_STR_QUERYOVERWRITE ) ),
+ m_aOverwriteAllText( PaResId( RID_FIMP_STR_OVERWRITEALL ) ),
+ m_aOverwriteNoneText( PaResId( RID_FIMP_STR_OVERWRITENONE ) ),
+ m_aNoAfmText( PaResId( RID_FIMP_STR_NOAFM ) ),
+ m_aAfmCopyFailedText( PaResId( RID_FIMP_STR_AFMCOPYFAILED ) ),
+ m_aFontCopyFailedText( PaResId( RID_FIMP_STR_FONTCOPYFAILED ) ),
+ m_aNoWritableFontsDirText( PaResId( RID_FIMP_STR_NOWRITEABLEFONTSDIR ) ),
+ m_aFontsImportedText( PaResId( RID_FIMP_STR_NUMBEROFFONTSIMPORTED ) ),
+ m_rFontManager( ::psp::PrintFontManager::get() )
+{
+ FreeResource();
+
+ m_aNewFontsBox.EnableMultiSelection( TRUE );
+
+ m_aOKBtn.SetClickHdl( LINK( this, FontImportDialog, ClickBtnHdl ) );
+ m_aSelectAllBtn.SetClickHdl( LINK( this, FontImportDialog, ClickBtnHdl ) );
+ m_aFromBtn.SetClickHdl( LINK( this, FontImportDialog, ClickBtnHdl ) );
+ m_aFromDirEdt.SetModifyHdl( LINK( this, FontImportDialog, ModifyHdl ) );
+ m_aRefreshTimer.SetTimeoutHdl( LINK( this, FontImportDialog, RefreshTimeoutHdl ) );
+ m_aRefreshTimer.SetTimeout( 2000 );
+ m_aLinkOnlyBox.Check( FALSE );
+ m_aSubDirsBox.Check( TRUE );
+ m_aSubDirsBox.SetToggleHdl( LINK( this, FontImportDialog, ToggleHdl ) );
+
+ Config& rPadminRC( getPadminRC() );
+ rPadminRC.SetGroup( "FontImport" );
+ m_aFromDirEdt.SetText( String( rPadminRC.ReadKey( "FromPath" ), RTL_TEXTENCODING_UTF8 ) );
+ RefreshTimeoutHdl( NULL );
+}
+
+FontImportDialog::~FontImportDialog()
+{
+ Config& rPadminRC( getPadminRC() );
+ rPadminRC.SetGroup( "FontImport" );
+ rPadminRC.WriteKey( "FromPath", ByteString( m_aFromDirEdt.GetText(), RTL_TEXTENCODING_UTF8 ) );
+}
+
+void FontImportDialog::importFontsFailed( ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason )
+{
+ String aText;
+ switch( eReason )
+ {
+ case psp::PrintFontManager::ImportFontCallback::NoWritableDirectory:
+ aText = m_aNoWritableFontsDirText;
+ break;
+ default:
+ break;
+ }
+ ErrorBox aBox( m_pProgress ? (Window*)m_pProgress : (Window*)this, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+}
+
+void FontImportDialog::progress( const ::rtl::OUString& rFile )
+{
+ m_pProgress->setValue( ++m_nFont );
+ m_pProgress->setFilename( rFile );
+}
+
+bool FontImportDialog::queryOverwriteFile( const ::rtl::OUString& rFile )
+{
+ bool bRet = false;
+
+ if( m_bOverwriteNone )
+ return false;
+ if( m_bOverwriteAll )
+ return true;
+
+ String aText( m_aOverwriteQueryText );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rFile );
+
+ QueryBox aQueryBox( m_pProgress ? (Window*)m_pProgress : (Window*)this, WB_YES_NO | WB_DEF_NO, aText );
+ aQueryBox.AddButton( m_aOverwriteAllText, 20, 0 );
+ aQueryBox.AddButton( m_aOverwriteNoneText, 21, 0 );
+
+ int nResult = aQueryBox.Execute();
+ switch( nResult )
+ {
+ case BUTTONID_YES: bRet = true; break;
+ case BUTTONID_NO: bRet = false; break;
+ case 20: bRet = m_bOverwriteAll = true; break;
+ case 21: bRet = false; m_bOverwriteNone = true; break;
+ }
+
+ return bRet;
+}
+
+void FontImportDialog::importFontFailed( const ::rtl::OUString& rFile, ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason )
+{
+ String aText;
+ switch( eReason )
+ {
+ case psp::PrintFontManager::ImportFontCallback::NoAfmMetric:
+ aText = m_aNoAfmText;
+ break;
+ case psp::PrintFontManager::ImportFontCallback::AfmCopyFailed:
+ aText = m_aAfmCopyFailedText;
+ break;
+ case psp::PrintFontManager::ImportFontCallback::FontCopyFailed:
+ aText = m_aFontCopyFailedText;
+ break;
+ default:
+ break;
+ }
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rFile );
+ ErrorBox aBox( m_pProgress ? (Window*)m_pProgress : (Window*)this, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+}
+
+bool FontImportDialog::isCanceled()
+{
+ return m_pProgress->isCanceled();
+}
+
+IMPL_LINK( FontImportDialog, ModifyHdl, Edit*, EMPTYARG )
+{
+ m_aRefreshTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( FontImportDialog, RefreshTimeoutHdl, void*, EMPTYARG )
+{
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+ std::list< String > aFiles;
+ m_aNewFonts.clear();
+ OUString aDirectory( m_aFromDirEdt.GetText() );
+ FindFiles( aDirectory, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PFA;PFB;TTF;TTC;OTF" ) ), m_aSubDirsBox.IsChecked() );
+ OString aDir( OUStringToOString( aDirectory, aEncoding ) );
+ aDir += "/";
+ while( aFiles.begin() != aFiles.end() )
+ {
+ OString aFont( aDir );
+ aFont += OUStringToOString( aFiles.front(), aEncoding );
+ aFiles.pop_front();
+ ::std::list< FastPrintFontInfo > aInfos;
+ if( m_rFontManager.getImportableFontProperties( aFont, aInfos ) )
+ m_aNewFonts[ aFont ] = aInfos;
+ }
+ fillFontBox();
+ return 0;
+}
+
+void FontImportDialog::fillFontBox()
+{
+ rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
+ m_aNewFontsBox.Clear();
+
+ ::std::hash_map< OUString, int, OUStringHash > aFamilies;
+ ::std::hash_map< OString, ::std::list< FastPrintFontInfo >, OStringHash >::iterator it;
+ for( it = m_aNewFonts.begin(); it != m_aNewFonts.end(); ++it )
+ {
+ const OUString& rFamily( it->second.front().m_aFamilyName );
+ if( aFamilies.find( rFamily ) == aFamilies.end() )
+ aFamilies[rFamily] = 0;
+ aFamilies[rFamily]++;
+ }
+
+ for( it = m_aNewFonts.begin(); it != m_aNewFonts.end(); ++it )
+ {
+ OString aFileName( it->first.copy( it->first.lastIndexOf( '/' )+1 ) );
+ OUString aFile( OStringToOUString( aFileName, aEncoding ) );
+ String aEntry;
+ if( it->second.size() == 1 )
+ aEntry = FontNameDlg::fillFontEntry( it->second.front(), aFile, aFamilies[ it->second.front().m_aFamilyName ] > 1 );
+ else
+ aEntry = FontNameDlg::fillFontEntry( it->second, aFile );
+ USHORT nPos = m_aNewFontsBox.InsertEntry( aEntry );
+ m_aNewFontsBox.SetEntryData( nPos, (void*)&(it->first) );
+ }
+}
+
+void FontImportDialog::copyFonts()
+{
+ ::std::list< OString > aFiles;
+ for( int i = 0; i < m_aNewFontsBox.GetSelectEntryCount(); i++ )
+ {
+ OString* pFile = (OString*)m_aNewFontsBox.GetEntryData( m_aNewFontsBox.GetSelectEntryPos( i ) );
+ aFiles.push_back( *pFile );
+ }
+
+ int nSuccess = 0;
+ if( aFiles.size() )
+ {
+ m_nFont = 0;
+ m_pProgress = new ProgressDialog( this );
+ m_pProgress->setRange( 0, aFiles.size() );
+ m_pProgress->startOperation( m_aImportOperation );
+ m_pProgress->Show( TRUE );
+ m_pProgress->setValue( 0 );
+ m_pProgress->Invalidate();
+ m_pProgress->Sync();
+ nSuccess = m_rFontManager.importFonts( aFiles, m_aLinkOnlyBox.IsChecked() ? true : false, this );
+ m_pProgress->Show( FALSE );
+ delete m_pProgress;
+ m_pProgress = NULL;
+ }
+ String aText( m_aFontsImportedText );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%d" ) ), String::CreateFromInt32( nSuccess ) );
+ InfoBox aBox( this, aText );
+ aBox.Execute();
+}
+
+IMPL_LINK( FontImportDialog, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == &m_aFromBtn )
+ {
+ String aPath( m_aFromDirEdt.GetText() );
+ if( chooseDirectory( aPath ) )
+ {
+ m_aFromDirEdt.SetText( aPath );
+ RefreshTimeoutHdl( NULL );
+ }
+ }
+ else if( pButton == &m_aOKBtn )
+ {
+ copyFonts();
+ EndDialog( 0 );
+ }
+ else if( pButton == &m_aSelectAllBtn )
+ {
+ m_aNewFontsBox.SetUpdateMode( FALSE );
+ for( int i = 0; i < m_aNewFontsBox.GetEntryCount(); i++ )
+ m_aNewFontsBox.SelectEntryPos( i, TRUE );
+ m_aNewFontsBox.SetUpdateMode( TRUE );
+ }
+ return 0;
+}
+
+IMPL_LINK( FontImportDialog, ToggleHdl, CheckBox*, pBox )
+{
+ if( pBox == &m_aSubDirsBox )
+ {
+ RefreshTimeoutHdl( NULL );
+ }
+
+ return 0;
+}
diff --git a/padmin/source/fontentry.hxx b/padmin/source/fontentry.hxx
new file mode 100644
index 000000000000..c9585564be9f
--- /dev/null
+++ b/padmin/source/fontentry.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_FONTENTRY_HXX_
+#define _PAD_FONTENTRY_HXX_
+
+#include "progress.hxx"
+#include "helper.hxx"
+
+#include "vcl/timer.hxx"
+#include "vcl/dialog.hxx"
+#include "vcl/button.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/group.hxx"
+#include "vcl/fontmanager.hxx"
+
+#include "tools/urlobj.hxx"
+
+namespace padmin {
+
+ class FontImportDialog :
+ public ModalDialog,
+ public ::psp::PrintFontManager::ImportFontCallback
+ {
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ PushButton m_aSelectAllBtn;
+ ListBox m_aNewFontsBox;
+ FixedLine m_aFromFL;
+ Edit m_aFromDirEdt;
+ PushButton m_aFromBtn;
+ CheckBox m_aSubDirsBox;
+ FixedLine m_aTargetOptFL;
+ CheckBox m_aLinkOnlyBox;
+ FixedText m_aFixedText;
+ bool m_bOverwriteAll;
+ bool m_bOverwriteNone;
+ ProgressDialog* m_pProgress;
+ int m_nFont;
+
+ String m_aImportOperation;
+ String m_aOverwriteQueryText;
+ String m_aOverwriteAllText;
+ String m_aOverwriteNoneText;
+ String m_aNoAfmText;
+ String m_aAfmCopyFailedText;
+ String m_aFontCopyFailedText;
+ String m_aNoWritableFontsDirText;
+ String m_aFontsImportedText;
+
+ ::std::hash_map< ::rtl::OString, ::std::list< ::psp::FastPrintFontInfo >, ::rtl::OStringHash >
+ m_aNewFonts;
+
+ Timer m_aRefreshTimer;
+ DECL_LINK( RefreshTimeoutHdl, void* );
+
+
+ ::psp::PrintFontManager& m_rFontManager;
+
+ DECL_LINK( ClickBtnHdl, Button* );
+ DECL_LINK( ModifyHdl, Edit* );
+ DECL_LINK( ToggleHdl, CheckBox* );
+
+ // implement ImportFontCallback
+ virtual void importFontsFailed( ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
+ virtual void progress( const ::rtl::OUString& rFile );
+ virtual bool queryOverwriteFile( const ::rtl::OUString& rFile );
+ virtual void importFontFailed( const ::rtl::OUString& rFile, ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
+ virtual bool isCanceled();
+
+ void copyFonts();
+ void fillFontBox();
+ public:
+ FontImportDialog( Window* );
+ ~FontImportDialog();
+ };
+
+ class FontNameDlg : public ModalDialog
+ {
+ private:
+ OKButton m_aOKButton;
+ PushButton m_aRenameButton;
+ PushButton m_aRemoveButton;
+ PushButton m_aImportButton;
+
+ DelListBox m_aFontBox;
+ FixedText m_aFixedText;
+
+ String m_aRenameString;
+ String m_aRenameTTCString;
+ String m_aNoRenameString;
+
+ ::psp::PrintFontManager& m_rFontManager;
+
+ // maps fontID to XLFD
+ ::std::hash_map< ::psp::fontID, String >
+ m_aFonts;
+ void init();
+ public:
+ FontNameDlg( Window* );
+ ~FontNameDlg();
+
+ DECL_LINK( ClickBtnHdl, Button* );
+ DECL_LINK( DelPressedHdl, ListBox* );
+ DECL_LINK( SelectHdl, ListBox* );
+
+ static String fillFontEntry( ::psp::FastPrintFontInfo& rInfo, const String& rFile, bool bAddRegular );
+ static String fillFontEntry( const ::std::list< ::psp::FastPrintFontInfo >& rInfos, const String& rFile );
+ };
+} // namespace
+
+#endif
diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx
new file mode 100644
index 000000000000..b81d37df5cb1
--- /dev/null
+++ b/padmin/source/helper.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <unistd.h>
+#include <helper.hxx>
+#ifndef _PAD_PADIALOG_HRC_
+#include <padialog.hrc>
+#endif
+#include <osl/file.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/config.hxx>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XControlAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/confignode.hxx>
+#include <vcl/unohelp.hxx>
+#include <i18npool/mslangid.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+using namespace osl;
+using namespace rtl;
+using namespace padmin;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ui::dialogs;
+
+#define MAX_PATH 1024
+
+/*
+ * PaResId
+ */
+
+ResId padmin::PaResId( sal_uInt32 nId )
+{
+ static ResMgr* pPaResMgr = NULL;
+ if( ! pPaResMgr )
+ {
+ ::com::sun::star::lang::Locale aLocale;
+// LanguageType nLang = LANGUAGE_SYSTEM;
+
+ utl::OConfigurationNode aNode =
+ utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
+ vcl::unohelper::GetMultiServiceFactory(),
+ OUString::createFromAscii( "org.openoffice.Setup/L10N" ) );
+ if ( aNode.isValid() )
+ {
+ rtl::OUString aLoc;
+ Any aValue = aNode.getNodeValue( OUString::createFromAscii( "ooLocale" ) );
+ if( aValue >>= aLoc )
+ {
+// LanguageType nTmpLang = MsLangId::convertIsoStringToLanguage( aLoc );
+// if( nTmpLang != LANGUAGE_DONTKNOW )
+// nLang = nTmpLang;
+ sal_Int32 nIndex = 0;
+ aLocale.Language = aLoc.getToken( 0, '-', nIndex );
+ aLocale.Country = aLoc.getToken( 0, '-', nIndex );
+ aLocale.Variant = aLoc.getToken( 0, '-', nIndex );
+ }
+ }
+ pPaResMgr = ResMgr::SearchCreateResMgr( "spa", aLocale );
+ AllSettings aSettings = Application::GetSettings();
+// aSettings.SetUILanguage( nLang );
+ aSettings.SetUILocale( aLocale );
+ Application::SetSettings( aSettings );
+ }
+ return ResId( nId, *pPaResMgr );
+}
+
+/*
+ * FindFiles
+ */
+
+void padmin::FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes, bool bRecursive )
+{
+ rResult.clear();
+
+ OUString aDirPath;
+ ::osl::FileBase::getFileURLFromSystemPath( rDirectory, aDirPath );
+ Directory aDir( aDirPath );
+ if( aDir.open() != FileBase::E_None )
+ return;
+ DirectoryItem aItem;
+ while( aDir.getNextItem( aItem ) == FileBase::E_None )
+ {
+ FileStatus aStatus( FileStatusMask_FileName |
+ FileStatusMask_Type
+ );
+ if( aItem.getFileStatus( aStatus ) == FileBase::E_None )
+ {
+ if( aStatus.getFileType() == FileStatus::Regular ||
+ aStatus.getFileType() == FileStatus::Link )
+ {
+ String aFileName = aStatus.getFileName();
+ int nToken = rSuffixes.GetTokenCount( ';' );
+ while( nToken-- )
+ {
+ String aSuffix = rSuffixes.GetToken( nToken, ';' );
+ if( aFileName.Len() > aSuffix.Len()+1 )
+ {
+ String aExtension = aFileName.Copy( aFileName.Len()-aSuffix.Len() );
+ if( aFileName.GetChar( aFileName.Len()-aSuffix.Len()-1 ) == '.' &&
+ aExtension.EqualsIgnoreCaseAscii( aSuffix ) )
+ {
+ rResult.push_back( aFileName );
+ break;
+ }
+ }
+ }
+ }
+ else if( bRecursive && aStatus.getFileType() == FileStatus::Directory )
+ {
+ OUStringBuffer aSubDir( rDirectory );
+ aSubDir.appendAscii( "/", 1 );
+ aSubDir.append( aStatus.getFileName() );
+ std::list< String > subfiles;
+ FindFiles( aSubDir.makeStringAndClear(), subfiles, rSuffixes, bRecursive );
+ for( std::list< String >::const_iterator it = subfiles.begin(); it != subfiles.end(); ++it )
+ {
+ OUStringBuffer aSubFile( aStatus.getFileName() );
+ aSubFile.appendAscii( "/", 1 );
+ aSubFile.append( *it );
+ rResult.push_back( aSubFile.makeStringAndClear() );
+ }
+ }
+ }
+ }
+ aDir.close();
+}
+
+/*
+ * DelMultiListBox
+ */
+
+long DelMultiListBox::Notify( NotifyEvent& rEvent )
+{
+ long nRet = 0;
+
+ if( rEvent.GetType() == EVENT_KEYINPUT &&
+ rEvent.GetKeyEvent()->GetKeyCode().GetCode() == KEY_DELETE )
+ {
+ m_aDelPressedLink.Call( this );
+ nRet = 1;
+ }
+ else
+ nRet = MultiListBox::Notify( rEvent );
+
+ return nRet;
+}
+
+/*
+ * DelListBox
+ */
+
+long DelListBox::Notify( NotifyEvent& rEvent )
+{
+ long nRet = 0;
+
+ if( rEvent.GetType() == EVENT_KEYINPUT &&
+ rEvent.GetKeyEvent()->GetKeyCode().GetCode() == KEY_DELETE )
+ {
+ m_aDelPressedLink.Call( this );
+ nRet = 1;
+ }
+ else
+ nRet = ListBox::Notify( rEvent );
+
+ return nRet;
+}
+
+/*
+ * QueryString
+ */
+
+QueryString::QueryString( Window* pParent, String& rQuery, String& rRet, const ::std::list< String >& rChoices ) :
+ ModalDialog( pParent, PaResId( RID_STRINGQUERYDLG ) ),
+ m_aOKButton( this, PaResId( RID_STRQRY_BTN_OK ) ),
+ m_aCancelButton( this, PaResId( RID_STRQRY_BTN_CANCEL ) ),
+ m_aFixedText( this, PaResId( RID_STRQRY_TXT_RENAME ) ),
+ m_aEdit( this, PaResId( RID_STRQRY_EDT_NEWNAME ) ),
+ m_aComboBox( this, PaResId( RID_STRQRY_BOX_NEWNAME ) ),
+ m_rReturnValue( rRet )
+{
+ FreeResource();
+ m_aOKButton.SetClickHdl( LINK( this, QueryString, ClickBtnHdl ) );
+ m_aFixedText.SetText( rQuery );
+ if( rChoices.begin() != rChoices.end() )
+ {
+ m_aComboBox.SetText( m_rReturnValue );
+ m_aComboBox.InsertEntry( m_rReturnValue );
+ for( ::std::list<String>::const_iterator it = rChoices.begin(); it != rChoices.end(); ++it )
+ m_aComboBox.InsertEntry( *it );
+ m_aEdit.Show( FALSE );
+ m_bUseEdit = false;
+ }
+ else
+ {
+ m_aEdit.SetText( m_rReturnValue );
+ m_aComboBox.Show( FALSE );
+ m_bUseEdit = true;
+ }
+ SetText( Application::GetDisplayName() );
+}
+
+QueryString::~QueryString()
+{
+}
+
+IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == &m_aOKButton )
+ {
+ m_rReturnValue = m_bUseEdit ? m_aEdit.GetText() : m_aComboBox.GetText();
+ EndDialog( 1 );
+ }
+ else
+ EndDialog(0);
+ return 0;
+}
+
+/*
+ * AreYouSure
+ */
+
+BOOL padmin::AreYouSure( Window* pParent, int nRid )
+{
+ if( nRid == -1 )
+ nRid = RID_YOU_SURE;
+ QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_NO,
+ String( PaResId( nRid ) ) );
+ return aQueryBox.Execute() == RET_NO ? FALSE : TRUE;
+}
+
+/*
+ * getPadminRC
+ */
+
+static Config* pRC = NULL;
+
+Config& padmin::getPadminRC()
+{
+ if( ! pRC )
+ {
+ static const char* pEnv = getenv( "HOME" );
+ String aFileName( pEnv ? pEnv : "", osl_getThreadTextEncoding() );
+ aFileName.AppendAscii( "/.padminrc" );
+ pRC = new Config( aFileName );
+ }
+ return *pRC;
+}
+
+void padmin::freePadminRC()
+{
+ if( pRC )
+ delete pRC, pRC = NULL;
+}
+
+bool padmin::chooseDirectory( String& rInOutPath )
+{
+ bool bRet = false;
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ Reference< XFolderPicker > xFolderPicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY );
+ if( xFolderPicker.is() )
+ {
+ Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY );
+ if( xCA.is() )
+ {
+ try
+ {
+ Any aState;
+ aState <<= sal_False;
+ xCA->setControlProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpButton" ) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ),
+ aState );
+
+ }
+ catch( ... )
+ {
+ }
+ }
+ INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ xFolderPicker->setDisplayDirectory( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ if( xFolderPicker->execute() == ExecutableDialogResults::OK )
+ {
+ aObj = INetURLObject( xFolderPicker->getDirectory() );
+ rInOutPath = aObj.PathToFileName();
+ bRet = true;
+ }
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ fprintf( stderr, "could not get FolderPicker service\n" );
+#endif
+ }
+ return bRet;
+}
diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx
new file mode 100644
index 000000000000..636241b826a6
--- /dev/null
+++ b/padmin/source/helper.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_HELPER_HXX_
+#define _PAD_HELPER_HXX_
+
+#ifndef __SGI_STL_LIST
+#include <list>
+#endif
+#include <tools/string.hxx>
+#ifndef _RESID_HXX
+#include <tools/resid.hxx>
+#endif
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#ifndef _SV_LISTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#include <vcl/combobox.hxx>
+
+class Config;
+
+#define PSPRINT_PPDDIR "driver"
+
+namespace padmin
+{
+class DelMultiListBox : public MultiListBox
+{
+ Link m_aDelPressedLink;
+public:
+ DelMultiListBox( Window* pParent, const ResId& rResId ) :
+ MultiListBox( pParent, rResId ) {}
+ ~DelMultiListBox() {}
+
+ virtual long Notify( NotifyEvent& rEvent );
+
+ Link setDelPressedLink( const Link& rLink )
+ {
+ Link aOldLink( m_aDelPressedLink );
+ m_aDelPressedLink = rLink;
+ return aOldLink;
+ }
+ const Link& getDelPressedLink() const { return m_aDelPressedLink; }
+};
+
+class DelListBox : public ListBox
+{
+ Link m_aDelPressedLink;
+public:
+ DelListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( pParent, rResId ) {}
+ ~DelListBox() {}
+
+ virtual long Notify( NotifyEvent& rEvent );
+
+ Link setDelPressedLink( const Link& rLink )
+ {
+ Link aOldLink( m_aDelPressedLink );
+ m_aDelPressedLink = rLink;
+ return aOldLink;
+ }
+ const Link& getDelPressedLink() const { return m_aDelPressedLink; }
+};
+
+class QueryString : public ModalDialog
+{
+private:
+ OKButton m_aOKButton;
+ CancelButton m_aCancelButton;
+ FixedText m_aFixedText;
+ Edit m_aEdit;
+ ComboBox m_aComboBox;
+
+ String& m_rReturnValue;
+ bool m_bUseEdit;
+
+ DECL_LINK( ClickBtnHdl, Button* );
+
+public:
+ QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
+ // parent window, Query text, initial value
+ ~QueryString();
+};
+
+BOOL AreYouSure( Window*, int nRid = -1 );
+
+ResId PaResId( sal_uInt32 nId );
+
+void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes, bool bRecursive = false );
+
+Config& getPadminRC();
+void freePadminRC();
+
+bool chooseDirectory( String& rInOutPath );
+
+} // namespace padmin
+
+#endif
diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk
new file mode 100644
index 000000000000..8bcbd51ef832
--- /dev/null
+++ b/padmin/source/makefile.mk
@@ -0,0 +1,115 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.IF "$(GUIBASE)"=="aqua"
+
+dummy:
+ @echo "Nothing to build for GUIBASE aqua."
+
+.ELSE
+
+PRJ=..
+PRJNAME=padmin
+TARGET=padmin
+TARGETTYPE=GUI
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES=padialog.src rtsetup.src
+
+RESLIB1NAME=spa
+RESLIB1IMAGES=$(PRJ)$/source
+RESLIB1SRSFILES= $(SRS)$/padmin.srs
+RESLIB1DEPN=\
+ padialog.src \
+ padialog.hrc \
+ rtsetup.src \
+ rtsetup.hrc
+
+.IF "$(GUI)" == "UNX"
+
+SLOFILES=\
+ $(SLO)$/padialog.obj \
+ $(SLO)$/cmddlg.obj \
+ $(SLO)$/progress.obj \
+ $(SLO)$/newppdlg.obj \
+ $(SLO)$/prtsetup.obj \
+ $(SLO)$/fontentry.obj \
+ $(SLO)$/helper.obj \
+ $(SLO)$/adddlg.obj \
+ $(SLO)$/titlectrl.obj
+
+
+OBJFILES=\
+ $(OBJ)/pamain.obj
+
+SHL1TARGET= spa$(DLLPOSTFIX)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS=\
+ $(SVTOOLLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+APP1TARGET=spadmin.bin
+APP1DEPN+=$(SHL1TARGETN)
+
+APP1OBJS=\
+ $(OBJ)$/desktopcontext.obj \
+ $(OBJ)/pamain.obj
+
+APP1STDLIBS= \
+ -l$(SHL1TARGET) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+UNIXTEXT = $(MISC)$/spadmin.sh
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.ENDIF # GUIBASE==aqua
+
diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx
new file mode 100644
index 000000000000..e1760c28db30
--- /dev/null
+++ b/padmin/source/newppdlg.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include "helper.hxx"
+#include "padialog.hrc"
+#include "newppdlg.hxx"
+#include "padialog.hxx"
+#include "progress.hxx"
+
+#include "vcl/ppdparser.hxx"
+#include "vcl/helper.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/mnemonic.hxx"
+
+#include "tools/urlobj.hxx"
+
+#include "osl/file.hxx"
+
+#include <list>
+
+#define PPDIMPORT_GROUP "PPDImport"
+
+using namespace padmin;
+using namespace psp;
+using namespace osl;
+using namespace rtl;
+
+PPDImportDialog::PPDImportDialog( Window* pParent ) :
+ ModalDialog( pParent, PaResId( RID_PPDIMPORT_DLG ) ),
+ m_aOKBtn( this, PaResId( RID_PPDIMP_BTN_OK ) ),
+ m_aCancelBtn( this, PaResId( RID_PPDIMP_BTN_CANCEL ) ),
+ m_aPathTxt( this, PaResId( RID_PPDIMP_TXT_PATH ) ),
+ m_aPathBox( this, PaResId( RID_PPDIMP_LB_PATH ) ),
+ m_aSearchBtn( this, PaResId( RID_PPDIMP_BTN_SEARCH ) ),
+ m_aDriverTxt( this, PaResId( RID_PPDIMP_TXT_DRIVER ) ),
+ m_aDriverLB( this, PaResId( RID_PPDIMP_LB_DRIVER ) ),
+ m_aPathGroup( this, PaResId( RID_PPDIMP_GROUP_PATH ) ),
+ m_aDriverGroup( this, PaResId( RID_PPDIMP_GROUP_DRIVER ) ),
+ m_aLoadingPPD( PaResId( RID_PPDIMP_STR_LOADINGPPD ) )
+{
+ FreeResource();
+
+ String aText( m_aDriverTxt.GetText() );
+ aText.SearchAndReplaceAscii( "%s", Button::GetStandardText( BUTTON_OK ) );
+ m_aDriverTxt.SetText( MnemonicGenerator::EraseAllMnemonicChars( aText ) );
+
+ Config& rConfig = getPadminRC();
+ rConfig.SetGroup( PPDIMPORT_GROUP );
+ m_aPathBox.SetText( String( rConfig.ReadKey( "LastDir" ), RTL_TEXTENCODING_UTF8 ) );
+ for( int i = 0; i < 11; i++ )
+ {
+ ByteString aEntry( rConfig.ReadKey( ByteString::CreateFromInt32( i ) ) );
+ if( aEntry.Len() )
+ m_aPathBox.InsertEntry( String( aEntry, RTL_TEXTENCODING_UTF8 ) );
+ }
+
+ m_aOKBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) );
+ m_aSearchBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) );
+ m_aPathBox.SetSelectHdl( LINK( this, PPDImportDialog, SelectHdl ) );
+ m_aPathBox.SetModifyHdl( LINK( this, PPDImportDialog, ModifyHdl ) );
+
+ if( m_aPathBox.GetText().Len() )
+ Import();
+}
+
+PPDImportDialog::~PPDImportDialog()
+{
+ while( m_aDriverLB.GetEntryCount() )
+ {
+ delete (String*)m_aDriverLB.GetEntryData( 0 );
+ m_aDriverLB.RemoveEntry( 0 );
+ }
+}
+
+void PPDImportDialog::Import()
+{
+ String aImportPath( m_aPathBox.GetText() );
+
+ Config& rConfig = getPadminRC();
+ rConfig.SetGroup( PPDIMPORT_GROUP );
+ rConfig.WriteKey( "LastDir", ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) );
+
+ int nEntries = m_aPathBox.GetEntryCount();
+ while( nEntries-- )
+ if( aImportPath == m_aPathBox.GetEntry( nEntries ) )
+ break;
+ if( nEntries < 0 )
+ {
+ int nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32();
+ rConfig.WriteKey( ByteString::CreateFromInt32( nNextEntry ), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) );
+ nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0;
+ rConfig.WriteKey( "NextEntry", ByteString::CreateFromInt32( nNextEntry ) );
+ m_aPathBox.InsertEntry( aImportPath );
+ }
+ while( m_aDriverLB.GetEntryCount() )
+ {
+ delete (String*)m_aDriverLB.GetEntryData( 0 );
+ m_aDriverLB.RemoveEntry( 0 );
+ }
+
+ ProgressDialog aProgress( Application::GetFocusWindow() );
+ aProgress.startOperation( m_aLoadingPPD );
+
+ ::std::list< String > aFiles;
+ FindFiles( aImportPath, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true );
+
+ int i = 0;
+ aProgress.setRange( 0, aFiles.size() );
+ while( aFiles.size() )
+ {
+ aProgress.setValue( ++i );
+ aProgress.setFilename( aFiles.front() );
+ INetURLObject aPath( aImportPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ aPath.Append( aFiles.front() );
+ String aPrinterName = PPDParser::getPPDPrinterName( aPath.PathToFileName() );
+ aFiles.pop_front();
+
+ if( ! aPrinterName.Len() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "Warning: File %s has empty printer name.\n",
+ rtl::OUStringToOString( aPath.PathToFileName(), osl_getThreadTextEncoding() ).getStr() );
+#endif
+ continue;
+ }
+
+ USHORT nPos = m_aDriverLB.InsertEntry( aPrinterName );
+ m_aDriverLB.SetEntryData( nPos, new String( aPath.PathToFileName() ) );
+ }
+}
+
+IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aCancelBtn )
+ {
+ EndDialog( 0 );
+ }
+ else if( pButton == &m_aOKBtn )
+ {
+ // copy the files
+ ::std::list< rtl::OUString > aToDirs;
+ psp::getPrinterPathList( aToDirs, PRINTER_PPDDIR );
+ ::std::list< rtl::OUString >::iterator writeDir = aToDirs.begin();
+ m_aImportedFiles.clear();
+
+ for( int i = 0; i < m_aDriverLB.GetSelectEntryCount(); i++ )
+ {
+ INetURLObject aFile( *(String*)m_aDriverLB.GetEntryData(
+ m_aDriverLB.GetSelectEntryPos( i )
+ ), INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ OUString aFromUni( aFile.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+
+ do
+ {
+ INetURLObject aToFile( *writeDir, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ aToFile.Append( aFile.GetName() );
+ OUString aToUni( aToFile.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ if( ! File::copy( aFromUni, aToUni ) )
+ {
+ m_aImportedFiles.push_back( aToUni );
+ break;
+ }
+ ++writeDir;
+ } while( writeDir != aToDirs.end() );
+ }
+ EndDialog( 1 );
+ }
+ else if( pButton == &m_aSearchBtn )
+ {
+ String aPath( m_aPathBox.GetText() );
+ if( chooseDirectory( aPath ) )
+ {
+ m_aPathBox.SetText( aPath );
+ Import();
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( PPDImportDialog, SelectHdl, ComboBox*, pListBox )
+{
+ if( pListBox == &m_aPathBox )
+ {
+ Import();
+ }
+ return 0;
+}
+
+IMPL_LINK( PPDImportDialog, ModifyHdl, ComboBox*, pListBox )
+{
+ if( pListBox == &m_aPathBox )
+ {
+ ByteString aDir( m_aPathBox.GetText(), osl_getThreadTextEncoding() );
+ if( ! access( aDir.GetBuffer(), F_OK ) )
+ Import();
+ }
+ return 0;
+}
diff --git a/padmin/source/newppdlg.hxx b/padmin/source/newppdlg.hxx
new file mode 100644
index 000000000000..5b4aa9f755eb
--- /dev/null
+++ b/padmin/source/newppdlg.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_NEWPPDLG_HXX_
+#define _PAD_NEWPPDLG_HXX_
+
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+
+namespace psp { class PPDParser; }
+
+namespace padmin {
+
+ class PPDImportDialog : public ModalDialog
+ {
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ FixedText m_aPathTxt;
+ ComboBox m_aPathBox;
+ PushButton m_aSearchBtn;
+ FixedText m_aDriverTxt;
+ MultiListBox m_aDriverLB;
+
+ FixedLine m_aPathGroup;
+ FixedLine m_aDriverGroup;
+
+ String m_aLoadingPPD;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+ DECL_LINK( SelectHdl, ComboBox* );
+ DECL_LINK( ModifyHdl, ComboBox* );
+
+ void Import();
+
+ std::list< rtl::OUString > m_aImportedFiles;
+ public:
+ PPDImportDialog( Window* pParent );
+ ~PPDImportDialog();
+
+ const std::list< rtl::OUString >& getImportedFiles() const
+ { return m_aImportedFiles; }
+ };
+
+} // namespace
+
+#endif // _NEWPPDLG_HXX
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
new file mode 100644
index 000000000000..583e14c06caa
--- /dev/null
+++ b/padmin/source/padialog.cxx
@@ -0,0 +1,755 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <math.h>
+
+#include "padialog.hrc"
+#include "fontentry.hxx"
+#include "helper.hxx"
+#include "padialog.hxx"
+#include "adddlg.hxx"
+#include "prtsetup.hxx"
+
+#include "vcl/msgbox.hxx"
+#include "vcl/print.hxx"
+#include "vcl/gradient.hxx"
+#include "vcl/bitmap.hxx"
+#include "vcl/lineinfo.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/event.hxx"
+#include "vcl/printerinfomanager.hxx"
+
+#include "tools/stream.hxx"
+#include "tools/color.hxx"
+
+#include "osl/file.hxx"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "unotools/localedatawrapper.hxx"
+#include "unotools/configitem.hxx"
+#include "unotools/configmgr.hxx"
+
+#include "com/sun/star/awt/Size.hpp"
+
+using namespace psp;
+using namespace rtl;
+using namespace padmin;
+using namespace osl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+PADialog* PADialog::Create( Window* pParent, BOOL bAdmin )
+{
+ return new PADialog( pParent, bAdmin );
+}
+
+PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) :
+ ModalDialog( pParent, PaResId( RID_PADIALOG ) ),
+ m_aDevicesLB( this, PaResId( RID_PA_LB_DEV ) ),
+ m_aConfPB( this, PaResId( RID_PA_BTN_CONF ) ),
+ m_aRenamePB( this, PaResId( RID_PA_BTN_RENAME ) ),
+ m_aStdPB( this, PaResId( RID_PA_BTN_STD ) ),
+ m_aRemPB( this, PaResId( RID_PA_BTN_DEL ) ),
+ m_aTestPagePB( this, PaResId( RID_PA_TESTPAGE ) ),
+ m_aPrintersFL( this, PaResId( RID_PA_FL_PRINTERS ) ),
+ m_aDriverTxt( this, PaResId( RID_PA_TXT_DRIVER ) ),
+ m_aDriver( this, PaResId( RID_PA_TXT_DRIVER_STRING ) ),
+ m_aLocationTxt( this, PaResId( RID_PA_TXT_LOCATION ) ),
+ m_aLocation( this, PaResId( RID_PA_TXT_LOCATION_STRING ) ),
+ m_aCommandTxt( this, PaResId( RID_PA_TXT_COMMAND ) ),
+ m_aCommand( this, PaResId( RID_PA_TXT_COMMAND_STRING ) ),
+ m_aCommentTxt( this, PaResId( RID_PA_TXT_COMMENT ) ),
+ m_aComment( this, PaResId( RID_PA_TXT_COMMENT_STRING ) ),
+ m_aCUPSFL( this, PaResId( RID_PA_FL_CUPSUSAGE ) ),
+ m_aCUPSCB( this, PaResId( RID_PA_CB_CUPSUSAGE ) ),
+ m_aSepButtonFL( this, PaResId( RID_PA_FL_SEPBUTTON ) ),
+ m_aAddPB( this, PaResId( RID_PA_BTN_ADD ) ),
+ m_aFontsPB( this, PaResId( RID_PA_BTN_FONTS ) ),
+ m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ),
+ m_aDefPrt( PaResId( RID_PA_STR_DEFPRT ) ),
+ m_aRenameStr( PaResId( RID_PA_STR_RENAME ) ),
+ m_rPIManager( PrinterInfoManager::get() )
+{
+ FreeResource();
+ updateSettings();
+ Init();
+}
+
+void PADialog::updateSettings()
+{
+ if( ! GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER ) ) );
+ m_aFaxImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_FAX ) ) );
+ m_aPdfImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PDF ) ) );
+ }
+ else
+ {
+ m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER_HC ) ) );
+ m_aFaxImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_FAX_HC ) ) );
+ m_aPdfImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PDF_HC ) ) );
+ }
+}
+
+void PADialog::Init()
+{
+ // #i79787# initially ensure printer discovery has ended
+ m_rPIManager.checkPrintersChanged( true );
+ m_aCUPSCB.Check( m_rPIManager.isCUPSDisabled() );
+
+ UpdateDevice();
+ UpdateText();
+
+ m_aRemPB.Enable( FALSE );
+
+ m_aDevicesLB.SetDoubleClickHdl( LINK( this, PADialog, DoubleClickHdl ) );
+ m_aDevicesLB.SetSelectHdl( LINK( this, PADialog, SelectHdl ) );
+ m_aStdPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aRemPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aConfPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aRenamePB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aTestPagePB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aFontsPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aAddPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+ m_aDevicesLB.setDelPressedLink( LINK( this, PADialog, DelPressedHdl ) );
+ m_aCUPSCB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
+
+ ::psp::PrintFontManager& rFontManager( ::psp::PrintFontManager::get() );
+ if( ! rFontManager.checkImportPossible() )
+ m_aFontsPB.Enable( FALSE );
+ if( rFontManager.hasFontconfig() )
+ {
+ m_aFontsPB.Enable( FALSE );
+ m_aFontsPB.Show( FALSE );
+ }
+}
+
+PADialog::~PADialog()
+{
+ m_rPIManager.writePrinterConfig();
+ freePadminRC();
+}
+
+long PADialog::Notify( NotifyEvent& rEv )
+{
+ if( IsVisible() &&
+ (rEv.GetType() == EVENT_GETFOCUS || rEv.GetType() == EVENT_LOSEFOCUS )
+ )
+ {
+ if( m_rPIManager.checkPrintersChanged( true ) )
+ {
+ String aSelectEntry = m_aDevicesLB.GetSelectEntry();
+ UpdateDevice();
+ UpdateText();
+ m_aDevicesLB.SelectEntry( aSelectEntry );
+ }
+ }
+ return ModalDialog::Notify( rEv );
+}
+
+void PADialog::DataChanged( const DataChangedEvent& rEv )
+{
+ ModalDialog::DataChanged( rEv );
+ if( (rEv.GetType() == DATACHANGED_SETTINGS) &&
+ (rEv.GetFlags() & SETTINGS_STYLE) )
+ {
+ updateSettings();
+ // push the new images into the listbox
+ UpdateDevice();
+ }
+}
+
+String PADialog::getSelectedDevice()
+{
+ int nPos = m_aDevicesLB.GetSelectEntryPos();
+ int nLen = (int)(sal_IntPtr)m_aDevicesLB.GetEntryData( nPos );
+ return m_aDevicesLB.GetEntry( nPos ).Copy( 0, nLen );
+}
+
+IMPL_LINK( PADialog, DelPressedHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aDevicesLB && m_aRemPB.IsEnabled() )
+ ClickBtnHdl( &m_aRemPB );
+ return 0;
+}
+
+IMPL_LINK( PADialog, ClickBtnHdl, PushButton*, pButton )
+{
+ if( pButton == &m_aStdPB )
+ UpdateDefPrt();
+ else if( pButton == &m_aRemPB && AreYouSure( this, RID_QUERY_REMOVEPRINTER ) )
+ RemDevice();
+ else if( pButton == &m_aConfPB )
+ ConfigureDevice();
+ else if( pButton == &m_aRenamePB )
+ RenameDevice();
+ else if( pButton == &m_aTestPagePB )
+ PrintTestPage();
+ else if( pButton == &m_aAddPB )
+ AddDevice();
+ else if( pButton == &m_aFontsPB )
+ {
+ FontNameDlg aDialog( this );
+ aDialog.Execute();
+ }
+ else if( static_cast<Button*>(pButton) == &m_aCUPSCB )
+ {
+ m_rPIManager.setCUPSDisabled( m_aCUPSCB.IsChecked() );
+ UpdateDevice();
+ UpdateText();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( PADialog, DoubleClickHdl, ListBox*, pListBox )
+{
+ if( pListBox == &m_aDevicesLB )
+ UpdateDefPrt();
+ return 0;
+}
+
+IMPL_LINK( PADialog, SelectHdl, ListBox*, pListBox )
+{
+ if( pListBox == &m_aDevicesLB )
+ {
+ String sSelect = getSelectedDevice();
+ String sDefPrt = m_rPIManager.getDefaultPrinter();
+ if( sDefPrt == sSelect || ! m_rPIManager.removePrinter( sSelect, true ) )
+ m_aRemPB.Enable( FALSE );
+ else
+ m_aRemPB.Enable( TRUE );
+ UpdateText();
+ }
+ return 0;
+}
+
+void PADialog::UpdateDefPrt()
+{
+ m_rPIManager.setDefaultPrinter( getSelectedDevice() );
+
+ UpdateDevice();
+ UpdateText();
+
+ if( m_aRemPB.HasFocus() )
+ m_aDevicesLB.GetFocus();
+ m_aRemPB.Enable( FALSE );
+}
+
+void PADialog::UpdateText()
+{
+ OUString aDev( getSelectedDevice() );
+ if( aDev.getLength() )
+ {
+ const PrinterInfo& rInfo = m_rPIManager.getPrinterInfo( aDev );
+ String aDriver( rInfo.m_aPrinterName );
+ aDriver.AppendAscii( " (" );
+ aDriver += String( rInfo.m_aDriverName );
+ aDriver.Append( ')' );
+ m_aDriver.SetText( aDriver );
+ m_aCommand.SetText( rInfo.m_aCommand );
+ m_aComment.SetText( rInfo.m_aComment );
+ m_aLocation.SetText( rInfo.m_aLocation );
+ }
+ else // nothing selected
+ {
+ String aEmpty;
+ m_aDriver.SetText( aEmpty );
+ m_aCommand.SetText( aEmpty );
+ m_aComment.SetText( aEmpty );
+ m_aLocation.SetText( aEmpty );
+ }
+}
+
+static Point project( const Point& rPoint )
+{
+ const double angle_x = M_PI / 6.0;
+ const double angle_z = M_PI / 6.0;
+
+ // transform planar coordinates to 3d
+ double x = rPoint.X();
+ double y = rPoint.Y();
+ //double z = 0;
+
+ // rotate around X axis
+ double x1 = x;
+ double y1 = y * cos( angle_x );
+ double z1 = y * sin( angle_x );
+
+ // rotate around Z axis
+ double x2 = x1 * cos( angle_z ) + y1 * sin( angle_z );
+ //double y2 = y1 * cos( angle_z ) - x1 * sin( angle_z );
+ double z2 = z1;
+
+ return Point( (sal_Int32)x2, (sal_Int32)z2 );
+}
+
+static Color approachColor( const Color& rFrom, const Color& rTo )
+{
+ Color aColor;
+ UINT8 nDiff;
+ // approach red
+ if( rFrom.GetRed() < rTo.GetRed() )
+ {
+ nDiff = rTo.GetRed() - rFrom.GetRed();
+ aColor.SetRed( rFrom.GetRed() + ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else if( rFrom.GetRed() > rTo.GetRed() )
+ {
+ nDiff = rFrom.GetRed() - rTo.GetRed();
+ aColor.SetRed( rFrom.GetRed() - ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else
+ aColor.SetRed( rFrom.GetRed() );
+
+ // approach Green
+ if( rFrom.GetGreen() < rTo.GetGreen() )
+ {
+ nDiff = rTo.GetGreen() - rFrom.GetGreen();
+ aColor.SetGreen( rFrom.GetGreen() + ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else if( rFrom.GetGreen() > rTo.GetGreen() )
+ {
+ nDiff = rFrom.GetGreen() - rTo.GetGreen();
+ aColor.SetGreen( rFrom.GetGreen() - ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else
+ aColor.SetGreen( rFrom.GetGreen() );
+
+ // approach blue
+ if( rFrom.GetBlue() < rTo.GetBlue() )
+ {
+ nDiff = rTo.GetBlue() - rFrom.GetBlue();
+ aColor.SetBlue( rFrom.GetBlue() + ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else if( rFrom.GetBlue() > rTo.GetBlue() )
+ {
+ nDiff = rFrom.GetBlue() - rTo.GetBlue();
+ aColor.SetBlue( rFrom.GetBlue() - ( nDiff < 10 ? nDiff : 10 ) );
+ }
+ else
+ aColor.SetBlue( rFrom.GetBlue() );
+
+ return aColor;
+}
+
+class SpaPrinterController : public vcl::PrinterController
+{
+public:
+ SpaPrinterController( const boost::shared_ptr<Printer>& i_pPrinter )
+ : vcl::PrinterController( i_pPrinter )
+ {}
+ virtual ~SpaPrinterController()
+ {}
+
+ virtual int getPageCount() const { return 1; }
+ virtual Sequence< PropertyValue > getPageParameters( int i_nPage ) const;
+ virtual void printPage( int i_nPage ) const;
+ virtual void jobFinished( com::sun::star::view::PrintableState );
+};
+
+Sequence< PropertyValue > SpaPrinterController::getPageParameters( int ) const
+{
+ Sequence< PropertyValue > aRet( 1 );
+
+ Size aPageSize( getPrinter()->GetPaperSizePixel() );
+ aPageSize = getPrinter()->PixelToLogic( aPageSize, MapMode( MAP_100TH_MM ) );
+
+ awt::Size aSize;
+ aSize.Width = aPageSize.Width();
+ aSize.Height = aPageSize.Height();
+ aRet[0].Value = makeAny(aSize);
+
+ return aRet;
+}
+
+void SpaPrinterController::printPage( int ) const
+{
+ const double DELTA = 5.0;
+
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+
+ PrinterInfo aInfo( psp::PrinterInfoManager::get().getPrinterInfo( pPrinter->GetName() ) );
+ const PPDParser* pPrintParser = aInfo.m_pParser;
+
+ MapMode aMapMode( MAP_100TH_MM );
+
+ Bitmap aButterfly( PaResId( RID_BUTTERFLY ) );
+
+ pPrinter->SetMapMode( aMapMode );
+
+ Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME );
+ OUString aJobName;
+ aRet >>= aJobName;
+
+ aJobName = aJobName + OUString( RTL_CONSTASCII_USTRINGPARAM( " Testpage" ) );
+
+ Size aPaperSize=pPrinter->GetOutputSize();
+ Point aCenter( aPaperSize.Width()/2-300,
+ aPaperSize.Height() - aPaperSize.Width()/2 );
+ Point aP1( aPaperSize.Width()/48, 0), aP2( aPaperSize.Width()/40, 0 ), aPoint;
+
+ pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) );
+ pPrinter->DrawRect( Rectangle( Point( 100,100 ),
+ Size( aPaperSize.Width()-200,
+ aPaperSize.Height()-200 ) ) );
+ pPrinter->DrawRect( Rectangle( Point( 200,200 ),
+ Size( aPaperSize.Width()-400,
+ aPaperSize.Height()-400 ) ) );
+ pPrinter->DrawRect( Rectangle( Point( 300,300 ),
+ Size( aPaperSize.Width()-600,
+ aPaperSize.Height()-600 ) ) );
+
+ Font aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ), Size( 0, 400 ) );
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetItalic( ITALIC_NONE );
+ pPrinter->SetFont( aFont );
+
+ OUStringBuffer aPrintText(1024);
+ long nWidth = 0, nMaxWidth = 0;
+ String aToken;
+
+ static const struct
+ {
+ const char* const pDirect;
+ USHORT nResId;
+ } aResIds[] =
+ {
+ { NULL, RID_TXT_TESTPAGE_NAME },
+ { NULL, RID_TXT_TESTPAGE_MODEL },
+ { "PPD", 0 },
+ { NULL, RID_TXT_TESTPAGE_QUEUE },
+ { NULL, RID_TXT_TESTPAGE_COMMENT },
+ { NULL, RID_TXT_TESTPAGE_DATE },
+ { NULL, RID_TXT_TESTPAGE_TIME }
+ };
+
+ for( unsigned int i = 0; i < sizeof(aResIds)/sizeof(aResIds[0]); i++ )
+ {
+ if( aResIds[i].pDirect )
+ aToken = String::CreateFromAscii( aResIds[i].pDirect );
+ else
+ aToken = String( PaResId( aResIds[i].nResId ) );
+ nMaxWidth = ( nWidth = pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
+ aPrintText.append( aToken );
+ aPrintText.append( (sal_Unicode)'\n' );
+ };
+
+ pPrinter->DrawText( Rectangle( Point( 1000, 1000 ),
+ Size( aPaperSize.Width() - 2000,
+ aPaperSize.Height() - 4000 ) ),
+ aPrintText.makeStringAndClear(),
+ TEXT_DRAW_MULTILINE );
+
+ AllSettings aSettings( Application::GetSettings() );
+ const LocaleDataWrapper& rLocaleWrapper( aSettings.GetLocaleDataWrapper() );
+
+ aPrintText.appendAscii( ": " );
+ aPrintText.append( pPrinter->GetName() );
+ aPrintText.appendAscii( "\n: " );
+ if( pPrintParser )
+ aPrintText.append( pPrintParser->getPrinterName() );
+ aPrintText.appendAscii( "\n: " );
+ INetURLObject aDriverPath( pPrintParser ? pPrintParser->getFilename() : String( RTL_CONSTASCII_USTRINGPARAM( "<undef>" ) ),
+ INET_PROT_FILE, INetURLObject::ENCODE_ALL );
+ aPrintText.append( aDriverPath.GetName() );
+ aPrintText.appendAscii( "\n: " );
+ aPrintText.append( aInfo.m_aCommand );
+ aPrintText.appendAscii( "\n: " );
+ aPrintText.append( aInfo.m_aComment );
+ aPrintText.appendAscii( "\n: " );
+ aPrintText.append( rLocaleWrapper.getDate( Date() ) );
+ aPrintText.appendAscii( "\n: " );
+ aPrintText.append( rLocaleWrapper.getTime( Time() ) );
+
+ pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 1000 ),
+ Size( aPaperSize.Width() - 2100 - nMaxWidth,
+ aPaperSize.Height() - 4000 ) ),
+ aPrintText.makeStringAndClear(),
+ TEXT_DRAW_MULTILINE );
+
+ pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ),
+ Size( 3000,3000 ),
+ aButterfly );
+ pPrinter->SetFillColor();
+ pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ),
+ Size( 3000,3000 ) ) );
+
+ Color aWhite( 0xff, 0xff, 0xff );
+ Color aBlack( 0, 0, 0 );
+ Color aLightRed( 0xff, 0, 0 );
+ Color aDarkRed( 0x40, 0, 0 );
+ Color aLightBlue( 0, 0, 0xff );
+ Color aDarkBlue( 0,0,0x40 );
+ Color aLightGreen( 0, 0xff, 0 );
+ Color aDarkGreen( 0, 0x40, 0 );
+
+ Gradient aGradient( GRADIENT_LINEAR, aBlack, aWhite );
+ aGradient.SetAngle( 900 );
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ),
+ Size( aPaperSize.Width() - 2000,
+ 500 ) ), aGradient );
+ aGradient.SetStartColor( aDarkRed );
+ aGradient.SetEndColor( aLightBlue );
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ),
+ Size( aPaperSize.Width() - 2000,
+ 500 ) ), aGradient );
+ aGradient.SetStartColor( aDarkBlue );
+ aGradient.SetEndColor( aLightGreen );
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ),
+ Size( aPaperSize.Width() - 2000,
+ 500 ) ), aGradient );
+ aGradient.SetStartColor( aDarkGreen );
+ aGradient.SetEndColor( aLightRed );
+ pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ),
+ Size( aPaperSize.Width() - 2000,
+ 500 ) ), aGradient );
+
+
+
+ LineInfo aLineInfo( LINE_SOLID, 200 );
+ double sind = sin( DELTA*M_PI/180.0 );
+ double cosd = cos( DELTA*M_PI/180.0 );
+ double factor = 1 + (DELTA/1000.0);
+ int n=0;
+ Color aLineColor( 0, 0, 0 );
+ Color aApproachColor( 0, 0, 200 );
+ while ( aP2.X() < aCenter.X() && n++ < 680 )
+ {
+ aLineInfo.SetWidth( n/3 );
+ aLineColor = approachColor( aLineColor, aApproachColor );
+ pPrinter->SetLineColor( aLineColor );
+
+ // switch aproach color
+ if( aApproachColor.IsRGBEqual( aLineColor ) )
+ {
+ if( aApproachColor.GetRed() )
+ aApproachColor = Color( 0, 0, 200 );
+ else if( aApproachColor.GetGreen() )
+ aApproachColor = Color( 200, 0, 0 );
+ else
+ aApproachColor = Color( 0, 200, 0 );
+ }
+
+ pPrinter->DrawLine( project( aP1 ) + aCenter,
+ project( aP2 ) + aCenter,
+ aLineInfo );
+ aPoint.X() = (int)((((double)aP1.X())*cosd - ((double)aP1.Y())*sind)*factor);
+ aPoint.Y() = (int)((((double)aP1.Y())*cosd + ((double)aP1.X())*sind)*factor);
+ aP1 = aPoint;
+ aPoint.X() = (int)((((double)aP2.X())*cosd - ((double)aP2.Y())*sind)*factor);
+ aPoint.Y() = (int)((((double)aP2.Y())*cosd + ((double)aP2.X())*sind)*factor);
+ aP2 = aPoint;
+ }
+#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
+ fprintf( stderr, "%d lines\n",n );
+#endif
+}
+
+void SpaPrinterController::jobFinished( com::sun::star::view::PrintableState )
+{
+ String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) );
+ InfoBox aInfoBox( NULL, aInfoString );
+ aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) );
+ aInfoBox.Execute();
+}
+
+void PADialog::PrintTestPage()
+{
+ String sPrinter( getSelectedDevice() );
+
+ boost::shared_ptr<Printer> pPrinter( new Printer( sPrinter ) );
+
+ if( pPrinter->GetName() != sPrinter )
+ {
+ String aString( PaResId( RID_ERR_NOPRINTER ) );
+ aString.SearchAndReplaceAscii( "%s", sPrinter );
+
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString );
+ aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) );
+ aErrorBox.Execute();
+ return;
+ }
+
+ boost::shared_ptr<vcl::PrinterController> pController( new SpaPrinterController( pPrinter ) );
+ JobSetup aJobSetup( pPrinter->GetJobSetup() );
+ aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ),
+ String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
+ Printer::PrintJob( pController, aJobSetup );
+}
+
+void PADialog::AddDevice()
+{
+ AddPrinterDialog aDlg( this );
+
+ if( aDlg.Execute() )
+ UpdateDevice();
+}
+
+void PADialog::RemDevice()
+{
+ String aPrinter( getSelectedDevice() );
+ String aDefPrinter( m_rPIManager.getDefaultPrinter() );
+ // do not remove the default printer
+ if( aPrinter.Equals( aDefPrinter ) )
+ return;
+
+ if( ! m_rPIManager.removePrinter( aPrinter ) )
+ {
+ String aText( PaResId( RID_ERR_PRINTERNOTREMOVEABLE ) );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aPrinter );
+ ErrorBox aBox( this, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+ return;
+ }
+ m_aPrinters.remove( aPrinter );
+
+ m_aDevicesLB.RemoveEntry( m_aDevicesLB.GetSelectEntryPos() );
+ for( int i=0; i < m_aDevicesLB.GetEntryCount(); i++ )
+ {
+ if( m_aDevicesLB.GetEntry( i ).CompareTo( aDefPrinter, aDefPrinter.Len() ) == COMPARE_EQUAL )
+ {
+ m_aDevicesLB.SelectEntryPos( i, TRUE );
+ UpdateText();
+ break;
+ }
+ }
+
+ m_aDevicesLB.GetFocus();
+
+ if( m_aDevicesLB.GetEntryCount() < 2 )
+ m_aRemPB.Enable( FALSE );
+}
+
+void PADialog::ConfigureDevice()
+{
+ String aPrinter( getSelectedDevice() );
+
+ if( ! aPrinter.Len() )
+ return;
+
+ PrinterInfo aInfo( m_rPIManager.getPrinterInfo( aPrinter ) );
+ RTSDialog aDialog( aInfo, aPrinter, true, this );
+
+ if( aDialog.Execute() )
+ m_rPIManager.changePrinterInfo( aPrinter, aDialog.getSetup() );
+
+ UpdateText();
+}
+
+void PADialog::RenameDevice()
+{
+ String aPrinter( getSelectedDevice() );
+ OUString aOldPrinter( aPrinter );
+
+ if( ! aPrinter.Len() )
+ return;
+
+ String aTmpString( PaResId( RID_QRY_PRTNAME ) );
+ QueryString aQuery( this,
+ aTmpString,
+ aPrinter );
+ aQuery.SetText( m_aRenameStr );
+ aQuery.Execute();
+
+ if( aPrinter.Len() )
+ {
+ PrinterInfo aInfo( m_rPIManager.getPrinterInfo( aOldPrinter ) );
+ aInfo.m_aPrinterName = aPrinter;
+ if( m_rPIManager.addPrinter( aPrinter, aInfo.m_aDriverName ) )
+ {
+ bool bWasDefault = m_rPIManager.getDefaultPrinter() == aOldPrinter;
+ m_aPrinters.push_back( aPrinter );
+ if( m_rPIManager.removePrinter( aOldPrinter ) )
+ m_aPrinters.remove( aOldPrinter );
+ m_rPIManager.changePrinterInfo( aPrinter, aInfo );
+ if( bWasDefault )
+ {
+ m_rPIManager.setDefaultPrinter( aPrinter );
+ UpdateDefPrt();
+ }
+ UpdateDevice();
+ }
+ }
+}
+
+void PADialog::UpdateDevice()
+{
+ m_aDevicesLB.Clear();
+
+ m_rPIManager.listPrinters( m_aPrinters );
+ ::std::list< OUString >::iterator it;
+ for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
+ {
+ const PrinterInfo& rInfo( m_rPIManager.getPrinterInfo( *it ) );
+ sal_Int32 nIndex = 0;
+ bool bAutoQueue = false;
+ bool bFax = false;
+ bool bPdf = false;
+ while( nIndex != -1 && ! bAutoQueue )
+ {
+ OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
+ if( aToken.getLength() )
+ {
+ if( aToken.compareToAscii( "autoqueue" ) == 0 )
+ bAutoQueue = true;
+ else if( aToken.compareToAscii( "pdf=", 4 ) == 0 )
+ bPdf = true;
+ else if( aToken.compareToAscii( "fax", 3 ) == 0 )
+ bFax = true;
+ }
+ }
+ if( bAutoQueue )
+ continue;
+
+ String aEntry( *it );
+ if( *it == m_rPIManager.getDefaultPrinter() )
+ {
+ aEntry.AppendAscii( " (" );
+ aEntry += m_aDefPrt;
+ aEntry.AppendAscii( ")" );
+ }
+ int nPos =
+ m_aDevicesLB.InsertEntry( aEntry,
+ bFax ? m_aFaxImg :
+ bPdf ? m_aPdfImg : m_aPrinterImg
+ );
+ m_aDevicesLB.SetEntryData( nPos, (void*)it->getLength() );
+ if( *it == m_rPIManager.getDefaultPrinter() )
+ {
+ m_aDevicesLB.SelectEntryPos( nPos );
+ UpdateText();
+ }
+ }
+}
+
diff --git a/padmin/source/padialog.hrc b/padmin/source/padialog.hrc
new file mode 100644
index 000000000000..2f238592231a
--- /dev/null
+++ b/padmin/source/padialog.hrc
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_PADIALOG_HRC_
+#define _PAD_PADIALOG_HRC_
+
+#define RID_PADIALOG 1000
+#define RID_PA_BTN_CANCEL 1
+#define RID_PA_BTN_STD 2
+#define RID_PA_BTN_DEL 3
+#define RID_PA_LB_DEV 4
+#define RID_PA_FL_PRINTERS 5
+#define RID_PA_BTN_CONF 6
+#define RID_PA_BTN_RENAME 7
+#define RID_PA_TESTPAGE 8
+#define RID_PA_BTN_FONTS 9
+#define RID_PA_TXT_DRIVER 10
+#define RID_PA_TXT_DRIVER_STRING 11
+#define RID_PA_TXT_LOCATION 12
+#define RID_PA_TXT_LOCATION_STRING 13
+#define RID_PA_TXT_COMMAND 14
+#define RID_PA_TXT_COMMAND_STRING 15
+#define RID_PA_TXT_COMMENT 16
+#define RID_PA_TXT_COMMENT_STRING 17
+#define RID_PA_STR_DEFPRT 18
+#define RID_PA_BTN_ADD 19
+#define RID_PA_BTN_ADDFONTS 20
+#define RID_PA_STR_RENAME 21
+#define RID_PA_FL_SEPBUTTON 22
+#define RID_PA_FL_CUPSUSAGE 23
+#define RID_PA_CB_CUPSUSAGE 23
+
+#define RID_STRINGQUERYDLG 1003
+#define RID_STRQRY_TXT_RENAME 1
+#define RID_STRQRY_EDT_NEWNAME 2
+#define RID_STRQRY_BTN_OK 3
+#define RID_STRQRY_BTN_CANCEL 4
+#define RID_STRQRY_BOX_NEWNAME 5
+
+#define RID_PPDIMPORT_DLG 1004
+#define RID_PPDIMP_BTN_OK 1
+#define RID_PPDIMP_BTN_CANCEL 2
+#define RID_PPDIMP_BTN_SEARCH 3
+#define RID_PPDIMP_TXT_DRIVER 4
+#define RID_PPDIMP_LB_DRIVER 5
+#define RID_PPDIMP_LB_PATH 6
+#define RID_PPDIMP_GROUP_PATH 7
+#define RID_PPDIMP_GROUP_DRIVER 8
+#define RID_PPDIMP_TXT_PATH 9
+#define RID_PPDIMP_STR_LOADINGPPD 10
+
+#define RID_PA_TXT_TESTPAGE_PRINTED 1005
+
+#define RID_ERR_PRINTERNOTREMOVEABLE 1006
+#define RID_ERR_COMMANDCONNECTED 1007
+#define RID_ERR_FILENOTFOUND 1008
+#define RID_ERR_NOWRITE 1009
+#define RID_ERR_NOPRINTER 1013
+#define RID_ERR_FILEOPENREAD 1016
+#define RID_ERR_FILEOPENWRITE 1017
+#define RID_QRY_PRTNAME 1022
+
+#define RID_FONTLISTDLG 1026
+#define RID_FLDLG_BTN_OK 1
+#define RID_FLDLG_LB_FONTS 2
+#define RID_FLDLG_BTN_REMOVE 3
+#define RID_FLDLG_TXT 4
+
+#define RID_METRICOPTIONS_DLG 1029
+#define RID_METDLG_BTN_OK 1
+#define RID_METDLG_BTN_CANCEL 2
+#define RID_METDLG_BTN_SELECTION 3
+#define RID_METDLG_BTN_ALL 4
+#define RID_METDLG_BTN_CORRECT 5
+
+#define RID_FONTNAMEDIALOG 1030
+#define RID_FNTNM_FIXED 1
+#define RID_FNTNM_BTN_OK 2
+#define RID_FNTNM_BTN_REMOVE 3
+#define RID_FNTNM_LB_FONTS 4
+#define RID_FNTNM_BTN_IMPORT 5
+#define RID_FNTNM_BTN_RENAME 6
+#define RID_FNTNM_STR_RENAME 7
+#define RID_FNTNM_STR_TTCRENAME 8
+#define RID_FNTNM_STR_NOTRENAMABLE 9
+
+#define RID_TXT_REFETCH 1031
+
+#define RID_BXT_TESTPAGE 1034
+#define RID_BXT_ENVIRONMENT 1035
+
+#define RID_YOU_SURE 1040
+
+#define RID_ERR_REMOVEDRIVERFAILED 1041
+
+#define RID_BUTTERFLY 1047
+
+#define RID_COMMAND_TXT_MODIFY 1049
+#define RID_COMMAND_TXT_ADDENTRY 1050
+#define RID_ERR_REMOVESGENPRT 1051
+#define RID_PA_TXT_NOWRITE 1052
+#define RID_DOUBLEFONTFILE 1053
+#define RID_INVALIDFONTPATH 1054
+#define RID_TESTPAGESAVE 1055
+#define RID_FNTNM_FONTNAME_TXT 1056
+#define RID_FNTNM_NOFONT_TXT 1057
+#define RID_QUERY_REMOVEDRIVER 1058
+#define RID_QUERY_REMOVEPRINTER 1059
+#define RID_QUERY_REMOVEFONTFROMLIST 1060
+#define RID_QUERY_DRIVERUSED 1062
+#define RID_ERR_REMOVEDEFAULTDRIVER 1063
+#define RID_ERR_WRITEFONTSDIR 1064
+
+#define RID_FONTIMPORT_DIALOG 1065
+#define RID_FIMP_BTN_OK 1
+#define RID_FIMP_BTN_CANCEL 2
+#define RID_FIMP_EDT_FROM 3
+#define RID_FIMP_BTN_FROM 4
+#define RID_FIMP_FL_FROM 5
+#define RID_FIMP_BTN_SELECTALL 6
+#define RID_FIMP_BOX_NEWFONTS 7
+#define RID_FIMP_TXT_HELP 8
+#define RID_FIMP_STR_IMPORTOP 9
+#define RID_FIMP_STR_QUERYOVERWRITE 10
+#define RID_FIMP_STR_OVERWRITEALL 11
+#define RID_FIMP_STR_OVERWRITENONE 12
+#define RID_FIMP_STR_NOAFM 13
+#define RID_FIMP_STR_AFMCOPYFAILED 14
+#define RID_FIMP_STR_FONTCOPYFAILED 15
+#define RID_FIMP_STR_NOWRITEABLEFONTSDIR 16
+#define RID_FIMP_STR_NUMBEROFFONTSIMPORTED 17
+#define RID_FIMP_BOX_LINKONLY 18
+#define RID_FIMP_BOX_SUBDIRS 19
+#define RID_FIMP_FL_TARGETOPTS 20
+
+#define RID_TXT_IMPORTTITLE 1066
+#define RID_TXT_FONTS2IMPORT 1067
+#define RID_TXT_TESTPAGE_MODEL 1068
+#define RID_TXT_TESTPAGE_QUEUE 1069
+#define RID_TXT_TESTPAGE_DATE 1070
+#define RID_TXT_TESTPAGE_TIME 1071
+#define RID_TXT_PRINTERALREADYEXISTS 1072
+#define RID_TXT_PRINTERWITHOUTCOMMAND 1073
+#define RID_TXT_PRINTERADDFAILED 1074
+#define RID_TXT_DRIVERDOESNOTEXIST 1075
+#define RID_TXT_TESTPAGE_COMMENT 1076
+#define RID_TXT_TESTPAGE_NAME 1077
+
+#define RID_TXT_FONT_ITALIC 1078
+#define RID_TXT_FONT_OBLIQUE 1079
+#define RID_TXT_FONT_THIN 1080
+#define RID_TXT_FONT_ULTRALIGHT 1081
+#define RID_TXT_FONT_LIGHT 1082
+#define RID_TXT_FONT_SEMILIGHT 1083
+#define RID_TXT_FONT_SEMIBOLD 1084
+#define RID_TXT_FONT_BOLD 1085
+#define RID_TXT_FONT_ULTRABOLD 1086
+#define RID_TXT_FONT_ULTRACONDENSED 1087
+#define RID_TXT_FONT_EXTRACONDENSED 1088
+#define RID_TXT_FONT_CONDENSED 1089
+#define RID_TXT_FONT_SEMICONDENSED 1090
+#define RID_TXT_FONT_SEMIEXPANDED 1091
+#define RID_TXT_FONT_EXPANDED 1092
+#define RID_TXT_FONT_EXTRAEXPANDED 1093
+#define RID_TXT_FONT_ULTRAEXPANDED 1094
+#define RID_TXT_FONT_REGULAR 1095
+
+#define RID_BMP_SMALL_PRINTER 1096
+#define RID_BMP_SMALL_PRINTER_HC 1097
+#define RID_BMP_SMALL_FAX 1098
+#define RID_BMP_SMALL_FAX_HC 1099
+#define RID_BMP_SMALL_PDF 1100
+#define RID_BMP_SMALL_PDF_HC 1101
+#define RID_BMP_PRINTER 1102
+#define RID_BMP_PRINTER_HC 1103
+
+#define RID_AFMERROR_OK 1300
+#define RID_AFMERROR_NO_FONT_NAME 1301
+#define RID_AFMERROR_NO_FULL_NAME 1302
+#define RID_AFMERROR_NO_FAMILY_NAME 1303
+#define RID_AFMERROR_MOVETO_FAILED 1304
+#define RID_AFMERROR_STREAM_READ_FAILED 1305
+#define RID_AFMERROR_STREAM_WRITE_FAILED 1306
+#define RID_AFMERROR_NOT_A_METRIC 1307
+
+#define RID_AFMERROR_BOX_TXT 1350
+
+#define RID_PROGRESS_DLG 1400
+#define RID_PROGRESS_BTN_CANCEL 1
+#define RID_PROGRESS_OPERATION_TXT 2
+#define RID_PROGRESS_PROGRESS_TXT 3
+#define RID_PROGRESS_STATUSBAR 5
+#define RID_PROGRESS_FILENAME_TXT 6
+
+#define RID_OPERATION_FONTINTEGRATE 1402
+#define RID_OPERATION_FONTADD 1403
+#define RID_OPERATION_CONVERTMETRIC 1406
+#define RID_OPERATION_FONTCOLLECT 1407
+#define RID_OPERATION_FONTIMPORT 1408
+
+#define RID_ADD_PRINTER_DIALOG 2000
+#define RID_ADDP_BTN_FINISH 1
+#define RID_ADDP_BTN_CANCEL 2
+#define RID_ADDP_BTN_NEXT 3
+#define RID_ADDP_BTN_PREV 4
+#define RID_ADDP_LINE 5
+#define RID_ADDP_CTRL_TITLE 6
+#define RID_ADDP_STR_TITLE 127
+
+#define RID_ADDP_PAGE_CHOOSEDEV 2001
+#define RID_ADDP_CHDEV_TXT_OVER 1
+#define RID_ADDP_CHDEV_BTN_PRINTER 2
+#define RID_ADDP_CHDEV_BTN_FAX 3
+#define RID_ADDP_CHDEV_BTN_PDF 4
+#define RID_ADDP_CHDEV_BTN_OLD 5
+
+#define RID_ADDP_PAGE_CHOOSEDRIVER 2002
+#define RID_ADDP_CHDRV_TXT_DRIVER 1
+#define RID_ADDP_CHDRV_BOX_DRIVER 2
+#define RID_ADDP_CHDRV_BTN_ADD 3
+#define RID_ADDP_CHDRV_BTN_REMOVE 4
+#define RID_ADDP_CHDRV_STR_REMOVE 5
+
+#define RID_ADDP_PAGE_NAME 2003
+#define RID_ADDP_NAME_TXT_NAME 1
+#define RID_ADDP_NAME_TXT_FAXNAME 2
+#define RID_ADDP_NAME_TXT_PDFNAME 3
+#define RID_ADDP_NAME_EDT_NAME 4
+#define RID_ADDP_NAME_EDT_FAXNAME 5
+#define RID_ADDP_NAME_EDT_PDFNAME 6
+#define RID_ADDP_NAME_BOX_DEFAULT 7
+#define RID_ADDP_NAME_BOX_FAXSWALLOW 8
+
+#define RID_ADDP_PAGE_COMMAND 2004
+#define RID_ADDP_CMD_TXT_COMMAND 1
+#define RID_ADDP_CMD_BOX_COMMAND 2
+#define RID_ADDP_CMD_BTN_HELP 3
+#define RID_ADDP_CMD_STR_FAXHELP 4
+#define RID_ADDP_CMD_STR_PDFHELP 5
+#define RID_ADDP_CMD_TXT_PDFDIR 6
+#define RID_ADDP_CMD_EDT_PDFDIR 7
+#define RID_ADDP_CMD_BTN_PDFDIR 8
+#define RID_ADDP_CMD_BOX_PDFCOMMAND 9
+
+#define RID_ADDP_PAGE_OLDPRINTERS 2005
+#define RID_ADDP_OLD_TXT_PRINTERS 1
+#define RID_ADDP_OLD_BOX_PRINTERS 2
+#define RID_ADDP_OLD_BTN_SELECTALL 3
+
+#define RID_ADDP_PAGE_FAXDRIVER 2006
+#define RID_ADDP_FAXDRV_TXT_DRIVER 1
+#define RID_ADDP_FAXDRV_BTN_DEFAULT 2
+#define RID_ADDP_FAXDRV_BTN_SELECT 3
+
+#define RID_ADDP_PAGE_PDFDRIVER 2007
+#define RID_ADDP_PDFDRV_TXT_DRIVER 1
+#define RID_ADDP_PDFDRV_BTN_DEFAULT 2
+#define RID_ADDP_PDFDRV_BTN_DIST 3
+#define RID_ADDP_PDFDRV_BTN_SELECT 4
+
+#endif
diff --git a/padmin/source/padialog.hxx b/padmin/source/padialog.hxx
new file mode 100644
index 000000000000..2a8285f8af88
--- /dev/null
+++ b/padmin/source/padialog.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_PADIALOG_HXX_
+#define _PAD_PADIALOG_HXX_
+#ifndef __SGI_STL_LIST
+#include <list>
+#endif
+#ifndef _RTL_USTRING
+#include <rtl/ustring.hxx>
+#endif
+#include <vcl/dialog.hxx>
+#include <tools/config.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+#include <helper.hxx>
+
+// forward declaration
+namespace psp { class PrinterInfoManager; }
+class Printer;
+
+namespace padmin {
+
+ class PADialog : public ModalDialog
+ {
+ private:
+ DelListBox m_aDevicesLB;
+ PushButton m_aConfPB;
+ PushButton m_aRenamePB;
+ PushButton m_aStdPB;
+ PushButton m_aRemPB;
+ PushButton m_aTestPagePB;
+ FixedLine m_aPrintersFL;
+ FixedText m_aDriverTxt;
+ FixedText m_aDriver;
+ FixedText m_aLocationTxt;
+ FixedText m_aLocation;
+ FixedText m_aCommandTxt;
+ FixedText m_aCommand;
+ FixedText m_aCommentTxt;
+ FixedText m_aComment;
+
+ FixedLine m_aCUPSFL;
+ CheckBox m_aCUPSCB;
+
+ FixedLine m_aSepButtonFL;
+ PushButton m_aAddPB;
+ PushButton m_aFontsPB;
+ CancelButton m_aCancelButton;
+
+ String m_aDefPrt;
+ String m_aRenameStr;
+
+ ::psp::PrinterInfoManager& m_rPIManager;
+ ::std::list< ::rtl::OUString > m_aPrinters;
+
+ Image m_aPrinterImg;
+ Image m_aFaxImg;
+ Image m_aPdfImg;
+
+ DECL_LINK( ClickBtnHdl, PushButton* );
+ DECL_LINK( DoubleClickHdl, ListBox* );
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( DelPressedHdl, ListBox* );
+
+ PADialog( Window*, BOOL );
+ void Init();
+
+ void UpdateDefPrt();
+ void UpdateText();
+ void UpdateDevice();
+ void AddDevice();
+ void RemDevice();
+ void ConfigureDevice();
+ void RenameDevice();
+ void PrintTestPage();
+ void updateSettings();
+
+ virtual long Notify( NotifyEvent& rEv );
+ virtual void DataChanged( const DataChangedEvent& rEv );
+
+ String getSelectedDevice();
+ public:
+ ~PADialog();
+
+ static PADialog* Create( Window*, BOOL );
+ };
+
+} // namespace
+
+#endif
diff --git a/padmin/source/padialog.src b/padmin/source/padialog.src
new file mode 100644
index 000000000000..8834bba3226c
--- /dev/null
+++ b/padmin/source/padialog.src
@@ -0,0 +1,1153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "padialog.hrc"
+
+ModalDialog RID_FONTIMPORT_DIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 230 , 185 );
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ ListBox RID_FIMP_BOX_NEWFONTS
+ {
+ Border = TRUE;
+ Sort=TRUE;
+ AutoHScroll = TRUE;
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 155, 75 );
+ };
+ FixedText RID_FIMP_TXT_HELP
+ {
+ Pos = MAP_APPFONT( 5, 155 );
+ Size = MAP_APPFONT( 220, 24 );
+ WordBreak=TRUE;
+ Text [ en-US ] = "Please select the folder from which you want to import fonts. Add the selected fonts by clicking the OK button.";
+ };
+ FixedLine RID_FIMP_FL_FROM
+ {
+ Pos = MAP_APPFONT( 5, 85 );
+ Size = MAP_APPFONT( 160, 8 );
+ Text [ en-US ] = "Source directory";
+ };
+ Edit RID_FIMP_EDT_FROM
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 10, 97 );
+ Size = MAP_APPFONT( 130, 12 );
+ };
+ PushButton RID_FIMP_BTN_FROM
+ {
+ Pos = MAP_APPFONT( 145, 97 );
+ Size = MAP_APPFONT( 15, 12 );
+ Text = "...";
+ };
+ CheckBox RID_FIMP_BOX_SUBDIRS
+ {
+ Pos = MAP_APPFONT( 10, 115 );
+ Size = MAP_APPFONT( 145, 10 );
+ Text [ en-US ] = "Sea~rch Subdirectories";
+ };
+ FixedLine RID_FIMP_FL_TARGETOPTS
+ {
+ Pos = MAP_APPFONT( 5, 130 );
+ Size = MAP_APPFONT( 160, 8 );
+ Text [ en-US ] = "Target options";
+ };
+
+ CheckBox RID_FIMP_BOX_LINKONLY
+ {
+ Pos = MAP_APPFONT( 10, 140 );
+ Size = MAP_APPFONT( 145, 10 );
+ Text [ en-US ] = "Create ~soft links only";
+ };
+ OKButton RID_FIMP_BTN_OK
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT( 175, 10 );
+ Size = MAP_APPFONT( 50, 12 );
+ };
+ CancelButton RID_FIMP_BTN_CANCEL
+ {
+ Pos = MAP_APPFONT( 175, 27 );
+ Size = MAP_APPFONT( 50, 12 );
+ };
+ PushButton RID_FIMP_BTN_SELECTALL
+ {
+ Pos = MAP_APPFONT( 175, 44 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Select All";
+ };
+ String RID_FIMP_STR_IMPORTOP
+ {
+ Text [ en-US ] = "Add fonts";
+ };
+ String RID_FIMP_STR_QUERYOVERWRITE
+ {
+ Text [ en-US ] = "Do you really want to overwrite this font file?\n %s";
+ };
+ String RID_FIMP_STR_OVERWRITEALL
+ {
+ Text [ en-US ] = "All";
+ };
+ String RID_FIMP_STR_OVERWRITENONE
+ {
+ Text [ en-US ] = "None";
+ };
+
+ String RID_FIMP_STR_NOAFM
+ {
+ Text [ en-US ] = "A format file (with an .afm extension) has not been found for the font\n%s\ntherefore, the font cannot be installed. Format files can be created with ghostscript, for example, and have to be located in the same directory as the font files or its afm subdirectory.";
+ };
+ String RID_FIMP_STR_AFMCOPYFAILED
+ {
+ Text [ en-US ] = "The metric file for the font file\n %s\ncould not be copied. The font will not be installed.";
+ };
+ String RID_FIMP_STR_FONTCOPYFAILED
+ {
+ Text [ en-US ] = "The font file\n %s\ncould not be copied. The font will not be installed.";
+ };
+ String RID_FIMP_STR_NOWRITEABLEFONTSDIR
+ {
+ Text [ en-US ] = "A directory containing a writable fonts.dir file is not located in the Fontpath. Therefore, fonts cannot be installed.";
+ };
+ String RID_FIMP_STR_NUMBEROFFONTSIMPORTED
+ {
+ Text [ en-US ] = "%d new fonts were added.";
+ };
+ Text [ en-US ] = "Add Fonts";
+};
+
+ModalDialog RID_PADIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 198 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedLine RID_PA_FL_CUPSUSAGE
+ {
+ Pos = MAP_APPFONT( 6, 145 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "CUPS support";
+ };
+ CheckBox RID_PA_CB_CUPSUSAGE
+ {
+ Pos = MAP_APPFONT( 12, 158 );
+ Size = MAP_APPFONT( 168, 8 );
+ Text [ en-US ] = "Disable CUPS Support";
+ };
+
+ FixedLine RID_PA_FL_SEPBUTTON
+ {
+ Pos = MAP_APPFONT( 0, 176 );
+ Size = MAP_APPFONT( 260, 2 );
+ };
+ CancelButton RID_PA_BTN_CANCEL
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT( 190, 181 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "Close";
+ };
+
+ FixedLine RID_PA_FL_PRINTERS
+ {
+ Pos = MAP_APPFONT( 6, 5 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "Installed ~printers";
+ };
+ ListBox RID_PA_LB_DEV
+ {
+ Pos = MAP_APPFONT( 12, 15 );
+ Size = MAP_APPFONT( 168, 80 );
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ FixedText RID_PA_TXT_COMMAND
+ {
+ Pos = MAP_APPFONT( 10, 100 );
+ Size = MAP_APPFONT( 40, 8 );
+ Text [ en-US ] = "Command:";
+ };
+ FixedText RID_PA_TXT_COMMAND_STRING
+ {
+ Pos = MAP_APPFONT( 55, 100 );
+ Size = MAP_APPFONT( 135, 8 );
+ };
+ FixedText RID_PA_TXT_DRIVER
+ {
+ Pos = MAP_APPFONT( 10, 110 );
+ Size = MAP_APPFONT( 40, 8 );
+ Text [ en-US ] = "Driver:";
+ };
+ FixedText RID_PA_TXT_DRIVER_STRING
+ {
+ Pos = MAP_APPFONT( 55, 110 );
+ Size = MAP_APPFONT( 135, 8 );
+ };
+ FixedText RID_PA_TXT_LOCATION
+ {
+ Pos = MAP_APPFONT( 10, 120 );
+ Size = MAP_APPFONT( 40, 8 );
+ Text [ en-US ] = "Location:";
+ };
+ FixedText RID_PA_TXT_LOCATION_STRING
+ {
+ Pos = MAP_APPFONT( 55, 120 );
+ Size = MAP_APPFONT( 135, 8 );
+ };
+ FixedText RID_PA_TXT_COMMENT
+ {
+ Pos = MAP_APPFONT( 10, 130 );
+ Size = MAP_APPFONT( 40, 8 );
+ Text [ en-US ] = "Comment:";
+ };
+ FixedText RID_PA_TXT_COMMENT_STRING
+ {
+ Pos = MAP_APPFONT( 55, 130 );
+ Size = MAP_APPFONT( 135, 8 );
+ };
+ PushButton RID_PA_BTN_CONF
+ {
+ Pos = MAP_APPFONT( 190, 15 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "Properties...";
+ };
+ PushButton RID_PA_BTN_RENAME
+ {
+ Pos = MAP_APPFONT( 190, 32 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "R~ename...";
+ };
+ PushButton RID_PA_BTN_STD
+ {
+ Pos = MAP_APPFONT( 190, 49 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "~Default";
+ };
+ PushButton RID_PA_BTN_DEL
+ {
+ Pos = MAP_APPFONT( 190, 66 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "Remo~ve...";
+ };
+ PushButton RID_PA_TESTPAGE
+ {
+ Pos = MAP_APPFONT( 190, 83 );
+ Size = MAP_APPFONT( 60, 12 );
+ Text [ en-US ] = "Test ~Page";
+ };
+
+ PushButton RID_PA_BTN_FONTS
+ {
+ Pos = MAP_APPFONT( 80, 181 );
+ Size = MAP_APPFONT( 70, 12 );
+ Text [ en-US ] = "Fon~ts...";
+ };
+ PushButton RID_PA_BTN_ADD
+ {
+ Pos = MAP_APPFONT( 5, 181 );
+ Size = MAP_APPFONT( 70, 12 );
+ Text [ en-US ] = "New Printer...";
+ };
+
+ String RID_PA_STR_DEFPRT
+ {
+ Text [ en-US ] = "Default printer";
+ };
+ String RID_PA_STR_RENAME
+ {
+ Text [ en-US ] = "Rename";
+ };
+ Text [ en-US ] = "Printer Administration";
+};
+
+ModalDialog RID_STRINGQUERYDLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 10 , 10 ) ;
+ Size = MAP_APPFONT ( 200 , 42 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ FixedText RID_STRQRY_TXT_RENAME
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 130 , 16 ) ;
+ Wordbreak=TRUE;
+ };
+ Edit RID_STRQRY_EDT_NEWNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 130 , 12 ) ;
+ };
+ ComboBox RID_STRQRY_BOX_NEWNAME
+ {
+ Border = TRUE ;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 130 , 200 ) ;
+ };
+ OKButton RID_STRQRY_BTN_OK
+ {
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 145 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ CancelButton RID_STRQRY_BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 145 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+};
+
+String RID_ERR_NOPRINTER
+{
+ Text [ en-US ] = "Could not open printer %s.";
+};
+
+String RID_PA_TXT_TESTPAGE_PRINTED
+{
+ Text [ en-US ] = "The test page was printed succesfully. Please check the result.";
+};
+
+String RID_QRY_PRTNAME
+{
+ Text [ en-US ] = "~New printer name";
+};
+
+String RID_TXT_TESTPAGE_MODEL
+{
+ Text [ en-US ] = "Model";
+};
+
+String RID_TXT_TESTPAGE_NAME
+{
+ Text [ en-US ] = "Name";
+};
+
+String RID_TXT_TESTPAGE_COMMENT
+{
+ Text [ en-US ] = "Comment";
+};
+
+String RID_TXT_TESTPAGE_QUEUE
+{
+ Text [ en-US ] = "Queue";
+};
+
+String RID_TXT_TESTPAGE_DATE
+{
+ Text [ en-US ] = "Date";
+};
+
+String RID_TXT_TESTPAGE_TIME
+{
+ Text [ en-US ] = "Time";
+};
+
+
+ModalDialog RID_FONTNAMEDIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 255 , 110 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ OKButton RID_FNTNM_BTN_OK
+ {
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 196 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Text [ en-US ] = "Close";
+ };
+ PushButton RID_FNTNM_BTN_RENAME
+ {
+ Pos = MAP_APPFONT( 196, 31 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "Re~name...";
+ };
+ PushButton RID_FNTNM_BTN_REMOVE
+ {
+ Pos = MAP_APPFONT ( 196 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Text [ en-US ] = "~Remove...";
+ };
+ PushButton RID_FNTNM_BTN_IMPORT
+ {
+ Pos = MAP_APPFONT ( 196 , 65 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Text [ en-US ] = "~Add...";
+ };
+ ListBox RID_FNTNM_LB_FONTS
+ {
+ Border = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 185 , 70 ) ;
+ };
+ FixedText RID_FNTNM_FIXED
+ {
+ Pos = MAP_APPFONT ( 6 , 81 ) ;
+ Size = MAP_APPFONT ( 175 , 24 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "Note: The fonts are only available to the applications.";
+ };
+ String RID_FNTNM_STR_RENAME
+ {
+ Text [ en-US ] = "~New name for %s";
+ };
+ String RID_FNTNM_STR_TTCRENAME
+ {
+ Text [ en-US ] = "~New name for %s (%d1 of %d2)";
+ };
+ String RID_FNTNM_STR_NOTRENAMABLE
+ {
+ Text [ en-US ] = "The font %s cannot be renamed due to missing write permission.";
+ };
+ Text [ en-US ] = "Fonts";
+};
+String RID_BXT_TESTPAGE
+{
+ Text [ en-US ] = "Test page";
+};
+String RID_BXT_ENVIRONMENT
+{
+ Text [ en-US ] = "Wrong environment";
+};
+
+String RID_YOU_SURE
+{
+ Text [ en-US ] = "Are you sure ?";
+};
+
+Bitmap RID_BUTTERFLY
+{
+ File = "butter.png" ;
+};
+
+Bitmap RID_BMP_SMALL_PRINTER
+{
+ File = "print.png";
+};
+
+Bitmap RID_BMP_SMALL_FAX
+{
+ File = "fax.png";
+};
+
+Bitmap RID_BMP_SMALL_PDF
+{
+ File = "pdf.png";
+};
+
+Bitmap RID_BMP_PRINTER
+{
+ File = "printer_large.png";
+};
+
+Bitmap RID_BMP_SMALL_PRINTER_HC
+{
+ File = "printer_16_h.png";
+};
+
+Bitmap RID_BMP_SMALL_FAX_HC
+{
+ File = "fax_16_h.png";
+};
+
+Bitmap RID_BMP_SMALL_PDF_HC
+{
+ File = "printpdf_16_h.png";
+};
+
+Bitmap RID_BMP_PRINTER_HC
+{
+ File = "printer_40x48_h.png";
+};
+
+
+String RID_AFMERROR_OK
+{
+ Text [ en-US ] = "No error";
+};
+String RID_AFMERROR_NO_FONT_NAME
+{
+ Text [ en-US ] = "The metric does not contain a 'FontName' entry.";
+};
+String RID_AFMERROR_NO_FULL_NAME
+{
+ Text [ en-US ] = "The metric does not contain a 'FullName' entry.";
+};
+String RID_AFMERROR_NO_FAMILY_NAME
+{
+ Text [ en-US ] = "The metric does not contain a 'FamilyName' entry.";
+};
+String RID_AFMERROR_MOVETO_FAILED
+{
+ Text [ en-US ] = "The converted metric could not be written.";
+};
+String RID_AFMERROR_STREAM_READ_FAILED
+{
+ Text [ en-US ] = "The metric could not be read.";
+};
+String RID_AFMERROR_STREAM_WRITE_FAILED
+{
+ Text [ en-US ] = "A temporary file could not be created.";
+};
+STRING RID_AFMERROR_NOT_A_METRIC
+{
+ Text [ en-US ] = "The file does not contain a metric.";
+};
+String RID_AFMERROR_BOX_TXT
+{
+ Text [ en-US ] = "The metric\n\n%s\n\ncould not be converted for the following reason:\n\n";
+};
+
+ModelessDialog RID_PROGRESS_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 10 , 10 ) ;
+ Size = MAP_APPFONT ( 150 , 90 ) ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ CancelButton RID_PROGRESS_BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 50 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedText RID_PROGRESS_OPERATION_TXT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 140 , 18 ) ;
+ };
+ FixedText RID_PROGRESS_PROGRESS_TXT
+ {
+ Pos = MAP_APPFONT( 6, 48 );
+ Size = MAP_APPFONT( 140, 8 );
+ Text [ en-US ] = "Progress";
+ };
+ Window RID_PROGRESS_STATUSBAR
+ {
+ SVLook = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT( 140, 8 );
+ };
+ FixedText RID_PROGRESS_FILENAME_TXT
+ {
+ Pos = MAP_APPFONT ( 6 , 28 ) ;
+ Size = MAP_APPFONT ( 140 , 8 ) ;
+ };
+ Text [ en-US ] = "Please wait";
+};
+
+String RID_OPERATION_CONVERTMETRIC
+{
+ Text [ en-US ] = "Font metrics conversion";
+};
+
+
+ModalDialog RID_PPDIMPORT_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 265 , 225 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedLine RID_PPDIMP_GROUP_PATH
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 200, 8 );
+ Text [ en-US ] = "Dri~ver directory";
+ };
+ FixedText RID_PPDIMP_TXT_PATH
+ {
+ Pos = MAP_APPFONT( 10, 33 );
+ Size = MAP_APPFONT( 190, 8 );
+ Text [ en-US ] = "Please select the driver directory.";
+ };
+ ComboBox RID_PPDIMP_LB_PATH
+ {
+ Dropdown = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+
+ Pos = MAP_APPFONT( 10, 15 );
+ Size = MAP_APPFONT( 130, 80 );
+ };
+ PushButton RID_PPDIMP_BTN_SEARCH
+ {
+ Pos = MAP_APPFONT( 145, 15 );
+ Size = MAP_APPFONT( 50, 14 );
+ Text [ en-US ] = "Browse...";
+ };
+
+ FixedLine RID_PPDIMP_GROUP_DRIVER
+ {
+ Pos = MAP_APPFONT( 5, 60 );
+ Size = MAP_APPFONT( 200, 8 );
+ Text [ en-US ] = "~Selection of drivers";
+ };
+ MultiListBox RID_PPDIMP_LB_DRIVER
+ {
+ Border = TRUE;
+ Sort = TRUE;
+ SimpleMode = TRUE;
+ AutoHScroll = TRUE;
+ Pos = MAP_APPFONT( 10, 70 );
+ Size = MAP_APPFONT( 190, 120 );
+ };
+ FixedText RID_PPDIMP_TXT_DRIVER
+ {
+ Pos = MAP_APPFONT( 10, 195 );
+ Size = MAP_APPFONT( 190, 60 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please select the drivers to install and press \"%s\".";
+ };
+ String RID_PPDIMP_STR_LOADINGPPD
+ {
+ Text [ en-US ] = "Searching for drivers";
+ };
+ OKButton RID_PPDIMP_BTN_OK
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT( 210, 10 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+ CancelButton RID_PPDIMP_BTN_CANCEL
+ {
+ Pos = MAP_APPFONT( 210, 29 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+
+ Text [ en-US ] = "Driver Installation";
+};
+
+String RID_QUERY_REMOVEDRIVER
+{
+ Text [ en-US ] = "Do you really want to remove the driver \"%s\"?";
+};
+
+String RID_QUERY_REMOVEPRINTER
+{
+ Text [ en-US ] = "Do you really want to remove this printer ?";
+};
+
+String RID_QUERY_REMOVEFONTFROMLIST
+{
+ Text [ en-US ] = "Do you really want to remove the selected fonts ?";
+};
+
+String RID_QUERY_DRIVERUSED
+{
+ Text [ en-US ] = "There are still printers using the driver \"%s\". Do you really want to remove it? The corresponding printers will also be removed.";
+};
+
+String RID_ERR_REMOVESGENPRT
+{
+ Text [ en-US ] = "The driver \"%s\" is always needed and can therefore not be removed.";
+};
+
+String RID_ERR_REMOVEDRIVERFAILED
+{
+ Text [ en-US ] = "The driver \"%s1\" could not be removed. It was not possible to remove the file\n\n%s2.";
+};
+
+String RID_ERR_REMOVEDEFAULTDRIVER
+{
+ Text [ en-US ] = "The driver \"%s\" is used by your default printer. Therefore, it cannot be removed.";
+};
+
+String RID_ERR_PRINTERNOTREMOVEABLE
+{
+ Text [ en-US ] = "The printer %s cannot be removed.";
+};
+
+String RID_TXT_PRINTERALREADYEXISTS
+{
+ Text [ en-US ] = "A printer named \"%s\" already exists. This printer will not be imported.";
+};
+
+String RID_TXT_PRINTERWITHOUTCOMMAND
+{
+ Text [ en-US ] = "The printer \"%s\" has no valid configuration and, therefore, cannot be imported.";
+};
+
+String RID_TXT_DRIVERDOESNOTEXIST
+{
+ Text [ en-US ] = "The driver for the printer \"%s1\" (%s2) is not installed. Therefore the printer cannot be imported.";
+};
+
+String RID_TXT_PRINTERADDFAILED
+{
+ Text [ en-US ] = "The printer \"%s\" could not be added.";
+};
+
+ModalDialog RID_ADD_PRINTER_DIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 240 , 172 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ Control RID_ADDP_CTRL_TITLE
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 240, 26 );
+ };
+ FixedLine RID_ADDP_LINE
+ {
+ Pos = MAP_APPFONT( 0, 150 );
+ Size = MAP_APPFONT( 240, 2 );
+ };
+ OKButton RID_ADDP_BTN_FINISH
+ {
+ Pos = MAP_APPFONT( 185, 155 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Finish";
+ };
+ CancelButton RID_ADDP_BTN_CANCEL
+ {
+ Pos = MAP_APPFONT( 5, 155 );
+ Size = MAP_APPFONT( 50, 12 );
+ };
+ PushButton RID_ADDP_BTN_NEXT
+ {
+ Pos = MAP_APPFONT( 130, 155 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Next >>";
+ };
+ PushButton RID_ADDP_BTN_PREV
+ {
+ Pos = MAP_APPFONT( 75, 155 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "<< ~Back";
+ };
+ Text [ en-US ] = "Add Printer";
+};
+
+TabPage RID_ADDP_PAGE_CHOOSEDRIVER
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a driver";
+ };
+ FixedText RID_ADDP_CHDRV_TXT_DRIVER
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 230, 8 );
+ Text [ en-US ] = "Please select a s~uitable driver.";
+ };
+ ListBox RID_ADDP_CHDRV_BOX_DRIVER
+ {
+ Pos = MAP_APPFONT( 5, 15 );
+ Size = MAP_APPFONT( 175, 100 );
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ PushButton RID_ADDP_CHDRV_BTN_ADD
+ {
+ Pos = MAP_APPFONT( 185, 15 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Import...";
+ };
+ PushButton RID_ADDP_CHDRV_BTN_REMOVE
+ {
+ Pos = MAP_APPFONT( 185, 32 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Delete";
+ };
+ String RID_ADDP_CHDRV_STR_REMOVE
+ {
+ Text [ en-US ] = "Delete driver";
+ };
+};
+
+TabPage RID_ADDP_PAGE_CHOOSEDEV
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a device type";
+ };
+ FixedText RID_ADDP_CHDEV_TXT_OVER
+ {
+ Pos = MAP_APPFONT( 40, 25 );
+ Size = MAP_APPFONT( 180, 8 );
+ Text [ en-US ] = "Do you want to";
+ };
+ RadioButton RID_ADDP_CHDEV_BTN_PRINTER
+ {
+ Pos = MAP_APPFONT ( 40, 40 );
+ Size = MAP_APPFONT( 180, 10 );
+ Text [ en-US ] = "Add a ~printer";
+ };
+ RadioButton RID_ADDP_CHDEV_BTN_FAX
+ {
+ Pos = MAP_APPFONT ( 40, 50 );
+ Size = MAP_APPFONT( 180, 10 );
+ Text [ en-US ] = "Connect a fa~x device";
+ };
+ RadioButton RID_ADDP_CHDEV_BTN_PDF
+ {
+ Pos = MAP_APPFONT ( 40, 60 );
+ Size = MAP_APPFONT( 180, 10 );
+ Text [ en-US ] = "Connect a P~DF converter";
+ };
+ RadioButton RID_ADDP_CHDEV_BTN_OLD
+ {
+ Pos = MAP_APPFONT ( 40, 70 );
+ Size = MAP_APPFONT( 180, 10 );
+ Text [ en-US ] = "~Import printers from a StarOffice installation";
+ };
+};
+
+TabPage RID_ADDP_PAGE_NAME
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a name";
+ };
+ FixedText RID_ADDP_NAME_TXT_NAME
+ {
+ Pos = MAP_APPFONT( 40, 25 );
+ Size = MAP_APPFONT( 220, 8 );
+ Text [ en-US ] = "Please enter a name for the printer.";
+ };
+ FixedText RID_ADDP_NAME_TXT_FAXNAME
+ {
+ Pos = MAP_APPFONT( 40, 25 );
+ Size = MAP_APPFONT( 220, 8 );
+ Text [ en-US ] = "Please enter a name for the fax connection.";
+ };
+ FixedText RID_ADDP_NAME_TXT_PDFNAME
+ {
+ Pos = MAP_APPFONT( 40, 25 );
+ Size = MAP_APPFONT( 220, 8 );
+ Text [ en-US ] = "Please enter a name for the PDF connection.";
+ };
+ Edit RID_ADDP_NAME_EDT_NAME
+ {
+ Pos = MAP_APPFONT( 40, 35 );
+ Size = MAP_APPFONT( 160, 12 );
+ Border = TRUE;
+ };
+ Edit RID_ADDP_NAME_EDT_FAXNAME
+ {
+ Pos = MAP_APPFONT( 40, 35 );
+ Size = MAP_APPFONT( 160, 12 );
+ Border = TRUE;
+ Text [ en-US ] = "Fax printer";
+ };
+ Edit RID_ADDP_NAME_EDT_PDFNAME
+ {
+ Pos = MAP_APPFONT( 40, 35 );
+ Size = MAP_APPFONT( 160, 12 );
+ Border = TRUE;
+ Text [ en-US ] = "PDF converter";
+ };
+ CheckBox RID_ADDP_NAME_BOX_DEFAULT
+ {
+ Pos = MAP_APPFONT( 40, 50 );
+ Size = MAP_APPFONT( 160, 12 );
+ Text [ en-US ] = "~Use as default printer";
+ };
+ CheckBox RID_ADDP_NAME_BOX_FAXSWALLOW
+ {
+ Pos = MAP_APPFONT( 40, 50 );
+ Size = MAP_APPFONT( 160, 12 );
+ Text [ en-US ] = "Remo~ve fax number from output";
+ };
+};
+
+TabPage RID_ADDP_PAGE_COMMAND
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a command line";
+ };
+ FixedText RID_ADDP_CMD_TXT_COMMAND
+ {
+ Pos = MAP_APPFONT( 10, 2 );
+ Size = MAP_APPFONT( 160, 24 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please enter a c~ommand line appropriate for this device.";
+ };
+ ComboBox RID_ADDP_CMD_BOX_COMMAND
+ {
+ Pos = MAP_APPFONT( 10, 30);
+ Size = MAP_APPFONT( 220, 85 );
+ Border = TRUE;
+ };
+ ComboBox RID_ADDP_CMD_BOX_PDFCOMMAND
+ {
+ Pos = MAP_APPFONT( 10, 30);
+ Size = MAP_APPFONT( 220, 60 );
+ Border = TRUE;
+ };
+ FixedText RID_ADDP_CMD_TXT_PDFDIR
+ {
+ Pos = MAP_APPFONT( 10, 95 );
+ Size = MAP_APPFONT( 220, 8 );
+ Text [ en-US ] = "PDF ~target directory";
+ };
+ Edit RID_ADDP_CMD_EDT_PDFDIR
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 10, 104 );
+ Size = MAP_APPFONT( 190, 12 );
+ };
+ PushButton RID_ADDP_CMD_BTN_PDFDIR
+ {
+ Pos = MAP_APPFONT( 205, 104 );
+ Size = MAP_APPFONT( 25, 12 );
+ Text = "~...";
+ };
+ PushButton RID_ADDP_CMD_BTN_HELP
+ {
+ Pos = MAP_APPFONT( 180, 2 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Help";
+ };
+ String RID_ADDP_CMD_STR_PDFHELP
+ {
+ Text [ en-US ] = "The command line for PDF converters is executed as follows: for each document printed, \"(TMP)\" in the command line is replaced by a temporary file and \"(OUTFILE)\" in the command line is replaced by the target PDF file name. If \"(TMP)\" is in the command line, the PostScript code will be supplied via a file, otherwise via standard input (i.e. as a pipe).";
+ };
+ String RID_ADDP_CMD_STR_FAXHELP
+ {
+ Text [ en-US ] = "The command line for fax connections is executed as follows: for each fax sent, \"(TMP)\" in the command line is replaced by a temporary file and \"(PHONE)\" in the command line is replaced by the fax number. If \"(TMP)\" appears in the command line, the PostScript code will be supplied via a file, otherwise it is passed as standard input (i.e. as a pipe).";
+ };
+};
+
+TabPage RID_ADDP_PAGE_OLDPRINTERS
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Import printers from old versions";
+ };
+ FixedText RID_ADDP_OLD_TXT_PRINTERS
+ {
+ Pos = MAP_APPFONT( 10, 10 );
+ Size = MAP_APPFONT( 165, 25 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "~These printers can be imported. Please select the ones you want to import.";
+ };
+ MultiListBox RID_ADDP_OLD_BOX_PRINTERS
+ {
+ Pos = MAP_APPFONT( 10, 35 );
+ Size = MAP_APPFONT( 165, 80 );
+ Border = TRUE;
+ };
+ PushButton RID_ADDP_OLD_BTN_SELECTALL
+ {
+ Pos = MAP_APPFONT( 180, 35 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Select All";
+ };
+};
+
+TabPage RID_ADDP_PAGE_FAXDRIVER
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a driver";
+ };
+ FixedText RID_ADDP_FAXDRV_TXT_DRIVER
+ {
+ Pos = MAP_APPFONT( 40, 20 );
+ Size = MAP_APPFONT( 160, 19 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Use the following driver for this fax connection";
+ };
+ RadioButton RID_ADDP_FAXDRV_BTN_DEFAULT
+ {
+ Pos = MAP_APPFONT( 40,40 );
+ Size = MAP_APPFONT( 160, 10 );
+ Text [ en-US ] = "T~he default driver";
+ };
+ RadioButton RID_ADDP_FAXDRV_BTN_SELECT
+ {
+ Pos = MAP_APPFONT( 40, 50 );
+ Size = MAP_APPFONT( 160,24 );
+ Text [ en-US ] = "A speci~fic driver, to adapt the format to another printer";
+ };
+};
+
+TabPage RID_ADDP_PAGE_PDFDRIVER
+{
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 0, 30 );
+ Size = MAP_APPFONT( 240, 120 );
+ String RID_ADDP_STR_TITLE
+ {
+ Text [ en-US ] = "Choose a driver";
+ };
+ FixedText RID_ADDP_PDFDRV_TXT_DRIVER
+ {
+ Pos = MAP_APPFONT( 40, 20 );
+ Size = MAP_APPFONT( 160, 19 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Use the following driver for this PDF converter";
+ };
+ RadioButton RID_ADDP_PDFDRV_BTN_DEFAULT
+ {
+ Pos = MAP_APPFONT( 40, 40 );
+ Size = MAP_APPFONT( 160, 10 );
+ Text [ en-US ] = "T~he default driver";
+ };
+ RadioButton RID_ADDP_PDFDRV_BTN_DIST
+ {
+ Pos = MAP_APPFONT( 40,50 );
+ Size = MAP_APPFONT( 160, 10 );
+ Text [ en-US ] = "The Adobe D~istiller(tm) driver";
+ };
+ RadioButton RID_ADDP_PDFDRV_BTN_SELECT
+ {
+ Pos = MAP_APPFONT( 40, 60 );
+ Size = MAP_APPFONT( 160, 24 );
+ Text [ en-US ] = "A spec~ific driver, to adapt the format to another printer";
+ };
+};
+
+String RID_TXT_FONT_ITALIC
+{
+ Text [ en-US ] = "Italic";
+};
+
+String RID_TXT_FONT_OBLIQUE
+{
+ Text [ en-US ] = "Oblique";
+};
+
+String RID_TXT_FONT_THIN
+{
+ Text [ en-US ] = "Thin";
+};
+
+String RID_TXT_FONT_ULTRALIGHT
+{
+ Text [ en-US ] = "Ultralight";
+};
+
+String RID_TXT_FONT_SEMILIGHT
+{
+ Text [ en-US ] = "Semilight";
+};
+
+String RID_TXT_FONT_LIGHT
+{
+ Text [ en-US ] = "Light";
+};
+
+String RID_TXT_FONT_SEMIBOLD
+{
+ Text [ en-US ] = "Semibold";
+};
+
+String RID_TXT_FONT_BOLD
+{
+ Text [ en-US ] = "Bold";
+};
+
+String RID_TXT_FONT_ULTRABOLD
+{
+ Text [ en-US ] = "Ultrabold";
+};
+
+String RID_TXT_FONT_ULTRACONDENSED
+{
+ Text [ en-US ] = "Ultracondensed";
+};
+
+String RID_TXT_FONT_EXTRACONDENSED
+{
+ Text [ en-US ] = "Extracondensed";
+};
+
+String RID_TXT_FONT_CONDENSED
+{
+ Text [ en-US ] = "Condensed";
+};
+
+String RID_TXT_FONT_SEMICONDENSED
+{
+ Text [ en-US ] = "Semicondensed";
+};
+
+String RID_TXT_FONT_SEMIEXPANDED
+{
+ Text [ en-US ] = "Semiexpanded";
+};
+
+String RID_TXT_FONT_EXPANDED
+{
+ Text [ en-US ] = "Expanded";
+};
+
+String RID_TXT_FONT_EXTRAEXPANDED
+{
+ Text [ en-US ] = "Extraexpanded";
+};
+
+String RID_TXT_FONT_ULTRAEXPANDED
+{
+ Text [ en-US ] = "Ultraexpanded";
+};
+
+String RID_TXT_FONT_REGULAR
+{
+ Text [ en-US ] = "Regular";
+};
+
+
diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx
new file mode 100644
index 000000000000..f46a2c8a3149
--- /dev/null
+++ b/padmin/source/pamain.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include "tools/testtoolloader.hxx"
+
+#include "vcl/svapp.hxx"
+#include "vcl/wrkwin.hxx"
+#include "vcl/unowrap.hxx"
+
+#include "padialog.hxx"
+#include "helper.hxx"
+#include "desktopcontext.hxx"
+
+#include "cppuhelper/bootstrap.hxx"
+#include "comphelper/processfactory.hxx"
+#include "ucbhelper/contentbroker.hxx"
+#include "ucbhelper/configurationkeys.hxx"
+#include "unotools/configmgr.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+
+using namespace padmin;
+using namespace rtl;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace comphelper;
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+ virtual USHORT Exception( USHORT nError );
+
+ static void ReadStringHook( String& );
+};
+
+MyApp aMyApp;
+
+void MyApp::ReadStringHook( String& rStr )
+{
+ static String maProduct;
+ if( ! maProduct.Len() )
+ {
+ Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME );
+ OUString aProd;
+ aRet >>= aProd;
+ maProduct = String( aProd );
+ }
+ rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", maProduct );
+};
+
+
+// -----------------------------------------------------------------------
+
+USHORT MyApp::Exception( USHORT nError )
+{
+ switch( nError & EXC_MAJORTYPE )
+ {
+ case EXC_RSCNOTLOADED:
+ Abort( String::CreateFromAscii( "Error: could not load language resources.\nPlease check your installation.\n" ) );
+ break;
+ }
+ return 0;
+}
+
+void MyApp::Main()
+{
+ PADialog* pPADialog;
+
+ EnableAutoHelpId();
+
+ //-------------------------------------------------
+ // create the global service-manager
+ //-------------------------------------------------
+ Reference< XMultiServiceFactory > xFactory;
+ try
+ {
+ Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
+ xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(), UNO_QUERY );
+ if( xFactory.is() )
+ setProcessServiceFactory( xFactory );
+ }
+ catch( com::sun::star::uno::Exception& rExc)
+ {
+ }
+
+ if( ! xFactory.is() )
+ {
+ fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
+ exit( 1 );
+ }
+
+ // Detect desktop environment - need to do this as early as possible
+ com::sun::star::uno::setCurrentContext(
+ new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
+
+ /*
+ * Create UCB.
+ */
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+ aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+#if OSL_DEBUG_LEVEL > 1
+ sal_Bool bSuccess =
+#endif
+ ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+
+#if OSL_DEBUG_LEVEL > 1
+ if ( !bSuccess )
+ {
+ fprintf( stderr, "Error creating UCB, installation must be in disorder. Exiting.\n" );
+ exit( 1 );
+ }
+#endif
+
+ /*
+ * Initialize the Java UNO AccessBridge if accessibility is turned on
+ */
+
+ if( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() )
+ {
+ BOOL bQuitApp;
+ if( !InitAccessBridge( true, bQuitApp ) )
+ if( bQuitApp )
+ return;
+ }
+
+ // initialize test-tool library (if available)
+ tools::InitTestToolLib();
+
+ ResMgr::SetReadStringHook( MyApp::ReadStringHook );
+
+ pPADialog = PADialog::Create( NULL , FALSE );
+ Application::SetDisplayName( pPADialog->GetText() );
+ pPADialog->SetIcon(501);
+ pPADialog->Execute();
+ delete pPADialog;
+
+ tools::DeInitTestToolLib();
+
+ /*
+ * clean up UCB
+ */
+ ::ucbhelper::ContentBroker::deinitialize();
+
+}
diff --git a/padmin/source/progress.cxx b/padmin/source/progress.cxx
new file mode 100644
index 000000000000..03ef67db8da9
--- /dev/null
+++ b/padmin/source/progress.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <progress.hxx>
+#include <helper.hxx>
+#ifndef _PAD_PADIALOG_HRC_
+#include <padialog.hrc>
+#endif
+
+using namespace padmin;
+
+ProgressDialog::ProgressDialog( Window* pParent,
+ BOOL bCancelable,
+ int nMin, int nMax ) :
+ ModelessDialog( pParent, PaResId( RID_PROGRESS_DLG ) ),
+ maOperation( this, PaResId( RID_PROGRESS_OPERATION_TXT ) ),
+ maFilename( this, PaResId( RID_PROGRESS_FILENAME_TXT ) ),
+ maProgressTxt( this, PaResId( RID_PROGRESS_PROGRESS_TXT ) ),
+ maCancelButton( this, PaResId( RID_PROGRESS_BTN_CANCEL ) ),
+ maProgressBar( this, PaResId( RID_PROGRESS_STATUSBAR ) ),
+ mnMax( nMax ),
+ mnMin( nMin ),
+ mbCanceled( FALSE )
+{
+ maFilename.SetStyle( maFilename.GetStyle() | WB_PATHELLIPSIS );
+ if( ! bCancelable )
+ {
+ Point aPos = maProgressBar.GetPosPixel();
+ Size aSize = maProgressBar.GetSizePixel();
+ Size aMySize = GetOutputSizePixel();
+ aMySize.Height() = aPos.Y() + aSize.Height() + 5;
+ SetOutputSizePixel( aMySize );
+ }
+ else
+ maCancelButton.SetClickHdl( LINK( this, ProgressDialog, ClickBtnHdl ) );
+ FreeResource();
+}
+
+ProgressDialog::~ProgressDialog()
+{
+}
+
+void ProgressDialog::startOperation( const String& rOperation )
+{
+ maOperation.SetText( rOperation );
+ maProgressBar.SetValue( 0 );
+ mbCanceled = FALSE;
+ if( ! IsVisible() )
+ Show( TRUE );
+}
+
+void ProgressDialog::setValue( int nValue )
+{
+ maProgressBar.SetValue( nValue * 100 / ( mnMax - mnMin ) );
+ Application::Reschedule();
+}
+
+void ProgressDialog::setFilename( const String& rFilename )
+{
+ maFilename.SetText( rFilename );
+ maFilename.Update();
+ Flush();
+}
+
+IMPL_LINK( ProgressDialog, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == &maCancelButton )
+ {
+ mbCanceled = TRUE;
+ }
+ return 0;
+}
diff --git a/padmin/source/progress.hxx b/padmin/source/progress.hxx
new file mode 100644
index 000000000000..552a049c3572
--- /dev/null
+++ b/padmin/source/progress.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_PROGRESS_HXX_
+#define _PAD_PROGRESS_HXX_
+
+#include "vcl/dialog.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/button.hxx"
+
+#include "svtools/prgsbar.hxx"
+
+namespace padmin {
+
+ class ProgressDialog : public ModelessDialog
+ {
+ FixedText maOperation;
+ FixedText maFilename;
+ FixedText maProgressTxt;
+ CancelButton maCancelButton;
+ ProgressBar maProgressBar;
+
+ int mnMax, mnMin;
+ BOOL mbCanceled;
+
+ public:
+ ProgressDialog( Window*, BOOL bCancelable = TRUE, int nMin = 0, int nMax = 100 );
+ ~ProgressDialog();
+
+ DECL_LINK( ClickBtnHdl, Button* );
+
+ void setValue( int nValue );
+ void setRange( int nMin, int nMax ) { mnMin = nMin; mnMax = nMax; }
+ void startOperation( const String& );
+ void setFilename( const String& );
+
+ BOOL isCanceled() { return mbCanceled; }
+ };
+
+} // namespace
+
+#endif
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
new file mode 100644
index 000000000000..17d28515e540
--- /dev/null
+++ b/padmin/source/prtsetup.cxx
@@ -0,0 +1,817 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "prtsetup.hxx"
+#include "helper.hxx" // for PaResId
+#include "rtsetup.hrc"
+#include "cmddlg.hxx"
+
+#include "vcl/fontmanager.hxx"
+
+#include "osl/thread.h"
+
+#define LSCAPE_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Landscape" ) )
+#define PORTRAIT_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Portrait" ) )
+
+using namespace rtl;
+using namespace psp;
+using namespace padmin;
+
+void RTSDialog::insertAllPPDValues( ListBox& rBox, const PPDParser* pParser, const PPDKey* pKey )
+{
+ if( ! pKey || ! pParser )
+ return;
+
+ const PPDValue* pValue = NULL;
+ USHORT nPos = 0;
+ String aOptionText;
+
+ for( int i = 0; i < pKey->countValues(); i++ )
+ {
+ pValue = pKey->getValue( i );
+ aOptionText = pParser->translateOption( pKey->getKey(), pValue->m_aOption) ;
+
+ if( m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
+ {
+ if( rBox.GetEntryPos( (void*)pValue ) == LISTBOX_ENTRY_NOTFOUND )
+ {
+ nPos = rBox.InsertEntry( aOptionText, LISTBOX_APPEND );
+ rBox.SetEntryData( nPos, (void*)pValue );
+ }
+ }
+ else
+ {
+ if( ( nPos = rBox.GetEntryPos( (void*)pValue ) ) != LISTBOX_ENTRY_NOTFOUND )
+ rBox.RemoveEntry( nPos );
+ }
+ }
+ pValue = m_aJobData.m_aContext.getValue( pKey );
+ if( pValue )
+ {
+ if( ( nPos = rBox.GetEntryPos( (void*)pValue ) ) != LISTBOX_ENTRY_NOTFOUND )
+ rBox.SelectEntryPos( nPos );
+ }
+ else
+ rBox.SelectEntry( m_aInvalidString );
+}
+
+// --------------------------------------------------------------------------
+
+/*
+ * RTSDialog
+ */
+
+RTSDialog::RTSDialog( const PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent ) :
+ TabDialog( pParent, PaResId( RID_RTS_RTSDIALOG ) ),
+ m_aJobData( rJobData ),
+ m_aPrinter( rPrinter ),
+ m_aTabControl( this, PaResId( RID_RTS_RTSDIALOG_TABCONTROL ) ),
+ m_aOKButton( this ),
+ m_aCancelButton( this ),
+ m_pPaperPage( NULL ),
+ m_pDevicePage( NULL ),
+ 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 ) )
+{
+ FreeResource();
+
+ String aTitle( GetText() );
+ aTitle.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), m_aJobData.m_aPrinterName );
+ SetText( aTitle );
+
+ if( ! bAllPages )
+ {
+ m_aTabControl.RemovePage( RID_RTS_OTHERPAGE );
+ m_aTabControl.RemovePage( RID_RTS_FONTSUBSTPAGE );
+ m_aTabControl.RemovePage( RID_RTS_COMMANDPAGE );
+ }
+ else if( m_aJobData.m_aDriverName.compareToAscii( "CUPS:", 5 ) == 0 && ! PrinterInfoManager::get().isCUPSDisabled() )
+ {
+ // command page makes no sense for CUPS printers
+ m_aTabControl.RemovePage( RID_RTS_COMMANDPAGE );
+ }
+
+ m_aTabControl.SetActivatePageHdl( LINK( this, RTSDialog, ActivatePage ) );
+ m_aOKButton.SetClickHdl( LINK( this, RTSDialog, ClickButton ) );
+ m_aCancelButton.SetClickHdl( LINK( this, RTSDialog, ClickButton ) );
+ ActivatePage( &m_aTabControl );
+
+ m_aOKButton.Show();
+ m_aCancelButton.Show();
+}
+
+// --------------------------------------------------------------------------
+
+RTSDialog::~RTSDialog()
+{
+ if( m_pPaperPage )
+ delete m_pPaperPage;
+ if( m_pDevicePage )
+ delete m_pDevicePage;
+ if( m_pOtherPage )
+ delete m_pOtherPage;
+ if( m_pFontSubstPage )
+ delete m_pFontSubstPage;
+ if( m_pCommandPage )
+ delete m_pCommandPage;
+}
+
+// --------------------------------------------------------------------------
+
+IMPL_LINK( RTSDialog, ActivatePage, TabControl*, pTabCtrl )
+{
+ if( pTabCtrl != &m_aTabControl )
+ return 0;
+
+ USHORT nId = m_aTabControl.GetCurPageId();
+
+ if ( ! m_aTabControl.GetTabPage( nId ) )
+ {
+ TabPage *pPage = NULL;
+ if( nId == RID_RTS_PAPERPAGE )
+ pPage = m_pPaperPage = new RTSPaperPage( this );
+ else if( nId == RID_RTS_DEVICEPAGE )
+ pPage = m_pDevicePage = new RTSDevicePage( this );
+ else if( nId == RID_RTS_OTHERPAGE )
+ pPage = m_pOtherPage = new RTSOtherPage( this );
+ else if( nId == RID_RTS_FONTSUBSTPAGE )
+ pPage = m_pFontSubstPage = new RTSFontSubstPage( this );
+ else if( nId == RID_RTS_COMMANDPAGE )
+ pPage = m_pCommandPage = new RTSCommandPage( this );
+ if( pPage )
+ m_aTabControl.SetTabPage( nId, pPage );
+ }
+ else
+ {
+ switch( nId )
+ {
+ case RID_RTS_PAPERPAGE: m_pPaperPage->update();break;
+ case RID_RTS_DEVICEPAGE: m_pDevicePage->update();break;
+ default: break;
+ }
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+IMPL_LINK( RTSDialog, ClickButton, Button*, pButton )
+{
+ if( pButton == &m_aOKButton )
+ {
+ // refresh the changed values
+ if( m_pPaperPage )
+ {
+ // orientation
+ m_aJobData.m_eOrientation = m_pPaperPage->getOrientation().Equals( LSCAPE_STRING ) ? orientation::Landscape : orientation::Portrait;
+ }
+ if( m_pDevicePage )
+ {
+ m_aJobData.m_nColorDepth = m_pDevicePage->getDepth();
+ m_aJobData.m_nColorDevice = m_pDevicePage->getColorDevice();
+ m_aJobData.m_nPSLevel = m_pDevicePage->getLevel();
+ }
+ if( m_pOtherPage )
+ // write other settings
+ m_pOtherPage->save();
+ if( m_pCommandPage )
+ // write command settings
+ m_pCommandPage->save();
+
+ EndDialog( 1 );
+ }
+ else if( pButton == &m_aCancelButton )
+ EndDialog( 0 );
+
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+/*
+ * 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 ) )
+{
+ 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 ) );
+
+ FreeResource();
+
+ USHORT 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 );
+
+ // paper does not have an invalid entry
+
+ // input slots
+ nPos = m_aSlotBox.InsertEntry( m_pParent->m_aInvalidString );
+ m_aSlotBox.SetEntryData( nPos, NULL );
+
+ update();
+}
+
+// --------------------------------------------------------------------------
+
+RTSPaperPage::~RTSPaperPage()
+{
+}
+
+// --------------------------------------------------------------------------
+
+void RTSPaperPage::update()
+{
+ const PPDKey* pKey = NULL;
+
+ // orientation
+ m_aOrientBox.SelectEntry(
+ m_pParent->m_aJobData.m_eOrientation == orientation::Landscape
+ ? LSCAPE_STRING : PORTRAIT_STRING );
+
+ // 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 );
+ }
+ else
+ {
+ m_aDuplexText.Enable( FALSE );
+ m_aDuplexBox.Enable( 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 );
+ }
+ else
+ {
+ m_aPaperText.Enable( FALSE );
+ m_aPaperBox.Enable( FALSE );
+ }
+
+ // input slots
+ if( m_pParent->m_aJobData.m_pParser &&
+ (pKey = m_pParent->m_aJobData.m_pParser->getKey( String::CreateFromAscii( "InputSlot" ) )) )
+ {
+ m_pParent->insertAllPPDValues( m_aSlotBox, m_pParent->m_aJobData.m_pParser, pKey );
+ }
+ else
+ {
+ m_aSlotText.Enable( FALSE );
+ m_aSlotBox.Enable( FALSE );
+ }
+}
+
+// --------------------------------------------------------------------------
+
+IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
+{
+ const PPDKey* pKey = NULL;
+ if( pBox == &m_aPaperBox )
+ {
+ 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 )
+ {
+ 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 )
+ {
+ 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 )
+ {
+ m_pParent->m_aJobData.m_eOrientation = m_aOrientBox.GetSelectEntry().Equals( LSCAPE_STRING ) ? orientation::Landscape : orientation::Portrait;
+ }
+ if( pKey )
+ {
+ PPDValue* pValue =
+ (PPDValue*)pBox->GetEntryData( pBox->GetSelectEntryPos() );
+ m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
+ update();
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+/*
+ * RTSDevicePage
+ */
+
+RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
+ TabPage( & pParent->m_aTabControl, PaResId( RID_RTS_DEVICEPAGE ) ),
+
+ m_pParent( pParent ),
+
+ 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_LEVEL_TXT ) ),
+ m_aLevelBox( this, PaResId( RID_RTS_DEVICE_LEVEL_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();
+
+ m_aPPDKeyBox.SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
+ m_aPPDValueBox.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;
+ }
+
+ m_aLevelBox.InsertEntry( m_pParent->m_aFromDriverString );
+ m_aLevelBox.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( "1" ) ) );
+ m_aLevelBox.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( "2" ) ) );
+ if( m_pParent->m_aJobData.m_nPSLevel == 0 )
+ m_aLevelBox.SelectEntry( m_pParent->m_aFromDriverString );
+ else
+ m_aLevelBox.SelectEntry( String::CreateFromInt32( m_pParent->m_aJobData.m_nPSLevel ) );
+
+ m_aDepthBox.SelectEntry( String::CreateFromInt32( m_pParent->m_aJobData.m_nColorDepth ).AppendAscii( " Bit" ) );
+
+ // fill ppd boxes
+ if( m_pParent->m_aJobData.m_pParser )
+ {
+ for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
+ {
+ const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
+ if( pKey->isUIKey() &&
+ ! pKey->getKey().EqualsAscii( "PageSize" ) &&
+ ! pKey->getKey().EqualsAscii( "InputSlot" ) &&
+ ! pKey->getKey().EqualsAscii( "PageRegion" ) &&
+ ! pKey->getKey().EqualsAscii( "Duplex" )
+ )
+ {
+ String aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
+ USHORT nPos = m_aPPDKeyBox.InsertEntry( aEntry );
+ m_aPPDKeyBox.SetEntryData( nPos, (void*)pKey );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+
+RTSDevicePage::~RTSDevicePage()
+{
+}
+
+// --------------------------------------------------------------------------
+
+void RTSDevicePage::update()
+{
+}
+
+// ------------------------------------------------------------------
+
+IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aPPDKeyBox )
+ {
+ const PPDKey* pKey = (PPDKey*)m_aPPDKeyBox.GetEntryData( m_aPPDKeyBox.GetSelectEntryPos() );
+ FillValueBox( pKey );
+ }
+ else if( pBox == &m_aPPDValueBox )
+ {
+ const PPDKey* pKey = (PPDKey*)m_aPPDKeyBox.GetEntryData( m_aPPDKeyBox.GetSelectEntryPos() );
+ const PPDValue* pValue = (PPDValue*)m_aPPDValueBox.GetEntryData( m_aPPDValueBox.GetSelectEntryPos() );
+ if( pKey && pValue )
+ {
+ m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
+ FillValueBox( pKey );
+ }
+ }
+ return 0;
+}
+
+// ------------------------------------------------------------------
+
+void RTSDevicePage::FillValueBox( const PPDKey* pKey )
+{
+ m_aPPDValueBox.Clear();
+
+ if( ! pKey )
+ return;
+
+ const PPDValue* pValue = NULL;
+ for( int i = 0; i < pKey->countValues(); i++ )
+ {
+ pValue = pKey->getValue( i );
+ if( m_pParent->m_aJobData.m_aContext.checkConstraints( pKey, pValue ) &&
+ m_pParent->m_aJobData.m_pParser )
+ {
+ String aEntry( m_pParent->m_aJobData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ) );
+ USHORT nPos = m_aPPDValueBox.InsertEntry( aEntry );
+ m_aPPDValueBox.SetEntryData( nPos, (void*)pValue );
+ }
+ }
+ pValue = m_pParent->m_aJobData.m_aContext.getValue( pKey );
+ m_aPPDValueBox.SelectEntryPos( m_aPPDValueBox.GetEntryPos( (void*)pValue ) );
+}
+
+// --------------------------------------------------------------------------
+
+/*
+ * RTSOtherPage
+ */
+
+RTSOtherPage::RTSOtherPage( RTSDialog* pParent ) :
+ TabPage( &pParent->m_aTabControl, PaResId( RID_RTS_OTHERPAGE ) ),
+ m_pParent( pParent ),
+ m_aLeftTxt( this, PaResId( RID_RTS_OTHER_LEFTMARGIN_TXT ) ),
+ m_aLeftLB( this, PaResId( RID_RTS_OTHER_LEFTMARGIN_BOX ) ),
+ m_aTopTxt( this, PaResId( RID_RTS_OTHER_TOPMARGIN_TXT ) ),
+ m_aTopLB( this, PaResId( RID_RTS_OTHER_TOPMARGIN_BOX ) ),
+ m_aRightTxt( this, PaResId( RID_RTS_OTHER_RIGHTMARGIN_TXT ) ),
+ m_aRightLB( this, PaResId( RID_RTS_OTHER_RIGHTMARGIN_BOX ) ),
+ m_aBottomTxt( this, PaResId( RID_RTS_OTHER_BOTTOMMARGIN_TXT ) ),
+ m_aBottomLB( this, PaResId( RID_RTS_OTHER_BOTTOMMARGIN_BOX ) ),
+ m_aCommentTxt( this, PaResId( RID_RTS_OTHER_COMMENT_TXT ) ),
+ m_aCommentEdt( this, PaResId( RID_RTS_OTHER_COMMENT_EDT ) ),
+ m_aDefaultBtn( this, PaResId( RID_RTS_OTHER_DEFAULT_BTN ) )
+{
+ FreeResource();
+
+ m_aTopLB.EnableEmptyFieldValue( TRUE );
+ m_aBottomLB.EnableEmptyFieldValue( TRUE );
+ m_aLeftLB.EnableEmptyFieldValue( TRUE );
+ m_aRightLB.EnableEmptyFieldValue( TRUE );
+
+ m_aDefaultBtn.SetClickHdl( LINK( this, RTSOtherPage, ClickBtnHdl ) );
+
+ initValues();
+}
+
+// ------------------------------------------------------------------
+
+RTSOtherPage::~RTSOtherPage()
+{
+}
+
+// ------------------------------------------------------------------
+
+void RTSOtherPage::initValues()
+{
+ int nMarginLeft = 0;
+ int nMarginTop = 0;
+ int nMarginRight = 0;
+ int nMarginBottom = 0;
+
+ if( m_pParent->m_aJobData.m_pParser )
+ {
+ m_pParent->m_aJobData.m_pParser->
+ getMargins( m_pParent->m_aJobData.m_pParser->getDefaultPaperDimension(),
+ nMarginLeft,
+ nMarginRight,
+ nMarginTop,
+ nMarginBottom );
+ }
+
+ nMarginLeft += m_pParent->m_aJobData.m_nLeftMarginAdjust;
+ nMarginRight += m_pParent->m_aJobData.m_nRightMarginAdjust;
+ nMarginTop += m_pParent->m_aJobData.m_nTopMarginAdjust;
+ nMarginBottom += m_pParent->m_aJobData.m_nBottomMarginAdjust;
+
+ m_aLeftLB.SetValue( nMarginLeft, FUNIT_POINT );
+ m_aRightLB.SetValue( nMarginRight, FUNIT_POINT );
+ m_aTopLB.SetValue( nMarginTop, FUNIT_POINT );
+ m_aBottomLB.SetValue( nMarginBottom, FUNIT_POINT );
+ m_aCommentEdt.SetText( m_pParent->m_aJobData.m_aComment );
+}
+
+// ------------------------------------------------------------------
+
+void RTSOtherPage::save()
+{
+ int nMarginLeft = 0;
+ int nMarginTop = 0;
+ int nMarginRight = 0;
+ int nMarginBottom = 0;
+
+ if( m_pParent->m_aJobData.m_pParser )
+ {
+ m_pParent->m_aJobData.m_pParser->
+ getMargins( m_pParent->m_aJobData.m_pParser->getDefaultPaperDimension(),
+ nMarginLeft,
+ nMarginRight,
+ nMarginTop,
+ nMarginBottom );
+ }
+
+ m_pParent->m_aJobData.m_nLeftMarginAdjust = m_aLeftLB.GetValue( FUNIT_POINT ) - nMarginLeft;
+ m_pParent->m_aJobData.m_nRightMarginAdjust = m_aRightLB.GetValue( FUNIT_POINT ) - nMarginRight;
+ m_pParent->m_aJobData.m_nTopMarginAdjust = m_aTopLB.GetValue( FUNIT_POINT ) - nMarginTop;
+ m_pParent->m_aJobData.m_nBottomMarginAdjust = m_aBottomLB.GetValue( FUNIT_POINT ) - nMarginBottom;
+ m_pParent->m_aJobData.m_aComment = m_aCommentEdt.GetText();
+}
+
+// ------------------------------------------------------------------
+
+IMPL_LINK( RTSOtherPage, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == &m_aDefaultBtn )
+ {
+ m_pParent->m_aJobData.m_nLeftMarginAdjust =
+ m_pParent->m_aJobData.m_nRightMarginAdjust =
+ m_pParent->m_aJobData.m_nTopMarginAdjust =
+ m_pParent->m_aJobData.m_nBottomMarginAdjust = 0;
+
+ initValues();
+ }
+ return 0;
+}
+
+// ------------------------------------------------------------------
+
+/*
+ * RTSFontSubstPage
+ */
+
+RTSFontSubstPage::RTSFontSubstPage( RTSDialog* pParent ) :
+ TabPage( &pParent->m_aTabControl, PaResId( RID_RTS_FONTSUBSTPAGE ) ),
+ m_pParent( pParent ),
+ m_aSubstitutionsText( this, PaResId( RID_RTS_FS_SUBST_TXT ) ),
+ m_aSubstitutionsBox( this, PaResId( RID_RTS_FS_SUBST_BOX ) ),
+ m_aFromFontText( this, PaResId( RID_RTS_FS_FROM_TXT ) ),
+ m_aFromFontBox( this, PaResId( RID_RTS_FS_FROM_BOX ) ),
+ m_aToFontText( this, PaResId( RID_RTS_FS_TO_TXT ) ),
+ m_aToFontBox( this, PaResId( RID_RTS_FS_TO_BOX ) ),
+ m_aAddButton( this, PaResId( RID_RTS_FS_ADD_BTN ) ),
+ m_aRemoveButton( this, PaResId( RID_RTS_FS_REMOVE_BTN ) ),
+ m_aEnableBox( this, PaResId( RID_RTS_FS_ENABLE_BTN ) )
+{
+ FreeResource();
+
+ // fill to box
+ PrintFontManager& rFontManager = PrintFontManager::get();
+ ::std::list< FastPrintFontInfo > aFonts;
+ rFontManager.getFontListWithFastInfo( aFonts, m_pParent->m_aJobData.m_pParser, false );
+ ::std::list< FastPrintFontInfo >::const_iterator it;
+ ::std::hash_map< OUString, int, OUStringHash > aToMap, aFromMap;
+ for( it = aFonts.begin(); it != aFonts.end(); ++it )
+ {
+ if( it->m_eType == fonttype::Builtin )
+ {
+ if( aToMap.find( it->m_aFamilyName ) == aToMap.end() )
+ {
+ m_aToFontBox.InsertEntry( it->m_aFamilyName );
+ aToMap[ it->m_aFamilyName ] = 1;
+ }
+ }
+ else
+ {
+ if( aFromMap.find( it->m_aFamilyName ) == aFromMap.end() )
+ {
+ m_aFromFontBox.InsertEntry( it->m_aFamilyName );
+ aFromMap[ it->m_aFamilyName ] = 1;
+ }
+ }
+ }
+
+ m_aEnableBox.Check( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aRemoveButton.Enable( FALSE );
+ if( ! m_pParent->m_aJobData.m_bPerformFontSubstitution )
+ {
+ m_aSubstitutionsBox.Enable( FALSE );
+ m_aSubstitutionsText.Enable( FALSE );
+ m_aAddButton.Enable( FALSE );
+ m_aToFontBox.Enable( FALSE );
+ m_aToFontText.Enable( FALSE );
+ m_aFromFontBox.Enable( FALSE );
+ m_aFromFontText.Enable( FALSE );
+ }
+
+ update();
+
+ m_aAddButton.SetClickHdl( LINK( this, RTSFontSubstPage, ClickBtnHdl ) );
+ m_aRemoveButton.SetClickHdl( LINK( this, RTSFontSubstPage, ClickBtnHdl ) );
+ m_aEnableBox.SetClickHdl( LINK( this, RTSFontSubstPage, ClickBtnHdl ) );
+ m_aSubstitutionsBox.SetSelectHdl( LINK( this, RTSFontSubstPage, SelectHdl ) );
+ m_aSubstitutionsBox.setDelPressedLink( LINK( this, RTSFontSubstPage, DelPressedHdl ) );
+}
+
+RTSFontSubstPage::~RTSFontSubstPage()
+{
+}
+
+void RTSFontSubstPage::update()
+{
+ m_aSubstitutionsBox.Clear();
+ m_aRemoveButton.Enable( FALSE );
+ // fill substitutions box
+ ::std::hash_map< OUString, OUString, OUStringHash >::const_iterator it;
+ for( it = m_pParent->m_aJobData.m_aFontSubstitutes.begin();
+ it != m_pParent->m_aJobData.m_aFontSubstitutes.end(); ++it )
+ {
+ String aEntry( it->first );
+ aEntry.AppendAscii( " -> " );
+ aEntry.Append( String( it->second ) );
+ m_aSubstitutionsBox.InsertEntry( aEntry );
+ }
+}
+
+IMPL_LINK( RTSFontSubstPage, DelPressedHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aSubstitutionsBox &&
+ m_aRemoveButton.IsEnabled() )
+ ClickBtnHdl( &m_aRemoveButton );
+ return 0;
+}
+
+IMPL_LINK( RTSFontSubstPage, SelectHdl, ListBox*, pBox )
+{
+ if( pBox == &m_aSubstitutionsBox )
+ {
+ m_aRemoveButton.Enable( m_aSubstitutionsBox.GetSelectEntryCount() && m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ }
+ return 0;
+}
+
+IMPL_LINK( RTSFontSubstPage, ClickBtnHdl, Button*, pButton )
+{
+ if( pButton == &m_aAddButton )
+ {
+ m_pParent->m_aJobData.m_aFontSubstitutes[ m_aFromFontBox.GetText() ] = m_aToFontBox.GetSelectEntry();
+ update();
+ }
+ else if( pButton == &m_aRemoveButton )
+ {
+ for( int i = 0; i < m_aSubstitutionsBox.GetSelectEntryCount(); i++ )
+ {
+ String aEntry( m_aSubstitutionsBox.GetSelectEntry( i ) );
+ USHORT nPos = aEntry.SearchAscii( " -> " );
+ aEntry.Erase( nPos );
+ m_pParent->m_aJobData.m_aFontSubstitutes.erase( aEntry );
+ }
+ update();
+ }
+ else if( pButton == &m_aEnableBox )
+ {
+ m_pParent->m_aJobData.m_bPerformFontSubstitution = m_aEnableBox.IsChecked() ? true : false;
+ m_aSubstitutionsBox.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aSubstitutionsText.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aAddButton.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aRemoveButton.Enable( m_aSubstitutionsBox.GetSelectEntryCount() && m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aToFontBox.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aToFontText.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aFromFontBox.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ m_aFromFontText.Enable( m_pParent->m_aJobData.m_bPerformFontSubstitution );
+ }
+ return 0;
+}
+
+
+class RTSPWDialog : public ModalDialog
+{
+ FixedText m_aText;
+ FixedText m_aUserText;
+ Edit m_aUserEdit;
+ FixedText m_aPassText;
+ Edit m_aPassEdit;
+
+ OKButton m_aOKButton;
+ CancelButton m_aCancelButton;
+public:
+ RTSPWDialog( const OString& rServer, const OString& rUserName, Window* pParent );
+ ~RTSPWDialog();
+
+ OString getUserName() const;
+ OString getPassword() const;
+};
+
+RTSPWDialog::RTSPWDialog( const OString& rServer, const OString& rUserName, Window* pParent )
+ :
+ ModalDialog( pParent, PaResId( RID_RTS_PWDIALOG ) ),
+ m_aText( this, PaResId( RID_RTS_PWDIALOG_TXT ) ),
+ m_aUserText( this, PaResId( RID_RTS_PWDIALOG_USER_TXT ) ),
+ m_aUserEdit( this, PaResId( RID_RTS_PWDIALOG_USER_EDT ) ),
+ m_aPassText( this, PaResId( RID_RTS_PWDIALOG_PASS_TXT ) ),
+ m_aPassEdit( this, PaResId( RID_RTS_PWDIALOG_PASS_EDT ) ),
+ m_aOKButton( this, PaResId( RID_RTS_PWDIALOG_OK_BTN ) ),
+ m_aCancelButton( this, PaResId( RID_RTS_PWDIALOG_CANCEL_BTN ) )
+{
+ FreeResource();
+ String aText( m_aText.GetText() );
+ aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), OStringToOUString( rServer, osl_getThreadTextEncoding() ) );
+ m_aText.SetText( aText );
+ m_aUserEdit.SetText( OStringToOUString( rUserName, osl_getThreadTextEncoding() ) );
+}
+
+RTSPWDialog::~RTSPWDialog()
+{
+}
+
+OString RTSPWDialog::getUserName() const
+{
+ return rtl::OUStringToOString( m_aUserEdit.GetText(), osl_getThreadTextEncoding() );
+}
+
+OString RTSPWDialog::getPassword() const
+{
+ return rtl::OUStringToOString( m_aPassEdit.GetText(), osl_getThreadTextEncoding() );
+}
+
+extern "C" {
+
+ int Sal_SetupPrinterDriver( ::psp::PrinterInfo& rJobData )
+ {
+ int nRet = 0;
+ RTSDialog aDialog( rJobData, rJobData.m_aPrinterName, false );
+
+ if( aDialog.Execute() )
+ {
+ rJobData = aDialog.getSetup();
+ nRet = 1;
+ }
+
+ return nRet;
+ }
+
+ int Sal_queryFaxNumber( String& rNumber )
+ {
+ String aTmpString( PaResId( RID_TXT_QUERYFAXNUMBER ) );
+ QueryString aQuery( NULL, aTmpString, rNumber );
+ return aQuery.Execute();
+ }
+
+ bool Sal_authenticateQuery( const OString& rServer, OString& rUserName, OString& rPassword )
+ {
+ bool bRet = false;
+
+ RTSPWDialog aDialog( rServer, rUserName, NULL );
+ if( aDialog.Execute() )
+ {
+ rUserName = aDialog.getUserName();
+ rPassword = aDialog.getPassword();
+ bRet = true;
+ }
+ return bRet;
+ }
+
+} // extern "C"
diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx
new file mode 100644
index 000000000000..65288f738482
--- /dev/null
+++ b/padmin/source/prtsetup.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_PRTSETUP_HXX_
+#define _PAD_PRTSETUP_HXX_
+
+#include "helper.hxx"
+
+#include "tools/link.hxx"
+
+#include "vcl/tabdlg.hxx"
+#include "vcl/tabpage.hxx"
+#include "vcl/tabctrl.hxx"
+#include "vcl/button.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/field.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/ppdparser.hxx"
+#include "vcl/printerinfomanager.hxx"
+
+namespace padmin {
+
+class RTSPaperPage;
+class RTSDevicePage;
+class RTSOtherPage;
+class RTSFontSubstPage;
+class RTSCommandPage;
+
+class RTSDialog : public TabDialog
+{
+ friend class RTSPaperPage;
+ friend class RTSDevicePage;
+ friend class RTSOtherPage;
+ friend class RTSFontSubstPage;
+ friend class RTSCommandPage;
+
+ ::psp::PrinterInfo m_aJobData;
+ String m_aPrinter;
+
+ // controls
+ TabControl m_aTabControl;
+ OKButton m_aOKButton;
+ CancelButton m_aCancelButton;
+
+ // pages
+ RTSPaperPage* m_pPaperPage;
+ RTSDevicePage* m_pDevicePage;
+ RTSOtherPage* m_pOtherPage;
+ RTSFontSubstPage* m_pFontSubstPage;
+ RTSCommandPage* m_pCommandPage;
+
+ // some resources
+ String m_aInvalidString;
+ String m_aFromDriverString;
+
+ DECL_LINK( ActivatePage, TabControl* );
+ DECL_LINK( ClickButton, Button* );
+
+ // helper functions
+ void insertAllPPDValues( ListBox&, const psp::PPDParser*, const psp::PPDKey* );
+public:
+ RTSDialog( const ::psp::PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent = NULL );
+ ~RTSDialog();
+
+ const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
+};
+
+class RTSPaperPage : public TabPage
+{
+ RTSDialog* m_pParent;
+
+ FixedText m_aPaperText;
+ ListBox m_aPaperBox;
+
+ FixedText m_aOrientText;
+ ListBox m_aOrientBox;
+
+ FixedText m_aDuplexText;
+ ListBox m_aDuplexBox;
+
+ FixedText m_aSlotText;
+ ListBox m_aSlotBox;
+
+ DECL_LINK( SelectHdl, ListBox* );
+public:
+ RTSPaperPage( RTSDialog* );
+ ~RTSPaperPage();
+
+ void update();
+
+ String getOrientation() { return m_aOrientBox.GetSelectEntry(); }
+};
+
+class RTSDevicePage : public TabPage
+{
+ RTSDialog* m_pParent;
+
+ String m_aSpaceColor;
+ String m_aSpaceGray;
+
+ FixedText m_aPPDKeyText;
+ ListBox m_aPPDKeyBox;
+
+ FixedText m_aPPDValueText;
+ ListBox m_aPPDValueBox;
+
+ FixedText m_aLevelText;
+ ListBox m_aLevelBox;
+
+ FixedText m_aSpaceText;
+ ListBox m_aSpaceBox;
+
+ FixedText m_aDepthText;
+ ListBox m_aDepthBox;
+
+ void FillValueBox( const ::psp::PPDKey* );
+
+ DECL_LINK( SelectHdl, ListBox* );
+public:
+ RTSDevicePage( RTSDialog* );
+ ~RTSDevicePage();
+
+ void update();
+
+ ULONG getLevel() { return m_aLevelBox.GetSelectEntry().ToInt32(); }
+ ULONG getDepth() { return m_aDepthBox.GetSelectEntry().ToInt32(); }
+ ULONG getColorDevice()
+ {
+ String aSpace( m_aSpaceBox.GetSelectEntry() );
+ return aSpace == m_aSpaceColor ? 1 : ( aSpace == m_aSpaceGray ? -1 : 0 );
+ }
+};
+
+class RTSOtherPage : public TabPage
+{
+ RTSDialog* m_pParent;
+
+ FixedText m_aLeftTxt;
+ MetricField m_aLeftLB;
+ FixedText m_aTopTxt;
+ MetricField m_aTopLB;
+ FixedText m_aRightTxt;
+ MetricField m_aRightLB;
+ FixedText m_aBottomTxt;
+ MetricField m_aBottomLB;
+ FixedText m_aCommentTxt;
+ Edit m_aCommentEdt;
+ PushButton m_aDefaultBtn;
+
+ void initValues();
+
+ DECL_LINK( ClickBtnHdl, Button *);
+
+public:
+ RTSOtherPage( RTSDialog* );
+ ~RTSOtherPage();
+
+ void save();
+};
+
+class RTSFontSubstPage : public TabPage
+{
+ RTSDialog* m_pParent;
+
+ FixedText m_aSubstitutionsText;
+ DelMultiListBox m_aSubstitutionsBox;
+ FixedText m_aFromFontText;
+ ComboBox m_aFromFontBox;
+ FixedText m_aToFontText;
+ ListBox m_aToFontBox;
+
+ PushButton m_aAddButton;
+ PushButton m_aRemoveButton;
+ CheckBox m_aEnableBox;
+
+ DECL_LINK( ClickBtnHdl, Button* );
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( DelPressedHdl, ListBox* );
+
+ void update();
+public:
+ RTSFontSubstPage( RTSDialog* );
+ ~RTSFontSubstPage();
+};
+
+} // namespace
+
+#endif // _PAD_PRTSETUP_HXX
diff --git a/padmin/source/psetupl.xpm b/padmin/source/psetupl.xpm
new file mode 100644
index 000000000000..159374756290
--- /dev/null
+++ b/padmin/source/psetupl.xpm
@@ -0,0 +1,76 @@
+/* XPM */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+static char * L3PSetup_m_pm[] = {
+/* width height ncolors cpp [x_hot y_hot] */
+"32 32 11 1 0 0",
+/* colors */
+" s none m none c none",
+". s iconColor1 m black c black",
+"X c #000000008617",
+"o c #861782078617",
+"O s iconColor2 m white c white",
+"+ c #C71BC30BC71B",
+"@ s iconColor6 m white c yellow",
+"# c #00000000FFFF",
+"$ c #861782070000",
+"% c #000082078617",
+"& c #861700000000",
+/* pixels */
+" ",
+" ........ XXXX",
+" .o..oo.OOOOOOO+..X+OX",
+" .+ooOO.@OO@OOOO@OOXOOX",
+" .+oo+O.OO.OOOOOOOOOXXXX",
+" .+oo+O.O@.OOO@OOOO@OXXXX",
+" .+oo+O.@O.O@O.OO@OOOOXXXX",
+" .+oo+O.OO.+.O.OOOOOOOOXXXX",
+" .+oo+O.O@.+O+.O@O.OOO..X.X.",
+" .+oo+O+...+O++o.O.OO@. .X. ",
+" .+oo+O+O+O+O++++o.@O..o ... ",
+" .ooo+O+O+O+O++++ooo.. ",
+" .ooo+O+O+O+O++++o..+Oo ",
+" .oo+O+O+O+O++++o....OO. ",
+" ..+O+O+O+O++++o......OO. ",
+" .o+OO+O+O++#+o....$o..OO. ",
+" .oo+OO+O++%+o....$$$...Oo. ",
+" .ooo+OO++&+o...$$$+$+...o. ",
+" .oooo+O+++o...$$$+$+++..o. ",
+" .oooooOO+o.o.$$++$+OoOO..o ",
+" .ooooo+Oo..O.$++$OOoOO$O.o ",
+"o.ooooooO.o.OO.+$OOoOOoOOO. ",
+"oo.ooooo.O.O.OO.OOoOO$OOoOO. ",
+" oo.oooo+O.OO.OO.OOOoOOoOO.o ",
+" oo.ooo+O.oOo.Oo.O$OO$OO.o ",
+" oo.oo+O.o+o.+o.OOOoOO.o ",
+" oo.o+O.o+o.+o.OOoOO.o ",
+" oo.+..o+o.+o..OOO.o ",
+" oo.oo.+..+o.o.O.o ",
+" ooooo.o.o.ooo.o ",
+" oooo.o oo ",
+" oo "};
diff --git a/padmin/source/rtsetup.hrc b/padmin/source/rtsetup.hrc
new file mode 100644
index 000000000000..30439088de8e
--- /dev/null
+++ b/padmin/source/rtsetup.hrc
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_RTSETUP_HRC_
+#define _PAD_RTSETUP_HRC_
+
+#define RID_RTS_RTSDIALOG 4001
+#define RID_RTS_RTSDIALOG_INVALID_TXT 1
+#define RID_RTS_RTSDIALOG_FROMDRIVER_TXT 2
+#define RID_RTS_RTSDIALOG_TABCONTROL 3
+
+#define RID_RTS_OTHERPAGE 4002
+#define RID_RTS_OTHER_LEFTMARGIN_TXT 1
+#define RID_RTS_OTHER_LEFTMARGIN_BOX 2
+#define RID_RTS_OTHER_TOPMARGIN_TXT 3
+#define RID_RTS_OTHER_TOPMARGIN_BOX 4
+#define RID_RTS_OTHER_RIGHTMARGIN_TXT 5
+#define RID_RTS_OTHER_RIGHTMARGIN_BOX 6
+#define RID_RTS_OTHER_BOTTOMMARGIN_TXT 7
+#define RID_RTS_OTHER_BOTTOMMARGIN_BOX 8
+#define RID_RTS_OTHER_COMMENT_TXT 9
+#define RID_RTS_OTHER_COMMENT_EDT 10
+#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_LEVEL_TXT 7
+#define RID_RTS_DEVICE_LEVEL_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_DEVICE_COMPRESS_BOX 13
+
+#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
+#define RID_RTS_FS_SUBST_BOX 2
+#define RID_RTS_FS_FROM_TXT 3
+#define RID_RTS_FS_FROM_BOX 4
+#define RID_RTS_FS_TO_TXT 5
+#define RID_RTS_FS_TO_BOX 6
+#define RID_RTS_FS_ADD_BTN 7
+#define RID_RTS_FS_REMOVE_BTN 8
+#define RID_RTS_FS_ENABLE_BTN 9
+
+#define RID_RTS_COMMANDPAGE 4006
+#define RID_RTS_CMD_TXT_PRTNAME 1
+#define RID_RTS_CMD_TXT_CONNECT 2
+#define RID_RTS_CMD_FL_DEFAULT 3
+#define RID_RTS_CMD_BTN_HELP 4
+#define RID_RTS_CMD_CB_COMMANDS 5
+#define RID_RTS_CMD_FL_INSTALL 6
+#define RID_RTS_CMD_TXT_CONFIGURE 7
+#define RID_RTS_CMD_LB_CONFIGURE 8
+#define RID_RTS_CMD_STR_CONFIGURE_PRINTER 9
+#define RID_RTS_CMD_STR_CONFIGURE_FAX 10
+#define RID_RTS_CMD_STR_CONFIGURE_PDF 11
+#define RID_RTS_CMD_STR_PRINTERHELP 12
+#define RID_RTS_CMD_STR_FAXHELP 13
+#define RID_RTS_CMD_STR_PDFHELP 14
+#define RID_RTS_CMD_BTN_REMOVE 15
+#define RID_RTS_CMD_EDT_PDFDIR 16
+#define RID_RTS_CMD_BTN_PDFDIR 17
+#define RID_RTS_CMD_TXT_PDFDIR 18
+#define RID_RTS_CMD_BOX_SWALLOWFAXNO 19
+#define RID_RTS_CMD_CB_EXTERNAL 20
+#define RID_RTS_CMD_FT_QUICKCMD 21
+#define RIT_RTS_CMD_CB_QUICKCMD 22
+
+#define RID_TXT_QUERYFAXNUMBER 4007
+
+#define RID_RTS_PWDIALOG 4008
+#define RID_RTS_PWDIALOG_TXT 1
+#define RID_RTS_PWDIALOG_USER_TXT 2
+#define RID_RTS_PWDIALOG_USER_EDT 3
+#define RID_RTS_PWDIALOG_PASS_TXT 4
+#define RID_RTS_PWDIALOG_PASS_EDT 5
+#define RID_RTS_PWDIALOG_OK_BTN 6
+#define RID_RTS_PWDIALOG_CANCEL_BTN 7
+
+#endif
diff --git a/padmin/source/rtsetup.src b/padmin/source/rtsetup.src
new file mode 100644
index 000000000000..e04374a72245
--- /dev/null
+++ b/padmin/source/rtsetup.src
@@ -0,0 +1,568 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "rtsetup.hrc"
+
+TabDialog RID_RTS_RTSDIALOG
+{
+ Moveable = TRUE;
+ Closeable = TRUE;
+ SVLook = TRUE;
+
+ TabControl RID_RTS_RTSDIALOG_TABCONTROL
+ {
+ OutputSize = TRUE;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_RTS_COMMANDPAGE;
+ Text [ en-US ] = "Command";
+ };
+ PageItem
+ {
+ Identifier = RID_RTS_PAPERPAGE;
+ Text [ en-US ] = "Paper";
+ };
+ PageItem
+ {
+ Identifier = RID_RTS_DEVICEPAGE;
+ Text [ en-US ] = "Device";
+ };
+ PageItem
+ {
+ Identifier = RID_RTS_FONTSUBSTPAGE;
+ Text [ en-US ] = "Font Replacement";
+ };
+ PageItem
+ {
+ Identifier = RID_RTS_OTHERPAGE;
+ Text [ en-US ] = "Other Settings";
+ };
+ };
+ };
+ String RID_RTS_RTSDIALOG_FROMDRIVER_TXT
+ {
+ Text [ en-US ] = "from driver";
+ };
+ String RID_RTS_RTSDIALOG_INVALID_TXT
+ {
+ Text [ en-US ] = "<ignore>";
+ };
+ Text [ en-US ] = "Properties of %s";
+};
+
+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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Border = TRUE;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT( 115, 50 );
+ Size = MAP_APPFONT( 110, 120 );
+ };
+};
+
+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
+ {
+ 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
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 120, 14 );
+ Size = MAP_APPFONT( 105, 111 );
+ };
+
+ FixedText RID_RTS_DEVICE_LEVEL_TXT
+ {
+ Pos = MAP_APPFONT( 5, 130 );
+ Size = MAP_APPFONT( 80, 8 );
+ Text [ en-US ] = "PostScript ~Level";
+ };
+ ListBox RID_RTS_DEVICE_LEVEL_BOX
+ {
+ DropDown = TRUE;
+ Pos = MAP_APPFONT( 120, 130 );
+ Size = MAP_APPFONT( 105, 200 );
+ };
+ 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
+ {
+ 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
+ {
+ DropDown = TRUE;
+ Pos = MAP_APPFONT( 120, 160 );
+ Size = MAP_APPFONT( 105, 200 );
+ StringList =
+ {
+ "8 Bit";
+ "24 Bit";
+ };
+ };
+};
+
+TabPage RID_RTS_FONTSUBSTPAGE
+{
+ Hide = TRUE;
+ Size = MAP_APPFONT( 230, 175 );
+
+ CheckBox RID_RTS_FS_ENABLE_BTN
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 180, 10 );
+ Text [ en-US ] = "~Enable font replacement";
+ };
+
+ FixedText RID_RTS_FS_SUBST_TXT
+ {
+ Pos = MAP_APPFONT( 5,20 );
+ Size = MAP_APPFONT( 180, 8 );
+ Text [ en-US ] = "Replaced ~fonts";
+ };
+ MultiListBox RID_RTS_FS_SUBST_BOX
+ {
+ AutoHScroll = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+ SimpleMode = TRUE;
+ Pos = MAP_APPFONT( 5, 30 );
+ Size = MAP_APPFONT( 220, 90 );
+ };
+ PushButton RID_RTS_FS_ADD_BTN
+ {
+ Pos = MAP_APPFONT( 5, 125 );
+ Size = MAP_APPFONT( 107, 12 );
+ Text [ en-US ] = "~Add";
+ };
+ PushButton RID_RTS_FS_REMOVE_BTN
+ {
+ Pos = MAP_APPFONT( 117, 125 );
+ Size = MAP_APPFONT( 107, 12 );
+ Text [ en-US ] = "~Remove";
+ };
+ FixedText RID_RTS_FS_FROM_TXT
+ {
+ Pos = MAP_APPFONT( 5, 145 );
+ Size = MAP_APPFONT( 107, 8 );
+ Text [ en-US ] = "Repla~ce font";
+ };
+ ComboBox RID_RTS_FS_FROM_BOX
+ {
+ Border = TRUE;
+ DropDown = TRUE;
+ Sort = TRUE;
+ Pos = MAP_APPFONT( 5, 155 );
+ Size = MAP_APPFONT( 107, 200 );
+ };
+ FixedText RID_RTS_FS_TO_TXT
+ {
+ Pos = MAP_APPFONT( 117, 145 );
+ Size = MAP_APPFONT( 107, 8 );
+ Text [ en-US ] = "by ~printer font";
+ };
+ ListBox RID_RTS_FS_TO_BOX
+ {
+ Border = TRUE;
+ DropDown = TRUE;
+ Sort = TRUE;
+ Pos = MAP_APPFONT( 117, 155 );
+ Size = MAP_APPFONT( 107, 200 );
+ };
+};
+
+TabPage RID_RTS_COMMANDPAGE
+{
+ Hide = TRUE;
+ Size = MAP_APPFONT( 230, 175 );
+
+ ComboBox RID_RTS_CMD_CB_COMMANDS
+ {
+ Border = TRUE ;
+ Sort = TRUE ;
+ Dropdown = TRUE;
+ Pos = MAP_APPFONT ( 11 , 75 ) ;
+ Size = MAP_APPFONT ( 150 , 65 ) ;
+ };
+ CheckBox RID_RTS_CMD_CB_EXTERNAL
+ {
+ Pos = MAP_APPFONT( 11, 95 );
+ Size = MAP_APPFONT( 220, 10 );
+ Text [ en-US ] = "~Use system print dialog, disable %PRODUCTNAME's print dialog";
+ };
+ FixedText RID_RTS_CMD_FT_QUICKCMD
+ {
+ Pos = MAP_APPFONT( 11, 110 );
+ Size = MAP_APPFONT( 150, 20 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Command for quick printing without dialog (optional)";
+ };
+ ComboBox RIT_RTS_CMD_CB_QUICKCMD
+ {
+ Border = TRUE;
+ Sort = TRUE;
+ Dropdown = TRUE;
+ Pos = MAP_APPFONT( 11, 130 );
+ Size = MAP_APPFONT( 150, 65 );
+ };
+ FixedLine RID_RTS_CMD_FL_INSTALL
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 220 , 8 ) ;
+ Text [ en-US ] = "Select command";
+ };
+ String RID_RTS_CMD_STR_CONFIGURE_PRINTER
+ {
+ Text [ en-US ] = "Printer";
+ };
+ String RID_RTS_CMD_STR_CONFIGURE_FAX
+ {
+ Text [ en-US ] = "Fax";
+ };
+ String RID_RTS_CMD_STR_CONFIGURE_PDF
+ {
+ Text [ en-US ] = "PDF converter";
+ };
+
+ ListBox RID_RTS_CMD_LB_CONFIGURE
+ {
+ DropDown = true;
+ Border = true;
+ Pos = MAP_APPFONT( 101, 56 );
+ Size = MAP_APPFONT( 60, 200 );
+ };
+ FixedText RID_RTS_CMD_TXT_CONFIGURE
+ {
+ Pos = MAP_APPFONT( 11, 56 );
+ Size = MAP_APPFONT( 85, 10 );
+ Text [ en-US ] = "~Configure as";
+ };
+
+ CheckBox RID_RTS_CMD_BOX_SWALLOWFAXNO
+ {
+ Pos = MAP_APPFONT( 11, 146 );
+ Size = MAP_APPFONT( 130, 8 );
+ Text [ en-US ] = "~Fax number will be removed from output";
+ };
+ FixedText RID_RTS_CMD_TXT_PDFDIR
+ {
+ Pos = MAP_APPFONT( 11, 146 );
+ Size = MAP_APPFONT( 130, 8 );
+ Text [ en-US ] = "PDF target directory :";
+ };
+ Edit RID_RTS_CMD_EDT_PDFDIR
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 11, 155 );
+ Size = MAP_APPFONT( 130, 12 );
+ };
+ PushButton RID_RTS_CMD_BTN_PDFDIR
+ {
+ Pos = MAP_APPFONT( 146, 155 );
+ Size = MAP_APPFONT( 15, 12 );
+ Text = "...";
+ };
+ FixedText RID_RTS_CMD_TXT_PRTNAME
+ {
+ Pos = MAP_APPFONT ( 11 , 16 ) ;
+ Size = MAP_APPFONT ( 210 , 8 ) ;
+ };
+ FixedText RID_RTS_CMD_TXT_CONNECT
+ {
+ Pos = MAP_APPFONT ( 11 , 26 ) ;
+ Size = MAP_APPFONT ( 210 , 8 ) ;
+ Text [ en-US ] = "Command: ";
+ };
+ FixedLine RID_RTS_CMD_FL_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 220 , 8 ) ;
+ Text [ en-US ] = "Printer";
+ };
+ PushButton RID_RTS_CMD_BTN_HELP
+ {
+ Pos = MAP_APPFONT( 170, 55 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Help";
+ };
+ PushButton RID_RTS_CMD_BTN_REMOVE
+ {
+ Pos = MAP_APPFONT( 170, 72 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Remove";
+ };
+ String RID_RTS_CMD_STR_PDFHELP
+ {
+ Text [ en-US ] = "The command line for PDF converters is executed as follows: for each document printed, \"(TMP)\" in the command line is replaced by a temporary file and \"(OUTFILE)\" in the command line is replaced by the target PDF file name. If \"(TMP)\" is in the command line, the PostScript code will be supplied via a file, otherwise via standard input (i.e. as a pipe).";
+ };
+ String RID_RTS_CMD_STR_PRINTERHELP
+ {
+ Text [ en-US ] = "The command line for printer devices is executed as follows: the generated PostScript code is supplied as standard input (i.e. as a pipe) to the command line.";
+ };
+ String RID_RTS_CMD_STR_FAXHELP
+ {
+ Text [ en-US ] = "The command line for fax devices is executed as follows: for each fax sent, \"(TMP)\" in the command line is replaced by a temporary file and \"(PHONE)\" in the command line is replaced by the fax number. If \"(TMP)\" appears in the command line, the PostScript code will be supplied via a file, otherwise it is passed as standard input (i.e. as a pipe).";
+ };
+};
+
+TabPage RID_RTS_OTHERPAGE
+{
+ Hide = TRUE;
+ Size = MAP_APPFONT( 230, 175 );
+
+ FixedText RID_RTS_OTHER_LEFTMARGIN_TXT
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 85, 8 );
+ Text [ en-US ] = "~Left margin";
+ };
+ MetricField RID_RTS_OTHER_LEFTMARGIN_BOX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 100 , 5 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ StrictFormat = TRUE ;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Unit = FUNIT_MM;
+ };
+ FixedText RID_RTS_OTHER_TOPMARGIN_TXT
+ {
+ Pos = MAP_APPFONT( 5, 20 );
+ Size = MAP_APPFONT( 85, 8 );
+ Text [ en-US ] = "~Top margin";
+ };
+ MetricField RID_RTS_OTHER_TOPMARGIN_BOX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 100 , 20 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ StrictFormat = TRUE ;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Unit = FUNIT_MM;
+ };
+ FixedText RID_RTS_OTHER_RIGHTMARGIN_TXT
+ {
+ Pos = MAP_APPFONT( 5, 35 );
+ Size = MAP_APPFONT( 85, 8 );
+ Text [ en-US ] = "~Right margin";
+ };
+ MetricField RID_RTS_OTHER_RIGHTMARGIN_BOX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 100 , 35 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ StrictFormat = TRUE ;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Unit = FUNIT_MM;
+ };
+ FixedText RID_RTS_OTHER_BOTTOMMARGIN_TXT
+ {
+ Pos = MAP_APPFONT( 5, 50 );
+ Size = MAP_APPFONT( 85, 8 );
+ Text [ en-US ] = "~Bottom margin";
+ };
+ MetricField RID_RTS_OTHER_BOTTOMMARGIN_BOX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 100 , 50 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ StrictFormat = TRUE ;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Unit = FUNIT_MM;
+ };
+ FixedText RID_RTS_OTHER_COMMENT_TXT
+ {
+ Pos = MAP_APPFONT( 5, 65 );
+ Size = MAP_APPFONT( 85, 8 );
+ Text [ en-US ] = "~Comment";
+ };
+ Edit RID_RTS_OTHER_COMMENT_EDT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 5 , 75 ) ;
+ Size = MAP_APPFONT ( 220 , 12 ) ;
+ };
+ PushButton RID_RTS_OTHER_DEFAULT_BTN
+ {
+ Pos = MAP_APPFONT( 175, 5 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text [ en-US ] = "~Default";
+ };
+};
+
+String RID_TXT_QUERYFAXNUMBER
+{
+ Text [ en-US ] = "Please enter the fax number.";
+};
+
+ModalDialog RID_RTS_PWDIALOG
+{
+ Text [ en-US ] = "Authentication request";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 150 , 90 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedText RID_RTS_PWDIALOG_TXT
+ {
+ Pos = MAP_APPFONT( 5, 5 );
+ Size = MAP_APPFONT( 140, 20 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please enter your authentication data for server %s";
+ };
+ FixedText RID_RTS_PWDIALOG_USER_TXT
+ {
+ Pos = MAP_APPFONT( 5, 30 );
+ Size = MAP_APPFONT( 60, 10 );
+ Text [ en-US ] = "~User";
+ };
+ Edit RID_RTS_PWDIALOG_USER_EDT
+ {
+ Pos = MAP_APPFONT( 70, 29 );
+ Size = MAP_APPFONT( 75, 12 );
+ Border = TRUE;
+ };
+ FixedText RID_RTS_PWDIALOG_PASS_TXT
+ {
+ Pos = MAP_APPFONT( 5, 45 );
+ Size = MAP_APPFONT( 60, 10 );
+ Text [ en-US ] = "~Password";
+ };
+ Edit RID_RTS_PWDIALOG_PASS_EDT
+ {
+ Pos = MAP_APPFONT( 70, 44 );
+ Size = MAP_APPFONT( 75, 12 );
+ Border = TRUE;
+ Password = TRUE;
+ };
+ CancelButton RID_RTS_PWDIALOG_CANCEL_BTN
+ {
+ Pos = MAP_APPFONT( 95, 70 );
+ Size = MAP_APPFONT( 50, 15 );
+ };
+ OKButton RID_RTS_PWDIALOG_OK_BTN
+ {
+ Pos = MAP_APPFONT( 5, 70 );
+ Size = MAP_APPFONT( 50, 15 );
+ DefButton = TRUE;
+ };
+};
diff --git a/padmin/source/spadmin.sh b/padmin/source/spadmin.sh
new file mode 100644
index 000000000000..c831ab7f0919
--- /dev/null
+++ b/padmin/source/spadmin.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# enable file locking
+SAL_ENABLE_FILE_LOCKING=1
+export SAL_ENABLE_FILE_LOCKING
+
+# resolve installation directory
+sd_cwd="`pwd`"
+if [ -h "$0" ] ; then
+ sd_basename=`basename "$0"`
+ sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"`
+ cd "`dirname "$0"`"
+ cd "`dirname "$sd_script"`"
+else
+ cd "`dirname "$0"`"
+fi
+sd_prog=`pwd`
+cd "$sd_cwd"
+
+#collect all bootstrap variables specified on the command line
+#so that they can be passed as arguments to javaldx later on
+for arg in $@
+do
+ case "$arg" in
+ -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
+ esac
+done
+
+# extend the ld_library_path for java: javaldx checks the sofficerc for us
+if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
+ my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
+ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
+ if [ -n "$my_path" ] ; then
+ LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ fi
+fi
+
+unset XENVIRONMENT
+
+# uncomment line below to disable anti aliasing of fonts
+# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
+
+# Set PATH so that crash_report is found:
+PATH=$sd_prog${PATH+:$PATH}
+export PATH
+
+# execute binary
+exec "$sd_prog/../basis-link/program/spadmin.bin" "$@" \
+ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"
diff --git a/padmin/source/titlectrl.cxx b/padmin/source/titlectrl.cxx
new file mode 100644
index 000000000000..450780dce1e3
--- /dev/null
+++ b/padmin/source/titlectrl.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_NEWPPDLG_HXX_
+#include <titlectrl.hxx>
+#endif
+
+using namespace padmin;
+
+TitleImage::TitleImage( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ m_bArranged( false )
+{
+ Font aFont = GetFont();
+ aFont.SetHeight( aFont.GetHeight()*3/2 );
+ SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+TitleImage::~TitleImage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::arrange()
+{
+ m_bArranged = true;
+ Size aCtrlSize( GetSizePixel() );
+ Size aImageSize( m_aImage.GetSizePixel() );
+ Size aTextSize( GetTextWidth( m_aText ), GetTextHeight() );
+
+ m_aImagePos.Y() = ( aCtrlSize.Height() - aImageSize.Height() ) / 2;
+ m_aImagePos.X() = m_aImagePos.Y() < 0 ? -m_aImagePos.Y() : m_aImagePos.Y();
+ m_aTextPos.X() = m_aImagePos.X() + aImageSize.Width() + aTextSize.Height()/2;
+ m_aTextPos.Y() = ( aCtrlSize.Height() - aTextSize.Height() ) / 2;
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::Paint( const Rectangle& )
+{
+ if( ! m_bArranged )
+ arrange();
+
+ SetLineColor( m_aBGColor );
+ SetFillColor( m_aBGColor );
+ DrawRect( Rectangle( Point( 0, 0 ), Size( GetSizePixel() ) ) );
+ DrawImage( m_aImagePos, m_aImage );
+ DrawText( m_aTextPos, m_aText );
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetText( const String& rText )
+{
+ m_aText = rText;
+ m_bArranged = false;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetImage( const Image& rImage )
+{
+ m_aImage = rImage;
+ m_bArranged = false;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetBackgroundColor( const Color& rColor )
+{
+ m_aBGColor = rColor;
+ Invalidate();
+}
diff --git a/padmin/source/titlectrl.hxx b/padmin/source/titlectrl.hxx
new file mode 100644
index 000000000000..75c8d3eeeceb
--- /dev/null
+++ b/padmin/source/titlectrl.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAD_TITLECTRL_HXX_
+#define _PAD_TITLECTRL_HXX_
+
+#include <vcl/ctrl.hxx>
+#include <vcl/image.hxx>
+
+namespace padmin
+{
+
+class TitleImage : public Control
+{
+ Image m_aImage;
+ String m_aText;
+ Color m_aBGColor;
+ Point m_aImagePos;
+ Point m_aTextPos;
+
+ bool m_bArranged;
+
+ void arrange();
+public:
+ TitleImage( Window* pParent, const ResId& rResId );
+ ~TitleImage();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ void SetImage( const Image& rImage );
+ const Image& GetImage() const { return m_aImage; }
+
+ virtual void SetText( const String& rText );
+ virtual String GetText() const { return m_aText; }
+
+ void SetBackgroundColor( const Color& rColor );
+ const Color& GetBackgroundColor() const { return m_aBGColor; }
+};
+
+}
+
+#endif // _PAD_TITLECTRL_HXX_