Kaydet (Commit) 68af083f authored tarafından Paul Trojahn's avatar Paul Trojahn Kaydeden (comit) Markus Mohrhard

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/62428Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 7d571ce7
...@@ -171,15 +171,33 @@ public: ...@@ -171,15 +171,33 @@ public:
void RepeatDefaults(); 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 // 1/100 mm
class SC_DLLPUBLIC ScTabEditEngine : public ScEditEngineDefaulter class SC_DLLPUBLIC ScTabEditEngine : public ScFieldEditEngine
{ {
private: private:
void Init(const ScPatternAttr& rPattern); void Init(const ScPatternAttr& rPattern);
public: public:
ScTabEditEngine( ScDocument* pDoc ); // Default ScTabEditEngine( ScDocument* pDoc ); // Default
ScTabEditEngine( const ScPatternAttr& rPattern, ScTabEditEngine(const ScPatternAttr& rPattern,
SfxItemPool* pEnginePool, SfxItemPool *pEngineItemPool, ScDocument *pDoc,
SfxItemPool* pTextObjectPool = nullptr ); SfxItemPool* pTextObjectPool = nullptr );
}; };
...@@ -197,24 +215,6 @@ struct ScHeaderFieldData ...@@ -197,24 +215,6 @@ struct ScHeaderFieldData
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 // for headers/footers with fields
class SC_DLLPUBLIC ScHeaderEditEngine : public ScEditEngineDefaulter class SC_DLLPUBLIC ScHeaderEditEngine : public ScEditEngineDefaulter
{ {
......
...@@ -694,15 +694,15 @@ void ScEditEngineDefaulter::RemoveParaAttribs() ...@@ -694,15 +694,15 @@ void ScEditEngineDefaulter::RemoveParaAttribs()
} }
ScTabEditEngine::ScTabEditEngine( ScDocument* pDoc ) ScTabEditEngine::ScTabEditEngine( ScDocument* pDoc )
: ScEditEngineDefaulter( pDoc->GetEnginePool() ) : ScFieldEditEngine( pDoc, pDoc->GetEnginePool() )
{ {
SetEditTextObjectPool( pDoc->GetEditPool() ); SetEditTextObjectPool( pDoc->GetEditPool() );
Init(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); Init(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN));
} }
ScTabEditEngine::ScTabEditEngine( const ScPatternAttr& rPattern, ScTabEditEngine::ScTabEditEngine( const ScPatternAttr& rPattern,
SfxItemPool* pEnginePoolP, SfxItemPool* pTextObjectPool ) SfxItemPool* pEngineItemPool, ScDocument* pDoc, SfxItemPool* pTextObjectPool )
: ScEditEngineDefaulter( pEnginePoolP ) : ScFieldEditEngine( pDoc, pEngineItemPool, pTextObjectPool )
{ {
if ( pTextObjectPool ) if ( pTextObjectPool )
SetEditTextObjectPool( pTextObjectPool ); SetEditTextObjectPool( pTextObjectPool );
......
...@@ -68,7 +68,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) : ...@@ -68,7 +68,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
{ {
const ScPatternAttr* pPattern = mpDoc->GetPattern( const ScPatternAttr* pPattern = mpDoc->GetPattern(
maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() ); 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->SetUpdateMode( false );
mpEngine->EnableUndo( false ); mpEngine->EnableUndo( false );
} }
......
...@@ -307,7 +307,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ...@@ -307,7 +307,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
ScAddress aPos(nCol, nRow, nTab); ScAddress aPos(nCol, nRow, nTab);
const ScPatternAttr* pPattern = m_pDoc->GetPattern( 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); ScRefCellValue aCell(*m_pDoc, aPos);
if (aCell.meType == CELLTYPE_EDIT) if (aCell.meType == CELLTYPE_EDIT)
{ {
......
...@@ -808,7 +808,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat ...@@ -808,7 +808,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
if ( pData ) if ( pData )
{ {
const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab ); const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() ); ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool(), pDoc );
aEngine.SetText(*pData); aEngine.SetText(*pData);
ScEditAttrTester aTester( &aEngine ); ScEditAttrTester aTester( &aEngine );
......
...@@ -90,7 +90,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, ...@@ -90,7 +90,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
const bool bRecord (rDoc.IsUndoEnabled()); const bool bRecord (rDoc.IsUndoEnabled());
const ScPatternAttr* pPattern = rDoc.GetPattern( nStartCol, nStartRow, nTab ); 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 ); pEngine->EnableUndo( false );
vcl::Window* pActWin = GetActiveWin(); vcl::Window* pActWin = GetActiveWin();
......
...@@ -653,7 +653,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, ...@@ -653,7 +653,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
OUString aString; OUString aString;
const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab ); const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool() ); ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool(), &rDoc );
aEngine.SetText(rData); aEngine.SetText(rData);
if (bTestSimple) // test, if simple string without attribute if (bTestSimple) // test, if simple string without attribute
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment