[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Mon Jan 1 19:43:23 UTC 2018
sw/source/filter/html/htmlsect.cxx | 2 +-
sw/source/filter/html/htmltab.cxx | 32 +++++++++++++++++++++++++++++++-
sw/source/filter/html/swhtml.hxx | 2 +-
3 files changed, 33 insertions(+), 3 deletions(-)
New commits:
commit 9e269ef68e33fc9da154f6694be7cbcd5e3b4bfc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jan 1 17:13:50 2018 +0000
ofz#4817 Bad-cast
Change-Id: I5dc9c66ce17f6401fbc9683cf8b10bf62755a166
Reviewed-on: https://gerrit.libreoffice.org/47236
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index e5c2cf1268f8..0b2facf82e62 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -195,7 +195,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
static_cast<const SwStartNode *>( &rContentStIdx.GetNode() );
aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex() - 1;
- if (!PendingTableInPaM(aDelPam))
+ if (!PendingObjectsInPaM(aDelPam))
m_xDoc->getIDocumentContentOperations().DelFullPara(aDelPam);
// update page style
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index d05d3a1fe6e6..d138e66612db 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -610,6 +610,8 @@ public:
void IncBoxCount() { m_nBoxes++; }
bool IsOverflowing() const { return m_nBoxes > 64000; }
+
+ bool PendingDrawObjectsInPaM(SwPaM& rPam) const;
};
void HTMLTableCnts::InitCtor()
@@ -5277,11 +5279,39 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
return xRetTable;
}
-bool SwHTMLParser::PendingTableInPaM(SwPaM& rPam) const
+bool HTMLTable::PendingDrawObjectsInPaM(SwPaM& rPam) const
+{
+ if (!m_pResizeDrawObjects)
+ return false;
+
+ bool bRet = false;
+
+ sal_uInt16 nCount = m_pResizeDrawObjects->size();
+ for (sal_uInt16 i = 0; i < nCount && !bRet; ++i)
+ {
+ SdrObject *pObj = (*m_pResizeDrawObjects)[i];
+ SwFrameFormat* pObjectFormat = ::FindFrameFormat(pObj);
+ if (!pObjectFormat)
+ continue;
+ const SwFormatAnchor& rAnch = pObjectFormat->GetAnchor();
+ if (const SwPosition* pPos = rAnch.GetContentAnchor())
+ {
+ SwNodeIndex aObjNodeIndex(pPos->nNode);
+ bRet = (aObjNodeIndex >= rPam.Start()->nNode && aObjNodeIndex <= rPam.End()->nNode);
+ }
+ }
+
+ return bRet;
+}
+
+bool SwHTMLParser::PendingObjectsInPaM(SwPaM& rPam) const
{
bool bRet = false;
for (const auto& a : m_aTables)
{
+ bRet = a->PendingDrawObjectsInPaM(rPam);
+ if (bRet)
+ break;
const SwTable *pTable = a->GetSwTable();
if (!pTable)
continue;
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 24996cf2d340..8d6130d6c70c 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -870,7 +870,7 @@ private:
bool HasCurrentParaFlys( bool bNoSurroundOnly = false,
bool bSurroundOnly = false ) const;
- bool PendingTableInPaM(SwPaM& rPam) const;
+ bool PendingObjectsInPaM(SwPaM& rPam) const;
public: // used in tables
More information about the Libreoffice-commits
mailing list