diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-04-04 09:34:36 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-04-05 05:49:10 +0000 |
commit | c64235f4928754120a6a0817a1368b7abc924f8d (patch) | |
tree | d05872a1f90f74be68c9345b709cf5857f37cee8 | |
parent | 3e242e732e0aba170870098e4ce51d49f979eab9 (diff) |
hold bullet para by reference
(cherry picked from commit c9a04aed449c3cf992224cfedcee7f330357b01a)
Change-Id: I58025ea906426a7db4079042fa38954f1a3d076b
Reviewed-on: https://gerrit.libreoffice.org/23799
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | lotuswordpro/qa/cppunit/data/fail/reference-1.lwp | bin | 0 -> 17632 bytes | |||
-rw-r--r-- | lotuswordpro/source/filter/lwpsilverbullet.cxx | 24 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpsilverbullet.hxx | 4 |
3 files changed, 12 insertions, 16 deletions
diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp Binary files differnew file mode 100644 index 000000000000..d8141ae6dbaa --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx index e7ad33f3d3af..eb7c04af12f9 100644 --- a/lotuswordpro/source/filter/lwpsilverbullet.cxx +++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx @@ -76,16 +76,12 @@ LwpSilverBullet::LwpSilverBullet(LwpObjectHeader& objHdr, LwpSvStream* pStrm) , m_nFlags(0) , m_nUseCount(0) , m_pAtomHolder(new LwpAtomHolder) - , m_pBulletPara(NULL) { } LwpSilverBullet::~LwpSilverBullet() { - if (m_pAtomHolder) - { - delete m_pAtomHolder; - } + delete m_pAtomHolder; } void LwpSilverBullet::Read() @@ -129,7 +125,7 @@ void LwpSilverBullet::RegisterStyle() { ParaNumbering aParaNumbering; //get numbering format according to the position. - m_pBulletPara->GetParaNumber(nPos, &aParaNumbering); + m_xBulletPara->GetParaNumber(nPos, &aParaNumbering); LwpFribParaNumber* pParaNumber = aParaNumbering.pParaNumber; if (pParaNumber) { @@ -205,7 +201,7 @@ OUString LwpSilverBullet::GetBulletFontName() LwpFontManager& rFontMgr = m_pFoundry->GetFontManger(); - sal_uInt32 nBulletFontID = m_pBulletPara->GetBulletFontID(); + sal_uInt32 nBulletFontID = m_xBulletPara->GetBulletFontID(); sal_uInt16 nFinalFont = static_cast<sal_uInt16>((nBulletFontID >> 16) & 0xFFFF); //final fontid is valid? @@ -226,7 +222,7 @@ OUString LwpSilverBullet::GetBulletFontName() */ UChar32 LwpSilverBullet::GetBulletChar() { - OUString aBulletChar = m_pBulletPara->GetBulletChar(); + OUString aBulletChar = m_xBulletPara->GetBulletChar(); return aBulletChar.toChar(); } @@ -236,7 +232,7 @@ UChar32 LwpSilverBullet::GetBulletChar() */ LwpPara* LwpSilverBullet::GetBulletPara() { - if (!m_pBulletPara) + if (!m_xBulletPara.is()) { LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY).get()); if (!pStory) @@ -244,10 +240,10 @@ LwpPara* LwpSilverBullet::GetBulletPara() return NULL; } - m_pBulletPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj(VO_PARA).get()); + m_xBulletPara.set(dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj(VO_PARA).get())); } - return m_pBulletPara; + return m_xBulletPara.get(); } /** @@ -328,10 +324,10 @@ OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumber) */ bool LwpSilverBullet::IsBulletOrdered() { - if (!m_pBulletPara) + if (!m_xBulletPara.is()) return false; - LwpFribPtr& rFribs = m_pBulletPara->GetFribs(); + LwpFribPtr& rFribs = m_xBulletPara->GetFribs(); return (rFribs.HasFrib(FRIB_TAG_PARANUMBER) != NULL); } @@ -374,7 +370,7 @@ OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos) bool bDivisionName = false; bool bSectionName = false; - LwpFrib* pParaFrib = m_pBulletPara->GetFribs().GetFribs(); + LwpFrib* pParaFrib = m_xBulletPara->GetFribs().GetFribs(); if (!pParaFrib) { return aEmpty; diff --git a/lotuswordpro/source/filter/lwpsilverbullet.hxx b/lotuswordpro/source/filter/lwpsilverbullet.hxx index c56f35e1c25a..c8fbcdef1e20 100644 --- a/lotuswordpro/source/filter/lwpsilverbullet.hxx +++ b/lotuswordpro/source/filter/lwpsilverbullet.hxx @@ -142,7 +142,7 @@ private: sal_uInt32 m_nUseCount; LwpAtomHolder* m_pAtomHolder; - LwpPara* m_pBulletPara; + rtl::Reference<LwpPara> m_xBulletPara; OUString m_strStyleName; sal_uInt16 m_pHideLevels[10]; @@ -167,7 +167,7 @@ inline OUString LwpSilverBullet::GetNumberingName() } inline LwpPara* LwpSilverBullet::GetNumberingPara() { - return m_pBulletPara; + return m_xBulletPara.get(); } inline bool LwpSilverBullet::IsPosCumulative(sal_uInt16 nHideLevels) { |