diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-06-20 10:30:16 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-06-20 11:42:41 +0200 |
commit | ed11cb1dbada47f0ef2129005583fc23d8a9ac10 (patch) | |
tree | b831cf37e31b95c6703c0438232cb337182d9b0c | |
parent | 40bfeb3aef71e61fd620b8c3aa9d04a1b4ae5246 (diff) |
sw: WW8 export: remove WW6 export, partD: WW6 numbering export
These functions only call each other.
Change-Id: I0268e7559cdbc7b4695dce44ee5bddbe047387a1
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 279 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 11 |
2 files changed, 0 insertions, 290 deletions
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 09366bc794e9..30187b0f84d9 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 30f43bed9770..a1d9c7736a98 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; |