# HG changeset patch
# User Michael Stahl <mst@openoffice.org>
# Date 1286464772 -7200
# Node ID 9d50f14f0ff3add4cd857804c016e6c50098e630
# Parent  a21348d0f92755f627fda553462757886ba0922c
rtftok01: add paragraph properties

diff --git a/writerfilter/source/rtftok/RTFDestination.hxx b/writerfilter/source/rtftok/RTFDestination.hxx
--- a/writerfilter/source/rtftok/RTFDestination.hxx
+++ b/writerfilter/source/rtftok/RTFDestination.hxx
@@ -320,6 +320,8 @@
     void SetAttribute(Id const id, RTFValue::Pointer_t const& pValue);
     void SetSprm(Id const id, RTFValue::Pointer_t const& pValue);
     void ResetCharacterProperties();
+    void ResetParagraphProperties();
+    void ParagraphBreak();
 
 protected:
     RTFScannerHandlerImpl & GetHandler() { return m_rHandler; }
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
@@ -209,6 +209,20 @@
     };
 
     // paragraph properties
+    struct ParagraphProperties
+    {
+    public:
+        explicit ParagraphProperties()
+        { }
+        Attributes_t m_Attributes;
+        Attributes_t m_Sprms;
+    };
+    ParagraphProperties m_ParagraphProperties;
+
+    void ResetParagraphProperties(/*Attributes_t const& rDefaults*/) {
+        m_ParagraphProperties = ParagraphProperties();
+    };
+
     // section properties
     // table properties
 
@@ -388,6 +402,9 @@
 fprintf(stderr, "RTFScannerHandlerImpl::SetUnicodeCharacters: %d\n", uc);
         GetCurrentGroup().m_UnicodeCharacters = uc;
     }
+    void SetDefault(Id const id, RTFValue::Pointer_t const& pValue) {
+        m_Defaults[id] = pValue;
+    }
     void SetFontTable(FontTable_t const& rFontTable) {
         m_FontTable = rFontTable;
     }
@@ -416,8 +433,8 @@
     void ResetCharacterProperties() {
         GetCurrentGroup().ResetCharacterProperties(m_Defaults);
     }
-    void SetDefault(Id const id, RTFValue::Pointer_t const& pValue) {
-        m_Defaults[id] = pValue;
+    void ResetParagraphProperties() {
+        GetCurrentGroup().ResetCharacterProperties(m_Defaults);
     }
 
 private:
@@ -482,7 +499,21 @@
 RTFDestination::ResetCharacterProperties()
 {
     GetHandler().ResetCharacterProperties();
-};
+}
+
+void
+RTFDestination::ResetParagraphProperties()
+{
+    GetHandler().ResetParagraphProperties();
+}
+
+void
+RTFDestination::ParagraphBreak()
+{
+    sal_uInt8 const nl(0x0d);
+    GetHandler().GetStream().text(& nl, sizeof(nl));
+    //FIXME when to start / end para group ???
+}
 
 
 
@@ -882,20 +913,6 @@
                 GetHandler().SetDefault(NS_sprm::LN_CLidBi, pValue);
             }
             break;
-            case RTF_par:
-            {
-                sal_uInt8 const nl(0x0d);
-                GetHandler().GetStream().text(& nl, sizeof(nl));
-            }
-            break;
-            /*
-            case RTF_f:
-            {
-                sal_Int32 const n( ::rtl::OString(value).toInt32() );
-                GetHandler().SetEncodingToFont(n);
-            }
-            break;
-            */
             default:
             {
                 if (!handleControl(*this, token, value))
diff --git a/writerfilter/source/rtftok/rtfactions.xml b/writerfilter/source/rtftok/rtfactions.xml
--- a/writerfilter/source/rtftok/rtfactions.xml
+++ b/writerfilter/source/rtftok/rtfactions.xml
@@ -68,5 +68,85 @@
     <ref name="v" tokenid="sprm:CFVanish"/>
     <!--    <ref name="webhidden"/>-->
   </charprops>
+  <paraprops>
+    <ref name="par" action="ParagraphBreak()"/>
+    <ref name="pard" action="ResetParagraphProperties()"/>
+    <!-- <ref name="spv"/> -->
+    <!-- <ref name="hyphpar"/> -->
+    <!-- <ref name="intbl"/> -->
+    <!-- <ref name="itap"/> -->
+    <!-- <ref name="keep"/> -->
+    <!-- <ref name="keepn"/> -->
+    <!-- <ref name="level"/> -->
+    <!-- <ref name="noline"/> -->
+    <!-- <ref name="nowidctlpar"/> -->
+    <!-- <ref name="widctlpar"/> -->
+    <!-- <ref name="outlinelevel"/> -->
+    <!-- <ref name="pagebb"/> -->
+    <!-- <ref name="sbys"/> -->
+    <!-- <ref name="s"/> -->
+    <!-- <ref name="yts"/> -->
+    <!-- <ref name="tscfirstrow"/> -->
+    <!-- <ref name="tsclastrow"/> -->
+    <!-- <ref name="tscfirstcol"/> -->
+    <!-- <ref name="tsclastcol"/> -->
+    <!-- <ref name="tscbandhorzodd"/> -->
+    <!-- <ref name="tscbandhorzeven"/> -->
+    <!-- <ref name="tscbandvertodd"/> -->
+    <!-- <ref name="tscbandverteven"/> -->
+    <!-- <ref name="tscnwcell"/> -->
+    <!-- <ref name="tscnecell"/> -->
+    <!-- <ref name="tscswcell"/> -->
+    <!-- <ref name="tscsecell"/> -->
+    <!-- <ref name="qc"/> -->
+    <!-- <ref name="qj"/> -->
+    <!-- <ref name="ql"/> -->
+    <!-- <ref name="qr"/> -->
+    <!-- <ref name="qd"/> -->
+    <!-- <ref name="qk"/> -->
+    <!-- <ref name="qt"/> -->
+    <!-- <ref name="faauto"/> -->
+    <!-- <ref name="fahang"/> -->
+    <!-- <ref name="facenter"/> -->
+    <!-- <ref name="faroman"/> -->
+    <!-- <ref name="favar"/> -->
+    <!-- <ref name="fafixed"/> -->
+    <!-- <ref name="fi"/> -->
+    <!-- <ref name="cufi"/> -->
+    <!-- <ref name="li"/> -->
+    <!-- <ref name="lin"/> -->
+    <!-- <ref name="culi"/> -->
+    <!-- <ref name="ri"/> -->
+    <!-- <ref name="rin"/> -->
+    <!-- <ref name="curi"/> -->
+    <!-- <ref name="adjustright"/> -->
+    <!-- <ref name="indmirror"/> -->
+    <!-- <ref name="sb"/> -->
+    <!-- <ref name="sa"/> -->
+    <!-- <ref name="sbauto"/> -->
+    <!-- <ref name="saauto"/> -->
+    <!-- <ref name="lisb"/> -->
+    <!-- <ref name="lisa"/> -->
+    <!-- <ref name="sl"/> -->
+    <!-- <ref name="slmult"/> -->
+    <!-- <ref name="nosnaplinegrid"/> -->
+    <!-- <ref name="contextualspace"/> -->
+    <!-- <ref name="subdocument"/> -->
+    <!-- <ref name="prauth"/> -->
+    <!-- <ref name="prdate"/> -->
+    <!-- <ref name="rtlpar"/> -->
+    <!-- <ref name="ltrpar"/> -->
+    <!-- <ref name="nocwrap"/> -->
+    <!-- <ref name="nowwrap"/> -->
+    <!-- <ref name="nooverflow"/> -->
+    <!-- <ref name="aspalpha"/> -->
+    <!-- <ref name="aspnum"/> -->
+    <!-- <ref name="collapsed"/> -->
+    <!-- <ref name="txbxtwno"/> -->
+    <!-- <ref name="txbxtwalways"/> -->
+    <!-- <ref name="txbxtwfirstlast"/> -->
+    <!-- <ref name="txbxtwfirst"/> -->
+    <!-- <ref name="txbxtwlast"/> -->
+  </paraprops>
 </actions>
     <!--    <ref name="updnprops" tokenid="sprm:CHpsPos"/> destination??? -->
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
@@ -67,7 +67,7 @@
 </xsl:text>
 
     <!-- stuff -->
-    <xsl:for-each select="document('rtfactions.xml')/actions/charprops/ref">
+    <xsl:for-each select="document('rtfactions.xml')/actions/*/ref">
       <xsl:variable name="name">
           <xsl:value-of select="@name"/>
       </xsl:variable>
