diff options
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 7e81cfd430..7e4eeda7d3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -138,6 +138,8 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", uno::Any(true)); m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", uno::Any(true)); m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", uno::Any(true)); + m_pImpl->SetDocumentSettingsProperty(u"NoGapAfterNoteNumber"_ustr, + uno::Any(true)); // Enable only for new documents, since pasting from clipboard can influence existing doc m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", uno::Any(true)); @@ -703,6 +705,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_PageMar_gutter: m_pImpl->SetPageMarginTwip( PAGE_MAR_GUTTER, nIntValue ); break; + case NS_ooxml::LN_CT_PaperSource_first: + m_pImpl->SetPaperSource(PAPER_SOURCE_FIRST, nIntValue); + break; + case NS_ooxml::LN_CT_PaperSource_other: + m_pImpl->SetPaperSource(PAPER_SOURCE_OTHER, nIntValue); + break; case NS_ooxml::LN_CT_Language_val: //90314 case NS_ooxml::LN_CT_Language_eastAsia: //90315 case NS_ooxml::LN_CT_Language_bidi: //90316 @@ -2419,8 +2427,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } break; case NS_ooxml::LN_CT_PPrBase_framePr: - // Avoid frames if we're inside a structured document tag, would just cause outer tables fail to create. - if (!m_pImpl->GetSdt()) { PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); if( pContext ) @@ -2495,7 +2501,16 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) pSectionContext->SetGutterMargin(rPageMar.gutter); } break; - + case NS_ooxml::LN_EG_SectPrContents_paperSrc: + m_pImpl->InitPaperSource(); + resolveSprmProps(*this, rSprm); + OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); + if(pSectionContext) + { + const PaperSource& rPaperSource = m_pImpl->GetPaperSource(); + pSectionContext->SetPaperSource( rPaperSource.first, rPaperSource.other ); + } + break; case NS_ooxml::LN_EG_SectPrContents_cols: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); @@ -3258,7 +3273,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) * section is a table. So in case first element is a table add a dummy para * and remove it again when lcl_endSectionGroup is called */ - if(m_pImpl->m_nTableDepth == 0 && m_pImpl->GetIsFirstParagraphInSection() + if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0 + && m_pImpl->GetIsFirstParagraphInSection() && !m_pImpl->GetIsDummyParaAddedForTableInSection() && !m_pImpl->GetIsTextFrameInserted() && !m_pImpl->GetIsPreviousParagraphFramed() && !IsInHeaderFooter()) { @@ -3266,7 +3282,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } // if first paragraph style in table has break-before-page, transfer that setting to the table itself. - if( m_pImpl->m_nTableDepth == 0 ) + if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0) { const uno::Any aBreakType(style::BreakType_PAGE_BEFORE); const PropertyMapPtr pParagraphProps = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); @@ -3287,11 +3303,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } } - m_pImpl->m_nTableDepth++; + m_pImpl->m_StreamStateStack.top().nTableDepth++; } break; case NS_ooxml::LN_tblEnd: - m_pImpl->m_nTableDepth--; + m_pImpl->m_StreamStateStack.top().nTableDepth--; break; case NS_ooxml::LN_tcStart: m_pImpl->m_nTableCellDepth++; @@ -4417,8 +4433,6 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) xContext->Erase(PROP_NUMBERING_LEVEL); } finishParagraph(bRemove, bNoNumbering); - if (bRemove) - m_pImpl->RemoveLastParagraph(); m_pImpl->SetParaSectpr(false); } @@ -4483,14 +4497,24 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { - if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) - m_pImpl->m_pSdtHelper->createPlainTextControl(); + if (bInSdtBlockText) + { + if (m_pImpl->m_pSdtHelper->hasUnusedText()) + m_pImpl->m_pSdtHelper->createPlainTextControl(); + else if (!m_pImpl->m_pSdtHelper->isFieldStartRangeSet()) + m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); + } m_pImpl->AppendFieldCommand(sText); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { - if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) - m_pImpl->m_pSdtHelper->createPlainTextControl(); + if (bInSdtBlockText) + { + if (m_pImpl->m_pSdtHelper->hasUnusedText()) + m_pImpl->m_pSdtHelper->createPlainTextControl(); + else if (!m_pImpl->m_pSdtHelper->isFieldStartRangeSet()) + m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); + } /*depending on the success of the field insert operation this result will be set at the field or directly inserted into the text*/ m_pImpl->AppendFieldResult(sText); @@ -4947,6 +4971,9 @@ void DomainMapper::finishParagraph(const bool bRemove, const bool bNoNumbering) if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::datePicker) m_pImpl->m_pSdtHelper->createDateContentControl(); m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove, bNoNumbering); + if (bRemove || mbIsLastPara) + m_pImpl->RemoveLastParagraph(); + mbIsLastPara = false; // handle other subdocuments } void DomainMapper::commentProps(const OUString& sId, const CommentProperties& rProps) |