summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-01 13:38:47 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-01 13:38:47 +0100
commitc88c53c4b17a67fe700874a87c87d7f69603e156 (patch)
treeb6d0d076aa76870d784c40e8b685255b2333fb80 /oox
parent76d2d78ac48c0ec7fcdc27c841d0777cab732464 (diff)
oox: introduce W_TOKEN() macro
It was inconsistent that when parsing <a:foo> elements, A_TOKEN(foo) was available, but for <w:foo> elements there was no W_TOKEN() macro. Also, there were two manual variants (NMSP_doc|XML_foo or via OOX_TOKEN(doc, foo)), replace both of them with W_TOKEN() for easier searching. Change-Id: Ic5cd027f07518535b92671ffe3c486016a3f9f0a
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/textbodycontext.cxx32
-rw-r--r--oox/source/drawingml/textcharacterpropertiescontext.cxx58
-rw-r--r--oox/source/drawingml/textparagraphpropertiescontext.cxx22
-rw-r--r--oox/source/token/namespaces.hxx.tail1
-rw-r--r--oox/source/vml/vmltextboxcontext.cxx52
5 files changed, 83 insertions, 82 deletions
diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx
index 4154e1bb727a..7766296d8f87 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -58,7 +58,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken
switch( aElementToken )
{
case A_TOKEN( r ): // "CT_RegularTextRun" Regular Text Run.
- case OOX_TOKEN( doc, r ):
+ case W_TOKEN( r ):
{
TextRunPtr pRun( new TextRun );
mrParagraph.addRun( pRun );
@@ -78,16 +78,16 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken
return new TextFieldContext( *this, rAttribs, *pField );
}
case A_TOKEN( pPr ):
- case OOX_TOKEN( doc, pPr ):
+ case W_TOKEN( pPr ):
return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties() );
case A_TOKEN( endParaRPr ):
return new TextCharacterPropertiesContext( *this, rAttribs, mrParagraph.getEndProperties() );
- case OOX_TOKEN( doc, sdt ):
- case OOX_TOKEN( doc, sdtContent ):
+ case W_TOKEN( sdt ):
+ case W_TOKEN( sdtContent ):
return this;
- case OOX_TOKEN( doc, del ):
+ case W_TOKEN( del ):
break;
- case OOX_TOKEN( doc, ins ):
+ case W_TOKEN( ins ):
return this;
break;
default:
@@ -109,7 +109,7 @@ void RegularTextRunContext::onEndElement( )
switch( getCurrentElement() )
{
case A_TOKEN( t ):
- case OOX_TOKEN( doc, t ):
+ case W_TOKEN( t ):
{
mbIsInText = false;
break;
@@ -135,13 +135,13 @@ ContextHandlerRef RegularTextRunContext::onCreateContext( sal_Int32 aElementToke
switch( aElementToken )
{
case A_TOKEN( rPr ): // "CT_TextCharPropertyBag" The text char properties of this text run.
- case OOX_TOKEN( doc, rPr ):
+ case W_TOKEN( rPr ):
return new TextCharacterPropertiesContext( *this, rAttribs, mpRunPtr->getTextCharacterProperties() );
case A_TOKEN( t ): // "xsd:string" minOccurs="1" The actual text string.
- case OOX_TOKEN( doc, t ):
+ case W_TOKEN( t ):
mbIsInText = true;
break;
- case OOX_TOKEN( doc, drawing ):
+ case W_TOKEN( drawing ):
break;
default:
SAL_WARN("oox", "RegularTextRunContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
@@ -166,15 +166,15 @@ ContextHandlerRef TextBodyContext::onCreateContext( sal_Int32 aElementToken, con
case A_TOKEN( lstStyle ): // CT_TextListStyle
return new TextListStyleContext( *this, mrTextBody.getTextListStyle() );
case A_TOKEN( p ): // CT_TextParagraph
- case OOX_TOKEN( doc, p ):
+ case W_TOKEN( p ):
return new TextParagraphContext( *this, mrTextBody.addParagraph() );
- case OOX_TOKEN( doc, sdt ):
- case OOX_TOKEN( doc, sdtContent ):
+ case W_TOKEN( sdt ):
+ case W_TOKEN( sdtContent ):
return this;
- case OOX_TOKEN( doc, sdtPr ):
- case OOX_TOKEN( doc, sdtEndPr ):
+ case W_TOKEN( sdtPr ):
+ case W_TOKEN( sdtEndPr ):
break;
- case OOX_TOKEN( doc, tbl ):
+ case W_TOKEN( tbl ):
break;
default:
SAL_WARN("oox", "TextBodyContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 87d884e98948..22413062fb17 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -136,67 +136,67 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
case A_TOKEN( gradFill ):
return new GradientFillContext( *this, rAttribs, mrTextCharacterProperties.maGradientProps );
- case OOX_TOKEN( doc, rFonts ):
- if( rAttribs.hasAttribute(OOX_TOKEN(doc, ascii)) )
+ case W_TOKEN( rFonts ):
+ if( rAttribs.hasAttribute(W_TOKEN(ascii)) )
{
- mrTextCharacterProperties.maLatinFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, ascii), OUString()));
+ mrTextCharacterProperties.maLatinFont.setAttributes(rAttribs.getString(W_TOKEN(ascii), OUString()));
}
- if (rAttribs.hasAttribute(OOX_TOKEN(doc, asciiTheme)))
+ if (rAttribs.hasAttribute(W_TOKEN(asciiTheme)))
{
- mrTextCharacterProperties.maLatinThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, asciiTheme), OUString()));
+ mrTextCharacterProperties.maLatinThemeFont.setAttributes(rAttribs.getString(W_TOKEN(asciiTheme), OUString()));
}
- if( rAttribs.hasAttribute(OOX_TOKEN(doc, cs)) )
+ if( rAttribs.hasAttribute(W_TOKEN(cs)) )
{
- mrTextCharacterProperties.maComplexFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, cs), OUString()));
+ mrTextCharacterProperties.maComplexFont.setAttributes(rAttribs.getString(W_TOKEN(cs), OUString()));
}
- if (rAttribs.hasAttribute(OOX_TOKEN(doc, cstheme)))
+ if (rAttribs.hasAttribute(W_TOKEN(cstheme)))
{
- mrTextCharacterProperties.maComplexThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, cstheme), OUString()));
+ mrTextCharacterProperties.maComplexThemeFont.setAttributes(rAttribs.getString(W_TOKEN(cstheme), OUString()));
}
- if( rAttribs.hasAttribute(OOX_TOKEN(doc, eastAsia)) )
+ if( rAttribs.hasAttribute(W_TOKEN(eastAsia)) )
{
- mrTextCharacterProperties.maAsianFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, eastAsia), OUString()));
+ mrTextCharacterProperties.maAsianFont.setAttributes(rAttribs.getString(W_TOKEN(eastAsia), OUString()));
}
- if (rAttribs.hasAttribute(OOX_TOKEN(doc, eastAsiaTheme)))
+ if (rAttribs.hasAttribute(W_TOKEN(eastAsiaTheme)))
{
- mrTextCharacterProperties.maAsianThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, eastAsiaTheme), OUString()));
+ mrTextCharacterProperties.maAsianThemeFont.setAttributes(rAttribs.getString(W_TOKEN(eastAsiaTheme), OUString()));
}
break;
- case OOX_TOKEN( doc, b ):
- mrTextCharacterProperties.moBold = rAttribs.getBool(OOX_TOKEN( doc, val ), true);
+ case W_TOKEN( b ):
+ mrTextCharacterProperties.moBold = rAttribs.getBool(W_TOKEN( val ), true);
break;
- case OOX_TOKEN( doc, i ):
- mrTextCharacterProperties.moItalic = rAttribs.getBool(OOX_TOKEN( doc, val ), true);
+ case W_TOKEN( i ):
+ mrTextCharacterProperties.moItalic = rAttribs.getBool(W_TOKEN( val ), true);
break;
- case OOX_TOKEN( doc, bCs ):
+ case W_TOKEN( bCs ):
break;
- case OOX_TOKEN( doc, color ):
- if (rAttribs.getInteger(OOX_TOKEN(doc, val)).has())
+ case W_TOKEN( color ):
+ if (rAttribs.getInteger(W_TOKEN(val)).has())
{
- mrTextCharacterProperties.maCharColor.setSrgbClr(rAttribs.getIntegerHex(OOX_TOKEN(doc, val)).get());
+ mrTextCharacterProperties.maCharColor.setSrgbClr(rAttribs.getIntegerHex(W_TOKEN(val)).get());
}
break;
- case OOX_TOKEN( doc, sz ):
- if (rAttribs.getInteger(OOX_TOKEN(doc, val)).has())
+ case W_TOKEN( sz ):
+ if (rAttribs.getInteger(W_TOKEN(val)).has())
{
- sal_Int32 nVal = rAttribs.getInteger(OOX_TOKEN(doc, val)).get();
+ sal_Int32 nVal = rAttribs.getInteger(W_TOKEN(val)).get();
// wml has half points, dml has hundred points
mrTextCharacterProperties.moHeight = nVal * 50;
}
break;
- case OOX_TOKEN( doc, szCs ):
+ case W_TOKEN( szCs ):
break;
- case OOX_TOKEN( doc, caps ):
+ case W_TOKEN( caps ):
{
- if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) )
+ if( rAttribs.getBool(W_TOKEN( val ), true) )
mrTextCharacterProperties.moCaseMap = XML_all;
else
mrTextCharacterProperties.moCaseMap = XML_none;
}
break;
- case OOX_TOKEN( doc, smallCaps ):
+ case W_TOKEN( smallCaps ):
{
- if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) )
+ if( rAttribs.getBool(W_TOKEN( val ), true) )
mrTextCharacterProperties.moCaseMap = XML_small;
else
mrTextCharacterProperties.moCaseMap = XML_none;
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 6c01a0a0e06e..6d51ee5ca537 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -238,9 +238,9 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
return new TextTabStopListContext( *this, maTabList );
case A_TOKEN( defRPr ): // CT_TextCharacterProperties
return new TextCharacterPropertiesContext( *this, rAttribs, mrTextParagraphProperties.getTextCharacterProperties() );
- case OOX_TOKEN( doc, jc ):
+ case W_TOKEN( jc ):
{
- OptValue< OUString > oParaAdjust = rAttribs.getString( OOX_TOKEN(doc, val) );
+ OptValue< OUString > oParaAdjust = rAttribs.getString( W_TOKEN(val) );
if( oParaAdjust.has() && !oParaAdjust.get().isEmpty() )
{
const OUString& sParaAdjust = oParaAdjust.get();
@@ -255,12 +255,12 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
}
}
break;
- case OOX_TOKEN( doc, spacing ):
+ case W_TOKEN( spacing ):
{
// Spacing before
- if( !rAttribs.getBool(OOX_TOKEN(doc, beforeAutospacing), false) )
+ if( !rAttribs.getBool(W_TOKEN(beforeAutospacing), false) )
{
- OptValue<sal_Int32> oBefore = rAttribs.getInteger(OOX_TOKEN(doc, before));
+ OptValue<sal_Int32> oBefore = rAttribs.getInteger(W_TOKEN(before));
if (oBefore.has())
{
TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin();
@@ -270,7 +270,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
}
else
{
- OptValue<sal_Int32> oBeforeLines = rAttribs.getInteger(OOX_TOKEN(doc, beforeLines));
+ OptValue<sal_Int32> oBeforeLines = rAttribs.getInteger(W_TOKEN(beforeLines));
if (oBeforeLines.has())
{
TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin();
@@ -282,9 +282,9 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
}
// Spacing after
- if( !rAttribs.getBool(OOX_TOKEN(doc, afterAutospacing), false) )
+ if( !rAttribs.getBool(W_TOKEN(afterAutospacing), false) )
{
- OptValue<sal_Int32> oAfter = rAttribs.getInteger(OOX_TOKEN(doc, after));
+ OptValue<sal_Int32> oAfter = rAttribs.getInteger(W_TOKEN(after));
if (oAfter.has())
{
TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin();
@@ -294,7 +294,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
}
else
{
- OptValue<sal_Int32> oAfterLines = rAttribs.getInteger(OOX_TOKEN(doc, afterLines));
+ OptValue<sal_Int32> oAfterLines = rAttribs.getInteger(W_TOKEN(afterLines));
if (oAfterLines.has())
{
TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin();
@@ -306,8 +306,8 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
}
// Line spacing
- OptValue<OUString> oLineRule = rAttribs.getString(OOX_TOKEN(doc, lineRule));
- OptValue<sal_Int32> oLineSpacing = rAttribs.getInteger(OOX_TOKEN(doc, line));
+ OptValue<OUString> oLineRule = rAttribs.getString(W_TOKEN(lineRule));
+ OptValue<sal_Int32> oLineSpacing = rAttribs.getInteger(W_TOKEN(line));
if (oLineSpacing.has())
{
if( !oLineRule.has() || oLineRule.get() == "auto" )
diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail
index 43bb1ea0a6f2..378b0daf135a 100644
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@ -54,6 +54,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
#define LC_TOKEN( token ) OOX_TOKEN( dmlLockedCanvas, token )
#define WPS_TOKEN( token ) OOX_TOKEN( wps, token )
#define WPG_TOKEN( token ) OOX_TOKEN( wpg, token )
+#define W_TOKEN( token ) OOX_TOKEN( doc, token )
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index 7442e9eea3f6..c882021088b7 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -81,7 +81,7 @@ TextPortionContext::TextPortionContext( ContextHandler2Helper& rParent,
}
break;
case XML_span:
- case OOX_TOKEN(doc, r):
+ case W_TOKEN(r):
break;
default:
OSL_ENSURE( false, "TextPortionContext::TextPortionContext - unknown element" );
@@ -98,7 +98,7 @@ ContextHandlerRef TextPortionContext::onCreateContext( sal_Int32 nElement, const
void TextPortionContext::onCharacters( const OUString& rChars )
{
- if (getNamespace(getCurrentElement()) == NMSP_doc && getCurrentElement() != OOX_TOKEN(doc, t))
+ if (getNamespace(getCurrentElement()) == NMSP_doc && getCurrentElement() != W_TOKEN(t))
return;
switch( getCurrentElement() )
@@ -116,24 +116,24 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs)
{
switch (getCurrentElement())
{
- case OOX_TOKEN(doc, b):
+ case W_TOKEN(b):
maFont.mobBold = true;
break;
- case OOX_TOKEN(doc, sz):
- maFont.monSize = rAttribs.getInteger( OOX_TOKEN(doc, val) );
+ case W_TOKEN(sz):
+ maFont.monSize = rAttribs.getInteger( W_TOKEN(val) );
break;
- case OOX_TOKEN(doc, br):
+ case W_TOKEN(br):
mrTextBox.appendPortion( maParagraph, maFont, "\n" );
break;
- case OOX_TOKEN(doc, color):
- maFont.moColor = rAttribs.getString( OOX_TOKEN(doc, val) );
+ case W_TOKEN(color):
+ maFont.moColor = rAttribs.getString( W_TOKEN(val) );
break;
- case OOX_TOKEN(doc, spacing):
- maFont.monSpacing = rAttribs.getInteger(OOX_TOKEN(doc, val));
+ case W_TOKEN(spacing):
+ maFont.monSpacing = rAttribs.getInteger(W_TOKEN(val));
break;
- case OOX_TOKEN(doc, r):
- case OOX_TOKEN(doc, rPr):
- case OOX_TOKEN(doc, t):
+ case W_TOKEN(r):
+ case W_TOKEN(rPr):
+ case W_TOKEN(t):
break;
default:
SAL_INFO("oox", "unhandled: 0x" << std::hex<< getCurrentElement());
@@ -143,7 +143,7 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs)
void TextPortionContext::onEndElement()
{
- if (getNamespace(getCurrentElement()) == NMSP_doc && getCurrentElement() != OOX_TOKEN(doc, t))
+ if (getNamespace(getCurrentElement()) == NMSP_doc && getCurrentElement() != W_TOKEN(t))
return;
/* A child element without own child elements may contain a single space
@@ -223,24 +223,24 @@ ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const Att
{
case VML_TOKEN( textbox ):
if( nElement == XML_div ) return this;
- else if (nElement == OOX_TOKEN(doc, txbxContent)) return this;
+ else if (nElement == W_TOKEN(txbxContent)) return this;
break;
case XML_div:
if( nElement == XML_font ) return new TextPortionContext( *this, mrTextBox, maParagraph, TextFontModel(), nElement, rAttribs );
break;
- case OOX_TOKEN(doc, txbxContent):
- if (nElement == OOX_TOKEN(doc, p)) return this;
+ case W_TOKEN(txbxContent):
+ if (nElement == W_TOKEN(p)) return this;
break;
- case OOX_TOKEN(doc, p):
- case OOX_TOKEN(doc, sdtContent):
- case OOX_TOKEN(doc, smartTag):
- if (nElement == OOX_TOKEN(doc, r))
+ case W_TOKEN(p):
+ case W_TOKEN(sdtContent):
+ case W_TOKEN(smartTag):
+ if (nElement == W_TOKEN(r))
return new TextPortionContext( *this, mrTextBox, maParagraph, TextFontModel(), nElement, rAttribs );
else
return this;
break;
- case OOX_TOKEN(doc, pPr):
- case OOX_TOKEN(doc, sdt):
+ case W_TOKEN(pPr):
+ case W_TOKEN(sdt):
return this;
break;
default:
@@ -254,15 +254,15 @@ void TextBoxContext::onStartElement(const AttributeList& rAttribs)
{
switch (getCurrentElement())
{
- case OOX_TOKEN(doc, jc):
- maParagraph.moParaAdjust = rAttribs.getString( OOX_TOKEN(doc, val) );
+ case W_TOKEN(jc):
+ maParagraph.moParaAdjust = rAttribs.getString( W_TOKEN(val) );
break;
}
}
void TextBoxContext::onEndElement()
{
- if (getCurrentElement() == OOX_TOKEN(doc, p))
+ if (getCurrentElement() == W_TOKEN(p))
{
mrTextBox.appendPortion( maParagraph, TextFontModel(), "\n" );
maParagraph = TextParagraphModel();