summaryrefslogtreecommitdiff
path: root/sw/source/uibase/frmdlg
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-07-27 21:03:26 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-07-27 21:52:53 +0200
commit383f39493c0ca3e11c296fa37e7d9cf679065f74 (patch)
tree3d7fd82cfa29b64b44b3e3dc0d74e07bb1bf6473 /sw/source/uibase/frmdlg
parentd12f2e9025250a7e310078ff736f8c6756cf894d (diff)
tdf#134610 sw: fix incorrect position of math object from DOCX
Regression from commit a2f85c062aafb3fd9dfb1c6c6e87e1e73e7545a3 (tdf#130362 sw: fix anchoring of inline math objects, 2020-02-04), the problem was that the SwFlyFrameAttrMgr ctor wanted to set the anchor type to at-char, and then later DocumentContentOperationsManager::InsertEmbObject() wanted to undo that for math objects, but this did not play nicely with objects imported from DOCX. So don't set and clear the anchor type, rather set it conditionally in the first place. This allows setting the anchor type in writerfilter/ before insertion, and then all of 1) docx import (depends) 2) insert of Math objects (as-char) 3) insert of images (at-char) are working. Change-Id: I94d82c12f30d069426db1bab70c456cadf1c91ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99559 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase/frmdlg')
-rw-r--r--sw/source/uibase/frmdlg/frmmgr.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index f79d485af3f3..926a949e2f98 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -27,6 +27,8 @@
#include <editeng/shaditem.hxx>
#include <svx/swframevalidation.hxx>
#include <svx/xdef.hxx>
+#include <tools/globname.hxx>
+#include <comphelper/classids.hxx>
#include <fmtclds.hxx>
#include <wrtsh.hxx>
#include <view.hxx>
@@ -59,7 +61,7 @@ static sal_uInt16 aFrameMgrRange[] = {
0};
// determine frame attributes via Shell
-SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType ) :
+SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName ) :
m_aSet( static_cast<SwAttrPool&>(pSh->GetAttrPool()), aFrameMgrRange ),
m_pOwnSh( pSh ),
m_bAbsPos( false ),
@@ -85,7 +87,11 @@ SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nT
if (nType == Frmmgr_Type::GRF || nType == Frmmgr_Type::OLE)
{
- m_aSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_CHAR));
+ if (!pName || *pName != SvGlobalName( SO3_SM_CLASSID ))
+ {
+ // Default anchor for new graphics and objects is at-char, except for Math objects.
+ m_aSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_CHAR));
+ }
}
}
else if ( nType == Frmmgr_Type::NONE )