2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-12 17:21:24 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-12-19 17:56:47 +00:00
|
|
|
|
|
|
|
#include "XMLStarBasicExportHandler.hxx"
|
|
|
|
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
2007-06-27 14:21:43 +00:00
|
|
|
#include <xmloff/xmlexp.hxx>
|
|
|
|
#include <xmloff/xmltoken.hxx>
|
|
|
|
#include <xmloff/nmspmap.hxx>
|
2013-11-11 22:30:35 -06:00
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
2000-12-19 17:56:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
2000-12-19 17:56:47 +00:00
|
|
|
|
|
|
|
using ::com::sun::star::beans::PropertyValue;
|
|
|
|
|
|
|
|
|
|
|
|
XMLStarBasicExportHandler::XMLStarBasicExportHandler() :
|
2013-02-26 20:17:25 +01:00
|
|
|
sStarBasic("StarBasic"),
|
|
|
|
sLibrary("Library"),
|
|
|
|
sMacroName("MacroName"),
|
|
|
|
sStarOffice("StarOffice"),
|
|
|
|
sApplication("application")
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLStarBasicExportHandler::~XMLStarBasicExportHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLStarBasicExportHandler::Export(
|
|
|
|
SvXMLExport& rExport,
|
2004-07-13 07:17:50 +00:00
|
|
|
const OUString& rEventQName,
|
2000-12-19 17:56:47 +00:00
|
|
|
Sequence<PropertyValue> & rValues,
|
2014-03-28 16:28:51 +02:00
|
|
|
bool bUseWhitespace)
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
2004-07-13 07:17:50 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
|
|
|
|
rExport.GetNamespaceMap().GetQNameByKey(
|
|
|
|
XML_NAMESPACE_OOO, sStarBasic ) );
|
|
|
|
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, rEventQName);
|
2000-12-19 17:56:47 +00:00
|
|
|
|
2004-07-13 07:17:50 +00:00
|
|
|
OUString sLocation, sName;
|
2000-12-19 17:56:47 +00:00
|
|
|
sal_Int32 nCount = rValues.getLength();
|
|
|
|
for(sal_Int32 i = 0; i < nCount; i++)
|
|
|
|
{
|
|
|
|
if (sLibrary.equals(rValues[i].Name))
|
|
|
|
{
|
|
|
|
OUString sTmp;
|
|
|
|
rValues[i].Value >>= sTmp;
|
2004-07-13 07:17:50 +00:00
|
|
|
sLocation = GetXMLToken(
|
|
|
|
(sTmp.equalsIgnoreAsciiCase(sApplication) ||
|
|
|
|
sTmp.equalsIgnoreAsciiCase(sStarOffice) ) ? XML_APPLICATION
|
|
|
|
: XML_DOCUMENT );
|
2000-12-19 17:56:47 +00:00
|
|
|
}
|
|
|
|
else if (sMacroName.equals(rValues[i].Name))
|
|
|
|
{
|
2004-07-13 07:17:50 +00:00
|
|
|
rValues[i].Value >>= sName;
|
2000-12-19 17:56:47 +00:00
|
|
|
}
|
|
|
|
// else: disregard
|
|
|
|
}
|
|
|
|
|
2012-01-25 21:59:48 -02:00
|
|
|
if( !sLocation.isEmpty() )
|
2004-07-13 07:17:50 +00:00
|
|
|
{
|
|
|
|
OUStringBuffer sTmp( sLocation.getLength() + sName.getLength() + 1 );
|
|
|
|
sTmp = sLocation;
|
2013-11-13 12:10:31 +02:00
|
|
|
sTmp.append( ':' );
|
2004-07-13 07:17:50 +00:00
|
|
|
sTmp.append( sName );
|
|
|
|
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
|
|
|
|
sTmp.makeStringAndClear());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, sName );
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT,
|
|
|
|
XML_EVENT_LISTENER,
|
2014-03-28 16:28:51 +02:00
|
|
|
bUseWhitespace, false);
|
2000-12-19 17:56:47 +00:00
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|