summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2006-3493-1.docbin0 -> 48128 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2006-6628-1.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2007-1347-1.docbin0 -> 24064 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-1.docbin0 -> 25088 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-2.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-3.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2008-2752-4.docbin0 -> 23040 bytes
l---------sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc1
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2009-0259-1.docbin0 -> 101888 bytes
-rw-r--r--sw/qa/core/data/ww8/pass/CVE-2010-3200-1.docbin0 -> 48128 bytes
-rw-r--r--sw/source/core/doc/docnew.cxx59
-rw-r--r--sw/source/core/doc/notxtfrm.cxx31
-rw-r--r--sw/source/core/docnode/ndcopy.cxx13
-rw-r--r--sw/source/core/layout/ftnfrm.cxx2
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx14
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx17
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx6
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx47
-rw-r--r--sw/source/filter/ww8/ww8par.cxx109
-rw-r--r--sw/source/filter/ww8/ww8par.hxx147
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx99
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx121
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx38
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx105
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx21
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx5
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx6
29 files changed, 461 insertions, 391 deletions
diff --git a/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc b/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc
new file mode 100644
index 000000000000..af452ddc0e5f
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2006-3493-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc b/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc
new file mode 100644
index 000000000000..240ea77bca12
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2006-6628-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc b/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc
new file mode 100644
index 000000000000..d25e62ab2416
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2007-1347-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc
new file mode 100644
index 000000000000..f51fa8fe9b2e
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc
new file mode 100644
index 000000000000..7ce7a07bb6e2
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-2.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc
new file mode 100644
index 000000000000..8b04872af739
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-3.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc b/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc
new file mode 100644
index 000000000000..148a30d4ab35
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-2752-4.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc b/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc
new file mode 120000
index 000000000000..f099938bc1a8
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc
@@ -0,0 +1 @@
+CVE-2009-0259-1.doc \ No newline at end of file
diff --git a/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc b/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc
new file mode 100644
index 000000000000..0942b6d8d466
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2009-0259-1.doc
Binary files differ
diff --git a/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc b/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc
new file mode 100644
index 000000000000..596aec93bd60
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/CVE-2010-3200-1.doc
Binary files differ
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 85f3b33ae9c9..a7a9a6e0b94b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -909,39 +909,40 @@ void SwDoc::UpdateLinks( sal_Bool bUI )
{
SfxObjectCreateMode eMode;
sal_uInt16 nLinkMode = getLinkUpdateMode( true );
- sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
- if( GetDocShell() &&
- (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
- GetLinkManager().GetLinks().Count() &&
- SFX_CREATE_MODE_INTERNAL !=
- ( eMode = GetDocShell()->GetCreateMode()) &&
- SFX_CREATE_MODE_ORGANIZER != eMode &&
- SFX_CREATE_MODE_PREVIEW != eMode &&
- !GetDocShell()->IsPreview() )
- {
- ViewShell* pVSh = 0;
- sal_Bool bAskUpdate = nLinkMode == MANUAL;
- sal_Bool bUpdate = sal_True;
- switch(nUpdateDocMode)
- {
- case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break;
- case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break;
- case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break;
- }
- if( bUpdate && (bUI || !bAskUpdate) )
+ if ( GetDocShell()) {
+ sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
+ if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
+ GetLinkManager().GetLinks().Count() &&
+ SFX_CREATE_MODE_INTERNAL !=
+ ( eMode = GetDocShell()->GetCreateMode()) &&
+ SFX_CREATE_MODE_ORGANIZER != eMode &&
+ SFX_CREATE_MODE_PREVIEW != eMode &&
+ !GetDocShell()->IsPreview() )
{
- SfxMedium* pMedium = GetDocShell()->GetMedium();
- SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
- Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
- if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225
+ ViewShell* pVSh = 0;
+ sal_Bool bAskUpdate = nLinkMode == MANUAL;
+ sal_Bool bUpdate = sal_True;
+ switch(nUpdateDocMode)
{
- ViewShell aVSh( *this, 0, 0 );
+ case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break;
+ case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break;
+ case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break;
+ }
+ if( bUpdate && (bUI || !bAskUpdate) )
+ {
+ SfxMedium* pMedium = GetDocShell()->GetMedium();
+ SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
+ Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
+ if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225
+ {
+ ViewShell aVSh( *this, 0, 0 );
- SET_CURR_SHELL( &aVSh );
- GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent );
+ SET_CURR_SHELL( &aVSh );
+ GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent );
+ }
+ else
+ GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent );
}
- else
- GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent );
}
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index fb8355880843..4d707dfd7f4f 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -819,9 +819,10 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( pGrfNd )
{
// Fix for bug fdo#33781
+ const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
{
- pOut->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW );
+ pOut->SetAntialiasing( nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW );
}
sal_Bool bForceSwap = sal_False, bContinue = sal_True;
@@ -938,8 +939,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bSwapped && bPrn )
bForceSwap = sal_True;
}
+
if( bForceSwap )
pGrfNd->SwapOut();
+
+ if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
}
else if( bIsChart
//charts must be painted resolution dependent!! #i82893#, #i75867#
@@ -952,15 +957,18 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
else if( pOLENd )
{
- // #i99665#
- // Adjust AntiAliasing mode at output device for chart OLE
+ // Fix for bug fdo#33781
const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
- if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
{
- const sal_uInt16 nAntialiasingForChartOLE =
- nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
- pOut->SetAntialiasing( nAntialiasingForChartOLE );
+ sal_uInt16 nNewAntialiasingAtOutput = nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW;
+
+ // #i99665#
+ // Adjust AntiAliasing mode at output device for chart OLE
+ if ( pOLENd->IsChart() )
+ nNewAntialiasingAtOutput |= ANTIALIASING_PIXELSNAPHAIRLINE;
+
+ pOut->SetAntialiasing( nNewAntialiasingAtOutput );
}
// <--
@@ -1006,13 +1014,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
}
- // #i99665#
- if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
- {
+ if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
- }
- // <--
}
}
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 090c9654b501..d9e9a4977794 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -186,14 +186,25 @@ namespace
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
+
+ // copying additional attributes for bookmarks or fieldmarks
::sw::mark::IBookmark* const pNewBookmark =
dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark);
- if(pNewBookmark) /* copying additional attributes for bookmarks */
+ if(pNewBookmark)
{
const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark);
pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
pNewBookmark->SetShortName(pOldBookmark->GetShortName());
}
+ ::sw::mark::IFieldmark* const pNewFieldmark =
+ dynamic_cast< ::sw::mark::IFieldmark* const >(pNewMark);
+ if(pNewFieldmark)
+ {
+ const ::sw::mark::IFieldmark* const pOldFieldmark = dynamic_cast< const ::sw::mark::IFieldmark* >(pMark);
+ pNewFieldmark->SetFieldname(pOldFieldmark->GetFieldname());
+ pNewFieldmark->SetFieldHelptext(pOldFieldmark->GetFieldHelptext());
+ }
+
::sfx2::Metadatable const*const pMetadatable(
dynamic_cast< ::sfx2::Metadatable const* >(pMark));
::sfx2::Metadatable *const pNewMetadatable(
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 608ecb57ddd5..61b3a0504a96 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2701,7 +2701,7 @@ void SwPageFrm::UpdateFtnNum()
SwPageFrm* pPage = pTmpBoss->FindPageFrm();
pFtn = NULL;
lcl_NextFtnBoss( pTmpBoss, pPage, sal_False );
- SwFtnContFrm *pCont = pTmpBoss->FindNearestFtnCont();
+ SwFtnContFrm *pCont = pTmpBoss ? pTmpBoss->FindNearestFtnCont() : NULL;
if ( pCont )
pFtn = (SwFtnFrm*)pCont->Lower();
}
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 56df822e16dd..81ab404cd353 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -1173,7 +1173,7 @@ void SwRTFParser::ReadShpTxt(String& s)
}
/*
- * Very basic support for the "Buchhalternase".
+ * Very basic support for the Z-line.
*/
void SwRTFParser::ReadDrawingObject()
{
@@ -1185,6 +1185,9 @@ void SwRTFParser::ReadDrawingObject()
::basegfx::B2DPoint aPoint;
bool bPolygonActive(false);
+ SwFmtHoriOrient aHori( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME );
+ SwFmtVertOrient aVert( 0, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME );
+
while (level>0 && IsParserWorking())
{
nToken = GetNextToken();
@@ -1196,6 +1199,12 @@ void SwRTFParser::ReadDrawingObject()
case '{':
level++;
break;
+ case RTF_DOBXMARGIN:
+ aHori.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA );
+ break;
+ case RTF_DOBYMARGIN:
+ aVert.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA );
+ break;
case RTF_DPX:
aRect.setX(nTokenValue);
break;
@@ -1208,6 +1217,7 @@ void SwRTFParser::ReadDrawingObject()
case RTF_DPYSIZE:
aRect.setHeight(nTokenValue);
break;
+ case RTF_DPLINE:
case RTF_DPPOLYCOUNT:
bPolygonActive = true;
break;
@@ -1244,9 +1254,7 @@ void SwRTFParser::ReadDrawingObject()
aAnchor.SetAnchor( pPam->GetPoint() );
aFlySet.Put( aAnchor );
- SwFmtHoriOrient aHori( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME );
aFlySet.Put( aHori );
- SwFmtVertOrient aVert( 0, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME );
aFlySet.Put( aVert );
pDoc->GetOrCreateDrawModel();
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 25fc96566def..84e58f7ad0cf 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -539,6 +539,9 @@ protected:
/// Sfx item RES_KEEP
virtual void FormatKeep( const SvxFmtKeepItem& ) = 0;
+ /// Compute the grid character pitch
+ sal_uInt32 GridCharacterPitch( const SwTextGridItem& rGrid ) const;
+
/// Sfx item RES_TEXTGRID
virtual void FormatTextGrid( const SwTextGridItem& ) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 497f8bc4f07b..1e257b16b819 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4041,23 +4041,8 @@ void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
pGridAttrList->add( FSNS( XML_w, XML_linePitch ),
OString::valueOf( sal_Int32( nHeight ) ).getStr( ) );
- MSWordStyles * pStyles = m_rExport.pStyles;
- SwFmt * pSwFmt = pStyles->GetSwFmt();
-
- sal_uInt32 nPageCharSize = 0;
-
- if (pSwFmt != NULL)
- {
- nPageCharSize = ItemGet<SvxFontHeightItem>
- (*pSwFmt, RES_CHRATR_FONTSIZE).GetHeight();
- }
-
- sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() :
- rGrid.GetBaseWidth( );
- sal_Int32 nCharSpace = ( nPitch - nPageCharSize ) * 4096 / 20;
-
pGridAttrList->add( FSNS( XML_w, XML_charSpace ),
- OString::valueOf( sal_Int32( nCharSpace ) ).getStr( ) );
+ OString::valueOf( sal_Int32( GridCharacterPitch( rGrid ) ) ).getStr( ) );
m_pSerializer->singleElementNS( XML_w, XML_docGrid, pGridAttrList );
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 9d5a6f9cf879..7a4540007db5 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1622,7 +1622,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNo
xub_StrLen nNextPos = aAttrIter->WhereNext();
xub_StrLen nNextBookmark = nNextPos;
- if( nNextBookmark > nAktPos )//no need to search for bookmarks otherwise
+ if( nNextBookmark > nAktPos ) //no need to search for bookmarks otherwise (checked in UpdatePosition())
{
GetSortedBookmarks( rNode, nAktPos, nNextBookmark - nAktPos );
NearestBookmark( nNextBookmark, nAktPos, false );
@@ -1634,9 +1634,9 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt
{
xub_StrLen nNextPos;
- // go to next attribute if no bookmark is found and if the next attribute position if at the current position
+ // go to next attribute if no bookmark is found or if the bookmark is behind the next attribute position
bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true );
- if( !bNextBookmark && nAktPos >= aAttrIter->WhereNext() )
+ if( !bNextBookmark || nNextPos > aAttrIter->WhereNext() )
aAttrIter->NextPos();
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 63ee393bb83a..6e6164172110 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3641,6 +3641,37 @@ void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* /*pSecti
m_rWW8Export.ReplaceCr( nC );
}
+sal_uInt32 AttributeOutputBase::GridCharacterPitch( const SwTextGridItem& rGrid ) const
+{
+ MSWordStyles * pStyles = GetExport().pStyles;
+ SwFmt * pSwFmt = pStyles->GetSwFmt();
+
+ sal_uInt32 nPageCharSize = 0;
+
+ if (pSwFmt != NULL)
+ {
+ nPageCharSize = ItemGet<SvxFontHeightItem>
+ (*pSwFmt, RES_CHRATR_FONTSIZE).GetHeight();
+ }
+ sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() :
+ rGrid.GetBaseWidth( );
+
+ sal_Int32 nCharWidth = nPitch - nPageCharSize;
+ sal_Int32 nFraction = nCharWidth % 20;
+ if ( nCharWidth < 0 )
+ nFraction = 20 + nFraction;
+ nFraction = ( nFraction * 0xFFF ) / 20;
+ nFraction = ( nFraction & 0x00000FFF );
+
+ sal_Int32 nMain = nCharWidth / 20;
+ if ( nCharWidth < 0 )
+ nMain -= 1;
+ nMain = nMain * 0x1000;
+ nMain = ( nMain & 0xFFFFF000 );
+
+ return sal_uInt32( nFraction + nMain );
+}
+
void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
{
if ( m_rWW8Export.bOutPageDescs && m_rWW8Export.bWrtWW8 )
@@ -3670,22 +3701,8 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch );
m_rWW8Export.InsUInt16( nHeight );
- MSWordStyles * pStyles = m_rWW8Export.pStyles;
- SwFmt * pSwFmt = pStyles->GetSwFmt();
-
- sal_uInt32 nPageCharSize = 0;
-
- if (pSwFmt != NULL)
- {
- nPageCharSize = ItemGet<SvxFontHeightItem>
- (*pSwFmt, RES_CHRATR_FONTSIZE).GetHeight();
- }
- sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() :
- rGrid.GetBaseWidth( );
- sal_Int32 nCharSpace = ( nPitch - nPageCharSize ) * 4096 / 20;
-
m_rWW8Export.InsUInt16( NS_sprm::LN_SDxtCharSpace );
- m_rWW8Export.InsUInt32( nCharSpace );
+ m_rWW8Export.InsUInt32( GridCharacterPitch( rGrid ) );
}
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index fd05e95c58b6..e0459945ecf3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -958,9 +958,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;
}
}
@@ -1210,8 +1210,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);
}
/*
@@ -1371,16 +1371,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;
@@ -1397,11 +1399,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
)
@@ -1409,7 +1411,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())
@@ -2393,10 +2397,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#
/*
@@ -2453,12 +2457,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#
@@ -2623,9 +2627,6 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
// Unicode-Flag neu setzen und notfalls File-Pos korrigieren
// merke: Seek kostet nicht viel, da inline geprueft wird,
// ob die korrekte FilePos nicht schon erreicht ist.
- WW8_FC nStreamPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode);
- pStrm->Seek( nStreamPos );
-
xub_StrLen nLen;
if (nEnd - rPos <= (STRING_MAXLEN-1))
nLen = writer_cast<xub_StrLen>(nEnd - rPos);
@@ -2635,6 +2636,16 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs)
if (!nLen)
return true;
+ sal_Size nRequestedPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode);
+ sal_Size nSeekedPos = pStrm->Seek(nRequestedPos);
+ OSL_ENSURE(nRequestedPos == nSeekedPos, "Document claimed to have more text than available");
+ if (nRequestedPos != nSeekedPos)
+ {
+ //Swallow missing range, e.g. #i95550#
+ rPos+=nLen;
+ return true;
+ }
+
const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() :
RTL_TEXTENCODING_MS_1252;
const CharSet eSrcCJKCharSet = bVer67 ? GetCurrentCJKCharSet() :
@@ -3179,7 +3190,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;
@@ -3187,10 +3198,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 )
{
@@ -3203,10 +3217,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);
}
}
@@ -3342,8 +3356,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;
}
}
@@ -3598,7 +3612,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
pAktColl = 0;
pLstManager = 0;
pAktItemSet = 0;
- pCollA = 0;
pDfltTxtFmtColl = 0;
pStandardFmtColl = 0;
pHdFt = 0;
@@ -3608,7 +3621,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
@@ -4427,7 +4440,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);
@@ -4654,8 +4667,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
maInsertedTables.DelAndMakeTblFrms();
maSectionManager.InsertSegments();
- if (pCollA)
- delete[] pCollA;
+ vColl.clear();
DELETEZ( pStyles );
@@ -5149,16 +5161,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
@@ -5181,7 +5193,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
}
}
// <--
@@ -5208,9 +5223,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())
{
@@ -5350,7 +5365,7 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss)
m_bRegardHindiDigits = aVal[ 12 ] > 0;
}
- sal_uInt16 nMagic;
+ sal_uInt16 nMagic(0);
*pStrm >> nMagic;
// beachte: 6 steht fuer "6 ODER 7", 7 steht fuer "NUR 7"
@@ -5646,6 +5661,8 @@ bool SwWW8ImplReader::InEqualApo(int nLvl) const
//the table.
if (nLvl)
--nLvl;
+ if (nLvl < 0 || static_cast<size_t>(nLvl) >= maApos.size())
+ return false;
return maApos[nLvl];
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 2851b8860a3a..97e218cf0192 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,127 @@ 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
+
+ WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
+ bool operator==(const WW8FlyPara& rSrc) const;
+ void Read(sal_uInt8 nSprm29, WW8PLCFx_Cp_FKP* pPap);
+ void ReadFull(sal_uInt8 nSprm29, SwWW8ImplReader* pIo);
+ void Read(sal_uInt8 nSprm29, 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
//-----------------------------------------
@@ -752,14 +879,15 @@ struct ApoTestResults
{
bool mbStartApo;
bool mbStopApo;
- const sal_uInt8* mpSprm37;
- const sal_uInt8* mpSprm29;
+ bool m_bHasSprm37;
+ bool m_bHasSprm29;
+ sal_uInt8 m_nSprm29;
WW8FlyPara* mpStyleApo;
- ApoTestResults() :
- mbStartApo(false), mbStopApo(false), mpSprm37(0), mpSprm29(0),
- mpStyleApo(0) {}
+ ApoTestResults()
+ : mbStartApo(false), mbStopApo(false), m_bHasSprm37(false)
+ , m_bHasSprm29(false), m_nSprm29(0), mpStyleApo(0) {}
bool HasStartStop() const { return (mbStartApo || mbStopApo); }
- bool HasFrame() const { return (mpSprm29 || mpSprm37 || mpStyleApo); }
+ bool HasFrame() const { return (m_bHasSprm29 || m_bHasSprm37 || mpStyleApo); }
};
struct ANLDRuleMap
@@ -948,7 +1076,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"
@@ -1000,7 +1128,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;
@@ -1089,7 +1216,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 7df5e5fa1a2c..2677a1d92336 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#
@@ -549,8 +549,10 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
to see if we are still in that frame.
*/
- aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
- aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+ aRet.m_bHasSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
+ const sal_uInt8 *pSrpm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+ aRet.m_bHasSprm29 = pSrpm29 != NULL;
+ aRet.m_nSprm29 = pSrpm29 ? *pSrpm29 : 0;
// Is there some frame data here
bool bNowApo = aRet.HasFrame() || pTopLevelTable;
@@ -3664,11 +3666,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;
@@ -3677,13 +3679,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;
}
}
@@ -3699,21 +3701,7 @@ const sal_uInt8* WW8RStyle::HasParaSprm( sal_uInt16 nId ) const
if( !pParaSprms || !nSprmsLen )
return 0;
- const sal_uInt8* pSprms = pParaSprms;
- sal_uInt16 i, x;
-
- for( i=0; i < nSprmsLen; )
- {
- sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
- // Sprm found ?
- if( nAktId == nId )
- return pSprms + maSprmParser.DistanceToData(nId);
-
- x = maSprmParser.GetSprmSize(nAktId, pSprms);
- i = i + x;
- pSprms += x;
- }
- return 0; // Sprm not found
+ return maSprmParser.findSprmData(nId, pParaSprms, nSprmsLen);
}
void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap)
@@ -3727,11 +3715,11 @@ void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap)
nSprmsLen = nLen;
}
- while ( nLen > 0 )
+ WW8SprmIter aSprmIter(pSprms, nLen, maSprmParser);
+ while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
{
- sal_uInt16 nL1 = pIo->ImportSprm(pSprms);
- nLen = nLen - nL1;
- pSprms += nL1;
+ pIo->ImportSprm(pSprm);
+ aSprmIter.advance();
}
pParaSprms = 0;
@@ -3838,8 +3826,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()
@@ -3931,7 +3918,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
@@ -3971,7 +3958,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
@@ -3992,7 +3979,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;
@@ -4002,7 +3992,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 );
@@ -4045,13 +4035,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);
@@ -4071,7 +4064,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.
@@ -4086,7 +4079,7 @@ void WW8RStyle::PostProcessStyles()
*/
for (i=0; i < cstd; ++i)
{
- if (pIo->pCollA[i].bValid)
+ if (pIo->vColl[i].bValid)
{
RecursiveReg(i);
}
@@ -4098,7 +4091,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
@@ -4355,9 +4348,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(
@@ -4377,7 +4370,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;
@@ -4507,7 +4503,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);
@@ -4518,7 +4514,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);
@@ -4539,7 +4535,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 );
}
@@ -4565,11 +4561,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 ?
@@ -4589,8 +4585,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 5e3e2a8cff10..1a837643446a 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 45cc68c4cdfc..cf7ca73e4121 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -470,20 +470,7 @@ SV_IMPL_PTRARR( WW8LFOInfos, WW8LFOInfo_Ptr );
sal_uInt8* WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms,
sal_uInt8 nLen)
{
- sal_uInt8* pSprms = &rSprms;
- sal_uInt16 nRemLen=nLen;
- while (nRemLen > (maSprmParser.getVersion()?1:0))
- {
- sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
- if( nAktId == nId ) // Sprm found
- return pSprms + maSprmParser.DistanceToData(nId);
-
- // gib Zeiger auf Daten
- sal_uInt16 nSize = maSprmParser.GetSprmSize(nAktId, pSprms);
- pSprms += nSize;
- nRemLen -= nSize;
- }
- return 0; // Sprm not found
+ return maSprmParser.findSprmData(nId, &rSprms, nLen);
}
class ListWithId : public std::unary_function<const WW8LSTInfo *, bool>
@@ -775,7 +762,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
for(nLevelB = 0; nLevelB <= nLevel; ++nLevelB)
{
sal_uInt8 nPos = aOfsNumsXCH[nLevelB];
- if (nPos && sNumString.GetChar(nPos-1) < nMaxLevel)
+ if (nPos && nPos < sNumString.Len() && sNumString.GetChar(nPos-1) < nMaxLevel)
{
if (rNotReallyThere[nLevelB])
aOfsNumsXCH[nLevelB] = 0;
@@ -1702,7 +1689,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");
@@ -1738,7 +1728,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
@@ -1786,10 +1780,12 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
if (pLstManager) // sind die Listendeklarationen gelesen?
{
- std::vector<sal_uInt8> aParaSprms;
SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
- OSL_ENSURE(pTxtNd, "Kein Text-Node an PaM-Position");
+ OSL_ENSURE(pTxtNd, "No Text-Node at PaM-Position");
+ if (!pTxtNd)
+ return;
+ std::vector<sal_uInt8> aParaSprms;
const SwNumRule* pRule = bSetAttr ?
pLstManager->GetNumRuleForActivation( nActLFO, nActLevel,
aParaSprms, pTxtNd) : 0;
@@ -2033,8 +2029,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 e8a1d22f06ce..526b829863aa 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2777,9 +2777,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);
@@ -3284,9 +3284,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 8f6ad9f2f439..17002a8f4923 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;
}
@@ -917,6 +917,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
aNewSection.maSep.fEvenlySpaced =
ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false;
+ const sal_uInt8 numrgda = SAL_N_ELEMENTS(aNewSection.maSep.rgdxaColumnWidthSpacing);
if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
{
aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0;
@@ -930,7 +931,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440;
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ if (++nIdx < numrgda)
+ aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
if (i < nCols-1)
{
@@ -941,7 +943,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
if( pSD )
{
nWidth = SVBT16ToShort(pSD + 1);
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ if (++nIdx < numrgda)
+ aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
}
}
}
@@ -1616,11 +1619,8 @@ bool WW8FlyPara::operator==(const WW8FlyPara& rSrc) const
}
// Read fuer normalen Text
-void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap)
+void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8PLCFx_Cp_FKP* pPap)
{
- if (pSprm29)
- nOrigSp29 = *pSprm29; // PPC ( Bindung )
-
const sal_uInt8* pS = 0;
if( bVer67 )
{
@@ -1671,12 +1671,12 @@ void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8PLCFx_Cp_FKP* pPap)
nSp29 = nOrigSp29;
}
-void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
+void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo)
{
WW8PLCFMan* pPlcxMan = pIo->pPlcxMan;
WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
- Read(pSprm29, pPap); // Lies Apo-Parameter
+ Read(nOrigSp29, pPap); // Lies Apo-Parameter
do{ // Block zum rausspringen
if( nSp45 != 0 /* || nSp28 != 0 */ )
@@ -1714,15 +1714,15 @@ 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);
}
WW8FlyPara aF(bVer67, pNowStyleApo);
// Neuer FlaPara zum Vergleich
- aF.Read( pS, pPap ); // WWPara fuer neuen Para
+ aF.Read( *pS, pPap ); // WWPara fuer neuen Para
if( !( aF == *this ) ) // selber APO ? ( oder neuer ? )
bGrafApo = true; // nein -> 1-zeiliger APO
// -> Grafik-APO
@@ -1736,11 +1736,8 @@ void WW8FlyPara::ReadFull(const sal_uInt8* pSprm29, SwWW8ImplReader* pIo)
// Read fuer Apo-Defs in Styledefs
-void WW8FlyPara::Read(const sal_uInt8* pSprm29, WW8RStyle* pStyle)
+void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8RStyle* pStyle)
{
- if (pSprm29)
- nOrigSp29 = *pSprm29; // PPC ( Bindung )
-
const sal_uInt8* pS = 0;
if (bVer67)
{
@@ -2315,7 +2312,7 @@ WW8FlyPara *SwWW8ImplReader::ConstructApo(const ApoTestResults &rApo,
// APO-Parameter ermitteln und Test auf bGrafApo
if (rApo.HasFrame())
- pRet->ReadFull(rApo.mpSprm29, this);
+ pRet->ReadFull(rApo.m_nSprm29, this);
pRet->ApplyTabPos(pTabPos);
@@ -2592,7 +2589,7 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo,
WW8FlyPara aF(bVer67, rApo.mpStyleApo);
// WWPara fuer akt. Para
if (rApo.HasFrame())
- aF.Read(rApo.mpSprm29, pPlcxMan->GetPapPLCF());
+ aF.Read(rApo.m_nSprm29, pPlcxMan->GetPapPLCF());
aF.ApplyTabPos(pTabPos);
return aF == *pWFlyPara;
@@ -2664,10 +2661,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)
@@ -2790,7 +2787,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);
}
/***************************************************************************
@@ -2874,8 +2871,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
@@ -2955,9 +2952,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 )
@@ -3522,19 +3519,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;
}
}
@@ -3762,11 +3759,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;
}
@@ -3961,9 +3958,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;
@@ -3982,22 +3979,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;
@@ -4110,15 +4107,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;
}
@@ -4137,15 +4134,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;
}
@@ -4862,14 +4859,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;
- pFly->Read(pData, pStyles);
+ 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;
}
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0c3d3bef395c..fa37caeb9623 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7280,6 +7280,27 @@ sal_uInt16 wwSprmParser::DistanceToData(sal_uInt16 nId) const
return 1 + mnDelta + SprmDataOfs(nId);
}
+sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms,
+ sal_uInt16 nLen) const
+{
+ while (nLen > (getVersion()?1:0))
+ {
+ sal_uInt16 nAktId = GetSprmId(pSprms);
+ if (nAktId == nId) // Sprm found
+ return pSprms + DistanceToData(nId);
+
+ // gib Zeiger auf Daten
+ sal_uInt16 nSize = GetSprmSize(nAktId, pSprms);
+ OSL_ENSURE(nSize <= nLen, "sprm longer than remaining bytes");
+ //Clip to available size if wrong
+ nSize = std::min(nSize, nLen);
+ pSprms += nSize;
+ nLen -= nSize;
+ }
+ // Sprm not found
+ return 0;
+}
+
SEPr::SEPr() :
bkc(2), fTitlePage(0), fAutoPgn(0), nfcPgn(0), fUnlocked(0), cnsPgn(0),
fPgnRestart(0), fEndNote(1), lnc(0), grpfIhdt(0), nLnnMod(0), dxaLnn(0),
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 96300f4fbe5a..f83b428b111b 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -145,6 +145,11 @@ public:
/// The minimum acceptable sprm len possible for this type of parser
int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; }
+ /// Returns the offset to data of the first sprm of id nId, 0
+ // if not found. nLen must be the <= length of pSprms
+ sal_uInt8* findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen)
+ const;
+
inline int getVersion() const { return meVersion; } //cmc, I'm dubious about the usage of this, how can it be 0
};
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 0f4a644989e8..20bfcf380edb 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -906,12 +906,13 @@ bool Tcg255::Read(SvStream *pS)
{
OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
nOffSet = pS->Tell();
- sal_uInt8 nId = 0; //
+ sal_uInt8 nId = 0x40;
*pS >> nId;
while ( nId != 0x40 )
{
if ( !processSubStruct( nId, pS ) )
return false;
+ nId = 0x40;
*pS >> nId;
}
return true;
@@ -948,9 +949,10 @@ bool Tcg255SubStruct::Read(SvStream *pS)
return true;
}
-PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), iMac(0), rgmcd( NULL )
{
}
+
PlfMcd::~PlfMcd()
{
if ( rgmcd )