[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - 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 c5b3802cc1e2ced5326ca4d9d30045b84d58aea9
Author: Caolán McNamara 
AuthorDate: Mon Apr 10 10:38:32 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Apr 10 18:52:57 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/+/150152
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

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: Branch 'libreoffice-7-5' - xmloff/source

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

New commits:
commit d505d6b5c60aae0109130e731fd8298a1905b501
Author: Michael Stahl 
AuthorDate: Tue Mar 14 18:24:30 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Mar 18 20:06:07 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 
(cherry picked from commit 9070c1b0404fb72d2553f6fa8f702e70c0abb269)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148959
Reviewed-by: Caolán McNamara 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index c8d513d4e724..0f5b711a021a 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: Branch 'libreoffice-7-5' - xmloff/source

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

New commits:
commit 5c822b9fd03b8e78cefaa6de1d258586c492450d
Author: Michael Stahl 
AuthorDate: Mon Jan 23 15:50:57 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 24 10:33:19 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 
(cherry picked from commit 09e3aaa2d22b8fe2887ae973b55f3ad274a960ee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146027
Reviewed-by: Miklos Vajna 

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: Branch 'libreoffice-7-5' - xmloff/source

2023-01-06 Thread Michael Stahl (via logerrit)
 xmloff/source/text/XMLChangedRegionImportContext.cxx |   11 ---
 xmloff/source/text/txtparai.cxx  |   17 +
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit af920245710d1a51d98bba2c18b7002a32865e0b
Author: Michael Stahl 
AuthorDate: Thu Jan 5 18:07:03 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jan 6 20:46:30 2023 +

tdf#152710 xmloff: ignore exception in XMLChangedRegionImportContext

The xOldCursor must be restored in all cases.

Also XMLParaContext triggers an exception which ends up aborting the
import.

Change-Id: I8f4785e0e9bde4c8c484954a4d66f3b82d6ca28c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145094
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit e5b5d9c8d33b1dd87e5a50856ad02f21df59dc5b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145012
Reviewed-by: Caolán McNamara 

diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx 
b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 4d43a8de3027..fe00c4a058b9 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -122,9 +122,14 @@ void 
XMLChangedRegionImportContext::endFastElement(sal_Int32 )
 {
 // delete last paragraph
 // (one extra paragraph was inserted in the beginning)
-rtl::Reference rHelper =
-GetImport().GetTextImport();
-rHelper->DeleteParagraph();
+try
+{
+GetImport().GetTextImport()->DeleteParagraph();
+}
+catch (uno::Exception const&)
+{   // cursor may be disposed - must reset to old cursor!
+SAL_INFO("xmloff.text", "XMLChangedRegionImportContext: delete 
paragraph failed");
+}
 
 GetImport().GetTextImport()->SetCursor(xOldCursor);
 xOldCursor = nullptr;
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 9844e2628c89..5fffc202612a 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1688,10 +1688,19 @@ void XMLParaContext::endFastElement(sal_Int32 )
 {
 rtl::Reference < XMLTextImportHelper > xTxtImport(
 GetImport().GetTextImport());
-Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
-if( !xCrsrRange.is() )
-return; // Robust (defective file)
-Reference < XTextRange > xEnd(xCrsrRange->getStart());
+Reference xEnd;
+try
+{
+Reference const xCrsrRange(xTxtImport->GetCursorAsRange());
+if (!xCrsrRange.is())
+return; // Robust (defective file)
+xEnd = xCrsrRange->getStart();
+}
+catch (uno::Exception const&)
+{
+SAL_INFO("xmloff.text", "XMLParaContext: cursor disposed?");
+return;
+}
 
 // if we have an id set for this paragraph, get a cursor for this
 // paragraph and register it with the given identifier


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - xmloff/source

2022-12-10 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 1c0cd3c732298f86f60479dd088f914bf1aca54a
Author: Caolán McNamara 
AuthorDate: Thu Dec 8 16:25:24 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Dec 10 10:08:35 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 
(cherry picked from commit 8a33bde5288a4a652de35846aa34354044b872c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143732

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