summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-11-09 14:14:02 +0200
committerTor Lillqvist <tml@collabora.com>2021-11-09 17:14:35 +0100
commit4e01639f2ce64f3f6c3281ef526b3e4645566b6b (patch)
tree15593f29786c80ac952a8b987f21dfa9f2e64ee8 /include/comphelper
parent9393325c1db9fa25037d208607b71adb567a8bbc (diff)
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 <tml@collabora.com>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/windowsdebugoutput.hxx25
1 files changed, 25 insertions, 0 deletions
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: */