summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-10-23 10:58:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-10-23 13:18:01 +0200
commitfbb5ab3e0ecb862fa5c48ef4640859c4aeb77984 (patch)
tree7c5a4300427ce5b2da5ba50d5e528abbcccd45d6 /sw
parent2fb74f6e155322ca25edc3b0b59d0d1347903195 (diff)
tdf#156525 Save as > HTML loses drawing object as invalid gif
This patch is specifically for the 7-6 branch, other changes meant that master received a simpler fix. This reverts the following patches commit f22c23e71d4ae628e9e90ee98d22d1fc8fca1619 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Aug 2 15:26:06 2023 +0200 tdf#156525 Save as > HTML loses drawing object as invalid gif commit 04f02cfecfae481f256b6c98a1940fc5235a921a Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed May 10 14:06:49 2023 +0200 AlphaMask::BlendWith wants an AlphaMask parameter commit 8270eb5d5600cc84dbf5f0e339f90c4519ef88bb Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Fri May 19 13:35:31 2023 +0200 loplugin:unusedmethods Change-Id: I2146557b6401079061474d5d83082f75d6f1974f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158340 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/ndarr.hxx4
-rw-r--r--sw/inc/ndtxt.hxx4
-rw-r--r--sw/source/core/draw/dflyobj.cxx6
-rw-r--r--sw/source/core/graphic/ndgrf.cxx8
-rw-r--r--sw/source/core/inc/dflyobj.hxx1
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx27
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx11
-rw-r--r--sw/source/filter/ww8/writerhelper.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx39
10 files changed, 104 insertions, 0 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 7afe8d2bce46..b7fd0bb2e078 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -223,6 +223,10 @@ public:
SwGrfFormatColl *pColl,
SwAttrSet const * pAutoAttr = nullptr ); ///< in ndgrf.cxx
+ static SwGrfNode *MakeGrfNode( SwNode & rWhere,
+ const GraphicObject& rGrfObj,
+ SwGrfFormatColl *pColl ); ///< in ndgrf.cxx
+
SwOLENode *MakeOLENode( SwNode& rWhere,
const svt::EmbeddedObjectRef&,
SwGrfFormatColl *pColl ); ///< in ndole.cxx
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 3f99919f77b2..c16a643ec76c 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -540,6 +540,10 @@ public:
SwTwips GetAdditionalIndentForStartingNewList() const;
+ void ClearLRSpaceItemDueToListLevelIndents(
+ std::unique_ptr<SvxFirstLineIndentItem>& o_rFirstLineItem,
+ std::unique_ptr<SvxTextLeftMarginItem>& o_rTextLeftMarginItem) const;
+
/** return left margin for tab stop position calculation
Needed for text formatting
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index b7001277b2c0..31a193a45119 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -130,6 +130,12 @@ SwFlyDrawObj::SwFlyDrawObj(SdrModel& rSdrModel)
{
}
+SwFlyDrawObj::SwFlyDrawObj(SdrModel& rSdrModel, SwFlyDrawObj const& rSource)
+ : SdrObject(rSdrModel, rSource)
+ , mbIsTextBox(false)
+{
+}
+
SwFlyDrawObj::~SwFlyDrawObj()
{
}
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 5d7d60052926..e96c7557ba69 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -421,6 +421,14 @@ SwGrfNode * SwNodes::MakeGrfNode( SwNode & rWhere,
return pNode;
}
+SwGrfNode * SwNodes::MakeGrfNode( SwNode & rWhere,
+ const GraphicObject& rGrfObj,
+ SwGrfFormatColl* pGrfColl )
+{
+ OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer is 0." );
+ return new SwGrfNode( rWhere, rGrfObj, pGrfColl, nullptr );
+}
+
Size SwGrfNode::GetTwipSize() const
{
if( !mnGrfSize.Width() && !mnGrfSize.Height() )
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 701d63328923..fe43f24c9045 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -46,6 +46,7 @@ private:
public:
SwFlyDrawObj(SdrModel& rSdrModel);
+ SwFlyDrawObj(SdrModel& rSdrModel, SwFlyDrawObj const& rSource);
// for instantiation of this class while loading (via factory
virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8eea1b74f11e..b5cc61b13f2b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3426,6 +3426,33 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
return nAdditionalIndent;
}
+// #i96772#
+void SwTextNode::ClearLRSpaceItemDueToListLevelIndents(
+ std::unique_ptr<SvxFirstLineIndentItem>& o_rFirstLineItem,
+ std::unique_ptr<SvxTextLeftMarginItem>& o_rTextLeftMarginItem) const
+{
+ ::sw::ListLevelIndents const result(AreListLevelIndentsApplicable());
+ if (result != ::sw::ListLevelIndents::No)
+ {
+ const SwNumRule* pRule = GetNumRule();
+ if ( pRule && GetActualListLevel() >= 0 )
+ {
+ const SwNumFormat& rFormat = pRule->Get(lcl_BoundListLevel(GetActualListLevel()));
+ if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ if (result & ::sw::ListLevelIndents::FirstLine)
+ {
+ o_rFirstLineItem = std::make_unique<SvxFirstLineIndentItem>(RES_MARGIN_FIRSTLINE);
+ }
+ if (result & ::sw::ListLevelIndents::LeftMargin)
+ {
+ o_rTextLeftMarginItem = std::make_unique<SvxTextLeftMarginItem>(RES_MARGIN_TEXTLEFT);
+ }
+ }
+ }
+ }
+}
+
// #i91133#
tools::Long SwTextNode::GetLeftMarginForTabCalculation() const
{
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 528859565667..5a45a6dbb04b 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -404,6 +404,17 @@ namespace sw
// DeduplicateItems(rItems);
}
+ void DeduplicateItems(ww8::PoolItems & rItems)
+ {
+ if (rItems.find(RES_CHRATR_WEIGHT) != rItems.end()
+ && rItems.find(RES_CHRATR_CJK_WEIGHT) != rItems.end())
+ {
+ // avoid duplicate w:b element (DOC and DOCX map Western and
+ // CJK the same - inconsistently RTF maps CJK and CTL the same?)
+ rItems.erase(rItems.find(RES_CHRATR_CJK_WEIGHT));
+ }
+ }
+
const SfxPoolItem *SearchPoolItems(const ww8::PoolItems &rItems,
sal_uInt16 eType)
{
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index 632d1cb3a639..27442fceb0b9 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -317,6 +317,8 @@ namespace sw
*/
void GetPoolItems(const SfxItemSet &rSet, ww8::PoolItems &rItems, bool bExportParentItemSet );
+ void DeduplicateItems(ww8::PoolItems &rItems);
+
const SfxPoolItem *SearchPoolItems(const ww8::PoolItems &rItems,
sal_uInt16 eType);
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 6c1e6c74d954..9bbefdab98b6 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1916,6 +1916,8 @@ public: // really private, but can only be done public
short ImportSprm(const sal_uInt8* pPos, sal_Int32 nMemLen, sal_uInt16 nId = 0);
bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) const;
+ /// Seek to the end of the table with pPap, returns true on success.
+ bool SearchTableEnd(WW8PLCFx_Cp_FKP* pPap) const;
const WW8Fib& GetFib() const { return *m_xWwFib; }
SwDoc& GetDoc() const { return m_rDoc; }
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 71fd71997eac..26b6ee1f8de6 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -388,6 +388,45 @@ bool SwWW8ImplReader::SearchRowEnd(WW8PLCFx_Cp_FKP* pPap, WW8_CP &rStartCp,
return false;
}
+bool SwWW8ImplReader::SearchTableEnd(WW8PLCFx_Cp_FKP* pPap) const
+{
+ if (m_bVer67)
+ // The below SPRM is for WW8 only.
+ return false;
+
+ WW8PLCFxDesc aRes;
+ aRes.pMemPos = nullptr;
+ aRes.nEndPos = pPap->Where();
+ std::set<std::pair<WW8_CP, WW8_CP>> aPrevRes;
+
+ while (pPap->HasFkp() && pPap->Where() != WW8_CP_MAX)
+ {
+ // See if the current pap is outside the table.
+ SprmResult aSprmRes = pPap->HasSprm(NS_sprm::PFInTable::val);
+ const sal_uInt8* pB = aSprmRes.pSprm;
+ if (!pB || aSprmRes.nRemainingData < 1 || *pB != 1)
+ // Yes, this is the position after the end of the table.
+ return true;
+
+ // It is, so seek to the next pap.
+ aRes.nStartPos = aRes.nEndPos;
+ aRes.pMemPos = nullptr;
+ if (!pPap->SeekPos(aRes.nStartPos))
+ return false;
+
+ // Read the sprms and make sure we moved forward to avoid infinite loops.
+ pPap->GetSprms(&aRes);
+ auto aBounds(std::make_pair(aRes.nStartPos, aRes.nEndPos));
+ if (!aPrevRes.insert(aBounds).second) //already seen these bounds, infinite loop
+ {
+ SAL_WARN("sw.ww8", "SearchTableEnd, loop in paragraph property chain");
+ break;
+ }
+ }
+
+ return false;
+}
+
ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
const WW8_TablePos *pTabPos)
{