summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/htmlform.cxx3
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx63
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx28
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx22
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx20
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx31
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx66
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
12 files changed, 180 insertions, 71 deletions
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 725e2018a385..ceba42fd6c54 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -76,6 +76,9 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/form/XImageProducerSupplier.hpp>
+#include <com/sun/star/form/XForm.hpp>
#include <doc.hxx>
#include <pam.hxx>
#include <swtable.hxx>
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index 2b6c0c18b7c7..8ab026415259 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -530,7 +530,7 @@ void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt )
rRTFWrt.SetStrm( *pSaveStrm ); // Stream-Pointer wieder zurueck
- if( aTmpStrm.GetSize() ) // gibt es SWG spezifische Attribute ??
+ if ( aTmpStrm.GetEndOfData() ) // gibt es SWG spezifische Attribute?
{
aTmpStrm.Seek( 0L );
rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << aTmpStrm << '}';
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index cd7fd742825b..c87cc0bb982a 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -72,6 +72,7 @@
#include <fmtline.hxx>
#include <swtable.hxx>
#include <msfilter.hxx>
+#include <swmodule.hxx>
#include <writerfilter/doctok/sprmids.hxx>
@@ -1856,13 +1857,48 @@ void WW8_WrPlcFtnEdn::Append( WW8_CP nCp, const SwFmtFtn& rFtn )
aCntnt.Insert( p, aCntnt.Count() );
}
-void WW8_WrPlcPostIt::Append( WW8_CP nCp, const SwPostItField& rPostIt )
+WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt)
+{
+ mpRichText = pPostIt->GetTextObject();
+ if (!mpRichText)
+ msSimpleText = pPostIt->GetTxt();
+ msOwner = pPostIt->GetPar1();
+ maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
+}
+
+WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) : mpRichText(0)
+{
+ msSimpleText = pRedline->GetComment();
+ msOwner = SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor());
+ maDateTime = pRedline->GetTimeStamp();
+}
+
+void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt )
{
aCps.Insert( nCp, aCps.Count() );
- void* p = (void*)&rPostIt;
+ WW8_Annotation* p = new WW8_Annotation(pPostIt);
aCntnt.Insert( p, aCntnt.Count() );
}
+void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwRedlineData *pRedline )
+{
+ maProcessedRedlines.insert(pRedline);
+ aCps.Insert( nCp, aCps.Count() );
+ WW8_Annotation* p = new WW8_Annotation(pRedline);
+ aCntnt.Insert( p, aCntnt.Count() );
+}
+
+bool WW8_WrPlcAnnotations::IsNewRedlineComment( const SwRedlineData *pRedline )
+{
+ return maProcessedRedlines.find(pRedline) == maProcessedRedlines.end();
+}
+
+WW8_WrPlcAnnotations::~WW8_WrPlcAnnotations()
+{
+ for( USHORT n=0; n < aCntnt.Count(); n++ )
+ delete (WW8_Annotation*)aCntnt[n];
+}
+
bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp,
WW8_CP& rCount )
{
@@ -1882,13 +1918,13 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp,
// Anfaenge fuer PlcfAtnTxt
pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
rWrt.WritePostItBegin();
- if (const OutlinerParaObject* pOutliner = rPFld.GetTextObject())
- rWrt.WriteOutliner(*pOutliner, nTTyp);
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
+ if (rAtn.mpRichText)
+ rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp);
else
{
- String sTxt(rPFld.GetTxt());
+ String sTxt(rAtn.msSimpleText);
sTxt.SearchAndReplaceAll(0x0A, 0x0B);
rWrt.WriteStringAsPara( sTxt );
}
@@ -2015,8 +2051,8 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
// then write first the GrpXstAtnOwners
for ( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
- aStrArr.push_back(rPFld.GetPar1());
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
+ aStrArr.push_back(rAtn.msOwner);
}
//sort and remove duplicates
@@ -2054,10 +2090,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
{
for( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
- sal_uInt32 nDTTM =
- sw::ms::DateTime2DTTM(DateTime(rPFld.GetDate(),rPFld.GetTime()));
+ sal_uInt32 nDTTM = sw::ms::DateTime2DTTM(rAtn.maDateTime);
SwWW8Writer::WriteLong( *rWrt.pTableStrm, nDTTM );
SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
@@ -2137,12 +2172,12 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
{
for ( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
//aStrArr is sorted
myiter aIter = ::std::lower_bound(aStrArr.begin(),
- aStrArr.end(), rPFld.GetPar1());
- ASSERT(aIter != aStrArr.end() && *aIter == rPFld.GetPar1(),
+ aStrArr.end(), rAtn.msOwner);
+ ASSERT(aIter != aStrArr.end() && *aIter == rAtn.msOwner,
"Impossible");
sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
String sAuthor(*aIter);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index f57548b70262..3ea56eb735f3 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3039,7 +3039,7 @@ void WW8Export::ExportDocument_Impl()
pFtn = new WW8_WrPlcFtnEdn( TXT_FTN ); // Footnotes
pEdn = new WW8_WrPlcFtnEdn( TXT_EDN ); // Endnotes
- pAtn = new WW8_WrPlcPostIt; // PostIts
+ pAtn = new WW8_WrPlcAnnotations; // PostIts
pTxtBxs = new WW8_WrPlcTxtBoxes( TXT_TXTBOX );
pHFTxtBxs = new WW8_WrPlcTxtBoxes( TXT_HFTXTBOX );
@@ -3448,7 +3448,7 @@ void WW8_WrPlcFtnEdn::WritePlc( WW8Export& rWrt ) const
}
-bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt )
+bool WW8_WrPlcAnnotations::WriteTxt( WW8Export& rWrt )
{
bool bRet = WriteGenericTxt( rWrt, TXT_ATN, rWrt.pFib->ccpAtn );
rWrt.pFldAtn->Finish( rWrt.Fc2Cp( rWrt.Strm().Tell() ),
@@ -3457,7 +3457,7 @@ bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt )
return bRet;
}
-void WW8_WrPlcPostIt::WritePlc( WW8Export& rWrt ) const
+void WW8_WrPlcAnnotations::WritePlc( WW8Export& rWrt ) const
{
WriteGenericPlc( rWrt, TXT_ATN, rWrt.pFib->fcPlcfandTxt,
rWrt.pFib->lcbPlcfandTxt, rWrt.pFib->fcPlcfandRef,
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 2e0b4ab7d778..83b3b7b265ed 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -109,7 +109,7 @@ class WW8_WrPlcFld;
class WW8_WrMagicTable;
class WW8_WrPlcFtnEdn;
class WW8_WrPlcPn;
-class WW8_WrPlcPostIt;
+class WW8_WrPlcAnnotations;
class MSWordSections;
class WW8_WrPlcTxtBoxes;
class WW8_WrPct; // Verwaltung
@@ -488,7 +488,7 @@ public:
WW8_WrPlcPn* pChpPlc;
MSWordAttrIter* pChpIter;
MSWordStyles* pStyles;
- WW8_WrPlcPostIt* pAtn;
+ WW8_WrPlcAnnotations* pAtn;
WW8_WrPlcTxtBoxes *pTxtBxs, *pHFTxtBxs;
const sw::Frame *mpParentFrame; //If set we are exporting content inside
@@ -1149,16 +1149,30 @@ public:
void Append( WW8_CP nCp, const SwFmtFtn& rFtn );
};
-class WW8_WrPlcPostIt : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts
+struct WW8_Annotation
+{
+ const OutlinerParaObject* mpRichText;
+ String msSimpleText;
+ String msOwner;
+ DateTime maDateTime;
+ WW8_Annotation(const SwPostItField* pPostIt);
+ WW8_Annotation(const SwRedlineData* pRedline);
+};
+
+class WW8_WrPlcAnnotations : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts
{
private:
//No copying
- WW8_WrPlcPostIt(const WW8_WrPlcPostIt&);
- WW8_WrPlcPostIt& operator=(WW8_WrPlcPostIt&);
+ WW8_WrPlcAnnotations(const WW8_WrPlcAnnotations&);
+ WW8_WrPlcAnnotations& operator=(WW8_WrPlcAnnotations&);
+ std::set<const SwRedlineData*> maProcessedRedlines;
public:
- WW8_WrPlcPostIt() {}
+ WW8_WrPlcAnnotations() {}
+ ~WW8_WrPlcAnnotations();
- void Append( WW8_CP nCp, const SwPostItField& rPostIt );
+ void Append( WW8_CP nCp, const SwPostItField* pPostIt );
+ void Append( WW8_CP nCp, const SwRedlineData* pRedLine );
+ bool IsNewRedlineComment( const SwRedlineData* pRedLine );
bool WriteTxt( WW8Export& rWrt );
void WritePlc( WW8Export& rWrt ) const;
};
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index eafd1d5738b7..a5f884a95e8a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -982,6 +982,24 @@ void WW8AttributeOutput::StartRunProperties()
m_nFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
}
+
+void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+{
+ if (pRedlineData)
+ {
+ const String &rComment = pRedlineData->GetComment();
+ //Only possible to export to main text
+ if (rComment.Len() && (m_rWW8Export.nTxtTyp == TXT_MAINTEXT))
+ {
+ if (m_rWW8Export.pAtn->IsNewRedlineComment(pRedlineData))
+ {
+ m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pRedlineData );
+ m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
+ }
+ }
+ }
+}
+
void WW8AttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
{
Redline( pRedlineData );
@@ -2555,8 +2573,8 @@ void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const
void WW8AttributeOutput::PostitField( const SwField* pFld )
{
- const SwPostItField& rPFld = *(SwPostItField*)pFld;
- m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rPFld );
+ const SwPostItField *pPFld = (const SwPostItField*)pFld;
+ m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pPFld );
m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
}
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 4968d88887dc..8d8516433432 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -57,8 +57,7 @@ public:
/// Start of the text run.
///
- /// No-op for binary filters.
- virtual void StartRun( const SwRedlineData* /*pRedlineData*/ ) {}
+ virtual void StartRun( const SwRedlineData* pRedlineData );
/// End of the text run.
///
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 9fb86cf95629..8f922cde14d8 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -503,14 +503,15 @@ ESelection SwWW8ImplReader::GetESelection( long nCpStart, long nCpEnd )
// ItemSet gestopft.
void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, USHORT nColl )
{
- if( nColl < nColls && pCollA[nColl].pFmt && pCollA[nColl].bColl )
+ SwWW8StyInf * pStyInf = GetStyle(nColl);
+ if( pStyInf != NULL && pStyInf->pFmt && pStyInf->bColl )
{
const SfxPoolItem* pItem;
for( USHORT i = POOLATTR_BEGIN; i < POOLATTR_END; i++ )
{
//If we are set in the source and not set in the destination
//then add it in.
- if ( SFX_ITEM_SET == pCollA[nColl].pFmt->GetItemState(
+ if ( SFX_ITEM_SET == pStyInf->pFmt->GetItemState(
i, true, &pItem ) )
{
SfxItemPool *pEditPool = rS.GetPool();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7ef4a4f11aba..a1b6e60f6fe0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -57,9 +57,8 @@
#include <editeng/lrspitem.hxx> // SvxLRSpaceItem
#include <editeng/ulspitem.hxx>
#include <editeng/langitem.hxx>
-// --> OD 2005-02-28 #i43427#
#include <editeng/opaqitem.hxx>
-// <--
+#include <editeng/charhiddenitem.hxx>
#include <filter/msfilter/svxmsbas.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdoole2.hxx>
@@ -989,7 +988,7 @@ 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)
+ if (eState != SFX_ITEM_SET && rReader.pCollA != NULL)
pItem = &(rReader.pCollA[rReader.nAktColl].maWordLR);
}
@@ -1630,7 +1629,9 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
sTxt, aDate );
aPostIt.SetTextObject(pOutliner);
+ pCtrlStck->NewAttr(*pPaM->GetPoint(), SvxCharHiddenItem(false, RES_CHRATR_HIDDEN));
rDoc.InsertPoolItem(*pPaM, SwFmtFld(aPostIt), 0);
+ pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_HIDDEN);
return 0;
}
@@ -2163,7 +2164,7 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
eSrcCharSet = maFontSrcCharSets.top();
if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
eSrcCharSet = pCollA[nCharFmt].GetCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl))
eSrcCharSet = pCollA[nAktColl].GetCharSet();
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
@@ -2221,10 +2222,13 @@ CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
{
if (!maFontSrcCJKCharSets.empty())
eSrcCharSet = maFontSrcCJKCharSets.top();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
- eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if (pCollA != NULL)
+ {
+ 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)
{ // patch from cmc for #i52786#
/*
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 003023f26329..449190268898 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -827,7 +827,8 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen )
{
// nur fuer SwTxtFmtColl, nicht CharFmt
// WW: 0 = no Numbering
- if (pCollA[nAktColl].bColl && *pData)
+ SwWW8StyInf * pColl = GetStyle(nAktColl);
+ if (pColl != NULL && pColl->bColl && *pData)
{
// Bereich WW:1..9 -> SW:0..8 keine Aufzaehlung / Nummerierung
@@ -861,12 +862,16 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen )
void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen ) // Sprm 12
{
- if( !pAktColl || nLen <= 0 // nur bei Styledef
- || !pCollA[nAktColl].bColl // CharFmt -> ignorieren
- || ( nIniFlags & WW8FL_NO_OUTLINE ) ){
- nSwNumLevel = 0xff;
- return;
+ {
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if( !pAktColl || nLen <= 0 // nur bei Styledef
+ || (pStyInf && !pStyInf->bColl) // CharFmt -> ignorieren
+ || ( nIniFlags & WW8FL_NO_OUTLINE ) ){
+ nSwNumLevel = 0xff;
+ return;
+ }
}
+
if( nSwNumLevel <= MAXLEVEL // Bereich WW:1..9 -> SW:0..8
&& nSwNumLevel <= 9 ){ // keine Aufzaehlung / Nummerierung
@@ -892,7 +897,10 @@ void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen )
SwNumRule* pNR = GetStyRule();
SetAnld(pNR, (WW8_ANLD*)pData, 0, false);
pAktColl->SetFmtAttr( SwNumRuleItem( pNR->GetName() ) );
- pCollA[nAktColl].bHasStyNumRule = true;
+
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if (pStyInf != NULL)
+ pStyInf->bHasStyNumRule = true;
}
}
@@ -1007,9 +1015,10 @@ void SwWW8ImplReader::StartAnl(const BYTE* pSprm13)
}
}
- if (!sNumRule.Len() && pCollA[nAktColl].bHasStyNumRule)
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if (!sNumRule.Len() && pStyInf->bHasStyNumRule)
{
- sNumRule = pCollA[nAktColl].pFmt->GetNumRule().GetValue();
+ sNumRule = pStyInf->pFmt->GetNumRule().GetValue();
pNumRule = rDoc.FindNumRulePtr(sNumRule);
if (!pNumRule)
sNumRule.Erase();
@@ -3918,8 +3927,8 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI)
: WW8Style(*pI->pTableStream, _rFib), maSprmParser(_rFib.GetFIBVersion()),
pIo(pI), pStStrm(pI->pTableStream), pStyRule(0), nWwNumLevel(0)
{
- pIo->pCollA = new SwWW8StyInf[ cstd ]; // Style-UEbersetzung WW->SW
pIo->nColls = cstd;
+ pIo->pCollA = cstd ? new SwWW8StyInf[ cstd ] : NULL; // Style-UEbersetzung WW->SW
}
void WW8RStyle::Set1StyleDefaults()
@@ -4691,7 +4700,7 @@ void WW8RStyle::Import()
//
// fuer z.B. Tabellen wird ein immer gueltiger Std-Style gebraucht
- if( pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
+ if( pIo->StyleExists(0) && pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->pCollA[0].pFmt;
else
pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl();
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f20c13889f27..55834f5c0816 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2281,22 +2281,48 @@ WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct,
void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF )
{
+ bool failure = false;
+
// Pointer auf Pos-Array
pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ];
sal_Size nOldPos = pSt->Tell();
pSt->Seek( nFilePos );
- pSt->Read( pPLCF_PosArray, nPLCF );
+ failure = pSt->GetError();
+
+ if (!failure)
+ {
+ pSt->Read( pPLCF_PosArray, nPLCF );
+ failure = pSt->GetError();
+ }
+
+ if (!failure)
+ {
#ifdef OSL_BIGENDIAN
- for( nIdx = 0; nIdx <= nIMax; nIdx++ )
- pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
- nIdx = 0;
+ for( nIdx = 0; nIdx <= nIMax; nIdx++ )
+ pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
+ nIdx = 0;
#endif // OSL_BIGENDIAN
- // Pointer auf Inhalts-Array
- pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
+ // Pointer auf Inhalts-Array
+ pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
+ }
pSt->Seek( nOldPos );
+
+ ASSERT( !failure, "Document has corrupt PLCF, ignoring it" );
+
+ if (failure)
+ MakeFailedPLCF();
+}
+
+void WW8PLCF::MakeFailedPLCF()
+{
+ nIMax = 0;
+ delete[] pPLCF_PosArray;
+ pPLCF_PosArray = new INT32[2];
+ pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
+ pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
}
void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN )
@@ -2359,13 +2385,7 @@ void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN )
ASSERT( !failure, "Document has corrupt PLCF, ignoring it" );
if (failure)
- {
- nIMax = 0;
- delete[] pPLCF_PosArray;
- pPLCF_PosArray = new INT32[2];
- pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
- pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
- }
+ MakeFailedPLCF();
}
bool WW8PLCF::SeekPos(WW8_CP nPos)
@@ -4390,15 +4410,16 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
pBkm = &aD[1];
pEdn = &aD[2];
pFtn = &aD[3];
+ pAnd = &aD[4];
-
- pPcd = ( pBase->pPLCFx_PCD ) ? &aD[4] : 0;
+ pPcd = ( pBase->pPLCFx_PCD ) ? &aD[5] : 0;
//pPcdA index == pPcd index + 1
- pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[5] : 0;
- pChp = &aD[6];
- pAnd = &aD[7];
+ pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[6] : 0;
+
+ pChp = &aD[7];
pPap = &aD[8];
pSep = &aD[9];
+
pSep->pPLCFx = pBase->pSepPLCF;
pFtn->pPLCFx = pBase->pFtnPLCF;
pEdn->pPLCFx = pBase->pEdnPLCF;
@@ -6240,8 +6261,11 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
rSt.Seek( rFib.fcSttbfffn );
+ INT32 nFFn = rFib.lcbSttbfffn - 2;
+
// allocate Font Array
- BYTE* pA = new BYTE[ rFib.lcbSttbfffn - 2 ];
+ BYTE* pA = new BYTE[ nFFn ];
+ memset(pA, 0, nFFn);
WW8_FFN* p = (WW8_FFN*)pA;
ww::WordVersion eVersion = rFib.GetFIBVersion();
@@ -6258,13 +6282,13 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
rSt.SeekRel( 2 );
// read all font information
- rSt.Read( pA, rFib.lcbSttbfffn - 2 );
+ nFFn = rSt.Read( pA, nFFn );
if( eVersion < ww::eWW8 )
{
// try to figure out how many fonts are defined here
nMax = 0;
- long nLeft = rFib.lcbSttbfffn - 2;
+ long nLeft = nFFn;
for(;;)
{
short nNextSiz;
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 3547eaf99391..85c80ba51025 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -295,6 +295,8 @@ private:
machen wir uns hiermit einen PLC:
*/
void GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN );
+
+ void MakeFailedPLCF();
public:
WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct,
WW8_CP nStartPos = -1 );