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 2012/11/22 13:46:44 UTC

svn commit: r1412533 - /incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx

Author: orw
Date: Thu Nov 22 12:46:44 2012
New Revision: 1412533

URL: http://svn.apache.org/viewvc?rev=1412533&view=rev
Log:
#120938# - method <WW8AttributeOutput::ParaTabStop(..) - consider left indentation when converting tab stop positions of styles

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1412533&r1=1412532&r2=1412533&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx Thu Nov 22 12:46:44 2012
@@ -4892,8 +4892,9 @@ void SwWW8WrTabu::PutAll(WW8Export& rWrt
 }
 
 
-static void ParaTabStopAdd( WW8Export& rWrt, const SvxTabStopItem& rTStops,
-    long nLParaMgn )
+static void ParaTabStopAdd( WW8Export& rWrt, 
+                            const SvxTabStopItem& rTStops,
+                            const long nLParaMgn )
 {
     SwWW8WrTabu aTab( 0, rTStops.Count());
 
@@ -4918,8 +4919,11 @@ bool lcl_IsEqual(long nOneLeft, const Sv
           );
 }
 
-static void ParaTabStopDelAdd( WW8Export& rWrt, const SvxTabStopItem& rTStyle,
-    long nLStypeMgn, const SvxTabStopItem& rTNew, long nLParaMgn )
+static void ParaTabStopDelAdd( WW8Export& rWrt, 
+                               const SvxTabStopItem& rTStyle,
+                               const long nLStypeMgn, 
+                               const SvxTabStopItem& rTNew, 
+                               const long nLParaMgn )
 {
     SwWW8WrTabu aTab(rTStyle.Count(), rTNew.Count());
 
@@ -4995,15 +4999,15 @@ static void ParaTabStopDelAdd( WW8Export
 
 void WW8AttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStops )
 {
-    bool bTabsRelativeToIndex = m_rWW8Export.pCurPam->GetDoc()->get( IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT );
+    const bool bTabsRelativeToIndex = m_rWW8Export.pCurPam->GetDoc()->get( IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT );
+
     long nCurrentLeft = 0;
-    
     if ( bTabsRelativeToIndex )
     {
         const SfxPoolItem* pLR = m_rWW8Export.HasItem( RES_LR_SPACE );
         
         if ( pLR != NULL )
-            nCurrentLeft = ((const SvxLRSpaceItem*)pLR)->GetTxtLeft();
+            nCurrentLeft = static_cast<const SvxLRSpaceItem*>(pLR)->GetTxtLeft();
     }
 
     // --> FLR 2009-03-17 #i100264#
@@ -5011,42 +5015,51 @@ void WW8AttributeOutput::ParaTabStop( co
          m_rWW8Export.pCurrentStyle != NULL &&
          m_rWW8Export.pCurrentStyle->DerivedFrom() != NULL ) 
     {
-        SvxTabStopItem aTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+        SvxTabStopItem aParentTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
         const SwFmt *pParentStyle = m_rWW8Export.pCurrentStyle->DerivedFrom();
-        const SvxTabStopItem* pParentTabs = HasItem<SvxTabStopItem>( pParentStyle->GetAttrSet(), RES_PARATR_TABSTOP );
-        if ( pParentTabs )
         {
-            aTabs.Insert( pParentTabs );
+            const SvxTabStopItem* pParentTabs = HasItem<SvxTabStopItem>( pParentStyle->GetAttrSet(), RES_PARATR_TABSTOP );
+            if ( pParentTabs )
+            {
+                aParentTabs.Insert( pParentTabs );
+            }
         }
-        
-        ParaTabStopDelAdd( m_rWW8Export, aTabs, 0, rTabStops, 0 );
+
+        // #120938# - consider left indentation of style and its parent style
+        long nParentLeft = 0;
+        if ( bTabsRelativeToIndex )
+        {
+            const SvxLRSpaceItem &rStyleLR = ItemGet<SvxLRSpaceItem>( pParentStyle->GetAttrSet(), RES_LR_SPACE );
+            nParentLeft = rStyleLR.GetTxtLeft();
+        }
+
+        ParaTabStopDelAdd( m_rWW8Export, aParentTabs, nParentLeft, rTabStops, nCurrentLeft );
         return;
     }
     // <--
 
-    // StyleDef -> "einfach" eintragen || keine Style-Attrs -> dito
     const SvxTabStopItem* pStyleTabs = 0;
     if ( !m_rWW8Export.bStyDef && m_rWW8Export.pStyAttr )
     {
-        pStyleTabs =
-            HasItem<SvxTabStopItem>( *m_rWW8Export.pStyAttr, RES_PARATR_TABSTOP );
+        pStyleTabs = HasItem<SvxTabStopItem>( *m_rWW8Export.pStyAttr, RES_PARATR_TABSTOP );
     }
 
     if ( !pStyleTabs )
+    {
         ParaTabStopAdd(m_rWW8Export, rTabStops, nCurrentLeft);
+    }
     else
     {
         long nStyleLeft = 0;
-        
-        if (bTabsRelativeToIndex)
+        if ( bTabsRelativeToIndex )
         {
-            const SvxLRSpaceItem &rStyleLR =
-            ItemGet<SvxLRSpaceItem>(*m_rWW8Export.pStyAttr, RES_LR_SPACE);
+            const SvxLRSpaceItem &rStyleLR = ItemGet<SvxLRSpaceItem>(*m_rWW8Export.pStyAttr, RES_LR_SPACE);
             nStyleLeft = rStyleLR.GetTxtLeft();
         }
 
-        ParaTabStopDelAdd(m_rWW8Export, *pStyleTabs, nStyleLeft, rTabStops,
-            nCurrentLeft);
+        ParaTabStopDelAdd( m_rWW8Export, 
+                           *pStyleTabs, nStyleLeft, 
+                           rTabStops, nCurrentLeft);
     }
 }