diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-07-27 21:03:26 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-07-27 21:52:53 +0200 |
commit | 383f39493c0ca3e11c296fa37e7d9cf679065f74 (patch) | |
tree | 3d7fd82cfa29b64b44b3e3dc0d74e07bb1bf6473 | |
parent | d12f2e9025250a7e310078ff736f8c6756cf894d (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
-rw-r--r-- | sw/CppunitTest_sw_uibase_frmdlg.mk | 73 | ||||
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 2 | ||||
-rw-r--r-- | sw/qa/uibase/frmdlg/data/wrapped-math-object.docx | bin | 0 -> 20504 bytes | |||
-rw-r--r-- | sw/qa/uibase/frmdlg/frmdlg.cxx | 51 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/draw/dflyobj.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/appenv.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/frmmgr.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/inc/frmmgr.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/grfsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 |
17 files changed, 162 insertions, 29 deletions
diff --git a/sw/CppunitTest_sw_uibase_frmdlg.mk b/sw/CppunitTest_sw_uibase_frmdlg.mk new file mode 100644 index 000000000000..5c2b8b7283b7 --- /dev/null +++ b/sw/CppunitTest_sw_uibase_frmdlg.mk @@ -0,0 +1,73 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sw_uibase_frmdlg)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_uibase_frmdlg)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sw_uibase_frmdlg, \ + sw/qa/uibase/frmdlg/frmdlg \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sw_uibase_frmdlg, \ + comphelper \ + cppu \ + cppuhelper \ + editeng \ + sal \ + sfx \ + svl \ + svx \ + svxcore \ + sw \ + test \ + unotest \ + utl \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sw_uibase_frmdlg,\ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sw_uibase_frmdlg,\ + -I$(SRCDIR)/sw/inc \ + -I$(SRCDIR)/sw/source/core/inc \ + -I$(SRCDIR)/sw/source/uibase/inc \ + -I$(SRCDIR)/sw/qa/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sw_uibase_frmdlg,\ + udkapi \ + offapi \ + oovbaapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sw_uibase_frmdlg)) +$(eval $(call gb_CppunitTest_use_vcl,sw_uibase_frmdlg)) + +$(eval $(call gb_CppunitTest_use_rdb,sw_uibase_frmdlg,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_uibase_frmdlg,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sw_uibase_frmdlg)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,sw_uibase_frmdlg, \ + modules/swriter \ +)) + +$(eval $(call gb_CppunitTest_use_more_fonts,sw_uibase_frmdlg)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 731dc4ef7ca6..1dd4f34cc61f 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -110,6 +110,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_core_doc \ CppunitTest_sw_uibase_shells \ CppunitTest_sw_uibase_dochdl \ + CppunitTest_sw_uibase_frmdlg \ CppunitTest_sw_core_accessibilitycheck \ CppunitTest_sw_core_layout \ CppunitTest_sw_core_frmedt \ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 45361b4762d9..7d873c558e2c 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -4400,7 +4400,7 @@ void SwUiWriterTest::testTdf88986() // Create the item set that is normally passed to the insert frame dialog. SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT); + SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr); SfxItemSet aSet = aShell.CreateInsertFrameItemSet(aMgr); // This was missing along with the gradient and other tables. diff --git a/sw/qa/uibase/frmdlg/data/wrapped-math-object.docx b/sw/qa/uibase/frmdlg/data/wrapped-math-object.docx Binary files differnew file mode 100644 index 000000000000..c6f76dd5d77e --- /dev/null +++ b/sw/qa/uibase/frmdlg/data/wrapped-math-object.docx diff --git a/sw/qa/uibase/frmdlg/frmdlg.cxx b/sw/qa/uibase/frmdlg/frmdlg.cxx new file mode 100644 index 000000000000..3700abb9d946 --- /dev/null +++ b/sw/qa/uibase/frmdlg/frmdlg.cxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <com/sun/star/text/TextContentAnchorType.hpp> + +char const DATA_DIRECTORY[] = "/sw/qa/uibase/frmdlg/data/"; + +/// Covers sw/source/uibase/frmdlg/ fixes. +class SwUibaseFrmdlgTest : public SwModelTestBase +{ +public: + void createDoc(const char* pName = nullptr); +}; + +void SwUibaseFrmdlgTest::createDoc(const char* pName) +{ + if (!pName) + { + loadURL("private:factory/swriter", nullptr); + } + else + { + load(DATA_DIRECTORY, pName); + } +} + +CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testWrappedMathObject) +{ + // The document includes a Math object with explicit wrapping. + createDoc("wrapped-math-object.docx"); + uno::Reference<drawing::XShape> xMath = getShape(1); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4 (AT_CHARACTER) + // - Actual : 1 (AS_CHARACTER) + // i.e. the object lost its wrapping, leading to an incorrect position. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 7c651d0cb26d..a8c427678c2d 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2913,12 +2913,6 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsertEmbObject( if (SotExchange::IsMath(aClassName)) { nId = RES_POOLFRM_FORMEL; - if (pFlyAttrSet && pFlyAttrSet->HasItem(RES_ANCHOR)) - { - // Clear the at-char anchor set in the SwFlyFrameAttrMgr ctor, so the as-char one - // set later in pFrameFormat is considered. - pFlyAttrSet->ClearItem(RES_ANCHOR); - } } } diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 756ea9e33fdf..f794887fee77 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -397,7 +397,7 @@ void SwVirtFlyDrawObj::Rotate(const Point& rRef, long nAngle, double sn, double // RotGrfFlyFrame: Add transformation to placeholder object Size aSize; const sal_uInt16 nOldRot(SwVirtFlyDrawObj::getPossibleRotationFromFraphicFrame(aSize)); - SwFlyFrameAttrMgr aMgr(false, pShForAngle, Frmmgr_Type::NONE); + SwFlyFrameAttrMgr aMgr(false, pShForAngle, Frmmgr_Type::NONE, nullptr); aMgr.SetRotation(nOldRot, (nOldRot + static_cast<sal_uInt16>(nAngle)) % 3600, aSize); } diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index 31123923b991..b1304a882b87 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -395,7 +395,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) pSh->ChgCurPageDesc(*pDesc); // Insert Frame - SwFlyFrameAttrMgr aMgr(false, pSh, Frmmgr_Type::ENVELP); + SwFlyFrameAttrMgr aMgr(false, pSh, Frmmgr_Type::ENVELP, nullptr); SwFieldMgr aFieldMgr; aMgr.SetHeightSizeType(SwFrameSize::Variable); 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 ) diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx index 61267e5af077..8cd1ee303a06 100644 --- a/sw/source/uibase/inc/frmmgr.hxx +++ b/sw/source/uibase/inc/frmmgr.hxx @@ -33,6 +33,7 @@ struct SvxSwFrameValidation; struct SwPosition; class SwFormatCol; +class SvGlobalName; const SwTwips DFLT_WIDTH = MM50 * 4; const SwTwips DFLT_HEIGHT = MM50; @@ -67,7 +68,7 @@ class SW_DLLPUBLIC SwFlyFrameAttrMgr SAL_DLLPRIVATE void UpdateFlyFrame_(); // post-treatment after insert or update public: - SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType ); + SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName ); //CopyCtor for dialogs to check the metrics SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet ); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 34b42f64351a..7b91c5c8aee8 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1278,7 +1278,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) else if ( rSh.IsFrameSelected() ) { // Set border attributes via Frame-Manager. - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); aMgr.SetAttrSet( *pArgs ); aMgr.UpdateFlyFrame(); } @@ -1310,7 +1310,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) else if ( rSh.IsFrameSelected() ) { // Set border attributes via Frame-Manager. - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); aMgr.SetAttrSet(*pArgs); aMgr.UpdateFlyFrame(); } @@ -1507,7 +1507,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) } else if( rSh.IsFrameSelected() ) { - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); aSet.Put( aMgr.GetAttrSet() ); } else @@ -2479,7 +2479,7 @@ void SwBaseShell::GetBorderState(SfxItemSet &rSet) } else if ( rSh.IsFrameSelected() ) { - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); rSet.Put( aMgr.GetAttrSet() ); bPrepare = false; } @@ -2574,7 +2574,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) else if ( rSh.IsFrameSelected() ) { // Set border attributes via Frame-Manager - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); aSet.Put( aMgr.GetAttrSet() ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 5d69014e0af2..08b6ff047234 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -276,7 +276,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) return; } - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); bool bUpdateMgr = true; bool bCopyToFormat = false; switch ( nSlot ) @@ -749,7 +749,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) bProtect |= bParentCntProt; const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true); - SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE ); + SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr ); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index f8a8dd844d79..3287de6cb653 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -251,7 +251,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) case FN_DRAW_WRAP_DLG: { SwFlyFrameAttrMgr aMgr( false, &rSh, rSh.IsFrameSelected() ? - Frmmgr_Type::NONE : Frmmgr_Type::GRF); + Frmmgr_Type::NONE : Frmmgr_Type::GRF, nullptr); const SwViewOption* pVOpt = rSh.GetViewOptions(); SwViewOption aUsrPref( *pVOpt ); @@ -932,7 +932,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest const &rReq) SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} ); rShell.GetCurAttr( aSet ); const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION); - SwFlyFrameAttrMgr aMgr(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF); + SwFlyFrameAttrMgr aMgr(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF, nullptr); // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET) diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index f2e3fd0b6cc3..85831dc92488 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -403,7 +403,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) Size aSize(16 * MM50, 8 * MM50); GetShell().LockPaint(); GetShell().StartAllAction(); - SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT ); + SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT, nullptr ); if(nCols > 1) { SwFormatCol aCol; @@ -434,7 +434,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) } // Create new border - SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT ); + SwFlyFrameAttrMgr aMgr( true, GetShellPtr(), Frmmgr_Type::TEXT, nullptr ); if(pArgs) { Size aSize(aMgr.GetSize()); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index ea7e5f60d044..2768719cc696 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -245,7 +245,7 @@ ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, } } - SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF ); + SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF, nullptr ); SwWrtShell& rShell = GetWrtShell(); // #i123922# determine if we really want to insert or replace the graphic at a selected object @@ -1968,7 +1968,7 @@ void SwView::InsFrameMode(sal_uInt16 nCols) { if ( m_pWrtShell->HasWholeTabSelection() ) { - SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT ); + SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT, nullptr ); const SwFrameFormat &rPageFormat = m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster(); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index a0fb6e1d12f4..444db135021d 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -287,7 +287,7 @@ void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter, if ( !pFrameMgr ) { bOwnMgr = true; - pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF ); + pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF, nullptr ); // CAUTION // GetAttrSet makes an adjustment @@ -523,7 +523,14 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame EnterSelFrameMode(); - SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE ); + const SvGlobalName* pName = nullptr; + SvGlobalName aObjClsId; + if (xRef.is()) + { + aObjClsId = SvGlobalName(xRef.GetObject()->getClassID()); + pName = &aObjClsId; + } + SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE, pName ); aFrameMgr.SetHeightSizeType(SwFrameSize::Fixed); SwRect aBound; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 16f9e279a7fb..d3eaa4cb093d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2319,11 +2319,11 @@ void DomainMapper_Impl::appendStarMath( const Value& val ) uno::makeAny( sal_Int32(size.Width()))); xStarMathProperties->setPropertyValue(getPropertyName( PROP_HEIGHT ), uno::makeAny( sal_Int32(size.Height()))); + xStarMathProperties->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), + uno::makeAny(text::TextContentAnchorType_AS_CHARACTER)); // mimic the treatment of graphics here... it seems anchoring as character // gives a better ( visually ) result appendTextContent(xStarMath, uno::Sequence<beans::PropertyValue>()); - xStarMathProperties->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), - uno::makeAny(text::TextContentAnchorType_AS_CHARACTER)); } catch( const uno::Exception& ) { |