summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/misc
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r--dbaccess/source/ui/misc/HtmlReader.cxx4
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx4
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx2
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx2
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx129
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx4
-rw-r--r--dbaccess/source/ui/misc/documentcontroller.cxx137
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx197
-rw-r--r--dbaccess/source/ui/misc/makefile.mk1
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx75
10 files changed, 207 insertions, 348 deletions
diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx
index ec46bd7f54ca..9e3517ffb3af 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -506,6 +506,8 @@ sal_Bool OHTMLReader::CreateTable(int nToken)
else if ( m_sCurrent.Len() )
aColumnName = m_sCurrent;
+ aColumnName.EraseLeadingChars();
+ aColumnName.EraseTrailingChars();
CreateDefaultColumn(aColumnName);
aColumnName.Erase();
m_sCurrent.Erase();
@@ -550,6 +552,8 @@ sal_Bool OHTMLReader::CreateTable(int nToken)
if ( m_sCurrent.Len() )
aColumnName = m_sCurrent;
+ aColumnName.EraseLeadingChars();
+ aColumnName.EraseTrailingChars();
if(aColumnName.Len())
CreateDefaultColumn(aColumnName);
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index a9c7cbd39d3d..930dd089951a 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -375,11 +375,11 @@ SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XP
}
else
{ // instantiate the default SDB interaction handler
- Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
+ Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY);
if (!xHandler.is())
{
OSL_ENSURE(sal_False, "createConnection: could not instantiate an interaction handler!");
- // ShowServiceNotAvailableError(NULL, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True);
+ // ShowServiceNotAvailableError(NULL, String(SERVICE_TASK_INTERACTION_HANDLER), sal_True);
// TODO: a real parent!
}
else
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index d22a78fd5e21..5670ff86b60e 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -706,7 +706,7 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe
::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex );
::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex );
- m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY);
+ m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY);
OCopyTable* pPage1( new OCopyTable( this ) );
pPage1->disallowViews();
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index d0907ce31a38..f33c82abecb7 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -320,6 +320,8 @@ IMPL_LINK( OWizTypeSelect, ColumnSelectHdl, MultiListBox *, /*pListBox*/ )
OFieldDescription* pField = static_cast<OFieldDescription*>(m_lbColumnNames.GetEntryData(m_lbColumnNames.GetEntryPos(aColumnName)));
if(pField)
m_aTypeControl.DisplayData(pField);
+
+ m_aTypeControl.Enable(m_lbColumnNames.GetSelectEntryCount() == 1 );
return 0;
}
// -----------------------------------------------------------------------
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 5d0df2d69bcd..68f702b11d75 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -46,7 +46,6 @@
#include <comphelper/extract.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/namedvaluecollection.hxx>
#include <connectivity/dbtools.hxx>
#include <osl/diagnose.h>
#include <toolkit/helper/vclunohelper.hxx>
@@ -75,11 +74,11 @@ namespace dbaui
const Reference< XDatabaseDocumentUI >& _rxApplication,
const Reference< XFrame >& _rxParentFrame,
const ::rtl::OUString& _rComponentURL )
- :m_xORB ( _rxORB )
- ,m_xParentFrame ( _rxParentFrame )
- ,m_xFrameLoader ( )
- ,m_xApplication ( _rxApplication )
- ,m_sComponentURL( _rComponentURL )
+ :m_xORB ( _rxORB )
+ ,m_xParentFrame ( _rxParentFrame )
+ ,m_xFrameLoader ( )
+ ,m_xApplication ( _rxApplication )
+ ,m_sComponentURL ( _rComponentURL )
{
OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" );
OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" );
@@ -95,32 +94,33 @@ namespace dbaui
}
//----------------------------------------------------------------------
- Reference< XComponent > DatabaseObjectView::createNew(const Reference< XDataSource >& _xDataSource )
+ Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs )
{
- return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), Sequence< PropertyValue >() );
+ return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), i_rDispatchArgs );
}
//----------------------------------------------------------------------
- Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName, const Sequence< PropertyValue >& _rArgs )
+ Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName,
+ const ::comphelper::NamedValueCollection& i_rDispatchArgs )
{
- return doCreateView( _rDataSource, _rName, _rArgs );
+ return doCreateView( _rDataSource, _rName, i_rDispatchArgs );
}
//----------------------------------------------------------------------
Reference< XComponent > DatabaseObjectView::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName,
- const Sequence< PropertyValue >& _rCreationArgs )
+ const ::comphelper::NamedValueCollection& i_rCreationArgs )
{
- Sequence< PropertyValue > aDispatchArgs;
- fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName );
+ ::comphelper::NamedValueCollection aDispatchArgs;
- ::comphelper::NamedValueCollection aDispArgs( aDispatchArgs );
- aDispArgs.merge( _rCreationArgs, true );
+ aDispatchArgs.merge( i_rCreationArgs, false ); // false => do not overwrite
+ fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName );
+ aDispatchArgs.merge( i_rCreationArgs, true ); // true => do overwrite
- return doDispatch( aDispArgs.getPropertyValues() );
+ return doDispatch( aDispatchArgs );
}
//----------------------------------------------------------------------
- Reference< XComponent > DatabaseObjectView::doDispatch( const Sequence< PropertyValue >& _rArgs )
+ Reference< XComponent > DatabaseObjectView::doDispatch( const ::comphelper::NamedValueCollection& i_rDispatchArgs )
{
Reference< XComponent > xReturn;
if ( m_xORB.is() )
@@ -160,7 +160,7 @@ namespace dbaui
m_sComponentURL,
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")),
0,
- _rArgs
+ i_rDispatchArgs.getPropertyValues()
);
if ( !xReturn.is() )
@@ -176,29 +176,23 @@ namespace dbaui
//----------------------------------------------------------------------
void DatabaseObjectView::fillDispatchArgs(
- Sequence< PropertyValue >& _rDispatchArguments,
+ ::comphelper::NamedValueCollection& i_rDispatchArgs,
const Any& _aDataSource,
const ::rtl::OUString& /* _rName */
)
{
- sal_Int32 nPos = _rDispatchArguments.getLength();
- _rDispatchArguments.realloc( nPos + 2 );
-
::rtl::OUString sDataSource;
Reference<XDataSource> xDataSource;
if ( _aDataSource >>= sDataSource )
{
- _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCENAME;
- _rDispatchArguments[nPos++].Value <<= sDataSource;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCENAME, sDataSource );
}
else if ( _aDataSource >>= xDataSource )
{
- _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCE;
- _rDispatchArguments[nPos++].Value <<= xDataSource;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCE, xDataSource );
}
- _rDispatchArguments[nPos ].Name = PROPERTY_ACTIVE_CONNECTION;
- _rDispatchArguments[nPos++].Value <<= getConnection();
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, getConnection() );
}
//======================================================================
@@ -206,48 +200,32 @@ namespace dbaui
//======================================================================
//----------------------------------------------------------------------
QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication,
- const Reference< XFrame >& _rxParentFrame,
- bool _bCreateView, sal_Bool _bPreferSQLView )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) )
+ const Reference< XFrame >& _rxParentFrame, bool _bCreateView )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN )
,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY )
- ,m_bPreferSQLView( _bPreferSQLView )
{
}
//----------------------------------------------------------------------
- void QueryDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource,
+ void QueryDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
const ::rtl::OUString& _rObjectName )
{
- DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName );
+ DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName );
- bool bIncludeQueryName = 0 != _rObjectName.getLength();
- bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && m_bPreferSQLView;
+ const bool bIncludeQueryName = 0 != _rObjectName.getLength();
+ const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True );
+ const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign;
- sal_Int32 nPos = _rDispatchArguments.getLength();
-
- sal_Int32 nNewLen = _rDispatchArguments.getLength() + 2;
- if ( bIncludeQueryName )
- ++nNewLen;
- if ( bEditViewAsSQLCommand )
- ++nNewLen;
- _rDispatchArguments.realloc( nNewLen );
-
- _rDispatchArguments[nPos ].Name = PROPERTY_GRAPHICAL_DESIGN;
- _rDispatchArguments[nPos++].Value <<= ::cppu::bool2any( !m_bPreferSQLView );
-
- _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE;
- _rDispatchArguments[nPos++].Value <<= m_nCommandType;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, m_nCommandType );
if ( bIncludeQueryName )
{
- _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND;
- _rDispatchArguments[nPos++].Value <<= _rObjectName;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rObjectName );
}
if ( bEditViewAsSQLCommand )
{
- _rDispatchArguments[nPos ].Name = PROPERTY_ESCAPE_PROCESSING;
- _rDispatchArguments[nPos++].Value <<= sal_Bool( sal_False );
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, sal_False );
}
}
@@ -261,24 +239,20 @@ namespace dbaui
}
//----------------------------------------------------------------------
- void TableDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource,
+ void TableDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
const ::rtl::OUString& _rObjectName )
{
- DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName );
- sal_Bool bIncludeName = 0 != _rObjectName.getLength();
+ DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName );
- if (bIncludeName)
+ if ( 0 != _rObjectName.getLength() )
{
- sal_Int32 nPos = _rDispatchArguments.getLength();
- _rDispatchArguments.realloc(_rDispatchArguments.getLength() + 1);
- _rDispatchArguments[nPos ].Name = PROPERTY_CURRENTTABLE;
- _rDispatchArguments[nPos++].Value <<= _rObjectName;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_CURRENTTABLE, _rObjectName );
}
}
//----------------------------------------------------------------------
Reference< XComponent > TableDesigner::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName,
- const Sequence< PropertyValue >& _rCreationArgs )
+ const ::comphelper::NamedValueCollection& i_rCreationArgs )
{
bool bIsNewDesign = ( _rObjectName.getLength() == 0 );
@@ -288,7 +262,7 @@ namespace dbaui
xDesigner = impl_getConnectionProvidedDesigner_nothrow( _rObjectName );
if ( !xDesigner.is() )
- return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, _rCreationArgs );
+ return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, i_rCreationArgs );
// try whether the designer is a dialog
Reference< XExecutableDialog > xDialog( xDesigner, UNO_QUERY_THROW );
@@ -333,10 +307,10 @@ namespace dbaui
}
//----------------------------------------------------------------------
- void ResultSetBrowser::fillDispatchArgs(Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource,
+ void ResultSetBrowser::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
const ::rtl::OUString& _rQualifiedName)
{
- DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rQualifiedName );
+ DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName );
OSL_ENSURE( 0 != _rQualifiedName.getLength(),"A Table name must be set");
::rtl::OUString sCatalog;
::rtl::OUString sSchema;
@@ -344,26 +318,15 @@ namespace dbaui
if ( m_bTable )
::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
- sal_Int32 nPos = _rDispatchArguments.getLength();
- _rDispatchArguments.realloc( _rDispatchArguments.getLength() + 3 + ( m_bTable ? 3 : 0 ) );
-
- _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE;
- _rDispatchArguments[nPos++].Value <<= (m_bTable ? CommandType::TABLE : CommandType::QUERY);
-
- _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND;
- _rDispatchArguments[nPos++].Value <<= _rQualifiedName;
-
- _rDispatchArguments[nPos ].Name = PROPERTY_ENABLE_BROWSER;
- _rDispatchArguments[nPos++].Value <<= sal_False;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rQualifiedName );
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ENABLE_BROWSER, sal_False );
if ( m_bTable )
{
- _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_CATALOGNAME;
- _rDispatchArguments[nPos++].Value <<= sCatalog;
- _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_SCHEMANAME;
- _rDispatchArguments[nPos++].Value <<= sSchema;
- _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_TABLENAME;
- _rDispatchArguments[nPos++].Value <<= sTable;
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, sCatalog );
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, sSchema );
+ i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_TABLENAME, sTable );
}
}
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index eb8fbde27eaf..4c4a9be58d52 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -192,9 +192,9 @@ namespace dbaui
if ( !xHandler.is() )
{
// instantiate the default SDB interaction handler
- xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY );
+ xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY );
if ( !xHandler.is() )
- ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True);
+ ShowServiceNotAvailableError(m_pErrorMessageParent, (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER, sal_True);
}
if ( xHandler.is() )
diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx
deleted file mode 100644
index c9b7f8863e0b..000000000000
--- a/dbaccess/source/ui/misc/documentcontroller.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#include "documentcontroller.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::frame;
-
- //====================================================================
- //= ModelControllerConnector
- //====================================================================
- DBG_NAME( ModelControllerConnector )
- //--------------------------------------------------------------------
- ModelControllerConnector::ModelControllerConnector()
- {
- DBG_CTOR( ModelControllerConnector, NULL );
- }
-
- //--------------------------------------------------------------------
- ModelControllerConnector::ModelControllerConnector( const ModelControllerConnector& _rSource )
- {
- DBG_CTOR( ModelControllerConnector, NULL );
- impl_copyFrom( _rSource );
- }
-
- //--------------------------------------------------------------------
- ModelControllerConnector& ModelControllerConnector::operator=( const ModelControllerConnector& _rSource )
- {
- if ( this != &_rSource )
- impl_copyFrom( _rSource );
- return *this;
- }
-
- //--------------------------------------------------------------------
- void ModelControllerConnector::connect( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController )
- {
- impl_disconnect();
-
- m_xModel = _rxModel;
- m_xController = _rxController;
-
- impl_connect();
- }
-
- //--------------------------------------------------------------------
- void ModelControllerConnector::impl_copyFrom( const ModelControllerConnector& _rSource )
- {
- Model aNewModel( _rSource.m_xModel );
- Controller aNewController( _rSource.m_xController );
-
- impl_disconnect();
-
- m_xModel = aNewModel;
- m_xController = aNewController;
-
- impl_connect();
- }
-
- //--------------------------------------------------------------------
- ModelControllerConnector::~ModelControllerConnector()
- {
- impl_disconnect();
- DBG_DTOR( ModelControllerConnector, NULL );
- }
-
- //--------------------------------------------------------------------
- void ModelControllerConnector::impl_connect()
- {
- try
- {
- Reference< XModel > xModel = m_xModel;
- if ( xModel.is() && m_xController.is() )
- xModel->connectController( m_xController );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void ModelControllerConnector::impl_disconnect()
- {
- try
- {
- Reference< XModel > xModel = m_xModel;
- if ( xModel.is() && m_xController.is() )
- xModel->disconnectController( m_xController );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 08240b172901..4d3472e623b7 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -64,8 +64,8 @@
#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_
#include <com/sun/star/ucb/XCommandProcessor.hpp>
#endif
-#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
-#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
#include <com/sun/star/ucb/OpenMode.hpp>
@@ -152,6 +152,7 @@ namespace dbaui
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::task;
using namespace ::svt;
@@ -189,17 +190,13 @@ namespace dbaui
//==================================================================
DBG_NAME(OLinkedDocumentsAccess)
//------------------------------------------------------------------
- OLinkedDocumentsAccess::OLinkedDocumentsAccess(Window* _pDialogParent
- , const Reference< XFrame >& _rxParentFrame
- , const Reference< XMultiServiceFactory >& _rxORB
- , const Reference< XNameAccess >& _rxContainer
- , const Reference< XConnection>& _xConnection
- , const ::rtl::OUString& _sDataSourceName
- )
+ OLinkedDocumentsAccess::OLinkedDocumentsAccess( Window* _pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI,
+ const Reference< XMultiServiceFactory >& _rxORB, const Reference< XNameAccess >& _rxContainer,
+ const Reference< XConnection>& _xConnection, const ::rtl::OUString& _sDataSourceName )
:m_xORB(_rxORB)
,m_xDocumentContainer(_rxContainer)
,m_xConnection(_xConnection)
- ,m_xParentFrame(_rxParentFrame)
+ ,m_xDocumentUI( i_rDocumentUI )
,m_pDialogParent(_pDialogParent)
,m_sDataSourceName(_sDataSourceName)
{
@@ -268,112 +265,101 @@ namespace dbaui
return xRet;
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,
- Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
+ void OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,
+ const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
{
- Reference< XComponent> xRet;
try
{
- ::svx::ODataAccessDescriptor aDesc;
- aDesc.setDataSource(m_sDataSourceName);
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "DataSourceName", m_sDataSourceName );
+
+ if ( m_xConnection.is() )
+ aArgs.put( "ActiveConnection", m_xConnection );
+
if ( _rObjectName.getLength() && ( _nCommandType != -1 ) )
{
- aDesc[::svx::daCommandType] <<= _nCommandType;
- aDesc[::svx::daCommand] <<= _rObjectName;
+ aArgs.put( "CommandType", _nCommandType );
+ aArgs.put( "Command", _rObjectName );
}
- if ( m_xConnection.is() )
- aDesc[::svx::daConnection] <<= m_xConnection;
- Sequence<Any> aSeq = aDesc.createAnySequence();
- const sal_Int32 nLength = aSeq.getLength();
- aSeq.realloc(nLength + 1 );
- PropertyValue aVal;
- aVal.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame"));
- aVal.Value <<= m_xParentFrame;
- aSeq[nLength] <<= aVal;
+ aArgs.put( "DocumentUI", m_xDocumentUI );
- Reference< XJobExecutor > xFormWizard;
+ Reference< XJobExecutor > xWizard;
{
WaitObject aWaitCursor( m_pDialogParent );
- xFormWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString::createFromAscii(_pWizardService),aSeq),UNO_QUERY);
- }
- if ( xFormWizard.is() )
- {
- xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start")));
- Reference<XPropertySet> xProp(xFormWizard,UNO_QUERY);
- if ( xProp.is() )
- {
- Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
- if ( xInfo->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))) )
- {
- _xDefinition.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentDefinition"))),UNO_QUERY);
- xRet.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))),UNO_QUERY);
- }
- }
- xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("end")));
- ::comphelper::disposeComponent(xFormWizard);
+ xWizard.set( m_xORB->createInstanceWithArguments(
+ ::rtl::OUString::createFromAscii( _pWizardService ),
+ aArgs.getWrappedPropertyValues()
+ ), UNO_QUERY_THROW );
}
+
+ xWizard->trigger( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "start" ) ) );
+ ::comphelper::disposeComponent( xWizard );
}
catch(const Exception& e)
{
- (void) e;
- OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newWithPilot: caught an exception while loading the object!");
+ DBG_UNHANDLED_EXCEPTION();
}
- return xRet;
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newFormWithPilot(Reference< XComponent >& _xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName)
+ void OLinkedDocumentsAccess::newFormWithPilot( const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName )
{
- return impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _xDefinition, _nCommandType, _rObjectName );
+ impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _nCommandType, _rObjectName );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newReportWithPilot( Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
+ void OLinkedDocumentsAccess::newReportWithPilot( const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
{
- return impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _xDefinition, _nCommandType, _rObjectName );
+ impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _nCommandType, _rObjectName );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newTableWithPilot()
+ void OLinkedDocumentsAccess::newTableWithPilot()
{
- Reference< XComponent > xDefinition;
- return impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", xDefinition, -1, ::rtl::OUString() );
+ impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", -1, ::rtl::OUString() );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newQueryWithPilot()
+ void OLinkedDocumentsAccess::newQueryWithPilot()
{
- Reference< XComponent > xDefinition;
- return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() );
+ impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", -1, ::rtl::OUString() );
}
//------------------------------------------------------------------
- Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _sObjectName )
+ Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID,
+ const ::comphelper::NamedValueCollection& i_rCreationArgs, Reference< XComponent >& o_rDefinition )
{
OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!");
- // determine the URL to use for the new document
+ // determine the class ID to use for the new document
Sequence<sal_Int8> aClassId;
- switch (_nNewFormId)
+ if ( !i_rCreationArgs.has( "ClassID" )
+ && !i_rCreationArgs.has( "MediaType" )
+ && !i_rCreationArgs.has( "DocumentServiceName" )
+ )
{
- case ID_FORM_NEW_TEXT:
- aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID);
- OSL_ENSURE(aClassId == comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID),"Not equal");
- break;
+ switch ( i_nActionID )
+ {
+ case ID_FORM_NEW_TEXT:
+ aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID);
+ OSL_ENSURE(aClassId == comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID),"Not equal");
+ break;
- case ID_FORM_NEW_CALC:
- aClassId = lcl_GetSequenceClassID(SO3_SC_CLASSID);
- break;
+ case ID_FORM_NEW_CALC:
+ aClassId = lcl_GetSequenceClassID(SO3_SC_CLASSID);
+ break;
- case ID_FORM_NEW_IMPRESS:
- aClassId = lcl_GetSequenceClassID(SO3_SIMPRESS_CLASSID);
- break;
- case ID_REPORT_NEW_TEXT:
- aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90);
- break;
+ case ID_FORM_NEW_IMPRESS:
+ aClassId = lcl_GetSequenceClassID(SO3_SIMPRESS_CLASSID);
+ break;
- case SID_DB_FORM_NEW_PILOT:
- default:
- OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newDocument: please use newFormWithPilot!");
- return Reference< XComponent >();
+ case ID_REPORT_NEW_TEXT:
+ aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90);
+ break;
+ default:
+ OSL_ENSURE( sal_False, "OLinkedDocumentsAccess::newDocument: please use newFormWithPilot!" );
+ return Reference< XComponent >();
+
+ }
}
+
// load the document as template
Reference< XComponent > xNewDocument;
try
@@ -382,36 +368,37 @@ namespace dbaui
Reference<XMultiServiceFactory> xORB(m_xDocumentContainer,UNO_QUERY);
if ( xORB.is() )
{
- Sequence< Any > aArguments(2);
-
- PropertyValue aValue;
-
- aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassID"));
- aValue.Value <<= aClassId;
- aArguments[0] <<= aValue;
-
- aValue.Name = PROPERTY_ACTIVE_CONNECTION;
- aValue.Value <<= m_xConnection;
- aArguments[1] <<= aValue;
-
- Reference<XCommandProcessor> xContent(xORB->createInstanceWithArguments(SERVICE_SDB_DOCUMENTDEFINITION,aArguments),UNO_QUERY);
- if ( xContent.is() )
+ ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs );
+ if ( aClassId.getLength() )
+ aCreationArgs.put( "ClassID", aClassId );
+ aCreationArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, m_xConnection );
+
+ // separate values which are real creation args from args relevant for opening the doc
+ ::comphelper::NamedValueCollection aCommandArgs;
+ if ( aCreationArgs.has( "Hidden" ) )
{
- _xDefinition.set(xContent,UNO_QUERY);
- Command aCommand;
- aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("openDesign"));
- OpenCommandArgument2 aOpenCommand;
- aOpenCommand.Mode = OpenMode::DOCUMENT;
- aCommand.Argument <<= aOpenCommand;
- WaitObject aWaitCursor( m_pDialogParent );
- xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY);
- Reference<XPropertySet> xProp(xNewDocument,UNO_QUERY);
- if ( xProp.is() && _sObjectName.getLength() )
- {
- xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(_nCommandType));
- xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(_sObjectName));
- }
+ aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) );
+ aCreationArgs.remove( "Hidden" );
}
+
+ Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments(
+ SERVICE_SDB_DOCUMENTDEFINITION,
+ aCreationArgs.getWrappedPropertyValues()
+ ),
+ UNO_QUERY_THROW
+ );
+ o_rDefinition.set( xContent, UNO_QUERY );
+
+ // put the OpenMode into the OpenArgs
+ OpenCommandArgument aOpenModeArg;
+ aOpenModeArg.Mode = OpenMode::DOCUMENT;
+ aCommandArgs.put( "OpenMode", aOpenModeArg );
+
+ Command aCommand;
+ aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "openDesign" ) );
+ aCommand.Argument <<= aCommandArgs.getPropertyValues();
+ WaitObject aWaitCursor( m_pDialogParent );
+ xNewDocument.set( xContent->execute( aCommand, xContent->createCommandIdentifier(), NULL ), UNO_QUERY );
}
}
catch(const Exception& )
diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk
index 77f4f7e722a8..7f9bbed56023 100644
--- a/dbaccess/source/ui/misc/makefile.mk
+++ b/dbaccess/source/ui/misc/makefile.mk
@@ -72,7 +72,6 @@ SLOFILES= \
$(SLO)$/WColumnSelect.obj \
$(SLO)$/WExtendPages.obj \
$(SLO)$/WNameMatch.obj \
- $(SLO)$/documentcontroller.obj \
$(SLO)$/ToolBoxHelper.obj \
$(SLO)$/stringlistitem.obj \
$(SLO)$/charsets.obj \
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 43dadd489884..87ddfa1f197b 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -94,6 +94,7 @@ namespace dbaui
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::frame::XUntitledNumbers;
+ using ::com::sun::star::beans::PropertyVetoException;
/** === end UNO using === **/
class DataSourceHolder
@@ -140,6 +141,9 @@ namespace dbaui
OModuleClient m_aModuleClient;
::dbtools::SQLExceptionInfo m_aCurrentError; // contains the current error which can be set through IEnvironment
+ ::cppu::OInterfaceContainerHelper
+ m_aModifyListeners;
+
// <properties>
SharedConnection m_xConnection;
::dbtools::DatabaseMetaData m_aSdbMetaData;
@@ -154,8 +158,9 @@ namespace dbaui
sal_Bool m_bModified; // is the data modified
bool m_bNotAttached;
- OSingleDocumentControllerImpl()
+ OSingleDocumentControllerImpl( ::osl::Mutex& i_rMutex )
:m_aDocScriptSupport()
+ ,m_aModifyListeners( i_rMutex )
,m_nDocStartNumber(0)
,m_bSuspended( sal_False )
,m_bEditable(sal_True)
@@ -185,7 +190,7 @@ namespace dbaui
//--------------------------------------------------------------------
OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB)
:OSingleDocumentController_Base( _rxORB )
- ,m_pImpl(new OSingleDocumentControllerImpl())
+ ,m_pImpl( new OSingleDocumentControllerImpl( getMutex() ) )
{
}
@@ -540,15 +545,6 @@ namespace dbaui
InvalidateFeature(ID_BROWSER_UNDO);
InvalidateFeature(ID_BROWSER_REDO);
}
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::setModified(sal_Bool _bModified)
- {
- m_pImpl->m_bModified = _bModified;
- InvalidateFeature(ID_BROWSER_SAVEDOC);
-
- if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
- InvalidateFeature(ID_BROWSER_SAVEASDOC);
- }
// -----------------------------------------------------------------------------
::rtl::OUString OSingleDocumentController::getDataSourceName() const
@@ -591,12 +587,6 @@ namespace dbaui
}
// -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isModified() const
- {
- return m_pImpl->m_bModified;
- }
-
- // -----------------------------------------------------------------------------
void OSingleDocumentController::setEditable(sal_Bool _bEditable)
{
m_pImpl->m_bEditable = _bEditable;
@@ -702,6 +692,57 @@ namespace dbaui
return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
}
+ // -----------------------------------------------------------------------------
+ void SAL_CALL OSingleDocumentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.addInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL OSingleDocumentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL OSingleDocumentController::isModified( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ return impl_isModified();
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL OSingleDocumentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( getMutex() );
+
+ if ( m_pImpl->m_bModified == i_bModified )
+ return;
+
+ m_pImpl->m_bModified = i_bModified;
+ impl_onModifyChanged();
+
+ EventObject aEvent( *this );
+ aGuard.clear();
+ m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool OSingleDocumentController::impl_isModified() const
+ {
+ return m_pImpl->m_bModified;
+ }
+
+ // -----------------------------------------------------------------------------
+ void OSingleDocumentController::impl_onModifyChanged()
+ {
+ InvalidateFeature( ID_BROWSER_SAVEDOC );
+ if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
+ InvalidateFeature( ID_BROWSER_SAVEASDOC );
+ }
+
//........................................................................
} // namespace dbaui
//........................................................................