[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sw/inc sw/source writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 8 06:08:23 PST 2013


 sw/inc/IDocumentSettingAccess.hxx           |    1 +
 sw/inc/doc.hxx                              |    1 +
 sw/source/core/doc/doc.cxx                  |    5 +++++
 sw/source/core/doc/docnew.cxx               |    1 +
 sw/source/core/text/txttab.cxx              |    5 ++++-
 sw/source/filter/ww8/ww8par.cxx             |    1 +
 sw/source/filter/xml/xmlimp.cxx             |    7 +++++++
 sw/source/ui/uno/SwXDocumentSettings.cxx    |   16 +++++++++++++++-
 writerfilter/source/filter/ImportFilter.cxx |    1 +
 9 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 908bcce46c54e999916b32dffef34d34f21878d4
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 8 11:57:13 2013 +0100

    n#793998 sw: add TabOverMargin compat mode
    
    In case the right margin is larger then the tab position (e.g. the right
    margin of 7cm, there is a tab position at 16cm and right margin begins
    at 9cm), we have a conflicting case.  In Word, the tab has priority, so
    in this conflicting case, the text can be outside the specified margin.
    In Writer, the right margin has priority. Add a compat flag to let
    the tab have priority in Writer as well for Word formats.
    
    This is similar to TabOverflow, but that was only applied to left tabs
    and only in case there were no characters after the tabs in the
    paragraph.
    (cherry picked from commit bdfc6363d66aa079512cc8008996b633f693fed1)

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 2c02236..8214f1a 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -77,6 +77,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
          UNBREAKABLE_NUMBERINGS,
          CLIPPED_PICTURES,
          BACKGROUND_PARA_OVER_DRAWINGS,
+         TAB_OVER_MARGIN,
          // COMPATIBILITY FLAGS END
 
          BROWSE_MODE,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index bfe2826..34ba7df 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -578,6 +578,7 @@ private:
     bool mbUnbreakableNumberings;
     bool mbClippedPictures;
     bool mbBackgroundParaOverDrawings;
+    bool mbTabOverMargin;
 
     bool mbLastBrowseMode                           : 1;
 
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index dda0b6d..80cfa84 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -192,6 +192,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
         case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
         case CLIPPED_PICTURES: return mbClippedPictures;
         case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
+        case TAB_OVER_MARGIN: return mbTabOverMargin;
 
         case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
         case HTML_MODE: return mbHTMLMode;
@@ -347,6 +348,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
             mbBackgroundParaOverDrawings = value;
             break;
 
+        case TAB_OVER_MARGIN:
+            mbTabOverMargin = 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 730fe56..d5f55f7 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -317,6 +317,7 @@ SwDoc::SwDoc()
     mbUnbreakableNumberings(false),
     mbClippedPictures(false),
     mbBackgroundParaOverDrawings(false),
+    mbTabOverMargin(false),
     mbLastBrowseMode( false ),
     n32DummyCompatabilityOptions1(0),
     n32DummyCompatabilityOptions2(0),
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index a83ea96..124fa8f 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -486,7 +486,10 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
 
 sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf )
 {
-    const KSHORT nRight = Min( GetTabPos(), rInf.Width() );
+    const bool bTabOverMargin = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVER_MARGIN);
+    // If the tab position is larger than the right margin, it gets scaled down by default.
+    // However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines.
+    const KSHORT nRight = bTabOverMargin ? GetTabPos() : Min(GetTabPos(), rInf.Width());
     const SwLinePortion *pPor = GetPortion();
 
     KSHORT nPorWidth = 0;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 22c49fd..8760c72 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1524,6 +1524,7 @@ void SwWW8ImplReader::ImportDop()
     rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true);
     rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true);
     rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true);
+    rDoc.set(IDocumentSettingAccess::TAB_OVER_MARGIN, true);
 
     //
     // COMPATIBILITY FLAGS END
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 637ef88..a6cdc42 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1142,6 +1142,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US));
+    aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US));
 
     sal_Int32 nCount = aConfigProps.getLength();
     const PropertyValue* pValues = aConfigProps.getConstArray();
@@ -1175,6 +1176,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     bool bUnbreakableNumberings = false;
     bool bClippedPictures = false;
     bool bBackgroundParaOverDrawings = false;
+    bool bTabOverMargin = false;
 
     OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
 
@@ -1267,6 +1269,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
                     bClippedPictures = true;
                 else if ( pValues->Name == "BackgroundParaOverDrawings" )
                     bBackgroundParaOverDrawings = true;
+                else if ( pValues->Name == "TabOverMargin" )
+                    bTabOverMargin = true;
             }
             catch( Exception& )
             {
@@ -1454,6 +1458,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     if ( !bBackgroundParaOverDrawings )
         xProps->setPropertyValue("BackgroundParaOverDrawings", makeAny( false ) );
 
+    if ( !bTabOverMargin )
+        xProps->setPropertyValue("TabOverMargin", 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 ede40fd..828b603 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -122,7 +122,8 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_CLIPPED_PICTURES,
     HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
     HANDLE_EMBED_FONTS,
-    HANDLE_EMBED_SYSTEM_FONTS
+    HANDLE_EMBED_SYSTEM_FONTS,
+    HANDLE_TAB_OVER_MARGIN,
 };
 
 static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -191,6 +192,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
         { RTL_CONSTASCII_STRINGPARAM("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("EmbedFonts"), HANDLE_EMBED_FONTS, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, CPPUTYPE_BOOLEAN, 0, 0},
+        { RTL_CONSTASCII_STRINGPARAM("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, 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
@@ -785,6 +787,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             mpDoc->set(IDocumentSettingAccess::EMBED_SYSTEM_FONTS, bTmp);
         }
         break;
+        case HANDLE_TAB_OVER_MARGIN:
+        {
+            sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+            mpDoc->set(IDocumentSettingAccess::TAB_OVER_MARGIN, bTmp);
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }
@@ -1192,6 +1200,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
+        case HANDLE_TAB_OVER_MARGIN:
+        {
+            sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::TAB_OVER_MARGIN );
+            rValue.setValue( &bTmp, ::getBooleanCppuType() );
+        }
+        break;
         default:
             throw UnknownPropertyException();
     }
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index d58e877..e56cbca 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -192,6 +192,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >&
    xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True ));
    xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) );
    xSettings->setPropertyValue( "BackgroundParaOverDrawings", uno::makeAny( sal_True ) );
+   xSettings->setPropertyValue( "TabOverMargin", uno::makeAny( sal_True ) );
 }
 
 void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )


More information about the Libreoffice-commits mailing list