[Libreoffice-commits] core.git: 2 commits - writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Aug 16 09:57:10 PDT 2014
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 50 +++++++++---------
writerfilter/source/ooxml/factoryimpl.py | 4 -
writerfilter/source/ooxml/factoryimpl_ns.py | 2
writerfilter/source/ooxml/model.xml | 48 ++++++++---------
writerfilter/source/ooxml/namespaceids.py | 2
5 files changed, 53 insertions(+), 53 deletions(-)
New commits:
commit e33f6f499f9eca9a558cec557b20557f714f1caf
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Aug 16 18:44:37 2014 +0200
Sync oox -> writerfilter alias for generic VML
See 656ab07b2924dd2703f31f460c8586c375c7878a (Sync oox -> writerfilter
alias for wordprocessingml, 2014-08-10).
Change-Id: I5179961b683473a502693923422171bb274fc845
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 3a09641..158c614 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1804,7 +1804,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
{
case NMSP_doc:
case NMSP_vml_wordprocessingDrawing:
- case NMSP_office:
+ case NMSP_vmlOffice:
if (!bGroupShape)
xContextHandler.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
// no break;
@@ -1823,7 +1823,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
{
pWrapper->addNamespace(NMSP_doc);
pWrapper->addNamespace(NMSP_vml_wordprocessingDrawing);
- pWrapper->addNamespace(NMSP_office);
+ pWrapper->addNamespace(NMSP_vmlOffice);
pWrapper->addToken( NMSP_vml|XML_textbox );
}
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index ccabb1b..35fb03e 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -20,7 +20,7 @@
<namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml"/>
<namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="officeRel"/>
<namespace-alias name="http://purl.oclc.org/ooxml/officeDocument/relationships" alias="officeRel"/>
- <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office"/>
+ <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="vmlOffice"/>
<namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme"/>
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing"/>
<namespace-alias name="http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing" alias="wordprocessingDrawing"/>
@@ -10431,35 +10431,35 @@
<action name="end" action="handleOLE"/>
</resource>
<resource name="ST_Angle" resource="List">
- <value tokenid="ooxml:Value_office_ST_Angle_any">any</value>
- <value tokenid="ooxml:Value_office_ST_Angle_30">30</value>
- <value tokenid="ooxml:Value_office_ST_Angle_45">45</value>
- <value tokenid="ooxml:Value_office_ST_Angle_60">60</value>
- <value tokenid="ooxml:Value_office_ST_Angle_90">90</value>
- <value tokenid="ooxml:Value_office_ST_Angle_auto">auto</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_any">any</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_30">30</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_45">45</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_60">60</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_90">90</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_Angle_auto">auto</value>
</resource>
<resource name="ST_OLELinkType" resource="List">
- <value tokenid="ooxml:Value_office_ST_OLELinkType_Picture">Picture</value>
- <value tokenid="ooxml:Value_office_ST_OLELinkType_Bitmap">Bitmap</value>
- <value tokenid="ooxml:Value_office_ST_OLELinkType_EnhancedMetaFile">EnhancedMetaFile</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_OLELinkType_Picture">Picture</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_OLELinkType_Bitmap">Bitmap</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_OLELinkType_EnhancedMetaFile">EnhancedMetaFile</value>
</resource>
<resource name="ST_TrueFalseBlank" resource="List">
- <value tokenid="ooxml:Value_office_ST_TrueFalseBlank_"/>
- <value tokenid="ooxml:Value_office_ST_TrueFalseBlank_t">t</value>
- <value tokenid="ooxml:Value_office_ST_TrueFalseBlank_f">f</value>
- <value tokenid="ooxml:Value_office_ST_TrueFalseBlank_true">true</value>
- <value tokenid="ooxml:Value_office_ST_TrueFalseBlank_false">false</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_TrueFalseBlank_"/>
+ <value tokenid="ooxml:Value_vmlOffice_ST_TrueFalseBlank_t">t</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_TrueFalseBlank_f">f</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_TrueFalseBlank_true">true</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_TrueFalseBlank_false">false</value>
</resource>
<resource name="ST_FillType" resource="List">
- <value tokenid="ooxml:Value_office_ST_FillType_gradientCenter">gradientCenter</value>
- <value tokenid="ooxml:Value_office_ST_FillType_solid">solid</value>
- <value tokenid="ooxml:Value_office_ST_FillType_pattern">pattern</value>
- <value tokenid="ooxml:Value_office_ST_FillType_tile">tile</value>
- <value tokenid="ooxml:Value_office_ST_FillType_frame">frame</value>
- <value tokenid="ooxml:Value_office_ST_FillType_gradientUnscaled">gradientUnscaled</value>
- <value tokenid="ooxml:Value_office_ST_FillType_gradientRadial">gradientRadial</value>
- <value tokenid="ooxml:Value_office_ST_FillType_gradient">gradient</value>
- <value tokenid="ooxml:Value_office_ST_FillType_background">background</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_gradientCenter">gradientCenter</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_solid">solid</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_pattern">pattern</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_tile">tile</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_frame">frame</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_gradientUnscaled">gradientUnscaled</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_gradientRadial">gradientRadial</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_gradient">gradient</value>
+ <value tokenid="ooxml:Value_vmlOffice_ST_FillType_background">background</value>
</resource>
</namespace>
<namespace name="mce">
commit 28bf20625cfcd3b3e4492e873471e26ded880080
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Aug 16 18:37:51 2014 +0200
Sync oox -> writerfilter namespace prefixes
Change-Id: Ifbcb7716640cd05d4b98eef22f9ddf49f3bd79aa
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 802dbb5..3a09641 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -217,7 +217,7 @@ void SAL_CALL OOXMLFastContextHandler::startFastElement
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
{
- if (oox::getNamespace(Element) == static_cast<sal_Int32>(NS_mce))
+ if (oox::getNamespace(Element) == static_cast<sal_Int32>(NMSP_mce))
m_bDiscardChildren = prepareMceContext(Element, Attribs);
else if (!m_bDiscardChildren)
@@ -237,9 +237,9 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
void SAL_CALL OOXMLFastContextHandler::endFastElement(Token_t Element)
throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
{
- if (Element == (NS_mce | XML_Choice) || Element == (NS_mce | XML_Fallback))
+ if (Element == (NMSP_mce | XML_Choice) || Element == (NMSP_mce | XML_Fallback))
m_bDiscardChildren = false;
- else if (Element == (NS_mce | XML_AlternateContent))
+ else if (Element == (NMSP_mce | XML_AlternateContent))
{
SavedAlternateState aState(mpParserState->getSavedAlternateStates().back());
mpParserState->getSavedAlternateStates().pop_back();
@@ -256,9 +256,9 @@ void OOXMLFastContextHandler::lcl_startFastElement
throw (uno::RuntimeException, xml::sax::SAXException)
{
OOXMLFactory::getInstance()->startAction(this, Element);
- if( Element == (NS_wordprocessingDrawing|XML_positionV) )
+ if( Element == (NMSP_wordprocessingDrawing|XML_positionV) )
inPositionV = true;
- else if( Element == (NS_wordprocessingDrawing|XML_positionH) )
+ else if( Element == (NMSP_wordprocessingDrawing|XML_positionH) )
inPositionV = false;
}
@@ -283,9 +283,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
{
uno::Reference< xml::sax::XFastContextHandler > xResult;
- if ((Element & 0xffff0000) != NS_mce && !m_bDiscardChildren)
+ if ((Element & 0xffff0000) != NMSP_mce && !m_bDiscardChildren)
xResult.set(lcl_createFastChildContext(Element, Attribs));
- else if ((Element & 0xffff0000) == NS_mce)
+ else if ((Element & 0xffff0000) == NMSP_mce)
xResult = this;
return xResult;
@@ -1143,13 +1143,13 @@ void OOXMLFastContextHandlerProperties::handleXNotes()
{
switch (mnToken)
{
- case NS_doc|XML_footnoteReference:
+ case NMSP_doc|XML_footnoteReference:
{
OOXMLFootnoteHandler aFootnoteHandler(this);
mpPropertySet->resolve(aFootnoteHandler);
}
break;
- case NS_doc|XML_endnoteReference:
+ case NMSP_doc|XML_endnoteReference:
{
OOXMLEndnoteHandler aEndnoteHandler(this);
mpPropertySet->resolve(aEndnoteHandler);
@@ -1164,13 +1164,13 @@ void OOXMLFastContextHandlerProperties::handleHdrFtr()
{
switch (mnToken)
{
- case NS_doc|XML_footerReference:
+ case NMSP_doc|XML_footerReference:
{
OOXMLFooterHandler aFooterHandler(this);
mpPropertySet->resolve(aFooterHandler);
}
break;
- case NS_doc|XML_headerReference:
+ case NMSP_doc|XML_headerReference:
{
OOXMLHeaderHandler aHeaderHandler(this);
mpPropertySet->resolve(aHeaderHandler);
@@ -1748,7 +1748,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
newProperty(NS_ooxml::LN_shape, pValue);
m_bShapeSent = true;
- bool bIsPicture = Element == ( NS_picture | XML_pic );
+ bool bIsPicture = Element == ( NMSP_picture | XML_pic );
// Notify the dmapper that the shape is ready to use
if ( !bIsPicture )
@@ -1773,7 +1773,7 @@ void OOXMLFastContextHandlerShape::lcl_endFastElement
OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
// Ending the shape should be the last thing to do
- bool bIsPicture = Element == ( NS_picture | XML_pic );
+ bool bIsPicture = Element == ( NMSP_picture | XML_pic );
if ( !bIsPicture && m_bShapeStarted)
mpStream->endShape( );
}
@@ -1795,16 +1795,16 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
{
uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
- bool bGroupShape = Element == Token_t(NS_vml | XML_group);
+ bool bGroupShape = Element == Token_t(NMSP_vml | XML_group);
// drawingML version also counts as a group shape.
- bGroupShape |= mrShapeContext->getStartToken() == Token_t(NS_wpg | XML_wgp);
+ bGroupShape |= mrShapeContext->getStartToken() == Token_t(NMSP_wpg | XML_wgp);
sal_uInt32 nNamespace = Element & 0xffff0000;
switch (nNamespace)
{
- case NS_doc:
- case NS_vml_wordprocessingDrawing:
- case NS_office:
+ case NMSP_doc:
+ case NMSP_vml_wordprocessingDrawing:
+ case NMSP_office:
if (!bGroupShape)
xContextHandler.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
// no break;
@@ -1821,10 +1821,10 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
if (!bGroupShape)
{
- pWrapper->addNamespace(NS_doc);
- pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
- pWrapper->addNamespace(NS_office);
- pWrapper->addToken( NS_vml|XML_textbox );
+ pWrapper->addNamespace(NMSP_doc);
+ pWrapper->addNamespace(NMSP_vml_wordprocessingDrawing);
+ pWrapper->addNamespace(NMSP_office);
+ pWrapper->addToken( NMSP_vml|XML_textbox );
}
xContextHandler.set(pWrapper);
@@ -1839,8 +1839,8 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
// OOXMLFastContextHandlerWrapper::lcl_createFastChildContext(), here we
// handle the WPS import of shape text, as there the parent context is a
// Shape one, so a different situation.
- if (Element == static_cast<sal_Int32>(NS_wps | XML_txbx) ||
- Element == static_cast<sal_Int32>(NS_wps | XML_linkedTxbx) )
+ if (Element == static_cast<sal_Int32>(NMSP_wps | XML_txbx) ||
+ Element == static_cast<sal_Int32>(NMSP_wps | XML_linkedTxbx) )
sendShape(Element);
return xContextHandler;
@@ -1989,7 +1989,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
// processed by writerfilter (instead of oox), but we have no method to
// filter out a single token. Just hardwire the wrap token here till we
// need a more generic solution.
- bool bIsWrap = Element == static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | XML_wrap);
+ bool bIsWrap = Element == static_cast<sal_Int32>(NMSP_vml_wordprocessingDrawing | XML_wrap);
if ( bInNamespaces && ((pShapeCtx->isShapeSent() && bIsWrap) || !bIsWrap) )
xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
else if (mxContext.is())
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 8e7e74d..c527ef2 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -129,7 +129,7 @@ string fastTokenToId(sal_uInt32 nToken)
for alias in [a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]:
if not alias in aliases:
aliases.append(alias)
- print(""" case NS_%s:
+ print(""" case NMSP_%s:
sResult += "%s:";
break;""" % (alias, alias))
print(""" }
@@ -161,7 +161,7 @@ def getFastParser(model):
mxFastParser = css::xml::sax::FastParser::create(mxContext);
""")
for alias in model.getElementsByTagName("namespace-alias"):
- print(""" mxFastParser->registerNamespace("%s", NS_%s);""" % (alias.getAttribute("name"), alias.getAttribute("alias")))
+ print(""" mxFastParser->registerNamespace("%s", NMSP_%s);""" % (alias.getAttribute("name"), alias.getAttribute("alias")))
print(""" }
return mxFastParser;
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index c088ac7..03136dc 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -110,7 +110,7 @@ def idForDefine(nsNode, defineNode):
def fastNamespace(attrNode):
- return "NS_%s" % attrNode.getAttribute("prefix")
+ return "NMSP_%s" % attrNode.getAttribute("prefix")
def fastLocalName(attrNode):
diff --git a/writerfilter/source/ooxml/namespaceids.py b/writerfilter/source/ooxml/namespaceids.py
index 2135b48..151e809 100644
--- a/writerfilter/source/ooxml/namespaceids.py
+++ b/writerfilter/source/ooxml/namespaceids.py
@@ -41,7 +41,7 @@ using namespace ::com::sun::star;
def startElement(self, name, attrs):
if name == "namespace-alias":
- token = """const sal_uInt32 NS_%s = %s;""" % (attrs["alias"], attrs["id"])
+ token = """const sal_Int32 NMSP_%s = %s;""" % (attrs["alias"], attrs["id"])
if token not in self.tokens:
self.tokens.append(token)
print(token)
More information about the Libreoffice-commits
mailing list