summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtww8.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter/ww8/wrtww8.cxx')
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx239
1 files changed, 122 insertions, 117 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 05e535cff636..f8b34bb3174f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -268,19 +268,19 @@ static void WriteDop( WW8Export& rWrt )
xDocProps = xDPS->getDocumentProperties();
DBG_ASSERT(xDocProps.is(), "DocumentProperties is null");
- rDop.lKeyProtDoc = pDocShell->GetModifyPasswordHash();
+ rDop.lKeyProtDoc = pDocShell->GetModifyPasswordHash();
}
if ((rWrt.pSepx && rWrt.pSepx->DocumentIsProtected()) ||
rDop.lKeyProtDoc != 0)
- {
+ {
rDop.fProtEnabled = 1;
}
- else
+ else
{
rDop.fProtEnabled = 0;
}
-
+
if (!xDocProps.is()) {
rDop.dttmCreated = rDop.dttmRevised = rDop.dttmLastPrint = 0x45FBAC69;
} else {
@@ -1624,7 +1624,7 @@ void SwWW8Writer::WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAd
ww::bytes aBytes;
SwWW8Writer::InsUInt16(aBytes, rStr.Len());
SwWW8Writer::InsAsString16(aBytes, rStr);
- if (bAddZero)
+ if (bAddZero)
SwWW8Writer::InsUInt16(aBytes, 0);
rStrm.Write(&aBytes[0], aBytes.size());
}
@@ -1712,7 +1712,7 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt,
if( nStt || nLen != rStr.Len() )
{
String sOut( rStr.Copy( nStt, nLen ) );
-
+
#ifdef DEBUG
::std::clog << ::rtl::OUStringToOString(sOut, RTL_TEXTENCODING_ASCII_US).getStr() << ::std::endl;
#endif
@@ -1722,7 +1722,7 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt,
else
SwWW8Writer::WriteString8(Strm(), sOut, false, eChrSet);
}
- else
+ else
{
#ifdef DEBUG
::std::clog << ::rtl::OUStringToOString(rStr, RTL_TEXTENCODING_ASCII_US).getStr() << ::std::endl;
@@ -1734,9 +1734,9 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt,
SwWW8Writer::WriteString8(Strm(), rStr, false, eChrSet);
}
}
-
+
#ifdef DEBUG
- ::std::clog << "</OutSwString>" << ::std::endl;
+ ::std::clog << "</OutSwString>" << ::std::endl;
#endif
}
@@ -1746,7 +1746,7 @@ void WW8Export::WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
WriteChar('\007');
else
WriteChar( '\015' );
-
+
pPiece->SetParaBreak();
}
@@ -1878,12 +1878,12 @@ void WW8AttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pT
if ( nDepth > 0 )
{
- /* Cell */
+ /* Cell */
m_rWW8Export.InsUInt16( NS_sprm::LN_PFInTable );
m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() );
m_rWW8Export.InsUInt16( NS_sprm::LN_PTableDepth );
m_rWW8Export.InsUInt32( nDepth );
-
+
if ( nDepth > 1 && pTableTextNodeInfoInner->isEndOfCell() )
{
m_rWW8Export.InsUInt16( NS_sprm::LN_PCell );
@@ -1965,15 +1965,15 @@ static sal_uInt16 lcl_TCFlags(const SwTableBox * pBox, long nRowSpan)
void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
- const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwTableBoxes & rTblBoxes = pTabLine->GetTabBoxes();
-
+
sal_uInt8 nBoxes = rTblBoxes.Count();
for ( sal_uInt8 n = 0; n < nBoxes; n++ )
{
const SwTableBox * pTabBox1 = rTblBoxes[n];
const SwFrmFmt * pFrmFmt = pTabBox1->GetFrmFmt();
-
+
if ( FRMDIR_VERT_TOP_RIGHT == m_rWW8Export.TrueFrameDirection( *pFrmFmt ) )
{
m_rWW8Export.InsUInt16( NS_sprm::LN_TTextFlow );
@@ -1987,7 +1987,7 @@ void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_
void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
- const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt();
/*
@@ -1995,7 +1995,7 @@ void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pT
feature equivalent to this, Word stores 1 for fCantSplit if the row
cannot be split, we set true if we can split it. An example is #i4569#
*/
-
+
const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit();
BYTE nCantSplit = (!rSplittable.GetValue()) ? 1 : 0;
if ( m_rWW8Export.bWrtWW8 )
@@ -2015,7 +2015,7 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
const SwFrmFmt * pFrmFmt = pTable->GetFrmFmt();
-
+
if ( m_rWW8Export.bWrtWW8 )
{
if ( m_rWW8Export.TrueFrameDirection(*pFrmFmt) == FRMDIR_HORI_RIGHT_TOP )
@@ -2029,7 +2029,7 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable
void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
- const SwTableLine * pTabLine = pTabBox->GetUpper();
+ const SwTableLine * pTabLine = pTabBox->GetUpper();
const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt();
// Zeilenhoehe ausgeben sprmTDyaRowHeight
@@ -2051,21 +2051,21 @@ void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTab
m_rWW8Export.pO->Insert( 189, m_rWW8Export.pO->Count() );
m_rWW8Export.InsUInt16( (USHORT)nHeight );
}
-
+
}
void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
-
+
const SwFrmFmt *pFmt = pTable->GetFrmFmt();
OSL_ENSURE(pFmt,"Impossible");
if (!pFmt)
return;
-
+
const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
-
+
if (
(text::RelOrientation::PRINT_AREA == rHori.GetRelationOrient() ||
text::RelOrientation::FRAME == rHori.GetRelationOrient())
@@ -2095,11 +2095,11 @@ void WW8AttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTab
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
const SwTableFmt * pTableFmt = dynamic_cast<const SwTableFmt *>(pTable->GetRegisteredIn());
-
+
if (pTableFmt != NULL)
{
const SvxULSpaceItem & rUL = pTableFmt->GetULSpace();
-
+
if (rUL.GetUpper() > 0)
{
sal_uInt8 nPadding = 2;
@@ -2123,13 +2123,13 @@ void WW8AttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTab
m_rWW8Export.InsUInt16(NS_sprm::LN_TDyaFromTextBottom);
m_rWW8Export.InsUInt16(rUL.GetLower());
}
- }
+ }
}
void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTable * pTable = pTableTextNodeInfoInner->getTable();
-
+
if ( pTable->GetRowsToRepeat() > pTableTextNodeInfoInner->getRow() )
{
if( m_rWW8Export.bWrtWW8 )
@@ -2139,11 +2139,11 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
m_rWW8Export.pO->Insert( 1, m_rWW8Export.pO->Count() );
}
- ww8::TableBoxVectorPtr pTableBoxes =
+ ww8::TableBoxVectorPtr pTableBoxes =
pTableTextNodeInfoInner->getTableBoxesOfRow();
// number of cell written
sal_uInt32 nBoxes = pTableBoxes->size();
-
+
// sprm header
m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable );
sal_uInt16 nSprmSize = 2 + (nBoxes + 1) * 2 + nBoxes * 20;
@@ -2152,7 +2152,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
// number of boxes
m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes), m_rWW8Export.pO->Count() );
- /* cellxs */
+ /* cellxs */
/*
ALWAYS relative when text::HoriOrientation::NONE (nPageSize + ( nPageSize / 10 )) < nTblSz,
in that case the cell width's and table width's are not real. The table
@@ -2167,9 +2167,9 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
-
+
sal_uInt16 nTblOffset = 0;
-
+
if (
(text::RelOrientation::PRINT_AREA == rHori.GetRelationOrient() ||
text::RelOrientation::FRAME == rHori.GetRelationOrient())
@@ -2192,61 +2192,61 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
break;
}
}
-
+
m_rWW8Export.InsUInt16( nTblOffset );
-
+
ww8::GridColsPtr pGridCols = GetGridCols( pTableTextNodeInfoInner );
- for ( ww8::GridCols::const_iterator it = pGridCols->begin(),
+ for ( ww8::GridCols::const_iterator it = pGridCols->begin(),
end = pGridCols->end(); it != end; ++it )
{
m_rWW8Export.InsUInt16( static_cast<USHORT>( *it ) + nTblOffset );
}
-
+
/* TCs */
ww8::RowSpansPtr pRowSpans = pTableTextNodeInfoInner->getRowSpansOfRow();
ww8::RowSpans::const_iterator aItRowSpans = pRowSpans->begin();
ww8::TableBoxVector::const_iterator aIt;
ww8::TableBoxVector::const_iterator aItEnd = pTableBoxes->end();
-
+
#ifdef DEBUG
size_t nRowSpans = pRowSpans->size();
size_t nTableBoxes = pTableBoxes->size();
(void) nRowSpans;
(void) nTableBoxes;
#endif
-
+
for( aIt = pTableBoxes->begin(); aIt != aItEnd; ++aIt, ++aItRowSpans)
{
#ifdef DEBUG
sal_uInt16 npOCount = m_rWW8Export.pO->Count();
#endif
-
+
const SwTableBox * pTabBox1 = *aIt;
const SwFrmFmt * pBoxFmt = NULL;
if (pTabBox1 != NULL)
pBoxFmt = pTabBox1->GetFrmFmt();
-
+
if ( m_rWW8Export.bWrtWW8 )
{
- sal_uInt16 nFlags =
+ sal_uInt16 nFlags =
lcl_TCFlags(pTabBox1, *aItRowSpans);
m_rWW8Export.InsUInt16( nFlags );
}
-
+
static BYTE aNullBytes[] = { 0x0, 0x0 };
-
+
m_rWW8Export.pO->Insert( aNullBytes, 2, m_rWW8Export.pO->Count() ); // dummy
if (pBoxFmt != NULL)
{
const SvxBoxItem & rBoxItem = pBoxFmt->GetBox();
-
+
m_rWW8Export.Out_SwFmtTableBox( *m_rWW8Export.pO, &rBoxItem ); // 8/16 Byte
}
else
m_rWW8Export.Out_SwFmtTableBox( *m_rWW8Export.pO, NULL); // 8/16 Byte
-
+
#ifdef DEBUG
- ::std::clog << "<tclength>" << m_rWW8Export.pO->Count() - npOCount << "</tclength>"
+ ::std::clog << "<tclength>" << m_rWW8Export.pO->Count() - npOCount << "</tclength>"
<< ::std::endl;
#endif
}
@@ -2256,7 +2256,7 @@ ww8::GridColsPtr AttributeOutputBase::GetGridCols( ww8::WW8TableNodeInfoInner::P
{
return pTableTextNodeInfoInner->getGridColsOfRow(*this);
}
-
+
void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableTextNodeInfoInner, sal_uInt32& rPageSize, bool& rRelBoxSize )
{
sal_uInt32 nPageSize = 0;
@@ -2310,9 +2310,9 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT
const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
nPageSize -= (rLR.GetLeft() + rLR.GetRight());
}
-
+
}
-
+
OSL_ENSURE(nWidthPercent, "Impossible");
if (nWidthPercent)
{
@@ -2337,7 +2337,7 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe
BOX_LINE_TOP, BOX_LINE_LEFT,
BOX_LINE_BOTTOM, BOX_LINE_RIGHT
};
-
+
for ( int i = 0; i < 4; ++i )
{
SwWW8Writer::InsUInt16( *m_rWW8Export.pO, 0xD634 );
@@ -2346,7 +2346,7 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe
m_rWW8Export.pO->Insert( BYTE(1), m_rWW8Export.pO->Count() );
m_rWW8Export.pO->Insert( BYTE(1 << i), m_rWW8Export.pO->Count() );
m_rWW8Export.pO->Insert( BYTE(3), m_rWW8Export.pO->Count() );
-
+
SwWW8Writer::InsUInt16( *m_rWW8Export.pO,
pFrmFmt->GetBox().GetDistance( aBorders[i] ) );
}
@@ -2364,17 +2364,17 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t
else
m_rWW8Export.pO->Insert( (BYTE)191, m_rWW8Export.pO->Count() );
m_rWW8Export.pO->Insert( (BYTE)(nBoxes * 2), m_rWW8Export.pO->Count() ); // Len
-
+
for ( sal_uInt8 n = 0; n < nBoxes; n++ )
{
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();
+ aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
}
else
aColor = COL_AUTO;
@@ -2390,32 +2390,32 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t
sal_uInt8 nBoxes0 = rTabBoxes.Count();
if (nBoxes0 > 21)
nBoxes0 = 21;
-
+
for (sal_uInt32 m = 0; m < 2; m++)
{
m_rWW8Export.InsUInt16( aSprmIds[m] );
- m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10),
+ m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10),
m_rWW8Export.pO->Count() );
-
+
for ( sal_uInt8 n = 0; n < nBoxes0; n++ )
{
const SwTableBox * pBox1 = rTabBoxes[n];
const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt();
const SfxPoolItem * pI = NULL;
Color aColor;
-
- if ( SFX_ITEM_ON ==
+
+ if ( SFX_ITEM_ON ==
pFrmFmt->GetAttrSet().
GetItemState( RES_BACKGROUND, false, &pI ) )
{
- aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
+ aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor();
}
else
aColor = COL_AUTO;
-
+
WW8SHDLong aSHD;
aSHD.setCvFore( 0xFF000000 );
-
+
sal_uInt32 nBgColor = aColor.GetColor();
if ( nBgColor == COL_AUTO )
aSHD.setCvBack( 0xFF000000 );
@@ -2423,8 +2423,8 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t
aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) );
aSHD.Write( m_rWW8Export );
- }
- }
+ }
+ }
}
}
@@ -2522,16 +2522,16 @@ void MSWordExportBase::WriteText()
SwNode * pCurrentNode = &pCurPam->GetPoint()->nNode.GetNode();
const SwNode * pNextNode = mpTableInfo->getNextNode(pCurrentNode);
-
+
if (pNextNode != NULL)
pCurPam->GetPoint()->nNode = SwNodeIndex(*pNextNode);
else
pCurPam->GetPoint()->nNode++;
-
+
ULONG nPos = pCurPam->GetPoint()->nNode.GetIndex();
::SetProgressState( nPos, pCurPam->GetDoc()->GetDocShell() );
}
-
+
#ifdef DEBUG
::std::clog << "</WriteText>" << ::std::endl;
#endif
@@ -2720,13 +2720,13 @@ void WW8Export::WriteFkpPlcUsw()
// Reclaim stored FIB data from document.
::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *>
(pDoc->getExternalData(::sw::FIB).get());
-
+
if ( pFibData )
// <--
{
- pFib->fReadOnlyRecommended =
+ pFib->fReadOnlyRecommended =
pFibData->getReadOnlyRecommended() ? 1 : 0;
- pFib->fWriteReservation =
+ pFib->fWriteReservation =
pFibData->getWriteReservation() ? 1 : 0;
}
@@ -2868,7 +2868,7 @@ namespace
rCtx.Encode(in, nBS, in, nBS);
rOut.Write(in, nBS);
}
- }
+ }
}
void MSWordExportBase::ExportDocument( bool bWriteAll )
@@ -3073,12 +3073,12 @@ void WW8Export::ExportDocument_Impl()
StoreDoc1();
if ( bEncrypt )
- {
+ {
// Generate random number with a seed of time as salt.
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool ();
- rtl_random_addBytes ( aRandomPool, &aTime, 8 );
+ rtl_random_addBytes ( aRandomPool, &aTime, 8 );
sal_uInt8 aDocId[ 16 ] = {0};
rtl_random_getBytes( aRandomPool, aDocId, 16 );
@@ -3098,11 +3098,11 @@ void WW8Export::ExportDocument_Impl()
pDataStrmTemp = &xDataStrm;
if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp)
- EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp);
+ EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp);
EncryptRC4(aCtx, *pTableStrm, *pTableStrmTemp);
- // Write Unencrypted Header 52 bytes to the start of the table stream
+ // Write Unencrypted Header 52 bytes to the start of the table stream
// EncryptionVersionInfo (4 bytes): A Version structure where Version.vMajor MUST be 0x0001, and Version.vMinor MUST be 0x0001.
pTableStrmTemp->Seek( 0 );
sal_uInt32 nEncType = 0x10001;
@@ -3114,19 +3114,19 @@ void WW8Export::ExportDocument_Impl()
pTableStrmTemp->Write( aDocId, 16 );
pTableStrmTemp->Write( pSaltData, 16 );
- pTableStrmTemp->Write( pSaltDigest, 16 );
+ pTableStrmTemp->Write( pSaltDigest, 16 );
EncryptRC4(aCtx, GetWriter().Strm(), *pStrmTemp);
- // Write Unencrypted Fib 68 bytes to the start of the workdocument stream
+ // Write Unencrypted Fib 68 bytes to the start of the workdocument stream
pFib->fEncrypted = 1; // fEncrypted indicates the document is encrypted.
pFib->fObfuscated = 0; // Must be 0 for RC4.
pFib->nHash = 0x34; // encrypt header bytes count of table stream.
pFib->nKey = 0; // lkey2 must be 0 for RC4.
- pStrmTemp->Seek( 0 );
- pFib->WriteHeader( *pStrmTemp );
- }
+ pStrmTemp->Seek( 0 );
+ pFib->WriteHeader( *pStrmTemp );
+ }
if (pUsedNumTbl) // all used NumRules
{
@@ -3320,7 +3320,7 @@ ULONG SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed,
MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
: aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0),
- pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0),
+ pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0),
mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0),
mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0),
pStyles( NULL ),
@@ -3554,13 +3554,19 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
pChpPlc->AppendFkpEntry( Strm().Tell(), sizeof( aArr1 ), aArr1 );
- sal_uInt8 aFldHeader[] =
+ struct FFDataHeader
{
- 0xFF, 0xFF, 0xFF, 0xFF, // Unicode Marker...
- 0, 0, 0, 0,// 0, 0, 0, 0
+ sal_uInt32 version;
+ sal_uInt16 bits;
+ sal_uInt16 cch;
+ sal_uInt16 hps;
+ FFDataHeader() : version( 0xFFFFFFFF ), bits(0), cch(0), hps(0) {}
};
- aFldHeader[4] |= (type & 0x03);
+
+ FFDataHeader aFldHeader;
+ aFldHeader.bits |= (type & 0x03);
+
sal_Int32 ffres = 0; // rFieldmark.GetFFRes();
if ( pAsCheckbox && pAsCheckbox->IsChecked() )
ffres = 1;
@@ -3572,12 +3578,12 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
else
ffres = 0;
}
- aFldHeader[4] |= ( (ffres<<2) & 0x7C );
+ aFldHeader.bits |= ( (ffres<<2) & 0x7C );
std::vector< ::rtl::OUString > aListItems;
if (type==2)
{
- aFldHeader[5] |= 0x80; // ffhaslistbox
+ aFldHeader.bits |= 0x8000; // ffhaslistbox
const ::sw::mark::IFieldmark::parameter_map_t* const pParameters = rFieldmark.GetParameters();
::sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY));
if(pListEntries != pParameters->end())
@@ -3598,16 +3604,16 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
const sal_uInt8 aFldData[] =
{
- 0x44,0, // the start of "next" data
+ 0x44,0, // the start of "next" data
0,0,0,0,0,0,0,0,0,0, // PIC-Structure! /10
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16
0,0,0,0, // / /4
};
- sal_uInt32 slen = sizeof(sal_uInt32)
+ sal_uInt32 slen = sizeof(sal_uInt32)
+ sizeof(aFldData)
- + sizeof( aFldHeader )
+ + sizeof( aFldHeader.version ) + sizeof( aFldHeader.bits ) + sizeof( aFldHeader.cch ) + sizeof( aFldHeader.hps )
+ 2*ffname.getLength() + 4
+ 2*ffdeftext.getLength() + 4
+ 2*ffformat.getLength() + 4
@@ -3615,8 +3621,10 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
+ 2*ffstattext.getLength() + 4
+ 2*ffentrymcr.getLength() + 4
+ 2*ffexitmcr.getLength() + 4;
+ if ( type )
+ slen += 2; // wDef
if ( type==2 ) {
- slen += 2; // for 0xFF, 0xFF
+ slen += 2; // sttb ( fExtend )
slen += 4; // for num of list items
const int items = aListItems.size();
for( int i = 0; i < items; i++ ) {
@@ -3631,17 +3639,14 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
OSL_ENSURE( len == 0x44-sizeof(sal_uInt32), "SwWW8Writer::WriteFormData(..) - wrong aFldData length" );
pDataStrm->Write( aFldData, len );
- len = sizeof( aFldHeader );
- OSL_ENSURE( len == 8, "SwWW8Writer::WriteFormData(..) - wrong aFldHeader length" );
-
- pDataStrm->Write( aFldHeader, len );
+ *pDataStrm << aFldHeader.version << aFldHeader.bits << aFldHeader.cch << aFldHeader.hps;
SwWW8Writer::WriteString_xstz( *pDataStrm, ffname, true ); // Form field name
- if ( type == 0 )
- SwWW8Writer::WriteString_xstz( *pDataStrm, ffdeftext, true );
- else
- pDataStrm->WriteNumber( (sal_uInt16)0 );
+ SwWW8Writer::WriteString_xstz( *pDataStrm, ffdeftext, true );
+ if ( type )
+ *pDataStrm << sal_uInt16(0);
+
SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffformat ), true );
SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffhelptext ), true );
@@ -3674,7 +3679,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
#endif
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
-
+
sal_uInt32 nShadowsBefore = pNodeInfoInner->getShadowsBefore();
if (nShadowsBefore > 0)
{
@@ -3687,14 +3692,14 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
for (sal_uInt32 n = 0; n < nShadowsBefore; ++n)
{
m_rWW8Export.WriteCR(pTmpNodeInfoInner);
-
- m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2,
+
+ m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2,
m_rWW8Export.pO->Count() ); // Style #
TableInfoCell(pTmpNodeInfoInner);
m_rWW8Export.pPapPlc->AppendFkpEntry
( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
m_rWW8Export.pO->GetData() );
-
+
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
}
@@ -3705,33 +3710,33 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
::std::clog << "<endOfCell/>" << ::std::endl;
#endif
m_rWW8Export.WriteCR(pNodeInfoInner);
-
+
m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style #
TableInfoCell(pNodeInfoInner);
m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
m_rWW8Export.pO->GetData() );
-
+
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
-
+
sal_uInt32 nShadowsAfter = pNodeInfoInner->getShadowsAfter();
if (nShadowsAfter > 0)
{
ww8::WW8TableNodeInfoInner::Pointer_t
pTmpNodeInfoInner(new ww8::WW8TableNodeInfoInner(NULL));
-
+
pTmpNodeInfoInner->setDepth(pNodeInfoInner->getDepth());
pTmpNodeInfoInner->setEndOfCell(true);
for (sal_uInt32 n = 0; n < nShadowsAfter; ++n)
{
m_rWW8Export.WriteCR(pTmpNodeInfoInner);
-
+
m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style #
TableInfoCell(pTmpNodeInfoInner);
m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(),
m_rWW8Export.pO->GetData() );
-
+
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
}
@@ -3742,13 +3747,13 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
::std::clog << "<endOfLine/>" << ::std::endl;
#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(),
m_rWW8Export.pO->GetData() );
-
+
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren
}
#ifdef DEBUG
@@ -3759,7 +3764,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
void MSWordExportBase::OutputStartNode( const SwStartNode & rNode)
{
- ww8::WW8TableNodeInfo::Pointer_t pNodeInfo =
+ ww8::WW8TableNodeInfo::Pointer_t pNodeInfo =
mpTableInfo->getTableNodeInfo( &rNode );
if (pNodeInfo.get() != NULL)
@@ -3767,14 +3772,14 @@ void MSWordExportBase::OutputStartNode( const SwStartNode & rNode)
#ifdef DEBUG
::std::clog << pNodeInfo->toString() << ::std::endl;
#endif
-
+
const ww8::WW8TableNodeInfo::Inners_t aInners = pNodeInfo->getInners();
ww8::WW8TableNodeInfo::Inners_t::const_reverse_iterator aIt(aInners.rbegin());
ww8::WW8TableNodeInfo::Inners_t::const_reverse_iterator aEnd(aInners.rend());
while (aIt != aEnd)
{
ww8::WW8TableNodeInfoInner::Pointer_t pInner = aIt->second;
-
+
AttrOutput().TableNodeInfoInner(pInner);
aIt++;
}
@@ -3793,13 +3798,13 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode )
#endif
ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode );
-
+
if (pNodeInfo.get() != NULL)
{
#ifdef DEBUG
::std::clog << pNodeInfo->toString() << ::std::endl;
#endif
-
+
const ww8::WW8TableNodeInfo::Inners_t aInners = pNodeInfo->getInners();
ww8::WW8TableNodeInfo::Inners_t::const_iterator aIt(aInners.begin());
ww8::WW8TableNodeInfo::Inners_t::const_iterator aEnd(aInners.end());