diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-04 18:10:11 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-04 20:47:14 +0100 |
commit | 3d780e72b93773a25f796feb488b0fd878c490b5 (patch) | |
tree | 7031e08095a5dc6ebc296bd71c99ebe382af2c43 /vcl/source | |
parent | 2449571a3ed5f0f5daeb60db6e740a5d830afa4a (diff) |
Move helpers for css::awt/VCL point/rect/size to vcl::unohelper
Move helpers to convert between the Rectangle, Point and Size
classes in vcl and in css::awt from VCLUnoHelper (in the toolkit module)
to vcl::unohelper (in the vcl module), for reuse in vcl in upcoming
commits.
Change-Id: I7b11c8a6b8c843a01ce25b1e4c0fb1869ad1e6ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177816
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/unohelp.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index ed9f62a5df20..05ac38c4fa7e 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -209,5 +209,36 @@ FontItalic vcl::unohelper::ConvertFontSlant(css::awt::FontSlant eSlant) return eRet; } +Size vcl::unohelper::ConvertToVCLSize(const css::awt::Size& rAWTSize) +{ + return Size(rAWTSize.Width, rAWTSize.Height); +} + +css::awt::Size vcl::unohelper::ConvertToAWTSize(const Size& rVCLSize) +{ + return css::awt::Size(rVCLSize.Width(), rVCLSize.Height()); +} + +Point vcl::unohelper::ConvertToVCLPoint(const css::awt::Point& rAWTPoint) +{ + return Point(rAWTPoint.X, rAWTPoint.Y); +} + +css::awt::Point vcl::unohelper::ConvertToAWTPoint(const PointTemplateBase& rVCLPoint) +{ + return css::awt::Point(rVCLPoint.X(), rVCLPoint.Y()); +} + +tools::Rectangle vcl::unohelper::ConvertToVCLRect(const css::awt::Rectangle& rAWTRect) +{ + return ::tools::Rectangle(Point(rAWTRect.X, rAWTRect.Y), + Size(rAWTRect.Width, rAWTRect.Height)); +} + +css::awt::Rectangle vcl::unohelper::ConvertToAWTRect(const RectangleTemplateBase& rVCLRect) +{ + return css::awt::Rectangle(rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), + rVCLRect.GetHeight()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |