summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-07-10 15:05:22 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-07-11 06:44:48 +0200
commit2fdee9fd60bc4bb61f773fa1f766e84f4ee0dae3 (patch)
tree4a541f076f822fc11d26001a16174976b2853da3 /reportdesign
parentf111fbf5d508c8215615f037d7e1c1f563812a13 (diff)
Unify/Port to use VCLUnoHelper for AWT <-> VCL conversions
Following Change-Id: Id48f81deb05aee2026509037f7d14575735e5be0 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Jul 10 14:49:03 2024 +0200 VCLUnoHelper: Align AWT <-> VCL helpers with convert.hxx impl , port all uses of the helper functions defined in `include/toolkit/helper/convert.hxx` to use the `VCLUnoHelper` equivalents instead, to unify usage and avoid duplication. Drop `include/toolkit/helper/convert.hxx` now that it's unused. Change-Id: I22695a93e40e47bb2b14d191a2e0a4eb7c856895 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170317 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/pch/precompiled_rptui.hxx1
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx9
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx4
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx11
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx9
6 files changed, 21 insertions, 17 deletions
diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx
index 9dc3e3fd6fe2..908dfa9cf4f9 100644
--- a/reportdesign/inc/pch/precompiled_rptui.hxx
+++ b/reportdesign/inc/pch/precompiled_rptui.hxx
@@ -444,7 +444,6 @@
#include <svx/xit.hxx>
#include <svx/xpoly.hxx>
#include <svx/xtable.hxx>
-#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/date.hxx>
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 9b7d1db223bd..8ec61ceaca5e 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -82,7 +82,6 @@
#include <sfx2/docfilt.hxx>
#include <helpids.h>
-#include <toolkit/helper/convert.hxx>
#include <o3tl/functional.hxx>
#include <o3tl/safeint.hxx>
@@ -1605,11 +1604,11 @@ void GeometryHandler::checkPosAndSize( const awt::Point& _aNewPos,
if ( !xSection.is() || uno::Reference< report::XShape>(xSourceReportComponent,uno::UNO_QUERY).is() ) // shapes can overlap.
return;
- ::Point aPos(VCLPoint(_aNewPos));
+ ::Point aPos(VCLUnoHelper::ConvertToVCLPoint(_aNewPos));
if ( aPos.X() < 0 || aPos.Y() < 0 ) // TODO: have to check size with pos aka || (aPos.X() + aAwtSize.Width) > m_xSection->getReportDefinition()->
throw beans::PropertyVetoException(RptResId(RID_STR_ILLEGAL_POSITION),xSourceReportComponent);
- ::tools::Rectangle aSourceRect(aPos,VCLSize(_aSize));
+ ::tools::Rectangle aSourceRect(aPos, VCLUnoHelper::ConvertToVCLSize(_aSize));
const sal_Int32 nCount = xSection->getCount();
for (sal_Int32 i = 0; i < nCount ; ++i)
@@ -1617,7 +1616,9 @@ void GeometryHandler::checkPosAndSize( const awt::Point& _aNewPos,
const uno::Reference< report::XReportComponent> xReportComponent(xSection->getByIndex(i),uno::UNO_QUERY);
if ( xReportComponent.is() && xReportComponent != xSourceReportComponent )
{
- const ::tools::Rectangle aBoundRect(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
+ const ::tools::Rectangle aBoundRect(
+ VCLUnoHelper::ConvertToVCLPoint(xReportComponent->getPosition()),
+ VCLUnoHelper::ConvertToVCLSize(xReportComponent->getSize()));
const ::tools::Rectangle aRect = aSourceRect.GetIntersection(aBoundRect);
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
throw beans::PropertyVetoException(RptResId( RID_STR_OVERLAP_OTHER_CONTROL),xSourceReportComponent);
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 2d3851486816..549307b941e4 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -19,7 +19,6 @@
#include <memory>
-#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <SectionView.hxx>
#include <UITools.hxx>
@@ -935,7 +934,8 @@ tools::Rectangle getRectangleFromControl(SdrObject* _pControl)
uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY);
if (xComponent.is())
{
- tools::Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
+ tools::Rectangle aRect(VCLUnoHelper::ConvertToVCLPoint(xComponent->getPosition()),
+ VCLUnoHelper::ConvertToVCLSize(xComponent->getSize()));
aRect.setHeight(aRect.getOpenHeight() + 1);
aRect.setWidth(aRect.getOpenWidth() + 1);
return aRect;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 49cb91063efe..e616cd859eab 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -127,7 +127,6 @@
#include <PropertyForward.hxx>
#include <SectionWindow.hxx>
-#include <toolkit/helper/convert.hxx>
#include <GroupsSorting.hxx>
#include <PageNumber.hxx>
#include <UndoEnv.hxx>
@@ -2415,7 +2414,8 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
else
{
- aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
+ aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,
+ VCLUnoHelper::ConvertToVCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,RPTUI_ID_LRSPACE));
aDescriptor.Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index ec70ae7192e8..61e38fff8e8c 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -43,7 +43,7 @@
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <comphelper/propertyvalue.hxx>
#include <toolkit/awt/vclxmenu.hxx>
-#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <RptDef.hxx>
#include <SectionWindow.hxx>
@@ -255,7 +255,8 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC
// Clone to target SdrModel
rtl::Reference<SdrObject> pNewObj(pObject->CloneSdrObject(*m_pModel));
m_pPage->InsertObject(pNewObj.get(), SAL_MAX_SIZE);
- tools::Rectangle aRet(VCLPoint(rCopy->getPosition()),VCLSize(rCopy->getSize()));
+ tools::Rectangle aRet(VCLUnoHelper::ConvertToVCLPoint(rCopy->getPosition()),
+ VCLUnoHelper::ConvertToVCLSize(rCopy->getSize()));
aRet.setHeight(aRet.getOpenHeight() + 1);
aRet.setWidth(aRet.getOpenWidth() + 1);
bool bOverlapping = true;
@@ -536,7 +537,9 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I
{
xReportComponent->setPosition(aPos);
correctOverlapping(pObject,*this,false);
- tools::Rectangle aRet(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
+ tools::Rectangle aRet(
+ VCLUnoHelper::ConvertToVCLPoint(xReportComponent->getPosition()),
+ VCLUnoHelper::ConvertToVCLSize(xReportComponent->getSize()));
aRet.setHeight(aRet.getOpenHeight() + 1);
aRet.setWidth(aRet.getOpenWidth() + 1);
if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getOpenHeight() + aRet.Top()) > m_xSection->getHeight()) )
@@ -768,7 +771,7 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt )
aCurrent.realloc(nLength + 3);
auto pCurrent = aCurrent.getArray();
pCurrent[nLength].Name = PROPERTY_POSITION;
- pCurrent[nLength++].Value <<= AWTPoint(aDropPos);
+ pCurrent[nLength++].Value <<= VCLUnoHelper::ConvertToAWTPoint(aDropPos);
// give also the DND Action (Shift|Ctrl) Key to really say what we want
pCurrent[nLength].Name = "DNDAction";
pCurrent[nLength++].Value <<= _rEvt.mnAction;
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 111cb612227c..3dfb95ead12f 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -39,7 +39,7 @@
#include <vcl/settings.hxx>
#include <core_resource.hxx>
#include <svx/svdundo.hxx>
-#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <algorithm>
#include <cstdlib>
#include <numeric>
@@ -1238,7 +1238,7 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe
for (; pColIter != pColEnd; ++pColIter)
{
uno::Reference< report::XReportComponent> xRC(*pColIter);
- aPrevious = VCLPoint(xRC->getPosition());
+ aPrevious = VCLUnoHelper::ConvertToVCLPoint(xRC->getPosition());
awt::Size aSize = xRC->getSize();
if ( aNewPos.X() < nLeftMargin )
@@ -1259,12 +1259,13 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe
aNewPos.setX( 0 );
xRC->setSize(aSize);
}
- xRC->setPosition(AWTPoint(aNewPos));
+ xRC->setPosition(VCLUnoHelper::ConvertToAWTPoint(aNewPos));
if ( (pColIter+1) != pColEnd )
{
// bring aNewPos to the position of the next object
uno::Reference< report::XReportComponent> xRCNext = *(pColIter + 1);
- Point aNextPosition = VCLPoint(xRCNext->getPosition());
+ Point aNextPosition
+ = VCLUnoHelper::ConvertToVCLPoint(xRCNext->getPosition());
aNewPos += aNextPosition - aPrevious;
}
}