[Libreoffice-commits] .: 2 commits - sw/inc sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Nov 2 07:10:31 PDT 2011


 sw/inc/IDocumentSettingAccess.hxx        |    3 ++-
 sw/inc/doc.hxx                           |    1 +
 sw/source/core/doc/doc.cxx               |    5 +++++
 sw/source/core/doc/docnew.cxx            |    1 +
 sw/source/core/text/inftxt.cxx           |    5 +++--
 sw/source/core/text/inftxt.hxx           |    4 ++++
 sw/source/core/text/itrform2.cxx         |    3 +++
 sw/source/core/text/portab.hxx           |    8 +++++---
 sw/source/core/text/txttab.cxx           |   18 +++++++++++++-----
 sw/source/filter/ww8/ww8par.cxx          |    1 +
 sw/source/filter/ww8/ww8par3.cxx         |    5 ++++-
 sw/source/filter/xml/xmlimp.cxx          |   10 ++++++++++
 sw/source/ui/uno/SwXDocumentSettings.cxx |   16 +++++++++++++++-
 13 files changed, 67 insertions(+), 13 deletions(-)

New commits:
commit 8c0847593abd84d4f6c2bcf8f243202ae876dc57
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Wed Nov 2 14:41:05 2011 +0100

    n#715115: WW8 numbering levels: use the WW6 indent if legacy flag is set

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 1b38b33..cb01a45 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -906,7 +906,10 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
     {
         rNumFmt.SetIndentAt( aLVL.nDxaLeft );
         rNumFmt.SetFirstLineIndent(aLVL.nDxaLeft1);
-        rNumFmt.SetListtabPos( nTabPos );
+        if ( !aLVL.bV6 )
+            rNumFmt.SetListtabPos( nTabPos );
+        else
+            rNumFmt.SetListtabPos( aLVL.nV6Indent );
         SvxNumberFormat::SvxNumLabelFollowedBy eNumLabelFollowedBy = SvxNumberFormat::LISTTAB;
         switch ( ixchFollow )
         {
commit fd886cdc6a8c047a9fb1bd10a00f901b4adb525e
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Mon Oct 31 17:39:16 2011 +0100

    n#693238: fixed docx import of tabs set after the end margin
    
    Added a new compatibility option to keep the previous behavior, but
    changed the default to avoid lines insertion for tabs when there are tab
    stops set beyond the end margin

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 1dd7699..50e8096 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -79,9 +79,10 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
          PROTECT_FORM,
          // #i89181#
          TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
-     INVERT_BORDER_SPACING,
+         INVERT_BORDER_SPACING,
          COLLAPSE_EMPTY_CELL_PARA,
          SMALL_CAPS_PERCENTAGE_66,
+         TAB_OVERFLOW,
          // COMPATIBILITY FLAGS END
 
          BROWSE_MODE,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 3461e6d..656b0b7 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -579,6 +579,7 @@ private:
     bool mbCollapseEmptyCellPara                    : 1;
     bool mbTabAtLeftIndentForParagraphsInList;             // #i89181# - see above
     bool mbSmallCapsPercentage66;
+    bool mbTabOverflow;
 
     bool mbLastBrowseMode                           : 1;
 
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index aef0e49..c512862 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -202,6 +202,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
         case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
         case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
         case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66;
+        case TAB_OVERFLOW: return mbTabOverflow;
 
         case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
         case HTML_MODE: return mbHTMLMode;
@@ -336,6 +337,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
         case SMALL_CAPS_PERCENTAGE_66:
             mbSmallCapsPercentage66 = value;
             break;
+
+        case TAB_OVERFLOW:
+            mbTabOverflow = value;
+            break;
          // COMPATIBILITY FLAGS END
 
         case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index aa8aa3a..f8a0ce2 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -357,6 +357,7 @@ SwDoc::SwDoc()
     mbInvertBorderSpacing                   = false;        // hidden
     mbCollapseEmptyCellPara                 = true;        // hidden
     mbSmallCapsPercentage66                 = false;        // hidden
+    mbTabOverflow                           = true;
 
     //
     // COMPATIBILITY FLAGS END
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index a76d746..5d84e84 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1459,7 +1459,7 @@ void SwTxtFormatInfo::Init()
     // Nicht initialisieren: pRest, nLeft, nRight, nFirst, nRealWidth
     X(0);
     bArrowDone = bFull = bFtnDone = bErgoDone = bNumDone = bNoEndHyph =
-        bNoMidHyph = bStop = bNewLine = bUnderFlow = sal_False;
+        bNoMidHyph = bStop = bNewLine = bUnderFlow = bTabOverflow = sal_False;
 
     // generally we do not allow number portions in follows, except...
     if ( GetTxtFrm()->IsFollow() )
@@ -1501,7 +1501,8 @@ void SwTxtFormatInfo::Init()
  * --------------------------------------------------*/
 
 SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf,
-    SwLineLayout& rLay, SwTwips nActWidth ) : SwTxtPaintInfo( rInf )
+    SwLineLayout& rLay, SwTwips nActWidth ) : SwTxtPaintInfo( rInf ),
+    bTabOverflow( sal_False )
 {
     pRoot = &rLay;
     pLast = &rLay;
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index b549cf4..b056612 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -565,6 +565,7 @@ class SwTxtFormatInfo : public SwTxtPaintInfo
     sal_Bool bFakeLineStart: 1; // String has been replaced by field portion
                                 // info structure only pretends that we are at
                                 // the beginning of a line
+    sal_Bool bTabOverflow;      // Tabs are expanding after the end margin
 
     xub_Unicode   cTabDecimal;  // das _aktuelle_ Dezimalzeichen
     xub_Unicode   cHookChar;    // fuer Tabs in Feldern etc.
@@ -734,6 +735,9 @@ public:
 
 //  friend ostream &operator<<( ostream &rOS, const SwTxtFormatInfo &rInf );
     friend SvStream &operator<<( SvStream &rOS, const SwTxtFormatInfo &rInf );
+
+    inline void SetTabOverflow( sal_Bool bOverflow ) { bTabOverflow = bOverflow; }
+    inline sal_Bool IsTabOverflow( ) { return bTabOverflow; }
 };
 
 /*************************************************************************
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 965d73e..a507526 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -738,6 +738,9 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
 
     // 3260, 3860: Fly auf jeden Fall loeschen!
     ClearFly( rInf );
+
+    // Reinit the tab overflow flag after the line
+    rInf.SetTabOverflow( sal_False );
 }
 
 /*************************************************************************
diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx
index 3cda7b9..bb5fe9d 100644
--- a/sw/source/core/text/portab.hxx
+++ b/sw/source/core/text/portab.hxx
@@ -38,17 +38,19 @@ class SwTabPortion : public SwFixPortion
 {
     const KSHORT nTabPos;
     const xub_Unicode cFill;
+    const bool bAutoTabStop;
 
     // Das Format() verzweigt entweder in Pre- oder PostFormat()
     sal_Bool PreFormat( SwTxtFormatInfo &rInf );
 public:
-    SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0' );
+    SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0', const bool bAutoTab = true );
     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
     virtual void FormatEOL( SwTxtFormatInfo &rInf );
     sal_Bool PostFormat( SwTxtFormatInfo &rInf );
     inline  sal_Bool IsFilled() const { return 0 != cFill; }
     inline  KSHORT GetTabPos() const { return nTabPos; }
+    inline  sal_Bool IsAutoTabStop() const { return bAutoTabStop; }
 
     // Accessibility: pass information about this portion to the PortionHandler
     virtual void HandlePortion( SwPortionHandler& rPH ) const;
@@ -63,8 +65,8 @@ public:
 class SwTabLeftPortion : public SwTabPortion
 {
 public:
-    inline SwTabLeftPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
-         : SwTabPortion( nTabPosVal, cFillChar )
+    inline SwTabLeftPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0', bool bAutoTab = true )
+         : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
     { SetWhichPor( POR_TABLEFT ); }
     OUTPUT_OPERATOR
 };
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 7ed1874..d237873 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -94,6 +94,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
     SvxTabAdjust eAdj;
 
     KSHORT nNewTabPos;
+    bool bAutoTabStop = true;
     {
         const bool bRTL = pFrm->IsRightToLeft();
         // #i24363# tab stops relative to indent
@@ -177,6 +178,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
                 //calculate default tab position of default tabs in negative indent
                 nNextPos = ( nSearchPos / nNextPos ) * nNextPos;
             }
+            bAutoTabStop = false;
         }
         else
         {
@@ -312,7 +314,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
             {
                    OSL_ENSURE( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj,
                         "+SwTxtFormatter::NewTabPortion: unknown adjustment" );
-                pTabPor = new SwTabLeftPortion( nNewTabPos, cFill );
+                pTabPor = new SwTabLeftPortion( nNewTabPos, cFill, bAutoTabStop );
                 break;
             }
         }
@@ -333,8 +335,8 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
 // Die Basisklasse wird erstmal ohne alles initialisiert.
 
 
-SwTabPortion::SwTabPortion( const KSHORT nTabPosition, const xub_Unicode cFillChar )
-    : SwFixPortion( 0, 0 ), nTabPos(nTabPosition), cFill(cFillChar)
+SwTabPortion::SwTabPortion( const KSHORT nTabPosition, const xub_Unicode cFillChar, const bool bAutoTab )
+    : SwFixPortion( 0, 0 ), nTabPos(nTabPosition), cFill(cFillChar), bAutoTabStop( bAutoTab )
 {
     nLineLength = 1;
 #if OSL_DEBUG_LEVEL > 1
@@ -388,6 +390,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
     Fix( static_cast<sal_uInt16>(rInf.X()) );
 
     const bool bTabCompat = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT);
+    const bool bTabOverflow = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVERFLOW);
 
     // Die Mindestbreite eines Tabs ist immer mindestens ein Blank
     // #i37686# In compatibility mode, the minimum width
@@ -419,7 +422,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
     // 1. Minmal width does not fit to line anymore.
     // 2. An underflow event was called for the tab portion.
     sal_Bool bFull = ( bTabCompat && rInf.IsUnderFlow() ) ||
-                       rInf.Width() <= rInf.X() + PrtWidth();
+                     ( rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() ) ;
 
     // #95477# Rotated tab stops get the width of one blank
     const sal_uInt16 nDir = rInf.GetFont()->GetOrientation( rInf.GetTxtFrm()->IsVertical() );
@@ -447,10 +450,15 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
                 // In tabulator compatibility mode, we reset the bFull flag
                 // if the tabulator is at the end of the paragraph and the
                 // tab stop position is outside the frame:
+                bool bAtParaEnd = rInf.GetIdx() + GetLen() == rInf.GetTxt().Len();
                 if ( bFull && bTabCompat &&
-                     rInf.GetIdx() + GetLen() == rInf.GetTxt().Len() &&
+                     ( bTabOverflow && ( rInf.IsTabOverflow() || !IsAutoTabStop() ) || bAtParaEnd ) &&
                      GetTabPos() >= rInf.GetTxtFrm()->Frm().Width() )
+                {
                     bFull = sal_False;
+                    if ( bTabOverflow && !IsAutoTabStop() )
+                        rInf.SetTabOverflow( sal_True );
+                }
 
                 break;
             }
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2876172..0f8f732 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1579,6 +1579,7 @@ void SwWW8ImplReader::ImportDop()
 
     rDoc.set(IDocumentSettingAccess::INVERT_BORDER_SPACING, true);
     rDoc.set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, true);
+    rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true);
 
     //
     // COMPATIBILITY FLAGS END
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index f47c9df..06b95b3 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1191,6 +1191,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US));
+    aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US));
 
     sal_Int32 nCount = aConfigProps.getLength();
     const PropertyValue* pValues = aConfigProps.getConstArray();
@@ -1220,6 +1221,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     bool bUnixForceZeroExtLeading = false;
     bool bUseOldPrinterMetrics = false;
     bool bSmallCapsPercentage66 = false;
+    bool bTabOverflow = false;
 
     OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
 
@@ -1289,6 +1291,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
                     bUseOldPrinterMetrics = true;
                 else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66")) )
                     bSmallCapsPercentage66 = true;
+                else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabOverflow")) )
+                    bTabOverflow = true;
             }
             catch( Exception& )
             {
@@ -1442,6 +1446,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
             OUString( RTL_CONSTASCII_USTRINGPARAM("SmallCapsPercentage66") ), makeAny( true ) );
     }
 
+    if ( !bTabOverflow )
+    {
+        xProps->setPropertyValue(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("TabOverflow") ), makeAny( false ) );
+    }
+
     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     Reference < XText > xText = xTextDoc->getText();
     Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index b3dbea1..0d42d12 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -123,7 +123,8 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_MATH_BASELINE_ALIGNMENT,
     HANDLE_INVERT_BORDER_SPACING,
     HANDLE_COLLAPSE_EMPTY_CELL_PARA,
-    HANDLE_SMALL_CAPS_PERCENTAGE_66
+    HANDLE_SMALL_CAPS_PERCENTAGE_66,
+    HANDLE_TAB_OVERFLOW
 };
 
 MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -182,6 +183,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo()
         { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, CPPUTYPE_BOOLEAN, 0, 0},
+        { RTL_CONSTASCII_STRINGPARAM("TabOverflow"), HANDLE_TAB_OVERFLOW, CPPUTYPE_BOOLEAN, 0, 0},
 /*
  * As OS said, we don't have a view when we need to set this, so I have to
  * find another solution before adding them to this property set - MTG
@@ -709,6 +711,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             mpDoc->set(IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66, bTmp);
         }
         break;
+        case HANDLE_TAB_OVERFLOW:
+        {
+            sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+            mpDoc->set(IDocumentSettingAccess::TAB_OVERFLOW, bTmp);
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }
@@ -1059,6 +1067,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
+        case HANDLE_TAB_OVERFLOW:
+        {
+            sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::TAB_OVERFLOW );
+            rValue.setValue( &bTmp, ::getBooleanCppuType() );
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }


More information about the Libreoffice-commits mailing list