[Libreoffice-commits] core.git: bin/distro-install-desktop-integration bin/distro-install-file-lists extras/Module_extras.mk extras/Package_cfgsrvbitmapunx.mk extras/unx include/tools include/vcl padmin/AllLangResTarget_spa.mk padmin/Executable_spadmin.bin.mk padmin/Library_spa.mk padmin/Module_padmin.mk padmin/Package_padmin.mk padmin/source padmin/uiconfig Repository.mk scp2/source sysui/CustomTarget_share.mk sysui/desktop test/Package_unittest.mk tools/source unusedcode.easy vcl/unx
Caolán McNamara
caolanm at redhat.com
Fri Mar 21 01:57:54 PDT 2014
Repository.mk | 1
bin/distro-install-desktop-integration | 2
bin/distro-install-file-lists | 1
extras/Module_extras.mk | 1
extras/Package_cfgsrvbitmapunx.mk | 17
extras/unx/source/bitmaps/psetup.xpm | 31 -
extras/unx/source/bitmaps/psetupl.xpm | 49 -
include/tools/config.hxx | 1
include/vcl/ppdparser.hxx | 2
padmin/AllLangResTarget_spa.mk | 1
padmin/Executable_spadmin.bin.mk | 61 --
padmin/Library_spa.mk | 6
padmin/Module_padmin.mk | 2
padmin/Package_padmin.mk | 24
padmin/source/adddlg.cxx | 661 ------------------------
padmin/source/adddlg.hxx | 209 -------
padmin/source/cmddlg.cxx | 468 -----------------
padmin/source/cmddlg.hxx | 106 ---
padmin/source/desktopcontext.cxx | 53 -
padmin/source/desktopcontext.hxx | 46 -
padmin/source/helper.cxx | 180 ------
padmin/source/helper.hxx | 49 -
padmin/source/newppdlg.cxx | 221 --------
padmin/source/newppdlg.hxx | 68 --
padmin/source/padialog.cxx | 711 --------------------------
padmin/source/padialog.hrc | 139 -----
padmin/source/padialog.hxx | 101 ---
padmin/source/padialog.src | 645 -----------------------
padmin/source/pamain.cxx | 157 -----
padmin/source/progress.cxx | 94 ---
padmin/source/progress.hxx | 59 --
padmin/source/prtsetup.cxx | 150 -----
padmin/source/prtsetup.hxx | 35 -
padmin/source/psetupl.xpm | 67 --
padmin/source/rtsetup.hrc | 34 -
padmin/source/rtsetup.src | 225 --------
padmin/source/spadmin.sh | 89 ---
padmin/source/titlectrl.cxx | 94 ---
padmin/source/titlectrl.hxx | 60 --
padmin/uiconfig/ui/printerpropertiesdialog.ui | 27
scp2/source/ooo/file_extra_ooo.scp | 11
scp2/source/ooo/file_ooo.scp | 11
scp2/source/ooo/module_hidden_ooo.scp | 2
sysui/CustomTarget_share.mk | 8
sysui/desktop/man/libreoffice.1 | 2
sysui/desktop/share/create_tree.sh | 4
sysui/desktop/share/printeradmin.sh | 3
sysui/desktop/solaris/prototype | 2
test/Package_unittest.mk | 2
tools/source/generic/config.cxx | 7
unusedcode.easy | 6
vcl/unx/generic/printer/ppdparser.cxx | 59 --
52 files changed, 11 insertions(+), 5053 deletions(-)
New commits:
commit a547f865e0ce7731e1b3998b06ecba505e1c27ca
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 20 16:59:48 2014 +0000
drop spadmin
Change-Id: Ie10ee80f1d35b40c0baf9d7ba5c1181b52405b5f
diff --git a/Repository.mk b/Repository.mk
index eb7a55f..4e1e379 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -86,7 +86,6 @@ $(eval $(call gb_Helper_register_executables,OOO, \
$(if $(filter-out ANDROID IOS MACOSX WNT,$(OS)),oosplash) \
$(if $(ENABLE_NPAPI_FROM_BROWSER),pluginapp.bin) \
soffice_bin \
- spadmin.bin \
$(if $(filter $(GUIBASE)$(ENABLE_GTK),unxTRUE), \
xid-fullscreen-on-all-monitors \
) \
diff --git a/bin/distro-install-desktop-integration b/bin/distro-install-desktop-integration
index 0379ffa..18107e0 100755
--- a/bin/distro-install-desktop-integration
+++ b/bin/distro-install-desktop-integration
@@ -121,8 +121,6 @@ cd -
rm -rf $sysui_temp
# we do not want some stuff from the plain packages
-rm -f $DESTDIR/$PREFIXDIR/bin/$INSTALLDIRNAME-printeradmin
-rm -f $DESTDIR$PREFIXDIR/share/applications/libreoffice-printeradmin.desktop
if test -d $DESTDIR/opt ; then
rm -f $DESTDIR/opt/$INSTALLDIRNAME
rmdir --ignore-fail-on-non-empty $DESTDIR/opt
diff --git a/bin/distro-install-file-lists b/bin/distro-install-file-lists
index b0d962a..ada7295 100755
--- a/bin/distro-install-file-lists
+++ b/bin/distro-install-file-lists
@@ -343,7 +343,6 @@ if test "z$OOO_VENDOR" != "zDebian" ; then
program/pluginapp.bin \
program/setofficelang.bin \
program/soffice.bin \
- program/spadmin.bin \
program/uno.bin \
program/unopkg.bin \
program/uri-encode
diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk
index a2c25b4..5b5678a 100644
--- a/extras/Module_extras.mk
+++ b/extras/Module_extras.mk
@@ -14,7 +14,6 @@ $(eval $(call gb_Module_add_targets,extras,\
CustomTarget_glade \
Package_autocorr \
Package_autotextuser \
- Package_cfgsrvbitmapunx \
Package_cfgsrvnolang \
Package_cfgusr \
Package_database \
diff --git a/extras/Package_cfgsrvbitmapunx.mk b/extras/Package_cfgsrvbitmapunx.mk
deleted file mode 100644
index 250b7c1..0000000
--- a/extras/Package_cfgsrvbitmapunx.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_Package_Package,extras_cfgsrvbitmapunx,$(SRCDIR)/extras/unx/source/bitmaps))
-
-$(eval $(call gb_Package_add_files,extras_cfgsrvbitmapunx,$(LIBO_SHARE_FOLDER)/config,\
- psetupl.xpm \
- psetup.xpm \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/extras/unx/source/bitmaps/psetup.xpm b/extras/unx/source/bitmaps/psetup.xpm
deleted file mode 100644
index f512975..0000000
--- a/extras/unx/source/bitmaps/psetup.xpm
+++ /dev/null
@@ -1,31 +0,0 @@
-/* XPM */
-static char * L3PSetup_t_pm[] = {
-/* width height ncolors cpp [x_hot y_hot] */
-"16 16 9 1 0 0",
-/* colors */
-" s none m none c none",
-". c #861782078617",
-"X s iconColor1 m black c black",
-"o c #000000008617",
-"O s iconColor2 m white c white",
-"+ c #C71BC30BC71B",
-"@ s iconColor6 m white c yellow",
-"# c #00000000FFFF",
-"$ c #861700000000",
-/* pixels */
-" ",
-" .. XXXXX o",
-" ..OO+XO.OO at Xo",
-" ..OOOOX at .@.OOOo",
-"XXOOOOXOXO.O. at Oo",
-" XOOX at XOX@.OXXo",
-" XOOXOO+XXX o",
-" XX+XOO..+++O+. ",
-"X.++X..+++##++O.",
-"X...++++$$++OOO.",
-"X.....++++OO++O.",
-"X.......OO++++..",
-"XX......+++++.X.",
-" XX....+++.XX ",
-" XX..+.XX ",
-" XXXX "};
diff --git a/extras/unx/source/bitmaps/psetupl.xpm b/extras/unx/source/bitmaps/psetupl.xpm
deleted file mode 100644
index f9cca89..0000000
--- a/extras/unx/source/bitmaps/psetupl.xpm
+++ /dev/null
@@ -1,49 +0,0 @@
-/* XPM */
-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. at OO@OOOO at OOXOOX",
-" .+oo+O.OO.OOOOOOOOOXXXX",
-" .+oo+O.O at .OOO@OOOO at OXXXX",
-" .+oo+O. at O.O@O.OO at OOOOXXXX",
-" .+oo+O.OO.+.O.OOOOOOOOXXXX",
-" .+oo+O.O at .+O+.O@O.OOO..X.X.",
-" .+oo+O+...+O++o.O.OO at . .X. ",
-" .+oo+O+O+O+O++++o. at 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/include/tools/config.hxx b/include/tools/config.hxx
index 751114d..0b472b9 100644
--- a/include/tools/config.hxx
+++ b/include/tools/config.hxx
@@ -53,7 +53,6 @@ public:
bool HasGroup(const OString& rGroup) const;
OString ReadKey(const OString& rKey) const;
- OUString ReadKey(const OString& rKey, rtl_TextEncoding eEncoding) const;
OString ReadKey(const OString& rKey, const OString& rDefault) const;
void WriteKey(const OString& rKey, const OString& rValue);
void DeleteKey(const OString& rKey);
diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index a4df86d..9ac90ce 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -190,9 +190,7 @@ private:
static OUString getPPDFile( const OUString& rFile );
public:
static const PPDParser* getParser( const OUString& rFile );
- static OUString getPPDPrinterName( const OUString& rFile );
static void freeAll();
- static void getKnownPPDDrivers( std::list< OUString >& o_rDrivers, bool bRefresh = false );
const OUString& getFilename() const { return m_aFile; }
diff --git a/padmin/AllLangResTarget_spa.mk b/padmin/AllLangResTarget_spa.mk
index 12eab22..31d2608 100644
--- a/padmin/AllLangResTarget_spa.mk
+++ b/padmin/AllLangResTarget_spa.mk
@@ -28,7 +28,6 @@ $(eval $(call gb_AllLangResTarget_add_srs,spa,\
$(eval $(call gb_SrsTarget_SrsTarget,padmin/source))
$(eval $(call gb_SrsTarget_add_files,padmin/source,\
- padmin/source/padialog.src \
padmin/source/rtsetup.src \
))
diff --git a/padmin/Executable_spadmin.bin.mk b/padmin/Executable_spadmin.bin.mk
deleted file mode 100644
index 5ea6a3a..0000000
--- a/padmin/Executable_spadmin.bin.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Executable_Executable,spadmin.bin))
-
-$(eval $(call gb_Executable_use_external,spadmin.bin,boost_headers))
-
-$(eval $(call gb_Executable_use_static_libraries,spadmin.bin,\
- vclmain \
-))
-
-$(eval $(call gb_Executable_use_sdk_api,spadmin.bin))
-
-$(eval $(call gb_Executable_use_libraries,spadmin.bin,\
- spa \
- svt \
- vcl \
- utl \
- ucbhelper \
- comphelper \
- tl \
- cppuhelper \
- cppu \
- sal \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_Executable_add_exception_objects,spadmin.bin,\
- padmin/source/desktopcontext \
- padmin/source/pamain \
-))
-
-ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS)))
-$(eval $(call gb_Executable_add_libs,spadmin.bin,\
- -lpthread \
-))
-endif
-
-ifeq ($(OS),LINUX)
-$(eval $(call gb_Executable_add_libs,spadmin.bin,\
- -ldl \
-))
-endif
-
-# vim: set noet sw=4 ts=4:
diff --git a/padmin/Library_spa.mk b/padmin/Library_spa.mk
index c4588a5..57961cd 100644
--- a/padmin/Library_spa.mk
+++ b/padmin/Library_spa.mk
@@ -45,14 +45,8 @@ $(eval $(call gb_Library_use_libraries,spa,\
))
$(eval $(call gb_Library_add_exception_objects,spa,\
- padmin/source/adddlg \
- padmin/source/cmddlg \
padmin/source/helper \
- padmin/source/newppdlg \
- padmin/source/padialog \
- padmin/source/progress \
padmin/source/prtsetup \
- padmin/source/titlectrl \
))
ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS)))
diff --git a/padmin/Module_padmin.mk b/padmin/Module_padmin.mk
index 45db7aa..6ea23d9 100644
--- a/padmin/Module_padmin.mk
+++ b/padmin/Module_padmin.mk
@@ -23,9 +23,7 @@ $(eval $(call gb_Module_Module,padmin))
ifeq ($(GUIBASE),unx)
$(eval $(call gb_Module_add_targets,padmin,\
- Executable_spadmin.bin \
Library_spa \
- Package_padmin \
))
$(eval $(call gb_Module_add_l10n_targets,padmin,\
diff --git a/padmin/Package_padmin.mk b/padmin/Package_padmin.mk
deleted file mode 100644
index e706f3f..0000000
--- a/padmin/Package_padmin.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Package_Package,padmin,$(SRCDIR)/padmin/source))
-
-$(eval $(call gb_Package_add_file,padmin,$(LIBO_BIN_FOLDER)/spadmin,spadmin.sh))
-
-# vim: set noet sw=4 ts=4:
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx
deleted file mode 100644
index 7e775df..0000000
--- a/padmin/source/adddlg.cxx
+++ /dev/null
@@ -1,661 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <unistd.h>
-
-#include "adddlg.hxx"
-#include "newppdlg.hxx"
-#include "cmddlg.hxx"
-#include "padialog.hrc"
-
-#include "vcl/msgbox.hxx"
-#include "vcl/strhelper.hxx"
-#include <vcl/settings.hxx>
-
-#include <tools/config.hxx>
-#include <osl/thread.h>
-#include <rtl/strbuf.hxx>
-#include <boost/unordered_set.hpp>
-
-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 )
-{
-}
-
-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 (OUString*)m_aDriverBox.GetEntryData( i );
-}
-
-bool APChooseDriverPage::check()
-{
- return m_aDriverBox.GetSelectEntryCount() > 0;
-}
-
-void APChooseDriverPage::fill( PrinterInfo& rInfo )
-{
- sal_uInt16 nPos = m_aDriverBox.GetSelectEntryPos();
- OUString* pDriver = (OUString*)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 ) )
- {
- OUString aPrinter( AddPrinterDialog::uniquePrinterName( m_aDriverBox.GetEntry( nPos ) ) );
- rInfo.m_aPrinterName = m_aLastPrinterName = aPrinter;
- }
-}
-
-void APChooseDriverPage::updateDrivers( bool bRefresh, const OUString& rSelectDriver )
-{
- for( int k = 0; k < m_aDriverBox.GetEntryCount(); k++ )
- delete (OUString*)m_aDriverBox.GetEntryData( k );
- m_aDriverBox.Clear();
-
- std::list< OUString > aDrivers;
- psp::PPDParser::getKnownPPDDrivers( aDrivers, bRefresh );
-
- OUString aSelectDriver( psp::PPDParser::getPPDPrinterName( rSelectDriver ) );
-
- OUString aSelectedEntry;
- for( std::list< OUString >::const_iterator it = aDrivers.begin(); it != aDrivers.end(); ++it )
- {
- OUString aDriver( psp::PPDParser::getPPDPrinterName( *it ) );
- if( !aDriver.isEmpty() )
- {
- int nPos = m_aDriverBox.InsertEntry( aDriver );
- m_aDriverBox.SetEntryData( nPos, new OUString( *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< 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);
- OUString aDriver( *(OUString*)m_aDriverBox.GetEntryData( nSelect ) );
- if( !aDriver.isEmpty() )
- {
- // never delete the default driver
- if( aDriver.equalsIgnoreAsciiCase( "SGENPRT" ) )
- {
- OUString aText( PaResId( RID_ERR_REMOVESGENPRT ) );
- aText = aText.replaceFirst( OUString( "%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 )
- {
- OUString aText( PaResId( RID_ERR_REMOVEDEFAULTDRIVER ) );
- aText = aText.replaceFirst( OUString( "%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() )
- {
- OUString aText( PaResId( RID_QUERY_DRIVERUSED ) );
- aText = aText.replaceFirst( OUString( "%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
- {
- OUString aText( PaResId( RID_QUERY_REMOVEDRIVER ) );
- aText = aText.replaceFirst( OUString( "%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< OUString > aDirs;
- // get only psprint's directories, not eventual system dirs
- psp::getPrinterPathList( aDirs, NULL );
- std::list< OUString >::iterator dir;
- for( dir = aDirs.begin(); dir != aDirs.end(); ++dir )
- {
- ::std::list< OUString > aFiles;
- ::std::list< OUString >::iterator file;
- OUStringBuffer aDir( *dir );
- aDir.append( '/' );
- aDir.appendAscii( PRINTER_PPDDIR );
- OUString aPPDDir( aDir.makeStringAndClear() );
- FindFiles( aPPDDir, aFiles, OUString( "PS;PPD;PS.GZ;PPD.GZ" ), true );
- for( file = aFiles.begin(); file != aFiles.end(); ++file )
- {
- OUString aFile( aPPDDir );
- if( !aFile.endsWith( "/" ) )
- aFile += "/";
- aFile += *file;
-
- sal_Int32 nPos = file->lastIndexOf( '.' );
- OUString sCopy = nPos == -1 ? *file : file->copy(0, nPos);
- if( sCopy == aPPD )
- {
- OString aSysPath(OUStringToOString(aFile, aEncoding));
- if (unlink(aSysPath.getStr()))
- {
- OUString aText( PaResId( RID_ERR_REMOVEDRIVERFAILED ) );
- aText = aText.replaceFirst( OUString( "%s1" ), m_aDriverBox.GetSelectEntry( i ) );
- aText = aText.replaceFirst( OUString( "%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 OUString& rInitName, DeviceKind::type eKind )
- : APTabPage( pParent, PaResId( RID_ADDP_PAGE_NAME ) ),
- m_aNameTxt(
- this,
- PaResId(
- eKind == DeviceKind::Printer ? RID_ADDP_NAME_TXT_NAME : RID_ADDP_NAME_TXT_PDFNAME
- )
- ),
- m_aNameEdt(
- this,
- PaResId(
- eKind == DeviceKind::Printer ? RID_ADDP_NAME_EDT_NAME : RID_ADDP_NAME_EDT_PDFNAME
- )
- ),
- m_aDefaultBox( this, PaResId( RID_ADDP_NAME_BOX_DEFAULT ) )
-{
- FreeResource();
- if( eKind != DeviceKind::Printer )
- m_aDefaultBox.Show( false );
- else
- m_aNameEdt.SetText( rInitName );
-
- m_aNameEdt.SetText( AddPrinterDialog::uniquePrinterName( m_aNameEdt.GetText() ) );
- m_aDefaultBox.Check( false );
-}
-
-APNamePage::~APNamePage()
-{
-}
-
-bool APNamePage::check()
-{
- return !m_aNameEdt.GetText().isEmpty();
-}
-
-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( 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< OUString > 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::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< OUString >::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< OUString > aCommands;
- OUString aLastCommand( m_aCommandBox.GetText() );
- for( int i = 0; i < m_aCommandBox.GetEntryCount(); i++ )
- {
- OUString 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::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 )
- {
- OUString 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().isEmpty() );
- }
- return 0;
-}
-
-bool APCommandPage::check()
-{
- return true;
-}
-
-void APCommandPage::fill( PrinterInfo& rInfo )
-{
- rInfo.m_aCommand = m_aCommandBox.GetText();
-}
-
-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 = "SGENPRT";
- else if( isDist() )
- rInfo.m_aDriverName = "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_pCommandPage( NULL ),
- m_pChooseDriverPage( NULL ),
- m_pNamePage( NULL ),
- m_pPdfDriverPage( NULL ),
- m_pPdfSelectDriverPage( NULL ),
- m_pPdfNamePage( NULL ),
- m_pPdfCommandPage( NULL )
-{
- FreeResource();
- m_pCurrentPage = m_pPdfDriverPage = new APPdfDriverPage( 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()
-{
- delete m_pChooseDriverPage;
- delete m_pNamePage;
- delete m_pCommandPage;
- delete m_pPdfDriverPage;
- delete m_pPdfSelectDriverPage;
- delete m_pPdfNamePage;
- delete m_pPdfCommandPage;
-}
-
-void AddPrinterDialog::updateSettings()
-{
- m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER ) ) ) );
-}
-
-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_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_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;
- }
- m_aPrevPB.Enable( true );
- }
- 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, OUString(), 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_pNamePage )
- {
- m_pCurrentPage = m_pCommandPage;
- m_aNextPB.Enable( true );
- }
- else if( m_pCurrentPage == m_pCommandPage )
- {
- m_pCurrentPage = m_pChooseDriverPage;
- }
- 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() );
- 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;
- OUString aPdf( "pdf=" );
- aPdf += m_pPdfCommandPage->getPdfDir();
- aInfo.m_aFeatures = aPdf;
- rManager.changePrinterInfo( m_aPrinter.m_aPrinterName, aInfo );
- }
-}
-
-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;
-}
-
-OUString AddPrinterDialog::uniquePrinterName( const OUString& rBase )
-{
- OUString aResult( rBase );
-
- PrinterInfoManager& rManager( PrinterInfoManager::get() );
-
- sal_Int32 nVersion = 1;
- list< OUString > aPrinterList;
- rManager.listPrinters( aPrinterList );
- boost::unordered_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 += "_" ;
- aResult += OUString::number(nVersion++);
- }
-
- return aResult;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/adddlg.hxx b/padmin/source/adddlg.hxx
deleted file mode 100644
index c0b54e0..0000000
--- a/padmin/source/adddlg.hxx
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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, Pdf }; }
-
-class APTabPage : public TabPage
-{
- OUString 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 OUString& getTitle() const { return m_aTitle; }
-};
-
-class APChooseDevicePage : public APTabPage
-{
- RadioButton m_aPDFBtn;
- FixedText m_aOverTxt;
-public:
- APChooseDevicePage( AddPrinterDialog* pParent );
- ~APChooseDevicePage();
-
- 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;
-
- OUString m_aRemStr;
- OUString m_aLastPrinterName;
-
- DECL_LINK( ClickBtnHdl, PushButton* );
- DECL_LINK( DelPressedHdl, ListBox* );
-
- void updateDrivers( bool bRefresh = false, const OUString& rSelectDriver = OUString( "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;
-public:
- APNamePage( AddPrinterDialog* pParent, const OUString& rInitName, DeviceKind::type eKind );
- ~APNamePage();
-
- bool isDefault() { return m_aDefaultBox.IsChecked(); }
-
- void setText( const OUString& 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;
- OUString 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 );
-
- OUString 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 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;
-
- APCommandPage* m_pCommandPage;
- APChooseDriverPage* m_pChooseDriverPage;
- APNamePage* m_pNamePage;
- 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 OUString uniquePrinterName( const OUString& rString );
-
- void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); }
-};
-
-} // namespace
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx
deleted file mode 100644
index 89908af..0000000
--- a/padmin/source/cmddlg.cxx
+++ /dev/null
@@ -1,468 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <stdio.h>
-#include <tools/config.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <rtsetup.hrc>
-#include <cmddlg.hxx>
-#include <padialog.hxx>
-#include <helper.hxx>
-#include <prtsetup.hxx>
-
-using namespace psp;
-using namespace padmin;
-
-#define PRINTER_PERSISTENCE_GROUP "KnownPrinterCommands"
-#define PDF_PERSISTENCE_GROUP "KnowPdfCommands"
-#define MAX_COMMANDS 50
-
-void CommandStore::getSystemPrintCommands( ::std::list< OUString >& 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< OUString >& rCommands )
-{
- static bool bOnce = false;
- static ::std::list< OUString > aSysCommands;
-
- if( ! bOnce )
- {
- bOnce = true;
- char pBuffer[1024];
- FILE* pPipe;
- OUString 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 = OUString(pBuffer, nLen, aEncoding);
- if( ( ( aCommand[ 0 ] == '/' )
- || ( aCommand[ 0 ] == '.' && aCommand[ 1 ] == '/' )
- || ( aCommand[ 0 ] == '.' && aCommand[ 1 ] == '.' && aCommand[ 2 ] == '/' ) )
- && nLen > 2
- && aCommand[ nLen-2 ] == 'g'
- && aCommand[ nLen-1 ] == 's' )
- {
- aCommand += " -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 = OUString(pBuffer, nLen, aEncoding);
- if( ( ( aCommand[ 0 ] == '/' )
- || ( aCommand[ 0 ] == '.' && aCommand[ 1 ] == '/' )
- || ( aCommand[ 0 ] == '.' && aCommand[ 1 ] == '.' && aCommand[ 2 ] == '/' ) )
- && nLen > 7
- && aCommand.copy( nLen - 8 ).equalsAscii( "/distill" ) )
- {
- aCommand += " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ;
- aSysCommands.push_back( aCommand );
- }
- }
- pclose( pPipe );
- }
- }
- ::std::list< OUString >::const_iterator it;
- for( it = aSysCommands.begin(); it != aSysCommands.end(); ++it )
- rCommands.push_back( *it );
-}
-
-
-
-void CommandStore::getStoredCommands( const char* pGroup, ::std::list< OUString >& rCommands )
-{
- Config& rConfig( getPadminRC() );
- rConfig.SetGroup( pGroup );
- sal_Int32 nKeys = rConfig.GetKeyCount();
- ::std::list< OUString >::const_iterator it;
- while( nKeys-- )
- {
- OUString aCommand( rConfig.ReadKey(OString::number(nKeys), RTL_TEXTENCODING_UTF8 ) );
- if( !aCommand.isEmpty() )
- {
- 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< OUString >& rCommands,
- const ::std::list< OUString >& rSysCommands
- )
-{
- Config& rConfig( getPadminRC() );
- rConfig.DeleteGroup( pGroup );
- rConfig.SetGroup( pGroup );
- ::std::list< OUString >::const_iterator it, loop;
- ::std::list< OUString > aWriteList;
-
- sal_Int32 nWritten = 0;
- for( it = rCommands.begin(); it != rCommands.end(); ++it )
- {
- if( !it->isEmpty() )
- {
- 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( OString::number(nWritten), OUStringToOString(*it, RTL_TEXTENCODING_UTF8) );
-}
-
-
-void CommandStore::getPrintCommands( ::std::list< OUString >& rCommands )
-{
- rCommands.clear();
- getSystemPrintCommands( rCommands );
- getStoredCommands( PRINTER_PERSISTENCE_GROUP, rCommands );
-}
-
-void CommandStore::getPdfCommands( ::std::list< OUString >& rCommands )
-{
- rCommands.clear();
- getSystemPdfCommands( rCommands );
- getStoredCommands( PDF_PERSISTENCE_GROUP, rCommands );
-}
-
-void CommandStore::setPrintCommands( const ::std::list< OUString >& rCommands )
-{
- ::std::list< OUString > aSysCmds;
- getSystemPrintCommands( aSysCmds );
- setCommands( PRINTER_PERSISTENCE_GROUP, rCommands, aSysCmds );
-}
-
-void CommandStore::setPdfCommands( const ::std::list< OUString >& rCommands )
-{
- ::std::list< OUString > aSysCmds;
- getSystemPdfCommands( aSysCmds );
- setCommands( PDF_PERSISTENCE_GROUP, rCommands, aSysCmds );
-}
-
-RTSCommandPage::RTSCommandPage( RTSDialog* pParent ) :
- TabPage( pParent->m_pTabControl, 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_aHelpButton( this, PaResId( RID_RTS_CMD_BTN_HELP ) ),
- m_aRemovePB( this, PaResId( RID_RTS_CMD_BTN_REMOVE ) ),
- m_aPrinterHelp( PaResId( RID_RTS_CMD_STR_PRINTERHELP ) ),
- m_aPdfHelp( PaResId( RID_RTS_CMD_STR_PDFHELP ) ),
- m_bWasExternalDialog(false)
-{
- // configuring as printer is only sensible in default print system
- PrinterInfoManager& rMgr( PrinterInfoManager::get() );
- if( rMgr.getType() == PrinterInfoManager::Default )
- m_nPrinterEntry = m_aConfigureBox.InsertEntry( OUString( PaResId( RID_RTS_CMD_STR_CONFIGURE_PRINTER ) ) );
- else
- m_nPrinterEntry = ~0;
- m_nPdfEntry = m_aConfigureBox.InsertEntry( OUString( PaResId( RID_RTS_CMD_STR_CONFIGURE_PDF ) ) );
-
- FreeResource();
-
- CommandStore::getPrintCommands( m_aPrinterCommands );
- 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_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
- m_aQuickCB.SetText( m_pParent->m_aJobData.m_aQuickCommand );
-
- 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.startsWith( "pdf=" ) )
- {
- 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.equalsAscii( "external_dialog" ) )
- {
- m_aExternalCB.Check();
- m_bWasExternalDialog = true;
- }
- }
-
- m_aQuickCB.Enable( m_aExternalCB.IsChecked() );
-
- OUString aString( m_aConnectedTo.GetText() );
- aString += m_pParent->m_aJobData.m_aCommand;
- m_aConnectedTo.SetText( aString );
-
- UpdateCommands();
-}
-
-RTSCommandPage::~RTSCommandPage()
-{
-}
-
-void RTSCommandPage::save()
-{
- OUString aCommand,aQuickCommand;
- bool bHavePdf = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? true : false;
- ::std::list< OUString >::iterator it;
-
- OUString aFeatures;
- sal_Int32 nIndex = 0;
- OUString aOldPdfPath;
- bool bExternalDialog = m_aExternalCB.IsChecked() ? true : false;
-
- while( nIndex != -1 )
- {
- OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) );
- if( !aToken.startsWith( "pdf" ) &&
- aToken.compareToAscii( "external_dialog" )
- )
- {
- if( !aToken.isEmpty() )
- {
- if( !aFeatures.isEmpty() )
- aFeatures += ",";
- aFeatures += OUString( aToken );
- }
- }
- else if( aToken.startsWith( "pdf=" ) )
- {
- sal_Int32 nPos = 0;
- aOldPdfPath = aToken.getToken( 1, '=', nPos );
- }
- }
- ::std::list< OUString >* pList = &m_aPrinterCommands;
- if( bExternalDialog )
- {
- if( !aFeatures.isEmpty() )
- aFeatures += ",";
- aFeatures += "external_dialog" ;
- }
- if( bHavePdf )
- {
- if( !aFeatures.isEmpty() )
- aFeatures += ",";
- aFeatures += "pdf=" ;
- aFeatures += 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 != m_pParent->m_aJobData.m_aCommand ||
- aQuickCommand != m_pParent->m_aJobData.m_aQuickCommand ||
- ( m_bWasPdf && ! bHavePdf ) ||
- ( ! m_bWasPdf && bHavePdf ) ||
- ( bHavePdf && aOldPdfPath != m_aPdfDirectoryEdit.GetText() ) ||
- ( 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::setPdfCommands( m_aPdfCommands );
-}
-
-
-IMPL_LINK( RTSCommandPage, SelectHdl, Control*, pBox )
-{
- if( pBox == &m_aConfigureBox )
- {
- sal_Bool bEnable = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? sal_True : sal_False;
- m_aPdfDirectoryButton.Show( bEnable );
- m_aPdfDirectoryEdit.Show( bEnable );
- m_aPdfDirectoryText.Show( bEnable );
- UpdateCommands();
- }
- else if( pBox == &m_aCommandsCB )
- {
- m_aRemovePB.Enable( true );
- }
-
- return 0;
-}
-
-IMPL_LINK( RTSCommandPage, ClickBtnHdl, Button*, pButton )
-{
- if( pButton == & m_aPdfDirectoryButton )
- {
- OUString aPath( m_aPdfDirectoryEdit.GetText() );
- if( chooseDirectory( aPath ) )
- m_aPdfDirectoryEdit.SetText( aPath );
- }
- else if( pButton == &m_aRemovePB )
- {
- OUString aEntry( m_aCommandsCB.GetText() );
- ::std::list< OUString >* pList;
- if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
- pList = &m_aPrinterCommands;
- else
- pList = &m_aPdfCommands;
-
- pList->remove( aEntry );
- m_aCommandsCB.RemoveEntry( aEntry );
- m_aQuickCB.RemoveEntry( aEntry );
- }
- else if( pButton == &m_aHelpButton )
- {
- OUString aHelpText;
- if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
- aHelpText = m_aPrinterHelp;
- 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< OUString >::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 );
- }
- m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
- }
- 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( OUString() );
- }
-}
-
-void RTSCommandPage::ConnectCommand()
-{
- OUString aString = ( m_aConnectedTo.GetText().getToken( 0, ':' ) )
- + ": " + m_aCommandsCB.GetText();
-
- m_aConnectedTo.SetText( aString );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/cmddlg.hxx b/padmin/source/cmddlg.hxx
deleted file mode 100644
index 1fdb0aa..0000000
--- a/padmin/source/cmddlg.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _PAD_COMMANDDLG_HXX_
-#define _PAD_COMMANDDLG_HXX_
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#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< OUString >& rCommands );
- static void getSystemPrintCommands( ::std::list< OUString >& rCommands );
- static void getSystemPdfCommands( ::std::list< OUString >& rCommands );
- static void setCommands( const char* pGroup, const ::std::list< OUString >& rCommands, const ::std::list< OUString >& rSysCommands );
-
-public:
- static void getPrintCommands( ::std::list< OUString >& rCommands );
- static void getPdfCommands( ::std::list< OUString >& rCommands );
-
- static void setPrintCommands( const ::std::list< OUString >& rCommands );
- static void setPdfCommands( const ::std::list< OUString >& 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;
- sal_uInt16 m_nPrinterEntry;
- sal_uInt16 m_nPdfEntry;
- FixedText m_aPdfDirectoryText;
- PushButton m_aPdfDirectoryButton;
- Edit m_aPdfDirectoryEdit;
-
- PushButton m_aHelpButton;
- PushButton m_aRemovePB;
-
- ::std::list< OUString > m_aPrinterCommands;
- ::std::list< OUString > m_aPdfCommands;
-
- OUString m_aPrinterHelp;
- OUString m_aPdfHelp;
-
- 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
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/desktopcontext.cxx b/padmin/source/desktopcontext.cxx
deleted file mode 100644
index fe58759..0000000
--- a/padmin/source/desktopcontext.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "desktopcontext.hxx"
-
-#include <vcl/svapp.hxx>
-
-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, std::exception)
-{
- Any retVal;
-
- if ( Name.equalsAscii( 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;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/desktopcontext.hxx b/padmin/source/desktopcontext.hxx
deleted file mode 100644
index cf46700..0000000
--- a/padmin/source/desktopcontext.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 OUString& Name )
- throw (com::sun::star::uno::RuntimeException, std::exception);
-
- private:
- com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext;
- };
-}
-
-#endif // _PADMIN_DESKTOPCONTEXT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx
index fdb974c..d0e2a51 100644
--- a/padmin/source/helper.cxx
+++ b/padmin/source/helper.cxx
@@ -19,7 +19,6 @@
#include <unistd.h>
#include <helper.hxx>
-#include <padialog.hrc>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
@@ -77,110 +76,8 @@ ResId padmin::PaResId( sal_uInt32 nId )
}
/*
- * FindFiles
- */
-
-void padmin::FindFiles( const OUString& rDirectory, ::std::list< OUString >& rResult, const OUString& 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( osl_FileStatus_Mask_FileName |
- osl_FileStatus_Mask_Type
- );
- if( aItem.getFileStatus( aStatus ) == FileBase::E_None )
- {
- if( aStatus.getFileType() == FileStatus::Regular ||
- aStatus.getFileType() == FileStatus::Link )
- {
- OUString aFileName = aStatus.getFileName();
- int nToken = comphelper::string::getTokenCount(rSuffixes, ';');
- while( nToken-- )
- {
- OUString aSuffix = rSuffixes.getToken( nToken, ';' );
- if( aFileName.getLength() > aSuffix.getLength()+1 )
- {
- OUString aExtension = aFileName.copy( aFileName.getLength()-aSuffix.getLength() );
- if( aFileName[ aFileName.getLength()-aSuffix.getLength()-1 ] == '.' &&
- aExtension.equalsIgnoreAsciiCase( 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< OUString > subfiles;
- FindFiles( aSubDir.makeStringAndClear(), subfiles, rSuffixes, bRecursive );
- for( std::list< OUString >::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
- */
-
-bool DelMultiListBox::Notify( NotifyEvent& rEvent )
-{
- bool nRet = false;
-
- if( rEvent.GetType() == EVENT_KEYINPUT &&
- rEvent.GetKeyEvent()->GetKeyCode().GetCode() == KEY_DELETE )
- {
- m_aDelPressedLink.Call( this );
- nRet = true;
- }
- else
- nRet = MultiListBox::Notify( rEvent );
-
- return nRet;
-}
-
-/*
- * DelListBox
- */
-
-bool DelListBox::Notify( NotifyEvent& rEvent )
-{
- bool nRet = false;
-
- if( rEvent.GetType() == EVENT_KEYINPUT &&
- rEvent.GetKeyEvent()->GetKeyCode().GetCode() == KEY_DELETE )
- {
- m_aDelPressedLink.Call( this );
- nRet = true;
- }
- else
- nRet = ListBox::Notify( rEvent );
-
- return nRet;
-}
-
-/*
* QueryString
*/
-
QueryString::QueryString(Window* pParent, OUString& rQuery, OUString& rRet)
: ModalDialog(pParent, "QueryDialog",
"spa/ui/querydialog.ui" )
@@ -212,81 +109,4 @@ IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton )
return 0;
}
-/*
- * AreYouSure
- */
-
-sal_Bool padmin::AreYouSure( Window* pParent, int nRid )
-{
- if( nRid == -1 )
- nRid = RID_YOU_SURE;
- QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_NO,
- OUString( PaResId( nRid ) ) );
- return aQueryBox.Execute() == RET_NO ? sal_False : sal_True;
-}
-
-/*
- * getPadminRC
- */
-
-static Config* pRC = NULL;
-
-Config& padmin::getPadminRC()
-{
- if( ! pRC )
- {
- static const char* pEnv = getenv( "HOME" );
- OUString aFileName;
- if( pEnv )
- aFileName = OUString::createFromAscii( pEnv ) + "/.padminrc";
- else
- aFileName += OStringToOUString( "", osl_getThreadTextEncoding() ) + "/.padminrc";
-
- pRC = new Config( aFileName );
- }
- return *pRC;
-}
-
-void padmin::freePadminRC()
-{
- if( pRC )
- delete pRC, pRC = NULL;
-}
-
-bool padmin::chooseDirectory( OUString& rInOutPath )
-{
- bool bRet = false;
- Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);;
- Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY );
- if( xCA.is() )
- {
- try
- {
- Any aState;
- aState <<= sal_False;
- xCA->setControlProperty( OUString( "HelpButton" ),
- OUString( "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;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx
index 5a1279a..1e491d2 100644
--- a/padmin/source/helper.hxx
+++ b/padmin/source/helper.hxx
@@ -36,49 +36,8 @@
#define SPA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
-
-class Config;
-
namespace padmin
{
-class DelMultiListBox : public MultiListBox
-{
- Link m_aDelPressedLink;
-public:
- DelMultiListBox( Window* pParent, const ResId& rResId ) :
- MultiListBox( pParent, rResId ) {}
- ~DelMultiListBox() {}
-
- virtual bool 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 bool 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:
@@ -95,16 +54,8 @@ public:
~QueryString();
};
-sal_Bool AreYouSure( Window*, int nRid = -1 );
-
ResId PaResId( sal_uInt32 nId );
-void FindFiles( const OUString& rDirectory, ::std::list< OUString >& rResult, const OUString& rSuffixes, bool bRecursive = false );
-Config& getPadminRC();
-void freePadminRC();
-
-bool chooseDirectory( OUString& rInOutPath );
-
} // namespace padmin
#endif
diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx
deleted file mode 100644
index 81171ee..0000000
--- a/padmin/source/newppdlg.cxx
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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/config.hxx"
-#include "tools/urlobj.hxx"
-
-#include "osl/file.hxx"
-
-#include <list>
-
-#define PPDIMPORT_GROUP "PPDImport"
-
-using namespace padmin;
-using namespace psp;
-using namespace osl;
-
-
-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();
-
- OUString aText( m_aDriverTxt.GetText() );
- aText = aText.replaceFirst( "%s", Button::GetStandardText( BUTTON_OK ) );
- m_aDriverTxt.SetText( MnemonicGenerator::EraseAllMnemonicChars( aText ) );
-
- Config& rConfig = getPadminRC();
- rConfig.SetGroup( PPDIMPORT_GROUP );
- m_aPathBox.SetText( OStringToOUString(rConfig.ReadKey("LastDir"), RTL_TEXTENCODING_UTF8) );
- for (sal_Int32 i = 0; i < 11; ++i)
- {
- OString aEntry(rConfig.ReadKey(OString::number(i)));
- if (!aEntry.isEmpty())
- m_aPathBox.InsertEntry(OStringToOUString(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().isEmpty() )
- Import();
-}
-
-PPDImportDialog::~PPDImportDialog()
-{
- while( m_aDriverLB.GetEntryCount() )
- {
- delete (OUString*)m_aDriverLB.GetEntryData( 0 );
- m_aDriverLB.RemoveEntry( 0 );
- }
-}
-
-void PPDImportDialog::Import()
-{
- OUString aImportPath( m_aPathBox.GetText() );
-
- Config& rConfig = getPadminRC();
- rConfig.SetGroup( PPDIMPORT_GROUP );
- rConfig.WriteKey( "LastDir", OUStringToOString(aImportPath, RTL_TEXTENCODING_UTF8) );
-
- int nEntries = m_aPathBox.GetEntryCount();
- while( nEntries-- )
- if( aImportPath == m_aPathBox.GetEntry( nEntries ) )
- break;
- if( nEntries < 0 )
- {
- sal_Int32 nNextEntry = rConfig.ReadKey("NextEntry").toInt32();
- rConfig.WriteKey( OString::number(nNextEntry), OUStringToOString(aImportPath, RTL_TEXTENCODING_UTF8) );
- nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0;
- rConfig.WriteKey( "NextEntry", OString::number(nNextEntry) );
- m_aPathBox.InsertEntry( aImportPath );
- }
- while( m_aDriverLB.GetEntryCount() )
- {
- delete (OUString*)m_aDriverLB.GetEntryData( 0 );
- m_aDriverLB.RemoveEntry( 0 );
- }
-
- ProgressDialog aProgress( Application::GetFocusWindow() );
- aProgress.startOperation( m_aLoadingPPD );
-
- ::std::list< OUString > aFiles;
- FindFiles( aImportPath, aFiles, OUString( "PS;PPD;PS.GZ;PPD.GZ" ), true );
-
- int i = 0;
- aProgress.setRange( 0, aFiles.size() );
- while( !aFiles.empty() )
- {
- aProgress.setValue( ++i );
- aProgress.setFilename( aFiles.front() );
- INetURLObject aPath( aImportPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
- aPath.Append( aFiles.front() );
- OUString aPrinterName = PPDParser::getPPDPrinterName( aPath.PathToFileName() );
- aFiles.pop_front();
-
- if( aPrinterName.isEmpty() )
- {
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "Warning: File %s has empty printer name.\n",
- OUStringToOString( aPath.PathToFileName(), osl_getThreadTextEncoding() ).getStr() );
-#endif
- continue;
- }
-
- sal_uInt16 nPos = m_aDriverLB.InsertEntry( aPrinterName );
- m_aDriverLB.SetEntryData( nPos, new OUString( aPath.PathToFileName() ) );
- }
-}
-
-IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton )
-{
- if( pButton == &m_aCancelBtn )
- {
- EndDialog( 0 );
- }
- else if( pButton == &m_aOKBtn )
- {
- // copy the files
- ::std::list< OUString > aToDirs;
- psp::getPrinterPathList( aToDirs, PRINTER_PPDDIR );
- ::std::list< OUString >::iterator writeDir = aToDirs.begin();
- m_aImportedFiles.clear();
-
- for( int i = 0; i < m_aDriverLB.GetSelectEntryCount(); i++ )
- {
- INetURLObject aFile( *(OUString*)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 )
- {
- OUString 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 )
- {
- OString aDir(OUStringToOString(m_aPathBox.GetText(), osl_getThreadTextEncoding()));
- if (!access( aDir.getStr(), F_OK))
- Import();
- }
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/newppdlg.hxx b/padmin/source/newppdlg.hxx
deleted file mode 100644
index f222ef2..0000000
--- a/padmin/source/newppdlg.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _PAD_NEWPPDLG_HXX_
-#define _PAD_NEWPPDLG_HXX_
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#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;
-
- OUString m_aLoadingPPD;
-
- DECL_LINK( ClickBtnHdl, PushButton* );
- DECL_LINK( SelectHdl, ComboBox* );
- DECL_LINK( ModifyHdl, ComboBox* );
-
- void Import();
-
- std::list< OUString > m_aImportedFiles;
- public:
- PPDImportDialog( Window* pParent );
- ~PPDImportDialog();
-
- const std::list< OUString >& getImportedFiles() const
- { return m_aImportedFiles; }
- };
-
-} // namespace
-
-#endif // _NEWPPDLG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
deleted file mode 100644
index 82a54bf..0000000
--- a/padmin/source/padialog.cxx
+++ /dev/null
@@ -1,711 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <math.h>
-
-#include "padialog.hrc"
-#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 <vcl/settings.hxx>
-
-#include "tools/stream.hxx"
-#include "tools/color.hxx"
-#include "tools/urlobj.hxx"
-
-#include "osl/file.hxx"
-
-#include "rtl/ustrbuf.hxx"
-#include <sal/macros.h>
-
-#include "unotools/localedatawrapper.hxx"
-#include "unotools/configitem.hxx"
-#include "unotools/configmgr.hxx"
-
-#include "com/sun/star/awt/Size.hpp"
-
-using namespace psp;
-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, sal_Bool bAdmin )
-{
- return new PADialog( pParent, bAdmin );
-}
-
-PADialog::PADialog( Window* pParent, sal_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_aSepButtonFL( this, PaResId( RID_PA_FL_SEPBUTTON ) ),
- m_aAddPB( this, PaResId( RID_PA_BTN_ADD ) ),
- 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()
-{
- m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER ) ) );
- m_aPdfImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PDF ) ) );
-}
-
-void PADialog::Init()
-{
- // #i79787# initially ensure printer discovery has ended
- m_rPIManager.checkPrintersChanged( true );
-
- 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_aAddPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
- m_aDevicesLB.setDelPressedLink( LINK( this, PADialog, DelPressedHdl ) );
-
- // at this point no actual changes will be written
- // but the write will have checked whether any writeable config exists
- if( ! m_rPIManager.writePrinterConfig() )
- {
- m_aAddPB.Enable( false );
- m_aRemPB.Enable( false );
- m_aConfPB.Enable( false );
- m_aRenamePB.Enable( false );
- m_aStdPB.Enable( false );
- ErrorBox aBox( GetParent(), WB_OK | WB_DEF_OK, OUString( PaResId( RID_ERR_NOWRITE ) ) );
- aBox.Execute();
- }
-}
-
-PADialog::~PADialog()
-{
- m_rPIManager.writePrinterConfig();
- freePadminRC();
-}
-
-bool PADialog::Notify( NotifyEvent& rEv )
-{
- if( IsVisible() &&
- (rEv.GetType() == EVENT_GETFOCUS || rEv.GetType() == EVENT_LOSEFOCUS )
- )
- {
- if( m_rPIManager.checkPrintersChanged( true ) )
- {
- OUString 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();
- }
-}
-
-OUString 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();
-
- 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 )
- {
- OUString sSelect = getSelectedDevice();
- OUString 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.isEmpty() )
- {
- const PrinterInfo& rInfo = m_rPIManager.getPrinterInfo( aDev );
-
- OUString aDriver = rInfo.m_aPrinterName + " (" + rInfo.m_aDriverName + ")";
-
- 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
- {
- OUString 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;
- sal_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 );
-
- 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( "Courier", Size( 0, 400 ) );
- aFont.SetWeight( WEIGHT_NORMAL );
- aFont.SetItalic( ITALIC_NONE );
- pPrinter->SetFont( aFont );
-
- OUStringBuffer aPrintText(1024);
- long nWidth = 0, nMaxWidth = 0;
- OUString aToken;
-
- static const struct
- {
- const char* const pDirect;
- sal_uInt16 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 < SAL_N_ELEMENTS(aResIds); i++ )
- {
- if( aResIds[i].pDirect )
- aToken = OUString::createFromAscii(aResIds[i].pDirect);
- else
- aToken = PaResId( aResIds[i].nResId );
- nMaxWidth = ( nWidth = pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
- aPrintText.append( aToken );
- aPrintText.append( '\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() : OUString( "<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( Date::SYSTEM ) ) );
- aPrintText.appendAscii( "\n: " );
- aPrintText.append( rLocaleWrapper.getTime( Time( Time::SYSTEM ) ) );
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list