diff options
author | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2013-10-07 10:26:30 +0300 |
---|---|---|
committer | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2013-10-07 11:04:32 +0300 |
commit | aa52753785154f0e95fed559f613f5eae9105dcf (patch) | |
tree | d4f3835368a183b87c9deb49c73cdbdbdcf83b90 /writerfilter | |
parent | bc43c1ca942c4c111aa7f45b268e13ab03c7f613 (diff) |
DOCX:fdo#43093 fix wrong direction and alignment for RTL
Change-Id: If362d80a86a7493f2d43e6d661b94fc03942711f
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 14 |
3 files changed, 15 insertions, 17 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index 8dc82feb2828..a879115269c1 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -158,6 +158,7 @@ private: sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue); sal_Int32 mnBackgroundColor; bool mbIsHighlightSet; + bool mbIsBIDI; boost::scoped_ptr< GraphicZOrderHelper > zOrderHelper; }; diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 1dfb58d4dc9d..b65c7a7f1da8 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -95,7 +95,7 @@ LoggedProperties(dmapper_logger, "DomainMapper"), LoggedTable(dmapper_logger, "DomainMapper"), LoggedStream(dmapper_logger, "DomainMapper"), m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, bIsNewDoc )), - mnBackgroundColor(0), mbIsHighlightSet(false) + mnBackgroundColor(0), mbIsHighlightSet(false), mbIsBIDI(false) { // #i24363# tab stops relative to indent m_pImpl->SetDocumentSettingsProperty( @@ -1527,7 +1527,7 @@ sal_Int32 lcl_getCurrentNumberingProperty(uno::Reference<container::XIndexAccess } // In rtl-paragraphs the meaning of left/right are to be exchanged -static bool ExchangeLeftRight( const PropertyMapPtr rContext ) + static bool ExchangeLeftRight( const PropertyMapPtr rContext, bool mbIsBIDI) { bool bExchangeLeftRight = false; PropertyMap::const_iterator aPropParaIte = rContext->find( PropertyDefinition( PROP_WRITING_MODE )); @@ -1537,6 +1537,8 @@ static bool ExchangeLeftRight( const PropertyMapPtr rContext ) if( (aPropParaIte->second >>= aAdjust) && aAdjust == text::WritingMode2::RL_TB ) bExchangeLeftRight = true; } + else + return mbIsBIDI; return bExchangeLeftRight; } @@ -1566,7 +1568,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType break; // sprmPIncLvl case NS_sprm::LN_PJcExtra: // sprmPJc Asian (undocumented) case NS_sprm::LN_PJc: // sprmPJc - handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext )); + handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, mbIsBIDI )); break; case NS_sprm::LN_PFSideBySide: break; // sprmPFSideBySide @@ -1662,7 +1664,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case 17: case NS_sprm::LN_PDxaLeft: // sprmPDxaLeft { - bool bExchangeLeftRight = ExchangeLeftRight( rContext ); + bool bExchangeLeftRight = ExchangeLeftRight( rContext, mbIsBIDI ); if( NS_sprm::LN_PDxaLeft == nSprmId || 0x17 == nSprmId|| (bExchangeLeftRight && nSprmId == 0x845d) || ( !bExchangeLeftRight && nSprmId == 0x845e)) rContext->Insert( eSprmType == SPRM_DEFAULT ? PROP_PARA_LEFT_MARGIN : PROP_LEFT_MARGIN, @@ -1958,9 +1960,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType { if (nIntValue != 0) { + mbIsBIDI = true; rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB )); rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT )); } + else + { + rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::LR_TB )); + rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT )); + } } break; // sprmPFBiDi @@ -3119,6 +3127,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_ooxml::LN_CT_PPrBase_pStyle: { + mbIsBIDI = false; m_pImpl->SetCurrentParaStyleId( sStringValue ); StyleSheetTablePtr pStyleTable = m_pImpl->GetStyleSheetTable(); const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true ); diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index e3962f526edd..206c885664f9 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -1618,19 +1618,7 @@ void OOXMLFastContextHandlerValue::setDefaultBooleanValue() if (mpValue.get() == NULL) { - // Value should not always be 'true' - //OOXMLValue::Pointer_t pValue(new OOXMLBooleanValue(true)); - bool bSet = true; - - // Paragraph properties are not always 'true' by default - // For example - RTL layout of paragraph is by default 'false' (look in this link for 'sprmPFBiDi') - // http://msdn.microsoft.com/en-us/library/dd923496%28v=office.12%29.aspx - if (getId() == NS_sprm::LN_PFBiDi) - { - bSet = false; - } - - OOXMLValue::Pointer_t pValue(new OOXMLBooleanValue(bSet)); + OOXMLValue::Pointer_t pValue(new OOXMLBooleanValue(true)); setValue(pValue); } } |