[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.4' - 23 commits - configure.ac lotuswordpro/qa lotuswordpro/source
Andras Timar
andras.timar at collabora.com
Wed Mar 2 06:19:43 UTC 2016
configure.ac | 2
lotuswordpro/qa/cppunit/test_lotuswordpro.cxx | 4
lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 12
lotuswordpro/source/filter/bencont.cxx | 10
lotuswordpro/source/filter/bento.hxx | 7
lotuswordpro/source/filter/benval.cxx | 2
lotuswordpro/source/filter/explode.hxx | 2
lotuswordpro/source/filter/genericfilter.cxx | 2
lotuswordpro/source/filter/lwp9reader.cxx | 2
lotuswordpro/source/filter/lwpbackgroundoverride.hxx | 2
lotuswordpro/source/filter/lwpbackgroundstuff.cxx | 25
lotuswordpro/source/filter/lwpbackgroundstuff.hxx | 2
lotuswordpro/source/filter/lwpbreaksoverride.hxx | 2
lotuswordpro/source/filter/lwpbulletstylemgr.cxx | 4
lotuswordpro/source/filter/lwpcelllayout.cxx | 34
lotuswordpro/source/filter/lwpcelllayout.hxx | 10
lotuswordpro/source/filter/lwpcharborderoverride.hxx | 2
lotuswordpro/source/filter/lwpcharsetmgr.cxx | 5
lotuswordpro/source/filter/lwpcharsetmgr.hxx | 6
lotuswordpro/source/filter/lwpcontent.cxx | 20
lotuswordpro/source/filter/lwpcontent.hxx | 2
lotuswordpro/source/filter/lwpdivinfo.cxx | 4
lotuswordpro/source/filter/lwpdivinfo.hxx | 4
lotuswordpro/source/filter/lwpdivopts.hxx | 2
lotuswordpro/source/filter/lwpdllist.cxx | 4
lotuswordpro/source/filter/lwpdllist.hxx | 12
lotuswordpro/source/filter/lwpdoc.cxx | 82 +-
lotuswordpro/source/filter/lwpdoc.hxx | 25
lotuswordpro/source/filter/lwpdocdata.hxx | 4
lotuswordpro/source/filter/lwpdrawobj.cxx | 38 -
lotuswordpro/source/filter/lwpdrawobj.hxx | 6
lotuswordpro/source/filter/lwpfilehdr.cxx | 12
lotuswordpro/source/filter/lwpfilter.cxx | 2
lotuswordpro/source/filter/lwpfnlayout.cxx | 12
lotuswordpro/source/filter/lwpfont.hxx | 4
lotuswordpro/source/filter/lwpfootnote.cxx | 6
lotuswordpro/source/filter/lwpfoundry.cxx | 44 -
lotuswordpro/source/filter/lwpfoundry.hxx | 7
lotuswordpro/source/filter/lwpframelayout.cxx | 110 +--
lotuswordpro/source/filter/lwpfrib.cxx | 14
lotuswordpro/source/filter/lwpfribbreaks.cxx | 9
lotuswordpro/source/filter/lwpfribframe.cxx | 6
lotuswordpro/source/filter/lwpfribmark.cxx | 6
lotuswordpro/source/filter/lwpfribmark.hxx | 2
lotuswordpro/source/filter/lwpfribptr.cxx | 9
lotuswordpro/source/filter/lwpfribptr.hxx | 2
lotuswordpro/source/filter/lwpfribsection.cxx | 84 +-
lotuswordpro/source/filter/lwpfribtable.cxx | 22
lotuswordpro/source/filter/lwpfribtable.hxx | 2
lotuswordpro/source/filter/lwpfribtext.cxx | 4
lotuswordpro/source/filter/lwpgrfobj.cxx | 22
lotuswordpro/source/filter/lwpgrfobj.hxx | 2
lotuswordpro/source/filter/lwpheader.hxx | 3
lotuswordpro/source/filter/lwplayout.cxx | 489 ++++++++------
lotuswordpro/source/filter/lwplayout.hxx | 167 +++-
lotuswordpro/source/filter/lwplaypiece.hxx | 2
lotuswordpro/source/filter/lwpmarker.cxx | 8
lotuswordpro/source/filter/lwpnotes.cxx | 8
lotuswordpro/source/filter/lwpnumberingoverride.hxx | 2
lotuswordpro/source/filter/lwpnumericfmt.cxx | 2
lotuswordpro/source/filter/lwpnumericfmt.hxx | 16
lotuswordpro/source/filter/lwpobj.cxx | 3
lotuswordpro/source/filter/lwpobj.hxx | 14
lotuswordpro/source/filter/lwpobjfactory.cxx | 21
lotuswordpro/source/filter/lwpobjfactory.hxx | 7
lotuswordpro/source/filter/lwpobjhdr.cxx | 38 -
lotuswordpro/source/filter/lwpobjid.cxx | 19
lotuswordpro/source/filter/lwpobjid.hxx | 7
lotuswordpro/source/filter/lwpobjstrm.cxx | 8
lotuswordpro/source/filter/lwpobjstrm.hxx | 2
lotuswordpro/source/filter/lwpoleobject.cxx | 6
lotuswordpro/source/filter/lwpoverride.hxx | 20
lotuswordpro/source/filter/lwppagelayout.cxx | 48 -
lotuswordpro/source/filter/lwppara.cxx | 65 -
lotuswordpro/source/filter/lwppara.hxx | 5
lotuswordpro/source/filter/lwppara1.cxx | 10
lotuswordpro/source/filter/lwpparaborderoverride.hxx | 2
lotuswordpro/source/filter/lwpparaproperty.cxx | 16
lotuswordpro/source/filter/lwpparaproperty.hxx | 48 -
lotuswordpro/source/filter/lwpparastyle.cxx | 7
lotuswordpro/source/filter/lwpparastyle.hxx | 4
lotuswordpro/source/filter/lwpproplist.cxx | 11
lotuswordpro/source/filter/lwpprtinfo.hxx | 4
lotuswordpro/source/filter/lwprowlayout.cxx | 9
lotuswordpro/source/filter/lwprowlayout.hxx | 2
lotuswordpro/source/filter/lwpsdwfileloader.cxx | 2
lotuswordpro/source/filter/lwpsdwfileloader.hxx | 6
lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx | 20
lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx | 4
lotuswordpro/source/filter/lwpsdwrect.hxx | 4
lotuswordpro/source/filter/lwpsilverbullet.hxx | 6
lotuswordpro/source/filter/lwpstory.cxx | 155 +---
lotuswordpro/source/filter/lwpstory.hxx | 2
lotuswordpro/source/filter/lwpsvstream.cxx | 24
lotuswordpro/source/filter/lwpsvstream.hxx | 10
lotuswordpro/source/filter/lwptable.cxx | 2
lotuswordpro/source/filter/lwptable.hxx | 7
lotuswordpro/source/filter/lwptablelayout.cxx | 129 ++-
lotuswordpro/source/filter/lwptablelayout.hxx | 2
lotuswordpro/source/filter/lwptaboverride.hxx | 2
lotuswordpro/source/filter/lwptabrack.hxx | 2
lotuswordpro/source/filter/lwptblcell.cxx | 2
lotuswordpro/source/filter/lwptblcell.hxx | 82 +-
lotuswordpro/source/filter/lwptblformula.cxx | 19
lotuswordpro/source/filter/lwptoc.cxx | 34
lotuswordpro/source/filter/lwptoc.hxx | 10
lotuswordpro/source/filter/lwptools.cxx | 12
lotuswordpro/source/filter/lwptools.hxx | 4
lotuswordpro/source/filter/lwpuidoc.cxx | 2
lotuswordpro/source/filter/lwpuidoc.hxx | 2
lotuswordpro/source/filter/lwpusrdicts.hxx | 2
lotuswordpro/source/filter/tocread.cxx | 6
lotuswordpro/source/filter/utlist.hxx | 2
lotuswordpro/source/filter/xfilter/xfcell.cxx | 9
lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx | 8
lotuswordpro/source/filter/xfilter/xfcontentcontainer.hxx | 10
lotuswordpro/source/filter/xfilter/xfdocfield.cxx | 4
lotuswordpro/source/filter/xfilter/xfdrawobj.hxx | 16
lotuswordpro/source/filter/xfilter/xfdrawpath.hxx | 10
lotuswordpro/source/filter/xfilter/xfdrawpolyline.hxx | 24
lotuswordpro/source/filter/xfilter/xfdrawrect.hxx | 10
lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx | 4
lotuswordpro/source/filter/xfilter/xfdropcap.hxx | 2
lotuswordpro/source/filter/xfilter/xffootnote.hxx | 2
lotuswordpro/source/filter/xfilter/xfframe.cxx | 2
lotuswordpro/source/filter/xfilter/xfframe.hxx | 4
lotuswordpro/source/filter/xfilter/xfinputlist.hxx | 22
lotuswordpro/source/filter/xfilter/xflineheight.hxx | 2
lotuswordpro/source/filter/xfilter/xflist.cxx | 25
lotuswordpro/source/filter/xfilter/xflist.hxx | 4
lotuswordpro/source/filter/xfilter/xfliststyle.hxx | 3
lotuswordpro/source/filter/xfilter/xfparastyle.hxx | 4
lotuswordpro/source/filter/xfilter/xfrect.hxx | 2
lotuswordpro/source/filter/xfilter/xfshadow.hxx | 2
lotuswordpro/source/filter/xfilter/xfstylecont.cxx | 18
lotuswordpro/source/filter/xfilter/xfstylemanager.cxx | 19
lotuswordpro/source/filter/xfilter/xftable.cxx | 16
lotuswordpro/source/filter/xfilter/xftable.hxx | 2
138 files changed, 1363 insertions(+), 1207 deletions(-)
New commits:
commit dd37b6176145ba6bea9afe67d28908d0d9f295a5
Author: Andras Timar <andras.timar at collabora.com>
Date: Wed Mar 2 07:26:06 2016 +0100
Bump version to 4.4-11
Change-Id: Ia126e2b6419ceae18812f9f7db87b483996afedf
diff --git a/configure.ac b/configure.ac
index 7ebefd8..aeecff3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
# several non-alphanumeric characters, those are split off and used only for the
# ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
-AC_INIT([LibreOffice],[4.4.10.10],[],[],[https://libreoffice-from-collabora.com/])
+AC_INIT([LibreOffice],[4.4.10.11],[],[],[https://libreoffice-from-collabora.com/])
AC_PREREQ([2.59])
commit 9d0f2aa7b77800f1849b3207385813b9481ccd5a
Author: Andras Timar <andras.timar at collabora.com>
Date: Wed Mar 2 07:22:57 2016 +0100
backport lwp all fixes from LO 5.0
Change-Id: I9a0c1ca3f2ae326bddfd3c317567f8451d289628
diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
index 72db879..7371136 100644
--- a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
+++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
@@ -29,7 +29,7 @@ namespace
virtual bool load(const OUString &,
const OUString &rURL, const OUString &,
- unsigned int, unsigned int, unsigned int) SAL_OVERRIDE;
+ SfxFilterFlags, SotClipboardFormatId, unsigned int) SAL_OVERRIDE;
void test();
@@ -51,7 +51,7 @@ namespace
bool LotusWordProTest::load(const OUString &,
const OUString &rURL, const OUString &,
- unsigned int, unsigned int, unsigned int)
+ SfxFilterFlags, SotClipboardFormatId, unsigned int)
{
uno::Sequence< beans::PropertyValue > aDescriptor(1);
aDescriptor[0].Name = "URL";
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index 8a1aca4..91c9b13 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -74,7 +74,7 @@ bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::sun::
pValue[i].Value >>= sURL;
}
- SvFileStream inputStream( sURL, STREAM_READ );
+ SvFileStream inputStream( sURL, StreamMode::READ );
if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) )
return false;
@@ -180,22 +180,16 @@ OUString LotusWordProImportFilter_getImplementationName ()
return OUString ( "com.sun.star.comp.Writer.LotusWordProImportFilter" );
}
-#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
-
Sequence< OUString > SAL_CALL LotusWordProImportFilter_getSupportedServiceNames( )
throw (RuntimeException)
{
Sequence < OUString > aRet(2);
OUString* pArray = aRet.getArray();
- pArray[0] = OUString ( SERVICE_NAME1 );
- pArray[1] = OUString ( SERVICE_NAME2 );
+ pArray[0] = "com.sun.star.document.ImportFilter";
+ pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
return aRet;
}
-#undef SERVICE_NAME2
-#undef SERVICE_NAME1
-
uno::Reference< XInterface > SAL_CALL LotusWordProImportFilter_createInstance( const uno::Reference< XMultiServiceFactory > & rSMgr)
throw( Exception )
{
diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
index 51587ce..3cb4a09 100644
--- a/lotuswordpro/source/filter/bencont.cxx
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -91,15 +91,9 @@ sal_uLong BenOpenContainer(LwpSvStream * pStream, pLtcBenContainer * ppContainer
*ppContainer = pContainer;
return BenErr_OK;
}
-BenError
-LtcBenContainer::Close()
-{
- return BenErr_OK;
-}
LtcBenContainer::~LtcBenContainer()
{
- Close();
}
BenError
@@ -358,7 +352,7 @@ BenError LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *p
delete pS;
}
- pMemStream = new SvMemoryStream(pBuf, nLen, STREAM_READ);
+ pMemStream = new SvMemoryStream(pBuf, nLen, StreamMode::READ);
assert(pMemStream != NULL);
pStream = pMemStream;
diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx
index 0a44cf3..dcd5acf 100644
--- a/lotuswordpro/source/filter/bento.hxx
+++ b/lotuswordpro/source/filter/bento.hxx
@@ -204,7 +204,6 @@ class LtcBenContainer
{
public:
BenError Open();
- BenError Close();
BenError RegisterPropertyName(const char * sPropertyName,
pCBenPropertyName * ppPropertyName);
// Pass NULL to begin iteration. Done when returns NULL.
@@ -297,8 +296,6 @@ public: // Internal methods
pCurrValueSegment);
inline pLtcBenContainer GetContainer();
CUtList& GetValueSegments() { return cValueSegments; }
- // Currently, no generation support
- BenGeneration GetGeneration() { return 1; }
private: // Data
pCBenProperty cpProperty;
@@ -409,8 +406,8 @@ public: // Internal methods
const char * GetNameCStr() { return csName.c_str(); }
void SetPosition(BenContainerPos Pos) { cPos = Pos; }
- BenContainerPos GetPosition(void) { return cPos; }
- size_t GetLength(void) { return csName.length()+ 1; }
+ BenContainerPos GetPosition() { return cPos; }
+ size_t GetLength() { return csName.length()+ 1; }
CBenNamedObjectListElmt& GetNameListElmt() { return cNameListElmt; }
private: // Data
diff --git a/lotuswordpro/source/filter/benval.cxx b/lotuswordpro/source/filter/benval.cxx
index 06f45fe..db505a8 100644
--- a/lotuswordpro/source/filter/benval.cxx
+++ b/lotuswordpro/source/filter/benval.cxx
@@ -77,7 +77,7 @@ CBenValue::ReadValueData(BenDataPtr pReadBuffer, unsigned long Offset,
*pAmtRead = 0;
pCBenValueSegment pCurrSeg = NULL;
pLtcBenContainer pContainer = GetContainer();
- BenByteDataPtr pBuffer = (BenByteDataPtr) pReadBuffer;
+ BenByteDataPtr pBuffer = static_cast<BenByteDataPtr>(pReadBuffer);
/// pReadBuffer -- pointer to buffer of read result, allocated outside this function
/// Offset -- read buffer's start offset address, relative value in the whole value stream
diff --git a/lotuswordpro/source/filter/explode.hxx b/lotuswordpro/source/filter/explode.hxx
index 9db360b..5cb5601 100644
--- a/lotuswordpro/source/filter/explode.hxx
+++ b/lotuswordpro/source/filter/explode.hxx
@@ -119,7 +119,7 @@ public:
void ConstructTree1();
void ConstructTree2();
void fillArray();
- void ToString(sal_uInt32 nBits, sal_Char *pChar, sal_uInt32 nLen);
+ static void ToString(sal_uInt32 nBits, sal_Char *pChar, sal_uInt32 nLen);
};
#endif
diff --git a/lotuswordpro/source/filter/genericfilter.cxx b/lotuswordpro/source/filter/genericfilter.cxx
index 5187b7a..3ff90ec 100644
--- a/lotuswordpro/source/filter/genericfilter.cxx
+++ b/lotuswordpro/source/filter/genericfilter.cxx
@@ -24,7 +24,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL lotuswordpro_component_getFactory(
if ( pServiceManager && implName.equals(LotusWordProImportFilter_getImplementationName()) )
{
Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ static_cast< XMultiServiceFactory * >( pServiceManager ),
OUString::createFromAscii( pImplName ),
LotusWordProImportFilter_createInstance, LotusWordProImportFilter_getSupportedServiceNames() ) );
diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
index bba45304..e74d02e 100644
--- a/lotuswordpro/source/filter/lwp9reader.cxx
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -169,7 +169,7 @@ sal_Int64 Lwp9Reader::GetFileSize()
sal_Int64 size = m_pDocStream->Seek( STREAM_SEEK_TO_END);
m_pDocStream->Seek(pos);
- return(size);
+ return size;
}
/**
diff --git a/lotuswordpro/source/filter/lwpbackgroundoverride.hxx b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
index 1bbebfa..7f382ba 100644
--- a/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
+++ b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
@@ -89,7 +89,7 @@ protected:
LwpBackgroundOverride(LwpBackgroundOverride const& rOther);
private:
- LwpBackgroundOverride& operator=(LwpBackgroundOverride const& rOther); // not implemented
+ LwpBackgroundOverride& operator=(LwpBackgroundOverride const& rOther) SAL_DELETED_FUNCTION;
private:
LwpBackgroundStuff m_aStuff;
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
index 8a19cc9..107850d 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -83,14 +83,11 @@ void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArra
assert(false);
return;
}
- if (pPttnArray)
+ assert((2 < btPttnIndex) && (btPttnIndex < 72));
+ const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
+ for(sal_uInt8 i = 0; i < 32; i++)
{
- assert((2 < btPttnIndex) && (btPttnIndex < 72));
- const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
- for(sal_uInt8 i = 0; i < 32; i++)
- {
- pPttnArray[i] = (i%4 == 0) ? pTempArray[7-i/4] : 0;
- }
+ pPttnArray[i] = (i%4 == 0) ? pTempArray[7-i/4] : 0;
}
}
@@ -113,21 +110,15 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern()
}
// get pattern array from pattern table
- sal_uInt8* pPttnArray = new sal_uInt8 [32];
- this->GetPattern(m_nID, pPttnArray);
+ sal_uInt8 aPttnArray[32];
+ GetPattern(m_nID, aPttnArray);
// create bitmap object from the pattern array
Bitmap aBmp( Size(8, 8), 1 );
BitmapWriteAccess* pWA = aBmp.AcquireWriteAccess();
sal_uInt8* pBuf = pWA->GetBuffer();
- memcpy(pBuf, pPttnArray, 32);
- aBmp.ReleaseAccess(pWA);
-
- if (pPttnArray)
- {
- delete [] pPttnArray;
- pPttnArray = NULL;
- }
+ memcpy(pBuf, aPttnArray, 32);
+ Bitmap::ReleaseAccess(pWA);
// create XOBitmap object from bitmap object
XOBitmap aXOBitmap( aBmp );
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.hxx b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
index 085e092..60d12d1 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
@@ -145,7 +145,7 @@ public:
}
private:
- void GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArray);
+ static void GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArray);
public:
void Read(LwpObjectStream *pStrm);
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.hxx b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
index dff45ea..1454afc 100644
--- a/lotuswordpro/source/filter/lwpbreaksoverride.hxx
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
@@ -134,7 +134,7 @@ protected:
LwpBreaksOverride(LwpBreaksOverride const& rOther);
private:
- LwpBreaksOverride& operator=(const LwpBreaksOverride& rOther); // not implemented
+ LwpBreaksOverride& operator=(const LwpBreaksOverride& rOther) SAL_DELETED_FUNCTION;
private:
LwpAtomHolder *m_pNextStyle;
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index c71cf15..933f239 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -172,9 +172,9 @@ OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverrid
for (sal_uInt8 nC = 1; nC < 11; nC++)
{
pListStyle->SetListBullet(nC, pSilverBullet->GetBulletChar(), pSilverBullet->GetBulletFontName(),
- pSilverBullet->GetPrefix(), pSilverBullet->GetSuffix());
+ LwpSilverBullet::GetPrefix(), LwpSilverBullet::GetSuffix());
- if (pIndent->GetMRest() > 0.001)
+ if (pIndent->GetMRest() > 0) /* note: used to be 0.001, no idea why */
{
pListStyle->SetListPosition(nC, 0.0,
LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(pIndent->GetMRest())), 0.0, eAlign);
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 13d7307..404c4e7 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -328,7 +328,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
// we should judt its style by current position
if (pTable->GetDefaultCellStyle() == GetObjectID())
{
- aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout());
+ aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout().get());
}
// content of cell
@@ -423,10 +423,7 @@ LwpObjectID * LwpCellLayout::GetPreviousCellStory()
LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
{
if (!pTableLayout)
- {
- assert(false);
return enumWholeBorder;
- }
// get left cell and judge if neighbour border is different
XFBorders * pBorders = GetXFBorders();
@@ -572,8 +569,8 @@ void LwpCellLayout::RegisterDefaultCell()
*/
void LwpCellLayout::RegisterStyle()
{
- LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get());
- if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get()));
+ if (!xParent.is() || xParent->GetLayoutType() != LWP_ROW_LAYOUT)
{
// default cell layout, we must register 4 styles for it
RegisterDefaultCell();
@@ -650,7 +647,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
bool bProtected = false;
// judge current cell
- if (IsProtected())
+ if (GetIsProtected())
{
bProtected = true;
}
@@ -658,7 +655,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
// judge base on
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
- if (pBase && pBase->IsProtected())
+ if (pBase && pBase->GetIsProtected())
{
bProtected = true;
}
@@ -666,9 +663,9 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
// judge whole table
LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
- LwpTableLayout * pTableLayout = pTable ? static_cast<LwpTableLayout *>(pTable->GetTableLayout()) : NULL;
- LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : NULL;
- if (pSuper && pSuper->IsProtected())
+ rtl::Reference<LwpTableLayout> xTableLayout(pTable ? pTable->GetTableLayout() : nullptr);
+ LwpSuperTableLayout * pSuper = xTableLayout.is() ? xTableLayout->GetSuperTableLayout() : nullptr;
+ if (pSuper && pSuper->GetIsProtected())
{
bProtected = true;
}
@@ -764,7 +761,11 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
}
}
- if ( (nRow + nRowSpan) == pTableLayout->GetTable()->GetRow() )
+ LwpTable* pTable = pTableLayout->GetTable();
+ if (!pTable)
+ throw std::runtime_error("missing table");
+
+ if ( (nRow + nRowSpan) == pTable->GetRow())
{
bNoBottomBorder = false;
}
diff --git a/lotuswordpro/source/filter/lwpcelllayout.hxx b/lotuswordpro/source/filter/lwpcelllayout.hxx
index a6123a4..1ca533a 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.hxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.hxx
@@ -100,7 +100,7 @@ public:
LwpObjectID * GetPreviousCellStory();
virtual LwpPara* GetLastParaOfPreviousStory() SAL_OVERRIDE;
LwpTableLayout * GetTableLayout();
- virtual void SetCellMap(void);
+ virtual void SetCellMap();
double GetActualWidth();
OUString GetNumfmtName(){return m_NumfmtName;}
protected:
@@ -117,8 +117,8 @@ protected:
OUString GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
void RegisterDefaultCell();
virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
- LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
- virtual sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
+ static LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
+ static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; };
sal_uInt16 crowid;
@@ -154,7 +154,7 @@ public:
virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
virtual XFCell* ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) SAL_OVERRIDE;
void RegisterStyle() SAL_OVERRIDE {}
- virtual void SetCellMap(void) SAL_OVERRIDE;
+ virtual void SetCellMap() SAL_OVERRIDE;
protected:
void Read() SAL_OVERRIDE;
LwpObjectID cconnectedlayout;
@@ -174,7 +174,7 @@ public:
virtual XFCell* ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) SAL_OVERRIDE;
sal_uInt16 GetNumrows(){return m_nRealrowspan;}
sal_uInt8 GetNumcols(){return m_nRealcolspan;}
- virtual void SetCellMap(void) SAL_OVERRIDE;
+ virtual void SetCellMap() SAL_OVERRIDE;
void SetNumrows(sal_uInt16 nVal){m_nRealrowspan = nVal;}
void SetNumcols(sal_uInt8 nVal){m_nRealcolspan = nVal;}
protected:
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.hxx b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
index 2a8528e..9beb601 100644
--- a/lotuswordpro/source/filter/lwpcharborderoverride.hxx
+++ b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
@@ -104,7 +104,7 @@ protected:
LwpCharacterBorderOverride(LwpCharacterBorderOverride const& rOther);
private:
- LwpCharacterBorderOverride& operator=(LwpCharacterBorderOverride const& rOther); // not implemented
+ LwpCharacterBorderOverride& operator=(LwpCharacterBorderOverride const& rOther) SAL_DELETED_FUNCTION;
private:
LwpBorderStuff* m_pBorderStuff;
diff --git a/lotuswordpro/source/filter/lwpcharsetmgr.cxx b/lotuswordpro/source/filter/lwpcharsetmgr.cxx
index f1d31a4..84e270d 100644
--- a/lotuswordpro/source/filter/lwpcharsetmgr.cxx
+++ b/lotuswordpro/source/filter/lwpcharsetmgr.cxx
@@ -110,9 +110,4 @@ rtl_TextEncoding LwpCharSetMgr::GetTextCharEncoding(sal_uInt16 wordproCode)
return GetTextCharEncoding();
}
-rtl_TextEncoding LwpCharSetMgr::GetTextCharEncoding()
-{
- return RTL_TEXTENCODING_MS_1252;//here should be a default value,1252 or get from platform, 1-18
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpcharsetmgr.hxx b/lotuswordpro/source/filter/lwpcharsetmgr.hxx
index 6125e5a..340b9e7 100644
--- a/lotuswordpro/source/filter/lwpcharsetmgr.hxx
+++ b/lotuswordpro/source/filter/lwpcharsetmgr.hxx
@@ -75,7 +75,11 @@ public:
static LwpCharSetMgr* GetInstance();
void SetCodePageMap();
rtl_TextEncoding GetTextCharEncoding(sal_uInt16 wordproCode);
- rtl_TextEncoding GetTextCharEncoding();
+ static rtl_TextEncoding GetTextCharEncoding()
+ {
+ return RTL_TEXTENCODING_MS_1252;//here should be a default value,1252 or get from platform, 1-18
+ }
+
private:
std::map<sal_uInt16,rtl_TextEncoding> m_CodePageMap;
static LwpCharSetMgr* Instance;
diff --git a/lotuswordpro/source/filter/lwpcontent.cxx b/lotuswordpro/source/filter/lwpcontent.cxx
index 77ae0d3..17be69b 100644
--- a/lotuswordpro/source/filter/lwpcontent.cxx
+++ b/lotuswordpro/source/filter/lwpcontent.cxx
@@ -125,17 +125,20 @@ void LwpContent::Read()
pStrm->SkipExtra();
}
-LwpVirtualLayout* LwpContent::GetLayout(LwpVirtualLayout* pStartLayout)
+rtl::Reference<LwpVirtualLayout> LwpContent::GetLayout(LwpVirtualLayout* pStartLayout)
{
return m_LayoutsWithMe.GetLayout(pStartLayout);
}
bool LwpContent::HasNonEmbeddedLayouts()
{
- LwpVirtualLayout* pLayout = NULL;
- while( (pLayout = GetLayout(pLayout)) )
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
{
- if(!pLayout->NoContentReference())
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (!xLayout->NoContentReference())
return true;
}
return false;
@@ -143,10 +146,13 @@ bool LwpContent::HasNonEmbeddedLayouts()
bool LwpContent::IsStyleContent()
{
- LwpVirtualLayout* pLayout = NULL;
- while( (pLayout = GetLayout(pLayout)) )
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
{
- if(pLayout->IsStyleLayout())
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (xLayout->IsStyleLayout())
return true;
}
return false;
diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx
index cd85bd5..b0900c2 100644
--- a/lotuswordpro/source/filter/lwpcontent.hxx
+++ b/lotuswordpro/source/filter/lwpcontent.hxx
@@ -110,7 +110,7 @@ protected:
void Read() SAL_OVERRIDE;
public:
inline LwpAssociatedLayouts& GetLayoutsWithMe();
- LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
+ rtl::Reference<LwpVirtualLayout> GetLayout(LwpVirtualLayout* pStartLayout);
inline bool IsActive();
virtual bool IsTable();
inline OUString GetClassName();
diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
index 2e97587..11d4f0e 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.cxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.cxx
@@ -166,10 +166,10 @@ sal_uInt16 LwpDivInfo::GetMaxNumberOfPages()
LwpDocument* pDiv = GetDivision();
if(!pDiv)
return 0;
- LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
if(pHeadTail)
{
- LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
{
return pPageHint->GetPageNumber();
diff --git a/lotuswordpro/source/filter/lwpdivinfo.hxx b/lotuswordpro/source/filter/lwpdivinfo.hxx
index f99d807..6ac2fb5 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.hxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.hxx
@@ -139,7 +139,7 @@ private:
inline bool LwpDivInfo::HasContents()
{
- return (m_nFlags & DI_HASCONTENTS) ? sal_True : sal_False;
+ return (m_nFlags & DI_HASCONTENTS) != 0;
}
inline bool LwpDivInfo::IsOleDivision()
@@ -152,7 +152,7 @@ inline bool LwpDivInfo::IsOleDivision()
inline bool LwpDivInfo::IsScrollable()
{
- return (m_nFlags & DI_SCROLLABLE) ? sal_True : sal_False;
+ return (m_nFlags & DI_SCROLLABLE) != 0;
}
inline bool LwpDivInfo::IsGotoable()
diff --git a/lotuswordpro/source/filter/lwpdivopts.hxx b/lotuswordpro/source/filter/lwpdivopts.hxx
index 1445aa5..4321787 100644
--- a/lotuswordpro/source/filter/lwpdivopts.hxx
+++ b/lotuswordpro/source/filter/lwpdivopts.hxx
@@ -100,7 +100,7 @@ public:
~LwpTextLanguage();
void Read(LwpObjectStream *pStrm);
private:
- sal_uInt16 ConvertFrom96(sal_uInt16 orgLang);
+ static sal_uInt16 ConvertFrom96(sal_uInt16 orgLang);
sal_uInt16 m_nLanguage;
};
diff --git a/lotuswordpro/source/filter/lwpdllist.cxx b/lotuswordpro/source/filter/lwpdllist.cxx
index abf4d66..04310d2 100644
--- a/lotuswordpro/source/filter/lwpdllist.cxx
+++ b/lotuswordpro/source/filter/lwpdllist.cxx
@@ -64,7 +64,7 @@
#include "lwpdllist.hxx"
-LwpDLList::LwpDLList(void)
+LwpDLList::LwpDLList()
{
m_pNext = m_pPrevious = NULL;
}
@@ -80,7 +80,7 @@ LwpDLList::insert(LwpDLList* Next,LwpDLList* Previous)
m_pPrevious = Previous;
}
-LwpDLList::~LwpDLList(void)
+LwpDLList::~LwpDLList()
{
remove();
}
diff --git a/lotuswordpro/source/filter/lwpdllist.hxx b/lotuswordpro/source/filter/lwpdllist.hxx
index bbb67d2..744d399 100644
--- a/lotuswordpro/source/filter/lwpdllist.hxx
+++ b/lotuswordpro/source/filter/lwpdllist.hxx
@@ -68,12 +68,12 @@
class LwpDLList
{
public:
- LwpDLList(void);
+ LwpDLList();
virtual ~LwpDLList();
void insert(LwpDLList*, LwpDLList*);
- void remove(void);
- LwpDLList* GetNext(void);
- LwpDLList* GetPrevious(void);
+ void remove();
+ LwpDLList* GetNext();
+ LwpDLList* GetPrevious();
void SetNext(LwpDLList*);
void SetPrevious(LwpDLList*);
private:
@@ -81,7 +81,7 @@ private:
LwpDLList* m_pPrevious;
};
-inline LwpDLList* LwpDLList::GetNext(void)
+inline LwpDLList* LwpDLList::GetNext()
{
return m_pNext;
}
@@ -91,7 +91,7 @@ inline void LwpDLList::SetNext(LwpDLList* Next)
m_pNext = Next;
}
-inline LwpDLList* LwpDLList::GetPrevious(void)
+inline LwpDLList* LwpDLList::GetPrevious()
{
return m_pPrevious;
}
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index a0dc530..29a359b 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -70,7 +70,8 @@
LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
- , m_pOwnedFoundry(NULL)
+ , m_pOwnedFoundry(nullptr)
+ , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
, m_nFlags(0)
, m_nPersistentFlags(0)
, m_pLnOpts(NULL)
@@ -233,7 +234,9 @@ void LwpDocument::RegisterStyle()
void LwpDocument::RegisterTextStyles()
{
//Register all text styles: para styles, character styles
- LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get());
+ LwpDLVListHeadHolder* pParaStyleHolder = m_pFoundry
+ ? dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get())
+ : nullptr;
if(pParaStyleHolder)
{
LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
@@ -252,12 +255,15 @@ void LwpDocument::RegisterTextStyles()
*/
void LwpDocument::RegisterLayoutStyles()
{
- //Register all layout styles, before register all styles in para
- m_pFoundry->RegisterAllLayouts();
+ if (m_pFoundry)
+ {
+ //Register all layout styles, before register all styles in para
+ m_pFoundry->RegisterAllLayouts();
+ }
//set initial pagelayout in story for parsing pagelayout
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
- if(pDivInfo)
+ if (pDivInfo)
{
LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
if(pPageLayout)
@@ -279,16 +285,18 @@ void LwpDocument::RegisterLayoutStyles()
void LwpDocument::RegisterStylesInPara()
{
//Register all automatic styles in para
- LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get());
- if(pContent)
+ rtl::Reference<LwpHeadContent> xContent(m_pFoundry
+ ? dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get())
+ : nullptr);
+ if (xContent.is())
{
- LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead().obj(VO_STORY).get());
- while(pStory)
+ rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
+ while (xStory.is())
{
//Register the child para
- pStory->SetFoundry(m_pFoundry);
- pStory->RegisterStyle();
- pStory = dynamic_cast<LwpStory*>(pStory->GetNext().obj(VO_STORY).get());
+ xStory->SetFoundry(m_pFoundry);
+ xStory->DoRegisterStyle();
+ xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
}
}
}
@@ -297,19 +305,20 @@ void LwpDocument::RegisterStylesInPara()
*/
void LwpDocument::RegisterBulletStyles()
{
+ if (!m_pFoundry)
+ return;
//Register bullet styles
LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
(m_pFoundry->GetBulletManagerID().obj(VO_HEADHOLDER).get());
- if( mBulletHead )
+ if (!mBulletHead)
+ return;
+ LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
+ (mBulletHead->GetHeadID().obj().get());
+ while(pBullet)
{
- LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
- (mBulletHead->GetHeadID().obj().get());
- while(pBullet)
- {
- pBullet->SetFoundry(m_pFoundry);
- pBullet->RegisterStyle();
- pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
- }
+ pBullet->SetFoundry(m_pFoundry);
+ pBullet->RegisterStyle();
+ pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
}
}
/**
@@ -317,13 +326,14 @@ void LwpDocument::RegisterBulletStyles()
*/
void LwpDocument::RegisterGraphicsStyles()
{
+ if (!m_pFoundry)
+ return;
//Register all graphics styles, the first object should register the next;
rtl::Reference<LwpObject> pGraphic = m_pFoundry->GetGraphicListHead().obj(VO_GRAPHIC);
- if(pGraphic.is())
- {
- pGraphic->SetFoundry(m_pFoundry);
- pGraphic->DoRegisterStyle();
- }
+ if (!pGraphic.is())
+ return;
+ pGraphic->SetFoundry(m_pFoundry);
+ pGraphic->DoRegisterStyle();
}
/**
* @descr Register line number styles
@@ -610,7 +620,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/**
* @descr Get first division with contents that is not ole, copy from lwp-source code
*/
- LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE()
+ LwpDocument* LwpDocument::ImplGetFirstDivisionWithContentsThatIsNotOLE()
{
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get());
if(pDivInfo && pDivInfo->HasContents()
@@ -619,7 +629,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument* pDivision = GetFirstDivision();
- while (pDivision && pDivision != this)
+ while (pDivision)
{
LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
if(pContentDivision)
@@ -637,7 +647,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr;
while (pLastDoc)
{
- if(pLastDoc->GetEnSuperTableLayout())
+ if (pLastDoc->GetEnSuperTableLayout().is())
return pLastDoc;
pLastDoc = pLastDoc->GetPreviousDivisionWithContents();
}
@@ -647,14 +657,14 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/**
* @descr Get endnote supertable layout, every division has only one endnote supertable layout.
*/
- LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout()
+rtl::Reference<LwpVirtualLayout> LwpDocument::GetEnSuperTableLayout()
{
LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout().obj().get());
if(pHeadLayout)
{
return pHeadLayout->FindEnSuperTableLayout();
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
/**
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
index a1dfee2..91ac419 100644
--- a/lotuswordpro/source/filter/lwpdoc.hxx
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -89,6 +89,7 @@ public:
private:
LwpFoundry* m_pOwnedFoundry;
+ bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
//Data members in file format
LwpObjectID m_DocSockID;
@@ -137,8 +138,7 @@ public:
void RegisterStyle() SAL_OVERRIDE;
inline bool IsChildDoc();
- inline bool HonorProtection();
- inline LwpObjectID& GetContentList();
+ inline bool GetHonorProtection();
inline LwpObjectID& GetDocData();
inline LwpObjectID& GetSocket();
@@ -160,12 +160,20 @@ public:
LwpDocument* GetLastDivisionWithContents();
LwpDocument* GetLastInGroupWithContents();
LwpDocument* GetRootDocument();
- LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE();
+ LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE()
+ {
+ if (m_bGettingFirstDivisionWithContentsThatIsNotOLE)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = true;
+ LwpDocument* pRet = ImplGetFirstDivisionWithContentsThatIsNotOLE();
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = false;
+ return pRet;
+ }
LwpDocument* GetLastDivisionThatHasEndnote();
LwpDocument* GetLastDivision();
LwpDocument* GetFirstDivision();
- LwpVirtualLayout* GetEnSuperTableLayout();
+ rtl::Reference<LwpVirtualLayout> GetEnSuperTableLayout();
bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
sal_uInt16 GetNumberOfPagesBefore();
@@ -173,8 +181,9 @@ public:
private:
void MaxNumberOfPages(sal_uInt16& nNumPages);
+ LwpDocument* ImplGetFirstDivisionWithContentsThatIsNotOLE();
void XFConvertFrameInPage(XFContentContainer* pCont);
- void ChangeStyleName();
+ static void ChangeStyleName();
bool IsSkippedDivision();
};
@@ -182,14 +191,10 @@ inline bool LwpDocument::IsChildDoc()
{
return (m_nPersistentFlags & DOC_CHILDDOC) != 0;
}
-inline bool LwpDocument::HonorProtection()
+inline bool LwpDocument::GetHonorProtection()
{
return (m_nPersistentFlags & DOC_PROTECTED) != 0;
}
-inline LwpObjectID& LwpDocument::GetContentList()
-{
- return m_pFoundry->GetContentManager().GetContentList();
-}
inline LwpObjectID& LwpDocument::GetSocket()
{
return m_DocSockID;
diff --git a/lotuswordpro/source/filter/lwpdocdata.hxx b/lotuswordpro/source/filter/lwpdocdata.hxx
index 48414b3..226a18a 100644
--- a/lotuswordpro/source/filter/lwpdocdata.hxx
+++ b/lotuswordpro/source/filter/lwpdocdata.hxx
@@ -176,8 +176,8 @@ private:
LtTm m_nLastRevisionTime;
LtTm m_nTotalEditTime;
private:
- OUString DateTimeToOUString(LtTm& dt);
- OUString TimeToOUString(LtTm& dt);
+ static OUString DateTimeToOUString(LtTm& dt);
+ static OUString TimeToOUString(LtTm& dt);
public:
void Read() SAL_OVERRIDE;
diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx
index 1563f3d..5fc7817 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.cxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.cxx
@@ -317,11 +317,11 @@ void LwpDrawObj::SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag
if (nLeftArrow)
{
- pOpenedObjStyle->SetArrowStart( this->GetArrowName(nLeftArrow), fArrowSize, true);
+ pOpenedObjStyle->SetArrowStart( GetArrowName(nLeftArrow), fArrowSize, true);
}
if (nRightArrow)
{
- pOpenedObjStyle->SetArrowEnd( this->GetArrowName(nRightArrow), fArrowSize, true);
+ pOpenedObjStyle->SetArrowEnd( GetArrowName(nRightArrow), fArrowSize, true);
}
}
@@ -440,10 +440,10 @@ OUString LwpDrawLine::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aLineRec.nLineWidth, m_aLineRec.nLineStyle, m_aLineRec.aPenColor);
+ SetLineStyle(pStyle, m_aLineRec.nLineWidth, m_aLineRec.nLineStyle, m_aLineRec.aPenColor);
// set arrow head
- this->SetArrowHead(pStyle, m_aLineRec.nLineEnd, m_aLineRec.nLineWidth);
+ SetArrowHead(pStyle, m_aLineRec.nLineEnd, m_aLineRec.nLineWidth);
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
return (pXFStyleManager->AddStyle(pStyle)).m_pStyle->GetStyleName();
@@ -522,11 +522,11 @@ OUString LwpDrawPolyLine::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aPolyLineRec.nLineWidth, m_aPolyLineRec.nLineStyle,
+ SetLineStyle(pStyle, m_aPolyLineRec.nLineWidth, m_aPolyLineRec.nLineStyle,
m_aPolyLineRec.aPenColor);
// set arrow head
- this->SetArrowHead(pStyle, m_aPolyLineRec.nLineEnd, m_aPolyLineRec.nLineWidth);
+ SetArrowHead(pStyle, m_aPolyLineRec.nLineEnd, m_aPolyLineRec.nLineWidth);
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
return pXFStyleManager->AddStyle(pStyle).m_pStyle->GetStyleName();
@@ -608,7 +608,7 @@ OUString LwpDrawPolygon::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
m_aClosedObjStyleRec.aPenColor);
// set fill style
@@ -688,7 +688,7 @@ OUString LwpDrawRectangle::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
m_aClosedObjStyleRec.aPenColor);
// set fill style
@@ -847,7 +847,7 @@ OUString LwpDrawEllipse::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
+ SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
m_aClosedObjStyleRec.aPenColor);
// set fill style
@@ -926,11 +926,11 @@ OUString LwpDrawArc::RegisterStyle()
XFDrawStyle* pStyle = new XFDrawStyle();
// set line style
- this->SetLineStyle(pStyle, m_aArcRec.nLineWidth, m_aArcRec.nLineStyle,
+ SetLineStyle(pStyle, m_aArcRec.nLineWidth, m_aArcRec.nLineStyle,
m_aArcRec.aPenColor);
// set arrow head
- this->SetArrowHead(pStyle, m_aArcRec.nLineEnd, m_aArcRec.nLineWidth);
+ SetArrowHead(pStyle, m_aArcRec.nLineEnd, m_aArcRec.nLineWidth);
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
return pXFStyleManager->AddStyle(pStyle).m_pStyle->GetStyleName();
@@ -1074,8 +1074,8 @@ OUString LwpDrawTextBox::RegisterStyle()
rtl::Reference<XFFont> pFont = new XFFont();
rtl_TextEncoding aEncoding = RTL_TEXTENCODING_MS_1252;
- OUString aFontName = OUString((sal_Char*)m_aTextRec.tmpTextFaceName,
- strlen((char*)m_aTextRec.tmpTextFaceName), aEncoding);
+ OUString aFontName = OUString(reinterpret_cast<char*>(m_aTextRec.tmpTextFaceName),
+ strlen(reinterpret_cast<char*>(m_aTextRec.tmpTextFaceName)), aEncoding);
pFont->SetFontName(aFontName);
SetFontStyle(pFont, &m_aTextRec);
@@ -1099,11 +1099,11 @@ XFFrame* LwpDrawTextBox::CreateDrawObj(const OUString& rStyleName )
else
{
// temporary code, need to create Encoding from the value of nTextCharacterSet
- aEncoding = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
+ aEncoding = LwpCharSetMgr::GetTextCharEncoding();
}
XFParagraph* pXFPara = new XFParagraph();
- pXFPara->Add(OUString((sal_Char*)m_aTextRec.pTextString, (TextLength-2), aEncoding));
+ pXFPara->Add(OUString(reinterpret_cast<char*>(m_aTextRec.pTextString), (TextLength-2), aEncoding));
pXFPara->SetStyleName(rStyleName);
pTextBox->Add(pXFPara);
@@ -1279,8 +1279,8 @@ OUString LwpDrawTextArt::RegisterStyle()
rtl::Reference<XFFont> pFont = new XFFont();
rtl_TextEncoding aEncoding = RTL_TEXTENCODING_MS_1252;
- OUString aFontName = OUString((sal_Char*)m_aTextArtRec.tmpTextFaceName,
- strlen((char*)m_aTextArtRec.tmpTextFaceName), aEncoding);
+ OUString aFontName = OUString(reinterpret_cast<char*>(m_aTextArtRec.tmpTextFaceName),
+ strlen(reinterpret_cast<char*>(m_aTextArtRec.tmpTextFaceName)), aEncoding);
pFont->SetFontName(aFontName);
LwpDrawTextBox::SetFontStyle(pFont, &m_aTextArtRec);
@@ -1311,11 +1311,11 @@ XFFrame* LwpDrawTextArt::CreateDrawObj(const OUString& rStyleName)
else
{
// temporary code, need to create Encoding from the value of nTextCharacterSet
- aEncoding = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
+ aEncoding = LwpCharSetMgr::GetTextCharEncoding();
}
XFParagraph* pXFPara = new XFParagraph();
- pXFPara->Add(OUString((sal_Char*)m_aTextArtRec.pTextString, (m_aTextArtRec.nTextLen-1), aEncoding));
+ pXFPara->Add(OUString(reinterpret_cast<char*>(m_aTextArtRec.pTextString), (m_aTextArtRec.nTextLen-1), aEncoding));
pXFPara->SetStyleName(rStyleName);
pRetObj->Add(pXFPara);
diff --git a/lotuswordpro/source/filter/lwpdrawobj.hxx b/lotuswordpro/source/filter/lwpdrawobj.hxx
index 457a1fb..a379478 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.hxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.hxx
@@ -95,11 +95,11 @@ private:
protected:
void ReadClosedObjStyle();
void SetFillStyle(XFDrawStyle* pStyle);
- void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
+ static void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
const SdwColor& rColor);
void SetPosition(XFFrame* pObj);
- void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
- OUString GetArrowName(sal_uInt8 nArrowStyle);
+ static void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
+ static OUString GetArrowName(sal_uInt8 nArrowStyle);
protected:
/**
diff --git a/lotuswordpro/source/filter/lwpfilehdr.cxx b/lotuswordpro/source/filter/lwpfilehdr.cxx
index d2d87ac..5bcbf6d 100644
--- a/lotuswordpro/source/filter/lwpfilehdr.cxx
+++ b/lotuswordpro/source/filter/lwpfilehdr.cxx
@@ -70,22 +70,22 @@ LwpFileHeader::LwpFileHeader()
sal_uInt32 LwpFileHeader::Read(LwpSvStream *pStrm)
{
sal_uInt32 len = 0;
- *pStrm >> m_nAppRevision;
+ pStrm->ReadUInt16( m_nAppRevision );
len += sizeof(m_nAppRevision);
- *pStrm >> m_nFileRevision;
+ pStrm->ReadUInt16( m_nFileRevision );
len += sizeof(m_nFileRevision);
- *pStrm >> m_nAppReleaseNo;
+ pStrm->ReadUInt16( m_nAppReleaseNo );
len += sizeof(m_nAppReleaseNo);
- *pStrm >> m_nRequiredAppRevision;
+ pStrm->ReadUInt16( m_nRequiredAppRevision );
len += sizeof(m_nRequiredAppRevision);
- *pStrm >> m_nRequiredFileRevision;
+ pStrm->ReadUInt16( m_nRequiredFileRevision );
len += sizeof(m_nRequiredFileRevision);
len += m_cDocumentID.Read(pStrm);
if (m_nFileRevision < 0x000B)
m_nRootIndexOffset = BAD_OFFSET;
else
{
- *pStrm >> m_nRootIndexOffset;
+ pStrm->ReadUInt32( m_nRootIndexOffset );
len += sizeof(m_nRootIndexOffset);
}
return len;
diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
index 9db5f3f..c77d2de 100644
--- a/lotuswordpro/source/filter/lwpfilter.cxx
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -115,7 +115,7 @@ using namespace OpenStormBento;
if (ulRet != BenErr_OK)
return false;
- boost::scoped_ptr<LtcUtBenValueStream> aWordProData((LtcUtBenValueStream *)pBentoContainer->FindValueStreamWithPropertyName("WordProData"));
+ boost::scoped_ptr<LtcUtBenValueStream> aWordProData(pBentoContainer->FindValueStreamWithPropertyName("WordProData"));
if (!aWordProData.get())
return false;
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
index e02c597..d50cc0e 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -119,14 +119,14 @@ void LwpFnRowLayout::RegisterStyle()
{
// register cells' style
LwpObjectID& rCellID = GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
while(pCellLayout)
{
pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle();
rCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
}
}
@@ -199,14 +199,14 @@ void LwpEndnoteLayout::RegisterStyle()
{
// register style of rows
LwpObjectID& rRowID = GetChildHead();
- LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
while (pRowLayout)
{
pRowLayout->SetFoundry(m_pFoundry);
pRowLayout->RegisterStyle();
rRowID = pRowLayout->GetNext();
- pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+ pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
}
}
@@ -262,7 +262,7 @@ void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
while(!rID.IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(rID.obj().get());
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout*>(rID.obj().get());
if(!pLayout)
{
break;
@@ -318,7 +318,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
while(!rID.IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(rID.obj().get());
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get());
if(!pLayout)
{
break;
diff --git a/lotuswordpro/source/filter/lwpfont.hxx b/lotuswordpro/source/filter/lwpfont.hxx
index cda119d..bee86af 100644
--- a/lotuswordpro/source/filter/lwpfont.hxx
+++ b/lotuswordpro/source/filter/lwpfont.hxx
@@ -280,8 +280,8 @@ public:
private:
void Override(sal_uInt32 fontID, rtl::Reference<XFFont> const & pFont);
- inline sal_uInt16 GetFontNameIndex(sal_uInt32 fontID);
- inline sal_uInt16 GetFontAttrIndex(sal_uInt32 fontID);
+ static inline sal_uInt16 GetFontNameIndex(sal_uInt32 fontID);
+ static inline sal_uInt16 GetFontAttrIndex(sal_uInt32 fontID);
};
sal_uInt16 LwpFontManager::GetFontNameIndex(sal_uInt32 fontID)
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index 86c69ff..0964eda 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -206,7 +206,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout()
LwpEnSuperTableLayout* pEnSuperLayout = FindFootnoteTableLayout();
if(pEnSuperLayout)
{
- LwpTableLayout* pTableLayout = static_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
+ LwpTableLayout* pTableLayout = dynamic_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
if(pTableLayout)
{
LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
@@ -372,7 +372,7 @@ LwpEnSuperTableLayout* LwpFootnote::FindFootnoteTableLayout()
while ((pContent = pFoundry->EnumContents(pContent)) != NULL)
if (pContent->IsTable() && (strClassName.equals(pContent->GetClassName())) &&
- pContent->IsActive() && pContent->GetLayout(NULL))
+ pContent->IsActive() && pContent->GetLayout(nullptr).is())
{
// Found it!
return static_cast<LwpEnSuperTableLayout *>(
@@ -390,7 +390,7 @@ LwpContent* LwpFootnote::FindFootnoteContent()
LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj().get());
//if the content has layout, the content has footnote contents;
//or looking for the celllayout and return the footnote contents.
- if(pContent && pContent->GetLayout(NULL))
+ if (pContent && pContent->GetLayout(nullptr).is())
return pContent;
LwpCellLayout* pCellLayout = GetCellLayout();
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 284fca2..1d44e18 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -111,7 +111,7 @@ void LwpFoundry::Read(LwpObjectStream *pStrm)
{
if (!m_pDoc->IsChildDoc())
{
- m_VerMgr.Read(pStrm);
+ LwpVersionManager::Read(pStrm);
}
m_ObjMgr.Read(pStrm);
@@ -233,18 +233,21 @@ void LwpFoundry::RegisterAllLayouts()
LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
{
- LwpDLVListHeadHolder* pHeadHolder= static_cast
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast
<LwpDLVListHeadHolder*>(m_BookMarkHead.obj().get());
+
+ if (!pHeadHolder)
+ return nullptr;
+
LwpObjectID& rObjID = pHeadHolder->GetHeadID();
- LwpBookMark* pBookMark;
- pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+ LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
while (pBookMark)
{
if (pBookMark->IsRightMarker(objMarker))
return pBookMark;
rObjID = pBookMark->GetNext();
- pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+ pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
}
return NULL;
}
@@ -273,7 +276,7 @@ LwpSection* LwpFoundry::EnumSections(LwpSection * pSection)
*/
LwpObjectID * LwpFoundry::GetDefaultTextStyle()
{
- LwpVersionedPointer * pPointer = static_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
+ LwpVersionedPointer * pPointer = dynamic_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
if (!pPointer)
return NULL;
@@ -287,16 +290,16 @@ LwpObjectID * LwpFoundry::GetDefaultTextStyle()
LwpObjectID * LwpFoundry::FindParaStyleByName(const OUString& name)
{
//Register all text styles: para styles, character styles
- LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
+ LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
if(pParaStyleHolder)
{
- LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
+ LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
while(pParaStyle)
{
OUString strName = pParaStyle->GetName().str();
if(strName == name)
return &pParaStyle->GetObjectID();
- pParaStyle = static_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
+ pParaStyle = dynamic_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
}
}
@@ -405,8 +408,8 @@ LwpContent* LwpContentManager::EnumContents(LwpContent* pContent)
{
if(pContent)
return pContent->GetNextEnumerated();
- LwpVersionedPointer* pPointer = static_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
- return pPointer ? static_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : NULL;
+ LwpVersionedPointer* pPointer = dynamic_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
+ return pPointer ? dynamic_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : nullptr;
}
void LwpPieceManager::Read(LwpObjectStream *pStrm)
@@ -457,14 +460,14 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
{
// If Last has a next, return it.
if(pLast && !pLast->GetNext().IsNull())
- return static_cast<LwpOrderedObject*>(pLast->GetNext().obj().get());
+ return dynamic_cast<LwpOrderedObject*>(pLast->GetNext().obj().get());
LwpListList* pList = NULL;
if(pLast)
{
// We're at the end of Last's list (not Liszt's list).
// Start with the next active list
- pList = static_cast<LwpListList*>(pLast->GetListList().obj().get());
+ pList = dynamic_cast<LwpListList*>(pLast->GetListList().obj().get());
pList= GetNextActiveListList(pList);
}
else
@@ -475,7 +478,7 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
if(pList)
{
- return static_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
+ return dynamic_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
}
return NULL;
@@ -489,23 +492,22 @@ LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
{
LwpListList* pList = NULL;
if(pLast)
- pList = static_cast<LwpListList*>(pLast->GetNext().obj().get());
+ pList = dynamic_cast<LwpListList*>(pLast->GetNext().obj().get());
else
{
- LwpDLVListHeadHolder* pHeadHolder= static_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
if(pHeadHolder)
{
- pList = static_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
+ pList = dynamic_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
}
}
while(pList)
{
- LwpContent* pContent = static_cast<LwpContent*>(pList->GetObject().obj().get());
- if(pContent && pContent->HasNonEmbeddedLayouts() &&
- !pContent->IsStyleContent())
+ LwpContent* pContent = dynamic_cast<LwpContent*>(pList->GetObject().obj().get());
+ if (pContent && pContent->HasNonEmbeddedLayouts() && !pContent->IsStyleContent())
return pList;
- pList = static_cast<LwpListList*>(pList->GetNext().obj().get());
+ pList = dynamic_cast<LwpListList*>(pList->GetNext().obj().get());
}
return NULL;
}
diff --git a/lotuswordpro/source/filter/lwpfoundry.hxx b/lotuswordpro/source/filter/lwpfoundry.hxx
index 51fbf50..3f137c2 100644
--- a/lotuswordpro/source/filter/lwpfoundry.hxx
+++ b/lotuswordpro/source/filter/lwpfoundry.hxx
@@ -72,6 +72,7 @@
#include "lwpbasetype.hxx"
#include "lwpfont.hxx"
#include "lwpdropcapmgr.hxx"
+#include <unordered_map>
class LwpDocument;
class LwpBookMark;
@@ -85,8 +86,8 @@ public:
LwpVersionManager(){}
~LwpVersionManager(){}
public:
- void Read(LwpObjectStream *pStrm);
- void Skip(LwpObjectStream *pStrm);
+ static void Read(LwpObjectStream *pStrm);
+ static void Skip(LwpObjectStream *pStrm);
};
class LwpObjectManager
@@ -309,7 +310,7 @@ private:
}
};
- typedef boost::unordered_map<LwpObjectID, IXFStyle*, hashFunc, eqFunc> LwpStyleMap;
+ typedef std::unordered_map<LwpObjectID, IXFStyle*, hashFunc, eqFunc> LwpStyleMap;
LwpStyleMap m_StyleList;
public:
void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index feff262..19944f7 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -190,35 +190,35 @@ void LwpFrame::RegisterStyle(XFFrameStyle* pFrameStyle)
void LwpFrame::XFConvert(XFContentContainer* pCont)
{
// parse the frame which anchor to page
- LwpVirtualLayout* pParent = m_pLayout->GetParentLayout();
- if (!pParent)
+ rtl::Reference<LwpVirtualLayout> xParent = m_pLayout->GetParentLayout();
+ if (!xParent.is())
throw std::runtime_error("missing Parent Layout");
- if(pParent->IsPage()&& pParent->GetParentLayout()->IsPage())
+ if (xParent->IsPage() && xParent->GetParentLayout().is() && xParent->GetParentLayout()->IsPage())
{
//for mirror page, problems exist if the parent layout is header or footer layout,
- pParent = pParent->GetParentLayout();
+ xParent = xParent->GetParentLayout();
}
- if(m_pLayout->IsAnchorPage()&& pParent->IsPage())
+ if(m_pLayout->IsAnchorPage()&& xParent->IsPage())
{
//get parent layout
if(m_pLayout->IsUseOnPage())
{
- sal_Int32 nPageNo = pParent->GetPageNumber(m_pLayout->GetUsePage());
+ sal_Int32 nPageNo = xParent->GetPageNumber(m_pLayout->GetUsePage());
if(nPageNo>0)
m_pLayout->XFConvertFrame(pCont, nPageNo);
}
else if(m_pLayout->IsUseOnAllPages())
{
- sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
- sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
if(nLast > 0)
m_pLayout->XFConvertFrame(pCont, nFirst, nLast, true);
}
else if(m_pLayout->IsUseOnAllOddPages()||m_pLayout->IsUseOnAllEvenPages())
{
- sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
- sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
if(nLast > 0)
{
sal_uInt16 first = static_cast<sal_uInt16>(nFirst);
@@ -257,7 +257,8 @@ void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
//between the frame object and page margins
eWrap = enumXFWrapBest;
- LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
if(pParent)
{
if(IsLeftWider())
@@ -275,7 +276,7 @@ void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
case LwpPlacableLayout::LAY_NO_WRAP_AROUND:
{
eWrap = enumXFWrapRunThrough;
- if(!m_pLayout->GetBackColor() && !m_pLayout->GetWaterMarkLayout())
+ if(!m_pLayout->GetBackColor() && !m_pLayout->GetWaterMarkLayout().is())
{
//pFrameStyle->SetBackGround(sal_True);
XFColor aXFColor(0xffffff); //white color
@@ -400,7 +401,7 @@ void LwpFrame::ApplyBackColor(XFFrameStyle* pFrameStyle)
*/
void LwpFrame::ApplyProtect(XFFrameStyle* pFrameStyle)
{
- if(m_pLayout->IsProtected())
+ if(m_pLayout->GetIsProtected())
{
pFrameStyle->SetProtect(true,true,true);
}
@@ -437,8 +438,8 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
//set vertical position
if(m_pLayout->IsAnchorPage())//in page
{
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
{
//Only anchor to para, the frame can display in header and footer of each page
eYPos = enumXFFrameYPosFromTop; //from top
@@ -470,15 +471,15 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
eYPos = enumXFFrameYPosBelow; //below
eYRel = enumXFFrameYRelChar; //from char
//set vertical position
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && pContainer->IsPage())//in page
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
{
//eYPos = enumXFFrameYPosFromTop;
//eYRel = enumXFFrameYRelPage;
eYPos = enumXFFrameYPosBelow;
eYRel = enumXFFrameYRelChar;
}
- else if(pContainer && pContainer->IsFrame()) //in frame
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
{
eYPos = enumXFFrameYPosFromTop;
eYRel = enumXFFrameYRelPage;
@@ -539,12 +540,13 @@ void LwpFrame::ApplyWatermark(XFFrameStyle *pFrameStyle)
{
pFrameStyle->SetBackImage(pBGImage);
//set watermark transparent
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*>(m_pLayout->GetWaterMarkLayout());
- LwpBackgroundStuff* pBackgroundStuff = pLay->GetBackgroundStuff();
- if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
- {
- pFrameStyle->SetTransparency(100);
- }
+ rtl::Reference<LwpVirtualLayout> xWaterMarkLayout(m_pLayout->GetWaterMarkLayout());
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xWaterMarkLayout.get());
+ LwpBackgroundStuff* pBackgroundStuff = pLay ? pLay->GetBackgroundStuff() : nullptr;
+ if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
+ {
+ pFrameStyle->SetTransparency(100);
+ }
}
}
@@ -617,11 +619,11 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
//anchor to page, frame and cell
if(m_pLayout->IsAnchorPage())//in page
{
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
{
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
else
eAnchor = enumXFAnchorPage;
@@ -634,8 +636,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
{
//eAnchor = enumXFAnchorChar;
eAnchor = enumXFAnchorPara;
- LwpMiddleLayout* pContainer = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
- if(pContainer)
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pContainer = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
+ if (pContainer)
{
fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
}
@@ -645,26 +648,26 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
case LwpLayoutRelativityGuts::LAY_PARA_RELATIVE: //same page as text
{
eAnchor = enumXFAnchorChar;
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && pContainer->IsPage())//in page
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
{
//eAnchor = enumXFAnchorPage;
eAnchor = enumXFAnchorChar;// to character
}
- else if(pContainer && pContainer->IsFrame()) //in frame
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
{
eAnchor = enumXFAnchorFrame;
}
- else if(pContainer && pContainer->IsCell()) //in cell
+ else if (xContainer.is() && xContainer->IsCell()) //in cell
{
//eAnchor = enumXFAnchorChar;
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
- else if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))//in header or footer
+ else if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))//in header or footer
{
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
break;
}
@@ -692,7 +695,6 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
//because of the different feature between Word Pro and SODC, I simulate the vertical base offset
//between anchor and frame origin using the font height.
- //LwpPara* pPara = static_cast<LwpPara*>(m_pLayout->GetPosition()->obj());
rtl::Reference<XFFont> pFont = m_pLayout->GetFont();
if(pFont.is())
{
@@ -717,9 +719,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
*/
bool LwpFrame::IsLeftWider()
{
- //LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*>(m_pLayout->GetContainerLayout());
- if(pParent)
+ rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(xLayout.get());
+ if (pParent)
{
LwpPoint aPoint = m_pLayout->GetOrigin();
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
@@ -917,10 +919,13 @@ bool LwpFrameLayout::IsForWaterMark()
{
if(m_nBuoyancy >=LAY_BUOYLAYER)
{
- if(!m_Content.IsNull() && (m_Content.obj()->GetTag()==VO_GRAPHIC) )
- {
+ if (m_Content.IsNull())
+ return false;
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (!content.is())
+ return false;
+ if (content->GetTag() == VO_GRAPHIC)
return true;
- }
}
return false;
}
@@ -947,8 +952,9 @@ double LwpFrameLayout::GetWidth()
double LwpFrameLayout::GetMaxWidth()
{
double fActualWidth = 0;
- LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(GetContainerLayout());
- if(pParent)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get());
+ if (pParent)
{
LwpPoint aPoint = GetOrigin();
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
@@ -1098,11 +1104,11 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
m_pFrame->Parse(pXFFrame, nStart);
//add child frame into group
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
while(pLayout)
{
pLayout->XFConvert(pXFFrame);
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
}
pCont ->Add(pXFFrame);
@@ -1181,12 +1187,12 @@ void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
{
pStory->SetDropcapFlag(true);
pStory->SetFoundry(pFoundry);
- LwpPara* pPara = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
while(pPara)
{
pPara->SetFoundry(pFoundry);
pPara->RegisterStyle();
- pPara = static_cast<LwpPara*>(pPara->GetNext().obj().get());
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
}
}
}
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index 79de8dc..96833c7 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -247,7 +247,7 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
//note by ,1-27
rtl::Reference<XFFont> pFont;
XFTextStyle* pStyle = NULL;
- m_StyleName = "";
+ m_StyleName.clear();
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
XFTextStyle* pNamedStyle = nullptr;
if (m_pModifiers->HasCharStyle && pFoundry)
@@ -257,11 +257,13 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
}
if (pNamedStyle)
{
+ LwpCharacterStyle* pCharStyle = nullptr;
if (m_pModifiers->FontID && pFoundry)
+ pCharStyle = dynamic_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
+ if (pCharStyle)
{
pStyle = new XFTextStyle();
*pStyle = *pNamedStyle;
- LwpCharacterStyle* pCharStyle = static_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
pStyle->SetStyleName("");
pFont = pFoundry->GetFontManger().CreateOverrideFont(pCharStyle->GetFinalFontID(),m_pModifiers->FontID);
@@ -383,7 +385,7 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
/**
* @descr: Whether there are other fribs following current frib.
-* @return: Ture if having following fribs, or false.
+* @return: True if having following fribs, or false.
*/
bool LwpFrib::HasNextFrib()
{
diff --git a/lotuswordpro/source/filter/lwpfribbreaks.cxx b/lotuswordpro/source/filter/lwpfribbreaks.cxx
index eaaf919..c6ebad1 100644
--- a/lotuswordpro/source/filter/lwpfribbreaks.cxx
+++ b/lotuswordpro/source/filter/lwpfribbreaks.cxx
@@ -80,12 +80,9 @@ void LwpFribColumnBreak::RegisterBreakStyle(LwpPara * pPara)
*pOverStyle = *pBaseStyle;
pOverStyle->SetStyleName("");
- //Old code
- //if (static_cast<LwpStory*>(pPara->GetStoryID()->obj())
- // ->GetCurrentLayout()->GetNumCols() == 1)
//New code
- LwpStory* pStory = static_cast<LwpStory*>(pPara->GetStoryID().obj().get());
- LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : NULL;
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPara->GetStoryID().obj().get());
+ LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
if( pCurLayout && (pCurLayout->GetNumCols() == 1) )
{
@@ -129,7 +126,7 @@ void LwpFribPageBreak::RegisterBreakStyle(LwpPara* pPara)
XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
if (pBaseStyle == NULL) return;
- LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(m_Layout.obj().get());
+ LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(m_Layout.obj().get());
if(pLayout)
{
m_pMasterPage = new LwpMasterPage(pPara, pLayout);
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
index 9f0161e..6b1d5f8 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -156,13 +156,13 @@ void LwpFribFrame::XFConvert(XFContentContainer* pCont)
sal_uInt8 nType = pLayout->GetRelativeType();
if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
{
- LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
- if(pContainerLayout && pContainerLayout->IsFrame())
+ rtl::Reference<LwpVirtualLayout> xContainerLayout(pLayout->GetContainerLayout());
+ if (xContainerLayout.is() && xContainerLayout->IsFrame())
{
//same page as text and in frame
pXFContentContainer = m_pPara->GetXFContainer();
}
- else if(pContainerLayout && pContainerLayout->IsCell())
+ else if (xContainerLayout.is() && xContainerLayout->IsCell())
{
//same page as text and in cell, get the first xfpara
rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index ff502d2..2a51e0e 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -261,7 +261,7 @@ void LwpFribField::XFConvert(XFContentContainer* pXFPara)
//end marker
if (type == MARKER_END)
{
- if (pFieldMark->GetStart() == false)
+ if (!pFieldMark->GetStart())
return;
if (pFieldMark->IsFormulaInsert())
{
diff --git a/lotuswordpro/source/filter/lwpfribmark.hxx b/lotuswordpro/source/filter/lwpfribmark.hxx
index 93b8ca1..cf84841 100644
--- a/lotuswordpro/source/filter/lwpfribmark.hxx
+++ b/lotuswordpro/source/filter/lwpfribmark.hxx
@@ -144,7 +144,7 @@ private:
void ConvertDocFieldEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
void ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
void ConvertDateTimeEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
- void ConvertCrossRefEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
+ static void ConvertCrossRefEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
void ConvertCrossRefStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark);
};
diff --git a/lotuswordpro/source/filter/lwpfribptr.hxx b/lotuswordpro/source/filter/lwpfribptr.hxx
index 8892b3f..ada571f 100644
--- a/lotuswordpro/source/filter/lwpfribptr.hxx
+++ b/lotuswordpro/source/filter/lwpfribptr.hxx
@@ -82,7 +82,7 @@ private:
LwpFrib* m_pFribs;
XFParagraph* m_pXFPara;//for parse ,add by 1-17 //Current XFPara used for frib parsing
LwpPara* m_pPara;//for get foundry, add by 1-17
- void ProcessDropcap(LwpStory* pStory,LwpFrib* pFrib,sal_uInt32 nLen);
+ static void ProcessDropcap(LwpStory* pStory,LwpFrib* pFrib,sal_uInt32 nLen);
public:
// String GetText();
void XFConvert();
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index e24faf8..74cc81d 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -102,7 +102,7 @@ void LwpFribSection::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
*/
LwpSection* LwpFribSection::GetSection()
{
- return static_cast<LwpSection*>(m_Section.obj().get());
+ return dynamic_cast<LwpSection*>(m_Section.obj().get());
}
/**
@@ -126,11 +126,12 @@ void LwpFribSection::RegisterSectionStyle()
void LwpFribSection::SetSectionName()
{
LwpSection* pSection = GetSection();
- if(pSection)
- {
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- pStory->SetSectionName(pSection->GetSectionName());
- }
+ if (!pSection)
+ return;
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return;
+ pStory->SetSectionName(pSection->GetSectionName());
}
/**
@@ -164,7 +165,7 @@ void LwpFribSection::ParseSection()
m_pMasterPage->ParseSection(this);
}
}
- else if (LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
+ else if (LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
{
rtl::Reference<LwpObject> xObj(m_Section.obj());
if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION)
@@ -172,16 +173,6 @@ void LwpFribSection::ParseSection()
//create a new section and add it to container
XFIndex* pIndex = new XFIndex;
pIndex->SetIndexType(enumXFIndexAlphabetical);
- /*
- sal_Bool bRunin = sal_False;
- sal_Bool bSeparator = sal_False;
- LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj());
- if (pIndexSection->IsFormatRunin())
- bRunin = sal_True;
- if (pIndexSection->IsFormatSeparator())
- bSeparator = sal_True;
- pIndex->SetDefaultAlphaIndex("",bRunin,bSeparator);
- */
SetDefaultAlphaIndex(pIndex);
pStory->AddXFContent( pIndex );
@@ -200,9 +191,9 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
LwpFoundry* pFoundry = m_pPara->GetFoundry();
OUString styleName = pFoundry->FindActuralStyleName("Separator");
- LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj().get());
+ LwpIndexSection* pIndexSection = dynamic_cast<LwpIndexSection*>(m_Section.obj().get());
XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
- if (pIndexSection->IsFormatSeparator())
+ if (pIndexSection && pIndexSection->IsFormatSeparator())
{
pXFIndex->SetSeparator(true);
pTemplateSep->AddEntry(enumXFIndexTemplateText,"");
@@ -228,7 +219,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
pTemplate3->AddEntry(enumXFIndexTemplateTab,"");
pTemplate3->AddEntry(enumXFIndexTemplatePage,"");
- if (pIndexSection->IsFormatRunin())
+ if (pIndexSection && pIndexSection->IsFormatRunin())
{
//pXFIndex->AddTemplate(OUString::number(2),"Primary",pTemplate2);
//pXFIndex->AddTemplate(OUString::number(3),"Primary",pTemplate3);
@@ -256,10 +247,13 @@ LwpMasterPage::LwpMasterPage(LwpPara* pPara, LwpPageLayout* pLayout)
*/
bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
- //if there is no other frib after current firb, register master page in starting para of next page
- if(IsNextPageType()&&(!pFrib->HasNextFrib()))
+ //if there is no other frib after current frib, register master page in starting para of next page
+ LwpStory* pStory = nullptr;
+ if (IsNextPageType()&&(!pFrib->HasNextFrib()))
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+
+ if (pStory)
{
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
pStory->SetCurrentLayout(m_pLayout);
RegisterFillerPageStyle();
return false;
@@ -290,14 +284,17 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
case LwpLayout::StartOnOddPage: //fall through
case LwpLayout::StartOnEvenPage:
{
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- pStory->SetCurrentLayout(m_pLayout);
- //get odd page layout when the current pagelayout is mirror
- m_pLayout = pStory->GetCurrentLayout();
- m_bNewSection = IsNeedSection();
- //bSectionColumns = m_bNewSection;
- pOverStyle->SetMasterPage( m_pLayout->GetStyleName());
- RegisterFillerPageStyle();
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (pStory)
+ {
+ pStory->SetCurrentLayout(m_pLayout);
+ //get odd page layout when the current pagelayout is mirror
+ m_pLayout = pStory->GetCurrentLayout();
+ m_bNewSection = IsNeedSection();
+ //bSectionColumns = m_bNewSection;
+ pOverStyle->SetMasterPage( m_pLayout->GetStyleName());
+ RegisterFillerPageStyle();
+ }
break;
}
default:
@@ -305,7 +302,10 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
}
//register tab style;
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return false;
+
pStory->SetTabLayout(m_pLayout);
m_pPara->RegisterTabStyle(pOverStyle);
@@ -316,8 +316,8 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
XFSectionStyle* pSectStyle= new XFSectionStyle();
//set margin
- pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- if(pStory)
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (pStory)
{
LwpPageLayout* pCurrentLayout = pStory->GetCurrentLayout();
double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT)- pCurrentLayout->GetMarginsValue(MARGIN_LEFT);
@@ -348,9 +348,9 @@ bool LwpMasterPage::IsNeedSection()
{
bool bNewSection = false;
//get story
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
//if pagelayout is modified, register the pagelayout
- if(pStory->IsPMModified())
+ if (pStory && pStory->IsPMModified())
{
bNewSection = pStory->IsNeedSection();
}
@@ -396,8 +396,8 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
XFContentContainer* pContent = CreateXFSection();
if(pContent)
{
- LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
- //delete the additional blank para, 06/28/2005
+ LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ //delete the additional blank para
XFParagraph* pCurrPara = rFribPtr.GetXFPara();
if(!pCurrPara->HasContents())
{
@@ -407,13 +407,13 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
pCurrContainer->RemoveLastContent();
}
}
- //end,06/28/2005
- pStory->AddXFContent( pContent );
+ if (pStory)
+ pStory->AddXFContent( pContent );
}
else
{
- LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
- pContent = pStory->GetXFContent();
+ LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ pContent = pStory ? pStory->GetXFContent() : nullptr;
}
if(pContent)
{
diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx
index 59500d8..9b69ac7 100644
--- a/lotuswordpro/source/filter/lwpfribtable.cxx
+++ b/lotuswordpro/source/filter/lwpfribtable.cxx
@@ -73,7 +73,7 @@ void LwpFribTable::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
LwpSuperTableLayout* LwpFribTable::GetSuperTable()
{
- return static_cast<LwpSuperTableLayout*>(m_objTable.obj().get());
+ return dynamic_cast<LwpSuperTableLayout*>(m_objTable.obj().get());
}
void LwpFribTable::RegisterNewStyle()
@@ -103,11 +103,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
if (!pSuper)
return;
sal_uInt8 nType = pSuper->GetRelativeType();
- LwpVirtualLayout* pContainer = pSuper->GetContainerLayout();
- if (!pContainer)
+ rtl::Reference<LwpVirtualLayout> xContainer(pSuper->GetContainerLayout());
+ if (!xContainer.is())
return;
if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
- && !pContainer->IsCell())
+ && !xContainer->IsCell())
{
pXFContentContainer = m_pPara->GetXFContainer();
//delete the additional blank para, 06/28/2005
@@ -124,11 +124,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
else if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
{
//same page as text and in frame
- if(pContainer->IsFrame())
+ if (xContainer->IsFrame())
{
pXFContentContainer = m_pPara->GetXFContainer();
}
- else if(pContainer->IsCell())
+ else if (xContainer->IsCell())
{
//same page as text and in cell, get the first xfpara
rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwpfribtable.hxx b/lotuswordpro/source/filter/lwpfribtable.hxx
index f7d0acb..7c24562 100644
--- a/lotuswordpro/source/filter/lwpfribtable.hxx
+++ b/lotuswordpro/source/filter/lwpfribtable.hxx
@@ -67,7 +67,7 @@ public:
void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) SAL_OVERRIDE;
LwpSuperTableLayout* GetSuperTable();
void RegisterNewStyle();
- virtual void XFConvert(XFContentContainer* pCont);
+ void XFConvert(XFContentContainer* pCont);
private:
LwpObjectID m_objTable;
};
diff --git a/lotuswordpro/source/filter/lwpfribtext.cxx b/lotuswordpro/source/filter/lwpfribtext.cxx
index 42da9cd..c87818f 100644
--- a/lotuswordpro/source/filter/lwpfribtext.cxx
+++ b/lotuswordpro/source/filter/lwpfribtext.cxx
@@ -98,7 +98,7 @@ void LwpFribText::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
rEncode = LwpCharSetMgr::GetInstance()->
GetTextCharEncoding(m_pModifiers->CodePage);
else
- rEncode = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
+ rEncode = LwpCharSetMgr::GetTextCharEncoding();
}
LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
}
@@ -413,7 +413,7 @@ void LwpFribUnicode::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
rEncode = LwpCharSetMgr::GetInstance()->
GetTextCharEncoding(m_pModifiers->CodePage);
else
- rEncode = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
+ rEncode = LwpCharSetMgr::GetTextCharEncoding();
LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 4c9f3ce..29888eb 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -136,11 +136,11 @@ void LwpGraphicObject::Read()
}
if (nServerContextSize == 0)
{
- if (strcmp((char *)m_sServerContextFormat, ".cht") == 0 &&
- strcmp((char *)m_sDataFormat, ".sdw") == 0)
+ if (strcmp(reinterpret_cast<char *>(m_sServerContextFormat), ".cht") == 0 &&
+ strcmp(reinterpret_cast<char *>(m_sDataFormat), ".sdw") == 0)
{
- strcpy((char *)m_sServerContextFormat, ".lch");
- strcpy((char *)m_sDataFormat, ".lch");
+ strcpy(reinterpret_cast<char *>(m_sServerContextFormat), ".lch");
+ strcpy(reinterpret_cast<char *>(m_sDataFormat), ".lch");
}
}
m_nCachedBaseLine = m_pObjStrm->QuickReadInt32();
@@ -203,7 +203,7 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
pCont->Add(iter->get());
}
}
- else if (this->IsGrafFormatValid())
+ else if (this->IsGrafFormatValid() && !m_vXFDrawObjects.empty())
{
XFImage* pImage = static_cast<XFImage*>(m_vXFDrawObjects.front().get());
@@ -277,8 +277,8 @@ void LwpGraphicObject::RegisterStyle()
if (m_sServerContextFormat[1]=='l'&&m_sServerContextFormat[2]=='c'&&m_sServerContextFormat[3]=='h')
{
- LwpVirtualLayout* pMyLayout = GetLayout(NULL);
- if (pMyLayout && pMyLayout->IsFrame())
+ rtl::Reference<LwpVirtualLayout> xMyLayout(GetLayout(nullptr));
+ if (xMyLayout.is() && xMyLayout->IsFrame())
{
XFFrameStyle* pXFFrameStyle = new XFFrameStyle();
pXFFrameStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
@@ -308,7 +308,7 @@ void LwpGraphicObject::CreateDrawObjects()
// get graphic object's bento objet name
LwpObjectID& rMyID = this->GetObjectID();
std::string aGrfObjName;
- this->GetBentoNamebyID(rMyID, aGrfObjName);
+ GetBentoNamebyID(rMyID, aGrfObjName);
// get bento stream by the name
pBentoContainer->CreateGraphicStream(pDrawObjStream, aGrfObjName.c_str());
@@ -360,7 +360,7 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData)
// get graphic object's bento objet name
LwpObjectID& rMyID = this->GetObjectID();
std::string aGrfObjName;
- this->GetBentoNamebyID(rMyID, aGrfObjName);
+ GetBentoNamebyID(rMyID, aGrfObjName);
// get bento stream by the name
pBentoContainer->CreateGraphicStream(pGrafStream, aGrfObjName.c_str());
@@ -403,7 +403,7 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
// get graphic object's bento objet name
LwpObjectID& rMyID = this->GetObjectID();
std::string aGrfObjName;
- this->GetBentoNamebyID(rMyID, aGrfObjName);
+ GetBentoNamebyID(rMyID, aGrfObjName);
char sDName[64]="";
sprintf(sDName, "%s-D", aGrfObjName.c_str());
@@ -701,7 +701,7 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
{
pEquData[nIndex] = pGrafData[nBegin + nIndex];
}
- pXFNotePara->Add(OUString((sal_Char*)pEquData, (nEnd - nBegin + 1), osl_getThreadTextEncoding()));
+ pXFNotePara->Add(OUString(reinterpret_cast<char*>(pEquData), (nEnd - nBegin + 1), osl_getThreadTextEncoding()));
delete [] pEquData;
}
pXFNote->Add(pXFNotePara);
diff --git a/lotuswordpro/source/filter/lwpgrfobj.hxx b/lotuswordpro/source/filter/lwpgrfobj.hxx
index 473a23f..481b437 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.hxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.hxx
@@ -124,7 +124,7 @@ public:
// add by , 03/25/2005
void CreateDrawObjects();
void CreateGrafObject();
- void GetBentoNamebyID(LwpObjectID& rMyID, std::string& rName);
+ static void GetBentoNamebyID(LwpObjectID& rMyID, std::string& rName);
sal_uInt32 GetRawGrafData(sal_uInt8*& pGrafData);
sal_uInt32 GetGrafData(sal_uInt8*& pGrafData);
void GetGrafOrgSize(long& rWidth, long& rHeight) { rWidth = m_Cache.Width; rHeight = m_Cache.Height; }
diff --git a/lotuswordpro/source/filter/lwpheader.hxx b/lotuswordpro/source/filter/lwpheader.hxx
index b09ce25..0643a99 100644
--- a/lotuswordpro/source/filter/lwpheader.hxx
+++ b/lotuswordpro/source/filter/lwpheader.hxx
@@ -63,10 +63,9 @@
#include <config_lgpl.h>
#include <math.h>
-#include <vector>
#include <memory>
-#include <boost/unordered_map.hpp>
#include <map>
+#include <vector>
#include <assert.h>
#include <string>
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index f26c156..de77f9c 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -78,6 +78,11 @@
LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
+ , m_bGettingHonorProtection(false)
+ , m_bGettingMarginsSameAsParent(false)
+ , m_bGettingHasProtection(false)
+ , m_bGettingIsProtected(false)
+ , m_bGettingMarginsValue(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
@@ -109,7 +114,7 @@ void LwpVirtualLayout::Read()
bool LwpVirtualLayout::MarginsSameAsParent()
{
- return m_nAttributes2 & STYLE2_MARGINSSAMEASPARENT ? sal_True : sal_False;
+ return (m_nAttributes2 & STYLE2_MARGINSSAMEASPARENT) != 0;
}
/**
@@ -143,21 +148,17 @@ bool LwpVirtualLayout::HonorProtection()
if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
return false;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- return pParent->HonorProtection();
+ return xParent->GetHonorProtection();
}
if(m_pFoundry)//is null now
{
LwpDocument* pDoc = m_pFoundry->GetDocument();
- /*if(pDoc)
- {
- return pDoc->HonorProtection();
- }*/
if(pDoc && pDoc->GetRootDocument())
- return pDoc->GetRootDocument()->HonorProtection();
+ return pDoc->GetRootDocument()->GetHonorProtection();
}
return true;
@@ -171,10 +172,10 @@ bool LwpVirtualLayout::IsProtected()
{
bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected))
+ if (xParent->GetHonorProtection() && (xParent->GetHasProtection()||bProtected))
{
return true;
}
@@ -184,7 +185,7 @@ bool LwpVirtualLayout::IsProtected()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- if (pDoc->HonorProtection() && bProtected)
+ if (pDoc->GetHonorProtection() && bProtected)
{
return true;
}
@@ -203,10 +204,10 @@ bool LwpVirtualLayout::HasProtection()
if(m_nAttributes & STYLE_PROTECTED)
return true;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- return pParent->HasProtection();
+ return xParent->GetHasProtection();
}
return false;
@@ -218,7 +219,7 @@ bool LwpVirtualLayout::HasProtection()
*/
bool LwpVirtualLayout::IsComplex()
{
- return m_nAttributes & STYLE_COMPLEX ? sal_True : sal_False;
+ return (m_nAttributes & STYLE_COMPLEX) != 0;
}
/**
@@ -234,9 +235,9 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
if(GetLayoutType()!=LWP_PAGE_LAYOUT)
{
//get parent
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT))
- return pParent->GetUseWhen();
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader() && (xParent->GetLayoutType() != LWP_PAGE_LAYOUT))
+ return xParent->GetUseWhen();
}
@@ -344,9 +345,9 @@ bool LwpVirtualLayout::IsMinimumHeight()
* @descr: Get parent layout
*
*/
-LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
+rtl::Reference<LwpVirtualLayout> LwpVirtualLayout::GetParentLayout()
{
- return dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
}
/**
@@ -356,12 +357,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
void LwpVirtualLayout::RegisterChildStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.is())
{
- pLayout->SetFoundry(m_pFoundry);
- pLayout->RegisterStyle();
- pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ xLayout->SetFoundry(m_pFoundry);
+ xLayout->RegisterStyle();
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
}
}
@@ -375,9 +376,9 @@ bool LwpVirtualLayout::IsStyleLayout()
if (m_nAttributes3 & STYLE3_STYLELAYOUT)
return true;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get());
- if (pParent)
- return pParent->IsStyleLayout();
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is())
+ return xParent->IsStyleLayout();
return false;
}
@@ -445,42 +446,40 @@ void LwpAssociatedLayouts::Read(LwpObjectStream* pStrm)
* @descr: Looking for the layout which follows the pStartLayout
* @param: pStartLayout - the layout which is used for looking for its following layout
*/
-LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout)
+rtl::Reference<LwpVirtualLayout> LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout)
{
if (!pStartLayout && !m_OnlyLayout.IsNull())
/* Looking for the first layout and there's only one layout in the list.*/
- return dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get());
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get()));
- LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get());
- if(pObjHolder)
+ rtl::Reference<LwpObjectHolder> xObjHolder(dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get()));
+ if (xObjHolder.is())
{
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
- if(!pStartLayout )
- return pLayout;
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ if (!pStartLayout)
+ return xLayout;
- while(pObjHolder && pStartLayout != pLayout)
+ while (xObjHolder.is() && pStartLayout != xLayout.get())
{
- pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext().obj().get());
- if(pObjHolder)
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
{
- pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
}
}
- if(pObjHolder)
+ if (xObjHolder.is())
{
- pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext().obj().get());
- if(pObjHolder)
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
{
- pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
- return pLayout;
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ return xLayout;
}
}
-
- //return pLayout;
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
LwpHeadLayout::LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
@@ -499,27 +498,27 @@ void LwpHeadLayout::Read()
void LwpHeadLayout::RegisterStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.is())
{
- pLayout->SetFoundry(m_pFoundry);
+ xLayout->SetFoundry(m_pFoundry);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list