[Libreoffice-commits] core.git: writerfilter/inc writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sun Mar 2 10:54:03 PST 2014


 writerfilter/inc/resourcemodel/TableManager.hxx       |    9 -
 writerfilter/source/dmapper/DomainMapper.cxx          |    7 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx     |    2 
 writerfilter/source/doctok/resources.xmi              |  124 ------------------
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   16 +-
 writerfilter/source/ooxml/model.xml                   |    7 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx        |   12 -
 7 files changed, 30 insertions(+), 147 deletions(-)

New commits:
commit 2e0f89980f40f14b36bc45176504861f3624ea99
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Mar 2 19:43:57 2014 +0100

    writerfilter: convert sprm:P{TableDepth,FInTable,Cell,Row}
    
    With this, source/ooxml no longer depends on the 'NS_sprm' namespace
    doctok provides.
    
    Change-Id: I58d5514dea25f1fbc8806863d976f6a24934ea61

diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index e463c56..68e6573 100644
--- a/writerfilter/inc/resourcemodel/TableManager.hxx
+++ b/writerfilter/inc/resourcemodel/TableManager.hxx
@@ -25,6 +25,7 @@
 #include <resourcemodel/WW8ResourceModel.hxx>
 
 #include <doctok/sprmids.hxx>
+#include <ooxml/resourceids.hxx>
 
 #include <boost/shared_ptr.hpp>
 #include <stack>
@@ -859,20 +860,20 @@ bool TableManager<T, PropertiesPointer>::sprm(Sprm & rSprm)
     bool bRet = true;
     switch (rSprm.getId())
     {
-    case NS_sprm::LN_PTableDepth:
+    case NS_ooxml::LN_tblDepth:
         {
             Value::Pointer_t pValue = rSprm.getValue();
 
             cellDepth(pValue->getInt());
         }
         break;
-    case NS_sprm::LN_PFInTable:
+    case NS_ooxml::LN_inTbl:
         inCell();
         break;
-    case NS_sprm::LN_PCell:
+    case NS_ooxml::LN_tblCell:
         endCell();
         break;
-    case NS_sprm::LN_PRow:
+    case NS_ooxml::LN_tblRow:
         endRow();
         break;
     default:
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8aa8e64..e01df18 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1089,10 +1089,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                          eSprmType == SPRM_DEFAULT ? PROP_PARA_FIRST_LINE_INDENT : PROP_FIRST_LINE_OFFSET,
                          uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
         break;
-    case 24: // "sprmPFInTable"
-    case NS_sprm::LN_PFInTable:
-        break;  // sprmPFInTable
-    case NS_sprm::LN_PTableDepth: //sprmPTableDepth
+    case NS_ooxml::LN_inTbl:
+        break;
+    case NS_ooxml::LN_tblDepth:
         //not handled via sprm but via text( 0x07 )
     break;
     case NS_ooxml::LN_CT_FramePr_w:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index d1e9bb4..fba09b9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -725,7 +725,7 @@ public:
      * getTableManager().isInTable(), unless we're in the first paragraph of a
      * table, or first paragraph after a table, as the table manager is only
      * updated once we ended the paragraph (and know if the para has the
-     * PFInTable SPRM or not).
+     * inTbl SPRM or not).
      */
     sal_Int32 m_nTableDepth;
 
diff --git a/writerfilter/source/doctok/resources.xmi b/writerfilter/source/doctok/resources.xmi
index d6539ee..f4561e7 100644
--- a/writerfilter/source/doctok/resources.xmi
+++ b/writerfilter/source/doctok/resources.xmi
@@ -69,99 +69,6 @@
           </UML:ModelElement.taggedValue>
         </UML:Class>
         <!--SPRM sprmPDxaLeft-->
-        <!--SPRM sprmPFInTable-->
-        <UML:Class xmi.id="sprmPFInTable" name="sprmPFInTable">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x2416</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmPFInTable</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>paragraph</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmPFInTable-->
-        <!--SPRM sprmPCell-->
-        <UML:Class xmi.id="sprmPCell" name="sprmPCell">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x244b</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmPCell</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>paragraph</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmPCell-->
-        <!--SPRM sprmPRow-->
-        <UML:Class xmi.id="sprmPRow" name="sprmPRow">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x244c</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmPRow</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>paragraph</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmPRow-->
         <!--SPRM sprmPFWidowControl-->
         <UML:Class xmi.id="sprmPFWidowControl" name="sprmPFWidowControl">
           <UML:ModelElement.stereotype>
@@ -472,37 +379,6 @@
           </UML:ModelElement.taggedValue>
         </UML:Class>
         <!--SPRM sprmTTextFlow-->
-        <!--SPRM sprmPTableDepth-->
-        <UML:Class xmi.id="sprmPTableDepth" name="sprmPTableDepth">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x6649</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmPTableDepth</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>paragraph</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmPTableDepth-->
         <!--SPRM sprmPDxaLeft1-->
         <UML:Class xmi.id="sprmPDxaLeft1" name="sprmPDxaLeft1">
           <UML:ModelElement.stereotype>
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 720ae1f..e75e151 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -576,14 +576,14 @@ void OOXMLFastContextHandler::sendTableDepth() const
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(mnTableDepth));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
         {
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(1));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
 
@@ -1878,21 +1878,21 @@ void OOXMLFastContextHandlerTextTableCell::endCell()
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(mnTableDepth));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
         {
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(1));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
         {
             OOXMLValue::Pointer_t pVal
                 (new OOXMLBooleanValue(mnTableDepth > 0));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PCell, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_tblCell, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
 
@@ -1935,21 +1935,21 @@ void OOXMLFastContextHandlerTextTableRow::endRow()
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(mnTableDepth));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
         {
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(1));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
         {
             OOXMLValue::Pointer_t pVal
                 (new OOXMLIntegerValue(1));
             OOXMLProperty::Pointer_t pProp
-                (new OOXMLPropertyImpl(NS_sprm::LN_PRow, pVal, OOXMLPropertyImpl::SPRM));
+                (new OOXMLPropertyImpl(NS_ooxml::LN_tblRow, pVal, OOXMLPropertyImpl::SPRM));
             pProps->add(pProp);
         }
 
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 9e2296b..fe6aaf2 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -45,6 +45,13 @@
   <token tokenid="ooxml:object"/>
   <token tokenid="ooxml:tblStart"/>
   <token tokenid="ooxml:tblEnd"/>
+
+  <!-- These are not directly generated from OOXML XML elements / attributes, need to clean them up in the future. -->
+  <token tokenid="ooxml:tblDepth"/>
+  <token tokenid="ooxml:inTbl"/>
+  <token tokenid="ooxml:tblCell"/>
+  <token tokenid="ooxml:tblRow"/>
+
   <token tokenid="ooxml:ffdata"/>
   <token tokenid="ooxml:starmath"/>
   <token tokenid="ooxml:blip"/>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 6c9511b..8da5ede 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1239,7 +1239,7 @@ void RTFDocumentImpl::prepareProperties(
 
     RTFValue::Pointer_t const pRowValue(new RTFValue(1));
     if (nCells > 0)
-        rState.aTableRowSprms.set(NS_sprm::LN_PRow, pRowValue);
+        rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, pRowValue);
 
     RTFValue::Pointer_t const pCellMar =
         rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar);
@@ -1333,7 +1333,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
         {
             assert(pSprms && pAttributes);
             RTFValue::Pointer_t pValue(new RTFValue(1));
-            pSprms->set(NS_sprm::LN_PCell, pValue);
+            pSprms->set(NS_ooxml::LN_tblCell, pValue);
             writerfilter::Reference<Properties>::Pointer_t const pTableCellProperties(
                     new RTFReferenceProperties(*pAttributes, *pSprms));
             Mapper().props(pTableCellProperties);
@@ -2411,7 +2411,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_INTBL:
             {
                 m_aStates.top().pCurrentBuffer = &m_aTableBufferStack.back();
-                nParam = NS_sprm::LN_PFInTable;
+                nParam = NS_ooxml::LN_inTbl;
             }
             break;
         case RTF_PAGEBB:
@@ -2423,7 +2423,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
     if (nParam >= 0)
     {
         RTFValue::Pointer_t pValue(new RTFValue(1));
-        m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PFInTable);
+        m_aStates.top().aParagraphSprms.erase(NS_ooxml::LN_inTbl);
         m_aStates.top().aParagraphSprms.set(nParam, pValue);
         return 0;
     }
@@ -2466,7 +2466,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             else
             {
                 // We are still in a table.
-                m_aStates.top().aParagraphSprms.set(NS_sprm::LN_PFInTable, RTFValue::Pointer_t(new RTFValue(1)));
+                m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, RTFValue::Pointer_t(new RTFValue(1)));
             }
             m_aStates.top().resetFrame();
             break;
@@ -2980,7 +2980,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         case RTF_LIN: nSprm = 0x845e; break;
         case RTF_RI: nSprm = NS_sprm::LN_PDxaRight; break;
         case RTF_RIN: nSprm = 0x845d; break;
-        case RTF_ITAP: nSprm = NS_sprm::LN_PTableDepth; break;
+        case RTF_ITAP: nSprm = NS_ooxml::LN_tblDepth; break;
         case RTF_SBASEDON:
            nSprm = NS_ooxml::LN_CT_Style_basedOn;
            pIntValue.reset(new RTFValue(getStyleName(nParam)));


More information about the Libreoffice-commits mailing list