core.git: writerfilter/source

2024-04-13 Thread Mike Kaganski (via logerrit)
 writerfilter/source/ooxml/OOXMLPropertySet.cxx |   37 -
 1 file changed, 12 insertions(+), 25 deletions(-)

New commits:
commit fd19637cfd4099a96661a071939576bc7db4946a
Author: Mike Kaganski 
AuthorDate: Sat Apr 13 16:47:37 2024 +0500
Commit: Mike Kaganski 
CommitDate: Sat Apr 13 15:23:36 2024 +0200

Simplify a bit, and use more o3tl::convert

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

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index 2c760519b69f..f29efe875aee 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -601,41 +601,28 @@ 
OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(std::string_view pValue,
 {
 double val = o3tl::toDouble(pValue); // will ignore the trailing unit
 
-int nLen = pValue.size();
-if (nLen > 2 &&
-pValue[nLen-2] == 'p' &&
-pValue[nLen-1] == 't')
+if (pValue.ends_with("pt"))
 {
-mnValue = static_cast(val * npPt);
+val *= npPt;
 }
-else if (nLen > 2 &&
-pValue[nLen - 2] == 'c' &&
-pValue[nLen - 1] == 'm')
+else if (pValue.ends_with("cm"))
 {
-mnValue = static_cast(val * npPt * 72 / 2.54);
+val = o3tl::convert(val, o3tl::Length::cm, o3tl::Length::pt) * npPt;
 }
-else if (nLen > 2 &&
-pValue[nLen - 2] == 'm' &&
-pValue[nLen - 1] == 'm')
+else if (pValue.ends_with("mm"))
 {
-mnValue = static_cast(val * npPt * 72 / 25.4);
+val = o3tl::convert(val, o3tl::Length::mm, o3tl::Length::pt) * npPt;
 }
-else if (nLen > 2 &&
-pValue[nLen - 2] == 'i' &&
-pValue[nLen - 1] == 'n')
+else if (pValue.ends_with("in"))
 {
-mnValue = static_cast(val * npPt * 72);
+val = o3tl::convert(val, o3tl::Length::in, o3tl::Length::pt) * npPt;
 }
-else if (nLen > 2 &&
-pValue[nLen - 2] == 'p' &&
-( pValue[nLen - 1] == 'c' || pValue[nLen - 1] == 'i' ))
+else if (pValue.ends_with("pc") || pValue.ends_with("pi"))
 {
-mnValue = static_cast(val * npPt * 12);
-}
-else
-{
-mnValue = static_cast(val);
+val = o3tl::convert(val, o3tl::Length::pc, o3tl::Length::pt) * npPt;
 }
+
+mnValue = std::round(val);
 }
 
 OOXMLUniversalMeasureValue::~OOXMLUniversalMeasureValue()


core.git: writerfilter/source

2024-03-28 Thread LeSasse (via logerrit)
 writerfilter/source/ooxml/factoryimpl_ns.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b470044cbf116b825ca86c1b054ea7647646
Author: LeSasse 
AuthorDate: Wed Mar 27 08:49:55 2024 +0100
Commit: Noel Grandin 
CommitDate: Thu Mar 28 08:48:35 2024 +0100

tdf#158803 test for membership should be 'not in'

Change-Id: I9ed1a2cb83cfd0be8298e7a90c7b4fb931c33528
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165369
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py 
b/writerfilter/source/ooxml/factoryimpl_ns.py
index 64a220b9a44b..d4d5a2f67dc6 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -157,7 +157,7 @@ def factoryAttributeToResourceMapInner(nsNode, defineNode):
 attributes = collectAttributeToResource(nsNode, defineNode)
 already_used = set()
 for k in attributes[1]:
-if not (k in already_used):
+if k not in already_used:
 ret.append("{ %s, %s }," % (k, attributes[0][k]))
 already_used.add(k)
 
@@ -202,7 +202,7 @@ def idToLabel(idName):
 def appendValueData(values, name, value):
 first = name[0:1]
 
-if not (first in values):
+if first not in values:
 values[first] = []
 
 values[first].append([name, value])


core.git: writerfilter/source

2024-03-21 Thread Oliver Specht (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |3 ---
 writerfilter/source/dmapper/PropertyIds.cxx  |1 -
 writerfilter/source/dmapper/PropertyIds.hxx  |1 -
 3 files changed, 5 deletions(-)

New commits:
commit 44e4ada23dfc8655ec7ddccfd027f02d22684d60
Author: Oliver Specht 
AuthorDate: Wed Mar 20 16:25:17 2024 +0100
Commit: Michael Stahl 
CommitDate: Thu Mar 21 15:41:19 2024 +0100

Revert "tdf#159730 add compatibility option in RTF import"

This reverts commit 3b04e74503ec6d07dc4befdb756e6abdc3de4e58.

Reason for revert: The compatibility option is the wrong approach. This 
results in wrong line calculation as seen in tdf#159730#c6.
The problem that really needs to be fixed is the 9pt attribute of the 
hidden line breaks in the first paragraph that are used to calculate the height 
of the first paragraph.
Only the 1pt font attribute of the remaining visible space should define 
the line height.

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 3548ece176ed..22a2a17045c0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -131,9 +131,6 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 m_pImpl->SetDocumentSettingsProperty(
 getPropertyName(PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING),
 uno::Any(true));
-m_pImpl->SetDocumentSettingsProperty(
-getPropertyName(PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION),
-uno::Any(true));
 
 // Don't load the default style definitions to avoid weird mix
 m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", 
uno::Any(true));
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 8a83ca0bb064..b8b4efc06222 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -384,7 +384,6 @@ namespace
 { PROP_PARA_CONNECT_BORDERS, u"ParaIsConnectBorder"},
 { PROP_DECORATIVE, u"Decorative"},
 { PROP_PAPER_TRAY, u"PrinterPaperTray"},
-{ PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION, 
u"IgnoreTabsAndBlanksForLineCalculation"},
 });
 } // end anonymous ns
 
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index bb2fb833516c..b39fcd24fa49 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -383,7 +383,6 @@ enum PropertyIds
 ,PROP_RTL_GUTTER
 ,PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF
 ,PROP_PARA_CONNECT_BORDERS
-,PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION
 };
 
 //Returns the UNO string equivalent to eId.


core.git: writerfilter/source

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

New commits:
commit ccf988d206a47701c81126f23e2bef71fc3db333
Author: Justin Luth 
AuthorDate: Mon Mar 11 08:26:28 2024 -0400
Commit: Justin Luth 
CommitDate: Mon Mar 11 15:34:03 2024 +0100

GraphicImport.cxx: address nit

less emphasis on minimizing "if logic"
and more emphasis on readability
(especially since the comment comes after the logic).

In the most common cases, this version
should actually finish sooner to.

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

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 6ee808355a60..2df2569530a1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1863,9 +1863,10 @@ uno::Reference 
GraphicImport::createGraphicObject(uno::Refer
 if (m_pImpl->m_rGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
 {
 if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME
-&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE
-&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER
-&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL)
+&& (m_pImpl->m_nHoriOrient == text::HoriOrientation::LEFT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::RIGHT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::INSIDE
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::OUTSIDE))
 {
 // before compat15, relative left/right/inside/outside 
honored margins.
 if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)


core.git: writerfilter/source

2024-02-29 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |4 +--
 writerfilter/source/dmapper/DomainMapper.hxx  |2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 +--
 writerfilter/source/dmapper/GraphicImport.cxx |   23 +++---
 4 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit 027632ec97ad556606997254244c76c7474d9122
Author: Justin Luth 
AuthorDate: Thu Feb 29 08:42:07 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 01:29:58 2024 +0100

NFC prepwork for tdf#159158: flatten writerfilter applyZOrder

limit code shuffle in the fix itself

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 239ecde547d4..3548ece176ed 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4908,11 +4908,11 @@ SettingsTablePtr const & 
DomainMapper::GetSettingsTable()
 return m_pImpl->GetSettingsTable();
 }
 
-GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
+GraphicZOrderHelper& DomainMapper::graphicZOrderHelper()
 {
 if (m_zOrderHelper == nullptr)
 m_zOrderHelper.reset( new GraphicZOrderHelper );
-return m_zOrderHelper.get();
+return *m_zOrderHelper;
 }
 
 uno::Reference DomainMapper::PopPendingShape()
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx 
b/writerfilter/source/dmapper/DomainMapper.hxx
index db29f10d45eb..9d9771e640f5 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -107,7 +107,7 @@ public:
 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, 
bool bAlwaysCreate );
 StyleSheetTablePtr const & GetStyleSheetTable( );
 SettingsTablePtr const & GetSettingsTable();
-GraphicZOrderHelper* graphicZOrderHelper();
+GraphicZOrderHelper& graphicZOrderHelper();
 
 /// Return the first from the pending (not inserted to the document) 
shapes, if there are any.
 css::uno::Reference PopPendingShape();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0b1ff5e0e6e3..45ff00958083 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4762,12 +4762,12 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 {
 if (rProp.Name == "VML-Z-ORDER")
 {
-GraphicZOrderHelper* pZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
+GraphicZOrderHelper& rZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
 sal_Int32 zOrder(0);
 rProp.Value >>= zOrder;
 xShapePropertySet->setPropertyValue("ZOrder",
-uno::Any(pZOrderHelper->findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
-pZOrderHelper->addItem(xShapePropertySet, zOrder);
+uno::Any(rZOrderHelper.findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
+rZOrderHelper.addItem(xShapePropertySet, zOrder);
 xShapePropertySet->setPropertyValue(getPropertyName( 
PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
 checkZOrderStatus = true;
 }
@@ -4807,12 +4807,12 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 {
 if (rProp.Name == "VML-Z-ORDER")
 {
-GraphicZOrderHelper* pZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
+GraphicZOrderHelper& rZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
 sal_Int32 zOrder(0);
 rProp.Value >>= zOrder;
 xShapePropertySet->setPropertyValue("ZOrder",
-uno::Any(pZOrderHelper->findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
-pZOrderHelper->addItem(xShapePropertySet, zOrder);
+uno::Any(rZOrderHelper.findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
+rZOrderHelper.addItem(xShapePropertySet, zOrder);
 xShapePropertySet->setPropertyValue(getPropertyName( 
PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
 checkZOrderStatus = true;
 }
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index c11717b4048a..bee20740278f 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ 

core.git: writerfilter/source

2024-02-28 Thread Miklos Vajna (via logerrit)
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit c98ff922831f56253af2a050b8e07cfc89b7a387
Author: Miklos Vajna 
AuthorDate: Wed Feb 28 09:41:06 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Feb 28 11:36:41 2024 +0100

Related: tdf#158986 sw floattable, RTF import: use more setNeedPar()

See

,
this keeps the bug fixed but is a better version, as pointed out by
Michael S:

> there was a bug where dispatching PAR here caused a deferred page
> break to be lost, which was fixed by calling setNeedPar(true) instead.

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

diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx 
b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 9d10c7a03362..b40fd55dde9b 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -140,18 +140,19 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
 }
 else
 {
-if (m_bNeedCr)
-{ // tdf#158586 don't dispatch \par here, it eats deferred 
page breaks
-setNeedPar(true);
-}
-
+bool bPendingFloatingTable = false;
 RTFValue::Pointer_t pTblpPr
 = 
m_aStates.top().getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblpPr);
 if (pTblpPr)
 {
 // We have a pending floating table, provide an anchor for 
it still in this
 // section.
-dispatchSymbol(RTFKeyword::PAR);
+bPendingFloatingTable = true;
+}
+
+if (m_bNeedCr || bPendingFloatingTable)
+{ // tdf#158586 don't dispatch \par here, it eats deferred 
page breaks
+setNeedPar(true);
 }
 
 sectBreak();


core.git: writerfilter/source

2024-02-24 Thread Justin Luth (via logerrit)
 writerfilter/source/rtftok/rtfsdrimport.cxx |   19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

New commits:
commit fe84ced08668ef0030fbd37bea52424fd86c8e7a
Author: Justin Luth 
AuthorDate: Fri Feb 9 13:40:10 2024 -0500
Commit: Justin Luth 
CommitDate: Sat Feb 24 13:14:03 2024 +0100

tdf#126533 rtf import: page background fill

I worked on this mainly to see what the impact of the
docx changes would be on RTF.
It seemed to be OK. This patch shows that RTF
can now import gradient page backgrounds.

It does NOT import image backgrounds
(at least no the ones I tested)
because they were specified as
XML_sn: fillBlip
XML_sv: 
which is an unknown property in RTFSdrImport::resolve.

The only fill type that RTFSdrImport::resolve knows about
is XML_gradient.

The only existing unit test I noted was
page-background.rtf

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

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 031f24117d00..9c673e871835 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -1136,18 +1136,6 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool 
bClose, ShapeOrPict const shap
 return;
 }
 
-if (m_rImport.isInBackground())
-{
-RTFSprms aAttributes;
-aAttributes.set(NS_ooxml::LN_CT_Background_color,
-new 
RTFValue(xPropertySet->getPropertyValue("FillColor").get()));
-m_rImport.Mapper().props(new 
RTFReferenceProperties(std::move(aAttributes)));
-
-uno::Reference xComponent(xShape, uno::UNO_QUERY);
-xComponent->dispose();
-return;
-}
-
 // Send it to dmapper
 if (xShape.is())
 {
@@ -1158,6 +1146,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool 
bClose, ShapeOrPict const shap
 }
 }
 
+if (m_rImport.isInBackground())
+{
+RTFSprms aSprms;
+aSprms.set(NS_ooxml::LN_background_background, new RTFValue()); // 
action="end"
+m_rImport.Mapper().props(new RTFReferenceProperties(RTFSprms(), 
std::move(aSprms)));
+}
+
 // If the shape has an inner shape, the inner object's properties should 
not be influenced by
 // the outer one.
 rShape.getProperties().clear();


core.git: writerfilter/source

2024-02-21 Thread Noel Grandin (via logerrit)
 writerfilter/source/dmapper/CellMarginHandler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b863b599c751b28dde2d15188a9ed7cbce4c158a
Author: Noel Grandin 
AuthorDate: Wed Feb 21 20:51:47 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 22 08:41:05 2024 +0100

SAL_WARN->INFO in CellMarginHandler::lcl_attribute

this has been here since
commit 6a9e4e77e83875ecce3b387736f6dd1ea221ced8
Author: Rüdiger Timm 
Date:   Fri Apr 18 11:11:49 2008 +
INTEGRATION: CWS xmlfilter04 (1.1.2); FILE ADDED
and is very noisy, but does not seem to indicate a problem,
given the lack of changes here.

I added an assert here, and I saw all of:
case NS_ooxml::LN_CT_TcMar_top:
case NS_ooxml::LN_CT_TcMar_left:
case NS_ooxml::LN_CT_TcMar_bottom:
case NS_ooxml::LN_CT_TcMar_right:

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

diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx 
b/writerfilter/source/dmapper/CellMarginHandler.cxx
index 8b7b5fa77c23..e8262156e55f 100644
--- a/writerfilter/source/dmapper/CellMarginHandler.cxx
+++ b/writerfilter/source/dmapper/CellMarginHandler.cxx
@@ -62,7 +62,7 @@ void CellMarginHandler::lcl_attribute(Id rName, Value & rVal)
 m_nType = nIntValue;
 break;
 default:
-SAL_WARN("writerfilter", "CellMarginHandler::lcl_attribute: 
unknown attribute");
+SAL_INFO("writerfilter", "CellMarginHandler::lcl_attribute: 
unknown attribute");
 }
 }
 


core.git: writerfilter/source

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

New commits:
commit d10fd2fd532d14500f67cebcc57a1b0f06786baa
Author: Andrea Gelmini 
AuthorDate: Tue Feb 20 17:15:24 2024 +0100
Commit: Julien Nabet 
CommitDate: Tue Feb 20 18:20:25 2024 +0100

Fix typo

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f3e15a69afaf..239ecde547d4 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1501,7 +1501,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 || rProp.Name == "FillTransparenceGradientName"
 || rProp.Name == "FillBitmapURL" || rProp.Name == 
"FillColor2")
 {
-// silence exceptions for unsupported stuff when 
appling to page style
+// silence exceptions for unsupported stuff when 
applying to page style
 continue;
 }
 if (!rProp.Name.startsWith("Fill"))


core.git: writerfilter/source

2024-02-19 Thread Oliver Specht (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit feb08063c47e303bcf399ac90354fbcca1262997
Author: Oliver Specht 
AuthorDate: Mon Feb 19 11:11:56 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Feb 19 18:05:45 2024 +0100

tdf#159254 fix import of printer tray in docx

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5c75e998ff2b..946befddd2f9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -708,10 +708,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 m_pImpl->SetPageMarginTwip( PAGE_MAR_GUTTER, nIntValue );
 break;
 case NS_ooxml::LN_CT_PaperSource_first:
-m_pImpl->SetPaperSource(PAPER_SOURCE_FIRST, nIntValue);
+m_pImpl->SetPaperSource(PAPER_SOURCE_FIRST, 
sStringValue.toInt32());
 break;
 case NS_ooxml::LN_CT_PaperSource_other:
-m_pImpl->SetPaperSource(PAPER_SOURCE_OTHER, nIntValue);
+m_pImpl->SetPaperSource(PAPER_SOURCE_OTHER, 
sStringValue.toInt32());
 break;
 case NS_ooxml::LN_CT_Language_val: //90314
 case NS_ooxml::LN_CT_Language_eastAsia: //90315


core.git: writerfilter/source

2024-02-16 Thread Oliver Specht (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |3 +++
 writerfilter/source/dmapper/PropertyIds.cxx  |1 +
 writerfilter/source/dmapper/PropertyIds.hxx  |1 +
 3 files changed, 5 insertions(+)

New commits:
commit 3b04e74503ec6d07dc4befdb756e6abdc3de4e58
Author: Oliver Specht 
AuthorDate: Thu Feb 15 10:27:03 2024 +0100
Commit: Michael Stahl 
CommitDate: Fri Feb 16 14:22:04 2024 +0100

tdf#159730 add compatibility option in RTF import

Set IgnoreTabsAndBlanksForLineCalculation in RTF import to improve 
formatting.

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 0764a03b908d..5c75e998ff2b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -129,6 +129,9 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 m_pImpl->SetDocumentSettingsProperty(
 getPropertyName(PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING),
 uno::Any(true));
+m_pImpl->SetDocumentSettingsProperty(
+getPropertyName(PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION),
+uno::Any(true));
 
 // Don't load the default style definitions to avoid weird mix
 m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", 
uno::Any(true));
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index b8b4efc06222..8a83ca0bb064 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -384,6 +384,7 @@ namespace
 { PROP_PARA_CONNECT_BORDERS, u"ParaIsConnectBorder"},
 { PROP_DECORATIVE, u"Decorative"},
 { PROP_PAPER_TRAY, u"PrinterPaperTray"},
+{ PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION, 
u"IgnoreTabsAndBlanksForLineCalculation"},
 });
 } // end anonymous ns
 
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index b39fcd24fa49..bb2fb833516c 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -383,6 +383,7 @@ enum PropertyIds
 ,PROP_RTL_GUTTER
 ,PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF
 ,PROP_PARA_CONNECT_BORDERS
+,PROP_TABS_AND_BLANKS_FOR_LINE_CALCULATION
 };
 
 //Returns the UNO string equivalent to eId.


core.git: writerfilter/source

2024-02-08 Thread Oliver Specht (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 6eda6afc90eda8f0a424a5e91a2b00f063c5
Author: Oliver Specht 
AuthorDate: Wed Jan 31 16:41:34 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Thu Feb 8 15:19:47 2024 +0100

tdf#159478 read field comment in default encoding

If a symbol font is applied inside a field the command string
was wrongly converted as symbol text. This is fixed by using a
default RTL_TEXTENCODING_MS_1252 encoding.

Change-Id: I11326ef3c79d6d74c720a2b4ac4987ee6716d912
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162844
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4db4a6352cce..188cec25b95a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3807,9 +3807,11 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool 
bHex)
 if (bHex && !m_aHexBuffer.isEmpty())
 {
 rtl_TextEncoding nEncoding = m_aStates.top().getCurrentEncoding();
-if ((m_aStates.top().getDestination() == Destination::FONTENTRY
- || m_aStates.top().getDestination() == 
Destination::FIELDINSTRUCTION)
-&& m_aStates.top().getCurrentEncoding() == RTL_TEXTENCODING_SYMBOL)
+if (nEncoding == RTL_TEXTENCODING_SYMBOL
+&& (m_aStates.top().getDestination() == Destination::FONTENTRY
+|| (m_aStates.size() > 1
+&& m_aStates[m_aStates.size() - 2].getDestination()
+   == Destination::FIELDINSTRUCTION)))
 nEncoding = RTL_TEXTENCODING_MS_1252;
 OUString aString = OStringToOUString(m_aHexBuffer, nEncoding);
 m_aHexBuffer.setLength(0);


core.git: writerfilter/source

2024-02-08 Thread Michael Stahl (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6446d3e12440be39e6b55f8749038061a1b240da
Author: Michael Stahl 
AuthorDate: Wed Feb 7 13:04:14 2024 +0100
Commit: Michael Stahl 
CommitDate: Thu Feb 8 13:00:25 2024 +0100

tdf#158586 writerfilter: RTF import: fix assert on ooo113308-1.rtf

  warn:legacy.osl:::writerfilter/source/dmapper/DomainMapper_Impl.cxx:1278: 
section stack already empty
  DomainMapper_Impl.cxx:9817: void 
writerfilter::dmapper::DomainMapper_Impl::substream(): Assertion 
`m_aContextStack.size() == contextSize' failed.

Before substream(), there is one CONTEXT_SECTION, after there is an
additional CONTEXT_PARAGRPAH.

The first OSL_ENSURE is because RTFDocumentImpl::tableBreak() calls
endParagraphGroup() but in the substream, startParagraphGroup() hadn't
been called; fixing this also makes the assert failure go away.

This worked previously because sectBreak() called endParagraphGroup()
after reading the header substreams, but it seems dubious that a
paragraph group started in the body should be used in the substream.

(regression from commit 57abad5cf990111fd7de011809d4421dc0550193)

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

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0853cfa1b600..4db4a6352cce 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -654,6 +654,7 @@ void RTFDocumentImpl::runBreak()
 
 void RTFDocumentImpl::tableBreak()
 {
+checkFirstRun(); // ooo113308-1.rtf has a header at offset 151084 that 
doesn't startParagraphGroup() without this
 runBreak();
 Mapper().endParagraphGroup();
 Mapper().startParagraphGroup();


core.git: writerfilter/source

2024-02-06 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   23 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |8 ---
 2 files changed, 15 insertions(+), 16 deletions(-)

New commits:
commit 94f0744648539f1dc4efd42ea55a1e533364ff07
Author: Michael Stahl 
AuthorDate: Tue Feb 6 14:30:58 2024 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 6 15:33:29 2024 +0100

writerfilter: move these members to FieldContext

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bb5472f43174..9f56d17c2ec6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -336,9 +336,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_xComponentContext(std::move( xContext )),
 
m_bForceGenericFields(officecfg::Office::Common::Filter::Microsoft::Import::ForceImportWWFieldsAsGenericFields::get()),
 m_bIsDecimalComma( false ),
-m_bSetUserFieldContent( false ),
-m_bSetCitation( false ),
-m_bSetDateValue( false ),
 m_bIsFirstSection( true ),
 m_bStartTOC(false),
 m_bStartTOCHeaderFooter(false),
@@ -7393,9 +7390,9 @@ void DomainMapper_Impl::CloseFieldCommand()
 if( !pContext )
 return;
 
-m_bSetUserFieldContent = false;
-m_bSetCitation = false;
-m_bSetDateValue = false;
+pContext->m_bSetUserFieldContent = false;
+pContext->m_bSetCitation = false;
+pContext->m_bSetDateValue = false;
 // tdf#124472: If the normal command line is not empty, use it,
 // otherwise, the last active row is evaluated.
 if (!pContext->GetCommandIsEmpty(false))
@@ -7559,7 +7556,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 xFieldProperties->setPropertyValue(
 getPropertyName(PROP_IS_FIXED),
 uno::Any( true ));
-m_bSetDateValue = true;
+pContext->m_bSetDateValue = true;
 }
 else
 xFieldProperties->setPropertyValue(
@@ -7616,7 +7613,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 uno::Reference 
xDependentField(
 xFieldInterface, uno::UNO_QUERY_THROW);
 xDependentField->attachTextFieldMaster(xMaster);
-m_bSetUserFieldContent = true;
+pContext->m_bSetUserFieldContent = true;
 }
 }
 break;
@@ -8137,7 +8134,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 xFieldProperties->setPropertyValue(
 getPropertyName(PROP_IS_FIXED),
 uno::Any( true ));
-m_bSetDateValue = true;
+pContext->m_bSetDateValue = true;
 }
 SetNumberFormat( pContext->GetCommand(), xFieldProperties 
);
 }
@@ -8231,7 +8228,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 uno::Sequence aValues
 = 
m_aFieldStack.back()->getProperties()->GetPropertyValues();
 appendTextContent(xToInsert, aValues);
-m_bSetCitation = true;
+pContext->m_bSetCitation = true;
 }
 break;
 
@@ -8427,7 +8424,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& 
rResult)
 {
 try
 {
-if( m_bSetUserFieldContent )
+if (pContext->m_bSetUserFieldContent)
 {
 // user field content has to be set at the field master
 uno::Reference< text::XDependentTextField > 
xDependentField( xTextField, uno::UNO_QUERY_THROW );
@@ -8435,7 +8432,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& 
rResult)
 getPropertyName(PROP_CONTENT),
  uno::Any( rResult ));
 }
-else if ( m_bSetCitation )
+else if (pContext->m_bSetCitation)
 {
 
 uno::Reference< beans::XPropertySet > xFieldProperties( 
xTextField, uno::UNO_QUERY_THROW);
@@ -8479,7 +8476,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& 
rResult)
 uno::Any(aValues));
 }
 }
-else if ( m_bSetDateValue )
+else if (pContext->m_bSetDateValue)
 {
 uno::Reference< util::XNumberFormatsSupplier > 
xNumberSupplier( m_xTextDocument, uno::UNO_QUERY_THROW );
 
diff 

core.git: writerfilter/source

2024-02-06 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |   18 +---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   86 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   27 +++---
 writerfilter/source/dmapper/PropertyMap.cxx   |4 -
 4 files changed, 61 insertions(+), 74 deletions(-)

New commits:
commit 4b2e61cb8b5429e08f43c5a70eaa1dd27c40ddab
Author: Michael Stahl 
AuthorDate: Mon Feb 5 20:49:31 2024 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 6 13:03:36 2024 +0100

writerfilter: move more members to SubstreamContext

m_bIgnoreNextTab can be removed altogether, it is only set to true in
one place and immediately checked and reset in the next 2 statements.

Don't move m_bHasFtnSep, somehow breaks lots of tests.

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index c5c487f37cf5..0764a03b908d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3309,10 +3309,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 m_pImpl->m_StreamStateStack.top().nTableDepth--;
 break;
 case NS_ooxml::LN_tcStart:
-m_pImpl->m_nTableCellDepth++;
+m_pImpl->m_StreamStateStack.top().nTableCellDepth++;
 break;
 case NS_ooxml::LN_tcEnd:
-m_pImpl->m_nTableCellDepth--;
+m_pImpl->m_StreamStateStack.top().nTableCellDepth--;
 break;
 case NS_ooxml::LN_glow_glow:
 case NS_ooxml::LN_shadow_shadow:
@@ -4306,20 +4306,16 @@ void DomainMapper::lcl_utext(const sal_Unicode *const 
data_, size_t len)
 }
 else if (len == 1 && sText[0] == ' ' )
 {
-if ( m_pImpl->m_bCheckFirstFootnoteTab && m_pImpl->IsInFootOrEndnote() 
)
+if (m_pImpl->m_StreamStateStack.top().bCheckFirstFootnoteTab && 
m_pImpl->IsInFootOrEndnote())
 {
 // Allow MSO to emulate LO footnote text starting at left margin - 
only meaningful with hanging indent
-m_pImpl->m_bCheckFirstFootnoteTab = false;
+m_pImpl->m_StreamStateStack.top().bCheckFirstFootnoteTab = false;
 sal_Int32 nFirstLineIndent = 0;
 m_pImpl->GetAnyProperty(PROP_PARA_FIRST_LINE_INDENT, 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)) >>= nFirstLineIndent;
 if ( nFirstLineIndent < 0 )
-m_pImpl->m_bIgnoreNextTab = true;
-}
-
-if ( m_pImpl->m_bIgnoreNextTab )
-{
-m_pImpl->m_bIgnoreNextTab = false;
-return;
+{
+return;
+}
 }
 }
 if (!m_pImpl->hasTableManager())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index af14dffa8cc5..1d429c82463f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -384,14 +384,9 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsNewDoc(!rMediaDesc.getUnpackedValueOrDefault("InsertMode", 
false)),
 m_bIsAltChunk(rMediaDesc.getUnpackedValueOrDefault("AltChunkMode", 
false)),
 
m_bIsReadGlossaries(rMediaDesc.getUnpackedValueOrDefault("ReadGlossaries", 
false)),
-m_nTableCellDepth(0),
-m_bHasFtn(false),
 m_bHasFtnSep(false),
-m_bCheckFirstFootnoteTab(false),
-m_bIgnoreNextTab(false),
 m_bIsSplitPara(false),
 m_bIsActualParagraphFramed( false ),
-m_bParaAutoBefore(false),
 m_bSaxError(false)
 {
 m_StreamStateStack.emplace(); // add state for document body
@@ -956,7 +951,7 @@ bool DomainMapper_Impl::GetIsFirstParagraphInSection( bool 
bAfterRedline ) const
 
 void DomainMapper_Impl::SetIsFirstParagraphInShape(bool bIsFirst)
 {
-m_bIsFirstParaInShape = bIsFirst;
+m_StreamStateStack.top().bIsFirstParaInShape = bIsFirst;
 }
 
 void DomainMapper_Impl::SetIsDummyParaAddedForTableInSection( bool bIsAdded )
@@ -2346,7 +2341,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
  (GetIsFirstParagraphInSection() && GetSectionContext() && 
GetSectionContext()->IsFirstSection()) ||
 (m_StreamStateStack.top().bFirstParagraphInCell
  && 0 < m_StreamStateStack.top().nTableDepth
- && m_StreamStateStack.top().nTableDepth == m_nTableCellDepth))
+ && m_StreamStateStack.top().nTableDepth == 
m_StreamStateStack.top().nTableCellDepth))
 {
 // export requires grabbag to match top_margin, so keep them 
in sync
 if (nBeforeAutospacing && bIsAutoSet)
@@ -2621,7 +2616,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& 

core.git: writerfilter/source

2024-02-01 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   32 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   28 ++-
 2 files changed, 29 insertions(+), 31 deletions(-)

New commits:
commit 992f7114ab8645fb5b7a22b5f974a95fe7be7712
Author: Michael Stahl 
AuthorDate: Wed Jan 31 15:37:03 2024 +0100
Commit: Michael Stahl 
CommitDate: Thu Feb 1 09:34:55 2024 +0100

writerfilter: replace members w/ SubstreamContext::eSubstreamType

This should not change any behaviour.

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 08e81899b94f..633296ce69e1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -356,10 +356,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bInStyleSheetImport( false ),
 m_bInNumberingImport(false),
 m_bInAnyTableImport( false ),
-m_eInHeaderFooterImport( HeaderFooterImportState::none ),
 m_bDiscardHeaderFooter( false ),
-m_bInFootOrEndnote(false),
-m_bInFootnote(false),
 m_bHasFootnoteStyle(false),
 m_bCheckFootnoteStyle(false),
 m_eSkipFootnoteState(SkipFootnoteSeparator::OFF),
@@ -380,7 +377,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsPreviousParagraphFramed( false ),
 m_bIsLastParaInSection( false ),
 m_bIsLastSectionGroup( false ),
-m_bIsInComments( false ),
 m_bParaSectpr( false ),
 m_bUsingEnhancedFields( false ),
 m_bSdt(false),
@@ -959,7 +955,7 @@ bool DomainMapper_Impl::GetIsFirstParagraphInSection( bool 
bAfterRedline ) const
 // and none of them should be considered the first para in section.
 return ( bAfterRedline ? m_bIsFirstParaInSectionAfterRedline : 
m_bIsFirstParaInSection )
 && !IsInShape()
-&& !m_bIsInComments
+&& !IsInComments()
 && !IsInFootOrEndnote();
 }
 
@@ -2611,7 +2607,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 uno::Reference xCursor;
 if (m_StreamStateStack.top().bParaHadField
-&& !m_bIsInComments && !m_xTOCMarkerCursor.is())
+&& !IsInComments() && !m_xTOCMarkerCursor.is())
 {
 // Workaround to make sure char props of the field are 
not lost.
 // Not relevant for editeng-based comments.
@@ -2840,7 +2836,7 @@ 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_bIsInComments
+if (xParaProps && !IsInComments()
 && (0 < m_StreamStateStack.top().nTableDepth
 || !m_aAnchoredObjectAnchors.empty()))
 {
@@ -2992,7 +2988,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 m_previousRedline.clear();
 m_bParaChanged = false;
 
-if (m_bIsInComments && pParaContext)
+if (IsInComments() && pParaContext)
 {
 if (const OUString sParaId = pParaContext->props().GetParaId(); 
!sParaId.isEmpty())
 {
@@ -3021,7 +3017,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 // and in text boxes anchored to the first paragraph of table cells
 if (0 < m_StreamStateStack.top().nTableDepth
 && m_StreamStateStack.top().nTableDepth == m_nTableCellDepth
-&& !IsInShape() && !m_bIsInComments)
+&& !IsInShape() && !IsInComments())
 {
 m_StreamStateStack.top().bFirstParagraphInCell = false;
 }
@@ -3195,7 +3191,7 @@ void DomainMapper_Impl::applyToggleAttributes(const 
PropertyMapPtr& pPropertyMap
 {
 applyToggleAttributes(pPropertyMap);
 // If we are in comments, then disable CharGrabBag, comment text 
doesn't support that.
-uno::Sequence< beans::PropertyValue > aValues = 
pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!m_bIsInComments);
+uno::Sequence aValues = 
pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!IsInComments());
 
 if (IsInTOC() || m_bStartIndex || m_bStartBibliography)
 for( auto& rValue : asNonConstRange(aValues) )
@@ -3796,7 +3792,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType 
ePagePartType, PageTyp
 const PropertyIds ePropTextRight = bHeader ? PROP_HEADER_TEXT: 
PROP_FOOTER_TEXT;
 
 m_bDiscardHeaderFooter = true;
-

core.git: writerfilter/source

2024-02-01 Thread Michael Stahl (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   20 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |7 +++
 2 files changed, 11 insertions(+), 16 deletions(-)

New commits:
commit 4913812baeabd44b46302e54b73a227e760c688a
Author: Michael Stahl 
AuthorDate: Wed Jan 31 14:47:22 2024 +0100
Commit: Michael Stahl 
CommitDate: Thu Feb 1 09:34:10 2024 +0100

writerfilter: move m_bParaHadField to SubstreamContext

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 03886000935d..8f56f102e65f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -401,8 +401,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIgnoreNextTab(false),
 m_bIsSplitPara(false),
 m_bIsActualParagraphFramed( false ),
-m_bParaHadField(false),
-m_bSaveParaHadField(false),
 m_bParaAutoBefore(false),
 m_bFirstParagraphInCell(true),
 m_bSaveFirstParagraphInCell(false),
@@ -2614,7 +2612,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 else
 {
 uno::Reference xCursor;
-if (m_bParaHadField && !m_bIsInComments && 
!m_xTOCMarkerCursor.is())
+if (m_StreamStateStack.top().bParaHadField
+&& !m_bIsInComments && !m_xTOCMarkerCursor.is())
 {
 // Workaround to make sure char props of the field are 
not lost.
 // Not relevant for editeng-based comments.
@@ -3017,7 +3016,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 }
 
 SetIsOutsideAParagraph(true);
-m_bParaHadField = false;
+m_StreamStateStack.top().bParaHadField = false;
 
 // don't overwrite m_bFirstParagraphInCell in table separator nodes
 // and in text boxes anchored to the first paragraph of table cells
@@ -3789,7 +3788,6 @@ bool isContentEmpty(uno::Reference const& 
xText, uno::Reference 
DomainMapper_Impl::FindOrCreateFieldMaster(c
 
 void DomainMapper_Impl::PushFieldContext()
 {
-m_bParaHadField = true;
+m_StreamStateStack.top().bParaHadField = true;
 if(m_bDiscardHeaderFooter)
 return;
 #ifdef DBG_UTIL
@@ -7045,7 +7041,7 @@ void DomainMapper_Impl::handleToc
 
 m_bStartTOC = true;
 pContext->SetTOC(xTOC);
-m_bParaHadField = false;
+m_StreamStateStack.top().bParaHadField = false;
 
 if (!xTOC)
 return;
@@ -7278,7 +7274,7 @@ void DomainMapper_Impl::handleBibliography
 xTOC->setPropertyValue(getPropertyName( PROP_TITLE ), 
uno::Any(OUString()));
 
 pContext->SetTOC( xTOC );
-m_bParaHadField = false;
+m_StreamStateStack.top().bParaHadField = false;
 
 uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY );
 appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() );
@@ -7321,7 +7317,7 @@ void DomainMapper_Impl::handleIndex
 }
 }
 pContext->SetTOC( xTOC );
-m_bParaHadField = false;
+m_StreamStateStack.top().bParaHadField = false;
 
 uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY );
 appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() );
@@ -8339,7 +8335,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 }
 }
 else
-m_bParaHadField = false;
+m_StreamStateStack.top().bParaHadField = false;
 }
 }
 catch( const uno::Exception& )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 4f6bca22aa19..518f490cf12c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -187,6 +187,8 @@ struct SubstreamContext
 bool  bIsColumnBreakDeferred = false;
 bool  bIsPageBreakDeferred = false;
 sal_Int32 nLineBreaksDeferred = 0;
+/// Current paragraph had at least one field in it.
+bool  bParaHadField = false;
 };
 
 /// Information about a paragraph to be finished after a field end.
@@ -767,7 +769,7 @@ public:
 const std::stack& GetSdtStarts() const;
 
 bool GetParaChanged() const { return m_bParaChanged;}
-bool GetParaHadField() const { return m_bParaHadField; }
+bool GetParaHadField() const { return 
m_StreamStateStack.top().bParaHadField; }
 bool GetRemoveThisPara() const { return m_bRemoveThisParagraph; }
 
 void deferBreak( BreakType deferredBreakType );
@@ -1227,9 +1229,6 @@ private:
 // Start a new index section; if needed, finish current paragraph
 

core.git: writerfilter/source

2024-01-23 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/GraphicImport.cxx |   24 
 1 file changed, 20 insertions(+), 4 deletions(-)

New commits:
commit ca29c240dbfe6396115c961d27b1bf13a65793c2
Author: Justin Luth 
AuthorDate: Mon Jan 22 10:41:13 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Jan 23 14:55:08 2024 +0100

tdf#159158 writerfilter: improve m_bBehindDoc/m_bOpaque documentation

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

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 4b0e199d1d17..fd80491c3265 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -221,8 +221,13 @@ public:
 bool  m_bLayoutInCell;
 bool  m_bCompatForcedLayoutInCell;
 bool m_bAllowOverlap = true;
+
+// Opaque means not in the background (but instead, the graphic will be 
over top of the text)
+// This flag holds where LO will ACTUALLY put the graphic
 bool  m_bOpaque;
+// BehindDoc means in the background. This flag says the graphic REQUESTED 
to be behind the text
 bool  m_bBehindDoc;
+
 bool  m_bContour;
 bool  m_bContourOutside;
 WrapPolygon::Pointer_t mpWrapPolygon;
@@ -395,11 +400,22 @@ public:
 if (oZOrder)
 {
 // tdf#120760 Send objects with behinddoc=true to the back.
-// Only relativeHeight zOrders have been used if m_bBehindDoc is 
set,
-// and they have already been set as negative values (to be below 
all z-indexes).
+
+// zOrder can be defined either by z-index or by relativeHeight.
+// z-index indicates background with a negative value,
+// while relativeHeight indicates background with BehindDoc = true.
+//
+// In general, all z-index-defined shapes appear on top of 
relativeHeight graphics
+// regardless of the value.
+// So we have to try to put all relativeHeights as far back as 
possible,
+// and this has already partially happened because they were 
already made to be negative
+// but now the behindDoc relativeHeights need to be forced to the 
very back.
+//
 // Subtract even more so behindDoc relativeHeights will be behind
-// other relativeHeights and negative z-indexes (needed for 
IsInHeaderFooter).
-// relativeHeight removed 0x1E00 , so can subtract another 
0x6200 
+// foreground relativeHeights and also behind all of the negative 
z-indexes
+// (especially needed for IsInHeaderFooter, as EVERYTHING is 
forced to the background).
+//
+// relativeHeight already removed 0x1E00 , so can subtract 
another 0x6200 
 if (bBehindText)
 oZOrder = *oZOrder - 0x6200;
 


core.git: writerfilter/source

2024-01-21 Thread Arnaud VERSINI (via logerrit)
 writerfilter/source/dmapper/PropertyMap.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit f504b2de4abd204d87be25ee85ac7b31521757ac
Author: Arnaud VERSINI 
AuthorDate: Thu Dec 28 15:13:39 2023 +0100
Commit: Noel Grandin 
CommitDate: Sun Jan 21 13:51:57 2024 +0100

writerfilter : use constexpr frozen unordered_set instead of 
std::unordered_set

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

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 29444d809b1e..41c25ce50816 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -20,7 +20,6 @@
 #include 
 
 #include 
-#include 
 
 #include "PropertyMap.hxx"
 #include "TagLogger.hxx"
@@ -67,6 +66,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 using namespace com::sun::star;
 
 namespace writerfilter::dmapper {
@@ -1399,12 +1402,12 @@ void 
SectionPropertyMap::CreateEvenOddPageStyleCopy(DomainMapper_Impl& rDM_Impl,
 const uno::Sequence 
propertyList(pagePropertiesInfo->getProperties());
 
 // Ignore write-only properties.
-static const std::unordered_set staticDenylist = {
-"FooterBackGraphicURL", "BackGraphicURL", "HeaderBackGraphicURL",
-"HeaderIsOn", "FooterIsOn",
-"HeaderIsShared", "FooterIsShared", "FirstIsShared",
-"HeaderText", "HeaderTextLeft", "HeaderTextFirst",
-"FooterText", "FooterTextLeft", "FooterTextFirst" };
+static constexpr frozen::unordered_set 
staticDenylist = {
+u"FooterBackGraphicURL", u"BackGraphicURL", u"HeaderBackGraphicURL",
+u"HeaderIsOn", u"FooterIsOn",
+u"HeaderIsShared", u"FooterIsShared", u"FirstIsShared",
+u"HeaderText", u"HeaderTextLeft", u"HeaderTextFirst",
+u"FooterText", u"FooterTextLeft", u"FooterTextFirst" };
 
 for (const auto& rProperty : propertyList)
 {


core.git: writerfilter/source

2024-01-18 Thread Mike Kaganski (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 4d0f2d5ec9f7f988a1493916ae35bac1986c95a8
Author: Mike Kaganski 
AuthorDate: Thu Jan 18 20:57:52 2024 +0600
Commit: Mike Kaganski 
CommitDate: Thu Jan 18 19:04:56 2024 +0100

Related: tdf#159259 Drop obsolete exclusion of framePr inside sdt

Commit 73bd937420b9a99e1e35950e3f9dcbcfd874876d (n#780853 fix DOCX
import of w:sdtContent in table cell, 2012-09-25) had introduced a
restriction, where a framePr was ignored, when inside an sdt. It
was required to allow table import, which broke otherwise.

Since then, the situation has obviously changed; the test case for
the change, added in commit 7ea71eb8a28c4b41949299ff7d4b391486c90eea
(n#780853 testcase, 2012-09-25) passes after removal of the check.

This check disallows importing sdt in frame. This makes the bugdoc
of tdf#159259 to import the sdt in frame. The Lorem Ipsum paragraph
is still enclosed into the sdt - to be fixed in a follow-up.

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 00f1d005a5e2..d6717cc4600e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2419,8 +2419,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 }
 break;
 case NS_ooxml::LN_CT_PPrBase_framePr:
-// Avoid frames if we're inside a structured document tag, would just 
cause outer tables fail to create.
-if (!m_pImpl->GetSdt())
 {
 PropertyMapPtr pContext = 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
 if( pContext )


core.git: writerfilter/source

2024-01-17 Thread Noel Grandin (via logerrit)
 writerfilter/source/rtftok/rtfsprm.cxx  |   20 +++-
 writerfilter/source/rtftok/rtfsprm.hxx  |2 +-
 writerfilter/source/rtftok/rtfvalue.cxx |4 ++--
 3 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit f6a559ccacaab875d1aa1da70e3011592158e9d4
Author: Noel Grandin 
AuthorDate: Tue Jan 16 12:23:38 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jan 17 09:15:00 2024 +0100

tdf#158950 Paste as RTF loses char color and paragraph alignment from styles

This logic partially originated in

commit 8e8f9388c323ad3c32cef3f91609ad19386b7d56
Author: Miklos Vajna 
Date:   Tue Apr 22 12:53:24 2014 +0200
Related: fdo#77600 RTF import: RTFValue::equals: compare attribute
content

But it is rather weird to compare RTFSprms this way, comparing each
attribute to a parent RTFValue.

Making the comparison more "normal" fixes the reported bug while not
breaking fdo#77600

Change-Id: Iee224c7bc9542c359f8a71086230e4b53c1c3e16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162164
Reviewed-by: Regina Henschel 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index 5d57348f204e..148d39c2e48b 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -437,12 +437,22 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& 
rReference, Id const nStyleType
 return ret;
 }
 
-bool RTFSprms::equals(const RTFValue& rOther) const
+bool RTFSprms::equals(const RTFSprms& rOther) const
 {
-return std::all_of(m_pSprms->cbegin(), m_pSprms->cend(),
-   [&](const std::pair& raPair) 
-> bool {
-   return raPair.second->equals(rOther);
-   });
+auto it1 = m_pSprms->cbegin();
+auto it1End = m_pSprms->cend();
+auto it2 = rOther.m_pSprms->cbegin();
+auto it2End = rOther.m_pSprms->cend();
+while (it1 != it1End && it2 != it2End)
+{
+if (it1->first != it2->first)
+return false;
+if (!it1->second->equals(*it2->second))
+return false;
+++it1;
+++it2;
+}
+return it1 == it1End && it2 == it2End;
 }
 
 void RTFSprms::ensureCopyBeforeWrite()
diff --git a/writerfilter/source/rtftok/rtfsprm.hxx 
b/writerfilter/source/rtftok/rtfsprm.hxx
index 9f3bbd78b37a..132a2bbcbeb2 100644
--- a/writerfilter/source/rtftok/rtfsprm.hxx
+++ b/writerfilter/source/rtftok/rtfsprm.hxx
@@ -73,7 +73,7 @@ public:
 Iterator_t begin() { return m_pSprms->begin(); }
 Iterator_t end() { return m_pSprms->end(); }
 void clear();
-bool equals(const RTFValue& rOther) const;
+bool equals(const RTFSprms& rOther) const;
 
 private:
 void ensureCopyBeforeWrite();
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx 
b/writerfilter/source/rtftok/rtfvalue.cxx
index 373fb7521b13..7a9137f5db4a 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -172,7 +172,7 @@ bool RTFValue::equals(const RTFValue& rOther) const
 {
 if (m_pAttributes->size() != rOther.m_pAttributes->size())
 return false;
-if (!m_pAttributes->equals(rOther))
+if (!m_pAttributes->equals(*rOther.m_pAttributes))
 return false;
 }
 else if (m_pAttributes && m_pAttributes->size())
@@ -188,7 +188,7 @@ bool RTFValue::equals(const RTFValue& rOther) const
 {
 if (m_pSprms->size() != rOther.m_pSprms->size())
 return false;
-if (!m_pSprms->equals(rOther))
+if (!m_pSprms->equals(*rOther.m_pSprms))
 return false;
 }
 else if (m_pSprms && m_pSprms->size())


core.git: writerfilter/source

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

New commits:
commit 173b40944fa09825398ecd6f976f152ddd123257
Author: Andrea Gelmini 
AuthorDate: Fri Dec 1 12:09:10 2023 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Jan 16 13:05:41 2024 +0100

Fix typo

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ecad048dd529..96043cb368b9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3872,7 +3872,7 @@ void 
DomainMapper_Impl::prepareHeaderFooterContent(uno::Reference

core.git: writerfilter/source

2024-01-02 Thread Justin Luth (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0ce7c7a64fbc1b5c15dd6887c31ca7c93b069ff7
Author: Justin Luth 
AuthorDate: Thu Dec 28 15:32:00 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Jan 2 23:16:04 2024 +0100

rtf writerfilter: calculate if frame hasProperties once

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

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 33b90aa9b5ca..c7624da50012 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -589,8 +589,9 @@ void RTFDocumentImpl::checkNeedPap()
 NS_ooxml::LN_Value_ST_StyleType_paragraph));
 
 // Writer will ignore a page break before a text frame, so guard it 
with empty paragraphs
+const bool bIsInFrame = m_aStates.top().getFrame().hasProperties();
 bool hasBreakBeforeFrame
-= m_aStates.top().getFrame().hasProperties()
+= bIsInFrame
   && 
m_aStates.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore);
 if (hasBreakBeforeFrame)
 {
@@ -601,7 +602,7 @@ void RTFDocumentImpl::checkNeedPap()
 if (hasBreakBeforeFrame)
 dispatchSymbol(RTFKeyword::PAR);
 
-if (m_aStates.top().getFrame().hasProperties())
+if (bIsInFrame)
 {
 writerfilter::Reference::Pointer_t const 
pFrameProperties(
 new RTFReferenceProperties(RTFSprms(), 
m_aStates.top().getFrame().getSprms()));


core.git: writerfilter/source

2023-12-29 Thread Julien Nabet (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |4 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|   24 +++---
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit d727f58d73014a3fb4e7eb7f0a29ec4d4599090f
Author: Julien Nabet 
AuthorDate: Fri Dec 29 14:00:46 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 29 16:06:09 2023 +0100

Use emplace_back instead of push_back (writerfilter)

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index c6be4d9f8c98..142d7f2f12eb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2958,12 +2958,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if (m_pImpl->m_pSdtHelper->getDropDownDisplayTexts().size() != 
nDropDownDisplayTexts + 1)
 {
 // w:displayText="..." is optional, add empty value if it was not 
provided.
-
m_pImpl->m_pSdtHelper->getDropDownDisplayTexts().push_back(OUString());
+m_pImpl->m_pSdtHelper->getDropDownDisplayTexts().emplace_back();
 }
 if (m_pImpl->m_pSdtHelper->getDropDownItems().size() != nDropDownItems 
+ 1)
 {
 // w:value="..." is optional, add empty value if it was not 
provided.
-m_pImpl->m_pSdtHelper->getDropDownItems().push_back(OUString());
+m_pImpl->m_pSdtHelper->getDropDownItems().emplace_back();
 }
 }
 break;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c2489210d852..4f65f1b1cefd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4108,9 +4108,9 @@ void 
DomainMapper_Impl::CreateRedline(uno::Reference const& xR
 
 if (eType != StoredRedlines::NONE)
 {
-m_aStoredRedlines[eType].push_back( uno::Any(xRange) );
-m_aStoredRedlines[eType].push_back( uno::Any(sType) );
-m_aStoredRedlines[eType].push_back( uno::Any(aRedlineProperties) );
+m_aStoredRedlines[eType].emplace_back(xRange);
+m_aStoredRedlines[eType].emplace_back(sType);
+m_aStoredRedlines[eType].emplace_back(aRedlineProperties);
 }
 }
 catch( const uno::Exception & )
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1d0c2d7dde4c..33b90aa9b5ca 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1348,7 +1348,7 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool 
bRunProps)
 }
 else
 {
-pCurrentBuffer->push_back(Buf_t(BUFFER_STARTRUN, nullptr, nullptr));
+pCurrentBuffer->emplace_back(BUFFER_STARTRUN, nullptr, nullptr);
 }
 
 // Should we send run properties?
@@ -1363,8 +1363,8 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool 
bRunProps)
 else
 {
 auto pValue = new RTFValue(*sValue);
-pCurrentBuffer->push_back(Buf_t(BUFFER_TEXT, pValue, nullptr));
-pCurrentBuffer->push_back(Buf_t(BUFFER_ENDRUN, nullptr, nullptr));
+pCurrentBuffer->emplace_back(BUFFER_TEXT, pValue, nullptr);
+pCurrentBuffer->emplace_back(BUFFER_ENDRUN, nullptr, nullptr);
 }
 }
 
@@ -1604,7 +1604,7 @@ void RTFDocumentImpl::text(OUString& rString)
 else if (pCurrentBuffer)
 {
 RTFValue::Pointer_t pValue;
-pCurrentBuffer->push_back(Buf_t(BUFFER_STARTRUN, pValue, nullptr));
+pCurrentBuffer->emplace_back(BUFFER_STARTRUN, pValue, nullptr);
 }
 
 if (m_aStates.top().getDestination() == Destination::NORMAL
@@ -1617,7 +1617,7 @@ void RTFDocumentImpl::text(OUString& rString)
 else
 {
 auto pValue = new RTFValue(rString);
-pCurrentBuffer->push_back(Buf_t(BUFFER_UTEXT, pValue, nullptr));
+pCurrentBuffer->emplace_back(BUFFER_UTEXT, pValue, nullptr);
 }
 
 m_bNeedCr = true;
@@ -1627,7 +1627,7 @@ void RTFDocumentImpl::text(OUString& rString)
 else if (pCurrentBuffer)
 {
 RTFValue::Pointer_t pValue;
-pCurrentBuffer->push_back(Buf_t(BUFFER_ENDRUN, pValue, nullptr));
+pCurrentBuffer->emplace_back(BUFFER_ENDRUN, pValue, nullptr);
 }
 }
 
@@ -2498,8 +2498,8 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 // Also buffer the RTFPicture of the state stack as it 
contains
 // the shape size.
 auto pPictureValue = new 
RTFValue(m_aStates.top().getPicture());
-

core.git: writerfilter/source

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

New commits:
commit 1d28d0b800543dfcd2347cdd9bfc359ade3194a3
Author: Andrea Gelmini 
AuthorDate: Fri Dec 1 12:09:01 2023 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Dec 29 15:13:27 2023 +0100

Fix typo

Change-Id: Ie63bad4bd2ab19ed1557ffc8648500c1183692e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160203
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e247294a4e52..c2489210d852 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3805,7 +3805,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType 
ePagePartType, PageTyp
 // Turn on the headers
 xPageStyle->setPropertyValue(getPropertyName(ePropIsOn), 
uno::Any(true));
 
-// Set both sharing left and first to off so we can import the content 
regardless tha what value
+// Set both sharing left and first to off so we can import the content 
regardless of what value
 // the "titlePage" or "evenAndOdd" flags are set (which decide what 
the sharing is set to in the document).
 xPageStyle->setPropertyValue(getPropertyName(ePropShared), 
uno::Any(false));
 xPageStyle->setPropertyValue(getPropertyName(PROP_FIRST_IS_SHARED), 
uno::Any(false));


core.git: writerfilter/source

2023-12-29 Thread Declan Fodor (via logerrit)
 writerfilter/source/dmapper/GraphicImport.cxx |   94 +-
 1 file changed, 47 insertions(+), 47 deletions(-)

New commits:
commit 1c235c1343ed7b88a3e6b923b9b0d6e567054f1c
Author: Declan Fodor 
AuthorDate: Fri Dec 22 23:54:53 2023 -0600
Commit: Hossein 
CommitDate: Fri Dec 29 14:14:39 2023 +0100

tdf#157638 Removed old comments

Certain numerical comments in GraphicImport contained
debugging information that is no longer relevant to the
current code. These have been removed.

Change-Id: I931cd8dae6d1e449211d78eedd5422994b8c4423
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161232
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 2661d6ee58f4..86870565baed 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -489,16 +489,16 @@ void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
 {
-case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides: // 
90920;
+case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides:
 m_pImpl->m_nWrap = text::WrapTextMode_PARALLEL;
 break;
-case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left: // 90921;
+case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left:
 m_pImpl->m_nWrap = text::WrapTextMode_LEFT;
 break;
-case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right: // 90922;
+case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right:
 m_pImpl->m_nWrap = text::WrapTextMode_RIGHT;
 break;
-case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest: // 
90923;
+case NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest:
 m_pImpl->m_nWrap = text::WrapTextMode_DYNAMIC;
 break;
 default:;
@@ -633,7 +633,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 case NS_ooxml::LN_OfficeArtExtension_Decorative_val:
 m_pImpl->m_bDecorative = true;
 break;
-case NS_ooxml::LN_CT_Hyperlink_URL://90682;
+case NS_ooxml::LN_CT_Hyperlink_URL:
 m_pImpl->m_sHyperlinkURL = rValue.getString();
 break;
 case NS_ooxml::LN_blip: //the binary graphic data in a shape
@@ -695,14 +695,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 case NS_ooxml::LN_CT_EffectExtent_b:
 m_pImpl->m_oEffectExtentBottom = nIntValue;
 break;
-case NS_ooxml::LN_CT_NonVisualDrawingProps_id:// 90650;
+case NS_ooxml::LN_CT_NonVisualDrawingProps_id:
 //id of the object - ignored
 break;
-case NS_ooxml::LN_CT_NonVisualDrawingProps_name:// 90651;
+case NS_ooxml::LN_CT_NonVisualDrawingProps_name:
 //name of the object
 m_pImpl->m_sName = rValue.getString();
 break;
-case NS_ooxml::LN_CT_NonVisualDrawingProps_descr:// 90652;
+case NS_ooxml::LN_CT_NonVisualDrawingProps_descr:
 //alternative text
 m_pImpl->m_sAlternativeText = rValue.getString();
 break;
@@ -713,47 +713,47 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 case NS_ooxml::LN_CT_NonVisualDrawingProps_hidden:
 m_pImpl->m_bHidden = (nIntValue == 1);
 break;
-case 
NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noChangeAspect://90644;
+case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noChangeAspect:
 //disallow aspect ratio change - ignored
 break;
-case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noMove:// 90645;
+case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noMove:
 m_pImpl->m_bPositionProtected = true;
 break;
-case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noResize: // 90646;
+case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noResize:
 m_pImpl->m_bSizeProtected = true;
 break;
-case NS_ooxml::LN_CT_Anchor_distT: // 90983;
-case NS_ooxml::LN_CT_Anchor_distB: // 90984;
-case NS_ooxml::LN_CT_Anchor_distL: // 90985;
-case NS_ooxml::LN_CT_Anchor_distR: // 90986;
+case NS_ooxml::LN_CT_Anchor_distT:
+case NS_ooxml::LN_CT_Anchor_distB:
+case NS_ooxml::LN_CT_Anchor_distL:
+case NS_ooxml::LN_CT_Anchor_distR:
 {
 m_pImpl->m_nShapeOptionType = nName;
 ProcessShapeOptions(rValue);
 }
 break;
-case NS_ooxml::LN_CT_Anchor_simplePos_attr: // 90987;
+case NS_ooxml::LN_CT_Anchor_simplePos_attr:
 m_pImpl->m_bUseSimplePos = nIntValue > 0;
 break;
-case NS_ooxml::LN_CT_Anchor_relativeHeight: // 90988;
+case NS_ooxml::LN_CT_Anchor_relativeHeight:
 m_pImpl->m_zOrder = nIntValue;
   

core.git: writerfilter/source

2023-12-19 Thread Justin Luth (via logerrit)
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e915d9f6973c742a1d810c460d895a93522d3308
Author: Justin Luth 
AuthorDate: Wed Dec 13 22:25:32 2023 -0500
Commit: Miklos Vajna 
CommitDate: Tue Dec 19 09:05:03 2023 +0100

related tdf#158586 RTF writerfilter: HAnchor's default is text, not margin

\phcol: Use the column as the horizontal reference frame.
This is the default if no horizontal reference frame is given.

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

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f760afd6cc23..dc4bca02d73b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3963,7 +3963,7 @@ RTFSprms RTFFrame::getSprms()
 case NS_ooxml::LN_CT_FramePr_hAnchor:
 {
 if (m_nHoriAnchor == 0)
-m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
+m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text;
 pValue = new RTFValue(m_nHoriAnchor);
 }
 break;


[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,
  

  1   2   3   4   5   6   7   8   9   >