LibreOffice Module dbaccess (master) 1
AppController.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
20#include <memory>
21#include "AppController.hxx"
22#include <core_resource.hxx>
23#include <dbexchange.hxx>
24#include <strings.hxx>
27
28#include <com/sun/star/beans/NamedValue.hpp>
29#include <com/sun/star/container/XChild.hpp>
30#include <com/sun/star/container/XContainer.hpp>
31#include <com/sun/star/container/XContentEnumerationAccess.hpp>
32#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
33#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
34#include <com/sun/star/frame/XStorable.hpp>
35#include <com/sun/star/sdb/CommandType.hpp>
36#include <com/sun/star/sdb/ErrorMessageDialog.hpp>
37#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
38#include <com/sun/star/sdbc/SQLException.hpp>
39#include <com/sun/star/sdbc/SQLWarning.hpp>
40#include <com/sun/star/sdbc/XDataSource.hpp>
41#include <com/sun/star/sdbcx/XAlterView.hpp>
42#include <com/sun/star/sdbcx/XAppend.hpp>
43#include <com/sun/star/sdbcx/XRename.hpp>
44#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
45#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
46#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
47#include <com/sun/star/util/XFlushable.hpp>
48#include <com/sun/star/util/XModifiable.hpp>
49#include <com/sun/star/util/XModifyBroadcaster.hpp>
50#include <com/sun/star/util/XURLTransformer.hpp>
51#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
52#include <com/sun/star/document/XEmbeddedScripts.hpp>
53#include <com/sun/star/frame/XModel2.hpp>
54#include <com/sun/star/task/XInteractionHandler.hpp>
55#include <com/sun/star/sdb/application/DatabaseObject.hpp>
56#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
57#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
59#include <tools/urlobj.hxx>
60#include <osl/diagnose.h>
61
62#include <svl/filenotation.hxx>
63#include <vcl/transfer.hxx>
65
68#include <comphelper/uno3.hxx>
69#include <comphelper/types.hxx>
71
72#include <vcl/svapp.hxx>
73#include <vcl/weld.hxx>
74
79
80#include <sfx2/mailmodelapi.hxx>
82#include <sfx2/docfilt.hxx>
84
86
89
90#include <svx/dbaexchange.hxx>
91#include <svx/dbaobjectex.hxx>
92#include <svx/svxdlg.hxx>
93
94#include <osl/mutex.hxx>
95#include "AppView.hxx"
96#include <browserids.hxx>
97#include <strings.hrc>
100#include <dbtreelistbox.hxx>
101#include "AppDetailView.hxx"
102#include <linkeddocuments.hxx>
103#include <UITools.hxx>
104#include <dsntypes.hxx>
105#include <dlgsave.hxx>
106#include <dbaccess_slotid.hrc>
107
108extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
110 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
111{
112 return cppu::acquire(new ::dbaui::OApplicationController(context));
113}
114
115namespace dbaui
116{
117using namespace ::dbtools;
118using namespace ::svx;
119using namespace ::com::sun::star;
120using namespace ::com::sun::star::uno;
121using namespace ::com::sun::star::ucb;
122using namespace ::com::sun::star::view;
123using namespace ::com::sun::star::util;
124using namespace ::com::sun::star::beans;
125using namespace ::com::sun::star::lang;
126using namespace ::com::sun::star::frame;
127using namespace ::com::sun::star::container;
128using namespace ::com::sun::star::sdb;
129using namespace ::com::sun::star::sdbc;
130using namespace ::com::sun::star::sdbcx;
131using namespace ::com::sun::star::datatransfer;
132using namespace ::com::sun::star::ui::dialogs;
133using namespace ::com::sun::star::task;
134using ::com::sun::star::document::XEmbeddedScripts;
135using ::com::sun::star::document::XDocumentEventBroadcaster;
136using ::com::sun::star::sdb::application::NamedDatabaseObject;
137
138namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
139namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
140
142{
144}
145
147{
148 return { "com.sun.star.sdb.application.DefaultViewController" };
149}
150
151namespace {
152
153class SelectionGuard;
154
155}
156
157// OApplicationController
159{
160private:
164
165public:
166 SelectionNotifier( ::osl::Mutex& _rMutex, ::cppu::OWeakObject& _rContext )
167 :m_aSelectionListeners( _rMutex )
168 ,m_rContext( _rContext )
170 {
171 }
172
175
177 {
179 }
180
182 {
184 }
185
187 {
188 EventObject aEvent( m_rContext );
190 }
191
193
200 {
202 }
203
212 {
213 if ( --m_nSelectionNestingLevel == 0 )
214 {
215 EventObject aEvent( m_rContext );
216 m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvent );
217 }
218 }
219};
220
221namespace {
222
223class SelectionGuard
224{
225public:
226 explicit SelectionGuard( SelectionNotifier& _rNotifier )
227 :m_rNotifier( _rNotifier )
228 {
229 m_rNotifier.enterSelection( SelectionNotifier::SelectionGuardAccess() );
230 }
231
232 ~SelectionGuard()
233 {
234 m_rNotifier.leaveSelection( SelectionNotifier::SelectionGuardAccess() );
235 }
236
237 SelectionGuard(const SelectionGuard&) = delete;
238 const SelectionGuard& operator=(const SelectionGuard&) = delete;
239
240private:
241 SelectionNotifier& m_rNotifier;
242};
243
244}
245
246// OApplicationController
248 :OGenericUnoController( _rxORB )
249 ,m_aContextMenuInterceptors( getMutex() )
250 ,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
251 ,m_aTypeCollection( _rxORB )
252 ,m_aTableCopyHelper(this)
253 ,m_nAsyncDrop(nullptr)
254 ,m_aSelectContainerEvent( LINK( this, OApplicationController, OnSelectContainer ) )
255 ,m_ePreviewMode(PreviewMode::NONE)
256 ,m_eCurrentType(E_NONE)
257 ,m_bNeedToReconnect(false)
258 ,m_bSuspended( false )
259 ,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
260{
261}
262
264{
265 if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
266 {
267 OSL_FAIL("Please check who doesn't dispose this component!");
268 // increment ref count to prevent double call of Dtor
269 osl_atomic_increment( &m_refCount );
270 dispose();
271 }
272 clearView();
273}
274
277void OApplicationController::disconnect()
278{
279 if ( m_xDataSourceConnection.is() )
280 stopConnectionListening( m_xDataSourceConnection );
281
282 try
283 {
284 // temporary (hopefully!) hack for #i55274#
285 Reference< XFlushable > xFlush( m_xDataSourceConnection, UNO_QUERY );
286 if ( xFlush.is() && m_xMetaData.is() && !m_xMetaData->isReadOnly() )
287 xFlush->flush();
288 }
289 catch( const Exception& )
290 {
291 DBG_UNHANDLED_EXCEPTION("dbaccess");
292 }
293
294 m_xDataSourceConnection.clear();
295 m_xMetaData.clear();
296
297 InvalidateAll();
298}
299
301{
302 for( const auto& rContainerListener : m_aCurrentContainers )
303 {
304 if( rContainerListener.is() )
305 {
306 rContainerListener->removeContainerListener( this );
307 }
308 }
309
310 m_aCurrentContainers.clear();
311 m_pSubComponentManager->disposing();
312 m_pSelectionNotifier->disposing();
313
314 if ( getView() )
315 {
316 getContainer()->showPreview(nullptr);
317 m_pClipboardNotifier->ClearCallbackLink();
318 m_pClipboardNotifier->RemoveListener( getView() );
319 m_pClipboardNotifier.clear();
320 }
321
322 disconnect();
323 try
324 {
327
328 if ( m_xDataSource.is() )
329 {
330 m_xDataSource->removePropertyChangeListener(OUString(), this);
331 m_xDataSource->removePropertyChangeListener(PROPERTY_INFO, this);
332 m_xDataSource->removePropertyChangeListener(PROPERTY_URL, this);
333 m_xDataSource->removePropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
334 m_xDataSource->removePropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this);
335 m_xDataSource->removePropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this);
336 m_xDataSource->removePropertyChangeListener(PROPERTY_TABLEFILTER, this);
337 m_xDataSource->removePropertyChangeListener(PROPERTY_TABLETYPEFILTER, this);
338 m_xDataSource->removePropertyChangeListener(PROPERTY_USER, this);
339 m_xDataSource = nullptr;
340 }
341
342 Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
343 if ( xBroadcaster.is() )
344 xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this));
345
346 if ( m_xModel.is() )
347 {
348 OUString sUrl = m_xModel->getURL();
349 if ( !sUrl.isEmpty() )
350 {
351 if ( ::comphelper::NamedValueCollection::getOrDefault( m_xModel->getArgs(), u"PickListEntry", true ) )
352 {
353 OUString aFilter;
354 INetURLObject aURL( m_xModel->getURL() );
355 std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
356 if ( pFilter )
357 aFilter = pFilter->GetFilterName();
358
359 // add to svtool history options
360 SvtHistoryOptions::AppendItem( EHistoryType::PickList,
362 aFilter,
364 std::nullopt, std::nullopt);
365
366 // add to recent document list
367 if ( aURL.GetProtocol() == INetProtocol::File )
369 pFilter ? pFilter->GetMimeType() : OUString(),
370 pFilter ? pFilter->GetServiceName() : OUString() );
371 }
372 }
373
374 m_xModel->disconnectController( this );
375
376 m_xModel.clear();
377 }
378 }
379 catch(const Exception&)
380 {
381 DBG_UNHANDLED_EXCEPTION("dbaccess");
382 }
383
384 clearView();
385 OGenericUnoController::disposing(); // here the m_refCount must be equal 5
386}
387
389{
391
392 // late construction
393 bool bSuccess = false;
394 try
395 {
397 bSuccess = true;
398 }
399 catch(const SQLException&)
400 {
401 }
402 catch(const Exception&)
403 {
404 OSL_FAIL("OApplicationController::Construct : the construction of UnoDataBrowserView failed !");
405 }
406
407 if ( !bSuccess )
408 {
409 clearView();
410 return false;
411 }
412
413 // now that we have a view we can create the clipboard listener
416
418 m_pClipboardNotifier->AddListener( getView() );
419
421 getView()->Show();
422
423 return true;
424}
425
426void SAL_CALL OApplicationController::disposing(const EventObject& _rSource)
427{
428 ::osl::MutexGuard aGuard( getMutex() );
429 Reference<XConnection> xCon(_rSource.Source, UNO_QUERY);
430 if ( xCon.is() )
431 {
432 OSL_ENSURE( m_xDataSourceConnection == xCon,
433 "OApplicationController::disposing: which connection does this come from?" );
434
437 if ( m_xDataSourceConnection == xCon )
438 {
439 m_xMetaData.clear();
441 }
442 }
443 else if ( _rSource.Source == m_xModel )
444 {
445 m_xModel.clear();
446 }
447 else if ( _rSource.Source == m_xDataSource )
448 {
449 m_xDataSource = nullptr;
450 }
451 else
452 {
453 Reference<XContainer> xContainer( _rSource.Source, UNO_QUERY );
454 if ( xContainer.is() )
455 {
456 TContainerVector::iterator aFind = std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer);
457 if ( aFind != m_aCurrentContainers.end() )
458 m_aCurrentContainers.erase(aFind);
459 }
461 }
462}
463
465{
466 // notify the OnPrepareViewClosing event (before locking any mutex)
467 Reference< XDocumentEventBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
468 if ( xBroadcaster.is() )
469 {
470 xBroadcaster->notifyDocumentEvent(
471 "OnPrepareViewClosing",
472 this,
473 Any()
474 );
475 }
476
477 SolarMutexGuard aSolarGuard;
478 ::osl::MutexGuard aGuard( getMutex() );
479
480 if ( getView() && getView()->IsInModalMode() )
481 return false;
482
483 bool bCanSuspend = true;
484
485 if ( m_bSuspended != bool(bSuspend) )
486 {
487 if ( bSuspend && !closeSubComponents() )
488 return false;
489
490 Reference<XModifiable> xModi(m_xModel,UNO_QUERY);
491 Reference<XStorable> xStor(getModel(),UNO_QUERY);
492
493 if ( bSuspend
494 && xStor.is()
495 && !xStor->isReadonly()
496 && ( xModi.is()
497 && xModi->isModified()
498 )
499 )
500 {
502 {
503 case RET_YES:
505 bCanSuspend = !xModi->isModified();
506 // when we save the document this must be false else some press cancel
507 break;
508 case RET_CANCEL:
509 bCanSuspend = false;
510 break;
511 default:
512 break;
513 }
514 }
515 }
516
517 if ( bCanSuspend )
518 m_bSuspended = bSuspend;
519
520 return bCanSuspend;
521}
522
524{
525 FeatureState aReturn;
526 aReturn.bEnabled = false;
527 // check this first
528 if ( !getContainer() || m_bReadOnly )
529 return aReturn;
530
531 try
532 {
533 switch (_nId)
534 {
535 case SID_NEWDOCDIRECT:
536 aReturn.bEnabled = true;
537 aReturn.sTitle = "private:factory/sdatabase";
538 break;
539 case SID_OPENURL:
540 aReturn.bEnabled = true;
541 if ( m_xModel.is() )
542 aReturn.sTitle = m_xModel->getURL();
543 break;
544 case ID_BROWSER_COPY:
545 {
546 sal_Int32 nCount = getContainer()->getSelectionCount();
547 aReturn.bEnabled = nCount >= 1;
548 if ( aReturn.bEnabled && nCount == 1 && getContainer()->getElementType() == E_TABLE )
550 }
551 break;
552 case ID_BROWSER_CUT:
554 aReturn.bEnabled = aReturn.bEnabled && (getContainer()->getElementType() != E_TABLE || getContainer()->isCutAllowed());
555 break;
556 case ID_BROWSER_PASTE:
557 switch( getContainer()->getElementType() )
558 {
559 case E_TABLE:
561 break;
562 case E_QUERY:
563 aReturn.bEnabled = !isDataSourceReadOnly() && getViewClipboard().HasFormat(SotClipboardFormatId::DBACCESS_QUERY);
564 break;
565 default:
566 aReturn.bEnabled = !isDataSourceReadOnly() && OComponentTransferable::canExtractComponentDescriptor(getViewClipboard().GetDataFlavorExVector(),getContainer()->getElementType() == E_FORM);
567 }
568 break;
569 case SID_DB_APP_PASTE_SPECIAL:
571 break;
572 case SID_OPENDOC:
573 aReturn.bEnabled = true;
574 break;
576 aReturn.bEnabled = !isDataSourceReadOnly();
577 break;
579 aReturn.bEnabled = true;
580 break;
583 aReturn.bChecked = aReturn.bEnabled && getContainer()->isSortUp();
584 break;
587 aReturn.bChecked = aReturn.bEnabled && !getContainer()->isSortUp();
588 break;
589
590 case SID_NEWDOC:
591 case SID_APP_NEW_FORM:
594 break;
595 case SID_APP_NEW_REPORT:
596 aReturn.bEnabled = !isDataSourceReadOnly()
598 if ( aReturn.bEnabled )
599 {
600 Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY);
601 aReturn.bEnabled = xEnumAccess.is();
602 if ( aReturn.bEnabled )
603 {
604 const OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_xContext);
605 aReturn.bEnabled = !sReportEngineServiceName.isEmpty();
606 if ( aReturn.bEnabled )
607 {
608 const Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
609 aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
610 }
611 }
612 }
613 break;
614 case SID_DB_APP_VIEW_TABLES:
615 aReturn.bEnabled = true;
617 break;
618 case SID_DB_APP_VIEW_QUERIES:
619 aReturn.bEnabled = true;
621 break;
622 case SID_DB_APP_VIEW_FORMS:
623 aReturn.bEnabled = true;
624 aReturn.bChecked = getContainer()->getElementType() == E_FORM;
625 break;
626 case SID_DB_APP_VIEW_REPORTS:
627 aReturn.bEnabled = true;
629 break;
631 case ID_NEW_QUERY_SQL:
633 case SID_DB_FORM_NEW_PILOT:
634 aReturn.bEnabled = !isDataSourceReadOnly();
635 break;
637 case SID_DB_NEW_VIEW_SQL:
640 if ( aReturn.bEnabled )
641 {
642 Reference<XViewsSupplier> xViewsSup( getConnection(), UNO_QUERY );
643 aReturn.bEnabled = xViewsSup.is();
644 }
645 break;
649 break;
650 case ID_DIRECT_SQL:
651 aReturn.bEnabled = true;
652 break;
653 case SID_APP_NEW_FOLDER:
655 if ( aReturn.bEnabled )
656 {
658 aReturn.bEnabled = eType == E_REPORT || eType == E_FORM;
659 }
660 break;
661 case SID_FORM_CREATE_REPWIZ_PRE_SEL:
662 case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
663 case SID_APP_NEW_REPORT_PRE_SEL:
664 aReturn.bEnabled = !isDataSourceReadOnly()
667 if ( aReturn.bEnabled )
668 {
670 aReturn.bEnabled = eType == E_QUERY || eType == E_TABLE;
671 if ( aReturn.bEnabled && SID_APP_NEW_REPORT_PRE_SEL == _nId )
672 {
673 Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY);
674 aReturn.bEnabled = xEnumAccess.is();
675 if ( aReturn.bEnabled )
676 {
677 static constexpr OUStringLiteral s_sReportDesign = u"org.libreoffice.report.pentaho.SOReportJobFactory";
678 Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign);
679 aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
680 }
681 }
682 }
683 break;
684 case SID_DB_APP_DELETE:
685 case SID_DB_APP_RENAME:
686 aReturn.bEnabled = isRenameDeleteAllowed(getContainer()->getElementType(), _nId == SID_DB_APP_DELETE);
687 break;
688 case SID_DB_APP_TABLE_DELETE:
689 case SID_DB_APP_TABLE_RENAME:
690 aReturn.bEnabled = isRenameDeleteAllowed(E_TABLE, _nId == SID_DB_APP_TABLE_DELETE);
691 break;
692 case SID_DB_APP_QUERY_DELETE:
693 case SID_DB_APP_QUERY_RENAME:
694 aReturn.bEnabled = isRenameDeleteAllowed(E_QUERY, _nId == SID_DB_APP_QUERY_DELETE);
695 break;
696 case SID_DB_APP_FORM_DELETE:
697 case SID_DB_APP_FORM_RENAME:
698 aReturn.bEnabled = isRenameDeleteAllowed(E_FORM, _nId == SID_DB_APP_FORM_DELETE);
699 break;
700 case SID_DB_APP_REPORT_DELETE:
701 case SID_DB_APP_REPORT_RENAME:
702 aReturn.bEnabled = isRenameDeleteAllowed(E_REPORT, _nId == SID_DB_APP_REPORT_DELETE);
703 break;
704
705 case SID_SELECTALL:
707 break;
708 case SID_DB_APP_EDIT:
709 case SID_DB_APP_TABLE_EDIT:
710 case SID_DB_APP_QUERY_EDIT:
711 case SID_DB_APP_FORM_EDIT:
712 case SID_DB_APP_REPORT_EDIT:
715 break;
716 case SID_DB_APP_EDIT_SQL_VIEW:
717 if ( isDataSourceReadOnly() )
718 aReturn.bEnabled = false;
719 else
720 {
721 switch ( getContainer()->getElementType() )
722 {
723 case E_QUERY:
724 aReturn.bEnabled = ( getContainer()->getSelectionCount() > 0 )
725 && ( getContainer()->isALeafSelected() );
726 break;
727 case E_TABLE:
728 aReturn.bEnabled = false;
729 // there's one exception: views which support altering their underlying
730 // command can be edited in SQL view, too
731 if ( ( getContainer()->getSelectionCount() > 0 )
732 && ( getContainer()->isALeafSelected() )
733 )
734 {
735 std::vector< OUString > aSelected;
736 getSelectionElementNames( aSelected );
737 bool bAlterableViews = true;
738 for (auto const& selectedName : aSelected)
739 {
740 bAlterableViews &= impl_isAlterableView_nothrow(selectedName);
741 if (!bAlterableViews)
742 break;
743 }
744 aReturn.bEnabled = bAlterableViews;
745 }
746 break;
747 default:
748 break;
749 }
750 }
751 break;
752 case SID_DB_APP_OPEN:
753 case SID_DB_APP_TABLE_OPEN:
754 case SID_DB_APP_QUERY_OPEN:
755 case SID_DB_APP_FORM_OPEN:
756 case SID_DB_APP_REPORT_OPEN:
758 break;
759 case SID_DB_APP_DSUSERADMIN:
760 aReturn.bEnabled = !dbaccess::ODsnTypeCollection::isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
761 break;
762 case SID_DB_APP_DSRELDESIGN:
763 aReturn.bEnabled = true;
764 break;
765 case SID_DB_APP_TABLEFILTER:
766 aReturn.bEnabled = !isDataSourceReadOnly();
767 break;
768 case SID_DB_APP_REFRESH_TABLES:
770 break;
771 case SID_DB_APP_DSPROPS:
772 aReturn.bEnabled = m_xDataSource.is() && dbaccess::ODsnTypeCollection::isShowPropertiesEnabled(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
773 break;
774 case SID_DB_APP_DSCONNECTION_TYPE:
775 aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is() && !dbaccess::ODsnTypeCollection::isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
776 break;
777 case SID_DB_APP_DSADVANCED_SETTINGS:
778 aReturn.bEnabled = m_xDataSource.is() && AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( m_aTypeCollection.getType(::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) )) );
779 break;
780 case SID_DB_APP_CONVERTTOVIEW:
781 aReturn.bEnabled = !isDataSourceReadOnly();
782 if ( aReturn.bEnabled )
783 {
785 aReturn.bEnabled = eType == E_QUERY && getContainer()->getSelectionCount() > 0;
786 if ( aReturn.bEnabled )
787 {
788 Reference<XViewsSupplier> xViewSup( getConnection(), UNO_QUERY );
789 aReturn.bEnabled = xViewSup.is() && Reference<XAppend>(xViewSup->getViews(),UNO_QUERY).is();
790 }
791 }
792 break;
793 case SID_DB_APP_DISABLE_PREVIEW:
794 aReturn.bEnabled = true;
796 break;
797 case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
798 {
800 aReturn.bEnabled = (E_REPORT == eType || E_FORM == eType);
802 }
803 break;
804 case SID_DB_APP_VIEW_DOC_PREVIEW:
805 aReturn.bEnabled = true;
807 break;
808 case ID_BROWSER_UNDO:
809 aReturn.bEnabled = false;
810 break;
811 case SID_MAIL_SENDDOC:
812 aReturn.bEnabled = true;
813 break;
814 case SID_DB_APP_SENDREPORTASMAIL:
815 {
818 }
819 break;
820 case SID_DB_APP_SENDREPORTTOWRITER:
821 case SID_DB_APP_DBADMIN:
822 aReturn.bEnabled = false;
823 break;
824 case SID_DB_APP_STATUS_TYPE:
825 aReturn.bEnabled = m_xDataSource.is();
826 if ( aReturn.bEnabled )
827 {
828 OUString sURL;
829 m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
830 OUString sDSTypeName;
832 {
833 sDSTypeName = DBA_RES(RID_STR_EMBEDDED_DATABASE);
834 }
835 else
836 {
837 sDSTypeName = m_aTypeCollection.getTypeDisplayName(sURL);
838 }
839 aReturn.sTitle = sDSTypeName;
840 }
841 break;
842 case SID_DB_APP_STATUS_DBNAME:
843 aReturn.bEnabled = m_xDataSource.is();
844 if ( aReturn.bEnabled )
845 {
846 OUString sURL;
847 m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
848 OUString sDatabaseName;
849 OUString sHostName;
850 sal_Int32 nPortNumber( -1 );
851
852 m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
853
854 if ( sDatabaseName.isEmpty() )
855 sDatabaseName = m_aTypeCollection.cutPrefix( sURL );
857 {
858 sDatabaseName = SvtPathOptions().SubstituteVariable( sDatabaseName );
859 if ( !sDatabaseName.isEmpty() )
860 {
861 ::svt::OFileNotation aFileNotation(sDatabaseName);
862 // set this decoded URL as text
863 sDatabaseName = aFileNotation.get(::svt::OFileNotation::N_SYSTEM);
864 }
865 }
866
867 if ( sDatabaseName.isEmpty() )
868 sDatabaseName = m_aTypeCollection.getTypeDisplayName( sURL );
869
870 aReturn.sTitle = sDatabaseName;
871 }
872 break;
873 case SID_DB_APP_STATUS_USERNAME:
874 aReturn.bEnabled = m_xDataSource.is();
875 if ( aReturn.bEnabled )
876 m_xDataSource->getPropertyValue( PROPERTY_USER ) >>= aReturn.sTitle;
877 break;
878 case SID_DB_APP_STATUS_HOSTNAME:
879 aReturn.bEnabled = m_xDataSource.is();
880 if ( aReturn.bEnabled )
881 {
882 OUString sURL;
883 m_xDataSource->getPropertyValue( PROPERTY_URL ) >>= sURL;
884
885 OUString sHostName, sDatabaseName;
886 sal_Int32 nPortNumber = -1;
887 m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
888 aReturn.sTitle = sHostName;
889 }
890 break;
891 default:
892 aReturn = OGenericUnoController::GetState(_nId);
893 }
894 }
895 catch(const Exception& )
896 {
897 DBG_UNHANDLED_EXCEPTION("dbaccess");
898 }
899 return aReturn;
900}
901
902namespace
903{
904 bool lcl_handleException_nothrow( const Reference< XModel >& _rxDocument, const Any& _rException )
905 {
906 bool bHandled = false;
907
908 // try handling the error with an interaction handler
910 if ( xHandler.is() )
911 {
912 rtl::Reference pRequest( new ::comphelper::OInteractionRequest( _rException ) );
913 rtl::Reference pApprove( new ::comphelper::OInteractionApprove );
914 pRequest->addContinuation( pApprove );
915
916 try
917 {
918 xHandler->handle( pRequest );
919 }
920 catch( const Exception& )
921 {
922 DBG_UNHANDLED_EXCEPTION("dbaccess");
923 }
924
925 bHandled = pApprove->wasSelected();
926 }
927 return bHandled;
928 }
929}
930
932{
933 SolarMutexGuard aSolarGuard;
934 ::osl::MutexGuard aGuard( getMutex() );
935
936 if ( isUserDefinedFeature( _nId ) )
937 {
938 OGenericUnoController::Execute( _nId, aArgs );
939 return;
940 }
941
942 if ( !getContainer() || m_bReadOnly )
943 return; // return without execution
944
945 try
946 {
947 switch(_nId)
948 {
949 case ID_BROWSER_CUT:
950 getContainer()->cut();
951 break;
952 case ID_BROWSER_COPY:
953 {
955 if ( pTransfer )
956 pTransfer->CopyToClipboard(getView());
957 }
958 break;
959 case ID_BROWSER_PASTE:
960 {
961 const TransferableDataHelper& rTransferData( getViewClipboard() );
963
964 switch( eType )
965 {
966 case E_TABLE:
967 {
968 // get the selected tablename
969 std::vector< OUString > aList;
971 if ( !aList.empty() )
973 else
975
977 }
978 break;
979
980 case E_QUERY:
981 if ( rTransferData.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) )
982 paste( E_QUERY, ODataAccessObjectTransferable::extractObjectDescriptor( rTransferData ) );
983 break;
984 default:
985 {
986 std::vector< OUString> aList;
988 OUString sFolderNameToInsertInto;
989 if ( !aList.empty() )
990 {
992 if ( xContainer.is()
993 && xContainer->hasByHierarchicalName(*aList.begin())
994 && (xContainer->getByHierarchicalName(*aList.begin()) >>= xContainer)
995 && xContainer.is()
996 )
997 sFolderNameToInsertInto = *aList.begin();
998 }
999 paste( eType, OComponentTransferable::extractComponentDescriptor( rTransferData ),
1000 sFolderNameToInsertInto );
1001 }
1002 break;
1003 }
1004 }
1005 break;
1006 case SID_DB_APP_PASTE_SPECIAL:
1007 {
1008 if ( !aArgs.hasElements() )
1009 {
1011 ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(getFrameWeld()));
1012 std::vector<SotClipboardFormatId> aFormatIds;
1014 for (auto const& formatId : aFormatIds)
1015 pDlg->Insert(formatId,"");
1016
1017 const TransferableDataHelper& rClipboard = getViewClipboard();
1018 pasteFormat(pDlg->GetFormat(rClipboard.GetTransferable()));
1019 }
1020 else
1021 {
1022 const PropertyValue* pIter = aArgs.getConstArray();
1023 const PropertyValue* pEnd = pIter + aArgs.getLength();
1024 for( ; pIter != pEnd ; ++pIter)
1025 {
1026 if ( pIter->Name == "FormatStringId" )
1027 {
1028 sal_uInt32 nTmp;
1029 if ( pIter->Value >>= nTmp )
1030 pasteFormat(static_cast<SotClipboardFormatId>(nTmp));
1031 break;
1032 }
1033 }
1034 }
1035 }
1036 break;
1037 case SID_NEWDOCDIRECT:
1038 case SID_OPENDOC:
1039 {
1040 Reference < XDispatchProvider > xProv( getFrame(), UNO_QUERY );
1041 if ( xProv.is() )
1042 {
1043 URL aURL;
1044 OUString aTarget;
1045 if ( _nId == SID_NEWDOCDIRECT )
1046 {
1047 aURL.Complete = "private:factory/sdatabase?Interactive";
1048 aTarget = "_default";
1049 }
1050 else
1051 aURL.Complete = ".uno:Open";
1052
1053 if ( m_xUrlTransformer.is() )
1054 m_xUrlTransformer->parseStrict( aURL );
1055 Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, aTarget, 0 );
1056 if ( xDisp.is() )
1057 xDisp->dispatch( aURL, Sequence < PropertyValue >() );
1058 }
1059 }
1060 break;
1061 case ID_BROWSER_SAVEDOC:
1062 {
1063 Reference< XStorable > xStore( m_xModel, UNO_QUERY_THROW );
1064 try
1065 {
1066 xStore->store();
1067 }
1068 catch( const Exception& )
1069 {
1070 lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
1071 }
1072 }
1073 break;
1074
1076 {
1077 OUString sUrl;
1078 if ( m_xModel.is() )
1079 sUrl = m_xModel->getURL();
1080
1081 ::sfx2::FileDialogHelper aFileDlg(
1082 ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
1083 FileDialogFlags::NONE, getFrameWeld());
1085 if (!sUrl.isEmpty())
1086 aFileDlg.SetDisplayDirectory( sUrl );
1087
1088 std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
1089 if ( pFilter )
1090 {
1091 aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
1092 aFileDlg.SetCurrentFilter(pFilter->GetUIName());
1093 }
1094
1095 if ( aFileDlg.Execute() != ERRCODE_NONE )
1096 break;
1097
1098 Reference<XStorable> xStore( m_xModel, UNO_QUERY_THROW );
1099 INetURLObject aURL( aFileDlg.GetPath() );
1100 try
1101 {
1102 xStore->storeAsURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), Sequence< PropertyValue >() );
1103 }
1104 catch( const Exception& )
1105 {
1106 lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
1107 }
1108
1109 /*updateTitle();*/
1110 m_bCurrentlyModified = false;
1112 if ( getContainer()->getElementType() == E_NONE )
1113 {
1116 // #i95524#
1118 refreshTables();
1119 }
1120
1121 }
1122 break;
1123 case ID_BROWSER_SORTUP:
1124 getContainer()->sortUp();
1126 break;
1130 break;
1131
1135 case SID_DB_FORM_NEW_PILOT:
1136 case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
1137 case SID_APP_NEW_REPORT_PRE_SEL:
1138 case SID_FORM_CREATE_REPWIZ_PRE_SEL:
1140 case SID_APP_NEW_FORM:
1141 case SID_APP_NEW_REPORT:
1142 case ID_NEW_QUERY_SQL:
1145 {
1147 bool bAutoPilot = false;
1149
1150 switch( _nId )
1151 {
1152 case SID_DB_FORM_NEW_PILOT:
1153 case SID_FORM_CREATE_REPWIZ_PRE_SEL:
1154 bAutoPilot = true;
1155 [[fallthrough]];
1156 case SID_APP_NEW_FORM:
1157 eType = E_FORM;
1158 break;
1160 case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
1161 bAutoPilot = true;
1162 [[fallthrough]];
1163 case SID_APP_NEW_REPORT:
1164 case SID_APP_NEW_REPORT_PRE_SEL:
1165 eType = E_REPORT;
1166 break;
1168 bAutoPilot = true;
1169 eType = E_QUERY;
1170 break;
1172 aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, true );
1173 [[fallthrough]];
1174 case ID_NEW_QUERY_SQL:
1175 eType = E_QUERY;
1176 break;
1178 bAutoPilot = true;
1179 [[fallthrough]];
1181 break;
1182 default:
1183 OSL_FAIL("illegal switch call!");
1184 }
1185 if ( bAutoPilot )
1186 getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) );
1187 else
1188 {
1189 Reference< XComponent > xDocDefinition;
1190 newElement( eType, aCreationArgs, xDocDefinition );
1191 }
1192 }
1193 break;
1194 case SID_APP_NEW_FOLDER:
1195 {
1197 OUString sName = getContainer()->getQualifiedName( nullptr );
1199 }
1200 break;
1201 case ID_NEW_VIEW_DESIGN:
1202 case SID_DB_NEW_VIEW_SQL:
1203 {
1204 SharedConnection xConnection( ensureConnection() );
1205 if ( xConnection.is() )
1206 {
1207 QueryDesigner aDesigner( getORB(), this, getFrame(), true );
1208
1210 aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
1211
1212 const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
1213 const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs );
1214 onDocumentOpened( OUString(), E_QUERY, ElementOpenMode::Design, xComponent, nullptr );
1215 }
1216 }
1217 break;
1218 case SID_DB_APP_DELETE:
1219 case SID_DB_APP_TABLE_DELETE:
1220 case SID_DB_APP_QUERY_DELETE:
1221 case SID_DB_APP_FORM_DELETE:
1222 case SID_DB_APP_REPORT_DELETE:
1223 deleteEntries();
1224 break;
1225 case SID_DB_APP_RENAME:
1226 case SID_DB_APP_TABLE_RENAME:
1227 case SID_DB_APP_QUERY_RENAME:
1228 case SID_DB_APP_FORM_RENAME:
1229 case SID_DB_APP_REPORT_RENAME:
1230 renameEntry();
1231 break;
1232 case SID_DB_APP_EDIT:
1233 case SID_DB_APP_EDIT_SQL_VIEW:
1234 case SID_DB_APP_TABLE_EDIT:
1235 case SID_DB_APP_QUERY_EDIT:
1236 case SID_DB_APP_FORM_EDIT:
1237 case SID_DB_APP_REPORT_EDIT:
1239 break;
1240 case SID_DB_APP_OPEN:
1241 case SID_DB_APP_TABLE_OPEN:
1242 case SID_DB_APP_QUERY_OPEN:
1243 case SID_DB_APP_FORM_OPEN:
1244 case SID_DB_APP_REPORT_OPEN:
1246 break;
1247 case SID_DB_APP_CONVERTTOVIEW:
1249 break;
1250 case SID_SELECTALL:
1252 InvalidateAll();
1253 break;
1254 case SID_DB_APP_DSRELDESIGN:
1255 {
1256 Reference< XComponent > xRelationDesigner;
1257 if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xRelationDesigner ) )
1258 {
1259 SharedConnection xConnection( ensureConnection() );
1260 if ( xConnection.is() )
1261 {
1262 RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
1263
1264 const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
1265 const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource );
1266 onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, ElementOpenMode::Design, xComponent, nullptr );
1267 }
1268 }
1269 }
1270 break;
1271 case SID_DB_APP_DSUSERADMIN:
1272 {
1273 SharedConnection xConnection( ensureConnection() );
1274 if ( xConnection.is() )
1275 openDialog("com.sun.star.sdb.UserAdministrationDialog");
1276 }
1277 break;
1278 case SID_DB_APP_TABLEFILTER:
1279 // opens the table filter dialog for the selected data source
1280 openDialog( "com.sun.star.sdb.TableFilterDialog" );
1282 break;
1283 case SID_DB_APP_REFRESH_TABLES:
1284 refreshTables();
1285 break;
1286 case SID_DB_APP_DSPROPS:
1287 // opens the administration dialog for the selected data source
1288 openDialog( "com.sun.star.sdb.DatasourceAdministrationDialog" );
1290 break;
1291 case SID_DB_APP_DSADVANCED_SETTINGS:
1292 openDialog("com.sun.star.sdb.AdvancedDatabaseSettingsDialog");
1294 break;
1295 case SID_DB_APP_DSCONNECTION_TYPE:
1296 openDialog("com.sun.star.sdb.DataSourceTypeChangeDialog");
1298 break;
1299 case ID_DIRECT_SQL:
1300 {
1301 SharedConnection xConnection( ensureConnection() );
1302 if ( xConnection.is() )
1303 // opens the DirectSQLDialog to execute hand made sql statements.
1305 }
1306 break;
1307 case SID_DB_APP_VIEW_TABLES:
1308 m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_TABLE ) );
1309 break;
1310 case SID_DB_APP_VIEW_QUERIES:
1311 m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_QUERY ) );
1312 break;
1313 case SID_DB_APP_VIEW_FORMS:
1314 m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_FORM ) );
1315 break;
1316 case SID_DB_APP_VIEW_REPORTS:
1317 m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_REPORT ) );
1318 break;
1319 case SID_DB_APP_DISABLE_PREVIEW:
1322 break;
1323 case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
1326 break;
1327 case SID_DB_APP_VIEW_DOC_PREVIEW:
1330 break;
1331 case SID_MAIL_SENDDOC:
1332 {
1333 SfxMailModel aSendMail;
1334 if ( aSendMail.AttachDocument(getModel(), OUString()) == SfxMailModel::SEND_MAIL_OK )
1335 aSendMail.Send( getFrame() );
1336 }
1337 break;
1338 case SID_DB_APP_SENDREPORTASMAIL:
1340 break;
1341 }
1342 }
1343 catch( const Exception& )
1344 {
1345 DBG_UNHANDLED_EXCEPTION("dbaccess");
1346 }
1347 InvalidateFeature(_nId);
1348}
1349
1351{
1353
1354 implDescribeSupportedFeature( ".uno:AddDirect", SID_NEWDOCDIRECT, CommandGroup::APPLICATION );
1355 implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
1356 implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
1357 implDescribeSupportedFeature( ".uno:SendMail", SID_MAIL_SENDDOC, CommandGroup::DOCUMENT );
1358 implDescribeSupportedFeature( ".uno:DBSendReportAsMail",SID_DB_APP_SENDREPORTASMAIL,
1359 CommandGroup::DOCUMENT );
1360 implDescribeSupportedFeature( ".uno:DBSendReportToWriter",SID_DB_APP_SENDREPORTTOWRITER,
1361 CommandGroup::DOCUMENT );
1362 implDescribeSupportedFeature( ".uno:DBNewForm", SID_APP_NEW_FORM, CommandGroup::INSERT );
1363 implDescribeSupportedFeature( ".uno:DBNewFolder", SID_APP_NEW_FOLDER, CommandGroup::INSERT );
1364 implDescribeSupportedFeature( ".uno:DBNewFormAutoPilot", SID_DB_FORM_NEW_PILOT, CommandGroup::INSERT );
1365 implDescribeSupportedFeature( ".uno:DBNewFormAutoPilotWithPreSelection",
1366 SID_FORM_CREATE_REPWIZ_PRE_SEL,
1367 CommandGroup::APPLICATION );
1368
1369 implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT );
1370 implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot",
1371 ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT );
1372 implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection",
1373 SID_REPORT_CREATE_REPWIZ_PRE_SEL,
1374 CommandGroup::APPLICATION );
1375 implDescribeSupportedFeature( ".uno:DBNewQuery", ID_NEW_QUERY_DESIGN, CommandGroup::INSERT );
1376 implDescribeSupportedFeature( ".uno:DBNewQuerySql", ID_NEW_QUERY_SQL, CommandGroup::INSERT );
1378 CommandGroup::INSERT );
1379 implDescribeSupportedFeature( ".uno:DBNewTable", ID_NEW_TABLE_DESIGN, CommandGroup::INSERT );
1381 CommandGroup::INSERT );
1382 implDescribeSupportedFeature( ".uno:DBNewView", ID_NEW_VIEW_DESIGN, CommandGroup::INSERT );
1383 implDescribeSupportedFeature( ".uno:DBNewViewSQL", SID_DB_NEW_VIEW_SQL, CommandGroup::INSERT );
1384
1385 implDescribeSupportedFeature( ".uno:DBDelete", SID_DB_APP_DELETE, CommandGroup::EDIT );
1386 implDescribeSupportedFeature( ".uno:Delete", SID_DB_APP_DELETE, CommandGroup::EDIT );
1387 implDescribeSupportedFeature( ".uno:DBRename", SID_DB_APP_RENAME, CommandGroup::EDIT );
1388 implDescribeSupportedFeature( ".uno:DBEdit", SID_DB_APP_EDIT, CommandGroup::EDIT );
1389 implDescribeSupportedFeature( ".uno:DBEditSqlView", SID_DB_APP_EDIT_SQL_VIEW, CommandGroup::EDIT );
1390 implDescribeSupportedFeature( ".uno:DBOpen", SID_DB_APP_OPEN, CommandGroup::EDIT );
1391
1392 implDescribeSupportedFeature( ".uno:DBTableDelete", SID_DB_APP_TABLE_DELETE, CommandGroup::EDIT );
1393 implDescribeSupportedFeature( ".uno:DBTableRename", SID_DB_APP_TABLE_RENAME, CommandGroup::EDIT );
1394 implDescribeSupportedFeature( ".uno:DBTableEdit", SID_DB_APP_TABLE_EDIT, CommandGroup::EDIT );
1395 implDescribeSupportedFeature( ".uno:DBTableOpen", SID_DB_APP_TABLE_OPEN, CommandGroup::EDIT );
1396
1397 implDescribeSupportedFeature( ".uno:DBQueryDelete", SID_DB_APP_QUERY_DELETE, CommandGroup::EDIT );
1398 implDescribeSupportedFeature( ".uno:DBQueryRename", SID_DB_APP_QUERY_RENAME, CommandGroup::EDIT );
1399 implDescribeSupportedFeature( ".uno:DBQueryEdit", SID_DB_APP_QUERY_EDIT, CommandGroup::EDIT );
1400 implDescribeSupportedFeature( ".uno:DBQueryOpen", SID_DB_APP_QUERY_OPEN, CommandGroup::EDIT );
1401
1402 implDescribeSupportedFeature( ".uno:DBFormDelete", SID_DB_APP_FORM_DELETE, CommandGroup::EDIT );
1403 implDescribeSupportedFeature( ".uno:DBFormRename", SID_DB_APP_FORM_RENAME, CommandGroup::EDIT );
1404 implDescribeSupportedFeature( ".uno:DBFormEdit", SID_DB_APP_FORM_EDIT, CommandGroup::EDIT );
1405 implDescribeSupportedFeature( ".uno:DBFormOpen", SID_DB_APP_FORM_OPEN, CommandGroup::EDIT );
1406
1407 implDescribeSupportedFeature( ".uno:DBReportDelete", SID_DB_APP_REPORT_DELETE, CommandGroup::EDIT );
1408 implDescribeSupportedFeature( ".uno:DBReportRename", SID_DB_APP_REPORT_RENAME, CommandGroup::EDIT );
1409 implDescribeSupportedFeature( ".uno:DBReportEdit", SID_DB_APP_REPORT_EDIT, CommandGroup::EDIT );
1410 implDescribeSupportedFeature( ".uno:DBReportOpen", SID_DB_APP_REPORT_OPEN, CommandGroup::EDIT );
1411
1412 implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
1413 implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
1414
1415 implDescribeSupportedFeature( ".uno:Sortup", ID_BROWSER_SORTUP, CommandGroup::VIEW );
1416 implDescribeSupportedFeature( ".uno:SortDown", ID_BROWSER_SORTDOWN, CommandGroup::VIEW );
1417 implDescribeSupportedFeature( ".uno:DBRelationDesign", SID_DB_APP_DSRELDESIGN, CommandGroup::APPLICATION );
1418 implDescribeSupportedFeature( ".uno:DBUserAdmin", SID_DB_APP_DSUSERADMIN, CommandGroup::APPLICATION );
1419 implDescribeSupportedFeature( ".uno:DBTableFilter", SID_DB_APP_TABLEFILTER, CommandGroup::APPLICATION );
1420 implDescribeSupportedFeature( ".uno:DBDSProperties", SID_DB_APP_DSPROPS, CommandGroup::EDIT );
1421 implDescribeSupportedFeature( ".uno:DBDSConnectionType", SID_DB_APP_DSCONNECTION_TYPE,
1422 CommandGroup::EDIT );
1423 implDescribeSupportedFeature( ".uno:DBDSAdvancedSettings",
1424 SID_DB_APP_DSADVANCED_SETTINGS,
1425 CommandGroup::EDIT );
1426 implDescribeSupportedFeature( ".uno:PasteSpecial", SID_DB_APP_PASTE_SPECIAL, CommandGroup::EDIT );
1427 implDescribeSupportedFeature( ".uno:DBConvertToView", SID_DB_APP_CONVERTTOVIEW, CommandGroup::EDIT );
1428 implDescribeSupportedFeature( ".uno:DBRefreshTables", SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
1429 implDescribeSupportedFeature( ".uno:DBDirectSQL", ID_DIRECT_SQL, CommandGroup::APPLICATION );
1430 implDescribeSupportedFeature( ".uno:DBViewTables", SID_DB_APP_VIEW_TABLES, CommandGroup::VIEW );
1431 implDescribeSupportedFeature( ".uno:DBViewQueries", SID_DB_APP_VIEW_QUERIES, CommandGroup::VIEW );
1432 implDescribeSupportedFeature( ".uno:DBViewForms", SID_DB_APP_VIEW_FORMS, CommandGroup::VIEW );
1433 implDescribeSupportedFeature( ".uno:DBViewReports", SID_DB_APP_VIEW_REPORTS, CommandGroup::VIEW );
1434 implDescribeSupportedFeature( ".uno:DBDisablePreview", SID_DB_APP_DISABLE_PREVIEW,CommandGroup::VIEW );
1435 implDescribeSupportedFeature( ".uno:DBShowDocInfoPreview",
1436 SID_DB_APP_VIEW_DOCINFO_PREVIEW,
1437 CommandGroup::VIEW );
1438 implDescribeSupportedFeature( ".uno:DBShowDocPreview", SID_DB_APP_VIEW_DOC_PREVIEW,
1439 CommandGroup::VIEW );
1440
1441 implDescribeSupportedFeature( ".uno:OpenUrl", SID_OPENURL, CommandGroup::APPLICATION );
1442
1443 // this one should not appear under Tools->Customize->Keyboard
1444 implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection",
1445 SID_APP_NEW_REPORT_PRE_SEL );
1446 implDescribeSupportedFeature( ".uno:DBDSImport", SID_DB_APP_DSIMPORT);
1447 implDescribeSupportedFeature( ".uno:DBDSExport", SID_DB_APP_DSEXPORT);
1448 implDescribeSupportedFeature( ".uno:DBDBAdmin", SID_DB_APP_DBADMIN);
1449
1450 // status info
1451 implDescribeSupportedFeature( ".uno:DBStatusType", SID_DB_APP_STATUS_TYPE);
1452 implDescribeSupportedFeature( ".uno:DBStatusDBName", SID_DB_APP_STATUS_DBNAME);
1453 implDescribeSupportedFeature( ".uno:DBStatusUserName", SID_DB_APP_STATUS_USERNAME);
1454 implDescribeSupportedFeature( ".uno:DBStatusHostName", SID_DB_APP_STATUS_HOSTNAME);
1455}
1456
1458{
1459 return static_cast< OApplicationView* >( getView() );
1460}
1461
1462// css::container::XContainerListener
1463void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rEvent )
1464{
1465 SolarMutexGuard aSolarGuard;
1466 ::osl::MutexGuard aGuard( getMutex() );
1467
1468 Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
1469 if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
1470 return;
1471
1472 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1473 if ( !getContainer() )
1474 return;
1475
1476 OUString sName;
1477 _rEvent.Accessor >>= sName;
1478 ElementType eType = getElementType(xContainer);
1479
1480 switch( eType )
1481 {
1482 case E_TABLE:
1484 break;
1485 case E_FORM:
1486 case E_REPORT:
1487 {
1488 Reference< XContainer > xSubContainer(_rEvent.Element,UNO_QUERY);
1489 if ( xSubContainer.is() )
1490 containerFound(xSubContainer);
1491 }
1492 break;
1493 default:
1494 break;
1495 }
1496 getContainer()->elementAdded(eType,sName,_rEvent.Element);
1497}
1498
1499void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEvent )
1500{
1501 SolarMutexGuard aSolarGuard;
1502 ::osl::MutexGuard aGuard( getMutex() );
1503
1504 Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
1505 if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
1506 return;
1507
1508 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1509 OUString sName;
1510 _rEvent.Accessor >>= sName;
1511 ElementType eType = getElementType(xContainer);
1512 switch( eType )
1513 {
1514 case E_TABLE:
1516 break;
1517 case E_FORM:
1518 case E_REPORT:
1519 {
1520 Reference<XContent> xContent(xContainer,UNO_QUERY);
1521 if ( xContent.is() )
1522 {
1523 sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
1524 }
1525 }
1526 break;
1527 default:
1528 break;
1529 }
1531}
1532
1533void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent )
1534{
1535 SolarMutexGuard aSolarGuard;
1536 ::osl::MutexGuard aGuard( getMutex() );
1537
1538 Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
1539 if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
1540 return;
1541
1542 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1543 OUString sName;
1544 try
1545 {
1546 _rEvent.Accessor >>= sName;
1547 Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
1548
1549 ElementType eType = getElementType(xContainer);
1550 switch( eType )
1551 {
1552 case E_TABLE:
1553 {
1555 if ( xProp.is() && m_xMetaData.is() )
1556 //TODO: tdf#133497 "OApplicationController::elementReplaced effectively does
1557 // nothing":
1558 (void) ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false );
1559 }
1560 break;
1561 case E_FORM:
1562 case E_REPORT:
1563 {
1564 Reference<XContent> xContent(xContainer,UNO_QUERY);
1565 if ( xContent.is() )
1566 {
1567 sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
1568 }
1569 }
1570 break;
1571 default:
1572 break;
1573 }
1574 // getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName);
1575 }
1576 catch( Exception& )
1577 {
1578 DBG_UNHANDLED_EXCEPTION("dbaccess");
1579 }
1580}
1581
1582namespace
1583{
1584 OUString lcl_getToolBarResource(ElementType _eType)
1585 {
1586 OUString sToolbar;
1587 switch(_eType)
1588 {
1589 case E_TABLE:
1590 sToolbar = "private:resource/toolbar/tableobjectbar";
1591 break;
1592 case E_QUERY:
1593 sToolbar = "private:resource/toolbar/queryobjectbar";
1594 break;
1595 case E_FORM:
1596 sToolbar = "private:resource/toolbar/formobjectbar";
1597 break;
1598 case E_REPORT:
1599 sToolbar = "private:resource/toolbar/reportobjectbar";
1600 break;
1601 case E_NONE:
1602 break;
1603 default:
1604 OSL_FAIL("Invalid ElementType!");
1605 break;
1606 }
1607 return sToolbar;
1608 }
1609}
1610
1612{
1613 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1614
1615 if ( m_eCurrentType != _eType && _eType != E_NONE )
1616 {
1617 SelectionGuard aSelGuard( *m_pSelectionNotifier );
1618
1619 if ( _eType == E_TABLE )
1620 {
1621 try
1622 {
1623 SharedConnection xConnection( ensureConnection() );
1624 if ( xConnection.is() && getContainer()->getDetailView() )
1625 {
1626 getContainer()->getDetailView()->createTablesPage(xConnection);
1627 Reference<XTablesSupplier> xTabSup(xConnection,UNO_QUERY);
1628 if ( xTabSup.is() )
1629 addContainerListener(xTabSup->getTables());
1630 }
1631 else
1632 {
1633 return false;
1634 }
1635 }
1636 catch( const Exception& )
1637 {
1638 return false;
1639 }
1640 }
1641 else if ( _eType == E_QUERY )
1642 {
1643 // tdf#126578: retrieve connection to be able to call "Create as View"
1645 }
1647 if ( xLayoutManager.is() )
1648 {
1649 OUString sToolbar = lcl_getToolBarResource(_eType);
1650 OUString sDestroyToolbar = lcl_getToolBarResource(m_eCurrentType);
1651
1652 xLayoutManager->lock();
1653 xLayoutManager->destroyElement( sDestroyToolbar );
1654 if ( !sToolbar.isEmpty() )
1655 {
1656 xLayoutManager->createElement( sToolbar );
1657 xLayoutManager->requestElement( sToolbar );
1658 }
1659 xLayoutManager->unlock();
1660 xLayoutManager->doLayout();
1661 }
1662
1663 if ( _eType != E_TABLE && getContainer()->getDetailView() )
1664 {
1665 Reference< XNameAccess > xContainer = getElements(_eType);
1666 addContainerListener(xContainer);
1667 getContainer()->getDetailView()->createPage(_eType,xContainer);
1668 }
1669
1670 SelectionByElementType::const_iterator pendingSelection = m_aPendingSelection.find( _eType );
1671 if ( pendingSelection != m_aPendingSelection.end() )
1672 {
1673 getContainer()->selectElements( comphelper::containerToSequence(pendingSelection->second) );
1674
1675 m_aPendingSelection.erase( pendingSelection );
1676 }
1677
1678 InvalidateAll();
1679 }
1680 m_eCurrentType = _eType;
1681
1682 return true;
1683}
1684
1686{
1687 OApplicationView* pContainer = getContainer();
1688 if (!pContainer)
1689 return false; // not handled
1690
1691 std::unique_ptr<weld::TreeIter> xHdlEntry = rTreeView.make_iterator();
1692 if (!rTreeView.get_cursor(xHdlEntry.get()))
1693 return false;
1694
1695 if (!pContainer->isLeaf(rTreeView, *xHdlEntry))
1696 return false; // not handled
1697
1698 try
1699 {
1700 // opens a new frame with either the table or the query or report or form or view
1702 getContainer()->getQualifiedName(xHdlEntry.get()),
1705 0,
1707 return true; // handled
1708 }
1709 catch(const Exception&)
1710 {
1711 DBG_UNHANDLED_EXCEPTION("dbaccess");
1712 }
1713
1714 return false; // not handled
1715}
1716
1717bool OApplicationController::impl_isAlterableView_nothrow( const OUString& _rTableOrViewName ) const
1718{
1719 OSL_PRECOND( m_xDataSourceConnection.is(), "OApplicationController::impl_isAlterableView_nothrow: no connection!" );
1720
1721 bool bIsAlterableView( false );
1722 try
1723 {
1726 if ( xViewsSupp.is() )
1727 xViews = xViewsSupp->getViews();
1728
1729 Reference< XAlterView > xAsAlterableView;
1730 if ( xViews.is() && xViews->hasByName( _rTableOrViewName ) )
1731 xAsAlterableView.set( xViews->getByName( _rTableOrViewName ), UNO_QUERY );
1732
1733 bIsAlterableView = xAsAlterableView.is();
1734 }
1735 catch( const Exception& )
1736 {
1737 DBG_UNHANDLED_EXCEPTION("dbaccess");
1738 }
1739 return bIsAlterableView;
1740}
1741
1743 ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand, const ::comphelper::NamedValueCollection& _rAdditionalArguments )
1744{
1745 OSL_PRECOND( getContainer(), "OApplicationController::openElementWithArguments: no view!" );
1746 if ( !getContainer() )
1747 return nullptr;
1748
1750 if ( _eOpenMode == ElementOpenMode::Design )
1751 {
1752 // https://bz.apache.org/ooo/show_bug.cgi?id=30382
1753 getContainer()->showPreview(nullptr);
1754 }
1755
1756 bool isStandaloneDocument = false;
1757 switch ( _eType )
1758 {
1759 case E_REPORT:
1760 if ( _eOpenMode != ElementOpenMode::Design )
1761 {
1762 // reports which are opened in a mode other than design are no sub components of our application
1763 // component, but standalone documents.
1764 isStandaloneDocument = true;
1765 }
1766 [[fallthrough]];
1767 case E_FORM:
1768 {
1769 if ( isStandaloneDocument || !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
1770 {
1771 std::unique_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType );
1772 if ( !aHelper->isConnected() )
1773 break;
1774
1775 Reference< XComponent > xDefinition;
1776 xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments );
1777
1778 if ( !isStandaloneDocument )
1779 onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition );
1780 }
1781 }
1782 break;
1783
1784 case E_QUERY:
1785 case E_TABLE:
1786 {
1787 if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
1788 {
1789 SharedConnection xConnection( ensureConnection() );
1790 if ( !xConnection.is() )
1791 break;
1792
1793 std::unique_ptr< DatabaseObjectView > pDesigner;
1794 ::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
1795
1796 Any aDataSource;
1797 if ( _eOpenMode == ElementOpenMode::Design )
1798 {
1799 bool bAddViewTypeArg = false;
1800
1801 if ( _eType == E_TABLE )
1802 {
1803 if ( impl_isAlterableView_nothrow( _sName ) )
1804 {
1805 pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true ) );
1806 bAddViewTypeArg = true;
1807 }
1808 else
1809 {
1810 pDesigner.reset( new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) );
1811 }
1812 }
1813 else if ( _eType == E_QUERY )
1814 {
1815 pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false ) );
1816 bAddViewTypeArg = true;
1817 }
1818 aDataSource <<= m_xDataSource;
1819
1820 if ( bAddViewTypeArg )
1821 {
1822 const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW );
1823 aArguments.put( PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode );
1824 }
1825
1826 }
1827 else
1828 {
1829 pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
1830
1831 if ( !aArguments.has( PROPERTY_SHOWMENU ) )
1832 aArguments.put( PROPERTY_SHOWMENU, Any( true ) );
1833
1834 aDataSource <<= getDatabaseName();
1835 }
1836
1837 xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments ) );
1838 onDocumentOpened( _sName, _eType, _eOpenMode, xRet, nullptr );
1839 }
1840 }
1841 break;
1842
1843 default:
1844 OSL_FAIL( "OApplicationController::openElement: illegal object type!" );
1845 break;
1846 }
1847 return xRet;
1848}
1849
1850IMPL_LINK( OApplicationController, OnSelectContainer, void*, _pType, void )
1851{
1852 ElementType eType = static_cast<ElementType>(reinterpret_cast< sal_IntPtr >( _pType ));
1853 if (getContainer())
1854 getContainer()->selectContainer(eType);
1855}
1856
1857IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType, void )
1858{
1859 ElementType eType = static_cast<ElementType>(reinterpret_cast< sal_IntPtr >( _pType ));
1860 newElementWithPilot( eType );
1861}
1862
1864{
1865 utl::CloseVeto aKeepDoc( getFrame() );
1866 // prevent the document being closed while the wizard is open
1867
1868 OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" );
1869
1870 switch ( _eType )
1871 {
1872 case E_REPORT:
1873 case E_FORM:
1874 {
1875 std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
1876 if ( aHelper->isConnected() )
1877 {
1878 sal_Int32 nCommandType = -1;
1879 const OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) );
1880 if ( E_REPORT == _eType )
1881 aHelper->newReportWithPilot( nCommandType, sCurrentSelected );
1882 else
1883 aHelper->newFormWithPilot( nCommandType, sCurrentSelected );
1884 }
1885 }
1886 break;
1887 case E_QUERY:
1888 case E_TABLE:
1889 {
1890 std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
1891 if ( aHelper->isConnected() )
1892 {
1893 if ( E_QUERY == _eType )
1894 aHelper->newQueryWithPilot();
1895 else
1896 aHelper->newTableWithPilot();
1897 }
1898 }
1899 break;
1900 case E_NONE:
1901 break;
1902 }
1903
1904 // no need for onDocumentOpened, the table wizard opens the created table by using
1905 // XDatabaseDocumentUI::loadComponent method.
1906}
1907
1908Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
1909 Reference< XComponent >& o_rDocumentDefinition )
1910{
1911 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1912
1913 Reference< XComponent > xComponent;
1914 o_rDocumentDefinition.clear();
1915
1916 switch ( _eType )
1917 {
1918 case E_FORM:
1919 case E_REPORT:
1920 {
1921 std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess( _eType );
1922 if ( !aHelper->isConnected() )
1923 break;
1924
1925 xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, o_rDocumentDefinition );
1926 }
1927 break;
1928
1929 case E_QUERY:
1930 case E_TABLE:
1931 {
1932 std::unique_ptr< DatabaseObjectView > pDesigner;
1933 SharedConnection xConnection( ensureConnection() );
1934 if ( !xConnection.is() )
1935 break;
1936
1937 if ( _eType == E_TABLE )
1938 {
1939 pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) );
1940 }
1941 else if ( _eType == E_QUERY )
1942 {
1943 pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false ) );
1944 }
1945
1946 Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
1947 xComponent = pDesigner->createNew( xDataSource, i_rAdditionalArguments );
1948 }
1949 break;
1950
1951 default:
1952 OSL_FAIL( "OApplicationController::newElement: illegal type!" );
1953 break;
1954 }
1955
1956 if ( xComponent.is() )
1957 onDocumentOpened( OUString(), _eType, ElementOpenMode::Design, xComponent, o_rDocumentDefinition );
1958
1959 return xComponent;
1960}
1961
1963{
1964 try
1965 {
1966 Reference< XContainer > xCont(_xCollection, UNO_QUERY);
1967 if ( xCont.is() )
1968 {
1969 // add as listener to get notified if elements are inserted or removed
1970 TContainerVector::const_iterator aFind = std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xCont);
1971 if ( aFind == m_aCurrentContainers.end() )
1972 {
1973 xCont->addContainerListener(this);
1974 m_aCurrentContainers.push_back(xCont);
1975 }
1976 }
1977 }
1978 catch( const Exception& )
1979 {
1980 DBG_UNHANDLED_EXCEPTION("dbaccess");
1981 }
1982}
1983
1985{
1986 SolarMutexGuard aSolarGuard;
1987 ::osl::MutexGuard aGuard( getMutex() );
1988
1989 OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
1990 std::vector< OUString> aList;
1992
1994 OSL_ENSURE(aList.size() == 1,"Invalid rename call here. More than one element!");
1995 if ( aList.empty() )
1996 return;
1997
1998 try
1999 {
2000 if ( xContainer.is() )
2001 {
2002 std::unique_ptr< IObjectNameCheck > pNameChecker;
2003 std::unique_ptr<OSaveAsDlg> xDialog;
2004
2005 Reference<XRename> xRename;
2007 switch( eType )
2008 {
2009 case E_FORM:
2010 case E_REPORT:
2011 {
2012 Reference<XHierarchicalNameContainer> xHNames(xContainer, UNO_QUERY);
2013 if ( xHNames.is() )
2014 {
2015 OUString sLabel;
2016 if ( eType == E_FORM )
2017 sLabel = DBA_RES(STR_FRM_LABEL);
2018 else
2019 sLabel = DBA_RES(STR_RPT_LABEL);
2020
2021 OUString sName = *aList.begin();
2022 if ( xHNames->hasByHierarchicalName(sName) )
2023 {
2024 xRename.set(xHNames->getByHierarchicalName(sName),UNO_QUERY);
2025 Reference<XChild> xChild(xRename,UNO_QUERY);
2026 if ( xChild.is() )
2027 {
2028 Reference<XHierarchicalNameContainer> xParent(xChild->getParent(),UNO_QUERY);
2029 if ( xParent.is() )
2030 {
2031 xHNames = xParent;
2032 Reference<XPropertySet>(xRename,UNO_QUERY_THROW)->getPropertyValue(PROPERTY_NAME) >>= sName;
2033 }
2034 }
2035 pNameChecker.reset( new HierarchicalNameCheck( xHNames, OUString() ) );
2036 xDialog.reset(new OSaveAsDlg(
2037 getFrameWeld(), getORB(), sName, sLabel, *pNameChecker, SADFlags::TitleRename));
2038 }
2039 }
2040 }
2041 break;
2042 case E_TABLE:
2044 if ( !getConnection().is() )
2045 break;
2046 [[fallthrough]];
2047 case E_QUERY:
2048 if ( xContainer->hasByName(*aList.begin()) )
2049 {
2050 xRename.set(xContainer->getByName(*aList.begin()),UNO_QUERY);
2051 sal_Int32 nCommandType = eType == E_QUERY ? CommandType::QUERY : CommandType::TABLE;
2052
2054 pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
2055 xDialog.reset(new OSaveAsDlg(getFrameWeld(), nCommandType, getORB(), getConnection(),
2056 *aList.begin(), *pNameChecker, SADFlags::TitleRename));
2057 }
2058 break;
2059 default:
2060 break;
2061 }
2062
2063 if (xRename.is() && xDialog)
2064 {
2065
2066 bool bTryAgain = true;
2067 while( bTryAgain )
2068 {
2069 if (xDialog->run() == RET_OK)
2070 {
2071 try
2072 {
2073 OUString sNewName;
2074 if ( eType == E_TABLE )
2075 {
2076 OUString sName = xDialog->getName();
2077 OUString sCatalog = xDialog->getCatalog();
2078 OUString sSchema = xDialog->getSchema();
2079
2080 sNewName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InDataManipulation );
2081 }
2082 else
2083 sNewName = xDialog->getName();
2084
2085 OUString sOldName = *aList.begin();
2086 if ( eType == E_FORM || eType == E_REPORT )
2087 {
2088 Reference<XContent> xContent(xRename,UNO_QUERY);
2089 if ( xContent.is() )
2090 {
2091 sOldName = xContent->getIdentifier()->getContentIdentifier();
2092 }
2093 }
2094
2095 xRename->rename(sNewName);
2096
2097 if ( eType == E_TABLE )
2098 {
2099 Reference<XPropertySet> xProp(xRename,UNO_QUERY);
2100 sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false );
2101 }
2102 getContainer()->elementReplaced( eType , sOldName, sNewName );
2103
2104 bTryAgain = false;
2105 }
2106 catch(const SQLException& )
2107 {
2108 showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
2109
2110 }
2111 catch(const ElementExistException& e)
2112 {
2113 OUString sMsg(DBA_RES(STR_NAME_ALREADY_EXISTS));
2114 showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, "S1000", 0, Any())));
2115 }
2116 catch(const Exception& )
2117 {
2118 DBG_UNHANDLED_EXCEPTION("dbaccess");
2119 }
2120 }
2121 else
2122 bTryAgain = false;
2123 }
2124 }
2125 }
2126 }
2127 catch(const Exception& )
2128 {
2129 DBG_UNHANDLED_EXCEPTION("dbaccess");
2130 }
2131}
2132
2134{
2135 InvalidateAll();
2136
2137 SelectionGuard aSelGuard( *m_pSelectionNotifier );
2138
2139 OApplicationView* pView = getContainer();
2140 if ( !pView )
2141 return;
2142
2143 if ( pView->getSelectionCount() == 1 )
2144 {
2145 const ElementType eType = pView->getElementType();
2146 if ( pView->isALeafSelected() )
2147 {
2148 const OUString sName = pView->getQualifiedName( nullptr /* means 'first selected' */ );
2150 }
2151 }
2152}
2153
2154void OApplicationController::showPreviewFor(const ElementType _eType,const OUString& _sName)
2155{
2157 return;
2158
2159 OApplicationView* pView = getContainer();
2160 if ( !pView )
2161 return;
2162
2163 try
2164 {
2165 switch( _eType )
2166 {
2167 case E_FORM:
2168 case E_REPORT:
2169 {
2170 Reference< XHierarchicalNameAccess > xContainer( getElements( _eType ), UNO_QUERY_THROW );
2171 Reference< XContent> xContent( xContainer->getByHierarchicalName( _sName ), UNO_QUERY_THROW );
2172 pView->showPreview( xContent );
2173 }
2174 break;
2175
2176 case E_TABLE:
2177 case E_QUERY:
2178 {
2179 SharedConnection xConnection( ensureConnection() );
2180 if ( xConnection.is() )
2181 pView->showPreview( getDatabaseName(), xConnection, _sName, _eType == E_TABLE );
2182 }
2183 return;
2184
2185 default:
2186 OSL_FAIL( "OApplicationController::showPreviewFor: unexpected element type!" );
2187 break;
2188 }
2189 }
2190 catch( const SQLException& )
2191 {
2192 showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
2193 }
2194 catch(const Exception& )
2195 {
2196 DBG_UNHANDLED_EXCEPTION("dbaccess");
2197 }
2198}
2199
2201{
2202 OnInvalidateClipboard();
2203}
2204
2206{
2210 InvalidateFeature(SID_DB_APP_PASTE_SPECIAL);
2211}
2212
2214{
2216}
2217
2219{
2221}
2222
2224{
2226 sal_uInt16 nId = 0;
2227 switch(eType)
2228 {
2229 case E_TABLE:
2230 nId = SID_DB_APP_TABLE_DELETE;
2231 break;
2232 case E_QUERY:
2233 nId = SID_DB_APP_QUERY_DELETE;
2234 break;
2235 case E_FORM:
2236 nId = SID_DB_APP_FORM_DELETE;
2237 break;
2238 case E_REPORT:
2239 nId = SID_DB_APP_REPORT_DELETE;
2240 break;
2241 default:
2242 OSL_FAIL("Invalid ElementType!");
2243 break;
2244 }
2246}
2247
2249{
2250 return "edit";
2251}
2252
2254{
2255 return *this;
2256}
2257
2259{
2261}
2262
2264{
2266 getContainer()->describeCurrentSelectionForControl(rControl, aSelection);
2267 return Any( aSelection );
2268}
2269
2271{
2272 return getContainer()->getMenuParent();
2273}
2274
2276{
2277 getContainer()->adjustMenuPosition(rControl, rPos);
2278}
2279
2280bool OApplicationController::requestQuickHelp(const void* /*pUserData*/, OUString& /*rText*/) const
2281{
2282 return false;
2283}
2284
2286{
2287 bool bSuccess = false;
2288
2289 OApplicationView* pContainer = getContainer();
2290 if (pContainer && pContainer->getSelectionCount())
2291 {
2292 try
2293 {
2294 if (getContainer()->getDetailView())
2295 {
2296 TreeListBox* pTreeListBox = getContainer()->getDetailView()->getTreeWindow();
2297
2299 if (eType == E_TABLE || eType == E_QUERY)
2300 {
2301 ODataClipboard& rExchange = static_cast<ODataClipboard&>(pTreeListBox->GetDataTransfer());
2302 bSuccess = copySQLObject(rExchange);
2303 }
2304 else
2305 {
2306 svx::OComponentTransferable& rExchange = static_cast<svx::OComponentTransferable&>(pTreeListBox->GetDataTransfer());
2307 bSuccess = copyDocObject(rExchange);
2308 }
2309 }
2310 }
2311 catch(const Exception& )
2312 {
2313 DBG_UNHANDLED_EXCEPTION("dbaccess");
2314 }
2315 }
2316
2317 return bSuccess;
2318}
2319
2321{
2322 sal_Int8 nActionAskedFor = _rEvt.mnAction;
2323 // check if we're a table or query container
2324 OApplicationView* pView = getContainer();
2325 if ( !pView || isDataSourceReadOnly() )
2326 return DND_ACTION_NONE;
2327
2328 ElementType eType = pView->getElementType();
2329 if ( eType == E_NONE || (eType == E_TABLE && isConnectionReadOnly()) )
2330 return DND_ACTION_NONE;
2331
2332 // check for the concrete type
2333 if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType)))
2334 return DND_ACTION_COPY;
2335
2336 if ( eType != E_FORM && eType != E_REPORT )
2337 return DND_ACTION_NONE;
2338
2339 sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE;
2340 if ( nAction == DND_ACTION_NONE )
2341 return DND_ACTION_NONE;
2342
2343 auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
2344 if (xHitEntry)
2345 {
2346 OUString sName = pView->getQualifiedName(xHitEntry.get());
2347 if ( !sName.isEmpty() )
2348 {
2349 Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
2350 if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) )
2351 {
2352 Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY);
2353 if ( xHitObject.is() )
2354 nAction = nActionAskedFor & DND_ACTION_COPYMOVE;
2355 }
2356 else
2357 nAction = DND_ACTION_NONE;
2358 }
2359 }
2360 return nAction;
2361}
2362
2364{
2365 OApplicationView* pView = getContainer();
2366 if ( !pView || pView->getElementType() == E_NONE )
2367 {
2368 OSL_FAIL("OApplicationController::executeDrop: what the hell did queryDrop do?");
2369 // queryDrop should not have allowed us to reach this situation...
2370 return DND_ACTION_NONE;
2371 }
2372
2373 // a TransferableDataHelper for accessing the dropped data
2374 TransferableDataHelper aDroppedData(_rEvt.maDropEvent.Transferable);
2375
2376 // reset the data of the previous async drop (if any)
2377 if ( m_nAsyncDrop )
2379
2380 m_nAsyncDrop = nullptr;
2384 m_aAsyncDrop.bError = false;
2385 m_aAsyncDrop.bHtml = false;
2386 m_aAsyncDrop.aUrl.clear();
2387
2388 // loop through the available formats and see what we can do...
2389 // first we have to check if it is our own format, if not we have to copy the stream :-(
2390 if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(aDroppedData.GetDataFlavorExVector()) )
2391 {
2392 m_aAsyncDrop.aDroppedData = ODataAccessObjectTransferable::extractObjectDescriptor(aDroppedData);
2393
2394 // asynchron because we some dialogs and we aren't allowed to show them while in D&D
2396 return DND_ACTION_COPY;
2397 }
2398 else if ( OComponentTransferable::canExtractComponentDescriptor(aDroppedData.GetDataFlavorExVector(),m_aAsyncDrop.nType == E_FORM) )
2399 {
2400 m_aAsyncDrop.aDroppedData = OComponentTransferable::extractComponentDescriptor(aDroppedData);
2401 auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
2402 if ( xHitEntry )
2403 m_aAsyncDrop.aUrl = pView->getQualifiedName(xHitEntry.get());
2404
2405 sal_Int8 nAction = _rEvt.mnAction;
2406 Reference<XContent> xContent;
2407 m_aAsyncDrop.aDroppedData[DataAccessDescriptorProperty::Component] >>= xContent;
2408 if ( xContent.is() )
2409 {
2410 OUString sName = xContent->getIdentifier()->getContentIdentifier();
2411 sName = sName.copy(sName.indexOf('/') + 1);
2412 if ( m_aAsyncDrop.aUrl.getLength() >= sName.getLength() && m_aAsyncDrop.aUrl.startsWith(sName) )
2413 {
2415 return DND_ACTION_NONE;
2416 }
2417
2418 // check if move is allowed, if another object with the same name exists only copy is allowed
2420 Reference<XNameAccess> xNameAccess(xContainer,UNO_QUERY);
2421
2422 if ( !m_aAsyncDrop.aUrl.isEmpty() && xContainer.is() && xContainer->hasByHierarchicalName(m_aAsyncDrop.aUrl) )
2423 xNameAccess.set(xContainer->getByHierarchicalName(m_aAsyncDrop.aUrl),UNO_QUERY);
2424
2425 if ( xNameAccess.is() )
2426 {
2427 Reference<XPropertySet> xProp(xContent,UNO_QUERY);
2428 if ( xProp.is() )
2429 {
2430 xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
2431 if ( xNameAccess.is() && xNameAccess->hasByName(sName) )
2432 nAction &= ~DND_ACTION_MOVE;
2433 }
2434 else
2435 nAction &= ~DND_ACTION_MOVE;
2436 }
2437 }
2438 if ( nAction != DND_ACTION_NONE )
2439 {
2440 m_aAsyncDrop.nAction = nAction;
2441 // asynchron because we some dialogs and we aren't allowed to show them while in D&D
2443 }
2444 else
2446 return nAction;
2447 }
2448 else
2449 {
2450 SharedConnection xConnection( ensureConnection() );
2451 if ( xConnection.is() && m_aTableCopyHelper.copyTagTable( aDroppedData, m_aAsyncDrop, xConnection ) )
2452 {
2453 // asynchron because we some dialogs and we aren't allowed to show them while in D&D
2455 return DND_ACTION_COPY;
2456 }
2457 }
2458
2459 return DND_ACTION_NONE;
2460}
2461
2463{
2464 return m_xModel;
2465}
2466
2468{
2469 sal_Int32 nConnectedControllers( 0 );
2470 try
2471 {
2472 Reference< XModel2 > xModel( m_xModel, UNO_QUERY_THROW );
2473 Reference< XEnumeration > xEnumControllers( xModel->getControllers(), UNO_SET_THROW );
2474 while ( xEnumControllers->hasMoreElements() )
2475 {
2476 Reference< XController > xController( xEnumControllers->nextElement(), UNO_QUERY_THROW );
2477 ++nConnectedControllers;
2478 }
2479 }
2480 catch( const Exception& )
2481 {
2482 DBG_UNHANDLED_EXCEPTION("dbaccess");
2483 }
2484
2485 if ( nConnectedControllers > 1 )
2486 { // we are not the first connected controller, there were already others
2487 return;
2488 }
2489
2491}
2492
2494{
2495 if ( !m_xModel.is() )
2496 {
2497 OSL_FAIL( "OApplicationController::OnFirstControllerConnected: too late!" );
2498 }
2499
2500 // if we have forms or reports which contain macros/scripts, then show a warning
2501 // which suggests the user to migrate them to the database document
2502 Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY );
2503 if ( xDocumentScripts.is() )
2504 {
2505 // no need to show this warning, obviously the document supports embedding scripts
2506 // into itself, so there are no "old-style" forms/reports which have macros/scripts
2507 // themselves
2508 return;
2509 }
2510
2511 try
2512 {
2513 // If the migration just happened, but was not successful, the document is reloaded.
2514 // In this case, we should not show the warning, again.
2515 if ( ::comphelper::NamedValueCollection::getOrDefault( m_xModel->getArgs(), u"SuppressMigrationWarning", false ) )
2516 return;
2517
2518 // also, if the document is read-only, then no migration is possible, and the
2519 // respective menu entry is hidden. So, don't show the warning in this case, too.
2520 if ( Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly() )
2521 return;
2522
2523 SQLWarning aWarning;
2524 aWarning.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS);
2525 SQLException aDetail;
2526 aDetail.Message = DBA_RES(STR_SUB_DOCS_WITH_SCRIPTS_DETAIL);
2527 aWarning.NextException <<= aDetail;
2528
2529 Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( getORB(), "", nullptr, Any( aWarning ) );
2530 xDialog->execute();
2531 }
2532 catch( const Exception& )
2533 {
2534 DBG_UNHANDLED_EXCEPTION("dbaccess");
2535 }
2536}
2537
2539{
2540 SolarMutexGuard aSolarGuard; // avoid deadlock in XModel calls
2541 ::osl::MutexGuard aGuard( getMutex() );
2542
2544 if ( getFrame().is() )
2546}
2547
2549{
2550 ::osl::MutexGuard aGuard( getMutex() );
2551 const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
2552 const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY );
2553 if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() )
2554 {
2555 OSL_FAIL( "OApplicationController::attachModel: invalid model!" );
2556 return false;
2557 }
2558
2559 if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) )
2560 {
2561 OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
2562 // we'd need to completely update our view here, close sub components, and the like
2563 return false;
2564 }
2565
2566 const OUString aPropertyNames[] =
2567 {
2568 OUString(PROPERTY_URL), OUString(PROPERTY_USER)
2569 };
2570
2571 // disconnect from old model
2572 try
2573 {
2574 if ( m_xDataSource.is() )
2575 {
2576 for (const auto & aPropertyName : aPropertyNames)
2577 {
2578 m_xDataSource->removePropertyChangeListener( aPropertyName, this );
2579 }
2580 }
2581
2582 Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
2583 if ( xBroadcaster.is() )
2584 xBroadcaster->removeModifyListener( this );
2585 }
2586 catch( const Exception& )
2587 {
2588 DBG_UNHANDLED_EXCEPTION("dbaccess");
2589 }
2590
2591 m_xModel = _rxModel;
2592 m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY );
2593
2594 // connect to new model
2595 try
2596 {
2597 if ( m_xDataSource.is() )
2598 {
2599 for (const auto & aPropertyName : aPropertyNames)
2600 {
2601 m_xDataSource->addPropertyChangeListener( aPropertyName, this );
2602 }
2603 }
2604
2605 Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW );
2606 xBroadcaster->addModifyListener( this );
2607
2608 }
2609 catch( const Exception& )
2610 {
2611 DBG_UNHANDLED_EXCEPTION("dbaccess");
2612 }
2613
2614 // initial preview mode
2615 if ( !m_xDataSource )
2616 return true;
2617
2618 try
2619 {
2620 // to get the 'modified' for the data source
2622 if ( aLayoutInfo.has( INFO_PREVIEW ) )
2623 {
2624 const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) );
2625 m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
2626 if ( getView() )
2628 }
2629 }
2630 catch( const Exception& )
2631 {
2632 DBG_UNHANDLED_EXCEPTION("dbaccess");
2633 }
2634
2635 return true;
2636}
2637
2639{
2640 try
2641 {
2642 if ( _xContainer.is() )
2643 {
2644 m_aCurrentContainers.push_back(_xContainer);
2645 _xContainer->addContainerListener(this);
2646 }
2647 }
2648 catch(const Exception&)
2649 {
2650 DBG_UNHANDLED_EXCEPTION("dbaccess");
2651 }
2652}
2653
2654OUString OApplicationController::getCurrentlySelectedName(sal_Int32& _rnCommandType) const
2655{
2656 _rnCommandType = ( (getContainer()->getElementType() == E_QUERY)
2658
2659 OUString sName;
2660 if ( _rnCommandType != -1 )
2661 {
2662 try
2663 {
2664 sName = getContainer()->getQualifiedName( nullptr );
2665 OSL_ENSURE( !sName.isEmpty(), "OApplicationController::getCurrentlySelectedName: no name given!" );
2666 }
2667 catch( const Exception& )
2668 {
2669 DBG_UNHANDLED_EXCEPTION("dbaccess");
2670 }
2671 }
2672 return sName;
2673}
2674
2676{
2677 m_pSelectionNotifier->addListener( Listener );
2678}
2679
2681{
2682 m_pSelectionNotifier->removeListener( Listener );
2683}
2684
2685sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection )
2686{
2687 SolarMutexGuard aSolarGuard;
2688 ::osl::MutexGuard aGuard( getMutex() );
2689 Sequence< OUString> aSelection;
2690 if ( !_aSelection.hasValue() || !getView() )
2691 {
2692 getContainer()->selectElements(aSelection);
2693 return true;
2694 }
2695
2696 // BEGIN compatibility
2697 Sequence< NamedValue > aCurrentSelection;
2698 if ( (_aSelection >>= aCurrentSelection) && aCurrentSelection.hasElements() )
2699 {
2701 const NamedValue* pIter = aCurrentSelection.getConstArray();
2702 const NamedValue* pEnd = pIter + aCurrentSelection.getLength();
2703 for(;pIter != pEnd;++pIter)
2704 {
2705 if ( pIter->Name == "Type" )
2706 {
2707 sal_Int32 nType = 0;
2708 pIter->Value >>= nType;
2709 if ( nType < DatabaseObject::TABLE || nType > DatabaseObject::REPORT )
2710 throw IllegalArgumentException();
2711 eType = static_cast< ElementType >( nType );
2712 }
2713 else if ( pIter->Name == "Selection" )
2714 pIter->Value >>= aSelection;
2715 }
2716
2717 m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
2719 getContainer()->selectElements(aSelection);
2720 return true;
2721 }
2722 // END compatibility
2723
2724 Sequence< NamedDatabaseObject > aSelectedObjects;
2725 if ( !( _aSelection >>= aSelectedObjects ) )
2726 {
2727 aSelectedObjects.realloc( 1 );
2728 if ( !( _aSelection >>= aSelectedObjects.getArray()[0] ) )
2729 throw IllegalArgumentException();
2730 }
2731
2732 SelectionByElementType aSelectedElements;
2733 ElementType eSelectedCategory = E_NONE;
2734 for ( const NamedDatabaseObject* pObject = aSelectedObjects.getConstArray();
2735 pObject != aSelectedObjects.getConstArray() + aSelectedObjects.getLength();
2736 ++pObject
2737 )
2738 {
2739 switch ( pObject->Type )
2740 {
2742 case DatabaseObjectContainer::SCHEMA:
2743 case DatabaseObjectContainer::CATALOG:
2744 aSelectedElements[ E_TABLE ].push_back( pObject->Name );
2745 break;
2747 aSelectedElements[ E_QUERY ].push_back( pObject->Name );
2748 break;
2749 case DatabaseObject::FORM:
2750 case DatabaseObjectContainer::FORMS_FOLDER:
2751 aSelectedElements[ E_FORM ].push_back( pObject->Name );
2752 break;
2754 case DatabaseObjectContainer::REPORTS_FOLDER:
2755 aSelectedElements[ E_REPORT ].push_back( pObject->Name );
2756 break;
2757 case DatabaseObjectContainer::TABLES:
2758 case DatabaseObjectContainer::QUERIES:
2759 case DatabaseObjectContainer::FORMS:
2760 case DatabaseObjectContainer::REPORTS:
2761 if ( eSelectedCategory != E_NONE )
2762 throw IllegalArgumentException(
2763 DBA_RES(RID_STR_NO_DIFF_CAT),
2764 *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
2765 eSelectedCategory =
2766 ( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
2767 : ( pObject->Type == DatabaseObjectContainer::QUERIES ) ? E_QUERY
2768 : ( pObject->Type == DatabaseObjectContainer::FORMS ) ? E_FORM
2769 : ( pObject->Type == DatabaseObjectContainer::REPORTS ) ? E_REPORT
2770 : E_NONE;
2771 break;
2772
2773 default:
2774 case DatabaseObjectContainer::DATA_SOURCE:
2775 {
2776 OUString sMessage(
2777 DBA_RES(RID_STR_UNSUPPORTED_OBJECT_TYPE).
2778 replaceFirst("$type$", OUString::number(pObject->Type)));
2779 throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
2780 }
2781 }
2782 }
2783 for (auto const& selectedElement : aSelectedElements)
2784 {
2785 if ( selectedElement.first == m_eCurrentType )
2786 {
2787 getContainer()->selectElements( comphelper::containerToSequence(selectedElement.second) );
2788 }
2789 else
2790 {
2791 m_aPendingSelection[ selectedElement.first ] = selectedElement.second;
2792 }
2793 }
2794
2795 m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
2796 getContainer()->selectContainer( eSelectedCategory );
2797
2798 return true;
2799}
2800
2802{
2803 SolarMutexGuard aSolarGuard;
2804 ::osl::MutexGuard aGuard( getMutex() );
2805
2806 Sequence< NamedDatabaseObject > aCurrentSelection;
2808 if ( eType != E_NONE )
2809 {
2810 getContainer()->describeCurrentSelectionForType( eType, aCurrentSelection );
2811 if ( !aCurrentSelection.hasElements() )
2812 { // if no objects are selected, add an entry to the sequence which describes the overall category
2813 // which is selected currently
2814 aCurrentSelection.realloc(1);
2815 auto pCurrentSelection = aCurrentSelection.getArray();
2816 pCurrentSelection[0].Name = getDatabaseName();
2817 switch ( eType )
2818 {
2819 case E_TABLE: pCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break;
2820 case E_QUERY: pCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break;
2821 case E_FORM: pCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break;
2822 case E_REPORT: pCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break;
2823 default:
2824 OSL_FAIL( "OApplicationController::getSelection: unexpected current element type!" );
2825 break;
2826 }
2827 }
2828 }
2829 return Any( aCurrentSelection );
2830}
2831
2832} // namespace dbaui
2833
2834/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SelectionNotifier & m_rNotifier
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_openoffice_comp_dbu_OApplicationController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
OptionalString sSchema
OptionalString sCatalog
OptionalString sName
SFX2_DLLPUBLIC short ExecuteQuerySaveDocument(weld::Widget *_pParent, std::u16string_view _rTitle)
AnyEventRef aEvent
#define ID_NEW_TABLE_DESIGN
Definition: browserids.hxx:72
#define ID_NEW_VIEW_DESIGN_AUTO_PILOT
Definition: browserids.hxx:86
#define ID_BROWSER_SAVEDOC
Definition: browserids.hxx:32
#define ID_NEW_TABLE_DESIGN_AUTO_PILOT
Definition: browserids.hxx:85
#define ID_BROWSER_SORTDOWN
Definition: browserids.hxx:42
#define ID_BROWSER_UNDO
Definition: browserids.hxx:35
#define ID_APP_NEW_QUERY_AUTO_PILOT
Definition: browserids.hxx:84
#define ID_NEW_VIEW_DESIGN
Definition: browserids.hxx:73
#define ID_FORM_NEW_TEXT
Definition: browserids.hxx:65
#define ID_DIRECT_SQL
Definition: browserids.hxx:74
#define ID_BROWSER_SORTUP
Definition: browserids.hxx:41
#define ID_BROWSER_PASTE
Definition: browserids.hxx:29
#define ID_BROWSER_CUT
Definition: browserids.hxx:25
#define ID_BROWSER_SAVEASDOC
Definition: browserids.hxx:33
#define ID_BROWSER_COPY
Definition: browserids.hxx:24
#define ID_DOCUMENT_CREATE_REPWIZ
Definition: browserids.hxx:81
#define ID_REPORT_NEW_TEXT
Definition: browserids.hxx:64
#define ID_NEW_QUERY_SQL
Definition: browserids.hxx:70
#define ID_NEW_QUERY_DESIGN
Definition: browserids.hxx:68
static void AddToRecentDocumentList(const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService)
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
SendMailResult AttachDocument(const css::uno::Reference< css::uno::XInterface > &xFrameOrModel, const OUString &sAttachmentTitle)
SendMailResult Send(const css::uno::Reference< css::frame::XFrame > &xFrame)
bool IsModuleInstalled(EModule eModule) const
OUString SubstituteVariable(const OUString &rVar) const
static SvxAbstractDialogFactory * Create()
const DataFlavorExVector & GetDataFlavorExVector() const
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
bool HasFormat(SotClipboardFormatId nFormat) const
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
OUString getType(std::u16string_view _sURL) const
Definition: dsntypes.cxx:481
OUString cutPrefix(std::u16string_view _sURL) const
on a given string, cut the type prefix and return the result
Definition: dsntypes.cxx:84
static bool isShowPropertiesEnabled(const OUString &_sURL)
Definition: dsntypes.cxx:188
bool isFileSystemBased(std::u16string_view _sURL) const
check if the given data source type is based on the file system - i.e. the URL is a prefix plus a fil...
Definition: dsntypes.cxx:249
static bool isEmbeddedDatabase(std::u16string_view _sURL)
checks if the given data source type embeds its data into the database document
Definition: dsntypes.cxx:285
OUString getTypeDisplayName(std::u16string_view _sURL) const
get the datasource type display name from a DSN string
Definition: dsntypes.cxx:79
void extractHostNamePort(const OUString &_rDsn, OUString &_sDatabaseName, OUString &_rHostname, sal_Int32 &_nPortNumber) const
Definition: dsntypes.cxx:202
static bool doesHaveAnyAdvancedSettings(const OUString &_sURL)
determines whether or not the given data source type has any advanced setting
const css::uno::Reference< css::frame::XFrame > & getFrame() const
css::uno::Reference< css::lang::XComponent > createNew(const css::uno::Reference< css::sdbc::XDataSource > &_xDataSource, const ::comphelper::NamedValueCollection &i_rDispatchArgs=::comphelper::NamedValueCollection())
opens a view for a to-be-created object
class implementing the IObjectNameCheck interface, and checking a given name for being valid as eithe...
class implementing the IObjectNameCheck interface, and checking given object names against a hierarch...
virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
virtual bool requestDrag(const weld::TreeIter &rEntry) override
handler for StartDrag requests
void onDeleteEntry()
called when a "Delete" command is executed in a tree view
void addContainerListener(const css::uno::Reference< css::container::XNameAccess > &_xCollection)
adds a listener to the current name access.
const TransferableDataHelper & getViewClipboard() const
returns the system clipboard.
bool isRenameDeleteAllowed(ElementType _eType, bool _bDelete) const
checks if delete command or rename command is allowed
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
virtual ~OApplicationController() override
bool insertHierarchyElement(ElementType _eType, const OUString &_sParentFolder, bool _bCollection=true, const css::uno::Reference< css::ucb::XContent > &_xContent=css::uno::Reference< css::ucb::XContent >(), bool _bMove=false)
Inserts a new object into the hierarchy given be the type.
void pasteFormat(SotClipboardFormatId _nFormatId)
pastes a special format from the system clipboard to the currently selected object types
std::map< ElementType, std::vector< OUString > > SelectionByElementType
OApplicationController(const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > &xFrame) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static void getSupportedFormats(ElementType _eType, std::vector< SotClipboardFormatId > &_rFormatIds)
fills the vector with all supported formats
void openDialog(const OUString &_sServiceName)
opens a uno dialog with the currently selected data source as initialize argument
static ElementType getElementType(const css::uno::Reference< css::container::XContainer > &_xContainer)
return the element type for given container
virtual sal_Bool SAL_CALL closeSubComponents() override
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
void refreshTables()
refreshes the tables
void renameEntry()
renames the selected entry in the detail page
void askToReconnect()
when the settings of the data source changed, it opens a dialog which ask to close all depending docu...
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
std::unique_ptr< SelectionNotifier > m_pSelectionNotifier
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
virtual ::comphelper::OInterfaceContainerHelper2 * getContextMenuInterceptors() override
returns the container of registered context menu interceptors, or NULL if the implementation does not...
OTableCopyHelper::DropDescriptor m_aAsyncDrop
virtual css::uno::Any SAL_CALL getSelection() override
bool isConnectionReadOnly() const
checks if the connection for the selected data source is read only.
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
void newElementWithPilot(ElementType _eType)
creates a new database object, using an auto pilot
virtual OUString getContextMenuResourceName() const override
returns the context menu resource name for the control
virtual void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const override
adjust rPos which is initially relative to rControl to be relative to the window of getMenuParent
virtual bool isDataSourceReadOnly() const override
checks if the selected data source is read only
SelectionByElementType m_aPendingSelection
virtual sal_Int8 queryDrop(const AcceptDropEvent &_rEvt, const DataFlavorExVector &_rFlavors) override
check whether or not a drop request should be accepted
virtual sal_Int8 executeDrop(const ExecuteDropEvent &_rEvt) override
execute a drop request
css::uno::Reference< css::lang::XComponent > newElement(ElementType _eType, const ::comphelper::NamedValueCollection &i_rAdditionalArguments, css::uno::Reference< css::lang::XComponent > &o_rDocumentDefinition)
opens a new frame for creation or auto pilot
OTableCopyHelper m_aTableCopyHelper
void showPreviewFor(const ElementType _eType, const OUString &_sName)
shows the preview for the given entry
bool copySQLObject(ODataClipboard &rExchange)
fills rExchange with current object if it's a Table or Query
void disconnect()
disconnects from our XConnection, and cleans up this connection
virtual css::uno::Any getCurrentSelection(weld::TreeView &rControl) const override
returns the current selection in the given control
virtual bool Construct(vcl::Window *pParent) override
virtual void SAL_CALL disposing() override
bool onContainerSelect(ElementType _eType)
called when a container (category) in the application view has been selected
virtual sal_Bool SAL_CALL isConnected() override
void onDocumentOpened(const OUString &_rName, const sal_Int32 _nType, const ElementOpenMode _eMode, const css::uno::Reference< css::lang::XComponent > &_xDocument, const css::uno::Reference< css::lang::XComponent > &_xDefinition)
remember a newly opened sub document for later access
void onSelectionChanged()
called when an entry in a tree view has been selected
const SharedConnection & ensureConnection(::dbtools::SQLExceptionInfo *_pErrorInfo=nullptr)
retrieves the current connection, creates it if necessary
bool paste(ElementType _eType, const svx::ODataAccessDescriptor &_rPasteData, const OUString &_sParentFolder=OUString(), bool _bMove=false)
pastes a query, form or report into the data source
rtl::Reference< TransferableHelper > copyObject()
copies the current object into clipboard
virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override
virtual vcl::Window * getMenuParent() const override
virtual bool requestQuickHelp(const void *pUserData, OUString &rText) const override
requests a quick help text to display
rtl::Reference< TransferableClipboardListener > m_pClipboardNotifier
void deleteEntries()
deletes the entries 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
const SharedConnection & getConnection() const
retrieves the current connection
css::uno::Reference< css::beans::XPropertySet > m_xDataSource
void getSelectionElementNames(std::vector< OUString > &_rNames) const
fills the list with the selected entries.
std::unique_ptr< OLinkedDocumentsAccess > getDocumentsAccess(ElementType _eType)
returns the document access for the specific type
OAsynchronousLink m_aSelectContainerEvent
css::uno::Reference< css::lang::XComponent > openElementWithArguments(const OUString &_sName, ElementType _eType, ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand, const ::comphelper::NamedValueCollection &_rAdditionalArguments)
opens a new sub frame with a table/query/form/report/view, passing additional arguments
::comphelper::OInterfaceContainerHelper2 m_aContextMenuInterceptors
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
bool impl_isAlterableView_nothrow(const OUString &_rTableOrViewName) const
determines whether the given table name denotes a view which can be altered
virtual FeatureState GetState(sal_uInt16 nId) const override
TransferableDataHelper m_aSystemClipboard
void onPasteEntry()
called when a "Paste" command is executed in a tree view
void doAction(sal_uInt16 _nId, ElementOpenMode _eOpenMode)
all selected entries will be opened, or edited, or converted to a view
css::uno::Reference< css::frame::XModel > m_xModel
bool copyDocObject(svx::OComponentTransferable &rExchange)
fills rExchange with current object if it's a Form or Report
OUString getStrippedDatabaseName() const
returns the stripped database name.
OUString getDatabaseName() const
returns the database name
void onCopyEntry()
called when a "Copy" command is executed in a tree view
css::uno::Reference< css::container::XNameAccess > getElements(ElementType _eType)
returns the nameaccess
::rtl::Reference< SubComponentManager > m_pSubComponentManager
bool isTableFormat() const
returns <TRUE> if the clipboard supports a table format, otherwise <FALSE>.
virtual void describeSupportedFeatures() override
OApplicationView * getContainer() const
virtual sal_Bool SAL_CALL select(const css::uno::Any &xSelection) override
::dbaccess::ODsnTypeCollection m_aTypeCollection
void onAttachedFrame()
called we were attached to a frame
virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > &xModel) override
bool onEntryDoubleClick(const weld::TreeView &rTree)
called when an entry in a tree list box has been double-clicked
OUString getCurrentlySelectedName(sal_Int32 &_rnCommandType) const
returns the currently selected table or query name.
SharedConnection m_xDataSourceConnection
virtual IController & getCommandController() override
returns the controller which is responsible for providing states of certain features,...
TContainerVector m_aCurrentContainers
void createPage(ElementType _eType, const css::uno::Reference< css::container::XNameAccess > &_xContainer)
creates the page for the specific type.
void createTablesPage(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
creates the tables page
TreeListBox * getTreeWindow() const
sal_Int32 getSelectionCount() const
returns the count of selected entries
Definition: AppView.cxx:294
OApplicationDetailView * getDetailView() const
get the detail page
Definition: AppView.hxx:127
bool isALeafSelected() const
returns if one of the selected entries is a leaf
Definition: AppView.cxx:252
bool isFilled() const
returns <TRUE> when a detail page was filled
Definition: AppView.cxx:282
std::unique_ptr< weld::TreeIter > elementAdded(ElementType eType, const OUString &rName, const css::uno::Any &rObject)
adds a new object to the detail page.
Definition: AppView.cxx:342
PreviewMode getPreviewMode() const
returns the preview mode
Definition: AppView.cxx:382
OUString getQualifiedName(const weld::TreeIter *_pEntry) const
return the qualified name.
Definition: AppView.cxx:240
void showPreview(const css::uno::Reference< css::ucb::XContent > &_xContent)
shows the Preview of the content when it is enabled.
void elementReplaced(ElementType eType, const OUString &_rOldName, const OUString &_rNewName)
replaces an objects name with a new one
Definition: AppView.cxx:354
void selectElements(const css::uno::Sequence< OUString > &_aNames)
select all names on the currently selected container.
Definition: AppView.cxx:336
void clearPages()
clears the detail page and the selection on the left side.
Definition: AppView.cxx:362
void selectAll()
select all entries in the detail page
Definition: AppView.cxx:258
void switchPreview(PreviewMode _eMode)
switches to the given preview mode
Definition: AppView.cxx:394
bool isSortUp() const
returns <TRUE> if it sorts ascending
Definition: AppView.cxx:264
void elementRemoved(ElementType _eType, const OUString &_rName)
removes an element from the detail page.
Definition: AppView.cxx:348
ElementType getElementType() const
return the element of currently select entry
Definition: AppView.cxx:288
void sortDown()
sort the entries in the detail page down
Definition: AppView.cxx:270
sal_Int32 getElementCount() const
returns the count of entries
Definition: AppView.cxx:300
void selectContainer(ElementType _eType)
changes the container which should be displayed.
Definition: AppView.cxx:369
vcl::Window * getMenuParent() const
get the menu parent window for the given control
Definition: AppView.cxx:318
void describeCurrentSelectionForType(const ElementType _eType, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given ElementType
Definition: AppView.cxx:330
void sortUp()
sort the entries in the detail page up
Definition: AppView.cxx:276
virtual void cut() override
Definition: AppView.cxx:226
void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const
adjust rPos relative to rControl to instead relative to getMenuParent
Definition: AppView.cxx:324
void describeCurrentSelectionForControl(const weld::TreeView &rControl, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given control
Definition: AppView.cxx:312
std::unique_ptr< weld::TreeIter > getEntry(const Point &rPosPixel) const
Definition: AppView.cxx:376
virtual bool isCutAllowed() override
Definition: AppView.cxx:207
bool isLeaf(const weld::TreeView &rTreeView, const weld::TreeIter &rEntry) const
returns if an entry is a leaf
Definition: AppView.cxx:246
virtual void Construct()
late construction
Definition: dataview.cxx:49
weld::Window * getFrameWeld() const
virtual FeatureState GetState(sal_uInt16 nId) const
css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer
virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > &xFrame) override
virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override
void showError(const ::dbtools::SQLExceptionInfo &_rInfo)
void implDescribeSupportedFeature(const OUString &_rCommandURL, sal_uInt16 _nFeatureId, sal_Int16 _nCommandGroup=css::frame::CommandGroup::INTERNAL)
describes a feature supported by the controller
void setView(const VclPtr< ODataView > &i_rView)
virtual void SAL_CALL dispose() override
virtual void executeChecked(const css::util::URL &_rCommand, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
executes the given command only when it is allowed
void InvalidateFeature(sal_uInt16 nId, const css::uno::Reference< css::frame::XStatusListener > &xListener=nullptr, bool _bForceBroadcast=false)
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue > &aArgs)
virtual bool Construct(vcl::Window *pParent)
::osl::Mutex & getMutex() const
virtual void SAL_CALL disposing() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
void InvalidateAll()
InvalidateAll invalidates all features currently known.
static css::uno::Reference< css::frame::XLayoutManager > getLayoutManager(const css::uno::Reference< css::frame::XFrame > &_xFrame)
get the layout manager
const css::uno::Reference< css::uno::XComponentContext > & getORB() const
static bool isUserDefinedFeature(const sal_uInt16 nFeatureId)
determines whether the given feature ID denotes a user-defined feature
void pasteTable(const TransferableDataHelper &_rTransData, std::u16string_view _sDestDataSourceName, const SharedConnection &_xConnection)
pastes a table into the data source
bool copyTagTable(DropDescriptor const &_rDesc, bool _bCheck, const SharedConnection &_xConnection)
copies a table which was constructed by tags like HTML or RTF
void SetTableNameForAppend(const OUString &_rDefaultTableName)
void leaveSelection(SelectionGuardAccess)
leaves a block which modifies the selection of our owner
void removeListener(const Reference< XSelectionChangeListener > &Listener)
const SelectionNotifier & operator=(const SelectionNotifier &)=delete
::comphelper::OInterfaceContainerHelper3< XSelectionChangeListener > m_aSelectionListeners
void addListener(const Reference< XSelectionChangeListener > &Listener)
SelectionNotifier(const SelectionNotifier &)=delete
::cppu::OWeakObject & m_rContext
SelectionNotifier(::osl::Mutex &_rMutex, ::cppu::OWeakObject &_rContext)
void enterSelection(SelectionGuardAccess)
enters a block which modifies the selection of our owner.
TransferDataContainer & GetDataTransfer()
OUString GetPath() const
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
void SetDisplayDirectory(const OUString &rPath)
void SetCurrentFilter(const OUString &rFilter)
void SetContext(Context _eNewContext)
OUString get(NOTATION _eOutputNotation) const
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual bool get_cursor(TreeIter *pIter) const=0
#define DBA_RES(id)
int nCount
#define DBG_UNHANDLED_EXCEPTION(...)
ULONG m_refCount
float u
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
Any aHelper
::std::vector< DataFlavorEx > DataFlavorExVector
SotClipboardFormatId
OUString eType
Definition: generalpage.cxx:78
URL aURL
Definition: intercept.cxx:87
Sequence< PropertyValue > aArguments
Definition: intercept.cxx:88
void AppendItem(EHistoryType eHistory, const OUString &sURL, const OUString &sFilter, const OUString &sTitle, const std::optional< OUString > &sThumbnail, ::std::optional< bool > const oIsReadOnly)
NONE
@ Exception
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
std::shared_ptr< const SfxFilter > getStandardDatabaseFilter()
returns the standard database filter
Definition: UITools.cxx:861
::osl::Mutex & getMutex()
sal_Int16 nId
const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE]
QPRO_FUNC_TYPE nType
OUString sMessage
Definition: sqlmessage.cxx:159
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OStatement, OStatementBase, OStatement_IFACE)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral PROPERTY_USER(u"User")
constexpr OUStringLiteral PROPERTY_URL(u"URL")
constexpr OUStringLiteral PROPERTY_INFO(u"Info")
constexpr OUStringLiteral SERVICE_SDB_DIRECTSQLDIALOG
Definition: strings.hxx:249
constexpr OUStringLiteral SERVICE_SDB_APPLICATIONCONTROLLER
Definition: strings.hxx:203
constexpr OUStringLiteral PROPERTY_TABLETYPEFILTER(u"TableTypeFilter")
constexpr OUStringLiteral PROPERTY_SUPPRESSVERSIONCL(u"SuppressVersionColumns")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_LAYOUTINFORMATION(u"LayoutInformation")
constexpr OUStringLiteral PROPERTY_SHOWMENU(u"ShowMenu")
constexpr OUStringLiteral PROPERTY_GRAPHICAL_DESIGN(u"GraphicalDesign")
constexpr OUStringLiteral PROPERTY_ISPASSWORDREQUIRED(u"IsPasswordRequired")
constexpr OUStringLiteral INFO_PREVIEW
Definition: strings.hxx:228
sal_Int8 mnAction
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
describes the state of a feature
std::optional< bool > bChecked
std::optional< OUString > sTitle
svx::ODataAccessDescriptor aDroppedData
Functor object for class DataFlavorExVector::value_type returntype is bool.
Reference< XController > xController
the controller of the sub component. Must not be <NULL>
Reference< XFrame > xFrame
the frame which the component resides in. Must not be <NULL>
Reference< XModel > xModel
the model of the sub component. Might be <NULL>
#define DND_ACTION_COPYMOVE
#define DND_ACTION_COPY
#define DND_ACTION_NONE
unsigned char sal_Bool
signed char sal_Int8
RET_OK
RET_CANCEL
RET_YES