solenv/clang-format/excludelist    |    2 
 vcl/inc/unx/cpdmgr.hxx             |   59 +--
 vcl/unx/generic/printer/cpdmgr.cxx |  574 ++++++++++++++++++-------------------
 3 files changed, 317 insertions(+), 318 deletions(-)

New commits:
commit 88f051257ebec4341864027f3af02e0f44df2367
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Mar 27 09:17:29 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Mar 27 15:12:57 2024 +0100

    clang-format CPDManager sources
    
    These will likely be significantly changed in the process
    of updating the code to support current CPDB
    (Common Print Dialog Backends) versions, see [1].
    
    [1] 
https://lists.freedesktop.org/archives/libreoffice/2024-March/091748.html
    
    Change-Id: I2d8fe1cfedb703e4843ade261e5c09e24dfe30b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165366
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index a4f7c15fa4b9..53e7e4252996 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14219,7 +14219,6 @@ vcl/inc/textlineinfo.hxx
 vcl/inc/textrender.hxx
 vcl/inc/toolbox.h
 vcl/inc/unx/cairotextrender.hxx
-vcl/inc/unx/cpdmgr.hxx
 vcl/inc/unx/cupsmgr.hxx
 vcl/inc/unx/fc_fontoptions.hxx
 vcl/inc/unx/fontmanager.hxx
@@ -14874,7 +14873,6 @@ vcl/unx/generic/print/prtsetup.cxx
 vcl/unx/generic/print/psputil.cxx
 vcl/unx/generic/print/psputil.hxx
 vcl/unx/generic/print/text_gfx.cxx
-vcl/unx/generic/printer/cpdmgr.cxx
 vcl/unx/generic/printer/cupsmgr.cxx
 vcl/unx/generic/printer/jobdata.cxx
 vcl/unx/generic/printer/ppdparser.cxx
diff --git a/vcl/inc/unx/cpdmgr.hxx b/vcl/inc/unx/cpdmgr.hxx
index 2806f1d09b53..76a46b261c15 100644
--- a/vcl/inc/unx/cpdmgr.hxx
+++ b/vcl/inc/unx/cpdmgr.hxx
@@ -38,7 +38,6 @@ typedef struct _GDBusConnection GDBusConnection;
 
 namespace psp
 {
-
 class PPDParser;
 
 struct CPDPrinter
@@ -57,13 +56,13 @@ struct CPDPrinter
 class CPDManager final : public PrinterInfoManager
 {
 #if ENABLE_DBUS && ENABLE_GIO
-    GDBusConnection * m_pConnection = nullptr;
+    GDBusConnection* m_pConnection = nullptr;
     bool m_aPrintersChanged = true;
     std::vector<std::pair<std::string, gchar*>> m_tBackends;
-    std::unordered_map< std::string, GDBusProxy * > m_pBackends;
-    std::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles;
-    std::unordered_map< OUString, CPDPrinter * > m_aCPDDestMap;
-    std::unordered_map< OUString, PPDContext > m_aDefaultContexts;
+    std::unordered_map<std::string, GDBusProxy*> m_pBackends;
+    std::unordered_map<FILE*, OString, FPtrHash> m_aSpoolFiles;
+    std::unordered_map<OUString, CPDPrinter*> m_aCPDDestMap;
+    std::unordered_map<OUString, PPDContext> m_aDefaultContexts;
 #endif
     CPDManager();
     // Function called when CPDManager is destroyed
@@ -72,49 +71,45 @@ class CPDManager final : public PrinterInfoManager
     virtual void initialize() override;
 
 #if ENABLE_DBUS && ENABLE_GIO
-    static void onNameAcquired(GDBusConnection *connection, const gchar* name, 
gpointer user_data);
-    static void onNameLost (GDBusConnection *, const gchar *name, gpointer);
-    static void printerAdded (GDBusConnection *connection,
-                              const gchar     *sender_name,
-                              const gchar     *object_path,
-                              const gchar     *interface_name,
-                              const gchar     *signal_name,
-                              GVariant        *parameters,
-                              gpointer        user_data);
-    static void printerRemoved (GDBusConnection *connection,
-                                const gchar     *sender_name,
-                                const gchar     *object_path,
-                                const gchar     *interface_name,
-                                const gchar     *signal_name,
-                                GVariant        *parameters,
-                                gpointer        user_data);
-
-    static void getOptionsFromDocumentSetup( const JobData& rJob, bool 
bBanner, const OString& rJobName, int& rNumOptions, GVariant **arr );
+    static void onNameAcquired(GDBusConnection* connection, const gchar* name, 
gpointer user_data);
+    static void onNameLost(GDBusConnection*, const gchar* name, gpointer);
+    static void printerAdded(GDBusConnection* connection, const gchar* 
sender_name,
+                             const gchar* object_path, const gchar* 
interface_name,
+                             const gchar* signal_name, GVariant* parameters, 
gpointer user_data);
+    static void printerRemoved(GDBusConnection* connection, const gchar* 
sender_name,
+                               const gchar* object_path, const gchar* 
interface_name,
+                               const gchar* signal_name, GVariant* parameters, 
gpointer user_data);
+
+    static void getOptionsFromDocumentSetup(const JobData& rJob, bool bBanner,
+                                            const OString& rJobName, int& 
rNumOptions,
+                                            GVariant** arr);
 #endif
 
 public:
 #if ENABLE_DBUS && ENABLE_GIO
     // Functions involved in initialization
     GDBusProxy* getProxy(const std::string& target);
-    void addBackend( std::pair< std::string, GDBusProxy * > pair );
+    void addBackend(std::pair<std::string, GDBusProxy*> pair);
     void addTempBackend(const std::pair<std::string, gchar*>& pair);
-    std::vector<std::pair<std::string, gchar*>> const & getTempBackends() 
const;
-    void addNewPrinter( const OUString&, const OUString&, CPDPrinter * );
+    std::vector<std::pair<std::string, gchar*>> const& getTempBackends() const;
+    void addNewPrinter(const OUString&, const OUString&, CPDPrinter*);
 #endif
 
     // Create CPDManager
     static CPDManager* tryLoadCPD();
 
     // Create a PPDParser for CPD Printers
-    const PPDParser* createCPDParser( const OUString& rPrinter );
+    const PPDParser* createCPDParser(const OUString& rPrinter);
 
     // Functions related to printing
-    virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand 
) override;
-    virtual bool endSpool( const OUString& rPrinterName, const OUString& 
rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const 
OUString& rFaxNumber ) override;
-    virtual void setupJobContextData( JobData& rData ) override;
+    virtual FILE* startSpool(const OUString& rPrinterName, bool bQuickCommand) 
override;
+    virtual bool endSpool(const OUString& rPrinterName, const OUString& 
rJobTitle, FILE* pFile,
+                          const JobData& rDocumentJobData, bool bBanner,
+                          const OUString& rFaxNumber) override;
+    virtual void setupJobContextData(JobData& rData) override;
 
     // check if the printer configuration has changed
-    virtual bool checkPrintersChanged( bool bWait ) override;
+    virtual bool checkPrintersChanged(bool bWait) override;
 };
 
 } // namespace psp
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx 
b/vcl/unx/generic/printer/cpdmgr.cxx
index 03cf85a7b75b..2d1b93e3f947 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -38,24 +38,20 @@ using namespace osl;
 
 #if ENABLE_DBUS && ENABLE_GIO
 // Function to execute when name is acquired on the bus
-void CPDManager::onNameAcquired (GDBusConnection *connection,
-                                 const gchar *,
-                                 gpointer user_data)
+void CPDManager::onNameAcquired(GDBusConnection* connection, const gchar*, 
gpointer user_data)
 {
     gchar* contents;
     // Get Interface for introspection
-    if (!g_file_get_contents (FRONTEND_INTERFACE, &contents, nullptr, nullptr))
+    if (!g_file_get_contents(FRONTEND_INTERFACE, &contents, nullptr, nullptr))
         return;
 
-    GDBusNodeInfo *introspection_data = g_dbus_node_info_new_for_xml 
(contents, nullptr);
+    GDBusNodeInfo* introspection_data = g_dbus_node_info_new_for_xml(contents, 
nullptr);
 
-    g_dbus_connection_register_object (connection,
-                                       "/org/libreoffice/PrintDialog",
-                                       introspection_data->interfaces[0],
-                                       nullptr,
-                                       nullptr,  /* user_data */
-                                       nullptr,  /* user_data_free_func */
-                                       nullptr); /* GError** */
+    g_dbus_connection_register_object(connection, 
"/org/libreoffice/PrintDialog",
+                                      introspection_data->interfaces[0], 
nullptr,
+                                      nullptr, /* user_data */
+                                      nullptr, /* user_data_free_func */
+                                      nullptr); /* GError** */
     g_free(contents);
     g_dbus_node_info_unref(introspection_data);
 
@@ -66,20 +62,14 @@ void CPDManager::onNameAcquired (GDBusConnection 
*connection,
         // Get Interface for introspection
         if (g_file_get_contents(BACKEND_INTERFACE, &contents, nullptr, 
nullptr))
         {
-            introspection_data = g_dbus_node_info_new_for_xml (contents, 
nullptr);
-            GDBusProxy *proxy = g_dbus_proxy_new_sync (connection,
-                                           G_DBUS_PROXY_FLAGS_NONE,
-                                           introspection_data->interfaces[0],
-                                           backend.first.c_str(),
-                                           backend.second,
-                                           "org.openprinting.PrintBackend",
-                                           nullptr,
-                                           nullptr);
-            g_assert (proxy != nullptr);
-            g_dbus_proxy_call(proxy, "ActivateBackend",
-                              nullptr,
-                              G_DBUS_CALL_FLAGS_NONE,
-                              -1, nullptr, nullptr, nullptr);
+            introspection_data = g_dbus_node_info_new_for_xml(contents, 
nullptr);
+            GDBusProxy* proxy = g_dbus_proxy_new_sync(
+                connection, G_DBUS_PROXY_FLAGS_NONE, 
introspection_data->interfaces[0],
+                backend.first.c_str(), backend.second, 
"org.openprinting.PrintBackend", nullptr,
+                nullptr);
+            g_assert(proxy != nullptr);
+            g_dbus_proxy_call(proxy, "ActivateBackend", nullptr, 
G_DBUS_CALL_FLAGS_NONE, -1,
+                              nullptr, nullptr, nullptr);
 
             g_object_unref(proxy);
             g_dbus_node_info_unref(introspection_data);
@@ -89,83 +79,76 @@ void CPDManager::onNameAcquired (GDBusConnection 
*connection,
     }
 }
 
-void CPDManager::onNameLost (GDBusConnection *,
-                             const gchar *name,
-                             gpointer)
+void CPDManager::onNameLost(GDBusConnection*, const gchar* name, gpointer)
 {
     g_message("Name Lost: %s", name);
 }
 
-void CPDManager::printerAdded (GDBusConnection *connection,
-                               const gchar     *sender_name,
-                               const gchar     *object_path,
-                               const gchar     *interface_name,
-                               const gchar     *,
-                               GVariant        *parameters,
-                               gpointer        user_data)
+void CPDManager::printerAdded(GDBusConnection* connection, const gchar* 
sender_name,
+                              const gchar* object_path, const gchar* 
interface_name, const gchar*,
+                              GVariant* parameters, gpointer user_data)
 {
     CPDManager* current = static_cast<CPDManager*>(user_data);
-    GDBusProxy *proxy;
+    GDBusProxy* proxy;
     proxy = current->getProxy(sender_name);
-    if (proxy == nullptr) {
+    if (proxy == nullptr)
+    {
         gchar* contents;
 
         // Get Interface for introspection
-        if (g_file_get_contents 
("/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml", &contents, 
nullptr, nullptr)) {
-            GDBusNodeInfo *introspection_data = g_dbus_node_info_new_for_xml 
(contents, nullptr);
-            proxy = g_dbus_proxy_new_sync (connection,
-                                           
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
-                                           introspection_data->interfaces[0],
-                                           sender_name,
-                                           object_path,
-                                           interface_name,
-                                           nullptr,
-                                           nullptr);
+        if 
(g_file_get_contents("/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml",
+                                &contents, nullptr, nullptr))
+        {
+            GDBusNodeInfo* introspection_data = 
g_dbus_node_info_new_for_xml(contents, nullptr);
+            proxy = g_dbus_proxy_new_sync(connection, 
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+                                          introspection_data->interfaces[0], 
sender_name,
+                                          object_path, interface_name, 
nullptr, nullptr);
 
             g_dbus_node_info_unref(introspection_data);
-            std::pair<std::string, GDBusProxy *> new_backend (sender_name, 
proxy);
+            std::pair<std::string, GDBusProxy*> new_backend(sender_name, 
proxy);
             current->addBackend(std::move(new_backend));
             g_free(contents);
         }
     }
-    CPDPrinter *pDest = static_cast<CPDPrinter *>(malloc(sizeof(CPDPrinter)));
+    CPDPrinter* pDest = static_cast<CPDPrinter*>(malloc(sizeof(CPDPrinter)));
     pDest->backend = proxy;
-    g_variant_get (parameters, "(sssssbss)", &(pDest->id), &(pDest->name), 
&(pDest->info), &(pDest->location), &(pDest->make_and_model), 
&(pDest->is_accepting_jobs), &(pDest->printer_state), &(pDest->backend_name));
+    g_variant_get(parameters, "(sssssbss)", &(pDest->id), &(pDest->name), 
&(pDest->info),
+                  &(pDest->location), &(pDest->make_and_model), 
&(pDest->is_accepting_jobs),
+                  &(pDest->printer_state), &(pDest->backend_name));
     std::stringstream printerName;
     printerName << pDest->name << ", " << pDest->backend_name;
     std::stringstream uniqueName;
     uniqueName << pDest->id << ", " << pDest->backend_name;
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
-    OUString aPrinterName = OStringToOUString( printerName.str(), aEncoding );
-    OUString aUniqueName = OStringToOUString( uniqueName.str(), aEncoding );
+    OUString aPrinterName = OStringToOUString(printerName.str(), aEncoding);
+    OUString aUniqueName = OStringToOUString(uniqueName.str(), aEncoding);
     current->addNewPrinter(aPrinterName, aUniqueName, pDest);
 }
 
-void CPDManager::printerRemoved (GDBusConnection *,
-                                 const gchar     *,
-                                 const gchar     *,
-                                 const gchar     *,
-                                 const gchar     *,
-                                 GVariant        *parameters,
-                                 gpointer        user_data)
+void CPDManager::printerRemoved(GDBusConnection*, const gchar*, const gchar*, 
const gchar*,
+                                const gchar*, GVariant* parameters, gpointer 
user_data)
 {
     // TODO: Remove every data linked to this particular printer.
     CPDManager* pManager = static_cast<CPDManager*>(user_data);
     char* id;
     char* backend_name;
-    g_variant_get (parameters, "(ss)", &id, &backend_name);
+    g_variant_get(parameters, "(ss)", &id, &backend_name);
     std::stringstream uniqueName;
     uniqueName << id << ", " << backend_name;
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
-    OUString aUniqueName = OStringToOUString( uniqueName.str(), aEncoding );
-    std::unordered_map<OUString, CPDPrinter *>::iterator it = 
pManager->m_aCPDDestMap.find( aUniqueName );
-    if (it == pManager->m_aCPDDestMap.end()) {
+    OUString aUniqueName = OStringToOUString(uniqueName.str(), aEncoding);
+    std::unordered_map<OUString, CPDPrinter*>::iterator it
+        = pManager->m_aCPDDestMap.find(aUniqueName);
+    if (it == pManager->m_aCPDDestMap.end())
+    {
         SAL_WARN("vcl.unx.print", "CPD trying to remove non-existent printer 
from list");
         return;
     }
     pManager->m_aCPDDestMap.erase(it);
-    std::unordered_map<OUString, Printer>::iterator printersIt = 
pManager->m_aPrinters.find( aUniqueName );
-    if (printersIt == pManager->m_aPrinters.end()) {
+    std::unordered_map<OUString, Printer>::iterator printersIt
+        = pManager->m_aPrinters.find(aUniqueName);
+    if (printersIt == pManager->m_aPrinters.end())
+    {
         SAL_WARN("vcl.unx.print", "CPD trying to remove non-existent printer 
from m_aPrinters");
         return;
     }
@@ -174,31 +157,33 @@ void CPDManager::printerRemoved (GDBusConnection *,
 
 GDBusProxy* CPDManager::getProxy(const std::string& target)
 {
-    std::unordered_map<std::string, GDBusProxy *>::const_iterator it = 
m_pBackends.find(target);
-    if (it == m_pBackends.end()) {
+    std::unordered_map<std::string, GDBusProxy*>::const_iterator it = 
m_pBackends.find(target);
+    if (it == m_pBackends.end())
+    {
         return nullptr;
     }
     return it->second;
 }
 
-void CPDManager::addBackend(std::pair<std::string, GDBusProxy *> pair) {
-    m_pBackends.insert(pair);
-}
+void CPDManager::addBackend(std::pair<std::string, GDBusProxy*> pair) { 
m_pBackends.insert(pair); }
 
 void CPDManager::addTempBackend(const std::pair<std::string, gchar*>& pair)
 {
     m_tBackends.push_back(pair);
 }
 
-std::vector<std::pair<std::string, gchar*>> const & 
CPDManager::getTempBackends() const {
+std::vector<std::pair<std::string, gchar*>> const& 
CPDManager::getTempBackends() const
+{
     return m_tBackends;
 }
 
-void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& 
aUniqueName, CPDPrinter *pDest) {
+void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& 
aUniqueName,
+                               CPDPrinter* pDest)
+{
     m_aCPDDestMap[aUniqueName] = pDest;
-    bool bSetToGlobalDefaults = m_aPrinters.find( aUniqueName ) == 
m_aPrinters.end();
-    Printer aPrinter = m_aPrinters[ aUniqueName ];
-    if( bSetToGlobalDefaults )
+    bool bSetToGlobalDefaults = m_aPrinters.find(aUniqueName) == 
m_aPrinters.end();
+    Printer aPrinter = m_aPrinters[aUniqueName];
+    if (bSetToGlobalDefaults)
         aPrinter.m_aInfo = m_aGlobalDefaults;
     aPrinter.m_aInfo.m_aPrinterName = aPrinterName;
 
@@ -218,15 +203,16 @@ void CPDManager::addNewPrinter(const OUString& 
aPrinterName, const OUString& aUn
     // every printer - which would be really bad runtime
     // behaviour
     aPrinter.m_aInfo.m_pParser = nullptr;
-    aPrinter.m_aInfo.m_aContext.setParser( nullptr );
-    std::unordered_map< OUString, PPDContext >::const_iterator c_it = 
m_aDefaultContexts.find( aUniqueName );
-    if( c_it != m_aDefaultContexts.end() )
+    aPrinter.m_aInfo.m_aContext.setParser(nullptr);
+    std::unordered_map<OUString, PPDContext>::const_iterator c_it
+        = m_aDefaultContexts.find(aUniqueName);
+    if (c_it != m_aDefaultContexts.end())
     {
         aPrinter.m_aInfo.m_pParser = c_it->second.getParser();
         aPrinter.m_aInfo.m_aContext = c_it->second;
     }
     aPrinter.m_aInfo.m_aDriverName = "CPD:" + aUniqueName;
-    m_aPrinters[ aUniqueName ] = aPrinter;
+    m_aPrinters[aUniqueName] = aPrinter;
 }
 #endif
 
@@ -240,19 +226,24 @@ CPDManager* CPDManager::tryLoadCPD()
 #if ENABLE_DBUS && ENABLE_GIO
     static const char* pEnv = getenv("SAL_DISABLE_CPD");
 
-    if (!pEnv || !*pEnv) {
+    if (!pEnv || !*pEnv)
+    {
         // interface description XML files are needed in 'onNameAcquired()'
-        if (!g_file_test(FRONTEND_INTERFACE, G_FILE_TEST_IS_REGULAR) ||
-                !g_file_test(BACKEND_INTERFACE, G_FILE_TEST_IS_REGULAR)) {
+        if (!g_file_test(FRONTEND_INTERFACE, G_FILE_TEST_IS_REGULAR)
+            || !g_file_test(BACKEND_INTERFACE, G_FILE_TEST_IS_REGULAR))
+        {
             return nullptr;
         }
 
-        GDir *dir;
-        const gchar *filename;
+        GDir* dir;
+        const gchar* filename;
         dir = g_dir_open(BACKEND_DIR, 0, nullptr);
-        if (dir != nullptr) {
-            while ((filename = g_dir_read_name(dir))) {
-                if (pManager == nullptr) {
+        if (dir != nullptr)
+        {
+            while ((filename = g_dir_read_name(dir)))
+            {
+                if (pManager == nullptr)
+                {
                     pManager = new CPDManager();
                 }
                 gchar* contents;
@@ -260,7 +251,7 @@ CPDManager* CPDManager::tryLoadCPD()
                 filepath << BACKEND_DIR << '/' << filename;
                 if (g_file_get_contents(filepath.str().c_str(), &contents, 
nullptr, nullptr))
                 {
-                    std::pair<std::string, gchar*> new_tbackend (filename, 
contents);
+                    std::pair<std::string, gchar*> new_tbackend(filename, 
contents);
                     pManager->addTempBackend(new_tbackend);
                     g_free(contents);
                 }
@@ -272,33 +263,25 @@ CPDManager* CPDManager::tryLoadCPD()
     return pManager;
 }
 
-CPDManager::CPDManager() :
-    PrinterInfoManager( PrinterInfoManager::Type::CPD )
+CPDManager::CPDManager()
+    : PrinterInfoManager(PrinterInfoManager::Type::CPD)
 {
 #if ENABLE_DBUS && ENABLE_GIO
     // Get Destinations number and pointers
-    GError *error = nullptr;
-    m_pConnection = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, &error);
-    g_assert_no_error (error);
+    GError* error = nullptr;
+    m_pConnection = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
+    g_assert_no_error(error);
 #endif
 }
 
 CPDManager::~CPDManager()
 {
 #if ENABLE_DBUS && ENABLE_GIO
-    g_dbus_connection_emit_signal (m_pConnection,
-                                   nullptr,
-                                   "/org/libreoffice/PrintDialog",
-                                   "org.openprinting.PrintFrontend",
-                                   "StopListing",
-                                   nullptr,
-                                   nullptr);
-    g_dbus_connection_flush_sync (m_pConnection,
-                                  nullptr,
-                                  nullptr);
-    g_dbus_connection_close_sync (m_pConnection,
-                                  nullptr,
+    g_dbus_connection_emit_signal(m_pConnection, nullptr, 
"/org/libreoffice/PrintDialog",
+                                  "org.openprinting.PrintFrontend", 
"StopListing", nullptr,
                                   nullptr);
+    g_dbus_connection_flush_sync(m_pConnection, nullptr, nullptr);
+    g_dbus_connection_close_sync(m_pConnection, nullptr, nullptr);
     for (auto const& backend : m_pBackends)
     {
         g_object_unref(backend.second);
@@ -310,30 +293,27 @@ CPDManager::~CPDManager()
 #endif
 }
 
-
-const PPDParser* CPDManager::createCPDParser( const OUString& rPrinter )
+const PPDParser* CPDManager::createCPDParser(const OUString& rPrinter)
 {
     const PPDParser* pNewParser = nullptr;
 #if ENABLE_DBUS && ENABLE_GIO
     OUString aPrinter;
 
-    if( rPrinter.startsWith("CPD:") )
-        aPrinter = rPrinter.copy( 4 );
+    if (rPrinter.startsWith("CPD:"))
+        aPrinter = rPrinter.copy(4);
     else
         aPrinter = rPrinter;
 
-    std::unordered_map< OUString, CPDPrinter * >::iterator dest_it =
-        m_aCPDDestMap.find( aPrinter );
+    std::unordered_map<OUString, CPDPrinter*>::iterator dest_it = 
m_aCPDDestMap.find(aPrinter);
 
-    if( dest_it != m_aCPDDestMap.end() )
+    if (dest_it != m_aCPDDestMap.end())
     {
         CPDPrinter* pDest = dest_it->second;
         GVariant* ret = nullptr;
         GError* error = nullptr;
-        ret = g_dbus_proxy_call_sync (pDest->backend, "GetAllOptions",
-                                      g_variant_new("(s)", (pDest->id)),
-                                      G_DBUS_CALL_FLAGS_NONE,
-                                      -1, nullptr, &error);
+        ret = g_dbus_proxy_call_sync(pDest->backend, "GetAllOptions",
+                                     g_variant_new("(s)", (pDest->id)), 
G_DBUS_CALL_FLAGS_NONE, -1,
+                                     nullptr, &error);
         if (ret != nullptr && error == nullptr)
         {
             // TODO: These keys need to be redefined to preserve usage across 
libreoffice
@@ -343,33 +323,38 @@ const PPDParser* CPDManager::createCPDParser( const 
OUString& rPrinter )
 
             int num_attribute;
             GVariantIter *iter_attr, *iter_supported_values;
-            g_variant_get (ret, "(ia(ssia(s)))", &num_attribute, &iter_attr);
+            g_variant_get(ret, "(ia(ssia(s)))", &num_attribute, &iter_attr);
             rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
-            PPDKey *pKey = nullptr;
+            PPDKey* pKey = nullptr;
             OUString aValueName;
             PPDValue* pValue;
             std::vector<PPDKey*> keys;
             std::vector<OUString> default_values;
-            for (int i = 0; i < num_attribute; i++) {
+            for (int i = 0; i < num_attribute; i++)
+            {
                 char *name, *default_value;
                 int num_supported_values;
-                g_variant_iter_loop(iter_attr, "(ssia(s))",
-                                    &name, &default_value,
+                g_variant_iter_loop(iter_attr, "(ssia(s))", &name, 
&default_value,
                                     &num_supported_values, 
&iter_supported_values);
-                OUString aOptionName = OStringToOUString( name, aEncoding );
-                OUString aDefaultValue = OStringToOUString( default_value, 
aEncoding );
-                if (aOptionName == "sides") {
+                OUString aOptionName = OStringToOUString(name, aEncoding);
+                OUString aDefaultValue = OStringToOUString(default_value, 
aEncoding);
+                if (aOptionName == "sides")
+                {
                     // Duplex key is used throughout for checking Duplex 
Support
                     aOptionName = OUString("Duplex");
-                } else if (aOptionName == "printer-resolution") {
+                }
+                else if (aOptionName == "printer-resolution")
+                {
                     // Resolution key is used in places
                     aOptionName = OUString("Resolution");
-                } else if (aOptionName == "media") {
+                }
+                else if (aOptionName == "media")
+                {
                     // PageSize key is used in many places
                     aOptionName = OUString("PageSize");
                 }
                 default_values.push_back(aDefaultValue);
-                pKey = new PPDKey( aOptionName );
+                pKey = new PPDKey(aOptionName);
 
                 // If number of values are 0, this is not settable via UI
                 if (num_supported_values > 0 && aDefaultValue != "NA")
@@ -377,75 +362,85 @@ const PPDParser* CPDManager::createCPDParser( const 
OUString& rPrinter )
 
                 bool bDefaultFound = false;
 
-                for (int j = 0; j < num_supported_values; j++) {
+                for (int j = 0; j < num_supported_values; j++)
+                {
                     char* value;
                     g_variant_iter_loop(iter_supported_values, "(s)", &value);
-                    aValueName = OStringToOUString( value, aEncoding );
-                    if (aOptionName == "Duplex") {
+                    aValueName = OStringToOUString(value, aEncoding);
+                    if (aOptionName == "Duplex")
+                    {
                         // Duplex key matches against very specific Values
-                        if (aValueName == "one-sided") {
+                        if (aValueName == "one-sided")
+                        {
                             aValueName = OUString("None");
-                        } else if (aValueName == "two-sided-long-edge") {
+                        }
+                        else if (aValueName == "two-sided-long-edge")
+                        {
                             aValueName = OUString("DuplexNoTumble");
-                        } else if (aValueName == "two-sided-short-edge") {
+                        }
+                        else if (aValueName == "two-sided-short-edge")
+                        {
                             aValueName = OUString("DuplexTumble");
                         }
                     }
 
-                    pValue = pKey->insertValue( aValueName, eQuoted );
-                    if( ! pValue )
+                    pValue = pKey->insertValue(aValueName, eQuoted);
+                    if (!pValue)
                         continue;
                     pValue->m_aValue = aValueName;
 
-                    if (aValueName.equals(aDefaultValue)) {
+                    if (aValueName.equals(aDefaultValue))
+                    {
                         pKey->m_pDefaultValue = pValue;
                         bDefaultFound = true;
                     }
-
                 }
                 // This could be done to ensure default values also appear as 
options:
-                if (!bDefaultFound && pKey->m_bUIOption) {
-                //     pValue = pKey->insertValue( aDefaultValue, eQuoted );
-                //     if( pValue )
-                //         pValue->m_aValue = aDefaultValue;
+                if (!bDefaultFound && pKey->m_bUIOption)
+                {
+                    //     pValue = pKey->insertValue( aDefaultValue, eQuoted 
);
+                    //     if( pValue )
+                    //         pValue->m_aValue = aDefaultValue;
                 }
                 keys.emplace_back(pKey);
             }
 
             pKey = new PPDKey("ModelName");
-            aValueName = OStringToOUString( "", aEncoding );
-            pValue = pKey->insertValue( aValueName, eQuoted );
-            if( pValue )
+            aValueName = OStringToOUString("", aEncoding);
+            pValue = pKey->insertValue(aValueName, eQuoted);
+            if (pValue)
                 pValue->m_aValue = aValueName;
             pKey->m_pDefaultValue = pValue;
             keys.emplace_back(pKey);
 
             pKey = new PPDKey("NickName");
-            aValueName = OStringToOUString( pDest->name, aEncoding );
-            pValue = pKey->insertValue( aValueName, eQuoted );
-            if( pValue )
+            aValueName = OStringToOUString(pDest->name, aEncoding);
+            pValue = pKey->insertValue(aValueName, eQuoted);
+            if (pValue)
                 pValue->m_aValue = aValueName;
             pKey->m_pDefaultValue = pValue;
             keys.emplace_back(pKey);
 
             pNewParser = new PPDParser(aPrinter, keys);
-            PrinterInfo& rInfo = m_aPrinters[ aPrinter ].m_aInfo;
-            PPDContext& rContext = m_aDefaultContexts[ aPrinter ];
-            rContext.setParser( pNewParser );
-            setDefaultPaper( rContext );
+            PrinterInfo& rInfo = m_aPrinters[aPrinter].m_aInfo;
+            PPDContext& rContext = m_aDefaultContexts[aPrinter];
+            rContext.setParser(pNewParser);
+            setDefaultPaper(rContext);
             std::vector<OUString>::iterator defit = default_values.begin();
             for (auto const& key : keys)
             {
-                const PPDValue* p1Value = key->getValue( *defit );
-                if( p1Value )
+                const PPDValue* p1Value = key->getValue(*defit);
+                if (p1Value)
                 {
-                    if( p1Value != key->getDefaultValue() )
+                    if (p1Value != key->getDefaultValue())
                     {
-                        rContext.setValue( key, p1Value, true );
-                        SAL_INFO("vcl.unx.print", "key " << pKey->getKey() << 
" is set to " << *defit);
+                        rContext.setValue(key, p1Value, true);
+                        SAL_INFO("vcl.unx.print",
+                                 "key " << pKey->getKey() << " is set to " << 
*defit);
                     }
                     else
-                        SAL_INFO("vcl.unx.print", "key " << pKey->getKey() << 
" is defaulted to " << *defit);
+                        SAL_INFO("vcl.unx.print",
+                                 "key " << pKey->getKey() << " is defaulted to 
" << *defit);
                 }
                 ++defit;
             }
@@ -463,16 +458,16 @@ const PPDParser* CPDManager::createCPDParser( const 
OUString& rPrinter )
     else
         SAL_INFO("vcl.unx.print", "no dest found for printer " << aPrinter);
 
-    if( ! pNewParser )
+    if (!pNewParser)
     {
         // get the default PPD
-        pNewParser = PPDParser::getParser( "SGENPRT" );
-        SAL_WARN("vcl.unx.print", "Parsing default SGENPRT PPD" );
+        pNewParser = PPDParser::getParser("SGENPRT");
+        SAL_WARN("vcl.unx.print", "Parsing default SGENPRT PPD");
 
-        PrinterInfo& rInfo = m_aPrinters[ aPrinter ].m_aInfo;
+        PrinterInfo& rInfo = m_aPrinters[aPrinter].m_aInfo;
 
         rInfo.m_pParser = pNewParser;
-        rInfo.m_aContext.setParser( pNewParser );
+        rInfo.m_aContext.setParser(pNewParser);
     }
 #else
     (void)rPrinter;
@@ -480,53 +475,46 @@ const PPDParser* CPDManager::createCPDParser( const 
OUString& rPrinter )
     return pNewParser;
 }
 
-
 void CPDManager::initialize()
 {
     // get normal printers, clear printer list
     PrinterInfoManager::initialize();
 #if ENABLE_DBUS && ENABLE_GIO
-    g_bus_own_name_on_connection (m_pConnection,
-                                  "org.libreoffice.print-dialog",
-                                  G_BUS_NAME_OWNER_FLAGS_NONE,
-                                  onNameAcquired,
-                                  onNameLost,
-                                  this,
-                                  nullptr);
-
-    g_dbus_connection_signal_subscribe (m_pConnection,                    // 
DBus Connection
-                                        nullptr,                          // 
Sender Name
-                                        "org.openprinting.PrintBackend",  // 
Sender Interface
-                                        "PrinterAdded",                   // 
Signal Name
-                                        nullptr,                          // 
Object Path
-                                        nullptr,                          // 
arg0 behaviour
-                                        G_DBUS_SIGNAL_FLAGS_NONE,         // 
Signal Flags
-                                        printerAdded,                     // 
Callback Function
-                                        this,
-                                        nullptr);
-    g_dbus_connection_signal_subscribe (m_pConnection,                    // 
DBus Connection
-                                        nullptr,                          // 
Sender Name
-                                        "org.openprinting.PrintBackend",  // 
Sender Interface
-                                        "PrinterRemoved",                 // 
Signal Name
-                                        nullptr,                          // 
Object Path
-                                        nullptr,                          // 
arg0 behaviour
-                                        G_DBUS_SIGNAL_FLAGS_NONE,         // 
Signal Flags
-                                        printerRemoved,                   // 
Callback Function
-                                        this,
-                                        nullptr);
+    g_bus_own_name_on_connection(m_pConnection, "org.libreoffice.print-dialog",
+                                 G_BUS_NAME_OWNER_FLAGS_NONE, onNameAcquired, 
onNameLost, this,
+                                 nullptr);
+
+    g_dbus_connection_signal_subscribe(m_pConnection, // DBus Connection
+                                       nullptr, // Sender Name
+                                       "org.openprinting.PrintBackend", // 
Sender Interface
+                                       "PrinterAdded", // Signal Name
+                                       nullptr, // Object Path
+                                       nullptr, // arg0 behaviour
+                                       G_DBUS_SIGNAL_FLAGS_NONE, // Signal 
Flags
+                                       printerAdded, // Callback Function
+                                       this, nullptr);
+    g_dbus_connection_signal_subscribe(m_pConnection, // DBus Connection
+                                       nullptr, // Sender Name
+                                       "org.openprinting.PrintBackend", // 
Sender Interface
+                                       "PrinterRemoved", // Signal Name
+                                       nullptr, // Object Path
+                                       nullptr, // arg0 behaviour
+                                       G_DBUS_SIGNAL_FLAGS_NONE, // Signal 
Flags
+                                       printerRemoved, // Callback Function
+                                       this, nullptr);
 
     // remove everything that is not a CUPS printer and not
     // a special purpose printer (PDF, Fax)
-    std::unordered_map< OUString, Printer >::iterator it = m_aPrinters.begin();
+    std::unordered_map<OUString, Printer>::iterator it = m_aPrinters.begin();
     while (it != m_aPrinters.end())
     {
-        if( m_aCPDDestMap.find( it->first ) != m_aCPDDestMap.end() )
+        if (m_aCPDDestMap.find(it->first) != m_aCPDDestMap.end())
         {
             ++it;
             continue;
         }
 
-        if( !it->second.m_aInfo.m_aFeatures.isEmpty() )
+        if (!it->second.m_aInfo.m_aFeatures.isEmpty())
         {
             ++it;
             continue;
@@ -536,63 +524,64 @@ void CPDManager::initialize()
 #endif
 }
 
-void CPDManager::setupJobContextData( JobData& rData )
+void CPDManager::setupJobContextData(JobData& rData)
 {
 #if ENABLE_DBUS && ENABLE_GIO
-    std::unordered_map<OUString, CPDPrinter *>::iterator dest_it =
-        m_aCPDDestMap.find( rData.m_aPrinterName );
+    std::unordered_map<OUString, CPDPrinter*>::iterator dest_it
+        = m_aCPDDestMap.find(rData.m_aPrinterName);
 
-    if( dest_it == m_aCPDDestMap.end() )
-        return PrinterInfoManager::setupJobContextData( rData );
+    if (dest_it == m_aCPDDestMap.end())
+        return PrinterInfoManager::setupJobContextData(rData);
 
-    std::unordered_map< OUString, Printer >::iterator p_it =
-        m_aPrinters.find( rData.m_aPrinterName );
-    if( p_it == m_aPrinters.end() ) // huh ?
+    std::unordered_map<OUString, Printer>::iterator p_it = 
m_aPrinters.find(rData.m_aPrinterName);
+    if (p_it == m_aPrinters.end()) // huh ?
     {
         SAL_WARN("vcl.unx.print", "CPD printer list in disorder, "
-                 "no dest for printer " << rData.m_aPrinterName);
+                                  "no dest for printer "
+                                      << rData.m_aPrinterName);
         return;
     }
 
-    if( p_it->second.m_aInfo.m_pParser == nullptr )
+    if (p_it->second.m_aInfo.m_pParser == nullptr)
     {
         // in turn calls createCPDParser
         // which updates the printer info
-        p_it->second.m_aInfo.m_pParser = PPDParser::getParser( 
p_it->second.m_aInfo.m_aDriverName );
+        p_it->second.m_aInfo.m_pParser = 
PPDParser::getParser(p_it->second.m_aInfo.m_aDriverName);
     }
-    if( p_it->second.m_aInfo.m_aContext.getParser() == nullptr )
+    if (p_it->second.m_aInfo.m_aContext.getParser() == nullptr)
     {
         OUString aPrinter;
-        if( p_it->second.m_aInfo.m_aDriverName.startsWith("CPD:") )
-            aPrinter = p_it->second.m_aInfo.m_aDriverName.copy( 4 );
+        if (p_it->second.m_aInfo.m_aDriverName.startsWith("CPD:"))
+            aPrinter = p_it->second.m_aInfo.m_aDriverName.copy(4);
         else
             aPrinter = p_it->second.m_aInfo.m_aDriverName;
 
-        p_it->second.m_aInfo.m_aContext = m_aDefaultContexts[ aPrinter ];
+        p_it->second.m_aInfo.m_aContext = m_aDefaultContexts[aPrinter];
     }
 
-    rData.m_pParser     = p_it->second.m_aInfo.m_pParser;
-    rData.m_aContext    = p_it->second.m_aInfo.m_aContext;
+    rData.m_pParser = p_it->second.m_aInfo.m_pParser;
+    rData.m_aContext = p_it->second.m_aInfo.m_aContext;
 #else
     (void)rData;
 #endif
 }
 
-FILE* CPDManager::startSpool( const OUString& rPrintername, bool bQuickCommand 
)
+FILE* CPDManager::startSpool(const OUString& rPrintername, bool bQuickCommand)
 {
 #if ENABLE_DBUS && ENABLE_GIO
-    SAL_INFO( "vcl.unx.print", "startSpool: " << rPrintername << " " << 
(bQuickCommand ? "true" : "false") );
-    if( m_aCPDDestMap.find( rPrintername ) == m_aCPDDestMap.end() )
+    SAL_INFO("vcl.unx.print",
+             "startSpool: " << rPrintername << " " << (bQuickCommand ? "true" 
: "false"));
+    if (m_aCPDDestMap.find(rPrintername) == m_aCPDDestMap.end())
     {
-        SAL_INFO( "vcl.unx.print", "defer to PrinterInfoManager::startSpool" );
-        return PrinterInfoManager::startSpool( rPrintername, bQuickCommand );
+        SAL_INFO("vcl.unx.print", "defer to PrinterInfoManager::startSpool");
+        return PrinterInfoManager::startSpool(rPrintername, bQuickCommand);
     }
     OUString aTmpURL, aTmpFile;
-    osl_createTempFile( nullptr, nullptr, &aTmpURL.pData );
-    osl_getSystemPathFromFileURL( aTmpURL.pData, &aTmpFile.pData );
-    OString aSysFile = OUStringToOString( aTmpFile, 
osl_getThreadTextEncoding() );
-    FILE* fp = fopen( aSysFile.getStr(), "w" );
-    if( fp )
+    osl_createTempFile(nullptr, nullptr, &aTmpURL.pData);
+    osl_getSystemPathFromFileURL(aTmpURL.pData, &aTmpFile.pData);
+    OString aSysFile = OUStringToOString(aTmpFile, 
osl_getThreadTextEncoding());
+    FILE* fp = fopen(aSysFile.getStr(), "w");
+    if (fp)
         m_aSpoolFiles[fp] = aSysFile;
 
     return fp;
@@ -604,40 +593,57 @@ FILE* CPDManager::startSpool( const OUString& 
rPrintername, bool bQuickCommand )
 }
 
 #if ENABLE_DBUS && ENABLE_GIO
-void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool 
bBanner, const OString& rJobName, int& rNumOptions, GVariant **arr )
+void CPDManager::getOptionsFromDocumentSetup(const JobData& rJob, bool bBanner,
+                                             const OString& rJobName, int& 
rNumOptions,
+                                             GVariant** arr)
 {
-    GVariantBuilder *builder;
+    GVariantBuilder* builder;
     builder = g_variant_builder_new(G_VARIANT_TYPE("a(ss)"));
     g_variant_builder_add(builder, "(ss)", "job-name", rJobName.getStr());
-    if( rJob.m_pParser ==  rJob.m_aContext.getParser() &&  rJob.m_pParser ) {
+    if (rJob.m_pParser == rJob.m_aContext.getParser() && rJob.m_pParser)
+    {
         std::size_t i;
         std::size_t nKeys = rJob.m_aContext.countValuesModified();
-        ::std::vector< const PPDKey* > aKeys( nKeys );
-        for(  i = 0; i < nKeys; i++ )
-            aKeys[i] = rJob.m_aContext.getModifiedKey( i );
-        for( i = 0; i < nKeys; i++ ) {
+        ::std::vector<const PPDKey*> aKeys(nKeys);
+        for (i = 0; i < nKeys; i++)
+            aKeys[i] = rJob.m_aContext.getModifiedKey(i);
+        for (i = 0; i < nKeys; i++)
+        {
             const PPDKey* pKey = aKeys[i];
-            const PPDValue* pValue = rJob.m_aContext.getValue( pKey );
+            const PPDValue* pValue = rJob.m_aContext.getValue(pKey);
             OUString sPayLoad;
-            if (pValue) {
+            if (pValue)
+            {
                 sPayLoad = pValue->m_bCustomOption ? pValue->m_aCustomOption : 
pValue->m_aOption;
             }
-            if (!sPayLoad.isEmpty()) {
-                OString aKey = OUStringToOString( pKey->getKey(), 
RTL_TEXTENCODING_ASCII_US );
-                OString aValue = OUStringToOString( sPayLoad, 
RTL_TEXTENCODING_ASCII_US );
-                if (aKey.equals("Duplex"_ostr)) {
+            if (!sPayLoad.isEmpty())
+            {
+                OString aKey = OUStringToOString(pKey->getKey(), 
RTL_TEXTENCODING_ASCII_US);
+                OString aValue = OUStringToOString(sPayLoad, 
RTL_TEXTENCODING_ASCII_US);
+                if (aKey.equals("Duplex"_ostr))
+                {
                     aKey = "sides"_ostr;
-                } else if (aKey.equals("Resolution"_ostr)) {
+                }
+                else if (aKey.equals("Resolution"_ostr))
+                {
                     aKey = "printer-resolution"_ostr;
-                } else if (aKey.equals("PageSize"_ostr)) {
+                }
+                else if (aKey.equals("PageSize"_ostr))
+                {
                     aKey = "media"_ostr;
                 }
-                if (aKey.equals("sides"_ostr)) {
-                    if (aValue.equals("None"_ostr)) {
+                if (aKey.equals("sides"_ostr))
+                {
+                    if (aValue.equals("None"_ostr))
+                    {
                         aValue = "one-sided"_ostr;
-                    } else if (aValue.equals("DuplexNoTumble"_ostr)) {
+                    }
+                    else if (aValue.equals("DuplexNoTumble"_ostr))
+                    {
                         aValue = "two-sided-long-edge"_ostr;
-                    } else if (aValue.equals("DuplexTumble"_ostr)) {
+                    }
+                    else if (aValue.equals("DuplexTumble"_ostr))
+                    {
                         aValue = "two-sided-short-edge"_ostr;
                     }
                 }
@@ -645,29 +651,37 @@ void CPDManager::getOptionsFromDocumentSetup( const 
JobData& rJob, bool bBanner,
             }
         }
     }
-    if( rJob.m_nCopies > 1 )
+    if (rJob.m_nCopies > 1)
     {
-        OString aVal( OString::number( rJob.m_nCopies ) );
+        OString aVal(OString::number(rJob.m_nCopies));
         g_variant_builder_add(builder, "(ss)", "copies", aVal.getStr());
         rNumOptions++;
         // TODO: something for collate
         // Maybe this is the equivalent ipp attribute:
-        if (rJob.m_bCollate) {
-            g_variant_builder_add(builder, "(ss)", 
"multiple-document-handling", "separate-documents-collated-copies");
-        } else {
-            g_variant_builder_add(builder, "(ss)", 
"multiple-document-handling", "separate-documents-uncollated-copies");
+        if (rJob.m_bCollate)
+        {
+            g_variant_builder_add(builder, "(ss)", 
"multiple-document-handling",
+                                  "separate-documents-collated-copies");
+        }
+        else
+        {
+            g_variant_builder_add(builder, "(ss)", 
"multiple-document-handling",
+                                  "separate-documents-uncollated-copies");
         }
         rNumOptions++;
     }
-    if( ! bBanner )
+    if (!bBanner)
     {
         g_variant_builder_add(builder, "(ss)", "job-sheets", "none");
         rNumOptions++;
     }
-    if (rJob.m_eOrientation == orientation::Portrait) {
+    if (rJob.m_eOrientation == orientation::Portrait)
+    {
         g_variant_builder_add(builder, "(ss)", "orientation-requested", 
"portrait");
         rNumOptions++;
-    } else if (rJob.m_eOrientation == orientation::Landscape) {
+    }
+    else if (rJob.m_eOrientation == orientation::Landscape)
+    {
         g_variant_builder_add(builder, "(ss)", "orientation-requested", 
"landscape");
         rNumOptions++;
     }
@@ -676,23 +690,25 @@ void CPDManager::getOptionsFromDocumentSetup( const 
JobData& rJob, bool bBanner,
 }
 #endif
 
-bool CPDManager::endSpool( const OUString& rPrintername, const OUString& 
rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const 
OUString& rFaxNumber )
+bool CPDManager::endSpool(const OUString& rPrintername, const OUString& 
rJobTitle, FILE* pFile,
+                          const JobData& rDocumentJobData, bool bBanner, const 
OUString& rFaxNumber)
 {
     bool success = false;
 #if ENABLE_DBUS && ENABLE_GIO
-    SAL_INFO( "vcl.unx.print", "endSpool: " << rPrintername << "," << 
rJobTitle << " copy count = " << rDocumentJobData.m_nCopies );
-    std::unordered_map< OUString, CPDPrinter * >::iterator dest_it =
-        m_aCPDDestMap.find( rPrintername );
-    if( dest_it == m_aCPDDestMap.end() )
+    SAL_INFO("vcl.unx.print", "endSpool: " << rPrintername << "," << rJobTitle
+                                           << " copy count = " << 
rDocumentJobData.m_nCopies);
+    std::unordered_map<OUString, CPDPrinter*>::iterator dest_it = 
m_aCPDDestMap.find(rPrintername);
+    if (dest_it == m_aCPDDestMap.end())
     {
-        SAL_INFO( "vcl.unx.print", "defer to PrinterInfoManager::endSpool" );
-        return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, 
rDocumentJobData, bBanner, rFaxNumber );
+        SAL_INFO("vcl.unx.print", "defer to PrinterInfoManager::endSpool");
+        return PrinterInfoManager::endSpool(rPrintername, rJobTitle, pFile, 
rDocumentJobData,
+                                            bBanner, rFaxNumber);
     }
 
-    std::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = 
m_aSpoolFiles.find( pFile );
-    if( it != m_aSpoolFiles.end() )
+    std::unordered_map<FILE*, OString, FPtrHash>::const_iterator it = 
m_aSpoolFiles.find(pFile);
+    if (it != m_aSpoolFiles.end())
     {
-        fclose( pFile );
+        fclose(pFile);
         rtl_TextEncoding aEnc = osl_getThreadTextEncoding();
         OString sJobName(OUStringToOString(rJobTitle, aEnc));
         if (!rFaxNumber.isEmpty())
@@ -704,24 +720,19 @@ bool CPDManager::endSpool( const OUString& rPrintername, 
const OUString& rJobTit
         GVariant* ret;
         gint job_id;
         int nNumOptions = 0;
-        GVariant *pArr = nullptr;
-        getOptionsFromDocumentSetup( rDocumentJobData, bBanner, sJobName, 
nNumOptions, &pArr );
-        ret = g_dbus_proxy_call_sync (pDest->backend, "printFile",
-                                      g_variant_new(
-                                                    "(ssi@a(ss))",
-                                                    (pDest->id),
-                                                    aSysFile.getStr(),
-                                                    nNumOptions,
-                                                    pArr
-                                                    ),
-                                      G_DBUS_CALL_FLAGS_NONE,
-                                      -1, nullptr, nullptr);
-        g_variant_get (ret, "(i)", &job_id);
-        if (job_id != -1) {
+        GVariant* pArr = nullptr;
+        getOptionsFromDocumentSetup(rDocumentJobData, bBanner, sJobName, 
nNumOptions, &pArr);
+        ret = g_dbus_proxy_call_sync(
+            pDest->backend, "printFile",
+            g_variant_new("(ssi@a(ss))", (pDest->id), aSysFile.getStr(), 
nNumOptions, pArr),
+            G_DBUS_CALL_FLAGS_NONE, -1, nullptr, nullptr);
+        g_variant_get(ret, "(i)", &job_id);
+        if (job_id != -1)
+        {
             success = true;
         }
         g_variant_unref(ret);
-        unlink( it->second.getStr() );
+        unlink(it->second.getStr());
         m_aSpoolFiles.erase(it);
     }
 #else
@@ -735,18 +746,14 @@ bool CPDManager::endSpool( const OUString& rPrintername, 
const OUString& rJobTit
     return success;
 }
 
-bool CPDManager::checkPrintersChanged( bool )
+bool CPDManager::checkPrintersChanged(bool)
 {
 #if ENABLE_DBUS && ENABLE_GIO
     bool bChanged = m_aPrintersChanged;
     m_aPrintersChanged = false;
-    g_dbus_connection_emit_signal (m_pConnection,
-                                   nullptr,
-                                   "/org/libreoffice/PrintDialog",
-                                   "org.openprinting.PrintFrontend",
-                                   "RefreshBackend",
-                                   nullptr,
-                                   nullptr);
+    g_dbus_connection_emit_signal(m_pConnection, nullptr, 
"/org/libreoffice/PrintDialog",
+                                  "org.openprinting.PrintFrontend", 
"RefreshBackend", nullptr,
+                                  nullptr);
     return bChanged;
 #else
     return false;
@@ -754,4 +761,3 @@ bool CPDManager::checkPrintersChanged( bool )
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-

Reply via email to