filter/source/msfilter/util.cxx | 4 include/filter/msfilter/util.hxx | 4 sw/source/filter/basflt/fltini.cxx | 2 sw/source/filter/inc/msfilter.hxx | 7 sw/source/filter/ww8/attributeoutputbase.hxx | 4 sw/source/filter/ww8/docxattributeoutput.cxx | 4 sw/source/filter/ww8/docxattributeoutput.hxx | 4 sw/source/filter/ww8/docxexport.hxx | 3 sw/source/filter/ww8/rtfattributeoutput.cxx | 6 sw/source/filter/ww8/rtfattributeoutput.hxx | 4 sw/source/filter/ww8/rtfexport.hxx | 6 sw/source/filter/ww8/writerwordglue.cxx | 45 - sw/source/filter/ww8/wrtw8esh.cxx | 19 sw/source/filter/ww8/wrtw8nds.cxx | 229 +---- sw/source/filter/ww8/wrtw8num.cxx | 327 -------- sw/source/filter/ww8/wrtw8sty.cxx | 459 +++-------- sw/source/filter/ww8/wrtww8.cxx | 528 ++++--------- sw/source/filter/ww8/wrtww8.hxx | 55 - sw/source/filter/ww8/wrtww8gr.cxx | 189 ---- sw/source/filter/ww8/ww8atr.cxx | 1093 +++++++-------------------- sw/source/filter/ww8/ww8attributeoutput.hxx | 7 21 files changed, 753 insertions(+), 2246 deletions(-)
New commits: commit d06c3440c85271454208f19442ab9c676707597b Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 11:04:39 2015 +0200 sw: WW8 export: remove unused InsAsString8 Surprisingly WriteString8 is still used to write URLs. Change-Id: Id16201473bafce100a4be75199fba7bd7147cc83 diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index a1d9c77..d8330b3 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1099,8 +1099,6 @@ public: void InsUInt32( sal_uInt32 n ) { SwWW8Writer::InsUInt32( *pO, n ); } void InsAsString16( const OUString& rStr ) { SwWW8Writer::InsAsString16( *pO, rStr ); } - void InsAsString8( const OUString& rStr, rtl_TextEncoding eCodeSet ) - { SwWW8Writer::InsAsString8( *pO, rStr, eCodeSet ); } void WriteStringAsPara( const OUString& rText, sal_uInt16 nStyleId = 0 ); /// Setup the exporter. commit 80c49861b69d731bc7eccda8ea085a2676e7422d Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 10:48:36 2015 +0200 sw: WW8 export: remove WW6 residue in WW8AttributeOutput::Redline() Change-Id: Ife8b827298bc32ad0c490ebca7f3169dddc1009e diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index cc0bf53..608d2b3 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2965,25 +2965,26 @@ void WW8AttributeOutput::Redline( const SwRedlineData* pRedline ) if ( pRedline->Next() ) Redline( pRedline->Next() ); - static const sal_uInt16 aSprmIds[ 2 * 2 * 3 ] = - { - // Ids for insert - NS_sprm::LN_CFRMark, NS_sprm::LN_CIbstRMark, NS_sprm::LN_CDttmRMark, // for WW8 - 0x0042, 0x0045, 0x0046, // for WW6 - // Ids for delete - NS_sprm::LN_CFRMarkDel, NS_sprm::LN_CIbstRMarkDel, NS_sprm::LN_CDttmRMarkDel, // for WW8 - 0x0041, 0x0045, 0x0046 // for WW6 + static const sal_uInt16 insSprmIds[ 3 ] = + { + // Ids for insert // for WW8 + NS_sprm::LN_CFRMark, NS_sprm::LN_CIbstRMark, NS_sprm::LN_CDttmRMark, + }; + static const sal_uInt16 delSprmIds[ 3 ] = + { + // Ids for delete // for WW8 + NS_sprm::LN_CFRMarkDel, NS_sprm::LN_CIbstRMarkDel, NS_sprm::LN_CDttmRMarkDel, }; const sal_uInt16* pSprmIds = 0; switch( pRedline->GetType() ) { case nsRedlineType_t::REDLINE_INSERT: - pSprmIds = aSprmIds; + pSprmIds = insSprmIds; break; case nsRedlineType_t::REDLINE_DELETE: - pSprmIds = aSprmIds + (2 * 3); + pSprmIds = delSprmIds; break; case nsRedlineType_t::REDLINE_FORMAT: commit ed11cb1dbada47f0ef2129005583fc23d8a9ac10 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 10:30:16 2015 +0200 sw: WW8 export: remove WW6 export, partD: WW6 numbering export These functions only call each other. Change-Id: I0268e7559cdbc7b4695dce44ee5bddbe047387a1 diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 09366bc..30187b0 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -595,112 +595,6 @@ void WW8Export::OutListNamesTab() pFib->lcbSttbListNames = pTableStrm->Tell() - pFib->fcSttbListNames; } -// old WW95-Code - -void WW8Export::Out_WwNumLvl( sal_uInt8 nWwLevel ) -{ - pO->push_back( 13 ); - pO->push_back( nWwLevel ); -} - -void WW8Export::Out_SwNumLvl( sal_uInt8 nSwLevel ) -{ - OSL_ENSURE( nSwLevel < MAXLEVEL, "numbered?"); - Out_WwNumLvl( nSwLevel + 1 ); -} - -void WW8Export::BuildAnlvBulletBase(WW8_ANLV& rAnlv, sal_uInt8*& rpCh, - sal_uInt16& rCharLen, const SwNumFormat& rFormat) -{ - rAnlv.nfc = 11; - - sal_uInt8 nb = 0; // type of number - switch (rFormat.GetNumAdjust()) - { - case SVX_ADJUST_RIGHT: - nb = 2; - break; - case SVX_ADJUST_CENTER: - nb = 1; - break; - case SVX_ADJUST_BLOCK: - case SVX_ADJUST_BLOCKLINE: - nb = 3; - break; - case SVX_ADJUST_LEFT: - case SVX_ADJUST_END: - break; - } - - // #i86652# - if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - if (GetWordFirstLineOffset(rFormat) < 0) - nb |= 0x8; // number will be displayed using a hanging indent - } - rAnlv.aBits1 = nb; - - if (1 < rCharLen) - { - const vcl::Font& rFont = rFormat.GetBulletFont() - ? *rFormat.GetBulletFont() - : numfunc::GetDefBulletFont(); - OUString sNumStr = OUString(rFormat.GetBulletChar()); - rtl_TextEncoding eChrSet = rFont.GetCharSet(); - OUString sFontName = rFont.GetName(); - - sal_uInt16 nFontId; - if ( IsStarSymbol(sFontName) ) - { - /* - If we are starsymbol then in ww7- mode we will always convert to a - windows 8bit symbol font and an index into it, to conversion to - 8 bit is complete at this stage. - */ - SubstituteBullet(sNumStr, eChrSet, sFontName); - wwFont aPseudoFont(sFontName, rFont.GetPitch(), rFont.GetFamily(), - eChrSet); - nFontId = m_aFontHelper.GetId(aPseudoFont); - *rpCh = static_cast<sal_uInt8>(sNumStr[0]); - } - else - { - /* - Otherwise we are a unicode char and need to be converted back to - an 8 bit format. We happen to know that if the font is already an - 8 bit windows font currently, staroffice promotes the char into - the F000->F0FF range, so we can undo this, and we'll be back to - the equivalent 8bit location, otherwise we have to convert from - true unicode to an 8bit charset - */ - nFontId = m_aFontHelper.GetId(rFont); - sal_Unicode cChar = sNumStr[0]; - if ( (eChrSet == RTL_TEXTENCODING_SYMBOL) && (cChar >= 0xF000) && ( - cChar <= 0xF0FF) ) - { - *rpCh = static_cast< sal_uInt8 >(cChar - 0xF000); - } - else - *rpCh = OUStringToOString(OUString(cChar), eChrSet).toChar(); - } - rpCh++; - rCharLen--; - ShortToSVBT16(nFontId, rAnlv.ftc); - rAnlv.cbTextBefore = 1; - } - // #i86652# - if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - ShortToSVBT16( -GetWordFirstLineOffset(rFormat), rAnlv.dxaIndent ); - ShortToSVBT16( rFormat.GetCharTextDistance(), rAnlv.dxaSpace ); - } - else - { - ShortToSVBT16( 0, rAnlv.dxaIndent ); - ShortToSVBT16( 0, rAnlv.dxaSpace ); - } -} - void MSWordExportBase::SubstituteBullet( OUString& rNumStr, rtl_TextEncoding& rChrSet, OUString& rFontName ) const { @@ -718,177 +612,4 @@ void MSWordExportBase::SubstituteBullet( OUString& rNumStr, rFontName = sFontName; } -static void SwWw8_InsertAnlText( const OUString& rStr, sal_uInt8*& rpCh, - sal_uInt16& rCharLen, sal_uInt8& r8Len ) -{ - sal_uInt8 nb = 0; - ww::bytes aO; - SwWW8Writer::InsAsString8( aO, rStr, RTL_TEXTENCODING_MS_1252 ); - - sal_uInt16 nCnt = aO.size(); - if( nCnt && nCnt < rCharLen ) - { - nb = (sal_uInt8)nCnt; - std::copy( aO.begin(), aO.end(), rpCh ); - rpCh += nCnt; - rCharLen = rCharLen - nCnt; - } - r8Len = nb; -} - -void WW8Export::BuildAnlvBase(WW8_ANLV& rAnlv, sal_uInt8*& rpCh, - sal_uInt16& rCharLen, const SwNumRule& rRul, const SwNumFormat& rFormat, - sal_uInt8 nSwLevel) -{ - const SfxItemSet *pOutSet = NULL; - if (rFormat.GetCharFormat()) - pOutSet = &rFormat.GetCharFormat()->GetAttrSet(); - rAnlv.nfc = GetLevelNFC(rFormat.GetNumberingType(),pOutSet ); - - sal_uInt8 nb = 0; - switch (rFormat.GetNumAdjust()) - { - case SVX_ADJUST_RIGHT: - nb = 2; - break; - case SVX_ADJUST_CENTER: - nb = 1; - break; - case SVX_ADJUST_BLOCK: - case SVX_ADJUST_BLOCKLINE: - nb = 3; - break; - case SVX_ADJUST_LEFT: - case SVX_ADJUST_END: - break; - } - - bool bInclUpper = rFormat.GetIncludeUpperLevels() > 0; - if( bInclUpper ) - nb |= 0x4; // include previous levels - - if (GetWordFirstLineOffset(rFormat) < 0) - nb |= 0x8; // number will be displayed using a hanging indent - rAnlv.aBits1 = nb; - - if( bInclUpper && !rRul.IsContinusNum() ) - { - if( (nSwLevel >= WW8ListManager::nMinLevel ) - && (nSwLevel<= WW8ListManager::nMaxLevel ) - && (rFormat.GetNumberingType() != SVX_NUM_NUMBER_NONE ) ) // UEberhaupt Nummerierung ? - { // -> suche, ob noch Zahlen davor - sal_uInt8 nUpper = rFormat.GetIncludeUpperLevels(); - if( (nUpper <= WW8ListManager::nMaxLevel) && - (rRul.Get(nUpper).GetNumberingType() != SVX_NUM_NUMBER_NONE ) ) // Nummerierung drueber ? - { - // dann Punkt einfuegen - SwWw8_InsertAnlText( ".", rpCh, rCharLen, - rAnlv.cbTextBefore ); - } - - } - } - else - { - SwWw8_InsertAnlText( rFormat.GetPrefix(), rpCh, rCharLen, - rAnlv.cbTextBefore ); - SwWw8_InsertAnlText( rFormat.GetSuffix(), rpCh, rCharLen, - rAnlv.cbTextAfter ); - } - - ShortToSVBT16( rFormat.GetStart(), rAnlv.iStartAt ); - // #i86652# - if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - ShortToSVBT16( -GetWordFirstLineOffset(rFormat), rAnlv.dxaIndent ); - ShortToSVBT16( rFormat.GetCharTextDistance(), rAnlv.dxaSpace ); - } - else - { - ShortToSVBT16( 0, rAnlv.dxaIndent ); - ShortToSVBT16( 0, rAnlv.dxaSpace ); - } -} - -void WW8Export::Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFormat& rFormat, - sal_uInt8 nSwLevel ) -{ - static const sal_uInt8 aSprmAnldDefault[54] = { - 12, 52, - 1,0,0,0x0c,0,0,1,0x80,0,0,1,0,0x1b,1,0,0,0x2e, - 0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - sal_uInt8 aSprmAnld[54]; - - memcpy( aSprmAnld, aSprmAnldDefault, sizeof( aSprmAnld ) ); - WW8_ANLD* pA = reinterpret_cast<WW8_ANLD*>(aSprmAnld + 2); // handy pointer - - sal_uInt8* pChars = pA->rgchAnld; - sal_uInt16 nCharLen = 31; - - if( nSwLevel == 11 ) - BuildAnlvBulletBase( pA->eAnlv, pChars, nCharLen, rFormat ); - else - BuildAnlvBase( pA->eAnlv, pChars, nCharLen, rRul, rFormat, nSwLevel ); - - // ... spit it out - OutSprmBytes( reinterpret_cast<sal_uInt8*>(&aSprmAnld), sizeof( aSprmAnld ) ); -} - -// Return: is it an outline? -bool WW8Export::Out_SwNum(const SwTextNode* pNd) -{ - int nLevel = pNd->GetActualListLevel(); - - if (nLevel < 0 || nLevel >= MAXLEVEL) - { - OSL_FAIL("Invalid level"); - - return false; - } - - sal_uInt8 nSwLevel = static_cast< sal_uInt8 >(nLevel); - - const SwNumRule* pRul = pNd->GetNumRule(); - if( !pRul || nSwLevel == WW8ListManager::nMaxLevel) - return false; - - bool bRet = true; - - SwNumFormat aFormat(pRul->Get(nSwLevel)); - // #i86652# - if ( aFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - const SvxLRSpaceItem& rLR = ItemGet<SvxLRSpaceItem>(*pNd, RES_LR_SPACE); - aFormat.SetAbsLSpace(writer_cast<short>(aFormat.GetAbsLSpace() + rLR.GetLeft())); - } - - if ( - aFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE || - aFormat.GetNumberingType() == SVX_NUM_CHAR_SPECIAL || - aFormat.GetNumberingType() == SVX_NUM_BITMAP - ) - { - Out_WwNumLvl(11); - Out_NumRuleAnld(*pRul, aFormat, 11); - bRet = false; - } - else if ( - pRul->IsContinusNum() || - (pRul->Get(1).GetIncludeUpperLevels() <= 1) - ) - { - Out_WwNumLvl(10); - Out_NumRuleAnld(*pRul, aFormat, 10); - bRet = false; - } - else - { - Out_SwNumLvl(nSwLevel); - Out_NumRuleAnld(*pRul, aFormat, nSwLevel); - } - return bRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 30f43be..a1d9c77 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -973,11 +973,6 @@ private: void WriteFkpPlcUsw(); void WriteMainText(); void StoreDoc1(); - void Out_WwNumLvl( sal_uInt8 nWwLevel ); - void BuildAnlvBulletBase( WW8_ANLV& rAnlv, sal_uInt8*& rpCh, sal_uInt16& rCharLen, - const SwNumFormat& rFormat ); - static void BuildAnlvBase( WW8_ANLV& rAnlv, sal_uInt8*& rpCh, sal_uInt16& rCharLen, - const SwNumRule& rRul, const SwNumFormat& rFormat, sal_uInt8 nSwLevel ); /// Output the numbering table. virtual void WriteNumbering() SAL_OVERRIDE; @@ -997,10 +992,6 @@ public: /// Setup the pA's info. virtual void SetupSectionPositions( WW8_PdAttrDesc* pA ) SAL_OVERRIDE; - void Out_SwNumLvl( sal_uInt8 nSwLevel ); - void Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFormat& rFormat, - sal_uInt8 nSwLevel ); - bool MiserableFormFieldExportHack(const SwFrameFormat& rFrameFormat); SvxMSExportOLEObjects& GetOLEExp() { return *m_pOLEExp; } @@ -1023,8 +1014,6 @@ public: void CreateEscher(); void WriteEscher(); - bool Out_SwNum(const SwTextNode* pNd); - /// Write the field virtual void OutputField( const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ) SAL_OVERRIDE; commit 40bfeb3aef71e61fd620b8c3aa9d04a1b4ae5246 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:58:38 2015 +0200 sw: WW8 export: remove WW6 export, partC: SwWW8Writer::bWrtWW8 ... and disable WW6 export in fltini.cxx Change-Id: I6f649e03f39dcb8f185b6cb5074ef9037e6d0562 diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 0144e2c..f7d9f7d 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -72,7 +72,7 @@ SwReaderWriterEntry aReaderWriter[] = { SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, true ), SwReaderWriterEntry( 0, &::GetASCWriter, false ), - SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, true ), + SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ), SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, true ), SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, true ), SwReaderWriterEntry( 0, &::GetHTMLWriter, true ), diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index cca6c5b..358e985 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3453,10 +3453,10 @@ MSWordSections& WW8Export::Sections() const SwWW8Writer::SwWW8Writer(const OUString& rFltName, const OUString& rBaseURL) : StgWriter(), - m_bWrtWW8( rFltName == FILTER_WW8 ), m_pExport( NULL ), mpMedium( 0 ) { + assert(rFltName == FILTER_WW8); // WW6/7 export was removed SetBaseURL( rBaseURL ); } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 13dbab2..30f43be 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -879,7 +879,6 @@ class SwWW8Writer: public StgWriter // (if yes, remove the friends, and provide here a GetExport() method) friend void WW8_WrtRedlineAuthor::Write(Writer &rWrt); - bool m_bWrtWW8; WW8Export *m_pExport; SfxMedium *mpMedium; commit 9adb120b31a6b413111231f962006964c9b2abc3 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:54:13 2015 +0200 sw: WW8 export: remove unused WW8_SepInfo::pNumNd Change-Id: I40b7284bdcbfc5359a2a8c0fe105868cfae4c992 diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 202cd60..512f265 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1129,17 +1129,6 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFormatPageDesc& rPD, AppendSection( rPD, rNd, pSectionFormat, nLnNumRestartNo ); } -// MSWordSections::SetNum() sets in each section the Num-pointers for the first call. -// All subsequent calls will be ignored. -// Thus, the first list of the section will be adopted. - -void MSWordSections::SetNum( const SwTextNode* pNumNd ) -{ - WW8_SepInfo& rInfo = aSects.back(); - if ( !rInfo.pNumNd ) // not yet assigned - rInfo.pNumNd = pNumNd; -} - void WW8_WrPlcSepx::WriteFootnoteEndText( WW8Export& rWrt, sal_uLong nCpStt ) { sal_uInt8 nInfoFlags = 0; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 7560746..13dbab2 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -161,20 +161,19 @@ struct WW8_SepInfo const SwPageDesc* pPageDesc; const SwSectionFormat* pSectionFormat; const SwNode* pPDNd; - const SwTextNode* pNumNd; sal_uLong nLnNumRestartNo; ::boost::optional<sal_uInt16> oPgRestartNo; bool bIsFirstParagraph; WW8_SepInfo() - : pPageDesc(0), pSectionFormat(0), pPDNd(0), pNumNd(0), nLnNumRestartNo(0), bIsFirstParagraph(false) + : pPageDesc(0), pSectionFormat(0), pPDNd(0), nLnNumRestartNo(0), bIsFirstParagraph(false) {} WW8_SepInfo( const SwPageDesc* pPD, const SwSectionFormat* pFormat, sal_uLong nLnRestart, ::boost::optional<sal_uInt16> oPgRestart = boost::none, const SwNode* pNd = NULL, bool bIsFirstPara = false ) - : pPageDesc( pPD ), pSectionFormat( pFormat ), pPDNd( pNd ), pNumNd( 0 ), + : pPageDesc( pPD ), pSectionFormat( pFormat ), pPDNd( pNd ), nLnNumRestartNo( nLnRestart ), oPgRestartNo( oPgRestart ), bIsFirstParagraph( bIsFirstPara ) {} @@ -211,7 +210,6 @@ public: const SwNode& rNd, const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo ); - void SetNum( const SwTextNode* pNumNd ); /// Number of columns based on the most recent WW8_SepInfo. sal_uInt16 CurrentNumberOfColumns( const SwDoc &rDoc ) const; commit a297df5f9df973205e50f908f60e231af4d12823 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:49:05 2015 +0200 sw: WW8 export: remove WW6 export, partB: newly dead functions Change-Id: I3531ca574239ee9e47a111d1a1d73b623292c80f diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index c7062ba..cc0bf53 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2845,55 +2845,6 @@ void WW8Export::AppendSection( const SwPageDesc *pPageDesc, const SwSectionForma // Flys -void WW8Export::OutWW6FlyFrmsInContent( const SwTextNode& rNd ) -{ - assert(false); // TODO - - if (const SwpHints* pTextAttrs = rNd.GetpSwpHints()) - { - for( size_t n=0; n < pTextAttrs->Count(); ++n ) - { - const SwTextAttr* pAttr = (*pTextAttrs)[ n ]; - if( RES_TXTATR_FLYCNT == pAttr->Which() ) - { - // attribute bound to a character - const SwFormatFlyCnt& rFlyContent = pAttr->GetFlyCnt(); - const SwFlyFrameFormat& rFlyFrameFormat = *static_cast<SwFlyFrameFormat*>(rFlyContent.GetFrameFormat()); - const SwNodeIndex* pNodeIndex = rFlyFrameFormat.GetContent().GetContentIdx(); - - if( pNodeIndex ) - { - sal_uLong nStt = pNodeIndex->GetIndex()+1, - nEnd = pNodeIndex->GetNode().EndOfSectionIndex(); - - if( (nStt < nEnd) && !m_pDoc->GetNodes()[ nStt ]->IsNoTextNode() ) - { - Point aOffset; - // get rectangle (bounding box?) of Fly and paragraph - SwRect aParentRect(rNd.FindLayoutRect(false, &aOffset)), - aFlyRect(rFlyFrameFormat.FindLayoutRect(false, &aOffset ) ); - - aOffset = aFlyRect.Pos() - aParentRect.Pos(); - - // let PaM point to content of Fly-frame format - SaveData( nStt, nEnd ); - - // is analysed in OutputFormat() - m_pFlyOffset = &aOffset; - m_eNewAnchorType = rFlyFrameFormat.GetAnchor().GetAnchorId(); - sw::Frame aFrm(rFlyFrameFormat, SwPosition(rNd)); - m_pParentFrame = &aFrm; - // Ok, write it out: - WriteText(); - - RestoreData(); - } - } - } - } - } -} - void WW8AttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFormat, const Point& rNdTopLeft ) { const SwFrameFormat &rFrameFormat = rFormat.GetFrameFormat(); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index ddc6bc6..09366bc 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -597,37 +597,6 @@ void WW8Export::OutListNamesTab() // old WW95-Code -void WW8Export::OutputOlst( const SwNumRule& rRule ) -{ - assert(false); // TODO - - static const sal_uInt8 aAnlvBase[] = { // Defaults - 1,0,0, // Upper Roman - 0x0C, // Hanging Indent, fPrev - 0,0,1,0x80,0,0,1,0,0x1b,1,0,0 }; - - static const sal_uInt8 aSprmOlstHdr[] = { 133, 212 }; - - pO->insert( pO->end(), aSprmOlstHdr, aSprmOlstHdr+sizeof( aSprmOlstHdr ) ); - WW8_OLST aOlst; - memset( &aOlst, 0, sizeof(aOlst) ); - sal_uInt8* pC = aOlst.rgch; - sal_uInt8* pChars = pC; - sal_uInt16 nCharLen = 64; - - for (sal_uInt16 j = 0; j < WW8ListManager::nMaxLevel; j++ ) // 9 variable ANLVs - { - memcpy( &aOlst.rganlv[j], aAnlvBase, sizeof( WW8_ANLV ) ); // Defaults - - const SwNumFormat* pFormat = rRule.GetNumFormat( j ); - if( pFormat ) - BuildAnlvBase( aOlst.rganlv[j], pChars, nCharLen, rRule, - *pFormat, (sal_uInt8)j ); - } - - pO->insert( pO->end(), reinterpret_cast<sal_uInt8*>(&aOlst), reinterpret_cast<sal_uInt8*>(&aOlst)+sizeof( aOlst ) ); -} - void WW8Export::Out_WwNumLvl( sal_uInt8 nWwLevel ) { pO->push_back( 13 ); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 1498927..202cd60 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1438,27 +1438,6 @@ void WW8AttributeOutput::SectionType( sal_uInt8 nBreakCode ) } } -// TODO -void WW8AttributeOutput::SectionWW6HeaderFooterFlags( sal_uInt8 nHeadFootFlags ) -{ - if (nHeadFootFlags && false) - { - sal_uInt8 nTmpFlags = nHeadFootFlags; - if ( m_rWW8Export.pDop->fFacingPages ) - { - if ( !(nTmpFlags & WW8_FOOTER_EVEN) && (nTmpFlags & WW8_FOOTER_ODD ) ) - nTmpFlags |= WW8_FOOTER_EVEN; - - if ( !(nTmpFlags & WW8_HEADER_EVEN) && (nTmpFlags & WW8_HEADER_ODD ) ) - nTmpFlags |= WW8_HEADER_EVEN; - } - - // sprmSGprfIhdt, is only needed in WW95 - m_rWW8Export.pO->push_back( 153 ); - m_rWW8Export.pO->push_back( nTmpFlags ); - } -} - void WW8Export::SetupSectionPositions( WW8_PdAttrDesc* pA ) { if ( !pA ) @@ -1705,14 +1684,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt AttrOutput().SectionType( nBreakCode ); - const SwTextNode* pNd = rSepInfo.pNumNd; - if ( pNd ) - { - const SwNumRule* pRule = pNd->GetNumRule(); - if ( pRule ) - OutputOlst( *pRule ); - } - // Header or Footer sal_uInt8 nHeadFootFlags = 0; @@ -1737,7 +1708,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt if ( !pPd->IsFooterShared() || bLeftRightPgChain ) MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFormat, WW8_FOOTER_EVEN ); - AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags ); } // binary filters only diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 78eb471..7560746 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -731,9 +731,6 @@ public: void SubstituteBullet( OUString& rNumStr, rtl_TextEncoding& rChrSet, OUString& rFontName ) const; - /// No-op for the newer WW versions. - virtual void OutputOlst( const SwNumRule& /*rRule*/ ) {} - /// Setup the pA's info. virtual void SetupSectionPositions( WW8_PdAttrDesc* /*pA*/ ) {} @@ -999,7 +996,6 @@ private: void DoCheckBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet); public: - virtual void OutputOlst( const SwNumRule& rRule ) SAL_OVERRIDE; /// Setup the pA's info. virtual void SetupSectionPositions( WW8_PdAttrDesc* pA ) SAL_OVERRIDE; @@ -1022,9 +1018,6 @@ public: const SvxBrushItem* GetCurrentPageBgBrush() const; SvxBrushItem TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const; - /// Output all textframes anchored as character for the winword 7- format. - void OutWW6FlyFrmsInContent( const SwTextNode& rNd ); - void AppendFlyInFlys(const sw::Frame& rFrameFormat, const Point& rNdTopLeft); void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp); void WriteSdrTextObj(const SdrTextObj& rObj, sal_uInt8 nTyp); diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 8a7ef83..761755c 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -178,9 +178,6 @@ public: /// The type of breaking. virtual void SectionType( sal_uInt8 nBreakCode ) SAL_OVERRIDE; - /// Special header/footer flags, needed for old versions only. - virtual void SectionWW6HeaderFooterFlags( sal_uInt8 nHeadFootFlags ) SAL_OVERRIDE; - /// Definition of a numbering instance. virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule ) SAL_OVERRIDE; commit cd3881d7171b828872db2ed0b3d49b580c3b17d1 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:48:07 2015 +0200 sw: WW8 export: remove newly unused parameters Change-Id: I76da4422008c9dad8cf48dd089d644e432007d79 diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 8d9920d..2fb5186 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -285,7 +285,7 @@ public: virtual void EndStyleProperties( bool bParProp ) = 0; /// Numbering rule and Id. - virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat& rNFormat, const SwFormat& rFormat ) = 0; + virtual void OutlineNumbering(sal_uInt8 nLvl) = 0; /// Page break /// As a paragraph property - the paragraph should be on the next page. diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 18d2ed4..989a717 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5327,7 +5327,7 @@ void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel FSEND); } -void DocxAttributeOutput::OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat& /*rNFormat*/, const SwFormat& /*rFormat*/ ) +void DocxAttributeOutput::OutlineNumbering(sal_uInt8 const nLvl) { lcl_OutlineLevel(m_pSerializer, nLvl); } diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 34e9627..04d745e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -282,7 +282,7 @@ public: virtual void EndStyleProperties( bool bParProp ) SAL_OVERRIDE; /// Numbering rule and Id. - virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat &rNFormat, const SwFormat &rFormat ) SAL_OVERRIDE; + virtual void OutlineNumbering(sal_uInt8 nLvl) SAL_OVERRIDE; /// Page break /// As a paragraph property - the paragraph should be on the next page. diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 6ff487a..e374a9a 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1065,7 +1065,7 @@ void RtfAttributeOutput::EndStyleProperties(bool /*bParProp*/) /* noop */ } -void RtfAttributeOutput::OutlineNumbering(sal_uInt8 nLvl, const SwNumFormat& /*rNFormat*/, const SwFormat& /*rFormat*/) +void RtfAttributeOutput::OutlineNumbering(sal_uInt8 nLvl) { if (nLvl >= WW8ListManager::nMaxLevel) nLvl = WW8ListManager::nMaxLevel - 1; diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 74dd379..0696486 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -151,7 +151,7 @@ public: virtual void EndStyleProperties(bool bParProp) SAL_OVERRIDE; /// Numbering rule and Id. - virtual void OutlineNumbering(sal_uInt8 nLvl, const SwNumFormat& rNFormat, const SwFormat& rFormat) SAL_OVERRIDE; + virtual void OutlineNumbering(sal_uInt8 nLvl) SAL_OVERRIDE; /// Page break /// As a paragraph property - the paragraph should be on the next page. diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 2c9e1d4..cca6c5b 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -153,7 +153,7 @@ public: WW8_FC GetStartFc() const; WW8_FC GetEndFc() const; - sal_uInt8 *CopyLastSprms(sal_uInt8 &rLen, bool bVer8); + sal_uInt8 *CopyLastSprms(sal_uInt8 &rLen); }; // class WW8_WrPc collects all piece entries for one piece @@ -871,7 +871,7 @@ WW8_WrPlcPn::~WW8_WrPlcPn() sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen) { WW8_WrFkp& rF = aFkps.back(); - return rF.CopyLastSprms(rLen, true/*TODO*/); + return rF.CopyLastSprms(rLen); } void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pSprms) @@ -1019,7 +1019,7 @@ sal_uInt8 WW8_WrFkp::SearchSameSprm( sal_uInt16 nVarLen, const sal_uInt8* pSprms return 0; // didn't found it } -sal_uInt8 *WW8_WrFkp::CopyLastSprms(sal_uInt8 &rLen, bool bVer8) +sal_uInt8 *WW8_WrFkp::CopyLastSprms(sal_uInt8 &rLen) { rLen=0; sal_uInt8 *pStart=0,*pRet=0; @@ -1033,7 +1033,7 @@ sal_uInt8 *WW8_WrFkp::CopyLastSprms(sal_uInt8 &rLen, bool bVer8) const sal_uInt8* p = pFkp + ( (sal_uInt16)nStart << 1 ); - if (!*p && bVer8) + if (!*p) p++; if (*p) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index b86a01a..b1c6529 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -669,7 +669,7 @@ sal_uInt8 WW8Export::GetNumId( sal_uInt16 eNumType ) return nRet; } -void WW8AttributeOutput::OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat &/*TODO*/, const SwFormat &/*TODO*/) +void WW8AttributeOutput::OutlineNumbering(sal_uInt8 nLvl) { if ( nLvl >= WW8ListManager::nMaxLevel ) nLvl = WW8ListManager::nMaxLevel-1; @@ -735,7 +735,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b // if Write StyleDefinition then write the OutlineRule const SwNumFormat& rNFormat = m_pDoc->GetOutlineNumRule()->Get( static_cast<sal_uInt16>( nLvl ) ); if ( m_bStyDef ) - AttrOutput().OutlineNumbering( static_cast< sal_uInt8 >( nLvl ), rNFormat, rFormat ); + AttrOutput().OutlineNumbering(static_cast<sal_uInt8>(nLvl)); if ( rNFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION && @@ -1481,7 +1481,7 @@ bool WW8Export::TransBrush(const Color& rCol, WW8_SHD& rShd) { rShd.SetFore( 0); rShd.SetBack( msfilter::util::TransColToIco( rCol ) ); - rShd.SetStyle( true, 0 ); // TODO + rShd.SetStyle( true, 0 ); // TODO FIXME??? } return !rCol.GetTransparency(); } @@ -2425,8 +2425,6 @@ void WW8AttributeOutput::PostitField( const SwField* pField ) bool WW8AttributeOutput::DropdownField( const SwField* pField ) { - bool bExpand = true; - // TODO const SwDropDownField& rField2 = *static_cast<const SwDropDownField*>(pField); uno::Sequence<OUString> aItems = rField2.GetItemSequence(); @@ -2434,8 +2432,7 @@ bool WW8AttributeOutput::DropdownField( const SwField* pField ) rField2.GetHelp(), rField2.GetToolTip(), rField2.GetSelectedItem(), aItems); - bExpand = false; - return bExpand; + return false; } bool WW8AttributeOutput::PlaceholderField( const SwField* ) @@ -3274,7 +3271,8 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) } } -void WW8AttributeOutput::ParaNumRule_Impl( const SwTextNode* /*TODO*/, sal_Int32 nLvl, sal_Int32 nNumId ) +void WW8AttributeOutput::ParaNumRule_Impl(const SwTextNode* /*pTxtNd*/, + sal_Int32 const nLvl, sal_Int32 const nNumId) { // write sprmPIlvl and sprmPIlfo SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlvl ); diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 230b414..8a7ef83 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -138,7 +138,7 @@ public: virtual void EndStyleProperties( bool bParProp ) SAL_OVERRIDE; /// Numbering rule and Id. - virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat &rNFormat, const SwFormat &rFormat ) SAL_OVERRIDE; + virtual void OutlineNumbering(sal_uInt8 nLvl) SAL_OVERRIDE; /// Page break /// As a paragraph property - the paragraph should be on the next page. commit 1edcba1ce993da983cdee4d687e32f81bec8b7c0 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:07:10 2015 +0200 sw: WW8 export: remove WW6 export, partA: WW8Export::bWrtWW8 Change-Id: I267acbbd6f427336752a436a1abcea0d2a412ad4 diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index a465164..2c9e1d4 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -136,7 +136,7 @@ class WW8_WrFkp sal_uInt8 SearchSameSprm( sal_uInt16 nVarLen, const sal_uInt8* pSprms ); public: - WW8_WrFkp(ePLCFT ePl, WW8_FC nStartFc, bool bWrtWW8); + WW8_WrFkp(ePLCFT ePl, WW8_FC nStartFc); ~WW8_WrFkp(); bool Append( WW8_FC nEndFc, sal_uInt16 nVarLen = 0, const sal_uInt8* pSprms = 0 ); bool Combine(); @@ -271,7 +271,7 @@ void WW8_WrtBookmarks::Write( WW8Export& rWrt) aTempStrm2.Seek(0L); rWrt.WriteAsStringTable(aNames, rWrt.pFib->fcSttbfbkmk,rWrt.pFib->lcbSttbfbkmk); - SvStream& rStrm = rWrt.bWrtWW8 ? *rWrt.pTableStrm : rWrt.Strm(); + SvStream& rStrm = *rWrt.pTableStrm; rWrt.pFib->fcPlcfbkf = rStrm.Tell(); rStrm.WriteStream( aTempStrm1 ); SwWW8Writer::WriteLong(rStrm, rWrt.pFib->ccpText + rWrt.pFib->ccpTxbx); @@ -860,7 +860,7 @@ WW8_WrPlcPn::WW8_WrPlcPn(WW8Export& rWr, ePLCFT ePl, WW8_FC nStartFc) , nFkpStartPage(0) , ePlc(ePl) { - WW8_WrFkp* pF = new WW8_WrFkp( ePlc, nStartFc, rWrt.bWrtWW8 ); + WW8_WrFkp* pF = new WW8_WrFkp(ePlc, nStartFc); aFkps.push_back( pF ); } @@ -871,7 +871,7 @@ WW8_WrPlcPn::~WW8_WrPlcPn() sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen) { WW8_WrFkp& rF = aFkps.back(); - return rF.CopyLastSprms(rLen, rWrt.bWrtWW8); + return rF.CopyLastSprms(rLen, true/*TODO*/); } void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pSprms) @@ -881,7 +881,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS // big sprm? build the sprmPHugePapx sal_uInt8* pNewSprms = const_cast<sal_uInt8*>(pSprms); sal_uInt8 aHugePapx[ 8 ]; - if( rWrt.bWrtWW8 && PAP == ePlc && 488 < nVarLen ) + if (PAP == ePlc && 488 < nVarLen) { sal_uInt8* p = aHugePapx; *p++ = *pSprms++; // set style Id @@ -913,7 +913,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS if( !bOk ) { pF->Combine(); - pF = new WW8_WrFkp( ePlc, pF->GetEndFc(), rWrt.bWrtWW8 ); // Start new Fkp == end of old Fkp + pF = new WW8_WrFkp(ePlc, pF->GetEndFc()); // Start new Fkp == end of old Fkp aFkps.push_back( pF ); if( !pF->Append( nEndFc, nVarLen, pNewSprms ) ) @@ -957,12 +957,8 @@ void WW8_WrPlcPn::WritePlc() aFkps[ i - 1 ].GetEndFc() ); // fuer jedes FKP die Page ausgeben - if( rWrt.bWrtWW8) // for WW97 Long output - for ( i = 0; i < aFkps.size(); i++) - SwWW8Writer::WriteLong( *rWrt.pTableStrm, i + nFkpStartPage ); - else // for WW95 Short output - for ( i = 0; i < aFkps.size(); i++) - SwWW8Writer::WriteShort( *rWrt.pTableStrm, i + nFkpStartPage ); + for ( i = 0; i < aFkps.size(); i++) + SwWW8Writer::WriteLong( *rWrt.pTableStrm, i + nFkpStartPage ); if( CHP == ePlc ) { @@ -976,9 +972,9 @@ void WW8_WrPlcPn::WritePlc() } } -WW8_WrFkp::WW8_WrFkp(ePLCFT ePl, WW8_FC nStartFc, bool bWrtWW8) +WW8_WrFkp::WW8_WrFkp(ePLCFT ePl, WW8_FC nStartFc) : ePlc(ePl), nStartGrp(511), nOldStartGrp(511), - nItemSize( ( CHP == ePl ) ? 1 : ( bWrtWW8 ? 13 : 7 )), + nItemSize( ( CHP == ePl ) ? 1 : 13 ), nIMax(0), nOldVarLen(0), bCombined(false) { pFkp = reinterpret_cast<sal_uInt8*>(new sal_Int32[128]); // 512 Byte @@ -1481,23 +1477,14 @@ void WW8Export::OutGrfBullets(const sw::Frame & rFrame) sal_uInt8* pArr = aArr; // sprmCFSpec - if( bWrtWW8 ) - Set_UInt16( pArr, 0x855 ); - else - Set_UInt8( pArr, 117 ); + Set_UInt16( pArr, 0x855 ); Set_UInt8( pArr, 1 ); Set_UInt16( pArr, 0x083c ); Set_UInt8( pArr, 0x81 ); // sprmCPicLocation - if( bWrtWW8 ) - Set_UInt16( pArr, 0x6a03 ); - else - { - Set_UInt8( pArr, 68 ); - Set_UInt8( pArr, 4 ); - } + Set_UInt16( pArr, 0x6a03 ); Set_UInt32( pArr, GRF_MAGIC_321 ); //extern nAttrMagicIdx; @@ -1535,7 +1522,7 @@ void WW8_WrtRedlineAuthor::Write( Writer& rWrt ) { WW8Export & rWW8Wrt = *(static_cast<SwWW8Writer&>(rWrt).m_pExport); rWW8Wrt.WriteAsStringTable(maAuthors, rWW8Wrt.pFib->fcSttbfRMark, - rWW8Wrt.pFib->lcbSttbfRMark, rWW8Wrt.bWrtWW8 ? 0 : 2); + rWW8Wrt.pFib->lcbSttbfRMark, 0); } sal_uInt16 WW8Export::AddRedlineAuthor( sal_uInt16 nId ) @@ -1556,38 +1543,19 @@ void WW8Export::WriteAsStringTable(const std::vector<OUString>& rStrings, { // we have some Redlines found in the document -> the // Author Name Stringtable - SvStream& rStrm = bWrtWW8 ? *pTableStrm : Strm(); + SvStream& rStrm = *pTableStrm; rfcSttbf = rStrm.Tell(); - if( bWrtWW8 ) + SwWW8Writer::WriteShort( rStrm, -1 ); + SwWW8Writer::WriteLong( rStrm, nCount ); + for( n = 0; n < nCount; ++n ) { - SwWW8Writer::WriteShort( rStrm, -1 ); - SwWW8Writer::WriteLong( rStrm, nCount ); - for( n = 0; n < nCount; ++n ) - { - const OUString& rNm = rStrings[n]; - SwWW8Writer::WriteShort( rStrm, rNm.getLength() ); - SwWW8Writer::WriteString16(rStrm, rNm, false); - if( nExtraLen ) - SwWW8Writer::FillCount(rStrm, nExtraLen); - } - } - else - { - SwWW8Writer::WriteShort( rStrm, 0 ); - for( n = 0; n < nCount; ++n ) - { - const OUString &rString = rStrings[n]; - const OUString aNm(rString.copy(0, std::min<sal_Int32>(rString.getLength(), 255))); - rStrm.WriteUChar( aNm.getLength() ); - SwWW8Writer::WriteString8(rStrm, aNm, false, - RTL_TEXTENCODING_MS_1252); - if (nExtraLen) - SwWW8Writer::FillCount(rStrm, nExtraLen); - } + const OUString& rNm = rStrings[n]; + SwWW8Writer::WriteShort( rStrm, rNm.getLength() ); + SwWW8Writer::WriteString16(rStrm, rNm, false); + if( nExtraLen ) + SwWW8Writer::FillCount(rStrm, nExtraLen); } rlcbSttbf = rStrm.Tell() - rfcSttbf; - if( !bWrtWW8 ) - SwWW8Writer::WriteShort( rStrm, rfcSttbf, (sal_uInt16)rlcbSttbf ); } } @@ -1692,10 +1660,7 @@ void WW8Export::WriteStringAsPara( const OUString& rText, sal_uInt16 nStyleId ) if( m_bOutTable ) { // Tab-Attr // sprmPFInTable - if( bWrtWW8 ) - SwWW8Writer::InsUInt16( aArr, NS_sprm::LN_PFInTable ); - else - aArr.push_back( 24 ); + SwWW8Writer::InsUInt16( aArr, NS_sprm::LN_PFInTable ); aArr.push_back( 1 ); } @@ -2028,16 +1993,9 @@ void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pT const SwFormatRowSplit& rSplittable = pLineFormat->GetRowSplit(); sal_uInt8 nCantSplit = (!rSplittable.GetValue()) ? 1 : 0; - if ( m_rWW8Export.bWrtWW8 ) - { - m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit ); - m_rWW8Export.pO->push_back( nCantSplit ); - m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit90 ); // also write fCantSplit90 - } - else - { - m_rWW8Export.pO->push_back( 185 ); - } + m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit ); + m_rWW8Export.pO->push_back( nCantSplit ); + m_rWW8Export.InsUInt16( NS_sprm::LN_TFCantSplit90 ); // also write fCantSplit90 m_rWW8Export.pO->push_back( nCantSplit ); } @@ -2046,13 +2004,10 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable const SwTable * pTable = pTableTextNodeInfoInner->getTable(); const SwFrameFormat * pFrameFormat = pTable->GetFrameFormat(); - if ( m_rWW8Export.bWrtWW8 ) + if ( m_rWW8Export.TrueFrameDirection(*pFrameFormat) == FRMDIR_HORI_RIGHT_TOP ) { - if ( m_rWW8Export.TrueFrameDirection(*pFrameFormat) == FRMDIR_HORI_RIGHT_TOP ) - { - m_rWW8Export.InsUInt16( NS_sprm::LN_TFBiDi ); - m_rWW8Export.InsUInt16( 1 ); - } + m_rWW8Export.InsUInt16( NS_sprm::LN_TFBiDi ); + m_rWW8Export.InsUInt16( 1 ); } } @@ -2083,10 +2038,7 @@ void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTab if ( nHeight ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_TDyaRowHeight ); - else - m_rWW8Export.pO->push_back( 189 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_TDyaRowHeight ); m_rWW8Export.InsUInt16( (sal_uInt16)nHeight ); } @@ -2117,10 +2069,7 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t { case text::HoriOrientation::CENTER: case text::HoriOrientation::RIGHT: - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_TJc90 ); - else - m_rWW8Export.pO->push_back( 182 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_TJc90 ); m_rWW8Export.InsUInt16( text::HoriOrientation::RIGHT == eHOri ? 2 : 1 ); break; default: @@ -2173,10 +2122,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t if ( pTable->GetRowsToRepeat() > pTableTextNodeInfoInner->getRow() ) { - if( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_TTableHeader ); - else - m_rWW8Export.pO->push_back( 186 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_TTableHeader ); m_rWW8Export.pO->push_back( 1 ); } @@ -2259,12 +2205,9 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t if (pTabBox1 != NULL) pBoxFormat = pTabBox1->GetFrameFormat(); - if ( m_rWW8Export.bWrtWW8 ) - { - sal_uInt16 nFlags = - lcl_TCFlags(*m_rWW8Export.m_pDoc, pTabBox1, *aItRowSpans); - m_rWW8Export.InsUInt16( nFlags ); - } + sal_uInt16 nFlags = + lcl_TCFlags(*m_rWW8Export.m_pDoc, pTabBox1, *aItRowSpans); + m_rWW8Export.InsUInt16( nFlags ); static sal_uInt8 aNullBytes[] = { 0x0, 0x0 }; @@ -2396,9 +2339,6 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe void WW8AttributeOutput::TableCellBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { - if (!m_rWW8Export.bWrtWW8) - return; - const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); @@ -2432,10 +2372,7 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); sal_uInt8 nBoxes = rTabBoxes.size(); - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTableShd80 ); - else - m_rWW8Export.pO->push_back( (sal_uInt8)191 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTableShd80 ); m_rWW8Export.pO->push_back( (sal_uInt8)(nBoxes * 2) ); // Len for ( sal_uInt8 n = 0; n < nBoxes; n++ ) @@ -2457,18 +2394,16 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t m_rWW8Export.InsUInt16( aShd.GetValue() ); } - if ( m_rWW8Export.bWrtWW8 ) - { - sal_uInt32 aSprmIds[] = { NS_sprm::LN_TDefTableShd, - NS_sprm::LN_TDefTableShdRaw }; - sal_uInt8 nBoxes0 = rTabBoxes.size(); - if (nBoxes0 > 21) - nBoxes0 = 21; + sal_uInt32 aSprmIds[] = { NS_sprm::LN_TDefTableShd, + NS_sprm::LN_TDefTableShdRaw }; + sal_uInt8 nBoxes0 = rTabBoxes.size(); + if (nBoxes0 > 21) + nBoxes0 = 21; - for (sal_uInt32 m = 0; m < 2; m++) - { - m_rWW8Export.InsUInt16( aSprmIds[m] ); - m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(nBoxes0 * 10) ); + for (sal_uInt32 m = 0; m < 2; m++) + { + m_rWW8Export.InsUInt16( aSprmIds[m] ); + m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(nBoxes0 * 10) ); for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) { @@ -2497,7 +2432,6 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t aSHD.Write( m_rWW8Export ); } - } } } @@ -2505,10 +2439,6 @@ void WW8Export::SectionBreaksAndFrames( const SwTextNode& rNode ) { // output page/section breaks OutputSectionBreaks( rNode.GetpSwAttrSet(), rNode ); - - // all textframes anchored as character for the winword 7- format - if ( !bWrtWW8 && !IsInTable() ) - OutWW6FlyFrmsInContent( rNode ); } class TrackContentToExport @@ -2733,129 +2663,92 @@ typedef ww8::WW8Sttb< ww8::WW8Struct > WW8SttbAssoc; void WW8Export::WriteFkpPlcUsw() { - if( !bWrtWW8 ) - { - static const sal_uInt8 aSpec[2] = - { - 117, 1 - }; - - m_pChpPlc->AppendFkpEntry( Strm().Tell() ); // Sepx with fSpecial - pSepx->WriteSepx( Strm() ); // Slcx.Sepx - m_pGrf->Write(); // Graphics - m_pChpPlc->AppendFkpEntry( Strm().Tell(), sizeof( aSpec ), aSpec ); - - m_pChpPlc->WriteFkps(); // Fkp.Chpx - m_pPapPlc->WriteFkps(); // Fkp.Papx - m_pStyles->OutputStylesTable(); // Styles - pFootnote->WritePlc( *this ); // Footnote-Ref & Text Plc - pEdn->WritePlc( *this ); // Endnote-Ref & Text Plc - m_pAtn->WritePlc( *this ); // Annotation-Ref & Text Plc - pSepx->WritePlcSed( *this ); // Slcx.PlcSed - pSepx->WritePlcHdd( *this ); // Slcx.PlcHdd - m_pChpPlc->WritePlc(); // Plcx.Chpx - m_pPapPlc->WritePlc(); // Plcx.Papx - m_aFontHelper.WriteFontTable(pTableStrm, *pFib); // FFNs - if( m_pRedlAuthors ) - m_pRedlAuthors->Write( GetWriter() ); // sttbfRMark (RedlineAuthors) - m_pFieldMain->Write( *this ); // Fields ( Main Text ) - m_pFieldHdFt->Write( *this ); // Fields ( Header/Footer ) - m_pFieldFootnote->Write( *this ); // Fields ( FootNotes ) - m_pFieldEdn->Write( *this ); // Fields ( EndNotes ) - m_pFieldAtn->Write( *this ); // Fields ( Annotations ) - m_pBkmks->Write( *this ); // Bookmarks - sttbfBkmk/ - // plcfBkmkf/plcfBkmkl - WriteDop( *this ); // Document-Properties + // Graphics in the data stream + m_pGrf->Write(); // Graphics - } - else + // Ausgabe in WordDocument-Stream + m_pChpPlc->WriteFkps(); // Fkp.Chpx + m_pPapPlc->WriteFkps(); // Fkp.Papx + pSepx->WriteSepx( Strm() ); // Sepx + + // Ausagbe in Table-Stream + m_pStyles->OutputStylesTable(); // for WW8 StyleTab + pFootnote->WritePlc( *this ); // Footnote-Ref & Text Plc + pEdn->WritePlc( *this ); // Endnote-Ref & Text Plc + m_pTextBxs->WritePlc( *this ); // Textbox Text Plc + m_pHFTextBxs->WritePlc( *this ); // Head/Foot-Textbox Text Plc + m_pAtn->WritePlc( *this ); // Annotation-Ref & Text Plc + + pSepx->WritePlcSed( *this ); // Slcx.PlcSed + pSepx->WritePlcHdd( *this ); // Slcx.PlcHdd + + m_pChpPlc->WritePlc(); // Plcx.Chpx + m_pPapPlc->WritePlc(); // Plcx.Papx + + if( m_pRedlAuthors ) + m_pRedlAuthors->Write( GetWriter() ); // sttbfRMark (RedlineAuthors) + m_pFieldMain->Write( *this ); // Fields ( Main Text ) + m_pFieldHdFt->Write( *this ); // Fields ( Header/Footer ) + m_pFieldFootnote->Write( *this ); // Fields ( FootNotes ) + m_pFieldEdn->Write( *this ); // Fields ( EndNotes ) + m_pFieldAtn->Write( *this ); // Fields ( Annotations ) + m_pFieldTextBxs->Write( *this ); // Fields ( Textboxes ) + m_pFieldHFTextBxs->Write( *this ); // Fields ( Head/Foot-Textboxes ) + + if (m_pEscher || m_pDoc->ContainsMSVBasic()) { - // Graphics in the data stream - m_pGrf->Write(); // Graphics - - // Ausgabe in WordDocument-Stream - m_pChpPlc->WriteFkps(); // Fkp.Chpx - m_pPapPlc->WriteFkps(); // Fkp.Papx - pSepx->WriteSepx( Strm() ); // Sepx - - // Ausagbe in Table-Stream - m_pStyles->OutputStylesTable(); // for WW8 StyleTab - pFootnote->WritePlc( *this ); // Footnote-Ref & Text Plc - pEdn->WritePlc( *this ); // Endnote-Ref & Text Plc - m_pTextBxs->WritePlc( *this ); // Textbox Text Plc - m_pHFTextBxs->WritePlc( *this ); // Head/Foot-Textbox Text Plc - m_pAtn->WritePlc( *this ); // Annotation-Ref & Text Plc - - pSepx->WritePlcSed( *this ); // Slcx.PlcSed - pSepx->WritePlcHdd( *this ); // Slcx.PlcHdd - - m_pChpPlc->WritePlc(); // Plcx.Chpx - m_pPapPlc->WritePlc(); // Plcx.Papx - - if( m_pRedlAuthors ) - m_pRedlAuthors->Write( GetWriter() ); // sttbfRMark (RedlineAuthors) - m_pFieldMain->Write( *this ); // Fields ( Main Text ) - m_pFieldHdFt->Write( *this ); // Fields ( Header/Footer ) - m_pFieldFootnote->Write( *this ); // Fields ( FootNotes ) - m_pFieldEdn->Write( *this ); // Fields ( EndNotes ) - m_pFieldAtn->Write( *this ); // Fields ( Annotations ) - m_pFieldTextBxs->Write( *this ); // Fields ( Textboxes ) - m_pFieldHFTextBxs->Write( *this ); // Fields ( Head/Foot-Textboxes ) - - if (m_pEscher || m_pDoc->ContainsMSVBasic()) - { - /* - Every time MS 2000 creates an escher stream there is always - an ObjectPool dir (even if empty). It turns out that if a copy of - MS 2000 is used to open a document that contains escher graphics - exported from StarOffice without this empty dir then *if* that - copy of MS Office has never been used to open a MSOffice document - that has escher graphics (and an ObjectPool dir of course) and - that copy of office has not been used to draw escher graphics then - our exported graphics do not appear. Once you do open a ms - document with escher graphics or draw an escher graphic with that - copy of word, then all documents from staroffice that contain - escher work from then on. Tricky to track down, some sort of late - binding trickery in MS where solely for first time initialization - the existence of an ObjectPool dir is necessary for triggering - some magic. cmc - */ - // avoid memory leak #i120098#, the unnamed obj will be released in destructor. - xEscherStg = GetWriter().GetStorage().OpenSotStorage(OUString(SL::aObjectPool), - STREAM_READWRITE | StreamMode::SHARE_DENYALL); - } + /* + Every time MS 2000 creates an escher stream there is always + an ObjectPool dir (even if empty). It turns out that if a copy of + MS 2000 is used to open a document that contains escher graphics + exported from StarOffice without this empty dir then *if* that + copy of MS Office has never been used to open a MSOffice document + that has escher graphics (and an ObjectPool dir of course) and + that copy of office has not been used to draw escher graphics then + our exported graphics do not appear. Once you do open a ms + document with escher graphics or draw an escher graphic with that + copy of word, then all documents from staroffice that contain + escher work from then on. Tricky to track down, some sort of late + binding trickery in MS where solely for first time initialization + the existence of an ObjectPool dir is necessary for triggering + some magic. cmc + */ + // avoid memory leak #i120098#, the unnamed obj will be released in destructor. + xEscherStg = GetWriter().GetStorage().OpenSotStorage(OUString(SL::aObjectPool), + STREAM_READWRITE | StreamMode::SHARE_DENYALL); + } - // dggInfo - escher stream - WriteEscher(); + // dggInfo - escher stream + WriteEscher(); - m_pSdrObjs->WritePlc( *this ); - m_pHFSdrObjs->WritePlc( *this ); - // spamom - office drawing table - // spahdr - header office drawing table + m_pSdrObjs->WritePlc( *this ); + m_pHFSdrObjs->WritePlc( *this ); + // spamom - office drawing table + // spahdr - header office drawing table - m_pBkmks->Write( *this ); // Bookmarks - sttbfBkmk/ - // plcfBkmkf/plcfBkmkl + m_pBkmks->Write( *this ); // Bookmarks - sttbfBkmk/ + // plcfBkmkf/plcfBkmkl - WriteNumbering(); + WriteNumbering(); - RestoreMacroCmds(); + RestoreMacroCmds(); - m_pMagicTable->Write( *this ); + m_pMagicTable->Write( *this ); - m_pPiece->WritePc( *this ); // Piece-Table - m_aFontHelper.WriteFontTable(pTableStrm, *pFib); // FFNs + m_pPiece->WritePc( *this ); // Piece-Table + m_aFontHelper.WriteFontTable(pTableStrm, *pFib); // FFNs - //Convert OOo asian typography into MS typography structure - ExportDopTypography(pDop->doptypography); + //Convert OOo asian typography into MS typography structure + ExportDopTypography(pDop->doptypography); - WriteDop( *this ); // Document-Properties + WriteDop( *this ); // Document-Properties - // Write SttbfAssoc - WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> - (m_pDoc->getIDocumentExternalData().getExternalData(::sw::tExternalDataType::STTBF_ASSOC).get()); + // Write SttbfAssoc + WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> + (m_pDoc->getIDocumentExternalData().getExternalData(::sw::tExternalDataType::STTBF_ASSOC).get()); - if ( pSttbfAssoc ) // #i106057# - { + if ( pSttbfAssoc ) // #i106057# + { ::std::vector<OUString> aStrings; ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); @@ -2868,8 +2761,8 @@ void WW8Export::WriteFkpPlcUsw() WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, pFib->lcbSttbfAssoc); - } } + Strm().Seek( 0 ); // Reclaim stored FIB data from document. @@ -2903,8 +2796,7 @@ void WW8Export::StoreDoc1() bNeedsFinalPara |= pEdn->WriteText( *this ); // EndNote-Text // create the escher streams - if( bWrtWW8 ) - CreateEscher(); + CreateEscher(); bNeedsFinalPara |= m_pTextBxs->WriteText( *this ); //Textbox Text Plc bNeedsFinalPara |= m_pHFTextBxs->WriteText( *this );//Head/Foot-Textbox Text Plc @@ -3152,26 +3044,23 @@ void WW8Export::ExportDocument_Impl() { PrepareStorage(); - pFib = new WW8Fib( bWrtWW8 ? 8 : 6, m_bDot ); + pFib = new WW8Fib(8, m_bDot); tools::SvRef<SotStorageStream> xWwStrm( GetWriter().GetStorage().OpenSotStream( m_aMainStg ) ); tools::SvRef<SotStorageStream> xTableStrm( xWwStrm ), xDataStrm( xWwStrm ); xWwStrm->SetBufferSize( 32768 ); - if( bWrtWW8 ) - { - pFib->fWhichTableStm = true; - xTableStrm = GetWriter().GetStorage().OpenSotStream(OUString(SL::a1Table), - STREAM_STD_WRITE ); - xDataStrm = GetWriter().GetStorage().OpenSotStream(OUString(SL::aData), - STREAM_STD_WRITE ); + pFib->fWhichTableStm = true; + xTableStrm = GetWriter().GetStorage().OpenSotStream(OUString(SL::a1Table), + STREAM_STD_WRITE ); + xDataStrm = GetWriter().GetStorage().OpenSotStream(OUString(SL::aData), + STREAM_STD_WRITE ); - xDataStrm->SetBufferSize( 32768 ); // for graphics - xTableStrm->SetBufferSize( 16384 ); // for the Font-/Style-Table, etc. + xDataStrm->SetBufferSize( 32768 ); // for graphics + xTableStrm->SetBufferSize( 16384 ); // for the Font-/Style-Table, etc. - xTableStrm->SetEndian( SvStreamEndian::LITTLE ); - xDataStrm->SetEndian( SvStreamEndian::LITTLE ); - } + xTableStrm->SetEndian( SvStreamEndian::LITTLE ); + xDataStrm->SetEndian( SvStreamEndian::LITTLE ); GetWriter().SetStream( & *xWwStrm ); pTableStrm = &xTableStrm; @@ -3330,16 +3219,13 @@ void WW8Export::ExportDocument_Impl() GetWriter().SetStream( 0 ); xWwStrm->SetBufferSize( 0 ); - if( bWrtWW8 ) + xTableStrm->SetBufferSize( 0 ); + xDataStrm->SetBufferSize( 0 ); + if( 0 == pDataStrm->Seek( STREAM_SEEK_TO_END )) { - xTableStrm->SetBufferSize( 0 ); - xDataStrm->SetBufferSize( 0 ); - if( 0 == pDataStrm->Seek( STREAM_SEEK_TO_END )) - { - xDataStrm.Clear(); - pDataStrm = 0; - GetWriter().GetStorage().Remove(OUString(SL::aData)); - } + xDataStrm.Clear(); + pDataStrm = 0; + GetWriter().GetStorage().Remove(OUString(SL::aData)); } } @@ -3350,57 +3236,29 @@ void WW8Export::PrepareStorage() const char* pName; sal_uInt32 nId1; - if (bWrtWW8) - { - static const char aUserName[] = "Microsoft Word-Document"; - static const sal_uInt8 aCompObj[] = - { - 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0x06, 0x09, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x46, 0x18, 0x00, 0x00, 0x00, - 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, - 0x74, 0x20, 0x57, 0x6F, 0x72, 0x64, 0x2D, 0x44, - 0x6F, 0x6B, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x00, - 0x0A, 0x00, 0x00, 0x00, 0x4D, 0x53, 0x57, 0x6F, - 0x72, 0x64, 0x44, 0x6F, 0x63, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x57, 0x6F, 0x72, 0x64, 0x2E, 0x44, - 0x6F, 0x63, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x2E, - 0x38, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 - }; - - pName = aUserName; - pData = aCompObj; - nLen = sizeof( aCompObj ); - nId1 = 0x00020906L; - } - else - { - static const char aUserName[] = "Microsoft Word 6.0 Document"; - static const sal_uInt8 aCompObj[] = - { - 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x09, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x46, 0x1C, 0x00, 0x00, 0x00, - 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, - 0x74, 0x20, 0x57, 0x6F, 0x72, 0x64, 0x20, 0x36, - 0x2E, 0x30, 0x2D, 0x44, 0x6F, 0x6B, 0x75, 0x6D, - 0x65, 0x6E, 0x74, 0x00, 0x0A, 0x00, 0x00, 0x00, - 0x4D, 0x53, 0x57, 0x6F, 0x72, 0x64, 0x44, 0x6F, - 0x63, 0x00, 0x10, 0x00, 0x00, 0x00, 0x57, 0x6F, - 0x72, 0x64, 0x2E, 0x44, 0x6F, 0x63, 0x75, 0x6D, - 0x65, 0x6E, 0x74, 0x2E, 0x36, 0x00, 0x00, 0x00, - 0x00, 0x00 - }; - - pName = aUserName; - pData = aCompObj; - nLen = sizeof( aCompObj ); - nId1 = 0x00020900L; - } + static const char aUserName[] = "Microsoft Word-Document"; + static const sal_uInt8 aCompObj[] = + { + 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x06, 0x09, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x46, 0x18, 0x00, 0x00, 0x00, + 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, + 0x74, 0x20, 0x57, 0x6F, 0x72, 0x64, 0x2D, 0x44, + 0x6F, 0x6B, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x4D, 0x53, 0x57, 0x6F, + 0x72, 0x64, 0x44, 0x6F, 0x63, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x57, 0x6F, 0x72, 0x64, 0x2E, 0x44, + 0x6F, 0x63, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x2E, + 0x38, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + + pName = aUserName; + pData = aCompObj; + nLen = sizeof( aCompObj ); + nId1 = 0x00020906L; SvGlobalName aGName( nId1, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 ); @@ -3455,7 +3313,7 @@ sal_uLong SwWW8Writer::WriteStorage() // Do the actual export { bool bDot = mpMedium->GetFilter()->GetName().endsWith("Vorlage"); - WW8Export aExport( this, pDoc, pCurPam, pOrigPam, m_bWrtWW8, bDot ); + WW8Export aExport(this, pDoc, pCurPam, pOrigPam, bDot); m_pExport = &aExport; aExport.ExportDocument( bWriteAll ); m_pExport = NULL; @@ -3562,7 +3420,7 @@ MSWordExportBase::~MSWordExportBase() WW8Export::WW8Export( SwWW8Writer *pWriter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam, - bool bIsWW8, bool bDot ) + bool bDot ) : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ) , pO(NULL) , pTableStrm(NULL) @@ -3572,7 +3430,6 @@ WW8Export::WW8Export( SwWW8Writer *pWriter, , pFootnote(NULL) , pEdn(NULL) , pSepx(NULL) - , bWrtWW8(bIsWW8) , m_bDot(bDot) , m_pWriter(pWriter) , m_pAttrOutput(new WW8AttributeOutput(*this)) @@ -3734,10 +3591,6 @@ void WW8SHDLong::Write( WW8Export& rExport ) void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) { - OSL_ENSURE( bWrtWW8, "No 95 export yet" ); - if ( !bWrtWW8 ) - return; - const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark; const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 4fab6dd..78eb471 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -948,7 +948,6 @@ public: WW8_WrPlcFootnoteEdn *pEdn; ///< Endnotes - structure to remember them, and output WW8_WrPlcSepx* pSepx; ///< Sections/headers/footers - bool bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format bool m_bDot; ///< Template or document. protected: @@ -1128,7 +1127,7 @@ public: /// Setup the exporter. WW8Export( SwWW8Writer *pWriter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam, - bool bIsWW8, bool bDot ); + bool bDot ); virtual ~WW8Export(); virtual void DoComboBox(const OUString &rName, commit 1c5e25c01a5460ad5bd6c41a74f8bb66dcd84055 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:17:31 2015 +0200 sw: WW8 export: remove WW6 export, part9: bWrtWW8 in wrtww8gr.cxx Change-Id: I5bc347e19c7eb76693e94bafeef42b8ceb92990f diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index dcd3277..3b2bbea 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -204,22 +204,9 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) 0x0a, 0x08, 1, // sprmCFOLE2 0x56, 0x08, 1 // sprmCFObj }; - static sal_uInt8 aSpecOLE_WW6[] = { - 68, 4, 0, 0, 0, 0, // sprmCPicLocation (len is 4) - 75, 1, // sprmCFOLE2 - 118, 1 // sprmCFObj - }; - if ( bWrtWW8 ) - { - pSpecOLE = aSpecOLE_WW8; - nSize = sizeof( aSpecOLE_WW8 ); - } - else - { - pSpecOLE = aSpecOLE_WW6; - nSize = sizeof( aSpecOLE_WW6 ); - } + pSpecOLE = aSpecOLE_WW8; + nSize = sizeof( aSpecOLE_WW8 ); pDataAdr = pSpecOLE + 2; //WW6 sprm is 1 but has 1 byte len as well. tools::SvRef<SotStorage> xObjStg = GetWriter().GetStorage().OpenSotStorage( @@ -445,30 +432,18 @@ void WW8Export::OutGrf(const sw::Frame &rFrame) GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); nHeight-=nFontHeight/20; - if (bWrtWW8) - Set_UInt16( pArr, NS_sprm::LN_CHpsPos ); - else - Set_UInt8( pArr, 101 ); + Set_UInt16( pArr, NS_sprm::LN_CHpsPos ); Set_UInt16( pArr, -((sal_Int16)nHeight)); } } } // sprmCFSpec - if( bWrtWW8 ) - Set_UInt16( pArr, 0x855 ); - else - Set_UInt8( pArr, 117 ); + Set_UInt16( pArr, 0x855 ); Set_UInt8( pArr, 1 ); // sprmCPicLocation - if( bWrtWW8 ) - Set_UInt16( pArr, NS_sprm::LN_CPicLocation ); - else - { - Set_UInt8( pArr, 68 ); - Set_UInt8( pArr, 4 ); - } + Set_UInt16( pArr, NS_sprm::LN_CPicLocation ); Set_UInt32( pArr, GRF_MAGIC_321 ); // vary Magic, so that different graphic attributes will not be merged @@ -482,7 +457,7 @@ void WW8Export::OutGrf(const sw::Frame &rFrame) // Otherwise, an additional paragraph is exported for a graphic, which is // forced to be treated as inline, because it's anchored inside another frame. if ( !rFrame.IsInline() && - ( ((eAn == FLY_AT_PARA) && ( bWrtWW8 || !IsInTable() )) || + ( ((eAn == FLY_AT_PARA)) || (eAn == FLY_AT_PAGE)) ) { WriteChar( (char)0x0d ); // close the surrounding frame with CR @@ -548,8 +523,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, } Size aGrTwipSz(rFly.GetSize()); - bool bWrtWW8 = rWrt.bWrtWW8; - sal_uInt16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; + sal_uInt16 nHdrLen = 0x44; sal_uInt8 aArr[ 0x44 ] = { 0 }; @@ -605,11 +579,8 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, memcpy( pArr, &aBrc.aBits1, 2); pArr+=2; - if( bWrtWW8 ) - { - memcpy( pArr, &aBrc.aBits2, 2); - pArr+=2; - } + memcpy( pArr, &aBrc.aBits2, 2); + pArr+=2; } } } @@ -704,43 +675,11 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, } else // Embedded File or DDE or something like that { - if (rWrt.bWrtWW8) - { - WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, - rGrfNd.GetpSwAttrSet()); - SwBasicEscherEx aInlineEscher(&rStrm, rWrt); - aInlineEscher.WriteGrfFlyFrame(rFly.GetFrameFormat(), 0x401); - aInlineEscher.WritePictures(); - } - else - { - Graphic& rGrf = const_cast<Graphic&>(rGrfNd.GetGrf()); - - GDIMetaFile aMeta; - switch (rGrf.GetType()) - { - case GRAPHIC_BITMAP: // Bitmap -> play in Metafile - { - ScopedVclPtrInstance< VirtualDevice > pVirt; - aMeta.Record(pVirt.get()); - pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); - aMeta.Stop(); - aMeta.WindStart(); - aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); - aMeta.SetPrefSize( rGrf.GetPrefSize()); - } - break; - case GRAPHIC_GDIMETAFILE : // GDI ( =SV ) Metafile - aMeta = rGrf.GetGDIMetaFile(); - break; - default: - return; - } - - WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight, - rGrfNd.GetpSwAttrSet()); - WriteWindowMetafileBits(rStrm, aMeta); - } + WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, + rGrfNd.GetpSwAttrSet()); + SwBasicEscherEx aInlineEscher(&rStrm, rWrt); + aInlineEscher.WriteGrfFlyFrame(rFly.GetFrameFormat(), 0x401); + aInlineEscher.WritePictures(); } } //For i120928,export graphic info of bullet @@ -751,8 +690,7 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, sal_Int16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; Size aGrTwipSz(rGrf.GetPrefSize()); - bool bWrtWW8 = rWrt.bWrtWW8; - sal_uInt16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; + sal_uInt16 nHdrLen = 0x44; sal_uInt8 aArr[ 0x44 ] = { 0 }; @@ -781,11 +719,8 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, memcpy( pArr, &aBrc.aBits1, 2); pArr+=2; - if( bWrtWW8 ) - { - memcpy( pArr, &aBrc.aBits2, 2); - pArr+=2; - } + memcpy(pArr, &aBrc.aBits2, 2); + pArr+=2; } pArr = aArr + 4; //skip lcb @@ -835,38 +770,10 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 nWidth, sal_uInt16 nHeight) { - if (rWrt.bWrtWW8) - { - WritePICBulletFHeader(rStrm,rGrf, 0x64,nWidth,nHeight); - SwBasicEscherEx aInlineEscher(&rStrm, rWrt); - aInlineEscher.WriteGrfBullet(rGrf); - aInlineEscher.WritePictures(); - } - else - { - GDIMetaFile aMeta; - switch (rGrf.GetType()) - { - case GRAPHIC_BITMAP: // Bitmap -> in Metafile abspielen - { - ScopedVclPtrInstance< VirtualDevice > pVirt; - aMeta.Record(pVirt.get()); - pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); - aMeta.Stop(); - aMeta.WindStart(); - aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); - aMeta.SetPrefSize( rGrf.GetPrefSize()); - } - break; - case GRAPHIC_GDIMETAFILE : // GDI ( =SV ) Metafile - aMeta = rGrf.GetGDIMetaFile(); - break; - default: - return; - } - WritePICBulletFHeader(rStrm, rGrf, 8, nWidth, nHeight); - WriteWindowMetafileBits(rStrm, aMeta); - } + WritePICBulletFHeader(rStrm,rGrf, 0x64,nWidth,nHeight); + SwBasicEscherEx aInlineEscher(&rStrm, rWrt); + aInlineEscher.WriteGrfBullet(rGrf); + aInlineEscher.WritePictures(); } void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) @@ -906,48 +813,15 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) if (pNd) { #ifdef OLE_PREVIEW_AS_EMF - if (!rWrt.bWrtWW8) - { - SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); - SwOLEObj& rSObj = pOleNd->GetOLEObj(); - uno::Reference < embed::XEmbeddedObject > rObj( rSObj.GetOleRef() ); - - comphelper::EmbeddedObjectContainer aCnt( pOleNd->GetDoc()->GetDocStorage() ); - - SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( rObj ) ); - OSL_ENSURE( pGraphicStream && !pGraphicStream->GetError(), "No graphic stream available!" ); - if ( pGraphicStream && !pGraphicStream->GetError() ) - { - Graphic aGr; - GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); - if( rGF.ImportGraphic( aGr, OUString(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ) == GRFILTER_OK ) - { - //TODO/LATER: do we really want to use GDIMetafile?! - GDIMetaFile aMtf; - aMtf = aGr.GetGDIMetaFile(); - aMtf.WindStart(); - aMtf.Play(Application::GetDefaultDevice(), Point(0, 0), - Size(2880, 2880)); - WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight, - pNd->GetpSwAttrSet()); - WriteWindowMetafileBits(rStrm, aMtf); - } - } - else - delete pGraphicStream; - } - else - { - //Convert this ole2 preview in ww8+ to an EMF for better unicode - //support (note that at this moment this breaks StarSymbol - //using graphics because I need to embed starsymbol in exported - //documents. - WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, - pNd->GetpSwAttrSet()); - SwBasicEscherEx aInlineEscher(&rStrm, rWrt); - aInlineEscher.WriteOLEFlyFrame(rFly.GetFrameFormat(), 0x401); - aInlineEscher.WritePictures(); - } + //Convert this ole2 preview in ww8+ to an EMF for better unicode + //support (note that at this moment this breaks StarSymbol + //using graphics because I need to embed starsymbol in exported + //documents. + WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, + pNd->GetpSwAttrSet()); + SwBasicEscherEx aInlineEscher(&rStrm, rWrt); + aInlineEscher.WriteOLEFlyFrame(rFly.GetFrameFormat(), 0x401); + aInlineEscher.WritePictures(); #else // cast away const SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); @@ -977,8 +851,6 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) case sw::Frame::eDrawing: case sw::Frame::eTextBox: case sw::Frame::eFormControl: - OSL_ENSURE(rWrt.bWrtWW8, - "You can't try and export these in WW8 format, a filter bug"); /* #i3958# We only export an empty dummy picture frame here, this is what word does the escher export should contain an anchored to @@ -986,7 +858,6 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) shebang surrounded with a SHAPE field. This isn't *my* hack :-), its what word does. */ - if (rWrt.bWrtWW8) { WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight); SwBasicEscherEx aInlineEscher(&rStrm, rWrt); commit 42d40281e676fa4f70597f8e03005449228e8db7 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jun 20 00:06:47 2015 +0200 sw: WW8 export: remove WW6 export, part8: bWrtWW8 in ww8atr.cxx Change-Id: I85afe629ee10ffcb3e509da0dab3a495427522c3 diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index ca94614..b86a01a 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -166,8 +166,6 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich case RES_CHRATR_CTL_LANGUAGE: case RES_CHRATR_CTL_POSTURE: case RES_CHRATR_CTL_WEIGHT: - if (!bWrtWW8) - bRet = false; default: break; } @@ -177,26 +175,6 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich //Complex is ok in ww8, but for ww6 there is only //one font, one fontsize, one fontsize (weight/posture) //and only one language - if ( !bWrtWW8 ) - { - switch ( nWhich ) - { - case RES_CHRATR_CJK_FONT: - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CJK_POSTURE: - case RES_CHRATR_CJK_WEIGHT: - case RES_CHRATR_CJK_LANGUAGE: - case RES_CHRATR_FONT: - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_POSTURE: - case RES_CHRATR_WEIGHT: - case RES_CHRATR_LANGUAGE: - bRet = false; - break; - default: - break; - } - } } else { @@ -217,8 +195,6 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich case RES_CHRATR_CTL_LANGUAGE: case RES_CHRATR_CTL_POSTURE: case RES_CHRATR_CTL_WEIGHT: - if ( !bWrtWW8 ) - bRet = false; default: break; } @@ -693,44 +669,19 @@ sal_uInt8 WW8Export::GetNumId( sal_uInt16 eNumType ) return nRet; } -void WW8AttributeOutput::OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat &rNFormat, const SwFormat &rFormat ) +void WW8AttributeOutput::OutlineNumbering( sal_uInt8 nLvl, const SwNumFormat &/*TODO*/, const SwFormat &/*TODO*/) { if ( nLvl >= WW8ListManager::nMaxLevel ) nLvl = WW8ListManager::nMaxLevel-1; - if ( m_rWW8Export.bWrtWW8 ) - { - // write sprmPOutLvl sprmPIlvl and sprmPIlfo - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_POutLvl ); - m_rWW8Export.pO->push_back( nLvl ); - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlvl ); - m_rWW8Export.pO->push_back( nLvl ); - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlfo ); - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, - 1 + m_rWW8Export.GetId( *m_rWW8Export.m_pDoc->GetOutlineNumRule() ) ); - } - else - { - m_rWW8Export.Out_SwNumLvl( nLvl ); - if ( rNFormat.GetPositionAndSpaceMode() == - SvxNumberFormat::LABEL_WIDTH_AND_POSITION && - rNFormat.GetAbsLSpace() ) - { - SwNumFormat aNumFormat( rNFormat ); - const SvxLRSpaceItem& rLR = - ItemGet<SvxLRSpaceItem>( rFormat, RES_LR_SPACE ); - - aNumFormat.SetAbsLSpace( writer_cast<short>( - aNumFormat.GetAbsLSpace() + rLR.GetLeft() ) ); - m_rWW8Export.Out_NumRuleAnld( - *m_rWW8Export.m_pDoc->GetOutlineNumRule(), - aNumFormat, nLvl ); - } - else - m_rWW8Export.Out_NumRuleAnld( - *m_rWW8Export.m_pDoc->GetOutlineNumRule(), - rNFormat, nLvl ); - } + // write sprmPOutLvl sprmPIlvl and sprmPIlfo + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_POutLvl ); + m_rWW8Export.pO->push_back( nLvl ); + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlvl ); + m_rWW8Export.pO->push_back( nLvl ); + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_PIlfo ); + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, + 1 + m_rWW8Export.GetId( *m_rWW8Export.m_pDoc->GetOutlineNumRule() ) ); } // #i77805# @@ -748,16 +699,12 @@ bool WW8Export::DisallowInheritingOutlineNumbering(const SwFormat &rFormat) { if (static_cast<const SwTextFormatColl*>(pParent)->IsAssignedToListLevelOfOutlineStyle()) { - if (bWrtWW8) - { - SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_POutLvl); - pO->push_back(sal_uInt8(9)); - SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_PIlfo); - SwWW8Writer::InsUInt16(*pO, 0); + SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_POutLvl); + pO->push_back(sal_uInt8(9)); + SwWW8Writer::InsUInt16(*pO, NS_sprm::LN_PIlfo); + SwWW8Writer::InsUInt16(*pO, 0); - bRet = true; - } - /*whats the winword 6 way to do this ?*/ + bRet = true; } } } @@ -971,7 +918,7 @@ OUString MSWordExportBase::GetBookmarkName( sal_uInt16 nTyp, const OUString* pNa /* File CHRATR.HXX: */ void WW8AttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) { - if ( m_rWW8Export.bWrtWW8 && bIsRTL ) + if (bIsRTL) { if( m_rWW8Export.m_pDoc->GetDocumentType() != SwDoc::DOCTYPE_MSWORD ) { @@ -981,7 +928,7 @@ void WW8AttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) } // #i46087# patch from james_clark; complex texts needs the undocumented SPRM CComplexScript with param 0x81. - if ( m_rWW8Export.bWrtWW8 && nScript == i18n::ScriptType::COMPLEX && !bIsRTL ) + if (nScript == i18n::ScriptType::COMPLEX && !bIsRTL) { m_rWW8Export.InsUInt16( NS_sprm::LN_CComplexScript ); m_rWW8Export.pO->push_back( (sal_uInt8)0x81 ); @@ -1093,12 +1040,7 @@ void WW8AttributeOutput::ParagraphStyle( sal_uInt16 nStyle ) void WW8AttributeOutput::OutputWW8Attribute( sal_uInt8 nId, bool bVal ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( 8 == nId ? NS_sprm::LN_CFDStrike : NS_sprm::LN_CFBold + nId ); - else if (8 == nId ) - return; // no such attribute in WW6 - else - m_rWW8Export.pO->push_back( 85 + nId ); + m_rWW8Export.InsUInt16( 8 == nId ? NS_sprm::LN_CFDStrike : NS_sprm::LN_CFBold + nId ); m_rWW8Export.pO->push_back( bVal ? 1 : 0 ); } @@ -1106,7 +1048,7 @@ void WW8AttributeOutput::OutputWW8Attribute( sal_uInt8 nId, bool bVal ) void WW8AttributeOutput::OutputWW8AttributeCTL( sal_uInt8 nId, bool bVal ) { OSL_ENSURE( nId <= 1, "out of range" ); - if ( !m_rWW8Export.bWrtWW8 || nId > 1 ) + if (nId > 1) return; m_rWW8Export.InsUInt16( NS_sprm::LN_CFBoldBi + nId ); @@ -1117,68 +1059,35 @@ void WW8AttributeOutput::CharFont( const SvxFontItem& rFont ) { sal_uInt16 nFontID = m_rWW8Export.GetId( rFont ); - if ( m_rWW8Export.bWrtWW8 ) - { - m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc0 ); - m_rWW8Export.InsUInt16( nFontID ); - m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc2 ); - } - else - m_rWW8Export.pO->push_back( 93 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc0 ); + m_rWW8Export.InsUInt16( nFontID ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc2 ); m_rWW8Export.InsUInt16( nFontID ); } void WW8AttributeOutput::CharFontCTL( const SvxFontItem& rFont ) { - //Can only export in 8+, in 7- export as normal variant and expect that - //upperlevel code has blocked exporting clobbering attributes sal_uInt16 nFontID = m_rWW8Export.GetId( rFont ); - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CFtcBi ); - else - m_rWW8Export.pO->push_back( 93 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CFtcBi ); m_rWW8Export.InsUInt16( nFontID ); } void WW8AttributeOutput::CharFontCJK( const SvxFontItem& rFont ) { - //Can only export in 8+, in 7- export as normal variant and expect that - //upperlevel code has blocked exporting clobbering attributes sal_uInt16 nFontID = m_rWW8Export.GetId( rFont ); - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc1 ); - else - m_rWW8Export.pO->push_back( 93 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CRgFtc1 ); m_rWW8Export.InsUInt16( nFontID ); } void WW8AttributeOutput::CharWeightCTL( const SvxWeightItem& rWeight ) { - //Can only export in 8+, in 7- export as normal variant and expect that - //upperlevel code has blocked exporting clobbering attributes - if (m_rWW8Export.bWrtWW8) - { - OutputWW8AttributeCTL( 0, WEIGHT_BOLD == rWeight.GetWeight()); - } - else - { - OutputWW8Attribute( 0, WEIGHT_BOLD == rWeight.GetWeight()); - } + OutputWW8AttributeCTL( 0, WEIGHT_BOLD == rWeight.GetWeight()); } void WW8AttributeOutput::CharPostureCTL( const SvxPostureItem& rPosture ) { - // Can only export in 8+, in 7- export as normal variant and expect that - // upperlevel code has blocked exporting clobbering attributes - if (m_rWW8Export.bWrtWW8) - { - OutputWW8AttributeCTL( 1, ITALIC_NONE != rPosture.GetPosture() ); - } - else - { - OutputWW8Attribute( 1, ITALIC_NONE != rPosture.GetPosture() ); - } + OutputWW8AttributeCTL( 1, ITALIC_NONE != rPosture.GetPosture() ); } void WW8AttributeOutput::CharPosture( const SvxPostureItem& rPosture ) @@ -1204,32 +1113,23 @@ void WW8AttributeOutput::CharShadow( const SvxShadowedItem& rShadow ) void WW8AttributeOutput::CharKerning( const SvxKerningItem& rKerning ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CDxaSpace ); - else - m_rWW8Export.pO->push_back( 96 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CDxaSpace ); m_rWW8Export.InsUInt16( rKerning.GetValue() ); } void WW8AttributeOutput::CharAutoKern( const SvxAutoKernItem& rAutoKern ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsKern ); - else - m_rWW8Export.pO->push_back( 107 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsKern ); m_rWW8Export.InsUInt16( rAutoKern.GetValue() ? 1 : 0 ); } void WW8AttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink ) { - if ( m_rWW8Export.bWrtWW8 ) - { - m_rWW8Export.InsUInt16( NS_sprm::LN_CSfxText ); - // At the moment the only animated text effect we support is blinking - m_rWW8Export.InsUInt16( rBlink.GetValue() ? 2 : 0 ); - } + m_rWW8Export.InsUInt16( NS_sprm::LN_CSfxText ); + // At the moment the only animated text effect we support is blinking + m_rWW8Export.InsUInt16( rBlink.GetValue() ? 2 : 0 ); } void WW8AttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossed ) @@ -1285,7 +1185,7 @@ void WW8AttributeOutput::CharBorder( const SvxBorderLine* pAllBorder, const sal_ void WW8AttributeOutput::CharHighlight( const SvxBrushItem& rBrush ) { - if( m_rWW8Export.bWrtWW8 && rBrush.GetColor() != COL_TRANSPARENT ) + if (rBrush.GetColor() != COL_TRANSPARENT) { sal_uInt8 nColor = msfilter::util::TransColToIco( rBrush.GetColor() ); // sprmCHighlight @@ -1296,10 +1196,7 @@ void WW8AttributeOutput::CharHighlight( const SvxBrushItem& rBrush ) void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CKul ); - else - m_rWW8Export.pO->push_back( 94 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CKul ); const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_CHRATR_WORDLINEMODE ); bool bWord = false; @@ -1318,7 +1215,7 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) b = ( bWord ) ? 2 : 1; break; case UNDERLINE_BOLD: - b = m_rWW8Export.bWrtWW8 ? 6 : 1; + b = 6; break; case UNDERLINE_DOUBLE: b = 3; @@ -1327,41 +1224,41 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) b = 4; break; case UNDERLINE_DASH: - b = m_rWW8Export.bWrtWW8 ? 7 : 4; + b = 7; break; case UNDERLINE_DASHDOT: - b = m_rWW8Export.bWrtWW8 ? 9 : 4; + b = 9; break; case UNDERLINE_DASHDOTDOT: - b = m_rWW8Export.bWrtWW8 ? 10 : 4; + b = 10; break; case UNDERLINE_WAVE: - b = m_rWW8Export.bWrtWW8 ? 11 : 3; + b = 11; break; // new in WW2000 case UNDERLINE_BOLDDOTTED: - b = m_rWW8Export.bWrtWW8 ? 20 : 4; + b = 20; break; case UNDERLINE_BOLDDASH: - b = m_rWW8Export.bWrtWW8 ? 23 : 4; + b = 23; break; case UNDERLINE_LONGDASH: - b = m_rWW8Export.bWrtWW8 ? 39 : 4; + b = 39; break; case UNDERLINE_BOLDLONGDASH: - b = m_rWW8Export.bWrtWW8 ? 55 : 4; + b = 55; break; case UNDERLINE_BOLDDASHDOT: - b = m_rWW8Export.bWrtWW8 ? 25 : 4; + b = 25; break; case UNDERLINE_BOLDDASHDOTDOT: - b = m_rWW8Export.bWrtWW8 ? 26 : 4; + b = 26; break; case UNDERLINE_BOLDWAVE: - b = m_rWW8Export.bWrtWW8 ? 27 : 3; + b = 27; break; case UNDERLINE_DOUBLEWAVE: - b = m_rWW8Export.bWrtWW8 ? 43 : 3; + b = 43; break; case UNDERLINE_NONE: b = 0; @@ -1375,42 +1272,32 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) Color aColor = rUnderline.GetColor(); if( aColor != COL_TRANSPARENT ) { - if( m_rWW8Export.bWrtWW8 ) - { - m_rWW8Export.InsUInt16( 0x6877 ); + m_rWW8Export.InsUInt16( 0x6877 ); - m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( aColor.GetColor() ) ); - } + m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( aColor.GetColor() ) ); } } void WW8AttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage ) { sal_uInt16 nId = 0; - if ( m_rWW8Export.bWrtWW8 ) + switch ( rLanguage.Which() ) { - switch ( rLanguage.Which() ) - { - case RES_CHRATR_LANGUAGE: - nId = NS_sprm::LN_CRgLid0_80; - break; - case RES_CHRATR_CJK_LANGUAGE: - nId = NS_sprm::LN_CRgLid1_80; - break; - case RES_CHRATR_CTL_LANGUAGE: - nId = NS_sprm::LN_CLidBi; - break; - } + case RES_CHRATR_LANGUAGE: + nId = NS_sprm::LN_CRgLid0_80; + break; + case RES_CHRATR_CJK_LANGUAGE: + nId = NS_sprm::LN_CRgLid1_80; + break; + case RES_CHRATR_CTL_LANGUAGE: + nId = NS_sprm::LN_CLidBi; + break; } - else - nId = 97; if ( nId ) { - if ( m_rWW8Export.bWrtWW8 ) // use sprmCRgLid0_80 rather than sprmCLid - m_rWW8Export.InsUInt16( nId ); - else - m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(nId) ); + // use sprmCRgLid0_80 rather than sprmCLid + m_rWW8Export.InsUInt16( nId ); m_rWW8Export.InsUInt16( rLanguage.GetLanguage() ); // Word 2000 and above apparently require both old and new versions of @@ -1448,10 +1335,7 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) if ( 0xFF != b ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CIss ); - else - m_rWW8Export.pO->push_back( 104 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CIss ); m_rWW8Export.pO->push_back( b ); } @@ -1460,19 +1344,13 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) { long nHeight = static_cast<const SvxFontHeightItem&>(m_rWW8Export.GetItem( RES_CHRATR_FONTSIZE )).GetHeight(); - if( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsPos ); - else - m_rWW8Export.pO->push_back( 101 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CHpsPos ); m_rWW8Export.InsUInt16( (short)(( nHeight * nEsc + 500 ) / 1000 )); if( 100 != nProp || !b ) { - if( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( NS_sprm::LN_CHps ); - else - m_rWW8Export.pO->push_back( 99 ); + m_rWW8Export.InsUInt16( NS_sprm::LN_CHps ); m_rWW8Export.InsUInt16( msword_cast<sal_uInt16>((nHeight * nProp + 500 ) / 1000)); @@ -1483,28 +1361,20 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) void WW8AttributeOutput::CharFontSize( const SvxFontHeightItem& rHeight ) { sal_uInt16 nId = 0; - if ( m_rWW8Export.bWrtWW8 ) + switch ( rHeight.Which() ) { - switch ( rHeight.Which() ) - { - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_CJK_FONTSIZE: - nId = NS_sprm::LN_CHps; - break; - case RES_CHRATR_CTL_FONTSIZE: - nId = NS_sprm::LN_CHpsBi; - break; - } + case RES_CHRATR_FONTSIZE: + case RES_CHRATR_CJK_FONTSIZE: + nId = NS_sprm::LN_CHps; + break; + case RES_CHRATR_CTL_FONTSIZE: + nId = NS_sprm::LN_CHpsBi; + break; } - else - nId = 99; if ( nId ) { - if ( m_rWW8Export.bWrtWW8 ) - m_rWW8Export.InsUInt16( nId ); - else - m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(nId) ); + m_rWW8Export.InsUInt16( nId ); m_rWW8Export.InsUInt16( (sal_uInt16)(( rHeight.GetHeight() + 5 ) / 10 ) ); } @@ -1512,38 +1382,32 @@ void WW8AttributeOutput::CharFontSize( const SvxFontHeightItem& rHeight ) void WW8AttributeOutput::CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth ) { - if ( m_rWW8Export.bWrtWW8 ) - { - m_rWW8Export.InsUInt16( NS_sprm::LN_CCharScale ); - m_rWW8Export.InsUInt16( rScaleWidth.GetValue() ); - } + m_rWW8Export.InsUInt16( NS_sprm::LN_CCharScale ); + m_rWW8Export.InsUInt16( rScaleWidth.GetValue() ); } void WW8AttributeOutput::CharRelief( const SvxCharReliefItem& rRelief ) { - if ( m_rWW8Export.bWrtWW8 ) + sal_uInt16 nId; + switch ( rRelief.GetValue() ) { - sal_uInt16 nId; - switch ( rRelief.GetValue() ) - { - case RELIEF_EMBOSSED: nId = NS_sprm::LN_CFEmboss; break; - case RELIEF_ENGRAVED: nId = NS_sprm::LN_CFImprint; break; - default: nId = 0; break; - } + case RELIEF_EMBOSSED: nId = NS_sprm::LN_CFEmboss; break; + case RELIEF_ENGRAVED: nId = NS_sprm::LN_CFImprint; break; + default: nId = 0; break; + } - if( nId ) - { - m_rWW8Export.InsUInt16( nId ); - m_rWW8Export.pO->push_back( (sal_uInt8)0x81 ); - } - else - { - // switch both flags off - m_rWW8Export.InsUInt16( NS_sprm::LN_CFEmboss ); - m_rWW8Export.pO->push_back( (sal_uInt8)0x0 ); - m_rWW8Export.InsUInt16( NS_sprm::LN_CFImprint ); - m_rWW8Export.pO->push_back( (sal_uInt8)0x0 ); - } + if( nId ) + { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits