[Libreoffice-commits] core.git: editeng/source include/editeng sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 9 16:37:51 UTC 2018


 editeng/source/editeng/editstt2.hxx |    7 +++++--
 editeng/source/editeng/impedit2.cxx |   15 ++++++++++++++-
 editeng/source/editeng/impedit3.cxx |    7 ++++++-
 include/editeng/editstat.hxx        |    4 +++-
 sc/source/ui/view/output2.cxx       |    2 ++
 sc/source/ui/view/viewdata.cxx      |    3 ++-
 6 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit 1b8886ad7744fc48e09bb7379d8ad8e75bb3084d
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Tue Oct 9 17:17:29 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Tue Oct 9 18:37:27 2018 +0200

    Resolves: tdf#66545 display URL fields non-shaded in Calc
    
    This disables shading of URL and email address fields when
    displaying cell content and still preserves shading in the Input
    Line and when editing cell content to indicate that it is actually
    a field content value.
    
    Change-Id: I8737045168646b6cd446bd357713ec9ac4631b31
    Reviewed-on: https://gerrit.libreoffice.org/61594
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx
index 15a8a0ed239e..fe51f3b6168d 100644
--- a/editeng/source/editeng/editstt2.hxx
+++ b/editeng/source/editeng/editstt2.hxx
@@ -81,8 +81,11 @@ public:
     bool    AutoPageHeight() const
                 { return bool( nControlBits & EEControlBits::AUTOPAGESIZEY ); }
 
-    bool    MarkFields() const
-                { return bool( nControlBits & EEControlBits::MARKFIELDS ); }
+    bool    MarkNonUrlFields() const
+                { return bool( nControlBits & EEControlBits::MARKNONURLFIELDS ); }
+
+    bool    MarkUrlFields() const
+                { return bool( nControlBits & EEControlBits::MARKURLFIELDS ); }
 
     bool    DoRestoreFont() const
                 { return bool( nControlBits & EEControlBits::RESTOREFONT ); }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index c15f0fde7cbf..025182a07bb8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2973,8 +2973,21 @@ bool ImpEditEngine::UpdateFields()
                 std::unique_ptr<EditCharAttribField> pCurrent(new EditCharAttribField(rField));
                 rField.Reset();
 
-                if ( aStatus.MarkFields() )
+                if (!aStatus.MarkNonUrlFields() && !aStatus.MarkUrlFields())
+                    ;   // nothing marked
+                else if (aStatus.MarkNonUrlFields() && aStatus.MarkUrlFields())
                     rField.GetFieldColor() = GetColorConfig().GetColorValue( svtools::WRITERFIELDSHADINGS ).nColor;
+                else
+                {
+                    bool bURL = false;
+                    if (const SvxFieldItem* pFieldItem = dynamic_cast<const SvxFieldItem*>(rField.GetItem()))
+                    {
+                        if (const SvxFieldData* pFieldData = pFieldItem->GetField())
+                            bURL = (dynamic_cast<const SvxURLField* >(pFieldData) != nullptr);
+                    }
+                    if ((bURL && aStatus.MarkUrlFields()) || (!bURL && aStatus.MarkNonUrlFields()))
+                        rField.GetFieldColor() = GetColorConfig().GetColorValue( svtools::WRITERFIELDSHADINGS ).nColor;
+                }
 
                 const OUString aFldValue =
                     GetEditEnginePtr()->CalcFieldValue(
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index afadc820687b..631893e8326c 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3182,7 +3182,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     pDXArray = pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart());
 
                                     // Paint control characters (#i55716#)
-                                    if ( aStatus.MarkFields() )
+                                    /* XXX: Given that there's special handling
+                                     * only for some specific characters
+                                     * (U+200B ZERO WIDTH SPACE and U+2060 WORD
+                                     * JOINER) it is assumed to be not relevant
+                                     * for MarkUrlFields(). */
+                                    if ( aStatus.MarkNonUrlFields() )
                                     {
                                         sal_Int32 nTmpIdx;
                                         const sal_Int32 nTmpEnd = nTextStart + rTextPortion.GetLen();
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
index a88b00d15c7b..4781e906558f 100644
--- a/include/editeng/editstat.hxx
+++ b/include/editeng/editstat.hxx
@@ -42,7 +42,9 @@ enum class EEControlBits
     ALLOWBIGOBJS       = 0x00000800,  // Portion info in text object
     ONLINESPELLING     = 0x00001000,  // During the edit Spelling
     STRETCHING         = 0x00002000,  // Stretch mode
-    MARKFIELDS         = 0x00004000,  // Mark Fields with color
+    MARKNONURLFIELDS   = 0x00004000,  // Mark fields other than URL with color
+    MARKURLFIELDS      = 0x00008000,  // Mark URL fields with color
+    MARKFIELDS         = (MARKNONURLFIELDS | MARKURLFIELDS),
     RESTOREFONT        = 0x00010000,  // Restore Font in OutDev
     RTFSTYLESHEETS     = 0x00020000,  // Use Stylesheets when imported
     AUTOCORRECT        = 0x00080000,  // AutoCorrect
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index dbe5bb107e94..40c66bb6de99 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2128,6 +2128,8 @@ ScFieldEditEngine* ScOutputData::CreateOutputEditEngine()
         nCtrl |= EEControlBits::ONLINESPELLING;
     if ( eType == OUTTYPE_PRINTER )
         nCtrl &= ~EEControlBits::MARKFIELDS;
+    else
+        nCtrl &= ~EEControlBits::MARKURLFIELDS;   // URLs not shaded for output
     if ( eType == OUTTYPE_WINDOW && mpRefDevice == pFmtDevice )
         nCtrl &= ~EEControlBits::FORMAT100;       // use the actual MapMode
     pEngine->SetControlWord( nCtrl );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 019480b9acb1..acb270806588 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -3597,7 +3597,8 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
     bool bOnlineSpell = pLocalDoc->GetDocOptions().IsAutoSpell();
 
     EEControlBits nCntrl = rOutl.GetControlWord();
-    nCntrl |= EEControlBits::MARKFIELDS;
+    nCntrl |= EEControlBits::MARKNONURLFIELDS;
+    nCntrl &= ~EEControlBits::MARKURLFIELDS;    // URLs not shaded for output
     nCntrl |= EEControlBits::AUTOCORRECT;
     if( bOnlineSpell )
         nCntrl |= EEControlBits::ONLINESPELLING;


More information about the Libreoffice-commits mailing list