[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/openoffice.org/devel openoffice.org-1.9.121.rh127576.gnomeprintui.patch, 1.2, 1.3



Author: caolanm

Update of /cvs/dist/rpms/openoffice.org/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv603

Modified Files:
	openoffice.org-1.9.121.rh127576.gnomeprintui.patch 
Log Message:
sfx2 built after svtools, rejig with uno api

openoffice.org-1.9.121.rh127576.gnomeprintui.patch:
 inc/jobset.hxx                      |    0 
 inc/print.hxx                       |    0 
 psprint/source/printer/cupsmgr.cxx  |    7 
 source/dialogs/makefile.mk          |    0 
 source/dialogs/printdlg.cxx         |    0 
 source/gdi/jobset.cxx               |    0 
 source/printer/cupsmgr.cxx          |    0 
 svtools/source/dialogs/makefile.mk  |    4 
 svtools/source/dialogs/printdlg.cxx |  487 +++++++++++++++++++++++++++++++++++-
 svtools/util/makefile.mk            |    8 
 util/makefile.mk                    |    0 
 vcl/inc/jobset.hxx                  |    1 
 vcl/inc/print.hxx                   |    1 
 vcl/source/gdi/jobset.cxx           |  194 ++++++++++++++
 14 files changed, 699 insertions(+), 3 deletions(-)

Index: openoffice.org-1.9.121.rh127576.gnomeprintui.patch
===================================================================
RCS file: /cvs/dist/rpms/openoffice.org/devel/openoffice.org-1.9.121.rh127576.gnomeprintui.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- openoffice.org-1.9.121.rh127576.gnomeprintui.patch	26 Jul 2005 07:41:27 -0000	1.2
+++ openoffice.org-1.9.121.rh127576.gnomeprintui.patch	26 Jul 2005 09:37:02 -0000	1.3
@@ -28,13 +28,258 @@
  }
  
  #ifdef ENABLE_CUPS
+Index: inc/print.hxx
+===================================================================
+RCS file: /cvs/gsl/vcl/inc/print.hxx,v
+retrieving revision 1.21
+diff -u -p -u -r1.21 print.hxx
+--- openoffice.org.orig/vcl/inc/print.hxx	31 Jan 2005 09:15:32 -0000	1.21
++++ openoffice.org/vcl/inc/print.hxx	25 Jul 2005 14:22:25 -0000
+@@ -382,6 +382,7 @@ public:
+ 	const JobSetup& 			GetJobSetup() const { return maJobSetup; }
+ 	String						GetJobValue( const String& rKey ) const { return maJobSetup.GetValue( rKey ); }
+ 	void						SetJobValue( const String& rKey, const String& rValue ) { maJobSetup.SetValue( rKey, rValue ); }
++	void						SetJobKey( const String& rKey, const String& rValue ) { maJobSetup.SetKey( rKey, rValue ); }
+ 
+ 	BOOL						Setup( Window* pWindow = NULL );
+ 	BOOL						SetPrinterProps( const Printer* pPrinter );
+Index: source/gdi/jobset.cxx
+===================================================================
+RCS file: /cvs/gsl/vcl/source/gdi/jobset.cxx,v
+retrieving revision 1.8
+diff -u -p -u -r1.8 jobset.cxx
+--- openoffice.org.orig/vcl/source/gdi/jobset.cxx	6 Jan 2004 13:46:09 -0000	1.8
++++ openoffice.org/vcl/source/gdi/jobset.cxx	25 Jul 2005 14:22:37 -0000
+@@ -76,6 +76,7 @@
+ #include <jobset.h>
+ #endif
+ 
++#include <psprint/printerinfomanager.hxx>
+ // =======================================================================
+ 
+ DBG_NAME( JobSetup );
+@@ -267,6 +268,199 @@ void JobSetup::SetValue( const String& r
+ 		mpData = new ImplJobSetup();
+ 
+ 	mpData->maValueMap[ rKey ] = rValue;
++}
++
++inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778)+0.5); }
++void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData );
++
++static struct
++{
++	int			width;
++	int			height;
++	const char*	name;
++	int			namelength;
++	Paper		paper;
++} aPaperTab[] =
++{
++	{ 29700, 42000,	"A3",			2,	PAPER_A3		},
++	{ 21000, 29700,	"A4",			2,	PAPER_A4		},
++	{ 14800, 21000,	"A5",			2,	PAPER_A5		},
++	{ 25000, 35300,	"B4",			2,	PAPER_B4		},
++	{ 17600, 25000,	"B5",			2,	PAPER_B5		},
++	{ 21600, 27900,	"Letter",		6,	PAPER_LETTER	},
++	{ 21600, 35600,	"Legal",		5,	PAPER_LEGAL		},
++	{ 27900, 43100,	"Tabloid",		7,	PAPER_TABLOID	},
++	{ 0, 0,	  		"USER",			4,	PAPER_USER		}
++};
++
++static Paper getPaperType( const String& rPaperName )
++{
++	ByteString aPaper( rPaperName, RTL_TEXTENCODING_ISO_8859_1 );
++	for( unsigned int i = 0; i < sizeof( aPaperTab )/sizeof( aPaperTab[0] ); i++ )
++	{
++		if( ! strcmp( aPaper.GetBuffer(), aPaperTab[i].name ) )
++			return aPaperTab[i].paper;
++	}
++	return PAPER_USER;
++}
++
++
++
++void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData )
++{
++	using namespace psp;
++
++	pJobSetup->meOrientation	= (Orientation)(rData.m_eOrientation == orientation::Landscape ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
++
++
++	// copy page size
++	String aPaper;
++	int width, height;
++
++	rData.m_aContext.getPageSize( aPaper, width, height );
++	pJobSetup->mePaperFormat	= getPaperType( aPaper );
++	pJobSetup->mnPaperWidth		= 0;
++	pJobSetup->mnPaperHeight	= 0;
++	if( pJobSetup->mePaperFormat == PAPER_USER )
++	{
++		// transform to 100dth mm
++		width				= PtTo10Mu( width );
++		height				= PtTo10Mu( height );
++
++        if( rData.m_eOrientation == psp::orientation::Portrait )
++        {
++            pJobSetup->mnPaperWidth	= width;
++            pJobSetup->mnPaperHeight= height;
++        }
++        else
++        {
++            pJobSetup->mnPaperWidth	= height;
++            pJobSetup->mnPaperHeight= width;
++        }
++	}
++
++	// copy input slot
++	const PPDKey* pKey = NULL;
++	const PPDValue* pValue = NULL;
++
++    pJobSetup->mnPaperBin = 0xffff;
++	pKey						= rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
++    if( pKey )
++        pValue					= rData.m_aContext.getValue( pKey );
++    if( pKey && pValue )
++    {
++        for( pJobSetup->mnPaperBin = 0;
++             pValue != pKey->getValue( pJobSetup->mnPaperBin ) &&
++                 pJobSetup->mnPaperBin < pKey->countValues();
++             pJobSetup->mnPaperBin++ )
++            ;
++        if( pJobSetup->mnPaperBin >= pKey->countValues() || pValue == pKey->getDefaultValue() )
++            pJobSetup->mnPaperBin = 0xffff;
++    }
++	
++
++	// copy the whole context
++	if( pJobSetup->mpDriverData )
++		rtl_freeMemory( pJobSetup->mpDriverData );
++
++	int nBytes;
++	void* pBuffer = NULL;
++	if( rData.getStreamBuffer( pBuffer, nBytes ) )
++	{
++		pJobSetup->mnDriverDataLen = nBytes;
++		pJobSetup->mpDriverData = (BYTE*)pBuffer;
++	}
++	else
++	{
++		pJobSetup->mnDriverDataLen = 0;
++		pJobSetup->mpDriverData = NULL;
++	}
++}
++
++void JobSetup::SetKey( const String& rKey, const String& rValue )
++{
++	if( ! mpData )
++		mpData = new ImplJobSetup();
++
++	using namespace psp;
++
++	PrinterInfoManager& rManager = PrinterInfoManager::get();
++	PrinterInfo aInfo(rManager.getPrinterInfo(mpData->maPrinterName));
++	if (mpData->mpDriverData )
++	{
++		JobData::constructFromStreamBuffer(mpData->mpDriverData, 
++		mpData->mnDriverDataLen, aInfo);
++	}
++	if (aInfo.m_pParser)
++	{
++		if (const PPDKey* pKey = aInfo.m_pParser->getKey(rKey))
++		{
++			bool bFound = false;
++			for (int i = 0; i < pKey->countValues(); ++i)
++			{
++               	const PPDValue *pValue = pKey->getValue(i);
++               	if (rValue == pValue->m_aOption)
++				{
++					aInfo.m_aContext.setValue(pKey, pValue);
++					bFound = true;
++					break;
++				}
++			}
++			if (!bFound && rKey == String::CreateFromAscii("PageSize"))
++			{
++				String aString(rValue);
++				if (aString == String::CreateFromAscii("USLetter"))
++					aString = String::CreateFromAscii("Letter");
++				else if (aString == String::CreateFromAscii("USLegal"))
++					aString = String::CreateFromAscii("Legal");
++				for (int i = 0; i < pKey->countValues(); ++i)
++				{
++					const PPDValue *pValue = pKey->getValue(i);
++					if (aString == pValue->m_aOption)
++					{
++						aInfo.m_aContext.setValue(pKey, pValue);
++						bFound = true;
++						break;
++					}
++				}
++			}
++			if (!bFound)	
++				fprintf(stderr, "Unknown value\n");
++		}
++		else
++		{
++			fprintf(stderr, "Unknown key\n");
++		}
++	}
++
++    String aPaper;
++    int nWidth, nHeight;
++    aInfo.m_aContext.getPageSize (aPaper, nWidth, nHeight);
++
++	copyJobDataToJobSetup( mpData, aInfo );
++
++#if 0
++	// copy the whole context
++	if (mpData->mpDriverData)
++		rtl_freeMemory( mpData->mpDriverData );
++
++	int nBytes;
++	void* pBuffer = NULL;
++	if( aInfo.getStreamBuffer( pBuffer, nBytes ) )
++	{
++		mpData->mnDriverDataLen = nBytes;
++	        mpData->mpDriverData = (BYTE*)pBuffer;
++	}
++	else
++	{
++	        mpData->mnDriverDataLen = 0;
++	        mpData->mpDriverData = NULL;
++	}
++
++
++	mpData->mnDriverDataLen = nBytes;
++        mpData->mpDriverData = (BYTE*)pBuffer;
++#endif
+ }
+ 
+ // -----------------------------------------------------------------------
+Index: inc/jobset.hxx
+===================================================================
+RCS file: /cvs/gsl/vcl/inc/jobset.hxx,v
+retrieving revision 1.6
+diff -u -p -u -r1.6 jobset.hxx
+--- openoffice.org.orig/vcl/inc/jobset.hxx	13 Jan 2005 17:38:31 -0000	1.6
++++ openoffice.org/vcl/inc/jobset.hxx	26 Jul 2005 07:39:58 -0000
+@@ -113,6 +113,7 @@ public:
+ 	 */
+ 	String				GetValue( const String& rKey ) const;
+ 	void				SetValue( const String& rKey, const String& rValue );
++	void				SetKey( const String& rKey, const String& rValue );
+ 	
+ 
+ 	JobSetup&			operator=( const JobSetup& rJob );
 Index: source/dialogs/makefile.mk
 ===================================================================
 RCS file: /cvs/util/svtools/source/dialogs/makefile.mk,v
 retrieving revision 1.13
 diff -u -p -u -r1.13 makefile.mk
 --- openoffice.org.orig/svtools/source/dialogs/makefile.mk	27 Apr 2005 09:45:56 -0000	1.13
-+++ openoffice.org/svtools/source/dialogs/makefile.mk	25 Jul 2005 14:24:16 -0000
++++ openoffice.org/svtools/source/dialogs/makefile.mk	26 Jul 2005 09:34:09 -0000
 @@ -70,6 +70,10 @@ TARGET=dialogs
  .INCLUDE :	settings.mk
  .INCLUDE :  $(PRJ)$/util$/svt.pmk
@@ -52,18 +297,31 @@
 retrieving revision 1.20
 diff -u -p -u -r1.20 printdlg.cxx
 --- openoffice.org.orig/svtools/source/dialogs/printdlg.cxx	3 Feb 2004 17:02:46 -0000	1.20
-+++ openoffice.org/svtools/source/dialogs/printdlg.cxx	25 Jul 2005 14:24:19 -0000
-@@ -109,6 +109,33 @@
++++ openoffice.org/svtools/source/dialogs/printdlg.cxx	26 Jul 2005 09:34:09 -0000
+@@ -109,8 +109,50 @@
  #include <comphelper/processfactory.hxx>
  #endif
  
 +#if 1
++#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
++#include <com/sun/star/frame/XFrame.hpp>
++#endif
++#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
++#include <com/sun/star/util/URL.hpp>
++#endif
++#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
++#include <com/sun/star/util/XURLTransformer.hpp>
++#endif
++#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
++#include <com/sun/star/frame/XDispatchProvider.hpp>
++#endif
++#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
++#include <com/sun/star/beans/PropertyValue.hpp>
++#endif
++
 +#include <libgnomeprintui/gnome-print-dialog.h>
 +#include <libgnomeprintui/gnome-print-job-preview.h>
-+#include <svtools/stritem.hxx> 
-+#include <sfx2/viewfrm.hxx>
-+#include <sfx2/bindings.hxx>
-+#include <sfx2/dispatch.hxx>
++#include <stritem.hxx> 
 +#include <osl/file.hxx>
 +#include <osl/process.h>
 +#define WE_ARE_LIBGNOMEPRINT_INTERNALS
@@ -86,8 +344,12 @@
 +
  using namespace com::sun::star::uno;
  using namespace com::sun::star::lang;
++using namespace ::com::sun::star::frame;
++using namespace ::com::sun::star::beans;
  using namespace com::sun::star::ui::dialogs;
-@@ -632,6 +661,118 @@ void PrintDialog::DataChanged( const Dat
+ using namespace rtl;
+ 
+@@ -632,6 +674,118 @@ void PrintDialog::DataChanged( const Dat
  
  // -----------------------------------------------------------------------
  
@@ -200,13 +462,13 @@
 +	}
 +	return sString;
 +}
-+
++#define ASCII_STR(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
 +#endif
 +
  short PrintDialog::Execute()
  {
  	if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() )
-@@ -647,6 +796,310 @@ short PrintDialog::Execute()
+@@ -647,6 +801,337 @@ short PrintDialog::Execute()
  	ImplInitControls();
  	ImplModifyControlHdl( NULL );
  
@@ -357,11 +619,38 @@
 +	
 +			if (bPrintToPDF)
 +			{
-+				SfxViewFrame* pFrm = SfxViewFrame::Current();
-+				SfxDispatcher* pDisp = pFrm->GetDispatcher();
-+				SfxStringItem aFileName(SID_FILE_NAME, sAbsFileURL);
-+				pDisp->Execute(SID_EXPORTDOCASPDF, 
-+					SFX_CALLMODE_SYNCHRON, &aFileName, 0L );
++  				Reference < XFramesSupplier > xDesktop = 
++					Reference < XFramesSupplier >(
++        			::comphelper::getProcessServiceFactory()->
++				        createInstance(
++							ASCII_STR("com.sun.star.frame.Desktop") ), 
++								UNO_QUERY );
++				Reference < XFrame > xFrame( xDesktop->getActiveFrame() );
++				if ( !xFrame.is() )
++			        xFrame = Reference < XFrame >( xDesktop, UNO_QUERY );
++
++				com::sun::star::util::URL aTargetURL;
++    			aTargetURL.Complete = ASCII_STR(".uno:ExportToPDF");
++
++				Reference < com::sun::star::util::XURLTransformer > 
++					xTrans( ::comphelper::getProcessServiceFactory()->
++						createInstance(
++							ASCII_STR("com.sun.star.util.URLTransformer") ), 
++								UNO_QUERY );
++				xTrans->parseStrict( aTargetURL );
++
++				Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
++				Reference < XDispatch > xDisp;
++				xDisp = xProv->queryDispatch(aTargetURL, ::rtl::OUString(), 0);
++
++				if (xDisp.is())
++				{
++					Sequence<PropertyValue> aArgs(1);
++			        PropertyValue* pArg = aArgs.getArray();
++			        pArg[0].Name = ASCII_STR("FileName");
++			        pArg[0].Value <<= sAbsFileURL;
++			        xDisp->dispatch( aTargetURL, aArgs );
++				}
 +				nRet = FALSE;
 +			}
 +			else
@@ -517,7 +806,7 @@
  	// Dialog starten
  	short nRet = ModalDialog::Execute();
  
-@@ -657,6 +1128,7 @@ short PrintDialog::Execute()
+@@ -657,6 +1142,7 @@ short PrintDialog::Execute()
  			mpPrinter->SetPrinterProps( TEMPPRINTER() );
  		ImplFillDialogData();
  	}
@@ -525,7 +814,7 @@
  
  	maStatusTimer.Stop();
  
-@@ -670,4 +1142,3 @@ void PrintDialog::DisableHelp()
+@@ -670,4 +1156,3 @@ void PrintDialog::DisableHelp()
  	mpPrinterImpl->m_bHelpDisabled = sal_True;
  	maBtnHelp.Disable();
  }
@@ -533,10 +822,10 @@
 Index: util/makefile.mk
 ===================================================================
 RCS file: /cvs/util/svtools/util/makefile.mk,v
-retrieving revision 1.53
-diff -u -p -u -r1.53 makefile.mk
---- openoffice.org.orig/svtools/util/makefile.mk	7 Jul 2005 13:11:33 -0000	1.53
-+++ openoffice.org/svtools/util/makefile.mk	25 Jul 2005 14:24:43 -0000
+retrieving revision 1.54
+diff -u -p -u -r1.54 makefile.mk
+--- openoffice.org.orig/svtools/util/makefile.mk	18 Jul 2005 11:55:39 -0000	1.54
++++ openoffice.org/svtools/util/makefile.mk	26 Jul 2005 09:34:32 -0000
 @@ -71,6 +71,9 @@ GEN_HID=TRUE
  GEN_HID_OTHER=TRUE
  ENABLE_EXCEPTIONS=TRUE
@@ -547,13 +836,12 @@
  # --- Settings -----------------------------------------------------
  
  .INCLUDE :	settings.mk
-@@ -184,8 +187,12 @@ SHL1STDLIBS+= \
+@@ -180,8 +183,11 @@ SHL1STDLIBS+= \
  		$(CPPULIB)			\
  		$(VOSLIB)			\
  		$(SALLIB)			\
 -		$(ICUUCLIB)		\
 +		$(ICUUCLIB)			\
-+		$(SFXLIB)			\
 +		-lpsp$(VERSION)$(DLLPOSTFIX)\
  		$(JVMFWKLIB)
 +
@@ -561,248 +849,3 @@
  
  .IF "$(OS)"=="MACOSX"
  # static libraries go at end
-Index: inc/print.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/print.hxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 print.hxx
---- openoffice.org.orig/vcl/inc/print.hxx	31 Jan 2005 09:15:32 -0000	1.21
-+++ openoffice.org/vcl/inc/print.hxx	25 Jul 2005 14:22:25 -0000
-@@ -382,6 +382,7 @@ public:
- 	const JobSetup& 			GetJobSetup() const { return maJobSetup; }
- 	String						GetJobValue( const String& rKey ) const { return maJobSetup.GetValue( rKey ); }
- 	void						SetJobValue( const String& rKey, const String& rValue ) { maJobSetup.SetValue( rKey, rValue ); }
-+	void						SetJobKey( const String& rKey, const String& rValue ) { maJobSetup.SetKey( rKey, rValue ); }
- 
- 	BOOL						Setup( Window* pWindow = NULL );
- 	BOOL						SetPrinterProps( const Printer* pPrinter );
-Index: source/gdi/jobset.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/jobset.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 jobset.cxx
---- openoffice.org.orig/vcl/source/gdi/jobset.cxx	6 Jan 2004 13:46:09 -0000	1.8
-+++ openoffice.org/vcl/source/gdi/jobset.cxx	25 Jul 2005 14:22:37 -0000
-@@ -76,6 +76,7 @@
- #include <jobset.h>
- #endif
- 
-+#include <psprint/printerinfomanager.hxx>
- // =======================================================================
- 
- DBG_NAME( JobSetup );
-@@ -267,6 +268,199 @@ void JobSetup::SetValue( const String& r
- 		mpData = new ImplJobSetup();
- 
- 	mpData->maValueMap[ rKey ] = rValue;
-+}
-+
-+inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778)+0.5); }
-+void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData );
-+
-+static struct
-+{
-+	int			width;
-+	int			height;
-+	const char*	name;
-+	int			namelength;
-+	Paper		paper;
-+} aPaperTab[] =
-+{
-+	{ 29700, 42000,	"A3",			2,	PAPER_A3		},
-+	{ 21000, 29700,	"A4",			2,	PAPER_A4		},
-+	{ 14800, 21000,	"A5",			2,	PAPER_A5		},
-+	{ 25000, 35300,	"B4",			2,	PAPER_B4		},
-+	{ 17600, 25000,	"B5",			2,	PAPER_B5		},
-+	{ 21600, 27900,	"Letter",		6,	PAPER_LETTER	},
-+	{ 21600, 35600,	"Legal",		5,	PAPER_LEGAL		},
-+	{ 27900, 43100,	"Tabloid",		7,	PAPER_TABLOID	},
-+	{ 0, 0,	  		"USER",			4,	PAPER_USER		}
-+};
-+
-+static Paper getPaperType( const String& rPaperName )
-+{
-+	ByteString aPaper( rPaperName, RTL_TEXTENCODING_ISO_8859_1 );
-+	for( unsigned int i = 0; i < sizeof( aPaperTab )/sizeof( aPaperTab[0] ); i++ )
-+	{
-+		if( ! strcmp( aPaper.GetBuffer(), aPaperTab[i].name ) )
-+			return aPaperTab[i].paper;
-+	}
-+	return PAPER_USER;
-+}
-+
-+
-+
-+void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData )
-+{
-+	using namespace psp;
-+
-+	pJobSetup->meOrientation	= (Orientation)(rData.m_eOrientation == orientation::Landscape ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
-+
-+
-+	// copy page size
-+	String aPaper;
-+	int width, height;
-+
-+	rData.m_aContext.getPageSize( aPaper, width, height );
-+	pJobSetup->mePaperFormat	= getPaperType( aPaper );
-+	pJobSetup->mnPaperWidth		= 0;
-+	pJobSetup->mnPaperHeight	= 0;
-+	if( pJobSetup->mePaperFormat == PAPER_USER )
-+	{
-+		// transform to 100dth mm
-+		width				= PtTo10Mu( width );
-+		height				= PtTo10Mu( height );
-+
-+        if( rData.m_eOrientation == psp::orientation::Portrait )
-+        {
-+            pJobSetup->mnPaperWidth	= width;
-+            pJobSetup->mnPaperHeight= height;
-+        }
-+        else
-+        {
-+            pJobSetup->mnPaperWidth	= height;
-+            pJobSetup->mnPaperHeight= width;
-+        }
-+	}
-+
-+	// copy input slot
-+	const PPDKey* pKey = NULL;
-+	const PPDValue* pValue = NULL;
-+
-+    pJobSetup->mnPaperBin = 0xffff;
-+	pKey						= rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
-+    if( pKey )
-+        pValue					= rData.m_aContext.getValue( pKey );
-+    if( pKey && pValue )
-+    {
-+        for( pJobSetup->mnPaperBin = 0;
-+             pValue != pKey->getValue( pJobSetup->mnPaperBin ) &&
-+                 pJobSetup->mnPaperBin < pKey->countValues();
-+             pJobSetup->mnPaperBin++ )
-+            ;
-+        if( pJobSetup->mnPaperBin >= pKey->countValues() || pValue == pKey->getDefaultValue() )
-+            pJobSetup->mnPaperBin = 0xffff;
-+    }
-+	
-+
-+	// copy the whole context
-+	if( pJobSetup->mpDriverData )
-+		rtl_freeMemory( pJobSetup->mpDriverData );
-+
-+	int nBytes;
-+	void* pBuffer = NULL;
-+	if( rData.getStreamBuffer( pBuffer, nBytes ) )
-+	{
-+		pJobSetup->mnDriverDataLen = nBytes;
-+		pJobSetup->mpDriverData = (BYTE*)pBuffer;
-+	}
-+	else
-+	{
-+		pJobSetup->mnDriverDataLen = 0;
-+		pJobSetup->mpDriverData = NULL;
-+	}
-+}
-+
-+void JobSetup::SetKey( const String& rKey, const String& rValue )
-+{
-+	if( ! mpData )
-+		mpData = new ImplJobSetup();
-+
-+	using namespace psp;
-+
-+	PrinterInfoManager& rManager = PrinterInfoManager::get();
-+	PrinterInfo aInfo(rManager.getPrinterInfo(mpData->maPrinterName));
-+	if (mpData->mpDriverData )
-+	{
-+		JobData::constructFromStreamBuffer(mpData->mpDriverData, 
-+		mpData->mnDriverDataLen, aInfo);
-+	}
-+	if (aInfo.m_pParser)
-+	{
-+		if (const PPDKey* pKey = aInfo.m_pParser->getKey(rKey))
-+		{
-+			bool bFound = false;
-+			for (int i = 0; i < pKey->countValues(); ++i)
-+			{
-+               	const PPDValue *pValue = pKey->getValue(i);
-+               	if (rValue == pValue->m_aOption)
-+				{
-+					aInfo.m_aContext.setValue(pKey, pValue);
-+					bFound = true;
-+					break;
-+				}
-+			}
-+			if (!bFound && rKey == String::CreateFromAscii("PageSize"))
-+			{
-+				String aString(rValue);
-+				if (aString == String::CreateFromAscii("USLetter"))
-+					aString = String::CreateFromAscii("Letter");
-+				else if (aString == String::CreateFromAscii("USLegal"))
-+					aString = String::CreateFromAscii("Legal");
-+				for (int i = 0; i < pKey->countValues(); ++i)
-+				{
-+					const PPDValue *pValue = pKey->getValue(i);
-+					if (aString == pValue->m_aOption)
-+					{
-+						aInfo.m_aContext.setValue(pKey, pValue);
-+						bFound = true;
-+						break;
-+					}
-+				}
-+			}
-+			if (!bFound)	
-+				fprintf(stderr, "Unknown value\n");
-+		}
-+		else
-+		{
-+			fprintf(stderr, "Unknown key\n");
-+		}
-+	}
-+
-+    String aPaper;
-+    int nWidth, nHeight;
-+    aInfo.m_aContext.getPageSize (aPaper, nWidth, nHeight);
-+
-+	copyJobDataToJobSetup( mpData, aInfo );
-+
-+#if 0
-+	// copy the whole context
-+	if (mpData->mpDriverData)
-+		rtl_freeMemory( mpData->mpDriverData );
-+
-+	int nBytes;
-+	void* pBuffer = NULL;
-+	if( aInfo.getStreamBuffer( pBuffer, nBytes ) )
-+	{
-+		mpData->mnDriverDataLen = nBytes;
-+	        mpData->mpDriverData = (BYTE*)pBuffer;
-+	}
-+	else
-+	{
-+	        mpData->mnDriverDataLen = 0;
-+	        mpData->mpDriverData = NULL;
-+	}
-+
-+
-+	mpData->mnDriverDataLen = nBytes;
-+        mpData->mpDriverData = (BYTE*)pBuffer;
-+#endif
- }
- 
- // -----------------------------------------------------------------------
-Index: inc/jobset.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/jobset.hxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 jobset.hxx
---- openoffice.org.orig/vcl/inc/jobset.hxx	13 Jan 2005 17:38:31 -0000	1.6
-+++ openoffice.org/vcl/inc/jobset.hxx	26 Jul 2005 07:39:58 -0000
-@@ -113,6 +113,7 @@ public:
- 	 */
- 	String				GetValue( const String& rKey ) const;
- 	void				SetValue( const String& rKey, const String& rValue );
-+	void				SetKey( const String& rKey, const String& rValue );
- 	
- 
- 	JobSetup&			operator=( const JobSetup& rJob );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]