diff options
author | Henning Brinkmann <hbrinkm@openoffice.org> | 2011-02-10 14:11:59 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-17 15:45:52 +0200 |
commit | 99ee78cbd8e6a2e9e1850bb6b2f19b2ced1f3a68 (patch) | |
tree | 263c63777a160214ee20d19ff487728e5ca1b286 | |
parent | 9a0faec6e45cf40fc405c6dcf5da26e4dea296da (diff) |
writerfilter10: #i116880# take outline border into account for correcting left/right margin of paragraphs [hg:59fc6a13300d]
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 31 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 23 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 2 |
3 files changed, 49 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1bddce15900c..cb09de4f25b6 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -606,11 +606,14 @@ void lcl_CorrectIndents(PropertySequence & aPropSeq) { 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; @@ -621,9 +624,17 @@ void lcl_CorrectIndents(PropertySequence & aPropSeq) { 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); } @@ -638,9 +649,17 @@ void lcl_CorrectIndents(PropertySequence & aPropSeq) { 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); } } @@ -998,6 +1017,10 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) 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); diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 308521fde67f..dca981c036d7 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -376,7 +376,7 @@ uno::Any PropertySequence::get(PropertyIds aPropId) 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); @@ -385,16 +385,23 @@ void PropertySequence::set(PropertyIds aPropId, const uno::Any & rValue) { 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) @@ -449,6 +456,16 @@ uno::Sequence<beans::PropertyValue> & PropertySequence::getSequence() ::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; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index dc184f41da9e..151db06531ef 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -322,6 +322,8 @@ class PropertySequence uno::Sequence<beans::PropertyValue>m_sequence; PropertyNameSupplier & m_rPropNameSupplier; + int getOrCreateIndex(PropertyIds aId); + public: typedef boost::shared_ptr<PropertySequence> Pointer_t; |