Author: damjan
Date: Wed Feb 24 02:00:13 2016
New Revision: 1732007

URL: http://svn.apache.org/viewvc?rev=1732007&view=rev
Log:
Merge r1409442 from branches/gbuild:
#i116880# take outline border into account for correcting left/right margin of 
paragraphs

BUILDS

Updates by: me


Modified:
    openoffice/branches/gbuild-reintegration/   (props changed)
    
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
    
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.cxx
    
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.hxx

Propchange: openoffice/branches/gbuild-reintegration/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 24 02:00:13 2016
@@ -1,4 +1,4 @@
-/incubator/ooo/branches/gbuild:1409313-1409425,1409428,1409432-1409436,1409438,1409440,1409470
+/incubator/ooo/branches/gbuild:1409313-1409425,1409428,1409432-1409436,1409438,1409440,1409442,1409470
 /openoffice/branches/AOO400:1503684
 /openoffice/branches/AOO410:1572480,1573601,1583349,1583635,1583666
 /openoffice/branches/alg_writerframes:1556289-1579189

Modified: 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1732007&r1=1732006&r2=1732007&view=diff
==============================================================================
--- 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
 (original)
+++ 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
 Wed Feb 24 02:00:13 2016
@@ -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: 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.cxx?rev=1732007&r1=1732006&r2=1732007&view=diff
==============================================================================
--- 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.cxx
 (original)
+++ 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.cxx
 Wed Feb 24 02:00:13 2016
@@ -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);
 }
@@ -431,7 +438,6 @@ uno::Sequence<beans::PropertyValue> & Pr
     return m_sequence;
 }
 
-#ifdef DEBUG
 ::std::string PropertySequence::toString() const
 {
     ::std::string sResult = "";
@@ -446,11 +452,20 @@ 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;
 }
-#endif
 
 } //namespace dmapper
 } //namespace writerfilter

Modified: 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.hxx?rev=1732007&r1=1732006&r2=1732007&view=diff
==============================================================================
--- 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.hxx
 (original)
+++ 
openoffice/branches/gbuild-reintegration/main/writerfilter/source/dmapper/PropertyIds.hxx
 Wed Feb 24 02:00:13 2016
@@ -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;
 
@@ -336,9 +338,7 @@ public:
 
     uno::Sequence<beans::PropertyValue> & getSequence();
 
-#ifdef DEBUG
     ::std::string toString() const;
-#endif
 };
 
 } //namespace dmapper


Reply via email to