/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr aNotifierWindow, VclPtr aContentWindow, std::string sTypeOfJSON) : Idle("JSDialog notify") , m_aNotifierWindow(aNotifierWindow) , m_aContentWindow(aContentWindow) , m_sTypeOfJSON(sTypeOfJSON) , m_LastNotificationMessage() , m_bForce(false) { SetPriority(TaskPriority::POST_PAINT); } void JSDialogNotifyIdle::ForceUpdate() { m_bForce = true; } void JSDialogNotifyIdle::Invoke() { if (!m_aNotifierWindow) return; const vcl::ILibreOfficeKitNotifier* pNotifier = m_aNotifierWindow->GetLOKNotifier(); if (pNotifier) { tools::JsonWriter aJsonWriter; m_aContentWindow->DumpAsPropertyTree(aJsonWriter); aJsonWriter.put("id", m_aNotifierWindow->GetLOKWindowId()); aJsonWriter.put("jsontype", m_sTypeOfJSON); if (m_sTypeOfJSON == "autofilter") { vcl::Window* pWindow = m_aContentWindow.get(); DockingWindow* pDockingWIndow = dynamic_cast(pWindow); while (pWindow && !pDockingWIndow) { pWindow = pWindow->GetParent(); pDockingWIndow = dynamic_cast(pWindow); } if (pDockingWIndow) { Point aPos = pDockingWIndow->GetFloatingPos(); aJsonWriter.put("posx", aPos.getX()); aJsonWriter.put("posy", aPos.getY()); } } if (m_bForce || !aJsonWriter.isDataEquals(m_LastNotificationMessage)) { m_bForce = false; m_LastNotificationMessage = aJsonWriter.extractAsStdString(); pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, m_LastNotificationMessage.c_str()); } } } void JSDialogSender::notifyDialogState(bool bForce) { if (bForce) mpIdleNotify->ForceUpdate(); mpIdleNotify->Start(); } namespace { vcl::Window* extract_sal_widget(weld::Widget* pParent) { SalInstanceWidget* pInstanceWidget = dynamic_cast(pParent); return pInstanceWidget ? pInstanceWidget->getWidget() : nullptr; } } // Drag and drop namespace { class JSDropTargetDropContext : public cppu::WeakImplHelper { public: JSDropTargetDropContext() {} // XDropTargetDropContext virtual void SAL_CALL acceptDrop(sal_Int8 /*dragOperation*/) override {} virtual void SAL_CALL rejectDrop() override {} virtual void SAL_CALL dropComplete(sal_Bool /*bSuccess*/) override {} }; } static JSTreeView* g_DragSource; JSDropTarget::JSDropTarget() : WeakComponentImplHelper(m_aMutex) { } void JSDropTarget::initialize(const css::uno::Sequence& /*rArgs*/) {} void JSDropTarget::addDropTargetListener( const css::uno::Reference& xListener) { ::osl::Guard<::osl::Mutex> aGuard(m_aMutex); m_aListeners.push_back(xListener); } void JSDropTarget::removeDropTargetListener( const css::uno::Reference& xListener) { ::osl::Guard<::osl::Mutex> aGuard(m_aMutex); m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), xListener), m_aListeners.end()); } sal_Bool JSDropTarget::isActive() { return false; } void JSDropTarget::setActive(sal_Bool /*active*/) {} sal_Int8 JSDropTarget::getDefaultActions() { return 0; } void JSDropTarget::setDefaultActions(sal_Int8 /*actions*/) {} OUString JSDropTarget::getImplementationName() { return "com.sun.star.datatransfer.dnd.JSDropTarget"; } sal_Bool JSDropTarget::supportsService(OUString const& ServiceName) { return cppu::supportsService(this, ServiceName); } css::uno::Sequence JSDropTarget::getSupportedServiceNames() { css::uno::Sequence aRet{ "com.sun.star.datatransfer.dnd.JSDropTarget" }; return aRet; } void JSDropTarget::fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde) { osl::ClearableGuard aGuard(m_aMutex); std::vector> aListeners( m_aListeners); aGuard.clear(); for (auto const& listener : aListeners) { listener->drop(dtde); } } void JSDropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde) { osl::ClearableGuard<::osl::Mutex> aGuard(m_aMutex); std::vector> aListeners( m_aListeners); aGuard.clear(); for (auto const& listener : aListeners) { listener->dragEnter(dtde); } } // used for dialogs JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) : SalInstanceBuilder(extract_sal_widget(pParent), rUIRoot, rUIFile) , m_nWindowId(0) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) , m_sTypeOfJSON("dialog") , m_bHasTopLevelDialog(false) , m_bIsNotebookbar(false) { vcl::Window* pRoot = m_xBuilder->get_widget_root(); if (pRoot && pRoot->GetParent()) { m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); if (m_aParentDialog) m_nWindowId = m_aParentDialog->GetLOKWindowId(); InsertWindowToMap(m_nWindowId); } } // used for notebookbar JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, const css::uno::Reference& rFrame, sal_uInt64 nWindowId) : SalInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame) , m_nWindowId(0) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) , m_sTypeOfJSON("notebookbar") , m_bHasTopLevelDialog(false) , m_bIsNotebookbar(false) { vcl::Window* pRoot = m_xBuilder->get_widget_root(); if (pRoot && pRoot->GetParent()) { m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); if (m_aParentDialog) m_nWindowId = m_aParentDialog->GetLOKWindowId(); if (!m_nWindowId && nWindowId) { m_nWindowId = nWindowId; m_bIsNotebookbar = true; } InsertWindowToMap(m_nWindowId); } } // used for autofilter dropdown JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile) : SalInstanceBuilder(pParent, rUIRoot, rUIFile) , m_nWindowId(0) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) , m_sTypeOfJSON("autofilter") , m_bHasTopLevelDialog(false) , m_bIsNotebookbar(false) { vcl::Window* pRoot = m_xBuilder->get_widget_root(); m_aContentWindow = pParent; if (pRoot && pRoot->GetParent()) { m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); if (m_aParentDialog) m_nWindowId = m_aParentDialog->GetLOKWindowId(); InsertWindowToMap(m_nWindowId); } } JSInstanceBuilder* JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { return new JSInstanceBuilder(pParent, rUIRoot, rUIFile); } JSInstanceBuilder* JSInstanceBuilder::CreateNotebookbarBuilder( vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, const css::uno::Reference& rFrame, sal_uInt64 nWindowId) { return new JSInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame, nWindowId); } JSInstanceBuilder* JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile) { return new JSInstanceBuilder(pParent, rUIRoot, rUIFile); } JSInstanceBuilder::~JSInstanceBuilder() { if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar)) { GetLOKWeldWidgetsMap().erase(m_nWindowId); } else { auto it = GetLOKWeldWidgetsMap().find(m_nWindowId); if (it != GetLOKWeldWidgetsMap().end()) { std::for_each(m_aRememberedWidgets.begin(), m_aRememberedWidgets.end(), [it](std::string& sId) { it->second.erase(sId.c_str()); }); } } } std::map& JSInstanceBuilder::GetLOKWeldWidgetsMap() { // Map to remember the LOKWindowId <-> weld widgets binding. static std::map s_aLOKWeldBuildersMap; return s_aLOKWeldBuildersMap; } weld::Widget* JSInstanceBuilder::FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget) { const auto it = GetLOKWeldWidgetsMap().find(nWindowId); if (it != GetLOKWeldWidgetsMap().end()) { auto widgetIt = it->second.find(rWidget); if (widgetIt != it->second.end()) return widgetIt->second; } return nullptr; } void JSInstanceBuilder::InsertWindowToMap(sal_uInt64 nWindowId) { WidgetMap map; auto it = GetLOKWeldWidgetsMap().find(nWindowId); if (it == GetLOKWeldWidgetsMap().end()) GetLOKWeldWidgetsMap().insert(std::map::value_type(nWindowId, map)); } void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget) { auto it = GetLOKWeldWidgetsMap().find(m_nWindowId); if (it != GetLOKWeldWidgetsMap().end()) { it->second.erase(id); it->second.insert(WidgetMap::value_type(id, pWidget)); m_aRememberedWidgets.push_back(id.getStr()); } } VclPtr& JSInstanceBuilder::GetContentWindow() { if (m_aContentWindow) return m_aContentWindow; else return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog; } VclPtr& JSInstanceBuilder::GetNotifierWindow() { return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog; } std::unique_ptr JSInstanceBuilder::weld_dialog(const OString& id) { ::Dialog* pDialog = m_xBuilder->get<::Dialog>(id); m_nWindowId = pDialog->GetLOKWindowId(); InsertWindowToMap(m_nWindowId); std::unique_ptr pRet(pDialog ? new JSDialog(m_aOwnedToplevel, m_aOwnedToplevel, pDialog, this, false, m_sTypeOfJSON) : nullptr); RememberWidget("__DIALOG__", pRet.get()); if (pDialog) { assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); m_aOwnedToplevel.set(pDialog); m_xBuilder->drop_ownership(pDialog); m_bHasTopLevelDialog = true; } const vcl::ILibreOfficeKitNotifier* pNotifier = pDialog->GetLOKNotifier(); if (pNotifier) { tools::JsonWriter aJsonWriter; m_aOwnedToplevel->DumpAsPropertyTree(aJsonWriter); aJsonWriter.put("id", m_aOwnedToplevel->GetLOKWindowId()); pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aJsonWriter.extractData()); } return pRet; } std::unique_ptr JSInstanceBuilder::weld_label(const OString& id) { ::FixedText* pLabel = m_xBuilder->get(id); auto pWeldWidget = std::make_unique(GetNotifierWindow(), GetContentWindow(), pLabel, this, false, m_sTypeOfJSON); if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_button(const OString& id) { ::Button* pButton = m_xBuilder->get<::Button>(id); auto pWeldWidget = pButton ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pButton, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_entry(const OString& id) { Edit* pEntry = m_xBuilder->get(id); auto pWeldWidget = pEntry ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pEntry, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_combo_box(const OString& id) { vcl::Window* pWidget = m_xBuilder->get(id); ::ComboBox* pComboBox = dynamic_cast<::ComboBox*>(pWidget); std::unique_ptr pWeldWidget; if (pComboBox) { pWeldWidget = std::make_unique(GetNotifierWindow(), GetContentWindow(), pComboBox, this, false, m_sTypeOfJSON); } else { ListBox* pListBox = dynamic_cast(pWidget); pWeldWidget = pListBox ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pListBox, this, false, m_sTypeOfJSON) : nullptr; } if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_notebook(const OString& id) { TabControl* pNotebook = m_xBuilder->get(id); auto pWeldWidget = pNotebook ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pNotebook, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_spin_button(const OString& id) { FormattedField* pSpinButton = m_xBuilder->get(id); auto pWeldWidget = pSpinButton ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pSpinButton, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_check_button(const OString& id) { CheckBox* pCheckButton = m_xBuilder->get(id); auto pWeldWidget = pCheckButton ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pCheckButton, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& rA11yImpl, FactoryFunction pUITestFactoryFunction, void* pUserData) { VclDrawingArea* pArea = m_xBuilder->get(id); auto pWeldWidget = pArea ? std::make_unique( GetNotifierWindow(), GetContentWindow(), pArea, this, rA11yImpl, pUITestFactoryFunction, pUserData, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_toolbar(const OString& id) { ToolBox* pToolBox = m_xBuilder->get(id); auto pWeldWidget = pToolBox ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pToolBox, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_text_view(const OString& id) { VclMultiLineEdit* pTextView = m_xBuilder->get(id); auto pWeldWidget = pTextView ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pTextView, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_tree_view(const OString& id) { SvTabListBox* pTreeView = m_xBuilder->get(id); auto pWeldWidget = pTreeView ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pTreeView, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } std::unique_ptr JSInstanceBuilder::weld_expander(const OString& id) { VclExpander* pExpander = m_xBuilder->get(id); auto pWeldWidget = pExpander ? std::make_unique(GetNotifierWindow(), GetContentWindow(), pExpander, this, false, m_sTypeOfJSON) : nullptr; if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); return pWeldWidget; } weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage) { SalInstanceWidget* pParentInstance = dynamic_cast(pParent); SystemWindow* pParentWidget = pParentInstance ? pParentInstance->getSystemWindow() : nullptr; VclPtrInstance<::MessageDialog> xMessageDialog(pParentWidget, rPrimaryMessage, eMessageType, eButtonType); const vcl::ILibreOfficeKitNotifier* pNotifier = xMessageDialog->GetLOKNotifier(); if (pNotifier) { tools::JsonWriter aJsonWriter; xMessageDialog->DumpAsPropertyTree(aJsonWriter); aJsonWriter.put("id", xMessageDialog->GetLOKWindowId()); aJsonWriter.put("jsontype", "dialog"); std::unique_ptr message(aJsonWriter.extractData()); pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.get()); } return new JSMessageDialog(xMessageDialog, xMessageDialog, nullptr, true); } JSDialog::JSDialog(VclPtr aNotifierWindow, VclPtr aContentWindow, ::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pDialog, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSDialog::collapse(weld::Widget* pEdit, weld::Widget* pButton) { SalInstanceDialog::collapse(pEdit, pButton); notifyDialogState(); } void JSDialog::undo_collapse() { SalInstanceDialog::undo_collapse(); notifyDialogState(); } JSLabel::JSLabel(VclPtr aNotifierWindow, VclPtr aContentWindow, FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pLabel, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSLabel::set_label(const OUString& rText) { SalInstanceLabel::set_label(rText); notifyDialogState(); }; JSButton::JSButton(VclPtr aNotifierWindow, VclPtr aContentWindow, ::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pButton, pBuilder, bTakeOwnership, sTypeOfJSON) { } JSEntry::JSEntry(VclPtr aNotifierWindow, VclPtr aContentWindow, ::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pEntry, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSEntry::set_text(const OUString& rText) { SalInstanceEntry::set_text(rText); notifyDialogState(); } JSListBox::JSListBox(VclPtr aNotifierWindow, VclPtr aContentWindow, ::ListBox* pListBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pListBox, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSListBox::insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) { SalInstanceComboBoxWithoutEdit::insert(pos, rStr, pId, pIconName, pImageSurface); notifyDialogState(); } void JSListBox::remove(int pos) { SalInstanceComboBoxWithoutEdit::remove(pos); notifyDialogState(); } void JSListBox::set_active(int pos) { SalInstanceComboBoxWithoutEdit::set_active(pos); notifyDialogState(); } JSComboBox::JSComboBox(VclPtr aNotifierWindow, VclPtr aContentWindow, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pComboBox, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSComboBox::insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) { SalInstanceComboBoxWithEdit::insert(pos, rStr, pId, pIconName, pImageSurface); notifyDialogState(); } void JSComboBox::remove(int pos) { SalInstanceComboBoxWithEdit::remove(pos); notifyDialogState(); } void JSComboBox::set_entry_text(const OUString& rText) { SalInstanceComboBoxWithEdit::set_entry_text(rText); notifyDialogState(); } void JSComboBox::set_active(int pos) { SalInstanceComboBoxWithEdit::set_active(pos); notifyDialogState(); } JSNotebook::JSNotebook(VclPtr aNotifierWindow, VclPtr aContentWindow, ::TabControl* pControl, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pControl, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSNotebook::set_current_page(int nPage) { bool bForce = false; int nCurrent = get_current_page(); if (nCurrent == nPage) bForce = true; SalInstanceNotebook::set_current_page(nPage); notifyDialogState(bForce); } void JSNotebook::set_current_page(const OString& rIdent) { bool bForce = false; OString sCurrent = get_current_page_ident(); if (sCurrent == rIdent) bForce = true; SalInstanceNotebook::set_current_page(rIdent); notifyDialogState(bForce); } void JSNotebook::remove_page(const OString& rIdent) { SalInstanceNotebook::remove_page(rIdent); notifyDialogState(); } void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int nPos) { SalInstanceNotebook::insert_page(rIdent, rLabel, nPos); notifyDialogState(); } JSSpinButton::JSSpinButton(VclPtr aNotifierWindow, VclPtr aContentWindow, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pSpin, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSSpinButton::set_value(int value) { SalInstanceSpinButton::set_value(value); notifyDialogState(); } JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, VclPtr aContentWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership) , JSDialogSender(m_xMessageDialog, aContentWindow, "dialog") { } void JSMessageDialog::set_primary_text(const OUString& rText) { SalInstanceMessageDialog::set_primary_text(rText); notifyDialogState(); } void JSMessageDialog::set_secondary_text(const OUString& rText) { SalInstanceMessageDialog::set_secondary_text(rText); notifyDialogState(); } JSCheckButton::JSCheckButton(VclPtr aNotifierWindow, VclPtr aContentWindow, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pCheckBox, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSCheckButton::set_active(bool active) { SalInstanceCheckButton::set_active(active); notifyDialogState(); } JSDrawingArea::JSDrawingArea(VclPtr aNotifierWindow, VclPtr aContentWindow, 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) { } void JSDrawingArea::queue_draw() { SalInstanceDrawingArea::queue_draw(); notifyDialogState(); } void JSDrawingArea::queue_draw_area(int x, int y, int width, int height) { SalInstanceDrawingArea::queue_draw_area(x, y, width, height); notifyDialogState(); } JSToolbar::JSToolbar(VclPtr aNotifierWindow, VclPtr aContentWindow, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pToolbox, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSToolbar::signal_clicked(const OString& rIdent) { SalInstanceToolbar::signal_clicked(rIdent); notifyDialogState(); } JSTextView::JSTextView(VclPtr aNotifierWindow, VclPtr aContentWindow, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pTextView, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSTextView::set_text(const OUString& rText) { SalInstanceTextView::set_text(rText); notifyDialogState(); } JSTreeView::JSTreeView(VclPtr aNotifierWindow, VclPtr aContentWindow, ::SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pTreeView, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSTreeView::set_toggle(int pos, TriState eState, int col) { SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0); while (pEntry && pos--) pEntry = m_xTreeView->Next(pEntry); if (pEntry) { SalInstanceTreeView::set_toggle(pEntry, eState, col); signal_toggled(iter_col(SalInstanceTreeIter(pEntry), col)); notifyDialogState(); } } void JSTreeView::select(int pos) { assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); disable_notify_events(); if (pos == -1 || (pos == 0 && n_children() == 0)) m_xTreeView->SelectAll(false); else { SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0); while (pEntry && pos--) pEntry = m_xTreeView->Next(pEntry); if (pEntry) { m_xTreeView->Select(pEntry, true); m_xTreeView->MakeVisible(pEntry); } } enable_notify_events(); } weld::TreeView* JSTreeView::get_drag_source() const { return g_DragSource; } void JSTreeView::drag_start() { g_DragSource = this; } void JSTreeView::drag_end() { css::datatransfer::dnd::XDropTarget* xDropTarget = m_xDropTarget.get(); if (xDropTarget) { css::datatransfer::dnd::DropTargetDropEvent aEvent; aEvent.Source = xDropTarget; aEvent.Context = new JSDropTargetDropContext(); // dummy values aEvent.LocationX = 50; aEvent.LocationY = 50; aEvent.DropAction = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; m_xDropTarget->fire_drop(aEvent); notifyDialogState(); } g_DragSource = nullptr; } JSExpander::JSExpander(VclPtr aNotifierWindow, VclPtr aContentWindow, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) : JSWidget(aNotifierWindow, aContentWindow, pExpander, pBuilder, bTakeOwnership, sTypeOfJSON) { } void JSExpander::set_expanded(bool bExpand) { SalInstanceExpander::set_expanded(bExpand); notifyDialogState(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */