[Libreoffice-commits] .: 3 commits - basic/source scripting/prj scripting/source sfx2/source vbahelper/prj vbahelper/source xmlscript/source xmlscript/util
Noel Power
noelp at kemper.freedesktop.org
Fri Nov 5 09:47:14 PDT 2010
basic/source/classes/sbxmod.cxx | 11
basic/source/inc/namecont.hxx | 3
basic/source/uno/dlgcont.cxx | 80 +++
basic/source/uno/namecont.cxx | 26
scripting/prj/build.lst | 2
scripting/source/dlgprov/dlgevtatt.cxx | 76 +-
scripting/source/dlgprov/dlgevtatt.hxx | 1
scripting/source/vbaevents/eventhelper.cxx | 66 +-
sfx2/source/appl/appserv.cxx | 30 -
vbahelper/prj/build.lst | 2
vbahelper/source/msforms/vbacontrol.cxx | 23
vbahelper/source/msforms/vbacontrols.cxx | 14
vbahelper/source/msforms/vbamultipage.cxx | 24
vbahelper/source/msforms/vbauserform.cxx | 75 ++
vbahelper/source/msforms/vbauserform.hxx | 2
xmlscript/source/xmldlg_imexp/common.hxx | 1
xmlscript/source/xmldlg_imexp/exp_share.hxx | 48 +
xmlscript/source/xmldlg_imexp/imp_share.hxx | 97 +++
xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 555 +++++++++++++++------
xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 474 ++++++-----------
xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 463 ++++++-----------
xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 154 +++++
xmlscript/util/makefile.mk | 1
23 files changed, 1336 insertions(+), 892 deletions(-)
New commits:
commit 588875fe85dd531ddabdd92a8f30d704e2818223
Merge: a22f01b... 0e156fe...
Author: Noel Power <noel.power at novell.com>
Date: Fri Nov 5 11:43:28 2010 +0000
Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/libs-core
Conflicts:
xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
diff --cc sfx2/source/appl/appserv.cxx
index 5cca2d5,3f1b44e..0321e6d
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@@ -2,7 -2,7 +2,7 @@@
/*************************************************************************
*
* 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
@@@ -365,11 -366,29 +366,29 @@@ void SfxApplication::MiscExec_Impl( Sfx
args[0].Value <<= sal_True;
args[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
args[1].Value <<= sal_True;
-
+
rtl::OUString aURL;
- if ( checkURL ( "LICENSE.odt", aURL ) ||
- checkURL ( "LICENSE.html", aURL ) ||
- checkURL ( "LICENSE", aURL ) ) {
+ char const** pNames;
+ if( rReq.GetSlot() == SID_SHOW_LICENSE )
+ {
- static char const* pLicenseStrings[] =
++ static char const* pLicenseStrings[] =
+ {
+ "LICENSE.odt", "LICENSE.html", "LICENSE"
+ };
+ pNames = pLicenseStrings;
+ }
+ else
+ {
- static char const* pCreditsStrings[] =
++ static char const* pCreditsStrings[] =
+ {
+ "CREDITS.odt", "CREDITS.html", "CREDITS"
+ };
+ pNames = pCreditsStrings;
+ }
+
+ if ( checkURL ( pNames[0], aURL ) ||
+ checkURL ( pNames[1], aURL ) ||
+ checkURL ( pNames[2], aURL ) ) {
xLoader->loadComponentFromURL( aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, args );
}
} catch (const ::com::sun::star::uno::Exception &) {
@@@ -913,14 -932,14 +932,14 @@@ namespac
}
}
--static ::rtl::OUString getConfigurationStringValue(
-- const ::rtl::OUString& rPackage,
-- const ::rtl::OUString& rRelPath,
++static ::rtl::OUString getConfigurationStringValue(
++ const ::rtl::OUString& rPackage,
++ const ::rtl::OUString& rRelPath,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rDefaultValue )
{
::rtl::OUString aDefVal( rDefaultValue );
--
++
try
{
::comphelper::ConfigurationHelper::readDirectKey(
@@@ -989,15 -1008,15 +1008,15 @@@ void SfxApplication::OfaExec_Impl( SfxR
uno::Reference< css::system::XSystemShellExecute > xSystemShell(
xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ),
uno::UNO_QUERY_THROW );
--
++
// read repository URL from configuration
-- ::rtl::OUString sTemplRepoURL =
++ ::rtl::OUString sTemplRepoURL =
getConfigurationStringValue(
::rtl::OUString::createFromAscii("org.openoffice.Office.Common"),
::rtl::OUString::createFromAscii("Dictionaries"),
::rtl::OUString::createFromAscii("RepositoryURL"),
::rtl::OUString());
--
++
if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 )
{
::rtl::OUStringBuffer aURLBuf( sTemplRepoURL );
@@@ -1010,11 -1029,11 +1029,11 @@@
::rtl::OUString::createFromAscii("L10N"),
::rtl::OUString::createFromAscii("ooLocale"),
::rtl::OUString::createFromAscii("en-US"));
--
++
aURLBuf.append( sLocale );
-- xSystemShell->execute(
-- aURLBuf.makeStringAndClear(),
-- ::rtl::OUString(),
++ xSystemShell->execute(
++ aURLBuf.makeStringAndClear(),
++ ::rtl::OUString(),
css::system::SystemShellExecuteFlags::DEFAULTS );
}
}
commit a22f01b1a6054d1dd7e07ba8280b4f353df71bad
Author: Noel Power <noel.power at novell.com>
Date: Fri Nov 5 10:37:53 2010 +0000
clean up styles, fix missing export of (embedded) image url
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 5523fe0..0717e32 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -128,8 +128,6 @@ struct DialogImport
::boost::shared_ptr< ::std::vector< ::rtl::OUString > > _pStyleNames;
::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles;
- ::std::vector< ::rtl::OUString >& _styleNames;
- ::std::vector< css::uno::Reference< css::xml::input::XElement > >& _styles;
css::uno::Reference< css::container::XNameContainer > _xDialogModel;
css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
@@ -176,8 +174,6 @@ public:
: _xContext( xContext )
, _pStyleNames( pStyleNames )
, _pStyles( pStyles )
- , _styleNames( *_pStyleNames )
- , _styles( *_pStyles )
, _xDialogModel( xDialogModel )
, _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
{ OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
@@ -187,8 +183,6 @@ public:
, _xSupplier( rOther._xSupplier )
, _pStyleNames( rOther._pStyleNames )
, _pStyles( rOther._pStyles )
- , _styleNames( *_pStyleNames )
- , _styles( *_pStyles )
, _xDialogModel( rOther._xDialogModel )
, _xDialogModelFactory( rOther._xDialogModelFactory )
, _xDoc( rOther._xDoc )
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 2d955fd..01f1efe 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -1333,10 +1333,8 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
if ( (aDecorationAny >>= bDecoration) && !bDecoration )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
-
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
-
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readEvents();
}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 02a74f2..b5d61fd 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -2010,19 +2010,19 @@ void DialogImport::addStyle(
Reference< xml::input::XElement > const & xStyle )
SAL_THROW( () )
{
- _styleNames.push_back( rStyleId );
- _styles.push_back( xStyle );
+ (*_pStyleNames).push_back( rStyleId );
+ (*_pStyles).push_back( xStyle );
}
//__________________________________________________________________________________________________
Reference< xml::input::XElement > DialogImport::getStyle(
OUString const & rStyleId ) const
SAL_THROW( () )
{
- for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos )
+ for ( size_t nPos = 0; nPos < (*_pStyleNames).size(); ++nPos )
{
- if (_styleNames[ nPos ] == rStyleId)
+ if ( (*_pStyleNames)[ nPos ] == rStyleId)
{
- return _styles[ nPos ];
+ return (*_pStyles)[ nPos ];
}
}
return 0;
commit c2e08dbfff7aca6af33a1ac32be15c97c648a73e
Author: Noel Power <noel.power at novell.com>
Date: Tue Nov 2 16:22:07 2010 +0000
initial import of latest cws container_controls
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 52bdddf..6adcf00 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2505,8 +2505,15 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] <<= m_xModel;
rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
- if ( this->GetParent()->GetName().Len() )
- sProjectName = this->GetParent()->GetName();
+
+ try
+ {
+ Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ sProjectName = xVBAMode->getProjectName();
+ }
+ catch( Exception& /*e*/) {}
+
sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index d86ca14..14ac05e 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -225,6 +225,7 @@ class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
{
sal_Bool mbVBACompat;
+ rtl::OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
@@ -514,6 +515,8 @@ public:
// Methods XVBACompatibility
virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
+ virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index b4172dd..105f180 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include "com/sun/star/resource/XStringResourceWithStorage.hpp"
#include "com/sun/star/resource/XStringResourceWithLocation.hpp"
+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
#include "dlgcont.hxx"
#include "sbmodule.hxx"
#include <comphelper/processfactory.hxx>
@@ -74,6 +75,8 @@ using namespace osl;
using com::sun::star::uno::Reference;
+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+
//============================================================================
// Implementation class SfxDialogLibraryContainer
@@ -225,6 +228,35 @@ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
xInput->closeInput();
}
+void lcl_deepInspectForEmbeddedImages( const Reference< XInterface >& xIf, std::vector< rtl::OUString >& rvEmbedImgUrls )
+{
+ static rtl::OUString sImageURL= OUString(RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) );
+ Reference< beans::XPropertySet > xProps( xIf, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ if ( xProps->getPropertySetInfo()->hasPropertyByName( sImageURL ) )
+ {
+ rtl::OUString sURL;
+ xProps->getPropertyValue( sImageURL ) >>= sURL;
+ if ( sURL.getLength() && sURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 )
+ rvEmbedImgUrls.push_back( sURL );
+ }
+ }
+ Reference< XNameContainer > xContainer( xIf, UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ Sequence< rtl::OUString > sNames = xContainer->getElementNames();
+ sal_Int32 nContainees = sNames.getLength();
+ for ( sal_Int32 index = 0; index < nContainees; ++index )
+ {
+ Reference< XInterface > xCtrl;
+ xContainer->getByName( sNames[ index ] ) >>= xCtrl;
+ lcl_deepInspectForEmbeddedImages( xCtrl, rvEmbedImgUrls );
+ }
+ }
+}
+
void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage ) throw ( RuntimeException )
{
LibraryContainerMethodGuard aGuard( *this );
@@ -253,6 +285,54 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
SfxLibraryContainer::storeLibrariesToStorage( xStorage );
+ // we need to export out any embedded image object(s)
+ // associated with any Dialogs. First, we need to actually gather any such urls
+ // for each dialog in this container
+ Sequence< OUString > sLibraries = getElementNames();
+ for ( sal_Int32 i=0; i < sLibraries.getLength(); ++i )
+ {
+ // libraries will already be loaded from above
+ Reference< XNameContainer > xLib;
+ getByName( sLibraries[ i ] ) >>= xLib;
+ if ( xLib.is() )
+ {
+ Sequence< OUString > sDialogs = xLib->getElementNames();
+ sal_Int32 nDialogs( sDialogs.getLength() );
+ for ( sal_Int32 j=0; j < nDialogs; ++j )
+ {
+ // Each Dialog has an associated xISP
+ Reference< io::XInputStreamProvider > xISP;
+ xLib->getByName( sDialogs[ j ] ) >>= xISP;
+ if ( xISP.is() )
+ {
+ Reference< io::XInputStream > xInput( xISP->createInputStream() );
+ Reference< XNameContainer > xDialogModel( mxMSF->createInstance
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
+ Reference< XComponentContext > xContext;
+ Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
+ std::vector< rtl::OUString > vEmbeddedImageURLs;
+ lcl_deepInspectForEmbeddedImages( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
+ if ( vEmbeddedImageURLs.size() )
+ {
+ // Export the images to the storage
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= xStorage;
+ Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicExportHelper" ) ), aArgs ), UNO_QUERY );
+ std::vector< rtl::OUString >::iterator it = vEmbeddedImageURLs.begin();
+ std::vector< rtl::OUString >::iterator it_end = vEmbeddedImageURLs.end();
+ if ( xGraphicResolver.is() )
+ {
+ for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
+ xGraphicResolver->resolveGraphicObjectURL( *it );
+ }
+ }
+ }
+ }
+ }
+ }
mbOasis2OOoFormat = sal_False;
}
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 9efa92e..0feee80 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -323,7 +323,7 @@ DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
: LibraryContainerHelper( maMutex )
- , mbVBACompat( sal_False )
+ , mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
, mbOldInfoFormat( sal_False )
@@ -2381,7 +2381,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
}
Reference< XNameContainer > xLib( pImplLib );
- Any aAny = importLibraryElement( xLib, aElementName,
+ Any aAny = importLibraryElement( xLib, aElementName,
aFile, xInStream );
if( pImplLib->hasByName( aElementName ) )
{
@@ -2799,7 +2799,7 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
OUString aRetStr = pImplLib->maOrignialStorageURL;
return aRetStr;
}
-
+
// XVBACompatibility
::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
@@ -2824,6 +2824,18 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
mbVBACompat = _vbacompatmodeon;
}
+void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _projectname ) throw (RuntimeException)
+{
+ msProjectName = _projectname;
+ BasicManager* pBasMgr = getBasicManager();
+ // Temporary HACK
+ // Some parts of the VBA handling ( e.g. in core basic )
+ // code expect the name of the VBA project to be set as the name of
+ // the basic manager. Provide fail back here.
+ if( pBasMgr )
+ pBasMgr->SetName( msProjectName );
+}
+
// Methods XServiceInfo
::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
throw (RuntimeException)
@@ -3168,7 +3180,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
}
case BUNDLED_EXTENSIONS:
{
- Reference< deployment::XPackage > xScriptPackage =
+ Reference< deployment::XPackage > xScriptPackage =
implGetNextBundledScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
break;
@@ -3401,7 +3413,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
try
{
Reference< XExtensionManager > xSharedManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
@@ -3454,7 +3466,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
try
{
Reference< XExtensionManager > xManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aBundledPackagesSeq = xManager->getDeployedExtensions
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
diff --git a/scripting/prj/build.lst b/scripting/prj/build.lst
index 7d51621..28fcdbc 100755
--- a/scripting/prj/build.lst
+++ b/scripting/prj/build.lst
@@ -1,4 +1,4 @@
-tc scripting : oovbaapi vbahelper bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
+tc scripting : filter oovbaapi vbahelper bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
tc scripting usr1 - all tc1_mkout NULL
tc scripting\inc nmake - all tc1_inc NULL
tc scripting\source\provider nmake - all tc1_scriptingprovider tc1_inc NULL
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 5be31fb..bfcc678 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -38,6 +38,7 @@
#include <tools/diagnose_ex.h>
#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XDialogEventHandler.hpp>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -232,6 +233,9 @@ namespace dlgprov
Reference< container::XNameContainer > xEventCont = xEventsSupplier->getEvents();
Reference< XControlModel > xControlModel = xControl->getModel();
+ Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
+ rtl::OUString sName;
+ xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") ) >>= sName;
if ( xEventCont.is() )
{
Sequence< ::rtl::OUString > aNames = xEventCont->getElementNames();
@@ -288,6 +292,51 @@ namespace dlgprov
}
}
+
+ void DialogEventsAttacherImpl::nestedAttachEvents( const Sequence< Reference< XInterface > >& Objects, const Any& Helper, rtl::OUString& sDialogCodeName )
+ {
+ const Reference< XInterface >* pObjects = Objects.getConstArray();
+ sal_Int32 nObjCount = Objects.getLength();
+
+ for ( sal_Int32 i = 0; i < nObjCount; ++i )
+ {
+ // We know that we have to do with instances of XControl.
+ // Otherwise this is not the right implementation for
+ // XScriptEventsAttacher and we have to give up.
+ Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
+ Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
+ Reference< XDialog > xDialog( xControl, UNO_QUERY );
+ if ( !xControl.is() )
+ throw IllegalArgumentException();
+
+ // get XEventsSupplier from control model
+ Reference< XControlModel > xControlModel = xControl->getModel();
+ Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
+ attachEventsToControl( xControl, xEventsSupplier, Helper );
+ if ( mbUseFakeVBAEvents )
+ {
+ xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
+ Any newHelper(xControl );
+ attachEventsToControl( xControl, xEventsSupplier, newHelper );
+ }
+ if ( xControlContainer.is() && !xDialog.is() )
+ {
+ Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
+ sal_Int32 nControlCount = aControls.getLength();
+
+ Sequence< Reference< XInterface > > aObjects( nControlCount );
+ Reference< XInterface >* pObjectsModify = aObjects.getArray();
+ const Reference< XControl >* pControls = aControls.getConstArray();
+
+ for ( sal_Int32 j = 0; j < nControlCount; ++j )
+ {
+ pObjectsModify[j] = Reference< XInterface >( pControls[j], UNO_QUERY );
+ }
+ nestedAttachEvents( aObjects, Helper, sDialogCodeName );
+ }
+ }
+ }
+
// -----------------------------------------------------------------------------
// XScriptEventsAttacher
// -----------------------------------------------------------------------------
@@ -320,12 +369,9 @@ namespace dlgprov
}
}
-
- // go over all objects
- const Reference< XInterface >* pObjects = Objects.getConstArray();
+ rtl::OUString sDialogCodeName;
sal_Int32 nObjCount = Objects.getLength();
Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
- rtl::OUString sDialogCodeName;
if ( xDlgControl.is() )
{
Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
@@ -335,26 +381,8 @@ namespace dlgprov
}
catch( Exception& ){}
}
-
- for ( sal_Int32 i = 0; i < nObjCount; ++i )
- {
- // We know that we have to do with instances of XControl.
- // Otherwise this is not the right implementation for
- // XScriptEventsAttacher and we have to give up.
- Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
- if ( !xControl.is() )
- throw IllegalArgumentException();
-
- // get XEventsSupplier from control model
- Reference< XControlModel > xControlModel = xControl->getModel();
- Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
- attachEventsToControl( xControl, xEventsSupplier, Helper );
- if ( mbUseFakeVBAEvents )
- {
- xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
- attachEventsToControl( xControl, xEventsSupplier, Helper );
- }
- }
+ // go over all objects
+ nestedAttachEvents( Objects, Helper, sDialogCodeName );
}
diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx
index aeb1edd..4e1321f 100644
--- a/scripting/source/dlgprov/dlgevtatt.hxx
+++ b/scripting/source/dlgprov/dlgevtatt.hxx
@@ -69,6 +69,7 @@ namespace dlgprov
::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacher > m_xEventAttacher;
::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > getScriptListenerForKey( const rtl::OUString& sScriptName ) throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, rtl::OUString& sCodeName );
+ void nestedAttachEvents( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects, const ::com::sun::star::uno::Any& Helper, rtl::OUString& sDialogCodeName );
void SAL_CALL attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper );
public:
DialogEventsAttacherImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index f8edf6e..b504b20 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -56,6 +56,7 @@
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/container/XNamed.hpp>
@@ -688,9 +689,9 @@ private:
Reference< XComponentContext > m_xContext;
Reference< frame::XModel > m_xModel;
- SfxObjectShell* mpShell;
sal_Bool m_bDocClosed;
-
+ SfxObjectShell* mpShell;
+ rtl::OUString msProject;
};
EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
@@ -698,7 +699,7 @@ OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(
{
registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-
+ msProject = rtl::OUString::createFromAscii("Standard");
}
void
@@ -716,6 +717,14 @@ EventListener::setShellFromModel()
}
pShell = SfxObjectShell::GetNext( *pShell );
}
+ // set ProjectName from model
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ msProject = xVBAMode->getProjectName();
+ }
+ catch ( uno::Exception& ) {}
}
//XEventListener
@@ -772,13 +781,13 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio
// XCloseListener
void SAL_CALL
-EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
+EventListener::queryClosing( const lang::EventObject& /*Source*/, ::sal_Bool /*GetsOwnership*/ ) throw (util::CloseVetoException, uno::RuntimeException)
{
//Nothing to do
}
void SAL_CALL
-EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+EventListener::notifyClosing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
{
m_bDocClosed = sal_True;
uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
@@ -931,36 +940,34 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
if ( !xDlg.is() )
{
- OSL_TRACE("Getting Control");
+ OSL_TRACE("Getting Control");
// evt.Source is
// a) Dialog
// b) xShapeControl ( from api (sheet control) )
// c) eventmanager ( I guess )
// d) vba control ( from api also )
- uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
- if ( xCntrlShape.is() )
- {
- // for sheet controls ( that fire from the api ) we don't
- // have the real control ( thats only available from the view )
- // api code creates just a control instance that is transferred
- // via aEvent.Arguments[ 0 ] that control though has no
- // info like name etc.
- uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW );
- OSL_TRACE("Got control shape");
- uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
- OSL_TRACE("Got xnamed ");
- sName = xName->getName();
- }
- else
+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
+ if ( xCntrlShape.is() )
{
- // Userform control ( fired from the api or from event manager )
- uno::Reference< beans::XPropertySet > xProps;
- OSL_TRACE("Getting properties");
- xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
- }
-
+ // for sheet controls ( that fire from the api ) we don't
+ // have the real control ( thats only available from the view )
+ // api code creates just a control instance that is transferred
+ // via aEvent.Arguments[ 0 ] that control though has no
+ // info like name etc.
+ OSL_TRACE("Got control shape");
+ uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
+ OSL_TRACE("Got xnamed ");
+ sName = xName->getName();
+ }
+ else
+ {
+ // Userform control ( fired from the api or from event manager )
+ uno::Reference< beans::XPropertySet > xProps;
+ OSL_TRACE("Getting properties");
+ xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
+ }
}
//dumpEvent( evt );
EventInfoHash& infos = getEventTransInfo();
@@ -984,7 +991,6 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
eventInfo_it->second.begin();
std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
- StarBASIC* pBasic = mpShell->GetBasic();
BasicManager* pBasicManager = mpShell->GetBasicManager();
rtl::OUString sProject;
rtl::OUString sScriptCode( evt.ScriptCode );
diff --git a/vbahelper/prj/build.lst b/vbahelper/prj/build.lst
index 20001db..ded9ee2 100644
--- a/vbahelper/prj/build.lst
+++ b/vbahelper/prj/build.lst
@@ -1,4 +1,4 @@
-vba vbahelper : oovbaapi basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
+vba vbahelper : oovbaapi oox basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
vba vbahelper usr1 - all vba_mkout NULL
#vba vbahelper\inc nmake - all vba_inc NULL
vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 599ef33..fcc9a4a 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -573,23 +573,28 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
- pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
- pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
- pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ // #FIXME implement a page control
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
+ pControl = new ScVbaControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
+ pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
- pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
- pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else
throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
return pControl;
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 9afb602..55bc5b8 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -71,7 +71,19 @@ private:
mIndices[ msNames[ nIndex ] ] = nIndex;
}
}
-
+ void getNestedControls( ControlVec& vControls, uno::Reference< awt::XControlContainer >& xContainer )
+ {
+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
+ {
+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
+ vControls.push_back( *pCtrl );
+ if ( xC.is() )
+ getNestedControls( vControls, xC );
+ }
+ }
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index 46593a1..1ca77dc 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -29,14 +29,12 @@
#include <ooo/vba/XCollection.hpp>
#include "vbapages.hxx"
#include <vector>
+#include <com/sun/star/container/XNameContainer.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
-// uno servicename com.sun.star.awt.UnoControlProgressBarMode
-const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
-const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") );
-const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") );
+const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") );
typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
class PagesImpl : public PagesImpl_Base
@@ -72,8 +70,6 @@ ScVbaMultiPage::getPages( sal_Int32 nPages )
ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{
mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
- // set dialog step to value of multipage pseudo model
- setValue(getValue());
}
// Attributes
@@ -82,17 +78,17 @@ ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
{
sal_Int32 nValue = 0;
m_xProps->getPropertyValue( SVALUE ) >>= nValue;
- return nValue;
+ // VBA 0 based tab index
+ return nValue - 1;
}
void SAL_CALL
ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
{
- // track change in dialog ( dialog value is 1 based, 0 is a special value )
- sal_Int32 nVal = _value; // will be _value + 1 when cws container_controls is integrated
+ // Openoffice 1 based tab index
+ sal_Int32 nVal = _value + 1;
sal_Int32 nOldVal = getValue();
- m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
- mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
+ m_xProps->setPropertyValue( SVALUE, uno::makeAny( nVal ) );
if ( nVal != nOldVal )
fireChangeEvent();
}
@@ -108,9 +104,9 @@ ScVbaMultiPage::getServiceImplName()
uno::Any SAL_CALL
ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException)
{
- sal_Int32 nValue = 0;
- m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue;
- uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) );
+ // get the container model
+ uno::Reference< container::XNameContainer > xContainer( m_xProps, uno::UNO_QUERY_THROW );
+ uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( xContainer->getElementNames().getLength() ) ) );
if ( !index.hasValue() )
return uno::makeAny( xColl );
return xColl->Item( uno::makeAny( index ), uno::Any() );
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 1894d3c..ec3bcb7 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -31,6 +31,7 @@
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/beans/PropertyConcept.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbmeth.hxx>
@@ -42,7 +43,7 @@ using namespace ::com::sun::star;
// some little notes
// XDialog implementation has the following interesting bits
// a Controls property ( which is an array of the container controls )
-// each item in the controls array is a XControl, where the model is
+// each item in the controls array is a XControl, where the model is
// basically a property bag
// additionally the XDialog instance has itself a model
// this model has a ControlModels ( array of models ) property
@@ -63,7 +64,7 @@ ScVbaUserForm::~ScVbaUserForm()
{
}
-void SAL_CALL
+void SAL_CALL
ScVbaUserForm::Show( ) throw (uno::RuntimeException)
{
OSL_TRACE("ScVbaUserForm::Show( )");
@@ -79,7 +80,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW );
m_xDialog = NULL;
xComp->dispose();
- mbDispose = false;
+ mbDispose = false;
}
catch( uno::Exception& )
{
@@ -87,7 +88,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
}
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sCaption;
@@ -100,7 +101,7 @@ ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::
m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) );
}
-void SAL_CALL
+void SAL_CALL
ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
{
mbDispose = false; // hide not dispose
@@ -126,13 +127,13 @@ void SAL_CALL ScVbaUserForm::setVisible( sal_Bool bVisible ) throw (uno::Runtime
}
}
-void SAL_CALL
+void SAL_CALL
ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
{
// do nothing
}
-void SAL_CALL
+void SAL_CALL
ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException)
{
mbDispose = true;
@@ -140,14 +141,14 @@ ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException)
m_xDialog->endExecute();
}
-rtl::OUString&
+rtl::OUString&
ScVbaUserForm::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaUserForm::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -159,19 +160,19 @@ ScVbaUserForm::getServiceNames()
return aServiceNames;
}
-uno::Reference< beans::XIntrospectionAccess > SAL_CALL
+uno::Reference< beans::XIntrospectionAccess > SAL_CALL
ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException)
{
return uno::Reference< beans::XIntrospectionAccess >();
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaUserForm::invoke( const ::rtl::OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
{
throw uno::RuntimeException(); // unsupported operation
}
-void SAL_CALL
+void SAL_CALL
ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
{
uno::Any aObject = getValue( aPropertyName );
@@ -191,7 +192,31 @@ ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& a
}
}
-uno::Any SAL_CALL
+uno::Reference< awt::XControl >
+ScVbaUserForm::nestedSearch( const rtl::OUString& aPropertyName, uno::Reference< awt::XControlContainer >& xContainer )
+{
+ uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
+ if ( !xControl.is() )
+ {
+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
+
+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
+ {
+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
+ if ( xC.is() )
+ {
+ xControl.set( nestedSearch( aPropertyName, xC ) );
+ if ( xControl.is() )
+ break;
+ }
+ }
+ }
+ return xControl;
+}
+
+uno::Any SAL_CALL
ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
{
uno::Any aResult;
@@ -201,7 +226,8 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
{
uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
+ uno::Reference< awt::XControl > xControl = nestedSearch( aPropertyName, xContainer );
+ xContainer->getControl( aPropertyName );
ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
@@ -214,12 +240,12 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
return aResult;
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
{
return sal_False;
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
{
// if the dialog already closed we should do nothing, but the VBA will call methods of the Controls objects
@@ -231,17 +257,22 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
return uno::makeAny( xControls );
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
{
uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY );
+
OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() );
if ( xControl.is() )
{
- uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW );
- sal_Bool bRes = xNameAccess->hasByName( aName );
- OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes );
- return bRes;
+ uno::Reference< beans::XPropertySet > xDlgProps( xControl->getModel(), uno::UNO_QUERY );
+ if ( xDlgProps.is() )
+ {
+ uno::Reference< container::XNameContainer > xAllChildren( xDlgProps->getPropertyValue( rtl::OUString::createFromAscii("AllDialogChildren" ) ), uno::UNO_QUERY_THROW );
+ sal_Bool bRes = xAllChildren->hasByName( aName );
+ OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xAllChildren.is(), bRes );
+ return bRes;
+ }
}
return sal_False;
}
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 646ef38..625d1fa 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -31,6 +31,7 @@
#include <cppuhelper/implbase1.hxx>
#include <ooo/vba/msforms/XUserForm.hpp>
#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <vbahelper/vbahelperinterface.hxx>
@@ -49,6 +50,7 @@ protected:
public:
ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
virtual ~ScVbaUserForm();
+ static css::uno::Reference< css::awt::XControl > nestedSearch( const rtl::OUString& aPropertyName, css::uno::Reference< css::awt::XControlContainer >& xContainer );
virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
// XUserForm
diff --git a/xmlscript/source/xmldlg_imexp/common.hxx b/xmlscript/source/xmldlg_imexp/common.hxx
index d609b7a..8cb48d6 100644
--- a/xmlscript/source/xmldlg_imexp/common.hxx
+++ b/xmlscript/source/xmldlg_imexp/common.hxx
@@ -40,6 +40,7 @@ const sal_Int16 BORDER_SIMPLE_COLOR = 3;
}
+#define XMLSCRIPT_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index c88dab1..aaf6bd6 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -61,27 +61,27 @@ struct Style
// current highest mask: 0x40
short _all;
short _set;
-
+
::rtl::OUString _id;
-
+
inline Style( short all_ ) SAL_THROW( () )
: _fontRelief( css::awt::FontRelief::NONE )
, _fontEmphasisMark( css::awt::FontEmphasisMark::NONE )
, _all( all_ )
, _set( 0 )
{}
-
+
css::uno::Reference< css::xml::sax::XAttributeList > createElement();
};
class StyleBag
{
::std::vector< Style * > _styles;
-
+
public:
~StyleBag() SAL_THROW( () );
-
+
::rtl::OUString getStyleId( Style const & rStyle ) SAL_THROW( () );
-
+
void dump( css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >
const & xOut );
};
@@ -91,16 +91,18 @@ class ElementDescriptor
{
css::uno::Reference< css::beans::XPropertySet > _xProps;
css::uno::Reference< css::beans::XPropertyState > _xPropState;
-
+ css::uno::Reference< css::frame::XModel > _xDocument;
+
public:
inline ElementDescriptor(
css::uno::Reference< css::beans::XPropertySet > const & xProps,
css::uno::Reference< css::beans::XPropertyState > const & xPropState,
- ::rtl::OUString const & name )
+ ::rtl::OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument )
SAL_THROW( () )
: XMLElement( name )
, _xProps( xProps )
, _xPropState( xPropState )
+ , _xDocument( xDocument )
{}
inline ElementDescriptor(
::rtl::OUString const & name )
@@ -112,7 +114,7 @@ public:
inline void read(
::rtl::OUString const & propName, ::rtl::OUString const & attrName,
bool forceAttribute = false );
-
+
//
template<typename T>
inline bool readProp( T * ret, ::rtl::OUString const & rPropName );
@@ -137,11 +139,13 @@ public:
inline void readBoolAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName )
{ read<sal_Bool>( rPropName, rAttrName ); }
-
+
void readAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
void readVerticalAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
+ void readImageURLAttr(
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
void readImageAlignAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
void readImagePositionAttr(
@@ -159,6 +163,8 @@ public:
void readSelectionTypeAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
//
+ void readDataAwareAttr(
+ ::rtl::OUString const & rAttrName );
inline void addBoolAttr(
::rtl::OUString const & rAttrName, sal_Bool bValue )
{ addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); }
@@ -166,23 +172,29 @@ public:
css::uno::Reference< css::beans::XPropertySet >
const & xFormatProperties,
::rtl::OUString const & rAttrName );
-
+
//
void readEvents() SAL_THROW( (css::uno::Exception) );
//
void readDialogModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
+ void readBullitinBoard( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
void readMultiPageModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
+ void readFrameModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
+ void readPageModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
void readButtonModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readEditModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readCheckBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readRadioButtonModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readComboBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readCurrencyFieldModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
@@ -196,9 +208,9 @@ public:
SAL_THROW( (css::uno::Exception) );
void readGroupBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readImageControlModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readListBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readNumericFieldModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
@@ -212,9 +224,9 @@ public:
SAL_THROW( (css::uno::Exception) );
void readProgressBarModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readScrollBarModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ void readSpinButtonModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readFixedHyperLinkModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 27929a3..5523fe0 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -45,7 +45,7 @@
#include <com/sun/star/xml/input/XRoot.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <vector>
-
+#include <boost/shared_ptr.hpp>
namespace css = ::com::sun::star;
@@ -117,16 +117,19 @@ inline bool getLongAttr(
class ImportContext;
//==============================================================================
+typedef ::cppu::WeakImplHelper1< css::xml::input::XRoot > DialogImport_Base;
struct DialogImport
- : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
+ : DialogImport_Base
{
friend class ImportContext;
css::uno::Reference< css::uno::XComponentContext > _xContext;
css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
- ::std::vector< ::rtl::OUString > _styleNames;
- ::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles;
+ ::boost::shared_ptr< ::std::vector< ::rtl::OUString > > _pStyleNames;
+ ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles;
+ ::std::vector< ::rtl::OUString >& _styleNames;
+ ::std::vector< css::uno::Reference< css::xml::input::XElement > >& _styles;
css::uno::Reference< css::container::XNameContainer > _xDialogModel;
css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
@@ -166,13 +169,32 @@ public:
css::uno::Reference<css::uno::XComponentContext> const & xContext,
css::uno::Reference<css::container::XNameContainer>
const & xDialogModel,
+ ::boost::shared_ptr< ::std::vector< ::rtl::OUString > >& pStyleNames,
+ ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > >& pStyles,
css::uno::Reference<css::frame::XModel> const & xDoc )
SAL_THROW( () )
: _xContext( xContext )
+ , _pStyleNames( pStyleNames )
+ , _pStyles( pStyles )
+ , _styleNames( *_pStyleNames )
+ , _styles( *_pStyles )
, _xDialogModel( xDialogModel )
, _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
{ OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
_xContext.is() ); }
+ inline DialogImport( const DialogImport& rOther ) : DialogImport_Base()
+ , _xContext( rOther._xContext )
+ , _xSupplier( rOther._xSupplier )
+ , _pStyleNames( rOther._pStyleNames )
+ , _pStyles( rOther._pStyles )
+ , _styleNames( *_pStyleNames )
+ , _styles( *_pStyles )
+ , _xDialogModel( rOther._xDialogModel )
+ , _xDialogModelFactory( rOther._xDialogModelFactory )
+ , _xDoc( rOther._xDoc )
+ , XMLNS_DIALOGS_UID( rOther.XMLNS_DIALOGS_UID )
+ , XMLNS_SCRIPT_UID( rOther.XMLNS_SCRIPT_UID ) {}
+
virtual ~DialogImport()
SAL_THROW( () );
@@ -365,6 +387,9 @@ protected:
::rtl::OUString getControlId(
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ ::rtl::OUString getControlModelName(
+ rtl::OUString const& rDefaultModel,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
css::uno::Reference< css::xml::input::XElement > getStyle(
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
public:
@@ -435,6 +460,8 @@ public:
bool importVerticalAlignProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importImageURLProperty( rtl::OUString const & rPropName, rtl::OUString const & rAttrName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes );
bool importImageAlignProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
@@ -459,6 +486,9 @@ public:
bool importSelectionTypeProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+ bool importDataAwareProperty(
+ ::rtl::OUString const & rPropName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
};
//==============================================================================
@@ -474,6 +504,14 @@ public:
pImport->_xDialogModelFactory->createInstance( rControlName ),
css::uno::UNO_QUERY_THROW ), rId )
{}
+ inline ControlImportContext(
+ DialogImport * pImport,
+ const css::uno::Reference< css::beans::XPropertySet >& xProps, ::rtl::OUString const & rControlName )
+ : ImportContext(
+ pImport,
+ xProps,
+ rControlName )
+ {}
inline ~ControlImportContext()
{
_pImport->_xDialogModel->insertByName(
@@ -1004,6 +1042,7 @@ public:
};
//==============================================================================
+
class SpinButtonElement
: public ControlElement
{
@@ -1044,9 +1083,65 @@ public:
ElementBase * pParent, DialogImport * pImport )
SAL_THROW( () )
: ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {
+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ), css::uno::UNO_QUERY );
+ }
+private:
+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
+};
+
+//==============================================================================
+class Frame
+ : public ControlElement
+{
+ ::rtl::OUString _label;
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline Frame(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
{}
+private:
+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
};
+//==============================================================================
+class Page
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline Page(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {
+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ), css::uno::UNO_QUERY );
+ }
+private:
+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
+};
+
+
class ProgressBarElement
: public ControlElement
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index a2abb08..2d955fd 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -39,8 +39,7 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
#include <comphelper/componentcontext.hxx>
-#include <comphelper/processfactory.hxx>
-
+#include <com/sun/star/lang/XServiceInfo.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -49,66 +48,6 @@ using ::rtl::OUString;
namespace xmlscript
{
-void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-{
- Reference< lang::XMultiServiceFactory > xFac;
- if ( xDocument.is() )
- xFac.set( xDocument, uno::UNO_QUERY );
-
- Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-
- if ( xFac.is() && xBinding.is() )
- {
- try
- {
- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
- Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
- if ( xBindable.is() )
- {
- table::CellAddress aAddress;
- xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
- rtl::OUString sAddress;
- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
- if ( sAddress.getLength() > 0 )
- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-
- OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- }
- }
- catch( uno::Exception& )
- {
- }
- }
- Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
- if ( xEntrySink.is() )
- {
- Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
- if ( xListSource.is() )
- {
- try
- {
- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-
- table::CellRangeAddress aAddress;
- xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-
- rtl::OUString sAddress;
- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
- OSL_TRACE("**** cell range source list %s",
- rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
- if ( sAddress.getLength() > 0 )
- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
- }
- catch( uno::Exception& )
- {
- }
- }
- }
-
-}
static inline bool readBorderProps(
ElementDescriptor * element, Style & style )
{
@@ -138,7 +77,9 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
{
// collect styles
- Style aStyle( 0x2 | 0x8 | 0x20 );
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
aStyle._set |= 0x2;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
@@ -153,24 +94,101 @@ void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
// collect elements
readDefaults();
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
+ bool bDecoration = sal_True;
+ if ( (aDecorationAny >>= bDecoration) && !bDecoration )
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtabs") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+
+ readEvents();
+ uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
+ if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFrameModel( StyleBag * all_styles )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+/*
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+*/
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+ // collect elements
+ readDefaults();
OUString aTitle;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
+
+ if ( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
{
ElementDescriptor * title = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
aTitle );
addSubElement( title );
}
+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readPageModel( StyleBag * all_styles )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ rtl::OUString aTitle;
+ readStringAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
readEvents();
}
+
void ElementDescriptor::readButtonModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
@@ -204,8 +222,10 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+
+
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
@@ -275,8 +295,8 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
@@ -312,7 +332,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -354,7 +374,9 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
// Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
+
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -362,14 +384,14 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
{
ElementDescriptor * popup = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
OUString const * pItemValues = itemValues.getConstArray();
for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
{
ElementDescriptor * item = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
pItemValues[ nPos ] );
popup->addSubElement( item );
@@ -380,7 +402,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -415,7 +437,8 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -423,7 +446,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
{
ElementDescriptor * popup = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
OUString const * pItemValues = itemValues.getConstArray();
sal_Int32 nPos;
@@ -431,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
{
ElementDescriptor * item = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
pItemValues[ nPos ] );
popup->addSubElement( item );
@@ -455,7 +478,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -486,8 +509,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
@@ -513,7 +536,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
break;
}
}
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
@@ -542,7 +565,7 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
{
ElementDescriptor * title = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
aTitle );
addSubElement( title );
@@ -683,10 +706,11 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ),
OUString( &cEcho, 1 ) );
}
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -705,33 +729,10 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
- rtl::OUString sURL;
- _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-
- if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
- {
- Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
-
- if ( xDocStorage.is() )
- {
- uno::Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
- aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
- if ( xGraphicResolver.is() )
- {
- sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
- }
- }
- }
- if ( sURL.getLength() > 0 )
- {
- addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
- }
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
readEvents();
}
//__________________________________________________________________________________________________
@@ -1151,6 +1152,45 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
readEvents();
}
+
+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
+ readLongAttr( OUSTR("SpinValueMin"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readEvents();
+}
+
//__________________________________________________________________________________________________
void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
@@ -1206,7 +1246,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -1244,47 +1284,7 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< fr
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
- // Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
-}
-//__________________________________________________________________________________________________
-void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
-{
- // collect styles
- Style aStyle( 0x1 | 0x4 );
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
- aStyle._set |= 0x1;
- if (readBorderProps( this, aStyle ))
- aStyle._set |= 0x4;
- if (aStyle._set)
- {
- addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
- all_styles->getStyleId( aStyle ) );
- }
-
- // collect elements
- readDefaults();
- readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
- readLongAttr( OUSTR("SpinValueMin"),
- OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
- readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
- // Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
@@ -1340,6 +1340,251 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
readEvents();
}
+void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect elements
+ ::std::vector< ElementDescriptor* > all_elements;
+ // read out all props
+ Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
+ if ( !xDialogModel.is() )
+ return; // #TODO throw???
+ Sequence< OUString > aElements( xDialogModel->getElementNames() );
+ OUString const * pElements = aElements.getConstArray();
+
+ ElementDescriptor * pRadioGroup = 0;
+
+ sal_Int32 nPos;
+ for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
+ {
+ Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
+ Reference< beans::XPropertySet > xProps;
+ OSL_VERIFY( aControlModel >>= xProps );
+ if (! xProps.is())
+ continue;
+ Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
+ OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
+ if (! xPropState.is())
+ continue;
+ Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
+ OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
+ if (! xServiceInfo.is())
+ continue;
+
+ ElementDescriptor * pElem = 0;
+
+ // group up radio buttons
+ if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
+ {
+ if (! pRadioGroup) // open radiogroup
+ {
+ pRadioGroup = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ), _xDocument );
+ all_elements.push_back( pRadioGroup );
+ }
+
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ), _xDocument );
+ pElem->readRadioButtonModel( all_styles );
+ pRadioGroup->addSubElement( pElem );
+ }
+ else // no radio
+ {
+ pRadioGroup = 0; // close radiogroup
+
+ if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ), _xDocument );
+ pElem->readButtonModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ), _xDocument );
+ pElem->readCheckBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ), _xDocument );
+ pElem->readComboBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ), _xDocument );
+ pElem->readListBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ), _xDocument );
+ pElem->readGroupBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ), _xDocument );
+ pElem->readMultiPageModel( all_styles );
+ }
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list