summaryrefslogtreecommitdiff
path: root/editeng
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 /editeng
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 'editeng')
-rw-r--r--editeng/inc/editattr.hxx3
-rw-r--r--editeng/inc/outleeng.hxx2
-rw-r--r--editeng/qa/unit/core-test.cxx2
-rw-r--r--editeng/source/editeng/editattr.cxx9
-rw-r--r--editeng/source/editeng/editeng.cxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx5
-rw-r--r--editeng/source/outliner/outleeng.cxx4
-rw-r--r--editeng/source/outliner/outliner.cxx7
-rw-r--r--editeng/source/uno/unoedprx.cxx4
-rw-r--r--editeng/source/uno/unofored.cxx4
-rw-r--r--editeng/source/uno/unoforou.cxx4
-rw-r--r--editeng/source/uno/unotext.cxx5
12 files changed, 35 insertions, 16 deletions
diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index 502a5b084605..fcc14ba5ce25 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -24,6 +24,7 @@
#include <optional>
#include <tools/color.hxx>
#include <tools/debug.hxx>
+#include <tools/fontenum.hxx>
class SvxFont;
class SvxFontItem;
@@ -343,6 +344,7 @@ class EditCharAttribField final : public EditCharAttrib
OUString aFieldValue;
std::optional<Color> mxTxtColor;
std::optional<Color> mxFldColor;
+ std::optional<FontLineStyle> mxFldLineStyle;
EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) = delete;
@@ -358,6 +360,7 @@ public:
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
std::optional<Color>& GetTextColor() { return mxTxtColor; }
std::optional<Color>& GetFieldColor() { return mxFldColor; }
+ std::optional<FontLineStyle>& GetFldLineStyle() { return mxFldLineStyle; }
const OUString& GetFieldValue() const { return aFieldValue;}
void SetFieldValue(const OUString& rVal);
diff --git a/editeng/inc/outleeng.hxx b/editeng/inc/outleeng.hxx
index 449b5ca44ce8..fb452a460864 100644
--- a/editeng/inc/outleeng.hxx
+++ b/editeng/inc/outleeng.hxx
@@ -73,7 +73,7 @@ public:
// for text conversion
virtual bool ConvertNextDocument() 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;
virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override;
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 2836c6ba81d6..c1cd7399b685 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -814,7 +814,7 @@ class UrlEditEngine : public EditEngine
public:
explicit UrlEditEngine(SfxItemPool *pPool) : EditEngine(pPool) {}
- virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>& ) override
+ virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>&, std::optional<FontLineStyle>& ) override
{
return "jim@bob.com"; // a sophisticated view of value:
}
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx
index 5d7da53de477..3277ed0916ba 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -329,6 +329,8 @@ void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* )
}
if ( mxTxtColor )
rFont.SetColor( *mxTxtColor );
+ if ( mxFldLineStyle )
+ rFont.SetUnderline( *mxFldLineStyle );
}
@@ -342,6 +344,7 @@ void EditCharAttribField::Reset()
aFieldValue.clear();
mxTxtColor.reset();
mxFldColor.reset();
+ mxFldLineStyle.reset();
}
EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr )
@@ -351,6 +354,7 @@ EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr )
// Use this constructor only for temporary Objects, Item is not pooled.
mxTxtColor = rAttr.mxTxtColor;
mxFldColor = rAttr.mxFldColor;
+ mxFldLineStyle = rAttr.mxFldLineStyle;
}
EditCharAttribField::~EditCharAttribField()
@@ -373,6 +377,11 @@ bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const
if ( ( mxFldColor && rAttr.mxFldColor ) && ( *mxFldColor != *rAttr.mxFldColor ) )
return false;
+ if ( ( mxFldLineStyle && !rAttr.mxFldLineStyle ) || ( !mxFldLineStyle && rAttr.mxFldLineStyle ) )
+ return false;
+ if ( ( mxFldLineStyle && rAttr.mxFldLineStyle ) && ( *mxFldLineStyle != *rAttr.mxFldLineStyle ) )
+ return false;
+
return true;
}
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 69fef679c7f3..5b70a2c2288b 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2594,7 +2594,7 @@ tools::Rectangle EditEngine::GetBulletArea( sal_Int32 )
return tools::Rectangle( Point(), Point() );
}
-OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>& )
+OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>&, std::optional<FontLineStyle>& )
{
return OUString(' ');
}
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index e6cbdcfbdeb9..98dcf70f186f 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -39,6 +39,7 @@
#include <editeng/adjustitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <editeng/justifyitem.hxx>
+#include <editeng/udlnitem.hxx>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/WordType.hpp>
@@ -3062,7 +3063,7 @@ bool ImpEditEngine::UpdateFields()
if (!aStatus.MarkNonUrlFields() && !aStatus.MarkUrlFields())
; // nothing marked
else if (aStatus.MarkNonUrlFields() && aStatus.MarkUrlFields())
- rField.GetFieldColor() = GetColorConfig().GetColorValue( svtools::WRITERFIELDSHADINGS ).nColor;
+ rField.GetFieldColor() = GetColorConfig().GetColorValue(svtools::WRITERFIELDSHADINGS).nColor;
else
{
bool bURL = false;
@@ -3078,7 +3079,7 @@ bool ImpEditEngine::UpdateFields()
const OUString aFldValue =
GetEditEnginePtr()->CalcFieldValue(
static_cast<const SvxFieldItem&>(*rField.GetItem()),
- nPara, rField.GetStart(), rField.GetTextColor(), rField.GetFieldColor());
+ nPara, rField.GetStart(), rField.GetTextColor(), rField.GetFieldColor(), rField.GetFldLineStyle() );
rField.SetFieldValue(aFldValue);
if (rField != aCurrent)
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index 0a7f8aef28de..2ab56a16c02d 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -174,9 +174,9 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, tools::Long nWidth, co
bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor );
}
-OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
- return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void OutlinerEditEng::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 6cd7ab274b0a..04f55eb7dbdb 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -634,7 +634,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend )
pEditEngine->SetUpdateLayout( bUpdate );
}
-OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
if ( !aCalcFieldValueHdl.IsSet() )
return OUString( ' ' );
@@ -650,6 +650,11 @@ OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara,
rpTxtColor = *aFldInfo.GetTextColor();
}
+ if ( aFldInfo.GetFontLineStyle() )
+ {
+ rpFldLineStyle = *aFldInfo.GetFontLineStyle();
+ }
+
if (aFldInfo.GetFieldColor())
rpFldColor = *aFldInfo.GetFieldColor();
else
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 91a4ac15b600..5bddd24fca7a 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -613,11 +613,11 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
return mpTextForwarder->GetPool();
}
-OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
- return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField )
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 425e07bb8206..5e1824ff5dca 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -151,9 +151,9 @@ bool SvxEditEngineForwarder::IsValid() const
return rEditEngine.IsUpdateLayout();
}
-OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
- return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField )
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index 7edf6923dec1..f6d0fbb8eaea 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -217,9 +217,9 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec
rOutliner.QuickSetAttribs( rSet, rSel );
}
-OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
- return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& /*rField*/ )
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 82a399f00e26..2bbae05a56b2 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -632,9 +632,10 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMapEntry* pMap,
// get presentation string for field
std::optional<Color> pTColor;
std::optional<Color> pFColor;
+ std::optional<FontLineStyle> pFldLineStyle;
SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
- OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
+ OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor, pFldLineStyle ) );
uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
rAny <<= xField;
@@ -2340,7 +2341,7 @@ void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
{
};
-OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>& )
+OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>&, std::optional<FontLineStyle>& )
{
return OUString();
}