office-gobmx/dbaccess/source/ui/browser/exsrcbrw.cxx

482 lines
20 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-10-26 08:46:14 -05:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-10-26 08:46:14 -05:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-10-26 08:46:14 -05:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-10-26 08:46:14 -05:00
*
* This file is part of OpenOffice.org.
2000-10-26 08:46:14 -05:00
*
* 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.
2000-10-26 08:46:14 -05:00
*
* 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).
2000-10-26 08:46:14 -05:00
*
* 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.
2000-10-26 08:46:14 -05:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
2000-10-26 08:46:14 -05:00
#include "exsrcbrw.hxx"
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
2001-08-16 04:39:55 -05:00
#include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
2000-10-26 08:46:14 -05:00
#include "formadapter.hxx"
#include <comphelper/processfactory.hxx>
#include "dbustrings.hrc"
#include "dbu_reghelper.hxx"
#include <tools/diagnose_ex.h>
2000-10-26 08:46:14 -05:00
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
2001-08-16 04:39:55 -05:00
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::frame;
2000-10-26 08:46:14 -05:00
using namespace dbaui;
//==============================================================================
//= SbaExternalSourceBrowser
//==============================================================================
extern "C" void SAL_CALL createRegistryInfo_OFormGridView()
{
static OMultiInstanceAutoRegistration< SbaExternalSourceBrowser > aAutoRegistration;
}
//------------------------------------------------------------------------------
Any SAL_CALL SbaExternalSourceBrowser::queryInterface(const Type& _rType) throw (RuntimeException)
{
Any aRet = SbaXDataBrowserController::queryInterface(_rType);
if(!aRet.hasValue())
aRet = ::cppu::queryInterface(_rType,
(::com::sun::star::util::XModifyBroadcaster*)this,
(::com::sun::star::form::XLoadListener*)this);
return aRet;
}
DBG_NAME(SbaExternalSourceBrowser)
2000-10-26 08:46:14 -05:00
//------------------------------------------------------------------------------
SbaExternalSourceBrowser::SbaExternalSourceBrowser(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM)
:SbaXDataBrowserController(_rM)
2001-08-14 06:12:43 -05:00
,m_aModifyListeners(getMutex())
,m_pDataSourceImpl(NULL)
,m_bInQueryDispatch( sal_False )
2000-10-26 08:46:14 -05:00
{
DBG_CTOR(SbaExternalSourceBrowser,NULL);
2000-10-26 08:46:14 -05:00
}
//------------------------------------------------------------------------------
SbaExternalSourceBrowser::~SbaExternalSourceBrowser()
{
DBG_DTOR(SbaExternalSourceBrowser,NULL);
2000-10-26 08:46:14 -05:00
}
2000-10-26 08:46:14 -05:00
//-------------------------------------------------------------------------
::comphelper::StringSequence SAL_CALL SbaExternalSourceBrowser::getSupportedServiceNames() throw(RuntimeException)
{
return getSupportedServiceNames_Static();
}
// -------------------------------------------------------------------------
::rtl::OUString SbaExternalSourceBrowser::getImplementationName_Static() throw(RuntimeException)
{
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.OFormGridView"));
2000-10-26 08:46:14 -05:00
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SbaExternalSourceBrowser::getSupportedServiceNames_Static() throw(RuntimeException)
{
::comphelper::StringSequence aSupported(1);
aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.FormGridView"));
2000-10-26 08:46:14 -05:00
return aSupported;
}
//-------------------------------------------------------------------------
Reference< XInterface > SAL_CALL SbaExternalSourceBrowser::Create(const Reference<XMultiServiceFactory >& _rxFactory)
{
return *(new SbaExternalSourceBrowser(_rxFactory));
}
//-------------------------------------------------------------------------
::rtl::OUString SAL_CALL SbaExternalSourceBrowser::getImplementationName() throw(RuntimeException)
{
return getImplementationName_Static();
}
//------------------------------------------------------------------------------
Reference< XRowSet > SbaExternalSourceBrowser::CreateForm()
{
m_pDataSourceImpl = new SbaXFormAdapter();
return m_pDataSourceImpl;
}
//------------------------------------------------------------------------------
sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XRowSet > & /*xForm*/)
2000-10-26 08:46:14 -05:00
{
return sal_True;
}
//------------------------------------------------------------------
sal_Bool SbaExternalSourceBrowser::LoadForm()
{
// as we don't have a main form (yet), we have nothing to do
// we don't call FormLoaded, because this expects a working data source
return sal_True;
}
//------------------------------------------------------------------
void SbaExternalSourceBrowser::modified(const ::com::sun::star::lang::EventObject& aEvent) throw( RuntimeException )
{
SbaXDataBrowserController::modified(aEvent);
// multiplex this event to all my listeners
::com::sun::star::lang::EventObject aEvt(*this);
::cppu::OInterfaceIteratorHelper aIt(m_aModifyListeners);
while (aIt.hasMoreElements())
((::com::sun::star::util::XModifyListener*)aIt.next())->modified(aEvt);
}
//------------------------------------------------------------------
2001-09-13 08:15:52 -05:00
void SAL_CALL SbaExternalSourceBrowser::dispatch(const ::com::sun::star::util::URL& aURL, const Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) throw(::com::sun::star::uno::RuntimeException)
2000-10-26 08:46:14 -05:00
{
const ::com::sun::star::beans::PropertyValue* pArguments = aArgs.getConstArray();
if (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/AddGridColumn"))))
2000-10-26 08:46:14 -05:00
{
// search the argument describing the column to create
::rtl::OUString sControlType;
2001-03-19 05:38:43 -06:00
sal_Int32 nControlPos = -1;
2000-10-26 08:46:14 -05:00
Sequence< ::com::sun::star::beans::PropertyValue> aControlProps;
sal_uInt16 i;
for ( i = 0; i < aArgs.getLength(); ++i, ++pArguments )
2000-10-26 08:46:14 -05:00
{
if (pArguments->Name.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColumnType"))))
2000-10-26 08:46:14 -05:00
{
sal_Bool bCorrectType = pArguments->Value.getValueType().equals(::getCppuType((const ::rtl::OUString*)0));
2001-03-23 06:33:59 -06:00
OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnType\" !");
2000-10-26 08:46:14 -05:00
if (bCorrectType)
sControlType = ::comphelper::getString(pArguments->Value);
}
else if (pArguments->Name.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColumnPosition"))))
2000-10-26 08:46:14 -05:00
{
sal_Bool bCorrectType = pArguments->Value.getValueType().equals(::getCppuType((const sal_Int16*)0));
2001-03-23 06:33:59 -06:00
OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnPosition\" !");
2000-10-26 08:46:14 -05:00
if (bCorrectType)
nControlPos = ::comphelper::getINT16(pArguments->Value);
}
else if (pArguments->Name.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColumnProperties"))))
2000-10-26 08:46:14 -05:00
{
sal_Bool bCorrectType = pArguments->Value.getValueType().equals(::getCppuType((const Sequence< ::com::sun::star::beans::PropertyValue>*)0));
2001-03-23 06:33:59 -06:00
OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnProperties\" !");
2000-10-26 08:46:14 -05:00
if (bCorrectType)
aControlProps = *(Sequence< ::com::sun::star::beans::PropertyValue>*)pArguments->Value.getValue();
}
else
2001-04-03 08:16:03 -05:00
OSL_ENSURE(sal_False, ((ByteString("SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (") += ByteString((const sal_Unicode*)pArguments->Name, gsl_getSystemTextEncoding()).GetBuffer()) += ") !").GetBuffer());
2000-10-26 08:46:14 -05:00
}
if (!sControlType.getLength())
{
2001-04-03 08:16:03 -05:00
OSL_ENSURE(sal_False, "SbaExternalSourceBrowser::dispatch(AddGridColumn) : missing argument (ColumnType) !");
sControlType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextField"));
2000-10-26 08:46:14 -05:00
}
2001-03-23 06:33:59 -06:00
OSL_ENSURE(aControlProps.getLength(), "SbaExternalSourceBrowser::dispatch(AddGridColumn) : missing argument (ColumnProperties) !");
2000-10-26 08:46:14 -05:00
// create the col
Reference< ::com::sun::star::form::XGridColumnFactory > xColFactory(getControlModel(), UNO_QUERY);
Reference< ::com::sun::star::beans::XPropertySet > xNewCol = xColFactory->createColumn(sControlType);
Reference< XPropertySetInfo > xNewColProperties;
if (xNewCol.is())
xNewColProperties = xNewCol->getPropertySetInfo();
2010-11-23 19:07:16 -06:00
// set its properties
if (xNewColProperties.is())
2000-10-26 08:46:14 -05:00
{
const ::com::sun::star::beans::PropertyValue* pControlProps = aControlProps.getConstArray();
for (i=0; i<aControlProps.getLength(); ++i, ++pControlProps)
2000-10-26 08:46:14 -05:00
{
try
{
if (xNewColProperties->hasPropertyByName(pControlProps->Name))
xNewCol->setPropertyValue(pControlProps->Name, pControlProps->Value);
}
catch(Exception&)
{
OSL_ENSURE(sal_False,
( ByteString("SbaExternalSourceBrowser::dispatch : could not set a column property (")
+= ByteString(pControlProps->Name.getStr(), (sal_uInt16)pControlProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US)
+= ByteString(")!")).GetBuffer());
}
2000-10-26 08:46:14 -05:00
}
}
// correct the position
Reference< ::com::sun::star::container::XIndexContainer > xColContainer(getControlModel(), UNO_QUERY);
if (nControlPos > xColContainer->getCount())
nControlPos = xColContainer->getCount();
if (nControlPos < 0)
nControlPos = 0;
// append the column
xColContainer->insertByIndex(nControlPos, makeAny(xNewCol));
}
else if (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/ClearView"))))
2000-10-26 08:46:14 -05:00
{
ClearView();
}
else if (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/AttachToForm"))))
2000-10-26 08:46:14 -05:00
{
if (!m_pDataSourceImpl)
return;
Reference< XRowSet > xMasterForm;
2010-11-23 19:07:16 -06:00
// search the arguments for the master form
2000-10-26 08:46:14 -05:00
for (sal_uInt16 i=0; i<aArgs.getLength(); ++i, ++pArguments)
{
if ((pArguments->Name.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MasterForm")))) && (pArguments->Value.getValueTypeClass() == TypeClass_INTERFACE))
2000-10-26 08:46:14 -05:00
{
xMasterForm = Reference< XRowSet > (*(Reference< XInterface > *)pArguments->Value.getValue(), UNO_QUERY);
break;
}
}
if (!xMasterForm.is())
{
2001-04-03 08:16:03 -05:00
OSL_ENSURE(sal_False, "SbaExternalSourceBrowser::dispatch(FormSlots/AttachToForm) : please specify a form to attach to as argument !");
2000-10-26 08:46:14 -05:00
return;
}
Attach(xMasterForm);
}
else
SbaXDataBrowserController::dispatch(aURL, aArgs);
}
//------------------------------------------------------------------
Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SbaExternalSourceBrowser::queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( RuntimeException )
{
Reference< ::com::sun::star::frame::XDispatch > xReturn;
if (m_bInQueryDispatch)
return xReturn;
m_bInQueryDispatch = sal_True;
if ( (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/AttachToForm"))))
2000-10-26 08:46:14 -05:00
// attach a new external form
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/AddGridColumn"))))
2000-10-26 08:46:14 -05:00
// add a column to the grid
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/ClearView"))))
2000-10-26 08:46:14 -05:00
// clear the grid
)
xReturn = (::com::sun::star::frame::XDispatch*)this;
if ( !xReturn.is()
&& ( (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/moveToFirst"))))
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/moveToPrev"))))
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/moveToNext"))))
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/moveToLast"))))
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/moveToNew"))))
|| (aURL.Complete.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FormSlots/undoRecord"))))
2000-10-26 08:46:14 -05:00
)
)
{
2001-05-16 06:29:39 -05:00
OSL_ENSURE(aURL.Mark.getLength() == 0, "SbaExternalSourceBrowser::queryDispatch : the ::com::sun::star::util::URL shouldn't have a mark !");
2000-10-26 08:46:14 -05:00
::com::sun::star::util::URL aNewUrl = aURL;
// split the ::com::sun::star::util::URL
OSL_ENSURE( m_xUrlTransformer.is(), "SbaExternalSourceBrowser::queryDispatch : could not create an URLTransformer !" );
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aNewUrl );
2000-10-26 08:46:14 -05:00
// set a new mark
aNewUrl.Mark = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DB/FormGridView"));
2000-10-26 08:46:14 -05:00
// this controller is instantiated when somebody dispatches the ".component:DB/FormGridView" in any
// frame, so we use "FormGridView" as mark that a dispatch request came from this view
if (m_xUrlTransformer.is())
m_xUrlTransformer->assemble(aNewUrl);
2000-10-26 08:46:14 -05:00
Reference< XDispatchProvider > xFrameDispatcher( getFrame(), UNO_QUERY );
2000-10-26 08:46:14 -05:00
if (xFrameDispatcher.is())
xReturn = xFrameDispatcher->queryDispatch(aNewUrl, aTargetFrameName, FrameSearchFlag::PARENT);
2000-10-26 08:46:14 -05:00
}
if (!xReturn.is())
xReturn = SbaXDataBrowserController::queryDispatch(aURL, aTargetFrameName, nSearchFlags);
m_bInQueryDispatch = sal_False;
return xReturn;
}
//------------------------------------------------------------------
2001-03-01 08:17:55 -06:00
void SAL_CALL SbaExternalSourceBrowser::disposing()
2000-10-26 08:46:14 -05:00
{
// say our modify listeners goodbye
::com::sun::star::lang::EventObject aEvt;
aEvt.Source = (XWeak*) this;
m_aModifyListeners.disposeAndClear(aEvt);
stopListening();
2001-03-01 08:17:55 -06:00
SbaXDataBrowserController::disposing();
2000-10-26 08:46:14 -05:00
}
//------------------------------------------------------------------
void SAL_CALL SbaExternalSourceBrowser::addModifyListener(const Reference< ::com::sun::star::util::XModifyListener > & aListener) throw( RuntimeException )
{
m_aModifyListeners.addInterface(aListener);
}
//------------------------------------------------------------------
void SAL_CALL SbaExternalSourceBrowser::removeModifyListener(const Reference< ::com::sun::star::util::XModifyListener > & aListener) throw( RuntimeException )
{
m_aModifyListeners.removeInterface(aListener);
}
//------------------------------------------------------------------
void SAL_CALL SbaExternalSourceBrowser::unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( RuntimeException )
{
if (m_pDataSourceImpl && (m_pDataSourceImpl->getAttachedForm() == aEvent.Source))
{
ClearView();
}
SbaXDataBrowserController::unloading(aEvent);
}
//------------------------------------------------------------------
void SbaExternalSourceBrowser::Attach(const Reference< XRowSet > & xMaster)
{
Any aOldPos;
sal_Bool bWasInsertRow = sal_False;
sal_Bool bBeforeFirst = sal_True;
sal_Bool bAfterLast = sal_True;
Reference< XResultSet > xResultSet(xMaster, UNO_QUERY);
Reference< XRowLocate > xCursor(xMaster, UNO_QUERY);
Reference< XPropertySet > xMasterProps(xMaster, UNO_QUERY);
try
{
// switch the control to design mode
if (getBrowserView() && getBrowserView()->getGridControl().is())
getBrowserView()->getGridControl()->setDesignMode(sal_True);
// the grid will move the form's cursor to the first record, but we want the form to remain unchanged
// restore the old position
if (xCursor.is() && xResultSet.is())
{
bBeforeFirst = xResultSet->isBeforeFirst();
bAfterLast = xResultSet->isAfterLast();
if(!bBeforeFirst && !bAfterLast)
aOldPos = xCursor->getBookmark();
}
if (xMasterProps.is())
xMasterProps->getPropertyValue(PROPERTY_ISNEW) >>= bWasInsertRow;
}
catch( const Exception& )
2000-10-26 08:46:14 -05:00
{
DBG_UNHANDLED_EXCEPTION();
2000-10-26 08:46:14 -05:00
}
CWS-TOOLING: integrate CWS evoab2def 2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set 2009-05-22 14:25:51 +0200 fs r272193 : #i10000# 2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically 2009-05-22 14:19:00 +0200 fs r272191 : #i10000# 2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points 2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache 2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces 2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY 2009-05-20 14:02:29 +0200 fs r272125 : implement sorting 2009-05-20 10:10:19 +0200 fs r272107 : #i10000# 2009-05-19 16:02:17 +0200 fs r272089 : #i10000# 2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED 2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code 2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED 2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty 2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes 2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing 2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing 2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings 2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings 2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set 2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet 2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too 2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types 2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types 2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version) 2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree 2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree 2009-05-18 11:40:16 +0200 fs r272008 : #i55701# 2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too 2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface 2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion 2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const 2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const 2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework 2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes 2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data 2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class 2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class 2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC 2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6) 2009-05-06 09:01:30 +0200 fs r271564 : #i101493# 2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 07:31:05 -05:00
onStartLoading( Reference< XLoadable >( xMaster, UNO_QUERY ) );
2000-10-26 08:46:14 -05:00
stopListening();
m_pDataSourceImpl->AttachForm(xMaster);
startListening();
if (xMaster.is())
{
2000-11-03 07:44:21 -06:00
// at this point we have to reset the formatter for the new form
initFormatter();
2001-08-16 04:39:55 -05:00
// assume that the master form is already loaded
#if OSL_DEBUG_LEVEL > 0
2001-08-16 04:39:55 -05:00
{
Reference< XLoadable > xLoadable( xMaster, UNO_QUERY );
OSL_ENSURE( xLoadable.is() && xLoadable->isLoaded(), "SbaExternalSourceBrowser::Attach: master is not loaded!" );
}
#endif
LoadFinished(sal_True);
2000-10-26 08:46:14 -05:00
Reference< XResultSetUpdate > xUpdate(xMaster, UNO_QUERY);
try
{
if (bWasInsertRow && xUpdate.is())
xUpdate->moveToInsertRow();
else if (xCursor.is() && aOldPos.hasValue())
xCursor->moveToBookmark(aOldPos);
else if(bBeforeFirst && xResultSet.is())
xResultSet->beforeFirst();
else if(bAfterLast && xResultSet.is())
xResultSet->afterLast();
2000-10-26 08:46:14 -05:00
}
catch(Exception&)
2000-10-26 08:46:14 -05:00
{
2001-04-03 08:16:03 -05:00
OSL_ENSURE(sal_False, "SbaExternalSourceBrowser::Attach : couldn't restore the cursor position !");
2000-10-26 08:46:14 -05:00
}
}
}
//------------------------------------------------------------------
void SbaExternalSourceBrowser::ClearView()
{
// set a new (empty) datasource
Attach(Reference< XRowSet > ());
// clear all cols in the grid
Reference< ::com::sun::star::container::XIndexContainer > xColContainer(getControlModel(), UNO_QUERY);
while (xColContainer->getCount() > 0)
xColContainer->removeByIndex(0);
}
//------------------------------------------------------------------
void SAL_CALL SbaExternalSourceBrowser::disposing(const ::com::sun::star::lang::EventObject& Source) throw( RuntimeException )
{
if (m_pDataSourceImpl && (m_pDataSourceImpl->getAttachedForm() == Source.Source))
{
ClearView();
}
2001-01-09 08:52:33 -06:00
SbaXDataBrowserController::disposing(Source);
2000-10-26 08:46:14 -05:00
}
//------------------------------------------------------------------
void SbaExternalSourceBrowser::startListening()
{
if (m_pDataSourceImpl && m_pDataSourceImpl->getAttachedForm().is())
{
Reference< ::com::sun::star::form::XLoadable > xLoadable(m_pDataSourceImpl->getAttachedForm(), UNO_QUERY);
xLoadable->addLoadListener((::com::sun::star::form::XLoadListener*)this);
}
}
//------------------------------------------------------------------
void SbaExternalSourceBrowser::stopListening()
{
if (m_pDataSourceImpl && m_pDataSourceImpl->getAttachedForm().is())
{
Reference< ::com::sun::star::form::XLoadable > xLoadable(m_pDataSourceImpl->getAttachedForm(), UNO_QUERY);
xLoadable->removeLoadListener((::com::sun::star::form::XLoadListener*)this);
}
}
//==================================================================
//==================================================================
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */