Automated merge with http://hg-lan.germany.sun.com/ooo/DEV300
This commit is contained in:
196
scripting/source/dlgprov/DialogModelProvider.cxx
Normal file
196
scripting/source/dlgprov/DialogModelProvider.cxx
Normal file
@@ -0,0 +1,196 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* 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_scripting.hxx"
|
||||
|
||||
#include "DialogModelProvider.hxx"
|
||||
#include "dlgprov.hxx"
|
||||
#include <com/sun/star/resource/XStringResourceManager.hpp>
|
||||
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
||||
|
||||
|
||||
// component helper namespace
|
||||
namespace comp_DialogModelProvider {
|
||||
|
||||
namespace css = ::com::sun::star;
|
||||
using namespace ::com::sun::star;
|
||||
using namespace awt;
|
||||
using namespace lang;
|
||||
using namespace uno;
|
||||
using namespace script;
|
||||
using namespace beans;
|
||||
|
||||
|
||||
// component and service helper functions:
|
||||
::rtl::OUString SAL_CALL _getImplementationName();
|
||||
css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL _create( css::uno::Reference< css::uno::XComponentContext > const & context );
|
||||
|
||||
} // closing component helper namespace
|
||||
|
||||
|
||||
|
||||
/// anonymous implementation namespace
|
||||
namespace dlgprov {
|
||||
|
||||
namespace css = ::com::sun::star;
|
||||
using namespace ::com::sun::star;
|
||||
using namespace awt;
|
||||
using namespace lang;
|
||||
using namespace uno;
|
||||
using namespace script;
|
||||
using namespace beans;
|
||||
|
||||
|
||||
DialogModelProvider::DialogModelProvider(Reference< XComponentContext > const & context) :
|
||||
m_xContext(context)
|
||||
{}
|
||||
|
||||
// lang::XInitialization:
|
||||
void SAL_CALL DialogModelProvider::initialize(const css::uno::Sequence< uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception)
|
||||
{
|
||||
if ( aArguments.getLength() == 1 )
|
||||
{
|
||||
::rtl::OUString sURL;
|
||||
if ( !( aArguments[ 0 ] >>= sURL ))
|
||||
throw css::lang::IllegalArgumentException();
|
||||
// Try any other URL with SimpleFileAccess
|
||||
Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY_THROW );
|
||||
Reference< ucb::XSimpleFileAccess > xSFI =
|
||||
Reference< ucb::XSimpleFileAccess >( xSMgr->createInstanceWithContext
|
||||
( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY );
|
||||
|
||||
try
|
||||
{
|
||||
Reference< io::XInputStream > xInput = xSFI->openFileRead( sURL );
|
||||
Reference< resource::XStringResourceManager > xStringResourceManager;
|
||||
if ( xInput.is() )
|
||||
{
|
||||
xStringResourceManager = dlgprov::lcl_getStringResourceManager(m_xContext,sURL);
|
||||
Any aDialogSourceURLAny;
|
||||
aDialogSourceURLAny <<= sURL;
|
||||
|
||||
m_xDialogModel.set( dlgprov::lcl_createDialogModel( m_xContext,xInput , xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW);
|
||||
m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW);
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{}
|
||||
//m_sURL = sURL;
|
||||
}
|
||||
}
|
||||
|
||||
// container::XElementAccess:
|
||||
uno::Type SAL_CALL DialogModelProvider::getElementType() throw (css::uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModel->getElementType();
|
||||
}
|
||||
|
||||
::sal_Bool SAL_CALL DialogModelProvider::hasElements() throw (css::uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModel->hasElements();
|
||||
}
|
||||
|
||||
// container::XNameAccess:
|
||||
uno::Any SAL_CALL DialogModelProvider::getByName(const ::rtl::OUString & aName) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException)
|
||||
{
|
||||
return m_xDialogModel->getByName(aName);
|
||||
}
|
||||
|
||||
css::uno::Sequence< ::rtl::OUString > SAL_CALL DialogModelProvider::getElementNames() throw (css::uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModel->getElementNames();
|
||||
}
|
||||
|
||||
::sal_Bool SAL_CALL DialogModelProvider::hasByName(const ::rtl::OUString & aName) throw (css::uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModel->hasByName(aName);
|
||||
}
|
||||
|
||||
// container::XNameReplace:
|
||||
void SAL_CALL DialogModelProvider::replaceByName(const ::rtl::OUString & aName, const uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException)
|
||||
{
|
||||
m_xDialogModel->replaceByName(aName,aElement);
|
||||
}
|
||||
|
||||
// container::XNameContainer:
|
||||
void SAL_CALL DialogModelProvider::insertByName(const ::rtl::OUString & aName, const uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException)
|
||||
{
|
||||
m_xDialogModel->insertByName(aName,aElement);
|
||||
}
|
||||
|
||||
void SAL_CALL DialogModelProvider::removeByName(const ::rtl::OUString & aName) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException)
|
||||
{
|
||||
m_xDialogModel->removeByName(aName);
|
||||
}
|
||||
uno::Reference< beans::XPropertySetInfo > SAL_CALL DialogModelProvider::getPropertySetInfo( ) throw (uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModelProp->getPropertySetInfo();
|
||||
}
|
||||
void SAL_CALL DialogModelProvider::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
}
|
||||
uno::Any SAL_CALL DialogModelProvider::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
return m_xDialogModelProp->getPropertyValue(PropertyName);
|
||||
}
|
||||
void SAL_CALL DialogModelProvider::addPropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
}
|
||||
void SAL_CALL DialogModelProvider::removePropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
}
|
||||
void SAL_CALL DialogModelProvider::addVetoableChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
}
|
||||
void SAL_CALL DialogModelProvider::removeVetoableChangeListener( const ::rtl::OUString& ,const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
||||
{
|
||||
}
|
||||
|
||||
// com.sun.star.uno.XServiceInfo:
|
||||
::rtl::OUString SAL_CALL DialogModelProvider::getImplementationName() throw (css::uno::RuntimeException)
|
||||
{
|
||||
return comp_DialogModelProvider::_getImplementationName();
|
||||
}
|
||||
|
||||
::sal_Bool SAL_CALL DialogModelProvider::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException)
|
||||
{
|
||||
css::uno::Sequence< ::rtl::OUString > serviceNames = comp_DialogModelProvider::_getSupportedServiceNames();
|
||||
for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
|
||||
if (serviceNames[i] == serviceName)
|
||||
return sal_True;
|
||||
}
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
css::uno::Sequence< ::rtl::OUString > SAL_CALL DialogModelProvider::getSupportedServiceNames() throw (css::uno::RuntimeException)
|
||||
{
|
||||
return comp_DialogModelProvider::_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
} // closing anonymous implementation namespace
|
||||
|
92
scripting/source/dlgprov/DialogModelProvider.hxx
Normal file
92
scripting/source/dlgprov/DialogModelProvider.hxx
Normal file
@@ -0,0 +1,92 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
#include "sal/config.h"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implbase4.hxx"
|
||||
#include "com/sun/star/lang/XInitialization.hpp"
|
||||
#include "com/sun/star/container/XNameContainer.hpp"
|
||||
#include "com/sun/star/lang/XServiceInfo.hpp"
|
||||
#include "com/sun/star/beans/XPropertySet.hpp"
|
||||
|
||||
/// anonymous implementation namespace
|
||||
namespace dlgprov{
|
||||
|
||||
namespace css = ::com::sun::star;
|
||||
|
||||
class DialogModelProvider:
|
||||
public ::cppu::WeakImplHelper4<
|
||||
css::lang::XInitialization,
|
||||
css::container::XNameContainer,
|
||||
css::beans::XPropertySet,
|
||||
css::lang::XServiceInfo>
|
||||
{
|
||||
public:
|
||||
explicit DialogModelProvider(css::uno::Reference< css::uno::XComponentContext > const & context);
|
||||
private:
|
||||
// ::com::sun::star::lang::XInitialization:
|
||||
virtual void SAL_CALL initialize(const css::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception);
|
||||
|
||||
// ::com::sun::star::container::XElementAccess:
|
||||
virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
|
||||
virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
|
||||
|
||||
// ::com::sun::star::container::XNameAccess:
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString & aName) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException);
|
||||
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException);
|
||||
virtual ::sal_Bool SAL_CALL hasByName(const ::rtl::OUString & aName) throw (css::uno::RuntimeException);
|
||||
|
||||
// ::com::sun::star::container::XNameReplace:
|
||||
virtual void SAL_CALL replaceByName(const ::rtl::OUString & aName, const ::com::sun::star::uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException);
|
||||
|
||||
// ::com::sun::star::container::XNameContainer:
|
||||
virtual void SAL_CALL insertByName(const ::rtl::OUString & aName, const ::com::sun::star::uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException);
|
||||
virtual void SAL_CALL removeByName(const ::rtl::OUString & Name) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException);
|
||||
|
||||
// ::com::sun::star::lang::XServiceInfo:
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
|
||||
virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
|
||||
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
|
||||
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
private:
|
||||
DialogModelProvider(const DialogModelProvider &); // not defined
|
||||
DialogModelProvider& operator=(const DialogModelProvider &); // not defined
|
||||
|
||||
// destructor is private and will be called indirectly by the release call virtual ~DialogModelProvider() {}
|
||||
|
||||
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
||||
css::uno::Reference< css::container::XNameContainer> m_xDialogModel;
|
||||
css::uno::Reference< css::beans::XPropertySet> m_xDialogModelProp;
|
||||
};
|
||||
} // closing anonymous implementation namespace
|
@@ -28,6 +28,7 @@
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_scripting.hxx"
|
||||
|
||||
#include "DialogModelProvider.hxx"
|
||||
#include "dlgprov.hxx"
|
||||
#include "dlgevtatt.hxx"
|
||||
#include <com/sun/star/awt/XControlContainer.hpp>
|
||||
@@ -60,20 +61,103 @@
|
||||
#include <util/MiscUtils.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::awt;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::script;
|
||||
using namespace ::com::sun::star::beans;
|
||||
using namespace ::com::sun::star::document;
|
||||
using namespace awt;
|
||||
using namespace lang;
|
||||
using namespace uno;
|
||||
using namespace script;
|
||||
using namespace beans;
|
||||
using namespace document;
|
||||
using namespace ::sf_misc;
|
||||
|
||||
// component helper namespace
|
||||
namespace comp_DialogModelProvider
|
||||
{
|
||||
|
||||
::rtl::OUString SAL_CALL _getImplementationName()
|
||||
{
|
||||
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogModelProvider"));
|
||||
}
|
||||
|
||||
uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
|
||||
{
|
||||
uno::Sequence< ::rtl::OUString > s(1);
|
||||
s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModelProvider"));
|
||||
return s;
|
||||
}
|
||||
|
||||
uno::Reference< uno::XInterface > SAL_CALL _create(const uno::Reference< uno::XComponentContext > & context) SAL_THROW((uno::Exception))
|
||||
{
|
||||
return static_cast< ::cppu::OWeakObject * >(new dlgprov::DialogModelProvider(context));
|
||||
}
|
||||
} // closing component helper namespace
|
||||
//.........................................................................
|
||||
namespace dlgprov
|
||||
{
|
||||
//.........................................................................
|
||||
|
||||
static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
|
||||
|
||||
Reference< resource::XStringResourceManager > lcl_getStringResourceManager(const Reference< XComponentContext >& i_xContext,const ::rtl::OUString& i_sURL)
|
||||
{
|
||||
INetURLObject aInetObj( i_sURL );
|
||||
::rtl::OUString aDlgName = aInetObj.GetBase();
|
||||
aInetObj.removeSegment();
|
||||
::rtl::OUString aDlgLocation = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
|
||||
bool bReadOnly = true;
|
||||
::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
|
||||
::rtl::OUString aComment;
|
||||
|
||||
Sequence<Any> aArgs( 6 );
|
||||
aArgs[0] <<= aDlgLocation;
|
||||
aArgs[1] <<= bReadOnly;
|
||||
aArgs[2] <<= aLocale;
|
||||
aArgs[3] <<= aDlgName;
|
||||
aArgs[4] <<= aComment;
|
||||
|
||||
Reference< task::XInteractionHandler > xDummyHandler;
|
||||
aArgs[5] <<= xDummyHandler;
|
||||
Reference< XMultiComponentFactory > xSMgr_( i_xContext->getServiceManager(), UNO_QUERY_THROW );
|
||||
// TODO: Ctor
|
||||
Reference< resource::XStringResourceManager > xStringResourceManager( xSMgr_->createInstanceWithContext
|
||||
( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ),
|
||||
i_xContext ), UNO_QUERY );
|
||||
if( xStringResourceManager.is() )
|
||||
{
|
||||
Reference< XInitialization > xInit( xStringResourceManager, UNO_QUERY );
|
||||
if( xInit.is() )
|
||||
xInit->initialize( aArgs );
|
||||
}
|
||||
return xStringResourceManager;
|
||||
}
|
||||
Reference< container::XNameContainer > lcl_createControlModel(const Reference< XComponentContext >& i_xContext)
|
||||
{
|
||||
Reference< XMultiComponentFactory > xSMgr_( i_xContext->getServiceManager(), UNO_QUERY_THROW );
|
||||
Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), i_xContext ), UNO_QUERY_THROW );
|
||||
return xControlModel;
|
||||
}
|
||||
Reference< container::XNameContainer > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext,
|
||||
const Reference< io::XInputStream >& xInput,
|
||||
const Reference< resource::XStringResourceManager >& xStringResourceManager,
|
||||
const Any &aDialogSourceURL) throw ( Exception )
|
||||
{
|
||||
Reference< container::XNameContainer > xDialogModel( lcl_createControlModel(i_xContext) );
|
||||
|
||||
::rtl::OUString aDlgSrcUrlPropName( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ) );
|
||||
Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
|
||||
xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
|
||||
|
||||
::xmlscript::importDialogModel( xInput, xDialogModel, i_xContext );
|
||||
// Set resource property
|
||||
if( xStringResourceManager.is() )
|
||||
{
|
||||
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
|
||||
Any aStringResourceManagerAny;
|
||||
aStringResourceManagerAny <<= xStringResourceManager;
|
||||
xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
|
||||
}
|
||||
|
||||
return xDialogModel;
|
||||
}
|
||||
// =============================================================================
|
||||
// component operations
|
||||
// =============================================================================
|
||||
@@ -173,9 +257,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
|
||||
Reference< container::XNameContainer > DialogProviderImpl::createControlModel() throw ( Exception )
|
||||
{
|
||||
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager(), UNO_QUERY_THROW );
|
||||
Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), m_xContext ), UNO_QUERY_THROW );
|
||||
return xControlModel;
|
||||
return lcl_createControlModel(m_xContext);
|
||||
}
|
||||
|
||||
Reference< container::XNameContainer > DialogProviderImpl::createDialogModel(
|
||||
@@ -183,23 +265,9 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
const Reference< resource::XStringResourceManager >& xStringResourceManager,
|
||||
const Any &aDialogSourceURL) throw ( Exception )
|
||||
{
|
||||
Reference< container::XNameContainer > xDialogModel( createControlModel() );
|
||||
|
||||
::rtl::OUString aDlgSrcUrlPropName( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ) );
|
||||
Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
|
||||
xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
|
||||
|
||||
::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
|
||||
// Set resource property
|
||||
if( xStringResourceManager.is() )
|
||||
{
|
||||
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
|
||||
Any aStringResourceManagerAny;
|
||||
aStringResourceManagerAny <<= xStringResourceManager;
|
||||
xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
|
||||
}
|
||||
|
||||
return xDialogModel;
|
||||
return lcl_createDialogModel(m_xContext,xInput,xStringResourceManager,aDialogSourceURL);
|
||||
}
|
||||
|
||||
Reference< XControlModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception )
|
||||
@@ -280,8 +348,8 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
bSingleDialog = true;
|
||||
|
||||
// Try any other URL with SimpleFileAccess
|
||||
Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI =
|
||||
Reference< ::com::sun::star::ucb::XSimpleFileAccess >( xSMgr->createInstanceWithContext
|
||||
Reference< ucb::XSimpleFileAccess > xSFI =
|
||||
Reference< ucb::XSimpleFileAccess >( xSMgr->createInstanceWithContext
|
||||
( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY );
|
||||
|
||||
try
|
||||
@@ -412,34 +480,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
Reference< resource::XStringResourceManager > xStringResourceManager;
|
||||
if( bSingleDialog )
|
||||
{
|
||||
INetURLObject aInetObj( aURL );
|
||||
::rtl::OUString aDlgName = aInetObj.GetBase();
|
||||
aInetObj.removeSegment();
|
||||
::rtl::OUString aDlgLocation = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
|
||||
bool bReadOnly = true;
|
||||
::com::sun ::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
|
||||
::rtl::OUString aComment;
|
||||
|
||||
Sequence<Any> aArgs( 6 );
|
||||
aArgs[0] <<= aDlgLocation;
|
||||
aArgs[1] <<= bReadOnly;
|
||||
aArgs[2] <<= aLocale;
|
||||
aArgs[3] <<= aDlgName;
|
||||
aArgs[4] <<= aComment;
|
||||
|
||||
Reference< task::XInteractionHandler > xDummyHandler;
|
||||
aArgs[5] <<= xDummyHandler;
|
||||
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager(), UNO_QUERY_THROW );
|
||||
// TODO: Ctor
|
||||
xStringResourceManager = Reference< resource::XStringResourceManager >( xSMgr_->createInstanceWithContext
|
||||
( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ),
|
||||
m_xContext ), UNO_QUERY );
|
||||
if( xStringResourceManager.is() )
|
||||
{
|
||||
Reference< XInitialization > xInit( xStringResourceManager, UNO_QUERY );
|
||||
if( xInit.is() )
|
||||
xInit->initialize( aArgs );
|
||||
}
|
||||
xStringResourceManager = lcl_getStringResourceManager(m_xContext,aURL);
|
||||
}
|
||||
else if( xDialogLib.is() )
|
||||
{
|
||||
@@ -794,7 +835,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
Reference< XWindow > DialogProviderImpl::createContainerWindow(
|
||||
const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
|
||||
const Reference< XWindowPeer >& xParent, const Reference< XInterface >& xHandler )
|
||||
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
|
||||
throw (lang::IllegalArgumentException, RuntimeException)
|
||||
{
|
||||
(void)WindowType; // for future use
|
||||
if( !xParent.is() )
|
||||
@@ -824,11 +865,8 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
|
||||
|
||||
static struct ::cppu::ImplementationEntry s_component_entries [] =
|
||||
{
|
||||
{
|
||||
create_DialogProviderImpl, getImplementationName_DialogProviderImpl,
|
||||
getSupportedServiceNames_DialogProviderImpl, ::cppu::createSingleComponentFactory,
|
||||
0, 0
|
||||
},
|
||||
{create_DialogProviderImpl, getImplementationName_DialogProviderImpl,getSupportedServiceNames_DialogProviderImpl, ::cppu::createSingleComponentFactory,0, 0},
|
||||
{ &comp_DialogModelProvider::_create,&comp_DialogModelProvider::_getImplementationName,&comp_DialogModelProvider::_getSupportedServiceNames,&::cppu::createSingleComponentFactory, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@@ -61,6 +61,13 @@ namespace dlgprov
|
||||
// =============================================================================
|
||||
// class DialogProviderImpl
|
||||
// =============================================================================
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createControlModel(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext);
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > lcl_getStringResourceManager(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext,const ::rtl::OUString& i_sURL);
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createDialogModel(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager,
|
||||
const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception );
|
||||
|
||||
typedef ::cppu::WeakImplHelper4<
|
||||
::com::sun::star::lang::XServiceInfo,
|
||||
|
@@ -41,6 +41,7 @@ DLLPRE =
|
||||
|
||||
SLOFILES= \
|
||||
$(SLO)$/dlgprov.obj \
|
||||
$(SLO)$/DialogModelProvider.obj \
|
||||
$(SLO)$/dlgevtatt.obj
|
||||
|
||||
SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno
|
||||
|
Reference in New Issue
Block a user