summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-01 17:13:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-01 20:42:57 +0100
commit9e269ef68e33fc9da154f6694be7cbcd5e3b4bfc (patch)
tree7dfc1b63ef9261c0deab47c3d6bc74a585ea20f5
parent4b27e96cb05ba9fa4d89d8727466db3eb7ef15a6 (diff)
ofz#4817 Bad-cast
Change-Id: I5dc9c66ce17f6401fbc9683cf8b10bf62755a166 Reviewed-on: https://gerrit.libreoffice.org/47236 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/html/htmlsect.cxx2
-rw-r--r--sw/source/filter/html/htmltab.cxx32
-rw-r--r--sw/source/filter/html/swhtml.hxx2
3 files changed, 33 insertions, 3 deletions
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