diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2023-04-01 20:44:43 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-04-11 12:17:28 +0200 |
commit | 37910f5ace3b1f07cd63d6b7814580293f961261 (patch) | |
tree | 7cfbf4da51b6314f8f77617c2d2701ebe0c6a37e /editeng | |
parent | 45e66d20380e9facff62e8a504c8b54f49ebbefe (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>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150162
Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editattr.hxx | 3 | ||||
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editattr.cxx | 9 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 5 | ||||
-rw-r--r-- | editeng/source/outliner/outleeng.cxx | 4 | ||||
-rw-r--r-- | editeng/source/outliner/outleeng.hxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 7 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 5 |
12 files changed, 35 insertions, 16 deletions
diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index 2b74427f6619..ac38200c4b11 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -25,6 +25,7 @@ #include <boost/optional.hpp> #include <tools/color.hxx> #include <tools/debug.hxx> +#include <tools/fontenum.hxx> class SvxFont; class SvxFontItem; @@ -366,6 +367,7 @@ class EditCharAttribField: public EditCharAttrib OUString aFieldValue; boost::optional<Color> mxTxtColor; boost::optional<Color> mxFldColor; + boost::optional<FontLineStyle> mxFldLineStyle; EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) = delete; @@ -381,6 +383,7 @@ public: virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; boost::optional<Color>& GetTextColor() { return mxTxtColor; } boost::optional<Color>& GetFieldColor() { return mxFldColor; } + boost::optional<FontLineStyle>& GetFldLineStyle() { return mxFldLineStyle; } const OUString& GetFieldValue() const { return aFieldValue;} void SetFieldValue(const OUString& rVal); diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index e832dffd39d6..1e1ffca916bf 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -813,7 +813,7 @@ class UrlEditEngine : public EditEngine public: explicit UrlEditEngine(SfxItemPool *pPool) : EditEngine(pPool) {} - virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& ) override + virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>&, boost::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 41b6a0db9bcd..0e8e71b1a6c4 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -352,6 +352,8 @@ void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* ) } if ( mxTxtColor ) rFont.SetColor( *mxTxtColor ); + if ( mxFldLineStyle ) + rFont.SetUnderline( *mxFldLineStyle ); } @@ -365,6 +367,7 @@ void EditCharAttribField::Reset() aFieldValue.clear(); mxTxtColor.reset(); mxFldColor.reset(); + mxFldLineStyle.reset(); } EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr ) @@ -374,6 +377,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() @@ -396,6 +400,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 2b600871c27d..ed88a647d3dc 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2562,7 +2562,7 @@ tools::Rectangle EditEngine::GetBulletArea( sal_Int32 ) return tools::Rectangle( Point(), Point() ); } -OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& ) +OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>&, boost::optional<FontLineStyle>& ) { return OUString(' '); } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index dc1730a72a94..e5592c58a128 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -47,6 +47,7 @@ #include <editeng/frmdiritem.hxx> #include <editeng/fontitem.hxx> #include <editeng/justifyitem.hxx> +#include <editeng/udlnitem.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/WordType.hpp> @@ -2998,7 +2999,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; @@ -3014,7 +3015,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 != *pCurrent) diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index eb9881e89efd..44ad1827a266 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -169,9 +169,9 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUS bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor ); } -OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) +OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, boost::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/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index 5110d8be28ef..299953dc0a87 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -71,7 +71,7 @@ public: // for text conversion virtual bool ConvertNextDocument() override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor, boost::optional<FontLineStyle>& rFldLineStyle ) override; virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override; diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 16a3833eeea2..89c031690b91 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -648,7 +648,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend ) pEditEngine->SetUpdateMode( bUpdate ); } -OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) +OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, boost::optional<FontLineStyle>& rpFldLineStyle ) { if ( !aCalcFieldValueHdl.IsSet() ) return OUString( ' ' ); @@ -664,6 +664,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 915fe7193eaa..d62f380dd6f0 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -615,11 +615,11 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const return mpTextForwarder->GetPool(); } -OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) +OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, boost::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 73a49039fa3d..f368ff454f4b 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -153,9 +153,9 @@ bool SvxEditEngineForwarder::IsValid() const return rEditEngine.GetUpdateMode(); } -OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) +OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, boost::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 b9abddf04455..0738b4eec461 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -220,9 +220,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, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor ) +OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, boost::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 4796732b2c74..3a5f5510f57a 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -635,9 +635,10 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pM // get presentation string for field boost::optional<Color> pTColor; boost::optional<Color> pFColor; + boost::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; @@ -2358,7 +2359,7 @@ void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& ) { }; -OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& ) +OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>&, boost::optional<FontLineStyle>& ) { return OUString(); } |