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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 01:03:39 PDT 2012


 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/inc/frame.hxx                |    5 +++--
 sw/source/core/layout/paintfrm.cxx          |   18 ++++++++++++------
 sw/source/filter/xml/xmlimp.cxx             |    7 +++++++
 sw/source/ui/uno/SwXDocumentSettings.cxx    |   14 ++++++++++++++
 writerfilter/source/filter/ImportFilter.cxx |    1 +
 9 files changed, 45 insertions(+), 8 deletions(-)

New commits:
commit 18b3feb8bef06bf7b126fd0bc743e19479cb8026
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Sep 12 09:59:27 2012 +0200

    n#778133 sw: add BackgroundParaOverDrawings compat flag
    
    In Word, the layer that contains a background image is behind the layer
    that contains the paragraph background. In Writer, the paragraph
    background is painted before the hell layer. Add a compat flag to change
    the order, so the DOCX importer can trigger that.
    
    To reproduce, create an XShape, send it to the background, set some
    color for a paragraph background, and notice that the background color
    is missing where the shape is behind the text.
    
    Change-Id: I9b1fffd9ac9a6e5a1c3d1f65371440047d125b38

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index b7d2c13..efddb59 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -85,6 +85,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
          TAB_OVERFLOW,
          UNBREAKABLE_NUMBERINGS,
          CLIPPED_PICTURES,
+         BACKGROUND_PARA_OVER_DRAWINGS,
          // COMPATIBILITY FLAGS END
 
          BROWSE_MODE,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 001ebf8..9346d04 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -592,6 +592,7 @@ private:
     bool mbTabOverflow;
     bool mbUnbreakableNumberings;
     bool mbClippedPictures;
+    bool mbBackgroundParaOverDrawings;
 
     bool mbLastBrowseMode                           : 1;
 
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 3dc4caf..de69e88 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -200,6 +200,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
         case TAB_OVERFLOW: return mbTabOverflow;
         case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
         case CLIPPED_PICTURES: return mbClippedPictures;
+        case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
 
         case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
         case HTML_MODE: return mbHTMLMode;
@@ -351,6 +352,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
             mbClippedPictures = value;
             break;
 
+        case BACKGROUND_PARA_OVER_DRAWINGS:
+            mbBackgroundParaOverDrawings = 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 b2d07db..73029d5 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -359,6 +359,7 @@ SwDoc::SwDoc()
     mbUnbreakableNumberings                 = false;
     mbFloattableNomargins                   = false;
     mbClippedPictures                       = false;
+    mbBackgroundParaOverDrawings            = false;
     mEmbedFonts                             = false;
     mEmbedSystemFonts                       = false;
 
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index b346b30..b72964c 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -492,11 +492,12 @@ public:
     virtual void PaintBorder( const SwRect&, const SwPageFrm *pPage,
                               const SwBorderAttrs & ) const;
     void PaintBaBo( const SwRect&, const SwPageFrm *pPage = 0,
-                    const sal_Bool bLowerBorder = sal_False ) const;
+                    const sal_Bool bLowerBorder = sal_False, const bool bOnlyTxtBackground = false ) const;
     void PaintBackground( const SwRect&, const SwPageFrm *pPage,
                           const SwBorderAttrs &,
                           const sal_Bool bLowerMode = sal_False,
-                          const sal_Bool bLowerBorder = sal_False ) const;
+                          const sal_Bool bLowerBorder = sal_False,
+                          const bool bOnlyTxtBackground = false ) const;
     void PaintBorderLine( const SwRect&, const SwRect&, const SwPageFrm*,
                           const Color *pColor, const editeng::SvxBorderStyle =
                 ::com::sun::star::table::BorderLineStyle::SOLID ) const;
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 3bef609..d8673cd 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3129,6 +3129,9 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
                     pLines->LockLines( sal_False );
                 }
 
+                if ( pSh->GetDoc()->get( IDocumentSettingAccess::BACKGROUND_PARA_OVER_DRAWINGS ) )
+                pPage->PaintBaBo( aPaintRect, pPage, sal_True, /*bOnlyTxtBackground=*/true );
+
                 if( pSh->GetWin() )
                 {
                     // collect sub-lines
@@ -6005,7 +6008,7 @@ SwRect SwPageFrm::GetBoundRect() const
 |*************************************************************************/
 
 void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
-                       const sal_Bool bLowerBorder ) const
+                       const sal_Bool bLowerBorder, const bool bOnlyTxtBackground ) const
 {
     if ( !pPage )
         pPage = FindPageFrm();
@@ -6025,18 +6028,19 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
     // OD 20.11.2002 #104598# - take care of page margin area
     // Note: code move from <SwFrm::PaintBackground(..)> to new method
     // <SwPageFrm::Paintmargin(..)>.
-    if ( IsPageFrm() )
+    if ( IsPageFrm() && !bOnlyTxtBackground)
     {
         static_cast<const SwPageFrm*>(this)->PaintMarginArea( rRect, pGlobalShell );
     }
 
     // paint background
     {
-        PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder );
+        PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder, bOnlyTxtBackground );
     }
 
     // OD 06.08.2002 #99657# - paint border before painting background
     // paint grid for page frame and paint border
+    if (!bOnlyTxtBackground)
     {
         SwRect aRect( rRect );
         if( IsPageFrm() )
@@ -6058,7 +6062,8 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
 void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                               const SwBorderAttrs & rAttrs,
                              const sal_Bool bLowerMode,
-                             const sal_Bool bLowerBorder ) const
+                             const sal_Bool bLowerBorder,
+                             const bool bOnlyTxtBackground ) const
 {
     // OD 20.01.2003 #i1837# - no paint of table background, if corresponding
     // option is *not* set.
@@ -6186,8 +6191,9 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                         ///     background transparency have to be considered
                         ///     Set missing 5th parameter to the default value GRFNUM_NO
                         ///         - see declaration in /core/inc/frmtool.hxx.
-                        ::DrawGraphic( pItem, pOut, aOrigBackRect, aRegion[i], GRFNUM_NO,
-                                bConsiderBackgroundTransparency );
+                        if (IsTxtFrm() || !bOnlyTxtBackground)
+                            ::DrawGraphic( pItem, pOut, aOrigBackRect, aRegion[i], GRFNUM_NO,
+                                    bConsiderBackgroundTransparency );
                     }
                 }
                 if( pCol )
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 4d62629..bf1c1c3 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1155,6 +1155,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US));
     aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US));
+    aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US));
 
     sal_Int32 nCount = aConfigProps.getLength();
     const PropertyValue* pValues = aConfigProps.getConstArray();
@@ -1187,6 +1188,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     bool bTabOverflow = false;
     bool bUnbreakableNumberings = false;
     bool bClippedPictures = false;
+    bool bBackgroundParaOverDrawings = false;
 
     OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
 
@@ -1277,6 +1279,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
                     bUnbreakableNumberings = true;
                 else if ( pValues->Name == "ClippedPictures" )
                     bClippedPictures = true;
+                else if ( pValues->Name == "BackgroundParaOverDrawings" )
+                    bBackgroundParaOverDrawings = true;
             }
             catch( Exception& )
             {
@@ -1461,6 +1465,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
             OUString( RTL_CONSTASCII_USTRINGPARAM("ClippedPictures") ), makeAny( false ) );
     }
 
+    if ( !bBackgroundParaOverDrawings )
+        xProps->setPropertyValue("BackgroundParaOverDrawings", 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 728e54c..8871cdd 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -129,6 +129,7 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_STYLES_NODEFAULT,
     HANDLE_FLOATTABLE_NOMARGINS,
     HANDLE_CLIPPED_PICTURES,
+    HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
     HANDLE_EMBED_FONTS,
     HANDLE_EMBED_SYSTEM_FONTS
 };
@@ -196,6 +197,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo()
         { RTL_CONSTASCII_STRINGPARAM("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, CPPUTYPE_BOOLEAN, 0, 0},
         { RTL_CONSTASCII_STRINGPARAM("ClippedPictures"), HANDLE_CLIPPED_PICTURES, CPPUTYPE_BOOLEAN, 0, 0},
+        { 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},
 /*
@@ -775,6 +777,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             mpDoc->set(IDocumentSettingAccess::CLIPPED_PICTURES, bTmp);
         }
         break;
+        case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
+        {
+            sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+            mpDoc->set(IDocumentSettingAccess::BACKGROUND_PARA_OVER_DRAWINGS, bTmp);
+        }
+        break;
         case HANDLE_EMBED_FONTS:
         {
             sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
@@ -1176,6 +1184,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
+        case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
+        {
+            sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::BACKGROUND_PARA_OVER_DRAWINGS );
+            rValue.setValue( &bTmp, ::getBooleanCppuType() );
+        }
+        break;
         case HANDLE_EMBED_FONTS:
         {
             sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::EMBED_FONTS );
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index 576d225..5d7da99 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -179,6 +179,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 ) );
 }
 
 void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )


More information about the Libreoffice-commits mailing list