summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chart2/source/controller/inc/ChartController.hxx2
-rw-r--r--chart2/source/controller/main/ChartController.cxx4
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx90
-rw-r--r--desktop/source/lib/init.cxx45
4 files changed, 110 insertions, 31 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index eb4cad46b540..a14224e24c73 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -481,7 +481,7 @@ private:
bool EndTextEdit();
void executeDispatch_View3D();
- void executeDispatch_PositionAndSize();
+ void executeDispatch_PositionAndSize( const ::css::uno::Sequence< ::css::beans::PropertyValue >* pArgs = nullptr );
void executeDispatch_EditData();
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index d26d2be9da39..5540d67a0e90 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1085,6 +1085,10 @@ void SAL_CALL ChartController::dispatch(
executeDispatch_LOKSetTextSelection(nType, nX, nY);
}
}
+ else if (aCommand == "LOKTransform")
+ {
+ this->executeDispatch_PositionAndSize(&rArgs);
+ }
else if(aCommand == "Paste")
this->executeDispatch_Paste();
else if(aCommand == "Copy" )
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index 6fc9eeb948a6..164b2197ec91 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -107,7 +107,7 @@ static void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, awt::
rPosAndSize = awt::Rectangle(nPosX,nPosY,nSizX,nSizY);
}
-void ChartController::executeDispatch_PositionAndSize()
+void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence< ::css::beans::PropertyValue >* pArgs)
{
const OUString aCID( m_aSelection.getSelectedCID() );
@@ -130,40 +130,74 @@ void ChartController::executeDispatch_PositionAndSize()
try
{
SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject();
+ const SfxItemSet* pOutItemSet = nullptr;
+ if (!pArgs)
+ {
+ //prepare and open dialog
+ SdrView* pSdrView = m_pDrawViewWrapper.get();
+ bool bResizePossible = m_aSelection.isResizeableObjectSelected();
- //prepare and open dialog
- SdrView* pSdrView = m_pDrawViewWrapper.get();
- bool bResizePossible = m_aSelection.isResizeableObjectSelected();
-
- SolarMutexGuard aGuard;
- SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create();
- vcl::Window* pWin = GetChartWindow();
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSchTransformTabDialog(
- pWin ? pWin->GetFrameWeld() : nullptr, &aItemSet, pSdrView, bResizePossible));
+ SolarMutexGuard aGuard;
+ SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create();
+ vcl::Window* pWin = GetChartWindow();
+ ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSchTransformTabDialog(
+ pWin ? pWin->GetFrameWeld() : nullptr, &aItemSet, pSdrView, bResizePossible));
- if( pDlg->Execute() == RET_OK )
+ if( pDlg->Execute() == RET_OK )
+ {
+ pOutItemSet = pDlg->GetOutputItemSet();
+ if (pOutItemSet)
+ aItemSet.Put(*pOutItemSet);//overwrite old values with new values (-> all items are set)
+ }
+ }
+ else
{
- const SfxItemSet* pOutItemSet = pDlg->GetOutputItemSet();
- if(pOutItemSet)
+ const SfxItemPool* pPool = aItemSet.GetPool();
+ if (!pPool)
+ return;
+
+ sal_uInt16 nWhich;
+ for (const auto& aProp: *pArgs)
{
- awt::Rectangle aObjectRect;
- aItemSet.Put(*pOutItemSet);//overwrite old values with new values (-> all items are set)
- lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect, aSelectedSize );
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
- awt::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
-
- bool bChanged = false;
- if ( eObjectType == OBJECTTYPE_LEGEND )
- {
- ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel().get());
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, false , true);
+ sal_Int32 nValue = 0;
+ aProp.Value >>= nValue;
+ if (aProp.Name == "TransformPosX") {
+ nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_POS_X);
+ aItemSet.Put(SfxInt32Item(nWhich, nValue));
+ }
+ else if (aProp.Name == "TransformPosY") {
+ nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_POS_Y);
+ aItemSet.Put(SfxInt32Item(nWhich, nValue));
+ }
+ else if (aProp.Name == "TransformWidth") {
+ nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_WIDTH);
+ aItemSet.Put(SfxUInt32Item(nWhich, static_cast<sal_uInt32>(nValue)));
}
+ else if (aProp.Name == "TransformHeight") {
+ nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_HEIGHT);
+ aItemSet.Put(SfxUInt32Item(nWhich, static_cast<sal_uInt32>(nValue)));
+ }
+ }
+ }
- bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel()
- , aObjectRect, aPageRect );
- if( bMoved || bChanged )
- aUndoGuard.commit();
+ if(pOutItemSet || pArgs)
+ {
+ awt::Rectangle aObjectRect;
+ lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect, aSelectedSize );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
+
+ bool bChanged = false;
+ if ( eObjectType == OBJECTTYPE_LEGEND )
+ {
+ ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel().get());
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, false , true);
}
+
+ bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel()
+ , aObjectRect, aPageRect );
+ if( bMoved || bChanged )
+ aUndoGuard.commit();
}
}
catch(const uno::Exception& e)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f747a5391a77..5710c268fec9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -991,7 +991,14 @@ void CallbackFlushHandler::queue(const int type, const char* data)
}
#endif
- if (m_bPartTilePainting)
+ bool bIsChartActive = false;
+ if (type == LOK_CALLBACK_GRAPHIC_SELECTION)
+ {
+ LokChartHelper aChartHelper(SfxViewShell::Current());
+ bIsChartActive = aChartHelper.GetWindow() != nullptr;
+ }
+
+ if (m_bPartTilePainting && !bIsChartActive)
{
// We drop notifications when this is set, except for important ones.
// When we issue a complex command (such as .uno:InsertAnnotation)
@@ -3038,13 +3045,20 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
{
bool bNeedConversion = false;
SfxViewShell* pViewShell = SfxViewShell::Current();
- if (const SdrView* pView = pViewShell->GetDrawView())
+ LokChartHelper aChartHelper(pViewShell);
+
+ if (aChartHelper.GetWindow() )
+ {
+ bNeedConversion = true;
+ }
+ else if (const SdrView* pView = pViewShell->GetDrawView())
{
if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice())
{
bNeedConversion = (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM);
}
}
+
if (bNeedConversion)
{
sal_Int32 value;
@@ -3061,8 +3075,35 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
value = OutputDevice::LogicToLogic(value, MapUnit::MapTwip, MapUnit::Map100thMM);
rPropValue.Value <<= value;
}
+ }
+ }
+
+ if (aChartHelper.GetWindow())
+ {
+ tools::Rectangle aChartBB = aChartHelper.GetChartBoundingBox();
+ int nLeft = OutputDevice::LogicToLogic(aChartBB.Left(), MapUnit::MapTwip, MapUnit::Map100thMM);
+ int nTop = OutputDevice::LogicToLogic(aChartBB.Top(), MapUnit::MapTwip, MapUnit::Map100thMM);
+ sal_Int32 value;
+ for (beans::PropertyValue& rPropValue: aPropertyValuesVector)
+ {
+ if (rPropValue.Name == "TransformPosX" || rPropValue.Name == "TransformRotationX")
+ {
+ rPropValue.Value >>= value;
+ rPropValue.Value <<= value - nLeft;
+ }
+ else if (rPropValue.Name == "TransformPosY" || rPropValue.Name == "TransformRotationY")
+ {
+ rPropValue.Value >>= value;
+ rPropValue.Value <<= value - nTop;
+ }
}
+
+ util::URL aCommandURL;
+ aCommandURL.Path = "LOKTransform";
+ css::uno::Reference<css::frame::XDispatch>& aChartDispatcher = aChartHelper.GetXDispatcher();
+ aChartDispatcher->dispatch(aCommandURL, comphelper::containerToSequence(aPropertyValuesVector));
+ return;
}
}