sw/source/filter/ww8/ww8par.cxx | 46 +++++++++++++------------ sw/source/filter/ww8/ww8par2.cxx | 40 +++++++++++++-------- sw/source/filter/ww8/ww8par2.hxx | 6 +++ sw/source/filter/ww8/ww8par3.cxx | 71 ++++++++++++--------------------------- xmloff/source/text/txtstyli.cxx | 2 - 5 files changed, 78 insertions(+), 87 deletions(-)
New commits: commit 4ffe95181283fb477a5911254a8d507892b58d32 Author: Armin Le Grand <a...@apache.org> Date: Tue Jul 1 15:25:11 2014 +0000 corrected obviously wrong comparison diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 8bc1823..6de97b5 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -539,7 +539,7 @@ void XMLTextStyleContext::FillPropertySet( (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue ); } - if(XML_STYLE_FAMILY_TABLE_TABLE == IsDefaultStyle() && GetFamily()) + if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_TABLE == GetFamily()) { OUString sCollapsingBorders(OUString( RTL_CONSTASCII_USTRINGPARAM( "CollapsingBorders" ) ) ); DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "property missing?" ); commit abb629c4741dd12328c86e7583370213d9598a2e Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Tue Jul 1 15:20:58 2014 +0000 78498: WW8 import - some further improvements and corrections regarding outline: - apply default outline level to WW8 Build-in Heading Styles - get WW8 Build-In Heading Styles' list level applied to the paragraphs - apply list level properties of WW8 Built-In Heading Styles only, if the list level of the WW8 Build-In Heading Style corresponds to its outline level diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 246ac97..fa2bfe3 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4555,13 +4555,13 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) } else //ordinary case { - //Modify here for #119405, by easyfan, 2012-05-24 - mbOnLoadingMain = true; - //End of modification, by easyfan - ReadText(0, pWwFib->ccpText, MAN_MAINTEXT); - //Modify here for #119405, by easyfan, 2012-05-24 - mbOnLoadingMain = false; - //End of modification, by easyfan + //Modify here for #119405, by easyfan, 2012-05-24 + mbOnLoadingMain = true; + //End of modification, by easyfan + ReadText( 0, pWwFib->ccpText, MAN_MAINTEXT ); + //Modify here for #119405, by easyfan, 2012-05-24 + mbOnLoadingMain = false; + //End of modification, by easyfan } ::SetProgressState(nProgress, mpDocShell); // Update @@ -5256,17 +5256,12 @@ void SwWW8ImplReader::SetOutlineStyles() } } - if ( pChosenWW8ListStyle == NULL ) - { - // no WW8 list style for Outline Style found --> nothing to do - return; - } - // - set list level properties of Outline Style - ODF's list style applied by default to headings // - assign corresponding Heading Paragraph Styles to the Outline Style // - If a heading Paragraph Styles is not applying the WW8 list style which had been chosen as // the one which provides the list level properties for the Outline Style, its assignment to - // the Outline Style is removed and a potential applied WW8 list style is assigned directly. + // the Outline Style is removed. A potential applied WW8 list style is assigned directly and + // its default outline level is applied. SwNumRule aOutlineRule( *rDoc.GetOutlineNumRule() ); bool bAppliedChangedOutlineStyle = false; std::vector< SwWW8StyInf* >::iterator aStylesIterEnd = @@ -5283,18 +5278,21 @@ void SwWW8ImplReader::SetOutlineStyles() continue; } -#if OSL_DEBUG_LEVEL > 1 - ASSERT( pStyleInf->mnWW8OutlineLevel == pStyleInf->nListLevel, - "WW8 import - <SwWW8ImplReader::SetOutlineStyles()> - it is not expected that WW8 Built-In Heading styles have different outline level and list level" ); -#endif - const SwNumFmt& rRule = pChosenWW8ListStyle->Get( pStyleInf->mnWW8OutlineLevel ); - aOutlineRule.Set( pStyleInf->mnWW8OutlineLevel, rRule ); - bAppliedChangedOutlineStyle = true; + if ( pChosenWW8ListStyle != NULL + && pStyleInf->mnWW8OutlineLevel == pStyleInf->nListLevel ) + { + const SwNumFmt& rRule = pChosenWW8ListStyle->Get( pStyleInf->mnWW8OutlineLevel ); + aOutlineRule.Set( pStyleInf->mnWW8OutlineLevel, rRule ); + bAppliedChangedOutlineStyle = true; + } + // in case that there are more styles on this level ignore them nOutlineStyleListLevelWithAssignment |= nOutlineStyleListLevelOfWW8BuiltInHeadingStyle; SwTxtFmtColl* pTxtFmtColl = static_cast<SwTxtFmtColl*>(pStyleInf->pFmt); - if ( pStyleInf->GetOutlineNumrule() != pChosenWW8ListStyle ) + if ( pStyleInf->GetOutlineNumrule() != pChosenWW8ListStyle + || ( pStyleInf->nListLevel < WW8ListManager::nMaxLevel + && pStyleInf->mnWW8OutlineLevel != pStyleInf->nListLevel ) ) { // WW8 Built-In Heading Style does not apply the chosen one. // --> delete assignment to OutlineStyle, but keep its current outline level @@ -5304,6 +5302,10 @@ void SwWW8ImplReader::SetOutlineStyles() { pTxtFmtColl->SetFmtAttr( SwNumRuleItem( pStyleInf->GetOutlineNumrule()->GetName() ) ); } + // apply default outline level of WW8 Built-in Heading Style + const sal_uInt8 nOutlineLevel = + SwWW8StyInf::WW8OutlineLevelToOutlinelevel( pStyleInf->mnWW8OutlineLevel ); + pTxtFmtColl->SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, nOutlineLevel ) ); } else { diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index a44e3b8..419a8ef 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -636,28 +636,35 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, // Hilfroutinen fuer Kapitelnummerierung und Aufzaehlung / Gliederung //--------------------------------------------------------------------- -static void SetBaseAnlv(SwNumFmt &rNum, WW8_ANLV &rAV, sal_uInt8 nSwLevel ) +static void SetBaseAnlv( + SwNumFmt &rNum, + WW8_ANLV &rAV, + sal_uInt8 nSwLevel ) { - static SvxExtNumType eNumA[8] = { SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER, - SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N, SVX_NUM_ARABIC, - SVX_NUM_ARABIC, SVX_NUM_ARABIC }; + static SvxExtNumType eNumA[8] = + { SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER, + SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N, + SVX_NUM_ARABIC, SVX_NUM_ARABIC, SVX_NUM_ARABIC }; - static SvxAdjust eAdjA[4] = { SVX_ADJUST_LEFT, - SVX_ADJUST_RIGHT, SVX_ADJUST_LEFT, SVX_ADJUST_LEFT }; -// eigentlich folgende 2, aber Writer-UI bietet es nicht an -// SVX_ADJUST_CENTER, SVX_ADJUST_BLOCKLINE }; + static SvxAdjust eAdjA[4] = + { SVX_ADJUST_LEFT, SVX_ADJUST_RIGHT, SVX_ADJUST_LEFT, SVX_ADJUST_LEFT }; + + rNum.SetNumberingType( + static_cast< sal_Int16 >(( SVBT8ToByte( rAV.nfc ) < 8 ) + ? eNumA[SVBT8ToByte( rAV.nfc ) ] + : SVX_NUM_NUMBER_NONE) ); - rNum.SetNumberingType( static_cast< sal_Int16 >(( SVBT8ToByte( rAV.nfc ) < 8 ) ? - eNumA[SVBT8ToByte( rAV.nfc ) ] : SVX_NUM_NUMBER_NONE) ); if ((SVBT8ToByte(rAV.aBits1 ) & 0x4) >> 2) + { rNum.SetIncludeUpperLevels(nSwLevel + 1); + } rNum.SetStart( SVBT16ToShort( rAV.iStartAt ) ); -// rNum.eNumAdjust = eAdjA[rAV.jc]; + rNum.SetNumAdjust( eAdjA[SVBT8ToByte( rAV.aBits1 ) & 0x3] ); rNum.SetCharTextDistance( SVBT16ToShort( rAV.dxaSpace ) ); - sal_Int16 nIndent = Abs((sal_Int16)SVBT16ToShort( rAV.dxaIndent )); - if( SVBT8ToByte( rAV.aBits1 ) & 0x08 ) //fHang + sal_Int16 nIndent = Abs( (sal_Int16) SVBT16ToShort( rAV.dxaIndent ) ); + if ( SVBT8ToByte( rAV.aBits1 ) & 0x08 ) //fHang { rNum.SetFirstLineOffset( -nIndent ); rNum.SetLSpace( nIndent ); @@ -877,11 +884,9 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, shor pAktColl->SetFmtAttr( SwNumRuleItem() ); String aName(CREATE_CONST_ASC( "Outline" )); - // --> OD 2008-02-11 #newlistlevelattrs# SwNumRule aNR( rDoc.GetUniqueNumRuleName( &aName ), SvxNumberFormat::LABEL_WIDTH_AND_POSITION, OUTLINE_RULE ); - // <-- aNR = *rDoc.GetOutlineNumRule(); SetAnld(&aNR, (WW8_ANLD*)pData, nSwNumLevel, true); @@ -4035,7 +4040,10 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty rSI.eCJKFontSrcCharSet = pj->eCJKFontSrcCharSet; rSI.n81Flags = pj->n81Flags; rSI.n81BiDiFlags = pj->n81BiDiFlags; - rSI.mnWW8OutlineLevel = pj->mnWW8OutlineLevel; + if ( !rSI.IsWW8BuiltInHeadingStyle() ) + { + rSI.mnWW8OutlineLevel = pj->mnWW8OutlineLevel; + } rSI.bParaAutoBefore = pj->bParaAutoBefore; rSI.bParaAutoAfter = pj->bParaAutoAfter; diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx index 8b5fd9e..81c500e 100644 --- a/sw/source/filter/ww8/ww8par2.hxx +++ b/sw/source/filter/ww8/ww8par2.hxx @@ -208,6 +208,12 @@ public: { sWWStyleName = rName; nWWStyleId = nId; + + // apply default WW8 outline level to WW8 Built-in Heading styles + if ( IsWW8BuiltInHeadingStyle() ) + { + mnWW8OutlineLevel = nWWStyleId - 1; + } } const String& GetOrgWWName() const diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 6be732b..2040c2e 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -530,10 +530,14 @@ void lcl_CopyGreaterEight(String &rDest, String &rSrc, } } -bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, - sal_uInt16 nLevelStyle, bool bSetStartNo, - std::deque<bool> &rNotReallyThere, sal_uInt16 nLevel, - ww::bytes &rParaSprms) +bool WW8ListManager::ReadLVL( + SwNumFmt& rNumFmt, + SfxItemSet*& rpItemSet, + sal_uInt16 nLevelStyle, + bool bSetStartNo, + std::deque< bool > &rNotReallyThere, + sal_uInt16 nLevel, + ww::bytes &rParaSprms ) { sal_uInt8 aBits1; sal_uInt16 nStartNo = 0; // Start-Nr. fuer den Writer @@ -1755,16 +1759,11 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel( pTxtNode->ResetAttr( RES_PARATR_NUMRULE ); } - if ( rStyleInfo.GetOutlineNumrule() == NULL ) + if ( USHRT_MAX > rStyleInfo.nLFOIndex + && WW8ListManager::nMaxLevel > rStyleInfo.nListLevel ) { - if ( - (USHRT_MAX > rStyleInfo.nLFOIndex) && - (WW8ListManager::nMaxLevel > rStyleInfo.nListLevel) - ) - { - RegisterNumFmtOnTxtNode(rStyleInfo.nLFOIndex, - rStyleInfo.nListLevel, false); - } + const bool bApplyListStyle = false; + RegisterNumFmtOnTxtNode( rStyleInfo.nLFOIndex, rStyleInfo.nListLevel, bApplyListStyle ); } } return bRes; @@ -1904,37 +1903,13 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode( ? pLstManager->GetNumRuleForActivation( nActLFO, nActLevel, aParaSprms, pTxtNd) : 0; - if ( pRule != NULL - || !bSetAttr) + if ( pRule != NULL || !bSetAttr) { - //#i24136# old is the same as new, and its the outline numbering, - //then we don't set the numrule again, and we just take the num node - //(the actual outline numbering gets set in SetOutlineNum) - using namespace sw::util; - bool bUnchangedOutlineNumbering = false; - /* - If the node is outline numbered, and the new numbering to apply - is the one that was chosen to be the outline numbering then all - is unchanged - */ - if ( pTxtNd->GetNumRule() == rDoc.GetOutlineNumRule() ) + if ( bSetAttr + && pTxtNd->GetNumRule() != pRule + && pTxtNd->GetNumRule() != rDoc.GetOutlineNumRule() ) { - bUnchangedOutlineNumbering = true; - } - if ( !bUnchangedOutlineNumbering ) - { - //If its normal numbering, see if its the same as it already - //was, if its not, and we have been asked to set it, then set - //it to the new one - if (bSetAttr) - { - const SwNumRule *pNormal = pTxtNd->GetNumRule(); - if (pNormal != pRule) - { - pTxtNd->SetAttr - (SwNumRuleItem(pRule->GetName())); - } - } + pTxtNd->SetAttr( SwNumRuleItem( pRule->GetName() ) ); } pTxtNd->SetAttrListLevel(nActLevel); @@ -1947,16 +1922,16 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode( // Direct application of the list level formatting no longer // needed for list levels of mode LABEL_ALIGNMENT bool bApplyListLevelIndentDirectlyAtPara( true ); - if ( pTxtNd->GetNumRule() && nActLevel < MAXLEVEL ) { - const SwNumFmt& rFmt = pTxtNd->GetNumRule()->Get( nActLevel ); - if ( rFmt.GetPositionAndSpaceMode() == - SvxNumberFormat::LABEL_ALIGNMENT ) + if ( pTxtNd->GetNumRule() && nActLevel < MAXLEVEL ) { - bApplyListLevelIndentDirectlyAtPara = false; + const SwNumFmt& rFmt = pTxtNd->GetNumRule()->Get( nActLevel ); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + bApplyListLevelIndentDirectlyAtPara = false; + } } } - if ( bApplyListLevelIndentDirectlyAtPara ) { SfxItemSet aListIndent(rDoc.GetAttrPool(), RES_LR_SPACE, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits