diff options
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 6b7f089f3ffd..151db7574729 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -132,9 +132,8 @@ namespace int QueryFaxNumber(OUString& rNumber) { - OUString aTmpString(VclResId(SV_PRINT_QUERYFAXNUMBER_TXT)); vcl::Window* pWin = Application::GetDefDialogParent(); - QueryString aQuery(pWin ? pWin->GetFrameWeld() : nullptr, aTmpString, rNumber); + QueryString aQuery(pWin ? pWin->GetFrameWeld() : nullptr, VclResId(SV_PRINT_QUERYFAXNUMBER_TXT), rNumber); return aQuery.run(); } } @@ -182,7 +181,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pJobSetup->SetPaperBin( 0 ); if( rData.m_pParser ) - pKey = rData.m_pParser->getKey( OUString("InputSlot") ); + pKey = rData.m_pParser->getKey( "InputSlot" ); if( pKey ) pValue = rData.m_aContext.getValue( pKey ); if( pKey && pValue ) @@ -202,7 +201,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pJobSetup->SetDuplexMode( DuplexMode::Unknown ); if( rData.m_pParser ) - pKey = rData.m_pParser->getKey( OUString("Duplex") ); + pKey = rData.m_pParser->getKey( "Duplex" ); if( pKey ) pValue = rData.m_aContext.getValue( pKey ); if( pKey && pValue ) @@ -334,13 +333,8 @@ static std::vector<OUString> getFaxNumbers() OUString aNewNr; if (QueryFaxNumber(aNewNr)) { - sal_Int32 nIndex = 0; - do - { - OUString sToken = aNewNr.getToken( 0, ';', nIndex ); - aFaxNumbers.push_back(sToken); - } - while (nIndex >= 0); + for (sal_Int32 nIndex {0}; nIndex >= 0; ) + aFaxNumbers.push_back(aNewNr.getToken( 0, ';', nIndex )); } return aFaxNumbers; @@ -348,10 +342,7 @@ static std::vector<OUString> getFaxNumbers() static bool createPdf( const OUString& rToFile, const OUString& rFromFile, const OUString& rCommandLine ) { - OUString aCommandLine( - rCommandLine.replaceAll("(OUTFILE)", rToFile)); - - return passFileToCommandLine( rFromFile, aCommandLine ); + return passFileToCommandLine( rFromFile, rCommandLine.replaceAll("(OUTFILE)", rToFile) ); } /* @@ -469,7 +460,7 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* ) if( m_aJobData.m_pParser ) { - const PPDKey* pKey = m_aJobData.m_pParser->getKey( OUString("PageSize") ); + const PPDKey* pKey = m_aJobData.m_pParser->getKey( "PageSize" ); if( pKey ) { int nValues = pKey->countValues(); @@ -593,7 +584,7 @@ bool PspSalInfoPrinter::SetData( else aPaper = OStringToOUString(PaperInfo::toPSName(pJobSetup->GetPaperFormat()), RTL_TEXTENCODING_ISO_8859_1); - pKey = aData.m_pParser->getKey( OUString("PageSize") ); + pKey = aData.m_pParser->getKey( "PageSize" ); pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : nullptr; // some PPD files do not specify the standard paper names (e.g. C5 instead of EnvC5) @@ -614,7 +605,7 @@ bool PspSalInfoPrinter::SetData( // merge paperbin if necessary if( nSetDataFlags & JobSetFlags::PAPERBIN ) { - pKey = aData.m_pParser->getKey( OUString("InputSlot") ); + pKey = aData.m_pParser->getKey( "InputSlot" ); if( pKey ) { int nPaperBin = pJobSetup->GetPaperBin(); @@ -638,22 +629,22 @@ bool PspSalInfoPrinter::SetData( // merge duplex if necessary if( nSetDataFlags & JobSetFlags::DUPLEXMODE ) { - pKey = aData.m_pParser->getKey( OUString("Duplex") ); + pKey = aData.m_pParser->getKey( "Duplex" ); if( pKey ) { pValue = nullptr; switch( pJobSetup->GetDuplexMode() ) { case DuplexMode::Off: - pValue = pKey->getValue( OUString("None") ); + pValue = pKey->getValue( "None" ); if( pValue == nullptr ) - pValue = pKey->getValue( OUString("SimplexNoTumble") ); + pValue = pKey->getValue( "SimplexNoTumble" ); break; case DuplexMode::ShortEdge: - pValue = pKey->getValue( OUString("DuplexTumble") ); + pValue = pKey->getValue( "DuplexTumble" ); break; case DuplexMode::LongEdge: - pValue = pKey->getValue( OUString("DuplexNoTumble") ); + pValue = pKey->getValue( "DuplexNoTumble" ); break; case DuplexMode::Unknown: default: @@ -725,7 +716,7 @@ sal_uInt16 PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) JobData aData; JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData ); - const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( OUString("InputSlot") ): nullptr; + const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( "InputSlot" ): nullptr; return pKey ? pKey->countValues() : 0; } @@ -734,21 +725,17 @@ OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_ JobData aData; JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData ); - OUString aRet; if( aData.m_pParser ) { - const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( OUString("InputSlot") ): nullptr; + const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( "InputSlot" ): nullptr; if( ! pKey || nPaperBin >= static_cast<sal_uInt16>(pKey->countValues()) ) - aRet = aData.m_pParser->getDefaultInputSlot(); - else - { - const PPDValue* pValue = pKey->getValue( nPaperBin ); - if( pValue ) - aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ); - } + return aData.m_pParser->getDefaultInputSlot(); + const PPDValue* pValue = pKey->getValue( nPaperBin ); + if( pValue ) + return aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption ); } - return aRet; + return OUString(); } sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType ) @@ -778,7 +765,7 @@ sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, Pr JobData aData = PrinterInfoManager::get().getPrinterInfo(pJobSetup->GetPrinterName()); if( pJobSetup->GetDriverData() ) JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData ); - const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey(OUString("Dial")) : nullptr; + const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey("Dial") : nullptr; const PPDValue* pValue = pKey ? aData.m_aContext.getValue(pKey) : nullptr; if (pValue && !pValue->m_aOption.equalsIgnoreAsciiCase("Manually")) return 1; @@ -880,13 +867,7 @@ bool PspSalPrinter::StartJob( nMode = S_IRUSR | S_IWUSR; if( m_aFileName.isEmpty() ) - { - OUStringBuffer aFileName( getPdfDir( rInfo ) ); - aFileName.append( '/' ); - aFileName.append( rJobName ); - aFileName.append( ".pdf" ); - m_aFileName = aFileName.makeStringAndClear(); - } + m_aFileName = getPdfDir( rInfo ) + "/" + rJobName + ".pdf"; break; } } @@ -1000,7 +981,7 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo // possibly create one job for collated output bool bSinglePrintJobs = false; - beans::PropertyValue* pSingleValue = i_rController.getValue( OUString( "PrintCollateAsSingleJobs" ) ); + beans::PropertyValue* pSingleValue = i_rController.getValue( "PrintCollateAsSingleJobs" ); if( pSingleValue ) { pSingleValue->Value >>= bSinglePrintJobs; |