[Libreoffice-commits] core.git: editeng/source include/editeng sc/inc sc/source

2021-12-06 Thread Samuel Mehrbrodt (via logerrit)
 editeng/source/editeng/editeng.cxx  |3 ++-
 editeng/source/editeng/impedit2.cxx |6 --
 include/editeng/editeng.hxx |3 ++-
 sc/inc/editutil.hxx |2 +-
 sc/source/core/tool/editutil.cxx|7 +--
 5 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit b9362e87a3646a6693b81fb0d40e28ce7813a251
Author: Samuel Mehrbrodt 
AuthorDate: Tue Nov 30 23:34:11 2021 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Dec 6 14:11:44 2021 +0100

tdf#145671 Don't open URL twice in cell edit mode

Change-Id: I8a324d6a037c8a5c0efc0b2825657513c2f9841c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126159
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index ae30e651b594..b557dd693d72 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2588,8 +2588,9 @@ OUString EditEngine::CalcFieldValue( const SvxFieldItem&, 
sal_Int32, sal_Int32,
 return OUString(' ');
 }
 
-void EditEngine::FieldClicked( const SvxFieldItem& )
+bool EditEngine::FieldClicked( const SvxFieldItem& )
 {
+return false;
 }
 
 
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 47672cb090f3..cbbfddff51c7 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -611,8 +611,11 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& 
rMEvt, EditView* pView )
 Point aLogicClick = rOutDev.PixelToLogic(rMEvt.GetPosPixel());
 if (const SvxFieldItem* pFld = pView->GetField(aLogicClick))
 {
+bool bUrlOpened = GetEditEnginePtr()->FieldClicked( *pFld );
+auto pUrlField = dynamic_cast(pFld->GetField());
+
 // tdf#121039 When in edit mode, editeng is responsible for 
opening the URL on mouse click
-if (auto pUrlField = dynamic_cast(pFld->GetField()))
+if (!bUrlOpened && pUrlField)
 {
 bool bCtrlClickHappened = rMEvt.IsMod1();
 bool bCtrlClickSecOption
@@ -627,7 +630,6 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, 
EditView* pView )
   
css::system::SystemShellExecuteFlags::DEFAULTS);
 }
 }
-GetEditEnginePtr()->FieldClicked( *pFld );
 }
 }
 }
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index fb109d7baa53..560f3be1a83a 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -516,7 +516,8 @@ public:
  const Color& rTextLineColor);
 virtual OUString  GetUndoComment( sal_uInt16 nUndoId ) const;
 virtual boolSpellNextDocument();
-virtual voidFieldClicked( const SvxFieldItem& rField );
+/** @return true, when click was consumed. false otherwise. */
+virtual boolFieldClicked( const SvxFieldItem& rField );
 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 
nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 
rFldColor );
 
 // override this if access to bullet information needs to be provided
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 1353544b96e3..04975b05ccc0 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -180,7 +180,7 @@ public:
 
 void SetExecuteURL(bool bSet){ bExecuteURL = bSet; }
 
-virtual voidFieldClicked( const SvxFieldItem& rField ) override;
+virtual boolFieldClicked( const SvxFieldItem& rField ) override;
 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 
nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 
rFldColor ) override;
 };
 
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 40957b3362b1..331f50af8b93 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -895,14 +895,17 @@ OUString ScFieldEditEngine::CalcFieldValue( const 
SvxFieldItem& rField,
 return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, &rTxtColor);
 }
 
-void ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField )
+bool ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField )
 {
 if (!bExecuteURL)
-return;
+return false;
+
 if (const SvxURLField* pURLField = dynamic_cast(rField.GetField()))
 {
 ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
+return true;
 }
+return false;
 }
 
 ScNoteEditEngine::ScNoteEditEngine( SfxItemPool* pEnginePoolP,


[Libreoffice-commits] core.git: editeng/source include/editeng sc/inc sc/source

2017-08-09 Thread Varun Dhall
 editeng/source/editeng/editobj.cxx|  362 --
 editeng/source/editeng/editobj2.hxx   |2 
 include/editeng/editobj.hxx   |2 
 sc/inc/attrib.hxx |7 
 sc/source/core/data/attrib.cxx|  192 -
 sc/source/ui/condformat/condformatdlgitem.cxx |5 
 sc/source/ui/inc/condformatdlgitem.hxx|1 
 7 files changed, 571 deletions(-)

New commits:
commit 9cc75c52369d6656a5812e950641d4b9b6d0cc35
Author: Varun Dhall 
Date:   Tue Aug 8 23:42:02 2017 +0530

Removing unused SfxItemPool serialisation from sc

Change-Id: Ib8686d06f8cd477ff4fce948b0ac9c3fe463b129
Reviewed-on: https://gerrit.libreoffice.org/40901
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 14eebcfbcf45..f5122fec09eb 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -393,36 +393,6 @@ SvtScriptType EditTextObject::GetScriptType() const
 }
 
 
-EditTextObject* EditTextObject::Create( SvStream& rIStream )
-{
-sal_uInt64 const nStartPos = rIStream.Tell();
-
-// First check what type of Object...
-sal_uInt16 nWhich;
-rIStream.ReadUInt16( nWhich );
-
-sal_uInt32 nStructSz;
-rIStream.ReadUInt32( nStructSz );
-
-if (nWhich != EE_FORMAT_BIN)
-{
-// Unknown object we no longer support.
-rIStream.SetError(EE_READWRITE_WRONGFORMAT);
-return nullptr;
-}
-
-if ( rIStream.GetError() )
-return nullptr;
-
-EditTextObject* pTxtObj = new EditTextObject(nullptr);
-pTxtObj->mpImpl->CreateData(rIStream);
-
-// Make sure that the stream is left at the correct place.
-std::size_t nFullSz = sizeof( nWhich ) + sizeof( nStructSz ) + nStructSz;
-rIStream.Seek( nStartPos + nFullSz );
-return pTxtObj;
-}
-
 EditTextObject* EditTextObject::Clone() const
 {
 return new EditTextObject(*this);
@@ -1089,338 +1059,6 @@ void EditTextObjectImpl::ChangeStyleSheetName( 
SfxStyleFamily eFamily,
 ImpChangeStyleSheets( rOldName, eFamily, rNewName, eFamily );
 }
 
-
-namespace {
-
-class FindAttribByChar
-{
-sal_uInt16 mnWhich;
-sal_Int32 mnChar;
-public:
-FindAttribByChar(sal_uInt16 nWhich, sal_Int32 nChar) : mnWhich(nWhich), 
mnChar(nChar) {}
-bool operator() (const std::unique_ptr& rAttr) const
-{
-return (rAttr->GetItem()->Which() == mnWhich) && (rAttr->GetStart() <= 
mnChar) && (rAttr->GetEnd() > mnChar);
-}
-};
-
-}
-
-void EditTextObjectImpl::CreateData( SvStream& rIStream )
-{
-rIStream.ReadUInt16( nVersion );
-
-// The text object was first created with the current setting of
-// pTextObjectPool.
-bool bOwnerOfCurrent = bOwnerOfPool;
-bool b;
-rIStream.ReadCharAsBool( b );
-bOwnerOfPool = b;
-
-if ( bOwnerOfCurrent && !bOwnerOfPool )
-{
-// A global Pool was used, but not handed over to me, but I need it!
-OSL_FAIL( "Give me the global TextObjectPool!" );
-return;
-}
-else if ( !bOwnerOfCurrent && bOwnerOfPool )
-{
-// A global Pool should be used, but this Textobject has its own.
-pPool = EditEngine::CreatePool();
-}
-
-if ( bOwnerOfPool )
-GetPool()->Load( rIStream );
-
-// CharSet, in which it was saved:
-sal_uInt16 nCharSet;
-rIStream.ReadUInt16( nCharSet );
-
-rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( 
(rtl_TextEncoding)nCharSet );
-
-// The number of paragraphs ...
-sal_uInt16 nParagraphs(0);
-rIStream.ReadUInt16( nParagraphs );
-
-const size_t nMinParaRecordSize = 6 + eSrcEncoding == 
RTL_TEXTENCODING_UNICODE ? 4 : 2;
-const size_t nMaxParaRecords = rIStream.remainingSize() / 
nMinParaRecordSize;
-if (nParagraphs > nMaxParaRecords)
-{
-SAL_WARN("editeng", "Parsing error: " << nMaxParaRecords <<
- " max possible entries, but " << nParagraphs<< " claimed, 
truncating");
-nParagraphs = nMaxParaRecords;
-}
-
-// The individual paragraphs ...
-for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ )
-{
-ContentInfo* pC = CreateAndInsertContent();
-
-// The Text...
-OString aByteString = 
read_uInt16_lenPrefixed_uInt8s_ToOString(rIStream);
-pC->SetText(OStringToOUString(aByteString, eSrcEncoding));
-
-// StyleName and Family...
-pC->SetStyle(rIStream.ReadUniOrByteString(eSrcEncoding));
-sal_uInt16 nStyleFamily(0);
-rIStream.ReadUInt16( nStyleFamily );
-pC->SetFamily((SfxStyleFamily)nStyleFamily);
-
-// Paragraph attributes ...
-pC->GetParaAttribs().Load( rIStream );
-
-// The number of attributes ...
-sal_uInt16 nTmp16(0);
-rIStream.ReadUInt16( nTmp16 );
-size_t nAttribs = nTmp16;
-
-const size_t nMinRecordSize(10);
-const size_t