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

2023-12-04 Thread Caolán McNamara (via logerrit)
 xmloff/source/forms/layerexport.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 325ec1c1060ba29b24eb1acbc5451bc972b484fc
Author: Caolán McNamara 
AuthorDate: Sun Dec 3 19:48:34 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 10:48:19 2023 +0100

cid#1546476 COPY_INSTEAD_OF_MOVE

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

diff --git a/xmloff/source/forms/layerexport.cxx 
b/xmloff/source/forms/layerexport.cxx
index a75bceada634..dac9297679ae 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -561,10 +561,8 @@ namespace xmloff
 
 // generate a new control id
 
-// find a free id
-OUString sCurrentId = lcl_findFreeControlId( m_aControlIds );
-// add it to the map
-m_aCurrentPageIds->second[ xColumnProperties ] = sCurrentId;
+// find a free id and add it to the map
+m_aCurrentPageIds->second[xColumnProperties] = 
lcl_findFreeControlId(m_aControlIds);
 
 // determine a number style, if needed
 xColumnPropertiesMeta = 
xColumnProperties->getPropertySetInfo();


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

2023-12-04 Thread Julien Nabet (via logerrit)
 xmloff/source/core/namespacemap.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 09200875ce643e66f293d39bb27630a3fdbb984d
Author: Julien Nabet 
AuthorDate: Sun Dec 3 20:50:50 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Dec 4 09:26:45 2023 +0100

cid#1546325, cid#1546212: invalid iterator (xmloff/namespacemap.cxx)

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

diff --git a/xmloff/source/core/namespacemap.cxx 
b/xmloff/source/core/namespacemap.cxx
index c64f28087f36..1d844fe04cd9 100644
--- a/xmloff/source/core/namespacemap.cxx
+++ b/xmloff/source/core/namespacemap.cxx
@@ -360,6 +360,7 @@ sal_uInt16 SvXMLNamespaceMap::GetFirstKey() const
 sal_uInt16 SvXMLNamespaceMap::GetNextKey( sal_uInt16 nLastKey ) const
 {
 auto aIter = maKeyToNamespaceMap.find ( nLastKey );
+assert(aIter != maKeyToNamespaceMap.end());
 return (++aIter == maKeyToNamespaceMap.end()) ? USHRT_MAX : (*aIter).first;
 }
 
@@ -378,6 +379,7 @@ sal_uInt16 SvXMLNamespaceMap::GetFirstIndex() const
 sal_uInt16 SvXMLNamespaceMap::GetNextIndex( sal_uInt16 nOldIdx ) const
 {
 auto aIter = maKeyToNamespaceMap.find ( nOldIdx );
+assert(aIter != maKeyToNamespaceMap.end());
 return (++aIter == maKeyToNamespaceMap.end()) ? USHRT_MAX : (*aIter).first;
 }
 


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

2023-12-02 Thread Tomaž Vajngerl (via logerrit)
 xmloff/source/text/XMLTextFrameContext.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 91b39a9dad0563726ea2100557e3c88c24be2e61
Author: Tomaž Vajngerl 
AuthorDate: Sat Dec 2 21:42:25 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Dec 2 13:44:38 2023 +0100

remove printf

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

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index 723a168a52b9..b00b2b84d90e 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1082,7 +1082,6 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 case XML_ELEMENT(DRAW, XML_MIME_TYPE):
 case XML_ELEMENT(LO_EXT, XML_MIME_TYPE):
 sMimeType = aIter.toString();
-printf ("MIME %s\n", sMimeType.toUtf8().getStr());
 break;
 case XML_ELEMENT(DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES):
 case XML_ELEMENT(DRAW, XML_NOTIFY_ON_UPDATE_OF_TABLE):


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

2023-12-01 Thread Andrea Gelmini (via logerrit)
 xmloff/source/draw/ximpshap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 86dc86ac25b24aab25ad9947014bed898b0d591c
Author: Andrea Gelmini 
AuthorDate: Fri Dec 1 12:12:00 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 1 17:04:36 2023 +0100

Fix typo

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 6cf226274115..3961c8d546f8 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1785,7 +1785,7 @@ bool lcl_IsLikelyOOXMLCurve(const basegfx::B2DPolygon& 
rPolygon)
 
 basegfx::B2DVector aStartVec(rPolygon.getNextControlPoint(0) - 
rPolygon.getB2DPoint(0));
 basegfx::B2DVector aEndVec(rPolygon.getPrevControlPoint(nCount-1) - 
rPolygon.getB2DPoint(nCount - 1));
-// LibreOffice uses one point less than OOXML for the same underlaying 
bentConnector or
+// LibreOffice uses one point less than OOXML for the same underlying 
bentConnector or
 // STANDARD connector, respectively. A deeper inspection is only needed in 
case of 2 resulting
 // points. Those connector paths look like a quarter ellipse.
 switch (nCount)


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

2023-11-29 Thread Eike Rathke (via logerrit)
 xmloff/source/core/xmluconv.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 0c3f57487c9cc29d172121b178938cdb2a8adc7b
Author: Eike Rathke 
AuthorDate: Wed Nov 29 19:11:22 2023 +0100
Commit: Eike Rathke 
CommitDate: Wed Nov 29 23:56:53 2023 +0100

Resolves: tdf#158265 Store more than 100th seconds precision in date+time

e.g. office:date-value

Change-Id: I9bb4b589cdb8c6f04fa39ba7ec4254207eaa3663
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160124
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index a95de5ecb66c..544bea50d3c5 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -61,7 +61,6 @@ using namespace ::com::sun::star::i18n;
 using namespace ::xmloff::token;
 
 
-const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
 constexpr OUStringLiteral XML_NULLDATE = u"NullDate";
 
 struct SvXMLUnitConverter::Impl
@@ -444,6 +443,16 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& 
rBuffer,
 else
 fCount = 0.0;
 const int nDigits = sal_Int16(fCount) + 4;  // +4 for *86400 in seconds
+
+// Since the beginning from initial source code import this was 11 without
+// further explanation, effectively limiting fractions in ~current
+// date+time to 2 decimals (maybe because old class Time code had a
+// resolution of only 100th seconds). Preserve at least milliseconds, but
+// strive for more.
+// NOTE: sax/source/tools/converter.cxx uses 14-5 in a different context
+// rounding nanoseconds and fractions of seconds.
+constexpr int XML_MAXDIGITSCOUNT_TIME = 14;
+
 const int nFractionDecimals = std::max( XML_MAXDIGITSCOUNT_TIME - nDigits, 
0);
 
 sal_uInt16 nHour, nMinute, nSecond;


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

2023-10-19 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/shapeimport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d8b7558d8a462649fa3b2df2748e92377917e3fd
Author: Noel Grandin 
AuthorDate: Thu Oct 19 12:07:26 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 19 16:03:34 2023 +0200

SAL_WARN->SAL_INFO in XMLShapeImportHelper::CreateGroupChildContext

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

diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index 5b0e6d101787..5186c8be2b47 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -341,7 +341,7 @@ SvXMLShapeContext* 
XMLShapeImportHelper::CreateGroupChildContext(
 return new SdXMLShapeLinkContext( rImport, xAttrList, rShapes );
 // add other shapes here...
 default:
-XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+XMLOFF_INFO_UNKNOWN_ELEMENT("xmloff", nElement);
 return new SvXMLShapeContext( rImport, bTemporaryShape );
 }
 


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

2023-09-10 Thread Noel Grandin (via logerrit)
 xmloff/source/core/PropertySetMerger.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit d6d0bd11ec38978156b9dbbda50bdddc9159e064
Author: Noel Grandin 
AuthorDate: Sat Sep 9 13:57:30 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 10 13:44:15 2023 +0200

PropertySetMergerImpl does not need to implement XAggreggation

Checked on jenkins using 'make check' and

+void SAL_CALL setDelegator(css::uno::Reference const 
&) final { assert(false); }

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

diff --git a/xmloff/source/core/PropertySetMerger.cxx 
b/xmloff/source/core/PropertySetMerger.cxx
index 7663aef638d3..65a936bb3d80 100644
--- a/xmloff/source/core/PropertySetMerger.cxx
+++ b/xmloff/source/core/PropertySetMerger.cxx
@@ -19,18 +19,17 @@
 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 
-#include 
-#include 
-
 namespace {
 
-class PropertySetMergerImpl : public ::cppu::WeakAggImplHelper3< XPropertySet, 
XPropertyState, XPropertySetInfo >
+class PropertySetMergerImpl : public ::cppu::WeakImplHelper< XPropertySet, 
XPropertyState, XPropertySetInfo >
 {
 private:
 Reference< XPropertySet > mxPropSet1;


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

2023-09-08 Thread Noel Grandin (via logerrit)
 xmloff/source/text/XMLIndexSimpleEntryContext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 425ca75d71497aebae5f5fdfdb20f65a6422a9d3
Author: Noel Grandin 
AuthorDate: Fri Sep 8 13:29:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 8 15:36:48 2023 +0200

WARN->INFO in XMLIndexSimpleEntryContext

This is not generally a problem

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

diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx 
b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx
index d8f2e79bc259..6c59f13380f3 100644
--- a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx
+++ b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx
@@ -75,7 +75,7 @@ void XMLIndexSimpleEntryContext::startFastElement(
 m_bCharStyleNameOK = false;
 }
 else
-XMLOFF_WARN_UNKNOWN("xmloff", aIter);
+XMLOFF_INFO_UNKNOWN("xmloff", aIter);
 }
 
 // if we have a style name, set it!


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

2023-09-07 Thread Andrea Gelmini (via logerrit)
 xmloff/source/draw/ximpshap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2b807baa2fd596ce4728cbc5ffbf8f8a50a60a54
Author: Andrea Gelmini 
AuthorDate: Thu Sep 7 08:45:29 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Sep 7 10:52:01 2023 +0200

Fix typo

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 7532b4320099..24475522f1e5 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1964,7 +1964,7 @@ void SdXMLConnectorShapeContext::startFastElement 
(sal_Int32 nElement,
 if ( bApplySVGD )
 {
 // tdf#83360 use path data only when redundant data of start and 
end point coordinates of
-// path start/end and connector start/end is equal. This is to 
avoid using erraneous
+// path start/end and connector start/end is equal. This is to 
avoid using erroneous
 // or inconsistent path data at import of foreign formats. Office 
itself always
 // writes out a consistent data set. Not using it when there is 
inconsistency
 // is okay since the path data is redundant, buffered data just to 
avoid recalculation


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

2023-09-07 Thread Andrea Gelmini (via logerrit)
 xmloff/source/draw/ximpshap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8658568f8c3946cf88af708928e092f7c5835b17
Author: Andrea Gelmini 
AuthorDate: Thu Sep 7 08:45:46 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Sep 7 10:50:22 2023 +0200

Fix typo

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index efc94e7c1c86..1dc5a2618d16 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2159,7 +2159,7 @@ void SdXMLPageShapeContext::startFastElement (sal_Int32 
nElement,
 // add, set style and properties from base shape
 
 // #86163# take into account which type of PageShape needs to
-// be constructed. It's a pres shape if presentation:XML_CLASS == XML_PAGE.
+// be constructed. It's a presentation shape if presentation:XML_CLASS == 
XML_PAGE.
 bool bIsPresentation = !maPresentationClass.isEmpty() &&
GetImport().GetShapeImport()->IsPresentationShapesSupported();
 


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

2023-09-06 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/ximpshap.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit fc3d33858629279f88717e3cec9b1761de890774
Author: Noel Grandin 
AuthorDate: Wed Sep 6 09:33:22 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 6 13:07:42 2023 +0200

improve debug logging in SdXMLShapeContext::AddShape

so we get source info for the exception

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index c64a80b756a1..6dea8cab5e2f 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -513,6 +513,7 @@ void SdXMLShapeContext::AddShape(OUString const & 
serviceName)
 }
 catch(const uno::Exception& e)
 {
+TOOLS_WARN_EXCEPTION("xmloff", "AddShape " << serviceName);
 uno::Sequence aSeq { serviceName };
 GetImport().SetError( XMLERROR_FLAG_ERROR | XMLERROR_API,
   aSeq, e.Message, nullptr );


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

2023-09-05 Thread Caolán McNamara (via logerrit)
 xmloff/source/core/xmlexp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 6d9b793512a60f18db624452d8773f0e52c00081
Author: Caolán McNamara 
AuthorDate: Tue Sep 5 15:21:59 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 5 21:39:43 2023 +0200

drop a stray printf

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index eb173fc4d98c..1f0f5a9780d8 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1070,7 +1070,6 @@ void SvXMLExport::ImplExportSettings()
 
 void SvXMLExport::ImplExportStyles()
 {
-printf ("SvXMLExport::ImplExportStyles\n");
 CheckAttrList();
 
 {


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

2023-06-20 Thread Stephan Bergmann (via logerrit)
 xmloff/source/text/txtparae.cxx |  200 
 1 file changed, 100 insertions(+), 100 deletions(-)

New commits:
commit 12364a7d4ca2f74f57d9a4f3a63ad4dfe8205bb6
Author: Stephan Bergmann 
AuthorDate: Tue Jun 20 09:20:12 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Jun 20 12:57:37 2023 +0200

XMLTextParagraphExport::DocumentListNodes must be a complete type

...at least when building with --with-latest-c++ against recent LLVM 17 
trunk
libc++,

> In file included from xmloff/source/text/txtparae.cxx:22:
> In file included from include/o3tl/any.hxx:21:
> In file included from include/com/sun/star/uno/Any.hxx:28:
> In file included from ~/llvm/inst/bin/../include/c++/v1/algorithm:1779:
> In file included from 
~/llvm/inst/bin/../include/c++/v1/__algorithm/inplace_merge.h:27:
> In file included from 
~/llvm/inst/bin/../include/c++/v1/__memory/uninitialized_buffer.h:14:
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: 
invalid application of 'sizeof' to an incomplete type 
'XMLTextParagraphExport::DocumentListNodes'
>63 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete 
type");
>   |   ^~~
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in 
instantiation of member function 
'std::default_delete::operator()' 
requested here
>   297 |   __ptr_.second()(__tmp);
>   |   ^
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in 
instantiation of member function 
'std::unique_ptr::reset' requested 
here
>   263 |   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 
~unique_ptr() { reset(); }
>   |   
^
> xmloff/source/text/txtparae.cxx:1333:25: note: in instantiation of member 
function 
'std::unique_ptr::~unique_ptr' 
requested here
>  1333 | XMLTextParagraphExport::XMLTextParagraphExport(
>   | ^
> include/xmloff/txtparae.hxx:115:12: note: forward declaration of 
'XMLTextParagraphExport::DocumentListNodes'
>   115 | struct DocumentListNodes;
>   |^

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

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 34e12aec02b2..6407e0248626 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1330,6 +1330,106 @@ struct XMLTextParagraphExport::Impl
 }
 };
 
+struct XMLTextParagraphExport::DocumentListNodes
+{
+struct NodeData
+{
+sal_Int32 index; // see SwNode::GetIndex and SwNodeOffset
+sal_uInt64 style_id; // actually a pointer to NumRule
+OUString list_id;
+};
+std::vector docListNodes;
+DocumentListNodes(const css::uno::Reference& xModel)
+{
+// Sequence of nodes, each of them represented by three-element 
sequence,
+// corresponding to NodeData members
+css::uno::Sequence> nodes;
+if (auto xPropSet = xModel.query())
+{
+try
+{
+// See SwXTextDocument::getPropertyValue
+xPropSet->getPropertyValue("ODFExport_ListNodes") >>= nodes;
+}
+catch (css::beans::UnknownPropertyException&)
+{
+// That's absolutely fine!
+}
+}
+
+docListNodes.reserve(nodes.getLength());
+for (const auto& node : nodes)
+{
+assert(node.getLength() == 3);
+docListNodes.push_back({ node[0].get(), 
node[1].get(),
+ node[2].get() });
+}
+
+std::sort(docListNodes.begin(), docListNodes.end(),
+  [](const NodeData& lhs, const NodeData& rhs) { return 
lhs.index < rhs.index; });
+}
+bool ShouldSkipListId(const Reference& xTextContent) const
+{
+if (docListNodes.empty())
+return false;
+
+if (auto xPropSet = xTextContent.query())
+{
+sal_Int32 index = 0;
+try
+{
+// See SwXParagraph::Impl::GetPropertyValues_Impl
+xPropSet->getPropertyValue("ODFExport_NodeIndex") >>= index;
+}
+catch (css::beans::UnknownPropertyException&)
+{
+// That's absolutely fine!
+return false;
+}
+
+auto it = std::lower_bound(docListNodes.begin(), 
docListNodes.end(), index,
+   [](const NodeData& lhs, sal_Int32 rhs)
+   { return lhs.index < rhs; });
+if (it == docListNodes.end() || it->index != index)
+return 

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

2023-05-31 Thread Andrea Gelmini (via logerrit)
 xmloff/source/style/GradientStyle.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c58ff5befa4c9704ab54f365811af4beeea384a8
Author: Andrea Gelmini 
AuthorDate: Wed May 31 19:26:21 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed May 31 21:03:54 2023 +0200

Fix typo

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

diff --git a/xmloff/source/style/GradientStyle.cxx 
b/xmloff/source/style/GradientStyle.cxx
index fb1fc68fb077..7598074fc409 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -231,7 +231,7 @@ void XMLGradientStyleExport::exportXML(
 // MCGR: For better compatibility with LO versions before MCGR, try
 // to re-create a 'border' value based on the existing gradient stops.
 // With MCGR we do not need 'border' anymore in quite some cases since
-// no Start/EndColor at 0.0 resp. 1.0 is explicitely needed. Since we
+// no Start/EndColor at 0.0 resp. 1.0 is explicitly needed. Since we
 // (unfortunately need to) internally continue to support border
 // anyways it does no harm to fallback to use the border value - if
 // there is an equivalent representation as this helper checks for.


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

2023-05-30 Thread Mike Kaganski (via logerrit)
 xmloff/source/text/txtparae.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d2c02a9aba3c05e4b3072596d2b3871b7fe67864
Author: Mike Kaganski 
AuthorDate: Tue May 30 13:25:24 2023 +0200
Commit: Mike Kaganski 
CommitDate: Tue May 30 15:58:49 2023 +0200

Fix wrong check

It was introduced in commit 286ba5b6ca60c7f67106059ea56721b86c36925b
(#79947#: Improve performance, 2001-11-01), and there the size of
xPropStates did not change when incrementing nIgnoreProps. But later
commit 8195d7061ed52ebb98f46d35fe5929762c71e4b3 (INTEGRATION: CWS
swautomatic01 (1.126.4); FILE MERGED, 2006-12-01) started to remove
the ignored items from xPropStates.

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

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index e5344665b5e6..2b3af03b93dd 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -691,7 +691,6 @@ void XMLTextParagraphExport::Add( XmlStyleFamily nFamily,
 
 Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
 OUString sParent, sCondParent;
-sal_uInt16 nIgnoreProps = 0;
 switch( nFamily )
 {
 case XmlStyleFamily::TEXT_PARAGRAPH:
@@ -744,6 +743,7 @@ void XMLTextParagraphExport::Add( XmlStyleFamily nFamily,
 {
 // Get parent and remove hyperlinks (they aren't of interest)
 rtl::Reference< XMLPropertySetMapper > 
xPM(xPropMapper->getPropertySetMapper());
+sal_uInt16 nIgnoreProps = 0;
 for( ::std::vector< XMLPropertyState >::iterator 
i(aPropStates.begin());
   nIgnoreProps < 2 && i != aPropStates.end(); )
 {
@@ -780,7 +780,7 @@ void XMLTextParagraphExport::Add( XmlStyleFamily nFamily,
 break;
 default: break;
 }
-if (aPropStates.size() - nIgnoreProps)
+if (aPropStates.size()) // could change after the previous check
 {
 GetAutoStylePool().Add( nFamily, sParent, std::vector(aPropStates), 
bDontSeek );
 if( !sCondParent.isEmpty() && sParent != sCondParent )


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

2023-05-18 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/chart/PropertyMaps.cxx   |  240 ++---
 xmloff/source/forms/elementexport.cxx  |   44 ++---
 xmloff/source/forms/property_meta_data.cxx |   19 --
 xmloff/source/style/xmlexppr.cxx   |   29 +--
 xmloff/source/transform/OOo2Oasis.cxx  |   58 +++
 xmloff/source/xforms/xformsapi.cxx |   25 +--
 xmloff/source/xforms/xformsexport.cxx  |  105 ++--
 7 files changed, 257 insertions(+), 263 deletions(-)

New commits:
commit 9ffaf2cbfb855390954380eb40ebd7415b26e067
Author: Vojtěch Doležal 
AuthorDate: Wed May 17 09:01:23 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 18 09:07:16 2023 +0200

Removed remaining macro concatenations from xmloff/

For PropertyMaps.cxx used:
(MAP_FULL\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF12\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF_EXT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF_EXT_IMPORT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_CONTEXT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL_ODF12\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL_ODF13\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_

For xmlexppr.cxx used:
ENTRY\( *([A-Za-z0-9_]+) *\) => { GET_PROP_TYPE(XML_TYPE_PROP_\1), 
XML_\1_PROPERTIES }

For OOo2Oasis.cxx used:
(OOO_IMPORTER\( *)([A-Za-z]+) => \1xmloff_\2_get_implementation

For xformsapi.cxx used:
TOKEN_MAP_ENTRY\( *([A-Za-z0-9"]+) *, *([A-Za-z0-9_]+) *\) => { 
XML_NAMESPACE_\1, xmloff::token::XML_\2, xmloff::token::XML_\2 }

For xformsexport.cxx used:
TABLE_ENTRY\( *([A-Za-z0-9"_]+) *, *([A-Za-z0-9"_]+) *, 
*([A-Za-z0-9"_]+) *, *([A-Za-z0-9"_]+) *\) => { \1, XML_NAMESPACE_\2, 
xmloff::token::XML_\3, \4 }

elementexport.cxx and property_meta_data.cxx done by hand.

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

diff --git a/xmloff/source/chart/PropertyMaps.cxx 
b/xmloff/source/chart/PropertyMaps.cxx
index ea40bd4c7e6b..964e317e780c 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -60,16 +60,16 @@ using namespace ::xmloff::token;
 using namespace css::chart2;
 
 
-#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, 
EarliestODFVersionForExport ) { ApiName, XML_NAMESPACE_##NameSpace, 
xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, 
EarliestODFVersionForExport, false }
-#define MAP_ENTRY( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_ENTRY_ODF12( a, ns, nm, t )  { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false 
}
+#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, 
EarliestODFVersionForExport ) { ApiName, NameSpace, 
xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, 
EarliestODFVersionForExport, false }
+#define MAP_ENTRY( a, ns, nm, t ){ a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false }
+#define MAP_ENTRY_ODF12( a, ns, nm, t )  { a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false }
 #define MAP_ENTRY_ODF13( a, ns, nm, t )  { a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_013, false }
-#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
-#define MAP_ENTRY_ODF_EXT_IMPORT( a, ns, nm, t ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
-#define MAP_CONTEXT( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_SPECIAL( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_010, false }
-#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_012, false }
-#define MAP_SPECIAL_ODF13( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_013, false }
+#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ){ a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
+#define 

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

2023-05-17 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/transform/OOo2Oasis.cxx| 1180 +++
 xmloff/source/transform/Oasis2OOo.cxx| 1045 +++
 xmloff/source/transform/StyleOOoTContext.cxx |   56 -
 3 files changed, 992 insertions(+), 1289 deletions(-)

New commits:
commit 24b15bc11b57aaeb3961b26ab636c3cf2d18fddc
Author: Vojtěch Doležal 
AuthorDate: Tue May 16 09:02:45 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 17 08:48:43 2023 +0200

Removed more constant concatenations

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

diff --git a/xmloff/source/transform/OOo2Oasis.cxx 
b/xmloff/source/transform/OOo2Oasis.cxx
index a11baa98a8e9..150de69aebc6 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -76,7 +76,7 @@ enum XMLUserDefinedTransformerAction
 }
 
 #define ENTRY3( n, l, a, p1, p2, p3 ) \
-{ XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
+{ n, l, a, p1, p2, p3 }
 #define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \
 ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
 XMLTransformerActionInit::QNameParam( n2, l2 ), p3 )
@@ -104,613 +104,447 @@ static constexpr sal_Int32 RENAME_ENTRY( XMLTokenEnum 
f, XMLTokenEnum s )
 XMLTransformerActionInit const aActionTable[] =
 {
 // remove office:class from  and 
-ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_STYLES, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_SETTINGS, XML_ETACTION_DOCUMENT ),
-ENTRY1Q( OFFICE, AUTO_TEXT_EVENTS, XML_ETACTION_DOCUMENT_RENAME,
-  XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT, XML_ETACTION_DOCUMENT ),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT 
),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_STYLES, XML_ETACTION_DOCUMENT 
),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_SETTINGS, 
XML_ETACTION_DOCUMENT ),
+ENTRY1Q( XML_NAMESPACE_OFFICE, XML_AUTO_TEXT_EVENTS, 
XML_ETACTION_DOCUMENT_RENAME, XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
 
 // remove 
-ENTRY0( META, KEYWORDS, XML_ETACTION_COPY_CONTENT ),
+ENTRY0( XML_NAMESPACE_META, XML_KEYWORDS, XML_ETACTION_COPY_CONTENT ),
 
 // rename  to 
-ENTRY1Q( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
+ENTRY1Q( XML_NAMESPACE_OFFICE, XML_SCRIPT, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
 
 // rename  to  and process attributes
-ENTRY2QN( OFFICE, SCRIPT_DATA, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OFFICE, XML_SCRIPT,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_OFFICE, XML_SCRIPT_DATA, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OFFICE, XML_SCRIPT, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to 
-ENTRY1Q( SCRIPT, LIBRARIES, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OOO, XML_LIBRARIES ),
+ENTRY1Q( XML_NAMESPACE_SCRIPT, XML_LIBRARIES, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OOO, XML_LIBRARIES ),
 
 // rename  to  and process 
attributes
-ENTRY2QN( SCRIPT, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_LIBRARY_LINKED,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_LIBRARY_LINKED, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_LIBRARY_LINKED, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to  and process 
attributes
-ENTRY2QN( SCRIPT, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_LIBRARY_EMBEDDED, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to  and process attributes
-ENTRY2QN( SCRIPT, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_MODULE,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_MODULE, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_MODULE, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to 
-ENTRY1Q( SCRIPT, SOURCE_CODE, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
+ENTRY1Q( XML_NAMESPACE_SCRIPT, XML_SOURCE_CODE, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
 
 // rename  to ,
 // rename  to , process attrs
-ENTRY1Q( OFFICE, FONT_DECLS, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS ),
-ENTRY2QN( STYLE, FONT_DECL, 

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

2023-05-16 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/text/txtprmap.cxx | 1163 
 1 file changed, 582 insertions(+), 581 deletions(-)

New commits:
commit 41d96a72fc0e0a9fa35b6ac88a389473f8baedaf
Author: Vojtěch Doležal 
AuthorDate: Mon May 15 23:31:29 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue May 16 12:17:37 2023 +0200

Removed constant concatenation macros from txtprmap.cxx

Removed concatenation from the macros, because due to them I wasn't able to 
find anything relevant with grep when searching for them.

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

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 5d8ef1d3471e..418d4e396ff2 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -33,13 +33,13 @@ using namespace ::com::sun::star::uno;
 using namespace ::xmloff::token;
 
 #define M_E_( a, p, l, t, c ) \
-{ a, XML_NAMESPACE_##p, XML_##l, t, c, SvtSaveOptions::ODFSVER_010, false }
+{ a, p, l, t, c, SvtSaveOptions::ODFSVER_010, false }
 
 #define M_EV_( a, p, l, t, c, v ) \
-{ a, XML_NAMESPACE_##p, XML_##l, t, c, v, false }
+{ a, p, l, t, c, v, false }
 
 #define M_ED_( a, p, l, t, c ) \
-{ a, XML_NAMESPACE_##p, XML_##l, (t) | MID_FLAG_DEFAULT_ITEM_EXPORT, c, 
SvtSaveOptions::ODFSVER_010, false }
+{ a, p, l, (t) | MID_FLAG_DEFAULT_ITEM_EXPORT, c, 
SvtSaveOptions::ODFSVER_010, false }
 
 // text properties
 #define MT_E( a, p, l, t, c ) \
@@ -90,7 +90,7 @@ using namespace ::xmloff::token;
 XMLPropertyMapEntry constexpr aXMLParaPropMap[] =
 {
 // RES_UNKNOWNATR_CONTAINER
-MP_E( PROP_ParaUserDefinedAttributes, TEXT, XMLNS, 
XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+MP_E( PROP_ParaUserDefinedAttributes,  XML_NAMESPACE_TEXT, XML_XMLNS, 
XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
 
 // fill attributes for paragraph backgrounds
 // #i125045# moved to the front to be able to exclude these in 
lcl_txtprmap_getMap
@@ -118,187 +118,187 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] =
 
 // RES_LR_SPACE
 // !!! DO NOT REORDER THE MARGINS !!!
-MP_E( PROP_ParaLeftMargin, FO, MARGIN, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ),
-MP_E( PROP_ParaLeftMarginRelative, FO, MARGIN, XML_TYPE_PERCENT16, 
CTF_PARAMARGINALL_REL ),
-MP_E( PROP_ParaLeftMargin, FO, MARGIN_LEFT,
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
-MP_E( PROP_ParaLeftMarginRelative, FO, MARGIN_LEFT,
XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
-MP_E( PROP_ParaRightMargin,FO, MARGIN_RIGHT,   
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
-MP_E( PROP_ParaRightMarginRelative,FO, MARGIN_RIGHT,   
XML_TYPE_PERCENT16, CTF_PARARIGHTMARGIN_REL ),
+MP_E( PROP_ParaLeftMargin,  XML_NAMESPACE_FO, XML_MARGIN,   
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ),
+MP_E( PROP_ParaLeftMarginRelative,  XML_NAMESPACE_FO, XML_MARGIN,   
XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ),
+MP_E( PROP_ParaLeftMargin,  XML_NAMESPACE_FO, XML_MARGIN_LEFT,  
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
+MP_E( PROP_ParaLeftMarginRelative,  XML_NAMESPACE_FO, XML_MARGIN_LEFT,  
XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
+MP_E( PROP_ParaRightMargin, XML_NAMESPACE_FO, XML_MARGIN_RIGHT, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
+MP_E( PROP_ParaRightMarginRelative, XML_NAMESPACE_FO, XML_MARGIN_RIGHT, 
XML_TYPE_PERCENT16, CTF_PARARIGHTMARGIN_REL ),
 // RES_UL_SPACE
-MP_E( PROP_ParaTopMargin,  FO, MARGIN_TOP, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARATOPMARGIN ),
-MP_E( PROP_ParaTopMarginRelative,  FO, MARGIN_TOP, 
XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
-MP_E( PROP_ParaBottomMargin,   FO, MARGIN_BOTTOM,  
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARABOTTOMMARGIN ),
-MP_E( PROP_ParaBottomMarginRelative,FO,MARGIN_BOTTOM,  
XML_TYPE_PERCENT16, CTF_PARABOTTOMMARGIN_REL ),
-MAP_ODF13( PROP_ParaContextMargin, XML_NAMESPACE_STYLE, 
XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ),// ODF 
1.3 OFFICE-3767 and was written by LO<=4.2
-MAP_ODF13( PROP_ParaContextMargin, XML_NAMESPACE_LO_EXT, 
XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // 
extension namespace
+MP_E( PROP_ParaTopMargin,XML_NAMESPACE_FO,XML_MARGIN_TOP,  
   XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARATOPMARGIN ),
+MP_E( PROP_ParaTopMarginRelative,XML_NAMESPACE_FO,XML_MARGIN_TOP,  
   XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
+MP_E( PROP_ParaBottomMargin, XML_NAMESPACE_FO,

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

2023-05-01 Thread Mike Kaganski (via logerrit)
 xmloff/source/style/xmlstyle.cxx |   65 +++
 1 file changed, 19 insertions(+), 46 deletions(-)

New commits:
commit 2059f242bd2d3e9cefa8cb38bcbef8cab120bab5
Author: Mike Kaganski 
AuthorDate: Mon May 1 14:49:05 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon May 1 15:02:22 2023 +0200

Simplify and unify a bit

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

diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index c72684102a5f..d0dc368870a2 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -67,6 +67,8 @@ using namespace ::xmloff::token;
 
 constexpr OUStringLiteral gsParaStyleServiceName( 
u"com.sun.star.style.ParagraphStyle" );
 constexpr OUStringLiteral gsTextStyleServiceName( 
u"com.sun.star.style.CharacterStyle" );
+constexpr OUStringLiteral gsParagraphStyles(u"ParagraphStyles");
+constexpr OUStringLiteral gsCharacterStyles(u"CharacterStyles");
 
 void SvXMLStyleContext::SetAttribute( sal_Int32 nElement,
   const OUString& rValue )
@@ -606,25 +608,19 @@ Reference < XAutoStyleFamily > 
SvXMLStylesContext::GetAutoStyles( XmlStyleFamily
 if( XmlStyleFamily::TEXT_TEXT == nFamily || XmlStyleFamily::TEXT_PARAGRAPH 
== nFamily)
 {
 bool bPara = XmlStyleFamily::TEXT_PARAGRAPH == nFamily;
-if( !bPara && mxTextAutoStyles.is() )
-xAutoStyles = mxTextAutoStyles;
-else if( bPara && mxParaAutoStyles.is() )
-xAutoStyles = mxParaAutoStyles;
-else
+const Reference& rxAutoStyles = bPara ? 
mxParaAutoStyles : mxTextAutoStyles;
+if (!rxAutoStyles)
 {
-OUString sName(bPara ? std::u16string_view( u"ParagraphStyles" ): 
std::u16string_view( u"CharacterStyles" ));
+OUString sName(bPara ? gsParagraphStyles : gsCharacterStyles);
 Reference< XAutoStylesSupplier > xAutoStylesSupp(   
GetImport().GetModel(), UNO_QUERY );
 Reference< XAutoStyles > xAutoStyleFamilies = 
xAutoStylesSupp->getAutoStyles();
 if (xAutoStyleFamilies->hasByName(sName))
 {
 Any aAny = xAutoStyleFamilies->getByName( sName );
-aAny >>= xAutoStyles;
-if( bPara )
-const_cast(this)->mxParaAutoStyles = 
xAutoStyles;
-else
-const_cast(this)->mxTextAutoStyles = 
xAutoStyles;
+aAny >>= 
const_cast&>(rxAutoStyles);
 }
 }
+xAutoStyles = rxAutoStyles;
 }
 return xAutoStyles;
 }
@@ -633,48 +629,25 @@ Reference < XNameContainer > 
SvXMLStylesContext::GetStylesContainer(
 XmlStyleFamily nFamily ) const
 {
 Reference < XNameContainer > xStyles;
-OUString sName;
-switch( nFamily )
+if (XmlStyleFamily::TEXT_TEXT == nFamily || XmlStyleFamily::TEXT_PARAGRAPH 
== nFamily)
 {
-case XmlStyleFamily::TEXT_PARAGRAPH:
-if( mxParaStyles.is() )
-xStyles = mxParaStyles;
-else
-sName = "ParagraphStyles";
-break;
-
-case XmlStyleFamily::TEXT_TEXT:
-if( mxTextStyles.is() )
-xStyles = mxTextStyles;
-else
-sName = "CharacterStyles";
-break;
-default: break;
-}
-if( !xStyles.is() && !sName.isEmpty() )
-{
-Reference< XStyleFamiliesSupplier > xFamiliesSupp(
-GetImport().GetModel(), UNO_QUERY );
-if ( xFamiliesSupp.is() )
+bool bPara = XmlStyleFamily::TEXT_PARAGRAPH == nFamily;
+const Reference& rxStyles = bPara ? mxParaStyles : 
mxTextStyles;
+if (!rxStyles)
 {
-Reference< XNameAccess > xFamilies = 
xFamiliesSupp->getStyleFamilies();
-if (xFamilies->hasByName(sName))
+OUString sName(bPara ? gsParagraphStyles : gsCharacterStyles);
+Reference 
xFamiliesSupp(GetImport().GetModel(), UNO_QUERY);
+if (xFamiliesSupp.is())
 {
-xStyles.set(xFamilies->getByName( sName ),uno::UNO_QUERY);
-
-switch( nFamily )
+Reference xFamilies = 
xFamiliesSupp->getStyleFamilies();
+if (xFamilies->hasByName(sName))
 {
-case XmlStyleFamily::TEXT_PARAGRAPH:
-const_cast(this)->mxParaStyles = 
xStyles;
-break;
-
-case XmlStyleFamily::TEXT_TEXT:
-const_cast(this)->mxTextStyles = 
xStyles;
-break;
-default: break;
+Any aAny = xFamilies->getByName(sName);
+aAny >>= const_cast&>(rxStyles);
 }
 }
 }
+xStyles = 

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

2023-04-21 Thread Gabor Kelemen (via logerrit)
 xmloff/source/chart/XMLChartStyleContext.cxx|1 -
 xmloff/source/core/DomBuilderContext.cxx|1 -
 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx  |1 -
 xmloff/source/draw/XMLImageMapContext.cxx   |1 -
 xmloff/source/draw/layerimp.cxx |1 -
 xmloff/source/draw/xexptran.cxx |2 --
 xmloff/source/forms/elementimport.cxx   |1 -
 xmloff/source/forms/officeforms.cxx |1 -
 xmloff/source/forms/propertyimport.cxx  |1 -
 xmloff/source/script/XMLEventImportHelper.cxx   |2 --
 xmloff/source/script/XMLEventsImportContext.cxx |1 -
 xmloff/source/style/PageHeaderFooterContext.cxx |1 -
 xmloff/source/style/XMLFootnoteSeparatorImport.cxx  |1 -
 xmloff/source/text/XMLAutoMarkFileContext.cxx   |2 --
 xmloff/source/text/XMLAutoTextContainerEventImport.cxx  |2 --
 xmloff/source/text/XMLAutoTextEventExport.cxx   |1 -
 xmloff/source/text/XMLAutoTextEventImport.cxx   |1 -
 xmloff/source/text/XMLChangeElementImportContext.cxx|2 --
 xmloff/source/text/XMLChangeImportContext.cxx   |2 --
 xmloff/source/text/XMLChangeInfoContext.cxx |1 -
 xmloff/source/text/XMLChangedRegionImportContext.cxx|1 -
 xmloff/source/text/XMLFootnoteBodyImportContext.cxx |1 -
 xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx|2 --
 xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx |1 -
 xmloff/source/text/XMLIndexBibliographyEntryContext.cxx |1 -
 xmloff/source/text/XMLIndexBibliographySourceContext.cxx|1 -
 xmloff/source/text/XMLIndexBodyContext.cxx  |1 -
 xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx  |1 -
 xmloff/source/text/XMLIndexIllustrationSourceContext.cxx|2 --
 xmloff/source/text/XMLIndexObjectSourceContext.cxx  |2 --
 xmloff/source/text/XMLIndexSimpleEntryContext.cxx   |2 --
 xmloff/source/text/XMLIndexSourceBaseContext.cxx|1 -
 xmloff/source/text/XMLIndexTOCContext.cxx   |1 -
 xmloff/source/text/XMLIndexTOCSourceContext.cxx |1 -
 xmloff/source/text/XMLIndexTOCStylesContext.cxx |1 -
 xmloff/source/text/XMLIndexTabStopEntryContext.cxx  |1 -
 xmloff/source/text/XMLIndexTableSourceContext.cxx   |1 -
 xmloff/source/text/XMLIndexTemplateContext.cxx  |1 -
 xmloff/source/text/XMLIndexTitleTemplateContext.cxx |2 --
 xmloff/source/text/XMLIndexUserSourceContext.cxx|2 --
 xmloff/source/text/XMLLineNumberingImportContext.cxx|1 -
 xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx   |2 --
 xmloff/source/text/XMLSectionFootnoteConfigImport.cxx   |1 -
 xmloff/source/text/XMLSectionImportContext.cxx  |1 -
 xmloff/source/text/XMLSectionSourceImportContext.cxx|1 -
 xmloff/source/text/XMLStringBufferImportContext.cxx |2 --
 xmloff/source/text/XMLTextMasterStylesContext.cxx   |1 -
 xmloff/source/text/XMLTrackedChangesImportContext.cxx   |1 -
 xmloff/source/xforms/XFormsInstanceContext.cxx  |1 -
 xmloff/source/xforms/XFormsSubmissionContext.cxx|1 -
 50 files changed, 64 deletions(-)

New commits:
commit 36db242816099bdc3ed2573df1230313056c552c
Author: Gabor Kelemen 
AuthorDate: Wed Apr 12 00:28:17 2023 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Apr 21 22:22:33 2023 +0200

Run clang-tidy with misc-unused-using-decls on module xmloff

To remove unneeded using declarations.

Via the simple script:

for i in $(find $dirname -name "*cxx" -o -name "*hxx" ); do
clang-tidy-12  --checks="-*,misc-unused-using-decls" "$i";
done

Change-Id: Iccae38de41c809b39345ec6b31c9f6346e620f53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150611
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx 
b/xmloff/source/chart/XMLChartStyleContext.cxx
index db30d22c96b3..fd8ff45d162e 100644
--- a/xmloff/source/chart/XMLChartStyleContext.cxx
+++ b/xmloff/source/chart/XMLChartStyleContext.cxx
@@ -32,7 +32,6 @@
 #include "XMLChartPropertyContext.hxx"
 
 using namespace com::sun::star;
-using ::xmloff::token::IsXMLToken;
 using ::xmloff::token::XML_DATA_STYLE_NAME;
 using ::xmloff::token::XML_PERCENTAGE_DATA_STYLE_NAME;
 using ::xmloff::token::XML_TEXT_PROPERTIES;
diff --git 

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

2023-04-18 Thread Caolán McNamara (via logerrit)
 xmloff/source/draw/ximpshap.cxx |   13 -
 xmloff/source/draw/ximpshap.hxx |2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit bafec47847a0b9697b3bbe9358e53f8118af3024
Author: Caolán McNamara 
AuthorDate: Mon Apr 17 16:53:44 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 18 21:53:35 2023 +0200

create the FloatingFrameShape in a separate step to inserting it

this is derived from the path taken by the AddShape(const OUString&)
function for this case. No change in behavior is intended.

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 5b671ab1caf4..552414b06c9a 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3133,10 +3133,21 @@ 
SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext()
 {
 }
 
+uno::Reference 
SdXMLFloatingFrameShapeContext::CreateFloatingFrameShape() const
+{
+uno::Reference 
xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
+if (!xServiceFact.is())
+return nullptr;
+uno::Reference xShape(
+xServiceFact->createInstance("com.sun.star.drawing.FrameShape"), 
uno::UNO_QUERY);
+return xShape;
+}
+
 void SdXMLFloatingFrameShapeContext::startFastElement (sal_Int32 /*nElement*/,
 const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
/*xAttrList*/)
 {
-AddShape("com.sun.star.drawing.FrameShape");
+uno::Reference 
xShape(SdXMLFloatingFrameShapeContext::CreateFloatingFrameShape());
+AddShape(xShape);
 
 if( !mxShape.is() )
 return;
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index 217c773c9785..64b28df579a0 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -528,6 +528,8 @@ private:
 OUString maFrameName;
 OUString maHref;
 
+css::uno::Reference CreateFloatingFrameShape() const;
+
 public:
 
 SdXMLFloatingFrameShapeContext( SvXMLImport& rImport,


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

2023-04-17 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/shapeexport.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 94e505b9ffbeb1695393d5dea0da84a0bf887fba
Author: Noel Grandin 
AuthorDate: Mon Apr 17 19:25:26 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 18 07:51:55 2023 +0200

no need to perform lookup twice in XMLShapeExport::seekShapes

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 056c3ce98267..94b7ad8e78a0 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1092,11 +1092,9 @@ void XMLShapeExport::seekShapes( const uno::Reference< 
drawing::XShapes >& xShap
 maCurrentShapesIter = maShapesInfos.find( xShapes );
 if( maCurrentShapesIter == maShapesInfos.end() )
 {
-ImplXMLShapeExportInfoVector aNewInfoVector;
-aNewInfoVector.resize( 
static_cast(xShapes->getCount()) );
-maShapesInfos[ xShapes ] = aNewInfoVector;
+auto itPair = maShapesInfos.emplace( xShapes, 
ImplXMLShapeExportInfoVector( 
static_cast(xShapes->getCount()) ) );
 
-maCurrentShapesIter = maShapesInfos.find( xShapes );
+maCurrentShapesIter = itPair.first;
 
 SAL_WARN_IF( maCurrentShapesIter == maShapesInfos.end(), "xmloff", 
"XMLShapeExport::seekShapes(): insert into stl::map failed" );
 }


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

2023-04-10 Thread Caolán McNamara (via logerrit)
 xmloff/source/style/XMLFontAutoStylePool.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c0400558ba9325bc19fd454bcb4b16498082842c
Author: Caolán McNamara 
AuthorDate: Mon Apr 10 10:38:32 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 10 13:16:06 2023 +0200

crashreporting: getUsedFontList() crash

e.g.

https://crashreport.libreoffice.org/stats/crash_details/3a3c07aa-0f96-4efa-b55b-c3fe4e4b6ed8

...
Crash Reason  EXCEPTION_ACCESS_VIOLATION_READ
Crash Address 0x0
...

  XMLFontAutoStylePool::getUsedFontList() 
xmloff\source\style\XMLFontAutoStylePool.cxx:334
  XMLFontAutoStylePool::exportXML()   
xmloff\source\style\XMLFontAutoStylePool.cxx:408

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

diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx 
b/xmloff/source/style/XMLFontAutoStylePool.cxx
index 0fbb57b78ec8..e86709b6cc3d 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -328,9 +328,9 @@ std::unordered_set 
XMLFontAutoStylePool::getUsedFontList()
 if (xStyle->isInUse())
 {
 uno::Reference 
xPropertySet(xStyle, UNO_QUERY);
-if (xPropertySet.is())
+uno::Reference 
xInfo(xPropertySet ? xPropertySet->getPropertySetInfo() : nullptr);
+if (xInfo)
 {
-uno::Reference 
xInfo(xPropertySet->getPropertySetInfo());
 if (m_bEmbedLatinScript && 
xInfo->hasPropertyByName("CharFontName"))
 {
 OUString sCharFontName;


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

2023-03-30 Thread Noel Grandin (via logerrit)
 xmloff/source/core/DomExport.cxx |   12 +--
 xmloff/source/core/namespacemap.cxx  |   29 ++-
 xmloff/source/core/xmlerror.cxx  |   43 ---
 xmloff/source/core/xmluconv.cxx  |6 -
 xmloff/source/draw/propimp0.cxx  |3 
 xmloff/source/draw/sdxmlexp.cxx  |9 --
 xmloff/source/meta/xmlmetae.cxx  |6 -
 xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx |3 
 xmloff/source/style/XMLClipPropertyHandler.cxx   |3 
 xmloff/source/style/bordrhdl.cxx |4 -
 xmloff/source/style/chrhghdl.cxx |3 
 xmloff/source/style/fonthdl.cxx  |5 -
 xmloff/source/style/impastpl.cxx |   40 --
 xmloff/source/style/xmlnumfe.cxx |   13 +--
 xmloff/source/text/XMLTextListAutoStylePool.cxx  |5 -
 xmloff/source/text/txtprhdl.cxx  |3 
 xmloff/source/transform/TransformerBase.cxx  |6 -
 17 files changed, 72 insertions(+), 121 deletions(-)

New commits:
commit 5988a3cf91e2cb5bf1628b88965e3652932e4eb6
Author: Noel Grandin 
AuthorDate: Thu Mar 30 10:57:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 30 13:53:28 2023 +

loplugin:stringadd in xmloff

when applying my upcoming patch to also consider O[U]StringBuffer

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

diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx
index 9d26d68b1cee..585c2b4572b4 100644
--- a/xmloff/source/core/DomExport.cxx
+++ b/xmloff/source/core/DomExport.cxx
@@ -128,7 +128,7 @@ class DomExport: public DomVisitor
 void pushNamespace();
 void addNamespace( const OUString& sPrefix, const OUString& sURI );
 OUString qualifiedName( const OUString& sPrefix, const OUString& sURI,
-std::u16string_view sLocalName );
+const OUString& sLocalName );
 OUString qualifiedName( const Reference&  );
 OUString qualifiedName( const Reference&  );
 void addAttribute( const Reference& );
@@ -181,17 +181,15 @@ void DomExport::addNamespace( const OUString& sPrefix, 
const OUString& sURI )
 
 OUString DomExport::qualifiedName( const OUString& sPrefix,
const OUString& sURI,
-   std::u16string_view sLocalName )
+   const OUString& sLocalName )
 {
-OUStringBuffer sBuffer;
 if( !sPrefix.isEmpty() && !sURI.isEmpty() )
 {
 addNamespace( sPrefix, sURI );
-sBuffer.append( sPrefix );
-sBuffer.append( ':' );
+return sPrefix + ":" + sLocalName;
 }
-sBuffer.append( sLocalName );
-return sBuffer.makeStringAndClear();
+else
+return sLocalName;
 }
 
 OUString DomExport::qualifiedName( const Reference& xElement )
diff --git a/xmloff/source/core/namespacemap.cxx 
b/xmloff/source/core/namespacemap.cxx
index 84668a612dfe..c64f28087f36 100644
--- a/xmloff/source/core/namespacemap.cxx
+++ b/xmloff/source/core/namespacemap.cxx
@@ -212,14 +212,10 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 
nKey,
 {
 // ...if it's in the xmlns namespace, make the prefix
 // don't bother caching this, it rarely happens
-OUStringBuffer sQName;
-sQName.append ( m_sXMLNS );
 if (!rLocalName.isEmpty()) // not default namespace
-{
-sQName.append ( ':' );
-sQName.append ( rLocalName );
-}
-return sQName.makeStringAndClear();
+return m_sXMLNS + ":" + rLocalName;
+else
+return m_sXMLNS;
 }
 case XML_NAMESPACE_XML:
 {
@@ -242,21 +238,14 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 
nKey,
 {
 // ...if it's in our map, make the prefix
 const OUString & prefix( (*aIter).second.sPrefix );
-OUStringBuffer sQName(prefix.getLength() + 1 + 
rLocalName.getLength());
+OUString sQName;
 if (!prefix.isEmpty()) // not default namespace
-{
-sQName.append( prefix );
-sQName.append( ':' );
-}
-sQName.append ( rLocalName );
-if (bCache)
-{
-OUString sString(sQName.makeStringAndClear());
-m_aQNameCache.emplace(QNamePair(nKey, rLocalName), 

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

2023-03-16 Thread Michael Stahl (via logerrit)
 xmloff/source/draw/shapeexport.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 9070c1b0404fb72d2553f6fa8f702e70c0abb269
Author: Michael Stahl 
AuthorDate: Tue Mar 14 18:24:30 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Mar 16 09:10:39 2023 +

xmloff: ODF export: produce alt text and description for MediaShape

... and others where it was inexplicably missing (PluginShape,
AppletShape, FrameShape).

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index f972c389a396..da9fe7f0e438 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3237,6 +3237,7 @@ void XMLShapeExport::ImpExportFrameShape(
 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, 
XML_FLOATING_FRAME, true, true);
 }
 
+ImpExportDescription(xShape);
 }
 
 void XMLShapeExport::ImpExportAppletShape(
@@ -3292,6 +3293,7 @@ void XMLShapeExport::ImpExportAppletShape(
 }
 }
 
+ImpExportDescription(xShape);
 }
 
 void XMLShapeExport::ImpExportPluginShape(
@@ -3338,6 +3340,7 @@ void XMLShapeExport::ImpExportPluginShape(
 }
 }
 
+ImpExportDescription(xShape);
 }
 
 static void lcl_CopyStream(
@@ -3581,6 +3584,8 @@ void XMLShapeExport::ImpExportMediaShape(
 // The media has a preview, export it.
 ExportGraphicPreview(xGraphic, mrExport, u"MediaPreview", u".png", 
"image/png");
 }
+
+ImpExportDescription(xShape);
 }
 
 void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< 
drawing::XShape >& xShape, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)


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

2023-03-10 Thread Miklos Vajna (via logerrit)
 xmloff/source/text/txtparae.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 656850deda2bd478b828a761d2231c65b1fa771e
Author: Miklos Vajna 
AuthorDate: Mon Mar 6 08:18:41 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Mar 10 11:50:17 2023 +

xmloff: fix -Wmaybe-uninitialized

In case operator >>=() of uno::Any fails, it leaves nTabIndex
uninitialized and it seems gcc notices this sometimes:

In file included from include/com/sun/star/uno/Any.h:30,
 from include/com/sun/star/uno/Any.hxx:35,
 from include/o3tl/any.hxx:21,
 from xmloff/source/text/txtparae.cxx:22:
include/rtl/ustring.hxx: In member function ‘void 
XMLTextParagraphExport::ExportContentControl(const 
com::sun::star::uno::Reference&, bool, 
bool, bool&)’:
include/rtl/ustring.hxx:3044:22: warning: ‘nTabIndex’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
 3044 | return number( static_cast< unsigned long long >( i ), 
radix );
  |
~~^
xmloff/source/text/txtparae.cxx:3999:20: note: ‘nTabIndex’ was declared here
 3999 | sal_uInt32 nTabIndex;
  |^

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

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index f9928e402295..a06e027c7190 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -4085,7 +4085,7 @@ void XMLTextParagraphExport::ExportContentControl(
 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_ID, 
OUString::number(nId));
 }
 
-sal_uInt32 nTabIndex;
+sal_uInt32 nTabIndex = 0;
 if ((xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex) && 
nTabIndex)
 {
 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_TAB_INDEX,


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

2023-01-23 Thread Michael Stahl (via logerrit)
 xmloff/source/style/styleexp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 09e3aaa2d22b8fe2887ae973b55f3ad274a960ee
Author: Michael Stahl 
AuthorDate: Mon Jan 23 15:50:57 2023 +0100
Commit: Michael Stahl 
CommitDate: Mon Jan 23 18:49:06 2023 +

xmloff: ODF export: missing extension check in XMLStyleExport

(regression from commit 05f863844d9a5613250e8d787e32752b270ec4d3)

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

diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 10ae6a22dcfa..b311dbdf6c34 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -244,7 +244,8 @@ bool XMLStyleExport::exportStyle(
 aAny = xPropSet->getPropertyValue("LinkStyle");
 OUString sLinkName;
 aAny >>= sLinkName;
-if (!sLinkName.isEmpty())
+if (!sLinkName.isEmpty()
+&& (GetExport().getSaneDefaultVersion() & 
SvtSaveOptions::ODFSVER_EXTENDED))
 {
 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, 
XML_LINKED_STYLE_NAME,
  GetExport().EncodeStyleName(sLinkName));


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

2023-01-02 Thread Caolán McNamara (via logerrit)
 xmloff/source/text/txtprmap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 54cb5990e694385dd269dc2e946c58d64390986a
Author: Caolán McNamara 
AuthorDate: Thu Dec 29 21:37:02 2022 +
Commit: Miklos Vajna 
CommitDate: Mon Jan 2 08:18:42 2023 +

tdf#150707 xmloff/source/style/xmlexppr.cxx:907: no prop type specified

warning seen on saving very simple writer document.

maybe since:

commit 91f649a119d4b7ece26f9737a38663664953a57a
Date:   Thu Dec 9 08:43:27 2021 +0100

ODP import/export: refer to theme from shape text color

Refer to the 12 pre-defined colors by name + don't write the attribute
for the case when there is no theme.

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

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 8385e678bfbe..527c63bbc1f0 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -139,7 +139,7 @@ XMLPropertyMapEntry const aXMLParaPropMap[] =
 MT_ED( PROP_CharColor, STYLE,  USE_WINDOW_FONT_COLOR,  
XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY,   0 ),
 MAP_EXT_I( PROP_CharTransparence, XML_NAMESPACE_DRAW, XML_OPACITY, 
XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0),
 MAP_EXT( PROP_CharTransparence, XML_NAMESPACE_LO_EXT, XML_OPACITY, 
XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0),
-MAP_EXT( PROP_CharColorTheme, XML_NAMESPACE_LO_EXT, XML_THEME_COLOR, 
XML_TYPE_THEME_COLOR, 0),
+MAP_EXT( PROP_CharColorTheme, XML_NAMESPACE_LO_EXT, XML_THEME_COLOR, 
XML_TYPE_THEME_COLOR | XML_TYPE_PROP_TEXT, 0),
 MAP_EXT( PROP_CharColorLumMod, XML_NAMESPACE_LO_EXT, XML_COLOR_LUM_MOD, 
XML_TYPE_PERCENT100 | XML_TYPE_PROP_TEXT, 0),
 MAP_EXT( PROP_CharColorLumOff, XML_NAMESPACE_LO_EXT, XML_COLOR_LUM_OFF, 
XML_TYPE_PERCENT100 | XML_TYPE_PROP_TEXT, 0),
 // RES_CHRATR_CONTOUR


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

2022-12-19 Thread Stephan Bergmann (via logerrit)
 xmloff/source/text/txtparae.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a0c6bc75628513f3c501321eea1458d77bacc36c
Author: Stephan Bergmann 
AuthorDate: Mon Dec 19 08:16:37 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 19 14:12:06 2022 +

-Werror=maybe-uninitialized

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

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 56e6c3737553..f0f6360b4904 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -4075,8 +4075,7 @@ void XMLTextParagraphExport::ExportContentControl(
 }
 
 sal_uInt32 nTabIndex;
-xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex;
-if (nTabIndex)
+if ((xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex) && 
nTabIndex)
 {
 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_TAB_INDEX,
  OUString::number(nTabIndex));


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

2022-12-08 Thread Caolán McNamara (via logerrit)
 xmloff/source/script/XMLEventImportHelper.cxx   |2 --
 xmloff/source/script/XMLScriptContextFactory.cxx|3 +++
 xmloff/source/script/XMLStarBasicContextFactory.cxx |3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 8a33bde5288a4a652de35846aa34354044b872c3
Author: Caolán McNamara 
AuthorDate: Thu Dec 8 16:25:24 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 8 19:45:00 2022 +

tdf#152266 only warn about script:event-listener with non-empty targets

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

diff --git a/xmloff/source/script/XMLEventImportHelper.cxx 
b/xmloff/source/script/XMLEventImportHelper.cxx
index aa409e77765d..aebfd13dc7ee 100644
--- a/xmloff/source/script/XMLEventImportHelper.cxx
+++ b/xmloff/source/script/XMLEventImportHelper.cxx
@@ -102,8 +102,6 @@ SvXMLImportContext* XMLEventImportHelper::CreateContext(
 const OUString& rXmlEventName,
 const OUString& rLanguage)
 {
-rImport.NotifyMacroEventRead();
-
 SvXMLImportContext* pContext = nullptr;
 
 // translate event name from xml to api
diff --git a/xmloff/source/script/XMLScriptContextFactory.cxx 
b/xmloff/source/script/XMLScriptContextFactory.cxx
index c5d7cb2d0d05..3ebc45c1c98a 100644
--- a/xmloff/source/script/XMLScriptContextFactory.cxx
+++ b/xmloff/source/script/XMLScriptContextFactory.cxx
@@ -53,6 +53,9 @@ SvXMLImportContext* XMLScriptContextFactory::CreateContext(
 // else: ignore
 }
 
+if (!sURLVal.isEmpty())
+rImport.NotifyMacroEventRead();
+
 Sequence aValues{ 
comphelper::makePropertyValue(gsEventType, OUString(gsScript)),
  comphelper::makePropertyValue(gsURL, 
sURLVal) };
 
diff --git a/xmloff/source/script/XMLStarBasicContextFactory.cxx 
b/xmloff/source/script/XMLStarBasicContextFactory.cxx
index e26198978596..bab59a0d7505 100644
--- a/xmloff/source/script/XMLStarBasicContextFactory.cxx
+++ b/xmloff/source/script/XMLStarBasicContextFactory.cxx
@@ -81,6 +81,9 @@ SvXMLImportContext* XMLStarBasicContextFactory::CreateContext(
 sMacroNameVal = sMacroNameVal.copy( rDoc.getLength()+1 );
 }
 
+if (!sMacroNameVal.isEmpty())
+rImport.NotifyMacroEventRead();
+
 Sequence aValues
 {
 comphelper::makePropertyValue(gsEventType, OUString(gsStarBasic)),


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

2022-11-07 Thread László Németh (via logerrit)
 xmloff/source/style/xmlnumfe.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0a93f33a2ec5bdbda446d35dfbeca1b7b8a3b8cb
Author: László Németh 
AuthorDate: Mon Nov 7 12:26:41 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 7 13:53:48 2022 +0100

xmloff: write transliteration-spellout only in extended ODF

Follow-up to commit 7c20c3c2a9fc85c66dad9d09908b257beeedd78d
"xmloff: ODF export: adapt all checks of ODFSVER_012 etc.".

Reported by Eike Rathke.

See also b7d53247eb2fab04f5f6d82d405f1ac0c73542b2
"tdf#115007 i18npool: add NatNum12 formats to locales" and
2a1d2d42af7f365330479f4032ddfdd9eeba7c1d
"tdf#115007 add NatNum12 number format list items, fix title case".

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

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index abf03285f818..a2938b1d998d 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1205,12 +1205,12 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 const bool bWriteSpellout = aAttr.Format.isEmpty();
 assert(bWriteSpellout); // mutually exclusive
 
-// Export only for 1.2 with extensions or 1.3 and later.
+// Export only for 1.2 and later with extensions
 SvtSaveOptions::ODFSaneDefaultVersion eVersion = 
rExport.getSaneDefaultVersion();
 // Also ensure that duplicated transliteration-language and
 // transliteration-country attributes never escape into the wild with
 // releases.
-if (eVersion > SvtSaveOptions::ODFSVER_012 && bWriteSpellout)
+if ( (eVersion & SvtSaveOptions::ODFSVER_EXTENDED) && bWriteSpellout )
 {
 /* FIXME-BCP47: ODF defines no transliteration-script or
  * transliteration-rfc-language-tag */


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

2022-10-28 Thread Armin Le Grand (allotropia) (via logerrit)
 xmloff/source/draw/shapeexport.cxx |   42 +
 1 file changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 470201f392a019ef6f2b9e70377e66e47e839494
Author: Armin Le Grand (allotropia) 
AuthorDate: Thu Oct 27 15:08:50 2022 +0200
Commit: Armin Le Grand 
CommitDate: Fri Oct 28 10:47:36 2022 +0200

tdf#145240 add flexibility to receiving PolyPolygons over UNO API

Make XMLShapeExport aware and use that PolyPolygons can be not
only in Bezier format, but also a sequence of Points

Change-Id: Ie00e87d35d4f8aa9d481b2800585c5a770bbbc0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141935
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index f975e4d1d1b2..f12958a9f650 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2321,37 +2321,35 @@ void XMLShapeExport::ImpExportPolygonShape(
 // prepare name (with most used)
 enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
 
-if(bBezier)
+uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
+basegfx::B2DPolyPolygon aPolyPolygon;
+
+// tdf#145240 the Any can contain PolyPolygonBezierCoords or 
PointSequenceSequence
+// (see OWN_ATTR_BASE_GEOMETRY in 
SvxShapePolyPolygon::getPropertyValueImpl),
+// so be more flexible in interpreting it. Try to access bezier first:
 {
-// get PolygonBezier
-uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
 auto pSourcePolyPolygon = 
o3tl::tryAccess(aAny);
+
 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
 {
-const basegfx::B2DPolyPolygon aPolyPolygon(
-basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
-*pSourcePolyPolygon));
+aPolyPolygon = 
basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*pSourcePolyPolygon);
+}
+}
 
-// complex polygon shape, write as svg:d
-const OUString aPolygonString(
-basegfx::utils::exportToSvgD(
-aPolyPolygon,
-true,   // bUseRelativeCoordinates
-false,  // bDetectQuadraticBeziers: not used in old, 
but maybe activated now
-true)); // bHandleRelativeNextPointCompatible
+// if received no data, try to access point sequence second:
+if(0 == aPolyPolygon.count())
+{
+auto pSourcePolyPolygon = 
o3tl::tryAccess(aAny);
 
-// write point array
-mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+if(pSourcePolyPolygon)
+{
+aPolyPolygon = 
basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*pSourcePolyPolygon);
 }
 }
-else
-{
-// get non-bezier polygon
-uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
-const basegfx::B2DPolyPolygon aPolyPolygon(
-
basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*o3tl::doAccess(aAny)));
 
-if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
+if(aPolyPolygon.count())
+{
+if(!bBezier && !aPolyPolygon.areControlPointsUsed() && 1 == 
aPolyPolygon.count())
 {
 // simple polygon shape, can be written as svg:points sequence
 const basegfx::B2DPolygon& aPolygon(aPolyPolygon.getB2DPolygon(0));


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

2022-09-27 Thread Caolán McNamara (via logerrit)
 xmloff/source/chart/SchXMLChartContext.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1f09bf7bee753d34953fcefd6e2ee05797bf4b0a
Author: Caolán McNamara 
AuthorDate: Tue Sep 27 14:47:25 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 27 17:47:41 2022 +0200

crashtesting: assert on converting ooo64499-3.sxc to ods

a problem since:

commit 776ea34deefe7bdce2fb8a06e5c55ef27ec87ea7
Date:   Wed Sep 21 11:09:46 2022 +0200

use more string_view in xmloff

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

diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx
index 2fe91b2026a1..7a8ac46c40a9 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -182,12 +182,12 @@ uno::Sequence< sal_Int32 > 
lcl_getNumberSequenceFromString( std::u16string_view
 while( nPos != std::u16string_view::npos )
 {
 nPos = rStr.find( aSpace, nLastPos );
-if( nPos > nLastPos )
-{
-aVec.push_back( o3tl::toInt32(rStr.substr( nLastPos, (nPos - 
nLastPos) )) );
-}
 if( nPos != std::u16string_view::npos )
+{
+if( nPos > nLastPos )
+aVec.push_back( o3tl::toInt32(rStr.substr( nLastPos, (nPos - 
nLastPos) )) );
 nLastPos = nPos + 1;
+}
 }
 // last entry
 if( nLastPos != 0 &&


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

2022-09-23 Thread Michael Stahl (via logerrit)
 xmloff/source/text/XMLTextMarkImportContext.cxx |2 -
 xmloff/source/text/txtimp.cxx   |   35 
 2 files changed, 7 insertions(+), 30 deletions(-)

New commits:
commit a0a529a131c61588cf865143d47cdc23961fd596
Author: Michael Stahl 
AuthorDate: Fri Sep 23 16:04:18 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Sep 23 21:34:59 2022 +0200

xmloff: ODF import: fix crash on fdo34997-1.odt

Clean up the redundant checks too, these are all called after first
checking hasCurrentFieldCtx().

(regression from 463178fef5c22f1a04d10e54491852d56e2038b0)

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

diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx 
b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 4e42899e709c..4a71194df23c 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -436,7 +436,7 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 
nElement)
 }
 case TypeFieldmarkEnd:
 {
-if (!m_rHelper.hasCurrentFieldSeparator())
+if (m_rHelper.hasCurrentFieldCtx() && 
!m_rHelper.hasCurrentFieldSeparator())
 {   // backward compat for old files without separator
 InsertFieldmark(GetImport(), m_rHelper, true);
 }
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 288ccf45dc9b..87fd2b91283a 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2127,49 +2127,26 @@ XMLTextImportHelper::popFieldCtx()
 void XMLTextImportHelper::addFieldParam( const OUString& name, const OUString& 
value )
 {
 assert(!m_xImpl->m_FieldStack.empty());
-if (!m_xImpl->m_FieldStack.empty()) {
-Impl::field_stack_item_t & FieldStackItem(m_xImpl->m_FieldStack.top());
-std::get<1>(FieldStackItem).emplace_back( name, value );
-}
+Impl::field_stack_item_t & FieldStackItem(m_xImpl->m_FieldStack.top());
+std::get<1>(FieldStackItem).emplace_back( name, value );
 }
 
 ::std::pair XMLTextImportHelper::getCurrentFieldType() 
const
 {
 assert(!m_xImpl->m_FieldStack.empty());
-if (!m_xImpl->m_FieldStack.empty())
-{
-return std::get<0>(m_xImpl->m_FieldStack.top());
-}
-else
-{
-return {};
-}
+return std::get<0>(m_xImpl->m_FieldStack.top());
 }
 
 uno::Reference XMLTextImportHelper::getCurrentFieldStart() 
const
 {
 assert(!m_xImpl->m_FieldStack.empty());
-if (!m_xImpl->m_FieldStack.empty())
-{
-return std::get<3>(m_xImpl->m_FieldStack.top());
-}
-else
-{
-return {};
-}
+return std::get<3>(m_xImpl->m_FieldStack.top());
 }
 
 bool XMLTextImportHelper::hasCurrentFieldSeparator() const
 {
 assert(!m_xImpl->m_FieldStack.empty());
-if (!m_xImpl->m_FieldStack.empty())
-{
-return std::get<2>(m_xImpl->m_FieldStack.top()).is();
-}
-else
-{
-return {};
-}
+return std::get<2>(m_xImpl->m_FieldStack.top()).is();
 }
 
 bool XMLTextImportHelper::hasCurrentFieldCtx() const
@@ -2180,7 +2157,7 @@ bool XMLTextImportHelper::hasCurrentFieldCtx() const
 void XMLTextImportHelper::setCurrentFieldParamsTo(css::uno::Reference< 
css::text::XFormField> const )
 {
 assert(!m_xImpl->m_FieldStack.empty());
-if (!m_xImpl->m_FieldStack.empty() && xFormField.is())
+if (xFormField.is())
 {
 FieldParamImporter(::get<1>(m_xImpl->m_FieldStack.top()),
 xFormField->getParameters()).Import();


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

2022-09-15 Thread Tomaž Vajngerl (via logerrit)
 xmloff/source/chart/SchXMLDataTableContext.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 47fe4927f01d7461f3a8f152895a75c98eae3e71
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 14 23:53:52 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 15 10:16:22 2022 +0200

remove accidental printf

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

diff --git a/xmloff/source/chart/SchXMLDataTableContext.cxx 
b/xmloff/source/chart/SchXMLDataTableContext.cxx
index 4271221ed71f..a9a26d2e1d3d 100644
--- a/xmloff/source/chart/SchXMLDataTableContext.cxx
+++ b/xmloff/source/chart/SchXMLDataTableContext.cxx
@@ -42,7 +42,6 @@ 
SchXMLDataTableContext::SchXMLDataTableContext(SchXMLImportHelper& rImpHelper, S
 void SchXMLDataTableContext::startFastElement(
 sal_Int32 /*nElement*/, const 
uno::Reference& xAttrList)
 {
-printf("SchXMLDataTableContext::startFastElement\n");
 auto xChartDocument = mrImportHelper.GetChartDocument();
 if (!xChartDocument.is())
 return;


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

2022-09-14 Thread Stephan Bergmann (via logerrit)
 xmloff/source/draw/shapeexport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f4f8f6ffd2f9c49e22a73dd15e9075617263f18e
Author: Stephan Bergmann 
AuthorDate: Wed Sep 14 16:15:04 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 14 19:35:34 2022 +0200

-Werror=maybe-uninitialized

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index a9f0291a53b8..14297f25a424 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -4960,7 +4960,7 @@ static void ImpExportEnhancedGeometry( SvXMLExport& 
rExport, const uno::Referenc
 {
 if (xPropSetInfo->hasPropertyByName(u"WritingMode"))
 {
-sal_Int16 nDirection;
+sal_Int16 nDirection = -1;
 xPropSet->getPropertyValue(u"WritingMode") >>= nDirection;
 if (nDirection == text::WritingMode2::TB_RL90)
 fTextRotateAngle -= 90;


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

2022-09-10 Thread Noel Grandin (via logerrit)
 xmloff/source/text/XMLTextFrameContext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b32c44f83ded245b0fc350aef350e1c55545e354
Author: Noel Grandin 
AuthorDate: Sat Sep 10 13:40:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 10 20:58:13 2022 +0200

WARN->INFO in XMLTextFrameContext_Impl

Unknown attributes are not really a problem.

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

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index e7ae0f092150..cc3603d6e67f 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1065,7 +1065,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 sTblName = aIter.toString();
 break;
 default:
-XMLOFF_WARN_UNKNOWN("xmloff", aIter);
+SAL_INFO("xmloff", "unknown attribute " << 
SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << " value=" << 
aIter.toString());
 }
 };
 


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

2022-09-06 Thread Caolán McNamara (via logerrit)
 xmloff/source/draw/ximpshap.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 46216a79f440dc972724bb243396b295267530ce
Author: Caolán McNamara 
AuthorDate: Tue Sep 6 11:38:55 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 6 17:52:31 2022 +0200

check impress/calc IFrame "FrameURL" target

similar to

commit c7450d0b9d02c64ae3da467d329040787039767e
Date:   Tue Aug 30 17:01:08 2022 +0100

check IFrame "FrameURL" target

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index af0bfc1a7ef0..94ac8532b6c9 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -90,6 +90,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -3151,6 +3152,9 @@ void SdXMLFloatingFrameShapeContext::startFastElement 
(sal_Int32 /*nElement*/,
 
 if( !maHref.isEmpty() )
 {
+if (INetURLObject(maHref).GetProtocol() == INetProtocol::Macro)
+GetImport().NotifyMacroEventRead();
+
 xProps->setPropertyValue("FrameURL", Any(maHref) );
 }
 }


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

2022-08-31 Thread Noel Grandin (via logerrit)
 xmloff/source/style/impastpl.cxx |   88 +--
 xmloff/source/style/impastpl.hxx |   14 ++
 2 files changed, 45 insertions(+), 57 deletions(-)

New commits:
commit 51103b8396c3a0c0dc34afcf3c11bd93e4342163
Author: Noel Grandin 
AuthorDate: Tue Aug 30 20:45:02 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 31 08:34:52 2022 +0200

flatten data structures in SvXMLAutoStylePoolP_Impl a little

set::set is already a node-based data structure, no need for
more indirection

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

diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index 40d65ed5dc8c..e103fc1c372a 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -257,14 +257,14 @@ struct ComparePartial
 const XMLAutoStyleFamily& rFamilyData;
 
 bool operator()(const vector< XMLPropertyState >& lhs,
-const std::unique_ptr& rhs) 
const
+const XMLAutoStylePoolProperties& rhs) const
 {
-return rFamilyData.mxMapper->LessPartial(lhs, rhs->GetProperties());
+return rFamilyData.mxMapper->LessPartial(lhs, rhs.GetProperties());
 }
-bool operator()(const std::unique_ptr& lhs,
+bool operator()(const XMLAutoStylePoolProperties& lhs,
 const vector< XMLPropertyState >& rhs ) const
 {
-return rFamilyData.mxMapper->LessPartial(lhs->GetProperties(), rhs);
+return rFamilyData.mxMapper->LessPartial(lhs.GetProperties(), rhs);
 }
 };
 
@@ -275,18 +275,17 @@ struct ComparePartial
 
 bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, vector< 
XMLPropertyState >&& rProperties, OUString& rName, bool bDontSeek )
 {
-XMLAutoStylePoolProperties *pProperties = nullptr;
+PropertiesListType::iterator pProperties = m_PropertiesList.end();;
 auto [itBegin, itEnd] = std::equal_range(m_PropertiesList.begin(), 
m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
 if (!bDontSeek)
 for (auto it = itBegin; it != itEnd; ++it)
-if (rFamilyData.mxMapper->Equals((*it)->GetProperties(), 
rProperties))
-pProperties = it->get();
+if (rFamilyData.mxMapper->Equals(it->GetProperties(), rProperties))
+pProperties = it;
 
 bool bAdded = false;
-if( bDontSeek || !pProperties )
+if( bDontSeek || pProperties == m_PropertiesList.end() )
 {
-pProperties = new XMLAutoStylePoolProperties( rFamilyData, 
std::move(rProperties), msParent );
-m_PropertiesList.insert(itBegin, 
std::unique_ptr(pProperties));
+pProperties = m_PropertiesList.emplace(itBegin, rFamilyData, 
std::move(rProperties), msParent);
 bAdded = true;
 }
 
@@ -308,11 +307,9 @@ bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& 
rFamilyData, vector<
 
 auto it = std::lower_bound(m_PropertiesList.begin(), 
m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
 
-std::unique_ptr pProperties(
-new XMLAutoStylePoolProperties(rFamilyData, std::move(rProperties), 
msParent));
+it = m_PropertiesList.emplace(it, rFamilyData, std::move(rProperties), 
msParent);
 // ignore the generated name
-pProperties->SetName( rName );
-m_PropertiesList.insert(it, std::move(pProperties));
+it->SetName( rName );
 return true;
 }
 
@@ -325,8 +322,8 @@ OUString XMLAutoStylePoolParent::Find( const 
XMLAutoStyleFamily& rFamilyData, co
 OUString sName;
 auto [itBegin,itEnd] = std::equal_range(m_PropertiesList.begin(), 
m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
 for (auto it = itBegin; it != itEnd; ++it)
-if (rFamilyData.mxMapper->Equals((*it)->GetProperties(), rProperties))
-sName = (*it)->GetName();
+if (rFamilyData.mxMapper->Equals(it->GetProperties(), rProperties))
+sName = it->GetName();
 
 return sName;
 }
@@ -374,15 +371,15 @@ void SvXMLAutoStylePoolP_Impl::AddFamily(
 {
 // FIXME: do we really intend to replace the previous nFamily
 // entry in this case ?
-SAL_WARN_IF( (*iter)->mxMapper != rMapper, "xmloff",
+SAL_WARN_IF( iter->mxMapper != rMapper, "xmloff",
  "Adding duplicate family " << rStrName <<
  " with mismatching mapper ! " <<
- typeid((*iter)->mxMapper.get()).name() << " " <<
+ typeid(iter->mxMapper.get()).name() << " " <<
  typeid(*rMapper).name() );
 }
 #endif
 
-m_FamilySet.insert(std::make_unique(nFamily, rStrName, 
rMapper, aPrefix, bAsFamily));
+m_FamilySet.emplace(nFamily, rStrName, rMapper, aPrefix, bAsFamily);
 }
 
 void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
@@ -392,7 +389,7 

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

2022-08-29 Thread Miklos Vajna (via logerrit)
 xmloff/source/draw/shapeexport.cxx |  188 +++--
 1 file changed, 78 insertions(+), 110 deletions(-)

New commits:
commit e268ac208d22aef687e99a625fc32e2a03a7b873
Author: Miklos Vajna 
AuthorDate: Mon Aug 29 13:37:52 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 29 14:24:00 2022 +0200

xmloff: extract ExportGraphicPreview() from ...

... XMLShapeExport::ImpExportTableShape(), this way
XMLShapeExport::ImpExportMediaShape() can reuse it.

Both write an XGraphic fallback, just the name template and the format
of the export result differ.

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 6931c5684642..c44349184770 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3364,6 +3364,82 @@ lcl_StoreMediaAndGetURL(SvXMLExport & rExport,
 }
 }
 
+namespace
+{
+void ExportGraphicPreview(const uno::Reference& xGraphic, 
SvXMLExport& rExport, const std::u16string_view& rPrefix, const 
std::u16string_view& rExtension, const OUString& rMimeType)
+{
+const bool bExportEmbedded(rExport.getExportFlags() & 
SvXMLExportFlags::EMBEDDED);
+
+if( xGraphic.is() ) try
+{
+uno::Reference< uno::XComponentContext > xContext = 
rExport.getComponentContext();
+
+uno::Reference< embed::XStorage > xPictureStorage;
+uno::Reference< embed::XStorage > xStorage;
+uno::Reference< io::XStream > xPictureStream;
+
+OUString sPictureName;
+if( bExportEmbedded )
+{
+xPictureStream.set( 
xContext->getServiceManager()->createInstanceWithContext( 
"com.sun.star.comp.MemoryStream", xContext), uno::UNO_QUERY_THROW );
+}
+else
+{
+xStorage.set( rExport.GetTargetStorage(), uno::UNO_SET_THROW );
+
+xPictureStorage.set( xStorage->openStorageElement( "Pictures" , 
::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
+
+sal_Int32 nIndex = 0;
+do
+{
+sPictureName = rPrefix + OUString::number( ++nIndex ) + 
rExtension;
+}
+while( xPictureStorage->hasByName( sPictureName ) );
+
+xPictureStream.set( xPictureStorage->openStreamElement( 
sPictureName, ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
+}
+
+uno::Reference< graphic::XGraphicProvider > xProvider( 
graphic::GraphicProvider::create(xContext) );
+uno::Sequence< beans::PropertyValue > aArgs{
+comphelper::makePropertyValue("MimeType", rMimeType ),
+comphelper::makePropertyValue("OutputStream", 
xPictureStream->getOutputStream())
+};
+xProvider->storeGraphic( xGraphic, aArgs );
+
+if( xPictureStorage.is() )
+{
+uno::Reference< embed::XTransactedObject > xTrans( 
xPictureStorage, uno::UNO_QUERY );
+if( xTrans.is() )
+xTrans->commit();
+}
+
+if( !bExportEmbedded )
+{
+OUString sURL = "Pictures/" + sPictureName;
+rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
+rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD 
);
+}
+
+SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_IMAGE, 
false, true );
+
+if( bExportEmbedded )
+{
+uno::Reference< io::XSeekableInputStream > xSeekable( 
xPictureStream, uno::UNO_QUERY_THROW );
+xSeekable->seek(0);
+
+XMLBase64Export aBase64Exp( rExport );
+aBase64Exp.exportOfficeBinaryDataElement( uno::Reference < 
io::XInputStream >( xPictureStream, uno::UNO_QUERY_THROW ) );
+}
+}
+catch( uno::Exception const & )
+{
+DBG_UNHANDLED_EXCEPTION("xmloff.draw");
+}
+}
+}
+
 void XMLShapeExport::ImpExportMediaShape(
 const uno::Reference< drawing::XShape >& xShape,
 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* 
pRefPoint)
@@ -3459,48 +3535,7 @@ void XMLShapeExport::ImpExportMediaShape(
 if (!aGraphic.IsNone())
 {
 // The media has a preview, export it.
-uno::Reference xPictureStorage;
-uno::Reference xStorage;
-uno::Reference xPictureStream;
-OUString sPictureName;
-xStorage.set(GetExport().GetTargetStorage(), uno::UNO_SET_THROW);
-xPictureStorage.set(
-xStorage->openStorageElement("Pictures", 
embed::ElementModes::READWRITE),
-uno::UNO_SET_THROW);
-sal_Int32 nIndex = 0;
-while (true)
-{
-

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

2022-08-18 Thread Caolán McNamara (via logerrit)
 xmloff/source/draw/shapeimport.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 292fd4d83bba706a10926465b390fa5bc0d4e1ce
Author: Caolán McNamara 
AuthorDate: Thu Aug 18 09:54:02 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 14:28:50 2022 +0200

cid#1509254 Uninitialized scalar variable

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

diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index f0e150910ae9..259348e44176 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -615,6 +615,7 @@ void ShapeGroupContext::popGroupAndPostProcess()
 
 // second add the already existing shapes in the unsorted list
 ZOrderHint aNewHint;
+aNewHint.pShape = nullptr;
 do
 {
 nCount--;


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

2022-08-03 Thread ehsan (via logerrit)
 xmloff/source/forms/elementexport.cxx |   46 +-
 1 file changed, 23 insertions(+), 23 deletions(-)

New commits:
commit e010a57ab2489464719fb73ad0aea6e4e4c60383
Author: ehsan 
AuthorDate: Fri Jul 1 21:24:56 2022 +0430
Commit: Hossein 
CommitDate: Wed Aug 3 13:08:43 2022 +0200

tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro

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

diff --git a/xmloff/source/forms/elementexport.cxx 
b/xmloff/source/forms/elementexport.cxx
index 5f283fa8b036..dd005e551ff6 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -509,11 +509,11 @@ namespace xmloff
 {
 PROPERTY_LABEL, PROPERTY_TITLE
 };
-OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) ==
-SAL_N_ELEMENTS(nStringPropertyAttributeIds),
+OSL_ENSURE( std::size(aStringPropertyNames) ==
+std::size(nStringPropertyAttributeIds),
 "OControlExport::exportCommonControlAttributes: 
somebody tampered with the maps (1)!");
 
-for (i=0; i 0
-static const sal_Int32 nIdCount = 
SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
-static const sal_Int32 nNameCount = 
SAL_N_ELEMENTS(pBooleanPropertyNames);
-static const sal_Int32 nFlagsCount = 
SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
+static const sal_Int32 nIdCount = 
std::size(nBooleanPropertyAttributeIds);
+static const sal_Int32 nNameCount = 
std::size(pBooleanPropertyNames);
+static const sal_Int32 nFlagsCount = 
std::size(nBooleanPropertyAttrFlags);
 OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
 "OControlExport::exportCommonControlAttributes: somebody 
tampered with the maps (2)!");
 #endif
-for (i=0; i 0
-static const sal_Int32 nIdCount = 
SAL_N_ELEMENTS(nIntegerPropertyAttributeIds);
-static const sal_Int32 nNameCount = 
SAL_N_ELEMENTS(pIntegerPropertyNames);
-static const sal_Int32 nDefaultCount = 
SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults);
+static const sal_Int32 nIdCount = 
std::size(nIntegerPropertyAttributeIds);
+static const sal_Int32 nNameCount = 
std::size(pIntegerPropertyNames);
+static const sal_Int32 nDefaultCount = 
std::size(nIntegerPropertyAttrDefaults);
 OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == 
nDefaultCount),
 "OControlExport::exportCommonControlAttributes: somebody 
tampered with the maps (3)!");
 #endif
-for (i=0; i 0
-static const sal_Int32 nNameCount = 
SAL_N_ELEMENTS(pBooleanPropertyNames);
+static const sal_Int32 nNameCount = 
std::size(pBooleanPropertyNames);
 OSL_ENSURE((nIdCount == nNameCount),
 "OControlExport::exportSpecialAttributes: somebody tampered 
with the maps (1)!");
 #endif
@@ -982,12 +982,12 @@ namespace xmloff
 10
 };
 
-static const sal_Int32 nIdCount = SAL_N_ELEMENTS( 
nIntegerPropertyAttributeIds );
+static const sal_Int32 nIdCount = std::size( 
nIntegerPropertyAttributeIds );
 #if OSL_DEBUG_LEVEL > 0
-static const sal_Int32 nNameCount = SAL_N_ELEMENTS( 
pIntegerPropertyNames );
+static const sal_Int32 nNameCount = std::size( 
pIntegerPropertyNames );
 OSL_ENSURE( ( nIdCount == nNameCount ),
 "OControlExport::exportSpecialAttributes: somebody tampered 
with the maps (2)!" );
-static const sal_Int32 nDefaultCount = SAL_N_ELEMENTS( 
nIntegerPropertyAttrDefaults );
+static const sal_Int32 nDefaultCount = std::size( 
nIntegerPropertyAttrDefaults );
 OSL_ENSURE( ( nIdCount == nDefaultCount ),
 "OControlExport::exportSpecialAttributes: somebody tampered 
with the maps (3)!" );
 #endif
@@ -1129,9 +1129,9 @@ namespace xmloff
 u"" PROPERTY_GROUP_NAME
 };
 
-static const sal_Int32 nIdCount = SAL_N_ELEMENTS( 
nStringPropertyAttributeIds );
+static const sal_Int32 nIdCount = std::size( 
nStringPropertyAttributeIds );
 #if OSL_DEBUG_LEVEL > 0
-static const sal_Int32 nNameCount = SAL_N_ELEMENTS( 
pStringPropertyNames );
+static const sal_Int32 nNameCount = std::size( 
pStringPropertyNames );
 OSL_ENSURE( ( nIdCount == nNameCount ),
 "OControlExport::exportSpecialAttributes: somebody tampered 
with the maps (2)!" );
 #endif
@@ -2050,9 +2050,9 @@ namespace xmloff
 {
 PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, 
PROPERTY_FILTER, 

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

2022-07-21 Thread Andrea Gelmini (via logerrit)
 xmloff/source/style/xmlimppr.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 1c50d7e229942aacdc9ece7f01f233510500c87e
Author: Andrea Gelmini 
AuthorDate: Wed Jul 13 13:46:43 2022 +0200
Commit: Julien Nabet 
CommitDate: Thu Jul 21 16:14:19 2022 +0200

Removed duplicated include

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

diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index f35a11983554..446c03872215 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -44,7 +44,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 using namespace ::com::sun::star::uno;


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

2022-07-13 Thread Mike Kaganski (via logerrit)
 xmloff/source/text/txtparae.cxx |   64 +---
 1 file changed, 22 insertions(+), 42 deletions(-)

New commits:
commit 454e182898cdf9c8a9ce1b575591910bbff3a762
Author: Mike Kaganski 
AuthorDate: Tue Jul 12 11:22:25 2022 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jul 13 09:54:03 2022 +0200

Simplify XMLTextParagraphExport::addHyperlinkAttributes

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

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 63232f8b2822..5b2cb233dd38 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3369,18 +3369,13 @@ bool XMLTextParagraphExport::addHyperlinkAttributes(
 const Reference< XPropertyState > & rPropState,
 const Reference< XPropertySetInfo > & rPropSetInfo )
 {
-bool bExport = false;
-OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName;
-bool bServerMap = false;
+OUString sHRef;
 
 if( rPropSetInfo->hasPropertyByName( gsHyperLinkURL ) &&
 ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
 rPropState->getPropertyState( gsHyperLinkURL ) ) )
 {
 rPropSet->getPropertyValue( gsHyperLinkURL ) >>= sHRef;
-
-if( !sHRef.isEmpty() )
-bExport = true;
 }
 
 if ( sHRef.isEmpty() )
@@ -3390,81 +3385,66 @@ bool XMLTextParagraphExport::addHyperlinkAttributes(
 return false;
 }
 
+GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
+GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF,
+ GetExport().GetRelativeReference(sHRef));
+
 if ( rPropSetInfo->hasPropertyByName( gsHyperLinkName )
  && ( !rPropState.is()
   || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( 
gsHyperLinkName ) ) )
 {
+OUString sName;
 rPropSet->getPropertyValue( gsHyperLinkName ) >>= sName;
 if( !sName.isEmpty() )
-bExport = true;
+GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sName);
 }
 
 if ( rPropSetInfo->hasPropertyByName( gsHyperLinkTarget )
  && ( !rPropState.is()
   || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( 
gsHyperLinkTarget ) ) )
 {
+OUString sTargetFrame;
 rPropSet->getPropertyValue( gsHyperLinkTarget ) >>= sTargetFrame;
 if( !sTargetFrame.isEmpty() )
-bExport = true;
+{
+GetExport().AddAttribute(XML_NAMESPACE_OFFICE, 
XML_TARGET_FRAME_NAME, sTargetFrame);
+enum XMLTokenEnum eTok = sTargetFrame == "_blank" ? XML_NEW : 
XML_REPLACE;
+GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, eTok);
+}
 }
 
 if ( rPropSetInfo->hasPropertyByName( gsServerMap )
  && ( !rPropState.is()
   || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( 
gsServerMap ) ) )
 {
-bServerMap = *o3tl::doAccess(rPropSet->getPropertyValue( 
gsServerMap ));
+bool bServerMap = *o3tl::doAccess(rPropSet->getPropertyValue( 
gsServerMap ));
 if ( bServerMap )
-bExport = true;
+GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_SERVER_MAP, 
XML_TRUE);
 }
 
 if ( rPropSetInfo->hasPropertyByName( gsUnvisitedCharStyleName )
  && ( !rPropState.is()
   || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( 
gsUnvisitedCharStyleName ) ) )
 {
+OUString sUStyleName;
 rPropSet->getPropertyValue( gsUnvisitedCharStyleName ) >>= sUStyleName;
 if( !sUStyleName.isEmpty() )
-bExport = true;
+GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName(sUStyleName));
 }
 
 if ( rPropSetInfo->hasPropertyByName( gsVisitedCharStyleName )
  && ( !rPropState.is()
   || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( 
gsVisitedCharStyleName ) ) )
 {
+OUString sVStyleName;
 rPropSet->getPropertyValue( gsVisitedCharStyleName ) >>= sVStyleName;
 if( !sVStyleName.isEmpty() )
-bExport = true;
-}
-
-if ( bExport )
-{
-GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
-GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, 
GetExport().GetRelativeReference( sHRef ) );
-
-if( !sName.isEmpty() )
-GetExport().AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME, sName );
-
-if( !sTargetFrame.isEmpty() )
-{
-GetExport().AddAttribute( XML_NAMESPACE_OFFICE,
-  XML_TARGET_FRAME_NAME, sTargetFrame );
-enum XMLTokenEnum eTok = sTargetFrame == "_blank" ? XML_NEW : 

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

2022-07-05 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/shapeimport.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit db63000ea7805ddd762521a7cf39de203dbe6c3f
Author: Noel Grandin 
AuthorDate: Tue Jul 5 10:24:38 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 5 11:51:32 2022 +0200

tdf#137544 reduce ref-counting traffic

we can store a direct pointer here, shaves 5% off load time

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

diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index 1a21953f39ff..538120d2bfaa 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -515,8 +515,9 @@ struct ZOrderHint
 {
 sal_Int32 nIs;
 sal_Int32 nShould;
-/// The hint is for this shape.
-uno::Reference xShape;
+/// The hint is for this shape. We don't use uno::Reference here to speed 
up
+/// some operations, and because this shape is always held by mxShapes
+drawing::XShape* pShape;
 
 bool operator<(const ZOrderHint& rComp) const { return nShould < 
rComp.nShould; }
 };
@@ -731,7 +732,7 @@ void XMLShapeImportHelper::shapeWithZIndexAdded( 
css::uno::Reference< css::drawi
 ZOrderHint aNewHint;
 aNewHint.nIs = mpImpl->mpGroupContext->mnCurrentZ++;
 aNewHint.nShould = nZIndex;
-aNewHint.xShape = xShape;
+aNewHint.pShape = xShape.get();
 
 if( nZIndex == -1 )
 {
@@ -749,7 +750,7 @@ void XMLShapeImportHelper::shapeRemoved(const 
uno::Reference& x
 {
 auto it = std::find_if(mpImpl->mpGroupContext->maZOrderList.begin(), 
mpImpl->mpGroupContext->maZOrderList.end(), [](const ZOrderHint& rHint)
 {
-return rHint.xShape == xShape;
+return rHint.pShape == xShape.get();
 });
 if (it == mpImpl->mpGroupContext->maZOrderList.end())
 // Part of the unsorted list, nothing to do.


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

2022-07-04 Thread Noel Grandin (via logerrit)
 xmloff/source/core/xmlimp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d30810b5a116816fe8a6d3341aa98e43adc56de2
Author: Noel Grandin 
AuthorDate: Mon Jul 4 14:08:53 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 4 15:37:36 2022 +0200

dont instantiate TextImport unless we need it

speeds up loading XColorList and related UI elements

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

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 3d9cb9f1edb1..873f557f8982 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -598,7 +598,8 @@ void SAL_CALL SvXMLImport::endDocument()
 //  #i9518# All the stuff that accesses the document has to be done here, 
not in the dtor,
 //  because the SvXMLImport dtor might not be called until after the 
document has been closed.
 
-GetTextImport()->MapCrossRefHeadingFieldsHorribly();
+if (mxTextImport)
+mxTextImport->MapCrossRefHeadingFieldsHorribly();
 
 if (mpImpl->mpRDFaHelper)
 {


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

2022-06-08 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfe.cxx |   31 +++
 1 file changed, 31 insertions(+)

New commits:
commit 33a8c4bd0e8533ab42894280e7e04c13a47aefa9
Author: Eike Rathke 
AuthorDate: Wed Jun 8 17:49:15 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Jun 8 20:49:53 2022 +0200

Related: tdf#149484 Write proper  with 

Change-Id: I46b7987dde25840ae0b6e5871b14e3806c6e4ac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135508
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 52b286dd50a9..82ed552dcbca 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1254,6 +1254,37 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 WriteBooleanElement_Impl();
 bAnyContent = true;
 }
+else if (eType == XML_BOOLEAN_STYLE)
+{
+//  may contain only  and
+//  elements.
+sal_uInt16 nPos = 0;
+bool bEnd = false;
+while (!bEnd)
+{
+const short nElemType = rFormat.GetNumForType( nPart, nPos );
+switch (nElemType)
+{
+case 0:
+bEnd = true;// end of format reached
+if (bHasText && sTextContent.isEmpty())
+bHasText = false;   // don't write trailing empty 
text
+break;
+case NF_SYMBOLTYPE_STRING:
+{
+const OUString* pElemStr = rFormat.GetNumForString( 
nPart, nPos );
+if (pElemStr)
+AddToTextElement_Impl( *pElemStr );
+}
+break;
+case NF_KEY_BOOLEAN:
+WriteBooleanElement_Impl();
+bAnyContent = true;
+break;
+}
+++nPos;
+}
+}
 else
 {
 //  first loop to collect attributes


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

2022-06-08 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfi.cxx |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 025231224b8b076e280235cd2b943addd2fb0755
Author: Eike Rathke 
AuthorDate: Wed Jun 8 17:47:19 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Jun 8 20:15:44 2022 +0200

Resolves: tdf#149484 Read and handle  in 

Change-Id: I1be5f2be908eb88aa4ef7436ea7c09f35b076acf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135507
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index e5e9a25828fa..46ee44b3080f 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -497,8 +497,11 @@ static bool lcl_ValidChar( sal_Unicode cChar, const 
SvXMLNumFormatContext& rPare
 }
 
 //  see ImpSvNumberformatScan::Next_Symbol
+
+// All format types except BOOLEAN may contain minus sign or delimiter.
 if ( cChar == '-' )
-return true;   // all format types may content minus sign or delimiter
+return nFormatType != SvXMLStylesTokens::BOOLEAN_STYLE;
+
 if ( ( cChar == ' ' ||
cChar == '/' ||
cChar == '.' ||
@@ -528,11 +531,13 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& 
rContent, const SvXMLNumForm
 {
 bool bQuote = true;
 sal_Int32 nLength = rContent.getLength();
+const SvXMLStylesTokens nFormatType = rParent.GetType();
 
-if ((nLength == 1 && lcl_ValidChar( rContent[0], rParent)) ||
-(nLength == 2 &&
- ((rContent[0] == ' ' && rContent[1] == '-') ||
-  (rContent[1] == ' ' && lcl_ValidChar( rContent[0], rParent)
+if (nFormatType != SvXMLStylesTokens::BOOLEAN_STYLE &&
+((nLength == 1 && lcl_ValidChar( rContent[0], rParent)) ||
+ (nLength == 2 &&
+  ((rContent[0] == ' ' && rContent[1] == '-') ||
+   (rContent[1] == ' ' && lcl_ValidChar( rContent[0], rParent))
 {
 //  Don't quote single separator characters like space or percent,
 //  or separator characters followed by space (used in date formats).
@@ -541,7 +546,7 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& 
rContent, const SvXMLNumForm
 //  the difference of quotes.
 bQuote = false;
 }
-else if ( rParent.GetType() == SvXMLStylesTokens::PERCENTAGE_STYLE && 
nLength > 1 )
+else if ( nFormatType == SvXMLStylesTokens::PERCENTAGE_STYLE && nLength > 
1 )
 {
 //  the percent character in percentage styles must be left out of 
quoting
 //  (one occurrence is enough even if there are several percent 
characters in the string)
@@ -907,7 +912,7 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
 }
 break;
 case SvXMLStyleTokens::Boolean:
-// ignored - only default boolean format is supported
+rParent.AddNfKeyword( NF_KEY_BOOLEAN );
 break;
 
 case SvXMLStyleTokens::Day:
@@ -1535,9 +1540,8 @@ sal_Int32 
SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter)
 nIndex = pFormatter->GetFormatIndex( NF_NUMBER_SYSTEM, nFormatLang 
);
 }
 
-//  boolean is always the builtin boolean format
-//  (no other boolean formats are implemented)
-if ( nType == SvXMLStylesTokens::BOOLEAN_STYLE )
+if ( nType == SvXMLStylesTokens::BOOLEAN_STYLE && !bHasExtraText &&
+aMyConditions.empty() && sFormat.toChar() != '[' )
 nIndex = pFormatter->GetFormatIndex( NF_BOOLEAN, nFormatLang );
 
 //  check for default date formats


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

2022-06-02 Thread Stephan Bergmann (via logerrit)
 xmloff/source/text/txtflde.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 875abc7774e5fb72bc764e0ae8004a85cc9dd14f
Author: Stephan Bergmann 
AuthorDate: Thu Jun 2 18:50:13 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 2 20:32:20 2022 +0200

Use o3tl::make_unsigned, length is known to be non-negative

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

diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index fb6cd419b923..242b641369c8 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2853,7 +2854,7 @@ void XMLTextFieldExport::ExplodeFieldMasterName(
 size_t nSeparator = sMasterName.find('.', nLength);
 
 // '.' found?
-if (static_cast(nSeparator) == nLength || nSeparator == 
std::u16string_view::npos) {
+if (nSeparator == o3tl::make_unsigned(nLength) || nSeparator == 
std::u16string_view::npos) {
 SAL_WARN("xmloff.text", "no field var name!");
 }
 else


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

2022-06-02 Thread Noel Grandin (via logerrit)
 xmloff/source/style/xmltabi.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b1a4d2a49a47cd8b457b8c704134c0f1beaa9210
Author: Noel Grandin 
AuthorDate: Thu Jun 2 13:33:06 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 2 15:37:59 2022 +0200

tdf#148846 TOC: Character fill for tabulation is wrong

regression from
commit 8e4453c2117b6c3bb15be6b949a0a8a43df66647
use more FastAttributeIter::toView

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

diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index 0c470a4891c7..601c3f5fd191 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -93,7 +93,7 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
 break;
 case XML_ELEMENT(STYLE, XML_CHAR):
 if( !aIter.isEmpty() )
-aTabStop.DecimalChar = aIter.toView()[0];
+aTabStop.DecimalChar = aIter.toString()[0];
 break;
 case XML_ELEMENT(STYLE, XML_LEADER_STYLE):
 if( IsXMLToken( aIter, XML_NONE ) )
@@ -105,7 +105,7 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
 break;
 case XML_ELEMENT(STYLE, XML_LEADER_TEXT):
 if( !aIter.isEmpty() )
-cTextFillChar = aIter.toView()[0];
+cTextFillChar = aIter.toString()[0];
 break;
 default:
 XMLOFF_WARN_UNKNOWN("xmloff", aIter);


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

2022-06-02 Thread Noel Grandin (via logerrit)
 xmloff/source/core/DocumentSettingsContext.cxx |6 --
 xmloff/source/core/XMLBase64ImportContext.cxx  |8 +---
 xmloff/source/draw/animationexport.cxx |   12 
 xmloff/source/draw/xexptran.cxx|5 ++---
 xmloff/source/draw/ximppage.cxx|4 ++--
 xmloff/source/meta/xmlmetai.cxx|2 +-
 xmloff/source/style/xmlnumfi.cxx   |   13 -
 xmloff/source/text/XMLChangeInfoContext.cxx|3 ++-
 xmloff/source/text/XMLTextFrameContext.cxx |6 --
 xmloff/source/text/txtfldi.cxx |4 ++--
 10 files changed, 38 insertions(+), 25 deletions(-)

New commits:
commit 733a6b4f8eac9d9b93d7ea9c605bebab9f5345dd
Author: Noel Grandin 
AuthorDate: Thu Jun 2 11:43:33 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 2 13:06:27 2022 +0200

elide some makeStringAndClear() class

when we are passing the result to a string_view, it is pointless.

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

diff --git a/xmloff/source/core/DocumentSettingsContext.cxx 
b/xmloff/source/core/DocumentSettingsContext.cxx
index bf3a8f7f6472..b21010b07c81 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -408,9 +409,10 @@ void XMLConfigItemContext::endFastElement(sal_Int32 )
 uno::Sequence aDecoded;
 if (IsXMLToken(msType, XML_BASE64BINARY))
 {
-OUString sChars = maCharBuffer.makeStringAndClear().trim();
-if( !sChars.isEmpty() )
+std::u16string_view sChars = o3tl::trim(maCharBuffer);
+if( !sChars.empty() )
 ::comphelper::Base64::decodeSomeChars( aDecoded, sChars );
+maCharBuffer.setLength(0);
 }
 else
 sValue = maCharBuffer.makeStringAndClear();
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx 
b/xmloff/source/core/XMLBase64ImportContext.cxx
index 301865a26c10..81d2498bbabd 100644
--- a/xmloff/source/core/XMLBase64ImportContext.cxx
+++ b/xmloff/source/core/XMLBase64ImportContext.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -43,13 +44,14 @@ XMLBase64ImportContext::~XMLBase64ImportContext()
 
 void XMLBase64ImportContext::endFastElement(sal_Int32 )
 {
-OUString sChars = maCharBuffer.makeStringAndClear().trim();
-if( !sChars.isEmpty() )
+std::u16string_view sChars = o3tl::trim(maCharBuffer);
+if( !sChars.empty() )
 {
-Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
+Sequence< sal_Int8 > aBuffer( (sChars.size() / 4) * 3 );
 ::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
 xOut->writeBytes( aBuffer );
 }
+maCharBuffer.setLength(0);
 xOut->closeOutput();
 }
 
diff --git a/xmloff/source/draw/animationexport.cxx 
b/xmloff/source/draw/animationexport.cxx
index 62781694e28f..2a48e16c34f5 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1485,7 +1485,8 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum 
eAttributeName, OUString
 if( !sTmp.isEmpty() )
 sTmp.append( ';' );
 convertValue( eAttributeName, sTmp2, *pAny );
-sTmp.append( sTmp2.makeStringAndClear() );
+sTmp.append( sTmp2 );
+sTmp2.setLength(0);
 }
 }
 else
@@ -1567,7 +1568,8 @@ void AnimationsExporterImpl::convertTiming( 
OUStringBuffer& sTmp, const Any& rVa
 if( !sTmp.isEmpty() )
 sTmp.append( ';' );
 convertTiming( sTmp2, *pAny );
-sTmp.append( sTmp2.makeStringAndClear() );
+sTmp.append( sTmp2 );
+sTmp2.setLength(0);
 }
 }
 else if( auto x = o3tl::tryAccess(rValue) )
@@ -1593,7 +1595,8 @@ void AnimationsExporterImpl::convertTiming( 
OUStringBuffer& sTmp, const Any& rVa
 
 SvXMLUnitConverter::convertEnum( sTmp2, pEvent->Trigger, 
aAnimations_EnumMap_EventTrigger );
 
-sTmp.append( sTmp2.makeStringAndClear() );
+sTmp.append( sTmp2 );
+sTmp2.setLength(0);
 }
 
 if( pEvent->Offset.hasValue() )
@@ -1603,7 +1606,8 @@ void AnimationsExporterImpl::convertTiming( 
OUStringBuffer& sTmp, const Any& rVa
 if( !sTmp.isEmpty() )
 sTmp.append( '+' );
 
-sTmp.append( sTmp2.makeStringAndClear() );
+sTmp.append( sTmp2 );
+sTmp2.setLength(0);
 }
 }
 else
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index c8e7f51bb403..776401fb2840 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -129,11 +129,10 @@ static double 

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

2022-05-28 Thread Michael Stahl (via logerrit)
 xmloff/source/text/XMLSectionFootnoteConfigImport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9896f330cdb3df67b74b16a2c2177a8505fd2485
Author: Michael Stahl 
AuthorDate: Fri May 27 21:34:57 2022 +0200
Commit: Michael Stahl 
CommitDate: Sat May 28 16:47:09 2022 +0200

tdf#145178 xmloff: ODF import: fix another bad attribute

...in XMLSectionFootnoteConfigImport.

(regression from commit 9814c1f2edf56ecc0f31001db9234ef335488879)

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

diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx 
b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
index ef408c0c13c8..0f4f51e1b4e3 100644
--- a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
@@ -113,7 +113,7 @@ void XMLSectionFootnoteConfigImport::startFastElement(
 bNumOwn = true;
 break;
 }
-case XML_ELEMENT(TEXT, XML_NUM_LETTER_SYNC):
+case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
 {
 sNumLetterSync = aIter.toString();
 bNumOwn = true;


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

2022-05-27 Thread Louis Possoz (via logerrit)
 xmloff/source/text/XMLSectionFootnoteConfigImport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bbec710bd25fc5da27636cde73fe4ab23c76904f
Author: Louis Possoz 
AuthorDate: Sat Apr 30 06:39:38 2022 +0100
Commit: Michael Stahl 
CommitDate: Fri May 27 21:11:27 2022 +0200

tdf#145178 Formats in section Foot/Endnotes not read from saved files

Imported, 'num-suffix' & 'num-format' properties generate debug warnings:

warn:xmloff:10220:10220:xmloff/source/text/
   XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis
   :names:tc:opendocument:xmlns:style:1.0 style:num-suffix value=]]
warn:xmloff:10220:10220:xmloff/source/text/
   XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis
   :names:tc:opendocument:xmlns:style:1.0 style:num-format value=One

The faulty code is within XMLSectionFootnoteConfigImport::startFastElement()

The namespace for these two properties must be set to 'STYLE'
   (it is wrongly set to 'TEXT')

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

diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx 
b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
index fcdbf2221b5a..ef408c0c13c8 100644
--- a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
@@ -101,13 +101,13 @@ void XMLSectionFootnoteConfigImport::startFastElement(
 bNumOwn = true;
 break;
 }
-case XML_ELEMENT(TEXT, XML_NUM_SUFFIX):
+case XML_ELEMENT(STYLE, XML_NUM_SUFFIX):
 {
 sNumSuffix = aIter.toString();
 bNumOwn = true;
 break;
 }
-case XML_ELEMENT(TEXT, XML_NUM_FORMAT):
+case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
 {
 sNumFormat = aIter.toString();
 bNumOwn = true;


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

2022-05-14 Thread Noel Grandin (via logerrit)
 xmloff/source/core/xmlexp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 094b003268423a62cce9619a78caa82c59c7bbb8
Author: Noel Grandin 
AuthorDate: Fri May 13 11:10:12 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 14 13:46:35 2022 +0200

elide some OUString construction in GetViewSettingsAndViews

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index f8e72d6fb3f3..5235226ac81f 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1725,7 +1725,8 @@ void 
SvXMLExport::GetViewSettingsAndViews(uno::Sequence& r
 xViewDataSupplier->setViewData( xIndexAccess ); // make sure we get a 
newly created sequence
 {
 // tdf#130559: don't export preview view data if active
-css::uno::ContextLayer 
layer(comphelper::NewFlagContext("NoPreviewData"));
+static constexpr OUStringLiteral sNoPreviewData = u"NoPreviewData";
+css::uno::ContextLayer 
layer(comphelper::NewFlagContext(sNoPreviewData));
 xIndexAccess = xViewDataSupplier->getViewData();
 }
 bool bAdd = false;


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

2022-05-14 Thread Noel Grandin (via logerrit)
 xmloff/source/core/xmlexp.cxx |   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 39acaf84f9b23442e1333db7d213100c6997ffe6
Author: Noel Grandin 
AuthorDate: Thu May 12 20:24:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 14 08:40:00 2022 +0200

elide temporary OUString in SvXMLExport::initialize

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 7c2291156852..f8e72d6fb3f3 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -699,27 +699,26 @@ void SAL_CALL SvXMLExport::initialize( const 
uno::Sequence< uno::Any >& aArgumen
 
 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
 mxExportInfo->getPropertySetInfo();
-OUString sPropName(
-"BaseURI"  );
-if( xPropertySetInfo->hasPropertyByName(sPropName) )
+static constexpr OUStringLiteral sBaseURI = u"BaseURI";
+if( xPropertySetInfo->hasPropertyByName(sBaseURI) )
 {
-uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+uno::Any aAny = mxExportInfo->getPropertyValue(sBaseURI);
 aAny >>= msOrigFileName;
 mpImpl->msPackageURI = msOrigFileName;
 mpImpl->SetSchemeOf( msOrigFileName );
 }
 OUString sRelPath;
-sPropName = "StreamRelPath";
-if( xPropertySetInfo->hasPropertyByName(sPropName) )
+static constexpr OUStringLiteral sStreamRelPath = u"StreamRelPath";
+if( xPropertySetInfo->hasPropertyByName(sStreamRelPath) )
 {
-uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+uno::Any aAny = mxExportInfo->getPropertyValue(sStreamRelPath);
 aAny >>= sRelPath;
 }
 OUString sName;
-sPropName = "StreamName";
-if( xPropertySetInfo->hasPropertyByName(sPropName) )
+static constexpr OUStringLiteral sStreamName = u"StreamName";
+if( xPropertySetInfo->hasPropertyByName(sStreamName) )
 {
-uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+uno::Any aAny = mxExportInfo->getPropertyValue(sStreamName);
 aAny >>= sName;
 }
 if( !msOrigFileName.isEmpty() && !sName.isEmpty() )


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

2022-05-13 Thread Noel Grandin (via logerrit)
 xmloff/source/core/namespacemap.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 09e0cfd9b3e391435c39d3bc933d26a87e2b082e
Author: Noel Grandin 
AuthorDate: Wed May 11 19:14:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri May 13 08:41:45 2022 +0200

reserve space in map in SvXMLNamespaceMap

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

diff --git a/xmloff/source/core/namespacemap.cxx 
b/xmloff/source/core/namespacemap.cxx
index e6e2a68a84c9..9fdce6e3cc16 100644
--- a/xmloff/source/core/namespacemap.cxx
+++ b/xmloff/source/core/namespacemap.cxx
@@ -52,6 +52,9 @@ const OUString sEmpty;
 SvXMLNamespaceMap::SvXMLNamespaceMap()
 : sXMLNS( GetXMLToken ( XML_XMLNS ) )
 {
+// approx worst-case size
+aNameHash.reserve(20);
+aNameMap.reserve(20);
 }
 
 SvXMLNamespaceMap::SvXMLNamespaceMap( const SvXMLNamespaceMap& rMap )


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

2022-04-25 Thread Julien Nabet (via logerrit)
 xmloff/source/draw/shapeexport.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit fd4410aa5fd079e4277297f1fb70ad8c728e7a17
Author: Julien Nabet 
AuthorDate: Thu Apr 21 18:06:57 2022 +0200
Commit: Julien Nabet 
CommitDate: Mon Apr 25 18:30:26 2022 +0200

tdf#145240: Can't save drawing if I'm adding a short freeform line with no 
fill

Here are the steps of the dup tdf#148693:
1. Open a new sheet in LibreOffice Draw
2. Select the tool Shape/Insert/Curves and Polygons
3. Draw a short line (I mean very short)
4. Click "File" > "Save" and select a random place to save

=>
1  0x7fcd3c774fcb in 
o3tl::doAccess(com::sun::star::uno::Any
 const&) (any=
  uno::Any("[][]com.sun.star.awt.Point": uno::Sequence of length 1 = 
{uno::Sequence of length 2 = {{X = 0, Y = 0}, {X = 252, Y = 0}}})) at 
include/o3tl/any.hxx:284
2  0x7fcd3c74f759 in 
XMLShapeExport::ImpExportPolygonShape(com::sun::star::uno::Reference
 const&, XmlShapeType, XMLShapeExportFlags, com::sun::star::awt::Point*)
(this=0x8770560, xShape=uno::Reference to (SvxShapePolyPolygon *) 
0x7bcb3a8, eShapeType=XmlShapeTypeDrawOpenBezierShape, nFeatures=15, 
pRefPoint=0x0) at xmloff/source/draw/shapeexport.cxx:2342
3  0x7fcd3c74d952 in 
XMLShapeExport::exportShape(com::sun::star::uno::Reference
 const&, XMLShapeExportFlags, com::sun::star::awt::Point*, SvXMLAttributeList*)
(this=0x8770560, xShape=uno::Reference to (SvxShapePolyPolygon *) 
0x7bcb3a8, nFeatures=15, pRefPoint=0x0, pAttrList=0x0) at 
xmloff/source/draw/shapeexport.cxx:811
4  0x7fcd3c75cca1 in 
XMLShapeExport::exportShapes(com::sun::star::uno::Reference
 const&, XMLShapeExportFlags, com::sun::star::awt::Point*)
(this=0x8770560, xShapes=uno::Reference to (SdDrawPage *) 0x2d6b258, 
nFeatures=15, pRefPoint=0x0) at xmloff/source/draw/shapeexport.cxx:1006

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 55de243f07aa..9b069a07eb2c 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2338,11 +2338,13 @@ void XMLShapeExport::ImpExportPolygonShape(
 {
 // get PolygonBezier
 uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
-const basegfx::B2DPolyPolygon aPolyPolygon(
-
basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doAccess(aAny)));
-
-if(aPolyPolygon.count())
+auto pSourcePolyPolygon = 
o3tl::tryAccess(aAny);
+if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
 {
+const basegfx::B2DPolyPolygon aPolyPolygon(
+basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+*pSourcePolyPolygon));
+
 // complex polygon shape, write as svg:d
 const OUString aPolygonString(
 basegfx::utils::exportToSvgD(


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

2022-04-04 Thread Michael Stahl (via logerrit)
 xmloff/source/text/XMLTextShapeImportHelper.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit b812150696c574aea0a173d11f178e8d458b1a3e
Author: Michael Stahl 
AuthorDate: Mon Apr 4 20:29:07 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon Apr 4 20:30:18 2022 +0200

oops, forgot to fix the comment

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

diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx 
b/xmloff/source/text/XMLTextShapeImportHelper.cxx
index 1c567b689632..f4a62f4ad9b7 100644
--- a/xmloff/source/text/XMLTextShapeImportHelper.cxx
+++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx
@@ -119,8 +119,7 @@ void XMLTextShapeImportHelper::addShape(
 // anchor type
 xPropSet->setPropertyValue( gsAnchorType, Any(eAnchorType) );
 
-// page number (must be set after the frame is inserted, because it
-// will be overwritten then inserting the frame.
+// page number must be set before the frame is inserted
 switch( eAnchorType )
 {
 case TextContentAnchorType_AT_PAGE:


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

2022-03-15 Thread Caolán McNamara (via logerrit)
 xmloff/source/style/GradientStyle.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fc42d1159f390a99d886ea0f82d268613ac22e2f
Author: Caolán McNamara 
AuthorDate: Tue Mar 15 13:52:30 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 15 16:39:31 2022 +0100

ofz: Use-of-uninitialized-value

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

diff --git a/xmloff/source/style/GradientStyle.cxx 
b/xmloff/source/style/GradientStyle.cxx
index 7626db9db8ce..f3fbfb01ec24 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -78,7 +78,7 @@ void XMLGradientStyleImport::importXML(
 
 for (auto  : sax_fastparser::castToFastAttributeList( xAttrList ))
 {
-sal_Int32 nTmpValue;
+sal_Int32 nTmpValue(0);
 
 switch( aIter.getToken() )
 {


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

2022-03-14 Thread Julien Nabet (via logerrit)
 xmloff/source/core/xmlimp.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9aae749e99a92e6622fe18539e186e5cb07fa721
Author: Julien Nabet 
AuthorDate: Mon Mar 14 20:25:42 2022 +0100
Commit: Julien Nabet 
CommitDate: Mon Mar 14 21:48:09 2022 +0100

Return early if empty ref (xmloff/xmlimp)

+ fix a comment, the function uses "bool" not old "sal_Bool"

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

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 9c68c2be6da1..a710e87b3bb7 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1627,7 +1627,7 @@ OUString SvXMLImport::GetAbsoluteReference(const 
OUString& rValue) const
 
 bool SvXMLImport::IsODFVersionConsistent( const OUString& aODFVersion )
 {
-// the check returns sal_False only if the storage version could be 
retrieved
+// the check returns false only if the storage version could be retrieved
 bool bResult = true;
 
 if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 
0 )
@@ -1637,6 +1637,8 @@ bool SvXMLImport::IsODFVersionConsistent( const OUString& 
aODFVersion )
 try
 {   // don't use getDocumentStorage(), it's temporary and latest 
version
 uno::Reference const xStor(GetSourceStorage());
+if (!xStor.is())
+return bResult;
 uno::Reference< beans::XPropertySet > xStorProps( xStor, 
uno::UNO_QUERY_THROW );
 
 // the check should be done only for OASIS format


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

2022-03-13 Thread Caolán McNamara (via logerrit)
 xmloff/source/style/GradientStyle.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit e4bc01d9f57d47d943ff1910e42abda3d9033f46
Author: Caolán McNamara 
AuthorDate: Sun Mar 13 10:38:28 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 13 13:04:06 2022 +0100

ofz: Use-of-uninitialized-value

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

diff --git a/xmloff/source/style/GradientStyle.cxx 
b/xmloff/source/style/GradientStyle.cxx
index 17c058727679..7626db9db8ce 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -65,12 +65,16 @@ void XMLGradientStyleImport::importXML(
 OUString aDisplayName;
 
 awt::Gradient aGradient;
+aGradient.Style = css::awt::GradientStyle_LINEAR;
+aGradient.StartColor = 0;
+aGradient.EndColor = 0;
+aGradient.Angle = 0;
+aGradient.Border = 0;
 aGradient.XOffset = 0;
 aGradient.YOffset = 0;
 aGradient.StartIntensity = 100;
 aGradient.EndIntensity = 100;
-aGradient.Angle = 0;
-aGradient.Border = 0;
+aGradient.StepCount = 0;
 
 for (auto  : sax_fastparser::castToFastAttributeList( xAttrList ))
 {


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

2022-02-26 Thread Caolán McNamara (via logerrit)
 xmloff/source/core/namespacemap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 20b301efef0fce7c92b9fac9e62d38cbfe10529f
Author: Caolán McNamara 
AuthorDate: Fri Feb 25 21:41:05 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 26 13:30:01 2022 +0100

cid#1500663 std::move a sal_uInt16 and then return the original is 
unorthodox

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

diff --git a/xmloff/source/core/namespacemap.cxx 
b/xmloff/source/core/namespacemap.cxx
index 2a0ca441d05a..4d5ec0d503da 100644
--- a/xmloff/source/core/namespacemap.cxx
+++ b/xmloff/source/core/namespacemap.cxx
@@ -350,7 +350,7 @@ sal_uInt16 SvXMLNamespaceMap::GetKeyByQName(const OUString& 
rQName,
 rtl::Reference xEntry(new NameSpaceEntry);
 xEntry->sPrefix = std::move(sEntryPrefix);
 xEntry->sName = std::move(sEntryName);
-xEntry->nKey = std::move(nKey);
+xEntry->nKey = nKey;
 aNameCache.emplace(rQName, std::move(xEntry));
 }
 }


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

2022-02-02 Thread Andrea Gelmini (via logerrit)
 xmloff/source/transform/PropertyActionsOOo.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e262770bf55e9ef6023cddefbfa5607bc744a2c4
Author: Andrea Gelmini 
AuthorDate: Tue Feb 1 14:46:50 2022 +0100
Commit: Julien Nabet 
CommitDate: Wed Feb 2 18:35:48 2022 +0100

Fix variable name

It's just a comment, but so it is the same as in
PropertyActionsOASIS.cxx

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

diff --git a/xmloff/source/transform/PropertyActionsOOo.cxx 
b/xmloff/source/transform/PropertyActionsOOo.cxx
index dbee8983f250..cc6fc0e6b6f9 100644
--- a/xmloff/source/transform/PropertyActionsOOo.cxx
+++ b/xmloff/source/transform/PropertyActionsOOo.cxx
@@ -276,7 +276,7 @@ XMLTransformerActionInit const 
aGraphicPropertyOOoAttrActionTable[] =
   NO_PARAMS }, /* generated entry */
 { XML_NAMESPACE_STYLE, XML_WRAP, XML_ATACTION_COPY,
   NO_PARAMS }, /* generated entry */
-//  { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_TRESHOLD, XML_ATACTION_COPY,
+//  { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_THRESHOLD, XML_ATACTION_COPY,
 //  NO_PARAMS }, /* new attribute */
 { XML_NAMESPACE_STYLE, XML_NUMBER_WRAPPED_PARAGRAPHS, XML_ATACTION_COPY,
   NO_PARAMS }, /* generated entry */


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

2022-01-05 Thread Andrea Gelmini (via logerrit)
 xmloff/source/text/txtparai.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dba8853271b1ee52c294c2401a5c8d98cc52cdc3
Author: Andrea Gelmini 
AuthorDate: Tue Jan 4 18:58:50 2022 +0100
Commit: Julien Nabet 
CommitDate: Wed Jan 5 19:11:20 2022 +0100

Fix typos

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

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 504c32b90f57..20f2b5c6388e 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1182,7 +1182,7 @@ void XMLTOCMarkImportContext_Impl::ProcessAttribute(
 {
 case XML_ELEMENT(TEXT, XML_OUTLINE_LEVEL):
 {
-// ouline level: set Level property
+// outline level: set Level property
 sal_Int32 nTmp;
 if (::sax::Converter::convertNumber( nTmp, aIter.toView() )
 && nTmp >= 1
@@ -1239,7 +1239,7 @@ void XMLUserIndexMarkImportContext_Impl::ProcessAttribute(
 break;
 case XML_ELEMENT(TEXT, XML_OUTLINE_LEVEL):
 {
-// ouline level: set Level property
+// outline level: set Level property
 sal_Int32 nTmp;
 if (::sax::Converter::convertNumber(
 nTmp, aIter.toView(), 0,


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

2021-12-21 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/shapeimport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 45ca7938dbc146ffa39e1e759e20d8e0b60a3c85
Author: Noel Grandin 
AuthorDate: Tue Dec 21 08:42:21 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 21 09:38:12 2021 +0100

SAL_WARN->SAL_INFO

this method is often speculatively called, so the warnings
here are not that useful

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

diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index 76ac0075c564..bfbcf180feab 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -419,7 +419,7 @@ SvXMLShapeContext* 
XMLShapeImportHelper::CreateFrameChildContext(
 }
 // add other shapes here...
 default:
-XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+SAL_INFO("xmloff", "unknown element " << 
SvXMLImport::getPrefixAndNameFromToken(nElement));
 break;
 }
 
@@ -429,7 +429,7 @@ SvXMLShapeContext* 
XMLShapeImportHelper::CreateFrameChildContext(
 for(auto& aIter : *xCombinedAttrList)
 {
 if (!pContext->processAttribute( aIter ))
-XMLOFF_WARN_UNKNOWN("xmloff", aIter);
+SAL_INFO("xmloff", "unknown attribute " << 
SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << " value=" << 
aIter.toString());
 }
 }
 


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

2021-12-21 Thread Noel Grandin (via logerrit)
 xmloff/source/chart/SchXMLTableContext.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e5594e656d7d7958015cfe0bdbcd42ecd5a9c9c3
Author: Noel Grandin 
AuthorDate: Tue Dec 21 09:00:31 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 21 09:18:16 2021 +0100

also handle SVG_COMPAT namespace here

Noticed an "unknown element" message while doing some
unrelated debugging

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

diff --git a/xmloff/source/chart/SchXMLTableContext.cxx 
b/xmloff/source/chart/SchXMLTableContext.cxx
index 51c56b545a8d..ac8a9f3e3f51 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -1028,7 +1028,8 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SchXMLRangeSomewhereCo
 sal_Int32 nElement,
 const css::uno::Reference< css::xml::sax::XFastAttributeList >&  )
 {
-if( nElement == XML_ELEMENT(SVG, XML_DESC) )
+if( nElement == XML_ELEMENT(SVG, XML_DESC)
+|| nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC) )
 {
 return new XMLStringBufferImportContext( GetImport(), 
maRangeStringBuffer );
 }


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

2021-12-07 Thread Pesi Taototo (via logerrit)
 xmloff/source/text/txtparai.cxx   |   12 +-
 xmloff/source/text/txtparaimphint.hxx |   40 ++
 2 files changed, 28 insertions(+), 24 deletions(-)

New commits:
commit 47503fce3ebc0874534175c0d9ea40d3a5bbffde
Author: Pesi Taototo 
AuthorDate: Sun Dec 5 22:34:33 2021 -0800
Commit: Hossein 
CommitDate: Tue Dec 7 16:25:47 2021 +0100

tdf#145614 Convert #define to 'enum class'

Change-Id: I991cd44b13465e63c5adc1aed3cfbc038847c0f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126396
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index ac05986ffe6a..5cee4085e693 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1851,7 +1851,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
 xAttrCursor->gotoRange( pHint->GetEnd(), true );
 switch( pHint->GetType() )
 {
-case XML_HINT_STYLE:
+case XMLHintType::XML_HINT_STYLE:
 {
 const OUString& rStyleName =
 static_cast(pHint)->GetStyleName();
@@ -1861,7 +1861,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
   false );
 }
 break;
-case XML_HINT_REFERENCE:
+case XMLHintType::XML_HINT_REFERENCE:
 {
 const OUString& rRefName =
 static_cast(pHint)->GetRefName();
@@ -1880,7 +1880,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
 }
 }
 break;
-case XML_HINT_HYPERLINK:
+case XMLHintType::XML_HINT_HYPERLINK:
 {
 const XMLHyperlinkHint_Impl *pHHint =
 static_cast(pHint);
@@ -1894,7 +1894,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
   pHHint->GetEventsContext() );
 }
 break;
-case XML_HINT_INDEX_MARK:
+case XMLHintType::XML_HINT_INDEX_MARK:
 {
 Reference xMark(
 static_cast(pHint)->GetMark());
@@ -1910,7 +1910,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
 }
 }
 break;
-case XML_HINT_TEXT_FRAME:
+case XMLHintType::XML_HINT_TEXT_FRAME:
 {
 const XMLTextFrameHint_Impl *pFHint =
 static_cast(pHint);
@@ -1955,7 +1955,7 @@ void XMLParaContext::endFastElement(sal_Int32 )
 /* Core impl. of the unification of drawing objects and
Writer fly frames (#i26791#)
 */
-case XML_HINT_DRAW:
+case XMLHintType::XML_HINT_DRAW:
 {
 const XMLDrawHint_Impl *pDHint =
 static_cast(pHint);
diff --git a/xmloff/source/text/txtparaimphint.hxx 
b/xmloff/source/text/txtparaimphint.hxx
index 63cc49cfa67e..f60b87be5984 100644
--- a/xmloff/source/text/txtparaimphint.hxx
+++ b/xmloff/source/text/txtparaimphint.hxx
@@ -23,24 +23,28 @@
 #include "XMLTextFrameHyperlinkContext.hxx"
 #include 
 
-#define XML_HINT_STYLE 1
-#define XML_HINT_REFERENCE 2
-#define XML_HINT_HYPERLINK 3
-#define XML_HINT_INDEX_MARK 5
-#define XML_HINT_TEXT_FRAME 6
-// Core impl. of the unification of drawing objects and Writer fly frames 
(#i26791#)
-#define XML_HINT_DRAW 7
+enum class XMLHintType
+{
+XML_HINT_STYLE  = 1,
+XML_HINT_REFERENCE  = 2,
+XML_HINT_HYPERLINK  = 3,
+// There is no 4 defined here
+XML_HINT_INDEX_MARK = 5,
+XML_HINT_TEXT_FRAME = 6,
+// Core impl. of the unification of drawing objects and Writer fly frames 
(#i26791#)
+XML_HINT_DRAW   = 7
+};
 
 class XMLHint_Impl
 {
 css::uno::Reference < css::text::XTextRange > xStart;
 css::uno::Reference < css::text::XTextRange > xEnd;
 
-sal_uInt8 nType;
+XMLHintType nType;
 
 public:
 
-XMLHint_Impl( sal_uInt8 nTyp,
+XMLHint_Impl( XMLHintType nTyp,
   const css::uno::Reference < css::text::XTextRange > & rS,
   const css::uno::Reference < css::text::XTextRange > & rE ) :
 xStart( rS ),
@@ -57,8 +61,8 @@ public:
 
 // We don't use virtual methods to differ between the sub classes,
 // because this seems to be too expensive if compared to inline methods.
-sal_uInt8 GetType() const { return nType; }
-bool IsReference() const { return XML_HINT_REFERENCE==nType; }
+XMLHintType GetType() const { return nType; }
+bool IsReference() const { return XMLHintType::XML_HINT_REFERENCE==nType; }
 };
 
 class XMLStyleHint_Impl : public XMLHint_Impl
@@ -69,7 +73,7 @@ public:
 
 XMLStyleHint_Impl( const OUString& rStyleName,

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

2021-11-15 Thread Noel Grandin (via logerrit)
 xmloff/source/chart/PropertyMap.hxx  |  299 --
 xmloff/source/chart/PropertyMaps.cxx |  300 ++-
 2 files changed, 294 insertions(+), 305 deletions(-)

New commits:
commit 8c45639a19b277eaaeb1be3798574f91aac5b022
Author: Noel Grandin 
AuthorDate: Mon Nov 15 09:05:46 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 15 10:08:14 2021 +0100

move xmloff chart tables into cxx file

instead of playing games with #define

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

diff --git a/xmloff/source/chart/PropertyMap.hxx 
b/xmloff/source/chart/PropertyMap.hxx
index 60d414bad5c8..f9a3dc4e3b8e 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -85,304 +85,5 @@
 #define XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SERIES   ( XML_SCH_CTF_START + 27 )
 #define XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE ( XML_SCH_CTF_START + 28 )
 
-#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, 
EarliestODFVersionForExport ) { ApiName, XML_NAMESPACE_##NameSpace, 
xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, 
EarliestODFVersionForExport, false }
-#define MAP_ENTRY( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_ENTRY_ODF12( a, ns, nm, t )  { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false 
}
-#define MAP_ENTRY_ODF13( a, ns, nm, t )  { a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_013, false }
-#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
-#define MAP_ENTRY_ODF_EXT_IMPORT( a, ns, nm, t ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
-#define MAP_CONTEXT( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_SPECIAL( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_010, false }
-#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_012, false }
-#define MAP_SPECIAL_ODF13( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_013, false }
-#define MAP_ENTRY_END { 
nullptr,0,xmloff::token::XML_TOKEN_INVALID,0,0,SvtSaveOptions::ODFSVER_010, 
false }
-
-// PropertyMap for Chart properties drawing- and
-// textproperties are added later using the chaining
-// mechanism
-
-// only create maps once!
-// this define is set in PropertyMaps.cxx
-
-#ifdef XML_SCH_CREATE_GLOBAL_MAPS
-
-const XMLPropertyMapEntry aXMLChartPropMap[] =
-{
-// chart subtypes
-MAP_ENTRY( "UpDown", CHART, XML_JAPANESE_CANDLE_STICK, XML_TYPE_BOOL ), // 
formerly XML_STOCK_UPDOWN_BARS
-MAP_CONTEXT( "Volume", CHART, XML_STOCK_WITH_VOLUME, XML_TYPE_BOOL, 
XML_SCH_CONTEXT_STOCK_WITH_VOLUME ),
-MAP_ENTRY( "Dim3D", CHART, XML_THREE_DIMENSIONAL, XML_TYPE_BOOL ),
-MAP_ENTRY( "Deep", CHART, XML_DEEP, XML_TYPE_BOOL ),
-MAP_ENTRY( "Lines", CHART, XML_LINES, XML_TYPE_BOOL ),
-MAP_ENTRY( "Percent", CHART, XML_PERCENTAGE, XML_TYPE_BOOL ),
-MAP_ENTRY( "SolidType", CHART, XML_SOLID_TYPE, XML_SCH_TYPE_SOLID_TYPE ),
-// ODF 1.3 OFFICE-3662 added values
-MAP_ENTRY( "SplineType", CHART, XML_INTERPOLATION, 
XML_SCH_TYPE_INTERPOLATION ),
-MAP_ENTRY( "Stacked", CHART, XML_STACKED, XML_TYPE_BOOL ),
-// type: "none", "automatic", "named-symbol" or "image"
-MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_TYPE, XML_SCH_TYPE_SYMBOL_TYPE 
| MID_FLAG_MULTI_PROPERTY ),
-// if type=="named-symbol" => name of symbol (square, diamond, ...)
-MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_NAME, XML_SCH_TYPE_NAMED_SYMBOL 
| MID_FLAG_MULTI_PROPERTY ),
-// if type=="image" => an xlink:href element with a linked (package) URI
-MAP_SPECIAL( "SymbolBitmap", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | 
MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ),
-MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_WIDTH, XML_TYPE_MEASURE | 
MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ),
-MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_HEIGHT, XML_TYPE_MEASURE | 
MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT ),
-MAP_ENTRY( "Vertical", CHART, XML_VERTICAL, XML_TYPE_BOOL ),
-// #i32368# property should no longer be used as XML-property (in OASIS
-// format), but 

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

2021-11-02 Thread Tomaž Vajngerl (via logerrit)
 xmloff/source/style/PageMasterImportPropMapper.cxx |  134 +++--
 1 file changed, 71 insertions(+), 63 deletions(-)

New commits:
commit b0e574a8be2a080f5039e968f4f32ce4b8fa2b26
Author: Tomaž Vajngerl 
AuthorDate: Fri Oct 29 17:23:02 2021 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 2 19:35:49 2021 +0100

xmloff: Prevent gutter margin xml property to be deallocated

Previously we stored a pointer to the gutter margin XMLPropertyState
so we could read it later. The problem with this is that in between
when we storing and reading the property state, we add elements
to the rProperties vector, where the XML properties are allocated.

Adding new elements to the vector can cause that the internal
array is reallocated to a bigger size and elements copied to the
new array, so our pointer shows to a invalid (deallocated) memory
address.

This issue is fixed by moving the code up to before we add new
elements to rProperties vector and a big warning is written to not
use XMLPropertyState* pointers after the code adds to the
rProperties vector.

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

diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx 
b/xmloff/source/style/PageMasterImportPropMapper.cxx
index b9850eaec618..8ee711804333 100644
--- a/xmloff/source/style/PageMasterImportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -390,6 +390,74 @@ void PageMasterImportPropertyMapper::finished(std::vector< 
XMLPropertyState >& r
 pAllFooterMarginProperty->mnIndex = -1;
 }
 
+if (pMarginGutter)
+{
+sal_Int32 nGutterMargin{};
+pMarginGutter->maValue >>= nGutterMargin;
+
+bool bGutterAtTop{};
+uno::Reference xSI(GetImport().GetModel(), 
uno::UNO_QUERY);
+if (xSI.is() && xSI->supportsService("com.sun.star.text.TextDocument"))
+{
+uno::Reference 
xFac(GetImport().GetModel(), uno::UNO_QUERY);
+if (xFac.is())
+{
+uno::Reference xProps(
+xFac->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+if (xProps.is())
+{
+xProps->getPropertyValue("GutterAtTop") >>= bGutterAtTop;
+}
+}
+}
+if (bGutterAtTop)
+{
+if (nGutterMargin && pMargins[XML_LINE_TOP])
+{
+// Decrease top margin to not include gutter.
+sal_Int32 nTopMargin{};
+pMargins[XML_LINE_TOP]->maValue >>= nTopMargin;
+nTopMargin -= nGutterMargin;
+pMargins[XML_LINE_TOP]->maValue <<= nTopMargin;
+}
+}
+else
+{
+bool bRtlGutter{};
+if (nGutterMargin && pRtlGutter)
+{
+pRtlGutter->maValue >>= bRtlGutter;
+}
+if (bRtlGutter)
+{
+if (nGutterMargin && pMargins[XML_LINE_RIGHT])
+{
+// Decrease right margin to not include gutter.
+sal_Int32 nRightMargin{};
+pMargins[XML_LINE_RIGHT]->maValue >>= nRightMargin;
+nRightMargin -= nGutterMargin;
+pMargins[XML_LINE_RIGHT]->maValue <<= nRightMargin;
+}
+}
+else
+{
+if (nGutterMargin && pMargins[XML_LINE_LEFT])
+{
+// Decrease left margin to not include gutter.
+sal_Int32 nLeftMargin{};
+pMargins[XML_LINE_LEFT]->maValue >>= nLeftMargin;
+nLeftMargin -= nGutterMargin;
+pMargins[XML_LINE_LEFT]->maValue <<= nLeftMargin;
+}
+}
+}
+}
+
+// CAUTION!
+// The following code adds into the rProperties vector, so all the
+// XMLPropertyState* pointers that are pointing to the rProperties
+// elements could potentially be deallocated, so don't use them after
+// this!
 for (sal_uInt16 i = 0; i < 4; i++)
 {
 if (pNewMargins[i])
@@ -435,6 +503,9 @@ void PageMasterImportPropertyMapper::finished(std::vector< 
XMLPropertyState >& r
 delete pFooterNewBorders[i];
 }
 }
+// CAUTION - do not use XMLPropertyState* pointers (like pMargins,
+// pMarginGutter) after this.
+
 if(xHeaderDynamic)
 {
 rProperties.push_back(*xHeaderDynamic);
@@ -446,68 +517,5 @@ void PageMasterImportPropertyMapper::finished(std::vector< 
XMLPropertyState >& r
 xFooterDynamic.reset();
 }
 
-if (!pMarginGutter)
-return;
-
-sal_Int32 nGutterMargin{};
-pMarginGutter->maValue >>= nGutterMargin;

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

2021-11-01 Thread Mike Kaganski (via logerrit)
 xmloff/source/chart/MultiPropertySetHandler.hxx |3 
 xmloff/source/chart/SchXMLChartContext.cxx  |   47 ---
 xmloff/source/chart/SchXMLExport.cxx|   22 ---
 xmloff/source/chart/SchXMLImport.cxx|5 -
 xmloff/source/chart/SchXMLPlotAreaContext.cxx   |2 
 xmloff/source/chart/SchXMLPropertyMappingContext.cxx|2 
 xmloff/source/chart/SchXMLSeries2Context.cxx|8 +-
 xmloff/source/chart/SchXMLTableContext.cxx  |   28 +
 xmloff/source/chart/SchXMLTextListContext.cxx   |3 
 xmloff/source/core/DocumentSettingsContext.cxx  |5 -
 xmloff/source/core/xmlexp.cxx   |   16 +
 xmloff/source/draw/sdxmlexp.cxx |6 -
 xmloff/source/draw/shapeexport.cxx  |   22 +++
 xmloff/source/draw/shapeimport.cxx  |5 -
 xmloff/source/draw/ximpshap.cxx |   49 
 xmloff/source/forms/eventexport.cxx |   14 ++--
 xmloff/source/forms/formcellbinding.cxx |4 -
 xmloff/source/forms/gridcolumnproptranslator.cxx|   10 +--
 xmloff/source/meta/MetaExportComponent.cxx  |6 -
 xmloff/source/meta/xmlversion.cxx   |2 
 xmloff/source/script/xmlscripti.cxx |5 -
 xmloff/source/text/XMLAutoTextEventExport.cxx   |3 
 xmloff/source/text/XMLIndexBibliographyEntryContext.cxx |5 -
 xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx  |9 +-
 xmloff/source/text/XMLIndexSimpleEntryContext.cxx   |9 +-
 xmloff/source/text/XMLIndexSpanEntryContext.cxx |5 -
 xmloff/source/text/XMLIndexTOCStylesContext.cxx |3 
 xmloff/source/text/XMLIndexTemplateContext.cxx  |6 -
 xmloff/source/text/txtfldi.cxx  |3 
 xmloff/source/text/txtimp.cxx   |5 -
 xmloff/source/transform/OOo2Oasis.cxx   |5 -
 xmloff/source/xforms/xformsexport.cxx   |   11 +--
 32 files changed, 171 insertions(+), 157 deletions(-)

New commits:
commit 8cb57be792e6991c38cf5d4434569dc118dd0ed4
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:28:28 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 07:11:36 2021 +0100

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

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

diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx 
b/xmloff/source/chart/MultiPropertySetHandler.hxx
index 178fb3e1adf6..d742faf50463 100644
--- a/xmloff/source/chart/MultiPropertySetHandler.hxx
+++ b/xmloff/source/chart/MultiPropertySetHandler.hxx
@@ -185,9 +185,10 @@ MultiPropertySetHandler::MultiPropertySetHandler 
(css::uno::Reference<
 boolMultiPropertySetHandler::GetProperties()
 {
 css::uno::Sequence< OUString> aNameList (aPropertyList.size());
+auto aNameListRange = asNonConstRange(aNameList);
 int i = 0;
 for (const auto& rProperty : aPropertyList)
-aNameList[i++] = rProperty.second->msName;
+aNameListRange[i++] = rProperty.second->msName;
 if ( ! MultiGet(aNameList))
 if ( ! SingleGet(aNameList))
 return false;
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx
index d8a91ff49659..51a7e1f05d93 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -98,7 +98,7 @@ void lcl_MoveDataToCandleStickSeries(
 // @todo: realloc only once outside this function
 uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence 
> > aData( xSource->getDataSequences());
 aData.realloc( aData.getLength() + 1);
-aData[ aData.getLength() - 1 ] = aLabeledSeq[0];
+aData.getArray()[ aData.getLength() - 1 ] = aLabeledSeq[0];
 uno::Reference< chart2::data::XDataSink > xSink( xDestination, 
uno::UNO_QUERY_THROW );
 xSink->setData( aData );
 }
@@ -206,9 +206,9 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( 
const OUString& rStr
 else if( bAddOneToEachOldIndex )
 {
 aSeq.realloc( nVecSize+1 );
-aSeq[0]=0;
+auto pSeqArr = aSeq.getArray();
+pSeqArr[0]=0;
 
-sal_Int32* pSeqArr = aSeq.getArray();
 for( nPos = 0; nPos < nVecSize; ++nPos )
 {
 pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
@@ -641,24 +641,25 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
 bHasCateories = true;
 }
 
-uno::Sequence< beans::PropertyValue > aArgs( 3 );
-aArgs[0] = beans::PropertyValue(
-"CellRangeRepresentation",
--1, uno::makeAny( 

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

2021-10-29 Thread Andrea Gelmini (via logerrit)
 xmloff/source/draw/shapeexport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cf158b801a8d23538e339e3e1b9b571e8f1575d7
Author: Andrea Gelmini 
AuthorDate: Fri Oct 29 14:28:00 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Oct 29 16:34:50 2021 +0200

Fix typo

Change-Id: I06cb364b31274d36a712f43db258a2421995388a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124434
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Julien Nabet 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index dbd52fadd1d1..ae5dbf041d1e 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -4588,7 +4588,7 @@ static void ImpExportEnhancedGeometry( SvXMLExport& 
rExport, const uno::Referenc
 // tdf#141301: no specific skew values provided
 if (!bSkewValuesProvided)
 {
-// so we need to export default values 
explicitely
+// so we need to export default values 
explicitly
 rExport.AddAttribute( XML_NAMESPACE_DRAW, 
XML_EXTRUSION_SKEW, "50 -135");
 }
 }


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

2021-10-21 Thread Eike Rathke (via logerrit)
 xmloff/source/style/chrlohdl.cxx |   58 +--
 1 file changed, 56 insertions(+), 2 deletions(-)

New commits:
commit cb56ec6aa8f03fbc70c808bd4f519ce9d3c21f7d
Author: Eike Rathke 
AuthorDate: Fri Oct 22 01:56:46 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Oct 22 04:02:12 2021 +0200

Resolves: tdf#92015 Handle malused *:rfc-language-tag ODF violation

... and don't let it overwrite existing fo:* tags with less
information.

Change-Id: I63c223f6bccd682e4173449ddc76c36e8fac6c35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124042
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx
index 4b6b1aebbf1d..05dd6d770e5a 100644
--- a/xmloff/source/style/chrlohdl.cxx
+++ b/xmloff/source/style/chrlohdl.cxx
@@ -339,8 +339,62 @@ bool XMLCharRfcLanguageTagHdl::importXML( const OUString& 
rStrImpValue, uno::Any
 
 if( !IsXMLToken( rStrImpValue, XML_NONE ) )
 {
-aLocale.Variant = rStrImpValue;
-aLocale.Language = I18NLANGTAG_QLT;
+// Stored may be a *:rfc-language-tag in violation of ODF v1.3
+// 19.516 style:rfc-language-tag "It shall only be used if its value
+// cannot be expressed as a valid combination of the fo:language
+// 19.871, fo:script 19.242 and fo:country 19.234 attributes".
+// That could override a more detailed fo:* and we also don't want an
+// unjustified I18NLANGTAG_QLT extended locale tag, but fetch the
+// values in case fo:* doesn't follow.
+// Rule out the obvious.
+if (rStrImpValue.getLength() < 7)
+{
+SAL_WARN("xmloff.style","rfc-language-tag too short: {" << 
rStrImpValue << "} Set: "
+<< aLocale.Language <<","<< aLocale.Country <<","<< 
aLocale.Variant);
+// Ignore empty and keep Ssss or any earlier qlt already set.
+if (!rStrImpValue.isEmpty() && aLocale.Language != I18NLANGTAG_QLT)
+{
+// Shorter than ll-Ssss, so try ll-CC or lll-CC or ll or lll
+sal_Int32 h = rStrImpValue.indexOf('-');
+OUString aLang;
+if (2 <= h && h <= 3)
+aLang = rStrImpValue.copy(0, h);
+else if (h < 0 && 2 <= rStrImpValue.getLength() && 
rStrImpValue.getLength() <= 3)
+aLang = rStrImpValue;
+OUString aCoun;
+if (!aLang.isEmpty() && aLang.getLength() + 3 == 
rStrImpValue.getLength())
+aCoun = rStrImpValue.copy( aLang.getLength() + 1);
+// Ignore identical value or less information.
+if ((!aLang.isEmpty() && aLang != aLocale.Language) ||
+(!aCoun.isEmpty() && aCoun != aLocale.Country))
+{
+// Do not override existing values.
+if (aLocale.Language.isEmpty())
+aLocale.Language = aLang;
+if (aLocale.Country.isEmpty())
+aLocale.Country = aCoun;
+if (aLang != aLocale.Language || aCoun != aLocale.Country)
+{
+// No match, so we still need the qlt anyway. 
Whatever..
+aLocale.Variant = rStrImpValue;
+aLocale.Language = I18NLANGTAG_QLT;
+}
+}
+else if (aLang.isEmpty() && aCoun.isEmpty())
+{
+// Both empty, some other tag.
+aLocale.Variant = rStrImpValue;
+aLocale.Language = I18NLANGTAG_QLT;
+}
+}
+SAL_WARN("xmloff.style","rfc-language-tag too short: now set: "
+<< aLocale.Language <<","<< aLocale.Country <<","<< 
aLocale.Variant);
+}
+else
+{
+aLocale.Variant = rStrImpValue;
+aLocale.Language = I18NLANGTAG_QLT;
+}
 }
 
 rValue <<= aLocale;


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

2021-10-19 Thread Julien Nabet (via logerrit)
 xmloff/source/script/XMLStarBasicContextFactory.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit b7e7fee238dc250e7ab6e8e8fef4a6b15430c90c
Author: Julien Nabet 
AuthorDate: Tue Oct 19 07:21:12 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 19 09:27:11 2021 +0200

Leftover from 4477baeba5aec71098f374cf0b4bd4591e048809

... Simplify Sequences in xmloff (+ merge 2 SetError)

Thank you Mike for having spotted it! :-)

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

diff --git a/xmloff/source/script/XMLStarBasicContextFactory.cxx 
b/xmloff/source/script/XMLStarBasicContextFactory.cxx
index 73d6482daa9f..eec6ded9f207 100644
--- a/xmloff/source/script/XMLStarBasicContextFactory.cxx
+++ b/xmloff/source/script/XMLStarBasicContextFactory.cxx
@@ -87,10 +87,6 @@ SvXMLImportContext* 
XMLStarBasicContextFactory::CreateContext(
 comphelper::makePropertyValue(gsMacroName, sMacroNameVal)
 };
 
-// macro name
-aValues[2].Name = gsMacroName;
-aValues[2].Value <<= sMacroNameVal;
-
 // add values for event now
 rEvents->AddEventValues(rApiEventName, aValues);
 


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

2021-10-10 Thread Mike Kaganski (via logerrit)
 xmloff/source/core/xmlexp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 5041b1491a183366ca44380bd0f5dfb7c0acc5fb
Author: Mike Kaganski 
AuthorDate: Sun Oct 10 22:07:34 2021 +0200
Commit: Mike Kaganski 
CommitDate: Mon Oct 11 06:14:38 2021 +0200

Drop unused 'using namespace' here

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 0fd65e17d8f2..5e0e46dabeb0 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -98,7 +98,6 @@
 #include 
 #include 
 
-using namespace ::osl;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::frame;


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

2021-09-23 Thread Pierre Marty (via logerrit)
 xmloff/source/draw/ximpstyl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5bcced4776bb73846ef4f98795e217e4fb923e40
Author: Pierre Marty 
AuthorDate: Mon Sep 20 14:56:33 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 23 09:56:12 2021 +0200

tdf#141978: corrects the value assigned to AutoLayout while loading .odp 
file

SdXMLPresentationPageLayoutContext::endFastElement(sal_Int32)
  now assigns the value AUTOLAYOUT_TITLE_6CONTENT
  instead of AUTOLAYOUT_4CLIPART at file loading

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

diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 77f5877a2442..4f3805e39ddd 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -618,7 +618,7 @@ void 
SdXMLPresentationPageLayoutContext::endFastElement(sal_Int32 )
 }
 case 7:
 {
-mnTypeId = AUTOLAYOUT_4CLIPART; // FIXME: not 
AUTOLAYOUT_TITLE_6CONTENT?
+mnTypeId = AUTOLAYOUT_TITLE_6CONTENT; // tdf#141978: Apply 
6content layout
 break;
 }
 default:


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

2021-09-10 Thread Michael Stahl (via logerrit)
 xmloff/source/draw/shapeexport.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit a0d28d03ff40a77a2c88704a7b2bedb68e68563f
Author: Michael Stahl 
AuthorDate: Thu Sep 9 18:52:49 2021 +0200
Commit: Michael Stahl 
CommitDate: Fri Sep 10 12:44:58 2021 +0200

xmloff: ODF export: avoid mysterious crash while sorting shapes

Apparently the draw page contains a null XShape.  That sounds like a bug
but OTOH this sorting feature from commit
9bc6160e0acbc78be998129ea55ed7e4529959faa isn't that important so let's
sweep the problem under the rug.

0   swlo.dll
sw::GetZOrderLayer::operator()(com::sun::star::uno::Reference
 const &) 
C:\cygwin64\home\buildslave\source\libo-core\sw\source\filter\xml\zorder.hxx:37
1   mergedlo.dll
xmloff::FixZOrder(com::sun::star::uno::Reference
 const &,std::function const &)
C:\cygwin64\home\buildslave\source\libo-core\xmloff\source\draw\shapeexport.cxx:1003
2   swlo.dll
SwXMLWriter::Write_(com::sun::star::uno::Reference
 const &,rtl::OUString const &)   
C:\cygwin64\home\buildslave\source\libo-core\sw\source\filter\xml\wrtxml.cxx:190


https://crashreport.libreoffice.org/stats/crash_details/045adea4-c577-4164-9e69-bde5f892bd17

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 455ca3b4e024..8c7ba1727a84 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1024,6 +1024,11 @@ void FixZOrder(uno::Reference const& 
xShapes,
 for (sal_Int32 i = 0; i < nCount; ++i)
 {
 uno::Reference const 
xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+if (!xShape.is())
+{
+SAL_WARN("xmloff", "FixZOrder: null shape, cannot sort");
+return;
+}
 unsigned int const nLayer(rGetLayer(xShape));
 if (layers.size() <= nLayer)
 {


[Libreoffice-commits] core.git: xmloff/source xmlsecurity/source

2021-09-03 Thread Noel Grandin (via logerrit)
 xmloff/source/chart/SchXMLTextListContext.cxx   |1 
 xmloff/source/chart/XMLLabelSeparatorContext.cxx|3 --
 xmloff/source/core/DocumentSettingsContext.cxx  |1 
 xmloff/source/core/xmlexp.cxx   |5 ---
 xmloff/source/core/xmlimp.cxx   |2 -
 xmloff/source/core/xmlmultiimagehelper.cxx  |3 --
 xmloff/source/draw/shapeexport.cxx  |1 
 xmloff/source/draw/ximpshap.cxx |9 +-
 xmloff/source/meta/MetaImportComponent.cxx  |2 -
 xmloff/source/meta/xmlmetae.cxx |3 --
 xmloff/source/script/XMLEventImportHelper.cxx   |4 --
 xmloff/source/style/MultiPropertySetHelper.cxx  |2 -
 xmloff/source/style/PageMasterImportContext.cxx |1 
 xmloff/source/style/PageMasterPropHdlFactory.cxx|3 --
 xmloff/source/style/numehelp.cxx|6 +---
 xmloff/source/style/xmlexppr.cxx|3 --
 xmloff/source/style/xmlnumfi.cxx|2 -
 xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx|1 
 xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx |3 --
 xmloff/source/text/XMLIndexTabStopEntryContext.cxx  |1 
 xmloff/source/text/XMLTextFrameContext.cxx  |3 --
 xmloff/source/text/XMLTextListBlockContext.cxx  |4 --
 xmloff/source/text/XMLTextListItemContext.cxx   |3 --
 xmloff/source/text/XMLTextNumRuleInfo.cxx   |5 ---
 xmloff/source/text/txtfldi.cxx  |   14 
+-
 xmloff/source/text/txtlists.cxx |4 --
 xmloff/source/text/txtparae.cxx |1 
 xmloff/source/text/txtparai.cxx |4 --
 xmloff/source/text/txtprhdl.cxx |3 --
 xmloff/source/xforms/SchemaRestrictionContext.cxx   |3 --
 xmloff/source/xforms/XFormsSubmissionContext.cxx|3 --
 xmlsecurity/source/dialogs/certificatechooser.cxx   |1 
 xmlsecurity/source/framework/signaturecreatorimpl.cxx   |2 -
 xmlsecurity/source/framework/signatureverifierimpl.cxx  |1 
 xmlsecurity/source/gpg/CertificateImpl.cxx  |3 --
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx   |2 -
 36 files changed, 23 insertions(+), 89 deletions(-)

New commits:
commit 6cc1ee903544ed813402303e93753dac8226984f
Author: Noel Grandin 
AuthorDate: Fri Sep 3 09:11:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 3 12:44:22 2021 +0200

clang-tidy:readability-redundant-member-init

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

diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx 
b/xmloff/source/chart/SchXMLTextListContext.cxx
index 33aaa5028b8f..8b60d895bdef 100644
--- a/xmloff/source/chart/SchXMLTextListContext.cxx
+++ b/xmloff/source/chart/SchXMLTextListContext.cxx
@@ -74,7 +74,6 @@ SchXMLTextListContext::SchXMLTextListContext(
 , Sequence< OUString>& rTextList )
 : SvXMLImportContext( rImport )
 , m_rTextList( rTextList )
-, m_aTextVector()
 {
 }
 
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.cxx 
b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
index 1d05bfca1cfb..93beff46cf41 100644
--- a/xmloff/source/chart/XMLLabelSeparatorContext.cxx
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
@@ -32,8 +32,7 @@ XMLLabelSeparatorContext::XMLLabelSeparatorContext(
 const XMLPropertyState& rProp,
 ::std::vector< XMLPropertyState >  ) :
 XMLElementPropertyContext(
-rImport, nElement, rProp, rProps ),
-m_aSeparator()
+rImport, nElement, rProp, rProps )
 {
 }
 
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx 
b/xmloff/source/core/DocumentSettingsContext.cxx
index f221bfbc0f00..b40ac306963a 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -352,7 +352,6 @@ XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& 
rImport,
 XMLConfigBaseContext* pTempBaseContext)
 : SvXMLImportContext( rImport ),
 maProps( rImport.GetComponentContext() ),
-maProp(),
 mrAny(rTempAny),
 mpBaseContext(pTempBaseContext)
 {
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 889b9243e8d6..c64fb6052d45 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2455,7 +2455,6 @@ 

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

2021-08-30 Thread Caolán McNamara (via logerrit)
 xmloff/source/text/XMLTextFrameContext.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 6669c1a06bcc3ce31c9c17c714fdf2c2e0e25360
Author: Caolán McNamara 
AuthorDate: Mon Aug 30 09:22:47 2021 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 30 12:12:00 2021 +0200

ofz: MemorySanitizer: use-of-uninitialized-value

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

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index fbe537dd424b..0ab223b3c109 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -891,8 +891,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 if( aIter.toView().find( '%' ) != std::string_view::npos )
 {
 sal_Int32 nTmp;
-::sax::Converter::convertPercent( nTmp, aIter.toView() );
-nRelWidth = static_cast(nTmp);
+if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
+nRelWidth = static_cast(nTmp);
 }
 else
 {
@@ -917,8 +917,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 if( aIter.toView().find( '%' ) != std::string_view::npos )
 {
 sal_Int32 nTmp;
-::sax::Converter::convertPercent( nTmp, aIter.toView() );
-nRelWidth = static_cast(nTmp);
+if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
+nRelWidth = static_cast(nTmp);
 }
 else
 {
@@ -933,8 +933,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 if( aIter.toView().find( '%' ) != std::string_view::npos )
 {
 sal_Int32 nTmp;
-::sax::Converter::convertPercent( nTmp, aIter.toView() );
-nRelHeight = static_cast(nTmp);
+if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
+nRelHeight = static_cast(nTmp);
 }
 else
 {
@@ -964,8 +964,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
 if( aIter.toView().find( '%' ) != std::string_view::npos )
 {
 sal_Int32 nTmp;
-::sax::Converter::convertPercent( nTmp, aIter.toView() );
-nRelHeight = static_cast(nTmp);
+if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
+nRelHeight = static_cast(nTmp);
 }
 else
 {


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

2021-08-23 Thread Michael Stahl (via logerrit)
 xmloff/source/text/XMLTextMarkImportContext.cxx |   12 +---
 xmloff/source/text/XMLTextMarkImportContext.hxx |2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit fbe183bbb05220a4ccc51952445b1797bb498403
Author: Michael Stahl 
AuthorDate: Fri Aug 20 20:28:48 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Aug 23 15:43:50 2021 +0200

xmloff: avoid annoying warnings about bookmark conditions

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

diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx 
b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 2017d8f21a3d..44f652aaf6fa 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -95,6 +96,7 @@ XMLTextMarkImportContext::XMLTextMarkImportContext(
 : SvXMLImportContext(rImport)
 , m_rHelper(rHlp)
 , m_rxCrossRefHeadingBookmark(io_rxCrossRefHeadingBookmark)
+, m_isHidden(false)
 , m_bHaveAbout(false)
 {
 }
@@ -166,9 +168,7 @@ void XMLTextMarkImportContext::startFastElement( sal_Int32 
nElement,
 
 if ((nElement & TOKEN_MASK) == XML_BOOKMARK_START)
 {
-const OUString sHidden= 
xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_HIDDEN));
-const OUString sCondition = 
xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_CONDITION));
-m_rHelper.setBookmarkAttributes(m_sBookmarkName, sHidden == "true", 
sCondition);
+m_rHelper.setBookmarkAttributes(m_sBookmarkName, m_isHidden, 
m_sCondition);
 }
 }
 
@@ -539,6 +539,12 @@ bool XMLTextMarkImportContext::FindName(
 case XML_ELEMENT(FIELD, XML_TYPE):
 m_sFieldName = sValue;
 break;
+case XML_ELEMENT(LO_EXT, XML_HIDDEN):
+::sax::Converter::convertBool(m_isHidden, sValue);
+break;
+case XML_ELEMENT(LO_EXT, XML_CONDITION):
+m_sCondition = sValue;
+break;
 default:
 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
 }
diff --git a/xmloff/source/text/XMLTextMarkImportContext.hxx 
b/xmloff/source/text/XMLTextMarkImportContext.hxx
index ccf04e55deeb..407cddbadf7f 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.hxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.hxx
@@ -65,6 +65,8 @@ private:
 
 OUString m_sBookmarkName;
 OUString m_sFieldName;
+bool m_isHidden;
+OUString m_sCondition;
 OUString m_sXmlId;
 // RDFa
 bool m_bHaveAbout;


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

2021-08-18 Thread Samuel Mehrbrodt (via logerrit)
 xmloff/source/text/XMLTextFrameContext.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit da006fbe2d4c5891933390d72f6e6026b28d39fc
Author: Samuel Mehrbrodt 
AuthorDate: Wed Aug 18 16:48:43 2021 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 19 07:27:36 2021 +0200

tdf#143736 Fix loading hyperlink from textbox

Change-Id: I56f5aec153d9544a6c345e0cbb5857cf5d0074b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120673
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index a4f8cb636ca1..fbe537dd424b 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1375,6 +1375,17 @@ void XMLTextFrameContext::endFastElement(sal_Int32 )
 (pMultiContext.is()) ? pMultiContext.get() : m_xImplContext.get();
 XMLTextFrameContext_Impl *pImpl = 
const_cast(dynamic_cast< const 
XMLTextFrameContext_Impl*>( pContext ));
 assert(!pMultiContext.is() || pImpl);
+
+// When we are dealing with a textbox, pImpl will be null;
+// we need to set the hyperlink to the shape instead
+Reference xShape = GetShape();
+if (xShape.is() && m_pHyperlink)
+{
+Reference xProps(xShape, UNO_QUERY);
+if (xProps.is())
+xProps->setPropertyValue("Hyperlink", 
Any(m_pHyperlink->GetHRef()));
+}
+
 if( !pImpl )
 return;
 


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

2021-08-18 Thread Samuel Mehrbrodt (via logerrit)
 xmloff/source/text/XMLTextFrameHyperlinkContext.cxx |   36 +++-
 1 file changed, 21 insertions(+), 15 deletions(-)

New commits:
commit 7bd26828933a682b7bca86e4fb26f4cf99fa33e0
Author: Samuel Mehrbrodt 
AuthorDate: Tue Aug 17 16:49:21 2021 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Wed Aug 18 11:42:54 2021 +0200

tdf#143736 Fix loading hyperlink from various shapes

Change-Id: I86de90ee605fab8f11e7c01892fbbff6acf790a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120609
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx 
b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
index f3bf9c5e..7a1146ac8125 100644
--- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
@@ -101,22 +101,28 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLTextFrameHyperlinkC
 SvXMLImportContext *pContext = nullptr;
 XMLTextFrameContext *pTextFrameContext = nullptr;
 
-if( nElement == XML_ELEMENT(DRAW, XML_FRAME) )
+switch (nElement)
 {
-pTextFrameContext = new XMLTextFrameContext( GetImport(),
-xAttrList,
-eDefaultAnchorType );
-pTextFrameContext->SetHyperlink( sHRef, sName, sTargetFrameName, bMap 
);
-pContext = pTextFrameContext;
-xFrameContext = pContext;
-}
-if (nElement == XML_ELEMENT(DRAW, XML_CUSTOM_SHAPE))
-{
-Reference xShapes;
-SvXMLShapeContext* pShapeContext
-= XMLShapeImportHelper::CreateGroupChildContext(GetImport(), 
nElement, xAttrList, xShapes);
-pShapeContext->setHyperlink(sHRef);
-pContext = pShapeContext;
+case XML_ELEMENT(DRAW, XML_FRAME):
+{
+pTextFrameContext = new XMLTextFrameContext(GetImport(), 
xAttrList, eDefaultAnchorType);
+pTextFrameContext->SetHyperlink(sHRef, sName, sTargetFrameName, 
bMap);
+pContext = pTextFrameContext;
+xFrameContext = pContext;
+}
+break;
+case XML_ELEMENT(DRAW, XML_CUSTOM_SHAPE):
+case XML_ELEMENT(DRAW, XML_PATH):
+case XML_ELEMENT(DRAW, XML_ELLIPSE):
+case XML_ELEMENT(DRAW, XML_LINE):
+{
+Reference xShapes;
+SvXMLShapeContext* pShapeContext = 
XMLShapeImportHelper::CreateGroupChildContext(
+GetImport(), nElement, xAttrList, xShapes);
+pShapeContext->setHyperlink(sHRef);
+pContext = pShapeContext;
+}
+break;
 }
 
 if (!pContext)


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

2021-08-01 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/shapeimport.cxx |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit fba13b3b52b22eeab25faf31a57b642d0ce7
Author: Noel Grandin 
AuthorDate: Sun Aug 1 11:06:17 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 20:07:00 2021 +0200

unordered_map is better for pointer keys

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

diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index 792daaa5db3f..4fe64c9e1730 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -45,7 +45,7 @@
 #include "ximpgrp.hxx"
 #include "ximplink.hxx"
 
-#include 
+#include 
 #include 
 #include 
 
@@ -69,21 +69,12 @@ struct ConnectionHint
 sal_Int32 nDestGlueId;
 };
 
-struct XShapeCompareHelper
-{
-  bool operator()(const css::uno::Reference < css::drawing::XShape >& x1,
-  const css::uno::Reference < css::drawing::XShape >& x2 ) 
const
-  {
-return x1.get() < x2.get();
-  }
-};
-
 }
 
 /** this map store all glue point id mappings for shapes that had user defined 
glue points. This
 is needed because on insertion the glue points will get a new and unique 
id */
 typedef std::map GluePointIdMap;
-typedef std::map< css::uno::Reference < css::drawing::XShape >, 
GluePointIdMap, XShapeCompareHelper > ShapeGluePointsMap;
+typedef std::unordered_map< css::uno::Reference < css::drawing::XShape >, 
GluePointIdMap > ShapeGluePointsMap;
 
 /** this struct is created for each startPage() call and stores information 
that is needed during
 import of shapes for one page. Since pages could be nested ( notes pages 
inside impress ) there


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

2021-08-01 Thread Noel Grandin (via logerrit)
 xmloff/source/forms/layerexport.hxx |8 
 xmloff/source/forms/layerimport.hxx |3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 303aa36685f2d52cff6004f9b41b90629c26f978
Author: Noel Grandin 
AuthorDate: Sun Aug 1 11:04:34 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 20:06:40 2021 +0200

unordered_map is better for pointer keys

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

diff --git a/xmloff/source/forms/layerexport.hxx 
b/xmloff/source/forms/layerexport.hxx
index 39e6b5667c0f..4d19386efa13 100644
--- a/xmloff/source/forms/layerexport.hxx
+++ b/xmloff/source/forms/layerexport.hxx
@@ -21,7 +21,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
@@ -43,12 +43,12 @@ namespace xmloff
 typedef o3tl::sorted_vector< css::uno::Reference< css::beans::XPropertySet 
> > PropertySetBag;
 
 // maps objects (property sets) to strings, e.g. control ids.
-typedef ::std::map  <   css::uno::Reference< css::beans::XPropertySet >
+typedef ::std::unordered_map  <   css::uno::Reference< 
css::beans::XPropertySet >
 ,   OUString
 >   MapPropertySet2String;
 
 // map pages to maps (of property sets to strings)
-typedef ::std::map  <   css::uno::Reference< css::drawing::XDrawPage >
+typedef ::std::unordered_map  <   css::uno::Reference< 
css::drawing::XDrawPage >
 ,   MapPropertySet2String
 >   MapPropertySet2Map;
 
@@ -106,7 +106,7 @@ namespace xmloff
 // TODO: To avoid this construct above, and to have a cleaner 
implementation, a class encapsulating the
 // export of a single page should be introduced.
 
-typedef std::map, 
sal_Int32> MapPropertySet2Int;
+typedef 
std::unordered_map, sal_Int32> 
MapPropertySet2Int;
 MapPropertySet2Int  m_aControlNumberFormats;
 // maps controls to format keys, which are relative to our own 
formats supplier
 
diff --git a/xmloff/source/forms/layerimport.hxx 
b/xmloff/source/forms/layerimport.hxx
index 448076ec8b4f..21e3a79c723b 100644
--- a/xmloff/source/forms/layerimport.hxx
+++ b/xmloff/source/forms/layerimport.hxx
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -58,7 +59,7 @@ namespace xmloff
 rtl::Reference  m_xAutoStyles;
 
 typedef std::map< OUString, css::uno::Reference< 
css::beans::XPropertySet > > MapString2PropertySet;
-typedef std::map, 
MapString2PropertySet> MapDrawPage2Map;
+typedef 
std::unordered_map, 
MapString2PropertySet> MapDrawPage2Map;
 
 MapDrawPage2Map m_aControlIds;  // ids of the controls 
on all known page
 MapDrawPage2Map::iterator m_aCurrentPageIds;  // ifs of the 
controls on the current page


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

2021-08-01 Thread Noel Grandin (via logerrit)
 xmloff/source/forms/layerexport.cxx |2 +-
 xmloff/source/forms/layerexport.hxx |5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 5678db6ff2d8d1e1bc73972b8af8e6d063d499ad
Author: Noel Grandin 
AuthorDate: Sun Aug 1 11:00:18 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 20:06:21 2021 +0200

o3tl::sorted_vector is better for small sets of pointers

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

diff --git a/xmloff/source/forms/layerexport.cxx 
b/xmloff/source/forms/layerexport.cxx
index e87d8fae9fc3..c6d9edf17378 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -717,7 +717,7 @@ namespace xmloff
 {
 Reference< XPropertySet > xProps( _rxControl, UNO_QUERY );
 OSL_ENSURE( xProps.is(), "OFormLayerXMLExport_Impl::excludeFromExport: 
invalid control model!" );
-::std::pair< PropertySetBag::iterator, bool > aPos =
+::std::pair< PropertySetBag::const_iterator, bool > aPos =
   m_aIgnoreList.insert( xProps );
 OSL_ENSURE( aPos.second, "OFormLayerXMLExport_Impl::excludeFromExport: 
element already exists in the ignore list!" );
 }
diff --git a/xmloff/source/forms/layerexport.hxx 
b/xmloff/source/forms/layerexport.hxx
index 3fabafb57b5a..39e6b5667c0f 100644
--- a/xmloff/source/forms/layerexport.hxx
+++ b/xmloff/source/forms/layerexport.hxx
@@ -22,7 +22,6 @@
 #include 
 
 #include 
-#include 
 
 #include 
 #include 
@@ -31,6 +30,7 @@
 #include 
 #include "callbacks.hxx"
 #include 
+#include 
 
 class SvXMLExport;
 class SvXMLNumFmtExport;
@@ -40,8 +40,7 @@ class SvXMLExportPropertyMapper;
 namespace xmloff
 {
 
-typedef ::std::set  <   css::uno::Reference< css::beans::XPropertySet >
->   PropertySetBag;
+typedef o3tl::sorted_vector< css::uno::Reference< css::beans::XPropertySet 
> > PropertySetBag;
 
 // maps objects (property sets) to strings, e.g. control ids.
 typedef ::std::map  <   css::uno::Reference< css::beans::XPropertySet >


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

2021-08-01 Thread Noel Grandin (via logerrit)
 xmloff/source/draw/EnhancedCustomShapeToken.cxx |   38 ++--
 1 file changed, 17 insertions(+), 21 deletions(-)

New commits:
commit e698cbd8f860ba6f483f1476e694706717451d2f
Author: Noel Grandin 
AuthorDate: Sat Jul 31 19:03:44 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 13:56:26 2021 +0200

osl::Mutex->static local in EnhancedCustomShapeToken

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

diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx 
b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
index 34bc3f61b874..38ca0df48e6a 100644
--- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -18,20 +18,12 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 
 namespace xmloff::EnhancedCustomShapeToken {
 
-typedef std::unordered_map< const char*, EnhancedCustomShapeTokenEnum, 
rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
-static TypeNameHashMap* pHashMap = nullptr;
-static ::osl::Mutex& getHashMapMutex()
-{
-static osl::Mutex s_aHashMapProtection;
-return s_aHashMapProtection;
-}
 
 namespace {
 
@@ -172,27 +164,31 @@ const TokenTable pTokenTableArray[] =
 { "NotFound",   EAS_NotFound }
 };
 
-EnhancedCustomShapeTokenEnum EASGet( const OUString& rShapeType )
+typedef std::unordered_map< const char*, EnhancedCustomShapeTokenEnum, 
rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
+static const TypeNameHashMap& GetNameHashMap()
 {
-if ( !pHashMap )
-{   // init hash map
-::osl::MutexGuard aGuard( getHashMapMutex() );
-if ( !pHashMap )
-{
-TypeNameHashMap* pH = new TypeNameHashMap;
+static TypeNameHashMap aHashMap = []()
+{   // init hash map
+TypeNameHashMap res;
 for (auto const & pair : pTokenTableArray)
-(*pH)[pair.pS] = pair.pE;
-pHashMap = pH;
-}
-}
+res[pair.pS] = pair.pE;
+return res;
+}();
+
+return aHashMap;
+}
+
+EnhancedCustomShapeTokenEnum EASGet( const OUString& rShapeType )
+{
 EnhancedCustomShapeTokenEnum eRetValue = EAS_NotFound;
 int i, nLen = rShapeType.getLength();
 std::unique_ptr pBuf(new char[ nLen + 1 ]);
 for ( i = 0; i < nLen; i++ )
 pBuf[ i ] = static_cast(rShapeType[ i ]);
 pBuf[ i ] = 0;
-TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf.get() ) );
-if ( aHashIter != pHashMap->end() )
+auto& rHashMap = GetNameHashMap();
+TypeNameHashMap::const_iterator aHashIter( rHashMap.find( pBuf.get() ) );
+if ( aHashIter != rHashMap.end() )
 eRetValue = (*aHashIter).second;
 return eRetValue;
 }


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

2021-08-01 Thread Noel Grandin (via logerrit)
 xmloff/source/core/xmlexp.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a32af6867b7fdc6dccf78ffbb63573fd4224883b
Author: Noel Grandin 
AuthorDate: Sat Jul 31 19:05:10 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 13:54:57 2021 +0200

osl::Mutex->std::mutex in SvXMLExport::SetError

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 3159aa44e683..f45afea8aaa5 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -21,11 +21,11 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -2269,8 +2269,8 @@ void SvXMLExport::SetError(
 const Reference& rLocator )
 {
 // allow multi-threaded access to the cancel() method
-static osl::Mutex aMutex;
-osl::MutexGuard aGuard(aMutex);
+static std::mutex aMutex;
+std::lock_guard aGuard(aMutex);
 
 // maintain error flags
 if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )


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

2021-07-20 Thread Noel Grandin (via logerrit)
 xmloff/source/style/xmlexppr.cxx |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 37d5cdef8d4678eed03909bd5459d52cd0a19ed7
Author: Noel Grandin 
AuthorDate: Mon Jul 19 12:31:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 20 11:57:26 2021 +0200

no need to allocate Sequence separately in FilterPropertiesInfo_Impl

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

diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index aeda6e081405..44bab345afe2 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -158,7 +159,7 @@ class FilterPropertiesInfo_Impl
 {
 FilterPropertyInfoList_Impl aPropInfos;
 
-std::unique_ptr> pApiNames;
+std::optional> mxApiNames;
 
 public:
 FilterPropertiesInfo_Impl();
@@ -183,13 +184,13 @@ void FilterPropertiesInfo_Impl::AddProperty(
 {
 aPropInfos.emplace_back(rApiName, nIndex);
 
-OSL_ENSURE( !pApiNames, "performance warning: API names already retrieved" 
);
-pApiNames.reset();
+OSL_ENSURE( !mxApiNames, "performance warning: API names already 
retrieved" );
+mxApiNames.reset();
 }
 
 const uno::Sequence& FilterPropertiesInfo_Impl::GetApiNames()
 {
-if( !pApiNames )
+if( !mxApiNames )
 {
 // we have to do three things:
 // 1) sort API names,
@@ -232,8 +233,8 @@ const uno::Sequence& 
FilterPropertiesInfo_Impl::GetApiNames()
 }
 
 // construct sequence
-pApiNames.reset( new Sequence < OUString >( aPropInfos.size() ) );
-OUString *pNames = pApiNames->getArray();
+mxApiNames.emplace( aPropInfos.size() );
+OUString *pNames = mxApiNames->getArray();
 
 for (auto const& propInfo : aPropInfos)
 {
@@ -242,7 +243,7 @@ const uno::Sequence& 
FilterPropertiesInfo_Impl::GetApiNames()
 }
 }
 
-return *pApiNames;
+return *mxApiNames;
 }
 
 void FilterPropertiesInfo_Impl::FillPropertyStateArray(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-19 Thread Samuel Mehrbrodt (via logerrit)
 xmloff/source/draw/shapeexport.cxx |   37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 903f7dd825caca1af15d985658043ec055c4eb45
Author: Samuel Mehrbrodt 
AuthorDate: Thu Jul 15 11:50:57 2021 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jul 19 12:55:41 2021 +0200

Make obvious that this is in a try/catch block

Change-Id: I1118ef026730481eeef127b570bfd59de4434455
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119163
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index d9d4116a2c55..105281b46d0c 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -583,29 +583,32 @@ void XMLShapeExport::exportShape(const uno::Reference< 
drawing::XShape >& xShape
 
 // export hyperlinks with . Currently only in draw since 
draw
 // does not support document events
-if( xSet.is() && (GetExport().GetModelType() == 
SvtModuleOptions::EFactory::DRAW) ) try
+if( xSet.is() && (GetExport().GetModelType() == 
SvtModuleOptions::EFactory::DRAW) )
 {
-presentation::ClickAction eAction = presentation::ClickAction_NONE;
-xSet->getPropertyValue("OnClick") >>= eAction;
-
-if( (eAction == presentation::ClickAction_DOCUMENT) ||
-(eAction == presentation::ClickAction_BOOKMARK) )
+try
 {
-OUString sURL;
-xSet->getPropertyValue(gsBookmark) >>= sURL;
+presentation::ClickAction eAction = presentation::ClickAction_NONE;
+xSet->getPropertyValue("OnClick") >>= eAction;
 
-if( !sURL.isEmpty() )
+if( (eAction == presentation::ClickAction_DOCUMENT) ||
+(eAction == presentation::ClickAction_BOOKMARK) )
 {
-mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
-mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, 
XML_SIMPLE );
-mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, 
XML_EMBED );
-pHyperlinkElement.reset( new SvXMLElementExport(mrExport, 
XML_NAMESPACE_DRAW, XML_A, true, true) );
+OUString sURL;
+xSet->getPropertyValue(gsBookmark) >>= sURL;
+
+if( !sURL.isEmpty() )
+{
+mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL 
);
+mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, 
XML_SIMPLE );
+mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, 
XML_EMBED );
+pHyperlinkElement.reset( new SvXMLElementExport(mrExport, 
XML_NAMESPACE_DRAW, XML_A, true, true) );
+}
 }
 }
-}
-catch(const uno::Exception&)
-{
-TOOLS_WARN_EXCEPTION("xmloff", "XMLShapeExport::exportShape(): 
exception during hyperlink export");
+catch(const uno::Exception&)
+{
+TOOLS_WARN_EXCEPTION("xmloff", "XMLShapeExport::exportShape(): 
exception during hyperlink export");
+}
 }
 
 if( xSet.is() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-30 Thread Jan-Marek Glogowski (via logerrit)
 xmloff/source/transform/TransformerBase.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a876055b6f56e838114cce041d4c49aed43693f9
Author: Jan-Marek Glogowski 
AuthorDate: Wed Jun 30 11:01:06 2021 +
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 30 14:37:02 2021 +0200

Fix potential (but unlikely) overflow

warning: assuming signed overflow does not occur when assuming
that (X + c) >= X is always true [-Wstrict-overflow]
 while( nPos < nLen )
~^~

Change-Id: I95e3bb4a131eaf4e82fbc74cc0bea92930b6afe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118159
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/xmloff/source/transform/TransformerBase.cxx 
b/xmloff/source/transform/TransformerBase.cxx
index c937e00ca2c4..8814d19f26af 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -1315,12 +1315,12 @@ bool XMLTransformerBase::ConvertURIToOOo( OUString& 
rURI,
 {
 case '/':
 // a relative path segment within the package
-nPos = nLen;// leave loop
+nPos = nLen - 1;// leave loop
 break;
 case ':':
 // a schema
 bPackage = false;
-nPos = nLen;// leave loop
+nPos = nLen - 1;// leave loop
 break;
 default:
 // we don't care about any other characters
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-22 Thread Caolán McNamara (via logerrit)
 xmloff/source/draw/shapeexport.cxx |   31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit c5d984b840db595796051bc2bf37d1c2179157e3
Author: Caolán McNamara 
AuthorDate: Tue Jun 22 09:42:58 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 22 13:06:49 2021 +0200

crashtesting: assert on export of tdf105134-1.docx to odt

when interactively saving on creating preview for recently used

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

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index e68bf388325f..5ed81e82a247 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2129,23 +2129,26 @@ void XMLShapeExport::ImpExportLineShape(
 // create base position
 awt::Point aBasePosition(FRound(aTRTranslate.getX()), 
FRound(aTRTranslate.getY()));
 
-// get the two points
-uno::Any aAny(xPropSet->getPropertyValue("Geometry"));
-if (auto pSourcePolyPolygon
-= o3tl::tryAccess(aAny))
+if (xPropSet->getPropertySetInfo()->hasPropertyByName("Geometry"))
 {
-if (pSourcePolyPolygon->getLength() > 0)
+// get the two points
+uno::Any aAny(xPropSet->getPropertyValue("Geometry"));
+if (auto pSourcePolyPolygon
+= o3tl::tryAccess(aAny))
 {
-const drawing::PointSequence& rInnerSequence = 
(*pSourcePolyPolygon)[0];
-if (rInnerSequence.hasElements())
+if (pSourcePolyPolygon->getLength() > 0)
 {
-const awt::Point& rPoint = rInnerSequence[0];
-aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + 
aBasePosition.Y);
-}
-if (rInnerSequence.getLength() > 1)
-{
-const awt::Point& rPoint = rInnerSequence[1];
-aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + 
aBasePosition.Y);
+const drawing::PointSequence& rInnerSequence = 
(*pSourcePolyPolygon)[0];
+if (rInnerSequence.hasElements())
+{
+const awt::Point& rPoint = rInnerSequence[0];
+aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + 
aBasePosition.Y);
+}
+if (rInnerSequence.getLength() > 1)
+{
+const awt::Point& rPoint = rInnerSequence[1];
+aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + 
aBasePosition.Y);
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-08 Thread Vasily Melenchuk (via logerrit)
 xmloff/source/style/xmlnumi.cxx |  203 
 1 file changed, 82 insertions(+), 121 deletions(-)

New commits:
commit 93605ab85a8b62dbfb59a9181a26b75a032b9a94
Author: Vasily Melenchuk 
AuthorDate: Mon Jun 7 09:49:53 2021 +0300
Commit: Michael Stahl 
CommitDate: Tue Jun 8 10:49:23 2021 +0200

Use containerToSequence for Sequence of dynamic size

Instead of set of conditions to detect size of resulting Sequence
this should be shorter and cleaner.

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

diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 778741501711..3f8040bbad6c 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -40,6 +40,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -351,36 +353,27 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SvxXMLListLevelStyleCo
 
 Sequence 
SvxXMLListLevelStyleContext_Impl::GetProperties()
 {
+if (!bBullet && !bImage && !bNum)
+{
+return Sequence();
+}
+
 sal_Int16 eType = NumberingType::NUMBER_NONE;
+std::vector aProperties;
 
-sal_Int32 nCount = 0;
 if( bBullet )
 {
 eType = NumberingType::CHAR_SPECIAL;
-nCount = 15; // 'cBullet' will be written anyway if 'bBullet' is true
 }
 if( bImage )
 {
 eType = NumberingType::BITMAP;
-nCount = 15;
-
-if( !sImageURL.isEmpty() || xBase64Stream.is() )
-nCount++;
 }
 if( bNum )
 {
 eType = NumberingType::ARABIC;
 GetImport().GetMM100UnitConverter().convertNumFormat(
 eType, sNumFormat, sNumLetterSync, true );
-nCount = 15;
-}
-
-if( ( bBullet || bNum ) && nRelSize )
-nCount++;
-
-if( !bImage && bHasColor )
-{
-nCount++;
 }
 
 if (bBullet && !sSuffix.isEmpty())
@@ -399,142 +392,110 @@ Sequence 
SvxXMLListLevelStyleContext_Impl::GetProperties()
 }
 }
 
-Sequence aPropSeq( nCount );
-if( nCount > 0 )
-{
-beans::PropertyValue *pProps = aPropSeq.getArray();
-sal_Int32 nPos = 0;
-pProps[nPos].Name = "NumberingType";
-pProps[nPos++].Value <<= eType ;
+aProperties.push_back(comphelper::makePropertyValue("NumberingType", 
eType));
 
-pProps[nPos].Name = "Prefix";
-pProps[nPos++].Value <<= sPrefix;
+aProperties.push_back(comphelper::makePropertyValue("Prefix", sPrefix));
 
-pProps[nPos].Name = "Suffix";
-pProps[nPos++].Value <<= sSuffix;
+aProperties.push_back(comphelper::makePropertyValue("Suffix", sSuffix));
 
-pProps[nPos].Name = "Adjust";
-pProps[nPos++].Value <<= eAdjust;
+aProperties.push_back(comphelper::makePropertyValue("Adjust", eAdjust));
 
-sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
-pProps[nPos].Name = "LeftMargin";
-pProps[nPos++].Value <<= nLeftMargin;
+sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
+aProperties.push_back(comphelper::makePropertyValue("LeftMargin", 
nLeftMargin));
 
-sal_Int32 nFirstLineOffset = -nMinLabelWidth;
+sal_Int32 nFirstLineOffset = -nMinLabelWidth;
+aProperties.push_back(comphelper::makePropertyValue("FirstLineOffset", 
nFirstLineOffset));
 
-pProps[nPos].Name = "FirstLineOffset";
-pProps[nPos++].Value <<= nFirstLineOffset;
+aProperties.push_back(comphelper::makePropertyValue("SymbolTextDistance", 
static_cast(nMinLabelDist)));
 
-pProps[nPos].Name = "SymbolTextDistance";
-pProps[nPos++].Value <<= static_cast(nMinLabelDist);
+
aProperties.push_back(comphelper::makePropertyValue("PositionAndSpaceMode", 
ePosAndSpaceMode));
 
-pProps[nPos].Name = "PositionAndSpaceMode";
-pProps[nPos++].Value <<= ePosAndSpaceMode;
-pProps[nPos].Name = "LabelFollowedBy";
-pProps[nPos++].Value <<= eLabelFollowedBy;
-pProps[nPos].Name = "ListtabStopPosition";
-pProps[nPos++].Value <<= nListtabStopPosition;
-pProps[nPos].Name = "FirstLineIndent";
-pProps[nPos++].Value <<= nFirstLineIndent;
-pProps[nPos].Name = "IndentAt";
-pProps[nPos++].Value <<= nIndentAt;
+aProperties.push_back(comphelper::makePropertyValue("LabelFollowedBy", 
eLabelFollowedBy));
 
-OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName(
-XmlStyleFamily::TEXT_TEXT, sTextStyleName  );
-pProps[nPos].Name = "CharStyleName";
-pProps[nPos++].Value <<= sDisplayTextStyleName;
+aProperties.push_back(comphelper::makePropertyValue("ListtabStopPosition", 
nListtabStopPosition));
 
-if( bBullet )
-{
-awt::FontDescriptor aFDesc;
-aFDesc.Name = 

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

2021-06-04 Thread Andrea Gelmini (via logerrit)
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit da8970034d1db518ed2225b7e6046cafb788d26d
Author: Andrea Gelmini 
AuthorDate: Fri Jun 4 11:56:24 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Jun 4 12:40:45 2021 +0200

Fix typo

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

diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx 
b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
index 56ae47bfab05..6854b56d7f79 100644
--- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
+++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
@@ -136,8 +136,8 @@ void XMLEmbeddedObjectImportContext::SetComponent( 
Reference< XComponent > const
 
 xComp = rComp;  // keep ref to component only if there is a handler
 
-// #i34042: copy namepspace declarations
-// We created a new instance of XMLImport, so we need to propogate the 
namespace
+// #i34042: copy namespace declarations
+// We created a new instance of XMLImport, so we need to propagate the 
namespace
 // declarations to it.
 pFastHandler->GetNamespaceMap() = GetImport().GetNamespaceMap();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-03 Thread Noel Grandin (via logerrit)
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 06a983b213b8fb71fdac1004868d7b4fdd6a9833
Author: Noel Grandin 
AuthorDate: Thu Jun 3 14:15:13 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 3 18:44:59 2021 +0200

tdf#142546 broken formulas in .FODT files

regression from
commit 81fe31d2c8977791f9b90ab1da4fbb1a778f87fb
Date:   Tue Nov 3 18:25:10 2020 +0200
use fastparser in XMLEmbeddedObjectImportContext

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

diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx 
b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
index 79705901cf2d..56ae47bfab05 100644
--- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
+++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
@@ -135,6 +135,11 @@ void XMLEmbeddedObjectImportContext::SetComponent( 
Reference< XComponent > const
 xImporter->setTargetDocument( rComp );
 
 xComp = rComp;  // keep ref to component only if there is a handler
+
+// #i34042: copy namepspace declarations
+// We created a new instance of XMLImport, so we need to propogate the 
namespace
+// declarations to it.
+pFastHandler->GetNamespaceMap() = GetImport().GetNamespaceMap();
 }
 
 XMLEmbeddedObjectImportContext::XMLEmbeddedObjectImportContext(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-29 Thread Mike Kaganski (via logerrit)
 xmloff/source/text/txtimp.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e0c4cdf9a874bb40f028a26562e6399d39cb2c0f
Author: Mike Kaganski 
AuthorDate: Sat May 29 21:16:00 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sat May 29 21:58:15 2021 +0200

Missing include

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

diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 90dc8dcc0c84..813e66ed8083 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-29 Thread Noel Grandin (via logerrit)
 xmloff/source/style/styleexp.cxx |   14 +++---
 xmloff/source/text/txtimp.cxx|   22 +++---
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 397ba047c941eb7d77a15a8de72e20ace4744da1
Author: Noel Grandin 
AuthorDate: Fri May 28 15:19:09 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat May 29 19:23:31 2021 +0200

std::unique_ptr->std::optional

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

diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 8b4256a3d043..159d5b50e02e 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -440,7 +440,7 @@ void XMLStyleExport::exportStyleFamily(
// If next styles are supported and used styles should be exported only,
 // the next style may be unused but has to be exported, too. In this case
 // the names of all exported styles are remembered.
-std::unique_ptr > pExportedStyles;
+std::optional > xExportedStyles;
 bool bFirstStyle = true;
 
 const uno::Sequence< OUString> aSeq = xStyleCont->getElementNames();
@@ -478,14 +478,14 @@ void XMLStyleExport::exportStyleFamily(
 xPropSet->getPropertySetInfo();
 
 if (xPropSetInfo->hasPropertyByName( gsFollowStyle ))
-pExportedStyles.reset(new std::set);
+xExportedStyles.emplace();
 bFirstStyle = false;
 }
 
-if (pExportedStyles && bExported)
+if (xExportedStyles && bExported)
 {
 // If next styles are supported, remember this style's name.
-pExportedStyles->insert( xStyle->getName() );
+xExportedStyles->insert( xStyle->getName() );
 }
 }
 
@@ -495,7 +495,7 @@ void XMLStyleExport::exportStyleFamily(
 pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
 }
 
-if( !pExportedStyles )
+if( !xExportedStyles )
 return;
 
 // if next styles are supported, export all next styles that are
@@ -532,13 +532,13 @@ void XMLStyleExport::exportStyleFamily(
 // if the next style hasn't been exported by now, export it now
 // and remember its name.
 if (xStyle->getName() != sNextName &&
-0 == pExportedStyles->count( sTmp ))
+0 == xExportedStyles->count( sTmp ))
 {
 xStyleCont->getByName( sNextName ) >>= xStyle;
 assert(xStyle.is());
 
 if (exportStyle(xStyle, rXMLFamily, rPropMapper, xStyleCont, 
pPrefix))
-pExportedStyles->insert( sTmp );
+xExportedStyles->insert( sTmp );
 }
 }
 }
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 4d521f295b95..90dc8dcc0c84 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -93,8 +93,8 @@ using namespace ::com::sun::star::ucb;
 
 struct XMLTextImportHelper::Impl
 {
-std::unique_ptr< std::vector > m_xPrevFrmNames;
-std::unique_ptr< std::vector > m_xNextFrmNames;
+std::optional< std::vector > m_xPrevFrmNames;
+std::optional< std::vector > m_xNextFrmNames;
 std::unique_ptr m_xTextListsHelper;
 
 rtl::Reference m_xAutoStyles;
@@ -172,7 +172,7 @@ struct XMLTextImportHelper::Impl
 
 OUString m_sCellParaStyleDefault;
 
-std::unique_ptr> 
m_pCrossRefHeadingBookmarkMap;
+std::optional> m_xCrossRefHeadingBookmarkMap;
 
 Impl(   uno::Reference const& rModel,
 SvXMLImport & rImport,
@@ -2183,8 +2183,8 @@ void XMLTextImportHelper::ConnectFrameChains(
 {
 if (!m_xImpl->m_xPrevFrmNames)
 {
-m_xImpl->m_xPrevFrmNames.reset( new std::vector );
-m_xImpl->m_xNextFrmNames.reset( new std::vector );
+m_xImpl->m_xPrevFrmNames.emplace();
+m_xImpl->m_xNextFrmNames.emplace();
 }
 m_xImpl->m_xPrevFrmNames->push_back(rFrmName);
 m_xImpl->m_xNextFrmNames->push_back(sNextFrmName);
@@ -2372,11 +2372,11 @@ OUString const& 
XMLTextImportHelper::GetCellParaStyleDefault() const
 
 void XMLTextImportHelper::AddCrossRefHeadingMapping(OUString const& rFrom, 
OUString const& rTo)
 {
-if (!m_xImpl->m_pCrossRefHeadingBookmarkMap)
+if (!m_xImpl->m_xCrossRefHeadingBookmarkMap)
 {
-m_xImpl->m_pCrossRefHeadingBookmarkMap.reset(new std::map);
+m_xImpl->m_xCrossRefHeadingBookmarkMap.emplace();
 }
-m_xImpl->m_pCrossRefHeadingBookmarkMap->insert(std::make_pair(rFrom, rTo));
+m_xImpl->m_xCrossRefHeadingBookmarkMap->insert(std::make_pair(rFrom, rTo));
 }
 
 // tdf#94804: hack to map cross reference fields that reference duplicate marks
@@ -2384,7 +2384,7 @@ void 

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

2021-05-11 Thread Mike Kaganski (via logerrit)
 xmloff/source/core/xmlimp.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b4c6fe22e2f91f33ce3705f01ef35b46e980b926
Author: Mike Kaganski 
AuthorDate: Tue May 11 15:20:02 2021 +0200
Commit: Mike Kaganski 
CommitDate: Tue May 11 16:30:05 2021 +0200

Missing include

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

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 1f21acef1876..d3973c87e16c 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-01 Thread Jochen Nitschke (via logerrit)
 xmloff/source/style/xmlexppr.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit ce7729ab473b971164822338661d1a4828d860d2
Author: Jochen Nitschke 
AuthorDate: Sat May 1 16:02:00 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat May 1 19:02:42 2021 +0200

remove superfluous loop variable

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

diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index bd3ee809ec1a..129a568065c1 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -267,8 +267,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
 const beans::GetDirectPropertyTolerantResult *pResults = 
aResults.getConstArray();
 FilterPropertyInfoList_Impl::iterator 
aPropIter(aPropInfos.begin());
 XMLPropertyState aNewProperty( -1 );
-size_t i = 0;
-while (nResultCount > 0 && i < aPropInfos.size())
+while (nResultCount > 0 && aPropIter != aPropInfos.end())
 {
 if (pResults->Name == aPropIter->GetApiName())
 {
@@ -284,7 +283,6 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
 --nResultCount;
 }
 ++aPropIter;
-++i;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-04-11 Thread Caolán McNamara (via logerrit)
 xmloff/source/draw/ximpstyl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 87586cd0e41b1dbcbf49df993d69ef7aa426f7e0
Author: Caolán McNamara 
AuthorDate: Sun Apr 11 14:42:33 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 11 17:03:45 2021 +0200

ofz#32467 Timeout: add arbitrary master page limit when fuzzing

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

diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index e606c223b39d..a702872a736b 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -48,6 +48,7 @@
 #include "layerimp.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1318,6 +1319,10 @@ css::uno::Reference< css::xml::sax::XFastContextHandler 
> SdXMLMasterStylesConte
 sal_Int32 nMasterPageCount = xMasterPages->getCount();
 if (nNewMasterPageCount + 1 > nMasterPageCount)
 {
+// arbitrary limit to master pages when fuzzing to avoid 
deadend timeouts
+if (nMasterPageCount >= 64 && utl::ConfigManager::IsFuzzing())
+return nullptr;
+
 // new page, create and insert
 xNewMasterPage = 
xMasterPages->insertNewByIndex(nMasterPageCount);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-04-09 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfi.cxx |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 5d1042cbd25b22babaf8b30bc4edff6f70750b5e
Author: Eike Rathke 
AuthorDate: Sat Apr 10 00:16:15 2021 +0200
Commit: Eike Rathke 
CommitDate: Sat Apr 10 03:49:37 2021 +0200

ODF load: use AAA/ instead of NN/NNN(N) for implicit secondary calendar

For example ja-JP Gengou calendar.
NN/NNN always worked because ja-JP Gregorian calendar defines the
same day of week names so it never was apparent.

Change-Id: Ief0d7ce7532b7ed7d58910bf150b190b7872db28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113900
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 28dbe6574336..3928b6788af1 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -955,11 +955,26 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
 //  HasEra flag is set
 break;
 case SvXMLStyleTokens::DayOfWeek:
-rParent.UpdateCalendar( sCalendar );
 //! I18N doesn't provide SYSTEM or extended date information yet
-rParent.AddNfKeyword(
-sal::static_int_cast< sal_uInt16 >(
-bEffLong ? NF_KEY_ : NF_KEY_NN ) );
+{
+// Implicit secondary calendar uses A keyword, default and
+// explicit calendar N keyword.
+rParent.UpdateCalendar( sCalendar);
+const SvXMLNumFormatContext::ImplicitCalendar eCal = 
rParent.GetImplicitCalendarState();
+if (eCal == SvXMLNumFormatContext::ImplicitCalendar::SECONDARY
+|| eCal == 
SvXMLNumFormatContext::ImplicitCalendar::SECONDARY_FROM_OTHER)
+{
+rParent.AddNfKeyword(
+sal::static_int_cast< sal_uInt16 >(
+bEffLong ? NF_KEY_ : NF_KEY_AAA ) );
+}
+else
+{
+rParent.AddNfKeyword(
+sal::static_int_cast< sal_uInt16 >(
+bEffLong ? NF_KEY_ : NF_KEY_NN ) );
+}
+}
 break;
 case SvXMLStyleTokens::WeekOfYear:
 rParent.UpdateCalendar( sCalendar );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-04-09 Thread Mike Kaganski (via logerrit)
 xmloff/source/core/xmlexp.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit c87e0938b3ee9f4c1f87c4ec53f3e94a022fe6f0
Author: Mike Kaganski 
AuthorDate: Fri Apr 9 12:43:59 2021 +0200
Commit: Mike Kaganski 
CommitDate: Fri Apr 9 15:17:18 2021 +0200

Remove duplicating call

... introduced in 14ee634e9cca474cacccd8872d5fdf46ea53f108
and obsoleted by 8a32a014fbf336ce32e4a1d4b95c4d286029ea4c
shortly after.

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

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 3d20d3e33f41..32312229c1a9 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1152,8 +1152,6 @@ void SvXMLExport::ImplExportContent()
 {
 CheckAttrList();
 
-CheckAttrList();
-
 {
 SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_BODY,
   true, true );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   4   5   6   7   >