[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 11 commits - desktop/source include/svx include/vcl svx/source sw/qa sw/source vcl/inc vcl/jsdialog vcl/source
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 10 18:49:53 UTC 2021
desktop/source/lib/init.cxx | 5
include/svx/fontworkgallery.hxx | 6
include/vcl/jsdialog/executor.hxx | 9
include/vcl/uitest/uiobject.hxx | 19 +
include/vcl/weld.hxx | 2
svx/source/tbxctrls/fontworkgallery.cxx | 9
svx/source/toolbars/fontworkbar.cxx | 4
sw/qa/uitest/writer_tests2/fontworks.py | 11
sw/source/uibase/uiview/viewdraw.cxx | 53 ++--
vcl/inc/iconview.hxx | 3
vcl/inc/jsdialog/jsdialogbuilder.hxx | 173 +++++++++----
vcl/inc/salvtables.hxx | 59 ++++
vcl/jsdialog/executor.cxx | 30 ++
vcl/jsdialog/jsdialogbuilder.cxx | 269 +++++++++++---------
vcl/source/app/salvtables.cxx | 415 +++++++++++++++-----------------
vcl/source/treelist/iconview.cxx | 62 ++++
vcl/source/uitest/uiobject.cxx | 37 ++
vcl/source/window/builder.cxx | 3
18 files changed, 732 insertions(+), 437 deletions(-)
New commits:
commit 248c7a8e70bff77491a05ba1e1e135b6a17e8b58
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Dec 17 10:16:52 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:26:41 2021 +0200
lok: add parameter "MacroExecMode"
It is required to execute VBA scripts.
Change-Id: Ibaafc62ecedcefcd0596c701728039783b5a0de7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107891
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7b455cf7b348..760249bb2555 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -60,6 +60,7 @@
#include <comphelper/threadpool.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/Desktop.hpp>
@@ -2239,7 +2240,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
const OUString aDeviceFormFactor = extractParameter(aOptions, "DeviceFormFactor");
SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor);
- uno::Sequence<css::beans::PropertyValue> aFilterOptions(2);
+ uno::Sequence<css::beans::PropertyValue> aFilterOptions(3);
aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions",
0,
uno::makeAny(aOptions),
@@ -2258,11 +2259,11 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[1].Name = "InteractionHandler";
aFilterOptions[1].Value <<= xInteraction;
- /* TODO
sal_Int16 nMacroExecMode = document::MacroExecMode::USE_CONFIG;
aFilterOptions[2].Name = "MacroExecutionMode";
aFilterOptions[2].Value <<= nMacroExecMode;
+ /* TODO
sal_Int16 nUpdateDoc = document::UpdateDocMode::ACCORDING_TO_CONFIG;
aFilterOptions[3].Name = "UpdateDocMode";
aFilterOptions[3].Value <<= nUpdateDoc;
commit db7f66f3f96782c4077089226dbcd1516f1e08aa
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 4 16:32:30 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:26:16 2021 +0200
lok: use JSDialog Builder to create a Macro Selector Dialog
The Macro Selector Dialog should be created for desktop too.
The JS Builder has an implementation to send "jsdialog: "
data to the client side.
Change-Id: If29660467e494323ac26605e704ee9bf15725fd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107243
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
commit f3efaad1b8a2a8d0f397f7b1aaaf608850c1df72
Author: Mert Tumer <mert.tumer at collabora.com>
AuthorDate: Wed Dec 16 23:00:11 2020 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:25:13 2021 +0200
jsdialogs: Use JS dialog for Fontwork dialog
Change-Id: I4d2206550f7d3948f373c803888c7d19034e42c4
Signed-off-by: Mert Tumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108684
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109217
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 3ff956be4395..077534436651 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -203,7 +203,8 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
|| rUIFile == "uui/ui/macrowarnmedium.ui"
|| rUIFile == "modules/scalc/ui/datafielddialog.ui"
|| rUIFile == "modules/scalc/ui/pivotfielddialog.ui"
- || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui")
+ || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui"
+ || rUIFile == "svx/ui/fontworkgallerydialog.ui")
{
bUseJSBuilder = true;
}
commit b972832c002b025de9e0da1a1f7cceee3981d82a
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jan 11 13:52:32 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:24:58 2021 +0200
Make Fontwork gallery dialog async
Change-Id: I156dc1b505b01dc7520ccfe80bbf97eba881d653
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109092
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109258
Tested-by: Jenkins
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 3fa657305ad6..46dfd3b26104 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -49,7 +49,8 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontWorkGalleryDialog final : public wel
sal_uInt16 mnThemeId;
SdrView& mrSdrView;
- SdrObject** mppSdrObject;
+ bool mbInsertIntoPage;
+ SdrObject* mppSdrObject;
SdrModel* mpDestModel;
std::vector<VclPtr< VirtualDevice >> maFavoritesHorizontal;
@@ -69,7 +70,8 @@ public:
virtual ~FontWorkGalleryDialog() override;
// SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
- void SetSdrObjectRef( SdrObject**, SdrModel* pModel );
+ void SetSdrObjectRef( SdrModel* pModel, bool bInsertIntoPage = true );
+ SdrObject* GetSdrObjectRef() { return mppSdrObject; }
};
}
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index efef6f786e0d..b9ad40f80dbe 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -52,6 +52,7 @@ FontWorkGalleryDialog::FontWorkGalleryDialog(weld::Window* pParent, SdrView& rSd
: GenericDialogController(pParent, "svx/ui/fontworkgallerydialog.ui", "FontworkGalleryDialog")
, mnThemeId(0xffff)
, mrSdrView(rSdrView)
+ , mbInsertIntoPage(true)
, mppSdrObject(nullptr)
, mpDestModel(nullptr)
, maCtlFavorites(m_xBuilder->weld_icon_view("ctlFavoriteswin"))
@@ -131,9 +132,9 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 nThemeId)
maCtlFavorites->select(0);
}
-void FontWorkGalleryDialog::SetSdrObjectRef( SdrObject** ppSdrObject, SdrModel* pModel )
+void FontWorkGalleryDialog::SetSdrObjectRef( SdrModel* pModel, bool bInsertIntoPage )
{
- mppSdrObject = ppSdrObject;
+ mbInsertIntoPage = bInsertIntoPage;
mpDestModel = pModel;
}
@@ -164,7 +165,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
// If this is not used, the correct SdrModel seems to be the one from
// the mrSdrView that is used to insert (InsertObjectAtView below) the
// cloned SdrObject.
- const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
+ const bool bUseSpecialCalcMode(!mbInsertIntoPage && nullptr != mpDestModel);
// center shape on current view
OutputDevice* pOutDev(mrSdrView.GetFirstOutputDevice());
@@ -201,7 +202,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
if (bUseSpecialCalcMode)
{
- *mppSdrObject = pNewObject;
+ mppSdrObject = pNewObject;
}
else
{
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 308f4d2f6b60..8a89952d8db3 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -415,8 +415,8 @@ void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindin
{
case SID_FONTWORK_GALLERY_FLOATER:
{
- FontWorkGalleryDialog aDlg(rReq.GetFrameWeld(), rSdrView);
- aDlg.run();
+ std::shared_ptr<FontWorkGalleryDialog> pDlg = std::make_shared<FontWorkGalleryDialog>(rReq.GetFrameWeld(), rSdrView);
+ weld::DialogController::runAsync(pDlg, [](int){});
}
break;
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index e5284b48e04a..219d4bbf52c8 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -150,35 +150,40 @@ void SwView::ExecDraw(SfxRequest& rReq)
pSdrView = m_pWrtShell->GetDrawView();
if (pSdrView)
{
- SdrObject* pObj = nullptr;
- svx::FontWorkGalleryDialog aDlg(rWin.GetFrameWeld(), *pSdrView);
- aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() );
- aDlg.run();
- if ( pObj )
- {
- Size aDocSize( m_pWrtShell->GetDocSize() );
- const SwRect& rVisArea = m_pWrtShell->VisArea();
- Point aPos( rVisArea.Center() );
- Size aSize;
- Size aPrefSize( pObj->GetSnapRect().GetSize() );
+ std::shared_ptr<svx::FontWorkGalleryDialog> pDlg = std::make_shared<svx::FontWorkGalleryDialog>(rWin.GetFrameWeld(), *pSdrView);
+ pDlg->SetSdrObjectRef( pSdrView->GetModel(), false );
+ weld::DialogController::runAsync(pDlg, [this, pDlg](int) {
+ vcl::Window& rWin2 = m_pWrtShell->GetView().GetViewFrame()->GetWindow();
- if( rVisArea.Width() > aDocSize.Width())
- aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
+ SdrObject* pObj = pDlg->GetSdrObjectRef();
+ if ( pObj )
+ {
+ Size aDocSize( m_pWrtShell->GetDocSize() );
+ const SwRect& rVisArea = m_pWrtShell->VisArea();
+ Point aPos( rVisArea.Center() );
+ Size aSize;
+ Size aPrefSize( pObj->GetSnapRect().GetSize() );
- if(rVisArea.Height() > aDocSize.Height())
- aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
+ if( rVisArea.Width() > aDocSize.Width())
+ aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
- if( aPrefSize.Width() && aPrefSize.Height() )
- aSize = rWin.PixelToLogic(aPrefSize, MapMode(MapUnit::MapTwip));
- else
- aSize = Size( 2835, 2835 );
+ if(rVisArea.Height() > aDocSize.Height())
+ aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
- m_pWrtShell->EnterStdMode();
- m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
- rReq.Ignore ();
- }
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ aSize = rWin2.PixelToLogic(aPrefSize, MapMode(MapUnit::MapTwip));
+ else
+ aSize = Size( 2835, 2835 );
+
+ m_pWrtShell->EnterStdMode();
+ m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
+ }
+
+ rWin2.LeaveWait();
+ });
}
- rWin.LeaveWait();
+ else
+ rWin.LeaveWait();
}
else if ( m_nFormSfxId != USHRT_MAX )
GetViewFrame()->GetDispatcher()->Execute( SID_FM_LEAVE_CREATE );
commit fa03ce3f5aa3cb9439b0531812448afa30c5a6ee
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jan 11 09:47:33 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:24:47 2021 +0200
jsdialog: execute IconView actions
Change-Id: If94df547096a5adb15ace432695f91ee7e879bb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109078
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109257
Tested-by: Jenkins
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 0c7abbf693ca..159b1dccd730 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -22,6 +22,10 @@ public:
static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
+ static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
+
+ static void trigger_changed(weld::IconView& rIconView) { rIconView.signal_selection_changed(); }
+
static void trigger_toggled(weld::ToggleButton& rButton) { rButton.signal_toggled(); }
static void trigger_row_activated(weld::TreeView& rTreeView)
@@ -29,7 +33,10 @@ public:
rTreeView.signal_row_activated();
}
- static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
+ static void trigger_item_activated(weld::IconView& rIconView)
+ {
+ rIconView.signal_item_activated();
+ }
static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
{
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index db5ada010fd1..b38ba2914462 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1228,6 +1228,8 @@ public:
class VCL_DLLPUBLIC IconView : virtual public Container
{
+ friend class ::LOKTrigger;
+
private:
OUString m_sSavedValue;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 066512b2abf1..b21ec0ae7202 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -270,6 +270,36 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
}
}
}
+ else if (sControlType == "iconview")
+ {
+ auto pIconView = dynamic_cast<weld::IconView*>(pWidget);
+ if (pIconView)
+ {
+ if (sAction == "select")
+ {
+ OString nPosString
+ = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+ int nPos = std::atoi(nPosString.getStr());
+
+ pIconView->select(nPos);
+ LOKTrigger::trigger_changed(*pIconView);
+
+ return true;
+ }
+ else if (sAction == "activate")
+ {
+ OString nPosString
+ = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+ int nPos = std::atoi(nPosString.getStr());
+
+ pIconView->select(nPos);
+ LOKTrigger::trigger_changed(*pIconView);
+ LOKTrigger::trigger_item_activated(*pIconView);
+
+ return true;
+ }
+ }
+ }
else if (sControlType == "expander")
{
auto pExpander = dynamic_cast<weld::Expander*>(pWidget);
commit a0b95bc0806d45803f063af09a74c685456e79b6
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Jan 8 10:54:14 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:20:56 2021 +0200
jsdialog: dump IconView
Change-Id: I82df1f5e5f966e764b768044526b3401d55fc394
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108984
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109256
Tested-by: Jenkins
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index f10b0ed8a53e..c1e62bc2ec65 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -35,6 +35,7 @@ public:
vcl::RenderContext& rRenderContext);
virtual FactoryFunction GetUITestFactory() const override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
};
#endif
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index b6dd3da1c40a..7786a6976c2a 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -22,6 +22,11 @@
#include <iconview.hxx>
#include "iconviewimpl.hxx"
#include <vcl/uitest/uiobject.hxx>
+#include <tools/json_writer.hxx>
+#include <vcl/toolkit/svlbitm.hxx>
+#include <tools/stream.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <comphelper/base64.hxx>
IconView::IconView(vcl::Window* pParent, WinBits nBits)
: SvTreeListBox(pParent, nBits)
@@ -218,4 +223,58 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n
FactoryFunction IconView::GetUITestFactory() const { return IconViewUIObject::create; }
+static OUString extractPngString(const SvLBoxContextBmp* pBmpItem)
+{
+ BitmapEx aImage = pBmpItem->GetBitmap1().GetBitmapEx();
+ SvMemoryStream aOStm(65535, 65535);
+ if (GraphicConverter::Export(aOStm, aImage, ConvertDataFormat::PNG) == ERRCODE_NONE)
+ {
+ css::uno::Sequence<sal_Int8> aSeq(static_cast<sal_Int8 const*>(aOStm.GetData()),
+ aOStm.Tell());
+ OUStringBuffer aBuffer("data:image/png;base64,");
+ ::comphelper::Base64::encode(aBuffer, aSeq);
+ return aBuffer.makeStringAndClear();
+ }
+
+ return "";
+}
+
+static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListEntry* pEntry,
+ SvTreeListBox* pTabListBox)
+{
+ while (pEntry)
+ {
+ auto aNode = rJsonWriter.startStruct();
+
+ // simple listbox value
+ const SvLBoxItem* pIt = pEntry->GetFirstItem(SvLBoxItemType::String);
+ if (pIt)
+ rJsonWriter.put("text", static_cast<const SvLBoxString*>(pIt)->GetText());
+
+ pIt = pEntry->GetFirstItem(SvLBoxItemType::ContextBmp);
+ if (pIt)
+ {
+ const SvLBoxContextBmp* pBmpItem = static_cast<const SvLBoxContextBmp*>(pIt);
+ if (pBmpItem)
+ rJsonWriter.put("image", extractPngString(pBmpItem));
+ }
+
+ if (pTabListBox->IsSelected(pEntry))
+ rJsonWriter.put("selected", "true");
+
+ rJsonWriter.put("row",
+ OString::number(pTabListBox->GetModel()->GetAbsPos(pEntry)).getStr());
+
+ pEntry = pEntry->NextSibling();
+ }
+}
+
+void IconView::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+ SvTreeListBox::DumpAsPropertyTree(rJsonWriter);
+ rJsonWriter.put("type", "iconview");
+ auto aNode = rJsonWriter.startArray("entries");
+ lcl_DumpEntryAndSiblings(rJsonWriter, First(), this);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ae840230fc92210f80be837f28e9985ab0670246
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 13 20:12:50 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:20:50 2021 +0200
UITest: add IconView
Change-Id: I6971d73e65f0a1f60203ea1010ed8ad3ba176755
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109243
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index b4c7f437e9e3..e2cb07384cf7 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -24,6 +24,7 @@ class CheckBox;
class ComboBox;
class Dialog;
class Edit;
+class IconView;
class ListBox;
class RadioButton;
class TabControl;
@@ -439,7 +440,7 @@ private:
virtual OUString get_name() const override;
};
-class TreeListUIObject final : public WindowUIObject
+class TreeListUIObject : public WindowUIObject
{
public:
TreeListUIObject(const VclPtr<SvTreeListBox>& xTreeList);
@@ -455,7 +456,7 @@ public:
virtual std::set<OUString> get_children() const override;
-private:
+protected:
virtual OUString get_name() const override;
@@ -486,6 +487,20 @@ private:
SvTreeListEntry* const mpEntry;
};
+class IconViewUIObject final : public TreeListUIObject
+{
+public:
+ IconViewUIObject(const VclPtr<SvTreeListBox>& xIconView);
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+private:
+
+ virtual OUString get_name() const override;
+};
+
class ToolBoxUIObject final : public WindowUIObject
{
private:
diff --git a/sw/qa/uitest/writer_tests2/fontworks.py b/sw/qa/uitest/writer_tests2/fontworks.py
index d3034dc8134b..671f63087ba4 100644
--- a/sw/qa/uitest/writer_tests2/fontworks.py
+++ b/sw/qa/uitest/writer_tests2/fontworks.py
@@ -22,15 +22,18 @@ class fontWorksDialog(UITestCase):
self.ui_test.execute_dialog_through_command(".uno:FontworkGalleryFloater")
xDialog = self.xUITest.getTopFocusWindow()
- FontWorkSelector = xDialog.getChild("ctlFavorites")
+ FontWorkSelector = xDialog.getChild("ctlFavoriteswin")
# Select element with id (3)
- FontWorkSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"}))
+ element3 = FontWorkSelector.getChild("2")
+ element3.executeAction("SELECT", mkPropertyValues({}))
+ print(get_state_as_dict(FontWorkSelector))
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2")
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3")
- self.assertEqual(get_state_as_dict(FontWorkSelector)["ItemsCount"], "36")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36")
# Select element with id (7)
- FontWorkSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"}))
+ element7 = FontWorkSelector.getChild("6")
+ element7.executeAction("SELECT", mkPropertyValues({}))
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6")
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7")
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index 9c74d29f9834..f10b0ed8a53e 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -33,6 +33,8 @@ public:
void PaintEntry(SvTreeListEntry&, tools::Long nX, tools::Long nY,
vcl::RenderContext& rRenderContext);
+
+ virtual FactoryFunction GetUITestFactory() const override;
};
#endif
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 12bdd75165fe..b6dd3da1c40a 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -21,6 +21,7 @@
#include <vcl/toolkit/viewdataentry.hxx>
#include <iconview.hxx>
#include "iconviewimpl.hxx"
+#include <vcl/uitest/uiobject.hxx>
IconView::IconView(vcl::Window* pParent, WinBits nBits)
: SvTreeListBox(pParent, nBits)
@@ -215,4 +216,6 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n
}
}
+FactoryFunction IconView::GetUITestFactory() const { return IconViewUIObject::create; }
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 90322d500611..92122b54caab 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -26,6 +26,9 @@
#include <vcl/toolkit/dialog.hxx>
#include <vcl/toolkit/edit.hxx>
#include <vcl/toolkit/field.hxx>
+#include <vcl/toolkit/treelistbox.hxx>
+#include <vcl/toolkit/treelistentry.hxx>
+#include <vcl/toolkit/svlbitm.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/toolkit/vclmedit.hxx>
#include <vcl/uitest/logger.hxx>
@@ -1729,4 +1732,38 @@ DrawingAreaUIObject::~DrawingAreaUIObject()
{
}
+IconViewUIObject::IconViewUIObject(const VclPtr<SvTreeListBox>& xIconView):
+ TreeListUIObject(xIconView)
+{
+}
+
+StringMap IconViewUIObject::get_state()
+{
+ StringMap aMap = TreeListUIObject::get_state();
+
+ SvTreeListEntry* pEntry = mxTreeList->FirstSelected();
+
+ OUString* pId = static_cast<OUString*>(pEntry->GetUserData());
+ if (pId)
+ aMap["SelectedItemId"] = *pId;
+
+ SvTreeList* pModel = mxTreeList->GetModel();
+ if (pModel)
+ aMap["SelectedItemPos"] = OUString::number(pModel->GetAbsPos(pEntry));
+
+ return aMap;
+}
+
+OUString IconViewUIObject::get_name() const
+{
+ return "IconViewUIObject";
+}
+
+std::unique_ptr<UIObject> IconViewUIObject::create(vcl::Window* pWindow)
+{
+ SvTreeListBox* pTreeList = dynamic_cast<SvTreeListBox*>(pWindow);
+ assert(pTreeList);
+ return std::unique_ptr<UIObject>(new IconViewUIObject(pTreeList));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 63a84a26366353b8bbe2bfedea56a0dcfdf2f572
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 16 23:00:11 2020 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:10:49 2021 +0200
jsdialogs: implemented IconView
Change-Id: I05f5009efc879aaf3fc6055ff8dfa7c26aa33d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108983
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109244
Tested-by: Jenkins
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 8740ce5db983..ca59aab24924 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -28,6 +28,7 @@ class ToolBox;
class ComboBox;
class VclMultiLineEdit;
class SvTabListBox;
+class IconView;
typedef std::map<OString, weld::Widget*> WidgetMap;
@@ -174,6 +175,7 @@ public:
virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) override;
virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) override;
+ virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) override;
static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
@@ -444,4 +446,20 @@ public:
virtual void set_expanded(bool bExpand) override;
};
+class JSIconView : public JSWidget<SalInstanceIconView, ::IconView>
+{
+public:
+ JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, weld::TreeIter* pRet) override;
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
+ virtual void clear() override;
+ virtual void select(int pos) override;
+ virtual void unselect(int pos) override;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 921552a7d32c..81ba11f92fb9 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -667,6 +667,18 @@ std::unique_ptr<weld::Expander> JSInstanceBuilder::weld_expander(const OString&
return pWeldWidget;
}
+std::unique_ptr<weld::IconView> JSInstanceBuilder::weld_icon_view(const OString& id)
+{
+ ::IconView* pIconView = m_xBuilder->get<::IconView>(id);
+ auto pWeldWidget
+ = pIconView ? std::make_unique<JSIconView>(this, pIconView, this, false) : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
VclButtonsType eButtonType,
@@ -1056,4 +1068,42 @@ void JSExpander::set_expanded(bool bExpand)
notifyDialogState();
}
+JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceIconView, ::IconView>(pSender, pIconView, pBuilder, bTakeOwnership)
+{
+}
+
+void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, weld::TreeIter* pRet)
+{
+ SalInstanceIconView::insert(pos, pStr, pId, pIconName, pRet);
+ notifyDialogState();
+}
+
+void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+ const VirtualDevice* pIcon, weld::TreeIter* pRet)
+{
+ SalInstanceIconView::insert(pos, pStr, pId, pIcon, pRet);
+ notifyDialogState();
+}
+
+void JSIconView::clear()
+{
+ SalInstanceIconView::clear();
+ notifyDialogState();
+}
+
+void JSIconView::select(int pos)
+{
+ SalInstanceIconView::select(pos);
+ notifyDialogState();
+}
+
+void JSIconView::unselect(int pos)
+{
+ SalInstanceIconView::unselect(pos);
+ notifyDialogState();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
commit 242ed6c8c16e76734f2c7c4b7502fd548d59939d
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 12 14:30:05 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:10:49 2021 +0200
jsdialog: use shared sender
Change-Id: I6d1047715cf6c29e9281c66d266ed4b888ed784c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109171
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 2df2aaeb3ad1..8740ce5db983 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -23,7 +23,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <cppuhelper/compbase.hxx>
-#include <boost/property_tree/ptree_fwd.hpp>
class ToolBox;
class ComboBox;
@@ -63,10 +62,11 @@ class JSDialogSender
std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify;
public:
+ JSDialogSender() = default;
JSDialogSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
std::string sTypeOfJSON)
- : mpIdleNotify(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON))
{
+ initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON);
}
virtual ~JSDialogSender() = default;
@@ -74,6 +74,13 @@ public:
virtual void notifyDialogState(bool bForce = false);
void sendClose();
virtual void sendUpdate(VclPtr<vcl::Window> pWindow);
+
+protected:
+ void initializeSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
+ std::string sTypeOfJSON)
+ {
+ mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON));
+ }
};
class JSDropTarget final
@@ -110,7 +117,7 @@ public:
void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
};
-class JSInstanceBuilder : public SalInstanceBuilder
+class JSInstanceBuilder : public SalInstanceBuilder, public JSDialogSender
{
sal_uInt64 m_nWindowId;
/// used in case of tab pages where dialog is not a direct top level
@@ -174,24 +181,35 @@ public:
const OUString& rPrimaryMessage);
private:
+ const std::string& GetTypeOfJSON();
VclPtr<vcl::Window>& GetContentWindow();
VclPtr<vcl::Window>& GetNotifierWindow();
};
-template <class BaseInstanceClass, class VclClass>
-class JSWidget : public BaseInstanceClass, public JSDialogSender
+template <class BaseInstanceClass, class VclClass> class JSWidget : public BaseInstanceClass
{
protected:
rtl::Reference<JSDropTarget> m_xDropTarget;
bool m_bIsFreezed;
+ JSDialogSender* m_pSender;
+
public:
- JSWidget(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- VclClass* pObject, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
+ JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
: BaseInstanceClass(pObject, pBuilder, bTakeOwnership)
- , JSDialogSender(aNotifierWindow, aContentWindow, sTypeOfJSON)
, m_bIsFreezed(false)
+ , m_pSender(pSender)
+ {
+ }
+
+ JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
+ const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData,
+ bool bTakeOwnership)
+ : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
+ bTakeOwnership)
+ , m_bIsFreezed(false)
+ , m_pSender(pSender)
{
}
@@ -234,25 +252,30 @@ public:
m_bIsFreezed = false;
}
- virtual void sendUpdate(VclPtr<vcl::Window> pWindow) override
+ void sendClose()
+ {
+ if (m_pSender)
+ m_pSender->sendClose();
+ }
+
+ void sendUpdate(VclPtr<vcl::Window> pWindow)
{
- if (!m_bIsFreezed)
- JSDialogSender::sendUpdate(pWindow);
+ if (!m_bIsFreezed && m_pSender)
+ m_pSender->sendUpdate(pWindow);
}
- virtual void notifyDialogState(bool bForce = false) override
+ void notifyDialogState(bool bForce = false)
{
- if (!m_bIsFreezed || bForce)
- JSDialogSender::notifyDialogState(bForce);
+ if ((!m_bIsFreezed || bForce) && m_pSender)
+ m_pSender->notifyDialogState(bForce);
}
};
class JSDialog : public JSWidget<SalInstanceDialog, ::Dialog>
{
public:
- JSDialog(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override;
virtual void undo_collapse() override;
@@ -262,34 +285,31 @@ public:
class JSLabel : public JSWidget<SalInstanceLabel, FixedText>
{
public:
- JSLabel(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_label(const OUString& rText) override;
};
class JSButton : public JSWidget<SalInstanceButton, ::Button>
{
public:
- JSButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
};
class JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
{
public:
- JSEntry(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, ::Edit* pEntry,
- SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON);
+ JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_text(const OUString& rText) override;
};
class JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
{
public:
- JSListBox(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ListBox* pListBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface) override;
virtual void remove(int pos) override;
@@ -299,9 +319,8 @@ public:
class JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
{
public:
- JSComboBox(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface) override;
virtual void remove(int pos) override;
@@ -312,9 +331,8 @@ public:
class JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl>
{
public:
- JSNotebook(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::TabControl* pControl, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_current_page(int nPage) override;
@@ -328,18 +346,20 @@ public:
class JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField>
{
public:
- JSSpinButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_value(int value) override;
};
-class JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender
+class JSMessageDialog : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
{
+ std::unique_ptr<JSDialogSender> m_pOwnedSender;
+
public:
- JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> aContentWindow,
- SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+ JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
+ JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
virtual void set_primary_text(const OUString& rText) override;
@@ -349,19 +369,18 @@ public:
class JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox>
{
public:
- JSCheckButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_active(bool active) override;
};
-class JSDrawingArea : public SalInstanceDrawingArea, public JSDialogSender
+class JSDrawingArea : public JSWidget<SalInstanceDrawingArea, VclDrawingArea>
{
public:
- JSDrawingArea(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder, const a11yref& rAlly,
- FactoryFunction pUITestFactoryFunction, void* pUserData, std::string sTypeOfJSON);
+ JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
+ SalInstanceBuilder* pBuilder, const a11yref& rAlly,
+ FactoryFunction pUITestFactoryFunction, void* pUserData);
virtual void queue_draw() override;
virtual void queue_draw_area(int x, int y, int width, int height) override;
@@ -370,9 +389,8 @@ public:
class JSToolbar : public JSWidget<SalInstanceToolbar, ::ToolBox>
{
public:
- JSToolbar(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void signal_clicked(const OString& rIdent) override;
};
@@ -380,18 +398,16 @@ public:
class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
{
public:
- JSTextView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_text(const OUString& rText) override;
};
class JSTreeView : public JSWidget<SalInstanceTreeView, ::SvTabListBox>
{
public:
- JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
using SalInstanceTreeView::set_toggle;
/// pos is used differently here, it defines how many steps of iterator we need to perform to take entry
@@ -422,9 +438,8 @@ public:
class JSExpander : public JSWidget<SalInstanceExpander, ::VclExpander>
{
public:
- JSExpander(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON);
+ JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
virtual void set_expanded(bool bExpand) override;
};
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index df2d68e71c16..921552a7d32c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -297,6 +297,8 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
m_nWindowId = m_aParentDialog->GetLOKWindowId();
InsertWindowToMap(m_nWindowId);
}
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
// used for notebookbar
@@ -325,6 +327,8 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo
}
InsertWindowToMap(m_nWindowId);
}
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
// used for autofilter dropdown
@@ -347,6 +351,8 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo
m_nWindowId = m_aParentDialog->GetLOKWindowId();
InsertWindowToMap(m_nWindowId);
}
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
JSInstanceBuilder* JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent,
@@ -428,6 +434,8 @@ void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)
}
}
+const std::string& JSInstanceBuilder::GetTypeOfJSON() { return m_sTypeOfJSON; }
+
VclPtr<vcl::Window>& JSInstanceBuilder::GetContentWindow()
{
if (m_aContentWindow)
@@ -458,8 +466,7 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
m_xBuilder->drop_ownership(pDialog);
m_bHasTopLevelDialog = true;
- pRet.reset(
- new JSDialog(m_aOwnedToplevel, m_aOwnedToplevel, pDialog, this, false, m_sTypeOfJSON));
+ pRet.reset(new JSDialog(this, pDialog, this, false));
RememberWidget("__DIALOG__", pRet.get());
@@ -471,6 +478,8 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
aJsonWriter.put("id", m_aOwnedToplevel->GetLOKWindowId());
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aJsonWriter.extractData());
}
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
return pRet;
@@ -491,10 +500,12 @@ std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(cons
assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
m_aOwnedToplevel.set(pMessageDialog);
m_xBuilder->drop_ownership(pMessageDialog);
+ m_bHasTopLevelDialog = true;
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
- pRet.reset(pMessageDialog ? new JSMessageDialog(pMessageDialog, m_aOwnedToplevel, this, false)
- : nullptr);
+ pRet.reset(pMessageDialog ? new JSMessageDialog(this, pMessageDialog, this, false) : nullptr);
if (pRet)
RememberWidget("__DIALOG__", pRet.get());
@@ -505,8 +516,7 @@ std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(cons
std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id)
{
::FixedText* pLabel = m_xBuilder->get<FixedText>(id);
- auto pWeldWidget = std::make_unique<JSLabel>(GetNotifierWindow(), GetContentWindow(), pLabel,
- this, false, m_sTypeOfJSON);
+ auto pWeldWidget = std::make_unique<JSLabel>(this, pLabel, this, false);
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -517,9 +527,7 @@ std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id)
std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& id)
{
::Button* pButton = m_xBuilder->get<::Button>(id);
- auto pWeldWidget = pButton ? std::make_unique<JSButton>(GetNotifierWindow(), GetContentWindow(),
- pButton, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget = pButton ? std::make_unique<JSButton>(this, pButton, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -530,9 +538,7 @@ std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& id)
std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id)
{
Edit* pEntry = m_xBuilder->get<Edit>(id);
- auto pWeldWidget = pEntry ? std::make_unique<JSEntry>(GetNotifierWindow(), GetContentWindow(),
- pEntry, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget = pEntry ? std::make_unique<JSEntry>(this, pEntry, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -548,16 +554,12 @@ std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OString&
if (pComboBox)
{
- pWeldWidget = std::make_unique<JSComboBox>(GetNotifierWindow(), GetContentWindow(),
- pComboBox, this, false, m_sTypeOfJSON);
+ pWeldWidget = std::make_unique<JSComboBox>(this, pComboBox, this, false);
}
else
{
ListBox* pListBox = dynamic_cast<ListBox*>(pWidget);
- pWeldWidget = pListBox
- ? std::make_unique<JSListBox>(GetNotifierWindow(), GetContentWindow(),
- pListBox, this, false, m_sTypeOfJSON)
- : nullptr;
+ pWeldWidget = pListBox ? std::make_unique<JSListBox>(this, pListBox, this, false) : nullptr;
}
if (pWeldWidget)
@@ -569,10 +571,8 @@ std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OString&
std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString& id)
{
TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
- auto pWeldWidget = pNotebook
- ? std::make_unique<JSNotebook>(GetNotifierWindow(), GetContentWindow(),
- pNotebook, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pNotebook ? std::make_unique<JSNotebook>(this, pNotebook, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -583,10 +583,8 @@ std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString&
std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OString& id)
{
FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
- auto pWeldWidget = pSpinButton
- ? std::make_unique<JSSpinButton>(GetNotifierWindow(), GetContentWindow(),
- pSpinButton, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pSpinButton ? std::make_unique<JSSpinButton>(this, pSpinButton, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -598,9 +596,7 @@ std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OS
{
CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
auto pWeldWidget
- = pCheckButton ? std::make_unique<JSCheckButton>(GetNotifierWindow(), GetContentWindow(),
- pCheckButton, this, false, m_sTypeOfJSON)
- : nullptr;
+ = pCheckButton ? std::make_unique<JSCheckButton>(this, pCheckButton, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -613,9 +609,8 @@ JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& rA11yImpl
FactoryFunction pUITestFactoryFunction, void* pUserData)
{
VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id);
- auto pWeldWidget = pArea ? std::make_unique<JSDrawingArea>(
- GetNotifierWindow(), GetContentWindow(), pArea, this, rA11yImpl,
- pUITestFactoryFunction, pUserData, m_sTypeOfJSON)
+ auto pWeldWidget = pArea ? std::make_unique<JSDrawingArea>(this, pArea, this, rA11yImpl,
+ pUITestFactoryFunction, pUserData)
: nullptr;
if (pWeldWidget)
@@ -627,10 +622,8 @@ JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& rA11yImpl
std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OString& id)
{
ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id);
- auto pWeldWidget = pToolBox
- ? std::make_unique<JSToolbar>(GetNotifierWindow(), GetContentWindow(),
- pToolBox, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pToolBox ? std::make_unique<JSToolbar>(this, pToolBox, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -641,10 +634,8 @@ std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OString& id
std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const OString& id)
{
VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id);
- auto pWeldWidget = pTextView
- ? std::make_unique<JSTextView>(GetNotifierWindow(), GetContentWindow(),
- pTextView, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pTextView ? std::make_unique<JSTextView>(this, pTextView, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -655,10 +646,8 @@ std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const OString&
std::unique_ptr<weld::TreeView> JSInstanceBuilder::weld_tree_view(const OString& id)
{
SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id);
- auto pWeldWidget = pTreeView
- ? std::make_unique<JSTreeView>(GetNotifierWindow(), GetContentWindow(),
- pTreeView, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pTreeView ? std::make_unique<JSTreeView>(this, pTreeView, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -669,10 +658,8 @@ std::unique_ptr<weld::TreeView> JSInstanceBuilder::weld_tree_view(const OString&
std::unique_ptr<weld::Expander> JSInstanceBuilder::weld_expander(const OString& id)
{
VclExpander* pExpander = m_xBuilder->get<VclExpander>(id);
- auto pWeldWidget = pExpander
- ? std::make_unique<JSExpander>(GetNotifierWindow(), GetContentWindow(),
- pExpander, this, false, m_sTypeOfJSON)
- : nullptr;
+ auto pWeldWidget
+ = pExpander ? std::make_unique<JSExpander>(this, pExpander, this, false) : nullptr;
if (pWeldWidget)
RememberWidget(id, pWeldWidget.get());
@@ -701,14 +688,12 @@ weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParen
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.get());
}
- return new JSMessageDialog(xMessageDialog, xMessageDialog, nullptr, true);
+ return new JSMessageDialog(xMessageDialog, nullptr, true);
}
-JSDialog::JSDialog(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceDialog, ::Dialog>(aNotifierWindow, aContentWindow, pDialog, pBuilder,
- bTakeOwnership, sTypeOfJSON)
+JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceDialog, ::Dialog>(pSender, pDialog, pBuilder, bTakeOwnership)
{
}
@@ -730,11 +715,9 @@ void JSDialog::response(int response)
SalInstanceDialog::response(response);
}
-JSLabel::JSLabel(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceLabel, FixedText>(aNotifierWindow, aContentWindow, pLabel, pBuilder,
- bTakeOwnership, sTypeOfJSON)
+JSLabel::JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceLabel, FixedText>(pSender, pLabel, pBuilder, bTakeOwnership)
{
}
@@ -744,19 +727,15 @@ void JSLabel::set_label(const OUString& rText)
notifyDialogState();
};
-JSButton::JSButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceButton, ::Button>(aNotifierWindow, aContentWindow, pButton, pBuilder,
- bTakeOwnership, sTypeOfJSON)
+JSButton::JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceButton, ::Button>(pSender, pButton, pBuilder, bTakeOwnership)
{
}
-JSEntry::JSEntry(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceEntry, ::Edit>(aNotifierWindow, aContentWindow, pEntry, pBuilder,
- bTakeOwnership, sTypeOfJSON)
+JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceEntry, ::Edit>(pSender, pEntry, pBuilder, bTakeOwnership)
{
}
@@ -766,11 +745,10 @@ void JSEntry::set_text(const OUString& rText)
notifyDialogState();
}
-JSListBox::JSListBox(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ListBox* pListBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>(aNotifierWindow, aContentWindow, pListBox,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSListBox::JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>(pSender, pListBox, pBuilder,
+ bTakeOwnership)
{
}
@@ -793,11 +771,10 @@ void JSListBox::set_active(int pos)
notifyDialogState();
}
-JSComboBox::JSComboBox(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>(aNotifierWindow, aContentWindow, pComboBox,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>(pSender, pComboBox, pBuilder,
+ bTakeOwnership)
{
}
@@ -826,11 +803,9 @@ void JSComboBox::set_active(int pos)
notifyDialogState();
}
-JSNotebook::JSNotebook(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::TabControl* pControl, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceNotebook, ::TabControl>(aNotifierWindow, aContentWindow, pControl,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceNotebook, ::TabControl>(pSender, pControl, pBuilder, bTakeOwnership)
{
}
@@ -868,11 +843,9 @@ void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int
notifyDialogState();
}
-JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::FormattedField* pSpin, SalInstanceBuilder* pBuilder,
- bool bTakeOwnership, std::string sTypeOfJSON)
- : JSWidget<SalInstanceSpinButton, ::FormattedField>(aNotifierWindow, aContentWindow, pSpin,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, bTakeOwnership)
{
}
@@ -882,11 +855,20 @@ void JSSpinButton::set_value(int value)
notifyDialogState(true); // if input is limited we can receive the same JSON
}
-JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> aContentWindow,
+JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
- : SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership)
- , JSDialogSender(m_xMessageDialog, aContentWindow, "dialog")
+ : JSWidget<SalInstanceMessageDialog, ::MessageDialog>(pSender, pDialog, pBuilder,
+ bTakeOwnership)
+{
+}
+
+JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceMessageDialog, ::MessageDialog>(nullptr, pDialog, pBuilder,
+ bTakeOwnership)
+ , m_pOwnedSender(new JSDialogSender(pDialog, pDialog, "dialog"))
{
+ m_pSender = m_pOwnedSender.get();
}
void JSMessageDialog::set_primary_text(const OUString& rText)
@@ -901,12 +883,9 @@ void JSMessageDialog::set_secondary_text(const OUString& rText)
notifyDialogState();
}
-JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aNotifierWindow,
- VclPtr<vcl::Window> aContentWindow, ::CheckBox* pCheckBox,
- SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceCheckButton, ::CheckBox>(aNotifierWindow, aContentWindow, pCheckBox,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership)
{
}
@@ -916,14 +895,11 @@ void JSCheckButton::set_active(bool active)
notifyDialogState();
}
-JSDrawingArea::JSDrawingArea(VclPtr<vcl::Window> aNotifierWindow,
- VclPtr<vcl::Window> aContentWindow, VclDrawingArea* pDrawingArea,
+JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
SalInstanceBuilder* pBuilder, const a11yref& rAlly,
- FactoryFunction pUITestFactoryFunction, void* pUserData,
- std::string sTypeOfJSON)
- : SalInstanceDrawingArea(pDrawingArea, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
- false)
- , JSDialogSender(aNotifierWindow, aContentWindow, sTypeOfJSON)
+ FactoryFunction pUITestFactoryFunction, void* pUserData)
+ : JSWidget<SalInstanceDrawingArea, VclDrawingArea>(pSender, pDrawingArea, pBuilder, rAlly,
+ pUITestFactoryFunction, pUserData, false)
{
}
@@ -939,11 +915,9 @@ void JSDrawingArea::queue_draw_area(int x, int y, int width, int height)
notifyDialogState();
}
-JSToolbar::JSToolbar(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceToolbar, ::ToolBox>(aNotifierWindow, aContentWindow, pToolbox, pBuilder,
- bTakeOwnership, sTypeOfJSON)
+JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : JSWidget<SalInstanceToolbar, ::ToolBox>(pSender, pToolbox, pBuilder, bTakeOwnership)
{
}
@@ -953,11 +927,10 @@ void JSToolbar::signal_clicked(const OString& rIdent)
notifyDialogState();
}
-JSTextView::JSTextView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
- bool bTakeOwnership, std::string sTypeOfJSON)
- : JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(aNotifierWindow, aContentWindow, pTextView,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder,
+ bTakeOwnership)
{
}
@@ -967,11 +940,9 @@ void JSTextView::set_text(const OUString& rText)
notifyDialogState();
}
-JSTreeView::JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceTreeView, ::SvTabListBox>(aNotifierWindow, aContentWindow, pTreeView,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSTreeView::JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTreeView,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceTreeView, ::SvTabListBox>(pSender, pTreeView, pBuilder, bTakeOwnership)
{
}
@@ -1073,11 +1044,9 @@ void JSTreeView::collapse_row(const weld::TreeIter& rIter)
sendUpdate(m_xTreeView);
}
-JSExpander::JSExpander(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
- ::VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
- std::string sTypeOfJSON)
- : JSWidget<SalInstanceExpander, ::VclExpander>(aNotifierWindow, aContentWindow, pExpander,
- pBuilder, bTakeOwnership, sTypeOfJSON)
+JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceExpander, ::VclExpander>(pSender, pExpander, pBuilder, bTakeOwnership)
{
}
commit 859cc731b18f8483db9e9ec09cb8e990f3ecd8fd
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 30 09:57:00 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:10:49 2021 +0200
jsdialog: support for freeze/thaw
Change-Id: Ia3ca2c3c06a95e295e400780540c176cd9606ee7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108498
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 756f9d34767a..2df2aaeb3ad1 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -69,9 +69,11 @@ public:
{
}
- void notifyDialogState(bool bForce = false);
+ virtual ~JSDialogSender() = default;
+
+ virtual void notifyDialogState(bool bForce = false);
void sendClose();
- void sendUpdate(VclPtr<vcl::Window> pWindow);
+ virtual void sendUpdate(VclPtr<vcl::Window> pWindow);
};
class JSDropTarget final
@@ -181,6 +183,7 @@ class JSWidget : public BaseInstanceClass, public JSDialogSender
{
protected:
rtl::Reference<JSDropTarget> m_xDropTarget;
+ bool m_bIsFreezed;
public:
JSWidget(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
@@ -188,6 +191,7 @@ public:
std::string sTypeOfJSON)
: BaseInstanceClass(pObject, pBuilder, bTakeOwnership)
, JSDialogSender(aNotifierWindow, aContentWindow, sTypeOfJSON)
+ , m_bIsFreezed(false)
{
}
@@ -217,6 +221,30 @@ public:
return m_xDropTarget.get();
}
+
+ virtual void freeze() override
+ {
+ BaseInstanceClass::freeze();
+ m_bIsFreezed = true;
+ }
+
+ virtual void thaw() override
+ {
+ BaseInstanceClass::thaw();
+ m_bIsFreezed = false;
+ }
+
+ virtual void sendUpdate(VclPtr<vcl::Window> pWindow) override
+ {
+ if (!m_bIsFreezed)
+ JSDialogSender::sendUpdate(pWindow);
+ }
+
+ virtual void notifyDialogState(bool bForce = false) override
+ {
+ if (!m_bIsFreezed || bForce)
+ JSDialogSender::notifyDialogState(bForce);
+ }
};
class JSDialog : public JSWidget<SalInstanceDialog, ::Dialog>
commit 27f1750e1cc2795c24d63f7751a4203589d9fe26
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 12 16:10:58 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 18:24:08 2021 +0200
Move SalInstanceIconView decl to header file
Change-Id: I179f044b3db38ee51f539ef4023b136eac55f4ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108982
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109182
Tested-by: Jenkins
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 3c43c95c5cd9..34a301330ea8 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -27,6 +27,7 @@
#include <vcl/toolkit/svtabbx.hxx>
#include <vcl/toolkit/svlbitm.hxx>
#include <o3tl/sorted_vector.hxx>
+#include "iconview.hxx"
class SalInstanceBuilder : public weld::Builder
{
@@ -1699,4 +1700,62 @@ public:
virtual ~SalInstanceExpander() override;
};
+class SalInstanceIconView : public SalInstanceContainer, public virtual weld::IconView
+{
+private:
+ // owner for UserData
+ std::vector<std::unique_ptr<OUString>> m_aUserData;
+ VclPtr<::IconView> m_xIconView;
+
+ DECL_LINK(SelectHdl, SvTreeListBox*, void);
+ DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
+ DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
+
+public:
+ SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void freeze() override;
+
+ virtual void thaw() override;
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, weld::TreeIter* pRet) override;
+
+ virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+ const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
+
+ virtual OUString get_selected_id() const override;
+
+ virtual OUString get_selected_text() const override;
+
+ virtual int count_selected_items() const override;
+
+ virtual void select(int pos) override;
+
+ virtual void unselect(int pos) override;
+
+ virtual int n_children() const override;
+
+ virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
+ = nullptr) const override;
+
+ virtual bool get_selected(weld::TreeIter* pIter) const override;
+
+ virtual bool get_cursor(weld::TreeIter* pIter) const override;
+
+ virtual void set_cursor(const weld::TreeIter& rIter) override;
+
+ virtual bool get_iter_first(weld::TreeIter& rIter) const override;
+
+ virtual void scroll_to_item(const weld::TreeIter& rIter) override;
+
+ virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
+
+ virtual OUString get_id(const weld::TreeIter& rIter) const override;
+
+ virtual void clear() override;
+
+ virtual ~SalInstanceIconView() override;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 56c0f9dd3e40..555bc74a8553 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -22,7 +22,6 @@
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <o3tl/sorted_vector.hxx>
#include <officecfg/Office/Common.hxx>
-#include <iconview.hxx>
#include <salframe.hxx>
#include <salinst.hxx>
#include <salvd.hxx>
@@ -5021,264 +5020,252 @@ IMPL_LINK(SalInstanceTreeView, EditedEntryHdl, IterString, rIterString, bool)
iter_string(SalInstanceTreeIter(rIterString.first), rIterString.second));
}
-class SalInstanceIconView : public SalInstanceContainer, public virtual weld::IconView
+SalInstanceIconView::SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership)
+ : SalInstanceContainer(pIconView, pBuilder, bTakeOwnership)
+ , m_xIconView(pIconView)
{
-private:
- // owner for UserData
- std::vector<std::unique_ptr<OUString>> m_aUserData;
- VclPtr<::IconView> m_xIconView;
+ m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
+ m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
+ m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
+}
- DECL_LINK(SelectHdl, SvTreeListBox*, void);
- DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
- DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
+void SalInstanceIconView::freeze()
+{
+ SalInstanceWidget::freeze();
+ m_xIconView->SetUpdateMode(false);
+}
-public:
- SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
- : SalInstanceContainer(pIconView, pBuilder, bTakeOwnership)
- , m_xIconView(pIconView)
+void SalInstanceIconView::thaw()
+{
+ m_xIconView->SetUpdateMode(true);
+ SalInstanceWidget::thaw();
+}
+
+void SalInstanceIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, weld::TreeIter* pRet)
+{
+ disable_notify_events();
+ auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
+ void* pUserData;
+ if (pId)
{
- m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
- m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
- m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
+ m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
+ pUserData = m_aUserData.back().get();
}
+ else
+ pUserData = nullptr;
- virtual void freeze() override
+ SvTreeListEntry* pEntry = new SvTreeListEntry;
+ if (pIconName)
{
- SalInstanceWidget::freeze();
- m_xIconView->SetUpdateMode(false);
+ Image aImage(createImage(*pIconName));
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
}
-
- virtual void thaw() override
+ else
{
- m_xIconView->SetUpdateMode(true);
- SalInstanceWidget::thaw();
+ Image aDummy;
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
}
+ if (pStr)
+ pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
+ pEntry->SetUserData(pUserData);
+ m_xIconView->Insert(pEntry, nullptr, nInsertPos);
- virtual void insert(int pos, const OUString* pStr, const OUString* pId,
- const OUString* pIconName, weld::TreeIter* pRet) override
+ if (pRet)
{
- disable_notify_events();
- auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
- void* pUserData;
- if (pId)
- {
- m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
- pUserData = m_aUserData.back().get();
- }
- else
- pUserData = nullptr;
-
- SvTreeListEntry* pEntry = new SvTreeListEntry;
- if (pIconName)
- {
- Image aImage(createImage(*pIconName));
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
- }
- else
- {
- Image aDummy;
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
- }
- if (pStr)
- pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
- pEntry->SetUserData(pUserData);
- m_xIconView->Insert(pEntry, nullptr, nInsertPos);
+ SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
+ pVclRetIter->iter = pEntry;
+ }
- if (pRet)
- {
- SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
- pVclRetIter->iter = pEntry;
- }
+ enable_notify_events();
+}
- enable_notify_events();
+void SalInstanceIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+ const VirtualDevice* pIcon, weld::TreeIter* pRet)
+{
+ disable_notify_events();
+ auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
+ void* pUserData;
+ if (pId)
+ {
+ m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
+ pUserData = m_aUserData.back().get();
}
+ else
+ pUserData = nullptr;
- virtual void insert(int pos, const OUString* pStr, const OUString* pId,
- const VirtualDevice* pIcon, weld::TreeIter* pRet) override
+ SvTreeListEntry* pEntry = new SvTreeListEntry;
+ if (pIcon)
{
- disable_notify_events();
- auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
- void* pUserData;
- if (pId)
- {
- m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
- pUserData = m_aUserData.back().get();
- }
- else
- pUserData = nullptr;
-
- SvTreeListEntry* pEntry = new SvTreeListEntry;
- if (pIcon)
- {
- const Point aNull(0, 0);
- const Size aSize = pIcon->GetOutputSizePixel();
- Image aImage(pIcon->GetBitmapEx(aNull, aSize));
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
- }
- else
- {
- Image aDummy;
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
- }
- if (pStr)
- pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
- pEntry->SetUserData(pUserData);
- m_xIconView->Insert(pEntry, nullptr, nInsertPos);
-
- if (pRet)
- {
- SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
- pVclRetIter->iter = pEntry;
- }
-
- enable_notify_events();
+ const Point aNull(0, 0);
+ const Size aSize = pIcon->GetOutputSizePixel();
+ Image aImage(pIcon->GetBitmapEx(aNull, aSize));
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
}
-
- virtual OUString get_selected_id() const override
+ else
{
- assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
- if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
- {
- if (const OUString* pStr = static_cast<const OUString*>(pEntry->GetUserData()))
- return *pStr;
- }
- return OUString();
+ Image aDummy;
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
}
+ if (pStr)
+ pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
+ pEntry->SetUserData(pUserData);
+ m_xIconView->Insert(pEntry, nullptr, nInsertPos);
- virtual OUString get_selected_text() const override
+ if (pRet)
{
- assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
- if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
- return m_xIconView->GetEntryText(pEntry);
- return OUString();
+ SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
+ pVclRetIter->iter = pEntry;
}
- virtual int count_selected_items() const override { return m_xIconView->GetSelectionCount(); }
+ enable_notify_events();
+}
- virtual void select(int pos) override
+OUString SalInstanceIconView::get_selected_id() const
+{
+ assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
+ if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
{
- assert(m_xIconView->IsUpdateMode()
- && "don't select when frozen, select after thaw. Note selection doesn't survive a "
- "freeze");
- disable_notify_events();
- if (pos == -1 || (pos == 0 && n_children() == 0))
- m_xIconView->SelectAll(false);
- else
- {
- SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
- m_xIconView->Select(pEntry, true);
- m_xIconView->MakeVisible(pEntry);
- }
- enable_notify_events();
+ if (const OUString* pStr = static_cast<const OUString*>(pEntry->GetUserData()))
+ return *pStr;
}
+ return OUString();
+}
- virtual void unselect(int pos) override
- {
- assert(m_xIconView->IsUpdateMode()
- && "don't select when frozen, select after thaw. Note selection doesn't survive a "
- "freeze");
- disable_notify_events();
- if (pos == -1)
- m_xIconView->SelectAll(true);
- else
- {
- SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
- m_xIconView->Select(pEntry, false);
- }
- enable_notify_events();
- }
+OUString SalInstanceIconView::get_selected_text() const
+{
+ assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
+ if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
+ return m_xIconView->GetEntryText(pEntry);
+ return OUString();
+}
- virtual int n_children() const override
- {
- return m_xIconView->GetModel()->GetChildList(nullptr).size();
- }
+int SalInstanceIconView::count_selected_items() const { return m_xIconView->GetSelectionCount(); }
- virtual std::unique_ptr<weld::TreeIter>
- make_iterator(const weld::TreeIter* pOrig) const override
+void SalInstanceIconView::select(int pos)
+{
+ assert(m_xIconView->IsUpdateMode()
+ && "don't select when frozen, select after thaw. Note selection doesn't survive a "
+ "freeze");
+ disable_notify_events();
+ if (pos == -1 || (pos == 0 && n_children() == 0))
+ m_xIconView->SelectAll(false);
+ else
{
- return std::unique_ptr<weld::TreeIter>(
- new SalInstanceTreeIter(static_cast<const SalInstanceTreeIter*>(pOrig)));
+ SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
+ m_xIconView->Select(pEntry, true);
+ m_xIconView->MakeVisible(pEntry);
}
+ enable_notify_events();
+}
- virtual bool get_selected(weld::TreeIter* pIter) const override
+void SalInstanceIconView::unselect(int pos)
+{
+ assert(m_xIconView->IsUpdateMode()
+ && "don't select when frozen, select after thaw. Note selection doesn't survive a "
+ "freeze");
+ disable_notify_events();
+ if (pos == -1)
+ m_xIconView->SelectAll(true);
+ else
{
- SvTreeListEntry* pEntry = m_xIconView->FirstSelected();
- auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
- if (pVclIter)
- pVclIter->iter = pEntry;
- return pEntry != nullptr;
+ SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
+ m_xIconView->Select(pEntry, false);
}
+ enable_notify_events();
+}
- virtual bool get_cursor(weld::TreeIter* pIter) const override
- {
- SvTreeListEntry* pEntry = m_xIconView->GetCurEntry();
- auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
- if (pVclIter)
- pVclIter->iter = pEntry;
- return pEntry != nullptr;
- }
+int SalInstanceIconView::n_children() const
+{
+ return m_xIconView->GetModel()->GetChildList(nullptr).size();
+}
- virtual void set_cursor(const weld::TreeIter& rIter) override
- {
- const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
- disable_notify_events();
- m_xIconView->SetCurEntry(rVclIter.iter);
- enable_notify_events();
- }
+std::unique_ptr<weld::TreeIter>
+SalInstanceIconView::make_iterator(const weld::TreeIter* pOrig) const
+{
+ return std::unique_ptr<weld::TreeIter>(
+ new SalInstanceTreeIter(static_cast<const SalInstanceTreeIter*>(pOrig)));
+}
- virtual bool get_iter_first(weld::TreeIter& rIter) const override
- {
- SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
- rVclIter.iter = m_xIconView->GetEntry(0);
- return rVclIter.iter != nullptr;
- }
+bool SalInstanceIconView::get_selected(weld::TreeIter* pIter) const
+{
+ SvTreeListEntry* pEntry = m_xIconView->FirstSelected();
+ auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
+ if (pVclIter)
+ pVclIter->iter = pEntry;
+ return pEntry != nullptr;
+}
- virtual void scroll_to_item(const weld::TreeIter& rIter) override
- {
- assert(m_xIconView->IsUpdateMode()
- && "don't select when frozen, select after thaw. Note selection doesn't survive a "
- "freeze");
- disable_notify_events();
- const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
- m_xIconView->MakeVisible(rVclIter.iter);
- enable_notify_events();
- }
+bool SalInstanceIconView::get_cursor(weld::TreeIter* pIter) const
+{
+ SvTreeListEntry* pEntry = m_xIconView->GetCurEntry();
+ auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
+ if (pVclIter)
+ pVclIter->iter = pEntry;
+ return pEntry != nullptr;
+}
- virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
- {
- SalInstanceTreeIter aVclIter(m_xIconView->FirstSelected());
- while (aVclIter.iter)
- {
- if (func(aVclIter))
- return;
- aVclIter.iter = m_xIconView->NextSelected(aVclIter.iter);
- }
- }
+void SalInstanceIconView::set_cursor(const weld::TreeIter& rIter)
+{
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ disable_notify_events();
+ m_xIconView->SetCurEntry(rVclIter.iter);
+ enable_notify_events();
+}
- virtual OUString get_id(const weld::TreeIter& rIter) const override
- {
- const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
- const OUString* pStr = static_cast<const OUString*>(rVclIter.iter->GetUserData());
- if (pStr)
- return *pStr;
- return OUString();
- }
+bool SalInstanceIconView::get_iter_first(weld::TreeIter& rIter) const
+{
+ SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+ rVclIter.iter = m_xIconView->GetEntry(0);
+ return rVclIter.iter != nullptr;
+}
- virtual void clear() override
- {
- disable_notify_events();
- m_xIconView->Clear();
- m_aUserData.clear();
- enable_notify_events();
- }
+void SalInstanceIconView::scroll_to_item(const weld::TreeIter& rIter)
+{
+ assert(m_xIconView->IsUpdateMode()
+ && "don't select when frozen, select after thaw. Note selection doesn't survive a "
+ "freeze");
+ disable_notify_events();
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ m_xIconView->MakeVisible(rVclIter.iter);
+ enable_notify_events();
+}
- virtual ~SalInstanceIconView() override
+void SalInstanceIconView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
+{
+ SalInstanceTreeIter aVclIter(m_xIconView->FirstSelected());
+ while (aVclIter.iter)
{
- m_xIconView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
- m_xIconView->SetSelectHdl(Link<SvTreeListBox*, void>());
- m_xIconView->SetDeselectHdl(Link<SvTreeListBox*, void>());
+ if (func(aVclIter))
+ return;
+ aVclIter.iter = m_xIconView->NextSelected(aVclIter.iter);
}
-};
+}
+
+OUString SalInstanceIconView::get_id(const weld::TreeIter& rIter) const
+{
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ const OUString* pStr = static_cast<const OUString*>(rVclIter.iter->GetUserData());
+ if (pStr)
+ return *pStr;
+ return OUString();
+}
+
+void SalInstanceIconView::clear()
+{
+ disable_notify_events();
+ m_xIconView->Clear();
+ m_aUserData.clear();
+ enable_notify_events();
+}
+
+SalInstanceIconView::~SalInstanceIconView()
+{
+ m_xIconView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
+ m_xIconView->SetSelectHdl(Link<SvTreeListBox*, void>());
+ m_xIconView->SetDeselectHdl(Link<SvTreeListBox*, void>());
+}
IMPL_LINK_NOARG(SalInstanceIconView, SelectHdl, SvTreeListBox*, void)
{
More information about the Libreoffice-commits
mailing list