include/comphelper/windowsdebugoutput.hxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit 4e01639f2ce64f3f6c3281ef526b3e4645566b6b
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Tue Nov 9 14:14:02 2021 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Tue Nov 9 17:14:35 2021 +0100

    Add DC_PAPERSIZE_array_to_string
    
    Change-Id: I04a16294321f092a3aebe45735266d4ae34d51dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124915
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/include/comphelper/windowsdebugoutput.hxx 
b/include/comphelper/windowsdebugoutput.hxx
index 24185c678f4d..0315933c71cd 100644
--- a/include/comphelper/windowsdebugoutput.hxx
+++ b/include/comphelper/windowsdebugoutput.hxx
@@ -766,6 +766,31 @@ inline std::string DMPAPER_to_string(int dmpaper)
     }
 }
 
+inline std::string DC_PAPERSIZE_array_to_string(POINT* pPaperSizes, DWORD 
nCount)
+{
+    std::string result;
+
+    for (DWORD i = 0; i < nCount; i++)
+    {
+        if (i > 0)
+            result += ", ";
+
+        result += std::to_string(std::lround(pPaperSizes[i].x / 10.0)) + "x"
+                  + std::to_string(std::lround(pPaperSizes[i].y / 10.0));
+
+#if 0
+        // WIP. Printer::GetPaperName() should really be inline in 
<i18nutil/paper.hxx> or
+        // something, so that it can be used anywhere. We can't depend on vcl 
in this file as we
+        // might be included in modules that precede vcl.
+        PaperInfo paperInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10);
+        paperInfo.doSloppyFit(true);
+        if (paperInfo.getPaper() != PAPER_USER)
+            result += "(" + 
std::string(Printer::GetPaperName(paperInfo.getPaper()).toUtf8().getStr()) + 
")";
+#endif
+    }
+    return result;
+}
+
 #endif // INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to