[Libreoffice-commits] core.git: writerfilter/source

2023-12-05 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 24135dc15a797ca91dd32c70cbc4d26a05dfd127
Author: Miklos Vajna 
AuthorDate: Tue Dec 5 11:43:42 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Dec 5 20:29:03 2023 +0100

writerfilter: fix crash in DomainMapper_Impl::PushSdt()

Crashreport signature:

Fatal signal received: SIGSEGV code: 1 for address: 0x0

program/libwriterfilterlo.so
writerfilter::dmapper::DomainMapper_Impl::PushSdt()
writerfilter/source/dmapper/DomainMapper_Impl.cxx:987
program/libwriterfilterlo.so
writerfilter::dmapper::DomainMapper::lcl_attribute(unsigned int, 
writerfilter::Value&)
include/tools/ref.hxx:56
program/libwriterfilterlo.so

writerfilter::ooxml::OOXMLProperty::resolve(writerfilter::Properties&)
include/tools/ref.hxx:56
program/libwriterfilterlo.so

writerfilter::ooxml::OOXMLPropertySet::resolve(writerfilter::Properties&)
include/tools/ref.hxx:157

Change-Id: I76416ca707a4ac40495e5c22f62fcd017bcb5e48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160336
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 728f6ec104b1a91c8c8ea0790bc7f56471c67737)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160351
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 183d71d5833a..e9d57ea34cef 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -977,8 +977,19 @@ void DomainMapper_Impl::PushSdt()
 }
 
 uno::Reference xTextAppend = 
m_aTextAppendStack.top().xTextAppend;
+if (!xTextAppend.is())
+{
+return;
+}
+
+uno::Reference xText = xTextAppend->getText();
+if (!xText.is())
+{
+return;
+}
+
 uno::Reference xCursor
-= 
xTextAppend->getText()->createTextCursorByRange(xTextAppend->getEnd());
+= xText->createTextCursorByRange(xTextAppend->getEnd());
 // Offset so the cursor is not adjusted as we import the SDT's content.
 bool bStart = !xCursor->goLeft(1, /*bExpand=*/false);
 m_xSdtStarts.push({bStart, OUString(), xCursor->getStart()});


[Libreoffice-commits] core.git: writerfilter/source

2023-11-29 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/StyleSheetTable.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 6096a4913d6510929e007c6ef96e1cdbaeadae22
Author: Caolán McNamara 
AuthorDate: Tue Nov 28 09:17:42 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 29 10:37:53 2023 +0100

cid#1554876 Use of auto that causes a copy

Change-Id: I8218a4371f0b002d8ef4d544bf9227db6684915f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160012
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 194900b444de..711a90290f4c 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -887,14 +887,16 @@ void PropValVector::Insert(const beans::PropertyValue& 
rVal)
 uno::Sequence< uno::Any > PropValVector::getValues()
 {
 std::vector aRet;
-std::transform(m_aValues.begin(), m_aValues.end(), 
std::back_inserter(aRet), [](const beans::PropertyValue& rValue) { return 
rValue.Value; });
+std::transform(m_aValues.begin(), m_aValues.end(), 
std::back_inserter(aRet),
+[](const beans::PropertyValue& rValue) -> const uno::Any& { return 
rValue.Value; });
 return comphelper::containerToSequence(aRet);
 }
 
 uno::Sequence< OUString > PropValVector::getNames()
 {
 std::vector aRet;
-std::transform(m_aValues.begin(), m_aValues.end(), 
std::back_inserter(aRet), [](const beans::PropertyValue& rValue) { return 
rValue.Name; });
+std::transform(m_aValues.begin(), m_aValues.end(), 
std::back_inserter(aRet),
+[](const beans::PropertyValue& rValue) -> const OUString& { return 
rValue.Name; });
 return comphelper::containerToSequence(aRet);
 }
 


[Libreoffice-commits] core.git: writerfilter/source

2023-11-19 Thread Julien Nabet (via logerrit)
 writerfilter/source/rtftok/rtfsprm.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 75f6a86ad924661f19c504380d96659e6b7d8afe
Author: Julien Nabet 
AuthorDate: Sun Nov 19 21:50:04 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 20 07:40:41 2023 +0100

c++20: use std::erase(_if) instead of std::remove(_if)+erase (writerfilter)

Change-Id: Id506689954f20c3b66d417798f25807bd0e84ca3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159710
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index d98ea74abd55..4c7bf2967a53 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -103,9 +103,7 @@ void RTFSprms::set(Id nKeyword, const RTFValue::Pointer_t& 
pValue, RTFOverwrite
 {
 case RTFOverwrite::YES_PREPEND:
 {
-m_pSprms->erase(
-std::remove_if(m_pSprms->begin(), m_pSprms->end(), 
RTFSprms_compare{ nKeyword }),
-m_pSprms->end());
+std::erase_if(*m_pSprms, RTFSprms_compare{ nKeyword });
 m_pSprms->emplace(m_pSprms->cbegin(), nKeyword, pValue);
 break;
 }


[Libreoffice-commits] core.git: writerfilter/source

2023-11-16 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |  129 ++-
 writerfilter/source/dmapper/DomainMapper.hxx |1 
 2 files changed, 71 insertions(+), 59 deletions(-)

New commits:
commit 7b3f68257b7b6781dd22830bc118cb0ef92fb113
Author: Michael Stahl 
AuthorDate: Thu Nov 16 13:31:10 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 16 15:35:07 2023 +0100

writerfilter: DomainMapper: fix undetected merge conflict

... between commit fce18155052821756466ea043c638f4ed72f41d6 and
commit 15b886f460919ea3dce425a621dc017c2992a96b - move the code from
lcl_text() to lcl_utext().

Change-Id: Iaa515d2ebd9861e24b442b0d7b41f83662ed58df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159501
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 52836e497d50..dc863f3f5e8b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3925,65 +3925,6 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, 
size_t len)
 pContext->Insert(PROP_BREAK_TYPE, 
uno::Any(style::BreakType_COLUMN_BEFORE));
 m_pImpl->clearDeferredBreak(COLUMN_BREAK);
 }
-if (IsRTFImport() && pContext) {
-//reset paragraph style properties not repeated at the 
paragraph
-std::optional paraStyleName = 
pContext->getProperty(PROP_PARA_STYLE_NAME);
-if (paraStyleName.has_value()) {
-OUString uStyleName;
-paraStyleName->second >>= uStyleName;
-StyleSheetEntryPtr pStyleSheet = 
m_pImpl->GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(uStyleName);
-if (pStyleSheet != nullptr)
-{
-std::vector< PropertyIds > stylePropertyIds = 
pStyleSheet->m_pProperties->GetPropertyIds();
-std::vector< PropertyIds >::iterator 
stylePropertyIdsIt = stylePropertyIds.begin();
-while (stylePropertyIdsIt != 
stylePropertyIds.end())
-{
-PropertyIds ePropertyId = 
*stylePropertyIdsIt;
-std::optional< PropertyMap::Property > 
styleProperty = pStyleSheet->m_pProperties->getProperty(ePropertyId);
-std::optional< PropertyMap::Property > 
paragraphProperty = pContext->getProperty(ePropertyId);
-if (paragraphProperty.has_value()) {
-if (paragraphProperty->second == 
styleProperty->second &&
-
!isSPRMDeduplicateDenylist(ePropertyId, pContext))
-{
-pContext->Erase(ePropertyId);
-}
-}
-else
-{
-switch (ePropertyId)
-{
-case PROP_PARA_LEFT_MARGIN:
-if 
(!pContext->getProperty(PROP_NUMBERING_RULES))
-{
-pContext->Insert(ePropertyId, 
uno::Any(0l));
-}
-break;
-case PROP_PARA_RIGHT_MARGIN:
-pContext->Insert(ePropertyId, 
uno::Any(0l));
-break;
-case PROP_PARA_LAST_LINE_ADJUST:
-case PROP_PARA_ADJUST:
-pContext->Insert(ePropertyId, 
uno::Any(style::ParagraphAdjust_LEFT));
-break;
-case PROP_PARA_TAB_STOPS:
-pContext->Insert(ePropertyId, 
uno::Any(uno::Sequence< style::TabStop >()));
-break;
-case PROP_FILL_STYLE:
-pContext->Insert(ePropertyId, 
uno::Any(drawing::FillStyle_NONE));
-break;
-case PROP_FILL_COLOR:
-pContext->Insert(ePropertyId, 
uno::Any(sal_Int32(COL_TRANSPARENT)));
-   

[Libreoffice-commits] core.git: writerfilter/source

2023-11-14 Thread Miklos Vajna (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 015e7d51b671a9dbf110599855d99a57fda2ae59
Author: Miklos Vajna 
AuthorDate: Tue Nov 14 19:50:17 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 15 08:16:07 2023 +0100

writerfilter: avoid double map lookup in RTFDocumentImpl

It's not much more code and is faster.

Change-Id: I7ed6b80890dce5cb18555e6c66f7b02c49abcde2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159425
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45f49553b26b..572eab019e59 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -791,8 +791,9 @@ OUString RTFDocumentImpl::getStyleName(int nIndex)
 if (!m_pSuperstream)
 {
 OUString aRet;
-if (m_aStyleNames.find(nIndex) != m_aStyleNames.end())
-aRet = m_aStyleNames[nIndex];
+auto it = m_aStyleNames.find(nIndex);
+if (it != m_aStyleNames.end())
+aRet = it->second;
 return aRet;
 }
 
@@ -804,8 +805,9 @@ Id RTFDocumentImpl::getStyleType(int nIndex)
 if (!m_pSuperstream)
 {
 Id nRet = 0;
-if (m_aStyleTypes.find(nIndex) != m_aStyleTypes.end())
-nRet = m_aStyleTypes[nIndex];
+auto it = m_aStyleTypes.find(nIndex);
+if (it != m_aStyleTypes.end())
+nRet = it->second;
 return nRet;
 }
 


[Libreoffice-commits] core.git: writerfilter/source

2023-10-27 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/TableManager.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 8ad82fc115a337604c064d37adfffcc81440248e
Author: Miklos Vajna 
AuthorDate: Thu Oct 26 16:16:04 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 08:05:27 2023 +0200

sw floattable: fix nullptr deref in TableManager::endLevel()

This is never an empty reference in the interesting use-case, so just
make sure we don't crash.

Reported to be a regression from
2d43c34333076fad092f0cdc0f60f81580acdbee (Related: tdf#55160 sw
floattable, nested DOCX imp: fix inner tbl at cell start, 2023-09-15).

See

,
e.g.

.

Change-Id: I4cd9c35ae3813a67d13d9b9e60f0dd6058f510c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158508
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/TableManager.cxx 
b/writerfilter/source/dmapper/TableManager.cxx
index d0f90bd20729..5554a93d9fcf 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -444,7 +444,10 @@ void TableManager::endLevel()
 {
 xCursor = 
xCellStart->getText()->createTextCursorByRange(
 xCellStart->getStart());
-xCursor->goLeft(1, false);
+if (xCursor.is())
+{
+xCursor->goLeft(1, false);
+}
 }
 catch (const uno::RuntimeException&)
 {


[Libreoffice-commits] core.git: writerfilter/source

2023-10-12 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   80 --
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |6 -
 2 files changed, 32 insertions(+), 54 deletions(-)

New commits:
commit 7bd401fa4e458c4ca16f7eb88289d50059e1d32e
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 11 23:09:00 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 12 09:31:09 2023 +0200

writerfilter: clean-up PushPageHeaderFooter method impl.

in addition change m_aHeaderFooterTextAppendStack to use enum
PagePartType for the "second" value in pair, instead of a bool to
denote if it is an entry for header or footer.

No change in functionality.

Change-Id: I2aa75494c9b3337dd51bf79e282291cdca9d8547
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157839
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f9f6dbd52d65..1c4925b290d8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3415,10 +3415,10 @@ void 
DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b
 {
 while (!m_aHeaderFooterTextAppendStack.empty())
 {
-auto aFooterHeader = m_aHeaderFooterTextAppendStack.top();
-if ((aFooterHeader.second && !bDynamicHeightTop) || 
(!aFooterHeader.second && !bDynamicHeightBottom))
+auto& [aTextAppendContext, ePagePartType] = 
m_aHeaderFooterTextAppendStack.top();
+if ((ePagePartType == PagePartType::Header && !bDynamicHeightTop) || 
(ePagePartType == PagePartType::Footer && !bDynamicHeightBottom))
 {
-uno::Reference< text::XTextAppend > xTextAppend = 
aFooterHeader.first.xTextAppend;
+uno::Reference< text::XTextAppend > xTextAppend = 
aTextAppendContext.xTextAppend;
 uno::Reference< text::XTextCursor > xCursor = 
xTextAppend->createTextCursor();
 uno::Reference< text::XTextRange > xRangeStart, xRangeEnd;
 
@@ -3444,13 +3444,12 @@ void 
DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b
 fillEmptyFrameProperties(aFrameProperties, false);
 
 // If it is a footer, then orient the frame to the bottom
-if (!aFooterHeader.second)
+if (ePagePartType == PagePartType::Footer)
+{
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT),
 text::VertOrientation::BOTTOM));
-
-uno::Reference xBodyText(
-xRangeStart->getText(), uno::UNO_QUERY);
-xBodyText->convertToTextFrame(xTextAppend, xRangeEnd,
-comphelper::containerToSequence(aFrameProperties));
+}
+uno::Reference 
xBodyText(xRangeStart->getText(), uno::UNO_QUERY);
+xBodyText->convertToTextFrame(xTextAppend, xRangeEnd, 
comphelper::containerToSequence(aFrameProperties));
 }
 m_aHeaderFooterTextAppendStack.pop();
 }
@@ -3468,7 +3467,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType 
ePagePartType, PageTyp
 const PropertyIds ePropIsOn = bHeader ? PROP_HEADER_IS_ON: 
PROP_FOOTER_IS_ON;
 const PropertyIds ePropShared = bHeader ? PROP_HEADER_IS_SHARED: 
PROP_FOOTER_IS_SHARED;
 const PropertyIds ePropTextLeft = bHeader ? PROP_HEADER_TEXT_LEFT: 
PROP_FOOTER_TEXT_LEFT;
-const PropertyIds ePropText = bHeader ? PROP_HEADER_TEXT: PROP_FOOTER_TEXT;
+const PropertyIds ePropTextRight = bHeader ? PROP_HEADER_TEXT: 
PROP_FOOTER_TEXT;
 
 m_bDiscardHeaderFooter = true;
 m_eInHeaderFooterImport = bHeader ? HeaderFooterImportState::header : 
HeaderFooterImportState::footer;
@@ -3476,8 +3475,8 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType 
ePagePartType, PageTyp
 //get the section context
 PropertyMapPtr pContext = 
DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
 //ask for the header/footer name of the given type
-SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( 
pContext.get() );
-if(!pSectionContext)
+SectionPropertyMap* pSectionContext = 
dynamic_cast(pContext.get());
+if (!pSectionContext)
 return;
 
 // clear the "Link To Previous" flag so that the header/footer
@@ -3494,31 +3493,24 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
 return;
 try
 {
-bool bLeft = eType == PageType::LEFT;
-bool bFirst = eType == PageType::FIRST;
-if (!bLeft || GetSettingsTable()->GetEvenAndOddHeaders())
+const PropertyIds ePropText = eType == PageType::LEFT ? ePropTextLeft 
: ePropTextRight;
+if (eType != PageType::LEFT || 
GetSettingsTable()->GetEvenAndOddHeaders())
 {
 //switch on header/footer use
 

[Libreoffice-commits] core.git: writerfilter/source

2023-10-11 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   31 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |6 ++--
 writerfilter/source/dmapper/PropertyMap.cxx   |   12 
 writerfilter/source/dmapper/PropertyMap.hxx   |   14 -
 4 files changed, 29 insertions(+), 34 deletions(-)

New commits:
commit e3d09d2e525ef6d5b93c6646e3cadc3f01297ea0
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 2 08:15:06 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 12 03:33:53 2023 +0200

change PageType (first, left, right) enum to enum class

Change-Id: I45bb7947266de1e18028c7ed460149c609e430b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157834
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cddf8c6f6127..f9f6dbd52d65 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3456,7 +3456,7 @@ void 
DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b
 }
 }
 
-void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, 
SectionPropertyMap::PageType eType)
+void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, 
PageType eType)
 {
 m_bSaveParaHadField = m_bParaHadField;
 m_aHeaderFooterStack.push(HeaderFooterContext(m_bTextInserted, 
m_nTableDepth));
@@ -3489,22 +3489,17 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, Section
 return; // TODO sw cannot Undo insert header/footer without crashing
 }
 
-uno::Reference< beans::XPropertySet > xPageStyle =
-pSectionContext->GetPageStyle(
-*this,
-eType == SectionPropertyMap::PAGE_FIRST );
+uno::Reference xPageStyle = 
pSectionContext->GetPageStyle(*this, eType == PageType::FIRST);
 if (!xPageStyle.is())
 return;
 try
 {
-bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-bool bFirst = eType == SectionPropertyMap::PAGE_FIRST;
+bool bLeft = eType == PageType::LEFT;
+bool bFirst = eType == PageType::FIRST;
 if (!bLeft || GetSettingsTable()->GetEvenAndOddHeaders())
 {
 //switch on header/footer use
-xPageStyle->setPropertyValue(
-getPropertyName(ePropIsOn),
-uno::Any(true));
+xPageStyle->setPropertyValue(getPropertyName(ePropIsOn), 
uno::Any(true));
 
 // If the 'Different Even & Odd Pages' flag is turned on - do not 
ignore it
 // Even if the 'Even' header/footer is blank - the flag should be 
imported (so it would look in LO like in Word)
@@ -3555,12 +3550,12 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, Section
 }
 }
 
-void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
+void DomainMapper_Impl::PushPageHeader(PageType eType)
 {
 PushPageHeaderFooter(PagePartType::Header, eType);
 }
 
-void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
+void DomainMapper_Impl::PushPageFooter(PageType eType)
 {
 PushPageHeaderFooter(PagePartType::Footer, eType);
 }
@@ -9291,22 +9286,22 @@ void DomainMapper_Impl::substream(Id rName,
 switch( rName )
 {
 case NS_ooxml::LN_headerl:
-PushPageHeader(SectionPropertyMap::PAGE_LEFT);
+PushPageHeader(PageType::LEFT);
 break;
 case NS_ooxml::LN_headerr:
-PushPageHeader(SectionPropertyMap::PAGE_RIGHT);
+PushPageHeader(PageType::RIGHT);
 break;
 case NS_ooxml::LN_headerf:
-PushPageHeader(SectionPropertyMap::PAGE_FIRST);
+PushPageHeader(PageType::FIRST);
 break;
 case NS_ooxml::LN_footerl:
-PushPageFooter(SectionPropertyMap::PAGE_LEFT);
+PushPageFooter(PageType::LEFT);
 break;
 case NS_ooxml::LN_footerr:
-PushPageFooter(SectionPropertyMap::PAGE_RIGHT);
+PushPageFooter(PageType::RIGHT);
 break;
 case NS_ooxml::LN_footerf:
-PushPageFooter(SectionPropertyMap::PAGE_FIRST);
+PushPageFooter(PageType::FIRST);
 break;
 case NS_ooxml::LN_footnote:
 case NS_ooxml::LN_endnote:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 82d7ca06824e..83a804cf618d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -853,8 +853,8 @@ public:
 /// Get the first pending shape, if there are any.
 css::uno::Reference PopPendingShape();
 
-void PushPageHeader(SectionPropertyMap::PageType eType);
-void PushPageFooter(SectionPropertyMap::PageType eType);
+void PushPageHeader(PageType eType);
+void PushPageFooter(PageType 

[Libreoffice-commits] core.git: writerfilter/source

2023-09-20 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/TableData.hxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 35f43bfafa763b7e45188f155fab746c0aec8804
Author: Miklos Vajna 
AuthorDate: Tue Sep 19 20:04:16 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 20 08:05:16 2023 +0200

writerfilter: get rid of not needed RowPointer_t indirection

RowData::Pointer_t is already a typedef, can use that directly
everywhere.

Change-Id: I393f8878abcdc9e053a08e70f26b6b1030ee5e8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157049
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/TableData.hxx 
b/writerfilter/source/dmapper/TableData.hxx
index e65b9c1c1abc..558fb6946bde 100644
--- a/writerfilter/source/dmapper/TableData.hxx
+++ b/writerfilter/source/dmapper/TableData.hxx
@@ -289,8 +289,7 @@ public:
  */
 class TableData : public virtual SvRefBase
 {
-typedef RowData::Pointer_t RowPointer_t;
-typedef ::std::vector Rows;
+typedef ::std::vector Rows;
 
 /**
the data of the rows of the table
@@ -300,7 +299,7 @@ class TableData : public virtual SvRefBase
 /**
 pointer to the data of the current row (while building up the table 
data).
 */
-RowPointer_t mpRow;
+RowData::Pointer_t mpRow;
 
 /**
depth of the current table in a hierarchy of tables
@@ -310,7 +309,7 @@ class TableData : public virtual SvRefBase
 /**
initialize mpRow
  */
-void newRow() { mpRow = RowPointer_t(new RowData()); }
+void newRow() { mpRow = RowData::Pointer_t(new RowData()); }
 
 public:
 typedef tools::SvRef Pointer_t;
@@ -403,12 +402,12 @@ public:
 
@param i index of the row
 */
-RowPointer_t const & getRow(unsigned int i) const
+RowData::Pointer_t const & getRow(unsigned int i) const
 {
 return mRows[i];
 }
 
-const RowPointer_t& getCurrentRow() const
+const RowData::Pointer_t& getCurrentRow() const
 {
 return mpRow;
 }


[Libreoffice-commits] core.git: writerfilter/source

2023-09-19 Thread Noel Grandin (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |1 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 --
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 --
 3 files changed, 5 deletions(-)

New commits:
commit 6f787581ee67207921906442c0cf7f6ed87eebd7
Author: Noel Grandin 
AuthorDate: Mon Sep 18 11:23:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 19 09:54:32 2023 +0200

m_nLastTableCellParagraphDepth is write-only

ever since
  commit 2d43c34333076fad092f0cdc0f60f81580acdbee
  Author: Miklos Vajna 
  Date:   Fri Sep 15 13:37:41 2023 +0200
Related: tdf#55160 sw floattable, nested DOCX imp: fix inner tbl at
cell start

Change-Id: Ifa2837fde41cecdf51ba4858dd52a59d79e4474e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157041
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 17ad330e5568..5b5647be8bae 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3296,7 +3296,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 break;
 case NS_ooxml::LN_tcEnd:
 m_pImpl->m_nTableCellDepth--;
-m_pImpl->m_nLastTableCellParagraphDepth = 0;
 break;
 case NS_ooxml::LN_glow_glow:
 case NS_ooxml::LN_shadow_shadow:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6538f03d6ea4..72b35d7d544d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -392,7 +392,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 
m_bIsReadGlossaries(rMediaDesc.getUnpackedValueOrDefault("ReadGlossaries", 
false)),
 m_nTableDepth(0),
 m_nTableCellDepth(0),
-m_nLastTableCellParagraphDepth(0),
 m_bHasFtn(false),
 m_bHasFtnSep(false),
 m_bCheckFirstFootnoteTab(false),
@@ -2132,7 +2131,6 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 TagLogger::getInstance().startElement("finishParagraph");
 #endif
 
-m_nLastTableCellParagraphDepth = m_nTableCellDepth;
 ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* 
>( pPropertyMap.get() );
 if (m_aTextAppendStack.empty())
 return;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index b2fca78f45fe..c19de5a5c4b9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -1103,8 +1103,6 @@ public:
 sal_Int32 m_nTableDepth;
 /// Raw table cell depth.
 sal_Int32 m_nTableCellDepth;
-/// Table cell depth of the last finished paragraph.
-sal_Int32 m_nLastTableCellParagraphDepth;
 
 /// If the current section has footnotes.
 bool m_bHasFtn;


[Libreoffice-commits] core.git: writerfilter/source

2023-07-21 Thread Andrea Gelmini (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 142082d216cf48bc905c2468809bcc074fe2c638
Author: Andrea Gelmini 
AuthorDate: Tue Jul 18 00:50:59 2023 +0200
Commit: Julien Nabet 
CommitDate: Fri Jul 21 10:23:51 2023 +0200

Fix typo

Change-Id: Ied624a73804f99a63b71f9088d6179ad2d93cef6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154564
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bf433e2b8d33..ec1766f9e750 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7451,7 +7451,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 {
 if (vArguments.size() < 3)
 {
-SAL_WARN("writerfilter.dmapper", "IF field requires at 
lest 3 parameters!");
+SAL_WARN("writerfilter.dmapper", "IF field requires at 
least 3 parameters!");
 break;
 }
 


[Libreoffice-commits] core.git: writerfilter/source

2023-07-05 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   31 +--
 1 file changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 1ca926cd6eff2df195e673397d7b34e0a4fb569b
Author: Mike Kaganski 
AuthorDate: Wed Jul 5 10:50:17 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jul 5 11:53:14 2023 +0200

Optimize a bit

Do not create selection and calculate paragraph text string each time.

Change-Id: I6781695c05e3bb26c2656cf841c0a9093f260c8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154020
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 36add41691b0..2bd77f3f13ea 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1089,13 +1089,14 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 // 1. Collect all the table-style-defined properties, that aren't 
overridden by the
 //paragraph style or direct formatting
 std::vector aProps;
+std::optional oParagraphText;
 
 for( auto const& eId : aAllTableParaProperties )
 {
 // apply paragraph and character properties of the table style on 
table paragraphs
 // if there is no direct paragraph formatting
-bool bIsParaLevel = rParaProp.m_pPropertyMap->isSet(eId);
-if ( !bIsParaLevel || isCharacterProperty(eId) )
+bool bSetDirectlyInParaLevel = rParaProp.m_pPropertyMap->isSet(eId);
+if ( !bSetDirectlyInParaLevel || isCharacterProperty(eId) )
 {
 if ( (eId == PROP_PARA_LEFT_MARGIN || eId == 
PROP_PARA_FIRST_LINE_INDENT) &&
 rParaProp.m_pPropertyMap->isSet(PROP_NUMBERING_RULES) )
@@ -,7 +1112,20 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 // this cell applies the table style property
 if (pCellProp != rCellProperties.end())
 {
-bool bDocDefault;
+if (bSetDirectlyInParaLevel) // it is a character property set 
directly in the paragraph
+{
+if (!oParagraphText) // do it only once
+{
+uno::Reference xParagraph(
+
rParaProp.m_rEndParagraph->getText()->createTextCursorByRange(rParaProp.m_rEndParagraph),
 uno::UNO_QUERY_THROW );
+// select paragraph
+xParagraph->gotoStartOfParagraph( true );
+oParagraphText = xParagraph->getString();
+}
+// don't overwrite empty paragraph with table style, if it 
has a direct paragraph formatting
+if (oParagraphText->isEmpty())
+continue;
+}
 // handle paragraph background color defined in 
CellColorHandler
 if (eId == PROP_FILL_COLOR)
 {
@@ -1127,6 +1141,7 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 OUString sParaStyleName;
 rParaProp.m_rPropertySet->getPropertyValue("ParaStyleName") 
>>= sParaStyleName;
 StyleSheetEntryPtr pEntry = 
m_rDMapper_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(sParaStyleName);
+bool bDocDefault;
 uno::Any aParaStyle = 
m_rDMapper_Impl.GetPropertyFromStyleSheet(eId, pEntry, true, true, 
);
 // A very strange compatibility rule says that the DEFAULT 
style's specified fontsize of 11 or 12
 // or a specified left justify will always be overridden by 
the table-style.
@@ -1150,16 +1165,8 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 }
 
 // use table style when no paragraph style setting or a 
docDefault value is applied instead of it
-if ( aParaStyle == uno::Any() || bDocDefault || 
bCompatOverride ) try
+if (!aParaStyle.hasValue() || bDocDefault || bCompatOverride) 
try
 {
-uno::Reference xParagraph(
-
rParaProp.m_rEndParagraph->getText()->createTextCursorByRange(rParaProp.m_rEndParagraph),
 uno::UNO_QUERY_THROW );
-// select paragraph
-xParagraph->gotoStartOfParagraph( true );
-// don't overwrite empty paragraph with table style, if it 
has a direct paragraph formatting
-if ( bIsParaLevel && xParagraph->getString().getLength() 
== 0 )
-continue;
-
 // apply style setting when the paragraph doesn't modify it
 
aProps.push_back(comphelper::makePropertyValue(sPropertyName, 

[Libreoffice-commits] core.git: writerfilter/source

2023-07-05 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   19 +++
 1 file changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 4cb31f481e8bc271a39aaa4953edda8d898413be
Author: Mike Kaganski 
AuthorDate: Wed Jul 5 09:10:05 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jul 5 09:29:43 2023 +0200

Related: tdf#131062 Simplify a bit

The overly complicated processing was added in commit
7f805108a4ccc5751d7cbcb722ded5247e398578 (tdf#131062 DOCX import:
fix table-style paragraph background color, 2020-03-02). Setting
sPropertyName to "ParaBackColor" was then nullified by not using
its value for PROP_FILL_COLOR case, and using the old "FillColor"
value instead. Likely that was just forgotten cleanup after some
experimentation.

Change-Id: I1facec63bf74a50b1f16a7accd243345c017a032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154016
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index cd77182657c8..36add41691b0 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1115,15 +1115,10 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 // handle paragraph background color defined in 
CellColorHandler
 if (eId == PROP_FILL_COLOR)
 {
-// table style defines paragraph background color, use the 
correct property name
 auto pFillStyleProp = 
std::find_if(rCellProperties.begin(), rCellProperties.end(),
 [](const beans::PropertyValue& rProp) { return 
rProp.Name == "FillStyle"; });
-if ( pFillStyleProp != rCellProperties.end() &&
- pFillStyleProp->Value == 
uno::Any(drawing::FillStyle_SOLID) )
-{
-sPropertyName = "ParaBackColor";
-}
-else
+if ( pFillStyleProp == rCellProperties.end() ||
+ pFillStyleProp->Value != 
uno::Any(drawing::FillStyle_SOLID) )
 {
 // FillStyle_NONE, skip table style usage for 
paragraph background color
 continue;
@@ -1165,15 +1160,11 @@ void 
DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
 if ( bIsParaLevel && xParagraph->getString().getLength() 
== 0 )
 continue;
 
-if ( eId != PROP_FILL_COLOR )
-{
-// apply style setting when the paragraph doesn't 
modify it
-
aProps.push_back(comphelper::makePropertyValue(sPropertyName, 
pCellProp->Value));
-}
-else
+// apply style setting when the paragraph doesn't modify it
+
aProps.push_back(comphelper::makePropertyValue(sPropertyName, 
pCellProp->Value));
+if (eId == PROP_FILL_COLOR)
 {
 // we need this for complete import of table-style 
based paragraph background color
-
aProps.push_back(comphelper::makePropertyValue("FillColor",  pCellProp->Value));
 
aProps.push_back(comphelper::makePropertyValue("FillStyle",  
uno::Any(drawing::FillStyle_SOLID)));
 }
 }


[Libreoffice-commits] core.git: writerfilter/source

2023-06-18 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/dmapper/PropertyIds.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d7bc610a359ca7e95b3a600c03da6a0b9e6f439c
Author: Tomaž Vajngerl 
AuthorDate: Sun Jun 18 23:35:36 2023 +0900
Commit: Julien Nabet 
CommitDate: Sun Jun 18 17:36:51 2023 +0200

use frozen::make_unordered_map so no need to specify the count

Change-Id: I08057846e735028fb4634fad8b210c707905e096
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153233
Tested-by: Jenkins
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index d294a3ad082c..11ef07230fad 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -26,7 +26,7 @@ namespace writerfilter::dmapper{
 
 namespace
 {
-constexpr frozen::unordered_map 
constPropertyMap
+constexpr auto constPropertyMap = frozen::make_unordered_map(
 {
 { PROP_CHAR_WEIGHT, u"CharWeight"},
 { PROP_CHAR_POSTURE, u"CharPosture"},
@@ -378,7 +378,7 @@ namespace
 { PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF, u"CursorNotIgnoreTables"},
 { PROP_PARA_CONNECT_BORDERS, u"ParaIsConnectBorder"},
 { PROP_DECORATIVE, u"Decorative"},
-};
+});
 } // end anonymous ns
 
 OUString getPropertyName( PropertyIds eId )


[Libreoffice-commits] core.git: writerfilter/source

2023-06-16 Thread Satya (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4da11a5d39ccd9f59e326011d4de7ffee8a71d10
Author: Satya 
AuthorDate: Fri Jun 16 10:30:02 2023 +0530
Commit: Justin Luth 
CommitDate: Fri Jun 16 16:45:18 2023 +0200

tdf#155736 replaced m_bStartTOC condition with a method IsInTOC()

Modified IsInTOC() method and refactored usage of m_bStartTOC with 
IsInTOC() in the previous commit,but m_bStartTOC is still used at one place and 
now which is replacing with IsInTOC() to maintain consistency.

Change-Id: I7fe50770741d68d9db35d74e138417728c2e3dec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153165
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8b5cf8b6e049..a67bc5f5b092 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3008,7 +3008,7 @@ void DomainMapper_Impl::appendTextPortion( const 
OUString& rString, const Proper
 }
 else
 {
-if (m_bStartTOC || m_bStartIndex || m_bStartBibliography || 
m_nStartGenericField != 0)
+if (IsInTOC() || m_bStartIndex || m_bStartBibliography || 
m_nStartGenericField != 0)
 {
 if (IsInHeaderFooter() && !m_bStartTOCHeaderFooter)
 {


[Libreoffice-commits] core.git: writerfilter/source

2023-06-10 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/ooxml/model.xml |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 3a6d360b5e585b8e92cc0d58d5fbc497448e11fb
Author: Tomaž Vajngerl 
AuthorDate: Sat Jun 10 22:22:17 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Jun 11 02:27:33 2023 +0200

oox: fix theme data in model.xml to use a correct types

Change-Id: Ifaa725d8a3e6c4cfefc92a6c5fcdb581610d3ce6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152832
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 888ffeba173c..526fbc223c16 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -10997,13 +10997,13 @@
   
 
 
-  
+  
 
 
-  
+  
 
 
-  
+  
 
   
   
@@ -12591,13 +12591,13 @@
   
 
 
-  
+  
 
 
-  
+  
 
 
-  
+  
 
 
   


[Libreoffice-commits] core.git: writerfilter/source

2023-06-06 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |   20 ---
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |3 --
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |5 ---
 3 files changed, 28 deletions(-)

New commits:
commit 4c5438b2c447403194420b69311a81ea7d36e157
Author: Miklos Vajna 
AuthorDate: Tue Jun 6 08:22:53 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 6 11:50:05 2023 +0200

sw floattable, DOCX import: clean up not needed dmapper-level anchor insert

This was added in commit 1c99616f86f7d5b83b91edc225fc95fec227d710 (sw
floattable, crashtesting: fix PDF export of forum-mso-en3-26783.docx,
2023-05-02) to ensure that in case a floating table is not followed by a
text node, then inject one at a dmapper level.

Later commit 01ad8ec4bb5425446e95dbada81de435646824b4 (sw floattable:
fix lost tables around a floating table from DOCX, 2023-06-05) did the
same at a tokenizer level, as doing it in dmapper is too late in some
cases.

So keep the testcase from the first commit, but the changes to dmapper
can be dropped.

Change-Id: If5b702d99e81a3f939491b7ff9de1128da765cbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152638
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index fb3113273079..3d778ce64458 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3173,17 +3173,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 break;
 case NS_ooxml::LN_tblStart:
 {
-if (m_pImpl->hasTableManager())
-{
-if (m_pImpl->getTableManager().IsFloating())
-{
-// We're starting a new table, but the previous table was 
floating. Insert a dummy
-// paragraph to ensure that the floating table is not anchored 
inside the next
-// table.
-finishParagraph();
-}
-}
-
 if (m_pImpl->hasTableManager())
 {
 bool bTableStartsAtCellStart = m_pImpl->m_nTableDepth > 0 && 
m_pImpl->m_nTableCellDepth > m_pImpl->m_nLastTableCellParagraphDepth + 1;
@@ -4781,15 +4770,6 @@ 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 (m_pImpl->m_nTableDepth == 0)
-{
-if (m_pImpl->hasTableManager())
-{
-// Non-table content, possibly after a table. Forget that such a 
previous table was
-// floating.
-m_pImpl->getTableManager().SetFloating(false);
-}
-}
 }
 
 void DomainMapper::commentProps(const OUString& sId, const CommentProperties& 
rProps)
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 9f467f7ae409..2c802d3ce2a9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -333,9 +333,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 break;
 case NS_ooxml::LN_CT_TblPrBase_tblpPr:
 {
-// Remember that this will be a floating table.
-m_bIsFloating = true;
-
 writerfilter::Reference::Pointer_t pProperties 
= rSprm.getProps();
 // Ignore  in shape text, those tables should be 
always non-floating ones.
 if (!m_bIsInShape && pProperties)
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 955ccfafc963..a2e492936b96 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -42,8 +42,6 @@ class DomainMapperTableManager : public TableManager
 sal_Int32   m_nTableWidth; //might be set directly or has to be 
calculated from the column positions
 /// Are we in a shape (text append stack is not empty) or in the body 
document?
 bool m_bIsInShape;
-/// Is the current table floating?
-bool m_bIsFloating = false;
 std::vector< OUString > m_aTableStyleNames;
 /// Moved table (in moveRangeFromStart...moveRangeFromEnd or 
moveRangeToStart...moveRangeToEnd)
 std::vector< OUString > m_aMoved;
@@ -167,9 +165,6 @@ public:
 return OUString();
 }
 
-bool IsFloating() const { return m_bIsFloating; }
-
-void SetFloating(bool bFloating) { m_bIsFloating = bFloating; }
 };
 
 }


[Libreoffice-commits] core.git: writerfilter/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 writerfilter/source/filter/RtfFilter.cxx|2 +-
 writerfilter/source/filter/WriterFilter.cxx |8 +++-
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 7157cf5dee03a8a62033025521a68eec2a08d1f4
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:15:44 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 20:58:31 2023 +0200

Use getXWeak in writerfilter

Change-Id: I3e0e68c44750f30bd1998c79dc74a13f2c9ade9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150886
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/filter/RtfFilter.cxx 
b/writerfilter/source/filter/RtfFilter.cxx
index 69c27585cd51..8f80b85353b2 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -167,7 +167,7 @@ sal_Bool RtfFilter::filter(const 
uno::Sequence& rDescripto
 {
 css::uno::Any anyEx = cppu::getCaughtException();
 // cannot throw WrongFormatException directly :(
-throw lang::WrappedTargetRuntimeException("", 
static_cast(this), anyEx);
+throw lang::WrappedTargetRuntimeException("", getXWeak(), anyEx);
 }
 catch (const uno::Exception&)
 {
diff --git a/writerfilter/source/filter/WriterFilter.cxx 
b/writerfilter/source/filter/WriterFilter.cxx
index 3ac82d766c6a..1cfb0bee5387 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -211,15 +211,13 @@ sal_Bool WriterFilter::filter(const 
uno::Sequence& rDescri
 {
 // note: SfxObjectShell checks for WrongFormatException
 io::WrongFormatException wfe(lcl_GetExceptionMessage(e));
-throw lang::WrappedTargetRuntimeException("", 
static_cast(this),
-  uno::Any(wfe));
+throw lang::WrappedTargetRuntimeException("", getXWeak(), 
uno::Any(wfe));
 }
 catch (xml::sax::SAXException const& e)
 {
 // note: SfxObjectShell checks for WrongFormatException
 io::WrongFormatException wfe(lcl_GetExceptionMessage(e));
-throw lang::WrappedTargetRuntimeException("", 
static_cast(this),
-  uno::Any(wfe));
+throw lang::WrappedTargetRuntimeException("", getXWeak(), 
uno::Any(wfe));
 }
 catch (uno::RuntimeException const&)
 {
@@ -230,7 +228,7 @@ sal_Bool WriterFilter::filter(const 
uno::Sequence& rDescri
 css::uno::Any anyEx = cppu::getCaughtException();
 SAL_WARN("writerfilter",
  "WriterFilter::filter(): failed with " << 
exceptionToString(anyEx));
-throw lang::WrappedTargetRuntimeException("", 
static_cast(this), anyEx);
+throw lang::WrappedTargetRuntimeException("", getXWeak(), anyEx);
 }
 
 // Adding some properties to the document's grab bag for 
interoperability purposes:


[Libreoffice-commits] core.git: writerfilter/source

2023-05-08 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 1e75a434e349110990bcccd80b5c63c11080853e
Author: Miklos Vajna 
AuthorDate: Mon May 8 12:08:01 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 8 13:37:53 2023 +0200

writerfilter: fix crash in DomainMapper_Impl::handleIndex()

Crashreport signature:

program/libwriterfilterlo.so
  
writerfilter::dmapper::DomainMapper_Impl::handleIndex(tools::SvRef
 const&, rtl::OUString const&)
  writerfilter/source/dmapper/DomainMapper_Impl.cxx:6116
program/libwriterfilterlo.so
  writerfilter::dmapper::DomainMapper_Impl::CloseFieldCommand()
  include/rtl/ustring.hxx:527
program/libwriterfilterlo.so
  writerfilter::dmapper::DomainMapper::lcl_text(unsigned char const*, 
unsigned long)
  writerfilter/source/dmapper/DomainMapper.cxx:3735
program/libwriterfilterlo.so
  writerfilter::rtftok::RTFDocumentImpl::singleChar(unsigned char, bool)
  writerfilter/source/rtftok/rtfdocumentimpl.hxx:718

Change-Id: I4e0f93ce50c8c9a1f9a1a0f9204bd4fee70cdde4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151502
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b3942b4654e9..83ce570dcbab 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6800,7 +6800,10 @@ void DomainMapper_Impl::handleIndex
 {
 sValue = sValue.replaceAll("\"", "");
 uno::Reference xTextColumns;
-xTOC->getPropertyValue(getPropertyName( PROP_TEXT_COLUMNS )) >>= 
xTextColumns;
+if (xTOC.is())
+{
+xTOC->getPropertyValue(getPropertyName( PROP_TEXT_COLUMNS )) >>= 
xTextColumns;
+}
 if (xTextColumns.is())
 {
 xTextColumns->setColumnCount( sValue.toInt32() );


[Libreoffice-commits] core.git: writerfilter/source

2023-05-08 Thread Hossein (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   20 +++
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit fdd7304485ce00177e4b61e6632d14d89d438756
Author: Hossein 
AuthorDate: Sat May 6 15:18:43 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 8 09:36:59 2023 +0200

Drop boost dependency for writerfilter

The last usage of boost in writerfilter was .
This is now implemented using rtl::math::stringToDouble(). To avoid
behavior change in case it does not find any suitable characters to
convert, it is checked that the index of the last parsed character to
be zero, as lexical_cast throwing bad_lexical_cast exception in this
case but stringToDouble reports rtl_math_ConversionStatus_Ok.

OUString::toDouble() is not enough here, as it does not provide suitable
error handling mechanism beyond IEEE 754 special values and 0 as output.

stringToDouble() should be able to handle 16-bit char strings, as it
takes std::u16string_view type string as input, and also uses sal_Unicode
as the data type for the separators.

The boost library is no longer in use in writerfilter. But, right now it
is not possible to remove the remainings from the makefiles and includes,
because of the dependencies that still use boost.

Change-Id: Iae4b83106fcbdded71e7d9e5f70376ab408e9b5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139279
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index c70615a49a9f..f2f09d8a22d4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -51,7 +51,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef DBG_UTIL
@@ -1248,15 +1247,16 @@ static void lcl_convertFormulaRanges(const 
uno::Reference & xT
 sLastCell = 
xCell->getPropertyValue("CellName").get();
 if (sNextCell.isEmpty())
 sNextCell = sLastCell;
-try
-{
-// accept numbers with comma and 
percent
-OUString sCellText = 
xText->getString().replace(',', '.');
-if (sCellText.endsWith("%"))
-sCellText = sCellText.copy(0, 
sCellText.getLength()-1);
-
boost::lexical_cast(sCellText);
-}
-catch( boost::bad_lexical_cast const& )
+
+// accept numbers with comma and 
percent
+OUString sCellText = 
xText->getString().replace(',', '.');
+if (sCellText.endsWith("%"))
+sCellText = sCellText.copy(0, 
sCellText.getLength()-1);
+
+rtl_math_ConversionStatus 
eConversionStatus;
+sal_Int32 nParsedEnd;
+rtl::math::stringToDouble(sCellText, 
'.', ',', , );
+if ( eConversionStatus != 
rtl_math_ConversionStatus_Ok || nParsedEnd == 0 )
 {
 if ( !bFoundFirst )
 {


[Libreoffice-commits] core.git: writerfilter/source

2023-05-07 Thread Julien Nabet (via logerrit)
 writerfilter/source/dmapper/TrackChangesHandler.cxx |   21 ++--
 1 file changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 002ae41bb6088002ba3ed0188ac822fb823a23f9
Author: Julien Nabet 
AuthorDate: Sun May 7 17:11:16 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun May 7 23:15:54 2023 +0200

Simplify some initializations in writerfilter

Change-Id: Ib9f653c6add8713a9acf9f6b4605323bcb2c6db6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151470
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/TrackChangesHandler.cxx 
b/writerfilter/source/dmapper/TrackChangesHandler.cxx
index 212f88261c4a..47a52d6df695 100644
--- a/writerfilter/source/dmapper/TrackChangesHandler.cxx
+++ b/writerfilter/source/dmapper/TrackChangesHandler.cxx
@@ -6,6 +6,7 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
+#include 
 #include "TrackChangesHandler.hxx"
 #include "PropertyMap.hxx"
 #include "ConversionHelper.hxx"
@@ -56,9 +57,6 @@ void TrackChangesHandler::lcl_attribute(Id rName, Value & 
rVal)
 
 uno::Sequence 
TrackChangesHandler::getRedlineProperties() const
 {
-uno::Sequence< beans::PropertyValue > aRedlineProperties(3);
-beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
-
 OUString sType;
 switch ( m_pRedlineParams->m_nToken & 0x )
 {
@@ -75,17 +73,12 @@ uno::Sequence 
TrackChangesHandler::getRedlineProperties()
 sType = getPropertyName( PROP_TABLE_CELL_DELETE );
 break;
 }
-
-pRedlineProperties[0].Name = getPropertyName( PROP_REDLINE_TYPE );
-pRedlineProperties[0].Value <<= sType;
-pRedlineProperties[1].Name = getPropertyName( PROP_REDLINE_AUTHOR );
-pRedlineProperties[1].Value <<= m_pRedlineParams->m_sAuthor;
-pRedlineProperties[2].Name = getPropertyName( PROP_REDLINE_DATE_TIME );
-pRedlineProperties[2].Value <<= 
ConversionHelper::ConvertDateStringToDateTime( m_pRedlineParams->m_sDate );
-//pRedlineProperties[3].Name = getPropertyName( 
PROP_REDLINE_REVERT_PROPERTIES );
-//pRedlineProperties[3].Value <<= pRedline->m_aRevertProperties;
-
-return aRedlineProperties;
+return {
+   comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_TYPE 
), uno::Any(sType)),
+   
comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_AUTHOR), 
uno::Any(m_pRedlineParams->m_sAuthor)),
+   
comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_DATE_TIME), 
uno::Any(ConversionHelper::ConvertDateStringToDateTime( 
m_pRedlineParams->m_sDate )))
+   
//comphelper::makePropertyValue(getPropertyName(PROP_REDLINE_REVERT_PROPERTIES),
 uno::Any(pRedline->m_aRevertProperties))
+   };
 }
 
 void TrackChangesHandler::lcl_sprm(Sprm &) {}


[Libreoffice-commits] core.git: writerfilter/source

2023-05-03 Thread Jaume Pujantell (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 5431b756d45bebe74beaba2026704552ee6891f0
Author: Jaume Pujantell 
AuthorDate: Thu Apr 27 14:54:55 2023 +0200
Commit: Ashod Nakashian 
CommitDate: Wed May 3 12:42:31 2023 +0200

tdf#154478 fix comments empy after ToC

TOC creation entered a malformed state where it interfered with
the creation of other elements (e.g. annotations and textboxes).
This change is also a fix to tdf#154481, so the patch from
94de79e7d3c98 can be removed.

Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8407aaf7c58a..b3942b4654e9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5215,15 +5215,6 @@ void DomainMapper_Impl::PushTextBoxContent()
 if (m_bIsInTextBox)
 return;
 
-// tdf#154481: check for TOC creation with empty field stack,
-// and close TOC, unless pages will lost. FIXME.
-if (IsInTOC() && m_aFieldStack.size() == 0)
-{
-m_bStartTOC = false;
-SAL_WARN("writerfilter.dmapper",
- "broken TOC creation in textbox, but field stack is empty, so 
closing TOC!");
-}
-
 try
 {
 uno::Reference xTBoxFrame(
@@ -6720,7 +6711,13 @@ uno::Reference 
DomainMapper_Impl::createSectionForRange(
 if (stepLeft)
 xCursor->goLeft(1, true);
 uno::Reference< text::XTextContent > xSection( 
m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW );
-xSection->attach( uno::Reference< text::XTextRange >( xCursor, 
uno::UNO_QUERY_THROW) );
+try
+{
+xSection->attach( uno::Reference< text::XTextRange >( xCursor, 
uno::UNO_QUERY_THROW) );
+}
+catch(const uno::Exception&)
+{
+}
 xRet.set(xSection, uno::UNO_QUERY );
 }
 catch(const uno::Exception&)


[Libreoffice-commits] core.git: writerfilter/source

2023-05-02 Thread Vasily Melenchuk (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |   45 +++
 1 file changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 2d0a87f97e2c9ac50cd6ce329ca8256daf94ead4
Author: Vasily Melenchuk 
AuthorDate: Wed Apr 26 18:03:18 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Wed May 3 01:16:52 2023 +0200

tdf#151974: writerfilter: apply props only to new document

Properties applied to document shoudl be a case only for new doc,
but DomainMapper can be called during pasing of RTF and cause
modifications to props in already open document.

Tested only for "NoNumberingShowFollowBy" but I assume this is
a case for all compatibility props.

Change-Id: I4558d809ca477918373b15fa05500ed985e170a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151069
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 9da64ce6921a..3db5c2970705 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -116,26 +116,31 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 mbHasControls(false),
 mbWasShapeInPara(false)
 {
-// #i24363# tab stops relative to indent
-m_pImpl->SetDocumentSettingsProperty(
-getPropertyName( PROP_TABS_RELATIVE_TO_INDENT ),
-uno::Any( false ) );
-m_pImpl->SetDocumentSettingsProperty(
-getPropertyName( PROP_SURROUND_TEXT_WRAP_SMALL ),
-uno::Any( true ) );
-m_pImpl->SetDocumentSettingsProperty(
-getPropertyName( PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ),
-uno::Any( true ) );
-
-// Don't load the default style definitions to avoid weird mix
-m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("MsWordCompTrailingBlanks", 
uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
- uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", 
uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", 
uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", 
uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", 
uno::Any(true));
+if (m_pImpl->IsNewDoc())
+{
+// #i24363# tab stops relative to indent
+m_pImpl->SetDocumentSettingsProperty(
+getPropertyName(PROP_TABS_RELATIVE_TO_INDENT),
+uno::Any(false));
+m_pImpl->SetDocumentSettingsProperty(
+getPropertyName(PROP_SURROUND_TEXT_WRAP_SMALL),
+uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty(
+getPropertyName(PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING),
+uno::Any(true));
+
+// Don't load the default style definitions to avoid weird mix
+m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", 
uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty("MsWordCompTrailingBlanks", 
uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
+uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", 
uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", 
uno::Any(true));
+
m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", 
uno::Any(true));
+
+// Enable only for new documents, since pasting from clipboard can 
influence existing doc
+m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", 
uno::Any(true));
+}
 
 // Initialize RDF metadata, to be able to add statements during the import.
 try


[Libreoffice-commits] core.git: writerfilter/source

2023-04-29 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 621a7ac49500a2f9e7381a6e4a79675bf8d1043d
Author: Mike Kaganski 
AuthorDate: Sat Apr 29 15:55:07 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sat Apr 29 21:31:52 2023 +0200

Simplify a bit

Change-Id: Idd17018c0fe452979f699d63f2166ae95241a3b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151129
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 25f5efe83b72..8407aaf7c58a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2402,9 +2402,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 if (pPropertyMap)
 {
 aProperties = comphelper::sequenceToContainer< 
std::vector >(pPropertyMap->GetPropertyValues());
-}
-if (pPropertyMap)
-{
+
 // tdf#64222 filter out the "paragraph marker" formatting and
 // set it as a separate paragraph property, not a empty hint at
 // end of paragraph


[Libreoffice-commits] core.git: writerfilter/source

2023-04-26 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |3 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|3 ---
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|3 ---
 3 files changed, 9 deletions(-)

New commits:
commit 400d970f27078a93eab97ead8a6934a32272f549
Author: Miklos Vajna 
AuthorDate: Wed Apr 26 16:17:10 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 26 19:46:11 2023 +0200

sw floattable: DOCX import: m_bConvertedTable is now unused

This was added in commit 659c0227a50d298780d72902314e03df8824bc06
(tdf#107889 DOCX import: consider page breaks for multi-page
floattables, 2017-05-16), but is no longer used since commit
c50bf5a5daaae3d40f89ea0784a75a8a571c208d (sw floattable: remove no
longer needed DOCX import heuristics, 2023-04-12).

Change-Id: Ieba43e1175ab59c29c0555299facb8fc0e865acf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151067
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 5bd89ee41289..eaddae615817 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1585,9 +1585,6 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 AfterConvertToTextFrame(m_rDMapper_Impl, aFramedRedlines, 
redPos, redLen, redCell, redTable);
 }
 }
-
-// We're right after a table conversion.
-m_rDMapper_Impl.m_bConvertedTable = true;
 }
 
 m_aTableProperties.clear();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6cb0c1d90d28..25f5efe83b72 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2627,9 +2627,6 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 rAppendContext.m_aAnchoredObjects.clear();
 }
 
-// We're no longer right after a table conversion.
-m_bConvertedTable = false;
-
 if (xCursor.is())
 {
 xCursor->goLeft(1, true);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 38e214ee5b2f..5591733cce90 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -1023,9 +1023,6 @@ public:
 
 DeletableTabStopm_aCurrentTabStop;
 
-/// If we're right after the end of a table.
-bool m_bConvertedTable = false;
-
 bool IsOOXMLImport() const { return m_eDocumentType == 
SourceDocumentType::OOXML; }
 
 bool IsRTFImport() const { return m_eDocumentType == 
SourceDocumentType::RTF; }


[Libreoffice-commits] core.git: writerfilter/source

2023-04-08 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/NumberingManager.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 2c364d7564ee24d119c21d1738d78982303c4cdc
Author: Mike Kaganski 
AuthorDate: Sat Apr 8 10:01:53 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sat Apr 8 13:55:10 2023 +0200

Simplify a bit

Avoids creation of immediately destructed object in case of outline

Change-Id: I72bfb4c5b4020619b61d432c3eee59304fce9795
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150144
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index ea4fb36ec4a2..717eb5ea9788 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -531,17 +531,15 @@ void ListDef::CreateNumberingRules( DomainMapper& 
rDMapper,
 try
 {
 // Create the numbering style
-uno::Reference< beans::XPropertySet > xStyle (
-xFactory->createInstance("com.sun.star.style.NumberingStyle"),
-uno::UNO_QUERY_THROW );
-
 if (GetId() == nOutline)
 m_StyleName = "Outline"; //SwNumRule.GetOutlineRuleName()
 else
-xStyles->insertByName(GetStyleName(GetId(), xStyles), 
css::uno::Any(xStyle));
+xStyles->insertByName(
+GetStyleName(GetId(), xStyles),
+
css::uno::Any(xFactory->createInstance("com.sun.star.style.NumberingStyle")));
 
 uno::Any oStyle = xStyles->getByName(GetStyleName());
-xStyle.set( oStyle, uno::UNO_QUERY_THROW );
+uno::Reference< beans::XPropertySet > xStyle( oStyle, 
uno::UNO_QUERY_THROW );
 
 // Get the default OOo Numbering style rules
 uno::Any aRules = xStyle->getPropertyValue( getPropertyName( 
PROP_NUMBERING_RULES ) );


[Libreoffice-commits] core.git: writerfilter/source

2023-03-23 Thread Noel Grandin (via logerrit)
 writerfilter/source/ooxml/factoryimpl_ns.py |   14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

New commits:
commit 7ecc9925f3b0d1cea4ee7201473dd6fbbb95c271
Author: Noel Grandin 
AuthorDate: Thu Mar 23 11:23:15 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 23 17:07:20 2023 +

mutex in OOXMLFactory_* is unused

Change-Id: I55cf235919df3c19019ca5d280f10f6720cc4f15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149416
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py 
b/writerfilter/source/ooxml/factoryimpl_ns.py
index 263da3ebe9dc..64a220b9a44b 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -11,24 +11,13 @@ from xml.dom import minidom
 import sys
 
 
-# factoryMutexDecl
-
-
-def factoryMutexDecl(nsLabel):
-print("typedef rtl::Static 
OOXMLFactory_%s_Mutex;" % (nsLabel, nsLabel))
-print()
-
-
 # factoryConstructor
 
 
 def factoryConstructor(nsLabel):
 print("""OOXMLFactory_%s::OOXMLFactory_%s()
 {
-// multi-thread-safe mutex for all platforms
-
-osl::MutexGuard aGuard(OOXMLFactory_%s_Mutex::get());
-}""" % (nsLabel, nsLabel, nsLabel))
+}""" % (nsLabel, nsLabel))
 print()
 
 
@@ -738,7 +727,6 @@ using namespace com::sun::star;
 for nsNode in [i for i in getChildrenByName(modelNode, "namespace") if 
i.getAttribute("name") == nsName]:
 nsLabel = nsToLabel(nsNode)
 
-factoryMutexDecl(nsLabel)
 factoryConstructor(nsLabel)
 factoryDestructor(nsLabel)
 factoryGetInstance(nsLabel)


[Libreoffice-commits] core.git: writerfilter/source

2023-03-21 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 24d2e8ea7a17ded531d19cba3f1cb30b17833eea
Author: Mike Kaganski 
AuthorDate: Tue Mar 21 19:18:14 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Mar 21 20:13:36 2023 +

Simplify a bit

Also takes care of one place where dereferencing wasn't safe

Change-Id: I4ed67ad709610bea9cbed8184710f53d18d76d11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149225
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ffcd883289bd..37f7059118c8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6218,7 +6218,6 @@ void DomainMapper_Impl::handleToc
 OUString sTemplate;
 OUString sChapterNoSeparator;
 OUString sFigureSequence;
-uno::Reference< beans::XPropertySet > xTOC;
 OUString aBookmarkName;
 
 //  \a Builds a table of figures but does not include the 
captions's label and number
@@ -6317,6 +6316,8 @@ void DomainMapper_Impl::handleToc
 
 const OUString aTocTitle = extractTocTitle();
 
+uno::Reference xTOC;
+
 if (m_xTextFactory.is() && ! m_aTextAppendStack.empty())
 {
 const auto& xTextAppend = GetTopTextAppend();
@@ -6352,13 +6353,17 @@ void DomainMapper_Impl::handleToc
 }
 
 m_bStartTOC = true;
+pContext->SetTOC(xTOC);
+m_bParaHadField = false;
 
-if (xTOC.is())
-xTOC->setPropertyValue(getPropertyName( PROP_TITLE ), 
uno::Any(aTocTitle));
+if (!xTOC)
+return;
+
+xTOC->setPropertyValue(getPropertyName( PROP_TITLE ), uno::Any(aTocTitle));
 
 if (!aBookmarkName.isEmpty())
 xTOC->setPropertyValue(getPropertyName(PROP_TOC_BOOKMARK), 
uno::Any(aBookmarkName));
-if( !bTableOfFigures && xTOC.is() )
+if (!bTableOfFigures)
 {
 xTOC->setPropertyValue( getPropertyName( PROP_LEVEL ), uno::Any( 
nMaxLevel ) );
 xTOC->setPropertyValue( getPropertyName( PROP_CREATE_FROM_OUTLINE ), 
uno::Any( bFromOutline ));
@@ -6427,7 +6432,7 @@ void DomainMapper_Impl::handleToc
 }
 }
 }
-else if (bTableOfFigures && xTOC.is())
+else // if (bTableOfFigures)
 {
 if (!sFigureSequence.isEmpty())
 xTOC->setPropertyValue(getPropertyName(PROP_LABEL_CATEGORY),
@@ -6452,8 +6457,6 @@ void DomainMapper_Impl::handleToc
 xLevelFormats->replaceByIndex( 1, uno::Any( aNewLevel ) );
 }
 }
-pContext->SetTOC( xTOC );
-m_bParaHadField = false;
 }
 
 uno::Reference DomainMapper_Impl::createSectionForRange(


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 97b84d31a1db2ec690d180effad307f331d62fb9
Author: Justin Luth 
AuthorDate: Mon Mar 13 13:02:40 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 16:16:52 2023 +

tdf#154129 tdf#78590 writerfilter framePr: deduplicate grabbag

Well, not really deduplicate, because it only existed once.
But I can't imagine why it would depend on a parent style.

It was added with commit 1c876f5616522ab695de8c0316cdb0c601081815
Author: Rohit Deshmukh on  Fri Jun 13 11:39:56 2014 +0530
fdo#78590: Fix for Corruption of para with framePr & drawing object into 
para

Typically only RTF files don't have a parent style,
so the lack of it being there in the "else" clause
likely wouldn't have been noticed.

Change-Id: I36828863f9bc9b51fbd7c019d3865ac477662795
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148816
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2324fa78c2b5..1c27e8ccfdc6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1817,14 +1817,10 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(comphelper::makePropertyValue(
 getPropertyName(PROP_BACK_COLOR_TRANSPARENCY), sal_Int32(100)));
 
-if (vProps.size() > 1)
-{
-
-uno::Sequence aGrabBag( 
comphelper::InitPropertySequence({
-{ "ParaFrameProperties", 
uno::Any(rAppendContext.pLastParagraphProperties->IsFrameMode()) }
-}));
-
aFrameProperties.push_back(comphelper::makePropertyValue("FrameInteropGrabBag", 
aGrabBag));
-}
+uno::Sequence 
aGrabBag(comphelper::InitPropertySequence(
+{ { "ParaFrameProperties",
+
uno::Any(rAppendContext.pLastParagraphProperties->IsFrameMode()) } }));
+
aFrameProperties.push_back(comphelper::makePropertyValue("FrameInteropGrabBag", 
aGrabBag));
 
 lcl_MoveBorderPropertiesToFrame(aFrameProperties,
 
rAppendContext.pLastParagraphProperties->GetStartingRange(),


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit d21ba804040bdb275234254fbbe742ce830420c2
Author: Justin Luth 
AuthorDate: Mon Mar 13 12:46:28 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 16:15:50 2023 +

tdf#154129 tdf#97128 writerfilter framePr: deduplicate PopFrameDirection

Well, not really deduplicate, because it only existed once.
But I can't imagine why it would depend on a parent style.

Recently added with 7.1 commit af4e5ee0f93c1ff442d08caed5c875f2b2c1fd43
Author: Daniel Arato (NISZ) on  Wed Sep 16 08:48:32 2020 +0200
tdf#97128 DOCX import: fix frame direction

Typically only RTF files don't have a parent style,
so the lack of it being there in the "else" clause
likely wouldn't have been noticed.

Change-Id: I8e561dcfc5a1dfc6ac1979ad4226b6c5f35800d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148814
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 09492826f13f..0f8991819b3b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1805,13 +1805,14 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 getPropertyName(PROP_BOTTOM_MARGIN),
 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
 
-if (vProps.size() > 1)
+if (const std::optional nDirection = PopFrameDirection())
 {
-if (const std::optional nDirection = 
PopFrameDirection())
-{
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
-}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION), 
*nDirection));
+}
 
+if (vProps.size() > 1)
+{
 // If there is no fill, the Word default is 100% transparency.
 // Otherwise CellColorHandler has priority, and this setting
 // will be ignored.


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   76 +-
 1 file changed, 32 insertions(+), 44 deletions(-)

New commits:
commit a777dab7544bd11c26ae26c40cce49ab976dab2d
Author: Justin Luth 
AuthorDate: Mon Mar 13 11:31:00 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 12:39:40 2023 +

tdf#154129 tdf#73546 writerfilter framePr: fix/deduplicate w:v/hSpace

This is not quite a No Functional Change commit.

Now, the difference between the two clauses that I am calling
deduplicated is rather severe in this case.
But that seems to be because only one half was fixed with
4.3 commit 896714db527f39497aedee8946964e5acd73778c
Author: umeshkadam on Fri Jan 17 19:00:29 2014 +0530
fdo#73546 : faulty value of attribute value in  tag

So I expect that the "else" side is simply wrong.
That side is generally only hit by RTF formatted files
(or docx that are basically missing styles.xml).

Change-Id: Id0fd4f4807c38f281d2fbf8f805a49d6ae9acc0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148813
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 538409dae704..09492826f13f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1773,6 +1773,38 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), 
nWrap));
 
+sal_Int32 nRightDist = 0;
+sal_Int32 nLeftDist = 0;
+for (const auto pProp : vProps)
+{
+if (pProp->GethSpace() < 0)
+continue;
+nLeftDist = nRightDist = pProp->GethSpace();
+break;
+}
+aFrameProperties.push_back(comphelper::makePropertyValue(
+getPropertyName(PROP_LEFT_MARGIN),
+nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
+aFrameProperties.push_back(comphelper::makePropertyValue(
+getPropertyName(PROP_RIGHT_MARGIN),
+nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
+
+sal_Int32 nBottomDist = 0;
+sal_Int32 nTopDist = 0;
+for (const auto pProp : vProps)
+{
+if (pProp->GetvSpace() < 0)
+continue;
+nTopDist = nBottomDist = pProp->GetvSpace();
+break;
+}
+aFrameProperties.push_back(comphelper::makePropertyValue(
+getPropertyName(PROP_TOP_MARGIN),
+nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
+aFrameProperties.push_back(comphelper::makePropertyValue(
+getPropertyName(PROP_BOTTOM_MARGIN),
+nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
+
 if (vProps.size() > 1)
 {
 if (const std::optional nDirection = 
PopFrameDirection())
@@ -1780,36 +1812,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-
-/** FDO#73546 : distL & distR should be unsigned integers 
-Swapped the array elements 11,12 & 13,14 since 11 & 12 are
-LEFT & RIGHT margins and 13,14 are TOP and BOTTOM margins 
respectively.
-*/
-sal_Int32 nRightDist = 0;
-sal_Int32 nLeftDist = 0;
-for (const auto pProp : vProps)
-{
-if (pProp->GethSpace() < 0)
-continue;
-nLeftDist = nRightDist = pProp->GethSpace();
-break;
-}
-
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
-
-sal_Int32 nBottomDist = 0;
-sal_Int32 nTopDist = 0;
-for (const auto pProp : vProps)
-{
-if (pProp->GetvSpace() < 0)
-continue;
-nTopDist = nBottomDist = pProp->GetvSpace();
-break;
-}
-
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
 // If there is no fill, the Word default is 100% transparency.
 // Otherwise 

[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 4237db7f43c08efbf166a2bfa8a0c99d1c5f04a4
Author: Justin Luth 
AuthorDate: Mon Mar 13 10:44:16 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 12:38:17 2023 +

NFC tdf#154129 writerfilter framePr: deduplicate lcl.. call

Change-Id: Iedaea9d6d6f344ebd66bf83d1a9ee243cae5875b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148812
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c10703ba2bee..538409dae704 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1819,10 +1819,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 { "ParaFrameProperties", 
uno::Any(rAppendContext.pLastParagraphProperties->IsFrameMode()) }
 }));
 
aFrameProperties.push_back(comphelper::makePropertyValue("FrameInteropGrabBag", 
aGrabBag));
-
-lcl_MoveBorderPropertiesToFrame(aFrameProperties,
-rAppendContext.pLastParagraphProperties->GetStartingRange(),
-rAppendContext.pLastParagraphProperties->GetEndingRange());
 }
 else
 {
@@ -1837,12 +1833,12 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 nHoriDist = 0;
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
-
-lcl_MoveBorderPropertiesToFrame(aFrameProperties,
-rAppendContext.pLastParagraphProperties->GetStartingRange(),
-rAppendContext.pLastParagraphProperties->GetEndingRange());
 }
 
+lcl_MoveBorderPropertiesToFrame(aFrameProperties,
+
rAppendContext.pLastParagraphProperties->GetStartingRange(),
+
rAppendContext.pLastParagraphProperties->GetEndingRange());
+
 //frame conversion has to be executed after table conversion
 RegisterFrameConversion(
 rAppendContext.pLastParagraphProperties->GetStartingRange(),


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   24 ++
 1 file changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 33ce22f080bbedfde78fdc907b0d4d5bd0f68f14
Author: Justin Luth 
AuthorDate: Sat Mar 11 19:04:06 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 15 12:38:02 2023 +

tdf#154129 writerfilter framePr: deduplicate w:wrap

This is not quite a No Functional Change commit.

Likely it was a mistake that this was different for no-parent style.
Ahh, yes. commit 3eda8234acf09cd5a31cdcde76f04631a51fcc37
Author: Caolán McNcNamara on Thu Apr 27 15:25:20 2017 +0100
Resolves: tdf#107411 LibreOffice hangs at RTF import time
made the change to only one half.

Basically only RTF format ever has no "parent style",
so this should be a rather safe change to make.

MAKE_FIXED_SIZE is ENUM_MAX which would be
define SAL_MAX_ENUM 0x7fff.

Change-Id: I72ebfbdfbf656450068339326ad2a182d56b291f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148811
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 822746e5f02e..c10703ba2bee 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1762,6 +1762,17 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), 
nVAnchor));
 
+text::WrapTextMode nWrap = text::WrapTextMode_NONE;
+for (const auto pProp : vProps)
+{
+if (pProp->GetWrap() == 
text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
+continue;
+nWrap = pProp->GetWrap();
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), 
nWrap));
+
 if (vProps.size() > 1)
 {
 if (const std::optional nDirection = 
PopFrameDirection())
@@ -1769,16 +1780,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-text::WrapTextMode nWrap = text::WrapTextMode_NONE;
-for (const auto pProp : vProps)
-{
-if (pProp->GetWrap() == 
text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
-continue;
-nWrap = pProp->GetWrap();
-break;
-}
-aFrameProperties.push_back(
-comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), 
nWrap));
 
 /** FDO#73546 : distL & distR should be unsigned integers 
 Swapped the array elements 11,12 & 13,14 since 11 & 12 are
@@ -1837,9 +1838,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
 
-if( rAppendContext.pLastParagraphProperties->GetWrap() >= 
text::WrapTextMode_NONE )
-
aFrameProperties.push_back(comphelper::makePropertyValue("Surround", 
rAppendContext.pLastParagraphProperties->GetWrap()));
-
 lcl_MoveBorderPropertiesToFrame(aFrameProperties,
 rAppendContext.pLastParagraphProperties->GetStartingRange(),
 rAppendContext.pLastParagraphProperties->GetEndingRange());


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   39 ++
 1 file changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 2d331e6bfe8c9ca31f1a4e092dbcffb8919b8655
Author: Justin Luth 
AuthorDate: Mon Mar 13 10:32:28 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:51:21 2023 +

tdf#154129 writerfilter framePr: deduplicate w:vAnchor

This is not a No Functional Change commit.

However, it seems that pretty much only RTF
fails to typically have styles defined,
since even an unspecified "Normal" style is checked.

That means that in all but the most bizarre cases,
the "no style" case would never be reached anyway.
That really eliminates any worries about the deduplication going bad.

In any case, I can't see any reason why the same qualification
is not made if there is no parent style involved.

make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287
make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287B

Change-Id: Ied79f83dcd18304ae0d86c0b7843cd36a532ae93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148810
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 34442046c706..822746e5f02e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1744,6 +1744,24 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), 
nVertOrient));
 
+//Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
+sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
+// vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not 
defined,
+// but there is a defined vAlign, then a missing vAnchor should become 
'margin'.
+if (!bValidY && nVertOrient)
+{
+nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
+}
+for (const auto pProp : vProps)
+{
+if (pProp->GetvAnchor() < 0)
+continue;
+nVAnchor = pProp->GetvAnchor();
+break;
+}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), 
nVAnchor));
+
 if (vProps.size() > 1)
 {
 if (const std::optional nDirection = 
PopFrameDirection())
@@ -1751,24 +1769,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-//Default the anchor in case FramePr_vAnchor is missing ECMA 
17.3.1.11
-sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
-// vAlign is ignored if vAnchor is set to 'text'. So, if w:y is 
not defined,
-// but there is a defined vAlign, then a missing vAnchor should 
become 'margin'.
-if (!bValidY && nVertOrient)
-{
-nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
-}
-for (const auto pProp : vProps)
-{
-if (pProp->GetvAnchor() < 0)
-continue;
-nVAnchor = pProp->GetvAnchor();
-break;
-}
-aFrameProperties.push_back(comphelper::makePropertyValue(
-getPropertyName(PROP_VERT_ORIENT_RELATION), nVAnchor));
-
 text::WrapTextMode nWrap = text::WrapTextMode_NONE;
 for (const auto pProp : vProps)
 {
@@ -1837,9 +1837,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
 
-if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
-
aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor(;
-
 if( rAppendContext.pLastParagraphProperties->GetWrap() >= 
text::WrapTextMode_NONE )
 
aFrameProperties.push_back(comphelper::makePropertyValue("Surround", 
rAppendContext.pLastParagraphProperties->GetWrap()));
 


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +-
 1 file changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 070e62bad980cbe15dfbe9096a5e5d962a70f07c
Author: Justin Luth 
AuthorDate: Mon Mar 13 10:16:02 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:50:02 2023 +

tdf#154129 writerfilter framePr: deduplicate w:hAnchor

This is not quite a No Functional Change commit.

If there was no anchor specified, and no parent style,
then no property was written at all.

Basically only RTF format ever has no "parent style",
so this should be a rather safe change to make.

Change-Id: Ibeecd489deb876c64a2ba6ca2b700e4a03dbd316
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148809
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48f92e1e6dbb..34442046c706 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1708,6 +1708,18 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), 
nHoriOrient));
 
+//Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11
+sal_Int16 nHAnchor = text::RelOrientation::FRAME; // 'text'
+for (const auto pProp : vProps)
+{
+if (pProp->GethAnchor() < 0)
+continue;
+nHAnchor = pProp->GethAnchor();
+break;
+}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_RELATION), 
nHAnchor));
+
 bool bValidY = false;
 sal_Int32 nY = DEFAULT_VALUE;
 for (const auto pProp : vProps)
@@ -1739,18 +1751,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-//Default the anchor in case FramePr_hAnchor is missing ECMA 
17.3.1.11
-sal_Int16 nHAnchor = text::RelOrientation::FRAME;
-for (const auto pProp : vProps)
-{
-if (pProp->GethAnchor() < 0)
-continue;
-nHAnchor = pProp->GethAnchor();
-break;
-}
-aFrameProperties.push_back(comphelper::makePropertyValue(
-getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor));
-
 //Default the anchor in case FramePr_vAnchor is missing ECMA 
17.3.1.11
 sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
 // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is 
not defined,
@@ -1837,9 +1837,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
 
-if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 )
-
aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor(;
-
 if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
 
aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor(;
 


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   30 +-
 1 file changed, 13 insertions(+), 17 deletions(-)

New commits:
commit 611288b64548762e0731ed6323e1653e4fca2317
Author: Justin Luth 
AuthorDate: Mon Mar 13 10:09:46 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:49:16 2023 +

tdf#154129 writerfilter framePr: deduplicate w:y

This is not quite a No Functional Change commit.
In the previous code, a zero value for Y was not added as a property
if there was no parent style.

Basically only RTF format ever has no "parent style",
so this should be a rather safe change to make.

I've done the same thing for others as well.

Change-Id: I4a7ecb194ad8cbedf6d1b5c66cac7b10a1532b98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148808
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 624a2da20b30..48f92e1e6dbb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1708,6 +1708,19 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), 
nHoriOrient));
 
+bool bValidY = false;
+sal_Int32 nY = DEFAULT_VALUE;
+for (const auto pProp : vProps)
+{
+bValidY = pProp->IsyValid();
+if (!bValidY)
+continue;
+nY = pProp->Gety();
+break;
+}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION), nY));
+
 sal_Int16 nVertOrient = text::VertOrientation::NONE;
 for (const auto pProp : vProps)
 {
@@ -1738,20 +1751,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(comphelper::makePropertyValue(
 getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor));
 
-//set a non negative default value
-bool bValidY = false;
-sal_Int32 nY = DEFAULT_VALUE;
-for (const auto pProp : vProps)
-{
-bValidY = pProp->IsyValid();
-if (!bValidY)
-continue;
-nY = pProp->Gety();
-break;
-}
-aFrameProperties.push_back(
-
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION), nY));
-
 //Default the anchor in case FramePr_vAnchor is missing ECMA 
17.3.1.11
 sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
 // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is 
not defined,
@@ -1841,9 +1840,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 )
 
aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor(;
 
-if( rAppendContext.pLastParagraphProperties->IsyValid() )
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION),
 rAppendContext.pLastParagraphProperties->Gety()));
-
 if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
 
aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor(;
 


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   30 +-
 1 file changed, 13 insertions(+), 17 deletions(-)

New commits:
commit 1188fa78d0e7b5fd8f4c7c207fd4ec9ced666c12
Author: Justin Luth 
AuthorDate: Mon Mar 13 10:08:50 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:48:42 2023 +

tdf#154129 writerfilter framePr: deduplicate w:x

This is not quite a No Functional Change commit.
In the previous code, a zero value for X was not added as a property
if there was no parent style.

Basically only RTF format ever has no "parent style",
so this should be a rather safe change to make.

I've done the same thing for others as well.

Change-Id: Iaf4eb45b3adae88622fa9be16b5237db101a631e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148807
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index adbb436b9fec..624a2da20b30 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1684,6 +1684,19 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), 
nhRule));
 
+bool bValidX = false;
+sal_Int32 nX = DEFAULT_VALUE;
+for (const auto pProp : vProps)
+{
+bValidX = pProp->IsxValid();
+if (!bValidX)
+continue;
+nX = pProp->Getx();
+break;
+}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), nX));
+
 sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
 for (const auto pProp : vProps)
 {
@@ -1713,20 +1726,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-//set a non negative default value
-bool bValidX = false;
-sal_Int32 nX = DEFAULT_VALUE;
-for (const auto pProp : vProps)
-{
-bValidX = pProp->IsxValid();
-if (!bValidX)
-continue;
-nX = pProp->Getx();
-break;
-}
-aFrameProperties.push_back(
-
comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), nX));
-
 //Default the anchor in case FramePr_hAnchor is missing ECMA 
17.3.1.11
 sal_Int16 nHAnchor = text::RelOrientation::FRAME;
 for (const auto pProp : vProps)
@@ -1839,9 +1838,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
 
-if( rAppendContext.pLastParagraphProperties->IsxValid() )
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION),
 rAppendContext.pLastParagraphProperties->Getx()));
-
 if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 )
 
aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor(;
 


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f2a10d9e751bdbc4ba981b6ca9d0dc127439a3c2
Author: Justin Luth 
AuthorDate: Mon Mar 13 09:52:08 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:48:02 2023 +

tdf#154129 writerfilter framePr: nhRule obey comment instructions

The comment says
"[MS-OE376] Word uses a default value of "atLeast" for
 this attribute when the value of the h attribute is not 0."

But the code was setting MIN even when the attribute was 0.
I think that was a mistake.

Errata documentation confirms:
"The standard states that 0 is a valid value of the h attribute.
HOWEVER Word treats a value of 0 on this attribute as a value of auto."

// The height of the object is determined by the content only.
const short SizeType::VARIABLE = 0;

Change-Id: I1a74da6c5cd25024aba82a68238580a7ca90c9c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148806
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 910fe366fa93..adbb436b9fec 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1670,7 +1670,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 }
 if (nhRule < 0)
 {
-if (bValidH)
+if (bValidH && nHeight)
 {
 // [MS-OE376] Word uses a default value of "atLeast" for
 // this attribute when the value of the h attribute is not 0.


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   92 --
 1 file changed, 37 insertions(+), 55 deletions(-)

New commits:
commit af8f05f859a1fb61d88dfe558d1bc7a8282c792a
Author: Justin Luth 
AuthorDate: Mon Mar 13 09:47:29 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:46:45 2023 +

tdf#154129 writerfilter framePr: deduplicate w:h

This is not quite a No Functional Change commit.
In the previous code, a zero value for H was not added as a property
if there was no parent style.

However, it seems that pretty much only RTF
fails to typically have styles defined,
since even an unspecified "Normal" style is checked.
(fdo77890.docx also followed the "else" path
 because it basically had an empty styles.xml file.)

That means that in all but the most bizarre cases,
the "no style" case would never be reached anyway.
That really eliminates any worries about the deduplication going bad.

In any case, it makes it the same as width (and most DOCX files)
which had been doing this in the first place.

For consistency and code simplicity I'll go ahead with the change.

Change-Id: I65eed50ba83397284f21bb20ef3bbf10e02cce04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148805
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index eee409798ce1..910fe366fa93 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1647,6 +1647,43 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE),
   bAutoWidth ? text::SizeType::MIN : 
text::SizeType::FIX));
 
+bool bValidH = false;
+sal_Int32 nHeight = DEFAULT_FRAME_MIN_HEIGHT;
+for (const auto pProp : vProps)
+{
+if (pProp->Geth() < 0)
+continue;
+nHeight = pProp->Geth();
+bValidH = true;
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT), 
nHeight));
+
+sal_Int16 nhRule = -1;
+for (const auto pProp : vProps)
+{
+if (pProp->GethRule() < 0)
+continue;
+nhRule = pProp->GethRule();
+break;
+}
+if (nhRule < 0)
+{
+if (bValidH)
+{
+// [MS-OE376] Word uses a default value of "atLeast" for
+// this attribute when the value of the h attribute is not 0.
+nhRule = text::SizeType::MIN;
+}
+else
+{
+nhRule = text::SizeType::VARIABLE;
+}
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), 
nhRule));
+
 sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
 for (const auto pProp : vProps)
 {
@@ -1671,42 +1708,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 if (vProps.size() > 1)
 {
-bool bValidH = false;
-sal_Int32 nHeight = DEFAULT_FRAME_MIN_HEIGHT;
-for (const auto pProp : vProps)
-{
-if (pProp->Geth() < 0)
-continue;
-nHeight = pProp->Geth();
-bValidH = true;
-break;
-}
-aFrameProperties.push_back(
-comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT), 
nHeight));
-
-sal_Int16 nhRule = -1;
-for (const auto pProp : vProps)
-{
-if (pProp->GethRule() < 0)
-continue;
-nhRule = pProp->GethRule();
-break;
-}
-if ( nhRule < 0 )
-{
-if (bValidH)
-{
-// [MS-OE376] Word uses a default value of "atLeast" for
-// this attribute when the value of the h attribute is not 
0.
-nhRule = text::SizeType::MIN;
-}
-else
-{
-nhRule = text::SizeType::VARIABLE;
-}
-}
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE),
 nhRule));
-
 if (const std::optional nDirection = 
PopFrameDirection())
 {
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
@@ -1826,22 +1827,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 }
 else
 {
-sal_Int16 nhRule = 

[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   40 +-
 1 file changed, 17 insertions(+), 23 deletions(-)

New commits:
commit 1a12246fc1deaaf1e2c723c0c541de85cf88101e
Author: Justin Luth 
AuthorDate: Mon Mar 13 07:45:54 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:45:16 2023 +

NFC tdf#154129 writerfilter framePr: deduplicate w:w

This should be a No Functional Change.

I had a unit test error deduplicating the combined patch
(in combination with Hori/VertOrient) but not now.
And I don't see any differences
(even after a git reflog/git cherry-pick)
and yet the unit test failure was consistent over three tries...

Change-Id: I00f5290590fe51c68d1e3e65df1f172252655feb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148804
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 430726a464d3..eee409798ce1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1630,6 +1630,23 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 std::vector aFrameProperties;
 
+sal_Int32 nWidth = -1;
+for (const auto pProp : vProps)
+{
+if (pProp->Getw() < 0)
+continue;
+nWidth = pProp->Getw();
+break;
+}
+bool bAutoWidth = nWidth < 1;
+if (bAutoWidth)
+nWidth = DEFAULT_FRAME_MIN_WIDTH;
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_WIDTH), 
nWidth));
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE),
+  bAutoWidth ? text::SizeType::MIN : 
text::SizeType::FIX));
+
 sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
 for (const auto pProp : vProps)
 {
@@ -1654,19 +1671,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 if (vProps.size() > 1)
 {
-sal_Int32 nWidth = -1;
-for (const auto pProp : vProps)
-{
-if (pProp->Getw() < 0)
-continue;
-nWidth = pProp->Getw();
-break;
-}
-bool bAutoWidth = nWidth < 1;
-if( bAutoWidth )
-nWidth = DEFAULT_FRAME_MIN_WIDTH;
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH),
 nWidth));
-
 bool bValidH = false;
 sal_Int32 nHeight = DEFAULT_FRAME_MIN_HEIGHT;
 for (const auto pProp : vProps)
@@ -1703,8 +1707,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 }
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE),
 nhRule));
 
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE),
 bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX));
-
 if (const std::optional nDirection = 
PopFrameDirection())
 {
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
@@ -1824,12 +1826,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 }
 else
 {
-sal_Int32 nWidth = rAppendContext.pLastParagraphProperties->Getw();
-bool bAutoWidth = nWidth < 1;
-if( bAutoWidth )
-nWidth = DEFAULT_FRAME_MIN_WIDTH;
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH),
 nWidth));
-
 sal_Int16 nhRule = 
sal_Int16(rAppendContext.pLastParagraphProperties->GethRule());
 if ( nhRule < 0 )
 {
@@ -1846,8 +1842,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 }
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE),
 nhRule));
 
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE),
 bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX));
-
 sal_Int32 nVertDist = 
rAppendContext.pLastParagraphProperties->GethSpace();
 if( nVertDist < 0 )
 nVertDist = 0;


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   54 --
 1 file changed, 22 insertions(+), 32 deletions(-)

New commits:
commit fb8522e457b098b5ade98a4a4babbc8704d3fad4
Author: Justin Luth 
AuthorDate: Sat Mar 11 21:09:13 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:44:34 2023 +

NFC tdf#154129 writerfilter framePr: deduplicate Hori/VertOrient

This patch should be a No Functional Change

I had a unit test error in an earlier combined patch
so it seemed better to split deduplication up into smaller chuncks
and make the change incrementally.

Change-Id: Ie6eeaca07fd5d4fd5bc312f131851ceda5cc3647
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148803
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index db61d2fda2d1..430726a464d3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1630,6 +1630,28 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 std::vector aFrameProperties;
 
+sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
+for (const auto pProp : vProps)
+{
+if (pProp->GetxAlign() < 0)
+continue;
+nHoriOrient = pProp->GetxAlign();
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), 
nHoriOrient));
+
+sal_Int16 nVertOrient = text::VertOrientation::NONE;
+for (const auto pProp : vProps)
+{
+if (pProp->GetyAlign() < 0)
+continue;
+nVertOrient = pProp->GetyAlign();
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), 
nVertOrient));
+
 if (vProps.size() > 1)
 {
 sal_Int32 nWidth = -1;
@@ -1688,16 +1710,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
 }
 
-sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
-for (const auto pProp : vProps)
-{
-if (pProp->GetxAlign() < 0)
-continue;
-nHoriOrient = pProp->GetxAlign();
-break;
-}
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT),
 nHoriOrient));
-
 //set a non negative default value
 bool bValidX = false;
 sal_Int32 nX = DEFAULT_VALUE;
@@ -1724,16 +1736,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(comphelper::makePropertyValue(
 getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor));
 
-sal_Int16 nVertOrient = text::VertOrientation::NONE;
-for (const auto pProp : vProps)
-{
-if (pProp->GetyAlign() < 0)
-continue;
-nVertOrient = pProp->GetyAlign();
-break;
-}
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT),
 nVertOrient));
-
 //set a non negative default value
 bool bValidY = false;
 sal_Int32 nY = DEFAULT_VALUE;
@@ -1846,18 +1848,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE),
 bAutoWidth ?  text::SizeType::MIN : text::SizeType::FIX));
 
-sal_Int16 nHoriOrient = sal_Int16(
-rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
-rAppendContext.pLastParagraphProperties->GetxAlign() :
-text::HoriOrientation::NONE );
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT),
 nHoriOrient));
-
-sal_Int16 nVertOrient = sal_Int16(
-rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
-rAppendContext.pLastParagraphProperties->GetyAlign() :
-text::VertOrientation::NONE );
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT),
 nVertOrient));
-
 sal_Int32 nVertDist = 
rAppendContext.pLastParagraphProperties->GethSpace();
 if( nVertDist < 0 )
 nVertDist = 0;


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 6eb483d3f27e3ee8c56d422fb96f83844370d325
Author: Justin Luth 
AuthorDate: Sat Mar 11 19:50:37 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:43:33 2023 +

tdf#154129 writerfilter framePr: remove last use of pParaStyle

Now that everything is using vProp, pParaStyle can be removed.

Although there could conceivably be a minor logic flow difference
(in case a specified style had no properties == early return)
I'm pretty sure that that would actually cause errors,
so this should be better.

Change-Id: I5079732ebd2b822bea40929c5b4899b8551324e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148719
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 786cc0f39de2..db61d2fda2d1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1612,9 +1612,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 return;
 try
 {
-StyleSheetEntryPtr pParaStyle =
-
GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
-
 // A paragraph's properties come from direct formatting or somewhere 
in the style hierarchy
 std::vector vProps;
 vProps.emplace_back(rAppendContext.pLastParagraphProperties.get());
@@ -1633,12 +1630,8 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 
 std::vector aFrameProperties;
 
-if ( pParaStyle )
+if (vProps.size() > 1)
 {
-const StyleSheetPropertyMap* pStyleProperties = 
pParaStyle->m_pProperties.get();
-if (!pStyleProperties)
-return;
-
 sal_Int32 nWidth = -1;
 for (const auto pProp : vProps)
 {
@@ -1652,12 +1645,14 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 nWidth = DEFAULT_FRAME_MIN_WIDTH;
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH),
 nWidth));
 
+bool bValidH = false;
 sal_Int32 nHeight = DEFAULT_FRAME_MIN_HEIGHT;
 for (const auto pProp : vProps)
 {
 if (pProp->Geth() < 0)
 continue;
 nHeight = pProp->Geth();
+bValidH = true;
 break;
 }
 aFrameProperties.push_back(
@@ -1673,8 +1668,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 }
 if ( nhRule < 0 )
 {
-if ( rAppendContext.pLastParagraphProperties->Geth() >= 0 ||
-pStyleProperties->props().GethRule() >= 0 )
+if (bValidH)
 {
 // [MS-OE376] Word uses a default value of "atLeast" for
 // this attribute when the value of the h attribute is not 
0.


[Libreoffice-commits] core.git: writerfilter/source

2023-03-15 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   30 +-
 1 file changed, 18 insertions(+), 12 deletions(-)

New commits:
commit 2ab9a2e4166264be83300e7ed038be1b803a5ac8
Author: Justin Luth 
AuthorDate: Sat Mar 11 19:04:06 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 15 09:43:15 2023 +

tdf#154129 writerfilter framePr: check whole style inheritance: v/hSpace

This patch depends on HAnchor, which created vProps.

A style can inherit its properties from another style,
but the code was naively just checking the first paragraph style,
and not any of the parents.

There were no existing sw.check tests where the old and new method
produced different values.

Change-Id: I66ea366fae933c29587aa0fa9fff3abab6d8666b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148718
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5d9906ee97b1..786cc0f39de2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1787,22 +1787,28 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 Swapped the array elements 11,12 & 13,14 since 11 & 12 are
 LEFT & RIGHT margins and 13,14 are TOP and BOTTOM margins 
respectively.
 */
-sal_Int32 nRightDist;
-sal_Int32 nLeftDist = nRightDist =
-rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ?
-rAppendContext.pLastParagraphProperties->GethSpace() :
-pStyleProperties->props().GethSpace() >= 0
-? pStyleProperties->props().GethSpace() : 0;
+sal_Int32 nRightDist = 0;
+sal_Int32 nLeftDist = 0;
+for (const auto pProp : vProps)
+{
+if (pProp->GethSpace() < 0)
+continue;
+nLeftDist = nRightDist = pProp->GethSpace();
+break;
+}
 
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
 
-sal_Int32 nBottomDist;
-sal_Int32 nTopDist = nBottomDist =
-rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
-rAppendContext.pLastParagraphProperties->GetvSpace() :
-pStyleProperties->props().GetvSpace() >= 0
-? pStyleProperties->props().GetvSpace() : 0;
+sal_Int32 nBottomDist = 0;
+sal_Int32 nTopDist = 0;
+for (const auto pProp : vProps)
+{
+if (pProp->GetvSpace() < 0)
+continue;
+nTopDist = nBottomDist = pProp->GetvSpace();
+break;
+}
 
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));


[Libreoffice-commits] core.git: writerfilter/source

2023-03-14 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 44837a12d12be3e525fa48b37c3dd2553cc97d94
Author: Justin Luth 
AuthorDate: Sat Mar 11 18:26:22 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 15 01:51:31 2023 +

tdf#154129 writerfilter framePr: check whole style inheritance: wrap

This patch depends on HAnchor, which created vProps.

A style can inherit its properties from another style,
but the code was naively just checking the first paragraph style,
and not any of the parents.

There were no existing sw.check tests where the old and new method
produced different values.

Change-Id: Ifdd4b5f9eefdc1f53e472c1bb5d19b526e00ee38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148717
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f33d3c390afb..5d9906ee97b1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1772,13 +1772,16 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(comphelper::makePropertyValue(
 getPropertyName(PROP_VERT_ORIENT_RELATION), nVAnchor));
 
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SURROUND),
-rAppendContext.pLastParagraphProperties->GetWrap() != 
text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE
-? rAppendContext.pLastParagraphProperties->GetWrap()
-: pStyleProperties->props().GetWrap()
-  != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE
-  ? pStyleProperties->props().GetWrap()
-  : text::WrapTextMode_NONE ));
+text::WrapTextMode nWrap = text::WrapTextMode_NONE;
+for (const auto pProp : vProps)
+{
+if (pProp->GetWrap() == 
text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
+continue;
+nWrap = pProp->GetWrap();
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), 
nWrap));
 
 /** FDO#73546 : distL & distR should be unsigned integers 
 Swapped the array elements 11,12 & 13,14 since 11 & 12 are


[Libreoffice-commits] core.git: writerfilter/source

2023-03-14 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 6f1052da8d145b1176186024dc4745cbd561fe36
Author: Justin Luth 
AuthorDate: Sat Mar 11 17:55:06 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Mar 14 22:46:00 2023 +

tdf#154129 writerfilter framePr: check whole style inheritance: hRule

This patch depends on HAnchor, which created vProps.

A style can inherit its properties from another style,
but the code was naively just checking the first paragraph style,
and not any of the parents.

There were no existing ooxmlexport tests where the old and new method
produced different values.

Change-Id: I8648ec7abce5943be4850ec0f2dd054cd9ce1a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148716
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e3baf350b5f9..62dda7d02ac2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1651,10 +1651,14 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(
 comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT), 
nHeight));
 
-sal_Int16 nhRule = sal_Int16(
-rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
-rAppendContext.pLastParagraphProperties->GethRule() :
-pStyleProperties->props().GethRule());
+sal_Int16 nhRule = -1;
+for (const auto pProp : vProps)
+{
+if (pProp->GethRule() < 0)
+continue;
+nhRule = pProp->GethRule();
+break;
+}
 if ( nhRule < 0 )
 {
 if ( rAppendContext.pLastParagraphProperties->Geth() >= 0 ||


[Libreoffice-commits] core.git: writerfilter/source

2023-03-14 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +++---
 1 file changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 2571b39158c679a42a68bea5f219e29a42f4e6a6
Author: Justin Luth 
AuthorDate: Sat Mar 11 17:50:14 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Mar 14 17:10:09 2023 +

tdf#154129 writerfilter framePr: check whole style inheritance: W/H

This patch depends on HAnchor, which created vProps.

This patch changes the logic a little bit from the previous code.
Before, the paragraph has to specify something other than 0 (auto)
in order to be acceptable. Well, I don't see any reason why
direct formatting shouldn't be able to override a non-auto style value,
so we'll make the change and see how it plays out.

Errata says:
"The standard states that 0 is a valid value of the h attribute.
 HOWEVER Word treats a value of 0 on this attribute as a value of auto."

and:
"The standard states that the values of the h attribute
 are defined by the ST_TwipsMeasure simple type.
 HOWEVER Word restricts the value of this attribute
 to be at least 1 and at most 31680."

There were no existing ooxmlexport unit tests where the old and new method
produced different values.

Change-Id: I48934598c1bca8ffc99b97b114d77505f3341105
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148715
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bc1f7f8452ed..e3baf350b5f9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1626,19 +1626,30 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 const StyleSheetPropertyMap* pStyleProperties = 
pParaStyle->m_pProperties.get();
 if (!pStyleProperties)
 return;
-sal_Int32 nWidth =
-rAppendContext.pLastParagraphProperties->Getw() > 0 ?
-rAppendContext.pLastParagraphProperties->Getw() :
-pStyleProperties->props().Getw();
+
+sal_Int32 nWidth = -1;
+for (const auto pProp : vProps)
+{
+if (pProp->Getw() < 0)
+continue;
+nWidth = pProp->Getw();
+break;
+}
 bool bAutoWidth = nWidth < 1;
 if( bAutoWidth )
 nWidth = DEFAULT_FRAME_MIN_WIDTH;
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH),
 nWidth));
 
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT),
-rAppendContext.pLastParagraphProperties->Geth() > 0 ?
-rAppendContext.pLastParagraphProperties->Geth() :
-pStyleProperties->props().Geth() > 0 ? 
pStyleProperties->props().Geth() : DEFAULT_FRAME_MIN_HEIGHT));
+sal_Int32 nHeight = DEFAULT_FRAME_MIN_HEIGHT;
+for (const auto pProp : vProps)
+{
+if (pProp->Geth() < 0)
+continue;
+nHeight = pProp->Geth();
+break;
+}
+aFrameProperties.push_back(
+comphelper::makePropertyValue(getPropertyName(PROP_HEIGHT), 
nHeight));
 
 sal_Int16 nhRule = sal_Int16(
 rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?


[Libreoffice-commits] core.git: writerfilter/source

2023-03-14 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   29 +++---
 1 file changed, 20 insertions(+), 9 deletions(-)

New commits:
commit b1696d2a3e2015b60fc04a785e6a9f7925f4232e
Author: Justin Luth 
AuthorDate: Sat Mar 11 14:47:18 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Mar 14 11:17:41 2023 +

tdf#154129 writerfilter framePr: check whole style inheritance: Y/YAlign

This patch depends on HAnchor, which created vProps.

There were no existing unit tests where the old and new method
produced different values.

Change-Id: I1bf7dd6ee7a8c8d00f7c743657a32a86986e7a7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148690
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e6f9f8f6a3ab..fad1efd9ead3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1692,18 +1692,29 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
 aFrameProperties.push_back(comphelper::makePropertyValue(
 getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor));
 
-sal_Int16 nVertOrient = sal_Int16(
-rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
-rAppendContext.pLastParagraphProperties->GetyAlign() :
-pStyleProperties->props().GetyAlign() >= 0 ? 
pStyleProperties->props().GetyAlign() : text::VertOrientation::NONE );
+sal_Int16 nVertOrient = text::VertOrientation::NONE;
+for (const auto pProp : vProps)
+{
+if (pProp->GetyAlign() < 0)
+continue;
+nVertOrient = pProp->GetyAlign();
+break;
+}
 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT),
 nVertOrient));
 
 //set a non negative default value
-
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION),
-rAppendContext.pLastParagraphProperties->IsyValid() ?
-rAppendContext.pLastParagraphProperties->Gety() :
-pStyleProperties->props().IsyValid()
-? pStyleProperties->props().Gety() : DEFAULT_VALUE));
+bool bValidY = false;
+sal_Int32 nY = DEFAULT_VALUE;
+for (const auto pProp : vProps)
+{
+bValidY = pProp->IsyValid();
+if (!bValidY)
+continue;
+nY = pProp->Gety();
+break;
+}
+aFrameProperties.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION), nY));
 
 //Default the anchor in case FramePr_vAnchor is missing ECMA 
17.3.1.11
 sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'


[Libreoffice-commits] core.git: writerfilter/source

2023-03-13 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b2d754c49b7351f7b2663bb249b4b2f663ef3786
Author: Justin Luth 
AuthorDate: Mon Mar 13 07:03:30 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Mar 13 12:38:40 2023 +

tdf#154129 writerfilter framePr: address nit about nSafetyLimit

I was going to change --nSafetyLimit to nSafetyLimit-- anyway,
since that better matches "getting 16 tries" like a code-reader
would first expect (instead of only 15).

I had thought about putting an assert here,
but that isn't logically impossible to have 16 inheritances,
so an assert seemed a bit too strict.
But as the reviewer noted, a SAL_WARN at least ought to be here.

I thought perhaps using an unordered_set might let me
automatically eliminate loops, but then according to the documentation
it uses "random" sorting and isn't treated like an array,
which is definitely needed here.

Of course, I could add the logic to simply check if the new
value already exists in the vector. However, I believe that a loop
would be considered an "invalid document" and thus should never exist,
so clean-reading code and a safety valve against a malicious document
seems appropriate enough to me.

Change-Id: Ie6132c1beb483a6bee9c9794934ba8de7cfd82bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148784
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f8cbc3c7f3f5..a63c172caf0c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1609,7 +1609,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 sal_Int8 nSafetyLimit = 16;
 StyleSheetEntryPtr pStyle = 
GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(
 rAppendContext.pLastParagraphProperties->GetParaStyleName());
-while (--nSafetyLimit && pStyle && pStyle->m_pProperties)
+while (nSafetyLimit-- && pStyle && pStyle->m_pProperties)
 {
 vProps.emplace_back(>m_pProperties->props());
 assert(pStyle->m_sBaseStyleIdentifier != pStyle->m_sStyleName);
@@ -1617,6 +1617,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 break;
 pStyle = 
GetStyleSheetTable()->FindStyleSheetByISTD(pStyle->m_sBaseStyleIdentifier);
 }
+SAL_WARN_IF(!nSafetyLimit,"writerfilter.dmapper","Inherited style loop 
likely: early exit");
 
 std::vector aFrameProperties;
 


[Libreoffice-commits] core.git: writerfilter/source

2023-03-06 Thread Miklos Vajna (via logerrit)
 writerfilter/source/ooxml/OOXMLPropertySet.cxx |6 +++---
 writerfilter/source/ooxml/OOXMLPropertySet.hxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 078f5064dd09e5228f1a54b4f45ae90fc06bd99f
Author: Miklos Vajna 
AuthorDate: Mon Mar 6 08:09:44 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Mar 6 12:13:30 2023 +

writerfilter: prefix members of OOXMLStarMathValue

See tdf#94879 for motivation. With this, writerfilter/ is done, I think.

Change-Id: Ia2ae5394e41688049b0a639aa5ad922980928cf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148293
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index e060d2da2d6c..930fa5a7f85b 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -721,7 +721,7 @@ OOXMLValue * OOXMLShapeValue::clone() const
 
 
 OOXMLStarMathValue::OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject 
> c )
-: component(std::move(c))
+: m_component(std::move(c))
 {
 }
 
@@ -731,7 +731,7 @@ OOXMLStarMathValue::~OOXMLStarMathValue()
 
 uno::Any OOXMLStarMathValue::getAny() const
 {
-return uno::Any(component);
+return uno::Any(m_component);
 }
 
 #ifdef DBG_UTIL
@@ -743,7 +743,7 @@ std::string OOXMLStarMathValue::toString() const
 
 OOXMLValue * OOXMLStarMathValue::clone() const
 {
-return new OOXMLStarMathValue( component );
+return new OOXMLStarMathValue( m_component );
 }
 
 /*
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
index 3393050afa23..2c851ab53823 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
@@ -351,7 +351,7 @@ public:
 
 class OOXMLStarMathValue final : public OOXMLValue
 {
-css::uno::Reference component;
+css::uno::Reference m_component;
 
 public:
 explicit 
OOXMLStarMathValue(css::uno::Reference component);


[Libreoffice-commits] core.git: writerfilter/source

2023-02-27 Thread Miklos Vajna (via logerrit)
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx   |6 +--
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx   |2 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   24 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |6 +--
 writerfilter/source/ooxml/OOXMLParserState.cxx|   28 +-
 writerfilter/source/ooxml/OOXMLParserState.hxx|8 ++---
 6 files changed, 37 insertions(+), 37 deletions(-)

New commits:
commit 09ada9cf6e15f3a735d2c94737b045c5e0f001ef
Author: Miklos Vajna 
AuthorDate: Mon Feb 27 08:02:04 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 27 09:56:50 2023 +

sw: prefix members of OOXMLDocumentImpl, OOXMLFastContextHandler, ...

... OOXMLFastContextHandlerLinear and OOXMLParserState

See tdf#94879 for motivation.

Change-Id: I65f1b98918da40d9e3dbc27af54dadd38aaba8be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147854
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 8e0cd9aa8a86..3a7359df22e4 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -786,7 +786,7 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 embeddingsTemp.Name = embeddingsTarget;
 embeddingsTemp.Value <<= mxEmbeddings;
-aEmbeddings.push_back(embeddingsTemp);
+m_aEmbeddings.push_back(embeddingsTemp);
 mxEmbeddings.clear();
 }
 bFound = false;
@@ -794,8 +794,8 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 }
 }
 }
-if (!aEmbeddings.empty())
-mxEmbeddingsList = comphelper::containerToSequence(aEmbeddings);
+if (!m_aEmbeddings.empty())
+mxEmbeddingsList = comphelper::containerToSequence(m_aEmbeddings);
 }
 
 uno::Reference OOXMLDocumentImpl::getGlossaryDocDom( )
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index 3f57696b2d25..1983ed2583a5 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -54,7 +54,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Reference mxCustomXmlProsDom;
 css::uno::Reference mxEmbeddings;
 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
-std::vector aEmbeddings;
+std::vector m_aEmbeddings;
 bool mbIsSubstream;
 bool mbSkipImages;
 /// How many paragraphs equal to 1 percent?
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 6d8d149fa0a7..3db1a7d92338 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -73,7 +73,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   mbIsMathPara(false),
   mpStream(nullptr),
   mnTableDepth(0),
-  inPositionV(false),
+  m_inPositionV(false),
   mbAllowInCell(true),
   mbIsVMLfound(false),
   m_xContext(context),
@@ -96,7 +96,7 @@ 
OOXMLFastContextHandler::OOXMLFastContextHandler(OOXMLFastContextHandler * pCont
   mpStream(pContext->mpStream),
   mpParserState(pContext->mpParserState),
   mnTableDepth(pContext->mnTableDepth),
-  inPositionV(pContext->inPositionV),
+  m_inPositionV(pContext->m_inPositionV),
   mbAllowInCell(pContext->mbAllowInCell),
   mbIsVMLfound(pContext->mbIsVMLfound),
   m_xContext(pContext->m_xContext),
@@ -229,9 +229,9 @@ void OOXMLFastContextHandler::lcl_startFastElement
 {
 OOXMLFactory::startAction(this);
 if( Element == (NMSP_dmlWordDr|XML_positionV) )
-inPositionV = true;
+m_inPositionV = true;
 else if( Element == (NMSP_dmlWordDr|XML_positionH) )
-inPositionV = false;
+m_inPositionV = false;
 }
 
 void OOXMLFastContextHandler::lcl_endFastElement
@@ -715,7 +715,7 @@ void OOXMLFastContextHandler::text(const OUString & sText)
 void OOXMLFastContextHandler::positionOffset(const OUString& rText)
 {
 if (isForwardEvents())
-mpStream->positionOffset(rText, inPositionV);
+mpStream->positionOffset(rText, m_inPositionV);
 }
 
 void OOXMLFastContextHandler::ignore()
@@ -2227,21 +2227,21 @@ Token_t OOXMLFastContextHandlerWrapper::getToken() const
 
 
OOXMLFastContextHandlerLinear::OOXMLFastContextHandlerLinear(OOXMLFastContextHandler*
 pContext)
 : OOXMLFastContextHandlerProperties(pContext)
-, depthCount( 0 )
+, m_depthCount( 0 )
 {
 }
 
 void OOXMLFastContextHandlerLinear::lcl_startFastElement(Token_t Element,
 const uno::Reference< xml::sax::XFastAttributeList >& Attribs)
 {
-buffer.appendOpeningTag( Element, Attribs );
-

[Libreoffice-commits] core.git: writerfilter/source

2023-02-20 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |   10 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   76 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 
 writerfilter/source/dmapper/FontTable.cxx |   22 
 writerfilter/source/dmapper/FontTable.hxx |   10 
 writerfilter/source/dmapper/GraphicImport.cxx |  660 +++---
 writerfilter/source/dmapper/NumberingManager.cxx  |   12 
 writerfilter/source/dmapper/PropertyMap.cxx   |2 
 writerfilter/source/dmapper/StyleSheetTable.cxx   |  232 +++
 writerfilter/source/dmapper/StyleSheetTable.hxx   |   30 -
 10 files changed, 529 insertions(+), 529 deletions(-)

New commits:
commit 9d280061b094918b049278fb70b1ad99fef7dc84
Author: Miklos Vajna 
AuthorDate: Mon Feb 20 08:13:50 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 20 08:00:32 2023 +

writerfilter: prefix members of DomainMapper_Impl, EmbeddedFontHandler, ...

...  GraphicImport_Impl and StyleSheetEntry

See tdf#94879 for motivation.

Change-Id: I83639c40fb8c32c1d205a9b53d24409f9a5a5a15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147307
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8718f65b3bee..242a0d655e39 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1735,7 +1735,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if ( IsStyleSheetImport() )
 {
 const StyleSheetEntryPtr pCurrStyle = 
GetStyleSheetTable()->GetCurrentEntry();
-if ( pCurrStyle && pCurrStyle->nStyleTypeCode == 
STYLE_TYPE_CHAR )
+if ( pCurrStyle && pCurrStyle->m_nStyleTypeCode == 
STYLE_TYPE_CHAR )
 break;
 }
 
@@ -2459,7 +2459,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 
 // First check if the style exists in the document.
 StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( 
)->FindStyleSheetByConvertedStyleName( sConvertedName );
-bool bExists = pEntry && ( pEntry->nStyleTypeCode == 
STYLE_TYPE_CHAR );
+bool bExists = pEntry && ( pEntry->m_nStyleTypeCode == 
STYLE_TYPE_CHAR );
 // Add the property if the style exists, but do not add it 
elements in TOC:
 // they will receive later another style references from TOC
 if ( bExists && m_pImpl->GetTopContext() && !m_pImpl->IsInTOC())
@@ -3143,9 +3143,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if( !sStyleName.isEmpty() && GetStyleSheetTable() )
 pStyle = 
GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( sStyleName );
 
-if( pStyle && pStyle->pProperties
-&& pStyle->pProperties->isSet(PROP_BREAK_TYPE)
-&& 
pStyle->pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType )
+if( pStyle && pStyle->m_pProperties
+&& pStyle->m_pProperties->isSet(PROP_BREAK_TYPE)
+&& 
pStyle->m_pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType )
 {
 pParagraphProps->Insert(PROP_BREAK_TYPE, aBreakType);
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 128e97b522d1..efc83477f818 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -133,7 +133,7 @@ static void lcl_linenumberingHeaderFooter( const 
uno::ReferenceGetStyleSheetTable()->FindStyleSheetByISTD( rname );
 if (!pEntry)
 return;
-const StyleSheetPropertyMap* pStyleSheetProperties = 
pEntry->pProperties.get();
+const StyleSheetPropertyMap* pStyleSheetProperties = 
pEntry->m_pProperties.get();
 if ( !pStyleSheetProperties )
 return;
 sal_Int32 nListId = pStyleSheetProperties->props().GetListId();
@@ -199,13 +199,13 @@ static uno::Any 
lcl_GetPropertyFromParaStyleSheetNoNum(PropertyIds eId, StyleShe
 {
 while (pEntry)
 {
-if (pEntry->pProperties)
+if (pEntry->m_pProperties)
 {
 std::optional aProperty =
-pEntry->pProperties->getProperty(eId);
+pEntry->m_pProperties->getProperty(eId);
 if (aProperty)
 {
-if (pEntry->pProperties->props().GetListId())
+if (pEntry->m_pProperties->props().GetListId())
 // It is a paragraph style with list. Paragraph list 
styles are not taken into account
 return uno::Any();
 else
@@ -214,8 +214,8 @@ static uno::Any 

[Libreoffice-commits] core.git: writerfilter/source

2023-02-16 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit e55a5db74cc51ad5cba24d3872948becc4205d81
Author: Justin Luth 
AuthorDate: Thu Feb 16 18:49:25 2023 -0500
Commit: Justin Luth 
CommitDate: Fri Feb 17 00:37:51 2023 +

Revert "assert commit looking for example document to test theory."

This reverts commit a942e6e5ecfdd9ff83fc7febb8234c8f0e2813db.

I downloaded the crashtest URL results with wget -r,
and then gathered the identified documents with

grep writerfilter/source/dmapper/DomainMapper_Impl.cxx:303 * -l \
| xargs grep aRealURL

Change-Id: I0a4736af9c1f9be0e4897806538695d7a4b2c170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147181
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b282742e7311..128e97b522d1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -299,9 +299,6 @@ static bool IsFieldNestingAllowed(const FieldContextPtr& 
pOuter, const FieldCont
 return false;
 }
 default:
-SAL_WARN("writerfilter","found 
field["<<*pInner->GetFieldId()<<"] defined in FieldTypes.hxx");
-assert(false && "looking for example documents using { IF 
} with fields for condition or result");
-return false;
 break;
 }
 break;


[Libreoffice-commits] core.git: writerfilter/source

2023-02-16 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 537da891fe42f432ea5d9f5e44579ae9a11722e3
Author: Justin Luth 
AuthorDate: Thu Feb 16 13:00:16 2023 -0500
Commit: Justin Luth 
CommitDate: Thu Feb 16 20:36:15 2023 +

remove redundant mbWasShapeInPara = false

This is already reset in lcl_startParagraphGroup,
so no need to do it explicitly here.

It is not used by finishParagraph either, so safe to remove.

Change-Id: I62781dd797566dd554be1f18cca1f4659fd606fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147168
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 85d91fd454fe..e32cc43f607a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4168,7 +4168,6 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 {
 if (m_pImpl->GetIsFirstParagraphInSection() || 
!m_pImpl->IsFirstRun() || mbWasShapeInPara)
 {
-mbWasShapeInPara = false;
 mbIsSplitPara = true;
 finishParagraph();
 lcl_startParagraphGroup();


[Libreoffice-commits] core.git: writerfilter/source

2023-02-14 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 387240968cd89e294be5a7a1bec533df464f0943
Author: Justin Luth 
AuthorDate: Tue Feb 14 17:47:00 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Feb 15 02:52:16 2023 +

writerfilter: don't clear breaks when IsInComments

A few lines earlier we avoided applying deferred breaks
when IsInComments (and shapes), so why would we avoid
clearing all breaks only for shapes? That doesn't make sense.

Rearranged the code slightly to put all related items
together.

Change-Id: Ifbe911624b8190813fe2a57362e4ad7ccf1e712e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147031
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 62f2ad548e64..35dd9940a652 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3494,9 +3494,9 @@ void DomainMapper::lcl_startParagraphGroup()
 if (m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) != 
m_pImpl->GetTopContext())
 m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
 
-if (m_pImpl->GetTopContext())
+if (!m_pImpl->IsInShape() && !m_pImpl->IsInComments())
 {
-if (!m_pImpl->IsInShape() && !m_pImpl->IsInComments())
+if (m_pImpl->GetTopContext())
 {
 const OUString& sDefaultParaStyle = 
m_pImpl->GetDefaultParaStyleName();
 m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::Any( 
sDefaultParaStyle ) );
@@ -3508,15 +3508,15 @@ void DomainMapper::lcl_startParagraphGroup()
 m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, 
uno::Any(style::BreakType_COLUMN_BEFORE));
 mbWasShapeInPara = false;
 }
-
-if (m_pImpl->isParaSdtEndDeferred())
-m_pImpl->GetTopContext()->Insert(PROP_PARA_SDT_END_BEFORE, 
uno::Any(true), true, PARA_GRAB_BAG);
+m_pImpl->clearDeferredBreaks();
 }
+
+if (m_pImpl->isParaSdtEndDeferred() && m_pImpl->GetTopContext())
+m_pImpl->GetTopContext()->Insert(PROP_PARA_SDT_END_BEFORE, 
uno::Any(true), true, PARA_GRAB_BAG);
+m_pImpl->setParaSdtEndDeferred(false);
+
 m_pImpl->SetIsFirstRun(true);
 m_pImpl->SetIsOutsideAParagraph(false);
-if (!m_pImpl->IsInShape())
-m_pImpl->clearDeferredBreaks();
-m_pImpl->setParaSdtEndDeferred(false);
 }
 
 void DomainMapper::lcl_endParagraphGroup()


[Libreoffice-commits] core.git: writerfilter/source

2023-02-11 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit a942e6e5ecfdd9ff83fc7febb8234c8f0e2813db
Author: Justin Luth 
AuthorDate: Fri Jan 20 08:32:31 2023 -0500
Commit: Justin Luth 
CommitDate: Sat Feb 11 16:08:35 2023 +

assert commit looking for example document to test theory.

related tdf#125038 FORMTEXT/REF:fix spurious text outside IF field
speculated that this should always return false,
since the IF statement is not processed at all.
However, there are no documents that match this condition in the
existing unit tests, so a wider net is needed.

Change-Id: I8a5a0fd077cc141abc5438cacd0de77fcfe7c476
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145931
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d048d600f496..7f4c800b1002 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -292,11 +292,16 @@ static bool IsFieldNestingAllowed(const FieldContextPtr& 
pOuter, const FieldCont
 case FIELD_IF:
 case FIELD_MERGEFIELD:
 case FIELD_REF:
+case FIELD_PAGE:
+case FIELD_NUMPAGES:
 {
 // LO does not currently know how to evaluate these as 
conditions or results
 return false;
 }
 default:
+SAL_WARN("writerfilter","found 
field["<<*pInner->GetFieldId()<<"] defined in FieldTypes.hxx");
+assert(false && "looking for example documents using { IF 
} with fields for condition or result");
+return false;
 break;
 }
 break;


[Libreoffice-commits] core.git: writerfilter/source

2023-02-09 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9850aed84b8aa0a47eb89c7b547f1b90420db9a3
Author: Caolán McNamara 
AuthorDate: Wed Feb 8 20:27:09 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 9 08:57:45 2023 +

cid#1401328 suppress Uncaught exception

Change-Id: I20d7e1777b94d9e1d81e8e5b1640b8e912a981d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146676
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 32870f0a236a..d048d600f496 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -84,6 +84,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -451,7 +452,7 @@ DomainMapper_Impl::~DomainMapper_Impl()
 if (m_bIsNewDoc)
 {
 RemoveLastParagraph();
-GetStyleSheetTable()->ApplyClonedTOCStyles();
+
suppress_fun_call_w_exception(GetStyleSheetTable()->ApplyClonedTOCStyles());
 }
 if (hasTableManager())
 {


[Libreoffice-commits] core.git: writerfilter/source

2023-01-19 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   31 --
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit d2cd7097ab8d8fe1a69b9f6e4a11c978b667951a
Author: Justin Luth 
AuthorDate: Thu Jan 19 12:04:32 2023 -0500
Commit: Justin Luth 
CommitDate: Fri Jan 20 03:06:17 2023 +

NFC writerfilter: avoid unnecessary code processing

Early return on useless parameter,
and conditional processing on missing ID.

Change-Id: Iecf2d7522bd0c1e958f826214368966399be311c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145831
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48dfc3434ed4..0b73640fd57f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -253,27 +253,30 @@ static FieldContextPtr GetParentFieldContext(const 
std::deque&
 /// Decides if the pInner field inside pOuter is allowed in Writer core, 
depending on their type.
 static bool IsFieldNestingAllowed(const FieldContextPtr& pOuter, const 
FieldContextPtr& pInner)
 {
-std::optional oOuterFieldId = pOuter->GetFieldId();
-OUString aCommand = pOuter->GetCommand();
-
-// Ignore leading space before the field name, but don't accept IFF when 
we check for IF.
-if (!aCommand.isEmpty() && aCommand[0] == ' ')
-{
-aCommand = aCommand.subView(1);
-}
-
-if (!oOuterFieldId && aCommand.startsWith("IF "))
+if (!pInner->GetFieldId())
 {
-// This will be FIELD_IF once the command is closed.
-oOuterFieldId = FIELD_IF;
+return true;
 }
 
+std::optional oOuterFieldId = pOuter->GetFieldId();
 if (!oOuterFieldId)
 {
-return true;
+OUString aCommand = pOuter->GetCommand();
+
+// Ignore leading space before the field name, but don't accept IFF 
when we check for IF.
+if (!aCommand.isEmpty() && aCommand[0] == ' ')
+{
+aCommand = aCommand.subView(1);
+}
+
+if (aCommand.startsWith("IF "))
+{
+// This will be FIELD_IF once the command is closed.
+oOuterFieldId = FIELD_IF;
+}
 }
 
-if (!pInner->GetFieldId())
+if (!oOuterFieldId)
 {
 return true;
 }


[Libreoffice-commits] core.git: writerfilter/source

2023-01-19 Thread Andrea Gelmini (via logerrit)
 writerfilter/source/dmapper/StyleSheetTable.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 52b465e271961a65f356c9a5b354acead3c0a849
Author: Andrea Gelmini 
AuthorDate: Thu Jan 19 15:51:02 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 19 16:05:38 2023 +

Fix typo

Change-Id: Iba92ac9d7093b7fd8d6d61be2496333ad1d8b59d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145815
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index c0a8e32845c9..f7dfa61e779a 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1420,7 +1420,7 @@ const StyleSheetEntryPtr & 
StyleSheetTable::GetCurrentEntry() const
  Tragically there are references to the localised style name itself in TOC
  fields.
  Hopefully this works and a complete map of >100 built-in style names
- localised to all langauges isn't needed.
+ localised to all languages isn't needed.
 */
 static auto FilterChars(OUString const& rStyleName) -> OUString
 {


[Libreoffice-commits] core.git: writerfilter/source

2023-01-13 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/dmapper/TDefTableHandler.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1a79594a27f41ad369e7c387c51e00afb1352872
Author: Tomaž Vajngerl 
AuthorDate: Thu Jan 5 12:32:02 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 13:44:20 2023 +

ooxml: fix theme color type mapping: bg -> light, text -> dark

Change-Id: I19ad3ef7c911943075d7ddc01626047cdf11d5db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145070
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx 
b/writerfilter/source/dmapper/TDefTableHandler.cxx
index 4d279ac4bc12..b8e0582de033 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -300,13 +300,13 @@ model::ThemeColorType 
TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
 case NS_ooxml::LN_Value_St_ThemeColor_none:
 return model::ThemeColorType::Unknown;
 case NS_ooxml::LN_Value_St_ThemeColor_background1:
-return model::ThemeColorType::Dark1;
-case NS_ooxml::LN_Value_St_ThemeColor_text1:
 return model::ThemeColorType::Light1;
+case NS_ooxml::LN_Value_St_ThemeColor_text1:
+return model::ThemeColorType::Dark1;
 case NS_ooxml::LN_Value_St_ThemeColor_background2:
-return model::ThemeColorType::Dark2;
-case NS_ooxml::LN_Value_St_ThemeColor_text2:
 return model::ThemeColorType::Light2;
+case NS_ooxml::LN_Value_St_ThemeColor_text2:
+return model::ThemeColorType::Dark2;
 default:
 break;
 }


[Libreoffice-commits] core.git: writerfilter/source

2022-12-28 Thread Stephan Bergmann (via logerrit)
 writerfilter/source/dmapper/TagLogger.cxx |   10 ++
 writerfilter/source/dmapper/TagLogger.hxx |5 +
 2 files changed, 15 insertions(+)

New commits:
commit 6522d0f44a92f8102f50f94e26c6d7140fd7fd44
Author: Stephan Bergmann 
AuthorDate: Wed Dec 28 21:15:24 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 29 07:56:56 2022 +

Properly print floats

...avoiding

> /writerfilter/source/dmapper/PropertyMap.cxx:324:71: runtime error: -2539 
is outside the range of representable values of type 'unsigned int'
> #0 0x7f80e9a3b6c3 in writerfilter::dmapper::PropertyMap::dumpXml() 
const /writerfilter/source/dmapper/PropertyMap.cxx:324:71
> #1 0x7f80e928eccb in 
writerfilter::dmapper::DomainMapperTableHandler::endTableGetTableStyle(writerfilter::dmapper::TableInfo&,
 std::__debug::vector >&, bool) 
/writerfilter/source/dmapper/DomainMapperTableHandler.cxx:434:40
> #2 0x7f80e92b4b8f in 
writerfilter::dmapper::DomainMapperTableHandler::endTable(unsigned int, bool) 
/writerfilter/source/dmapper/DomainMapperTableHandler.cxx:1377:30
> #3 0x7f80e9c289de in 
writerfilter::dmapper::TableManager::resolveCurrentTable() 
/writerfilter/source/dmapper/TableManager.cxx:409:33
> #4 0x7f80e9c297a1 in writerfilter::dmapper::TableManager::endLevel() 
/writerfilter/source/dmapper/TableManager.cxx:427:9
> #5 0x7f80e936a997 in 
writerfilter::dmapper::DomainMapperTableManager::endLevel() 
/writerfilter/source/dmapper/DomainMapperTableManager.cxx:497:19
> #6 0x7f80e9c256d1 in 
writerfilter::dmapper::TableManager::endParagraphGroup() 
/writerfilter/source/dmapper/TableManager.cxx:338:9
> #7 0x7f80e9205974 in 
writerfilter::dmapper::DomainMapper::lcl_endParagraphGroup() 
/writerfilter/source/dmapper/DomainMapper.cxx:3511:35
> #8 0x7f80e984598e in writerfilter::LoggedStream::endParagraphGroup() 
/writerfilter/source/dmapper/LoggedResources.cxx:108:5
> #9 0x7f80e9d9addf in 
writerfilter::ooxml::OOXMLFastContextHandler::endParagraphGroup() 
/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:452:23
> #10 0x7f80ea042658 in 
writerfilter::ooxml::OOXMLFactory_wml::endAction(writerfilter::ooxml::OOXMLFastContextHandler*)
 /workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFactory_wml.cxx:7574:19
> #11 0x7f80e9d8822a in 
writerfilter::ooxml::OOXMLFactory::endAction(writerfilter::ooxml::OOXMLFastContextHandler*)
 /writerfilter/source/ooxml/OOXMLFactory.cxx:157:19
> #12 0x7f80e9d944eb in 
writerfilter::ooxml::OOXMLFastContextHandler::lcl_endFastElement(int) 
/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:242:5
> #13 0x7f80e9d941da in 
writerfilter::ooxml::OOXMLFastContextHandler::endFastElement(int) 
/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:225:9
> #14 0x7f80f44ffe2a in (anonymous namespace)::Entity::endElement() 
/sax/source/fastparser/fastparser.cxx:515:27
> #15 0x7f80f44ff818 in 
sax_fastparser::FastSaxParserImpl::callbackEndElement() 
/sax/source/fastparser/fastparser.cxx:1343:17
> #16 0x7f80f44ef554 in (anonymous 
namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char 
const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:339:18
> #17 0x7f8179cde54a in xmlParseEndTag2 
/workdir/UnpackedTarball/libxml2/parser.c:9742:2
> #18 0x7f8179c8ced0 in xmlParseTryOrFinish 
/workdir/UnpackedTarball/libxml2/parser.c:11642:14
> #19 0x7f8179c7acc9 in xmlParseChunk 
/workdir/UnpackedTarball/libxml2/parser.c:12351:13
> #20 0x7f80f44ea4f1 in sax_fastparser::FastSaxParserImpl::parse() 
/sax/source/fastparser/fastparser.cxx:1099:21
> #21 0x7f80f44e4146 in 
sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource
 const&) /sax/source/fastparser/fastparser.cxx:904:9
> #22 0x7f80f4505300 in 
sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource
 const&) /sax/source/fastparser/fastparser.cxx:1482:13
> #23 0x7f80e9d46e98 in 
writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) 
/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:508:18
> #24 0x7f80e9cfed05 in (anonymous 
namespace)::WriterFilter::filter(com::sun::star::uno::Sequence
 const&) /writerfilter/source/filter/WriterFilter.cxx:208:24
> #25 0x7f8149202866 in SfxObjectShell::ImportFrom(SfxMedium&, 
com::sun::star::uno::Reference const&) 
/sfx2/source/doc/objstor.cxx:2272:34
> #26 0x7f81491c2434 in SfxObjectShell::DoLoad(SfxMedium*) 
/sfx2/source/doc/objstor.cxx:739:23
> #27 0x7f81493c9870 in 
SfxBaseModel::load(com::sun::star::uno::Sequence
 const&) /sfx2/source/doc/sfxbasemodel.cxx:1937:36
> #28 0x7f8149b20d71 in (anonymous 
namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence
 const&, com::sun::star::uno::Reference const&) 
/sfx2/source/view/frmload.cxx:720:28
> #29 

[Libreoffice-commits] core.git: writerfilter/source

2022-12-21 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 3ff4194a8acff9da2cad7776cfd57f82bc71ce25
Author: Caolán McNamara 
AuthorDate: Wed Dec 21 16:06:08 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Dec 21 20:19:00 2022 +

ofz#54461 Null-dereference

seen since:

commit 96a856f87f16cca2e039c973c18d57c8b9dca362
Date:   Fri Dec 16 13:20:25 2022 +0100

tdf#152206 DOCX import: fix mixed first footnote

Note: tdf#152506 is the correct issue identifier.

Change-Id: I6e66db1a6a87cfce444346f193a418880750e03c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144692
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1fd0d4174346..377c133c8192 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3746,15 +3746,25 @@ void DomainMapper_Impl::PopFootOrEndnote()
 {
 if ( m_nFirstFootnoteIndex == -1 )
 lcl_convertToNoteIndices(m_aFootnoteIds, 
m_nFirstFootnoteIndex);
-xFootnotes->getByIndex(m_aFootnoteIds.front()) >>= 
xNoteFirst;
-m_aFootnoteIds.pop_front();
+if (m_aFootnoteIds.empty()) // lcl_convertToNoteIndices 
pops m_aFootnoteIds
+m_bSaxError = true;
+else
+{
+xFootnotes->getByIndex(m_aFootnoteIds.front()) >>= 
xNoteFirst;
+m_aFootnoteIds.pop_front();
+}
 }
 else if ( !IsInFootnote() && !m_aEndnoteIds.empty() )
 {
 if ( m_nFirstEndnoteIndex == -1 )
 lcl_convertToNoteIndices(m_aEndnoteIds, 
m_nFirstEndnoteIndex);
-xEndnotes->getByIndex(m_aEndnoteIds.front()) >>= 
xNoteFirst;
-m_aEndnoteIds.pop_front();
+if (m_aEndnoteIds.empty()) // lcl_convertToNoteIndices 
pops m_aEndnoteIds
+m_bSaxError = true;
+else
+{
+xEndnotes->getByIndex(m_aEndnoteIds.front()) >>= 
xNoteFirst;
+m_aEndnoteIds.pop_front();
+}
 }
 else
 m_bSaxError = true;


[Libreoffice-commits] core.git: writerfilter/source

2022-12-20 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 21a2de9b5e5ae9be260456a10a7ba25a77e73b43
Author: Miklos Vajna 
AuthorDate: Fri Dec 16 10:43:07 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 20 16:07:55 2022 +

writerfilter: fix crash in DomainMapper_Impl::convertFieldFormula()

Crashreport signature:

program/libwriterfilterlo.so
writerfilter::dmapper::SettingsTable::GetListSeparator() const
writerfilter/source/dmapper/SettingsTable.cxx:489
program/libwriterfilterlo.so

writerfilter::dmapper::DomainMapper_Impl::convertFieldFormula(rtl::OUString 
const&)
include/rtl/ustring.hxx:226
program/libwriterfilterlo.so

writerfilter::dmapper::DomainMapper_Impl::handleFieldFormula(tools::SvRef
 const&, com::sun::star::uno::Reference 
const&)
include/rtl/ustring.hxx:527
program/libwriterfilterlo.so
writerfilter::dmapper::DomainMapper_Impl::CloseFieldCommand()
writerfilter/source/dmapper/DomainMapper_Impl.cxx:6458

Change-Id: I7f48f76cacffa00d633d92f0a51b2d82f96d1e74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144592
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe7374848d72..1fd0d4174346 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5621,6 +5621,11 @@ void DomainMapper_Impl::handleFieldAsk
  */
 OUString DomainMapper_Impl::convertFieldFormula(const OUString& input) {
 
+if (!m_pSettingsTable)
+{
+return input;
+}
+
 OUString listSeparator = m_pSettingsTable->GetListSeparator();
 
 /* Replace logical condition functions with LO equivalent operators */


[Libreoffice-commits] core.git: writerfilter/source

2022-12-13 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 136ee63e37358e94c28b5d8c56f2b244a7a740de
Author: Justin Luth 
AuthorDate: Mon Dec 12 11:08:19 2022 -0500
Commit: Justin Luth 
CommitDate: Tue Dec 13 13:19:10 2022 +

tdf#148035 sw content controls: cursor-move for runSdt only

For normal documents, just doing a Push/PopSdt on a block SDT
seems to work out-of-the-box for checkbox/dropdown/date content controls.
Apparently that is not the right way to do it though.

When I was trying it, the first control was always "lost".
This patch takes care of that. At the moment it does nothing
since only runSdt's even call push/pop, but at least
it might save some trouble later on when block SDTs are
turned into content controls.

Change-Id: I6bf68f296ca919dc09dec660c052ddbdb59d56bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144007
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5365b302c6d2..064bb5b15da6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -882,7 +882,8 @@ void DomainMapper_Impl::PopSdt()
 // DomainMapper_Impl::AddDummyParaForTableInSection() would make our 
range multi-paragraph,
 // while the intention is to keep start/end inside the same paragraph 
for run SDTs.
 uno::Reference xParagraphCursor(xCursor, 
uno::UNO_QUERY);
-if (xParagraphCursor.is())
+if (xParagraphCursor.is()
+&& m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtRun_sdtContent)
 {
 xCursor->gotoRange(xEnd, /*bExpand=*/false);
 xParagraphCursor->gotoStartOfParagraph(/*bExpand=*/false);


[Libreoffice-commits] core.git: writerfilter/source

2022-12-09 Thread Andrea Gelmini (via logerrit)
 writerfilter/source/ooxml/model.xml |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 01fc8ceef1946ca84d7cfef3801ad7f00e36042a
Author: Andrea Gelmini 
AuthorDate: Fri Dec 9 20:51:18 2022 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 9 20:22:38 2022 +

Fix typo

Change-Id: I96297815043ea213f67d0ccc4224b12d7bcf7d36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143887
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 158b764f355e..4f2446aa5272 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -3492,7 +3492,7 @@
 
   
 
-
+
 
 
   


[Libreoffice-commits] core.git: writerfilter/source

2022-11-30 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 61b5835fc81f1dec9c9e334a9f886f35997d1b56
Author: Justin Luth 
AuthorDate: Wed Nov 30 08:13:01 2022 -0500
Commit: Justin Luth 
CommitDate: Wed Nov 30 19:14:18 2022 +0100

related tdf#152305 writerfilter: avoid comment-related exceptions

a comment anchored in a table sees m_nTableDepth,
but while in the comment it shouldn't affect
the table itself.

I did a search for m_nTableDepth and added !m_bIsInComments
everywhere that looked reasonable.

Change-Id: Iaaaf2f2b5a9f409146111b2e8546573c264e75ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143510
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4c20cdc1bfb5..ffeb26da7a97 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2481,7 +2481,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 css::uno::Reference 
xParaProps(xTextRange, uno::UNO_QUERY);
 
 // table style precedence and not hidden shapes anchored to 
hidden empty table paragraphs
-if (xParaProps && (m_nTableDepth > 0 || 
!m_aAnchoredObjectAnchors.empty()) )
+if (xParaProps && !m_bIsInComments
+&& (m_nTableDepth > 0 || 
!m_aAnchoredObjectAnchors.empty()))
 {
 // table style has got bigger precedence than docDefault 
style
 // collect these pending paragraph properties to process 
in endTable()
@@ -2596,7 +2597,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 }
 
 // fix table paragraph properties
-if ( xTextRange.is() && xParaProps && m_nTableDepth > 0 )
+if (xTextRange.is() && xParaProps && m_nTableDepth > 0 && 
!m_bIsInComments)
 {
 // tdf#128959 table paragraphs haven't got window and 
orphan controls
 uno::Any aAny(static_cast(0));
@@ -2665,7 +2666,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 
 // don't overwrite m_bFirstParagraphInCell in table separator nodes
 // and in text boxes anchored to the first paragraph of table cells
-if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && 
!IsInShape())
+if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && 
!IsInShape() && !m_bIsInComments)
 m_bFirstParagraphInCell = false;
 
 m_bParaAutoBefore = false;


[Libreoffice-commits] core.git: writerfilter/source

2022-11-24 Thread Stephan Bergmann (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |   62 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   75 --
 writerfilter/source/dmapper/NumberingManager.cxx  |4 -
 writerfilter/source/dmapper/PropertyMap.hxx   |   20 -
 writerfilter/source/dmapper/StyleSheetTable.cxx   |9 +-
 5 files changed, 96 insertions(+), 74 deletions(-)

New commits:
commit 8858962ec09478c203d43feb58f550bb36af37bb
Author: Stephan Bergmann 
AuthorDate: Wed Nov 23 16:57:57 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 24 10:43:24 2022 +0100

Introduce ParagraphProeprtiesPropertyMap

StylePropertyMap and ParagraphPropertyMap should be has-a, not is-a
ParagraphProperties.  (I came across this with a tentative new loplugin 
flagging
uses of dynamic_cast that implement cross casts between unrelated classes.  
This
would silence that plugin, but also IMO makes intent more explicit here.)

(And PropertyMap and ParagraphProperties no longer need their base classes 
to be
virtual now.)

Change-Id: Id89547f7824262b80e8a23c9c1d5ea6406dfcc9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143203
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 781cdfeac764..3521f705fdf8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -811,22 +811,22 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case NS_ooxml::LN_CT_FramePr_hSpace:
 case NS_ooxml::LN_CT_FramePr_vSpace:
 {
-ParagraphProperties* pParaProperties = nullptr;
+ParagraphPropertiesPropertyMap* pParaProperties = nullptr;
 // handle frame properties at styles
 if( m_pImpl->GetTopContextType() == CONTEXT_STYLESHEET )
-pParaProperties = dynamic_cast< ParagraphProperties*>( 
m_pImpl->GetTopContextOfType( CONTEXT_STYLESHEET ).get() );
+pParaProperties = dynamic_cast< 
ParagraphPropertiesPropertyMap*>( m_pImpl->GetTopContextOfType( 
CONTEXT_STYLESHEET ).get() );
 else
-pParaProperties = dynamic_cast< ParagraphProperties*>( 
m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
+pParaProperties = dynamic_cast< 
ParagraphPropertiesPropertyMap*>( m_pImpl->GetTopContextOfType( 
CONTEXT_PARAGRAPH ).get() );
 
 if( pParaProperties )
 {
 switch( nName )
 {
 case NS_ooxml::LN_CT_FramePr_dropCap:
-pParaProperties->SetDropCap( nIntValue );
+pParaProperties->props().SetDropCap( nIntValue );
 break;
 case NS_ooxml::LN_CT_FramePr_lines:
-pParaProperties->SetLines( nIntValue );
+pParaProperties->props().SetLines( nIntValue );
 break;
 case NS_ooxml::LN_CT_FramePr_hAnchor:
 switch(nIntValue)
@@ -837,7 +837,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case  NS_ooxml::LN_Value_doc_ST_HAnchor_page:   
nIntValue = text::RelOrientation::PAGE_FRAME; break;
 default:;
 }
-pParaProperties->SethAnchor( nIntValue );
+pParaProperties->props().SethAnchor( nIntValue );
 break;
 case NS_ooxml::LN_CT_FramePr_vAnchor:
 switch(nIntValue)
@@ -848,11 +848,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case  NS_ooxml::LN_Value_doc_ST_VAnchor_page: 
nIntValue = text::RelOrientation::PAGE_FRAME; break;
 default:;
 }
-pParaProperties->SetvAnchor( nIntValue );
+pParaProperties->props().SetvAnchor( nIntValue );
 break;
 case NS_ooxml::LN_CT_FramePr_x:
-pParaProperties->Setx( 
ConversionHelper::convertTwipToMM100(nIntValue ));
-pParaProperties->SetxAlign( 
text::HoriOrientation::NONE );
+pParaProperties->props().Setx(
+ConversionHelper::convertTwipToMM100(nIntValue ));
+pParaProperties->props().SetxAlign( 
text::HoriOrientation::NONE );
 break;
 case NS_ooxml::LN_CT_FramePr_xAlign:
 switch( nIntValue )
@@ -864,11 +865,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case  NS_ooxml::LN_Value_doc_ST_XAlign_left: 
nIntValue = text::HoriOrientation::LEFT; break;
  

[Libreoffice-commits] core.git: writerfilter/source

2022-11-24 Thread Stephan Bergmann (via logerrit)
 writerfilter/source/dmapper/PropertyMap.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6571ab41ec5ce496f151bc4c5eaa8c4a52087e7f
Author: Stephan Bergmann 
AuthorDate: Wed Nov 23 16:57:34 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 24 10:00:02 2022 +0100

No need for the base class to virtual here

Change-Id: Ie8078340ece235c52529770bf393b264d8ca31db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143202
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index 7ec406053f07..b222c5d1508d 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -79,7 +79,7 @@ enum GrabBagType
 CHAR_GRAB_BAG
 };
 
-struct RedlineParams : public virtual SvRefBase
+struct RedlineParams : public SvRefBase
 {
 OUString  m_sAuthor;
 OUString  m_sDate;


[Libreoffice-commits] core.git: writerfilter/source

2022-11-22 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 1435c5b12646269e2b5b58ec7d51626dce6505db
Author: Justin Luth 
AuthorDate: Fri Nov 18 12:57:35 2022 -0500
Commit: Justin Luth 
CommitDate: Wed Nov 23 01:08:02 2022 +0100

cleanup SdtControlType::plainText - same as the other controls.

For a while, plainText needed special handling
added in commit 9700c1b2170ad04453a361ed5647937833ac3c18
Date:   Mon Jul 25 09:13:03 2022 +0200
sw content controls, plain text: add DOCX import

But now it is treated the same as all the others
and so can be lumped together with the other case statements
since commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a
Date:   Mon Sep 19 10:01:36 2022 +0200
sw content controls, plain text: enable DOCX filter with data binding

Change-Id: Ie1ebe3873e8f49ae9747f1a77d08bfc0dec2d9f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142953
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 94422d8a6a98..781cdfeac764 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1109,6 +1109,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 switch (m_pImpl->m_pSdtHelper->getControlType())
 {
 case SdtControlType::richText:
+case SdtControlType::plainText:
 case SdtControlType::checkBox:
 case SdtControlType::dropDown:
 case SdtControlType::comboBox:
@@ -1119,11 +1120,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 default:
 break;
 }
-
-if (m_pImpl->m_pSdtHelper->getControlType() == 
SdtControlType::plainText)
-{
-m_pImpl->PopSdt();
-}
 }
 
 m_pImpl->SetSdt(false);


[Libreoffice-commits] core.git: writerfilter/source

2022-11-18 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/SdtHelper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit e960d3fea28fe4c180dc5612ce00682e432e9772
Author: Justin Luth 
AuthorDate: Thu Nov 17 06:20:14 2022 -0500
Commit: Justin Luth 
CommitDate: Fri Nov 18 14:07:57 2022 +0100

sw content controls: fix SdtHelper missing clear() items

Found during a code read, while attempting to add another property.

Change-Id: I342c51c81f23e1e3178e7d412f9af685f3fd4ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142839
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index cf86a629219b..6f08c81559cf 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -516,6 +516,10 @@ void SdtHelper::clear()
 m_bChecked = false;
 m_aCheckedState.clear();
 m_aUncheckedState.clear();
+m_aPlaceholderDocPart.clear();
+m_aColor.clear();
+m_aAlias.clear();
+m_aTag.clear();
 }
 
 void SdtHelper::SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)


[Libreoffice-commits] core.git: writerfilter/source

2022-10-03 Thread László Németh (via logerrit)
 writerfilter/source/dmapper/StyleSheetTable.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5a1c668747f3495ddc7567ae95f2145663565647
Author: László Németh 
AuthorDate: Mon Oct 3 17:15:04 2022 +0200
Commit: László Németh 
CommitDate: Mon Oct 3 21:20:52 2022 +0200

tdf#138625 DOCX import: fix superscript footnote numbering in l10n

Footnote/endnote numbers in the footnote area didn't get
superscript etc. formatting in non-English locale
settings because of the writerfilter mapping to
the English localization ("Footnote Characters" and
"Endnote Characters") instead of the correct
programmatic character style names ("Footnote Symbol"
and "Endnote Symbol") according to
SwStyleNameMapper::GetChrFormatProgNameArray().

Testing: unit test of tdf#82173. Manual: e.g. open test
document of tdf#138625 in an Italian build, after setting
Italian locale in it in Tools->Options...->Language Settings->
Languages->Language of user interface.

Follow-up to commit 707eb4db1918658e0c2c2c2033c6a69f80c4eafd
"tdf#82173 writerfilter: charStyle XnoteReference->Xnote Characters".

Change-Id: I36b3c5ff065e9f80289d051e27f618b40e0c9355
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140918
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 7c2d3634c6e2..cb0bd5a922b9 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1494,13 +1494,13 @@ OUString StyleSheetTable::ConvertStyleName( const 
OUString& rWWName, bool bExten
 //{ "Table of Figures", "" },
 { "Envelope Address", "Addressee" },
 { "Envelope Return", "Sender" },
-{ "footnote reference", "Footnote Characters" },
-{ "Footnote Reference", "Footnote Characters" },
+{ "footnote reference", "Footnote Symbol" },
+{ "Footnote Reference", "Footnote Symbol" },
 //{ "Annotation Reference", "" },
 { "Line Number", "Line numbering" },
 { "Page Number", "Page Number" },
-{ "endnote reference", "Endnote Characters" },
-{ "Endnote Reference", "Endnote Characters" },
+{ "endnote reference", "Endnote Symbol" },
+{ "Endnote Reference", "Endnote Symbol" },
 { "endnote text", "Endnote" },
 { "Endnote Text", "Endnote" },
 //{ "Table of Authorities", "" },


[Libreoffice-commits] core.git: writerfilter/source

2022-09-09 Thread Xisco Fauli (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9279b0bb5397d0520b727ab0d271f328807c8749
Author: Xisco Fauli 
AuthorDate: Fri Sep 9 12:22:55 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Sep 9 13:44:39 2022 +0200

writerfilter: avoid divide by zero

in DomainMapperTableManager::endOfRowAction()

See 
https://crashreport.libreoffice.org/stats/signature/writerfilter::dmapper::DomainMapperTableManager::endOfRowAction()

Probably since 116cadb5d2582532c69677a2f8499e8e9b7b9b80
"tdf#59274 DOCX import: fix tables with incomplete grid"

Change-Id: I12f2842107885fbbc62be2186511102f642e3efc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139717
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 2d86919deca3..bc8b59642714 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -797,9 +797,6 @@ void DomainMapperTableManager::endOfRowAction()
 size_t nWidthsBound = pCellWidths->size() - 1;
 if (nWidthsBound)
 {
-if (nFullWidthRelative == 0)
-throw o3tl::divide_by_zero();
-
 // At incomplete table grids, last cell width can be smaller, than 
its final width.
 // Correct it based on the last but one column width and their 
span values.
 if ( bIsIncompleteGrid && rCurrentSpans.size()-1 == nWidthsBound )
@@ -810,6 +807,9 @@ void DomainMapperTableManager::endOfRowAction()
 nFullWidthRelative += nFixLastCellWidth - 
(*pCellWidths)[nWidthsBound];
 }
 
+if (nFullWidthRelative == 0)
+throw o3tl::divide_by_zero();
+
 for (size_t i = 0; i < nWidthsBound; ++i)
 {
 nSum += (*pCellWidths)[i];


[Libreoffice-commits] core.git: writerfilter/source

2022-08-12 Thread Michael Stahl (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 49a74d07ca38c313ce5cf237b4ac2df892a3fa0e
Author: Michael Stahl 
AuthorDate: Thu Aug 11 19:01:54 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 12 11:07:19 2022 +0200

writerfilter: typo Srpms->Sprms

Change-Id: Ib24c5711539b54b429231693fe2aa034593c6262
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138156
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b3181e605f23..46b921bf9664 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1670,20 +1670,20 @@ void RTFDocumentImpl::sendProperties(
 tableBreak();
 }
 
-void RTFDocumentImpl::replayRowBuffer(RTFBuffer_t& rBuffer, 
::std::deque& rCellsSrpms,
+void RTFDocumentImpl::replayRowBuffer(RTFBuffer_t& rBuffer, 
::std::deque& rCellsSprms,
   ::std::deque& 
rCellsAttributes, int const nCells)
 {
 for (int i = 0; i < nCells; ++i)
 {
-replayBuffer(rBuffer, (), ());
-rCellsSrpms.pop_front();
+replayBuffer(rBuffer, (), ());
+rCellsSprms.pop_front();
 rCellsAttributes.pop_front();
 }
 for (Buf_t& i : rBuffer)
 {
 SAL_WARN_IF(BUFFER_CELLEND == std::get<0>(i), "writerfilter.rtf", 
"dropping table cell!");
 }
-assert(rCellsSrpms.empty());
+assert(rCellsSprms.empty());
 assert(rCellsAttributes.empty());
 }
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 14ffc2f630a4..48738135542a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -788,7 +788,7 @@ private:
 void sendProperties(writerfilter::Reference::Pointer_t const& 
pParagraphProperties,
 writerfilter::Reference::Pointer_t const& 
pFrameProperties,
 writerfilter::Reference::Pointer_t const& 
pTableRowProperties);
-void replayRowBuffer(RTFBuffer_t& rBuffer, ::std::deque& 
rCellsSrpms,
+void replayRowBuffer(RTFBuffer_t& rBuffer, ::std::deque& 
rCellsSprms,
  ::std::deque& rCellsAttributes, int nCells);
 void replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* pSprms, RTFSprms const* 
pAttributes);
 /// If we have some unicode or hex characters to send.


[Libreoffice-commits] core.git: writerfilter/source writerperfect/inc writerperfect/source

2022-07-31 Thread Noel Grandin (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 +-
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|9 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|   37 +++
 writerfilter/source/dmapper/FontTable.cxx|5 +-
 writerfilter/source/dmapper/FontTable.hxx|2 
 writerfilter/source/dmapper/FormControlHelper.cxx|5 +-
 writerfilter/source/dmapper/FormControlHelper.hxx|2 
 writerfilter/source/dmapper/GraphicImport.cxx|9 ++-
 writerfilter/source/dmapper/GraphicImport.hxx|4 -
 writerfilter/source/dmapper/LoggedResources.cxx  |5 +-
 writerfilter/source/dmapper/LoggedResources.hxx  |2 
 writerfilter/source/dmapper/NumberingManager.cxx |5 +-
 writerfilter/source/dmapper/NumberingManager.hxx |2 
 writerfilter/source/dmapper/PropertyMap.cxx  |5 +-
 writerfilter/source/dmapper/PropertyMap.hxx  |9 ++-
 writerfilter/source/dmapper/SdtHelper.cxx|5 +-
 writerfilter/source/dmapper/SdtHelper.hxx|2 
 writerfilter/source/dmapper/StyleSheetTable.cxx  |   11 ++--
 writerfilter/source/dmapper/TableData.hxx|3 -
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx |6 +-
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx |2 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx  |   11 ++--
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx  |2 
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx   |5 +-
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx   |2 
 writerfilter/source/ooxml/OOXMLPropertySet.cxx   |   30 ++--
 writerfilter/source/ooxml/OOXMLPropertySet.hxx   |   14 ++---
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx|9 ++-
 writerfilter/source/ooxml/OOXMLStreamImpl.hxx|4 -
 writerperfect/inc/ImportFilter.hxx   |5 +-
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx|5 +-
 writerperfect/source/common/DirectoryStream.cxx  |7 +-
 writerperfect/source/common/WPXSvInputStream.cxx |   15 +++---
 writerperfect/source/writer/WordPerfectImportFilter.hxx  |6 +-
 35 files changed, 137 insertions(+), 115 deletions(-)

New commits:
commit 93bea3531cff7f1e35a4c982836afbabfa587a6f
Author: Noel Grandin 
AuthorDate: Fri Jul 29 09:50:52 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 31 08:33:13 2022 +0200

clang-tidy modernize-pass-by-value in writer*

Change-Id: Ib08c971eb3e859e7b04cdd408af7966d83c2955b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137585
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 774cba78c3a1..bd23785b6ef2 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -55,6 +55,7 @@
 #ifdef DBG_UTIL
 #include "PropertyMapHelper.hxx"
 #include 
+#include 
 #endif
 
 namespace writerfilter::dmapper {
@@ -81,9 +82,9 @@ using namespace ::std;
 #define MAXTABLECELLS 63
 
 DomainMapperTableHandler::DomainMapperTableHandler(
-css::uno::Reference const& xText,
+css::uno::Reference xText,
 DomainMapper_Impl& rDMapper_Impl)
-: m_xText(xText),
+: m_xText(std::move(xText)),
 m_rDMapper_Impl( rDMapper_Impl ),
 m_bHadFootOrEndnote(false)
 {
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
index 4e396b6b23fc..f05fc1e474f1 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
@@ -79,7 +79,7 @@ class DomainMapperTableHandler final : public virtual 
SvRefBase
 public:
 typedef tools::SvRef Pointer_t;
 
-
DomainMapperTableHandler(css::uno::Reference 
const& xText,
+
DomainMapperTableHandler(css::uno::Reference 
xText,
  DomainMapper_Impl& rDMapper_Impl);
 ~DomainMapperTableHandler() override;
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ba66d5c340f7..f5ca32d6f6f6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -312,7 +313,7 @@ uno::Any 
FloatingTableInfo::getPropertyValue(std::u16string_view propertyName)
 
 DomainMapper_Impl::DomainMapper_Impl(
 DomainMapper& rDMapper,
-uno::Reference const& xContext,
+uno::Reference xContext,
  

[Libreoffice-commits] core.git: writerfilter/source

2022-07-13 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit fc8b757dad5d98f4ba1cd40d03505873128670cd
Author: Justin Luth 
AuthorDate: Wed Jul 13 10:19:23 2022 -0400
Commit: Justin Luth 
CommitDate: Wed Jul 13 21:09:30 2022 +0200

tdf#139759 writerfilter: import comment highlight

Although it is a highlight, LO doesn't have such a silly
duplicate thing in the editeng code. So just map this as
normal char background instead of char highlight.

As of LO 7.x, we default to exporting as char background anyway,
so highlight is on the way out in LO.

P.S. Highlight is one of 17-ish colors. It is the background
button in the Char panel in MS Word. Background is on Word's
Para panel (even though it is a character property),
and so it can fairly easily be removed in MS Word.

I didn't add a unit test because it doesn't round-trip,
and an import-only test is basically useless.
I'm having a surprisingly hard time finding why it doesn't export.

Change-Id: Iad279b503b9f307994f1d9b96e7d984d6d8b44fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137036
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index d940d09ffd34..969578a4e73c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1714,17 +1714,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 break;
 }
 
+PropertyIds ePropertyId = m_pImpl->IsInComments() ? 
PROP_CHAR_BACK_COLOR : PROP_CHAR_HIGHLIGHT;
+
 // OOXML import uses an ID
 if( IsOOXMLImport() )
 {
 sal_Int32 nColor = 0;
 if( getColorFromId(nIntValue, nColor) )
-rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::Any( nColor ));
+rContext->Insert(ePropertyId, uno::Any(nColor));
 }
 // RTF import uses the actual color value
 else if( IsRTFImport() )
 {
-rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::Any( nIntValue ));
+rContext->Insert(ePropertyId, uno::Any(nIntValue));
 }
 }
 break;


[Libreoffice-commits] core.git: writerfilter/source

2022-06-28 Thread Julien Nabet (via logerrit)
 writerfilter/source/dmapper/TableManager.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b86c7136fe0f75813dd370b408a7096f78ff168b
Author: Julien Nabet 
AuthorDate: Tue Jun 28 21:58:59 2022 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 28 22:42:38 2022 +0200

Typo: "getGridBefore" instead of "getGridAfter"

Change-Id: Ie4dafd54e2eaeb8879dc8938f188cb76ebdd7612
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136589
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/TableManager.cxx 
b/writerfilter/source/dmapper/TableManager.cxx
index 58f1c32b15e6..17126b73a6ca 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -75,7 +75,7 @@ sal_uInt32 TableManager::getGridAfter(sal_uInt32 nRow)
 {
 if (!isInTable())
 {
-SAL_WARN("writerfilter", "TableManager::getGridBefore called while not 
in table");
+SAL_WARN("writerfilter", "TableManager::getGridAfter called while not 
in table");
 return 0;
 }
 if (nRow >= mTableDataStack.top()->getRowCount())


[Libreoffice-commits] core.git: writerfilter/source

2022-06-28 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/TableManager.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 8fe3795621a577a866fcd748465b6ee0b6a5385a
Author: Caolán McNamara 
AuthorDate: Tue Jun 28 19:58:59 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 28 21:52:40 2022 +0200

crashtesting: assert on loading forum-mso-en-8971.docx

Change-Id: Ifce343a26a03b0a17624d584cb8936df49db6148
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136588
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/TableManager.cxx 
b/writerfilter/source/dmapper/TableManager.cxx
index 17fc3085d990..58f1c32b15e6 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -51,7 +51,11 @@ bool TableManager::isIgnore() const { return isRowEnd(); }
 
 sal_uInt32 TableManager::getGridBefore(sal_uInt32 nRow)
 {
-assert(isInTable());
+if (!isInTable())
+{
+SAL_WARN("writerfilter", "TableManager::getGridBefore called while not 
in table");
+return 0;
+}
 if (nRow >= mTableDataStack.top()->getRowCount())
 return 0;
 return mTableDataStack.top()->getRow(nRow)->getGridBefore();
@@ -69,7 +73,11 @@ void TableManager::setCurrentGridBefore(sal_uInt32 
nSkipGrids)
 
 sal_uInt32 TableManager::getGridAfter(sal_uInt32 nRow)
 {
-assert(isInTable());
+if (!isInTable())
+{
+SAL_WARN("writerfilter", "TableManager::getGridBefore called while not 
in table");
+return 0;
+}
 if (nRow >= mTableDataStack.top()->getRowCount())
 return 0;
 return mTableDataStack.top()->getRow(nRow)->getGridAfter();


[Libreoffice-commits] core.git: writerfilter/source

2022-06-23 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   29 +-
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 05cd9a73542f0865639711e808771385ca835e66
Author: Caolán McNamara 
AuthorDate: Thu Jun 23 14:35:35 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 23 18:16:41 2022 +0200

crashtesting: assert on loading forum-mso-en-11942.docx

with getToken index past end

Change-Id: I9bfeb9cacd8ad89de8008d37c88d15350ef84fb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136340
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 30f07b351ca5..9ce28108c9ce 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6743,19 +6743,26 @@ void DomainMapper_Impl::CloseFieldCommand()
 break;
 case FIELD_MACROBUTTON:
 {
-//extract macro name
-sal_Int32 nIndex = sizeof(" MACROBUTTON ");
-OUString sMacro = pContext->GetCommand().getToken( 0, ' ', 
nIndex);
 if (xFieldProperties.is())
-xFieldProperties->setPropertyValue(
-getPropertyName(PROP_MACRO_NAME), uno::Any( 
sMacro ));
-
-//extract quick help text
-if(xFieldProperties.is() && 
pContext->GetCommand().getLength() > nIndex + 1)
 {
-xFieldProperties->setPropertyValue(
-getPropertyName(PROP_HINT),
-uno::Any( pContext->GetCommand().copy( nIndex )));
+sal_Int32 nIndex = sizeof(" MACROBUTTON ");
+OUString sCommand = pContext->GetCommand();
+
+//extract macro name
+if (sCommand.getLength() >= nIndex)
+{
+OUString sMacro = sCommand.getToken(0, ' ', 
nIndex);
+xFieldProperties->setPropertyValue(
+getPropertyName(PROP_MACRO_NAME), 
uno::Any( sMacro ));
+}
+
+//extract quick help text
+if (sCommand.getLength() > nIndex + 1)
+{
+xFieldProperties->setPropertyValue(
+getPropertyName(PROP_HINT),
+uno::Any( sCommand.copy( nIndex )));
+}
 }
 }
 break;


[Libreoffice-commits] core.git: writerfilter/source

2022-06-12 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 37dde4ef13dee5107249ff6604c0bb134235143e
Author: Caolán McNamara 
AuthorDate: Sun Jun 12 16:26:49 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 13 06:55:07 2022 +0200

crashtesting: assert seen on loading forum-mso-de-79405.docx

Change-Id: I91200a8e409eec76de4ead22d200bf45f02b88b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135679
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3d6b26dba8d3..30f07b351ca5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4332,8 +4332,17 @@ static OUString lcl_ParseFormat( const OUString& 
rCommand )
 if (delimPos != -1)
 {
 // Remove whitespace permitted by standard between \@ and "
-sal_Int32 wsChars = rCommand.indexOf('\"') - delimPos - 2;
-command = rCommand.replaceAt(delimPos+2, wsChars, u"");
+const sal_Int32 nQuoteIndex = rCommand.indexOf('\"');
+if (nQuoteIndex != -1)
+{
+sal_Int32 wsChars = nQuoteIndex - delimPos - 2;
+command = rCommand.replaceAt(delimPos+2, wsChars, u"");
+}
+else
+{
+// turn date \@ MM into date \@"MM"
+command = OUString::Concat(rCommand.subView(0, delimPos + 2)) + 
"\"" + o3tl::trim(rCommand.subView(delimPos + 2)) + "\"";
+}
 return OUString(msfilter::util::findQuotedText(command, "\\@\"", 
'\"'));
 }
 


[Libreoffice-commits] core.git: writerfilter/source

2022-06-03 Thread Stephan Bergmann (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx   |6 +++---
 writerfilter/source/dmapper/PropertyMap.cxx|   10 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 +
 3 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit d7c9a269a45ccb7fb8f87ed666a6358eb6712a38
Author: Stephan Bergmann 
AuthorDate: Fri Jun 3 09:21:56 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 3 10:01:36 2022 +0200

No need to static_cast these const Id (aka sal_uInt32) values

Change-Id: I1ae1a4c0e0ca002414db68bf3ad382cb564e17a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135333
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5d2549f6a9c8..c449296e5e2c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -627,7 +627,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 }
 break;
 case NS_ooxml::LN_CT_PageSz_orient:
-CT_PageSz.orient = (nIntValue != 
static_cast(NS_ooxml::LN_Value_ST_PageOrientation_portrait));
+CT_PageSz.orient = (nIntValue != 
NS_ooxml::LN_Value_ST_PageOrientation_portrait);
 break;
 case NS_ooxml::LN_CT_PageSz_w:
 {
@@ -998,7 +998,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 pSectionContext->SetdxaLnn( nIntValue );
 break;
 case NS_ooxml::LN_CT_LineNumber_restart:
-aSettings.bRestartAtEachPage = nIntValue == 
static_cast(NS_ooxml::LN_Value_ST_LineNumberRestart_newPage);
+aSettings.bRestartAtEachPage = nIntValue == 
NS_ooxml::LN_Value_ST_LineNumberRestart_newPage;
 OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
 if( pSectionContext )
 pSectionContext->SetLnc( nIntValue );
@@ -1995,7 +1995,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 {
 //continuous break only allowed if it is not the only section break
 SectionPropertyMap* pLastContext = 
m_pImpl->GetLastSectionContext();
-if ( nIntValue != 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_continuous) || 
pLastContext || m_pImpl->GetParaSectpr() )
+if ( nIntValue != NS_ooxml::LN_Value_ST_SectionMark_continuous || 
pLastContext || m_pImpl->GetParaSectpr() )
 pSectionContext->SetBreakType( nIntValue );
 }
 break;
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 4c9b84c3755e..e1814a8ce1d5 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1565,7 +1565,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 }
 }
 
-if (m_nBreakType == 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_continuous)
+if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_continuous
 && !rDM_Impl.IsInComments())
 {
 //todo: insert a section or access the already inserted section
@@ -1671,7 +1671,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 // If the section is of type "New column" (0x01), then simply insert a 
column break.
 // But only if there actually are columns on the page, otherwise a column 
break
 // seems to be handled like a page break by MSO.
-else if (m_nBreakType == 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_nextColumn)
+else if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextColumn
 && m_nColumnCount > 1 && !rDM_Impl.IsInComments())
 {
 try
@@ -1845,7 +1845,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 // Handle page breaks with odd/even page numbering. We need to use 
an extra page style for setting the page style
 // to left/right, because if we set it to the normal style, we'd 
set it to "First Page"/"Default Style", which would
 // break them (all default pages would be only left or right).
-if ( m_nBreakType == 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_evenPage) || 
m_nBreakType == 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_oddPage) )
+if ( m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_evenPage || 
m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_oddPage )
 {
 OUString* pageStyle = m_bTitlePage ? _sFirstPageStyleName : 
_sFollowPageStyleName;
 OUString evenOddStyleName = rDM_Impl.GetUnusedPageStyleName();
@@ -1875,9 +1875,9 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 evenOddStyle->setPropertyValue( "FooterIsOn", uno::Any( false 
) );

[Libreoffice-commits] core.git: writerfilter/source

2022-04-26 Thread Vasily Melenchuk (via logerrit)
 writerfilter/source/rtftok/rtfvalue.cxx |  140 +---
 writerfilter/source/rtftok/rtfvalue.hxx |   25 ++---
 2 files changed, 89 insertions(+), 76 deletions(-)

New commits:
commit 7678e7ed88007061c3469db3b28b0e91acea7ed6
Author: Vasily Melenchuk 
AuthorDate: Thu Mar 17 22:57:51 2022 +0300
Commit: Miklos Vajna 
CommitDate: Tue Apr 26 08:34:55 2022 +0200

rtf filter: reduce memory allocations count

RTFValue in most cases contain only one value: either num, string,
picture, etc. No reason to allocate all of them in the same time.

RTF filter should became faster and consume less memory, however I
did not made any measuremets.

Change-Id: Ic12a941ce774b9066d7c57b38139af07851ac7b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131720
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/rtftok/rtfvalue.cxx 
b/writerfilter/source/rtftok/rtfvalue.cxx
index e4b3a5a11c68..42f60a1c97d7 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -15,106 +15,73 @@ using namespace com::sun::star;
 
 namespace writerfilter::rtftok
 {
-RTFValue::RTFValue(int nValue, OUString sValue, const RTFSprms& rAttributes, 
const RTFSprms& rSprms,
+RTFValue::RTFValue(int nValue, OUString sValue, const RTFSprms* pAttributes, 
const RTFSprms* pSprms,
uno::Reference xShape, 
uno::Reference xStream,
uno::Reference xObject, bool 
bForceString,
-   const RTFShape& aShape, const RTFPicture& rPicture)
+   const RTFShape* pShape, const RTFPicture* pPicture)
 : m_nValue(nValue)
 , m_sValue(std::move(sValue))
-, m_pAttributes(new RTFSprms(rAttributes))
-, m_pSprms(new RTFSprms(rSprms))
 , m_xShape(std::move(xShape))
 , m_xStream(std::move(xStream))
 , m_xObject(std::move(xObject))
 , m_bForceString(bForceString)
-, m_pShape(new RTFShape(aShape))
-, m_pPicture(new RTFPicture(rPicture))
 {
+if (pAttributes)
+m_pAttributes = new RTFSprms(*pAttributes);
+if (pSprms)
+m_pSprms = new RTFSprms(*pSprms);
+if (pShape)
+m_pShape = new RTFShape(*pShape);
+if (pPicture)
+m_pPicture = new RTFPicture(*pPicture);
 }
 
-RTFValue::RTFValue()
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
-{
-}
+RTFValue::RTFValue() {}
 
 RTFValue::RTFValue(int nValue)
 : m_nValue(nValue)
-, m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
 {
 }
 
 RTFValue::RTFValue(OUString sValue, bool bForce)
 : m_sValue(std::move(sValue))
-, m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
 , m_bForceString(bForce)
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
 {
 }
 
 RTFValue::RTFValue(const RTFSprms& rAttributes)
 : m_pAttributes(new RTFSprms(rAttributes))
-, m_pSprms(new RTFSprms())
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
 {
 }
 
 RTFValue::RTFValue(const RTFSprms& rAttributes, const RTFSprms& rSprms)
 : m_pAttributes(new RTFSprms(rAttributes))
 , m_pSprms(new RTFSprms(rSprms))
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
 {
 }
 
 RTFValue::RTFValue(uno::Reference xShape)
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_xShape(std::move(xShape))
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
+: m_xShape(std::move(xShape))
 {
 }
 
 RTFValue::RTFValue(uno::Reference xStream)
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_xStream(std::move(xStream))
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
+: m_xStream(std::move(xStream))
 {
 }
 
 RTFValue::RTFValue(uno::Reference xObject)
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_xObject(std::move(xObject))
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture)
+: m_xObject(std::move(xObject))
 {
 }
 
 RTFValue::RTFValue(const RTFShape& aShape)
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_pShape(new RTFShape(aShape))
-, m_pPicture(new RTFPicture)
+: m_pShape(new RTFShape(aShape))
 {
 }
 
 RTFValue::RTFValue(const RTFPicture& rPicture)
-: m_pAttributes(new RTFSprms())
-, m_pSprms(new RTFSprms())
-, m_pShape(new RTFShape())
-, m_pPicture(new RTFPicture(rPicture))
+: m_pPicture(new RTFPicture(rPicture))
 {
 }
 
@@ -148,13 +115,23 @@ uno::Any RTFValue::getAny() const
 return ret;
 }
 
-RTFShape& RTFValue::getShape() const { return *m_pShape; }
+RTFShape& RTFValue::getShape() const
+{
+if (!m_pShape)
+m_pShape = new RTFShape();
+return *m_pShape;
+}
 
-RTFPicture& RTFValue::getPicture() const { return *m_pPicture; }
+RTFPicture& 

[Libreoffice-commits] core.git: writerfilter/source

2022-04-21 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit e4243a140345a4bcd800217115b42667e277c6a3
Author: Justin Luth 
AuthorDate: Thu Apr 21 14:49:33 2022 +0200
Commit: Justin Luth 
CommitDate: Fri Apr 22 05:55:38 2022 +0200

cleanup writerfilter lcl_ParseFormat

If there is no \@, then we will never match what
util::findQuotedText is looking for, so don't bother.

Change-Id: I0a6709046673d98d00d74e921d7f502c9df54b46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133265
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2ce7081d286d..2aff26ad5ad4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4219,18 +4219,17 @@ style::NumberingType::
 static OUString lcl_ParseFormat( const OUString& rCommand )
 {
 //  The command looks like: " DATE \@"dd  " or "09/02/2014"
-//  Remove whitespace permitted by standard between \@ and "
 OUString command;
 sal_Int32 delimPos = rCommand.indexOf("\\@");
 if (delimPos != -1)
 {
+// Remove whitespace permitted by standard between \@ and "
 sal_Int32 wsChars = rCommand.indexOf('\"') - delimPos - 2;
 command = rCommand.replaceAt(delimPos+2, wsChars, u"");
+return OUString(msfilter::util::findQuotedText(command, "\\@\"", 
'\"'));
 }
-else
-command = rCommand;
 
-return OUString(msfilter::util::findQuotedText(command, "\\@\"", '\"'));
+return OUString();
 }
 /*-
 extract a parameter (with or without quotes) between the command and the 
following backslash


[Libreoffice-commits] core.git: writerfilter/source

2022-03-28 Thread Julien Nabet (via logerrit)
 writerfilter/source/rtftok/rtftokenizer.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit c168f15a74fbd6231e1bbbe93939d8e26937b517
Author: Julien Nabet 
AuthorDate: Sun Mar 27 21:37:49 2022 +0200
Commit: Julien Nabet 
CommitDate: Mon Mar 28 17:58:56 2022 +0200

Micro-optim of RTFTokenizer::resolveKeyword

Change-Id: I320df7087e5b9594e7d08a892468ad2cc9a00426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132152
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx 
b/writerfilter/source/rtftok/rtftokenizer.cxx
index 6e9580ed51e2..4dc80416c64f 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -183,10 +183,6 @@ void RTFTokenizer::popGroup() { m_nGroup--; }
 RTFError RTFTokenizer::resolveKeyword()
 {
 char ch;
-OStringBuffer aBuf(32);
-bool bNeg = false;
-bool bParam = false;
-int nParam = 0;
 
 Strm().ReadChar(ch);
 if (Strm().eof())
@@ -194,12 +190,11 @@ RTFError RTFTokenizer::resolveKeyword()
 
 if (!rtl::isAsciiAlpha(static_cast(ch)))
 {
-aBuf.append(ch);
-OString aKeyword = aBuf.makeStringAndClear();
 // control symbols aren't followed by a space, so we can return here
 // without doing any SeekRel()
-return dispatchKeyword(aKeyword, bParam, nParam);
+return dispatchKeyword(OString(ch), false, 0);
 }
+OStringBuffer aBuf(32);
 while (rtl::isAsciiAlpha(static_cast(ch)))
 {
 aBuf.append(ch);
@@ -215,6 +210,7 @@ RTFError RTFTokenizer::resolveKeyword()
 }
 }
 
+bool bNeg = false;
 if (ch == '-')
 {
 // in case we'll have a parameter, that will be negative
@@ -223,6 +219,8 @@ RTFError RTFTokenizer::resolveKeyword()
 if (Strm().eof())
 return RTFError::UNEXPECTED_EOF;
 }
+bool bParam = false;
+int nParam = 0;
 if (rtl::isAsciiDigit(static_cast(ch)))
 {
 OStringBuffer aParameter;


[Libreoffice-commits] core.git: writerfilter/source

2022-02-14 Thread Andrea Gelmini (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 69e964c77e689e493f12c265b87adb89ae66fbd6
Author: Andrea Gelmini 
AuthorDate: Mon Feb 14 10:01:51 2022 +0100
Commit: Julien Nabet 
CommitDate: Mon Feb 14 22:21:58 2022 +0100

Fix typo

Change-Id: Ib78a5987b5fa9c7117583e24e6945b1e2c724690
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129901
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4ffa55a89d9d..4460b9caa13b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -186,7 +186,7 @@ static void lcl_handleTextField( const uno::Reference< 
beans::XPropertySet >& rx
 /**
  Very similar to DomainMapper_Impl::GetPropertyFromStyleSheet
  It is focused on paragraph properties search in current & parent stylesheet 
entries.
- But it will not take into account propeties with listid: these are "list 
paragraph styles" and
+ But it will not take into account properties with listid: these are "list 
paragraph styles" and
  not used in some cases.
 */
 static uno::Any lcl_GetPropertyFromParaStyleSheetNoNum(PropertyIds eId, 
StyleSheetEntryPtr pEntry, const StyleSheetTablePtr& rStyleSheet)


[Libreoffice-commits] core.git: writerfilter/source

2022-02-09 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit d794c377e503aa7d00dbc6daad0aa32efad9e682
Author: Michael Stahl 
AuthorDate: Tue Feb 8 19:27:14 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Feb 9 14:11:30 2022 +0100

(related: tdf#147206) writerfilter: fix another end in...

...DomainMapper_Impl::PopFieldContext() that probably should use the
m_aTextAppendStack insert position.

Change-Id: I718d4b745258ca88e8ffec0bff5e5ea95037a312
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129686
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e9f53d461deb..f1efe6614047 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7033,13 +7033,23 @@ void DomainMapper_Impl::PopFieldContext()
 // End of index is the first item on a new 
paragraph - this paragraph
 // should not be part of index
 auto xCursor
-= 
xTextAppend->createTextCursorByRange(xTextAppend->getEnd());
-xCursor->gotoEnd(false);
+= xTextAppend->createTextCursorByRange(
+
m_aTextAppendStack.top().xInsertPosition.is()
+? m_aTextAppendStack.top().xInsertPosition
+: xTextAppend->getEnd());
 xCursor->goLeft(1, true);
 // delete
 xCursor->setString(OUString());
 // But a new paragraph should be started after the 
index instead
-
xTextAppend->finishParagraph(css::beans::PropertyValues());
+if (m_bIsNewDoc) // this check - see testTdf129402
+{   // where finishParagraph inserts between 2 
EndNode
+
xTextAppend->finishParagraph(css::beans::PropertyValues());
+}
+else
+{
+
xTextAppend->finishParagraphInsert(css::beans::PropertyValues(),
+m_aTextAppendStack.top().xInsertPosition);
+}
 }
 m_bStartedTOC = false;
 m_aTextAppendStack.pop();


[Libreoffice-commits] core.git: writerfilter/source

2022-01-26 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/PropertyMap.cxx |   13 +
 writerfilter/source/dmapper/PropertyMap.hxx |3 ++-
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 94ef342679629c76eff2686243b423e926bbf680
Author: Michael Stahl 
AuthorDate: Wed Jan 19 19:35:15 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 26 18:48:48 2022 +0100

tdf#139737 sw_fieldmarkhide: writerfilter: don't copy header/footer

... when inserting into an existing document.

The header/footer will not be removed by SwUndoInserts::UndoImpl() and
thus the extra nodes will screw up subsequent Undo actions.

Inserting a header from a file is already disabled, but there is a
function that copies from a preceding page style that was missing a
check.

This never worked and reportedly crashes since commit
4dc1615c80e8e66d339dc86fa95bbc76e884d988

Change-Id: I895d867ee9fd30a936144492f3ee1633d045fe8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128635
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 58871cc04538..dabdff851a9c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -882,13 +882,18 @@ void SectionPropertyMap::CopyHeaderFooterTextProperty( 
const uno::Reference< bea
 }
 
 // Copy headers and footers from the previous page style.
-void SectionPropertyMap::CopyHeaderFooter( const uno::Reference< 
beans::XPropertySet >& xPrevStyle,
+void SectionPropertyMap::CopyHeaderFooter( DomainMapper_Impl& rDM_Impl,
+   const uno::Reference< 
beans::XPropertySet >& xPrevStyle,
const uno::Reference< 
beans::XPropertySet >& xStyle,
bool bOmitRightHeader,
bool bOmitLeftHeader,
bool bOmitRightFooter,
bool bOmitLeftFooter )
 {
+if (!rDM_Impl.IsNewDoc())
+{   // see also DomainMapper_Impl::PushPageHeaderFooter()
+return; // tdf#139737 SwUndoInserts cannot deal with new header/footer
+}
 bool bHasPrevHeader = false;
 bool bHeaderIsShared = true;
 OUString sHeaderIsOn = getPropertyName( PROP_HEADER_IS_ON );
@@ -966,13 +971,13 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 
 if ( bFirstPage )
 {
-CopyHeaderFooter( xPrevStyle, xStyle,
+CopyHeaderFooter(rDM_Impl, xPrevStyle, xStyle,
 !m_bFirstPageHeaderLinkToPrevious, true,
 !m_bFirstPageFooterLinkToPrevious, true );
 }
 else
 {
-CopyHeaderFooter( xPrevStyle, xStyle,
+CopyHeaderFooter(rDM_Impl, xPrevStyle, xStyle,
  !m_bDefaultHeaderLinkToPrevious,
  !(m_bEvenPageHeaderLinkToPrevious && 
bUseEvenPages),
  !m_bDefaultFooterLinkToPrevious,
@@ -1851,7 +1856,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 rDM_Impl.GetPageStyles()->insertByName( evenOddStyleName, 
uno::makeAny( evenOddStyle ) );
 evenOddStyle->setPropertyValue( "HeaderIsOn", uno::makeAny( 
false ) );
 evenOddStyle->setPropertyValue( "FooterIsOn", uno::makeAny( 
false ) );
-CopyHeaderFooter( pageProperties, evenOddStyle );
+CopyHeaderFooter(rDM_Impl, pageProperties, evenOddStyle);
 *pageStyle = evenOddStyleName; // And use it instead of the 
original one (which is set as follow of this one).
 if ( m_nBreakType == 
static_cast(NS_ooxml::LN_Value_ST_SectionMark_evenPage) )
 evenOddStyle->setPropertyValue( getPropertyName( 
PROP_PAGE_STYLE_LAYOUT ), uno::makeAny( style::PageStyleLayout_LEFT ) );
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index 3314ce7451ae..b03ef7bd664c 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -299,7 +299,8 @@ private:
 
 void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
 
-static void CopyHeaderFooter( const css::uno::Reference< 
css::beans::XPropertySet >& xPrevStyle,
+static void CopyHeaderFooter( DomainMapper_Impl& rDM_Impl,
+  const css::uno::Reference< 
css::beans::XPropertySet >& xPrevStyle,
   const css::uno::Reference< 
css::beans::XPropertySet >& xStyle,
   bool bOmitRightHeader = false, bool 
bOmitLeftHeader = false,
   bool bOmitRightFooter = false, bool 

[Libreoffice-commits] core.git: writerfilter/source

2022-01-25 Thread Tor Lillqvist (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 +
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 3 files changed, 8 insertions(+)

New commits:
commit 9aa90da7e03b4b0806b27451665b7c41b8836bc0
Author: Tor Lillqvist 
AuthorDate: Mon Jan 24 16:48:04 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Jan 25 09:22:18 2022 +0100

Take layoutInCell into consideration when placing graphic in table

Set our IsFollowingTextFlow property accordingly.

Thanks to Miklos for doing most of the work.

Change-Id: I67d214d6ed41c19dcb2f3ad2db9be94ca77c5842
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128880
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 57ffccbac8f6..f0902918e0ff 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7457,6 +7457,7 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 {
 uno::Reference xEmbeddedProps(m_xEmbedded, 
uno::UNO_QUERY);
 xEmbeddedProps->setPropertyValue("AnchorType", 
uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+xEmbeddedProps->setPropertyValue("IsFollowingTextFlow", 
uno::makeAny(m_pGraphicImport->GetLayoutInCell()));
 uno::Reference xShapeProps(xShape, 
uno::UNO_QUERY);
 xEmbeddedProps->setPropertyValue("HoriOrient", 
xShapeProps->getPropertyValue("HoriOrient"));
 xEmbeddedProps->setPropertyValue("HoriOrientPosition", 
xShapeProps->getPropertyValue("HoriOrientPosition"));
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index bb3b2077e4aa..4fe5712b591f 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -474,6 +474,11 @@ com::sun::star::awt::Point 
GraphicImport::GetGraphicObjectPosition() const
 return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
 }
 
+bool GraphicImport::GetLayoutInCell() const
+{
+return m_pImpl->bLayoutInCell;
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index 57c3dbef906a..93be2df3f601 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -100,6 +100,8 @@ public:
 
 com::sun::star::awt::Point GetGraphicObjectPosition() const;
 
+bool GetLayoutInCell() const;
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;


[Libreoffice-commits] core.git: writerfilter/source

2021-12-29 Thread Vasily Melenchuk (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 923665ac525e8dad218724327fdbd98d4fb790ad
Author: Vasily Melenchuk 
AuthorDate: Wed Dec 29 12:59:21 2021 +0300
Commit: Vasily Melenchuk 
CommitDate: Wed Dec 29 12:36:30 2021 +0100

crashtesting: set document reference only once

For SdtHelper we need to keep valid reference to main document
(in our case first call), not to any of substreams like header,
footer, etc.

Change-Id: Id9d99c1a9bff9a3392eea4cc6e2abe774e5868d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127672
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index b4633cf8beeb..ee6813f9d293 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -634,7 +634,7 @@ public:
 utl::MediaDescriptor const & rMediaDesc);
 ~DomainMapper_Impl();
 
-void setDocumentReference(void* pDocument) { m_pOOXMLDocument = pDocument; 
};
+void setDocumentReference(void* pDocument) { if (!m_pOOXMLDocument) 
m_pOOXMLDocument = pDocument; };
 writerfilter::ooxml::OOXMLDocument* getDocumentReference() const;
 
 SectionPropertyMap* GetLastSectionContext( )


[Libreoffice-commits] core.git: writerfilter/source

2021-12-16 Thread Miklos Vajna (via logerrit)
 writerfilter/source/rtftok/rtfdispatchflag.cxx |   30 -
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit c40df02caa6b5473f80bd8c2ed14763dac2076cd
Author: Miklos Vajna 
AuthorDate: Wed Dec 15 20:16:05 2021 +0100
Commit: Miklos Vajna 
CommitDate: Thu Dec 16 09:07:57 2021 +0100

writerfilter: some param -> sprm in rtftok

The structure for these properties is to have a list like "paragraph
properties", which then has keys (e.g. NS_ooxml::LN_CT_PrBase_pBdr for
border), which may have sub-keys (e.g. NS_ooxml::LN_CT_PBdr_top), and
finally some value.

Stop calling sub-keys "parameters"; the real parameter will be some
writerfilter::Value subclass.

This is just meant to make the code more readable, no functional changes
intended.

Change-Id: Ie63b3216cafa6fcd0ad1ee8cf990cd7982ab7fb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126894
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 2acb4d59f977..6df2b588a016 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -624,22 +624,22 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 switch (nKeyword)
 {
 case RTFKeyword::CLBRDRT:
-nParam = NS_ooxml::LN_CT_TcBorders_top;
+nSprm = NS_ooxml::LN_CT_TcBorders_top;
 break;
 case RTFKeyword::CLBRDRL:
-nParam = NS_ooxml::LN_CT_TcBorders_left;
+nSprm = NS_ooxml::LN_CT_TcBorders_left;
 break;
 case RTFKeyword::CLBRDRB:
-nParam = NS_ooxml::LN_CT_TcBorders_bottom;
+nSprm = NS_ooxml::LN_CT_TcBorders_bottom;
 break;
 case RTFKeyword::CLBRDRR:
-nParam = NS_ooxml::LN_CT_TcBorders_right;
+nSprm = NS_ooxml::LN_CT_TcBorders_right;
 break;
 default:
 break;
 }
 putNestedSprm(m_aStates.top().getTableCellSprms(), 
NS_ooxml::LN_CT_TcPrBase_tcBorders,
-  nParam, pValue);
+  nSprm, pValue);
 m_aStates.top().setBorderState(RTFBorderState::CELL);
 }
 break;
@@ -654,22 +654,22 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 switch (nKeyword)
 {
 case RTFKeyword::PGBRDRT:
-nParam = NS_ooxml::LN_CT_PageBorders_top;
+nSprm = NS_ooxml::LN_CT_PageBorders_top;
 break;
 case RTFKeyword::PGBRDRL:
-nParam = NS_ooxml::LN_CT_PageBorders_left;
+nSprm = NS_ooxml::LN_CT_PageBorders_left;
 break;
 case RTFKeyword::PGBRDRB:
-nParam = NS_ooxml::LN_CT_PageBorders_bottom;
+nSprm = NS_ooxml::LN_CT_PageBorders_bottom;
 break;
 case RTFKeyword::PGBRDRR:
-nParam = NS_ooxml::LN_CT_PageBorders_right;
+nSprm = NS_ooxml::LN_CT_PageBorders_right;
 break;
 default:
 break;
 }
 putNestedSprm(m_aStates.top().getSectionSprms(),
-  NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, 
pValue);
+  NS_ooxml::LN_EG_SectPrContents_pgBorders, nSprm, 
pValue);
 m_aStates.top().setBorderState(RTFBorderState::PAGE);
 }
 break;
@@ -684,21 +684,21 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 switch (nKeyword)
 {
 case RTFKeyword::BRDRT:
-nParam = getParagraphBorder(0);
+nSprm = getParagraphBorder(0);
 break;
 case RTFKeyword::BRDRL:
-nParam = getParagraphBorder(1);
+nSprm = getParagraphBorder(1);
 break;
 case RTFKeyword::BRDRB:
-nParam = getParagraphBorder(2);
+nSprm = getParagraphBorder(2);
 break;
 case RTFKeyword::BRDRR:
-nParam = getParagraphBorder(3);
+nSprm = getParagraphBorder(3);
 break;
 default:
 break;
 }
-putNestedSprm(m_aStates.top().getParagraphSprms(), 
NS_ooxml::LN_CT_PrBase_pBdr, nParam,
+putNestedSprm(m_aStates.top().getParagraphSprms(), 
NS_ooxml::LN_CT_PrBase_pBdr, nSprm,
   pValue);

[Libreoffice-commits] core.git: writerfilter/source

2021-12-01 Thread Vasily Melenchuk (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |   91 +--
 writerfilter/source/dmapper/SdtHelper.cxx|   13 +--
 writerfilter/source/dmapper/SdtHelper.hxx|   18 +++--
 3 files changed, 63 insertions(+), 59 deletions(-)

New commits:
commit fe1da0ce2e097e5b8db6be9c141f2615b45ea8e7
Author: Vasily Melenchuk 
AuthorDate: Thu Nov 18 15:04:00 2021 +0300
Commit: Vasily Melenchuk 
CommitDate: Wed Dec 1 13:33:15 2021 +0100

writerfilter: extend SdtHelper for better support control types

There is much more different controls which must be supprorted
in future. So approach with isInsideDropDownControl() and
validateDateFormat() is not sufficient. Use enum to determine
and store control type.

Change-Id: Ibea7fde117c059053195be213a3ae821644f277c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125471
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 0383abb708aa..ea16e51e0f9f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1078,10 +1078,17 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 else
 m_pImpl->setSdtEndDeferred(true);
 
-if (m_pImpl->m_pSdtHelper->isInsideDropDownControl())
-m_pImpl->m_pSdtHelper->createDropDownControl();
-else if (m_pImpl->m_pSdtHelper->validateDateFormat())
-m_pImpl->m_pSdtHelper->createDateContentControl();
+switch (m_pImpl->m_pSdtHelper->getControlType())
+{
+case SdtControlType::dropDown:
+m_pImpl->m_pSdtHelper->createDropDownControl();
+break;
+case SdtControlType::datePicker:
+m_pImpl->m_pSdtHelper->createDateContentControl();
+break;
+case SdtControlType::unknown:
+default:;
+}
 break;
 case NS_ooxml::LN_CT_SdtListItem_displayText:
 // TODO handle when this is != value
@@ -2638,7 +2645,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 case NS_ooxml::LN_CT_SdtPr_dropDownList:
 case NS_ooxml::LN_CT_SdtPr_comboBox:
 {
-m_pImpl->m_pSdtHelper->setInsideDropDownControl(true);
+m_pImpl->m_pSdtHelper->setControlType(SdtControlType::dropDown);
 writerfilter::Reference::Pointer_t pProperties = 
rSprm.getProps();
 if (pProperties)
 pProperties->resolve(*this);
@@ -2661,6 +2668,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 break;
 case NS_ooxml::LN_CT_SdtPr_date:
 {
+m_pImpl->m_pSdtHelper->setControlType(SdtControlType::datePicker);
 resolveSprmProps(*this, rSprm);
 
m_pImpl->m_pSdtHelper->setDateFieldStartRange(GetCurrentTextRange()->getEnd());
 }
@@ -3518,7 +3526,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 }
 
 bool bNewLine = len == 1 && (sText[0] == 0x0d || sText[0] == 0x07);
-if (m_pImpl->m_pSdtHelper->isInsideDropDownControl())
+if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::dropDown)
 {
 if (bNewLine)
 // Dropdown control has single-line texts, so in case of newline, 
create the control.
@@ -3529,43 +3537,47 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 return;
 }
 }
+else if (m_pImpl->m_pSdtHelper->getControlType() == 
SdtControlType::datePicker)
+{
+if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
+{
+m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
+}
+else if (IsInHeaderFooter() && m_pImpl->IsDiscardHeaderFooter())
+{
+m_pImpl->m_pSdtHelper->getDateFormat().truncate();
+m_pImpl->m_pSdtHelper->getLocale().truncate();
+return;
+}
+}
 else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
 {
- // Ignore grabbag when we have a date field, it can conflict during 
export
-if(m_pImpl->m_pSdtHelper->validateDateFormat())
+// there are unsupported SDT properties in the document
+// save them in the paragraph interop grab bag
+if (m_pImpl->IsDiscardHeaderFooter())
 {
+// Unless we're supposed to ignore this header/footer.
 m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
+return;
 }
-else
+
if((m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_checkbox") 
||
+
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") ||
+
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") 
||
+

[Libreoffice-commits] core.git: writerfilter/source

2021-11-06 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/PropertyMap.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 0ce586e1e50deeaf2ba210acc4fea08058f8b15c
Author: Justin Luth 
AuthorDate: Thu Nov 4 13:28:39 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 6 08:45:08 2021 +0100

related tdf#136472 writerfilter: only copy even pages if used

Allowing the use of Even pages is a document-level setting.
So if the document does not allow the use of an even page,
although we will read it in once (in order to preserve the contents)
there is no point in copying it to every inheriting page style
(especially if it contains large items like images).

Change-Id: I22ccb16e29c5335e50010f8a334494aaa1d45785
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124437
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 393d49839cc9..dc833c363571 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -957,6 +957,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
 if ( pLastContext )
 {
+const bool bUseEvenPages = 
rDM_Impl.GetSettingsTable()->GetEvenAndOddHeaders();
 uno::Reference< beans::XPropertySet > xPrevStyle = 
pLastContext->GetPageStyle( rDM_Impl,
 bFirstPage );
 uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( rDM_Impl,
@@ -971,10 +972,10 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 else
 {
 CopyHeaderFooter( xPrevStyle, xStyle,
-!m_bDefaultHeaderLinkToPrevious,
-!m_bEvenPageHeaderLinkToPrevious,
-!m_bDefaultFooterLinkToPrevious,
-!m_bEvenPageFooterLinkToPrevious );
+ !m_bDefaultHeaderLinkToPrevious,
+ !(m_bEvenPageHeaderLinkToPrevious && 
bUseEvenPages),
+ !m_bDefaultFooterLinkToPrevious,
+ !(m_bEvenPageFooterLinkToPrevious && 
bUseEvenPages));
 }
 }
 SAL_INFO( "writerfilter", "END>>> 
SectionPropertyMap::CopyLastHeaderFooter()" );


[Libreoffice-commits] core.git: writerfilter/source

2021-11-05 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit a2d322c02af05db1b785633ea398fe0b62b67605
Author: Justin Luth 
AuthorDate: Sat Oct 23 13:25:41 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 6 05:06:00 2021 +0100

NFC writerfilter: m_bDiscardHeaderFooter = false in both cases

Change-Id: Ie16100c10fce6366659be17261a97795d372ff11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124754
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e338664d6068..8887a79d65a2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2910,7 +2910,6 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 ? uno::Reference()
 : xText->createTextCursorByRange(xText->getStart())),
 bHeader));
-m_bDiscardHeaderFooter = false; // set only on success!
 }
 // If we have *hidden* header footer
 else
@@ -2931,11 +2930,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 TextAppendContext(uno::Reference(xText, 
uno::UNO_QUERY_THROW),
   m_bIsNewDoc ? 
uno::Reference()
   : 
xText->createTextCursorByRange(xText->getStart(;
-m_bDiscardHeaderFooter = false; // set only on success!
 // Restore the original state of the shared prop after we stored 
the necessary values.
 xPageStyle->setPropertyValue(getPropertyName(ePropShared), 
uno::makeAny(bIsShared));
 }
-
+m_bDiscardHeaderFooter = false; // set only on success!
 }
 catch( const uno::Exception& )
 {


[Libreoffice-commits] core.git: writerfilter/source

2021-11-05 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 74723bbe6b860e54c26711c108f1e2d2388e8feb
Author: Justin Luth 
AuthorDate: Sat Oct 23 13:02:24 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Nov 5 17:22:59 2021 +0100

NFC writerfilter: simplify logic

if (!A && !B || B) is the same as
if (!A || B)

and the ELSE is also by definition A && !B now.

Change-Id: Ie797976423bb910386a26e96692c43faf0344132
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124753
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index dcec98ed59e0..e338664d6068 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2885,7 +2885,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 {
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
 bool bFirst = eType == SectionPropertyMap::PAGE_FIRST;
-if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || 
(GetSettingsTable()->GetEvenAndOddHeaders()))
+if (!bLeft || GetSettingsTable()->GetEvenAndOddHeaders())
 {
 //switch on header/footer use
 xPageStyle->setPropertyValue(
@@ -2913,7 +2913,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 m_bDiscardHeaderFooter = false; // set only on success!
 }
 // If we have *hidden* header footer
-else if (bLeft && !GetSettingsTable()->GetEvenAndOddHeaders())
+else
 {
 bool bIsShared = false;
 // Turn on the headers


[Libreoffice-commits] core.git: writerfilter/source

2021-11-05 Thread Caolán McNamara (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 848eb0ddecd4ef4c8da06624a5479efd3d73cf64
Author: Caolán McNamara 
AuthorDate: Fri Nov 5 09:42:05 2021 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 5 13:58:02 2021 +0100

crashtesting: downgrade assert on bookmark missing from input docx to a 
warning

The docx bugdoc is "generated by ComMA version 3.3.0" and has a pair of
bookmarkEnd/bookmarkStart in a non-conformant order, like so...


...


both bookmarkStart and bookmarkEnd are mapped to the same
DomainMapper_Impl::StartOrEndBookmark
(without a distinction made between begin/end) which assumes the first
time it's called for an id that it's a bookmark start, and the second
time for an id that it's a bookmark end and that there will have been a
w:name seen between the 1st and 2nd calls to be used as the name for the
bookmark to use at the 2nd call.

That there is no bookmark name is a problem in the input docx rather
than the import logic so turn this assert into a warning

$ wget https://bugs.documentfoundation.org/attachment.cgi?id=157489 -O 
tdf130241-1.docx
$ ./instdir/program/soffice --headless --convert-to pdf ./tdf130241-1.docx

https: 
//dev-builds.libreoffice.org/crashtest/b6ef68cdaa51ca5c9fdab40ade97f4a0f18da51b/backtraces/task815-core.backtrace.txt
Change-Id: Id389d186ea825f515c2638a76c9bba00666e0686
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124734
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 9bc82dfb6c92..dcec98ed59e0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7099,7 +7099,7 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
 xCursor->goLeft( 1, false );
 }
 uno::Reference< container::XNamed > xBkmNamed( xBookmark, 
uno::UNO_QUERY_THROW );
-assert(!aBookmarkIter->second.m_sBookmarkName.isEmpty());
+SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), 
"writerfilter.dmapper", "anonymous bookmark");
 //todo: make sure the name is not used already!
 xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
 xTextAppend->insertTextContent( uno::Reference< 
text::XTextRange >( xCursor, uno::UNO_QUERY_THROW), xBookmark, 
!xCursor->isCollapsed() );


[Libreoffice-commits] core.git: writerfilter/source

2021-10-31 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   48 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   39 ++--
 writerfilter/source/dmapper/GraphicImport.cxx|7 --
 writerfilter/source/dmapper/NumberingManager.cxx |   17 +++--
 writerfilter/source/dmapper/SettingsTable.cxx|   25 ---
 writerfilter/source/dmapper/StyleSheetTable.cxx  |8 +-
 writerfilter/source/dmapper/WrapPolygonHandler.cxx   |5 -
 writerfilter/source/dmapper/WriteProtection.cxx  |   15 +---
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx  |9 --
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|6 -
 writerfilter/source/ooxml/factoryimpl.py |3 
 writerfilter/source/rtftok/rtfsdrimport.cxx  |5 -
 12 files changed, 83 insertions(+), 104 deletions(-)

New commits:
commit 2b9bd1031cc4f627f83b62288a57b27e6cb9bc3e
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:26:30 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 06:22:35 2021 +0100

Prepare for removal of non-const operator[] from Sequence in writerfilter

Change-Id: I4002bc1ca227726bf1c36ecdb657175a42c2d9be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 5278206552f8..916ff5b5828d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -363,37 +363,18 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 {
 TablePositionHandler *pTablePositions = 
m_rDMapper_Impl.getTableManager().getCurrentTableRealPosition();
 
-uno::Sequence< beans::PropertyValue  > aGrabBagTS( 10 );
-
-aGrabBagTS[0].Name = "bottomFromText";
-aGrabBagTS[0].Value <<= pTablePositions->getBottomFromText();
-
-aGrabBagTS[1].Name = "horzAnchor";
-aGrabBagTS[1].Value <<= pTablePositions->getHorzAnchor();
-
-aGrabBagTS[2].Name = "leftFromText";
-aGrabBagTS[2].Value <<= pTablePositions->getLeftFromText();
-
-aGrabBagTS[3].Name = "rightFromText";
-aGrabBagTS[3].Value <<= pTablePositions->getRightFromText();
-
-aGrabBagTS[4].Name = "tblpX";
-aGrabBagTS[4].Value <<= pTablePositions->getX();
-
-aGrabBagTS[5].Name = "tblpXSpec";
-aGrabBagTS[5].Value <<= pTablePositions->getXSpec();
-
-aGrabBagTS[6].Name = "tblpY";
-aGrabBagTS[6].Value <<= pTablePositions->getY();
-
-aGrabBagTS[7].Name = "tblpYSpec";
-aGrabBagTS[7].Value <<= pTablePositions->getYSpec();
-
-aGrabBagTS[8].Name = "topFromText";
-aGrabBagTS[8].Value <<= pTablePositions->getTopFromText();
-
-aGrabBagTS[9].Name = "vertAnchor";
-aGrabBagTS[9].Value <<= pTablePositions->getVertAnchor();
+uno::Sequence< beans::PropertyValue  > aGrabBagTS{
+comphelper::makePropertyValue("bottomFromText", 
pTablePositions->getBottomFromText()),
+comphelper::makePropertyValue("horzAnchor", 
pTablePositions->getHorzAnchor()),
+comphelper::makePropertyValue("leftFromText", 
pTablePositions->getLeftFromText()),
+comphelper::makePropertyValue("rightFromText", 
pTablePositions->getRightFromText()),
+comphelper::makePropertyValue("tblpX", 
pTablePositions->getX()),
+comphelper::makePropertyValue("tblpXSpec", 
pTablePositions->getXSpec()),
+comphelper::makePropertyValue("tblpY", 
pTablePositions->getY()),
+comphelper::makePropertyValue("tblpYSpec", 
pTablePositions->getYSpec()),
+comphelper::makePropertyValue("topFromText", 
pTablePositions->getTopFromText()),
+comphelper::makePropertyValue("vertAnchor", 
pTablePositions->getVertAnchor())
+};
 
 aGrabBag["TablePosition"] <<= aGrabBagTS;
 }
@@ -1066,6 +1047,7 @@ css::uno::Sequence 
DomainMapperTableHandler::endTabl
 #endif
 
 css::uno::Sequence aRowProperties( 
m_aRowProperties.size() );
+auto aRowPropertiesRange = asNonConstRange(aRowProperties);
 sal_Int32 nRow = 0;
 for( const auto& rRow : m_aRowProperties )
 {
@@ -1086,7 +1068,7 @@ css::uno::Sequence 
DomainMapperTableHandler::endTabl
 rRow->Insert(PROP_SIZE_TYPE, 
uno::makeAny(text::SizeType::FIX));
 }
 
-aRowProperties[nRow] = rRow->GetPropertyValues();
+aRowPropertiesRange[nRow] = rRow->GetPropertyValues();
 #ifdef DBG_UTIL
 rRow->dumpXml();
 lcl_DumpPropertyValues(aRowProperties[nRow]);
@@ -1477,7 +1459,7 @@ void 

[Libreoffice-commits] core.git: writerfilter/source

2021-10-19 Thread Miklos Vajna (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 05f1990cbdcd99f7ba4863b91a8f1f298b56326a
Author: Miklos Vajna 
AuthorDate: Fri Oct 15 08:40:22 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 19 13:00:53 2021 +0200

writerfilter: give up if body text is missing

Crashreport trace:


writerfilter::dmapper::DomainMapper_Impl::DomainMapper_Impl(writerfilter::dmapper::DomainMapper&,
 com::sun::star::uno::Reference const&, 
com::sun::star::uno::Reference const&, 
writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor const&)
writerfilter/source/dmapper/DomainMapper_Impl.cxx:359 
(discriminator 2)

writerfilter::dmapper::DomainMapper::DomainMapper(com::sun::star::uno::Reference
 const&, com::sun::star::uno::Reference 
const&, com::sun::star::uno::Reference 
const&, bool, writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor 
const&)
writerfilter/source/dmapper/DomainMapper.cxx:113

writerfilter::dmapper::DomainMapperFactory::createMapper(com::sun::star::uno::Reference
 const&, com::sun::star::uno::Reference 
const&, com::sun::star::uno::Reference 
const&, bool, writerfilter::dmapper::SourceDocumentType, utl::MediaDescriptor 
const&)
writerfilter/source/dmapper/domainmapperfactory.cxx:34
ollaboraoffice6.4/program/../program/libwriterfilterlo.so

RtfFilter::filter(com::sun::star::uno::Sequence
 const&)
writerfilter/source/filter/RtfFilter.cxx:152

I.e. we end up in a situation where the insert position does not have a
containing XText. It's hard to continue from that point and this is in
the ctor of the dmapper, so we didn't start the import. Just throw an
exception to avoid further crashes.

Change-Id: Idb5c06186a82c00b838d0b3330260340eb4218b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123795
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0dcaa197962b..3be1aa56024c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -361,6 +361,11 @@ DomainMapper_Impl::DomainMapper_Impl(
 
 appendTableManager( );
 GetBodyText();
+if (!m_bIsNewDoc && !m_xBodyText)
+{
+throw uno::Exception("failed to find body text of the insert 
position", nullptr);
+}
+
 uno::Reference< text::XTextAppend > xBodyTextAppend( m_xBodyText, 
uno::UNO_QUERY );
 m_aTextAppendStack.push(TextAppendContext(xBodyTextAppend,
 m_bIsNewDoc ? uno::Reference() : 
m_xBodyText->createTextCursorByRange(m_xInsertTextRange)));


[Libreoffice-commits] core.git: writerfilter/source

2021-10-10 Thread Julien Nabet (via logerrit)
 writerfilter/source/ooxml/model.xml |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 633e8c98cbcf8f41b8f8394a5e1f396bf6f7138f
Author: Julien Nabet 
AuthorDate: Sat Oct 9 18:30:03 2021 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 10 08:17:17 2021 +0200

Typo: CT_SytemColor_lastClr->CT_SystemColor_lastClr

Change-Id: I10ebe939562097d3fc098a42c09b1e0f6e5cbd6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123315
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index da6d56473d41..b5d3412cd61a 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -3557,7 +3557,7 @@
 
 
   
-  
+  
 
 
   bg1


[Libreoffice-commits] core.git: writerfilter/source

2021-09-09 Thread Noel Grandin (via logerrit)
 writerfilter/source/dmapper/PropertyMap.cxx |  197 ++--
 1 file changed, 99 insertions(+), 98 deletions(-)

New commits:
commit ca6e29e9fb8999fdecca5b50570be1665071a2c7
Author: Noel Grandin 
AuthorDate: Thu Sep 9 15:59:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 9 18:56:43 2021 +0200

reserve space in vector to reduce reallocations

Change-Id: I6263c0b742331138188f7b557c05b2a59188d4fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121853
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index b4c58c0d8808..3fdecb9ed576 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -72,122 +72,123 @@ uno::Sequence< beans::PropertyValue > 
PropertyMap::GetPropertyValues( bool bChar
 {
 using comphelper::makePropertyValue;
 
-if ( m_aValues.empty() && !m_vMap.empty() )
-{
-size_t nCharGrabBag = 0;
-size_t nParaGrabBag = 0;
-size_t nCellGrabBag = 0;
-size_t nRowGrabBag  = 0;
+if ( !m_aValues.empty() || m_vMap.empty() )
+return comphelper::containerToSequence( m_aValues );
+
+size_t nCharGrabBag = 0;
+size_t nParaGrabBag = 0;
+size_t nCellGrabBag = 0;
+size_t nRowGrabBag  = 0;
+
+const PropValue* pParaStyleProp = nullptr;
+const PropValue* pCharStyleProp = nullptr;
+const PropValue* pNumRuleProp   = nullptr;
 
-const PropValue* pParaStyleProp = nullptr;
-const PropValue* pCharStyleProp = nullptr;
-const PropValue* pNumRuleProp   = nullptr;
+m_aValues.reserve( m_vMap.size() );
+for ( const auto& rPropPair : m_vMap )
+{
+if ( rPropPair.second.getGrabBagType() == CHAR_GRAB_BAG )
+nCharGrabBag++;
+else if ( rPropPair.second.getGrabBagType() == PARA_GRAB_BAG )
+nParaGrabBag++;
+else if ( rPropPair.second.getGrabBagType() == CELL_GRAB_BAG )
+nCellGrabBag++;
+else if ( rPropPair.first == PROP_CELL_INTEROP_GRAB_BAG )
+{
+uno::Sequence< beans::PropertyValue > aSeq;
+rPropPair.second.getValue() >>= aSeq;
+nCellGrabBag += aSeq.getLength();
+}
+else if ( rPropPair.second.getGrabBagType() == ROW_GRAB_BAG )
+nRowGrabBag++;
+
+if ( rPropPair.first == PROP_PARA_STYLE_NAME ) pParaStyleProp = 

+if ( rPropPair.first == PROP_CHAR_STYLE_NAME ) pCharStyleProp = 

+if ( rPropPair.first == PROP_NUMBERING_RULES ) pNumRuleProp   = 

+}
+
+// Style names have to be the first elements within the property sequence
+// otherwise they will overwrite 'hard' attributes
+if ( pParaStyleProp != nullptr )
+m_aValues.push_back( makePropertyValue( getPropertyName( 
PROP_PARA_STYLE_NAME ), pParaStyleProp->getValue() ) );
+if ( pCharStyleProp != nullptr )
+m_aValues.push_back( makePropertyValue( getPropertyName( 
PROP_CHAR_STYLE_NAME ), pCharStyleProp->getValue() ) );
+if ( pNumRuleProp != nullptr )
+m_aValues.push_back( makePropertyValue(getPropertyName( 
PROP_NUMBERING_RULES ), pNumRuleProp->getValue() ) );
+
+// If there are any grab bag properties, we need one slot for them.
+uno::Sequence< beans::PropertyValue > aCharGrabBagValues( nCharGrabBag );
+uno::Sequence< beans::PropertyValue > aParaGrabBagValues( nParaGrabBag );
+uno::Sequence< beans::PropertyValue > aCellGrabBagValues( nCellGrabBag );
+uno::Sequence< beans::PropertyValue > aRowGrabBagValues ( nRowGrabBag );
+beans::PropertyValue* pCharGrabBagValues = aCharGrabBagValues.getArray();
+beans::PropertyValue* pParaGrabBagValues = aParaGrabBagValues.getArray();
+beans::PropertyValue* pCellGrabBagValues = aCellGrabBagValues.getArray();
+beans::PropertyValue* pRowGrabBagValues  = aRowGrabBagValues.getArray();
+// Record index for the next property to be added in each grab bag.
+sal_Int32 nRowGrabBagValue  = 0;
+sal_Int32 nCellGrabBagValue = 0;
+sal_Int32 nParaGrabBagValue = 0;
+sal_Int32 nCharGrabBagValue = 0;
 
-for ( const auto& rPropPair : m_vMap )
+for ( const auto& rPropPair : m_vMap )
+{
+if ( rPropPair.first != PROP_PARA_STYLE_NAME &&
+ rPropPair.first != PROP_CHAR_STYLE_NAME &&
+ rPropPair.first != PROP_NUMBERING_RULES )
 {
 if ( rPropPair.second.getGrabBagType() == CHAR_GRAB_BAG )
-nCharGrabBag++;
+{
+if ( bCharGrabBag )
+{
+pCharGrabBagValues[nCharGrabBagValue].Name  = 
getPropertyName( rPropPair.first );
+pCharGrabBagValues[nCharGrabBagValue].Value = 
rPropPair.second.getValue();
+++nCharGrabBagValue;
+}
+}
 else if ( rPropPair.second.getGrabBagType() == 

[Libreoffice-commits] core.git: writerfilter/source writerperfect/source

2021-09-06 Thread Noel Grandin (via logerrit)
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|8 
 writerfilter/source/dmapper/NumberingManager.cxx |2 +-
 writerfilter/source/dmapper/SettingsTable.cxx|1 -
 writerfilter/source/dmapper/StyleSheetTable.cxx  |   12 +++-
 writerfilter/source/dmapper/ThemeTable.cxx   |1 -
 writerfilter/source/ooxml/Handler.cxx|4 ++--
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx  |2 --
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|3 +--
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx   |1 -
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx|4 +---
 writerperfect/source/common/WPXSvInputStream.cxx |   14 +++---
 12 files changed, 11 insertions(+), 45 deletions(-)

New commits:
commit a49242a7e8747a61904525bcf53d129f2f279e62
Author: Noel Grandin 
AuthorDate: Sun Sep 5 15:54:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 6 09:06:18 2021 +0200

clang-tidy:readability-redundant-member-init

Change-Id: Ib41556edafb03c770938c91cff89bfaefa23d7cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121691
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 6689a36091ad..f0b692783a44 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -40,17 +40,13 @@ using namespace ::std;
 
 DomainMapperTableManager::DomainMapperTableManager() :
 m_nRow(0),
-m_nCell(),
 m_nGridSpan(1),
 m_nHeaderRepeat(0),
 m_nTableWidth(0),
 m_bIsInShape(false),
-m_aTmpPosition(),
-m_aTmpTableProperties(),
 m_bPushCurrentWidth(false),
 m_bTableSizeTypeInserted(false),
 m_nLayoutType(0),
-m_aParagraphsToEndTable(),
 m_pTablePropsHandler(new TablePropertiesHandler())
 {
 m_pTablePropsHandler->SetTableManager( this );
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c21c9a282bf5..77c040fb9f3d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -296,10 +296,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bTextInserted(false),
 m_sCurrentPermId(0),
 m_bFrameDirectionSet(false),
-m_pLastSectionContext( ),
-m_pLastCharacterContext(),
-m_sCurrentParaStyleName(),
-m_sDefaultParaStyleName(),
 m_bInDocDefaultsImport(false),
 m_bInStyleSheetImport( false ),
 m_bInNumberingImport(false),
@@ -332,9 +328,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bSdt(false),
 m_bIsFirstRun(false),
 m_bIsOutsideAParagraph(true),
-m_xAnnotationField(),
 m_nAnnotationId( -1 ),
-m_aAnnotationPositions(),
 m_aSmartTagHandler(m_xComponentContext, m_xTextDocument),
 
m_xInsertTextRange(rMediaDesc.getUnpackedValueOrDefault("TextInsertModeRange", 
uno::Reference())),
 
m_xAltChunkStartingRange(rMediaDesc.getUnpackedValueOrDefault("AltChunkStartingRange",
 uno::Reference())),
@@ -350,7 +344,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIgnoreNextTab(false),
 m_bIsSplitPara(false),
 m_bIsActualParagraphFramed( false ),
-m_vTextFramesForChaining(),
 m_bParaHadField(false),
 m_bSaveParaHadField(false),
 m_bParaAutoBefore(false),
@@ -358,7 +351,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bSaveFirstParagraphInCell(false),
 m_bParaWithInlineObject(false),
 m_bSaxError(false)
-
 {
 m_aBaseUrl = rMediaDesc.getUnpackedValueOrDefault(
 utl::MediaDescriptor::PROP_DOCUMENTBASEURL(), OUString());
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 9e2072bc6ee6..f003dba2abe7 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -402,7 +402,7 @@ const OUString& AbstractListDef::MapListId(OUString const& 
rId)
 
 //--  ListDef implementation
 
-ListDef::ListDef( ) : AbstractListDef( )
+ListDef::ListDef( )
 {
 }
 
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 47a2d7269efd..a780635b5997 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -303,7 +303,6 @@ struct SettingsTable_Impl
 , m_bDoNotExpandShiftReturn(false)
 , m_bProtectForm(false)
 , m_bRedlineProtection(false)
-, m_sRedlineProtectionKey()
 , m_bReadOnly(false)
 , m_bDisplayBackgroundShape(false)
 , 

[Libreoffice-commits] core.git: writerfilter/source

2021-09-03 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 1a6530787579fe466a67a98ef1f1a2087715a1b2
Author: Justin Luth 
AuthorDate: Thu Sep 2 09:40:56 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Sep 3 08:30:19 2021 +0200

related tdf#137363: no NUMBERING_LEVEL 9(no-level) in para

Remove the (fake) 9 from the direct paragraph formatting.
Otherwise when numbering is applied it will start at level
10 instead of the proper level (as defined by the style).

Change-Id: I26fdff36e4f3d3449a259918a7c57a76bae7d486
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121503
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 44c9115a51e2..c21c9a282bf5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1600,7 +1600,10 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 // ListLevel 9 means Body Level/no numbering.
 if (bNoNumbering || nListLevel == 9)
+{
 pParaContext->Insert(PROP_NUMBERING_STYLE_NAME, 
uno::makeAny(OUString()), true);
+pParaContext->Erase(PROP_NUMBERING_LEVEL);
+}
 else if ( !isNumberingViaRule )
 {
 isNumberingViaStyle = true;


[Libreoffice-commits] core.git: writerfilter/source

2021-09-02 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit b87c7eb674dfc4ee76fa48af67da6cb13a8d6aa6
Author: Justin Luth 
AuthorDate: Wed Sep 1 14:12:51 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 2 09:08:01 2021 +0200

tdf#137363 DOCX filter: no NUMBERING_LEVEL 9(no-level) in styles

The only real (initial) reason for setting PROP_NUMBERING_LEVEL
in the style was to round-trip it so it didn't get lost.
It does kinda give a nice side benefit in UI, where the style
can now set the listLevel at the same time as turning numbering on
(at least on the second try.)

However, 9 ends up meaning LEVEL 10 in LO UI, instead of NO LEVEL.
So eliminate that value from round-trippability,
since LO has no correlating NO LEVEL value possible for that PROP.

The UI is too broken and inconsistent for any attempt
at a unit test.

Change-Id: Ibd9cea2ec10e85651f9f6643ad1b49ebf9babe12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121448
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 6b940f02e577..913730f79bee 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1316,7 +1316,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 rContext->Insert(PROP_BREAK_TYPE, uno::makeAny(nIntValue ? 
style::BreakType_PAGE_BEFORE : style::BreakType_NONE), 
/*bOverwrite=*/bool(nIntValue));
 break;
 case NS_ooxml::LN_CT_NumPr_ilvl:
-if (nIntValue < 0 || 10 <= nIntValue) // Writer can't do everything
+if (nIntValue < 0 || 10 <= nIntValue)
 {
 SAL_INFO("writerfilter",
 "unsupported numbering level " << nIntValue);
@@ -1329,7 +1329,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if (pStyleSheetPropertyMap)
 pStyleSheetPropertyMap->SetListLevel( 
static_cast(nIntValue) );
 }
-rContext->Insert(PROP_NUMBERING_LEVEL, 
uno::makeAny(static_cast(nIntValue)));
+// 0-8 are the 9 levels that Microsoft supports. (LO supports 10 
levels).
+// 9 indicates "no numbering", for which LO has no corresponding 
concept,
+// and so it will be treated as the 10th level.
+// finishParagraph() will convert the 9 into "no numbering" for 
direct formating.
+// (Styles only use this PROP for round-tripping and UI, but 
cannot trust it for import)
+if (!IsStyleSheetImport() || nIntValue != 9)
+rContext->Insert(PROP_NUMBERING_LEVEL, 
uno::makeAny(static_cast(nIntValue)));
 break;
 case NS_ooxml::LN_CT_NumPr_numId:
 {


  1   2   3   4   5   6   7   8   9   >