You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/07/01 17:20:58 UTC

svn commit: r1607111 - in /openoffice/trunk/main/sw/source/filter/ww8: ww8par.cxx ww8par2.cxx ww8par2.hxx ww8par3.cxx

Author: orw
Date: Tue Jul  1 15:20:58 2014
New Revision: 1607111

URL: http://svn.apache.org/r1607111
Log:
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


Modified:
    openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
    openoffice/trunk/main/sw/source/filter/ww8/ww8par2.cxx
    openoffice/trunk/main/sw/source/filter/ww8/ww8par2.hxx
    openoffice/trunk/main/sw/source/filter/ww8/ww8par3.cxx

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1607111&r1=1607110&r2=1607111&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx Tue Jul  1 15:20:58 2014
@@ -4555,13 +4555,13 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8G
     }
     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
         {

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par2.cxx?rev=1607111&r1=1607110&r2=1607111&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par2.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par2.cxx Tue Jul  1 15:20:58 2014
@@ -636,28 +636,35 @@ ApoTestResults SwWW8ImplReader::TestApo(
 //   Hilfroutinen fuer Kapitelnummerierung und Aufzaehlung / Gliederung
 //---------------------------------------------------------------------
 
-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 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 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 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( 
         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.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;
 

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par2.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par2.hxx?rev=1607111&r1=1607110&r2=1607111&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par2.hxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par2.hxx Tue Jul  1 15:20:58 2014
@@ -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

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par3.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par3.cxx?rev=1607111&r1=1607110&r2=1607111&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par3.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par3.cxx Tue Jul  1 15:20:58 2014
@@ -530,10 +530,14 @@ void lcl_CopyGreaterEight(String &rDest,
     }
 }
 
-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::SetTxtFmtCollAndLi
             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::RegisterNumFmtOnTx
             ? 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::RegisterNumFmtOnTx
             // 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,