[Libreoffice-commits] core.git: 4 commits - include/oox oox/source sc/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Jun 7 09:06:46 PDT 2014
include/oox/helper/helper.hxx | 9 ++------
oox/source/core/xmlfilterbase.cxx | 2 -
sc/source/filter/oox/defnamesbuffer.cxx | 8 +++----
sc/source/filter/oox/drawingmanager.cxx | 2 -
sc/source/filter/oox/stylesbuffer.cxx | 2 -
writerfilter/source/ooxml/factoryinc.xsl | 10 --------
writerfilter/source/ooxml/factorytools.xsl | 28 ++-----------------------
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 -
9 files changed, 14 insertions(+), 50 deletions(-)
New commits:
commit f0fdee8abf7d46f9afb90e5d7c78037fff5b34b1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Jun 7 14:43:34 2014 +0200
oox: replace redundant STATIC_ARRAY_SIZE macro with SAL_N_ELEMENTS
Change-Id: I8cf274902bb5fda9fa70ab2af9e399db82d85d1d
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index a5563f4..1f5942b 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -23,6 +23,7 @@
#include <algorithm>
#include <limits>
#include <boost/static_assert.hpp>
+#include <sal/macros.h>
#include <osl/endian.h>
#include <rtl/math.hxx>
#include <rtl/string.hxx>
@@ -33,19 +34,15 @@ namespace oox {
// Helper macros ==============================================================
-/** Expands to the number of elements in a STATIC data array. */
-#define STATIC_ARRAY_SIZE( array ) \
- (sizeof(array)/sizeof(*(array)))
-
/** Expands to a pointer behind the last element of a STATIC data array (like
STL end()). */
#define STATIC_ARRAY_END( array ) \
- ((array)+STATIC_ARRAY_SIZE(array))
+ ((array)+SAL_N_ELEMENTS(array))
/** Expands to the 'index'-th element of a STATIC data array, or to 'def', if
'index' is out of the array limits. */
#define STATIC_ARRAY_SELECT( array, index, def ) \
- ((static_cast<size_t>(index) < STATIC_ARRAY_SIZE(array)) ? ((array)[static_cast<size_t>(index)]) : (def))
+ ((static_cast<size_t>(index) < SAL_N_ELEMENTS(array)) ? ((array)[static_cast<size_t>(index)]) : (def))
/** Expands to a temporary OString, created from a literal(!) character
array. */
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 746ba2e..8dd5cfe 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -142,7 +142,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
NMSP_xlsExtLst
};
- Sequence< beans::Pair< OUString, sal_Int32 > > aRet(STATIC_ARRAY_SIZE(namespaceIds));
+ Sequence< beans::Pair< OUString, sal_Int32 > > aRet(SAL_N_ELEMENTS(namespaceIds));
for( sal_Int32 i=0; i<aRet.getLength(); ++i )
aRet[i] = make_Pair(
OUString::createFromAscii(namespaceURIs[i]),
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index f68799f..d153dfe 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -81,9 +81,9 @@ const sal_Char* const sppcBaseNames[] =
OUString lclGetBaseName( sal_Unicode cBuiltinId )
{
- OSL_ENSURE( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ), "lclGetBaseName - unsupported built-in identifier" );
+ OSL_ENSURE( cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ), "lclGetBaseName - unsupported built-in identifier" );
OUStringBuffer aBuffer;
- if( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ) )
+ if( cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ) )
aBuffer.appendAscii( sppcBaseNames[ cBuiltinId ] );
else
aBuffer.append( static_cast< sal_Int32 >( cBuiltinId ) );
@@ -102,7 +102,7 @@ sal_Unicode lclGetBuiltinIdFromPrefixedName( const OUString& rModelName )
sal_Int32 nPrefixLen = aPrefix.getLength();
if( rModelName.matchIgnoreAsciiCase( aPrefix ) )
{
- for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
+ for( sal_Unicode cBuiltinId = 0; cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ); ++cBuiltinId )
{
OUString aBaseName = lclGetBaseName( cBuiltinId );
sal_Int32 nBaseNameLen = aBaseName.getLength();
@@ -116,7 +116,7 @@ sal_Unicode lclGetBuiltinIdFromPrefixedName( const OUString& rModelName )
/** returns the built-in name identifier from a built-in base name, e.g. 'Print_Area'. */
sal_Unicode lclGetBuiltinIdFromBaseName( const OUString& rModelName )
{
- for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
+ for( sal_Unicode cBuiltinId = 0; cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ); ++cBuiltinId )
if( rModelName.equalsIgnoreAsciiCaseAscii( sppcBaseNames[ cBuiltinId ] ) )
return cBuiltinId;
return BIFF_DEFNAME_UNKNOWN;
diff --git a/sc/source/filter/oox/drawingmanager.cxx b/sc/source/filter/oox/drawingmanager.cxx
index c928aa5..5ca80ac 100644
--- a/sc/source/filter/oox/drawingmanager.cxx
+++ b/sc/source/filter/oox/drawingmanager.cxx
@@ -337,7 +337,7 @@ void BiffDrawingObjectBase::convertFillProperties( ShapePropertyMap& rPropMap, c
{ 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 },
{ 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 }
};
- const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_ARRAY_SIZE( sppnPatterns ) ) ];
+ const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, SAL_N_ELEMENTS( sppnPatterns ) ) ];
// create 2-colored 8x8 DIB
SvMemoryStream aMemStrm;
// { 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00 }
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index dc2f589..628db5e 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2503,7 +2503,7 @@ const sal_Char* const sppcStyleNames[] =
"60% - Accent6",
"Explanatory Text"
};
-const sal_Int32 snStyleNamesCount = static_cast< sal_Int32 >( STATIC_ARRAY_SIZE( sppcStyleNames ) );
+const sal_Int32 snStyleNamesCount = static_cast< sal_Int32 >( SAL_N_ELEMENTS( sppcStyleNames ) );
OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sal_Int32 nLevel = 0 )
{
commit effb5781dd0414b04dda4358605519e88a8ed3ac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Jun 7 14:38:34 2014 +0200
writerfilter: document what RTFParserState's LO/HI/DBCH does
Change-Id: Iee70bfdecafb28a56440e5a4bf6d7ace54ea6436
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index b86c54f..f5c43a7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -255,7 +255,7 @@ public:
RTFDrawingObject aDrawingObject;
RTFFrame aFrame;
- /// CJK or CTL?
+ /// Maps to OOXML's ascii, cs or eastAsia.
enum { LOCH, HICH, DBCH } eRunType;
/// ltrch or rtlch
bool isRightToLeft;
commit 31c11dfefcaaadf3a444bb842a73637a2952c450
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Jun 7 14:36:19 2014 +0200
writerfilter: RTF_LOCH is not a NOP anymore
Change-Id: I06297a0c88c931cbc95e24de472d43339fd5116f
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a4c7c1d..0f9c09c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3004,7 +3004,6 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
break;
case RTF_LOCH:
- // Noop, dmapper detects this automatically.
m_aStates.top().eRunType = RTFParserState::LOCH;
break;
case RTF_HICH:
commit e8416ed30b0d52bcc0bdfd6e39304f99cd98aaa1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Jun 7 14:28:12 2014 +0200
writerfilter: remove unused XSL templates
Change-Id: Ie0f7cbaf2061894bea6589073f619ed15d0201ec
diff --git a/writerfilter/source/ooxml/factoryinc.xsl b/writerfilter/source/ooxml/factoryinc.xsl
index f08c019..a72cffd 100644
--- a/writerfilter/source/ooxml/factoryinc.xsl
+++ b/writerfilter/source/ooxml/factoryinc.xsl
@@ -51,16 +51,6 @@
<xsl:include href="factorytools.xsl"/>
- <xsl:template name="factorynamespaceiddecls">
- <xsl:for-each select="/model/namespace">
- <xsl:sort select="@name"/>
- <xsl:text>
-extern const Id </xsl:text>
-<xsl:call-template name="idfornamespace"/>
-<xsl:text>;</xsl:text>
- </xsl:for-each>
- </xsl:template>
-
<xsl:template name="factorynamespaceidimpls">
<xsl:for-each select="/model/namespace">
<xsl:sort select="@name"/>
diff --git a/writerfilter/source/ooxml/factorytools.xsl b/writerfilter/source/ooxml/factorytools.xsl
index 3d6ce8b..08c4f40 100644
--- a/writerfilter/source/ooxml/factorytools.xsl
+++ b/writerfilter/source/ooxml/factorytools.xsl
@@ -198,8 +198,8 @@ case NN_<namesapce/@name> | DEFINE_<rng:define/@name>:
If id does not contain ":" the result is just id.
-->
-<xsl:template name='idtoqname'>
- <xsl:param name='id'/>
+<xsl:template name="idtoqname">
+ <xsl:param name="id"/>
<xsl:choose>
<xsl:when test="contains($id, ':')">
<xsl:text>NS_</xsl:text>
@@ -290,18 +290,6 @@ NS_<namespace/@alias>
</xsl:for-each>
</xsl:template>
-<xsl:template name="factorydefineiddecls">
- <xsl:for-each select="//rng:define">
- <xsl:sort select="@name"/>
- <xsl:if test="generate-id(key('definename', @name)[1]) = generate-id(.)">
- <xsl:text>
-extern const Id </xsl:text>
- <xsl:call-template name="localidfordefine"/>
- <xsl:text>;</xsl:text>
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
<xsl:template name="factorydefineidimpls">
<xsl:for-each select="//rng:define">
<xsl:sort select="@name"/>
@@ -316,14 +304,4 @@ const Id </xsl:text>
</xsl:for-each>
</xsl:template>
-<xsl:template name="resources">
- <xsl:for-each select="/model/namespace/resource">
- <xsl:if test="generate-id(key('resources', @resource)[1])=generate-id(.)">
- <xsl:text>RT_</xsl:text>
- <xsl:value-of select="@resource"/>
- <xsl:text>,
</xsl:text>
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
More information about the Libreoffice-commits
mailing list