# HG changeset patch
# User Michael Stahl <mst@openoffice.org>
# Date 1286554563 -7200
# Node ID 4f22de378f7a7bd9e1e724787978887969ce2e9b
# Parent  7d283082a94ca8cb7ab14eaf82cb56ba10b81afd
rtftok01: less noisy

diff --git a/writerfilter/source/rtftok/RTFDocumentImpl.cxx b/writerfilter/source/rtftok/RTFDocumentImpl.cxx
--- a/writerfilter/source/rtftok/RTFDocumentImpl.cxx
+++ b/writerfilter/source/rtftok/RTFDocumentImpl.cxx
@@ -88,13 +88,13 @@
         for (Attributes_t::const_iterator iter = m_Attributes.begin();
                 iter != m_Attributes.end(); ++iter)
         {
-fprintf(stderr, "RTFRefProperties::resolve: %ld -> %s\n", iter->first, iter->second->toString().c_str());
+fprintf(stderr, "RTFRefProperties::resolve: %lx -> %s\n", iter->first, iter->second->toString().c_str());
             rHandler.attribute(iter->first, *iter->second.get());
         }
         for (Attributes_t::const_iterator iter = m_Sprms.begin();
                 iter != m_Sprms.end(); ++iter)
         {
-fprintf(stderr, "RTFRefProperties::resolve: sprm: %ld -> %s\n", iter->first, iter->second->toString().c_str());
+fprintf(stderr, "RTFRefProperties::resolve: sprm: %lx -> %s\n", iter->first, iter->second->toString().c_str());
             RTFSprm sprm(iter->first, iter->second);
             rHandler.sprm(sprm);
         }
@@ -129,7 +129,7 @@
         for (Properties_t::const_iterator iter = m_Properties.begin();
                 iter != m_Properties.end(); ++iter)
         {
-fprintf(stderr, "RTFRefTable::resolve: %d -> %s\n", iter->first, iter->second->getType().c_str());
+fprintf(stderr, "RTFRefTable::resolve: %x -> %s\n", iter->first, iter->second->getType().c_str());
             rHandler.entry(iter->first, iter->second);
         }
     }
@@ -315,7 +315,7 @@
             {
                 checkString(); // no checkUString() here!
                 sal_Int32 const v(::rtl::OString(value).toInt32());
-fprintf(stderr, "RTFScannerHandlerImpl::ctrl: \\u%" SAL_PRIdINT32 "\n", v);
+//fprintf(stderr, "RTFScannerHandlerImpl::ctrl: \\u%" SAL_PRIdINT32 "\n", v);
                 if ((SAL_MIN_INT16 <= v) && (v <= SAL_MAX_INT16)) {
                     RTFScannerHandlerImpl::addCharU(
                         static_cast<sal_Unicode>(v));
@@ -383,7 +383,7 @@
     virtual void addChar(char const ch)
     {
         if (0 != m_NegativeCharacters) {
-fprintf(stderr, "RTFScannerHandlerImpl::addChar: ignoring character '%c'(%x)\n", ch, ch);
+//fprintf(stderr, "RTFScannerHandlerImpl::addChar: ignoring character '%c'(%x)\n", ch, ch);
             --m_NegativeCharacters; /* ignore the character */
         } else {
             checkUString();
@@ -693,7 +693,7 @@
                 case RTF_f:
                 {
                     m_Entry.m_Index = ::rtl::OString(value).toInt32();
-fprintf(stderr, "read: \\f with: %d\n", m_Entry.m_Index);
+//fprintf(stderr, "read: \\f with: %d\n", m_Entry.m_Index);
                 }
                 break;
                 case RTF_fcharset:
diff --git a/writerfilter/source/rtftok/rtfcontrols.xsl b/writerfilter/source/rtftok/rtfcontrols.xsl
--- a/writerfilter/source/rtftok/rtfcontrols.xsl
+++ b/writerfilter/source/rtftok/rtfcontrols.xsl
@@ -35,121 +35,121 @@
 
   <xsl:template name="handle-case">
     <xsl:param name="kind"/>
-      <xsl:variable name="name">
+    <xsl:variable name="name">
+      <xsl:value-of select="@name"/>
+    </xsl:variable>
+    <xsl:variable name="type">
+      <!-- hack: context must be in model document, to make key work -->
+      <xsl:for-each select="document('rtfmodel.xml')/out">
+        <xsl:value-of select="name(key('names', $name))" />
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="token">
+      <xsl:choose>
+        <xsl:when test="starts-with(@tokenid, 'sprm')">
+          <xsl:text>NS_sprm::LN_</xsl:text>
+          <xsl:value-of select="substring(@tokenid, 6)"/>
+        </xsl:when>
+        <xsl:when test="starts-with(@tokenid, '0x')">
+          <xsl:value-of select="@tokenid"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:text>case RTF_</xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:text>:&#xA;</xsl:text>
+    <xsl:text>{&#xA;</xsl:text>
+    <xsl:if test="@tokenid">
+      <xsl:choose>
+        <xsl:when test="$type='flag'">
+          <xsl:choose>
+            <xsl:when test="@value">
+              <xsl:text>RTFValue::Pointer_t const pValue(</xsl:text>
+              <xsl:text>new RTFValueInt(</xsl:text>
+              <xsl:value-of select="@value"/>
+              <xsl:text>)</xsl:text>
+              <xsl:text>);&#xA;</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>#error token: </xsl:text>
+              <xsl:value-of select="@name"/>
+              <xsl:text> type is:</xsl:text>
+              <xsl:value-of select="$type"/>
+              <xsl:text> NO VALUE</xsl:text>
+              <xsl:text>&#xA;</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="$type='toggle'">
+          <xsl:text>sal_Int32 const n( ('\0' == *value) ? 1 : ::rtl::OString(value).toInt32() );&#xA;</xsl:text>
+          <xsl:text>RTFValue::Pointer_t const pValue(</xsl:text>
+          <xsl:choose>
+            <xsl:when test="@nonzero-value">
+              <xsl:text>new RTFValueInt( (n == 0) ? 0 : </xsl:text>
+              <xsl:value-of select="@nonzero-value"/>
+              <xsl:text> )</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>new RTFValueBool(0 != n)</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:text>);&#xA;</xsl:text>
+        </xsl:when>
+        <xsl:when test="$type='value'">
+          <xsl:text>sal_Int32 const n( ('\0' == *value) ? 0 : ::rtl::OString(value).toInt32() );&#xA;</xsl:text>
+          <xsl:choose>
+            <xsl:when test="@colortablelookup">
+              <xsl:text>sal_uInt32 const color(rDestination.GetColorTableEntry(n));&#xA;</xsl:text>
+              <xsl:text>RTFValue::Pointer_t const pValue(new RTFValueInt(color));&#xA;</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>RTFValue::Pointer_t const pValue(new RTFValueInt(n));&#xA;</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>#error token: </xsl:text>
           <xsl:value-of select="@name"/>
-      </xsl:variable>
-      <xsl:variable name="type">
-        <!-- hack: context must be in model document, to make key work -->
-        <xsl:for-each select="document('rtfmodel.xml')/out">
-          <xsl:value-of select="name(key('names', $name))" />
-        </xsl:for-each>
-      </xsl:variable>
-      <xsl:variable name="token">
-        <xsl:choose>
-            <xsl:when test="starts-with(@tokenid, 'sprm')">
-              <xsl:text>NS_sprm::LN_</xsl:text>
-              <xsl:value-of select="substring(@tokenid, 6)"/>
+          <xsl:text> type is:</xsl:text>
+          <xsl:value-of select="$type"/>
+          <xsl:text>&#xA;</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="starts-with(@tokenid, 'sprm') or starts-with(@tokenid, '0x')">
+          <xsl:choose>
+            <xsl:when test="$kind='character'">
+              <xsl:text>rDestination.SetCharacterSprm(</xsl:text>
             </xsl:when>
-            <xsl:when test="starts-with(@tokenid, '0x')">
-              <xsl:value-of select="@tokenid"/>
+            <xsl:when test="$kind='paragraph'">
+              <xsl:text>rDestination.SetParagraphSprm(</xsl:text>
             </xsl:when>
-        </xsl:choose>
-      </xsl:variable>
-      <xsl:text>case RTF_</xsl:text>
-      <xsl:value-of select="@name"/>
-      <xsl:text>:&#xA;</xsl:text>
-      <xsl:text>{&#xA;</xsl:text>
-      <xsl:if test="@tokenid">
-        <xsl:choose>
-          <xsl:when test="$type='flag'">
-            <xsl:choose>
-              <xsl:when test="@value">
-                <xsl:text>RTFValue::Pointer_t const pValue(</xsl:text>
-                <xsl:text>new RTFValueInt(</xsl:text>
-                <xsl:value-of select="@value"/>
-                <xsl:text>)</xsl:text>
-                <xsl:text>);&#xA;</xsl:text>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:text>#error token: </xsl:text>
-                <xsl:value-of select="@name"/>
-                <xsl:text> type is:</xsl:text>
-                <xsl:value-of select="$type"/>
-                <xsl:text> NO VALUE</xsl:text>
-                <xsl:text>&#xA;</xsl:text>
-              </xsl:otherwise>
-            </xsl:choose>
-          </xsl:when>
-          <xsl:when test="$type='toggle'">
-            <xsl:text>sal_Int32 const n( ('\0' == *value) ? 1 : ::rtl::OString(value).toInt32() );&#xA;</xsl:text>
-            <xsl:text>RTFValue::Pointer_t const pValue(</xsl:text>
-            <xsl:choose>
-              <xsl:when test="@nonzero-value">
-                <xsl:text>new RTFValueInt( (n == 0) ? 0 : </xsl:text>
-                <xsl:value-of select="@nonzero-value"/>
-                <xsl:text> )</xsl:text>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:text>new RTFValueBool(0 != n)</xsl:text>
-              </xsl:otherwise>
-            </xsl:choose>
-            <xsl:text>);&#xA;</xsl:text>
-          </xsl:when>
-          <xsl:when test="$type='value'">
-            <xsl:text>sal_Int32 const n( ('\0' == *value) ? 0 : ::rtl::OString(value).toInt32() );&#xA;</xsl:text>
-            <xsl:choose>
-              <xsl:when test="@colortablelookup">
-                <xsl:text>sal_uInt32 const color(rDestination.GetColorTableEntry(n));&#xA;</xsl:text>
-                <xsl:text>RTFValue::Pointer_t const pValue(new RTFValueInt(color));&#xA;</xsl:text>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:text>RTFValue::Pointer_t const pValue(new RTFValueInt(n));&#xA;</xsl:text>
-              </xsl:otherwise>
-            </xsl:choose>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:text>#error token: </xsl:text>
-            <xsl:value-of select="@name"/>
-            <xsl:text> type is:</xsl:text>
-            <xsl:value-of select="$type"/>
-            <xsl:text>&#xA;</xsl:text>
-          </xsl:otherwise>
-        </xsl:choose>
-        <xsl:choose>
-          <xsl:when test="starts-with(@tokenid, 'sprm') or starts-with(@tokenid, '0x')">
-            <xsl:choose>
-              <xsl:when test="$kind='character'">
-                <xsl:text>rDestination.SetCharacterSprm(</xsl:text>
-              </xsl:when>
-              <xsl:when test="$kind='paragraph'">
-                <xsl:text>rDestination.SetParagraphSprm(</xsl:text>
-              </xsl:when>
-              <xsl:when test="$kind='section'">
-                <xsl:text>rDestination.SetSectionSprm(</xsl:text>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:text>UNKNOWN KIND: </xsl:text>
-                <xsl:value-of select="$kind"/>
-              </xsl:otherwise>
-            </xsl:choose>
-            <xsl:value-of select="$token"/>
-            <xsl:text>, pValue);&#xA;</xsl:text>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:text>rDestination.SetAttribute(</xsl:text>
-            <xsl:value-of select="$token"/>
-            <xsl:text>, pValue);&#xA;</xsl:text>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:if>
-      <xsl:if test="@action">
-        <xsl:text>rDestination.</xsl:text>
-        <xsl:value-of select="@action"/>
-        <xsl:text>;&#xA;</xsl:text>
-      </xsl:if>
-      <xsl:text>return true;&#xA;</xsl:text>
-      <xsl:text>}&#xA;</xsl:text>
-      <xsl:text>break;&#xA;</xsl:text>
+            <xsl:when test="$kind='section'">
+              <xsl:text>rDestination.SetSectionSprm(</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>UNKNOWN KIND: </xsl:text>
+              <xsl:value-of select="$kind"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:value-of select="$token"/>
+          <xsl:text>, pValue);&#xA;</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>rDestination.SetAttribute(</xsl:text>
+          <xsl:value-of select="$token"/>
+          <xsl:text>, pValue);&#xA;</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:if test="@action">
+      <xsl:text>rDestination.</xsl:text>
+      <xsl:value-of select="@action"/>
+      <xsl:text>;&#xA;</xsl:text>
+    </xsl:if>
+    <xsl:text>return true;&#xA;</xsl:text>
+    <xsl:text>}&#xA;</xsl:text>
+    <xsl:text>break;&#xA;</xsl:text>
   </xsl:template>
 
 
