[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 6 commits - editeng/source include/xmloff sc/source sd/qa svx/source sw/qa xmloff/source

Xisco Fauli anistenis at gmail.com
Thu Feb 4 14:18:25 UTC 2016


 editeng/source/editeng/impedit3.cxx                |    7 -
 include/xmloff/txtprmap.hxx                        |    7 -
 sc/source/core/opencl/formulagroupcl.cxx           |    7 +
 sc/source/core/tool/token.cxx                      |  102 +++++++++++++++++++--
 sd/qa/unit/import-tests.cxx                        |    3 
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx |    8 +
 svx/source/table/cell.cxx                          |    2 
 svx/source/table/tablelayouter.cxx                 |   12 ++
 sw/qa/extras/globalfilter/globalfilter.cxx         |   80 ++++++++++++++++
 xmloff/source/text/txtexppr.cxx                    |   10 ++
 xmloff/source/text/txtprmap.cxx                    |    4 
 11 files changed, 215 insertions(+), 27 deletions(-)

New commits:
commit 044a5b37252d5bd332ab8a00946cf379169ad539
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Thu Jan 21 20:56:31 2016 +0100

    tdf#91762: Check wether the row and the cell have text...
    
    ... in order to set the row's min height
    
    Regression from 4f2c8194f485b1527fb4f4dfe23ce804937f1f9c
    After this commit, the row's min height was set based only on
    the cells containing text in the row, but the problem appeared
    when the row didn't have any cell with text.
    Change logic to check wether there's text in the cell and in the row.
    
    Now, height in SdImportTest::testRowHeight() is 507 instead of
    508 but I can't figure it out why. However, I believe there's
    no harm in change the test from 508 to 507 as, visually speaking,
    the difference can't be distinguish.
    
    Change-Id: I0b3a14c34eaeaa8e77227860ca290fb79a0302ce
    Reviewed-on: https://gerrit.libreoffice.org/21692
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    (cherry picked from commit 13d4398820ded5914f635757865e258db2db2b57)
    Reviewed-on: https://gerrit.libreoffice.org/22009
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 7583d19a58f9aa0fed51c248c1773285e2cb39cf)

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 53f14e8..3c9f720 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1232,9 +1232,8 @@ void SdImportTest::testRowHeight()
     uno::Reference< com::sun::star::table::XTableRows > xRows( xTable->getRows(), uno::UNO_QUERY_THROW);
     uno::Reference< beans::XPropertySet > xRefRow( xRows->getByIndex(0), uno::UNO_QUERY_THROW );
     xRefRow->getPropertyValue( sHeight ) >>= nHeight;
-    CPPUNIT_ASSERT_EQUAL( sal_Int32(508), nHeight);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(507), nHeight);
 }
-
 void SdImportTest::testTdf93830()
 {
     // Text shape offset was ignored
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 71da0f1..26b66bd 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -727,7 +727,7 @@ sal_Int32 Cell::getMinimumHeight()
         pEditOutliner->SetMaxAutoPaperSize(aSize);
         nMinimumHeight = pEditOutliner->GetTextHeight()+1;
     }
-    else if ( hasText() )
+    else
     {
         Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
         rOutliner.SetPaperSize(aSize);
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 0793e77..ee66352 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -688,6 +688,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
         sal_Int32 nMinHeight = 0;
 
         bool bIsEmpty = true; // check if all cells in this row are merged
+        bool bRowHasText = false;
 
         for( nCol = 0; nCol < nColCount; ++nCol )
         {
@@ -704,7 +705,16 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
                 }
                 else
                 {
-                    nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() );
+                    bool bCellHasText = xCell->hasText();
+                    if ( (!bRowHasText && !bCellHasText) || ( bRowHasText && bCellHasText ) )
+                    {
+                        nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() );
+                    }
+                    else if ( !bRowHasText && bCellHasText )
+                    {
+                        bRowHasText = true;
+                        nMinHeight = xCell->getMinimumHeight();
+                    }
                 }
             }
         }
commit 1dda289bbcacb9fec56c6334d7cb89d2c45cf735
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Oct 18 22:57:47 2015 +0300

    tdf#97150: tdf#94924: If we can't handle strings, don't try to then
    
    Fixes the VLOOKUP problem reported in tdf#94540 by falling back to
    non-OpenCL for such a case, where one of the columns passed to the
    VLOOKUP contained strings. And since a while, we don't claim to handle
    strings in VLOOKUP. Which is true.
    
    (cherry picked from commit 476bef70f1d9fd58b29a1f6fb95e54567b031acf)
    
    Change-Id: I4140c86bf8166beb8201aa90c075d9f4432d9173
    Reviewed-on: https://gerrit.libreoffice.org/21874
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 6f50edb1aabaf9de37782e63abd109e2276bd0c4)

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 2667f5d..4b8b50e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2659,6 +2659,13 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
                                         new DynamicKernelMixedSlidingArgument(mCalcConfig,
                                             ts, ft->Children[i], mpCodeGen, j)));
                             }
+                            else if (!AllStringsAreNull(pDVR->GetArrays()[j].mpStringArray, pDVR->GetArrayLength()) &&
+                                     !pCodeGen->takeString())
+                            {
+                                // Can't handle
+                                SAL_INFO("sc.opencl", "Strings but can't do that.");
+                                throw UnhandledToken(pChild, ("unhandled operand " + StackVarEnumToString(pChild->GetType()) + " for ocPush").c_str());
+                            }
                             else
                             {
                                 // Not sure I can figure out what case this exactly is;)
commit c7b850ab5ccb577225130b22fd9b1bf3f9877c4d
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 26 16:10:06 2016 +0100

    Resolves: tdf#93151 handle ExpandRefs and mnColDelta the same as mnRowDelta
    
    (cherry picked from commit 02e69f0c3acec2c2e81692bc53c4356591a84ba5)
    
    Conflicts:
    	sc/source/core/tool/token.cxx
    
    Change-Id: I8cd00494fc63124443fc01582296ef17f4cd5e27
    Reviewed-on: https://gerrit.libreoffice.org/21821
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 406fdc37081a2bdbb4f15f80605f881105c15da0)

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index d826454..4369017 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3320,17 +3320,33 @@ bool adjustDoubleRefInName(
     ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt, const ScAddress& rPos )
 {
     bool bRefChanged = false;
-    if (rCxt.mnRowDelta > 0 && rCxt.mrDoc.IsExpandRefs() && !rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel())
+    if (rCxt.mrDoc.IsExpandRefs())
     {
-        // Check and see if we should expand the range at the top.
-        ScRange aSelectedRange = getSelectedRange(rCxt);
-        ScRange aAbs = rRef.toAbs(rPos);
-        if (aSelectedRange.Intersects(aAbs))
+        if (rCxt.mnRowDelta > 0 && !rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel())
         {
-            // Selection intersects the referenced range. Only expand the
-            // bottom position.
-            rRef.Ref2.IncRow(rCxt.mnRowDelta);
-            return true;
+            // Check and see if we should expand the range at the top.
+            ScRange aSelectedRange = getSelectedRange(rCxt);
+            ScRange aAbs = rRef.toAbs(rPos);
+            if (aSelectedRange.Intersects(aAbs))
+            {
+                // Selection intersects the referenced range. Only expand the
+                // bottom position.
+                rRef.Ref2.IncRow(rCxt.mnRowDelta);
+                return true;
+            }
+        }
+        if (rCxt.mnColDelta > 0 && !rRef.Ref1.IsColRel() && !rRef.Ref2.IsColRel())
+        {
+            // Check and see if we should expand the range at the left.
+            ScRange aSelectedRange = getSelectedRange(rCxt);
+            ScRange aAbs = rRef.toAbs(rPos);
+            if (aSelectedRange.Intersects(aAbs))
+            {
+                // Selection intersects the referenced range. Only expand the
+                // right position.
+                rRef.Ref2.IncCol(rCxt.mnColDelta);
+                return true;
+            }
         }
     }
 
@@ -3465,6 +3481,62 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 
                             aRes.mbReferenceModified = true;
                         }
+                        else if (rCxt.mnColDelta < 0)
+                        {
+                            // column(s) deleted.
+
+                            if (rRef.IsEntireRow())
+                                // Rows of entire rows are not affected.
+                                break;
+
+                            if (rRef.Ref1.IsColRel() || rRef.Ref2.IsColRel())
+                                // Don't modify relative references in names.
+                                break;
+
+                            if (aAbs.aStart.Row() < rCxt.maRange.aStart.Row() || rCxt.maRange.aEnd.Row() < aAbs.aEnd.Row())
+                                // row range of the reference is not entirely in the deleted row range.
+                                break;
+
+                            if (aAbs.aStart.Tab() > rCxt.maRange.aEnd.Tab() || aAbs.aEnd.Tab() < rCxt.maRange.aStart.Tab())
+                                // wrong tables
+                                break;
+
+                            ScRange aDeleted = rCxt.maRange;
+                            aDeleted.aStart.IncCol(rCxt.mnColDelta);
+                            aDeleted.aEnd.SetCol(aDeleted.aStart.Col()-rCxt.mnColDelta-1);
+
+                            if (aAbs.aEnd.Col() < aDeleted.aStart.Col() || aDeleted.aEnd.Col() < aAbs.aStart.Col())
+                                // reference range doesn't intersect with the deleted range.
+                                break;
+
+                            if (aDeleted.aStart.Col() <= aAbs.aStart.Col() && aAbs.aEnd.Col() <= aDeleted.aEnd.Col())
+                            {
+                                // This reference is entirely deleted.
+                                rRef.Ref1.SetColDeleted(true);
+                                rRef.Ref2.SetColDeleted(true);
+                                aRes.mbReferenceModified = true;
+                                break;
+                            }
+
+                            if (aAbs.aStart.Col() < aDeleted.aStart.Col())
+                            {
+                                if (aDeleted.aEnd.Col() < aAbs.aEnd.Col())
+                                    // Deleted in the middle.  Make the reference shorter.
+                                    rRef.Ref2.IncCol(rCxt.mnColDelta);
+                                else
+                                    // Deleted at tail end.  Cut off the right part.
+                                    rRef.Ref2.SetAbsCol(aDeleted.aStart.Col()-1);
+                            }
+                            else
+                            {
+                                // Deleted at the left.  Cut the left off and shift left.
+                                rRef.Ref1.SetAbsCol(aDeleted.aEnd.Col()+1);
+                                rRef.Ref1.IncCol(rCxt.mnColDelta);
+                                rRef.Ref2.IncCol(rCxt.mnColDelta);
+                            }
+
+                            aRes.mbReferenceModified = true;
+                        }
                         else if (rCxt.maRange.Intersects(aAbs))
                         {
                             if (rCxt.mnColDelta && rCxt.maRange.aStart.Row() <= aAbs.aStart.Row() && aAbs.aEnd.Row() <= rCxt.maRange.aEnd.Row())
@@ -3490,6 +3562,18 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
                                 aRes.mbReferenceModified = true;
                             }
                         }
+                        else if (rCxt.mnColDelta > 0 && rCxt.mrDoc.IsExpandRefs())
+                        {
+                            // Check if we could expand range reference by the right
+                            // edge. For named expressions, we only expand absolute
+                            // references.
+                            if (!rRef.Ref1.IsColRel() && !rRef.Ref2.IsColRel() && aAbs.aEnd.Col()+1 == rCxt.maRange.aStart.Col())
+                            {
+                                // Expand by the right edge.
+                                rRef.Ref2.IncCol(rCxt.mnColDelta);
+                                aRes.mbReferenceModified = true;
+                            }
+                        }
                     }
                     break;
                 default:
commit 2cd881660b9ccd3611843cae9645a29f5662b2e0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 26 15:33:40 2016 +0000

    Resolves: tdf#97276 don't clip out line if the underlying page size is unknown
    
    Change-Id: I77d88d8020e9ac26bd6b7277e6d8afefed5e3ee7
    (cherry picked from commit ad99c633908f7c70d06812ebfb4e0696666f0158)
    (cherry picked from commit 38b362c58abd0df654665956ffc751d40cfb67ab)
    Reviewed-on: https://gerrit.libreoffice.org/21814
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 5f9a61e877d79cce1f99c05a9c1598a029bf2c1c)

diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index c44c6a2..f09a78d 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -91,15 +91,17 @@ namespace sdr
             if(bIsLine)
             {
                 const SdrPage* pPage = GetPathObj().GetPage();
-                if (pPage)
+                double fPageWidth = pPage ? pPage->GetWdt() : 0.0;
+                double fPageHeight = pPage ? pPage->GetHgt() : 0.0;
+                if (fPageWidth && fPageHeight)
                 {
                     //tdf#63955 if we have an extremely long line then clip it
                     //to a very generous range of -1 page width/height vs +1
                     //page width/height to avoid oom and massive churn
                     //generating a huge polygon chain to cover the length in
                     //applyLineDashing if this line is dashed
-                    double fPageWidth = pPage->GetWdt();
-                    double fPageHeight = pPage->GetHgt();
+                    //tdf#97276 don't clip if the underlying page dimension
+                    //is unknown
                     basegfx::B2DRange aClipRange(-fPageWidth, -fPageHeight,
                                                  fPageWidth*2, fPageHeight*2);
                     aUnitPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(aUnitPolyPolygon,
commit accac7fc32b965d88ea884c65463f1e4ccda68e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 2 11:50:51 2016 +0000

    Resolves: tdf#97375 use Invalidate in all modes
    
    makes the crash/hangs go away
    
    (cherry picked from commit ab5c427784fb72d52042b8122ffc5a0fd7108c6b)
    
    (cherry picked from commit c3f09ae629b349c52a4a7954e3017ceb8d7afeaf)
    
    Change-Id: I91a4391190ec7aa0ffa5e41a8c1eb86b4bb9c484
    Reviewed-on: https://gerrit.libreoffice.org/22026
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 1b49e14c82af691fe1ec5aa5de8392350bce11a1)

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 0f38709..a0d2421 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -289,12 +289,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView )
         {
             // convert to window coordinates ....
             aClipRect = pView->pImpEditView->GetWindowPos( aClipRect );
-
-            // For tiled rendering, we have to always go via Invalidate().
-            if ( pView == pCurView && !pView->isTiledRendering())
-                Paint( pView->pImpEditView, aClipRect, 0, true );
-            else
-                pView->GetWindow()->Invalidate( aClipRect );
+            pView->GetWindow()->Invalidate( aClipRect );
         }
     }
 
commit f0497af409a51f0949a0b19082923ba5f9ad6d82
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Feb 2 14:10:02 2016 +0100

    xmloff: tdf#96147: ODF export: fix duplicate fo:background-color
    
    ... attributes that happen if both CharHighlight and CharBackColor
    properties are used, because the CharBackTransparent property wasn't
    taken into account, and combining the CharBackColor and
    CharBackTransparent properties happens *after*
    XMLTextExportPropertySetMapper::ContextFilter() runs.
    
    Also, it looks like a transparent highlight wouldn't export properly but
    apparently DomainMapper::getColorFromId() won't create such.
    
    (regression from f880962f5bf26bfaef06bd3f9e67e2d901a2e74c)
    
    (cherry picked from commit 8dadefc35f8b33648fb6adbdaca75ea52b2705db)
    
    Change-Id: Ib628ef8bb377482f74fadb97c81afb95fbbf7184
    Reviewed-on: https://gerrit.libreoffice.org/22046
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit e92dcab1407fa26fc5ee68d0b626b87bc04f1b3b)

diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx
index 5fa8e3c..79baf8b 100644
--- a/include/xmloff/txtprmap.hxx
+++ b/include/xmloff/txtprmap.hxx
@@ -197,9 +197,10 @@
 #define CTF_RELWIDTHREL                     (XML_TEXT_CTF_START + 168)
 #define CTF_RELHEIGHTREL                    (XML_TEXT_CTF_START + 169)
 #define CTF_CHAR_BACKGROUND                 (XML_TEXT_CTF_START + 170)
-#define CTF_CHAR_HIGHLIGHT                  (XML_TEXT_CTF_START + 171)
-#define CTF_FILLSTYLE                       (XML_TEXT_CTF_START + 172)
-#define CTF_FILLCOLOR                       (XML_TEXT_CTF_START + 173)
+#define CTF_CHAR_BACKGROUND_TRANSPARENCY    (XML_TEXT_CTF_START + 171)
+#define CTF_CHAR_HIGHLIGHT                  (XML_TEXT_CTF_START + 172)
+#define CTF_FILLSTYLE                       (XML_TEXT_CTF_START + 173)
+#define CTF_FILLCOLOR                       (XML_TEXT_CTF_START + 174)
 
 
 enum class TextPropMap {
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index f2a7cf2..18e17e3 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -30,6 +30,7 @@ public:
     void testImageWithSpecialID();
     void testGraphicShape();
     void testCharHighlight();
+    void testCharHighlightODF();
     void testCharHighlightBody();
     void testMSCharBackgroundEditing();
     void testCharBackgroundToHighlighting();
@@ -41,6 +42,7 @@ public:
     CPPUNIT_TEST(testImageWithSpecialID);
     CPPUNIT_TEST(testGraphicShape);
     CPPUNIT_TEST(testCharHighlight);
+    CPPUNIT_TEST(testCharHighlightODF);
     CPPUNIT_TEST(testMSCharBackgroundEditing);
     CPPUNIT_TEST(testCharBackgroundToHighlighting);
 #if !defined(WNT)
@@ -471,6 +473,84 @@ void Test::testCharHighlight()
     testCharHighlightBody();
 }
 
+void Test::testCharHighlightODF()
+{
+    mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"),
+                                      "com.sun.star.text.TextDocument");
+
+    // don't check import, testMSCharBackgroundEditing already does that
+
+    uno::Reference<text::XTextRange> xPara = getParagraph(1);
+    for (int i = 1; i <= 4; ++i)
+    {
+        uno::Reference<beans::XPropertySet> xRun(getRun(xPara,i), uno::UNO_QUERY);
+        switch (i)
+        {
+            case 1: // non-transparent highlight
+            xRun->setPropertyValue("CharBackColor", uno::makeAny(static_cast<sal_Int32>(128)));
+            xRun->setPropertyValue("CharBackTransparent", uno::makeAny(true));
+            xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(64)));
+            break;
+
+            case 2: // transparent backcolor
+            xRun->setPropertyValue("CharBackColor", uno::makeAny(static_cast<sal_Int32>(128)));
+            xRun->setPropertyValue("CharBackTransparent", uno::makeAny(true));
+            xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(COL_TRANSPARENT)));
+            break;
+
+            case 3: // non-transparent backcolor
+            xRun->setPropertyValue("CharBackColor", uno::makeAny(static_cast<sal_Int32>(128)));
+            xRun->setPropertyValue("CharBackTransparent", uno::makeAny(false));
+            xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(COL_TRANSPARENT)));
+            break;
+
+            case 4: // non-transparent highlight again
+            xRun->setPropertyValue("CharBackColor", uno::makeAny(static_cast<sal_Int32>(128)));
+            xRun->setPropertyValue("CharBackTransparent", uno::makeAny(false));
+            xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(64)));
+            break;
+        }
+    }
+
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    utl::MediaDescriptor aMediaDescriptor;
+    aMediaDescriptor["FilterName"] <<= OUString::createFromAscii("writer8");
+
+    utl::TempFile aTempFile;
+    aTempFile.EnableKillingFile();
+    xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+
+    uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY);
+    xComponent->dispose();
+    mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
+
+    xPara.set(getParagraph(1));
+    for (int i = 1; i <= 4; ++i)
+    {
+        uno::Reference<beans::XPropertySet> xRun(getRun(xPara,i), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_TRANSPARENT), getProperty<sal_Int32>(xRun, "CharHighlight"));
+        switch (i)
+        {
+            case 1: // non-transparent highlight
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(64), getProperty<sal_Int32>(xRun, "CharBackColor"));
+            CPPUNIT_ASSERT_EQUAL(sal_False, getProperty<sal_Bool>(xRun, "CharBackTransparent"));
+            break;
+            case 2: // transparent backcolor
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_TRANSPARENT), getProperty<sal_Int32>(xRun, "CharBackColor"));
+            CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xRun, "CharBackTransparent"));
+            break;
+            case 3: // non-transparent backcolor
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(128), getProperty<sal_Int32>(xRun, "CharBackColor"));
+            CPPUNIT_ASSERT_EQUAL(sal_False, getProperty<sal_Bool>(xRun, "CharBackTransparent"));
+            break;
+            case 4: // non-transparent highlight again
+            CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(64), getProperty<sal_Int32>(xRun, "CharBackColor"));
+            CPPUNIT_ASSERT_EQUAL(sal_False, getProperty<sal_Bool>(xRun, "CharBackTransparent"));
+            break;
+        }
+    }
+}
+
 void Test::testMSCharBackgroundEditing()
 {
     // Simulate the editing process of imported MSO character background attributes
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index bd0ed88..cb72868 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -669,6 +669,7 @@ void XMLTextExportPropertySetMapper::ContextFilter(
 
     // character background and highlight
     XMLPropertyState* pCharBackground = NULL;
+    XMLPropertyState* pCharBackgroundTransparency = NULL;
     XMLPropertyState* pCharHighlight = NULL;
 
     bool bNeedsAnchor = false;
@@ -831,6 +832,7 @@ void XMLTextExportPropertySetMapper::ContextFilter(
             break;
 
         case CTF_CHAR_BACKGROUND: pCharBackground = propertyState; break;
+        case CTF_CHAR_BACKGROUND_TRANSPARENCY: pCharBackgroundTransparency = propertyState; break;
         case CTF_CHAR_HIGHLIGHT: pCharHighlight = propertyState; break;
         }
     }
@@ -1137,12 +1139,20 @@ void XMLTextExportPropertySetMapper::ContextFilter(
     // When both background attributes are available export the visible one
     if( pCharHighlight && pCharBackground )
     {
+        assert(pCharBackgroundTransparency); // always together
         sal_uInt32 nColor = COL_TRANSPARENT;
         pCharHighlight->maValue >>= nColor;
         if( nColor == COL_TRANSPARENT )
+        {
+            // actually this would not be exported as transparent anyway
+            // and we'd need another property CharHighlightTransparent for that
             pCharHighlight->mnIndex = -1;
+        }
         else
+        {
             pCharBackground->mnIndex = -1;
+            pCharBackgroundTransparency->mnIndex = -1;
+        }
     }
 
     SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 7f892f4..17d3622 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -192,7 +192,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
     // TODO: not used?
     // RES_CHRATR_BACKGROUND
     MT_E( "CharBackColor",  FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, CTF_CHAR_BACKGROUND ),
-    MT_E( "CharBackTransparent",    FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+    MT_E( "CharBackTransparent",    FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, CTF_CHAR_BACKGROUND_TRANSPARENCY),
     MT_E( "CharBackColor",  FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
     // RES_CHRATR_CJK_FONT
     MT_ED( "CharFontNameAsian", STYLE,  FONT_NAME_ASIAN,            XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ),
@@ -535,7 +535,7 @@ XMLPropertyMapEntry aXMLTextPropMap[] =
     // TODO: not used?
     // RES_CHRATR_BACKGROUND
     MT_E( "CharBackColor",  FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, CTF_CHAR_BACKGROUND ),
-    MT_E( "CharBackTransparent",    FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+    MT_E( "CharBackTransparent",    FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, CTF_CHAR_BACKGROUND_TRANSPARENCY),
     { "CharShadingValue", sizeof("CharShadingValue")-1, XML_NAMESPACE_LO_EXT, XML_CHAR_SHADING_VALUE, XML_TYPE_NUMBER|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT, false },
     MT_E( "CharBackColor",  FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
     // RES_CHRATR_CJK_FONT


More information about the Libreoffice-commits mailing list