Kaydet (Commit) 864d018a authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: handle exact end of paragraph w:sdt tags

Testcase will be added when the export half of this is also in place.

Change-Id: Ic6ef8ea72a45424fcb5a473c74db9e30d6fd3be8
üst 85118169
...@@ -932,7 +932,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) ...@@ -932,7 +932,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
// It's not possible to insert the relevant property to the character context here: // It's not possible to insert the relevant property to the character context here:
// the previous, already sent character context may be still active, so the property would be lost. // the previous, already sent character context may be still active, so the property would be lost.
m_pImpl->setSdtEndDeferred(true); if (m_pImpl->m_pSdtHelper->isOutsideAParagraph())
m_pImpl->setParaSdtEndDeferred(true);
else
m_pImpl->setSdtEndDeferred(true);
if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty()) if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
m_pImpl->m_pSdtHelper->createDropDownControl(); m_pImpl->m_pSdtHelper->createDropDownControl();
...@@ -2607,10 +2610,14 @@ void DomainMapper::lcl_startParagraphGroup() ...@@ -2607,10 +2610,14 @@ void DomainMapper::lcl_startParagraphGroup()
m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE) ); m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE) );
else if (m_pImpl->isBreakDeferred(COLUMN_BREAK)) else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) ); m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) );
if (m_pImpl->isParaSdtEndDeferred())
m_pImpl->GetTopContext()->Insert(PROP_PARA_SDT_END_BEFORE, uno::makeAny(true), true, PARA_GRAB_BAG);
} }
m_pImpl->SetIsFirstRun(true); m_pImpl->SetIsFirstRun(true);
m_pImpl->SetIsOutsideAParagraph(false); m_pImpl->SetIsOutsideAParagraph(false);
m_pImpl->clearDeferredBreaks(); m_pImpl->clearDeferredBreaks();
m_pImpl->setParaSdtEndDeferred(false);
} }
void DomainMapper::lcl_endParagraphGroup() void DomainMapper::lcl_endParagraphGroup()
......
...@@ -165,6 +165,7 @@ DomainMapper_Impl::DomainMapper_Impl( ...@@ -165,6 +165,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsColumnBreakDeferred( false ), m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ), m_bIsPageBreakDeferred( false ),
m_bSdtEndDeferred(false), m_bSdtEndDeferred(false),
m_bParaSdtEndDeferred(false),
m_bStartTOC(false), m_bStartTOC(false),
m_bStartTOCHeaderFooter(false), m_bStartTOCHeaderFooter(false),
m_bStartedTOC(false), m_bStartedTOC(false),
...@@ -721,6 +722,16 @@ bool DomainMapper_Impl::isSdtEndDeferred() ...@@ -721,6 +722,16 @@ bool DomainMapper_Impl::isSdtEndDeferred()
return m_bSdtEndDeferred; return m_bSdtEndDeferred;
} }
void DomainMapper_Impl::setParaSdtEndDeferred(bool bParaSdtEndDeferred)
{
m_bParaSdtEndDeferred = bParaSdtEndDeferred;
}
bool DomainMapper_Impl::isParaSdtEndDeferred()
{
return m_bParaSdtEndDeferred;
}
void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProperties, void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProperties,
uno::Reference<text::XTextRange> const& xStartTextRange, uno::Reference<text::XTextRange> const& xStartTextRange,
uno::Reference<text::XTextRange> const& xEndTextRange ) uno::Reference<text::XTextRange> const& xEndTextRange )
......
...@@ -331,8 +331,10 @@ private: ...@@ -331,8 +331,10 @@ private:
bool m_bIsFirstSection; bool m_bIsFirstSection;
bool m_bIsColumnBreakDeferred; bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred; bool m_bIsPageBreakDeferred;
/// If we want to set "sdt end" on the next character contet. /// If we want to set "sdt end" on the next character context.
bool m_bSdtEndDeferred; bool m_bSdtEndDeferred;
/// If we want to set "paragraph sdt end" on the next paragraph context.
bool m_bParaSdtEndDeferred;
bool m_bStartTOC; bool m_bStartTOC;
bool m_bStartTOCHeaderFooter; bool m_bStartTOCHeaderFooter;
/// If we got any text that is the pre-rendered result of the TOC field. /// If we got any text that is the pre-rendered result of the TOC field.
...@@ -505,6 +507,8 @@ public: ...@@ -505,6 +507,8 @@ public:
void setSdtEndDeferred(bool bSdtEndDeferred); void setSdtEndDeferred(bool bSdtEndDeferred);
bool isSdtEndDeferred(); bool isSdtEndDeferred();
void setParaSdtEndDeferred(bool bParaSdtEndDeferred);
bool isParaSdtEndDeferred();
void finishParagraph( PropertyMapPtr pPropertyMap ); void finishParagraph( PropertyMapPtr pPropertyMap );
void appendTextPortion( const OUString& rString, PropertyMapPtr pPropertyMap ); void appendTextPortion( const OUString& rString, PropertyMapPtr pPropertyMap );
......
...@@ -394,6 +394,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const ...@@ -394,6 +394,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING : sName = "ApplyParagraphMarkFormatToNumbering"; break; case PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING : sName = "ApplyParagraphMarkFormatToNumbering"; break;
case PROP_CELL_DIRECTION: sName = "CellDirection"; break; case PROP_CELL_DIRECTION: sName = "CellDirection"; break;
case PROP_SDT_END_BEFORE: sName = "SdtEndBefore"; break; case PROP_SDT_END_BEFORE: sName = "SdtEndBefore"; break;
case PROP_PARA_SDT_END_BEFORE: sName = "ParaSdtEndBefore"; break;
} }
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
......
...@@ -366,6 +366,7 @@ enum PropertyIds ...@@ -366,6 +366,7 @@ enum PropertyIds
,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
,PROP_CELL_DIRECTION ,PROP_CELL_DIRECTION
,PROP_SDT_END_BEFORE ,PROP_SDT_END_BEFORE
,PROP_PARA_SDT_END_BEFORE
}; };
struct PropertyNameSupplier_Impl; struct PropertyNameSupplier_Impl;
class PropertyNameSupplier class PropertyNameSupplier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment