[Libreoffice-commits] core.git: 2 commits - chart2/source desktop/source filter/source sd/qa svx/source sw/inc sw/source
Marco Cecchetti (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 20 08:35:11 UTC 2019
chart2/source/controller/inc/ChartController.hxx | 2
chart2/source/controller/main/ChartController.cxx | 4
chart2/source/controller/main/ChartController_Position.cxx | 90 ++++++++-----
desktop/source/lib/init.cxx | 45 ++++++
filter/source/svg/svgexport.cxx | 2
sd/qa/unit/tiledrendering/tiledrendering.cxx | 36 ++---
svx/source/svdraw/svdmrkv.cxx | 37 +++--
sw/inc/cmdid.h | 2
sw/inc/unoprnms.hxx | 1
sw/source/core/draw/dflyobj.cxx | 13 +
sw/source/core/inc/dflyobj.hxx | 1
sw/source/core/unocore/unoframe.cxx | 31 ++++
sw/source/core/unocore/unomap1.cxx | 1
13 files changed, 205 insertions(+), 60 deletions(-)
New commits:
commit f6727831d56afe6360a2489a1bc251990fe26c19
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Wed Apr 10 15:49:12 2019 +0200
Commit: Marco Cecchetti <mrcekets at gmail.com>
CommitDate: Mon May 20 10:34:29 2019 +0200
lok: dragging and resizing chart elements
This patch make possible to set the new position or size of a chart
object through setting directly the property value instead of sending
mouse events to the core.
Change-Id: Ifc06dac6bdad78081d63e0ea0db55563a1ae57bc
Reviewed-on: https://gerrit.libreoffice.org/70566
Tested-by: Jenkins
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
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;
}
}
commit c2e30949e0fb7c6a73742450f646e0d8d59d5e4f
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Wed Apr 10 15:13:53 2019 +0200
Commit: Marco Cecchetti <mrcekets at gmail.com>
CommitDate: Mon May 20 10:34:16 2019 +0200
lok: writer: svg export transformed images
Change-Id: I908a6e01573c35c0641519f4995730af0b033c33
Reviewed-on: https://gerrit.libreoffice.org/70565
Tested-by: Jenkins
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 817c529f69d0..a674456be182 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -687,7 +687,7 @@ bool SVGFilter::implExportWriterTextGraphic( const Reference< view::XSelectionSu
{
uno::Reference<beans::XPropertySet> xPropertySet(xSelection, uno::UNO_QUERY);
uno::Reference<graphic::XGraphic> xGraphic;
- xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
+ xPropertySet->getPropertyValue("TransformedGraphic") >>= xGraphic;
if (!xGraphic.is())
return false;
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a35fdc6bf785..8ac4be6fdd2f 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -871,11 +871,11 @@ void SdTiledRenderingTest::testResizeTable()
auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pObject);
CPPUNIT_ASSERT(pTableObject);
- SdrHdlList handleList(nullptr);
- pObject->AddToHdlList(handleList);
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), handleList.GetHdlCount());
- // Take the top left handle
- SdrHdl* pHdl = handleList.GetHdl(0);
+ // Select the table by marking it + starting and ending text edit.
+ SdrView* pView = pViewShell->GetView();
+ pView->MarkObj(pObject, pView->GetSdrPageView());
+ pView->SdrBeginTextEdit(pObject);
+ pView->SdrEndTextEdit();
// Remember the original row heights.
uno::Reference<table::XColumnRowRange> xTable(pTableObject->getTable(), uno::UNO_QUERY);
@@ -886,14 +886,15 @@ void SdTiledRenderingTest::testResizeTable()
sal_Int32 nExpectedRow2 = xRow2->getPropertyValue("Size").get<sal_Int32>();
// Resize the upper row, decrease its height by 1 cm.
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY()));
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY() + 1000));
+ Point aInnerRowEdge = pObject->GetSnapRect().Center();
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY()));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY() - 1000));
// Remember the resized row heights.
sal_Int32 nResizedRow1 = xRow1->getPropertyValue("Size").get<sal_Int32>();
CPPUNIT_ASSERT(nResizedRow1 < nExpectedRow1);
sal_Int32 nResizedRow2 = xRow2->getPropertyValue("Size").get<sal_Int32>();
- CPPUNIT_ASSERT(nResizedRow2 < nExpectedRow2);
+ CPPUNIT_ASSERT_EQUAL(nExpectedRow2, nResizedRow2);
// Now undo the resize.
pXImpressDocument->GetDocShell()->GetUndoManager()->Undo();
@@ -903,7 +904,7 @@ void SdTiledRenderingTest::testResizeTable()
CPPUNIT_ASSERT_EQUAL(nExpectedRow1, nActualRow1);
sal_Int32 nActualRow2 = xRow2->getPropertyValue("Size").get<sal_Int32>();
// Expected was 4000, actual was 4572, i.e. the second row after undo was larger than expected.
- CPPUNIT_ASSERT_DOUBLES_EQUAL(nExpectedRow2, nActualRow2, 1.0);
+ CPPUNIT_ASSERT_EQUAL(nExpectedRow2, nActualRow2);
comphelper::LibreOfficeKit::setActive(false);
}
@@ -918,11 +919,11 @@ void SdTiledRenderingTest::testResizeTableColumn()
auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pObject);
CPPUNIT_ASSERT(pTableObject);
- SdrHdlList handleList(nullptr);
- pObject->AddToHdlList(handleList);
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), handleList.GetHdlCount());
- // Take the top left handle
- SdrHdl* pHdl = handleList.GetHdl(0);
+ // Select the table by marking it + starting and ending text edit.
+ SdrView* pView = pViewShell->GetView();
+ pView->MarkObj(pObject, pView->GetSdrPageView());
+ pView->SdrBeginTextEdit(pObject);
+ pView->SdrEndTextEdit();
// Remember the original cell widths.
xmlDocPtr pXmlDoc = parseXmlDump();
@@ -933,15 +934,16 @@ void SdTiledRenderingTest::testResizeTableColumn()
pXmlDoc = nullptr;
// Resize the left column, decrease its width by 1 cm.
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY()));
- pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(pHdl->GetPos().getX() + 1000), convertMm100ToTwip(pHdl->GetPos().getY()));
+ Point aInnerRowEdge = pObject->GetSnapRect().Center();
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(aInnerRowEdge.getX()), convertMm100ToTwip(aInnerRowEdge.getY()));
+ pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(aInnerRowEdge.getX() - 1000), convertMm100ToTwip(aInnerRowEdge.getY()));
// Remember the resized column widths.
pXmlDoc = parseXmlDump();
sal_Int32 nResizedColumn1 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[1]", "size").toInt32();
CPPUNIT_ASSERT(nResizedColumn1 < nExpectedColumn1);
sal_Int32 nResizedColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32();
- CPPUNIT_ASSERT(nResizedColumn2 < nExpectedColumn2);
+ CPPUNIT_ASSERT(nResizedColumn2 > nExpectedColumn2);
xmlFreeDoc(pXmlDoc);
pXmlDoc = nullptr;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index fa4ea376ae90..3bbf3b4a72ed 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -560,13 +560,10 @@ void SdrMarkView::showMarkHandles()
bool SdrMarkView::ImpIsFrameHandles() const
{
- // There can be multiple mark views, but we're only interested in the one that has a window associated.
- const bool bTiledRendering = comphelper::LibreOfficeKit::isActive() && GetFirstOutputDevice() && GetFirstOutputDevice()->GetOutDevType() == OUTDEV_WINDOW;
-
const size_t nMarkCount=GetMarkedObjectCount();
bool bFrmHdl=nMarkCount>static_cast<size_t>(mnFrameHandlesLimit) || mbForceFrameHandles;
bool bStdDrag=meDragMode==SdrDragMode::Move;
- if (!bTiledRendering && nMarkCount==1 && bStdDrag && bFrmHdl)
+ if (nMarkCount==1 && bStdDrag && bFrmHdl)
{
const SdrObject* pObj=GetMarkedObjectByIndex(0);
if (pObj->GetObjInventor()==SdrInventor::Default)
@@ -648,7 +645,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
bool bSingleTextObjMark=false;
bool bLimitedRotation(false);
- if (!bTiledRendering && nMarkCount==1)
+ if (nMarkCount==1)
{
mpMarkedObj=GetMarkedObjectByIndex(0);
@@ -781,15 +778,33 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
if(SfxViewShell* pViewShell = GetSfxViewShell())
{
-
- long nRotAngle(0);
- if(GetMarkedObjectCount())
+ if (GetMarkedObjectCount())
{
- SdrMark* pM = GetSdrMarkByIndex(0);
- SdrObject* pO = pM->GetMarkedSdrObj();
+ SdrObject* pO = mpMarkedObj;
+ long nRotAngle = pO->GetRotateAngle();
+ // true if we are delaing with a RotGrfFlyFrame
+ // (SwVirtFlyDrawObj with a SwGrfNode)
+ bool bWriterGraphic = pO->HasLimitedRotation();
+
+ if (bWriterGraphic)
+ {
+ nRotAngle *= 10;
+ }
- nRotAngle = pO->GetRotateAngle();
sSelection += OString(", ") + OString::number(nRotAngle);
+
+ OString sProperties;
+
+ if (bWriterGraphic)
+ {
+ sProperties = "{ WriterGraphic=true }";
+ }
+
+ if (!sProperties.isEmpty())
+ {
+ sSelection += ", ";
+ sSelection += sProperties;
+ }
}
if (pOtherShell)
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 9e4794dc7c3a..55ec66b1a116 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -608,6 +608,8 @@
#define FN_UNO_VISIBLE_AREA_WIDTH (FN_EXTRA2 + 125)
#define FN_UNO_VISIBLE_AREA_HEIGHT (FN_EXTRA2 + 126)
+#define FN_UNO_TRANSFORMED_GRAPHIC (FN_EXTRA2 + 125)
+
// Area: Help
// Region: Traveling & Selection
#define FN_CHAR_LEFT (FN_SELECTION + 1 ) /* */
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 731c7a719b49..8e03b0bb9c59 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -161,6 +161,7 @@
#define UNO_NAME_DROP_CAP_CHAR_STYLE_NAME "DropCapCharStyleName"
#define UNO_NAME_FILE_LINK "FileLink"
#define UNO_NAME_GRAPHIC "Graphic"
+#define UNO_NAME_TRANSFORMED_GRAPHIC "TransformedGraphic"
#define UNO_NAME_IS_PROTECTED "IsProtected"
#define UNO_NAME_PARA_KEEP_TOGETHER "ParaKeepTogether"
#define UNO_NAME_KEEP_TOGETHER "KeepTogether"
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index dd73a1d13df2..0b510dd767c9 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -1171,6 +1171,19 @@ sal_uInt16 SwVirtFlyDrawObj::getPossibleRotationFromFraphicFrame(Size& rSize) co
return nRetval;
}
+long SwVirtFlyDrawObj::GetRotateAngle() const
+{
+ if(ContainsSwGrfNode())
+ {
+ Size aSize;
+ return getPossibleRotationFromFraphicFrame(aSize);
+ }
+ else
+ {
+ return SdrVirtObj::GetRotateAngle();
+ }
+}
+
SdrObject* SwVirtFlyDrawObj::getFullDragClone() const
{
// call parent
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index c3acae10198e..5ede9007ec24 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -96,6 +96,7 @@ public:
// we treat the size calculation completely on ourself here
virtual const tools::Rectangle& GetCurrentBoundRect() const override;
virtual const tools::Rectangle& GetLastBoundRect() const override;
+ virtual long GetRotateAngle() const override;
virtual void RecalcBoundRect() override;
virtual void RecalcSnapRect() override;
virtual const tools::Rectangle& GetSnapRect() const override;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 25e1edcf37d5..b9806727394e 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -45,6 +45,7 @@
#include <memory>
#include <utility>
#include <hints.hxx>
+#include <cntfrm.hxx>
#include <doc.hxx>
#include <drawdoc.hxx>
#include <IDocumentUndoRedo.hxx>
@@ -2094,6 +2095,36 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
aAny <<= pGrfNode->GetGrf().GetXGraphic();
}
}
+ else if( FN_UNO_TRANSFORMED_GRAPHIC == pEntry->nWID )
+ {
+ const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ throw uno::RuntimeException();
+
+ SwDoc* pDoc = pFormat->GetDoc();
+ if (pDoc)
+ {
+ const SwEditShell* pEditShell = pDoc->GetEditShell();
+ if (pEditShell)
+ {
+ SwFrame* pCurrFrame = pEditShell->GetCurrFrame(false);
+ GraphicAttr aGraphicAttr;
+ pGrfNode->GetGraphicAttr( aGraphicAttr, pCurrFrame );
+ const GraphicObject aGraphicObj = pGrfNode->GetGrfObj();
+
+ awt::Size aFrameSize = getSize();
+ Size aSize100thmm(aFrameSize.Width, aFrameSize.Height);
+ Size aSize = OutputDevice::LogicToLogic(aSize100thmm, MapMode(MapUnit::Map100thMM), aGraphicObj.GetPrefMapMode());
+ Graphic aGraphic = aGraphicObj.GetTransformedGraphic(aSize, aGraphicObj.GetPrefMapMode(), aGraphicAttr);
+ aAny <<= aGraphic.GetXGraphic();
+ }
+ }
+ }
+ }
else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
{
aAny <<= SwStyleNameMapper::GetProgName(pFormat->DerivedFrom()->GetName(), SwGetPoolIdFromName::FrmFmt );
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 6bb635b0feb2..f5976ca50a4c 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -852,6 +852,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetGraphicPropertyMap(
{ OUString(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER, cppu::UnoType<OUString>::get(), 0, 0 },
{ OUString(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
{ OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_URL, cppu::UnoType<css::uno::Any>::get(), 0, 0 },
+ { OUString(UNO_NAME_TRANSFORMED_GRAPHIC), FN_UNO_TRANSFORMED_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
{ OUString(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, cppu::UnoType<css::awt::Size>::get(), PropertyAttribute::READONLY, CONVERT_TWIPS},
{ OUString(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_CONTOUR_PP, cppu::UnoType<css::drawing::PointSequenceSequence>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 },
More information about the Libreoffice-commits
mailing list