editeng/inc/editattr.hxx | 3 +++ editeng/inc/outleeng.hxx | 2 +- editeng/qa/unit/core-test.cxx | 2 +- editeng/source/editeng/editattr.cxx | 9 +++++++++ editeng/source/editeng/editeng.cxx | 2 +- editeng/source/editeng/impedit2.cxx | 5 +++-- editeng/source/outliner/outleeng.cxx | 4 ++-- editeng/source/outliner/outliner.cxx | 7 ++++++- editeng/source/uno/unoedprx.cxx | 4 ++-- editeng/source/uno/unofored.cxx | 4 ++-- editeng/source/uno/unoforou.cxx | 4 ++-- editeng/source/uno/unotext.cxx | 5 +++-- include/editeng/editeng.hxx | 3 ++- include/editeng/outliner.hxx | 6 +++++- include/editeng/unoedprx.hxx | 3 ++- include/editeng/unoedsrc.hxx | 3 ++- include/editeng/unofored.hxx | 2 +- include/editeng/unoforou.hxx | 2 +- include/editeng/unotext.hxx | 2 +- include/svx/svdomeas.hxx | 2 +- include/svx/svdotext.hxx | 2 +- include/svx/svdoutl.hxx | 2 +- sc/inc/editutil.hxx | 6 +++--- sc/source/core/tool/editutil.cxx | 13 +++++++++---- sc/source/filter/xml/xmlexprt.cxx | 2 +- sc/source/ui/pagedlg/scuitphfedit.cxx | 11 ++++++----- sc/source/ui/unoobj/fielduno.cxx | 6 +++--- svx/source/accessibility/AccessibleEmptyEditSource.cxx | 2 +- svx/source/dialog/ClassificationEditView.cxx | 2 +- svx/source/dialog/ClassificationEditView.hxx | 2 +- svx/source/dialog/weldeditview.cxx | 9 ++++++--- svx/source/svdraw/svdedxv.cxx | 7 ++++++- svx/source/svdraw/svdomeas.cxx | 4 ++-- svx/source/svdraw/svdotxfl.cxx | 2 +- svx/source/svdraw/svdoutl.cxx | 7 ++++--- 35 files changed, 96 insertions(+), 55 deletions(-)
New commits: commit 89e65e6afdfc942cf8232886d6703947167eaec3 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Sat Apr 1 20:44:43 2023 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Tue Apr 4 20:16:47 2023 +0200 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 <kelem...@ubuntu.com> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> 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 "j...@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(); } diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 0693d06821f9..b3d67c1c472e 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -40,6 +40,7 @@ #include <tools/lineend.hxx> #include <tools/degree.hxx> #include <tools/long.hxx> +#include <tools/fontenum.hxx> #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> @@ -524,7 +525,7 @@ public: virtual bool SpellNextDocument(); /** @return true, when click was consumed. false otherwise. */ virtual bool FieldClicked( const SvxFieldItem& rField ); - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); + 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 this if access to bullet information needs to be provided virtual const SvxNumberFormat * GetNumberFormat( sal_Int32 nPara ) const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 192b30d01634..5edf811c59ee 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -502,6 +502,7 @@ private: std::optional<Color> mxTxtColor; std::optional<Color> mxFldColor; + std::optional<FontLineStyle> mxFldLineStyle; OUString aRepresentation; @@ -531,6 +532,9 @@ public: std::optional<Color> const & GetFieldColor() const { return mxFldColor; } void SetFieldColor( std::optional<Color> xCol ) { mxFldColor = xCol; } + std::optional<FontLineStyle> const& GetFontLineStyle() const { return mxFldLineStyle; } + void SetFontLineStyle( std::optional<FontLineStyle> xLineStyle ) { mxFldLineStyle = xLineStyle; } + sal_Int32 GetPara() const { return nPara; } sal_Int32 GetPos() const { return nPos; } @@ -897,7 +901,7 @@ public: bool UpdateFields(); void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} ); - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor, std::optional<FontLineStyle>& rFldLineStyle ); void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller ); css::uno::Reference< css::linguistic2::XSpellChecker1 > const & diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx index f1db61fe9b63..475cd158934b 100644 --- a/include/editeng/unoedprx.hxx +++ b/include/editeng/unoedprx.hxx @@ -23,6 +23,7 @@ #include <config_options.h> #include <memory> #include <svl/SfxBroadcaster.hxx> +#include <tools/fontenum.hxx> #include <editeng/unoedsrc.hxx> #include <editeng/editdata.hxx> @@ -55,7 +56,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx index 44d8944bc442..007633616b19 100644 --- a/include/editeng/unoedsrc.hxx +++ b/include/editeng/unoedsrc.hxx @@ -23,6 +23,7 @@ #include <i18nlangtag/lang.h> #include <rtl/ustring.hxx> #include <tools/gen.hxx> +#include <tools/fontenum.hxx> #include <vcl/mapmod.hxx> #include <svl/poolitem.hxx> #include <editeng/editengdllapi.h> @@ -159,7 +160,7 @@ public: virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0; virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) = 0; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) = 0; virtual void FieldClicked( const SvxFieldItem& rField ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx index 989b5c36511d..7429cb21e53f 100644 --- a/include/editeng/unofored.hxx +++ b/include/editeng/unofored.hxx @@ -54,7 +54,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx index a4535d83bf77..4c8d17fd3ca0 100644 --- a/include/editeng/unoforou.hxx +++ b/include/editeng/unoforou.hxx @@ -73,7 +73,7 @@ public: virtual SfxItemPool* GetPool() const override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 5231219b5a1a..6307480cea31 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -196,7 +196,7 @@ public: virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; virtual void QuickInsertLineBreak( const ESelection& rSel ) override; - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) override; virtual void FieldClicked( const SvxFieldItem& rField ) override; virtual bool IsValid() const override; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index 7ddf4d7e3b62..e41b5bdd02d3 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -142,7 +142,7 @@ public: virtual OutlinerParaObject* GetOutlinerParaObject() const override; virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, - bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const override; + bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle, OUString& rRet) const override; // #i97878# virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index ccecae20e2f8..bf82e4db7c54 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -524,7 +524,7 @@ public: virtual void NbcReformatText() override; virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, - bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const; + bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle, OUString& rRet) const; virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override; diff --git a/include/svx/svdoutl.hxx b/include/svx/svdoutl.hxx index 2a78fd6b2e47..5b60e9cc246f 100644 --- a/include/svx/svdoutl.hxx +++ b/include/svx/svdoutl.hxx @@ -44,7 +44,7 @@ public: void setVisualizedPage(const SdrPage* pPage) { if(pPage != mpVisualizedPage) mpVisualizedPage = pPage; } const SdrPage* getVisualizedPage() const { return mpVisualizedPage; } - virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor) override; + virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle) override; bool hasEditViewCallbacks() const; 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(); diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index e1426d239c67..5f883a45986c 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -121,7 +121,7 @@ namespace accessibility //XTextCopy void CopyText(const SvxTextForwarder& ) override {} - OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, std::optional<Color>& /*rpTxtColor*/, std::optional<Color>& /*rpFldColor*/ ) override + OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, std::optional<Color>& /*rpTxtColor*/, std::optional<Color>& /*rpFldColor*/, std::optional<FontLineStyle>& /*rpFldLineStyle*/ ) override { return OUString(); } diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx index 0b6ef370570f..fa4388017fcb 100644 --- a/svx/source/dialog/ClassificationEditView.cxx +++ b/svx/source/dialog/ClassificationEditView.cxx @@ -24,7 +24,7 @@ ClassificationEditEngine::ClassificationEditEngine(SfxItemPool* pItemPool) {} OUString ClassificationEditEngine::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 /*nPara*/, - sal_Int32 /*nPos*/, std::optional<Color>& /*rTxtColor*/, std::optional<Color>& /*rFldColor*/) + sal_Int32 /*nPos*/, std::optional<Color>& /*rTxtColor*/, std::optional<Color>& /*rFldColor*/, std::optional<FontLineStyle>& /*rFldLineStyle*/) { OUString aString; const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(rField.GetField()); diff --git a/svx/source/dialog/ClassificationEditView.hxx b/svx/source/dialog/ClassificationEditView.hxx index b65e95399f9b..225efe1243db 100644 --- a/svx/source/dialog/ClassificationEditView.hxx +++ b/svx/source/dialog/ClassificationEditView.hxx @@ -21,7 +21,7 @@ class ClassificationEditEngine final : public EditEngine public: ClassificationEditEngine(SfxItemPool* pItemPool); - 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; }; class ClassificationEditView final : public WeldEditView diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 2e1ff335b9c7..e1e0d19617ff 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -383,7 +383,8 @@ public: virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, - std::optional<Color>& rpFldColor) override; + std::optional<Color>& rpFldColor, + std::optional<FontLineStyle>& rpFldLineStyle) override; virtual void FieldClicked(const SvxFieldItem&) override; virtual bool IsValid() const override; @@ -1056,10 +1057,12 @@ bool WeldTextForwarder::IsValid() const OUString WeldTextForwarder::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, - std::optional<Color>& rpFldColor) + std::optional<Color>& rpFldColor, + std::optional<FontLineStyle>& rpFldLineStyle) { EditEngine* pEditEngine = m_rEditAcc.GetEditEngine(); - return pEditEngine ? pEditEngine->CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor) + return pEditEngine ? pEditEngine->CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor, + rpFldLineStyle) : OUString(); } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 2710b52c4c0d..5a996b5721ed 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1180,14 +1180,19 @@ IMPL_LINK(SdrObjEditView, ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, pFI, voi { std::optional<Color> pTxtCol; std::optional<Color> pFldCol; + std::optional<FontLineStyle> pFldLineStyle; bOk = pTextObj->CalcFieldValue(pFI->GetField(), pFI->GetPara(), pFI->GetPos(), true, - pTxtCol, pFldCol, rStr); + pTxtCol, pFldCol, pFldLineStyle, rStr); if (bOk) { if (pTxtCol) { pFI->SetTextColor(*pTxtCol); } + if (pFldLineStyle) + { + pFI->SetFontLineStyle(*pFldLineStyle); + } if (pFldCol) { pFI->SetFieldColor(*pFldCol); diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index ee53dc085b32..b19667696523 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -557,7 +557,7 @@ basegfx::B2DPolyPolygon SdrMeasureObj::ImpCalcXPoly(const ImpMeasurePoly& rPol) bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, - std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const + std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle, OUString& rRet) const { const SvxFieldData* pField=rField.GetField(); const SdrMeasureField* pMeasureField=dynamic_cast<const SdrMeasureField*>( pField ); @@ -569,7 +569,7 @@ bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, } return true; } else { - return SdrTextObj::CalcFieldValue(rField,nPara,nPos,bEdit,rpTxtColor,rpFldColor,rRet); + return SdrTextObj::CalcFieldValue(rField,nPara,nPos,bEdit,rpTxtColor,rpFldColor,rpFldLineStyle,rRet); } } diff --git a/svx/source/svdraw/svdotxfl.cxx b/svx/source/svdraw/svdotxfl.cxx index e2c7c7515959..6c61d7c82489 100644 --- a/svx/source/svdraw/svdotxfl.cxx +++ b/svx/source/svdraw/svdotxfl.cxx @@ -20,7 +20,7 @@ #include <svx/svdotext.hxx> bool SdrTextObj::CalcFieldValue(const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_uInt16 /*nPos*/, - bool /*bEdit*/, std::optional<Color>& /*rpTxtColor*/, std::optional<Color>& /*rpFldColor*/, OUString& /*rRet*/) const + bool /*bEdit*/, std::optional<Color>& /*rpTxtColor*/, std::optional<Color>& /*rpFldColor*/, std::optional<FontLineStyle>& /*rpFldLineStyle*/, OUString& /*rRet*/) const { return false; } diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx index 94f73bfbf206..02bb89e38bda 100644 --- a/svx/source/svdraw/svdoutl.cxx +++ b/svx/source/svdraw/svdoutl.cxx @@ -73,16 +73,17 @@ void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj ) } OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, - std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor) + std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, + std::optional<FontLineStyle>& rpFldLineStyle) { bool bOk = false; OUString aRet; if(auto pTextObj = mxWeakTextObj.get()) - bOk = pTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet); + bOk = pTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, rpFldLineStyle, aRet); if (!bOk) - aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor); + aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle); return aRet; }