editeng/source/items/frmitems.cxx                        |   56 ++++++++++-----
 sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html |   45 ++++++++++++
 sw/qa/extras/htmlimport/htmlimport.cxx                   |   42 +++++++++++
 sw/source/filter/html/parcss1.cxx                        |   12 ++-
 sw/source/filter/html/swhtml.cxx                         |   15 ++++
 sw/source/filter/writer/wrt_fn.cxx                       |   45 +++++++++++-
 6 files changed, 197 insertions(+), 18 deletions(-)

New commits:
commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03
Author: Armin Le Grand <armin.le.gr...@cib.de>
Date:   Mon Nov 23 16:17:37 2015 +0100

    tdf#94088 add import of HTML inline graphics
    
    Related: fdo#63211 for saving. This one adds the import side, plus
    fallbacks to use the new FillStyle attributes in HTML im/export in a
    SvxBrushItem. Also added graphic import for inline graphics. Comment
    markers inserted at places where functionality may be added in the
    future when the new FillStyle attributes would be more used in this
    content. Unit test checks PageBackground and ParagraphBaground import.
    
    Change-Id: I3f198677db553ad198e0add3162603a4735398f1
    Reviewed-on: https://gerrit.libreoffice.org/20129
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 5bb1766..10211e4 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3904,7 +3904,6 @@ void SvxBrushItem::PurgeMedium() const
     DELETEZ( pImpl->pStream );
 }
 
-
 const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) 
const
 {
     if ( bLoadAgain && !maStrLink.isEmpty() && !pImpl->pGraphicObject )
@@ -3913,26 +3912,53 @@ const GraphicObject* 
SvxBrushItem::GetGraphicObject(OUString const & referer) co
         if (SvtSecurityOptions().isUntrustedReferer(referer)) {
             return nullptr;
         }
+
+        // tdf#94088 prepare graphic and state
+        Graphic aGraphic;
+        bool bGraphicLoaded = false;
+
+        // try to create stream directly from given URL
         pImpl->pStream = utl::UcbStreamHelper::CreateStream( maStrLink, 
STREAM_STD_READ );
+
+        // tdf#94088 if we have a stream, try to load it directly as graphic
         if( pImpl->pStream && !pImpl->pStream->GetError() )
         {
-            Graphic aGraphic;
-            int nRes;
-            pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN );
-            nRes = GraphicFilter::GetGraphicFilter().
-                ImportGraphic( aGraphic, maStrLink, *pImpl->pStream,
-                               GRFILTER_FORMAT_DONTKNOW, nullptr, 
GraphicFilterImportFlags::DontSetLogsizeForJpeg );
-
-            if( nRes != GRFILTER_OK )
+            if (GRFILTER_OK == 
GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, maStrLink, 
*pImpl->pStream,
+                GRFILTER_FORMAT_DONTKNOW, nullptr, 
GraphicFilterImportFlags::DontSetLogsizeForJpeg ))
             {
-                bLoadAgain = false;
+                bGraphicLoaded = true;
             }
-            else
+        }
+
+        // tdf#94088 if no succeeded, try if the string (which is not epty) 
contains
+        // a 'data:' scheme url and try to load that (embedded graphics)
+        if(!bGraphicLoaded)
+        {
+            INetURLObject aGraphicURL( maStrLink );
+
+            if( INetProtocol::Data == aGraphicURL.GetProtocol() )
             {
-                pImpl->pGraphicObject = new GraphicObject;
-                pImpl->pGraphicObject->SetGraphic( aGraphic );
-                const_cast < SvxBrushItem*> 
(this)->ApplyGraphicTransparency_Impl();
-             }
+                std::unique_ptr<SvMemoryStream> const 
pStream(aGraphicURL.getData());
+                if (pStream)
+                {
+                    if (GRFILTER_OK == 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream))
+                    {
+                        bGraphicLoaded = true;
+
+                        // tdf#94088 delete the no longer needed data scheme 
URL which
+                        // is potentially pretty // large, containing a base64 
encoded copy of the graphic
+                        const_cast< SvxBrushItem* >(this)->maStrLink.clear();
+                    }
+                }
+            }
+        }
+
+        // tdf#94088 when we got a graphic, set it
+        if(bGraphicLoaded && GRAPHIC_NONE != aGraphic.GetType())
+        {
+            pImpl->pGraphicObject = new GraphicObject;
+            pImpl->pGraphicObject->SetGraphic( aGraphic );
+            const_cast < SvxBrushItem*> 
(this)->ApplyGraphicTransparency_Impl();
         }
         else
         {
diff --git a/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html 
b/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html
new file mode 100644
index 0000000..fbe1ff1
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+       <meta http-equiv="content-type" content="text/html; 
charset=windows-1252"/>
+       <title></title>
+       <meta name="generator" content="LibreOfficeDev 5.1.0.0.alpha1 
(Windows)"/>
+       <meta name="created" content="2015-11-27T14:43:09.574000000"/>
+       <meta name="changed" content="2015-11-27T14:52:03.499000000"/>
+       <style type="text/css">
+               @page { margin: 2cm }
+               p { margin-bottom: 0.25cm; line-height: 120% }
+       </style>
+</head>
+<body lang="de-DE" 
background="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ4AAAA5CAYAAADHnJItAAAACXBIWXMAAA7MAAAOsgEAHVIGAAALQklEQVR4nO1dO3RVxRr+lQBBQMPSGEElkTw84WVQC9ORjnSku+lId+mgwwpuxe2g43ZJF7vYxS502CUGjAEiREBNRAgCKgKaO1/CwGQy/8w/s/c+Jy73txaLM+85me/8r5k9u25xcZFqhadPqaGuju7VbAL/cNTy719Xi0GBx4/pra+/ptEDB+hArebwT8elSzTa1kZHt2yhiWqPXRPiPXpELRcv0hj+r8X4JZaBHz/WYfdu6nvtNTpfzbGrTryHD6kLXxZivtpjl1gNrAMkX6VC/a+/Tp9Xa9yqEm9hgQ5dvkzDJenWFv76i+q/+YZGWlvp6Pbt9L9qjFk14s3P05GZGTqHL1mtMUvIAR/z2jU69+QJvbVzJ50qeryqEO/77+nY9et0xs6voUNdgpYk3ar0jRt08o8/qLm9nQaKHLtw4s3O0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X9929qos/27FnajSrkjY0mqvqG7tZWOgXbAdKvmuOWCKO5mc5WKi8u1SkaVSUe8PbbNAQXXTkdw2aguUTt0N5On+7atfIasaJRdeIBSqR/rjze3vFxGqnF+CVeACYQhEG1x/0/Y3povqE24/UAAAA
 ASUVORK5CYII=" dir="ltr">
+<p style="margin-bottom: 0cm; line-height: 100%; background: 
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAACeCAYAAACIAaLTAAAACXBIWXMAAA6yAAAOzAGAiWrPAAAIVklEQVR4nO2dfUwTZxzH3QBXnUoRHUWXUNxU1CntEqcduthlGxxbHOfiS31t3RJhiygEg+KUFjeRbAs1Ggsz44qL1r3EqiM5WJZ0/kGKiQvgmFKnK9Uh+DYKihRF2T0Y3FCOe3vuoMfzSUgoved5ft/n5Z7v8xztE9rd3T1CSu53dykCD+8px4aMbpaqzFCpCupljXcnUXPXo3HHEbqI0HF+KcqUVGSqb7ftu5afV4DfsYvppGtakX7Us4qA2OVKJjL3arG5+Oax1N7Xp9vr5uOXtjjLp+7DxC5bEpHEzZPGvKaDuU/+vaLNnWRsMBN2tdkkZvmiiyT9lUnrvXkE3fulN8qMMWHRPsvkDWaxYhBVpKvtzCL84hYn03V5Vw/mKkPG+DNUq6xixCGayOr2eg1+McvZ2X1Pweb6zCuFhaqwCc2GyMSjsGMRRaS3s1ENWrD1wR0ll3Qmr4UALYopE8phxgNdZEtXmxLzpJO+ziY117Sg1Q2XtjtccUV67fNxNbBigiqy42FAoT+f6vJ0+OL45tHadYeqpE2ke2aJLlYxuQFGXNBEAoH4hS3O2rsXNELzunb/lgpUVvXsw1oYrgiayDTvHltFqzsJVn6+e01qINQ9q0Qn1BVBEbn18r780hs/GWHk9X9q2z0a3JPldE7/EhciVLDI/EZia0GjfavQfOio8LuT0v7Kt9lftvB2RYJEEtdPGnMu788XkgcbgCtShoz1W2OzMvik5y2SbKnsqWG+6bmyt9mxOWpk5LVtk017uKblJdJ9++x8vJ69m4FFjm9/viosstn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/JpSUeti7Ifn/fz1N3VovvY7Gu7GlN67qRR0sggkRiTUE4k5vU5uanfKcSe+Jmp+c5NVUVD5ZA9XaI/4idOr3Ek7zGMCu172gTtPOlcbMWxY2nkqb/PLBI9OgjEjJvU4Fr2jT5CEe5/8j1akaPCFAHn+1Zc//2HrtobHo2YAQolanRkM51AwICOByTqFUqNU7UYAQol/LmxfnKJDYsNf7GB7hpGWwcSg1rSHlpW3UrdeWEGKJTnQkYGHMkFBm3UjJqBrmPlXXuF6g6vdg8lV0Qk7TJhUxYynq/F2qCD2nKmWHH8+NCwfwfe/jTNMCOZ1fmxnFYhoNYIbJdpZVn2oNq/na+nWtI0y4vYXs95qQVqD8yhma7BsX/rXnnfbkn4xMwlDa/1ZMbctY/sX6W09i8xNqHcnvwZ53MoeS+aLQs+Mftam2JK604Y+ebBhXmT5lQ5cWu/R0oxIWhnwP4uZf/aKfvnFdf+TR+vrieXHsCAQeGTXvD2B6hd7AfK/l0Rx/4Bu0YutWF0boYNgkX22D9KqP4IZf+uw7V/PW6GEhirpHczbICykRUxirJ/HzwS6muFY/+AmyGX27AZE6bUC80L2m4dqG1ymQ3THVrthmH/QKXpJsdXQQgN7pYkqHXXSsr+HRJm/0repezaS8x2jS3Q9121Ksr+LaHs34/87N/OhakW05wUO8yYRNlcxl5eWG7DdqStL9tBcEm3ae5qq+UNbm6GDaLtoJviU+z+QJsy8xd29m/5zKSj1neyeR02zYSojwky5q21Xmu/FVXgLhnw2PHEKQnlxHu7eB8bzoToz0L2vJmxDRj60rP927/4qOk1jpQCA183wwZJHvjYF3/+aPfvUl/7FxNOuZkVRRiYZ8UsX7KnWs6le3H9t+tdpxvP9pwSHPV8ZLNrTYk+euzAxw/DQDKRoDuSBhsGhDb
 4r6rJlUVYbIQwu8aWfwHLtT6nXLibPQAAAABJRU5ErkJggg==') repeat scroll ">
+Er h&ouml;rte leise Schritte hinter sich. Das bedeutete nichts Gutes.
+Wer w&uuml;rde ihm schon folgen, sp&auml;t in der Nacht und dazu noch
+in dieser engen Gasse mitten im &uuml;bel beleumundeten Hafenviertel?
+Gerade jetzt, wo er das Ding seines Lebens gedreht hatte und mit der
+Beute verschwinden wollte! Hatte einer seiner zahllosen Kollegen
+dieselbe Idee gehabt, ihn beobachtet und abgewartet, um ihn nun um
+die Fr&uuml;chte seiner Arbeit zu erleichtern? Oder geh&ouml;rten die
+Schritte hinter ihm zu einem der unz&auml;hligen Gesetzesh&uuml;ter
+dieser Stadt, und die st&auml;hlerne Acht um seine Handgelenke w&uuml;rde
+gleich zuschnappen? Er konnte die Aufforderung stehen zu bleiben
+schon h&ouml;ren. Gehetzt sah er sich um. Pl&ouml;tzlich erblickte er
+den schmalen Durchgang. Blitzartig drehte er sich nach rechts und
+verschwand zwischen den beiden Geb&auml;uden. Beinahe w&auml;re er
+dabei &uuml;ber den umgest&uuml;rzten M&uuml;lleimer gefallen, der
+mitten im Weg lag. Er versuchte, sich in der Dunkelheit seinen Weg zu
+ertasten und erstarrte: Anscheinend gab es keinen anderen Ausweg aus
+diesem kleinen Hof als den Durchgang, durch den er gekommen war. Die
+Schritte wurden lauter und lauter, er sah eine dunkle Gestalt um die
+Ecke biegen. Fieberhaft irrten seine Augen durch die n&auml;chtliche
+Dunkelheit und suchten einen Ausweg. War jetzt wirklich alles vorbei,
+waren alle M&uuml;he und alle Vorbereitungen umsonst? Er presste sich
+ganz eng an die Wand hinter ihm und hoffte, der Verfolger w&uuml;rde
+ihn &uuml;bersehen, als pl&ouml;tzlich neben ihm mit kaum
+wahrnehmbarem Quietschen eine T&uuml;r im n&auml;chtlichen Wind hin
+und her schwang. K&ouml;nnte dieses der flehentlich herbeigesehnte
+Ausweg aus seinem Dilemma sein? Langsam bewegte er sich auf die
+offene T&uuml;r zu, immer dicht an die Mauer gepresst. W&uuml;rde
+diese T&uuml;r seine Rettung werden?</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index 973b830..afd62ed 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -11,6 +11,8 @@
 
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/graphic/GraphicType.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
 #include <vcl/GraphicNativeTransform.hxx>
 #include <sfx2/linkmgr.hxx>
 
@@ -84,6 +86,46 @@ DECLARE_HTMLIMPORT_TEST(testInlinedImage, 
"inlined_image.html")
     }
 }
 
+DECLARE_HTMLIMPORT_TEST(testInlinedImagesPageAndParagraph, 
"PageAndParagraphFilled.html")
+{
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument 
*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    // The document contains embedded pictures inlined for PageBackground and
+    // ParagraphBackground, check for their existance after import
+    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+    SwEditShell* pEditShell = pDoc->GetEditShell();
+    CPPUNIT_ASSERT(pEditShell);
+
+    // images are not linked, check for zero links
+    const sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager();
+    CPPUNIT_ASSERT_EQUAL(size_t(0), rLinkManager.GetLinks().size());
+
+    // get the pageStyle where the PageBackgroundFill is defined. Caution: for
+    // HTML mode this is *not* called 'Default Style', but 'HTML'. Name is 
empty
+    // due to being loaded embedded. BitmapMode is repeat.
+    uno::Reference<beans::XPropertySet> 
xPageProperties1(getStyles("PageStyles")->getByName("HTML"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, 
getProperty<drawing::FillStyle>(xPageProperties1, "FillStyle"));
+    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPageProperties1, 
"FillBitmapName"));
+    CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_REPEAT, 
getProperty<drawing::BitmapMode>(xPageProperties1, "FillBitmapMode"));
+
+    // we should have one paragraph
+    const int nParagraphs = getParagraphs();
+    CPPUNIT_ASSERT_EQUAL(1, nParagraphs);
+
+    if(nParagraphs)
+    {
+        // get the paragraph
+        uno::Reference< text::XTextRange > xPara = getParagraph( 0 );
+        uno::Reference< beans::XPropertySet > xParagraphProperties( xPara, 
uno::UNO_QUERY);
+
+        // check for Bitmap FillStyle, name empty, repeat
+        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, 
getProperty<drawing::FillStyle>(xParagraphProperties, "FillStyle"));
+        CPPUNIT_ASSERT_EQUAL(OUString(""), 
getProperty<OUString>(xParagraphProperties, "FillBitmapName"));
+        CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_REPEAT, 
getProperty<drawing::BitmapMode>(xParagraphProperties, "FillBitmapMode"));
+    }
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/parcss1.cxx 
b/sw/source/filter/html/parcss1.cxx
index 2b14d41..034c429 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -1239,7 +1239,17 @@ bool CSS1Expression::GetURL( OUString& rURL  ) const
     if( aValue.getLength() > 5 )
     {
         rURL = aValue.copy( 4, aValue.getLength() - 5 );
-        rURL = comphelper::string::strip(rURL, ' ');
+
+        // tdf#94088 original stripped only spaces, but there may also be
+        // double quotes in CSS style URLs, so be prepared to spaces followed
+        // by a single quote followed by spaces
+        const sal_Unicode aSpace(' ');
+        const sal_Unicode aSingleQuote('\'');
+
+        rURL = comphelper::string::strip(rURL, aSpace);
+        rURL = comphelper::string::strip(rURL, aSingleQuote);
+        rURL = comphelper::string::strip(rURL, aSpace);
+
         bRet = true;
     }
 
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 42c4ff1..7c61701 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -61,6 +61,7 @@
 #include <editeng/lrspitem.hxx>
 #include <editeng/protitem.hxx>
 #include <editeng/flstitem.hxx>
+#include <svx/unobrushitemhelper.hxx>
 
 #include <frmatr.hxx>
 #include <charatr.hxx>
@@ -2870,6 +2871,20 @@ void SwHTMLParser::_SetAttr( bool bChkEnd, bool 
bBeforeTable,
                     OSL_ENSURE( false,
                             "LRSpace ueber mehrere Absaetze gesetzt!" );
                     // no break (shouldn't reach this point anyway)
+
+                // tdf#94088 expand RES_BACKGROUND to the new fill attribute
+                // definitions in the range [XATTR_FILL_FIRST .. 
XATTR_FILL_LAST].
+                // This is the right place in the future if the adapted fill 
attributes
+                // may be handled more directly in HTML import to handle them.
+                case RES_BACKGROUND:
+                {
+                    const SvxBrushItem& rBrush = static_cast< SvxBrushItem& 
>(*pAttr->pItem);
+                    SfxItemSet aNewSet(m_pDoc->GetAttrPool(), 
XATTR_FILL_FIRST, XATTR_FILL_LAST);
+
+                    setSvxBrushItemAsFillAttributesToTargetSet(rBrush, 
aNewSet);
+                    
m_pDoc->getIDocumentContentOperations().InsertItemSet(*pAttrPam, aNewSet, 
SetAttrMode::DONTREPLACE);
+                    break;
+                }
                 default:
 
                     // ggfs. ein Bookmark anspringen
diff --git a/sw/source/filter/writer/wrt_fn.cxx 
b/sw/source/filter/writer/wrt_fn.cxx
index 48adecc..0339b1e 100644
--- a/sw/source/filter/writer/wrt_fn.cxx
+++ b/sw/source/filter/writer/wrt_fn.cxx
@@ -20,6 +20,9 @@
 #include <svl/itemiter.hxx>
 #include <svl/whiter.hxx>
 
+// tdf#94088 SdrAllFillAttributesHelper needed
+#include <svx/unobrushitemhelper.hxx>
+
 #include "shellio.hxx"
 #include "wrt_fn.hxx"
 #include "node.hxx"
@@ -54,6 +57,11 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
     }
     const SfxPoolItem* pItem(nullptr);
     FnAttrOut pOut;
+
+    // tdf#94088 check if any FillAttribute is used [XATTR_FILL_FIRST .. 
XATTR_FILL_LAST]
+    // while processing the items
+    bool bFillItemUsed = false;
+
     if( !bDeep || !pSet->GetParent() )
     {
         OSL_ENSURE( rSet.Count(), "It has been handled already, right?" );
@@ -61,8 +69,17 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
         pItem = aIter.GetCurItem();
         do {
             // pTab only covers POOLATTR_BEGIN..POOLATTR_END.
-            if( pItem->Which() <= POOLATTR_END && nullptr != ( pOut = pTab[ 
pItem->Which() - RES_CHRATR_BEGIN] ))
+            if( pItem->Which() <= POOLATTR_END )
+            {
+                if( nullptr != ( pOut = pTab[ pItem->Which() - 
RES_CHRATR_BEGIN]) )
+                {
                     (*pOut)( rWrt, *pItem );
+                }
+            }
+            else if(XATTR_FILLSTYLE == pItem->Which())
+            {
+                bFillItemUsed = true;
+            }
         } while( !aIter.IsAtEnd() && nullptr != ( pItem = aIter.NextItem() ) );
     }
     else
@@ -76,11 +93,35 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& 
rWrt,
                     *pItem != rPool.GetDefaultItem( nWhich )
                     || ( pSet->GetParent() &&
                         *pItem != pSet->GetParent()->Get( nWhich ))
-                )) && nullptr != ( pOut = pTab[ nWhich - RES_CHRATR_BEGIN] ))
+                )))
+            {
+                if( nullptr != ( pOut = pTab[ nWhich - RES_CHRATR_BEGIN] ))
+                {
                     (*pOut)( rWrt, *pItem );
+                }
+                else if(XATTR_FILLSTYLE == pItem->Which())
+                {
+                    bFillItemUsed = true;
+                }
+            }
             nWhich = aIter.NextWhich();
         }
     }
+
+    if(bFillItemUsed)
+    {
+        // tdf#94088 if used, construct a SvxBrushItem and export it using the
+        // existing mechanisms.
+        // This is the right place in the future if the adapted fill attributes
+        // may be handled more directly in HTML export to handle them.
+        const SvxBrushItem aSvxBrushItem = getSvxBrushItemFromSourceSet(*pSet, 
RES_BACKGROUND, bDeep);
+
+        if( nullptr != ( pOut = pTab[RES_BACKGROUND - RES_CHRATR_BEGIN] ))
+        {
+            (*pOut)( rWrt, aSvxBrushItem );
+        }
+    }
+
     return rWrt;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to