vcl/inc/ppdparser.hxx                 |    9 +++++-
 vcl/inc/unx/fontmanager.hxx           |    2 -
 vcl/unx/generic/printer/cpdmgr.cxx    |    8 ++---
 vcl/unx/generic/printer/cupsmgr.cxx   |    2 -
 vcl/unx/generic/printer/ppdparser.cxx |   46 +++++++++++++++++++++-------------
 5 files changed, 42 insertions(+), 25 deletions(-)

New commits:
commit e148db3deebeaccae5c2b255fde2645d764a42d8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jan 10 17:11:20 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 10 20:45:18 2025 +0100

    vcl: Drop unused PPDParser forward declaration
    
    Unused since
    
        commit 003a3d7a55d9f83d5b68800d54fdac633b4c281a
        Date:   Tue Nov 26 17:08:25 2013 +0200
    
            No more uses of printer built in fonts
    
    Change-Id: Idd3e2b0e8a8a2d3e70d194d5ceecbf46924e9638
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180081
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 450f711338e1..ba73e9d741f4 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -51,8 +51,6 @@ namespace vcl { struct NameRecord; }
 class GenericUnixSalData;
 
 namespace psp {
-class PPDParser;
-
 typedef int fontID;
 
 // a class to manage printable fonts
commit 8166df9e833d410537cdd48e49ff3a182cf2eae9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jan 10 17:00:59 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 10 20:45:05 2025 +0100

    vcl: Make PPDValueType an enum class
    
    Change-Id: I94e52914acb29374f4dd1b6ea9c725a12b521416
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180080
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx
index f381f33ad7a6..f59bb41c88b5 100644
--- a/vcl/inc/ppdparser.hxx
+++ b/vcl/inc/ppdparser.hxx
@@ -41,7 +41,14 @@ enum class orientation;
 class PPDCache;
 class PPDTranslator;
 
-enum PPDValueType { eInvocation, eQuoted, eSymbol, eString, eNo };
+enum class PPDValueType
+{
+    Invocation,
+    Quoted,
+    Symbol,
+    String,
+    No
+};
 
 struct VCL_DLLPUBLIC PPDValue
 {
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx 
b/vcl/unx/generic/printer/cpdmgr.cxx
index 00023060b073..8b7c145344c6 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -383,7 +383,7 @@ const PPDParser* CPDManager::createCPDParser(const 
OUString& rPrinter)
                         }
                     }
 
-                    pValue = pKey->insertValue(aValueName, eQuoted);
+                    pValue = pKey->insertValue(aValueName, 
PPDValueType::Quoted);
                     if (!pValue)
                         continue;
                     pValue->m_aValue = aValueName;
@@ -397,7 +397,7 @@ const PPDParser* CPDManager::createCPDParser(const 
OUString& rPrinter)
                 // This could be done to ensure default values also appear as 
options:
                 if (!bDefaultFound && pKey->m_bUIOption)
                 {
-                    //     pValue = pKey->insertValue( aDefaultValue, eQuoted 
);
+                    //     pValue = pKey->insertValue( aDefaultValue, 
PPDValueType::Quoted );
                     //     if( pValue )
                     //         pValue->m_aValue = aDefaultValue;
                 }
@@ -406,7 +406,7 @@ const PPDParser* CPDManager::createCPDParser(const 
OUString& rPrinter)
 
             pKey = new PPDKey(u"ModelName"_ustr);
             aValueName = OStringToOUString("", aEncoding);
-            pValue = pKey->insertValue(aValueName, eQuoted);
+            pValue = pKey->insertValue(aValueName, PPDValueType::Quoted);
             if (pValue)
                 pValue->m_aValue = aValueName;
             pKey->m_pDefaultValue = pValue;
@@ -414,7 +414,7 @@ const PPDParser* CPDManager::createCPDParser(const 
OUString& rPrinter)
 
             pKey = new PPDKey(u"NickName"_ustr);
             aValueName = OStringToOUString(pDest->name, aEncoding);
-            pValue = pKey->insertValue(aValueName, eQuoted);
+            pValue = pKey->insertValue(aValueName, PPDValueType::Quoted);
             if (pValue)
                 pValue->m_aValue = aValueName;
             pKey->m_pDefaultValue = pValue;
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx 
b/vcl/unx/generic/printer/cupsmgr.cxx
index 87f2acc8d088..59b6d21aa1e4 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -639,7 +639,7 @@ void CUPSManager::getOptionsFromDocumentSetup(const 
JobData& rJob, bool bBanner,
             const PPDKey* pKey = aKeys[i];
             const PPDValue* pValue = rJob.m_aContext.getValue( pKey );
             OUString sPayLoad;
-            if (pValue && pValue->m_eType == eInvocation)
+            if (pValue && pValue->m_eType == PPDValueType::Invocation)
             {
                 sPayLoad = pValue->m_bCustomOption ? pValue->m_aCustomOption : 
pValue->m_aOption;
             }
diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index ce9be1ffe874..b6c25830fd37 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -627,8 +627,10 @@ PPDParser::PPDParser(OUString aFile, const 
std::vector<PPDKey*>& keys)
         for (int i = 0; i < pKey->countValues(); i++) {
             const PPDValue* pValue = pKey -> getValue(i);
             OUString aValueName = pValue -> m_aOption;
-            PPDValue* pImageableAreaValue = pImageableAreas -> insertValue( 
aValueName, eQuoted );
-            PPDValue* pPaperDimensionValue = pPaperDimensions -> insertValue( 
aValueName, eQuoted );
+            PPDValue* pImageableAreaValue
+                = pImageableAreas->insertValue(aValueName, 
PPDValueType::Quoted);
+            PPDValue* pPaperDimensionValue
+                = pPaperDimensions->insertValue(aValueName, 
PPDValueType::Quoted);
             rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
             OString o = OUStringToOString( aValueName, aEncoding );
             pwg_media_t *pPWGMedia = pwgMediaForPWG(o.pData->buffer);
@@ -778,11 +780,21 @@ PPDParser::PPDParser( OUString aFile ) :
             char const* pVType = "<unknown>";
             switch( pValue->m_eType )
             {
-                case eInvocation:       pVType = "invocation";break;
-                case eQuoted:           pVType = "quoted";break;
-                case eString:           pVType = "string";break;
-                case eSymbol:           pVType = "symbol";break;
-                case eNo:               pVType = "no";break;
+                case PPDValueType::Invocation:
+                    pVType = "invocation";
+                    break;
+                case PPDValueType::Quoted:
+                    pVType = "quoted";
+                    break;
+                case PPDValueType::String:
+                    pVType = "string";
+                    break;
+                case PPDValueType::Symbol:
+                    pVType = "symbol";
+                    break;
+                case PPDValueType::No:
+                    pVType = "no";
+                    break;
                 default: break;
             }
             SAL_INFO("vcl.unx.print", "                "
@@ -1015,7 +1027,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
             if(keyit != m_aKeys.end())
             {
                 PPDKey* pKey = keyit->second.get();
-                pKey->insertValue(u"Custom"_ustr, eInvocation, true);
+                pKey->insertValue(u"Custom"_ustr, PPDValueType::Invocation, 
true);
             }
             continue;
         }
@@ -1066,7 +1078,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
                 aOption = aOption.copy(0,  nTransPos);
         }
 
-        PPDValueType eType = eNo;
+        PPDValueType eType = PPDValueType::No;
         OUString aValue;
         OUString aOptionTranslation;
         OUString aValueTranslation;
@@ -1099,9 +1111,9 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
             {
                 if( !aOption.isEmpty() &&
                     !aUniKey.startsWith( "JCL" ) )
-                    eType = eInvocation;
+                    eType = PPDValueType::Invocation;
                 else
-                    eType = eQuoted;
+                    eType = PPDValueType::Quoted;
             }
             // check for invocation or quoted value
             else if(aLine[0] == '"')
@@ -1119,16 +1131,16 @@ void PPDParser::parse( ::std::vector< OString >& rLines 
)
                 // check for quoted value
                 if( !aOption.isEmpty() &&
                     !aUniKey.startsWith( "JCL" ) )
-                    eType = eInvocation;
+                    eType = PPDValueType::Invocation;
                 else
-                    eType = eQuoted;
+                    eType = PPDValueType::Quoted;
             }
             // check for symbol value
             else if(aLine[0] == '^')
             {
                 aLine = aLine.copy(1);
                 aValue = OStringToOUString(aLine, RTL_TEXTENCODING_MS_1252);
-                eType = eSymbol;
+                eType = PPDValueType::Symbol;
             }
             else
             {
@@ -1143,7 +1155,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
                 aValue = OStringToOUString(aLine.subView(0, nTransPos), 
RTL_TEXTENCODING_MS_1252);
                 if (nTransPos+1 < aLine.getLength())
                     aValueTranslation = handleTranslation( aLine.copy( 
nTransPos+1 ), bIsGlobalizedLine );
-                eType = eString;
+                eType = PPDValueType::String;
             }
         }
 
@@ -1175,7 +1187,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
         else
             pKey = keyit->second.get();
 
-        if( eType == eNo && bQuery )
+        if (eType == PPDValueType::No && bQuery)
             continue;
 
         PPDValue* pValue = pKey->insertValue( aOption, eType );
@@ -1225,7 +1237,7 @@ void PPDParser::parse( ::std::vector< OString >& rLines )
                     // (example: DefaultResolution)
                     // so invent that key here and have a default value
                     std::unique_ptr<PPDKey> pKey(new PPDKey( aKey ));
-                    pKey->insertValue( aOption, eInvocation /*or what ?*/ );
+                    pKey->insertValue(aOption, PPDValueType::Invocation /*or 
what ?*/);
                     pKey->m_pDefaultValue = pKey->getValue( aOption );
                     insertKey( std::move(pKey) );
                 }

Reply via email to