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 | |
parent | 191b701ddba98089c2156b44e5304b12e965f857 (diff) |
ISO OOXML: implemented the import of ind start and end attributes
Diffstat (limited to 'writerfilter/source')
-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 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 37 |
8 files changed, 120 insertions, 7 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_); diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index b7046a495bd8..7a77b42b1c0e 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -13841,6 +13841,30 @@ </define> <define name="CT_Ind"> <optional> + <attribute name="end"> + <ref name="ST_SignedTwipsMeasure"/> + <xs:documentation>Left Indentation</xs:documentation> + </attribute> + </optional> + <optional> + <attribute name="endChars"> + <ref name="ST_DecimalNumber"/> + <xs:documentation>Left Indentation in Character Units</xs:documentation> + </attribute> + </optional> + <optional> + <attribute name="start"> + <ref name="ST_SignedTwipsMeasure"/> + <xs:documentation>Left Indentation</xs:documentation> + </attribute> + </optional> + <optional> + <attribute name="startChars"> + <ref name="ST_DecimalNumber"/> + <xs:documentation>Left Indentation in Character Units</xs:documentation> + </attribute> + </optional> + <optional> <attribute name="left"> <ref name="ST_SignedTwipsMeasure"/> <xs:documentation>Left Indentation</xs:documentation> @@ -21596,14 +21620,19 @@ <attribute name="lineRule" tokenid="ooxml:CT_Spacing_lineRule"/> </resource> <resource name="CT_Ind" resource="Properties"> - <attribute name="left" tokenid="ooxml:CT_Ind_left"/> - <attribute name="leftChars" tokenid="ooxml:CT_Ind_leftChars"/> - <attribute name="right" tokenid="ooxml:CT_Ind_right"/> - <attribute name="rightChars" tokenid="ooxml:CT_Ind_rightChars"/> + <attribute name="end" tokenid="ooxml:CT_Ind_end"/> + <attribute name="endChars" tokenid="ooxml:CT_Ind_endChars"/> + <attribute name="start" tokenid="ooxml:CT_Ind_start"/> + <attribute name="startChars" tokenid="ooxml:CT_Ind_startChars"/> <attribute name="hanging" tokenid="ooxml:CT_Ind_hanging"/> <attribute name="hangingChars" tokenid="ooxml:CT_Ind_hangingChars"/> <attribute name="firstLine" tokenid="ooxml:CT_Ind_firstLine"/> <attribute name="firstLineChars" tokenid="ooxml:CT_Ind_firstLineChars"/> + <!-- ECMA 1st version --> + <attribute name="left" tokenid="ooxml:CT_Ind_left"/> + <attribute name="leftChars" tokenid="ooxml:CT_Ind_leftChars"/> + <attribute name="right" tokenid="ooxml:CT_Ind_right"/> + <attribute name="rightChars" tokenid="ooxml:CT_Ind_rightChars"/> </resource> <resource name="ST_Jc" resource="List"> <value tokenid="0">left</value> |