summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser/genericcontroller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/browser/genericcontroller.cxx')
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx150
1 files changed, 46 insertions, 104 deletions
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index aa6640d4edd5..77489aa422ae 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,106 +28,44 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbui.hxx"
-#ifndef DBAUI_GENERICCONTROLLER_HXX
#include "genericcontroller.hxx"
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
#include <toolkit/awt/vclxwindow.hxx>
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
#include "browserids.hxx"
-#endif
-#ifndef _SV_SVAPP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
-#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
-#endif
-#ifndef DBAUI_DATAVIEW_HXX
#include "dataview.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include <osl/diagnose.h>
#include "dbustrings.hrc"
-#endif
-#ifndef _VCL_STDTEXT_HXX
#include <vcl/stdtext.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
-#endif
#include <framework/titlehelper.hxx>
-#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
#include <com/sun/star/sdbc/XDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_
#include <com/sun/star/sdb/XCompletedConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
#include <com/sun/star/task/XInteractionHandler.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
#include <com/sun/star/util/XCloseable.hpp>
-#endif
-#ifndef DBAUI_TOOLS_HXX
#include "UITools.hxx"
-#endif
-#ifndef _DBAUI_COMMON_TYPES_HXX_
#include "commontypes.hxx"
-#endif
-#ifndef _SV_WAITOBJ_HXX
+#include <sal/macros.h>
#include <vcl/waitobj.hxx>
-#endif
-#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
-#endif
-#ifndef SVTOOLS_URIHELPER_HXX
#include <svl/urihelper.hxx>
-#endif
-#ifndef _DBAUI_DATASOURCECONNECTOR_HXX_
#include "datasourceconnector.hxx"
-#endif
-#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
#include <unotools/moduleoptions.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_STATUS_VISIBILITY_HPP_
#include <com/sun/star/frame/status/Visibility.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_
#include <com/sun/star/util/XModifiable.hpp>
-#endif
-#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
-#endif
-#ifndef _RTL_LOGFILE_HXX_
#include <rtl/logfile.hxx>
-#endif
#include <algorithm>
-#include <hash_map>
+#include <o3tl/compat_functional.hxx>
+#include <boost/unordered_map.hpp>
#include <cppuhelper/implbase1.hxx>
#include <limits>
@@ -152,7 +91,7 @@ using namespace ::comphelper;
#define LAST_USER_DEFINED_FEATURE ( ::std::numeric_limits< sal_uInt16 >::max() )
// -------------------------------------------------------------------------
-typedef ::std::hash_map< sal_Int16, sal_Int16 > CommandHashMap;
+typedef ::boost::unordered_map< sal_Int16, sal_Int16 > CommandHashMap;
typedef ::std::list< DispatchInformation > DispatchInfoList;
@@ -213,7 +152,7 @@ void UserDefinedFeatures::execute( const URL& _rFeatureURL, const Sequence< Prop
if ( xDispatch == xController )
{
- OSL_ENSURE( false, "UserDefinedFeatures::execute: the controller shouldn't be the dispatcher here!" );
+ OSL_FAIL( "UserDefinedFeatures::execute: the controller shouldn't be the dispatcher here!" );
xDispatch.clear();
}
@@ -271,7 +210,7 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto
try
{
- m_xUrlTransformer = Reference< XURLTransformer > (_rM->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), UNO_QUERY);
+ m_xUrlTransformer = Reference< XURLTransformer > (_rM->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY);
}
catch(Exception&)
{
@@ -294,7 +233,7 @@ OGenericUnoController::OGenericUnoController()
,m_bReadOnly(sal_False)
,m_bCurrentlyModified(sal_False)
{
- OSL_ENSURE( false, "OGenericUnoController::OGenericUnoController: illegal call!" );
+ OSL_FAIL( "OGenericUnoController::OGenericUnoController: illegal call!" );
// This ctor only exists because the MSVC compiler complained about an unresolved external
// symbol. It should not be used at all. Since using it yields strange runtime problems,
// we simply abort here.
@@ -324,14 +263,14 @@ sal_Bool OGenericUnoController::Construct(Window* /*pParent*/)
fillSupportedFeatures();
// create the database context
- DBG_ASSERT(getORB().is(), "OGenericUnoController::Construct need a service factory!");
+ OSL_ENSURE(getORB().is(), "OGenericUnoController::Construct need a service factory!");
try
{
m_xDatabaseContext = Reference< XNameAccess >(getORB()->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
}
catch(Exception&)
{
- DBG_ERROR("OGenericUnoController::Construct: could not create (or start listening at) the database context!");
+ OSL_FAIL("OGenericUnoController::Construct: could not create (or start listening at) the database context!");
}
if (!m_xDatabaseContext.is())
@@ -354,7 +293,7 @@ void OGenericUnoController::impl_initialize()
// -------------------------------------------------------------------------
void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
Reference< XWindow > xParent;
@@ -370,12 +309,6 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
{
xFrame.set(aValue.Value,UNO_QUERY_THROW);
}
- /* #i42316#
- else if ( ( *pIter >>= aValue ) && ( 0 == aValue.Name.compareToAscii( "ReadOnly" ) ) )
- {
- aValue.Value >>= m_bReadOnly;
- }
- */
else if ( ( *pIter >>= aValue ) && ( 0 == aValue.Name.compareToAscii( "Preview" ) ) )
{
aValue.Value >>= m_bPreview;
@@ -392,7 +325,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL;
if (!pParentWin)
{
- throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "Parent window is null" ), *this, 1 );
+ throw IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent window is null")), *this, 1 );
}
m_aInitParameters.assign( aArguments );
@@ -400,7 +333,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
ODataView* pView = getView();
if ( !pView )
- throw RuntimeException( ::rtl::OUString::createFromAscii( "unable to create a view" ), *this );
+ throw RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unable to create a view")), *this );
if ( m_bReadOnly || m_bPreview )
pView->EnableInput( sal_False );
@@ -487,7 +420,7 @@ Sequence< PropertyValue > SAL_CALL OGenericUnoController::getCreationArguments()
// -----------------------------------------------------------------------
void OGenericUnoController::attachFrame( const Reference< XFrame >& _rxFrame ) throw( RuntimeException )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
stopFrameListening( m_aCurrentFrame.getFrame() );
@@ -545,7 +478,6 @@ namespace
// #i67882# is the bug which was caused by the real fix which we did in framework
// #i68216# is the bug which requests to fix the code in Draw which relies on
// framework's implementation details
- // 2006-08-07 / frank.schoenheit@sun.com
if ( !!_rFeatureState.sTitle )
_out_rStates.push_back( makeAny( *_rFeatureState.sTitle ) );
if ( !!_rFeatureState.bChecked )
@@ -607,7 +539,6 @@ void OGenericUnoController::ImplBroadcastFeatureState(const ::rtl::OUString& _rF
// it is possible that listeners are registered or revoked while
// we are notifying them, so we must use a copy of m_arrStatusListener, not
// m_arrStatusListener itself
- // #121276# / 2005-05-19 / frank.schoenheit@sun.com
Dispatch aNotifyLoop( m_arrStatusListener );
DispatchIterator iterSearch = aNotifyLoop.begin();
DispatchIterator iterEnd = aNotifyLoop.end();
@@ -681,7 +612,7 @@ void OGenericUnoController::InvalidateFeature_Impl()
::rtl::OString sMessage( "OGenericUnoController::InvalidateFeature_Impl: feature id " );
sMessage += ::rtl::OString::valueOf( aNextFeature.nId );
sMessage += ::rtl::OString( " has been invalidated, but is not supported!" );
- OSL_ENSURE( false, sMessage.getStr() );
+ OSL_FAIL( sMessage.getStr() );
}
#endif
if ( m_aSupportedFeatures.end() != aFeaturePos )
@@ -748,7 +679,7 @@ void OGenericUnoController::InvalidateAll()
void OGenericUnoController::InvalidateAll_Impl()
{
// ---------------------------------
- // invalidate all aupported features
+ // invalidate all supported features
for ( SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.begin();
aIter != m_aSupportedFeatures.end();
@@ -758,7 +689,7 @@ void OGenericUnoController::InvalidateAll_Impl()
{
::osl::MutexGuard aGuard( m_aFeatureMutex);
- DBG_ASSERT(m_aFeaturesToInvalidate.size(), "OGenericUnoController::InvalidateAll_Impl: to be called from within InvalidateFeature_Impl only!");
+ OSL_ENSURE(m_aFeaturesToInvalidate.size(), "OGenericUnoController::InvalidateAll_Impl: to be called from within InvalidateFeature_Impl only!");
m_aFeaturesToInvalidate.pop_front();
if(!m_aFeaturesToInvalidate.empty())
m_aAsyncInvalidateAll.Call();
@@ -841,13 +772,13 @@ void OGenericUnoController::setMasterDispatchProvider(const Reference< XDispatch
// -----------------------------------------------------------------------
void OGenericUnoController::dispatch(const URL& _aURL, const Sequence< PropertyValue >& aArgs) throw(RuntimeException)
{
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- // Since the fix for #123967#, the SolarMutex is not locked anymore when the framework calls into
+ SolarMutexGuard aSolarGuard;
+ // The SolarMutex is not locked anymore when the framework calls into
// here. So, lock it ourself. The real solution would be to lock it only in the places
// where it's needed, but a) this might turn out difficult, since we then also need to care
// for locking in the proper order (SolarMutex and m_aMutex), and b) this would be too many places
// for the time frame of the fix.
- // #i52602# / frank.schoenheit@sun.com / 2005-07-29
+ // #i52602#
#ifdef TIMELOG
::rtl::OString sLog( "OGenericUnoController::dispatch( '" );
@@ -867,12 +798,12 @@ void OGenericUnoController::addStatusListener(const Reference< XStatusListener >
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aParsedURL );
- // remeber the listener together with the URL
+ // remember the listener together with the URL
m_arrStatusListener.insert( m_arrStatusListener.end(), DispatchTarget( aParsedURL, aListener ) );
// initially broadcast the state
ImplBroadcastFeatureState( aParsedURL.Complete, aListener, sal_True );
- // force the new state to be broadcasted to the new listener
+ // force the new state to be broadcast to the new listener
}
// -----------------------------------------------------------------------
@@ -997,7 +928,7 @@ void OGenericUnoController::implDescribeSupportedFeature( const sal_Char* _pAsci
sal_uInt16 _nFeatureId, sal_Int16 _nCommandGroup )
{
#ifdef DBG_UTIL
- DBG_ASSERT( m_bDescribingSupportedFeatures, "OGenericUnoController::implDescribeSupportedFeature: bad timing for this call!" );
+ OSL_ENSURE( m_bDescribingSupportedFeatures, "OGenericUnoController::implDescribeSupportedFeature: bad timing for this call!" );
#endif
OSL_PRECOND( _nFeatureId < FIRST_USER_DEFINED_FEATURE, "OGenericUnoController::implDescribeSupportedFeature: invalid feature id!" );
@@ -1239,7 +1170,7 @@ Reference< XFrame > SAL_CALL OGenericUnoController::getFrame(void) throw( Runtim
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OGenericUnoController::attachModel(const Reference< XModel > & /*xModel*/) throw( RuntimeException )
{
- OSL_ENSURE( false, "OGenericUnoController::attachModel: not supported!" );
+ OSL_FAIL( "OGenericUnoController::attachModel: not supported!" );
return sal_False;
}
@@ -1327,11 +1258,11 @@ namespace
"com.sun.star.formula.FormularProperties", "smath",
"com.sun.star.chart.ChartDocument", "schart"
};
- OSL_ENSURE( ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) % 2 == 0,
+ OSL_ENSURE( ( SAL_N_ELEMENTS( pTransTable ) ) % 2 == 0,
"lcl_getModuleHelpModuleName: odd size of translation table!" );
// loop through the table
- sal_Int32 nTableEntries = ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) / 2;
+ sal_Int32 nTableEntries = ( SAL_N_ELEMENTS( pTransTable ) ) / 2;
const sal_Char** pDocumentService = pTransTable;
const sal_Char** pHelpModuleName = pTransTable + 1;
for ( sal_Int32 j=0; j<nTableEntries; ++j )
@@ -1370,7 +1301,7 @@ namespace
pReturn = "sbasic";
else
{
- OSL_ENSURE( sal_False, "lcl_getModuleHelpModuleName: no installed module found" );
+ OSL_FAIL( "lcl_getModuleHelpModuleName: no installed module found" );
}
}
}
@@ -1391,7 +1322,7 @@ namespace
void OGenericUnoController::openHelpAgent(rtl::OUString const& _suHelpStringURL )
{
rtl::OUString suURL(_suHelpStringURL);
- rtl::OUString sLanguage = rtl::OUString::createFromAscii("Language=");
+ rtl::OUString sLanguage(RTL_CONSTASCII_USTRINGPARAM("Language="));
if (suURL.indexOf(sLanguage) == -1)
{
AppendConfigToken(suURL, sal_False /* sal_False := add '&' */ );
@@ -1454,7 +1385,7 @@ Reference< awt::XWindow> OGenericUnoController::getTopMostContainerWindow() cons
// -----------------------------------------------------------------------------
Reference< XTitle > OGenericUnoController::impl_getTitleHelper_throw()
{
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
if ( ! m_xTitleHelper.is ())
@@ -1488,7 +1419,7 @@ Reference< XTitle > OGenericUnoController::impl_getTitleHelper_throw()
void SAL_CALL OGenericUnoController::setTitle(const ::rtl::OUString& sTitle)
throw (RuntimeException)
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
m_bExternalTitle = sal_True;
impl_getTitleHelper_throw()->setTitle (sTitle);
@@ -1571,7 +1502,7 @@ sal_uInt16 OGenericUnoController::registerCommandURL( const ::rtl::OUString& _rC
++nFeatureId;
if ( nFeatureId == LAST_USER_DEFINED_FEATURE )
{
- OSL_ENSURE( false, "OGenericUnoController::registerCommandURL: no more space for user defined features!" );
+ OSL_FAIL( "OGenericUnoController::registerCommandURL: no more space for user defined features!" );
return 0L;
}
@@ -1642,12 +1573,22 @@ Sequence< ::sal_Int16 > SAL_CALL OGenericUnoController::getSupportedCommandGroup
::std::transform( aCmdHashMap.begin(),
aCmdHashMap.end(),
aCommandGroups.getArray(),
- ::std::select1st< CommandHashMap::value_type >()
+ ::o3tl::select1st< CommandHashMap::value_type >()
);
return aCommandGroups;
}
+namespace
+{
+ //Current c++0x draft (apparently) has std::identity, but not operator()
+ template<typename T> struct SGI_identity : public std::unary_function<T,T>
+ {
+ T& operator()(T& x) const { return x; }
+ const T& operator()(const T& x) const { return x; }
+ };
+}
+
// -----------------------------------------------------------------------------
Sequence< DispatchInformation > SAL_CALL OGenericUnoController::getConfigurableDispatchInformation( ::sal_Int16 CommandGroup ) throw (RuntimeException)
{
@@ -1669,7 +1610,7 @@ Sequence< DispatchInformation > SAL_CALL OGenericUnoController::getConfigurableD
::std::transform( aInformationList.begin(),
aInformationList.end(),
aInformation.getArray(),
- ::std::identity< DispatchInformation >()
+ SGI_identity< DispatchInformation >()
);
return aInformation;
@@ -1690,8 +1631,9 @@ void OGenericUnoController::fillSupportedFeatures()
void SAL_CALL OGenericUnoController::dispose() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ SolarMutexGuard aSolarGuard;
OGenericUnoController_Base::dispose();
}
} // namespace dbaui
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */