LibreOffice Module dbaccess (master) 1
AppDetailPageHelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
22#include <tabletree.hxx>
23#include <dbtreelistbox.hxx>
24#include <com/sun/star/awt/PopupMenu.hpp>
25#include <com/sun/star/awt/XTabController.hpp>
26#include <com/sun/star/container/XChild.hpp>
27#include <com/sun/star/container/XContainer.hpp>
28#include <com/sun/star/form/XLoadable.hpp>
29#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
30#include <com/sun/star/frame/XLayoutManager.hpp>
31#include <com/sun/star/frame/Frame.hpp>
32#include <com/sun/star/frame/FrameSearchFlag.hpp>
33#include <com/sun/star/frame/XFrames.hpp>
34#include <com/sun/star/frame/XFramesSupplier.hpp>
35#include <com/sun/star/frame/XPopupMenuController.hpp>
36#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
37#include <com/sun/star/sdb/application/DatabaseObject.hpp>
38#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
39#include <com/sun/star/sdbc/XConnection.hpp>
40#include <com/sun/star/ucb/XCommandEnvironment.hpp>
41#include <com/sun/star/ucb/XCommandProcessor.hpp>
42#include <com/sun/star/ucb/Command.hpp>
43#include <com/sun/star/util/XCloseable.hpp>
45#include <comphelper/string.hxx>
46#include <o3tl/string_view.hxx>
47#include "AppView.hxx"
48#include <helpids.h>
49#include <strings.hxx>
50#include <dbaccess_slotid.hrc>
52#include <imageprovider.hxx>
54#include <vcl/cvtgrf.hxx>
55#include <tools/stream.hxx>
56#include "AppController.hxx"
57
58#include <com/sun/star/document/XDocumentProperties.hpp>
59
60#include <memory>
61
62using namespace ::dbaui;
63using namespace ::com::sun::star::container;
64using namespace ::com::sun::star::uno;
65using namespace ::com::sun::star::ucb;
66using namespace ::com::sun::star::frame;
67using namespace ::com::sun::star::form;
68using namespace ::com::sun::star::sdb;
69using namespace ::com::sun::star::sdb::application;
70using namespace ::com::sun::star::sdbc;
71using namespace ::com::sun::star::beans;
72using namespace ::com::sun::star;
73using ::com::sun::star::awt::XTabController;
74
75namespace dbaui
76{
77 namespace DatabaseObject = css::sdb::application::DatabaseObject;
78 namespace DatabaseObjectContainer = css::sdb::application::DatabaseObjectContainer;
79}
80
81namespace
82{
83 bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
84 {
85 bool bReturn = false;
86 sal_Int32 nIndex = 0;
87 std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) );
88
89 const weld::TreeView& rTreeView = rTree.GetWidget();
90 bool bEntry = true;
91 do
92 {
93 if (rTreeView.get_text(rIter) == sName)
94 {
95 if ( nIndex != -1 )
96 {
97 sName = o3tl::getToken(rName,0,'/',nIndex);
98 bEntry = rTreeView.iter_children(rIter);
99 }
100 else
101 {
102 bReturn = true;
103 break;
104 }
105 }
106 else
107 bEntry = rTreeView.iter_next_sibling(rIter);
108 }
109 while (bEntry);
110
111 return bReturn;
112 }
113
114 bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter)
115 {
116 sal_Int32 nIndex = 0;
117 std::u16string_view sErase = o3tl::getToken(rName,0,'/',nIndex); // we don't want to have the "private:forms" part
118 return nIndex != -1 && lcl_findEntry_impl(rTree, rName.substr(sErase.size() + 1), rIter);
119 }
120}
121
122OAppDetailPageHelper::OAppDetailPageHelper(weld::Container* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode)
123 : OChildWindow(pParent, "dbaccess/ui/detailwindow.ui", "DetailWindow")
124 , m_rBorderWin(rBorderWin)
125 , m_xBox(m_xBuilder->weld_container("box"))
126 , m_xFL(m_xBuilder->weld_widget("separator"))
127 , m_xMBPreview(m_xBuilder->weld_menu_button("disablepreview"))
128 , m_xPreview(new OPreviewWindow)
129 , m_xPreviewWin(new weld::CustomWeld(*m_xBuilder, "preview", *m_xPreview))
130 , m_xDocumentInfo(new ODocumentInfoPreview)
131 , m_xDocumentInfoWin(new weld::CustomWeld(*m_xBuilder, "infopreview", *m_xDocumentInfo))
132 , m_xTablePreview(m_xBuilder->weld_container("tablepreview"))
133 , m_ePreviewMode(ePreviewMode)
134{
135 m_xContainer->set_stack_background();
136
137 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:DBDisablePreview",
138 "com.sun.star.sdb.OfficeDatabaseDocument");
141
142 m_xMBPreview->connect_selected(LINK(this, OAppDetailPageHelper, MenuSelectHdl));
143 m_xMBPreview->connect_toggled(LINK(this, OAppDetailPageHelper, OnDropdownClickHdl));
144
146
149
150 m_xWindow = m_xTablePreview->CreateChildFrame();
151}
152
154{
155 try
156 {
157 Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
158 if ( xCloseable.is() )
159 xCloseable->close(true);
160 m_xFrame.clear();
161 }
162 catch(const Exception&)
163 {
164 TOOLS_WARN_EXCEPTION( "dbaccess", "Exception thrown while disposing preview frame!");
165 }
166
167 for (auto& rpBox : m_aLists)
168 {
169 if (!rpBox)
170 continue;
171 rpBox.reset();
172 }
173
174 m_xWindow->dispose();
175 m_xWindow.clear();
176
177 m_xTablePreview.reset();
178 m_xDocumentInfoWin.reset();
179 m_xDocumentInfo.reset();
180 m_xPreviewWin.reset();
181 m_xPreview.reset();
182 m_xMBPreview.reset();
183 m_xFL.reset();
184 m_xBox.reset();
185}
186
188{
189 int i = 0;
190 for (; i < E_ELEMENT_TYPE_COUNT ; ++i)
191 {
192 if (m_aLists[i] && m_aLists[i]->get_visible())
193 break;
194 }
195 return i;
196}
197
199{
202 {
203 m_aLists[nPos]->GetWidget().select_all();
204 }
205}
206
208{
211 m_aLists[nPos]->GetWidget().grab_focus();
212 else if (m_xMBPreview && m_xMBPreview->get_visible())
213 m_xMBPreview->grab_focus();
214}
215
217{
219 if (nPos < E_ELEMENT_TYPE_COUNT && m_aLists[nPos]->GetWidget().has_focus())
220 return true;
221 return m_xMBPreview && m_xMBPreview->has_focus();
222}
223
224void OAppDetailPageHelper::sort(int nPos, bool bAscending)
225{
226 assert(m_aLists[nPos] && "List can not be NULL! ->GPF");
227 m_aLists[nPos]->GetWidget().set_sort_order(bAscending);
228}
229
231{
232 bool bAscending = false;
233
236 bAscending = m_aLists[nPos]->GetWidget().get_sort_order();
237
238 return bAscending;
239}
240
242{
245 sort(nPos, false);
246}
247
249{
252 sort(nPos, true);
253}
254
255void OAppDetailPageHelper::getSelectionElementNames(std::vector<OUString>& rNames) const
256{
258 if ( nPos >= E_ELEMENT_TYPE_COUNT )
259 return;
260
261 DBTreeViewBase& rTree = *m_aLists[nPos];
262 weld::TreeView& rTreeView = rTree.GetWidget();
263 sal_Int32 nCount = rTreeView.n_children();
264 rNames.reserve(nCount);
266
267 rTreeView.selected_foreach([this, eType, &rTreeView, &rNames](weld::TreeIter& rEntry){
268 if ( eType == E_TABLE )
269 {
270 if (!rTreeView.iter_has_child(rEntry))
271 rNames.push_back(getQualifiedName(&rEntry));
272 }
273 else
274 {
275 OUString sName = rTreeView.get_text(rEntry);
276 std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
277 bool bParent = rTreeView.iter_parent(*xParent);
278 while (bParent)
279 {
280 sName = rTreeView.get_text(*xParent) + "/" + sName;
281 bParent = rTreeView.iter_parent(*xParent);
282 }
283 rNames.push_back(sName);
284 }
285
286 return false;
287 });
288}
289
291{
292 for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
293 {
294 if (&m_aLists[i]->GetWidget() == &rControl)
295 {
296 describeCurrentSelectionForType(static_cast<ElementType>(i), out_rSelectedObjects);
297 return;
298 }
299 }
300 OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForControl: invalid control!" );
301}
302
304{
305 OSL_ENSURE( eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
306 DBTreeViewBase* pList = ( eType < E_ELEMENT_TYPE_COUNT ) ? m_aLists[eType].get() : nullptr;
307 OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: "
308 "You really should ensure this type has already been viewed before!" );
309 if ( !pList )
310 return;
311
312 std::vector< NamedDatabaseObject > aSelected;
313
314 weld::TreeView& rTreeView = pList->GetWidget();
315 rTreeView.selected_foreach([pList, eType, &rTreeView, &aSelected](weld::TreeIter& rEntry){
316 NamedDatabaseObject aObject;
317 switch (eType)
318 {
319 case E_TABLE:
320 {
321 OTableTreeListBox& rTableTree = static_cast<OTableTreeListBox&>(pList->getListBox());
322 aObject = rTableTree.describeObject(rEntry);
323 break;
324 }
325 case E_QUERY:
326 aObject.Type = DatabaseObject::QUERY;
327 aObject.Name = rTreeView.get_text(rEntry);
328 break;
329 case E_FORM:
330 case E_REPORT:
331 {
332 OUString sName = rTreeView.get_text(rEntry);
333 std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
334 bool bParent = rTreeView.iter_parent(*xParent);
335 while (bParent)
336 {
337 sName = rTreeView.get_text(*xParent) + "/" + sName;
338 bParent = rTreeView.iter_parent(*xParent);
339 }
340
341 if (isLeaf(rTreeView, rEntry))
342 aObject.Type = (eType == E_FORM) ? DatabaseObject::FORM : DatabaseObject::REPORT;
343 else
344 aObject.Type = (eType == E_FORM) ? DatabaseObjectContainer::FORMS_FOLDER : DatabaseObjectContainer::REPORTS_FOLDER;
345 aObject.Name = sName;
346 break;
347 }
348 default:
349 OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForType: unexpected type!" );
350 break;
351 }
352
353 if (!aObject.Name.isEmpty())
354 aSelected.push_back(aObject);
355
356 return false;
357 });
358
359 _out_rSelectedObjects = comphelper::containerToSequence(aSelected);
360}
361
363{
364 return &m_rBorderWin;
365}
366
368{
369 int x, y, width, height;
370 if (rControl.get_extents_relative_to(m_rBorderWin.getTopLevel(), x, y, width, height))
371 {
372 rPos.AdjustX(x);
373 rPos.AdjustY(y);
374 }
375}
376
378{
380 if ( nPos >= E_ELEMENT_TYPE_COUNT )
381 return;
382
383 DBTreeViewBase& rTree = *m_aLists[nPos];
384 weld::TreeView& rTreeView = rTree.GetWidget();
385 rTreeView.unselect_all();
386 const OUString* pIter = _aNames.getConstArray();
387 const OUString* pEnd = pIter + _aNames.getLength();
388 for(;pIter != pEnd;++pIter)
389 {
390 auto xEntry = rTree.getListBox().GetEntryPosByName(*pIter);
391 if (!xEntry)
392 continue;
393 rTreeView.select(*xEntry);
394 }
395}
396
398{
400 OUString sComposedName;
401
402 if ( nPos >= E_ELEMENT_TYPE_COUNT )
403 return sComposedName;
404
405 OSL_ENSURE(m_aLists[nPos],"Tables tree view is NULL! -> GPF");
406 DBTreeViewBase& rTree = *m_aLists[nPos];
407 weld::TreeView& rTreeView = rTree.GetWidget();
408
409 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator(_pEntry));
410 if (!_pEntry)
411 {
412 if (!rTreeView.get_selected(xEntry.get()))
413 xEntry.reset();
414 }
415
416 if (!xEntry)
417 return sComposedName;
418
419 if ( getElementType() == E_TABLE )
420 {
421 const OTableTreeListBox& rTableTreeListBox = static_cast<const OTableTreeListBox&>(m_aLists[nPos]->getListBox());
422 sComposedName = rTableTreeListBox.getQualifiedTableName(*xEntry);
423 }
424 else
425 {
426 sComposedName = rTreeView.get_text(*xEntry);
427 bool bParent = rTreeView.iter_parent(*xEntry);
428 while (bParent)
429 {
430 sComposedName = rTreeView.get_text(*xEntry) + "/" + sComposedName;
431 bParent = rTreeView.iter_parent(*xEntry);
432 }
433 }
434
435 return sComposedName;
436}
437
439{
441 return static_cast<ElementType>(nPos);
442}
443
445{
446 sal_Int32 nCount = 0;
449 {
450 DBTreeViewBase& rTree = *m_aLists[nPos];
451 weld::TreeView& rTreeView = rTree.GetWidget();
452 nCount = rTreeView.count_selected_rows();
453 }
454 return nCount;
455}
456
458{
459 sal_Int32 nCount = 0;
462 {
463 DBTreeViewBase& rTree = *m_aLists[nPos];
464 weld::TreeView& rTreeView = rTree.GetWidget();
465 nCount = rTreeView.n_children();
466 }
467 return nCount;
468}
469
470bool OAppDetailPageHelper::isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry)
471{
472 sal_Int32 nEntryType = rTreeView.get_id(rEntry).toInt32();
473 return !( ( nEntryType == DatabaseObjectContainer::TABLES )
474 || ( nEntryType == DatabaseObjectContainer::CATALOG )
475 || ( nEntryType == DatabaseObjectContainer::SCHEMA )
476 || ( nEntryType == DatabaseObjectContainer::FORMS_FOLDER )
477 || ( nEntryType == DatabaseObjectContainer::REPORTS_FOLDER ));
478}
479
481{
483 bool bLeafSelected = false;
485 {
486 DBTreeViewBase& rTree = *m_aLists[nPos];
487 weld::TreeView& rTreeView = rTree.GetWidget();
488 rTreeView.selected_foreach([&rTreeView, &bLeafSelected](weld::TreeIter& rEntry){
489 bLeafSelected = isLeaf(rTreeView, rEntry);
490 return bLeafSelected;
491 });
492 }
493 return bLeafSelected;
494}
495
496std::unique_ptr<weld::TreeIter> OAppDetailPageHelper::getEntry( const Point& _aPosPixel) const
497{
498 std::unique_ptr<weld::TreeIter> xReturn;
501 {
502 DBTreeViewBase& rTree = *m_aLists[nPos];
503 weld::TreeView& rTreeView = rTree.GetWidget();
504 xReturn = rTreeView.make_iterator();
505 if (!rTreeView.get_dest_row_at_pos(_aPosPixel, xReturn.get(), false))
506 xReturn.reset();
507 }
508 return xReturn;
509}
510
512{
513 OSL_ENSURE(_xConnection.is(),"Connection is NULL! -> GPF");
514
515 if ( !m_aLists[E_TABLE] )
516 {
517 m_aLists[E_TABLE].reset(new DBTableTreeView(m_xBox.get()));
519 m_aLists[E_TABLE]->GetWidget().set_help_id(HID_APP_TABLE_TREE);
520 }
521
522 weld::TreeView& rTreeView = m_aLists[E_TABLE]->GetWidget();
523 if (!rTreeView.n_children())
524 {
525 static_cast<OTableTreeListBox&>(m_aLists[E_TABLE]->getListBox()).UpdateTableList(_xConnection);
526
527 std::unique_ptr<weld::TreeIter> xFirst(rTreeView.make_iterator());
528 if (rTreeView.get_iter_first(*xFirst))
529 rTreeView.expand_row(*xFirst);
530 rTreeView.unselect_all();
531 }
532
534}
535
537{
538 sal_Int32 nDatabaseObjectType( 0 );
539 switch(_eType )
540 {
541 case E_FORM: nDatabaseObjectType = DatabaseObject::FORM; break;
542 case E_REPORT: nDatabaseObjectType = DatabaseObject::REPORT; break;
543 case E_QUERY: nDatabaseObjectType = DatabaseObject::QUERY; break;
544 default:
545 OSL_FAIL( "OAppDetailPageHelper::GetElementIcons: invalid element type!" );
546 return OUString();
547 }
548
549 return ImageProvider::getDefaultImageResourceID(nDatabaseObjectType);
550}
551
553{
554 OSL_ENSURE(E_TABLE != _eType,"E_TABLE isn't allowed.");
555
556 OUString sHelpId;
557 switch( _eType )
558 {
559 case E_FORM:
560 sHelpId = HID_APP_FORM_TREE;
561 break;
562 case E_REPORT:
563 sHelpId = HID_APP_REPORT_TREE;
564 break;
565 case E_QUERY:
566 sHelpId = HID_APP_QUERY_TREE;
567 break;
568 default:
569 OSL_FAIL("Illegal call!");
570 }
571 OUString sImageId = getElementIcons(_eType);
572
573 if ( !m_aLists[_eType] )
574 {
575 m_aLists[_eType] = createSimpleTree(sHelpId, _eType);
576 }
577
578 if ( !m_aLists[_eType] )
579 return;
580
581 weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget();
582 if (!rTreeView.n_children() && _xContainer.is())
583 {
584 rTreeView.make_unsorted();
585 fillNames( _xContainer, _eType, sImageId, nullptr );
586 rTreeView.make_sorted();
587
588 rTreeView.unselect_all();
589 }
590 setDetailPage(*m_aLists[_eType]);
591}
592
594{
595 bool bHasFocus = false;
596
597 DBTreeViewBase* pCurrent = getCurrentView();
598 if (pCurrent)
599 {
600 weld::Widget& rCurrent = pCurrent->GetWidget();
601 bHasFocus = rCurrent.has_focus();
602 pCurrent->hide();
603 }
604
605 showPreview(nullptr);
606 m_xFL->show();
607 rTreeView.show();
608 m_xMBPreview->show();
610
611 if (bHasFocus)
612 rTreeView.GetWidget().grab_focus();
613}
614
615namespace
616{
617 namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
618
619 sal_Int32 lcl_getFolderIndicatorForType( const ElementType _eType )
620 {
621 const sal_Int32 nFolderIndicator =
622 ( _eType == E_FORM ) ? DatabaseObjectContainer::FORMS_FOLDER
623 : ( _eType == E_REPORT ) ? DatabaseObjectContainer::REPORTS_FOLDER : -1;
624 return nFolderIndicator;
625 }
626}
627
629 const OUString& rImageId, const weld::TreeIter* _pParent )
630{
631 OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
632 OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
633
634 DBTreeViewBase* pList = m_aLists[_eType].get();
635 OSL_ENSURE( pList, "OAppDetailPageHelper::fillNames: you really should create the list before calling this!" );
636 if ( !pList )
637 return;
638
639 if ( !(_xContainer.is() && _xContainer->hasElements()) )
640 return;
641
642 weld::TreeView& rTreeView = pList->GetWidget();
643
644 std::unique_ptr<weld::TreeIter> xRet = rTreeView.make_iterator();
645 const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
646
647 Sequence< OUString> aSeq = _xContainer->getElementNames();
648 const OUString* pIter = aSeq.getConstArray();
649 const OUString* pEnd = pIter + aSeq.getLength();
650 for(;pIter != pEnd;++pIter)
651 {
652 Reference<XNameAccess> xSubElements(_xContainer->getByName(*pIter),UNO_QUERY);
653 if ( xSubElements.is() )
654 {
655 OUString sId(OUString::number(nFolderIndicator));
656
657 rTreeView.insert(_pParent, -1, nullptr, &sId, nullptr, nullptr, false, xRet.get());
658 rTreeView.set_text(*xRet, *pIter, 0);
659 rTreeView.set_text_emphasis(*xRet, false, 0);
661 fillNames( xSubElements, _eType, rImageId, xRet.get());
662 }
663 else
664 {
665 rTreeView.insert(_pParent, -1, nullptr, nullptr, nullptr, nullptr, false, xRet.get());
666 rTreeView.set_text(*xRet, *pIter, 0);
667 rTreeView.set_text_emphasis(*xRet, false, 0);
668 rTreeView.set_image(*xRet, rImageId);
669 }
670 }
671}
672
673std::unique_ptr<DBTreeViewBase> OAppDetailPageHelper::createSimpleTree(const OUString& rHelpId, ElementType eType)
674{
675 const bool bSQLType = eType == E_TABLE || eType == E_QUERY;
676 std::unique_ptr<DBTreeViewBase> xTreeView(new DBTreeView(m_xBox.get(), bSQLType));
677 xTreeView->GetWidget().set_help_id(rHelpId);
678 setupTree(*xTreeView);
679 return xTreeView;
680}
681
683{
685
686 rDBTreeView.getListBox().setCopyHandler(LINK(this, OAppDetailPageHelper, OnCopyEntry));
687 rDBTreeView.getListBox().setPasteHandler(LINK(this, OAppDetailPageHelper, OnPasteEntry));
688 rDBTreeView.getListBox().setDeleteHandler(LINK(this, OAppDetailPageHelper, OnDeleteEntry));
689
690 weld::TreeView& rTreeView = rDBTreeView.GetWidget();
691 rTreeView.make_sorted();
692 rTreeView.set_selection_mode(SelectionMode::Multiple);
693 // an arbitrary small size it's allowed to shrink to
694 rTreeView.set_size_request(42, 42);
695
696 rTreeView.connect_row_activated(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
697
698 rDBTreeView.getListBox().SetSelChangeHdl(LINK(this, OAppDetailPageHelper, OnEntrySelChange));
699
700 rDBTreeView.getListBox().setControlActionListener(&getBorderWin().getView()->getAppController());
701 rDBTreeView.getListBox().setContextMenuProvider(&getBorderWin().getView()->getAppController());
702}
703
705{
706 showPreview(nullptr);
707 for (auto& rpBox : m_aLists)
708 {
709 if ( rpBox )
710 rpBox->GetWidget().clear();
711 }
712}
713
715{
716 size_t i = 0;
717 for (; i < E_ELEMENT_TYPE_COUNT && !m_aLists[i]; ++i)
718 ;
719 return i != E_ELEMENT_TYPE_COUNT;
720}
721
723 const OUString& rOldName,
724 const OUString& rNewName)
725{
726 DBTreeViewBase* pTreeView = getCurrentView();
727 if (!pTreeView)
728 return;
729
730 weld::TreeView& rTreeView = pTreeView->GetWidget();
731 rTreeView.make_unsorted();
732
733 switch (eType)
734 {
735 case E_TABLE:
736 static_cast<OTableTreeListBox&>(pTreeView->getListBox()).removedTable(rOldName);
737 static_cast<OTableTreeListBox&>(pTreeView->getListBox()).addedTable(rNewName);
738 break;
739 case E_QUERY:
740 {
741 std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
742 if (rTreeView.get_iter_first(*xIter) && lcl_findEntry_impl(pTreeView->getListBox(), rOldName, *xIter))
743 rTreeView.set_text(*xIter, rNewName);
744 break;
745 }
746 case E_FORM:
747 case E_REPORT:
748 {
749 std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
750 if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), rOldName, *xIter))
751 rTreeView.set_text(*xIter, rNewName);
752 break;
753 }
754 default:
755 OSL_FAIL("Invalid element type");
756 }
757
758 rTreeView.make_sorted();
759}
760
761std::unique_ptr<weld::TreeIter> OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
762{
763 std::unique_ptr<weld::TreeIter> xRet;
764 DBTreeViewBase* pTreeView = m_aLists[_eType].get();
765 if (!pTreeView)
766 return xRet;
767 weld::TreeView& rTreeView = pTreeView->GetWidget();
768 rTreeView.make_unsorted();
769 if (_eType == E_TABLE)
770 {
771 xRet = static_cast<OTableTreeListBox&>(pTreeView->getListBox()).addedTable( _rName );
772 }
773 else
774 {
775 std::unique_ptr<weld::TreeIter> xEntry;
776 Reference<XChild> xChild(_rObject,UNO_QUERY);
777 if ( xChild.is() && E_QUERY != _eType )
778 {
779 Reference<XContent> xContent(xChild->getParent(),UNO_QUERY);
780 if ( xContent.is() )
781 {
782 OUString sName = xContent->getIdentifier()->getContentIdentifier();
783 std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
784 if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), sName, *xIter))
785 xEntry = std::move(xIter);
786 }
787 }
788
789 OUString sImageId = getElementIcons(_eType);
790 Reference<XNameAccess> xContainer(_rObject,UNO_QUERY);
791 if ( xContainer.is() )
792 {
793 const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
794 OUString sId(OUString::number(nFolderIndicator));
795
796 xRet = rTreeView.make_iterator();
797 rTreeView.insert(xEntry.get(), -1, nullptr, &sId, nullptr, nullptr, false, xRet.get());
798 rTreeView.set_text(*xRet, _rName, 0);
799 rTreeView.set_text_emphasis(*xRet, false, 0);
800 fillNames(xContainer, _eType, sImageId, xRet.get());
801 }
802 else
803 {
804 xRet = rTreeView.make_iterator();
805 rTreeView.insert(xEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xRet.get());
806 rTreeView.set_text(*xRet, _rName, 0);
807 rTreeView.set_text_emphasis(*xRet, false, 0);
808 rTreeView.set_image(*xRet, sImageId);
809 }
810 }
811 rTreeView.make_sorted();
812 return xRet;
813}
814
815void OAppDetailPageHelper::elementRemoved( ElementType _eType,const OUString& _rName )
816{
817 DBTreeViewBase* pTreeView = getCurrentView();
818 if ( !pTreeView )
819 return;
820
821 weld::TreeView& rTreeView = pTreeView->GetWidget();
822
823 switch( _eType )
824 {
825 case E_TABLE:
826 // we don't need to clear the table here, it is already done by the dispose listener
827 static_cast<OTableTreeListBox&>(pTreeView->getListBox()).removedTable(_rName);
828 break;
829 case E_QUERY:
830 {
831 std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
832 if (rTreeView.get_iter_first(*xIter) && lcl_findEntry_impl(pTreeView->getListBox(), _rName, *xIter))
833 rTreeView.remove(*xIter);
834 break;
835 }
836 case E_FORM:
837 case E_REPORT:
838 {
839 std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
840 if (rTreeView.get_iter_first(*xIter) && lcl_findEntry(pTreeView->getListBox(), _rName, *xIter))
841 rTreeView.remove(*xIter);
842 break;
843 }
844 default:
845 OSL_FAIL("Invalid element type");
846 }
847 if (!rTreeView.n_children())
848 showPreview(nullptr);
849}
850
851IMPL_LINK(OAppDetailPageHelper, OnEntryDoubleClick, weld::TreeView&, rTreeView, bool)
852{
853 return getBorderWin().getView()->getAppController().onEntryDoubleClick(rTreeView);
854}
855
856IMPL_LINK_NOARG(OAppDetailPageHelper, OnEntrySelChange, LinkParamNone*, void)
857{
858 getBorderWin().getView()->getAppController().onSelectionChanged();
859}
860
861IMPL_LINK_NOARG( OAppDetailPageHelper, OnCopyEntry, LinkParamNone*, void )
862{
863 getBorderWin().getView()->getAppController().onCopyEntry();
864}
865
866IMPL_LINK_NOARG( OAppDetailPageHelper, OnPasteEntry, LinkParamNone*, void )
867{
868 getBorderWin().getView()->getAppController().onPasteEntry();
869}
870
871IMPL_LINK_NOARG( OAppDetailPageHelper, OnDeleteEntry, LinkParamNone*, void )
872{
873 getBorderWin().getView()->getAppController().onDeleteEntry();
874}
875
877{
879}
880
881namespace
882{
883 OUString stripTrailingDots(std::u16string_view rStr)
884 {
885 return OUString(comphelper::string::stripEnd(rStr, '.'));
886 }
887}
888
890{
891 if ( !(m_ePreviewMode != _eMode || _bForce) )
892 return;
893
894 m_ePreviewMode = _eMode;
895
896 getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode));
897
898 OUString aCommand;
899 switch ( m_ePreviewMode )
900 {
902 aCommand = ".uno:DBDisablePreview";
903 break;
905 aCommand = ".uno:DBShowDocPreview";
906 break;
908 if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
909 aCommand = ".uno:DBShowDocInfoPreview";
910 else
911 {
913 aCommand = ".uno:DBDisablePreview";
914 }
915 break;
916 }
917
918 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
920 m_xMBPreview->set_label(stripTrailingDots(aCommandLabel));
921
922 // simulate a selectionChanged event at the controller, to force the preview to be updated
923 if ( isPreviewEnabled() )
924 {
925 DBTreeViewBase* pCurrent = getCurrentView();
926 if (pCurrent && pCurrent->GetWidget().get_selected(nullptr))
927 {
929 }
930 }
931 else
932 {
933 m_xTablePreview->hide();
934 m_xPreview->Hide();
935 m_xDocumentInfo->Hide();
936 }
937}
938
940{
941 if ( !isPreviewEnabled() )
942 return;
943
944 m_xTablePreview->hide();
945
947 try
948 {
949 Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
950 if ( xContent.is() )
951 {
952 css::ucb::Command aCommand;
954 aCommand.Name = "preview";
955 else
956 aCommand.Name = "getDocumentInfo";
957
958 Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
960 {
961 m_xDocumentInfo->Hide();
962 m_xPreview->Show();
963
964 Graphic aGraphic;
965 Sequence < sal_Int8 > aBmpSequence;
966 if ( aPreview >>= aBmpSequence )
967 {
968 SvMemoryStream aData( aBmpSequence.getArray(),
969 aBmpSequence.getLength(),
970 StreamMode::READ );
971
972 GraphicConverter::Import(aData,aGraphic);
973 }
974 m_xPreview->setGraphic( aGraphic );
975 m_xPreview->Invalidate();
976 }
977 else
978 {
979 m_xPreview->Hide();
980 m_xDocumentInfo->clear();
981 m_xDocumentInfo->Show();
982 Reference<document::XDocumentProperties> xProp(
983 aPreview, UNO_QUERY);
984 if ( xProp.is() )
985 m_xDocumentInfo->fill(xProp);
986 }
987 }
988 else
989 {
990 m_xPreview->Hide();
991 m_xDocumentInfo->Hide();
992 }
993 }
994 catch( const Exception& )
995 {
996 DBG_UNHANDLED_EXCEPTION("dbaccess");
997 }
998}
999
1000void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
1001 const OUString& _sName,
1002 bool _bTable)
1003{
1004 if ( !isPreviewEnabled() )
1005 return;
1006
1008 m_xPreview->Hide();
1009 m_xDocumentInfo->Hide();
1010 m_xTablePreview->show();
1011 if ( !m_xFrame.is() )
1012 {
1013 try
1014 {
1015 m_xFrame = Frame::create( getBorderWin().getView()->getORB() );
1016 m_xFrame->initialize( m_xWindow );
1017
1018 // no layout manager (and thus no toolbars) in the preview
1019 // Must be called after initialize ... but before any other call to this frame.
1020 // Otherwise frame throws "life time exceptions" as e.g. NON_INITIALIZED
1021 m_xFrame->setLayoutManager( Reference< XLayoutManager >() );
1022
1023 Reference<XFramesSupplier> xSup(getBorderWin().getView()->getAppController().getXController()->getFrame(),UNO_QUERY);
1024 if ( xSup.is() )
1025 {
1026 Reference<XFrames> xFrames = xSup->getFrames();
1027 xFrames->append( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW));
1028 }
1029 }
1030 catch(const Exception&)
1031 {
1032 }
1033 }
1034
1035 Reference< XDatabaseDocumentUI > xApplication( getBorderWin().getView()->getAppController().getXController(), UNO_QUERY );
1036 std::unique_ptr< DatabaseObjectView > pDispatcher( new ResultSetBrowser(
1037 getBorderWin().getView()->getORB(),
1038 xApplication, nullptr, _bTable
1039 ) );
1040 pDispatcher->setTargetFrame( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW) );
1041
1043 aArgs.put( "Preview", true );
1044 aArgs.put( "ReadOnly", true );
1045 aArgs.put( "AsTemplate", false );
1046 aArgs.put( PROPERTY_SHOWMENU, false );
1047
1048 Reference< XController > xPreview( pDispatcher->openExisting( Any( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
1049 bool bClearPreview = !xPreview.is();
1050
1051 // clear the preview when the query or table could not be loaded
1052 if ( !bClearPreview )
1053 {
1054 Reference< XTabController > xTabController( xPreview, UNO_QUERY );
1055 bClearPreview = !xTabController.is();
1056 if ( !bClearPreview )
1057 {
1058 Reference< XLoadable > xLoadable( xTabController->getModel(), UNO_QUERY );
1059 bClearPreview = !( xLoadable.is() && xLoadable->isLoaded() );
1060 }
1061 }
1062 if ( bClearPreview )
1063 showPreview(nullptr);
1064}
1065
1066namespace
1067{
1068 class MenuStatusListener final : public ::cppu::WeakImplHelper<css::frame::XStatusListener>
1069 {
1070 weld::MenuButton& m_rMBPreview;
1071 public:
1072 MenuStatusListener(weld::MenuButton& rMBPreview)
1073 : m_rMBPreview(rMBPreview)
1074 {
1075 }
1076
1077 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) override
1078 {
1079 if (!rEvent.IsEnabled)
1080 {
1081 const OUString &rURL = rEvent.FeatureURL.Complete;
1082 m_rMBPreview.remove_item(rURL);
1083 }
1084 }
1085
1086 virtual void SAL_CALL disposing( const css::lang::EventObject& /*rSource*/) override
1087 {
1088 }
1089 };
1090};
1091
1092IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, weld::Toggleable&, void)
1093{
1094 if (!m_xMBPreview->get_active())
1095 return;
1096
1097 m_xMBPreview->clear();
1098
1099 // execute the menu
1100 css::uno::Reference<css::uno::XComponentContext> xContext(getBorderWin().getView()->getORB());
1101 css::uno::Reference<css::frame::XUIControllerFactory> xPopupMenuFactory(css::frame::thePopupMenuControllerFactory::get(xContext));
1102 if (!xPopupMenuFactory.is())
1103 return;
1104
1105 auto xFrame = getBorderWin().getView()->getAppController().getFrame();
1106
1107 css::uno::Sequence<css::uno::Any> aArgs {
1108 css::uno::Any(comphelper::makePropertyValue("InToolbar", true)),
1109 css::uno::Any(comphelper::makePropertyValue("ModuleIdentifier", OUString("com.sun.star.sdb.OfficeDatabaseDocument"))),
1110 css::uno::Any(comphelper::makePropertyValue("Frame", xFrame)) };
1111
1112 css::uno::Reference<css::frame::XPopupMenuController> xPopupController
1113 (xPopupMenuFactory->createInstanceWithArgumentsAndContext(".uno:DBPreview", aArgs, xContext), css::uno::UNO_QUERY);
1114
1115 if (!xPopupController.is())
1116 return;
1117
1118 css::uno::Reference<css::awt::XPopupMenu> xPopupMenu(css::awt::PopupMenu::create(xContext));
1119 xPopupController->setPopupMenu(xPopupMenu);
1120
1121 css::util::URL aTargetURL;
1122 Reference<XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
1123
1124 css::uno::Reference<css::frame::XStatusListener> xStatusListener(new MenuStatusListener(*m_xMBPreview));
1125
1126 for (int i = 0, nCount = xPopupMenu->getItemCount(); i < nCount; ++i)
1127 {
1128 auto nItemId = xPopupMenu->getItemId(i);
1129 // in practice disabled items are initially enabled so this doesn't have an effect and
1130 // an status update is needed to query the enabled/disabled state
1131 if (!xPopupMenu->isItemEnabled(nItemId))
1132 continue;
1133
1134 aTargetURL.Complete = xPopupMenu->getCommand(nItemId);
1135
1137 "com.sun.star.sdb.OfficeDatabaseDocument");
1138 m_xMBPreview->append_item(aTargetURL.Complete, vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
1139
1140 // Add/remove status listener to get a status update once so we can remove any disabled items from the menu
1141 auto xDispatch = xDispatchProvider->queryDispatch(aTargetURL, "_self",
1142 css::frame::FrameSearchFlag::SELF);
1143 if (xDispatch.is())
1144 {
1145 xDispatch->addStatusListener(xStatusListener, aTargetURL);
1146 xDispatch->removeStatusListener(xStatusListener, aTargetURL);
1147 }
1148 }
1149
1150 css::uno::Reference<css::lang::XComponent> xComponent(xPopupController, css::uno::UNO_QUERY);
1151 if (xComponent.is())
1152 xComponent->dispose();
1153}
1154
1155IMPL_LINK(OAppDetailPageHelper, MenuSelectHdl, const OUString&, rIdent, void)
1156{
1157 if (rIdent.isEmpty())
1158 return;
1159
1160 css::util::URL aURL;
1161 aURL.Complete = rIdent;
1162
1163 Reference<XDispatchProvider> xProvider(getBorderWin().getView()->getAppController().getFrame(), UNO_QUERY);
1164 Reference<XDispatch> xDisp = xProvider->queryDispatch(aURL, "_self", 0);
1165 xDisp->dispatch(aURL, css::uno::Sequence<css::beans::PropertyValue>());
1166
1167 m_xMBPreview->set_label(stripTrailingDots(m_xMBPreview->get_item_label(rIdent)));
1168}
1169
1171{
1172}
1173
1174bool OPreviewWindow::ImplGetGraphicCenterRect(const vcl::RenderContext& rRenderContext, const Graphic& rGraphic, tools::Rectangle& rResultRect) const
1175{
1176 const Size aWinSize( GetOutputSizePixel() );
1177 Size aNewSize(rRenderContext.LogicToPixel(rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode()));
1178 bool bRet = false;
1179
1180 if( aNewSize.Width() && aNewSize.Height() )
1181 {
1182 // scale to fit window
1183 const double fGrfWH = static_cast<double>(aNewSize.Width()) / aNewSize.Height();
1184 const double fWinWH = static_cast<double>(aWinSize.Width()) / aWinSize.Height();
1185
1186 if ( fGrfWH < fWinWH )
1187 {
1188 aNewSize.setWidth( static_cast<tools::Long>( aWinSize.Height() * fGrfWH ) );
1189 aNewSize.setHeight( aWinSize.Height() );
1190 }
1191 else
1192 {
1193 aNewSize.setWidth( aWinSize.Width() );
1194 aNewSize.setHeight( static_cast<tools::Long>( aWinSize.Width() / fGrfWH) );
1195 }
1196
1197 const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1,
1198 ( aWinSize.Height() - aNewSize.Height() ) >> 1 );
1199
1200 rResultRect = tools::Rectangle( aNewPos, aNewSize );
1201 bRet = true;
1202 }
1203
1204 return bRet;
1205}
1206
1207void OPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
1208{
1210 {
1211 const Point aPos(m_aPreviewRect.TopLeft());
1212 const Size aSize(m_aPreviewRect.GetSize());
1213
1215 m_aGraphicObj.StartAnimation(rRenderContext, aPos, aSize);
1216 else
1217 m_aGraphicObj.Draw(rRenderContext, aPos, aSize);
1218 }
1219}
1220
1221/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sComposedName
OptionalString sName
PropertiesInfo aProperties
static ErrCode Import(SvStream &rIStm, Graphic &rGraphic, ConvertDataFormat nFormat=ConvertDataFormat::Unknown)
const Graphic & GetGraphic() const
bool IsAnimated() const
bool StartAnimation(OutputDevice &rOut, const Point &rPt, const Size &rSz, tools::Long nExtraData=0, OutputDevice *pFirstFrameOutDev=nullptr)
bool Draw(OutputDevice &rOut, const Point &rPt, const Size &rSz, const GraphicAttr *pAttr=nullptr) const
Size GetPrefSize() const
MapMode GetPrefMapMode() const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
TreeListBox & getListBox() const
weld::TreeView & GetWidget()
weld::Container & getTopLevel()
Definition: AppView.hxx:62
OApplicationView * getView() const
Definition: AppView.hxx:59
std::unique_ptr< weld::MenuButton > m_xMBPreview
void sortUp()
sorts all entries descending
void fillNames(const css::uno::Reference< css::container::XNameAccess > &_xContainer, const ElementType _eType, const OUString &rImageId, const weld::TreeIter *_pParent)
fills the names in the listbox
static bool isLeaf(const weld::TreeView &rTreeView, const weld::TreeIter &rEntry)
returns if an entry is a leaf
void sortDown()
sorts all entries ascending
bool isSortUp() const
returns <TRUE> if it sorts ascending
void sort(int nPos, bool bAscending)
sorts the entries in the tree list box.
std::unique_ptr< weld::CustomWeld > m_xDocumentInfoWin
std::unique_ptr< weld::Widget > m_xFL
virtual ~OAppDetailPageHelper() override
virtual bool HasChildPathFocus() const override
OUString getQualifiedName(const weld::TreeIter *_pEntry) const
return the qualified name.
std::unique_ptr< DBTreeViewBase > createSimpleTree(const OUString &rHelpId, ElementType eType)
creates the tree and sets all HandleCallbacks
std::unique_ptr< weld::Container > m_xTablePreview
void elementReplaced(ElementType eType, const OUString &_rOldName, const OUString &_rNewName)
replaces an objects name with a new one
vcl::Window * getMenuParent() const
get the menu parent window for the given control
static OUString getElementIcons(ElementType _eType)
retrieves the resource ids of the images representing elements of the given type
sal_Int32 getSelectionCount()
returns the count of selected entries
std::unique_ptr< weld::CustomWeld > m_xPreviewWin
bool isALeafSelected() const
returns if one of the selected entries is a leaf
int getVisibleControlIndex() const
returns the index of the visible control
void selectAll()
select all entries in the visible control
void setDetailPage(DBTreeViewBase &rTreeView)
sets the detail page
void setupTree(DBTreeViewBase &rTreeView)
sets all HandleCallbacks
std::unique_ptr< weld::TreeIter > getEntry(const Point &rPosPixel) const
bool isFilled() const
returns <TRUE> when a detail page was filled
css::uno::Reference< css::awt::XWindow > m_xWindow
DBTreeViewBase * getCurrentView() const
returns the current visible tree list box
virtual void GrabFocus() override
std::unique_ptr< weld::Container > m_xBox
void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const
std::unique_ptr< ODocumentInfoPreview > m_xDocumentInfo
void elementRemoved(ElementType _eType, const OUString &_rName)
removes an element from the detail page.
bool isPreviewEnabled() const
<TRUE> if the preview is enabled
sal_Int32 getElementCount() const
returns the count of entries
OAppBorderWindow & getBorderWin() const
std::unique_ptr< weld::TreeIter > elementAdded(ElementType eType, const OUString &rName, const css::uno::Any &rObject)
adds a new object to the detail page.
void getSelectionElementNames(std::vector< OUString > &_rNames) const
returns the element names which are selected
void createPage(ElementType _eType, const css::uno::Reference< css::container::XNameAccess > &_xContainer)
creates the page for the specific type.
css::uno::Reference< css::frame::XFrame2 > m_xFrame
void describeCurrentSelectionForType(const ElementType _eType, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given ElementType
void selectElements(const css::uno::Sequence< OUString > &_aNames)
select all names on the currently selected container.
ElementType getElementType() const
return the element of currently select entry
void showPreview(const css::uno::Reference< css::ucb::XContent > &_xContent)
shows the Preview of the content when it is enabled.
std::unique_ptr< DBTreeViewBase > m_aLists[size_t(E_ELEMENT_TYPE_COUNT)]
void switchPreview(PreviewMode _eMode, bool _bForce=false)
switches to the given preview mode
void describeCurrentSelectionForControl(const weld::TreeView &rControl, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given control
void clearPages()
clears the detail pages
std::unique_ptr< OPreviewWindow > m_xPreview
void createTablesPage(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
creates the tables page
void onSelectionChanged()
called when an entry in a tree view has been selected
void containerFound(const css::uno::Reference< css::container::XContainer > &_xContainer)
called when an object container of any kind was found during enumerating tree view elements
void previewChanged(sal_Int32 _nMode)
called when the preview mode was changed
OApplicationController & getAppController() const
Definition: AppView.hxx:114
std::unique_ptr< weld::Container > m_xContainer
Definition: ChildWindow.hxx:21
bool ImplGetGraphicCenterRect(const vcl::RenderContext &rRenderContext, const Graphic &rGraphic, tools::Rectangle &rResultRect) const
gets the graphic center rect
tools::Rectangle m_aPreviewRect
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
OUString getQualifiedTableName(const weld::TreeIter &rEntry) const
returns the fully qualified name of a table entry
Definition: tabletree.cxx:514
css::sdb::application::NamedDatabaseObject describeObject(const weld::TreeIter &rEntry)
returns a NamedDatabaseObject record which describes the given entry
Definition: tabletree.cxx:466
std::unique_ptr< weld::TreeIter > GetEntryPosByName(std::u16string_view rName, const weld::TreeIter *pStart=nullptr, const IEntryFilter *pFilter=nullptr) const
void setControlActionListener(IControlActionListener *pListener)
void setDeleteHandler(const Link< LinkParamNone *, void > &_rHdl)
void setPasteHandler(const Link< LinkParamNone *, void > &_rHdl)
void setCopyHandler(const Link< LinkParamNone *, void > &_rHdl)
void SetSelChangeHdl(const Link< LinkParamNone *, void > &_rHdl)
void setContextMenuProvider(IContextMenuProvider *pContextMenuProvider)
constexpr Point TopLeft() const
constexpr Size GetSize() const
weld::Window * GetFrameWeld() const
Size const & GetOutputSizePixel() const
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual bool get_selected(TreeIter *pIter) const=0
virtual void make_sorted()=0
virtual void expand_row(const TreeIter &rIter)=0
void connect_row_activated(const Link< TreeView &, bool > &rLink)
virtual void set_text(int row, const OUString &rText, int col=-1)=0
virtual OUString get_text(int row, int col=-1) const=0
virtual int n_children() const=0
void unselect_all()
virtual void set_selection_mode(SelectionMode eMode)=0
virtual void set_text_emphasis(int row, bool bOn, int col)=0
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter *pResult, bool bDnDMode, bool bAutoScroll=true)=0
virtual void selected_foreach(const std::function< bool(TreeIter &)> &func)=0
virtual void set_image(int row, const OUString &rImage, int col=-1)=0
virtual bool get_iter_first(TreeIter &rIter) const=0
virtual void remove(int pos)=0
virtual bool iter_next_sibling(TreeIter &rIter) const=0
virtual void select(int pos)=0
virtual bool iter_parent(TreeIter &rIter) const=0
virtual bool iter_children(TreeIter &rIter) const=0
virtual bool iter_has_child(const TreeIter &rIter) const=0
virtual void make_unsorted()=0
virtual int count_selected_rows() const=0
virtual OUString get_id(int pos) const=0
virtual void grab_focus()=0
virtual bool get_extents_relative_to(const Widget &rRelative, int &x, int &y, int &width, int &height) const=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual bool has_focus() const=0
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XDispatch > xDispatch
float y
float x
OUString eType
Definition: generalpage.cxx:78
constexpr OUStringLiteral HID_APP_FORM_TREE
Definition: helpids.h:87
constexpr OUStringLiteral HID_APP_REPORT_TREE
Definition: helpids.h:89
constexpr OUStringLiteral HID_APP_VIEW_PREVIEW_2
Definition: helpids.h:98
constexpr OUStringLiteral HID_APP_QUERY_TREE
Definition: helpids.h:88
constexpr OUStringLiteral HID_APP_TABLE_TREE
Definition: helpids.h:86
constexpr OUStringLiteral HID_APP_VIEW_PREVIEW_CB
Definition: helpids.h:96
constexpr OUStringLiteral HID_APP_VIEW_PREVIEW_1
Definition: helpids.h:97
constexpr OUStringLiteral HID_APP_VIEW_PREVIEW_3
Definition: helpids.h:100
URL aURL
Definition: intercept.cxx:87
sal_Int32 nIndex
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
constexpr OUStringLiteral aData
@ Exception
OString stripEnd(const OString &rIn, char c)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
@ E_ELEMENT_TYPE_COUNT
int i
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
SwView * getView(const uno::Reference< frame::XModel > &xModel)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
constexpr OUStringLiteral PROPERTY_SHOWMENU(u"ShowMenu")
Reference< XFrame > xFrame
the frame which the component resides in. Must not be <NULL>
OUString aCommand
OUString aTargetURL
OUString sId
Definition: unodatbr.cxx:1040