diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2020-12-22 10:54:27 +1100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-01-02 14:59:49 +0100 |
commit | ab2d3462f412d5180e60512df0dfb9c3b13ebf0c (patch) | |
tree | 6c873d8d8f2f6ad3ede20ffb068a5828684b3b11 /vcl/source | |
parent | dd91d3389c26645459d3b80649941d65efa4f63f (diff) |
tdf#74702 - vcl: introduce OutputDevice::GetDeviceInfo()
Change-Id: I02c9cc83fea330ed0ba1539b2682f75d33ba80fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108132
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/print.cxx | 15 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 32 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 7 |
3 files changed, 54 insertions, 0 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 99931441de04..bb99579fcafc 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1644,4 +1644,19 @@ Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const return OutputDevice::GetBitmap( rSrcPt, rSize ); } +css::awt::DeviceInfo Printer::GetDeviceInfo() const +{ + Size aDevSz = GetPaperSizePixel(); + css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(aDevSz); + Size aOutSz = GetOutputSizePixel(); + Point aOffset = GetPageOffset(); + aInfo.LeftInset = aOffset.X(); + aInfo.TopInset = aOffset.Y(); + aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X(); + aInfo.BottomInset = aDevSz.Height() - aOutSz.Height() - aOffset.Y(); + aInfo.Capabilities = 0; + + return aInfo; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index f2e19889d06b..729e322ec664 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -34,6 +34,8 @@ #include <window.h> #include <outdev.h> +#include <com/sun/star/awt/DeviceCapability.hpp> + #ifdef DISABLE_DYNLOADING // Linking all needed LO code into one .so/executable, these already // exist in the tools library, so put them in the anonymous namespace @@ -701,4 +703,34 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } +css::awt::DeviceInfo OutputDevice::GetCommonDeviceInfo(Size const& rDevSz) const +{ + css::awt::DeviceInfo aInfo; + + aInfo.Width = rDevSz.Width(); + aInfo.Height = rDevSz.Height(); + + Size aTmpSz = LogicToPixel(Size(1000, 1000), MapMode(MapUnit::MapCM)); + aInfo.PixelPerMeterX = aTmpSz.Width() / 10; + aInfo.PixelPerMeterY = aTmpSz.Height() / 10; + aInfo.BitsPerPixel = GetBitCount(); + + aInfo.Capabilities = css::awt::DeviceCapability::RASTEROPERATIONS | + css::awt::DeviceCapability::GETBITS; + + return aInfo; +} + +css::awt::DeviceInfo OutputDevice::GetDeviceInfo() const +{ + css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(GetOutputSizePixel()); + + aInfo.LeftInset = 0; + aInfo.TopInset = 0; + aInfo.RightInset = 0; + aInfo.BottomInset = 0; + + return aInfo; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 81dbbf63670c..d897e94a0bea 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3963,6 +3963,13 @@ FactoryFunction Window::GetUITestFactory() const return WindowUIObject::create; } +css::awt::DeviceInfo Window::GetDeviceInfo() const +{ + css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(GetSizePixel()); + GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset); + return aInfo; +} + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |