- added: import and export of document events

This commit is contained in:
Daniel Vogelheim 2001-02-21 19:30:19 +00:00
parent e4c5be3d85
commit a18bcee992
3 changed files with 46 additions and 12 deletions

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: xmlexp.cxx,v $ * $RCSfile: xmlexp.cxx,v $
* *
* $Revision: 1.35 $ * $Revision: 1.36 $
* *
* last change: $Author: sab $ $Date: 2001-02-14 06:24:00 $ * last change: $Author: dvo $ $Date: 2001-02-21 20:30:19 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -129,6 +129,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_ #ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
#include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XIndexContainer.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
#endif
#ifndef _XMLOFF_GRADIENTSTYLE_HXX #ifndef _XMLOFF_GRADIENTSTYLE_HXX
#include <GradientStyle.hxx> #include <GradientStyle.hxx>
@ -636,6 +639,10 @@ void SvXMLExport::_ExportScripts()
XMLBasicExport aBasicExp( *this ); XMLBasicExport aBasicExp( *this );
aBasicExp.Export(); aBasicExp.Export();
// export document events
Reference<document::XEventsSupplier> xEvents(GetModel(), UNO_QUERY);
GetEventExport().Export(xEvents, sal_True);
} }
void SvXMLExport::_ExportFontDecls() void SvXMLExport::_ExportFontDecls()

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: XMLEventExport.cxx,v $ * $RCSfile: XMLEventExport.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: dvo $ $Date: 2001-02-06 14:00:16 $ * last change: $Author: dvo $ $Date: 2001-02-21 20:30:19 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -194,10 +194,9 @@ void XMLEventExport::Export( Reference<XNameAccess> & rAccess,
for(sal_Int32 i = 0; i < nCount; i++) for(sal_Int32 i = 0; i < nCount; i++)
{ {
// translate name // translate name
OUString sXmlName;
if (aNameTranslationMap.count(aNames[i])) if (aNameTranslationMap.count(aNames[i]))
{ {
sXmlName = aNameTranslationMap[aNames[i]]; OUString sXmlName = aNameTranslationMap[aNames[i]];
// get PropertyValues for this event // get PropertyValues for this event
Any aAny = rAccess->getByName( aNames[i] ); Any aAny = rAccess->getByName( aNames[i] );
@ -298,7 +297,7 @@ const XMLEventNameTranslation aStandardEventTable[] =
{ "OnNonAlphaCharInput", "on-non-alpha-char-input" }, { "OnNonAlphaCharInput", "on-non-alpha-char-input" },
{ "OnResize", "on-resize" }, { "OnResize", "on-resize" },
{ "OnMove", "on-move" }, { "OnMove", "on-move" },
{ "PageCountChange", "page-count-change" }, { "OnPageCountChange", "page-count-change" },
{ "OnMouseOver", "on-mouse-over" }, { "OnMouseOver", "on-mouse-over" },
{ "OnClick", "on-click" }, { "OnClick", "on-click" },
{ "OnMouseOut", "on-mouse-out" }, { "OnMouseOut", "on-mouse-out" },

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: xmlscripti.cxx,v $ * $RCSfile: xmlscripti.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: dvo $ $Date: 2000-12-19 18:53:01 $ * last change: $Author: dvo $ $Date: 2001-02-21 20:30:19 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -68,17 +68,20 @@
#include "xmlkywd.hxx" #include "xmlkywd.hxx"
#include "xmlimp.hxx" #include "xmlimp.hxx"
#include "nmspmap.hxx" #include "nmspmap.hxx"
#include "XMLEventsImportContext.hxx"
#include <com/sun/star/script/XStarBasicAccess.hpp> #include <com/sun/star/script/XStarBasicAccess.hpp>
#include <com/sun/star/script/XStarBasicModuleInfo.hpp> #include <com/sun/star/script/XStarBasicModuleInfo.hpp>
#include <com/sun/star/script/XStarBasicDialogInfo.hpp> #include <com/sun/star/script/XStarBasicDialogInfo.hpp>
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp> #include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
using namespace rtl; using namespace rtl;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star::lang; using namespace com::sun::star::lang;
using namespace com::sun::star::frame; using namespace com::sun::star::frame;
using namespace com::sun::star::script; using namespace com::sun::star::script;
using namespace com::sun::star::document;
using namespace com::sun::star::xml::sax; using namespace com::sun::star::xml::sax;
@ -315,7 +318,7 @@ void XMLScriptModuleContext::Characters( const rtl::OUString& rChars )
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// //
// context for <office:meta> element // context for <office:script> element
// //
XMLScriptContext::XMLScriptContext( SvXMLImport& rImport, sal_uInt16 nPrfx, XMLScriptContext::XMLScriptContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
@ -337,8 +340,33 @@ SvXMLImportContext* XMLScriptContext::CreateChildContext( sal_uInt16 nPrefix,
const Reference<XAttributeList>& xAttrList ) const Reference<XAttributeList>& xAttrList )
{ {
SvXMLImportContext* pContext = NULL; SvXMLImportContext* pContext = NULL;
pContext = new XMLScriptElementContext( GetImport(),
nPrefix, rLName, xAttrList, *this, mxBasicAccess ); if (XML_NAMESPACE_SCRIPT == nPrefix)
{
if( rLName.equalsAsciiL( sXML_library_embedded,
sizeof(sXML_library_embedded)-1 ) ||
rLName.equalsAsciiL( sXML_library_linked,
sizeof(sXML_library_linked)-1 ) )
{
pContext = new XMLScriptElementContext(
GetImport(), nPrefix, rLName, xAttrList, *this, mxBasicAccess);
}
}
else if (XML_NAMESPACE_OFFICE == nPrefix)
{
if ( rLName.equalsAsciiL(sXML_events, sizeof(sXML_events)-1) )
{
Reference<XEventsSupplier> xSupplier(GetImport().GetModel(),
UNO_QUERY);
pContext = new XMLEventsImportContext(GetImport(), nPrefix, rLName,
xSupplier);
}
}
if (NULL == pContext)
pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLName,
xAttrList);
return pContext; return pContext;
} }