diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-12-03 17:22:36 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-12-03 17:23:35 +0100 |
commit | 4ec5258f2ba70d60a2dcb73b97e162c3f8655540 (patch) | |
tree | 7341cf0843487a515d73d0299305afb1ccf93f64 /writerfilter/source/dmapper | |
parent | 191b701ddba98089c2156b44e5304b12e965f857 (diff) |
ISO OOXML: implemented the import of ind start and end attributes
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 26 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 23 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.hxx | 2 |
7 files changed, 87 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 50c144c6e233..b807d999a7e6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1318,6 +1318,26 @@ void DomainMapper::attribute(Id nName, Value & val) pTopContext->Insert(PROP_PARA_LINE_SPACING, true, uno::makeAny( aSpacing )); } break; + case NS_ooxml::LN_CT_Ind_start: + if (m_pImpl->GetTopContext()) + { + PropertyIds eId = PROP_PARA_LEFT_MARGIN; + if ( m_pImpl->IsRTL() ) + eId = PROP_PARA_RIGHT_MARGIN; + m_pImpl->GetTopContext()->Insert( + eId, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) )); + } + break; + case NS_ooxml::LN_CT_Ind_end: + if (m_pImpl->GetTopContext()) + { + PropertyIds eId = PROP_PARA_RIGHT_MARGIN; + if ( m_pImpl->IsRTL() ) + eId = PROP_PARA_LEFT_MARGIN; + m_pImpl->GetTopContext()->Insert( + eId, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) )); + } + break; case NS_ooxml::LN_CT_Ind_left: if (m_pImpl->GetTopContext()) m_pImpl->GetTopContext()->Insert( diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 71c621a8717e..b885999a03c5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -891,6 +891,32 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) dmapper_logger->endElement("finishParagraph"); #endif } + +bool DomainMapper_Impl::IsRTL( ) +{ + bool bRtl = false; + bool bSet = false; + if ( GetTopContext() ) + bRtl = GetTopContext()->IsRTL( bSet ); + + PropertyMapPtr pParaContext = GetTopContextOfType( CONTEXT_PARAGRAPH ); + if ( !bSet && pParaContext ) + { + ParagraphPropertyMap* pParaProps = static_cast< ParagraphPropertyMap* >( pParaContext.get() ); + rtl::OUString sStyleName = pParaProps->GetParaStyleName( ); + bRtl = m_pStyleSheetTable->IsRTL( sStyleName, bSet ); + } + + PropertyMapPtr pSectionContext = GetTopContextOfType( CONTEXT_SECTION ); + if ( !bSet && pSectionContext ) + { + SectionPropertyMap* pSectionProps = static_cast< SectionPropertyMap* >( pSectionContext.get() ); + bRtl = pSectionProps->GetSFBiDi(); + } + + return bRtl; +} + /*------------------------------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 5e969f39f1c7..129c75877c9c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -598,6 +598,8 @@ public: void ApplySettingsTable(); SectionPropertyMap * GetSectionContext(); + + bool IsRTL(); }; } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 23e4c40c7787..7b707ad10099 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/text/RelOrientation.hpp> -#include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/TextGridMode.hpp> @@ -133,6 +133,23 @@ void PropertyMap::Insert( PropertyIds eId, bool bIsTextProperty, const uno::Any& Invalidate(); } +bool PropertyMap::IsRTL( bool& bSet ) +{ + bool bRtl = false; + bSet = false; + + PropertyMap::iterator aIt = find( PropertyDefinition( PROP_WRITING_MODE, true ) ); + if( aIt != end( ) ) + { + sal_Int16 nValue; + aIt->second >>= nValue; + bRtl = ( nValue == text::WritingMode2::RL_TB ); + bSet = true; + } + + return bRtl; +} + #ifdef DEBUG_DOMAINMAPPER XMLTag::Pointer_t PropertyMap::toTag() const { @@ -876,14 +893,14 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if( aElement != end()) aElement->second >>= nWidth; - text::WritingMode eWritingMode = text::WritingMode_LR_TB; + sal_Int32 eWritingMode = text::WritingMode2::LR_TB; aElement = find(PropertyDefinition( PROP_WRITING_MODE, false )); if( aElement != end()) aElement->second >>= eWritingMode; - sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ? + sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode2::LR_TB ? nHeight - m_nTopMargin - m_nBottomMargin : nWidth - m_nLeftMargin - m_nRightMargin; diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index e7614717e2f1..26224a7016fe 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -135,6 +135,8 @@ public: virtual void insertTableProperties( const PropertyMap* ); + virtual bool IsRTL( bool& bSet ); + #ifdef DEBUG_DOMAINMAPPER virtual XMLTag::Pointer_t toTag() const; #endif @@ -265,6 +267,7 @@ public: void SetGutterRTL( bool bSet ) { m_bGutterRTL = bSet;} void SetDzaGutter( sal_Int32 nSet ) {m_nDzaGutter = nSet; } void SetSFBiDi( bool bSet ) { m_bSFBiDi = bSet;} + bool GetSFBiDi( ) { return m_bSFBiDi;} void SetGridType(sal_Int32 nSet) { m_nGridType = nSet; } void SetGridLinePitch( sal_Int32 nSet ) { m_nGridLinePitch = nSet; } diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index ffc9874ff1b1..a46d98f0642a 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1408,6 +1408,20 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) return sListLabel; } +bool StyleSheetTable::IsRTL( rtl::OUString sStyleName, bool& bSet ) +{ + bool bRtl = false; + bSet = false; + StyleSheetEntryPtr pStyle = FindStyleSheetByStyleName( sStyleName ); + bRtl = pStyle->pProperties->IsRTL( bSet ); + + StyleSheetEntryPtr pBaseStyle = FindStyleSheetByISTD( pStyle->sBaseStyleIdentifier ); + if ( !bSet && pBaseStyle ) + bRtl = IsRTL( pBaseStyle->sStyleName, bSet ); + + return bRtl; +} + }//namespace dmapper }//namespace writerfilter diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index d74864826e16..33261b2be24e 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -118,6 +118,8 @@ public: ::rtl::OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties ); + bool IsRTL( rtl::OUString sStyleName, bool& bSet ); + private: void resolveAttributeProperties(Value & val); void resolveSprmProps(Sprm & sprm_); |