[Libreoffice-commits] .: sw/source
Michael Meeks
michael at kemper.freedesktop.org
Tue Jun 21 09:32:42 PDT 2011
sw/source/filter/ww8/ww8par.cxx | 92 ++++++++++++++------------
sw/source/filter/ww8/ww8par.hxx | 135 +++++++++++++++++++++++++++++++++++++--
sw/source/filter/ww8/ww8par2.cxx | 71 +++++++++++---------
sw/source/filter/ww8/ww8par2.hxx | 121 ----------------------------------
sw/source/filter/ww8/ww8par3.cxx | 15 +++-
sw/source/filter/ww8/ww8par5.cxx | 8 +-
sw/source/filter/ww8/ww8par6.cxx | 76 ++++++++++-----------
7 files changed, 274 insertions(+), 244 deletions(-)
New commits:
commit 28a56883c2887c44d8892d80bf0ee90ebdc58b48
Author: Marc-André Laverdière <marc-andre at atc.tcs.com>
Date: Tue Jun 21 12:16:57 2011 +0100
switch to using a vector for styles, and add many range checks
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4c457d5..6aad1e2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -957,9 +957,9 @@ void SwWW8ImplReader::Read_StyleCode( sal_uInt16, const sal_uInt8* pData, short
nColl = *pData;
else
nColl = SVBT16ToShort(pData);
- if (nColl < nColls)
+ if (nColl < vColl.size())
{
- SetTxtFmtCollAndListLevel( *pPaM, pCollA[nColl] );
+ SetTxtFmtCollAndListLevel( *pPaM, vColl[nColl] );
bCpxStyle = true;
}
}
@@ -1207,8 +1207,8 @@ const SfxPoolItem* SwWW8FltControlStack::GetFmtAttr(const SwPosition& rPos,
SfxItemState eState = SFX_ITEM_DEFAULT;
if (const SfxItemSet *pSet = pNd->GetpSwAttrSet())
eState = pSet->GetItemState(RES_LR_SPACE, false);
- if (eState != SFX_ITEM_SET && rReader.pCollA != NULL)
- pItem = &(rReader.pCollA[rReader.nAktColl].maWordLR);
+ if (eState != SFX_ITEM_SET && !rReader.vColl.empty() && rReader.nAktColl < rReader.vColl.size())
+ pItem = &(rReader.vColl[rReader.nAktColl].maWordLR);
}
/*
@@ -1368,16 +1368,18 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
const SwTxtFmtColl* pSty = 0;
sal_uInt16 nTabBase;
- if (pAktColl) // StyleDef
+ if (pAktColl && nAktColl < vColl.size()) // StyleDef
{
- nTabBase = pCollA[nAktColl].nBase;
- if (nTabBase < nColls) // Based On
- pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
+ nTabBase = vColl[nAktColl].nBase;
+ if (nTabBase < vColl.size()) // Based On
+ pSty = (const SwTxtFmtColl*)vColl[nTabBase].pFmt;
}
else
{ // Text
nTabBase = nAktColl;
- pSty = (const SwTxtFmtColl*)pCollA[nAktColl].pFmt;
+ if (nAktColl < vColl.size())
+ pSty = (const SwTxtFmtColl*)vColl[nAktColl].pFmt;
+ //TODO figure else here
}
bool bFound = false;
@@ -1394,11 +1396,11 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
sal_uInt16 nOldTabBase = nTabBase;
// If based on another
- if (nTabBase < nColls)
- nTabBase = pCollA[nTabBase].nBase;
+ if (nTabBase < vColl.size())
+ nTabBase = vColl[nTabBase].nBase;
if (
- nTabBase < nColls &&
+ nTabBase < vColl.size() &&
nOldTabBase != nTabBase &&
nTabBase != ww::stiNil
)
@@ -1406,7 +1408,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
// #i61789: Stop searching when next style is the same as the
// current one (prevent loop)
aLoopWatch.insert(reinterpret_cast<size_t>(pSty));
- pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
+ if (nTabBase < vColl.size())
+ pSty = (const SwTxtFmtColl*)vColl[nTabBase].pFmt;
+ //TODO figure out the else branch
if (aLoopWatch.find(reinterpret_cast<size_t>(pSty)) !=
aLoopWatch.end())
@@ -2389,10 +2393,10 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
{
if (!maFontSrcCharSets.empty())
eSrcCharSet = maFontSrcCharSets.top();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCharSet();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl))
- eSrcCharSet = pCollA[nAktColl].GetCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
+ eSrcCharSet = vColl[nCharFmt].GetCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl) && nAktColl < vColl.size())
+ eSrcCharSet = vColl[nAktColl].GetCharSet();
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
/*
@@ -2449,12 +2453,12 @@ CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
{
if (!maFontSrcCJKCharSets.empty())
eSrcCharSet = maFontSrcCJKCharSets.top();
- if (pCollA != NULL)
+ if (!vColl.empty())
{
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
- eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
+ eSrcCharSet = vColl[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW && nAktColl < vColl.size())
+ eSrcCharSet = vColl[nAktColl].GetCJKCharSet();
}
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
@@ -3182,7 +3186,7 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
nAktColl = pPlcxMan->GetColl();
// Invalid Style-Id
- if (nAktColl >= nColls || !pCollA[nAktColl].pFmt || !pCollA[nAktColl].bColl)
+ if (nAktColl >= vColl.size() || !vColl[nAktColl].pFmt || !vColl[nAktColl].bColl)
{
nAktColl = 0;
bParaAutoBefore = false;
@@ -3190,10 +3194,13 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
}
else
{
- bParaAutoBefore = pCollA[nAktColl].bParaAutoBefore;
- bParaAutoAfter = pCollA[nAktColl].bParaAutoAfter;
+ bParaAutoBefore = vColl[nAktColl].bParaAutoBefore;
+ bParaAutoAfter = vColl[nAktColl].bParaAutoAfter;
}
+ if (nOldColl >= vColl.size())
+ nOldColl = 0; //guess! TODO make sure this is what we want
+
bool bTabRowEnd = false;
if( pStartAttr && bCallProcessSpecial && !bInHyperlink )
{
@@ -3206,10 +3213,10 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
if (!bTabRowEnd && StyleExists(nAktColl))
{
- SetTxtFmtCollAndListLevel( *pPaM, pCollA[ nAktColl ]);
- ChkToggleAttr(pCollA[ nOldColl ].n81Flags, pCollA[ nAktColl ].n81Flags);
- ChkToggleBiDiAttr(pCollA[nOldColl].n81BiDiFlags,
- pCollA[nAktColl].n81BiDiFlags);
+ SetTxtFmtCollAndListLevel( *pPaM, vColl[ nAktColl ]);
+ ChkToggleAttr(vColl[ nOldColl ].n81Flags, vColl[ nAktColl ].n81Flags);
+ ChkToggleBiDiAttr(vColl[nOldColl].n81BiDiFlags,
+ vColl[nAktColl].n81BiDiFlags);
}
}
@@ -3345,8 +3352,8 @@ void SwWW8ImplReader::ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLin
// nicht im Plcx.Fkp.papx eingetragen, d.h. ( nFlags & MAN_MASK_NEW_PAP )
// ist false. Deshalb muss als Sonderbehandlung hier die Vorlage gesetzt
// werden.
- if (!bCpxStyle && nAktColl < nColls)
- SetTxtFmtCollAndListLevel(*pPaM, pCollA[nAktColl]);
+ if (!bCpxStyle && nAktColl < vColl.size())
+ SetTxtFmtCollAndListLevel(*pPaM, vColl[nAktColl]);
rbStartLine = false;
}
}
@@ -3600,7 +3607,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pAktColl = 0;
pLstManager = 0;
pAktItemSet = 0;
- pCollA = 0;
pDfltTxtFmtColl = 0;
pStandardFmtColl = 0;
pHdFt = 0;
@@ -3610,7 +3616,7 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pFmtOfJustInsertedApo = 0;
pPreviousNumPaM = 0;
pPrevNumRule = 0;
- nColls = nAktColl = 0;
+ nAktColl = 0;
nObjLocFc = nPicLocFc = 0;
nInTable=0;
bReadNoTbl = bPgSecBreak = bSpec = bObj = bTxbxFlySection
@@ -4429,7 +4435,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
::SetProgressState(nProgress, mpDocShell); // Update
pStyles->PostProcessStyles();
- if (pCollA)
+ if (!vColl.empty())
SetOutLineStyles();
pSBase = new WW8ScannerBase(pStrm,pTableStream,pDataStream,pWwFib);
@@ -4656,8 +4662,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
maInsertedTables.DelAndMakeTblFrms();
maSectionManager.InsertSegments();
- if (pCollA)
- delete[] pCollA;
+ vColl.clear();
DELETEZ( pStyles );
@@ -5150,16 +5155,16 @@ void SwWW8ImplReader::SetOutLineStyles()
pick the one that affects most styles. If we're not importing a new
document, we got to stick with what is already there.
*/
- // use index in text format collection array <pCollA>
+ // use index in text format collection array <vColl>
// as key of the outline numbering map <aRuleMap>
// instead of the memory pointer of the outline numbering rule
// to assure that, if two outline numbering rule affect the same
// count of text formats, always the same outline numbering rule is chosen.
std::map<sal_uInt16, int>aRuleMap;
typedef std::map<sal_uInt16, int>::iterator myIter;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[ nI ];
+ SwWW8StyInf& rSI = vColl[ nI ];
if (
(MAXLEVEL > rSI.nOutlineLevel) && rSI.pOutlineNumrule &&
rSI.pFmt
@@ -5182,7 +5187,10 @@ void SwWW8ImplReader::SetOutLineStyles()
if (aIter->second > nMax)
{
nMax = aIter->second;
- mpChosenOutlineNumRule = pCollA[ aIter->first ].pOutlineNumrule;
+ if(aIter->first < vColl.size())
+ mpChosenOutlineNumRule = vColl[ aIter->first ].pOutlineNumrule;
+ else
+ mpChosenOutlineNumRule = 0; //TODO make sure this is what we want
}
}
@@ -5207,9 +5215,9 @@ void SwWW8ImplReader::SetOutLineStyles()
sal_uInt16 nOldFlags = nFlagsStyleOutlLevel;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[nI];
+ SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutlineNumbered())
{
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 96c8d37..2cbdc92 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -50,6 +50,12 @@
#include <xmloff/odffields.hxx>
#include <IMark.hxx>
+#include <swtypes.hxx> // enum RndStdIds
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <editeng/lrspitem.hxx>
+
class SwDoc;
class SwPaM;
class SfxPoolItem;
@@ -64,7 +70,6 @@ class SwNumRule;
class SwFrmFmt;
class Writer;
class SwFmtFld;
-class SwWW8StyInf;
class WW8Fib;
class WW8PLCFMan;
struct WW8PLCFManResult;
@@ -177,6 +182,7 @@ struct WW8OleMap
}
};
+
class SwWW8ImplReader;
struct WW8LSTInfo;
class WW8ListManager
@@ -223,6 +229,128 @@ private:
sal_uInt16 nLastLFOPosition;
};
+struct WW8FlyPara
+{ // WinWord-Attribute
+ // Achtung: *Nicht* umsortieren, da Teile mit
+ // memcmp verglichen werden
+ bool bVer67;
+ sal_Int16 nSp26, nSp27; // rohe Position
+ sal_Int16 nSp45, nSp28; // Breite / Hoehe
+ sal_Int16 nLeMgn, nRiMgn, nUpMgn, nLoMgn; // Raender
+ sal_uInt8 nSp29; // rohe Bindung + Alignment
+ sal_uInt8 nSp37; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
+ WW8_BRC5 brc; // Umrandung Top, Left, Bottom, Right, Between
+ bool bBorderLines; // Umrandungslinien
+ bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
+ // enthaltene Grafik anders als zeichengebunden
+ // zu positionieren
+ bool mbVertSet; // true if vertical positioning has been set
+ sal_uInt8 nOrigSp29;
+
+ WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
+ bool operator==(const WW8FlyPara& rSrc) const;
+ void Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap);
+ void ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo);
+ void Read(const sal_uInt8* pSprm29, WW8RStyle* pStyle);
+ void ApplyTabPos(const WW8_TablePos *pTabPos);
+ bool IsEmpty() const;
+};
+
+class SwWW8StyInf
+{
+ String sWWStyleName;
+ sal_uInt16 nWWStyleId;
+public:
+ rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ rtl_TextEncoding eCJKFontSrcCharSet; // rtl_TextEncoding fuer den Font
+ SwFmt* pFmt;
+ WW8FlyPara* pWWFly;
+ SwNumRule* pOutlineNumrule;
+ long nFilePos;
+ sal_uInt16 nBase;
+ sal_uInt16 nFollow;
+ sal_uInt16 nLFOIndex;
+ sal_uInt8 nListLevel;
+ sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
+ sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
+ sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
+ SvxLRSpaceItem maWordLR;
+ bool bValid; // leer oder Valid
+ bool bImported; // fuers rekursive Importieren
+ bool bColl; // true-> pFmt ist SwTxtFmtColl
+ bool bImportSkipped; // nur true bei !bNewDoc && vorh. Style
+ bool bHasStyNumRule; // true-> Benannter NumRule in Style
+ bool bHasBrokenWW6List; // true-> WW8+ style has a WW7- list
+ bool bListReleventIndentSet; //true if this style's indent has
+ //been explicitly set, it's set to the value
+ //of pFmt->GetItemState(RES_LR_SPACE, false)
+ //if it was possible to get the ItemState
+ //for L of the LR space independantly
+ bool bParaAutoBefore; // For Auto spacing before a paragraph
+ bool bParaAutoAfter; // For Auto Spacing after a paragraph
+
+ SwWW8StyInf() :
+ sWWStyleName( aEmptyStr ),
+ nWWStyleId( 0 ),
+ eLTRFontSrcCharSet(0),
+ eRTLFontSrcCharSet(0),
+ eCJKFontSrcCharSet(0),
+ pFmt( 0 ),
+ pWWFly( 0 ),
+ pOutlineNumrule( 0 ),
+ nFilePos( 0 ),
+ nBase( 0 ),
+ nFollow( 0 ),
+ nLFOIndex( USHRT_MAX ),
+ nListLevel(WW8ListManager::nMaxLevel),
+ nOutlineLevel( MAXLEVEL ),
+ n81Flags( 0 ),
+ n81BiDiFlags(0),
+ maWordLR( RES_LR_SPACE ),
+ bValid(false),
+ bImported(false),
+ bColl(false),
+ bImportSkipped(false),
+ bHasStyNumRule(false),
+ bHasBrokenWW6List(false),
+ bListReleventIndentSet(false),
+ bParaAutoBefore(false),
+ bParaAutoAfter(false)
+
+ {}
+
+ ~SwWW8StyInf()
+ {
+ delete pWWFly;
+ }
+
+ void SetOrgWWIdent( const String& rName, const sal_uInt16 nId )
+ {
+ sWWStyleName = rName;
+ nWWStyleId = nId;
+ }
+ sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
+ const String& GetOrgWWName() const
+ {
+ return sWWStyleName;
+ }
+ bool IsOutline() const
+ {
+ return (pFmt && (MAXLEVEL > nOutlineLevel));
+ }
+ bool IsOutlineNumbered() const
+ {
+ return pOutlineNumrule && IsOutline();
+ }
+ const SwNumRule* GetOutlineNumrule() const
+ {
+ return pOutlineNumrule;
+ }
+ CharSet GetCharSet() const;
+ CharSet GetCJKCharSet() const;
+};
+
//-----------------------------------------
// Stack
//-----------------------------------------
@@ -947,7 +1075,7 @@ private:
// ( ist ausserhalb einer Style-Def immer 0 )
SfxItemSet* pAktItemSet;// gerade einzulesende Zeichenattribute
// (ausserhalb des WW8ListManager Ctor's immer 0)
- SwWW8StyInf* pCollA; // UEbersetzungs-Array der Styles
+ std::vector<SwWW8StyInf> vColl;
const SwTxtFmtColl* pDfltTxtFmtColl; // Default
SwFmt* pStandardFmtColl;// "Standard"
@@ -999,7 +1127,6 @@ private:
rtl_TextEncoding eStructCharSet; // rtl_TextEncoding for structures
rtl_TextEncoding eHardCharSet; // Hard rtl_TextEncoding-Attribute
sal_uInt16 nProgress; // %-Angabe fuer Progressbar
- sal_uInt16 nColls; // Groesse des Arrays
sal_uInt16 nAktColl; // gemaess WW-Zaehlung
sal_uInt16 nFldNum; // laufende Nummer dafuer
sal_uInt16 nLFOPosition;
@@ -1088,7 +1215,7 @@ private:
const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const;
- bool StyleExists(int nColl) const { return (nColl < nColls); }
+ bool StyleExists(unsigned int nColl) const { return (nColl < vColl.size()); }
SwWW8StyInf *GetStyle(sal_uInt16 nColl) const;
void AppendTxtNode(SwPosition& rPos);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 67e7dfb..a4829e1 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -526,8 +526,8 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
ApoTestResults aRet;
// Frame in Style Definition (word appears to ignore them if inside an
// text autoshape)
- if (!bTxbxFlySection)
- aRet.mpStyleApo = StyleExists(nAktColl) ? pCollA[nAktColl].pWWFly : 0;
+ if (!bTxbxFlySection && nAktColl < vColl.size())
+ aRet.mpStyleApo = StyleExists(nAktColl) ? vColl[nAktColl].pWWFly : 0;
/*
#i1140#
@@ -836,7 +836,7 @@ void SwWW8ImplReader::Read_ANLevelNo( sal_uInt16, const sal_uInt8* pData, short
void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, short nLen ) // Sprm 12
{
{
- SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
if( !pAktColl || nLen <= 0 // nur bei Styledef
|| (pStyInf && !pStyInf->bColl) // CharFmt -> ignorieren
|| ( nIniFlags & WW8FL_NO_OUTLINE ) ){
@@ -3652,11 +3652,11 @@ bool SwWW8ImplReader::IsInvalidOrToBeMergedTabCell() const
sal_uInt16 SwWW8ImplReader::StyleUsingLFO( sal_uInt16 nLFOIndex ) const
{
sal_uInt16 nRes = USHRT_MAX;
- if( pCollA )
+ if( !vColl.empty() )
{
for(sal_uInt16 nI = 0; nI < pStyles->GetCount(); nI++ )
- if( pCollA[ nI ].bValid
- && (nLFOIndex == pCollA[ nI ].nLFOIndex) )
+ if( vColl[ nI ].bValid
+ && (nLFOIndex == vColl[ nI ].nLFOIndex) )
nRes = nI;
}
return nRes;
@@ -3665,13 +3665,13 @@ sal_uInt16 SwWW8ImplReader::StyleUsingLFO( sal_uInt16 nLFOIndex ) const
const SwFmt* SwWW8ImplReader::GetStyleWithOrgWWName( String& rName ) const
{
SwFmt* pRet = 0;
- if( pCollA )
+ if( !vColl.empty() )
{
for(sal_uInt16 nI = 0; nI < pStyles->GetCount(); nI++ )
- if( pCollA[ nI ].bValid
- && (rName.Equals( pCollA[ nI ].GetOrgWWName())) )
+ if( vColl[ nI ].bValid
+ && (rName.Equals( vColl[ nI ].GetOrgWWName())) )
{
- pRet = pCollA[ nI ].pFmt;
+ pRet = vColl[ nI ].pFmt;
break;
}
}
@@ -3812,8 +3812,7 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI)
: WW8Style(*pI->pTableStream, _rFib), maSprmParser(_rFib.GetFIBVersion()),
pIo(pI), pStStrm(pI->pTableStream), pStyRule(0), nWwNumLevel(0)
{
- pIo->nColls = cstd;
- pIo->pCollA = cstd ? new SwWW8StyInf[ cstd ] : NULL; // Style-UEbersetzung WW->SW
+ pIo->vColl.resize(cstd);
}
void WW8RStyle::Set1StyleDefaults()
@@ -3905,7 +3904,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
sal_uInt16 j = rSI.nBase;
if (j != nThisStyle && j < cstd )
{
- SwWW8StyInf* pj = &pIo->pCollA[j];
+ SwWW8StyInf* pj = &pIo->vColl[j];
if (rSI.pFmt && pj->pFmt && rSI.bColl == pj->bColl)
{
rSI.pFmt->SetDerivedFrom( pj->pFmt ); // ok, Based on eintragen
@@ -3945,7 +3944,7 @@ void WW8RStyle::PostStyle(SwWW8StyInf &rSI, bool bOldNoImp)
pIo->nCharFmt = -1;
// If Style basiert auf Nichts oder Basis ignoriert
- if ((rSI.nBase >= cstd || pIo->pCollA[rSI.nBase].bImportSkipped) && rSI.bColl)
+ if ((rSI.nBase >= cstd || pIo->vColl[rSI.nBase].bImportSkipped) && rSI.bColl)
{
//! Char-Styles funktionieren aus
// unerfindlichen Gruenden nicht
@@ -3966,7 +3965,10 @@ void WW8RStyle::PostStyle(SwWW8StyInf &rSI, bool bOldNoImp)
void WW8RStyle::Import1Style( sal_uInt16 nNr )
{
- SwWW8StyInf &rSI = pIo->pCollA[nNr];
+ if (nNr >= pIo->vColl.size())
+ return;
+
+ SwWW8StyInf &rSI = pIo->vColl[nNr];
if( rSI.bImported || !rSI.bValid )
return;
@@ -3976,7 +3978,7 @@ void WW8RStyle::Import1Style( sal_uInt16 nNr )
//
// gueltig und nicht NIL und noch nicht Importiert
- if( rSI.nBase < cstd && !pIo->pCollA[rSI.nBase].bImported )
+ if( rSI.nBase < cstd && !pIo->vColl[rSI.nBase].bImported )
Import1Style( rSI.nBase );
pStStrm->Seek( rSI.nFilePos );
@@ -4019,13 +4021,16 @@ void WW8RStyle::Import1Style( sal_uInt16 nNr )
void WW8RStyle::RecursiveReg(sal_uInt16 nNr)
{
- SwWW8StyInf &rSI = pIo->pCollA[nNr];
+ if (nNr >= pIo->vColl.size())
+ return;
+
+ SwWW8StyInf &rSI = pIo->vColl[nNr];
if( rSI.bImported || !rSI.bValid )
return;
rSI.bImported = true;
- if( rSI.nBase < cstd && !pIo->pCollA[rSI.nBase].bImported )
+ if( rSI.nBase < cstd && !pIo->vColl[rSI.nBase].bImported )
RecursiveReg(rSI.nBase);
pIo->RegisterNumFmtOnStyle(nNr);
@@ -4045,7 +4050,7 @@ void WW8RStyle::PostProcessStyles()
formats and use it to mark handled ones
*/
for (i=0; i < cstd; ++i)
- pIo->pCollA[i].bImported = false;
+ pIo->vColl[i].bImported = false;
/*
Register the num formats and tabstop changes on the styles recursively.
@@ -4060,7 +4065,7 @@ void WW8RStyle::PostProcessStyles()
*/
for (i=0; i < cstd; ++i)
{
- if (pIo->pCollA[i].bValid)
+ if (pIo->vColl[i].bValid)
{
RecursiveReg(i);
}
@@ -4072,7 +4077,7 @@ void WW8RStyle::ScanStyles() // untersucht Style-Abhaengigkeiten
for (sal_uInt16 i = 0; i < cstd; ++i)
{
short nSkip;
- SwWW8StyInf &rSI = pIo->pCollA[i];
+ SwWW8StyInf &rSI = pIo->vColl[i];
rSI.nFilePos = pStStrm->Tell(); // merke FilePos
WW8_STD* pStd = Read1Style( nSkip, 0, 0 ); // read STD
@@ -4329,9 +4334,9 @@ void WW8RStyle::ImportOldFormatStyles()
{
for (sal_uInt16 i=0; i < cstd; ++i)
{
- pIo->pCollA[i].bColl = true;
+ pIo->vColl[i].bColl = true;
//every chain must end eventually at the null style (style code 222)
- pIo->pCollA[i].nBase = 222;
+ pIo->vColl[i].nBase = 222;
}
rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(
@@ -4351,7 +4356,10 @@ void WW8RStyle::ImportOldFormatStyles()
nByteCount++;
sal_uInt8 stc = static_cast< sal_uInt8 >((stcp - cstcStd) & 255);
- SwWW8StyInf &rSI = pIo->pCollA[stc];
+ if (stc >=pIo->vColl.size())
+ continue;
+
+ SwWW8StyInf &rSI = pIo->vColl[stc];
if (nCount != 0xFF) // undefined style
{
String sName;
@@ -4481,7 +4489,7 @@ void WW8RStyle::ImportOldFormatStyles()
if (stc == stcBase)
stcBase = 222;
- SwWW8StyInf &rSI = pIo->pCollA[stc];
+ SwWW8StyInf &rSI = pIo->vColl[stc];
rSI.nBase = stcBase;
ww::sti eSti = ww::GetCanonicalStiFromStc(stc);
@@ -4492,7 +4500,7 @@ void WW8RStyle::ImportOldFormatStyles()
rSI.bValid = true;
if (ww::StandardStiIsCharStyle(eSti) && !aPAPXOffsets[stcp].mnSize)
- pIo->pCollA[stc].bColl = false;
+ pIo->vColl[stc].bColl = false;
bool bOldNoImp = PrepareStyle(rSI, eSti, stc, stcNext);
@@ -4513,7 +4521,7 @@ void WW8RStyle::ImportNewFormatStyles()
ScanStyles(); // Scanne Based On
for (sal_uInt16 i = 0; i < cstd; ++i) // import Styles
- if (pIo->pCollA[i].bValid)
+ if (pIo->vColl[i].bValid)
Import1Style( i );
}
@@ -4539,11 +4547,11 @@ void WW8RStyle::Import()
for (sal_uInt16 i = 0; i < cstd; ++i)
{
// Follow chain
- SwWW8StyInf* pi = &pIo->pCollA[i];
+ SwWW8StyInf* pi = &pIo->vColl[i];
sal_uInt16 j = pi->nFollow;
if( j < cstd )
{
- SwWW8StyInf* pj = &pIo->pCollA[j];
+ SwWW8StyInf* pj = &pIo->vColl[j];
if ( j != i // sinnvoller Index ?
&& pi->pFmt // Format ok ?
&& pj->pFmt // Derived-Format ok ?
@@ -4563,8 +4571,9 @@ void WW8RStyle::Import()
//
// fuer z.B. Tabellen wird ein immer gueltiger Std-Style gebraucht
- if( pIo->StyleExists(0) && pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
- pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->pCollA[0].pFmt;
+ if( pIo->StyleExists(0) && !pIo->vColl.empty() &&
+ pIo->vColl[0].pFmt && pIo->vColl[0].bColl && pIo->vColl[0].bValid )
+ pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->vColl[0].pFmt;
else
pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl();
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index 2dba225..dae3e95 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -53,32 +53,6 @@ private:
SfxItemSet aChrSet,aParSet;
};
-struct WW8FlyPara
-{ // WinWord-Attribute
- // Achtung: *Nicht* umsortieren, da Teile mit
- // memcmp verglichen werden
- bool bVer67;
- sal_Int16 nSp26, nSp27; // rohe Position
- sal_Int16 nSp45, nSp28; // Breite / Hoehe
- sal_Int16 nLeMgn, nRiMgn, nUpMgn, nLoMgn; // Raender
- sal_uInt8 nSp29; // rohe Bindung + Alignment
- sal_uInt8 nSp37; // Wrap-Mode ( 1 / 2; 0 = no Apo ? )
- WW8_BRC5 brc; // Umrandung Top, Left, Bottom, Right, Between
- bool bBorderLines; // Umrandungslinien
- bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
- // enthaltene Grafik anders als zeichengebunden
- // zu positionieren
- bool mbVertSet; // true if vertical positioning has been set
- sal_uInt8 nOrigSp29;
-
- WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
- bool operator==(const WW8FlyPara& rSrc) const;
- void Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap);
- void ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo);
- void Read(const sal_uInt8* pSprm29, WW8RStyle* pStyle);
- void ApplyTabPos(const WW8_TablePos *pTabPos);
- bool IsEmpty() const;
-};
struct WW8SwFlyPara
{
@@ -122,101 +96,6 @@ struct WW8SwFlyPara
SwWW8FltAnchorStack *pOldAnchorStck;
};
-class SwWW8StyInf
-{
- String sWWStyleName;
- sal_uInt16 nWWStyleId;
-public:
- rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
- rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
- rtl_TextEncoding eCJKFontSrcCharSet; // rtl_TextEncoding fuer den Font
- SwFmt* pFmt;
- WW8FlyPara* pWWFly;
- SwNumRule* pOutlineNumrule;
- long nFilePos;
- sal_uInt16 nBase;
- sal_uInt16 nFollow;
- sal_uInt16 nLFOIndex;
- sal_uInt8 nListLevel;
- sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
- sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
- sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
- SvxLRSpaceItem maWordLR;
- bool bValid; // leer oder Valid
- bool bImported; // fuers rekursive Importieren
- bool bColl; // true-> pFmt ist SwTxtFmtColl
- bool bImportSkipped; // nur true bei !bNewDoc && vorh. Style
- bool bHasStyNumRule; // true-> Benannter NumRule in Style
- bool bHasBrokenWW6List; // true-> WW8+ style has a WW7- list
- bool bListReleventIndentSet; //true if this style's indent has
- //been explicitly set, it's set to the value
- //of pFmt->GetItemState(RES_LR_SPACE, false)
- //if it was possible to get the ItemState
- //for L of the LR space independantly
- bool bParaAutoBefore; // For Auto spacing before a paragraph
- bool bParaAutoAfter; // For Auto Spacing after a paragraph
-
- SwWW8StyInf() :
- sWWStyleName( aEmptyStr ),
- nWWStyleId( 0 ),
- eLTRFontSrcCharSet(0),
- eRTLFontSrcCharSet(0),
- eCJKFontSrcCharSet(0),
- pFmt( 0 ),
- pWWFly( 0 ),
- pOutlineNumrule( 0 ),
- nFilePos( 0 ),
- nBase( 0 ),
- nFollow( 0 ),
- nLFOIndex( USHRT_MAX ),
- nListLevel(WW8ListManager::nMaxLevel),
- nOutlineLevel( MAXLEVEL ),
- n81Flags( 0 ),
- n81BiDiFlags(0),
- maWordLR( RES_LR_SPACE ),
- bValid(false),
- bImported(false),
- bColl(false),
- bImportSkipped(false),
- bHasStyNumRule(false),
- bHasBrokenWW6List(false),
- bListReleventIndentSet(false),
- bParaAutoBefore(false),
- bParaAutoAfter(false)
-
- {}
-
- ~SwWW8StyInf()
- {
- delete pWWFly;
- }
-
- void SetOrgWWIdent( const String& rName, const sal_uInt16 nId )
- {
- sWWStyleName = rName;
- nWWStyleId = nId;
- }
- sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
- const String& GetOrgWWName() const
- {
- return sWWStyleName;
- }
- bool IsOutline() const
- {
- return (pFmt && (MAXLEVEL > nOutlineLevel));
- }
- bool IsOutlineNumbered() const
- {
- return pOutlineNumrule && IsOutline();
- }
- const SwNumRule* GetOutlineNumrule() const
- {
- return pOutlineNumrule;
- }
- CharSet GetCharSet() const;
- CharSet GetCJKCharSet() const;
-};
-
class WW8RStyle: public WW8Style
{
friend class SwWW8ImplReader;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 392efe7..7335579 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1684,7 +1684,10 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt)
void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
sal_uInt8 nActLevel)
{
- SwWW8StyInf &rStyleInf = pCollA[nStyle];
+ if (nStyle >= vColl.size())
+ return;
+
+ SwWW8StyInf &rStyleInf = vColl[nStyle];
if (rStyleInf.bValid)
{
OSL_ENSURE(pAktColl, "Cannot be called outside of style import");
@@ -1720,7 +1723,11 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle)
{
- SwWW8StyInf &rStyleInf = pCollA[nStyle];
+
+ if (nStyle >= vColl.size())
+ return;
+
+ SwWW8StyInf &rStyleInf = vColl[nStyle];
if (rStyleInf.bValid && rStyleInf.pFmt)
{
//Save old pre-list modified indent, which are the word indent values
@@ -2013,8 +2020,8 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
indentation. Setting this flag will allow us to recover from this
braindeadness
*/
- if (pAktColl && (nLFOPosition == 2047-1))
- pCollA[nAktColl].bHasBrokenWW6List = true;
+ if (pAktColl && (nLFOPosition == 2047-1) && nAktColl < vColl.size())
+ vColl[nAktColl].bHasBrokenWW6List = true;
// die Streamdaten sind hier 1 basiert, wir ziehen EINS ab
if (USHRT_MAX > nLFOPosition)
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index ac5f53b..462f82b 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2778,9 +2778,9 @@ bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
bool bExtras = false;
//This is the case if the winword outline numbering is set while the
//writer one is not
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = pCollA[nI];
+ SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutline())
{
const SwTxtFmtColl *pFmt = (const SwTxtFmtColl*)(rSI.pFmt);
@@ -3285,9 +3285,9 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
// the entry correctly, but I currently have no clue how to obtain
// the tab stop position. It is _not_ set at the paragraph style.
SwForm* pForm = 0;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- const SwWW8StyInf& rSI = pCollA[nI];
+ const SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutlineNumbered())
{
sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index c4ea2f0..df3f163 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -284,10 +284,10 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
sal_uInt32 nCharWidth=240;
for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
{
- if (pCollA[nI].bValid && pCollA[nI].pFmt &&
- pCollA[nI].GetWWStyleId() == 0)
+ if (vColl[nI].bValid && vColl[nI].pFmt &&
+ vColl[nI].GetWWStyleId() == 0)
{
- nCharWidth = ItemGet<SvxFontHeightItem>(*(pCollA[nI].pFmt),
+ nCharWidth = ItemGet<SvxFontHeightItem>(*(vColl[nI].pFmt),
RES_CHRATR_CJK_FONTSIZE).GetHeight();
break;
}
@@ -1712,9 +1712,9 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
WW8FlyPara *pNowStyleApo=0;
sal_uInt16 nColl = pPap->GetIstd();
ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
- while (eSti != ww::stiNil && 0 == (pNowStyleApo = pIo->pCollA[nColl].pWWFly))
+ while (eSti != ww::stiNil && nColl < pIo->vColl.size() && 0 == (pNowStyleApo = pIo->vColl[nColl].pWWFly))
{
- nColl = pIo->pCollA[nColl].nBase;
+ nColl = pIo->vColl[nColl].nBase;
eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
}
@@ -2659,10 +2659,10 @@ const SfxPoolItem* SwWW8ImplReader::GetFmtAttr( sal_uInt16 nWhich )
pRet = pCtrlStck->GetStackAttr(*pPaM->GetPoint(), nWhich);
if (!pRet)
{
- if (nAktColl < nColls && pCollA[nAktColl].pFmt &&
- pCollA[nAktColl].bColl)
+ if (nAktColl < vColl.size() && vColl[nAktColl].pFmt &&
+ vColl[nAktColl].bColl)
{
- pRet = &(pCollA[nAktColl].pFmt->GetFmtAttr(nWhich));
+ pRet = &(vColl[nAktColl].pFmt->GetFmtAttr(nWhich));
}
}
if (!pRet)
@@ -2785,7 +2785,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen
SwWW8StyInf *SwWW8ImplReader::GetStyle(sal_uInt16 nColl) const
{
- return nColl < nColls ? &pCollA[nColl] : 0;
+ return const_cast<SwWW8StyInf *>(nColl < vColl.size() ? &vColl[nColl] : 0);
}
/***************************************************************************
@@ -2869,8 +2869,8 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor
{
// The style based on has Bit 7 set ?
if (
- pSI->nBase < nColls && (*pData & 0x80) &&
- (pCollA[pSI->nBase].n81Flags & nMask)
+ pSI->nBase < vColl.size() && (*pData & 0x80) &&
+ (vColl[pSI->nBase].n81Flags & nMask)
)
{
bOn = !bOn; // umdrehen
@@ -2950,9 +2950,9 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData,
{
if (pSI)
{
- if( pSI->nBase < nColls // Style Based on
+ if( pSI->nBase < vColl.size() // Style Based on
&& ( *pData & 0x80 ) // Bit 7 gesetzt ?
- && ( pCollA[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
+ && ( vColl[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
bOn = !bOn; // umdrehen
if( bOn )
@@ -3517,19 +3517,19 @@ bool SwWW8ImplReader::SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums,
if( bSetEnums )
{
- if( pAktColl ) // StyleDef
+ if( pAktColl && nAktColl < vColl.size() ) // StyleDef
{
switch(nWhich)
{
default:
case RES_CHRATR_FONT:
- pCollA[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
break;
case RES_CHRATR_CTL_FONT:
- pCollA[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
break;
case RES_CHRATR_CJK_FONT:
- pCollA[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
+ vColl[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
break;
}
}
@@ -3757,11 +3757,11 @@ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen
}
sal_uInt16 nId = SVBT16ToShort( pData ); // Style-Id (NICHT Sprm-Id!)
- if( nId >= nColls || !pCollA[nId].pFmt // ungueltige Id ?
- || pCollA[nId].bColl ) // oder Para-Style ?
+ if( nId >= vColl.size() || !vColl[nId].pFmt // ungueltige Id ?
+ || vColl[nId].bColl ) // oder Para-Style ?
return; // dann ignorieren
- NewAttr( SwFmtCharFmt( (SwCharFmt*)pCollA[nId].pFmt ) );
+ NewAttr( SwFmtCharFmt( (SwCharFmt*)vColl[nId].pFmt ) );
nCharFmt = (short) nId;
}
@@ -3956,9 +3956,9 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
case 0x840F:
case 0x845E:
aLR.SetTxtLeft( nPara );
- if (pAktColl)
+ if (pAktColl && nAktColl < vColl.size())
{
- pCollA[nAktColl].bListReleventIndentSet = true;
+ vColl[nAktColl].bListReleventIndentSet = true;
}
bLeftIndentSet = true; // #i105414#
break;
@@ -3977,22 +3977,22 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
been removed then we will factor the original list applied hanging
into our calculation.
*/
- if (pPlcxMan && pCollA[nAktColl].bHasBrokenWW6List)
+ if (pPlcxMan && nAktColl < vColl.size() && vColl[nAktColl].bHasBrokenWW6List)
{
const sal_uInt8 *pIsZeroed = pPlcxMan->GetPapPLCF()->HasSprm(0x460B);
if (pIsZeroed && *pIsZeroed == 0)
{
const SvxLRSpaceItem &rLR =
- ItemGet<SvxLRSpaceItem>(*(pCollA[nAktColl].pFmt),
+ ItemGet<SvxLRSpaceItem>(*(vColl[nAktColl].pFmt),
RES_LR_SPACE);
nPara = nPara - rLR.GetTxtFirstLineOfst();
}
}
aLR.SetTxtFirstLineOfst(nPara);
- if (pAktColl)
+ if (pAktColl && nAktColl < vColl.size())
{
- pCollA[nAktColl].bListReleventIndentSet = true;
+ vColl[nAktColl].bListReleventIndentSet = true;
}
bFirstLinOfstSet = true; // #i103711#
break;
@@ -4105,15 +4105,15 @@ void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, sh
SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
aUL.SetUpper(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
NewAttr(aUL);
- if (pAktColl)
- pCollA[nAktColl].bParaAutoBefore = true;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoBefore = true;
else
bParaAutoBefore = true;
}
else
{
- if (pAktColl)
- pCollA[nAktColl].bParaAutoBefore = false;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoBefore = false;
else
bParaAutoBefore = false;
}
@@ -4132,15 +4132,15 @@ void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, sho
SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
aUL.SetLower(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
NewAttr(aUL);
- if (pAktColl)
- pCollA[nAktColl].bParaAutoAfter = true;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoAfter = true;
else
bParaAutoAfter = true;
}
else
{
- if (pAktColl)
- pCollA[nAktColl].bParaAutoAfter = false;
+ if (pAktColl && nAktColl < vColl.size())
+ vColl[nAktColl].bParaAutoAfter = false;
else
bParaAutoAfter = false;
}
@@ -4857,14 +4857,14 @@ void SwWW8ImplReader::Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, shor
void SwWW8ImplReader::Read_ApoPPC( sal_uInt16, const sal_uInt8* pData, short )
{
- if (pAktColl) // only for Styledef, sonst anders geloest
+ if (pAktColl && nAktColl < vColl.size()) // only for Styledef, sonst anders geloest
{
- SwWW8StyInf& rSI = pCollA[nAktColl];
+ SwWW8StyInf& rSI = vColl[nAktColl];
WW8FlyPara* pFly = rSI.pWWFly ? rSI.pWWFly : new WW8FlyPara(bVer67);
- pCollA[nAktColl].pWWFly = pFly;
+ vColl[nAktColl].pWWFly = pFly;
pFly->Read(pData, pStyles);
if (pFly->IsEmpty())
- delete pCollA[nAktColl].pWWFly, pCollA[nAktColl].pWWFly = 0;
+ delete vColl[nAktColl].pWWFly, vColl[nAktColl].pWWFly = 0;
}
}
More information about the Libreoffice-commits
mailing list