23#include <com/sun/star/container/XChild.hpp>
24#include <com/sun/star/frame/XController2.hpp>
25#include <com/sun/star/frame/XFrame.hpp>
26#include <com/sun/star/frame/XFrameLoader.hpp>
27#include <com/sun/star/frame/XLoadEventListener.hpp>
28#include <com/sun/star/lang/XInitialization.hpp>
29#include <com/sun/star/lang/XServiceInfo.hpp>
30#include <com/sun/star/sdb/ReportDesign.hpp>
31#include <com/sun/star/sdbc/XConnection.hpp>
32#include <com/sun/star/frame/XModule.hpp>
34#include <com/sun/star/sdbc/XDataSource.hpp>
56class DBContentLoader :
public ::cppu::WeakImplHelper< XFrameLoader, XServiceInfo>
74 virtual void SAL_CALL cancel()
override;
85extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
87 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
89 return cppu::acquire(
new DBContentLoader(context));
93OUString SAL_CALL DBContentLoader::getImplementationName()
95 return "org.openoffice.comp.dbu.DBContentLoader";
99sal_Bool SAL_CALL DBContentLoader::supportsService(
const OUString& ServiceName)
107 return {
"com.sun.star.frame.FrameLoader",
"com.sun.star.sdb.ContentLoader" };
110void SAL_CALL DBContentLoader::load(
const Reference< XFrame > & rFrame,
const OUString& rURL,
117 static constexpr struct ServiceNameToImplName
120 const char* pAsciiImplementationName;
121 } aImplementations[] = {
134 for (
const ServiceNameToImplName& aImplementation : aImplementations)
136 if ( sComponentURL == aImplementation.sServiceName )
139 createInstanceWithContext( OUString::createFromAscii( aImplementation.pAsciiImplementationName ),
m_xContext), UNO_QUERY_THROW );
151 bool bDisableBrowser = !aLoadArgs.getOrDefault(
"ShowTreeViewButton",
true )
154 if ( bDisableBrowser )
159 xModule->setIdentifier(
"com.sun.star.sdb.TableDataView" );
161 catch(
const Exception& )
170 bool bPreview = aLoadArgs.getOrDefault(
"Preview",
false );
173 if ( rListener.is() )
174 rListener->loadCancelled(
this );
178 if ( xReportModel.is() )
190 OUString sDataSourceName( aLoadArgs.getOrDefault(
"DataSourceName", OUString() ) );
192 if ( xDataSource.is() )
196 else if ( !sDataSourceName.isEmpty() )
202 else if ( xConnection.is() )
208 "DBContentLoader::load: a connection whose parent is no data source?" );
218 PropertyValue aFrame(
"Frame",0,
Any(rFrame),PropertyState_DIRECT_VALUE);
221 Any* pBegin = aInitArgs.getArray();
222 Any* pEnd = pBegin + aInitArgs.getLength();
224 const PropertyValue* pIter = m_aArgs.getConstArray();
225 for(++pBegin;pBegin != pEnd;++pBegin,++pIter)
230 xIni->initialize(aInitArgs);
232 catch(
const Exception&)
240 catch(
const Exception& )
256 if ( rListener.is() )
257 rListener->loadFinished(
this );
260 if ( rListener.is() )
261 rListener->loadCancelled(
this );
264void DBContentLoader::cancel()
constexpr OUStringLiteral sServiceName
Reference< XComponentContext > m_xContext
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_openoffice_comp_dbu_DBContentLoader_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define DBG_UNHANDLED_EXCEPTION(...)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Reference< css::sdbc::XDataSource > getDataSourceByName(const OUString &_rDataSourceName, weld::Window *_pErrorMessageParent, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, ::dbtools::SQLExceptionInfo *_pErrorInfo)
retrieves a data source given by name or URL, and displays an error if this fails
css::uno::Reference< css::uno::XInterface > getDataSourceOrModel(const css::uno::Reference< css::uno::XInterface > &_xObject)
returns either the model when data source is given as parameter, or returns a data source when a mode...
void ConnectModelController(const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::frame::XController > &xController)
constexpr OUStringLiteral URL_COMPONENT_RELATIONDESIGN
constexpr OUStringLiteral URL_COMPONENT_DATASOURCEBROWSER
constexpr OUStringLiteral URL_COMPONENT_QUERYDESIGN
constexpr OUStringLiteral URL_COMPONENT_VIEWDESIGN
constexpr OUStringLiteral PROPERTY_ENABLE_BROWSER(u"EnableBrowser")
constexpr OUStringLiteral URL_COMPONENT_REPORTDESIGN(u".component:DB/ReportDesign")
constexpr OUStringLiteral URL_COMPONENT_TABLEDESIGN
constexpr OUStringLiteral URL_COMPONENT_FORMGRIDVIEW
Reference< XController > xController
the controller of the sub component. Must not be <NULL>