summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-04-01 20:44:43 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2023-04-04 20:16:47 +0200
commit89e65e6afdfc942cf8232886d6703947167eaec3 (patch)
tree5e97bf6fe666f71ce93ee9d9f1381f1ca07b666d /sc
parent4b5203ebf4ca5894f4d7dd37a141832df26e8b9a (diff)
tdf#153880 sc: Make Calc text hyperlinks stand out more
Add underlining for links in Calc. TODO: unit test Change-Id: Idd5a7de7464d8ce443cdec756ac803491e73b0ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149913 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/editutil.hxx6
-rw-r--r--sc/source/core/tool/editutil.cxx13
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx2
-rw-r--r--sc/source/ui/pagedlg/scuitphfedit.cxx11
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx6
5 files changed, 22 insertions, 16 deletions
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 04975b05ccc0..ce102885ae4f 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -74,7 +74,7 @@ public:
static std::unique_ptr<EditTextObject> Clone( const EditTextObject& rSrc, ScDocument& rDestDoc );
static OUString GetCellFieldValue(
- const SvxFieldData& rFieldData, const ScDocument* pDoc, std::optional<Color>* ppTextColor );
+ const SvxFieldData& rFieldData, const ScDocument* pDoc, std::optional<Color>* ppTextColor, std::optional<FontLineStyle>* ppFldLineStyle );
public:
ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
@@ -181,7 +181,7 @@ public:
void SetExecuteURL(bool bSet) { bExecuteURL = bSet; }
virtual bool FieldClicked( const SvxFieldItem& rField ) override;
- virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ) override;
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor, std::optional<FontLineStyle>& rFldLineStyle ) override;
};
// 1/100 mm
@@ -218,7 +218,7 @@ private:
public:
ScHeaderEditEngine( SfxItemPool* pEnginePool );
- virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ) override;
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor, std::optional<FontLineStyle>& rFldLineStyle ) override;
void SetNumType(SvxNumType eNew) { aData.eNumType = eNew; }
void SetData(const ScHeaderFieldData& rNew) { aData = rNew; }
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index c7e0c0cb6830..43d903f60529 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -213,7 +213,7 @@ std::unique_ptr<EditTextObject> ScEditUtil::Clone( const EditTextObject& rObj, S
}
OUString ScEditUtil::GetCellFieldValue(
- const SvxFieldData& rFieldData, const ScDocument* pDoc, std::optional<Color>* ppTextColor )
+ const SvxFieldData& rFieldData, const ScDocument* pDoc, std::optional<Color>* ppTextColor, std::optional<FontLineStyle>* ppFldLineStyle )
{
OUString aRet;
switch (rFieldData.GetClassId())
@@ -241,6 +241,9 @@ OUString ScEditUtil::GetCellFieldValue(
if (ppTextColor)
*ppTextColor = SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor;
+
+ if (ppFldLineStyle)
+ *ppFldLineStyle = FontLineStyle::LINESTYLE_SINGLE;
}
break;
case text::textfield::Type::EXTENDED_TIME:
@@ -836,7 +839,8 @@ ScHeaderEditEngine::ScHeaderEditEngine( SfxItemPool* pEnginePoolP )
OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_Int32 /* nPara */, sal_Int32 /* nPos */,
- std::optional<Color>& /* rTxtColor */, std::optional<Color>& /* rFldColor */ )
+ std::optional<Color>& /* rTxtColor */, std::optional<Color>& /* rFldColor */,
+ std::optional<FontLineStyle>& /*rFldLineStyle*/ )
{
const SvxFieldData* pFieldData = rField.GetField();
if (!pFieldData)
@@ -900,14 +904,15 @@ ScFieldEditEngine::ScFieldEditEngine(
OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_Int32 /* nPara */, sal_Int32 /* nPos */,
- std::optional<Color>& rTxtColor, std::optional<Color>& /* rFldColor */ )
+ std::optional<Color>& rTxtColor, std::optional<Color>& /* rFldColor */,
+ std::optional<FontLineStyle>& rFldLineStyle )
{
const SvxFieldData* pFieldData = rField.GetField();
if (!pFieldData)
return " ";
- return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, &rTxtColor);
+ return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, &rTxtColor, &rFldLineStyle);
}
bool ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 4c306de2c907..9aa4b7b5ad36 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3020,7 +3020,7 @@ void writeContent(
if (pField)
{
// Write a field item.
- OUString aFieldVal = ScEditUtil::GetCellFieldValue(*pField, rExport.GetDocument(), nullptr);
+ OUString aFieldVal = ScEditUtil::GetCellFieldValue(*pField, rExport.GetDocument(), nullptr, nullptr);
switch (pField->GetClassId())
{
case text::textfield::Type::URL:
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 46687884e376..d82c923e56c4 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -182,13 +182,14 @@ void ScHFEditPage::InitPreDefinedList()
std::optional<Color> pTxtColour;
std::optional<Color> pFldColour;
+ std::optional<FontLineStyle> pFldLineStyle;
// Get the all field values at the outset.
- OUString aPageFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
- OUString aSheetFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
- OUString aFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
- OUString aExtFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxExtFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
- OUString aDateFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxDateField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+ OUString aPageFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour, pFldLineStyle));
+ OUString aSheetFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour, pFldLineStyle));
+ OUString aFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour, pFldLineStyle));
+ OUString aExtFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxExtFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour, pFldLineStyle));
+ OUString aDateFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxDateField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour, pFldLineStyle));
m_xLbDefined->clear();
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index aacb4e2e3815..4f179d782f94 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -170,7 +170,7 @@ public:
explicit ScUnoEditEngine(ScEditEngineDefaulter* pSource);
virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
- std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ) override;
+ std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor, std::optional<FontLineStyle>& rFldLineStyle ) override;
sal_uInt16 CountFields();
SvxFieldData* FindByIndex(sal_uInt16 nIndex);
@@ -196,9 +196,9 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource)
}
OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
- sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor )
+ sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor, std::optional<FontLineStyle>& rFldLineStyle )
{
- OUString aRet(EditEngine::CalcFieldValue( rField, nPara, nPos, rTxtColor, rFldColor ));
+ OUString aRet(EditEngine::CalcFieldValue( rField, nPara, nPos, rTxtColor, rFldColor, rFldLineStyle ));
if (eMode != SC_UNO_COLLECT_NONE)
{
const SvxFieldData* pFieldData = rField.GetField();