[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 20:59:34 UTC 2018


 sc/inc/editutil.hxx               |   42 +++++++++++++++++++-------------------
 sc/source/core/tool/editutil.cxx  |    6 ++---
 sc/source/filter/rtf/eeimpars.cxx |    2 -
 sc/source/ui/app/transobj.cxx     |    2 -
 sc/source/ui/view/viewfun2.cxx    |    2 -
 sc/source/ui/view/viewfun4.cxx    |    2 -
 sc/source/ui/view/viewfunc.cxx    |    2 -
 7 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 821c9fd85bf49ddab9968c7f1787a265c02d1f01
Author:     Paul Trojahn <paul.trojahn at gmail.com>
AuthorDate: Sat Oct 27 14:52:42 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Tue Nov 6 21:58:38 2018 +0100

    tdf#115317 Fix empty url representation
    
    ScTabEditEngine doesn't override CalcFieldValue, so the function in
    EditEngine returns a single space as representation. By inheriting from
    ScFieldEditEngine the representation is calculated correctly.
    
    Change-Id: I6f3be8bd2c3936acf9f3d082c25c080bd3cbee76
    Reviewed-on: https://gerrit.libreoffice.org/62428
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-on: https://gerrit.libreoffice.org/62967
    Tested-by: Jenkins

diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 6aac49e77f51..451e7f60e377 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -172,15 +172,33 @@ public:
     void            RepeatDefaults();
 };
 
+// for field commands (or just fields?) in a table
+class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter
+{
+private:
+    ScDocument* mpDoc;
+    bool bExecuteURL;
+
+public:
+    ScFieldEditEngine(
+        ScDocument* pDoc, SfxItemPool* pEnginePool, SfxItemPool* pTextObjectPool = nullptr,
+        bool bDeleteEnginePool = false);
+
+    void SetExecuteURL(bool bSet)    { bExecuteURL = bSet; }
+
+    virtual void    FieldClicked( const SvxFieldItem& rField, sal_Int32, sal_Int32 ) override;
+    virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ) override;
+};
+
 // 1/100 mm
-class SC_DLLPUBLIC ScTabEditEngine : public ScEditEngineDefaulter
+class SC_DLLPUBLIC ScTabEditEngine : public ScFieldEditEngine
 {
 private:
     void    Init(const ScPatternAttr& rPattern);
 public:
     ScTabEditEngine( ScDocument* pDoc );            // Default
-    ScTabEditEngine( const ScPatternAttr& rPattern,
-                    SfxItemPool* pEnginePool,
+    ScTabEditEngine(const ScPatternAttr& rPattern,
+                    SfxItemPool *pEngineItemPool, ScDocument *pDoc,
                     SfxItemPool* pTextObjectPool = nullptr );
 };
 
@@ -199,24 +217,6 @@ struct ScHeaderFieldData
     ScHeaderFieldData();
 };
 
-// for field commands (or just fields?) in a table
-class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter
-{
-private:
-    ScDocument* mpDoc;
-    bool bExecuteURL;
-
-public:
-    ScFieldEditEngine(
-        ScDocument* pDoc, SfxItemPool* pEnginePool, SfxItemPool* pTextObjectPool = nullptr,
-        bool bDeleteEnginePool = false);
-
-    void SetExecuteURL(bool bSet)    { bExecuteURL = bSet; }
-
-    virtual void    FieldClicked( const SvxFieldItem& rField, sal_Int32, sal_Int32 ) override;
-    virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ) override;
-};
-
 // for headers/footers with fields
 class SC_DLLPUBLIC ScHeaderEditEngine : public ScEditEngineDefaulter
 {
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index b40764739a48..f2dd38affecb 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -695,15 +695,15 @@ void ScEditEngineDefaulter::RemoveParaAttribs()
 }
 
 ScTabEditEngine::ScTabEditEngine( ScDocument* pDoc )
-        : ScEditEngineDefaulter( pDoc->GetEnginePool() )
+        : ScFieldEditEngine( pDoc, pDoc->GetEnginePool() )
 {
     SetEditTextObjectPool( pDoc->GetEditPool() );
     Init(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN));
 }
 
 ScTabEditEngine::ScTabEditEngine( const ScPatternAttr& rPattern,
-            SfxItemPool* pEnginePoolP, SfxItemPool* pTextObjectPool )
-        : ScEditEngineDefaulter( pEnginePoolP )
+            SfxItemPool* pEngineItemPool, ScDocument* pDoc, SfxItemPool* pTextObjectPool )
+        : ScFieldEditEngine( pDoc, pEngineItemPool, pTextObjectPool )
 {
     if ( pTextObjectPool )
         SetEditTextObjectPool( pTextObjectPool );
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index da23becae30c..0cfc8456cd97 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -68,7 +68,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
 {
     const ScPatternAttr* pPattern = mpDoc->GetPattern(
         maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() );
-    mpEngine.reset( new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc->GetEditPool()) );
+    mpEngine.reset( new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc, mpDoc->GetEditPool()) );
     mpEngine->SetUpdateMode( false );
     mpEngine->EnableUndo( false );
 }
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index fa76c05d133b..94cb3ab25ca6 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -307,7 +307,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
             ScAddress aPos(nCol, nRow, nTab);
 
             const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab );
-            ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool() );
+            ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc );
             ScRefCellValue aCell(*m_pDoc, aPos);
             if (aCell.meType == CELLTYPE_EDIT)
             {
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 6d3b79c10079..7b5d98fd1516 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -809,7 +809,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
     if ( pData )
     {
         const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
-        ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
+        ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool(), pDoc );
         aEngine.SetText(*pData);
 
         ScEditAttrTester aTester( &aEngine );
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 5bc8f11db602..81ce5791088c 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -89,7 +89,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
         const bool bRecord (rDoc.IsUndoEnabled());
 
         const ScPatternAttr* pPattern = rDoc.GetPattern( nStartCol, nStartRow, nTab );
-        std::unique_ptr<ScTabEditEngine> pEngine(new ScTabEditEngine( *pPattern, rDoc.GetEnginePool() ));
+        std::unique_ptr<ScTabEditEngine> pEngine(new ScTabEditEngine( *pPattern, rDoc.GetEnginePool(), &rDoc ));
         pEngine->EnableUndo( false );
 
         vcl::Window* pActWin = GetActiveWin();
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 54677815d542..6fdad679cb30 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -652,7 +652,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
         OUString aString;
 
         const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
-        ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool() );
+        ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool(), &rDoc );
         aEngine.SetText(rData);
 
         if (bTestSimple)                    // test, if simple string without attribute


More information about the Libreoffice-commits mailing list