[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-08-13 Thread Mike Kaganski (via logerrit)
 basctl/source/basicide/baside2b.cxx |   60 ++--
 1 file changed, 31 insertions(+), 29 deletions(-)

New commits:
commit 575f4ec1dcb0a2dbd80bfaf001a5fc3072cd11fa
Author: Mike Kaganski 
AuthorDate: Tue Aug 11 18:11:10 2020 +0300
Commit: Michael Stahl 
CommitDate: Thu Aug 13 17:35:37 2020 +0200

tdf#135639: check the return value of GetDim32

... to avoid crash accessing non-existing element of pChildItem->vIndices

Change-Id: I248a9301abd69883f940051d9d9671298dcc8453
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100540
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100565
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100615
Reviewed-by: Michael Stahl 

diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index d07222a44d27..c4d1f1e44b04 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2188,39 +2188,41 @@ void WatchTreeListBox::RequestingChildren( 
SvTreeListEntry * pParent )
 int nParentLevel = bArrayIsRootArray ? pItem->nDimLevel : 0;
 int nThisLevel = nParentLevel + 1;
 sal_Int32 nMin, nMax;
-pArray->GetDim32( nThisLevel, nMin, nMax );
-for( sal_Int32 i = nMin ; i <= nMax ; i++ )
+if (pArray->GetDim32(nThisLevel, nMin, nMax))
 {
-WatchItem* pChildItem = new WatchItem(pItem->maName);
+for( sal_Int32 i = nMin ; i <= nMax ; i++ )
+{
+WatchItem* pChildItem = new WatchItem(pItem->maName);
 
-// Copy data and create name
+// Copy data and create name
 
-OUStringBuffer aIndexStr = "(";
-pChildItem->mpArrayParentItem = pItem;
-pChildItem->nDimLevel = nThisLevel;
-pChildItem->nDimCount = pItem->nDimCount;
-pChildItem->vIndices.resize(pChildItem->nDimCount);
-sal_Int32 j;
-for( j = 0 ; j < nParentLevel ; j++ )
-{
-short n = pChildItem->vIndices[j] = pItem->vIndices[j];
-aIndexStr.append(OUString::number( n )).append(",");
+OUStringBuffer aIndexStr = "(";
+pChildItem->mpArrayParentItem = pItem;
+pChildItem->nDimLevel = nThisLevel;
+pChildItem->nDimCount = pItem->nDimCount;
+pChildItem->vIndices.resize(pChildItem->nDimCount);
+sal_Int32 j;
+for( j = 0 ; j < nParentLevel ; j++ )
+{
+short n = pChildItem->vIndices[j] = pItem->vIndices[j];
+aIndexStr.append(OUString::number( n )).append(",");
+}
+pChildItem->vIndices[nParentLevel] = 
sal::static_int_cast( i );
+aIndexStr.append(OUString::number( i )).append(")");
+
+OUString aDisplayName;
+WatchItem* pArrayRootItem = pChildItem->GetRootItem();
+if( pArrayRootItem && pArrayRootItem->mpArrayParentItem )
+aDisplayName = pItem->maDisplayName;
+else
+aDisplayName = pItem->maName;
+aDisplayName += aIndexStr;
+pChildItem->maDisplayName = aDisplayName;
+
+SvTreeListEntry* pChildEntry = SvTreeListBox::InsertEntry( 
aDisplayName, pEntry );
+nElementCount++;
+pChildEntry->SetUserData( pChildItem );
 }
-pChildItem->vIndices[nParentLevel] = sal::static_int_cast( 
i );
-aIndexStr.append(OUString::number( i )).append(")");
-
-OUString aDisplayName;
-WatchItem* pArrayRootItem = pChildItem->GetRootItem();
-if( pArrayRootItem && pArrayRootItem->mpArrayParentItem )
-aDisplayName = pItem->maDisplayName;
-else
-aDisplayName = pItem->maName;
-aDisplayName += aIndexStr;
-pChildItem->maDisplayName = aDisplayName;
-
-SvTreeListEntry* pChildEntry = SvTreeListBox::InsertEntry( 
aDisplayName, pEntry );
-nElementCount++;
-pChildEntry->SetUserData( pChildItem );
 }
 if( nElementCount > 0 )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-07-06 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/baside2.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 6e240dd933d1dd54480cad0f1f2ecb45b1c5326e
Author: Caolán McNamara 
AuthorDate: Mon Jul 6 16:23:51 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 6 20:50:42 2020 +0200

Resolves: tdf#134551 ModulWindow deleted when last module removed

leaving a dangling reference to m_aName. Hold a reference until
ExecuteCommand is finished.

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

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 5cb16f8f1f58..4a9fc67c94d0 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1009,8 +1009,13 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
 case SID_BASICIDE_DELETECURRENT:
 {
 if (QueryDelModule(m_aName, GetFrameWeld()))
+{
+// tdf#134551 don't delete the window if last module is 
removed until this block
+// is complete
+VclPtr xKeepRef(this);
 if (m_aDocument.removeModule(m_aLibName, m_aName))
 MarkDocumentModified(m_aDocument);
+}
 }
 break;
 case FID_SEARCH_OFF:
@@ -1050,7 +1055,6 @@ void ModulWindow::ExecuteGlobal (SfxRequest& rReq)
 }
 }
 
-
 void ModulWindow::GetState( SfxItemSet &rSet )
 {
 SfxWhichIter aIter(rSet);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-05-21 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/baside2.hxx  |3 +++
 basctl/source/basicide/baside2b.cxx |   19 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 1f628d9e1b118741093c0748686bd71223ef2364
Author: Caolán McNamara 
AuthorDate: Tue May 19 11:20:52 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 21 13:28:28 2020 +0200

Resolves: tdf#114258 defer LoseFocus treeview update

until the next event cycle in cas the LoseFocus is happening due to an
in-progress selection event from a  mouse down in the treeview that would be
updated

Change-Id: Ia4448aa798a8af7cd35bc17215891f6c5ca8678a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94494
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 1f209723cb294559f6f6bbb42d9db7b78a3b5a61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94455

diff --git a/basctl/source/basicide/baside2.hxx 
b/basctl/source/basicide/baside2.hxx
index 81401763c9ae..ba9f5b43f0fb 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -85,10 +85,13 @@ private:
 
 longnCurTextWidth;
 
+ImplSVEvent* m_nSetSourceInBasicId;
+
 SyntaxHighlighter   aHighlighter;
 IdleaSyntaxIdle;
 std::set   aSyntaxLineTable;
 DECL_LINK(SyntaxTimerHdl, Timer *, void);
+DECL_LINK(SetSourceInBasicHdl, void*, void);
 
 // progress bar
 class ProgressInfo;
diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 6bf425a65c8b..d07222a44d27 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -229,6 +229,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, 
ModulWindow* pModulWindow) :
 Window(pParent, WB_BORDER),
 rModulWindow(*pModulWindow),
 nCurTextWidth(0),
+m_nSetSourceInBasicId(nullptr),
 aHighlighter(HighlighterLanguage::Basic),
 bHighlighting(false),
 bDoSyntaxHighlight(true),
@@ -259,6 +260,12 @@ EditorWindow::~EditorWindow()
 
 void EditorWindow::dispose()
 {
+if (m_nSetSourceInBasicId)
+{
+Application::RemoveUserEvent(m_nSetSourceInBasicId);
+m_nSetSourceInBasicId = nullptr;
+}
+
 Reference< beans::XMultiPropertySet > n;
 {
 osl::MutexGuard g(mutex_);
@@ -926,10 +933,20 @@ void EditorWindow::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rectan
 
 void EditorWindow::LoseFocus()
 {
-SetSourceInBasic();
+// tdf#114258 wait until the next event loop cycle to do this so it doesn't
+// happen during a mouse down/up selection in the treeview whose contents
+// this may update
+if (!m_nSetSourceInBasicId)
+m_nSetSourceInBasicId = Application::PostUserEvent(LINK(this, 
EditorWindow, SetSourceInBasicHdl));
 Window::LoseFocus();
 }
 
+IMPL_LINK_NOARG(EditorWindow, SetSourceInBasicHdl, void*, void)
+{
+m_nSetSourceInBasicId = nullptr;
+SetSourceInBasic();
+}
+
 void EditorWindow::SetSourceInBasic()
 {
 if ( pEditEngine && pEditEngine->IsModified()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-04-16 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/macrodlg.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c737572cedceeec80ec38db0ad18278bbfdbc64a
Author: Caolán McNamara 
AuthorDate: Wed Apr 15 16:57:19 2020 +0100
Commit: Michael Stahl 
CommitDate: Thu Apr 16 11:13:16 2020 +0200

tdf#126828 hide macro organize dialog before launching macro editing

so the macro editor isn't forced behind the window with an active dialog

Change-Id: Iae89f6910a8183bcf01872eef71c04bc993f1550
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92307
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit cac8694feab1ccb422294ed3e2f8b682e15835fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92297
Reviewed-by: Michael Stahl 

diff --git a/basctl/source/basicide/macrodlg.cxx 
b/basctl/source/basicide/macrodlg.cxx
index 97a45c59c03c..0d9ee3691bcb 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -630,6 +630,8 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, 
void)
 if (m_xMacroBox->get_selected(m_xMacroBoxIter.get()))
 aInfoItem.SetMethod(m_xMacroBox->get_text(*m_xMacroBoxIter));
 StoreMacroDescription();
+m_xDialog->hide(); // tdf#126828 dismiss dialog before opening new 
window
+
 SfxAllItemSet aArgs( SfxGetpApp()->GetPool() );
 SfxRequest aRequest( SID_BASICIDE_APPEAR, SfxCallMode::SYNCHRON, 
aArgs );
 SfxGetpApp()->ExecuteSlot( aRequest );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-02-27 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/moduldlg.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 417a3d17271a3e27e7c0aa3030d2b382ecd03a42
Author: Caolán McNamara 
AuthorDate: Tue Feb 25 14:02:48 2020 +
Commit: Xisco Faulí 
CommitDate: Thu Feb 27 11:56:57 2020 +0100

check if edit can be enabled after setting cursor into tree

Change-Id: I264dc4db7e3ddc64faf0edec18d96d2c46ce00f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89438
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/basctl/source/basicide/moduldlg.cxx 
b/basctl/source/basicide/moduldlg.cxx
index 02259ed4314b..4f5711043d24 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -574,6 +574,7 @@ ObjectPage::~ObjectPage()
 void ObjectPage::ActivatePage()
 {
 m_xBasicBox->UpdateEntries();
+CheckButtons();
 }
 
 void ObjectPage::CheckButtons()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-02-26 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/linenumberwindow.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c3143b5db45ca84267a4bc9c897fb4077e33d128
Author: Caolán McNamara 
AuthorDate: Tue Feb 25 15:55:24 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 26 18:24:08 2020 +0100

tdf#130925 use the maximum document line number for the width calculation

not the max line number in the range currently getting rendered

Change-Id: I447e4152ef6a1ec327a95a8260d1616940e5d6c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89467
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit ca79c018f1e8bd0e1f42e3cef4b4f5893ef2e47f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89521

diff --git a/basctl/source/basicide/linenumberwindow.cxx 
b/basctl/source/basicide/linenumberwindow.cxx
index 79c124117c97..4fa6ebf8f5aa 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -73,7 +73,8 @@ void LineNumberWindow::Paint( vcl::RenderContext& 
rRenderContext, const tools::R
 
 // reserve enough for 3 digit minimum, with a bit to spare for comfort
 m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
-sal_uInt32 i = (nEndLine + 1) / 1000;
+auto nMaxLineNumber = std::max(nEndLine, txtEngine->GetParagraphCount() + 
1);
+sal_uInt32 i = (nMaxLineNumber + 1) / 1000;
 while (i)
 {
 i /= 10;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2020-02-11 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/bastype2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 020ee2fcc1a40415dca8e974cf30834667f55036
Author: Caolán McNamara 
AuthorDate: Tue Feb 11 12:12:05 2020 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Feb 11 15:27:13 2020 +0100

Related: tdf#130161 invalid iterator used in BrowseMode::Subs case

xTreeIter is invalid here before AddEntry, afterwards it will remain
invalid unless it was passed in to AddEntry to be updated to the
newly inserted location, and we need it to be valid in the
BrowseMode::Subs case

Change-Id: I4831b7713bdb67889604fd4f8a7cd1644fd81a10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88394
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/basctl/source/basicide/bastype2.cxx 
b/basctl/source/basicide/bastype2.cxx
index feb45f3d4206..80ed26a859d4 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -983,7 +983,7 @@ void SbTreeListBox::ImpCreateLibSubEntries(const 
weld::TreeIter& rLibRootEntry,
 bool bModuleEntry = FindEntry(aModName, 
OBJ_TYPE_MODULE, *xTreeIter);
 if (!bModuleEntry)
 {
-AddEntry(aModName, RID_BMP_MODULE, &rLibRootEntry, 
false, std::make_unique(OBJ_TYPE_MODULE));
+AddEntry(aModName, RID_BMP_MODULE, &rLibRootEntry, 
false, std::make_unique(OBJ_TYPE_MODULE), xTreeIter.get());
 }
 
 // methods
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

2019-11-20 Thread Caolán McNamara (via logerrit)
 basctl/source/basicide/macrodlg.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7ea47791488bfb3c4abe66f2c6035a2a5ee12871
Author: Caolán McNamara 
AuthorDate: Wed Nov 20 10:02:27 2019 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 20 15:04:55 2019 +0100

Resolves: tdf#128900 can't edit initial macro with empty user profile

Change-Id: I5e28a4253b755fc3f5ed7c02c99c2611513e5bd8
Reviewed-on: https://gerrit.libreoffice.org/83284
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/basctl/source/basicide/macrodlg.cxx 
b/basctl/source/basicide/macrodlg.cxx
index 3459a5432b9f..97a45c59c03c 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -152,7 +152,8 @@ void MacroChooser::RestoreMacroDescription()
 aDesc = pData->GetLastEntryDescriptor();
 }
 
-m_xBasicBox->SetCurrentEntry( aDesc );
+m_xBasicBox->SetCurrentEntry(aDesc);
+BasicSelectHdl(m_xBasicBox->get_widget());
 
 OUString aLastMacro( aDesc.GetMethodName() );
 if (!aLastMacro.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits