sc/source/filter/xcl97/xcl97rec.cxx | 42 +++++++++++++++++------------------- sw/source/uibase/app/docst.cxx | 15 ++++++++++-- 2 files changed, 32 insertions(+), 25 deletions(-)
New commits: commit ccd89a02f8b5f0e7c542353c5bf0a774dbf781d2 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Dec 14 11:21:56 2020 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Dec 14 20:17:00 2020 +0100 tdf#122045 using 'Apply' doesn't keep document modified on later 'Cancel' Change-Id: I7c6232747785a0c5827fe7344e1dc20758419956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107632 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index b19c7df81ddd..1f12447c90ee 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -554,6 +554,12 @@ public: ApplyHdl(nullptr); } VclPtr<SfxAbstractApplyTabDialog> m_pDlg; + // true if the document was initially modified before ApplyStyle was created + // or if ApplyStyle:::apply was called + bool DocIsModified() const + { + return m_bModified; + } private: SwDocShell &m_rDocSh; bool m_bNew; @@ -631,6 +637,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) if( !m_bModified ) { pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + m_bModified = true; } pWrtShell->EndAllAction(); @@ -903,7 +910,7 @@ void SwDocShell::Edit( && pStyle->IsUsed() && !pStyle->IsUserDefined(); - pDlg->StartExecuteAsync([bIsDefaultPage, bModified, bNew, nFamily, nSlot, nNewStyleUndoId, pApplyStyleHelper, pRequest, xTmp, this](sal_Int32 nResult){ + pDlg->StartExecuteAsync([bIsDefaultPage, bNew, nFamily, nSlot, nNewStyleUndoId, pApplyStyleHelper, pRequest, xTmp, this](sal_Int32 nResult){ if (RET_OK == nResult) pApplyStyleHelper->apply(); @@ -960,6 +967,8 @@ void SwDocShell::Edit( m_pWrtShell->EndUndo(nNewStyleUndoId, &aRewriter); } + bool bDocModified = pApplyStyleHelper->DocIsModified(); + if (RET_OK != nResult) { if (bNew) @@ -968,7 +977,7 @@ void SwDocShell::Edit( m_xDoc->GetIDocumentUndoRedo().ClearRedo(); } - if (!bModified) + if (!bDocModified) m_xDoc->getIDocumentState().ResetModified(); } @@ -984,7 +993,7 @@ void SwDocShell::Edit( if (pRequest) pRequest->Done(); - if (bIsDefaultPage && bModified) + if (bIsDefaultPage && bDocModified) { uno::Reference< style::XStyleFamiliesSupplier > xStyleFamSupp(GetModel(), uno::UNO_QUERY); commit 9b45511356712bc1c6b806499c344cb41dde9fd3 Author: Szabolcs Toth <[email protected]> AuthorDate: Sat Dec 12 10:33:20 2020 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Dec 14 20:16:49 2020 +0100 refactor for xlsx shape export Just a refactor, fewer lines, less computing capacity. And also get rid of nullptr reference. Change-Id: I3c3446c2917e9b5d2f205dd5c0110821ecf11f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107613 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107630 Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index ed4dbf5da31e..1fde9272f3f5 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,35 +1100,33 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft = rShape->getPosition(); awt::Size aSize = rShape->getSize(); - // size is correct, but aTopLeft needs correction for rotated shapes + // There are a few cases where we must adjust these values SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); - sal_Int32 nRotation = pObj->GetRotateAngle(); - if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) + if (pObj) { - const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape - aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); - aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); - } - - uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xShapeProperties->getPropertySetInfo(); - if (xPropertySetInfo->hasPropertyByName("RotateAngle")) - { - uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); - sal_Int32 nRot = nRotProp.get<sal_Int32>(); - - if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) + sal_Int32 nRotation = pObj->GetRotateAngle(); + if (nRotation != 0) { + sal_Int16 nHalfWidth = aSize.Width / 2; + sal_Int16 nHalfHeight = aSize.Height / 2; + // aTopLeft needs correction for rotated customshapes + if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) + { + const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape + aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; + aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; + } + // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. + if ((nRotation >= 45 * 100 && nRotation < 135 * 100) || (nRotation >= 225 * 100 && nRotation < 315 * 100)) + { + aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; + aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; - sal_Int16 nHalfWidth = aSize.Width / 2; - sal_Int16 nHalfHeight = aSize.Height / 2; - aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; - aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; - - std::swap(aSize.Width, aSize.Height); + std::swap(aSize.Width, aSize.Height); + } } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
