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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 2 05:23:00 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 68af083f9a8e3904aa3c341da5c598212da68f6f
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: Fri Nov 2 06:22:33 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>

diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 8d4a8a9fc282..a6d96ef73c49 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -171,15 +171,33 @@ public:
     void            RepeatDefaults();
 };
 
+// for field commands (or just fields?) in a table
+class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter
+{
+private:
+    ScDocument* const 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 );
 };
 
@@ -197,24 +215,6 @@ struct ScHeaderFieldData
     ScHeaderFieldData();
 };
 
-// for field commands (or just fields?) in a table
-class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter
-{
-private:
-    ScDocument* const 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 78c46e5f76cc..7b2b7c864d2f 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -694,15 +694,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 483832bac4a3..c7807cef178f 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.get() );
             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 169198177664..85edda400cf5 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -808,7 +808,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 3f686f2edbf4..4f29020e36d3 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -90,7 +90,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 7e5c54aecd46..29af7b0c42e5 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -653,7 +653,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