[Libreoffice-commits] core.git: 3 commits - include/vcl vcl/headless vcl/source vcl/unx vcl/win
Noel Grandin
noel at peralex.com
Mon Sep 5 08:39:58 UTC 2016
include/vcl/ppdparser.hxx | 2 -
include/vcl/printerinfomanager.hxx | 4 +-
include/vcl/prntypes.hxx | 3 +-
vcl/headless/svpprn.cxx | 8 ++---
vcl/source/gdi/jobset.cxx | 36 ++++++++++++-------------
vcl/source/gdi/print3.cxx | 6 ++--
vcl/unx/generic/print/genprnpsp.cxx | 16 +++++------
vcl/unx/generic/print/printerjob.cxx | 6 ++--
vcl/unx/generic/printer/cupsmgr.cxx | 4 +-
vcl/unx/generic/printer/ppdparser.cxx | 16 +++++------
vcl/unx/generic/printer/printerinfomanager.cxx | 4 +-
vcl/win/gdi/salprn.cxx | 16 +++++------
12 files changed, 61 insertions(+), 60 deletions(-)
New commits:
commit 74ab2a686144545255a2f07dde3f14f66f37753e
Author: Noel Grandin <noel at peralex.com>
Date: Mon Sep 5 10:38:05 2016 +0200
Convert PPDKey::SetupType to scoped enum
Change-Id: I7c39c9bd4bc3b8fe82840665906f8d520e2e2d2a
diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 34b41cf..dd8afb0 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -74,7 +74,7 @@ class VCL_DLLPUBLIC PPDKey
public:
enum UIType { PickOne, PickMany, Boolean };
- enum SetupType { ExitServer, Prolog, DocumentSetup, PageSetup, JCLSetup, AnySetup };
+ enum class SetupType { ExitServer, Prolog, DocumentSetup, PageSetup, JCLSetup, AnySetup };
private:
bool m_bUIOption;
diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx
index 0adb334..1f9689a 100644
--- a/vcl/unx/generic/print/printerjob.cxx
+++ b/vcl/unx/generic/print/printerjob.cxx
@@ -731,11 +731,11 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
bool bEmit = false;
if( bDocumentSetup )
{
- if( pKey->getSetupType() == PPDKey::DocumentSetup )
+ if( pKey->getSetupType() == PPDKey::SetupType::DocumentSetup )
bEmit = true;
}
- if( pKey->getSetupType() == PPDKey::PageSetup ||
- pKey->getSetupType() == PPDKey::AnySetup )
+ if( pKey->getSetupType() == PPDKey::SetupType::PageSetup ||
+ pKey->getSetupType() == PPDKey::SetupType::AnySetup )
bEmit = true;
if( bEmit )
{
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 231cd90..18de0da 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1261,17 +1261,17 @@ void PPDParser::parseOrderDependency(const OString& rLine)
pKey->m_nOrderDependency = nOrder;
if( aSetup == "ExitServer" )
- pKey->m_eSetupType = PPDKey::ExitServer;
+ pKey->m_eSetupType = PPDKey::SetupType::ExitServer;
else if( aSetup == "Prolog" )
- pKey->m_eSetupType = PPDKey::Prolog;
+ pKey->m_eSetupType = PPDKey::SetupType::Prolog;
else if( aSetup == "DocumentSetup" )
- pKey->m_eSetupType = PPDKey::DocumentSetup;
+ pKey->m_eSetupType = PPDKey::SetupType::DocumentSetup;
else if( aSetup == "PageSetup" )
- pKey->m_eSetupType = PPDKey::PageSetup;
+ pKey->m_eSetupType = PPDKey::SetupType::PageSetup;
else if( aSetup == "JCLSetup" )
- pKey->m_eSetupType = PPDKey::JCLSetup;
+ pKey->m_eSetupType = PPDKey::SetupType::JCLSetup;
else
- pKey->m_eSetupType = PPDKey::AnySetup;
+ pKey->m_eSetupType = PPDKey::SetupType::AnySetup;
}
void PPDParser::parseConstraint( const OString& rLine )
@@ -1504,7 +1504,7 @@ PPDKey::PPDKey( const OUString& rKey ) :
m_bUIOption( false ),
m_eUIType( PickOne ),
m_nOrderDependency( 100 ),
- m_eSetupType( AnySetup )
+ m_eSetupType( SetupType::AnySetup )
{
}
commit 2e3717837ffe257f98c854ebde2c7a0ac0ff27fb
Author: Noel Grandin <noel at peralex.com>
Date: Mon Sep 5 10:17:51 2016 +0200
convert PrinterInfoManager::Type to scoped enum
Change-Id: I3ae15e3ef9505b9857ab1dfa0ecdbf57e3a08150
diff --git a/include/vcl/printerinfomanager.hxx b/include/vcl/printerinfomanager.hxx
index 471c3a9..77ab898 100644
--- a/include/vcl/printerinfomanager.hxx
+++ b/include/vcl/printerinfomanager.hxx
@@ -61,7 +61,7 @@ struct PrinterInfo : JobData
class VCL_DLLPUBLIC PrinterInfoManager
{
public:
- enum Type { Default = 0, CUPS = 1 };
+ enum class Type { Default = 0, CUPS = 1 };
struct SystemPrintQueue
{
@@ -114,7 +114,7 @@ protected:
bool m_bUseJobPatch;
OUString m_aSystemDefaultPaper;
- PrinterInfoManager( Type eType = Default );
+ PrinterInfoManager( Type eType = Type::Default );
virtual void initialize();
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index cafaeed..5e9f716 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -150,7 +150,7 @@ static const char* setPasswordCallback( const char* pIn )
const char* pRet = nullptr;
PrinterInfoManager& rMgr = PrinterInfoManager::get();
- if( rMgr.getType() == PrinterInfoManager::CUPS ) // sanity check
+ if( rMgr.getType() == PrinterInfoManager::Type::CUPS ) // sanity check
pRet = static_cast<CUPSManager&>(rMgr).authenticateUser( pIn );
return pRet;
}
@@ -179,7 +179,7 @@ static void run_dest_thread_stub( void* pThis )
}
CUPSManager::CUPSManager() :
- PrinterInfoManager( CUPS ),
+ PrinterInfoManager( PrinterInfoManager::Type::CUPS ),
m_nDests( 0 ),
m_pDests( nullptr ),
m_bNewDests( false ),
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index d68ca2c..231cd90 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -568,7 +568,7 @@ const PPDParser* PPDParser::getParser( const OUString& rFile )
else
{
PrinterInfoManager& rMgr = PrinterInfoManager::get();
- if( rMgr.getType() == PrinterInfoManager::CUPS )
+ if( rMgr.getType() == PrinterInfoManager::Type::CUPS )
{
#ifdef ENABLE_CUPS
pNewParser = const_cast<PPDParser*>(static_cast<CUPSManager&>(rMgr).createCUPSParser( aFile ));
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 5e08f42..2c39a87 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -111,7 +111,7 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_bUseJobPatch( true ),
m_aSystemDefaultPaper( "A4" )
{
- if( eType == Default )
+ if( eType == Type::Default )
m_pQueueInfo = new SystemQueueInfo();
initSystemDefaultPaper();
}
@@ -483,7 +483,7 @@ void PrinterInfoManager::initialize()
aDefaultPrinter.clear();
m_aDefaultPrinter = aDefaultPrinter;
- if( m_eType != Default )
+ if( m_eType != Type::Default )
return;
// add a default printer for every available print queue
commit 3dfbf76e587b7ed7ee40ef2b4c4ef4805df22900
Author: Noel Grandin <noel at peralex.com>
Date: Mon Sep 5 09:36:04 2016 +0200
convert DuplexMode to scoped enum
Change-Id: Ic6f6e11437e75d17630683196c1b94dc25dd888f
diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx
index 169271e..f39544b 100644
--- a/include/vcl/prntypes.hxx
+++ b/include/vcl/prntypes.hxx
@@ -25,7 +25,8 @@
#include <o3tl/typed_flags_set.hxx>
-enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_LONGEDGE, DUPLEX_SHORTEDGE };
+// aapears to be a copy of css::view::DuplexMode
+enum class DuplexMode { Unknown, Off, LongEdge, ShortEdge };
enum class Orientation { Portrait, Landscape };
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index 35946f2..ac6cfdd 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -113,7 +113,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pKey = nullptr;
pValue = nullptr;
- pJobSetup->SetDuplexMode( DUPLEX_UNKNOWN );
+ pJobSetup->SetDuplexMode( DuplexMode::Unknown );
if( rData.m_pParser )
pKey = rData.m_pParser->getKey( OUString( "Duplex" ) );
if( pKey )
@@ -124,15 +124,15 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pValue->m_aOption.startsWithIgnoreAsciiCase( "Simplex" )
)
{
- pJobSetup->SetDuplexMode( DUPLEX_OFF );
+ pJobSetup->SetDuplexMode( DuplexMode::Off );
}
else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexNoTumble" ) )
{
- pJobSetup->SetDuplexMode( DUPLEX_LONGEDGE );
+ pJobSetup->SetDuplexMode( DuplexMode::LongEdge );
}
else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexTumble" ) )
{
- pJobSetup->SetDuplexMode( DUPLEX_SHORTEDGE );
+ pJobSetup->SetDuplexMode( DuplexMode::ShortEdge );
}
}
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 0fc9a7c..22de451 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -53,7 +53,7 @@ ImplJobSetup::ImplJobSetup()
{
mnSystem = 0;
meOrientation = Orientation::Portrait;
- meDuplexMode = DUPLEX_UNKNOWN;
+ meDuplexMode = DuplexMode::Unknown;
mnPaperBin = 0;
mePaperFormat = PAPER_USER;
mnPaperWidth = 0;
@@ -271,7 +271,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup )
rJobData.SetSystem( SVBT16ToShort( pOldJobData->nSystem ) );
rJobData.SetDriverDataLen( SVBT32ToUInt32( pOldJobData->nDriverDataLen ) );
rJobData.SetOrientation( (Orientation)SVBT16ToShort( pOldJobData->nOrientation ) );
- rJobData.SetDuplexMode( DUPLEX_UNKNOWN );
+ rJobData.SetDuplexMode( DuplexMode::Unknown );
rJobData.SetPaperBin( SVBT16ToShort( pOldJobData->nPaperBin ) );
rJobData.SetPaperFormat( (Paper)SVBT16ToShort( pOldJobData->nPaperFormat ) );
rJobData.SetPaperWidth( (long)SVBT32ToUInt32( pOldJobData->nPaperWidth ) );
@@ -294,14 +294,14 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup )
OUString aValue = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIStream, RTL_TEXTENCODING_UTF8);
if( aKey == "COMPAT_DUPLEX_MODE" )
{
- if( aValue == "DUPLEX_UNKNOWN" )
- rJobData.SetDuplexMode( DUPLEX_UNKNOWN );
- else if( aValue == "DUPLEX_OFF" )
- rJobData.SetDuplexMode( DUPLEX_OFF );
- else if( aValue == "DUPLEX_SHORTEDGE" )
- rJobData.SetDuplexMode( DUPLEX_SHORTEDGE );
- else if( aValue == "DUPLEX_LONGEDGE" )
- rJobData.SetDuplexMode( DUPLEX_LONGEDGE );
+ if( aValue == "DuplexMode::Unknown" )
+ rJobData.SetDuplexMode( DuplexMode::Unknown );
+ else if( aValue == "DuplexMode::Off" )
+ rJobData.SetDuplexMode( DuplexMode::Off );
+ else if( aValue == "DuplexMode::ShortEdge" )
+ rJobData.SetDuplexMode( DuplexMode::ShortEdge );
+ else if( aValue == "DuplexMode::LongEdge" )
+ rJobData.SetDuplexMode( DuplexMode::LongEdge );
}
else
rJobData.SetValueMap(aKey, aValue);
@@ -364,17 +364,17 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup )
write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "COMPAT_DUPLEX_MODE");
switch( rJobData.GetDuplexMode() )
{
- case DUPLEX_UNKNOWN:
- write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_UNKNOWN");
+ case DuplexMode::Unknown:
+ write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DuplexMode::Unknown");
break;
- case DUPLEX_OFF:
- write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_OFF");
+ case DuplexMode::Off:
+ write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DuplexMode::Off");
break;
- case DUPLEX_SHORTEDGE:
- write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_SHORTEDGE");
+ case DuplexMode::ShortEdge:
+ write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DuplexMode::ShortEdge");
break;
- case DUPLEX_LONGEDGE:
- write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_LONGEDGE");
+ case DuplexMode::LongEdge:
+ write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "DuplexMode::LongEdge");
break;
}
nLen = sal::static_int_cast<sal_uInt16>(rOStream.Tell() - nPos);
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index f1f24ac..bfaab26 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1717,9 +1717,9 @@ void PrinterController::pushPropertiesToPrinter()
pVal->Value >>= nDuplex;
switch( nDuplex )
{
- case css::view::DuplexMode::OFF: mpImplData->mxPrinter->SetDuplexMode( DUPLEX_OFF ); break;
- case css::view::DuplexMode::LONGEDGE: mpImplData->mxPrinter->SetDuplexMode( DUPLEX_LONGEDGE ); break;
- case css::view::DuplexMode::SHORTEDGE: mpImplData->mxPrinter->SetDuplexMode( DUPLEX_SHORTEDGE ); break;
+ case css::view::DuplexMode::OFF: mpImplData->mxPrinter->SetDuplexMode( DuplexMode::Off ); break;
+ case css::view::DuplexMode::LONGEDGE: mpImplData->mxPrinter->SetDuplexMode( DuplexMode::LongEdge ); break;
+ case css::view::DuplexMode::SHORTEDGE: mpImplData->mxPrinter->SetDuplexMode( DuplexMode::ShortEdge ); break;
}
}
}
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 573518e..5871942 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -211,7 +211,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pKey = nullptr;
pValue = nullptr;
- pJobSetup->SetDuplexMode( DUPLEX_UNKNOWN );
+ pJobSetup->SetDuplexMode( DuplexMode::Unknown );
if( rData.m_pParser )
pKey = rData.m_pParser->getKey( OUString("Duplex") );
if( pKey )
@@ -222,15 +222,15 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pValue->m_aOption.startsWithIgnoreAsciiCase( "Simplex" )
)
{
- pJobSetup->SetDuplexMode( DUPLEX_OFF);
+ pJobSetup->SetDuplexMode( DuplexMode::Off);
}
else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexNoTumble" ) )
{
- pJobSetup->SetDuplexMode( DUPLEX_LONGEDGE );
+ pJobSetup->SetDuplexMode( DuplexMode::LongEdge );
}
else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexTumble" ) )
{
- pJobSetup->SetDuplexMode( DUPLEX_SHORTEDGE );
+ pJobSetup->SetDuplexMode( DuplexMode::ShortEdge );
}
}
@@ -679,18 +679,18 @@ bool PspSalInfoPrinter::SetData(
pValue = nullptr;
switch( pJobSetup->GetDuplexMode() )
{
- case DUPLEX_OFF:
+ case DuplexMode::Off:
pValue = pKey->getValue( OUString("None") );
if( pValue == nullptr )
pValue = pKey->getValue( OUString("SimplexNoTumble") );
break;
- case DUPLEX_SHORTEDGE:
+ case DuplexMode::ShortEdge:
pValue = pKey->getValue( OUString("DuplexTumble") );
break;
- case DUPLEX_LONGEDGE:
+ case DuplexMode::LongEdge:
pValue = pKey->getValue( OUString("DuplexNoTumble") );
break;
- case DUPLEX_UNKNOWN:
+ case DuplexMode::Unknown:
default:
pValue = nullptr;
break;
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 3ec4097..0447846 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -707,15 +707,15 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
if( nFlags & JobSetFlags::DUPLEXMODE )
{
- DuplexMode eDuplex = DUPLEX_UNKNOWN;
+ DuplexMode eDuplex = DuplexMode::Unknown;
if( (CHOOSE_DEVMODE(dmFields) & DM_DUPLEX) )
{
if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_SIMPLEX )
- eDuplex = DUPLEX_OFF;
+ eDuplex = DuplexMode::Off;
else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_VERTICAL )
- eDuplex = DUPLEX_LONGEDGE;
+ eDuplex = DuplexMode::LongEdge;
else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_HORIZONTAL )
- eDuplex = DUPLEX_SHORTEDGE;
+ eDuplex = DuplexMode::ShortEdge;
}
pSetupData->SetDuplexMode( eDuplex );
}
@@ -988,19 +988,19 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, const ImplJobSet
{
switch( pSetupData->GetDuplexMode() )
{
- case DUPLEX_OFF:
+ case DuplexMode::Off:
CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
CHOOSE_DEVMODE(dmDuplex) = DMDUP_SIMPLEX;
break;
- case DUPLEX_SHORTEDGE:
+ case DuplexMode::ShortEdge:
CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
CHOOSE_DEVMODE(dmDuplex) = DMDUP_HORIZONTAL;
break;
- case DUPLEX_LONGEDGE:
+ case DuplexMode::LongEdge:
CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX;
CHOOSE_DEVMODE(dmDuplex) = DMDUP_VERTICAL;
break;
- case DUPLEX_UNKNOWN:
+ case DuplexMode::Unknown:
break;
}
}
More information about the Libreoffice-commits
mailing list