/src/libreoffice/vcl/jsdialog/jsdialogbuilder.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #include <jsdialog/jsdialogbuilder.hxx> |
11 | | #include <sal/log.hxx> |
12 | | #include <iconview.hxx> |
13 | | #include <vcl/menu.hxx> |
14 | | #include <vcl/svapp.hxx> |
15 | | #include <vcl/toolbox.hxx> |
16 | | #include <vcl/toolkit/button.hxx> |
17 | | #include <vcl/toolkit/combobox.hxx> |
18 | | #include <vcl/toolkit/dialog.hxx> |
19 | | #include <vcl/toolkit/treelistentry.hxx> |
20 | | #include <vcl/toolkit/vclmedit.hxx> |
21 | | #include <verticaltabctrl.hxx> |
22 | | #include <messagedialog.hxx> |
23 | | #include <tools/json_writer.hxx> |
24 | | #include <memory> |
25 | | #include <vcl/jsdialog/executor.hxx> |
26 | | #include <cppuhelper/supportsservice.hxx> |
27 | | |
28 | | #include <wizdlg.hxx> |
29 | | #include <jsdialog/enabled.hxx> |
30 | | |
31 | | namespace |
32 | | { |
33 | | void response_help(vcl::Window* pWindow) |
34 | 0 | { |
35 | 0 | ::Dialog* pDialog = dynamic_cast<::Dialog*>(pWindow); |
36 | 0 | if (!pDialog) |
37 | 0 | return; |
38 | | |
39 | 0 | vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP); |
40 | 0 | ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow); |
41 | 0 | if (!pButton) |
42 | 0 | { |
43 | | // Is it a wizard dialog? |
44 | 0 | vcl::RoadmapWizard* pWizard = dynamic_cast<vcl::RoadmapWizard*>(pWindow); |
45 | 0 | if (!pWizard || !pWizard->m_pHelp) |
46 | 0 | return; |
47 | 0 | pWizard->m_pHelp->Click(); |
48 | 0 | return; |
49 | 0 | } |
50 | | |
51 | 0 | pButton->Click(); |
52 | 0 | } |
53 | | } |
54 | | |
55 | | namespace |
56 | | { |
57 | | vcl::Window* extract_sal_widget(weld::Widget* pParent) |
58 | 0 | { |
59 | 0 | SalInstanceWidget* pInstanceWidget = dynamic_cast<SalInstanceWidget*>(pParent); |
60 | 0 | return pInstanceWidget ? pInstanceWidget->getWidget() : nullptr; |
61 | 0 | } |
62 | | } |
63 | | |
64 | | // Drag and drop |
65 | | |
66 | | namespace |
67 | | { |
68 | | class JSDropTargetDropContext |
69 | | : public cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDropContext> |
70 | | { |
71 | | public: |
72 | 0 | JSDropTargetDropContext() {} |
73 | | |
74 | | // XDropTargetDropContext |
75 | 0 | virtual void SAL_CALL acceptDrop(sal_Int8 /*dragOperation*/) override {} |
76 | | |
77 | 0 | virtual void SAL_CALL rejectDrop() override {} |
78 | | |
79 | 0 | virtual void SAL_CALL dropComplete(sal_Bool /*bSuccess*/) override {} |
80 | | }; |
81 | | } |
82 | | |
83 | | static JSTreeView* g_DragSource; |
84 | | |
85 | 0 | JSDropTarget::JSDropTarget() {}Unexecuted instantiation: JSDropTarget::JSDropTarget() Unexecuted instantiation: JSDropTarget::JSDropTarget() |
86 | | |
87 | 0 | void JSDropTarget::initialize(const css::uno::Sequence<css::uno::Any>& /*rArgs*/) {} |
88 | | |
89 | | void JSDropTarget::addDropTargetListener( |
90 | | const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener) |
91 | 0 | { |
92 | 0 | std::unique_lock aGuard(m_aMutex); |
93 | |
|
94 | 0 | m_aListeners.push_back(xListener); |
95 | 0 | } |
96 | | |
97 | | void JSDropTarget::removeDropTargetListener( |
98 | | const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener) |
99 | 0 | { |
100 | 0 | std::unique_lock aGuard(m_aMutex); |
101 | |
|
102 | 0 | std::erase(m_aListeners, xListener); |
103 | 0 | } |
104 | | |
105 | 0 | sal_Bool JSDropTarget::isActive() { return false; } |
106 | | |
107 | 0 | void JSDropTarget::setActive(sal_Bool /*active*/) {} |
108 | | |
109 | 0 | sal_Int8 JSDropTarget::getDefaultActions() { return 0; } |
110 | | |
111 | 0 | void JSDropTarget::setDefaultActions(sal_Int8 /*actions*/) {} |
112 | | |
113 | | OUString JSDropTarget::getImplementationName() |
114 | 0 | { |
115 | 0 | return u"com.sun.star.datatransfer.dnd.JSDropTarget"_ustr; |
116 | 0 | } |
117 | | |
118 | | sal_Bool JSDropTarget::supportsService(OUString const& ServiceName) |
119 | 0 | { |
120 | 0 | return cppu::supportsService(this, ServiceName); |
121 | 0 | } |
122 | | |
123 | | css::uno::Sequence<OUString> JSDropTarget::getSupportedServiceNames() |
124 | 0 | { |
125 | 0 | css::uno::Sequence<OUString> aRet{ u"com.sun.star.datatransfer.dnd.JSDropTarget"_ustr }; |
126 | 0 | return aRet; |
127 | 0 | } |
128 | | |
129 | | void JSDropTarget::fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde) |
130 | 0 | { |
131 | 0 | std::unique_lock aGuard(m_aMutex); |
132 | 0 | std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners( |
133 | 0 | m_aListeners); |
134 | 0 | aGuard.unlock(); |
135 | |
|
136 | 0 | for (auto const& listener : aListeners) |
137 | 0 | { |
138 | 0 | listener->drop(dtde); |
139 | 0 | } |
140 | 0 | } |
141 | | |
142 | | void JSDropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde) |
143 | 0 | { |
144 | 0 | std::unique_lock aGuard(m_aMutex); |
145 | 0 | std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners( |
146 | 0 | m_aListeners); |
147 | 0 | aGuard.unlock(); |
148 | |
|
149 | 0 | for (auto const& listener : aListeners) |
150 | 0 | { |
151 | 0 | listener->dragEnter(dtde); |
152 | 0 | } |
153 | 0 | } |
154 | | |
155 | | void JSInstanceBuilder::initializeDialogSender() |
156 | 0 | { |
157 | 0 | m_sTypeOfJSON = "dialog"; |
158 | |
|
159 | 0 | vcl::Window* pRoot = m_xBuilder->get_widget_root(); |
160 | |
|
161 | 0 | if (pRoot && pRoot->GetParent()) |
162 | 0 | { |
163 | 0 | m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); |
164 | 0 | if (m_aParentDialog) |
165 | 0 | m_nWindowId = m_aParentDialog->GetLOKWindowId(); |
166 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
167 | 0 | } |
168 | |
|
169 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
170 | 0 | } |
171 | | |
172 | | void JSInstanceBuilder::initializePopupSender() |
173 | 0 | { |
174 | | // when it is a popup we initialize sender in weld_popover |
175 | 0 | m_sTypeOfJSON = "popup"; |
176 | 0 | } |
177 | | |
178 | | void JSInstanceBuilder::initializeSidebarSender(sal_uInt64 nLOKWindowId, |
179 | | const std::u16string_view& rUIFile, |
180 | | const std::u16string_view& sTypeOfJSON) |
181 | 0 | { |
182 | 0 | m_sTypeOfJSON = sTypeOfJSON; |
183 | 0 | m_nWindowId = nLOKWindowId; |
184 | |
|
185 | 0 | vcl::Window* pRoot = m_xBuilder->get_widget_root(); |
186 | |
|
187 | 0 | m_aParentDialog = pRoot->GetParentWithLOKNotifier(); |
188 | |
|
189 | 0 | bool bIsDockingWindow = jsdialog::isBuilderEnabledForNavigator(rUIFile) |
190 | 0 | || jsdialog::isBuilderEnabledForQuickFind(rUIFile); |
191 | | |
192 | | // builder for Panel, PanelLayout, and DockingWindow |
193 | | // get SidebarDockingWindow, or SwNavigatorWin as m_aContentWindow |
194 | | // A11YCheckLevel : 12 levels up from pRoot |
195 | | // PanelLayout : 9 levels up from pRoot |
196 | | // Panel : 7 levels up from pRoot |
197 | | // DockingWindow: 3 levels up from pRoot |
198 | 0 | unsigned nLevelsUp = 100; // limit |
199 | 0 | if (bIsDockingWindow) |
200 | 0 | nLevelsUp = 3; |
201 | |
|
202 | 0 | if (nLevelsUp > 0) |
203 | 0 | { |
204 | | // embedded fragments cannot send close message for whole sidebar |
205 | 0 | if (rUIFile == u"modules/simpress/ui/customanimationfragment.ui") |
206 | 0 | m_bCanClose = false; |
207 | |
|
208 | 0 | m_aContentWindow = pRoot; |
209 | 0 | for (unsigned i = 0; i < nLevelsUp && m_aContentWindow; i++) |
210 | 0 | { |
211 | 0 | if (!bIsDockingWindow && m_aContentWindow->get_id() == "Deck") |
212 | 0 | nLevelsUp = i + 3; |
213 | | |
214 | | // Useful to check if any panel doesn't appear |
215 | | // SAL _ DEBUG ("SIDEBAR CONTENT LOOK UP FROM: " << m_aContentWindow->get_id()); |
216 | 0 | m_aContentWindow = m_aContentWindow->GetParent(); |
217 | 0 | } |
218 | 0 | } |
219 | |
|
220 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
221 | |
|
222 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
223 | 0 | } |
224 | | |
225 | | void JSInstanceBuilder::initializeNotebookbarSender(sal_uInt64 nLOKWindowId) |
226 | 0 | { |
227 | 0 | m_sTypeOfJSON = "notebookbar"; |
228 | |
|
229 | 0 | vcl::Window* pRoot = m_xBuilder->get_widget_root(); |
230 | 0 | if (pRoot && pRoot->GetParent()) |
231 | 0 | { |
232 | 0 | m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); |
233 | 0 | if (m_aParentDialog) |
234 | 0 | m_nWindowId = m_aParentDialog->GetLOKWindowId(); |
235 | 0 | if (!m_nWindowId && nLOKWindowId) |
236 | 0 | { |
237 | 0 | m_nWindowId = nLOKWindowId; |
238 | 0 | m_bIsNotebookbar = true; |
239 | 0 | } |
240 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
241 | 0 | } |
242 | |
|
243 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
244 | 0 | } |
245 | | |
246 | | void JSInstanceBuilder::initializeFormulabarSender(sal_uInt64 nLOKWindowId, |
247 | | const std::u16string_view& sTypeOfJSON, |
248 | | vcl::Window* pVclParent) |
249 | 0 | { |
250 | 0 | m_sTypeOfJSON = sTypeOfJSON; |
251 | 0 | m_nWindowId = nLOKWindowId; |
252 | |
|
253 | 0 | vcl::Window* pRoot = m_xBuilder->get_widget_root(); |
254 | 0 | m_aContentWindow = pVclParent; |
255 | 0 | if (pRoot && pRoot->GetParent()) |
256 | 0 | { |
257 | 0 | m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier(); |
258 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
259 | 0 | } |
260 | |
|
261 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
262 | 0 | } |
263 | | |
264 | | void JSInstanceBuilder::initializeMenuSender(weld::Widget* pParent) |
265 | 0 | { |
266 | 0 | m_sTypeOfJSON = "menu"; |
267 | 0 | m_aParentDialog = extract_sal_widget(pParent)->GetParentWithLOKNotifier(); |
268 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
269 | 0 | } |
270 | | |
271 | | JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, vcl::Window* pVclParent, |
272 | | std::u16string_view rUIRoot, const OUString& rUIFile, |
273 | | JSInstanceBuilder::Type eBuilderType, sal_uInt64 nLOKWindowId, |
274 | | const std::u16string_view& sTypeOfJSON, |
275 | | const css::uno::Reference<css::frame::XFrame>& rFrame) |
276 | 0 | : SalInstanceBuilder(pVclParent ? pVclParent : extract_sal_widget(pParent), rUIRoot, rUIFile, |
277 | 0 | rFrame) |
278 | 0 | , m_nWindowId(0) |
279 | 0 | , m_aParentDialog(nullptr) |
280 | 0 | , m_aContentWindow(nullptr) |
281 | 0 | , m_sTypeOfJSON("unknown") |
282 | 0 | , m_bHasTopLevelDialog(false) |
283 | 0 | , m_bIsNotebookbar(false) |
284 | 0 | , m_bSentInitialUpdate(false) |
285 | 0 | , m_bIsNestedBuilder(false) |
286 | 0 | , m_aWindowToRelease(nullptr) |
287 | 0 | { |
288 | 0 | switch (eBuilderType) |
289 | 0 | { |
290 | 0 | case JSInstanceBuilder::Type::Dialog: |
291 | 0 | initializeDialogSender(); |
292 | 0 | break; |
293 | | |
294 | 0 | case JSInstanceBuilder::Type::Popup: |
295 | 0 | initializePopupSender(); |
296 | 0 | break; |
297 | | |
298 | 0 | case JSInstanceBuilder::Type::Sidebar: |
299 | 0 | initializeSidebarSender(nLOKWindowId, rUIFile, sTypeOfJSON); |
300 | 0 | break; |
301 | | |
302 | 0 | case JSInstanceBuilder::Type::Notebookbar: |
303 | 0 | initializeNotebookbarSender(nLOKWindowId); |
304 | 0 | break; |
305 | | |
306 | 0 | case JSInstanceBuilder::Type::Formulabar: |
307 | 0 | initializeFormulabarSender(nLOKWindowId, sTypeOfJSON, pVclParent); |
308 | 0 | break; |
309 | | |
310 | 0 | case JSInstanceBuilder::Type::Menu: |
311 | 0 | initializeMenuSender(pParent); |
312 | 0 | break; |
313 | | |
314 | 0 | default: |
315 | 0 | assert(false); |
316 | 0 | }; |
317 | 0 | } |
318 | | |
319 | | std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent, |
320 | | const OUString& rUIRoot, |
321 | | const OUString& rUIFile) |
322 | 0 | { |
323 | 0 | return std::make_unique<JSInstanceBuilder>(pParent, nullptr, rUIRoot, rUIFile, |
324 | 0 | JSInstanceBuilder::Type::Dialog); |
325 | 0 | } |
326 | | |
327 | | std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateNotebookbarBuilder( |
328 | | vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, |
329 | | const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId) |
330 | 0 | { |
331 | 0 | return std::make_unique<JSInstanceBuilder>(nullptr, pParent, rUIRoot, rUIFile, |
332 | 0 | JSInstanceBuilder::Type::Notebookbar, nWindowId, u"", |
333 | 0 | rFrame); |
334 | 0 | } |
335 | | |
336 | | std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent, |
337 | | const OUString& rUIRoot, |
338 | | const OUString& rUIFile, |
339 | | const OUString& jsonType, |
340 | | sal_uInt64 nLOKWindowId) |
341 | 0 | { |
342 | 0 | return std::make_unique<JSInstanceBuilder>(pParent, nullptr, rUIRoot, rUIFile, |
343 | 0 | JSInstanceBuilder::Type::Sidebar, nLOKWindowId, |
344 | 0 | jsonType); |
345 | 0 | } |
346 | | |
347 | | std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreatePopupBuilder(weld::Widget* pParent, |
348 | | const OUString& rUIRoot, |
349 | | const OUString& rUIFile) |
350 | 0 | { |
351 | 0 | return std::make_unique<JSInstanceBuilder>(pParent, nullptr, rUIRoot, rUIFile, |
352 | 0 | JSInstanceBuilder::Type::Popup); |
353 | 0 | } |
354 | | |
355 | | std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateMenuBuilder(weld::Widget* pParent, |
356 | | const OUString& rUIRoot, |
357 | | const OUString& rUIFile) |
358 | 0 | { |
359 | 0 | return std::make_unique<JSInstanceBuilder>(pParent, nullptr, rUIRoot, rUIFile, |
360 | 0 | JSInstanceBuilder::Type::Menu); |
361 | 0 | } |
362 | | |
363 | | std::unique_ptr<JSInstanceBuilder> |
364 | | JSInstanceBuilder::CreateFormulabarBuilder(vcl::Window* pParent, const OUString& rUIRoot, |
365 | | const OUString& rUIFile, sal_uInt64 nLOKWindowId) |
366 | 0 | { |
367 | 0 | return std::make_unique<JSInstanceBuilder>(nullptr, pParent, rUIRoot, rUIFile, |
368 | 0 | JSInstanceBuilder::Type::Formulabar, nLOKWindowId, |
369 | 0 | u"formulabar"); |
370 | 0 | } |
371 | | |
372 | | std::unique_ptr<JSInstanceBuilder> |
373 | | JSInstanceBuilder::CreateAddressInputBuilder(vcl::Window* pParent, const OUString& rUIRoot, |
374 | | const OUString& rUIFile, sal_uInt64 nLOKWindowId) |
375 | 0 | { |
376 | 0 | return std::make_unique<JSInstanceBuilder>(nullptr, pParent, rUIRoot, rUIFile, |
377 | 0 | JSInstanceBuilder::Type::Formulabar, nLOKWindowId, |
378 | 0 | u"addressinputfield"); |
379 | 0 | } |
380 | | |
381 | | JSInstanceBuilder::~JSInstanceBuilder() |
382 | 0 | { |
383 | | // tab page closed -> refresh parent window |
384 | 0 | if (m_bIsNestedBuilder && m_sTypeOfJSON == "dialog") |
385 | 0 | { |
386 | 0 | jsdialog::SendFullUpdate(OUString::number(m_nWindowId), u"__DIALOG__"_ustr); |
387 | 0 | } |
388 | |
|
389 | 0 | if (m_sTypeOfJSON == "popup" || m_sTypeOfJSON == "menu") |
390 | 0 | sendClosePopup(m_nWindowId); |
391 | |
|
392 | 0 | if (m_aWindowToRelease) |
393 | 0 | { |
394 | 0 | m_aWindowToRelease->ReleaseLOKNotifier(); |
395 | 0 | m_aWindowToRelease.reset(); |
396 | 0 | } |
397 | |
|
398 | 0 | if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar)) |
399 | 0 | { |
400 | 0 | JSInstanceBuilder::Widgets().Forget(getMapIdFromWindowId()); |
401 | 0 | } |
402 | 0 | else |
403 | 0 | { |
404 | 0 | auto aWindowMap = JSInstanceBuilder::Widgets().Find(getMapIdFromWindowId()); |
405 | 0 | if (aWindowMap) |
406 | 0 | { |
407 | 0 | std::for_each(m_aRememberedWidgets.begin(), m_aRememberedWidgets.end(), |
408 | 0 | [&aWindowMap](const OUString& sId) { aWindowMap->Forget(sId); }); |
409 | 0 | } |
410 | 0 | } |
411 | |
|
412 | 0 | JSInstanceBuilder::Popups().Forget(OUString::number(m_nWindowId)); |
413 | 0 | JSInstanceBuilder::Menus().Forget(OUString::number(m_nWindowId)); |
414 | 0 | } |
415 | | |
416 | 0 | const OUString& JSInstanceBuilder::GetTypeOfJSON() const { return m_sTypeOfJSON; } |
417 | | |
418 | | VclPtr<vcl::Window>& JSInstanceBuilder::GetContentWindow() |
419 | 0 | { |
420 | 0 | if (m_aContentWindow) |
421 | 0 | return m_aContentWindow; |
422 | 0 | else |
423 | 0 | return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog; |
424 | 0 | } |
425 | | |
426 | | VclPtr<vcl::Window>& JSInstanceBuilder::GetNotifierWindow() |
427 | 0 | { |
428 | 0 | return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog; |
429 | 0 | } |
430 | | |
431 | | std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OUString& id) |
432 | 0 | { |
433 | 0 | std::unique_ptr<weld::Dialog> pRet; |
434 | 0 | ::Dialog* pDialog = m_xBuilder->get<::Dialog>(id); |
435 | |
|
436 | 0 | if (pDialog) |
437 | 0 | { |
438 | 0 | if (!pDialog->GetLOKNotifier()) |
439 | 0 | pDialog->SetLOKNotifier(GetpApp()); |
440 | |
|
441 | 0 | m_nWindowId = pDialog->GetLOKWindowId(); |
442 | 0 | pDialog->SetLOKTunnelingState(false); |
443 | |
|
444 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
445 | |
|
446 | 0 | assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); |
447 | 0 | m_aOwnedToplevel.reset(pDialog); |
448 | 0 | m_xBuilder->drop_ownership(pDialog); |
449 | 0 | m_bHasTopLevelDialog = true; |
450 | |
|
451 | 0 | pRet.reset(new JSDialog(this, pDialog, this, false)); |
452 | |
|
453 | 0 | RememberWidget(u"__DIALOG__"_ustr, pRet.get()); |
454 | |
|
455 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
456 | 0 | m_bSentInitialUpdate = true; |
457 | 0 | } |
458 | |
|
459 | 0 | return pRet; |
460 | 0 | } |
461 | | |
462 | | std::unique_ptr<weld::Assistant> JSInstanceBuilder::weld_assistant(const OUString& id) |
463 | 0 | { |
464 | 0 | vcl::RoadmapWizard* pDialog = m_xBuilder->get<vcl::RoadmapWizard>(id); |
465 | 0 | std::unique_ptr<JSAssistant> pRet(pDialog ? new JSAssistant(this, pDialog, this, false) |
466 | 0 | : nullptr); |
467 | 0 | if (pDialog) |
468 | 0 | { |
469 | 0 | m_nWindowId = pDialog->GetLOKWindowId(); |
470 | 0 | pDialog->SetLOKTunnelingState(false); |
471 | |
|
472 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
473 | |
|
474 | 0 | assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); |
475 | 0 | m_aOwnedToplevel.reset(pDialog); |
476 | 0 | m_xBuilder->drop_ownership(pDialog); |
477 | 0 | m_bHasTopLevelDialog = true; |
478 | |
|
479 | 0 | pRet.reset(new JSAssistant(this, pDialog, this, false)); |
480 | |
|
481 | 0 | RememberWidget(u"__DIALOG__"_ustr, pRet.get()); |
482 | |
|
483 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
484 | 0 | m_bSentInitialUpdate = true; |
485 | 0 | } |
486 | |
|
487 | 0 | return pRet; |
488 | 0 | } |
489 | | |
490 | | std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(const OUString& id) |
491 | 0 | { |
492 | 0 | std::unique_ptr<weld::MessageDialog> pRet; |
493 | 0 | ::MessageDialog* pMessageDialog = m_xBuilder->get<::MessageDialog>(id); |
494 | |
|
495 | 0 | if (pMessageDialog) |
496 | 0 | { |
497 | 0 | m_nWindowId = pMessageDialog->GetLOKWindowId(); |
498 | 0 | pMessageDialog->SetLOKTunnelingState(false); |
499 | |
|
500 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
501 | |
|
502 | 0 | assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); |
503 | 0 | m_aOwnedToplevel.reset(pMessageDialog); |
504 | 0 | m_xBuilder->drop_ownership(pMessageDialog); |
505 | 0 | m_bHasTopLevelDialog = true; |
506 | |
|
507 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
508 | 0 | m_bSentInitialUpdate = true; |
509 | 0 | } |
510 | |
|
511 | 0 | pRet.reset(pMessageDialog ? new JSMessageDialog(this, pMessageDialog, this, false) : nullptr); |
512 | |
|
513 | 0 | if (pRet) |
514 | 0 | RememberWidget(u"__DIALOG__"_ustr, pRet.get()); |
515 | |
|
516 | 0 | return pRet; |
517 | 0 | } |
518 | | |
519 | | std::unique_ptr<weld::Container> JSInstanceBuilder::weld_container(const OUString& id) |
520 | 0 | { |
521 | 0 | vcl::Window* pContainer = m_xBuilder->get<vcl::Window>(id); |
522 | 0 | auto pWeldWidget |
523 | 0 | = pContainer ? std::make_unique<JSContainer>(this, pContainer, this, false) : nullptr; |
524 | |
|
525 | 0 | if (pWeldWidget) |
526 | 0 | RememberWidget(id, pWeldWidget.get()); |
527 | |
|
528 | 0 | if (!m_bSentInitialUpdate && pContainer) |
529 | 0 | { |
530 | 0 | m_bSentInitialUpdate = true; |
531 | | |
532 | | // use parent builder to send update - avoid multiple calls from many builders |
533 | 0 | vcl::Window* pParent = pContainer->GetParent(); |
534 | 0 | OUString sId = OUString::number(m_nWindowId); |
535 | 0 | auto aWidgetMap = Widgets().Find(sId); |
536 | 0 | while (pParent && aWidgetMap && !aWidgetMap->Find(pParent->get_id())) |
537 | 0 | { |
538 | 0 | pParent = pParent->GetParent(); |
539 | 0 | } |
540 | |
|
541 | 0 | if (pParent) |
542 | 0 | jsdialog::SendFullUpdate(sId, pParent->get_id()); |
543 | | |
544 | | // Navigator is currently just a panellayout but we treat it as its own dialog in online |
545 | | // this is a hack to get it to close atm but probably need a better solution |
546 | 0 | if (id != u"NavigatorPanel") |
547 | | // this is nested builder, don't close parent dialog on destroy (eg. single tab page is closed) |
548 | 0 | m_bCanClose = false; |
549 | 0 | m_bIsNestedBuilder = true; |
550 | 0 | } |
551 | |
|
552 | 0 | return pWeldWidget; |
553 | 0 | } |
554 | | |
555 | | std::unique_ptr<weld::ScrolledWindow> |
556 | | JSInstanceBuilder::weld_scrolled_window(const OUString& id, bool bUserManagedScrolling) |
557 | 0 | { |
558 | 0 | VclScrolledWindow* pScrolledWindow = m_xBuilder->get<VclScrolledWindow>(id); |
559 | 0 | auto pWeldWidget = pScrolledWindow |
560 | 0 | ? std::make_unique<JSScrolledWindow>(this, pScrolledWindow, this, false, |
561 | 0 | bUserManagedScrolling) |
562 | 0 | : nullptr; |
563 | |
|
564 | 0 | if (pWeldWidget) |
565 | 0 | RememberWidget(id, pWeldWidget.get()); |
566 | |
|
567 | 0 | return pWeldWidget; |
568 | 0 | } |
569 | | |
570 | | std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OUString& id) |
571 | 0 | { |
572 | 0 | Control* pLabel = m_xBuilder->get<Control>(id); |
573 | 0 | auto pWeldWidget = pLabel ? std::make_unique<JSLabel>(this, pLabel, this, false) : nullptr; |
574 | |
|
575 | 0 | if (pWeldWidget) |
576 | 0 | RememberWidget(id, pWeldWidget.get()); |
577 | |
|
578 | 0 | return pWeldWidget; |
579 | 0 | } |
580 | | |
581 | | std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OUString& id) |
582 | 0 | { |
583 | 0 | ::Button* pButton = m_xBuilder->get<::Button>(id); |
584 | 0 | auto pWeldWidget = pButton ? std::make_unique<JSButton>(this, pButton, this, false) : nullptr; |
585 | |
|
586 | 0 | if (pWeldWidget) |
587 | 0 | RememberWidget(id, pWeldWidget.get()); |
588 | |
|
589 | 0 | return pWeldWidget; |
590 | 0 | } |
591 | | |
592 | | std::unique_ptr<weld::LinkButton> JSInstanceBuilder::weld_link_button(const OUString& id) |
593 | 0 | { |
594 | 0 | ::FixedHyperlink* pButton = m_xBuilder->get<::FixedHyperlink>(id); |
595 | 0 | auto pWeldWidget |
596 | 0 | = pButton ? std::make_unique<JSLinkButton>(this, pButton, this, false) : nullptr; |
597 | |
|
598 | 0 | if (pWeldWidget) |
599 | 0 | RememberWidget(id, pWeldWidget.get()); |
600 | |
|
601 | 0 | return pWeldWidget; |
602 | 0 | } |
603 | | |
604 | | std::unique_ptr<weld::ToggleButton> JSInstanceBuilder::weld_toggle_button(const OUString& id) |
605 | 0 | { |
606 | 0 | ::PushButton* pButton = m_xBuilder->get<::PushButton>(id); |
607 | 0 | auto pWeldWidget |
608 | 0 | = pButton ? std::make_unique<JSToggleButton>(this, pButton, this, false) : nullptr; |
609 | |
|
610 | 0 | if (pWeldWidget) |
611 | 0 | RememberWidget(id, pWeldWidget.get()); |
612 | |
|
613 | 0 | return pWeldWidget; |
614 | 0 | } |
615 | | |
616 | | std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OUString& id) |
617 | 0 | { |
618 | 0 | Edit* pEntry = m_xBuilder->get<Edit>(id); |
619 | 0 | auto pWeldWidget = pEntry ? std::make_unique<JSEntry>(this, pEntry, this, false) : nullptr; |
620 | |
|
621 | 0 | if (pWeldWidget) |
622 | 0 | RememberWidget(id, pWeldWidget.get()); |
623 | |
|
624 | 0 | return pWeldWidget; |
625 | 0 | } |
626 | | |
627 | | std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OUString& id) |
628 | 0 | { |
629 | 0 | vcl::Window* pWidget = m_xBuilder->get<vcl::Window>(id); |
630 | 0 | ::ComboBox* pComboBox = dynamic_cast<::ComboBox*>(pWidget); |
631 | 0 | std::unique_ptr<weld::ComboBox> pWeldWidget; |
632 | |
|
633 | 0 | if (pComboBox) |
634 | 0 | { |
635 | 0 | pWeldWidget = std::make_unique<JSComboBox>(this, pComboBox, this, false); |
636 | 0 | } |
637 | 0 | else |
638 | 0 | { |
639 | 0 | ListBox* pListBox = dynamic_cast<ListBox*>(pWidget); |
640 | 0 | pWeldWidget = pListBox ? std::make_unique<JSListBox>(this, pListBox, this, false) : nullptr; |
641 | 0 | } |
642 | |
|
643 | 0 | if (pWeldWidget) |
644 | 0 | RememberWidget(id, pWeldWidget.get()); |
645 | |
|
646 | 0 | return pWeldWidget; |
647 | 0 | } |
648 | | |
649 | | std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OUString& id) |
650 | 0 | { |
651 | 0 | std::unique_ptr<weld::Notebook> pWeldWidget; |
652 | 0 | vcl::Window* pNotebook = m_xBuilder->get(id); |
653 | |
|
654 | 0 | if (pNotebook && pNotebook->GetType() == WindowType::TABCONTROL) |
655 | 0 | pWeldWidget |
656 | 0 | = std::make_unique<JSNotebook>(this, static_cast<TabControl*>(pNotebook), this, false); |
657 | 0 | else if (pNotebook && pNotebook->GetType() == WindowType::VERTICALTABCONTROL) |
658 | 0 | pWeldWidget = std::make_unique<JSVerticalNotebook>( |
659 | 0 | this, static_cast<VerticalTabControl*>(pNotebook), this, false); |
660 | |
|
661 | 0 | if (pWeldWidget) |
662 | 0 | RememberWidget(id, pWeldWidget.get()); |
663 | |
|
664 | 0 | return pWeldWidget; |
665 | 0 | } |
666 | | |
667 | | std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OUString& id) |
668 | 0 | { |
669 | 0 | FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id); |
670 | 0 | auto pWeldWidget |
671 | 0 | = pSpinButton ? std::make_unique<JSSpinButton>(this, pSpinButton, this, false) : nullptr; |
672 | |
|
673 | 0 | if (pWeldWidget) |
674 | 0 | RememberWidget(id, pWeldWidget.get()); |
675 | |
|
676 | 0 | return pWeldWidget; |
677 | 0 | } |
678 | | |
679 | | std::unique_ptr<weld::FormattedSpinButton> |
680 | | JSInstanceBuilder::weld_formatted_spin_button(const OUString& id) |
681 | 0 | { |
682 | 0 | FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id); |
683 | 0 | auto pWeldWidget = pSpinButton |
684 | 0 | ? std::make_unique<JSFormattedSpinButton>(this, pSpinButton, this, false) |
685 | 0 | : nullptr; |
686 | |
|
687 | 0 | if (pWeldWidget) |
688 | 0 | RememberWidget(id, pWeldWidget.get()); |
689 | |
|
690 | 0 | return pWeldWidget; |
691 | 0 | } |
692 | | |
693 | | std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OUString& id) |
694 | 0 | { |
695 | 0 | CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id); |
696 | 0 | auto pWeldWidget |
697 | 0 | = pCheckButton ? std::make_unique<JSCheckButton>(this, pCheckButton, this, false) : nullptr; |
698 | |
|
699 | 0 | if (pWeldWidget) |
700 | 0 | RememberWidget(id, pWeldWidget.get()); |
701 | |
|
702 | 0 | return pWeldWidget; |
703 | 0 | } |
704 | | |
705 | | std::unique_ptr<weld::DrawingArea> |
706 | | JSInstanceBuilder::weld_drawing_area(const OUString& id, |
707 | | const rtl::Reference<comphelper::OAccessible>& rA11yImpl, |
708 | | FactoryFunction pUITestFactoryFunction, void* pUserData) |
709 | 0 | { |
710 | 0 | VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id); |
711 | 0 | auto pWeldWidget = pArea ? std::make_unique<JSDrawingArea>(this, pArea, this, rA11yImpl, |
712 | 0 | pUITestFactoryFunction, pUserData) |
713 | 0 | : nullptr; |
714 | |
|
715 | 0 | if (pWeldWidget) |
716 | 0 | RememberWidget(id, pWeldWidget.get()); |
717 | |
|
718 | 0 | return pWeldWidget; |
719 | 0 | } |
720 | | |
721 | | std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OUString& id) |
722 | 0 | { |
723 | 0 | ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id); |
724 | 0 | auto pWeldWidget |
725 | 0 | = pToolBox ? std::make_unique<JSToolbar>(this, pToolBox, this, false) : nullptr; |
726 | |
|
727 | 0 | if (pWeldWidget) |
728 | 0 | RememberWidget(id, pWeldWidget.get()); |
729 | |
|
730 | 0 | return pWeldWidget; |
731 | 0 | } |
732 | | |
733 | | std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const OUString& id) |
734 | 0 | { |
735 | 0 | VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id); |
736 | 0 | auto pWeldWidget |
737 | 0 | = pTextView ? std::make_unique<JSTextView>(this, pTextView, this, false) : nullptr; |
738 | |
|
739 | 0 | if (pWeldWidget) |
740 | 0 | RememberWidget(id, pWeldWidget.get()); |
741 | |
|
742 | 0 | return pWeldWidget; |
743 | 0 | } |
744 | | |
745 | | std::unique_ptr<weld::TreeView> JSInstanceBuilder::weld_tree_view(const OUString& id) |
746 | 0 | { |
747 | 0 | SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id); |
748 | 0 | auto pWeldWidget |
749 | 0 | = pTreeView ? std::make_unique<JSTreeView>(this, pTreeView, this, false) : nullptr; |
750 | |
|
751 | 0 | if (pWeldWidget) |
752 | 0 | RememberWidget(id, pWeldWidget.get()); |
753 | |
|
754 | 0 | return pWeldWidget; |
755 | 0 | } |
756 | | |
757 | | std::unique_ptr<weld::Expander> JSInstanceBuilder::weld_expander(const OUString& id) |
758 | 0 | { |
759 | 0 | VclExpander* pExpander = m_xBuilder->get<VclExpander>(id); |
760 | 0 | auto pWeldWidget |
761 | 0 | = pExpander ? std::make_unique<JSExpander>(this, pExpander, this, false) : nullptr; |
762 | |
|
763 | 0 | if (pWeldWidget) |
764 | 0 | RememberWidget(id, pWeldWidget.get()); |
765 | |
|
766 | 0 | return pWeldWidget; |
767 | 0 | } |
768 | | |
769 | | std::unique_ptr<weld::IconView> JSInstanceBuilder::weld_icon_view(const OUString& id) |
770 | 0 | { |
771 | 0 | ::IconView* pIconView = m_xBuilder->get<::IconView>(id); |
772 | 0 | auto pWeldWidget |
773 | 0 | = pIconView ? std::make_unique<JSIconView>(this, pIconView, this, false) : nullptr; |
774 | |
|
775 | 0 | if (pWeldWidget) |
776 | 0 | RememberWidget(id, pWeldWidget.get()); |
777 | |
|
778 | 0 | return pWeldWidget; |
779 | 0 | } |
780 | | |
781 | | std::unique_ptr<weld::RadioButton> JSInstanceBuilder::weld_radio_button(const OUString& id) |
782 | 0 | { |
783 | 0 | ::RadioButton* pRadioButton = m_xBuilder->get<::RadioButton>(id); |
784 | 0 | auto pWeldWidget |
785 | 0 | = pRadioButton ? std::make_unique<JSRadioButton>(this, pRadioButton, this, false) : nullptr; |
786 | |
|
787 | 0 | if (pWeldWidget) |
788 | 0 | RememberWidget(id, pWeldWidget.get()); |
789 | |
|
790 | 0 | return pWeldWidget; |
791 | 0 | } |
792 | | |
793 | | std::unique_ptr<weld::Frame> JSInstanceBuilder::weld_frame(const OUString& id) |
794 | 0 | { |
795 | 0 | ::VclFrame* pFrame = m_xBuilder->get<::VclFrame>(id); |
796 | 0 | auto pWeldWidget = pFrame ? std::make_unique<JSFrame>(this, pFrame, this, false) : nullptr; |
797 | |
|
798 | 0 | if (pWeldWidget) |
799 | 0 | RememberWidget(id, pWeldWidget.get()); |
800 | |
|
801 | 0 | return pWeldWidget; |
802 | 0 | } |
803 | | |
804 | | std::unique_ptr<weld::MenuButton> JSInstanceBuilder::weld_menu_button(const OUString& id) |
805 | 0 | { |
806 | 0 | ::MenuButton* pMenuButton = m_xBuilder->get<::MenuButton>(id); |
807 | 0 | auto pWeldWidget |
808 | 0 | = pMenuButton ? std::make_unique<JSMenuButton>(this, pMenuButton, this, false) : nullptr; |
809 | |
|
810 | 0 | if (pWeldWidget) |
811 | 0 | RememberWidget(id, pWeldWidget.get()); |
812 | |
|
813 | 0 | return pWeldWidget; |
814 | 0 | } |
815 | | |
816 | | std::unique_ptr<weld::Menu> JSInstanceBuilder::weld_menu(const OUString& id) |
817 | 0 | { |
818 | 0 | PopupMenu* pPopupMenu = m_xBuilder->get_menu(id); |
819 | |
|
820 | 0 | JSMenu* pMenu = pPopupMenu ? new JSMenu(this, pPopupMenu, this, false) : nullptr; |
821 | |
|
822 | 0 | std::unique_ptr<weld::Menu> pWeldWidget(pMenu); |
823 | |
|
824 | 0 | if (pWeldWidget) |
825 | 0 | JSInstanceBuilder::Menus().Remember(getMapIdFromWindowId(), pWeldWidget.get()); |
826 | |
|
827 | 0 | return pWeldWidget; |
828 | 0 | } |
829 | | |
830 | | std::unique_ptr<weld::Popover> JSInstanceBuilder::weld_popover(const OUString& id) |
831 | 0 | { |
832 | 0 | DockingWindow* pDockingWindow = m_xBuilder->get<DockingWindow>(id); |
833 | 0 | JSPopover* pPopover |
834 | 0 | = pDockingWindow ? new JSPopover(this, pDockingWindow, this, false) : nullptr; |
835 | 0 | std::unique_ptr<weld::Popover> pWeldWidget(pPopover); |
836 | 0 | if (pDockingWindow) |
837 | 0 | { |
838 | 0 | assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); |
839 | 0 | m_aOwnedToplevel.reset(pDockingWindow); |
840 | 0 | m_xBuilder->drop_ownership(pDockingWindow); |
841 | |
|
842 | 0 | if (VclPtr<vcl::Window> pWin = pDockingWindow->GetParentWithLOKNotifier()) |
843 | 0 | { |
844 | 0 | vcl::Window* pPopupRoot = pDockingWindow->GetChild(0); |
845 | 0 | pPopupRoot->SetLOKNotifier(pWin->GetLOKNotifier()); |
846 | 0 | m_aParentDialog = pPopupRoot; |
847 | 0 | m_aWindowToRelease = pPopupRoot; |
848 | 0 | m_nWindowId = m_aParentDialog->GetLOKWindowId(); |
849 | |
|
850 | 0 | pPopover->set_window_id(m_nWindowId); |
851 | 0 | JSInstanceBuilder::Popups().Remember(OUString::number(m_nWindowId), pDockingWindow); |
852 | |
|
853 | 0 | InsertWindowToMap(getMapIdFromWindowId()); |
854 | 0 | initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON()); |
855 | 0 | } |
856 | 0 | } |
857 | |
|
858 | 0 | if (pWeldWidget) |
859 | 0 | RememberWidget(u"__POPOVER__"_ustr, pWeldWidget.get()); |
860 | |
|
861 | 0 | return pWeldWidget; |
862 | 0 | } |
863 | | |
864 | | std::unique_ptr<weld::Box> JSInstanceBuilder::weld_box(const OUString& id) |
865 | 0 | { |
866 | 0 | VclBox* pContainer = m_xBuilder->get<VclBox>(id); |
867 | 0 | auto pWeldWidget |
868 | 0 | = pContainer ? std::make_unique<JSBox>(this, pContainer, this, false) : nullptr; |
869 | |
|
870 | 0 | if (pWeldWidget) |
871 | 0 | RememberWidget(id, pWeldWidget.get()); |
872 | |
|
873 | 0 | return pWeldWidget; |
874 | 0 | } |
875 | | |
876 | | std::unique_ptr<weld::Widget> JSInstanceBuilder::weld_widget(const OUString& id) |
877 | 0 | { |
878 | 0 | vcl::Window* pWidget = m_xBuilder->get(id); |
879 | 0 | auto pWeldWidget |
880 | 0 | = pWidget ? std::make_unique<JSWidgetInstance>(this, pWidget, this, false) : nullptr; |
881 | |
|
882 | 0 | if (pWeldWidget) |
883 | 0 | RememberWidget(id, pWeldWidget.get()); |
884 | |
|
885 | 0 | return pWeldWidget; |
886 | 0 | } |
887 | | |
888 | | std::unique_ptr<weld::Image> JSInstanceBuilder::weld_image(const OUString& id) |
889 | 0 | { |
890 | 0 | FixedImage* pImage = m_xBuilder->get<FixedImage>(id); |
891 | |
|
892 | 0 | auto pWeldWidget = pImage ? std::make_unique<JSImage>(this, pImage, this, false) : nullptr; |
893 | |
|
894 | 0 | if (pWeldWidget) |
895 | 0 | RememberWidget(id, pWeldWidget.get()); |
896 | |
|
897 | 0 | return pWeldWidget; |
898 | 0 | } |
899 | | |
900 | | std::unique_ptr<weld::LevelBar> JSInstanceBuilder::weld_level_bar(const OUString& id) |
901 | 0 | { |
902 | 0 | ::ProgressBar* pLevelBar = m_xBuilder->get<::ProgressBar>(id); |
903 | |
|
904 | 0 | auto pWeldWidget |
905 | 0 | = pLevelBar ? std::make_unique<JSLevelBar>(this, pLevelBar, this, false) : nullptr; |
906 | |
|
907 | 0 | if (pWeldWidget) |
908 | 0 | RememberWidget(id, pWeldWidget.get()); |
909 | |
|
910 | 0 | return pWeldWidget; |
911 | 0 | } |
912 | | |
913 | | std::unique_ptr<weld::Calendar> JSInstanceBuilder::weld_calendar(const OUString& id) |
914 | 0 | { |
915 | 0 | ::Calendar* pCalendar = m_xBuilder->get<::Calendar>(id); |
916 | |
|
917 | 0 | auto pWeldWidget |
918 | 0 | = pCalendar ? std::make_unique<JSCalendar>(this, pCalendar, this, false) : nullptr; |
919 | |
|
920 | 0 | if (pWeldWidget) |
921 | 0 | RememberWidget(id, pWeldWidget.get()); |
922 | |
|
923 | 0 | return pWeldWidget; |
924 | 0 | } |
925 | | |
926 | | weld::MessageDialog* |
927 | | JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, |
928 | | VclButtonsType eButtonType, const OUString& rPrimaryMessage, |
929 | | const vcl::ILibreOfficeKitNotifier* pNotifier) |
930 | 0 | { |
931 | 0 | SalInstanceWidget* pParentInstance = dynamic_cast<SalInstanceWidget*>(pParent); |
932 | 0 | SystemWindow* pParentWidget = pParentInstance ? pParentInstance->getSystemWindow() : nullptr; |
933 | 0 | VclPtrInstance<::MessageDialog> xMessageDialog(pParentWidget, rPrimaryMessage, eMessageType, |
934 | 0 | eButtonType); |
935 | |
|
936 | 0 | if (pNotifier) |
937 | 0 | xMessageDialog->SetLOKNotifier(pNotifier); |
938 | |
|
939 | 0 | pNotifier = xMessageDialog->GetLOKNotifier(); |
940 | 0 | if (pNotifier) |
941 | 0 | { |
942 | 0 | OUString sWindowId = OUString::number(xMessageDialog->GetLOKWindowId()); |
943 | 0 | InsertWindowToMap(sWindowId); |
944 | 0 | xMessageDialog->SetLOKTunnelingState(false); |
945 | |
|
946 | 0 | return new JSMessageDialog(xMessageDialog, nullptr, true); |
947 | 0 | } |
948 | 0 | else |
949 | 0 | SAL_WARN("vcl", "No notifier in JSInstanceBuilder::CreateMessageDialog"); |
950 | | |
951 | 0 | return new JSMessageDialog(xMessageDialog, nullptr, true); |
952 | 0 | } |
953 | | |
954 | | JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder, |
955 | | bool bTakeOwnership) |
956 | 0 | : JSWidget<SalInstanceDialog, ::Dialog>(pSender, pDialog, pBuilder, bTakeOwnership) |
957 | 0 | { |
958 | 0 | } Unexecuted instantiation: JSDialog::JSDialog(JSDialogSender*, Dialog*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSDialog::JSDialog(JSDialogSender*, Dialog*, SalInstanceBuilder*, bool) |
959 | | |
960 | | void JSDialog::collapse(weld::Widget& rEdit, weld::Widget* pButton) |
961 | 0 | { |
962 | 0 | SalInstanceDialog::collapse(rEdit, pButton); |
963 | 0 | sendFullUpdate(); |
964 | 0 | } |
965 | | |
966 | | void JSDialog::undo_collapse() |
967 | 0 | { |
968 | 0 | SalInstanceDialog::undo_collapse(); |
969 | 0 | sendFullUpdate(); |
970 | 0 | } |
971 | | |
972 | | void JSDialog::response(int response) |
973 | 0 | { |
974 | 0 | if (response == RET_HELP) |
975 | 0 | { |
976 | 0 | response_help(m_xWidget.get()); |
977 | 0 | return; |
978 | 0 | } |
979 | | |
980 | 0 | sendClose(); |
981 | 0 | SalInstanceDialog::response(response); |
982 | 0 | } |
983 | | |
984 | | void JSAssistant::response(int response) |
985 | 0 | { |
986 | 0 | if (response == RET_HELP) |
987 | 0 | { |
988 | 0 | response_help(m_xWidget.get()); |
989 | 0 | return; |
990 | 0 | } |
991 | | |
992 | 0 | sendClose(); |
993 | 0 | SalInstanceAssistant::response(response); |
994 | 0 | } |
995 | | |
996 | | int JSDialog::run() |
997 | 0 | { |
998 | 0 | sendFullUpdate(true); |
999 | 0 | int ret = SalInstanceDialog::run(); |
1000 | 0 | return ret; |
1001 | 0 | } |
1002 | | |
1003 | | bool JSDialog::runAsync(std::shared_ptr<weld::DialogController> const& rxOwner, |
1004 | | const std::function<void(sal_Int32)>& rEndDialogFn) |
1005 | 0 | { |
1006 | 0 | bool ret = SalInstanceDialog::runAsync(rxOwner, rEndDialogFn); |
1007 | 0 | sendFullUpdate(); |
1008 | 0 | return ret; |
1009 | 0 | } |
1010 | | |
1011 | | bool JSDialog::runAsync(std::shared_ptr<Dialog> const& rxSelf, |
1012 | | const std::function<void(sal_Int32)>& func) |
1013 | 0 | { |
1014 | 0 | bool ret = SalInstanceDialog::runAsync(rxSelf, func); |
1015 | 0 | sendFullUpdate(); |
1016 | 0 | return ret; |
1017 | 0 | } |
1018 | | |
1019 | | int JSAssistant::run() |
1020 | 0 | { |
1021 | 0 | sendFullUpdate(true); |
1022 | 0 | int ret = SalInstanceDialog::run(); |
1023 | 0 | return ret; |
1024 | 0 | } |
1025 | | |
1026 | | bool JSAssistant::runAsync(std::shared_ptr<weld::DialogController> const& rxOwner, |
1027 | | const std::function<void(sal_Int32)>& rEndDialogFn) |
1028 | 0 | { |
1029 | 0 | bool ret = SalInstanceDialog::runAsync(rxOwner, rEndDialogFn); |
1030 | 0 | sendFullUpdate(); |
1031 | 0 | return ret; |
1032 | 0 | } |
1033 | | |
1034 | | bool JSAssistant::runAsync(std::shared_ptr<Dialog> const& rxSelf, |
1035 | | const std::function<void(sal_Int32)>& func) |
1036 | 0 | { |
1037 | 0 | bool ret = SalInstanceDialog::runAsync(rxSelf, func); |
1038 | 0 | sendFullUpdate(); |
1039 | 0 | return ret; |
1040 | 0 | } |
1041 | | |
1042 | | std::unique_ptr<weld::Button> JSDialog::weld_button_for_response(int nResponse) |
1043 | 0 | { |
1044 | 0 | std::unique_ptr<weld::Button> xWeldWidget; |
1045 | 0 | if (PushButton* pButton |
1046 | 0 | = dynamic_cast<::PushButton*>(m_xDialog->get_widget_for_response(nResponse))) |
1047 | 0 | { |
1048 | 0 | xWeldWidget = std::make_unique<JSButton>(m_pSender, pButton, nullptr, false); |
1049 | |
|
1050 | 0 | auto pParentDialog = m_xDialog->GetParentWithLOKNotifier(); |
1051 | 0 | if (pParentDialog) |
1052 | 0 | JSInstanceBuilder::RememberWidget(OUString::number(pParentDialog->GetLOKWindowId()), |
1053 | 0 | pButton->get_id(), xWeldWidget.get()); |
1054 | 0 | } |
1055 | |
|
1056 | 0 | return xWeldWidget; |
1057 | 0 | } |
1058 | | |
1059 | | std::unique_ptr<weld::Button> JSAssistant::weld_button_for_response(int nResponse) |
1060 | 0 | { |
1061 | 0 | ::PushButton* pButton = nullptr; |
1062 | 0 | std::unique_ptr<JSButton> xWeldWidget; |
1063 | 0 | if (nResponse == RET_YES) |
1064 | 0 | pButton = m_xWizard->m_pNextPage; |
1065 | 0 | else if (nResponse == RET_NO) |
1066 | 0 | pButton = m_xWizard->m_pPrevPage; |
1067 | 0 | else if (nResponse == RET_OK) |
1068 | 0 | pButton = m_xWizard->m_pFinish; |
1069 | 0 | else if (nResponse == RET_CANCEL) |
1070 | 0 | pButton = m_xWizard->m_pCancel; |
1071 | 0 | else if (nResponse == RET_HELP) |
1072 | 0 | pButton = m_xWizard->m_pHelp; |
1073 | |
|
1074 | 0 | if (pButton) |
1075 | 0 | { |
1076 | 0 | xWeldWidget = std::make_unique<JSButton>(m_pSender, pButton, nullptr, false); |
1077 | |
|
1078 | 0 | auto pParentDialog = m_xWizard->GetParentWithLOKNotifier(); |
1079 | 0 | if (pParentDialog) |
1080 | 0 | JSInstanceBuilder::RememberWidget(OUString::number(pParentDialog->GetLOKWindowId()), |
1081 | 0 | pButton->get_id(), xWeldWidget.get()); |
1082 | 0 | } |
1083 | |
|
1084 | 0 | return xWeldWidget; |
1085 | 0 | } |
1086 | | |
1087 | | JSAssistant::JSAssistant(JSDialogSender* pSender, vcl::RoadmapWizard* pDialog, |
1088 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1089 | 0 | : JSWidget<SalInstanceAssistant, vcl::RoadmapWizard>(pSender, pDialog, pBuilder, bTakeOwnership) |
1090 | 0 | { |
1091 | 0 | } Unexecuted instantiation: JSAssistant::JSAssistant(JSDialogSender*, vcl::RoadmapWizard*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSAssistant::JSAssistant(JSDialogSender*, vcl::RoadmapWizard*, SalInstanceBuilder*, bool) |
1092 | | |
1093 | | void JSAssistant::do_set_current_page(int nPage) |
1094 | 0 | { |
1095 | 0 | SalInstanceAssistant::do_set_current_page(nPage); |
1096 | 0 | sendFullUpdate(); |
1097 | 0 | } |
1098 | | |
1099 | | void JSAssistant::do_set_current_page(const OUString& rIdent) |
1100 | 0 | { |
1101 | 0 | SalInstanceAssistant::do_set_current_page(rIdent); |
1102 | 0 | sendFullUpdate(); |
1103 | 0 | } |
1104 | | |
1105 | | JSContainer::JSContainer(JSDialogSender* pSender, vcl::Window* pContainer, |
1106 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1107 | 0 | : JSWidget<SalInstanceContainer, vcl::Window>(pSender, pContainer, pBuilder, bTakeOwnership) |
1108 | 0 | { |
1109 | 0 | } Unexecuted instantiation: JSContainer::JSContainer(JSDialogSender*, vcl::Window*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSContainer::JSContainer(JSDialogSender*, vcl::Window*, SalInstanceBuilder*, bool) |
1110 | | |
1111 | | void JSContainer::move(weld::Widget* pWidget, weld::Container* pNewParent) |
1112 | 0 | { |
1113 | 0 | SalInstanceContainer::move(pWidget, pNewParent); |
1114 | 0 | sendFullUpdate(); |
1115 | 0 | } |
1116 | | |
1117 | | JSScrolledWindow::JSScrolledWindow(JSDialogSender* pSender, ::VclScrolledWindow* pContainer, |
1118 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership, |
1119 | | bool bUserManagedScrolling) |
1120 | 0 | : JSWidget<SalInstanceScrolledWindow, ::VclScrolledWindow>( |
1121 | 0 | pSender, pContainer, pBuilder, bTakeOwnership, bUserManagedScrolling) |
1122 | 0 | { |
1123 | 0 | } Unexecuted instantiation: JSScrolledWindow::JSScrolledWindow(JSDialogSender*, VclScrolledWindow*, SalInstanceBuilder*, bool, bool) Unexecuted instantiation: JSScrolledWindow::JSScrolledWindow(JSDialogSender*, VclScrolledWindow*, SalInstanceBuilder*, bool, bool) |
1124 | | |
1125 | | void JSScrolledWindow::vadjustment_configure(int value, int upper, int step_increment, |
1126 | | int page_increment, int page_size) |
1127 | 0 | { |
1128 | 0 | SalInstanceScrolledWindow::vadjustment_configure(value, upper, step_increment, page_increment, |
1129 | 0 | page_size); |
1130 | 0 | sendUpdate(); |
1131 | 0 | } |
1132 | | |
1133 | | void JSScrolledWindow::vadjustment_set_value(int value) |
1134 | 0 | { |
1135 | 0 | SalInstanceScrolledWindow::vadjustment_set_value(value); |
1136 | 0 | sendUpdate(); |
1137 | 0 | } |
1138 | | |
1139 | | void JSScrolledWindow::vadjustment_set_value_no_notification(int value) |
1140 | 0 | { |
1141 | 0 | SalInstanceScrolledWindow::vadjustment_set_value(value); |
1142 | 0 | } |
1143 | | |
1144 | | void JSScrolledWindow::vadjustment_set_page_size(int size) |
1145 | 0 | { |
1146 | 0 | SalInstanceScrolledWindow::vadjustment_set_page_size(size); |
1147 | 0 | sendUpdate(); |
1148 | 0 | } |
1149 | | |
1150 | | void JSScrolledWindow::set_vpolicy(VclPolicyType eVPolicy) |
1151 | 0 | { |
1152 | 0 | SalInstanceScrolledWindow::set_vpolicy(eVPolicy); |
1153 | 0 | sendUpdate(); |
1154 | 0 | } |
1155 | | |
1156 | | void JSScrolledWindow::hadjustment_configure(int value, int upper, int step_increment, |
1157 | | int page_increment, int page_size) |
1158 | 0 | { |
1159 | 0 | SalInstanceScrolledWindow::hadjustment_configure(value, upper, step_increment, page_increment, |
1160 | 0 | page_size); |
1161 | 0 | sendUpdate(); |
1162 | 0 | } |
1163 | | |
1164 | | void JSScrolledWindow::hadjustment_set_value(int value) |
1165 | 0 | { |
1166 | 0 | SalInstanceScrolledWindow::hadjustment_set_value(value); |
1167 | 0 | sendUpdate(); |
1168 | 0 | } |
1169 | | |
1170 | | void JSScrolledWindow::hadjustment_set_value_no_notification(int value) |
1171 | 0 | { |
1172 | 0 | SalInstanceScrolledWindow::hadjustment_set_value(value); |
1173 | 0 | } |
1174 | | |
1175 | | void JSScrolledWindow::hadjustment_set_page_size(int size) |
1176 | 0 | { |
1177 | 0 | SalInstanceScrolledWindow::hadjustment_set_page_size(size); |
1178 | 0 | sendUpdate(); |
1179 | 0 | } |
1180 | | |
1181 | | void JSScrolledWindow::set_hpolicy(VclPolicyType eVPolicy) |
1182 | 0 | { |
1183 | 0 | SalInstanceScrolledWindow::set_hpolicy(eVPolicy); |
1184 | 0 | sendUpdate(); |
1185 | 0 | } |
1186 | | |
1187 | | JSLabel::JSLabel(JSDialogSender* pSender, Control* pLabel, SalInstanceBuilder* pBuilder, |
1188 | | bool bTakeOwnership) |
1189 | 0 | : JSWidget<SalInstanceLabel, Control>(pSender, pLabel, pBuilder, bTakeOwnership) |
1190 | 0 | { |
1191 | 0 | } Unexecuted instantiation: JSLabel::JSLabel(JSDialogSender*, Control*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSLabel::JSLabel(JSDialogSender*, Control*, SalInstanceBuilder*, bool) |
1192 | | |
1193 | | void JSLabel::set_label(const OUString& rText) |
1194 | 0 | { |
1195 | 0 | SalInstanceLabel::set_label(rText); |
1196 | 0 | sendUpdate(); |
1197 | 0 | }; |
1198 | | |
1199 | | JSButton::JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder, |
1200 | | bool bTakeOwnership) |
1201 | 0 | : JSWidget<SalInstanceButton, ::Button>(pSender, pButton, pBuilder, bTakeOwnership) |
1202 | 0 | { |
1203 | 0 | } Unexecuted instantiation: JSButton::JSButton(JSDialogSender*, Button*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSButton::JSButton(JSDialogSender*, Button*, SalInstanceBuilder*, bool) |
1204 | | |
1205 | | JSLinkButton::JSLinkButton(JSDialogSender* pSender, ::FixedHyperlink* pButton, |
1206 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1207 | 0 | : JSWidget<SalInstanceLinkButton, ::FixedHyperlink>(pSender, pButton, pBuilder, bTakeOwnership) |
1208 | 0 | { |
1209 | 0 | } Unexecuted instantiation: JSLinkButton::JSLinkButton(JSDialogSender*, FixedHyperlink*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSLinkButton::JSLinkButton(JSDialogSender*, FixedHyperlink*, SalInstanceBuilder*, bool) |
1210 | | |
1211 | | JSToggleButton::JSToggleButton(JSDialogSender* pSender, ::PushButton* pButton, |
1212 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1213 | 0 | : JSWidget<SalInstanceToggleButton, ::PushButton>(pSender, pButton, pBuilder, bTakeOwnership) |
1214 | 0 | { |
1215 | 0 | } Unexecuted instantiation: JSToggleButton::JSToggleButton(JSDialogSender*, PushButton*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSToggleButton::JSToggleButton(JSDialogSender*, PushButton*, SalInstanceBuilder*, bool) |
1216 | | |
1217 | | void JSToggleButton::do_set_active(bool active) |
1218 | 0 | { |
1219 | 0 | SalInstanceToggleButton::do_set_active(active); |
1220 | 0 | sendUpdate(); |
1221 | 0 | } |
1222 | | |
1223 | | JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder, |
1224 | | bool bTakeOwnership) |
1225 | 0 | : JSWidget<SalInstanceEntry, ::Edit>(pSender, pEntry, pBuilder, bTakeOwnership) |
1226 | 0 | { |
1227 | 0 | } Unexecuted instantiation: JSEntry::JSEntry(JSDialogSender*, Edit*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSEntry::JSEntry(JSDialogSender*, Edit*, SalInstanceBuilder*, bool) |
1228 | | |
1229 | | void JSEntry::do_set_text(const OUString& rText) |
1230 | 0 | { |
1231 | 0 | SalInstanceEntry::do_set_text(rText); |
1232 | 0 | sendUpdate(); |
1233 | 0 | } |
1234 | | |
1235 | 0 | void JSEntry::set_text_without_notify(const OUString& rText) { SalInstanceEntry::set_text(rText); } |
1236 | | |
1237 | | void JSEntry::replace_selection(const OUString& rText) |
1238 | 0 | { |
1239 | 0 | SalInstanceEntry::replace_selection(rText); |
1240 | 0 | sendUpdate(); |
1241 | 0 | } |
1242 | | |
1243 | | JSListBox::JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder, |
1244 | | bool bTakeOwnership) |
1245 | 0 | : JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>(pSender, pListBox, pBuilder, |
1246 | 0 | bTakeOwnership) |
1247 | 0 | { |
1248 | 0 | } Unexecuted instantiation: JSListBox::JSListBox(JSDialogSender*, ListBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSListBox::JSListBox(JSDialogSender*, ListBox*, SalInstanceBuilder*, bool) |
1249 | | |
1250 | | void JSListBox::insert(int pos, const OUString& rStr, const OUString* pId, |
1251 | | const OUString* pIconName, VirtualDevice* pImageSurface) |
1252 | 0 | { |
1253 | 0 | SalInstanceComboBoxWithoutEdit::insert(pos, rStr, pId, pIconName, pImageSurface); |
1254 | 0 | sendUpdate(); |
1255 | 0 | } |
1256 | | |
1257 | | void JSListBox::remove(int pos) |
1258 | 0 | { |
1259 | 0 | SalInstanceComboBoxWithoutEdit::remove(pos); |
1260 | 0 | sendUpdate(); |
1261 | 0 | } |
1262 | | |
1263 | | void JSListBox::do_set_active(int pos) |
1264 | 0 | { |
1265 | 0 | SalInstanceComboBoxWithoutEdit::do_set_active(pos); |
1266 | 0 | sendUpdate(); |
1267 | 0 | } |
1268 | | |
1269 | | JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, |
1270 | | bool bTakeOwnership) |
1271 | 0 | : JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>(pSender, pComboBox, pBuilder, |
1272 | 0 | bTakeOwnership) |
1273 | 0 | { |
1274 | 0 | } Unexecuted instantiation: JSComboBox::JSComboBox(JSDialogSender*, ComboBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSComboBox::JSComboBox(JSDialogSender*, ComboBox*, SalInstanceBuilder*, bool) |
1275 | | |
1276 | | void JSComboBox::insert(int pos, const OUString& rStr, const OUString* pId, |
1277 | | const OUString* pIconName, VirtualDevice* pImageSurface) |
1278 | 0 | { |
1279 | 0 | SalInstanceComboBoxWithEdit::insert(pos, rStr, pId, pIconName, pImageSurface); |
1280 | 0 | sendUpdate(); |
1281 | 0 | } |
1282 | | |
1283 | | void JSComboBox::remove(int pos) |
1284 | 0 | { |
1285 | 0 | SalInstanceComboBoxWithEdit::remove(pos); |
1286 | 0 | sendUpdate(); |
1287 | 0 | } |
1288 | | |
1289 | | void JSComboBox::set_entry_text_without_notify(const OUString& rText) |
1290 | 0 | { |
1291 | 0 | SalInstanceComboBoxWithEdit::set_entry_text(rText); |
1292 | 0 | } |
1293 | | |
1294 | | void JSComboBox::set_entry_text(const OUString& rText) |
1295 | 0 | { |
1296 | 0 | SalInstanceComboBoxWithEdit::set_entry_text(rText); |
1297 | |
|
1298 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1299 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "setText"; |
1300 | 0 | (*pMap)["text"_ostr] = rText; |
1301 | 0 | sendAction(std::move(pMap)); |
1302 | 0 | } |
1303 | | |
1304 | | void JSComboBox::do_set_active(int pos) |
1305 | 0 | { |
1306 | 0 | if (pos == get_active()) |
1307 | 0 | return; |
1308 | | |
1309 | 0 | SalInstanceComboBoxWithEdit::do_set_active(pos); |
1310 | |
|
1311 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1312 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "select"; |
1313 | 0 | (*pMap)["position"_ostr] = OUString::number(pos); |
1314 | 0 | sendAction(std::move(pMap)); |
1315 | 0 | } |
1316 | | |
1317 | | void JSComboBox::do_set_active_id(const OUString& rStr) |
1318 | 0 | { |
1319 | 0 | sal_uInt16 nPos = find_id(rStr); |
1320 | 0 | do_set_active(nPos); |
1321 | 0 | } |
1322 | | |
1323 | 0 | bool JSComboBox::changed_by_direct_pick() const { return true; } |
1324 | | |
1325 | | void JSComboBox::render_entry(int pos, int dpix, int dpiy) |
1326 | 0 | { |
1327 | 0 | ScopedVclPtrInstance<VirtualDevice> pDevice(DeviceFormat::WITH_ALPHA); |
1328 | 0 | pDevice->SetDPIX(96.0 * dpix / 100); |
1329 | 0 | pDevice->SetDPIY(96.0 * dpiy / 100); |
1330 | |
|
1331 | 0 | Size aRenderSize = signal_custom_get_size(*pDevice); |
1332 | 0 | pDevice->SetOutputSize(aRenderSize); |
1333 | |
|
1334 | 0 | signal_custom_render(*pDevice, tools::Rectangle(Point(0, 0), aRenderSize), false, get_id(pos)); |
1335 | |
|
1336 | 0 | Bitmap aImage = pDevice->GetBitmap(Point(0, 0), aRenderSize); |
1337 | |
|
1338 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1339 | 0 | if (OnDemandRenderingHandler::imageToActionData(aImage, pos, *pMap)) |
1340 | 0 | sendAction(std::move(pMap)); |
1341 | 0 | } |
1342 | | |
1343 | | JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, |
1344 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1345 | 0 | : JSWidget<SalInstanceNotebook, ::TabControl>(pSender, pControl, pBuilder, bTakeOwnership) |
1346 | 0 | { |
1347 | 0 | } Unexecuted instantiation: JSNotebook::JSNotebook(JSDialogSender*, TabControl*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSNotebook::JSNotebook(JSDialogSender*, TabControl*, SalInstanceBuilder*, bool) |
1348 | | |
1349 | | void JSNotebook::remove_page(const OUString& rIdent) |
1350 | 0 | { |
1351 | 0 | SalInstanceNotebook::remove_page(rIdent); |
1352 | 0 | sendFullUpdate(); |
1353 | 0 | } |
1354 | | |
1355 | | void JSNotebook::insert_page(const OUString& rIdent, const OUString& rLabel, int nPos, |
1356 | | const OUString* pIconName) |
1357 | 0 | { |
1358 | 0 | SalInstanceNotebook::insert_page(rIdent, rLabel, nPos, pIconName); |
1359 | 0 | sendFullUpdate(); |
1360 | 0 | } |
1361 | | |
1362 | | JSVerticalNotebook::JSVerticalNotebook(JSDialogSender* pSender, ::VerticalTabControl* pControl, |
1363 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1364 | 0 | : JSWidget<SalInstanceVerticalNotebook, ::VerticalTabControl>(pSender, pControl, pBuilder, |
1365 | 0 | bTakeOwnership) |
1366 | 0 | { |
1367 | 0 | } Unexecuted instantiation: JSVerticalNotebook::JSVerticalNotebook(JSDialogSender*, VerticalTabControl*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSVerticalNotebook::JSVerticalNotebook(JSDialogSender*, VerticalTabControl*, SalInstanceBuilder*, bool) |
1368 | | |
1369 | | void JSVerticalNotebook::remove_page(const OUString& rIdent) |
1370 | 0 | { |
1371 | 0 | SalInstanceVerticalNotebook::remove_page(rIdent); |
1372 | 0 | sendFullUpdate(); |
1373 | 0 | } |
1374 | | |
1375 | | void JSVerticalNotebook::insert_page(const OUString& rIdent, const OUString& rLabel, int nPos, |
1376 | | const OUString* pIconName) |
1377 | 0 | { |
1378 | 0 | SalInstanceVerticalNotebook::insert_page(rIdent, rLabel, nPos, pIconName); |
1379 | 0 | sendFullUpdate(); |
1380 | 0 | } |
1381 | | |
1382 | | JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, |
1383 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1384 | 0 | : JSWidget<SalInstanceSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, bTakeOwnership) |
1385 | 0 | { |
1386 | 0 | } Unexecuted instantiation: JSSpinButton::JSSpinButton(JSDialogSender*, FormattedField*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSSpinButton::JSSpinButton(JSDialogSender*, FormattedField*, SalInstanceBuilder*, bool) |
1387 | | |
1388 | | void JSSpinButton::set_floating_point_value(double fValue) |
1389 | 0 | { |
1390 | 0 | SalInstanceSpinButton::set_floating_point_value(fValue); |
1391 | |
|
1392 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1393 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "setText"; |
1394 | 0 | (*pMap)["text"_ostr] = OUString::number(m_rFormatter.GetValue()); |
1395 | 0 | sendAction(std::move(pMap)); |
1396 | 0 | } |
1397 | | |
1398 | | void JSSpinButton::set_floating_point_range(double fMin, double fMax) |
1399 | 0 | { |
1400 | 0 | SalInstanceSpinButton::set_floating_point_range(fMin, fMax); |
1401 | 0 | sendUpdate(); |
1402 | 0 | } |
1403 | | |
1404 | | JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, |
1405 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1406 | 0 | : JSWidget<SalInstanceFormattedSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, |
1407 | 0 | bTakeOwnership) |
1408 | 0 | , m_pFmtSpin(pSpin) |
1409 | 0 | { |
1410 | 0 | } Unexecuted instantiation: JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender*, FormattedField*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender*, FormattedField*, SalInstanceBuilder*, bool) |
1411 | | |
1412 | | void JSFormattedSpinButton::do_set_text(const OUString& rText) |
1413 | 0 | { |
1414 | 0 | if (!m_pFmtSpin) |
1415 | 0 | return; |
1416 | | |
1417 | 0 | disable_notify_events(); |
1418 | 0 | m_pFmtSpin->SetValueFromString(rText); |
1419 | 0 | enable_notify_events(); |
1420 | |
|
1421 | 0 | sendUpdate(); |
1422 | 0 | } |
1423 | | |
1424 | | void JSFormattedSpinButton::set_text_without_notify(const OUString& rText) |
1425 | 0 | { |
1426 | 0 | SalInstanceFormattedSpinButton::set_text(rText); |
1427 | 0 | } |
1428 | | |
1429 | | JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, |
1430 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1431 | 0 | : JSWidget<SalInstanceMessageDialog, ::MessageDialog>(pSender, pDialog, pBuilder, |
1432 | 0 | bTakeOwnership) |
1433 | 0 | { |
1434 | 0 | } Unexecuted instantiation: JSMessageDialog::JSMessageDialog(JSDialogSender*, MessageDialog*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSMessageDialog::JSMessageDialog(JSDialogSender*, MessageDialog*, SalInstanceBuilder*, bool) |
1435 | | |
1436 | | JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, |
1437 | | bool bTakeOwnership) |
1438 | 0 | : JSWidget<SalInstanceMessageDialog, ::MessageDialog>(nullptr, pDialog, pBuilder, |
1439 | 0 | bTakeOwnership) |
1440 | 0 | , m_pOwnedSender(new JSDialogSender(pDialog, pDialog, u"dialog"_ustr)) |
1441 | 0 | { |
1442 | 0 | m_pSender = m_pOwnedSender.get(); |
1443 | |
|
1444 | 0 | if (pBuilder) |
1445 | 0 | return; |
1446 | | |
1447 | 0 | m_sWindowId = OUString::number(m_xMessageDialog->GetLOKWindowId()); |
1448 | |
|
1449 | 0 | if (::OKButton* pOKBtn |
1450 | 0 | = dynamic_cast<::OKButton*>(m_xMessageDialog->get_widget_for_response(RET_OK))) |
1451 | 0 | { |
1452 | 0 | m_pOK.reset(new JSButton(m_pSender, pOKBtn, nullptr, false)); |
1453 | 0 | JSInstanceBuilder::RememberWidget(m_sWindowId, pOKBtn->get_id(), m_pOK.get()); |
1454 | 0 | m_pOK->connect_clicked(LINK(this, JSMessageDialog, OKHdl)); |
1455 | 0 | } |
1456 | |
|
1457 | 0 | if (::CancelButton* pCancelBtn |
1458 | 0 | = dynamic_cast<::CancelButton*>(m_xMessageDialog->get_widget_for_response(RET_CANCEL))) |
1459 | 0 | { |
1460 | 0 | m_pCancel.reset(new JSButton(m_pSender, pCancelBtn, nullptr, false)); |
1461 | 0 | JSInstanceBuilder::RememberWidget(m_sWindowId, pCancelBtn->get_id(), m_pCancel.get()); |
1462 | 0 | m_pCancel->connect_clicked(LINK(this, JSMessageDialog, CancelHdl)); |
1463 | 0 | } |
1464 | 0 | } Unexecuted instantiation: JSMessageDialog::JSMessageDialog(MessageDialog*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSMessageDialog::JSMessageDialog(MessageDialog*, SalInstanceBuilder*, bool) |
1465 | | |
1466 | | JSMessageDialog::~JSMessageDialog() |
1467 | 0 | { |
1468 | 0 | if (!m_pBuilder) |
1469 | 0 | { |
1470 | | // For Message Dialogs created from Application::CreateMessageDialog |
1471 | | // (where there is no builder to take care of this for us) explicitly |
1472 | | // remove this window id on tear down |
1473 | 0 | JSInstanceBuilder::Widgets().Forget(m_sWindowId); |
1474 | 0 | } |
1475 | 0 | } |
1476 | | |
1477 | | void JSMessageDialog::RememberMessageDialog() |
1478 | 0 | { |
1479 | 0 | static constexpr OUString sWidgetName = u"__DIALOG__"_ustr; |
1480 | 0 | OUString sWindowId = OUString::number(m_xMessageDialog->GetLOKWindowId()); |
1481 | 0 | auto aWidgetMap = JSInstanceBuilder::Widgets().Find(sWindowId); |
1482 | 0 | if (aWidgetMap && aWidgetMap->Find(sWidgetName)) |
1483 | 0 | return; |
1484 | | |
1485 | 0 | JSInstanceBuilder::InsertWindowToMap(sWindowId); |
1486 | 0 | JSInstanceBuilder::RememberWidget(sWindowId, sWidgetName, this); |
1487 | 0 | } |
1488 | | |
1489 | | int JSMessageDialog::run() |
1490 | 0 | { |
1491 | 0 | if (GetLOKNotifier()) |
1492 | 0 | { |
1493 | 0 | RememberMessageDialog(); |
1494 | 0 | sendFullUpdate(); |
1495 | 0 | } |
1496 | |
|
1497 | 0 | int bRet = SalInstanceMessageDialog::run(); |
1498 | 0 | return bRet; |
1499 | 0 | } |
1500 | | |
1501 | | bool JSMessageDialog::runAsync(std::shared_ptr<weld::DialogController> const& rxOwner, |
1502 | | const std::function<void(sal_Int32)>& rEndDialogFn) |
1503 | 0 | { |
1504 | 0 | bool bRet = SalInstanceMessageDialog::runAsync(rxOwner, rEndDialogFn); |
1505 | |
|
1506 | 0 | RememberMessageDialog(); |
1507 | 0 | sendFullUpdate(); |
1508 | |
|
1509 | 0 | return bRet; |
1510 | 0 | } |
1511 | | |
1512 | | bool JSMessageDialog::runAsync(std::shared_ptr<Dialog> const& rxSelf, |
1513 | | const std::function<void(sal_Int32)>& rEndDialogFn) |
1514 | 0 | { |
1515 | 0 | bool bRet = SalInstanceMessageDialog::runAsync(rxSelf, rEndDialogFn); |
1516 | |
|
1517 | 0 | RememberMessageDialog(); |
1518 | 0 | sendFullUpdate(); |
1519 | |
|
1520 | 0 | return bRet; |
1521 | 0 | } |
1522 | | |
1523 | 0 | IMPL_LINK_NOARG(JSMessageDialog, OKHdl, weld::Button&, void) { response(RET_OK); } |
1524 | | |
1525 | 0 | IMPL_LINK_NOARG(JSMessageDialog, CancelHdl, weld::Button&, void) { response(RET_CANCEL); } |
1526 | | |
1527 | | void JSMessageDialog::set_primary_text(const OUString& rText) |
1528 | 0 | { |
1529 | 0 | SalInstanceMessageDialog::set_primary_text(rText); |
1530 | 0 | sendFullUpdate(); |
1531 | 0 | } |
1532 | | |
1533 | | void JSMessageDialog::set_secondary_text(const OUString& rText) |
1534 | 0 | { |
1535 | 0 | SalInstanceMessageDialog::set_secondary_text(rText); |
1536 | 0 | sendFullUpdate(); |
1537 | 0 | } |
1538 | | |
1539 | | void JSMessageDialog::response(int response) |
1540 | 0 | { |
1541 | 0 | if (response == RET_HELP) |
1542 | 0 | { |
1543 | 0 | response_help(m_xWidget.get()); |
1544 | 0 | return; |
1545 | 0 | } |
1546 | | |
1547 | 0 | sendClose(); |
1548 | 0 | SalInstanceMessageDialog::response(response); |
1549 | 0 | } |
1550 | | |
1551 | | JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, |
1552 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1553 | 0 | : JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership) |
1554 | 0 | { |
1555 | 0 | } Unexecuted instantiation: JSCheckButton::JSCheckButton(JSDialogSender*, CheckBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSCheckButton::JSCheckButton(JSDialogSender*, CheckBox*, SalInstanceBuilder*, bool) |
1556 | | |
1557 | | void JSCheckButton::do_set_state(TriState eState) |
1558 | 0 | { |
1559 | 0 | TriState eOldState = get_state(); |
1560 | 0 | SalInstanceCheckButton::do_set_state(eState); |
1561 | 0 | if (eOldState != eState) |
1562 | 0 | sendUpdate(); |
1563 | 0 | } |
1564 | | |
1565 | | JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea, |
1566 | | SalInstanceBuilder* pBuilder, |
1567 | | const rtl::Reference<comphelper::OAccessible>& rAlly, |
1568 | | FactoryFunction pUITestFactoryFunction, void* pUserData) |
1569 | 0 | : JSWidget<SalInstanceDrawingArea, VclDrawingArea>(pSender, pDrawingArea, pBuilder, rAlly, |
1570 | 0 | std::move(pUITestFactoryFunction), pUserData, |
1571 | 0 | false) |
1572 | 0 | { |
1573 | 0 | } Unexecuted instantiation: JSDrawingArea::JSDrawingArea(JSDialogSender*, VclDrawingArea*, SalInstanceBuilder*, rtl::Reference<comphelper::OAccessible> const&, std::__1::function<std::__1::unique_ptr<UIObject, std::__1::default_delete<UIObject> > (vcl::Window*)>, void*) Unexecuted instantiation: JSDrawingArea::JSDrawingArea(JSDialogSender*, VclDrawingArea*, SalInstanceBuilder*, rtl::Reference<comphelper::OAccessible> const&, std::__1::function<std::__1::unique_ptr<UIObject, std::__1::default_delete<UIObject> > (vcl::Window*)>, void*) |
1574 | | |
1575 | | void JSDrawingArea::queue_draw() |
1576 | 0 | { |
1577 | 0 | SalInstanceDrawingArea::queue_draw(); |
1578 | 0 | sendUpdate(); |
1579 | 0 | } |
1580 | | |
1581 | | void JSDrawingArea::queue_draw_area(int x, int y, int width, int height) |
1582 | 0 | { |
1583 | 0 | SalInstanceDrawingArea::queue_draw_area(x, y, width, height); |
1584 | 0 | sendUpdate(); |
1585 | 0 | } |
1586 | | |
1587 | | JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, |
1588 | | bool bTakeOwnership) |
1589 | 0 | : JSWidget<SalInstanceToolbar, ::ToolBox>(pSender, pToolbox, pBuilder, bTakeOwnership) |
1590 | 0 | { |
1591 | 0 | } Unexecuted instantiation: JSToolbar::JSToolbar(JSDialogSender*, ToolBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSToolbar::JSToolbar(JSDialogSender*, ToolBox*, SalInstanceBuilder*, bool) |
1592 | | |
1593 | | void JSToolbar::set_item_active(const OUString& rIdent, bool bActive) |
1594 | 0 | { |
1595 | 0 | bool bWasActive = get_item_active(rIdent); |
1596 | 0 | SalInstanceToolbar::set_item_active(rIdent, bActive); |
1597 | |
|
1598 | 0 | if (bWasActive != bActive) |
1599 | 0 | sendUpdate(); |
1600 | 0 | } |
1601 | | |
1602 | | void JSToolbar::set_menu_item_active(const OUString& rIdent, bool bActive) |
1603 | 0 | { |
1604 | 0 | bool bWasActive = get_menu_item_active(rIdent); |
1605 | 0 | SalInstanceToolbar::set_menu_item_active(rIdent, bActive); |
1606 | |
|
1607 | 0 | ToolBoxItemId nItemId = m_xToolBox->GetItemId(rIdent); |
1608 | 0 | VclPtr<vcl::Window> pFloat = m_aFloats[nItemId]; |
1609 | |
|
1610 | 0 | if (!pFloat) |
1611 | 0 | return; |
1612 | | |
1613 | | // See WeldToolbarPopup : include/svtools/toolbarmenu.hxx |
1614 | | // TopLevel (Popover) -> Container -> main container of the popup |
1615 | 0 | vcl::Window* pPopupRoot = pFloat->GetChild(0); |
1616 | 0 | if (pPopupRoot) |
1617 | 0 | pPopupRoot = pPopupRoot->GetChild(0); |
1618 | |
|
1619 | 0 | if (pPopupRoot) |
1620 | 0 | { |
1621 | 0 | if (bActive) |
1622 | 0 | { |
1623 | 0 | JSInstanceBuilder::Popups().Remember(OUString::number(pPopupRoot->GetLOKWindowId()), |
1624 | 0 | pFloat); |
1625 | 0 | sendPopup(pPopupRoot, m_xToolBox->get_id(), rIdent); |
1626 | 0 | } |
1627 | 0 | else if (bWasActive) |
1628 | 0 | { |
1629 | 0 | JSInstanceBuilder::Popups().Forget(OUString::number(pPopupRoot->GetLOKWindowId())); |
1630 | 0 | sendClosePopup(pPopupRoot->GetLOKWindowId()); |
1631 | 0 | } |
1632 | 0 | } |
1633 | 0 | } |
1634 | | |
1635 | | void JSToolbar::set_item_sensitive(const OUString& rIdent, bool bSensitive) |
1636 | 0 | { |
1637 | 0 | bool bWasSensitive = get_item_sensitive(rIdent); |
1638 | 0 | SalInstanceToolbar::set_item_sensitive(rIdent, bSensitive); |
1639 | 0 | if (bWasSensitive != bSensitive) |
1640 | 0 | sendUpdate(); |
1641 | 0 | } |
1642 | | |
1643 | | void JSToolbar::set_item_icon_name(const OUString& rIdent, const OUString& rIconName) |
1644 | 0 | { |
1645 | 0 | SalInstanceToolbar::set_item_icon_name(rIdent, rIconName); |
1646 | 0 | sendUpdate(); |
1647 | 0 | } |
1648 | | |
1649 | | void JSToolbar::set_item_image(const OUString& rIdent, |
1650 | | const css::uno::Reference<css::graphic::XGraphic>& rImage) |
1651 | 0 | { |
1652 | 0 | SalInstanceToolbar::set_item_image(rIdent, rImage); |
1653 | 0 | if (rIdent == u".uno:ChartColorPalette"_ustr) |
1654 | 0 | { |
1655 | 0 | sendUpdate(); |
1656 | 0 | } |
1657 | 0 | } |
1658 | | |
1659 | | JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, |
1660 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1661 | 0 | : JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder, |
1662 | 0 | bTakeOwnership) |
1663 | 0 | { |
1664 | 0 | } Unexecuted instantiation: JSTextView::JSTextView(JSDialogSender*, VclMultiLineEdit*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSTextView::JSTextView(JSDialogSender*, VclMultiLineEdit*, SalInstanceBuilder*, bool) |
1665 | | |
1666 | | void JSTextView::do_set_text(const OUString& rText) |
1667 | 0 | { |
1668 | 0 | SalInstanceTextView::do_set_text(rText); |
1669 | 0 | sendUpdate(); |
1670 | 0 | } |
1671 | | |
1672 | | void JSTextView::set_text_without_notify(const OUString& rText) |
1673 | 0 | { |
1674 | 0 | SalInstanceTextView::set_text(rText); |
1675 | 0 | } |
1676 | | |
1677 | | void JSTextView::do_replace_selection(const OUString& rText) |
1678 | 0 | { |
1679 | 0 | SalInstanceTextView::do_replace_selection(rText); |
1680 | 0 | sendUpdate(); |
1681 | 0 | } |
1682 | | |
1683 | | JSTreeView::JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTreeView, |
1684 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1685 | 0 | : JSWidget<SalInstanceTreeView, ::SvTabListBox>(pSender, pTreeView, pBuilder, bTakeOwnership) |
1686 | 0 | { |
1687 | 0 | } Unexecuted instantiation: JSTreeView::JSTreeView(JSDialogSender*, SvTabListBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSTreeView::JSTreeView(JSDialogSender*, SvTabListBox*, SalInstanceBuilder*, bool) |
1688 | | |
1689 | | void JSTreeView::set_toggle(const weld::TreeIter& rIter, TriState bOn, int col) |
1690 | 0 | { |
1691 | 0 | SalInstanceTreeView::set_toggle(rIter, bOn, col); |
1692 | 0 | sendUpdate(); |
1693 | 0 | } |
1694 | | |
1695 | | void JSTreeView::set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) |
1696 | 0 | { |
1697 | 0 | SalInstanceTreeView::set_sensitive(rIter, bSensitive, col); |
1698 | 0 | sendUpdate(); |
1699 | 0 | } |
1700 | | |
1701 | | void JSTreeView::do_select(const weld::TreeIter& rIter) |
1702 | 0 | { |
1703 | 0 | SalInstanceTreeView::do_select(rIter); |
1704 | |
|
1705 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1706 | 0 | const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); |
1707 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "select"; |
1708 | 0 | (*pMap)["position"_ostr] = OUString::number(m_xTreeView->GetEntryPos(rVclIter.iter)); |
1709 | 0 | sendAction(std::move(pMap)); |
1710 | 0 | } |
1711 | | |
1712 | 0 | weld::TreeView* JSTreeView::get_drag_source() const { return g_DragSource; } |
1713 | | |
1714 | 0 | void JSTreeView::drag_start() { g_DragSource = this; } |
1715 | | |
1716 | | void JSTreeView::drag_end() |
1717 | 0 | { |
1718 | 0 | css::datatransfer::dnd::XDropTarget* xDropTarget = m_xDropTarget.get(); |
1719 | 0 | if (xDropTarget) |
1720 | 0 | { |
1721 | 0 | css::datatransfer::dnd::DropTargetDropEvent aEvent; |
1722 | 0 | aEvent.Source = xDropTarget; |
1723 | 0 | aEvent.Context = new JSDropTargetDropContext(); |
1724 | | // dummy values |
1725 | 0 | aEvent.LocationX = 50; |
1726 | 0 | aEvent.LocationY = 50; |
1727 | 0 | aEvent.DropAction = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; |
1728 | 0 | aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; |
1729 | |
|
1730 | 0 | m_xDropTarget->fire_drop(aEvent); |
1731 | |
|
1732 | 0 | sendUpdate(); |
1733 | 0 | if (g_DragSource) |
1734 | 0 | g_DragSource->sendUpdate(); |
1735 | 0 | } |
1736 | |
|
1737 | 0 | g_DragSource = nullptr; |
1738 | 0 | } |
1739 | | |
1740 | | void JSTreeView::do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, |
1741 | | const OUString* pId, const OUString* pIconName, |
1742 | | VirtualDevice* pImageSurface, bool bChildrenOnDemand, |
1743 | | weld::TreeIter* pRet) |
1744 | 0 | { |
1745 | 0 | SalInstanceTreeView::do_insert(pParent, pos, pStr, pId, pIconName, pImageSurface, |
1746 | 0 | bChildrenOnDemand, pRet); |
1747 | |
|
1748 | 0 | sendUpdate(); |
1749 | 0 | } |
1750 | | |
1751 | | void JSTreeView::set_text(const weld::TreeIter& rIter, const OUString& rStr, int col) |
1752 | 0 | { |
1753 | 0 | SalInstanceTreeView::set_text(rIter, rStr, col); |
1754 | 0 | sendUpdate(); |
1755 | 0 | } |
1756 | | |
1757 | | void JSTreeView::do_remove(const weld::TreeIter& rIter) |
1758 | 0 | { |
1759 | 0 | SalInstanceTreeView::do_remove(rIter); |
1760 | 0 | sendUpdate(); |
1761 | 0 | } |
1762 | | |
1763 | | void JSTreeView::do_clear() |
1764 | 0 | { |
1765 | 0 | SalInstanceTreeView::do_clear(); |
1766 | 0 | sendUpdate(); |
1767 | 0 | } |
1768 | | |
1769 | 0 | void JSTreeView::set_cursor_without_notify(const weld::TreeIter& rIter) { set_cursor(rIter); } |
1770 | | |
1771 | | void JSTreeView::do_set_cursor(const weld::TreeIter& rIter) |
1772 | 0 | { |
1773 | 0 | SalInstanceTreeView::do_set_cursor(rIter); |
1774 | 0 | sendUpdate(); |
1775 | 0 | } |
1776 | | |
1777 | | void JSTreeView::do_set_cursor(int pos) |
1778 | 0 | { |
1779 | 0 | SalInstanceTreeView::do_set_cursor(pos); |
1780 | 0 | sendUpdate(); |
1781 | 0 | } |
1782 | | |
1783 | | void JSTreeView::expand_row(const weld::TreeIter& rIter) |
1784 | 0 | { |
1785 | 0 | bool bNotify = false; |
1786 | 0 | const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); |
1787 | 0 | if (!m_xTreeView->IsExpanded(rVclIter.iter)) |
1788 | 0 | bNotify = true; |
1789 | |
|
1790 | 0 | SalInstanceTreeView::expand_row(rIter); |
1791 | |
|
1792 | 0 | if (bNotify) |
1793 | 0 | sendUpdate(); |
1794 | 0 | } |
1795 | | |
1796 | | void JSTreeView::collapse_row(const weld::TreeIter& rIter) |
1797 | 0 | { |
1798 | 0 | bool bNotify = false; |
1799 | 0 | const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); |
1800 | 0 | if (m_xTreeView->IsExpanded(rVclIter.iter)) |
1801 | 0 | bNotify = true; |
1802 | |
|
1803 | 0 | SalInstanceTreeView::collapse_row(rIter); |
1804 | |
|
1805 | 0 | if (bNotify) |
1806 | 0 | sendUpdate(); |
1807 | 0 | } |
1808 | | |
1809 | | void JSTreeView::render_entry(int pos, int dpix, int dpiy) |
1810 | 0 | { |
1811 | 0 | ScopedVclPtrInstance<VirtualDevice> pDevice(DeviceFormat::WITHOUT_ALPHA); |
1812 | 0 | pDevice->SetDPIX(96.0 * dpix / 100); |
1813 | 0 | pDevice->SetDPIY(96.0 * dpiy / 100); |
1814 | |
|
1815 | 0 | SvTreeListEntry* pEntry = m_xTreeView->GetEntryAtAbsPos(pos); |
1816 | 0 | if (!pEntry) |
1817 | 0 | { |
1818 | 0 | return; |
1819 | 0 | } |
1820 | | |
1821 | 0 | Size aRenderSize = signal_custom_get_size(*pDevice, get_id(pos)); |
1822 | 0 | pDevice->SetOutputSize(aRenderSize); |
1823 | 0 | m_xTreeView->DrawCustomEntry(*pDevice, tools::Rectangle(Point(0, 0), aRenderSize), *pEntry); |
1824 | |
|
1825 | 0 | Bitmap aImage = pDevice->GetBitmap(Point(0, 0), aRenderSize); |
1826 | |
|
1827 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1828 | 0 | if (OnDemandRenderingHandler::imageToActionData(aImage, pos, *pMap)) |
1829 | 0 | sendAction(std::move(pMap)); |
1830 | 0 | } |
1831 | | |
1832 | | JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, |
1833 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1834 | 0 | : JSWidget<SalInstanceExpander, ::VclExpander>(pSender, pExpander, pBuilder, bTakeOwnership) |
1835 | 0 | { |
1836 | 0 | } Unexecuted instantiation: JSExpander::JSExpander(JSDialogSender*, VclExpander*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSExpander::JSExpander(JSDialogSender*, VclExpander*, SalInstanceBuilder*, bool) |
1837 | | |
1838 | | void JSExpander::set_expanded(bool bExpand) |
1839 | 0 | { |
1840 | 0 | SalInstanceExpander::set_expanded(bExpand); |
1841 | 0 | sendUpdate(); |
1842 | 0 | } |
1843 | | |
1844 | | JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder, |
1845 | | bool bTakeOwnership) |
1846 | 0 | : JSWidget<SalInstanceIconView, ::IconView>(pSender, pIconView, pBuilder, bTakeOwnership) |
1847 | 0 | { |
1848 | 0 | } Unexecuted instantiation: JSIconView::JSIconView(JSDialogSender*, IconView*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSIconView::JSIconView(JSDialogSender*, IconView*, SalInstanceBuilder*, bool) |
1849 | | |
1850 | | void JSIconView::do_insert(int pos, const OUString* pStr, const OUString* pId, |
1851 | | const OUString* pIconName, weld::TreeIter* pRet) |
1852 | 0 | { |
1853 | 0 | SalInstanceIconView::do_insert(pos, pStr, pId, pIconName, pRet); |
1854 | 0 | sendUpdate(); |
1855 | 0 | } |
1856 | | |
1857 | | void JSIconView::do_insert(int pos, const OUString* pStr, const OUString* pId, const Bitmap* pIcon, |
1858 | | weld::TreeIter* pRet) |
1859 | 0 | { |
1860 | 0 | SalInstanceIconView::do_insert(pos, pStr, pId, pIcon, pRet); |
1861 | 0 | sendUpdate(); |
1862 | 0 | } |
1863 | | |
1864 | | void JSIconView::insert_separator(int pos, const OUString* pId) |
1865 | 0 | { |
1866 | 0 | SalInstanceIconView::insert_separator(pos, pId); |
1867 | 0 | sendUpdate(); |
1868 | 0 | } |
1869 | | |
1870 | | void JSIconView::do_clear() |
1871 | 0 | { |
1872 | 0 | SalInstanceIconView::do_clear(); |
1873 | 0 | sendUpdate(); |
1874 | 0 | } |
1875 | | |
1876 | | void JSIconView::do_select(const weld::TreeIter& rIter) |
1877 | 0 | { |
1878 | 0 | SalInstanceIconView::do_select(rIter); |
1879 | |
|
1880 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1881 | 0 | const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); |
1882 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "select"; |
1883 | 0 | (*pMap)["position"_ostr] = OUString::number(m_xIconView->GetEntryPos(rVclIter.iter)); |
1884 | 0 | sendAction(std::move(pMap)); |
1885 | 0 | } |
1886 | | |
1887 | | void JSIconView::do_unselect(const weld::TreeIter& rIter) |
1888 | 0 | { |
1889 | 0 | SalInstanceIconView::do_unselect(rIter); |
1890 | 0 | sendUpdate(); |
1891 | 0 | } |
1892 | | |
1893 | | void JSIconView::render_entry(int pos, int dpix, int dpiy) |
1894 | 0 | { |
1895 | 0 | OUString sImage = m_xIconView->renderEntry(pos, dpix, dpiy); |
1896 | 0 | if (sImage.isEmpty()) |
1897 | 0 | return; |
1898 | | |
1899 | 0 | std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); |
1900 | 0 | (*pMap)[ACTION_TYPE ""_ostr] = "rendered_entry"; |
1901 | 0 | (*pMap)["pos"_ostr] = OUString::number(pos); |
1902 | 0 | (*pMap)["image"_ostr] = sImage; |
1903 | 0 | sendAction(std::move(pMap)); |
1904 | 0 | } |
1905 | | |
1906 | | JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton, |
1907 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1908 | 0 | : JSWidget<SalInstanceRadioButton, ::RadioButton>(pSender, pRadioButton, pBuilder, |
1909 | 0 | bTakeOwnership) |
1910 | 0 | { |
1911 | 0 | } Unexecuted instantiation: JSRadioButton::JSRadioButton(JSDialogSender*, RadioButton*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSRadioButton::JSRadioButton(JSDialogSender*, RadioButton*, SalInstanceBuilder*, bool) |
1912 | | |
1913 | | void JSRadioButton::do_set_active(bool active) |
1914 | 0 | { |
1915 | 0 | SalInstanceRadioButton::do_set_active(active); |
1916 | 0 | sendUpdate(); |
1917 | 0 | } |
1918 | | |
1919 | | JSFrame::JSFrame(JSDialogSender* pSender, ::VclFrame* pFrame, SalInstanceBuilder* pBuilder, |
1920 | | bool bTakeOwnership) |
1921 | 0 | : JSWidget<SalInstanceFrame, ::VclFrame>(pSender, pFrame, pBuilder, bTakeOwnership) |
1922 | 0 | { |
1923 | 0 | } Unexecuted instantiation: JSFrame::JSFrame(JSDialogSender*, VclFrame*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSFrame::JSFrame(JSDialogSender*, VclFrame*, SalInstanceBuilder*, bool) |
1924 | | |
1925 | | JSMenuButton::JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton, |
1926 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
1927 | 0 | : JSWidget<SalInstanceMenuButton, ::MenuButton>(pSender, pMenuButton, pBuilder, bTakeOwnership) |
1928 | 0 | { |
1929 | 0 | } Unexecuted instantiation: JSMenuButton::JSMenuButton(JSDialogSender*, MenuButton*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSMenuButton::JSMenuButton(JSDialogSender*, MenuButton*, SalInstanceBuilder*, bool) |
1930 | | |
1931 | | void JSMenuButton::set_label(const OUString& rText) |
1932 | 0 | { |
1933 | 0 | OUString aPreviousLabel = get_label(); |
1934 | 0 | SalInstanceMenuButton::set_label(rText); |
1935 | 0 | if (aPreviousLabel != rText) |
1936 | 0 | sendUpdate(); |
1937 | 0 | } |
1938 | | |
1939 | | void JSMenuButton::set_image(VirtualDevice* pDevice) |
1940 | 0 | { |
1941 | 0 | SalInstanceMenuButton::set_image(pDevice); |
1942 | 0 | sendUpdate(); |
1943 | 0 | } |
1944 | | |
1945 | | void JSMenuButton::set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) |
1946 | 0 | { |
1947 | 0 | SalInstanceMenuButton::set_image(rImage); |
1948 | 0 | sendUpdate(); |
1949 | 0 | } |
1950 | | |
1951 | | void JSMenuButton::do_set_active(bool bActive) |
1952 | 0 | { |
1953 | 0 | SalInstanceMenuButton::do_set_active(bActive); |
1954 | |
|
1955 | 0 | VclPtr<vcl::Window> pPopup = m_xMenuButton->GetPopover(); |
1956 | 0 | if (pPopup) |
1957 | 0 | { |
1958 | 0 | if (bActive) |
1959 | 0 | sendPopup(pPopup->GetChild(0), m_xMenuButton->get_id(), m_xMenuButton->get_id()); |
1960 | 0 | else |
1961 | 0 | sendClosePopup(pPopup->GetChild(0)->GetLOKWindowId()); |
1962 | 0 | } |
1963 | 0 | } |
1964 | | |
1965 | | JSMenu::JSMenu(JSDialogSender* pSender, PopupMenu* pPopupMenu, SalInstanceBuilder* /*pBuilder*/, |
1966 | | bool bTakeOwnership) |
1967 | 0 | : SalInstanceMenu(pPopupMenu, bTakeOwnership) |
1968 | 0 | , m_pPopupMenu(pPopupMenu) |
1969 | 0 | , m_pSender(pSender) |
1970 | 0 | { |
1971 | 0 | } |
1972 | | |
1973 | | OUString JSMenu::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, |
1974 | | weld::Placement /*ePlace*/) |
1975 | 0 | { |
1976 | | // Do not block with SalInstanceMenu::popup_at_rect(pParent, rRect, ePlace); |
1977 | 0 | OUString sCancelId; |
1978 | 0 | if (weld::IconView* pIconView = dynamic_cast<weld::IconView*>(pParent); pIconView) |
1979 | 0 | { |
1980 | 0 | sCancelId = pIconView->get_selected_text(); |
1981 | 0 | if (sCancelId.isEmpty()) |
1982 | 0 | SAL_WARN("vcl", "No entry detected in JSMenu::popup_at_rect"); |
1983 | 0 | } |
1984 | 0 | else if (weld::TreeView* pTree = dynamic_cast<weld::TreeView*>(pParent); pTree) |
1985 | 0 | { |
1986 | | // we find position based on parent widget id and row text inside TreeView for context menu |
1987 | 0 | std::unique_ptr<weld::TreeIter> itEntry(pTree->make_iterator()); |
1988 | 0 | if (pTree->get_dest_row_at_pos(rRect.Center(), itEntry.get(), false, false)) |
1989 | 0 | sCancelId = pTree->get_text(*itEntry); |
1990 | 0 | else |
1991 | 0 | SAL_WARN("vcl", "No entry detected in JSMenu::popup_at_rect"); |
1992 | 0 | } |
1993 | | |
1994 | 0 | m_pSender->sendMenu(m_pPopupMenu, pParent ? pParent->get_buildable_name() : "", sCancelId); |
1995 | | |
1996 | | // Don't return any action - simulate canceled menu |
1997 | 0 | return ""; |
1998 | 0 | } |
1999 | | |
2000 | | JSPopover::JSPopover(JSDialogSender* pSender, DockingWindow* pDockingWindow, |
2001 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
2002 | 0 | : JSWidget<SalInstancePopover, DockingWindow>(pSender, pDockingWindow, pBuilder, bTakeOwnership) |
2003 | 0 | , mnWindowId(0) |
2004 | 0 | { |
2005 | 0 | } Unexecuted instantiation: JSPopover::JSPopover(JSDialogSender*, DockingWindow*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSPopover::JSPopover(JSDialogSender*, DockingWindow*, SalInstanceBuilder*, bool) |
2006 | | |
2007 | | void JSPopover::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, |
2008 | | weld::Placement ePlace) |
2009 | 0 | { |
2010 | 0 | SalInstancePopover::popup_at_rect(pParent, rRect, ePlace); |
2011 | 0 | sendPopup(getWidget()->GetChild(0), u"_POPOVER_"_ustr, u"_POPOVER_"_ustr); |
2012 | 0 | } |
2013 | | |
2014 | | void JSPopover::popdown() |
2015 | 0 | { |
2016 | 0 | VclPtr<vcl::Window> pPopup = JSInstanceBuilder::Popups().Find(OUString::number(mnWindowId)); |
2017 | |
|
2018 | 0 | if (pPopup) |
2019 | 0 | { |
2020 | 0 | sendClosePopup(mnWindowId); |
2021 | 0 | vcl::Window::GetDockingManager()->EndPopupMode(pPopup); |
2022 | 0 | } |
2023 | |
|
2024 | 0 | if (getWidget() && getWidget()->GetChild(0)) |
2025 | 0 | sendClosePopup(getWidget()->GetChild(0)->GetLOKWindowId()); |
2026 | |
|
2027 | 0 | SalInstancePopover::popdown(); |
2028 | 0 | } |
2029 | | |
2030 | | JSBox::JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder, |
2031 | | bool bTakeOwnership) |
2032 | 0 | : JSWidget<SalInstanceBox, VclBox>(pSender, pBox, pBuilder, bTakeOwnership) |
2033 | 0 | { |
2034 | 0 | } Unexecuted instantiation: JSBox::JSBox(JSDialogSender*, VclBox*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSBox::JSBox(JSDialogSender*, VclBox*, SalInstanceBuilder*, bool) |
2035 | | |
2036 | | void JSBox::reorder_child(weld::Widget* pWidget, int nNewPosition) |
2037 | 0 | { |
2038 | 0 | SalInstanceBox::reorder_child(pWidget, nNewPosition); |
2039 | 0 | sendFullUpdate(); |
2040 | 0 | } |
2041 | | |
2042 | | JSImage::JSImage(JSDialogSender* pSender, FixedImage* pImage, SalInstanceBuilder* pBuilder, |
2043 | | bool bTakeOwnership) |
2044 | 0 | : JSWidget<SalInstanceImage, FixedImage>(pSender, pImage, pBuilder, bTakeOwnership) |
2045 | 0 | { |
2046 | 0 | } Unexecuted instantiation: JSImage::JSImage(JSDialogSender*, FixedImage*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSImage::JSImage(JSDialogSender*, FixedImage*, SalInstanceBuilder*, bool) |
2047 | | |
2048 | | void JSImage::set_image(VirtualDevice* pDevice) |
2049 | 0 | { |
2050 | 0 | SalInstanceImage::set_image(pDevice); |
2051 | 0 | sendUpdate(); |
2052 | 0 | } |
2053 | | |
2054 | | void JSImage::set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) |
2055 | 0 | { |
2056 | 0 | SalInstanceImage::set_image(rImage); |
2057 | 0 | sendUpdate(); |
2058 | 0 | } |
2059 | | |
2060 | | JSLevelBar::JSLevelBar(JSDialogSender* pSender, ::ProgressBar* pProgressBar, |
2061 | | SalInstanceBuilder* pBuilder, bool bTakeOwnership) |
2062 | 0 | : JSWidget<SalInstanceLevelBar, ::ProgressBar>(pSender, pProgressBar, pBuilder, bTakeOwnership) |
2063 | 0 | { |
2064 | 0 | } Unexecuted instantiation: JSLevelBar::JSLevelBar(JSDialogSender*, ProgressBar*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSLevelBar::JSLevelBar(JSDialogSender*, ProgressBar*, SalInstanceBuilder*, bool) |
2065 | | |
2066 | | void JSLevelBar::set_percentage(double fPercentage) |
2067 | 0 | { |
2068 | 0 | SalInstanceLevelBar::set_percentage(fPercentage); |
2069 | 0 | sendUpdate(); |
2070 | 0 | } |
2071 | | |
2072 | | JSCalendar::JSCalendar(JSDialogSender* pSender, ::Calendar* pCalendar, SalInstanceBuilder* pBuilder, |
2073 | | bool bTakeOwnership) |
2074 | 0 | : JSWidget<SalInstanceCalendar, ::Calendar>(pSender, pCalendar, pBuilder, bTakeOwnership) |
2075 | 0 | { |
2076 | 0 | } Unexecuted instantiation: JSCalendar::JSCalendar(JSDialogSender*, Calendar*, SalInstanceBuilder*, bool) Unexecuted instantiation: JSCalendar::JSCalendar(JSDialogSender*, Calendar*, SalInstanceBuilder*, bool) |
2077 | | |
2078 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |