You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/11/14 22:43:44 UTC

svn commit: r1409442 - in /incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper: DomainMapper_Impl.cxx PropertyIds.cxx PropertyIds.hxx

Author: arist
Date: Wed Nov 14 21:43:43 2012
New Revision: 1409442

URL: http://svn.apache.org/viewvc?rev=1409442&view=rev
Log:
writerfilter10_15_59fc6a13300d.patch
# HG changeset patch
# User Henning Brinkmann <hb...@openoffice.org>
# Date 1297343519 -3600
# Node ID 59fc6a13300d1e29698bb3c97e08e906d1d0cff4
# Parent  b48e3cc5603ac8673c705b32ecf1709fa70724ad
writerfilter10: #i116880# take outline border into account for correcting left/right margin of paragraphs


Modified:
    incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
    incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.cxx
    incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.hxx

Modified: incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1409442&r1=1409441&r2=1409442&view=diff
==============================================================================
--- incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx (original)
+++ incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx Wed Nov 14 21:43:43 2012
@@ -603,11 +603,14 @@ void lcl_CorrectIndents(PropertySequence
 {
     try
     {
-        ::rtl::OUString str(RTL_CONSTASCII_USTRINGPARAM(__FUNCTION__));
-
         uno::Any aAny;
 
         sal_Int32 nLeftMargin = 0;
+	
+#ifdef DEBUG        
+        ::std::string aStr(aPropSeq.toString());
+#endif
+	
         aAny = aPropSeq.get(PROP_PARA_LEFT_MARGIN);
         if (aAny.hasValue())
             aAny >>= nLeftMargin;
@@ -618,9 +621,17 @@ void lcl_CorrectIndents(PropertySequence
         {
             sal_Int32 nLeftBorderDistance = 0;
             aAny >>= nLeftBorderDistance;
-
             nLeftMargin -= nLeftBorderDistance;
+            aPropSeq.set(PROP_PARA_LEFT_MARGIN, nLeftMargin);
+        }
 
+        aAny = aPropSeq.get(PROP_LEFT_BORDER);
+        
+        if (aAny.hasValue())
+        {
+            table::BorderLine aBorderLine;
+            aAny >>= aBorderLine;
+            nLeftMargin -= aBorderLine.OuterLineWidth;
             aPropSeq.set(PROP_PARA_LEFT_MARGIN, nLeftMargin);
         }
 
@@ -635,9 +646,17 @@ void lcl_CorrectIndents(PropertySequence
         {
             sal_Int32 nRightBorderDistance = 0;
             aAny >>= nRightBorderDistance;
-
             nRightMargin -= nRightBorderDistance;
+            aPropSeq.set(PROP_PARA_RIGHT_MARGIN, nRightMargin);
+        }
 
+        aAny = aPropSeq.get(PROP_RIGHT_BORDER);
+        
+        if (aAny.hasValue())
+        {
+            table::BorderLine aBorderLine;
+            aAny >>= aBorderLine;
+            nRightMargin -= aBorderLine.OuterLineWidth;
             aPropSeq.set(PROP_PARA_RIGHT_MARGIN, nRightMargin);
         }
     }
@@ -995,6 +1014,10 @@ void DomainMapper_Impl::finishParagraph(
 
                 lcl_CorrectIndents(*pPropSeq);
 
+                ::std::string sTmp(pPropSeq->toString());
+
+                ::std::clog << sTmp << ::std::endl;
+
                 uno::Reference< text::XTextRange > xTextRange =
                     xTextAppend->finishParagraph( pPropSeq->getSequence() );
                 getTableManager( ).handle(xTextRange);

Modified: incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.cxx?rev=1409442&r1=1409441&r2=1409442&view=diff
==============================================================================
--- incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.cxx (original)
+++ incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.cxx Wed Nov 14 21:43:43 2012
@@ -373,7 +373,7 @@ uno::Any PropertySequence::get(PropertyI
     return uno::Any();
 }
 
-void PropertySequence::set(PropertyIds aPropId, const uno::Any & rValue)
+int PropertySequence::getOrCreateIndex(PropertyIds aPropId)
 {
     Map_t::const_iterator aIt = m_indexMap.find(aPropId);
 
@@ -382,22 +382,29 @@ void PropertySequence::set(PropertyIds a
     {
         sal_uInt32 nCount = m_sequence.getLength() + 1;
         m_sequence.realloc(nCount);
-        m_indexMap[aPropId] = nCount;
         nIndex = nCount - 1;
+        m_indexMap[aPropId] = nIndex;
     }
     else
     {
         nIndex = aIt->second;
     }
-    
+
+    return nIndex;
+}
+
+void PropertySequence::set(PropertyIds aPropId, const uno::Any & rValue)
+{
+    sal_Int32 nIndex = getOrCreateIndex(aPropId);
+
     m_sequence[nIndex].Name = m_rPropNameSupplier.GetName(aPropId);
-    m_sequence[nIndex].Value <<= rValue;
+    m_sequence[nIndex].Value = rValue;
 }
 
 void PropertySequence::set(PropertyIds aPropId, sal_uInt32 nValue)
 {
     uno::Any aAny;
-
+    
     aAny <<= nValue;
     set(aPropId, aAny);
 }
@@ -405,7 +412,7 @@ void PropertySequence::set(PropertyIds a
 void PropertySequence::set(PropertyIds aPropId, sal_Int32 nValue)
 {
     uno::Any aAny;
-
+    
     aAny <<= nValue;
     set(aPropId, aAny);
 }
@@ -413,7 +420,7 @@ void PropertySequence::set(PropertyIds a
 void PropertySequence::set(PropertyIds aPropId, sal_uInt16 nValue)
 {
     uno::Any aAny;
-
+    
     aAny <<= nValue;
     set(aPropId, aAny);
 }
@@ -421,7 +428,7 @@ void PropertySequence::set(PropertyIds a
 void PropertySequence::set(PropertyIds aPropId, sal_Int16 nValue)
 {
     uno::Any aAny;
-
+    
     aAny <<= nValue;
     set(aPropId, aAny);
 }
@@ -446,6 +453,16 @@ uno::Sequence<beans::PropertyValue> & Pr
         ::std::string sTmp = ::rtl::OUStringToOString(m_sequence[n].Name, RTL_TEXTENCODING_ASCII_US).getStr();
 
         sResult += sTmp;
+
+        if (m_sequence[n].Value.hasValue())
+        {
+            sal_Int32 nValue = 0;
+            m_sequence[n].Value >>= nValue;
+
+            static char buffer[256];
+            snprintf(buffer, sizeof(buffer), " = %" SAL_PRIdINT32, nValue);
+            sResult += buffer;
+        }
     }
 
     return sResult;

Modified: incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.hxx?rev=1409442&r1=1409441&r2=1409442&view=diff
==============================================================================
--- incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.hxx (original)
+++ incubator/ooo/branches/gbuild/main/writerfilter/source/dmapper/PropertyIds.hxx Wed Nov 14 21:43:43 2012
@@ -319,6 +319,8 @@ class PropertySequence
     uno::Sequence<beans::PropertyValue>m_sequence;
     PropertyNameSupplier & m_rPropNameSupplier;
 
+    int getOrCreateIndex(PropertyIds aId);
+
 public:
     typedef boost::shared_ptr<PropertySequence> Pointer_t;