[Libreoffice-commits] .: 3 commits - oox/source sal/inc starmath/source

Lubos Lunak llunak at kemper.freedesktop.org
Mon Jan 30 05:10:56 PST 2012


 oox/source/mathml/importutils.cxx |   56 ++++++++++++++++----------------------
 sal/inc/sal/log-areas.dox         |    8 +++++
 starmath/source/ooxmlexport.cxx   |   15 +++++-----
 starmath/source/ooxmlimport.cxx   |    7 ++--
 4 files changed, 44 insertions(+), 42 deletions(-)

New commits:
commit 74ded8e619cac076e8fbf4ea547d61e055e7e3ce
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 30 14:09:17 2012 +0100

    add log areas

diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index 9dfe176..5c10567 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -13,9 +13,17 @@ a new area, use it and add it to the list in the proper section with an explanat
 This list should give you an overview of which areas to enable when debugging
 certain functionality.
 
+ at section oox
+
+ at li oox.xmlstream - XmlStream class
+
 @section Writer
 
 @li sw.uno - Writer's UNO interfaces
 @li sw.ww8 - .doc/.docx export filter, .doc import filter (not writerfilter)
 
+ at section StarMath
+
+ at li starmath.ooxml - OOXML export/import support
+
 */
commit 0843da18a6da6f01c6ad8d141a741c92e857d66e
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 30 14:07:42 2012 +0100

    fprintf -> SAL_INFO

diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx
index 55eb1fa..23db8f2 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -35,20 +35,15 @@
 #include <oox/token/tokenmap.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/token/namespaces.hxx>
+#include <rtl/oustringostreaminserter.hxx>
 #include <rtl/string.hxx>
 
 // *sigh*
 #define STR( str ) OUString( RTL_CONSTASCII_USTRINGPARAM( str ))
-#define CSTR( str ) ( rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr())
 
 #define OPENING( token ) XML_STREAM_OPENING( token )
 #define CLOSING( token ) XML_STREAM_CLOSING( token )
 
-// HACK - TODO convert to the real debug stuff
-#undef SAL_LOG_LEVEL
-#define SAL_LOG_LEVEL 2
-
-
 using namespace com::sun::star;
 using rtl::OUString;
 
@@ -84,7 +79,6 @@ AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFas
     }
 }
 
-#if 0
 static OUString tokenToString( int token )
 {
     OUString tokenname = StaticTokenMap::get().getUnicodeTokenName( token & TOKEN_MASK );
@@ -117,7 +111,6 @@ static OUString tokenToString( int token )
     // just the name itself, not specified whether opening or closing
     return namespacename + STR( ":" ) + tokenname;
 }
-#endif
 
 } // namespace
 
@@ -145,7 +138,7 @@ bool XmlStream::AttributeList::attribute( int token, bool def ) const
         if( find->second.equalsIgnoreAsciiCaseAscii( "false" ) || find->second.equalsIgnoreAsciiCaseAscii( "off" )
             || find->second.equalsIgnoreAsciiCaseAscii( "f" ) || find->second.equalsIgnoreAsciiCaseAscii( "0" ))
             return false;
-//        fprintf( stderr, "Cannot convert \'%s\' to bool.\n", CSTR( find->second ));
+        SAL_WARN( "oox.xmlstream", "Cannot convert \'" << find->second << "\' to bool." );
     }
     return def;
 }
@@ -157,8 +150,8 @@ sal_Unicode XmlStream::AttributeList::attribute( int token, sal_Unicode def ) co
     {
         if( !find->second.isEmpty() )
         {
-//            if( find->second.getLength() != 1 )
-//                fprintf( stderr, "Cannot convert \'%s\' to sal_Unicode, stripping.\n", CSTR( find->second ));
+            if( find->second.getLength() != 1 )
+                SAL_WARN( "oox.xmlstream", "Cannot convert \'" << find->second << "\' to sal_Unicode, stripping." );
             return find->second[ 0 ];
         }
     }
@@ -229,7 +222,6 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional )
 {
     // either it's the following tag, or find it
     int savedPos = pos;
-#if SAL_LOG_LEVEL >= 2
     if( optional )
     { // avoid printing debug messages about skipping tags if the optional one
       // will not be found and the position will be reset back
@@ -239,7 +231,6 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional )
             return Tag();
         }
     }
-#endif
     if( currentToken() == token || findTag( token ))
     {
         Tag ret = currentTag();
@@ -251,7 +242,7 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional )
         pos = savedPos;
         return Tag();
     }
-//    fprintf( stderr, "Expected tag %s not found.\n", CSTR( tokenToString( token )));
+    SAL_WARN( "oox.xmlstream", "Expected tag " << tokenToString( token ) << " not found." );
     return Tag();
 }
 
@@ -260,7 +251,7 @@ bool XmlStream::findTag( int token )
     return findTagInternal( token, false );
 }
 
-bool XmlStream::findTagInternal( int token, bool /*silent*/ )
+bool XmlStream::findTagInternal( int token, bool silent )
 {
     int depth = 0;
     for(;
@@ -271,20 +262,21 @@ bool XmlStream::findTagInternal( int token, bool /*silent*/ )
         {
             if( currentToken() == OPENING( currentToken()))
             {
-//                if( !silent )
-//                    fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken())));
+                if( !silent )
+                    SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken()));
                 ++depth;
             }
             else if( currentToken() == CLOSING( currentToken()))
             {
-//                if( !silent )
-//                    fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken())));
+                if( !silent )
+                    SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken()));
                 --depth;
             }
             else
             {
-//                if( !silent )
-//                    fprintf( stderr, "Malformed token %d (%s)\n", currentToken(), CSTR( tokenToString( currentToken())));
+                if( !silent )
+                    SAL_WARN( "oox.xmlstream", "Malformed token " << currentToken() << " ("
+                        << tokenToString( currentToken()) << ")" );
                 abort();
             }
             continue;
@@ -295,15 +287,15 @@ bool XmlStream::findTagInternal( int token, bool /*silent*/ )
             return false; // that would be leaving current element, so not found
         if( currentToken() == OPENING( currentToken()))
         {
-//            if( !silent )
-//                fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken())));
+            if( !silent )
+                SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken()));
             ++depth;
         }
         else
             abort();
     }
-//    if( !silent )
-//        fprintf( stderr, "Unexpected end of stream reached.\n" );
+    if( !silent )
+        SAL_WARN( "oox.xmlstream", "Unexpected end of stream reached." );
     return false;
 }
 
@@ -312,23 +304,23 @@ void XmlStream::skipElement( int token )
     return skipElementInternal( token, true ); // no debug about skipping if called from outside
 }
 
-void XmlStream::skipElementInternal( int token, bool /*silent*/ )
+void XmlStream::skipElementInternal( int token, bool silent )
 {
     int closing = ( token & ~TAG_OPENING ) | TAG_CLOSING; // make it a closing tag
     assert( currentToken() == OPENING( token ));
-//    if( !silent )
-//        fprintf( stderr, "Skipping unexpected element %s\n", CSTR( tokenToString( currentToken())));
+    if( !silent )
+        SAL_INFO( "oox.xmlstream", "Skipping unexpected element " << tokenToString( currentToken()));
     moveToNextTag();
     // and just find the matching closing tag
     if( findTag( closing ))
     {
-//        if( !silent )
-//            fprintf( stderr, "Skipped unexpected element %s\n", CSTR( tokenToString( token )));
+        if( !silent )
+            SAL_INFO( "oox.xmlstream", "Skipped unexpected element " << tokenToString( token ));
         moveToNextTag(); // and skip it too
         return;
     }
     // this one is an unexpected problem, do not silent it
-//    fprintf( stderr, "Expected end of element %s not found.\n", CSTR( tokenToString( token )));
+    SAL_WARN( "oox.xmlstream", "Expected end of element " << tokenToString( token ) << " not found." );
 }
 
 void XmlStream::handleUnexpectedTag()
@@ -337,7 +329,7 @@ void XmlStream::handleUnexpectedTag()
         return;
     if( currentToken() == CLOSING( currentToken()))
     {
-//        fprintf( stderr, "Skipping unexpected tag %s\n", CSTR( tokenToString( currentToken())));
+        SAL_INFO( "oox.xmlstream", "Skipping unexpected tag " << tokenToString( currentToken()));
         moveToNextTag(); // just skip it
         return;
     }
commit 6b2e9ebf77879a8df330310f9b67f11322e8bc3e
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 30 12:06:41 2012 +0100

    fprintf -> SAL_INFO

diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index fd12301..8468630 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -30,6 +30,7 @@
 #include "ooxmlexport.hxx"
 
 #include <oox/token/tokens.hxx>
+#include <rtl/oustringostreaminserter.hxx>
 
 using namespace oox;
 using namespace oox::core;
@@ -58,7 +59,7 @@ bool SmOoxmlExport::ConvertFromStarMath( ::sax_fastparser::FSHelperPtr serialize
 
 void SmOoxmlExport::HandleNode( const SmNode* pNode, int nLevel )
 {
-//    fprintf(stderr,"XX %d %d %d\n", nLevel, pNode->GetType(), pNode->GetNumSubNodes());
+    SAL_INFO( "starmath.ooxml", "Node: " << nLevel << " " << int( pNode->GetType()) << " " << pNode->GetNumSubNodes());
     switch(pNode->GetType())
     {
         case NATTRIBUT:
@@ -202,7 +203,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
     }
     m_pSerializer->startElementNS( XML_m, XML_t, FSNS( XML_xml, XML_space ), "preserve", FSEND );
     SmTextNode* pTemp=(SmTextNode* )pNode;
-//    fprintf(stderr, "T %s\n", rtl::OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
+    SAL_INFO( "starmath.ooxml", "Text:" << rtl::OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
     for(xub_StrLen i=0;i<pTemp->GetText().Len();i++)
     {
 #if 0
@@ -281,7 +282,7 @@ void SmOoxmlExport::HandleFractions( const SmNode* pNode, int nLevel, const char
 void SmOoxmlExport::HandleUnaryOperation( const SmUnHorNode* pNode, int nLevel )
 {
     // update HandleMath() when adding new items
-//    fprintf(stderr,"UNARY %d\n", pNode->GetToken().eType );
+    SAL_INFO( "starmath.ooxml", "Unary: " << int( pNode->GetToken().eType ));
 
 // Avoid MSVC warning C4065: switch statement contains 'default' but no 'case' labels
 //    switch( pNode->GetToken().eType )
@@ -294,7 +295,7 @@ void SmOoxmlExport::HandleUnaryOperation( const SmUnHorNode* pNode, int nLevel )
 
 void SmOoxmlExport::HandleBinaryOperation( const SmBinHorNode* pNode, int nLevel )
 {
-//    fprintf(stderr,"BINARY %d\n", pNode->Symbol()->GetToken().eType );
+    SAL_INFO( "starmath.ooxml", "Binary: " << int( pNode->Symbol()->GetToken().eType ));
     // update HandleMath() when adding new items
     switch( pNode->Symbol()->GetToken().eType )
     {
@@ -372,7 +373,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributNode* pNode, int nLevel )
 
 void SmOoxmlExport::HandleMath( const SmNode* pNode, int nLevel )
 {
-//    fprintf(stderr,"MATH %d\n", pNode->GetToken().eType);
+    SAL_INFO( "starmath.ooxml", "Math: " << int( pNode->GetToken().eType ));
     switch( pNode->GetToken().eType )
     {
         case TDIVIDEBY:
@@ -418,7 +419,7 @@ static rtl::OString mathSymbolToString( const SmNode* node )
 
 void SmOoxmlExport::HandleOperator( const SmOperNode* pNode, int nLevel )
 {
-//    fprintf( stderr, "OPER %d\n", pNode->GetToken().eType );
+    SAL_INFO( "starmath.ooxml", "Operator: " << int( pNode->GetToken().eType ));
     switch( pNode->GetToken().eType )
     {
         case TINT:
@@ -678,7 +679,7 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
 
 void SmOoxmlExport::HandleVerticalBrace( const SmVerticalBraceNode* pNode, int nLevel )
 {
-//    fprintf( stderr, "VERT %d\n", pNode->GetToken().eType );
+    SAL_INFO( "starmath.ooxml", "Vertical: " << int( pNode->GetToken().eType ));
     switch( pNode->GetToken().eType )
     {
         case TOVERBRACE:
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index 6d40375..a092462 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -32,6 +32,7 @@
 #include <comphelper/string.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/token/namespaces.hxx>
+#include <rtl/oustringostreaminserter.hxx>
 
 using namespace oox;
 using namespace oox::formulaimport;
@@ -88,7 +89,7 @@ OUString SmOoxmlImport::handleStream()
     // And as a result, empty parts of the formula that are not placeholders are written out
     // as a single space, so fix that up too.
     ret = comphelper::string::searchAndReplaceAllAsciiWithAscii( ret, "{ }", "{}" );
-//    fprintf(stderr, "FORMULA: %s\n", rtl::OUStringToOString( ret, RTL_TEXTENCODING_UTF8 ).getStr());
+    SAL_INFO( "starmath.ooxml", "Formula: " << ret );
     return ret;
 }
 
@@ -232,7 +233,7 @@ OUString SmOoxmlImport::handleAcc()
             break;
         default:
             acc = STR( "acute" );
-//            fprintf( stderr, "Unknown m:chr in m:acc '%d'\n", accChr );
+            SAL_WARN( "starmath.ooxml", "Unknown m:chr in m:acc \'" << accChr << "\'" );
             break;
     }
     OUString e = readOMathArgInElement( M_TOKEN( e ));
@@ -558,7 +559,7 @@ OUString SmOoxmlImport::handleNary()
             ret = STR( "sum" );
             break;
         default:
-//            fprintf( stderr, "Unknown m:nary chr '%d'\n", chr );
+            SAL_WARN( "starmath.ooxml", "Unknown m:nary chr \'" << chr << "\'" );
             break;
     }
     if( !subHide )


More information about the Libreoffice-commits mailing list