[Libreoffice-commits] core.git: 3 commits - editeng/source sc/source sw/source

2023-12-01 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/svxacorr.cxx|   11 +++
 sc/source/filter/excel/xeescher.cxx |2 +-
 sw/source/uibase/shells/translatehelper.cxx |2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 004807caaa5f5e4516ba5cc9fac085fe8cd30dee
Author: Caolán McNamara 
AuthorDate: Fri Dec 1 11:50:19 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 18:06:54 2023 +0100

cid#1546413 silence Using invalid iterator

sample to test silencing this

Change-Id: I73a8e22a5266367d7b2c76aa00d38d40431b4841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160213
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 4c4b6883f247..ab8a43091b00 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1888,11 +1888,14 @@ bool SvxAutoCorrect::PutText( const OUString& rShort, 
const OUString& rLong,
 LanguageType eLang )
 {
 LanguageTag aLanguageTag( eLang);
-auto const iter = m_aLangTable.find(aLanguageTag);
-if (iter != m_aLangTable.end())
+if (auto const iter = m_aLangTable.find(aLanguageTag); iter != 
m_aLangTable.end())
 return iter->second.PutText(rShort, rLong);
-if(CreateLanguageFile(aLanguageTag))
-return m_aLangTable.find(aLanguageTag)->second.PutText(rShort, rLong);
+if (CreateLanguageFile(aLanguageTag))
+{
+auto const iter = m_aLangTable.find(aLanguageTag);
+assert (iter != m_aLangTable.end());
+return iter->second.PutText(rShort, rLong);
+}
 return false;
 }
 
commit fc288036a51f3d6a529ef4f145468f3ee3c8fc32
Author: Caolán McNamara 
AuthorDate: Fri Dec 1 11:45:07 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 18:06:46 2023 +0100

cid#1555476 silence Unchecked return value

Change-Id: I55db6a470a2aca5ebcbace7859236b08bb67e25b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160212
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 4ed990be33d3..c85089fc0736 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1566,7 +1566,7 @@ XclExpChartObj::XclExpChartObj( XclExpObjectManager& 
rObjMgr, Reference< XShape
 
 // load the chart OLE object
 if( SdrOle2Obj* pSdrOleObj = dynamic_cast< SdrOle2Obj* >( pSdrObj ) )
-svt::EmbeddedObjectRef::TryRunningState( pSdrOleObj->GetObjRef() );
+(void)svt::EmbeddedObjectRef::TryRunningState(pSdrOleObj->GetObjRef());
 
 // create the chart substream object
 ScfPropertySet aShapeProp( xShape );
commit e0014555f562feb1096dc80b1350e2b881ca2a9e
Author: Caolán McNamara 
AuthorDate: Fri Dec 1 11:43:40 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 18:06:40 2023 +0100

cid#1558172 Division or modulo by zero

Change-Id: I4060b003fc03c8fe3e0396f9618e64a69715131c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160211
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/shells/translatehelper.cxx 
b/sw/source/uibase/shells/translatehelper.cxx
index a3d03542ba5a..eb9bcaedbb05 100644
--- a/sw/source/uibase/shells/translatehelper.cxx
+++ b/sw/source/uibase/shells/translatehelper.cxx
@@ -193,7 +193,7 @@ void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const 
TranslateAPIConfig&
 rConfig.m_xTargetLanguage, rConfig.m_xAPIUrl, 
rConfig.m_xAuthKey, aOut);
 SwTranslateHelper::PasteHTMLToPaM(rWrtSh, cursor.get(), 
aTranslatedOut);
 
-if (xStatusIndicator.is())
+if (xStatusIndicator.is() && nCount)
 xStatusIndicator->setValue((100 * ++nProgress) / nCount);
 
 Idle aIdle("ProgressBar::SetValue aIdle");


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

2015-04-14 Thread Jan Holesovsky
 editeng/source/editeng/impedit2.cxx |   10 +++
 sc/source/ui/inc/gridwin.hxx|8 ++
 sc/source/ui/inc/output.hxx |4 +
 sc/source/ui/view/gridwin.cxx   |  108 +---
 sc/source/ui/view/output2.cxx   |   33 +--
 5 files changed, 147 insertions(+), 16 deletions(-)

New commits:
commit 771bb58c1c547a874c80d05be59f73cbf68343df
Author: Jan Holesovsky ke...@collabora.com
Date:   Tue Apr 14 12:08:39 2015 +0200

editeng tiled editing: Don't overwrite bInSelection.

Setting bInSelection in MouseButtonUp() feels wrong, and against of its 
other
handling elsewhere.  Also it breaks the selection handling in the tiled
rendering case - on further redraw, selections may disappear.

But it has been so since the initial check-in of the OOo code, so I have no
idea what corner case I might break by deleting this, so let's guard the
behavior by isTiledReneding() for now.

Change-Id: I7f7b237f9f0f427e317266e05481bac439c3c8ad

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 7fc5c43..7d4f1c8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -567,7 +567,15 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent 
rMEvt, EditView* pView )
 {
 GetSelEngine().SetCurView( pView );
 GetSelEngine().SelMouseButtonUp( rMEvt );
-bInSelection = false;
+
+// in the tiled rendering case, setting bInSelection here has unexpected
+// consequences - further tiles painting removes the selection
+// FIXME I believe resetting bInSelection should not be here even in the
+// non-tiled-rendering case, but it has been here since 2000 (and before)
+// so who knows what corner case it was supposed to solve back then
+if (!pView-pImpEditView-isTiledRendering())
+bInSelection = false;
+
 // Special treatments
 EditSelection aCurSel( pView-pImpEditView-GetEditSelection() );
 if ( !aCurSel.HasRange() )
commit 3f04bfef9e12e947f336aaa441d784f6c77f8e6a
Author: Jan Holesovsky ke...@collabora.com
Date:   Tue Apr 14 12:05:00 2015 +0200

sc tiled editing: Implement long-touch to select word in overflowing text.

Normally, the text overflowing from other cells is completely ignored by 
Calc,
and the user always works with the underlying cells.

On Android / mobile, it is though more natural to be able to select the text
directly; so implement a compromise:

* tap places the text cursor, so that the user can write into the
  cells hidden by the text too
* long-tap selects the word in the text, even if the text 'just' overflows
  from another cell

Change-Id: Ibe8666301ff1df0414c0206c1f3336842485433b

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 259844e..0221e60 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -278,6 +278,14 @@ class ScGridWindow : public vcl::Window, public 
DropTargetHelper, public DragSou
 sal_uInt16  HitPageBreak( const Point rMouse, ScRange* pSource = 
NULL,
 SCCOLROW* pBreak = NULL, SCCOLROW* pPrev = 
NULL );
 
+/** The cell may be covered by text that overflows from a previous cell.
+
+@return if true, the given cell is covered by (overflowing) text and
+rTextStartPosX returns the column where the text that overflows
+starts.
+*/
+boolIsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB 
nTab, SCsCOL rTextStartPosX);
+
 voidPasteSelection( const Point rPosPixel );
 
 voidSelectForContextMenu( const Point rPosPixel, SCsCOL 
nCellX, SCsROW nCellY );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2b0ca4c..838318e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1657,6 +1657,72 @@ void ScGridWindow::MouseButtonDown( const MouseEvent 
rMEvt )
 nNestedButtonState = SC_NESTEDBUTTON_NONE;
 }
 
+bool ScGridWindow::IsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB nTab, 
SCsCOL rTextStartPosX)
+{
+ScDocument* pDoc = pViewData-GetDocument();
+
+// find the first non-empty cell (this, or to the left)
+ScRefCellValue aCell;
+SCsCOL nNonEmptyX = nPosX;
+for (; nNonEmptyX = 0; --nNonEmptyX)
+{
+aCell.assign(*pDoc, ScAddress(nNonEmptyX, nPosY, nTab));
+if (!aCell.isEmpty())
+break;
+}
+
+// the inital cell already contains text
+if (nNonEmptyX == nPosX)
+{
+rTextStartPosX = nNonEmptyX;
+return true;
+}
+
+// to the left, there is no cell that would contain (potentially
+// overrunning) text
+if (nNonEmptyX  0 || pDoc-HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, 
nPosY, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED))
+return false;
+
+double nPPTX = pViewData-GetPPTX();
+double