diff options
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/ww8/WW8TableInfo.cxx | 38 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8TableInfo.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 129 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 19 |
5 files changed, 146 insertions, 47 deletions
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 79cb9b714187..021bbea5f380 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -161,7 +161,8 @@ WW8TableNodeInfo::WW8TableNodeInfo(const SwNode * pNode) : mnDepth(0), mpNode(pNode), - mpNext(NULL) + mpNext(NULL), + mpNextNode(NULL) { } @@ -190,9 +191,7 @@ WW8TableNodeInfo::~WW8TableNodeInfo() } #ifdef DEBUG -//!! does not compile with debug=t -> unresolved external (dbg_out), -//!! sommeone who knows what he wants to get should fix this -// sResult += dbg_out(*mpNode); + sResult += dbg_out(*mpNode); #endif sResult +="</tableNodeInfo>"; @@ -247,6 +246,17 @@ void WW8TableNodeInfo::setTable(const SwTable * pTable) void WW8TableNodeInfo::setNext(WW8TableNodeInfo * pNext) { mpNext = pNext; + +#ifdef DEBUG + ::std::clog << "<setnext><from>" << toString() << "</from><to>" + << pNext->toString() << "</to></setnext>" + << ::std::endl; +#endif +} + +void WW8TableNodeInfo::setNextNode(SwNode * pNode) +{ + mpNode = pNode; } void WW8TableNodeInfo::setCell(sal_uInt32 nCell) @@ -287,6 +297,11 @@ WW8TableNodeInfo * WW8TableNodeInfo::getNext() const return mpNext; } +SwNode * WW8TableNodeInfo::getNextNode() const +{ + return mpNextNode; +} + bool WW8TableNodeInfo::isEndOfLine() const { return getInnerForDepth(mnDepth)->isEndOfLine(); @@ -362,6 +377,14 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) pPrev = processTableLine(pTable, pLine, n, 1, pPrev); } + if (pPrev != NULL) + { + SwTableNode * pTableNode = pTable->GetTableNode(); + SwEndNode * pEndNode = pTableNode->EndOfSectionNode(); + + pPrev->setNextNode(pEndNode); + } + #ifdef DEBUG ::std::clog << "</processSwTable>" << ::std::endl; #endif @@ -602,6 +625,13 @@ const SwNode * WW8TableInfo::getNextNode(const SwNode * pNode) if (pNextInfo != NULL) pResult = pNextInfo->getNode(); + else + { + SwNode * pNextNode = pNodeInfo->getNextNode(); + + if (pNextNode != NULL) + pResult = pNextNode; + } } return pResult; diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index a2d03337fb29..035464fb751b 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -97,6 +97,7 @@ private: const SwNode * mpNode; Inners_t mInners; WW8TableNodeInfo * mpNext; + SwNode * mpNextNode; public: typedef boost::shared_ptr<WW8TableNodeInfo> Pointer_t; @@ -112,6 +113,7 @@ public: void setCell(sal_uInt32 nCell); void setRow(sal_uInt32 nRow); void setNext(WW8TableNodeInfo * pNext); + void setNextNode(SwNode * pNode); sal_uInt32 getDepth() const; bool isEndOfLine() const; @@ -120,6 +122,7 @@ public: const SwTableBox * getTableBox() const; const SwTable * getTable() const; WW8TableNodeInfo * getNext() const; + SwNode * getNextNode() const; const Inners_t & getInners() const; const WW8TableNodeInfoInner::Pointer_t getFirstInner() const; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c015c13fc65b..dcef287a1537 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2370,37 +2370,45 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t if ( m_rWW8Export.bWrtWW8 ) { + sal_uInt32 aSprmIds[] = {NS_sprm::LN_TCellShd, NS_sprm::LN_TCellShadow}; + sal_uInt8 nBoxes0 = rTabBoxes.Count(); if (nBoxes0 > 21) nBoxes0 = 21; - m_rWW8Export.InsUInt16( NS_sprm::LN_TCellShd ); - m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), m_rWW8Export.pO->Count() ); - - for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) + for (sal_uInt32 m = 0; m < 2; m++) { - const SwTableBox * pBox1 = rTabBoxes[n]; - const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); - const SfxPoolItem * pI = NULL; - Color aColor; + m_rWW8Export.InsUInt16( aSprmIds[m] ); + m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), + m_rWW8Export.pO->Count() ); - if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) ) + for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) { - aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); - } - else - aColor = COL_AUTO; + const SwTableBox * pBox1 = rTabBoxes[n]; + const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); + const SfxPoolItem * pI = NULL; + Color aColor; + + if ( SFX_ITEM_ON == + pFrmFmt->GetAttrSet(). + GetItemState( RES_BACKGROUND, false, &pI ) ) + { + aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); + } + else + aColor = COL_AUTO; - WW8SHDLong aSHD; - aSHD.setCvFore( 0xFF000000 ); + WW8SHDLong aSHD; + aSHD.setCvFore( 0xFF000000 ); - sal_uInt32 nBgColor = aColor.GetColor(); - if ( nBgColor == COL_AUTO ) - aSHD.setCvBack( 0xFF000000 ); - else - aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); + sal_uInt32 nBgColor = aColor.GetColor(); + if ( nBgColor == COL_AUTO ) + aSHD.setCvBack( 0xFF000000 ); + else + aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); - aSHD.Write( m_rWW8Export ); + aSHD.Write( m_rWW8Export ); + } } } } @@ -2415,11 +2423,24 @@ void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode ) OutWW6FlyFrmsInCntnt( rNode ); } +#ifdef DEBUG +struct SwNodeHash +{ + size_t operator()(SwNode * pNode) const { return reinterpret_cast<size_t>(pNode); } +}; + +typedef ::std::hash_set<SwNode *, SwNodeHash> SwNodeHashSet; +typedef ::std::deque<SwNode *> SwNodeDeque; +#endif + void MSWordExportBase::WriteText() { #ifdef DEBUG ::std::clog << "<WriteText>" << ::std::endl; -// ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; + ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; + + SwNodeHashSet aNodeSet; + SwNodeDeque aNodeDeque; #endif while( pCurPam->GetPoint()->nNode < pCurPam->GetMark()->nNode || @@ -2428,6 +2449,29 @@ void MSWordExportBase::WriteText() { SwNode * pNd = pCurPam->GetNode(); +#ifdef DEBUG + if (aNodeSet.find(pNd) == aNodeSet.end()) + { + aNodeSet.insert(pNd); + aNodeDeque.push_back(pNd); + } + else + { + ::std::clog << "<already-done><which>" << dbg_out(*pNd) + << "</which><nodes>" << ::std::endl; + + SwNodeDeque::const_iterator aEnd = aNodeDeque.end(); + + for (SwNodeDeque::const_iterator aIt = aNodeDeque.begin(); + aIt != aEnd; aIt++) + { + ::std::clog << dbg_out(**aIt) << ::std::endl; + } + + ::std::clog << "</nodes></already-done>" << ::std::endl; + } +#endif + if ( pNd->IsTxtNode() ) SectionBreaksAndFrames( *pNd->GetTxtNode() ); @@ -2664,19 +2708,24 @@ void WW8Export::WriteFkpPlcUsw() // Write SttbfAssoc WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> (pDoc->getExternalData(::sw::STTBF_ASSOC).get()); - ::std::vector<String> aStrings; - - ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); - ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); - for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); - aIt != aItEnd; aIt++) + // --> OD 2009-10-19 #i106057# + if ( pSttbfAssoc ) + // <-- { - String aStr(aIt->getStr()); - aStrings.push_back(aStr); - } + ::std::vector<String> aStrings; - WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, - pFib->lcbSttbfAssoc); + ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); + ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); + for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); + aIt != aItEnd; aIt++) + { + String aStr(aIt->getStr()); + aStrings.push_back(aStr); + } + + WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, + pFib->lcbSttbfAssoc); + } } Strm().Seek( 0 ); @@ -2685,10 +2734,15 @@ void WW8Export::WriteFkpPlcUsw() ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> (pDoc->getExternalData(::sw::FIB).get()); - pFib->fReadOnlyRecommended = - pFibData->getReadOnlyRecommended() ? 1 : 0; - pFib->fWriteReservation = - pFibData->getWriteReservation() ? 1 : 0; + // --> OD 2009-10-19 #i106057# + if ( pFibData ) + // <-- + { + pFib->fReadOnlyRecommended = + pFibData->getReadOnlyRecommended() ? 1 : 0; + pFib->fWriteReservation = + pFibData->getWriteReservation() ? 1 : 0; + } pFib->Write( Strm() ); // FIB } @@ -3590,6 +3644,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer #endif TableRowEnd(pNodeInfoInner->getDepth()); + ShortToSVBT16(0, nStyle); m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style # TableInfoRow(pNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index ddb8e13bb867..3b91de937668 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -966,7 +966,7 @@ void WW8AttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTe TableRowEnd( pTextNodeInfoInner->getDepth() ); SVBT16 nSty; - ShortToSVBT16( m_rWW8Export.nStyleBeforeFly, nSty ); + ShortToSVBT16( 0, nSty ); m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style # TableInfoRow( pTextNodeInfoInner ); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), @@ -1559,7 +1559,7 @@ bool WW8Export::TransBrush(const Color& rCol, WW8_SHD& rShd) rShd = WW8_SHD(); // alles Nullen : transparent else { - rShd.SetFore( 8); + rShd.SetFore( 0); rShd.SetBack( TransCol( rCol ) ); rShd.SetStyle( bWrtWW8, 0 ); } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 7342843e6b9a..5cb19358f385 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1170,6 +1170,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) pS++; short nLen = (INT16)SVBT16ToShort( pS - 2 ); // nicht schoen + BYTE nCols = *pS; // Anzahl der Zellen short nOldCols = nWwCols; @@ -1200,7 +1201,11 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) setcelldefaults(pTCs,nCols); } - if( nFileCols ) + short nColsToRead = nFileCols; + if (nColsToRead > nCols) + nColsToRead = nCols; + + if( nColsToRead ) { // lies TCs ein @@ -1216,9 +1221,9 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) if( bVer67 ) { WW8_TCellVer6* pTc = (WW8_TCellVer6*)pT; - for(i=0; i<nFileCols; i++, ++pAktTC,++pTc) + for(i=0; i<nColsToRead; i++, ++pAktTC,++pTc) { - if( i < nFileCols ) + if( i < nColsToRead ) { // TC aus File ? BYTE aBits1 = SVBT8ToByte( pTc->aBits1Ver6 ); pAktTC->bFirstMerged = ( ( aBits1 & 0x01 ) != 0 ); @@ -1248,7 +1253,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) else { WW8_TCellVer8* pTc = (WW8_TCellVer8*)pT; - for (int k = 0; k < nFileCols; ++k, ++pAktTC, ++pTc ) + for (int k = 0; k < nColsToRead; ++k, ++pAktTC, ++pTc ) { UINT16 aBits1 = SVBT16ToShort( pTc->aBits1Ver8 ); pAktTC->bFirstMerged = ( ( aBits1 & 0x0001 ) != 0 ); @@ -1296,6 +1301,12 @@ void WW8TabBandDesc::ProcessSprmTSetBRC(bool bVer67, const BYTE* pParamsTSetBRC) BYTE nitcLim = pParamsTSetBRC[1];// (last col to be changed)+1 BYTE nFlag = *(pParamsTSetBRC+2); + if (nitcFirst >= nWwCols) + return; + + if (nitcLim > nWwCols) + nitcLim = nWwCols; + bool bChangeRight = (nFlag & 0x08) ? true : false; bool bChangeBottom = (nFlag & 0x04) ? true : false; bool bChangeLeft = (nFlag & 0x02) ? true : false; |