summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2020-12-22 10:54:27 +1100
committerMike Kaganski <mike.kaganski@collabora.com>2021-01-02 14:59:49 +0100
commitab2d3462f412d5180e60512df0dfb9c3b13ebf0c (patch)
tree6c873d8d8f2f6ad3ede20ffb068a5828684b3b11 /toolkit
parentdd91d3389c26645459d3b80649941d65efa4f63f (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 'toolkit')
-rw-r--r--toolkit/source/awt/vclxdevice.cxx45
1 files changed, 2 insertions, 43 deletions
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
index 84e54e630453..ba382248c0fd 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/awt/DeviceCapability.hpp>
-
#include <com/sun/star/util/MeasureUnit.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -87,47 +85,8 @@ css::awt::DeviceInfo VCLXDevice::getInfo()
css::awt::DeviceInfo aInfo;
- if( mpOutputDevice )
- {
- Size aDevSz;
- OutDevType eDevType = mpOutputDevice->GetOutDevType();
- if ( eDevType == OUTDEV_WINDOW )
- {
- aDevSz = static_cast<vcl::Window*>(mpOutputDevice.get())->GetSizePixel();
- static_cast<vcl::Window*>(mpOutputDevice.get())->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
- }
- else if ( eDevType == OUTDEV_PRINTER )
- {
- aDevSz = static_cast<Printer*>(mpOutputDevice.get())->GetPaperSizePixel();
- Size aOutSz = mpOutputDevice->GetOutputSizePixel();
- Point aOffset = static_cast<Printer*>(mpOutputDevice.get())->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();
- }
- else // VirtualDevice
- {
- aDevSz = mpOutputDevice->GetOutputSizePixel();
- aInfo.LeftInset = 0;
- aInfo.TopInset = 0;
- aInfo.RightInset = 0;
- aInfo.BottomInset = 0;
- }
-
- aInfo.Width = aDevSz.Width();
- aInfo.Height = aDevSz.Height();
-
- Size aTmpSz = mpOutputDevice->LogicToPixel( Size( 1000, 1000 ), MapMode( MapUnit::MapCM ) );
- aInfo.PixelPerMeterX = aTmpSz.Width()/10;
- aInfo.PixelPerMeterY = aTmpSz.Height()/10;
-
- aInfo.BitsPerPixel = mpOutputDevice->GetBitCount();
-
- aInfo.Capabilities = 0;
- if ( mpOutputDevice->GetOutDevType() != OUTDEV_PRINTER )
- aInfo.Capabilities = css::awt::DeviceCapability::RASTEROPERATIONS|css::awt::DeviceCapability::GETBITS;
- }
+ if (mpOutputDevice)
+ aInfo = mpOutputDevice->GetDeviceInfo();
return aInfo;
}