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

2018-04-04 Thread Caolán McNamara
 xmloff/source/draw/ximpcustomshape.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bd89b70a2f7ecccfa2edc965121c4b5976e54db9
Author: Caolán McNamara 
Date:   Mon Mar 26 14:06:34 2018 +0100

forcepoint #35 handle odd number of dimension fragments

Change-Id: I97e4e1b38d80276077b3427c90ae33023afb5e59
Reviewed-on: https://gerrit.libreoffice.org/51901
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index 68eba5a5bf62..1070df1c8f01 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -484,7 +484,7 @@ void GetSizeSequence( std::vector< 
css::beans::PropertyValue >& rDest,
 
 if ( !vNum.empty() )
 {
-uno::Sequence< awt::Size > aSizeSeq( vNum.size() / 2 );
+uno::Sequence< awt::Size > aSizeSeq((vNum.size() + 1) / 2);
 std::vector< sal_Int32 >::const_iterator aIter = vNum.begin();
 std::vector< sal_Int32 >::const_iterator aEnd = vNum.end();
 awt::Size* pValues = aSizeSeq.getArray();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-02 Thread Caolán McNamara
 xmloff/source/draw/XMLNumberStyles.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 88b1ca64c0cdb426025b246618e7e9e880c286d8
Author: Caolán McNamara 
Date:   Fri Mar 2 11:06:12 2018 +

ofz#6656 -1 isn't a good flag for all elements filled

Change-Id: I163de8fd943859fbf986da0928f3e3552d063a09
Reviewed-on: https://gerrit.libreoffice.org/50626
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/xmloff/source/draw/XMLNumberStyles.cxx 
b/xmloff/source/draw/XMLNumberStyles.cxx
index 8ca660499cc6..23ce723ec021 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -603,11 +603,8 @@ 
SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
 
 void SdXMLNumberFormatImportContext::add( OUString& rNumberStyle, bool bLong, 
bool bTextual, bool   bDecimal02, OUString& rText )
 {
-if( mnIndex == -1 || mnIndex == 16 )
-{
-mnIndex = -1;
+if (mnIndex == 16)
 return;
-}
 
 const SdXMLDataStyleNumber* pStyleMember = aSdXMLDataStyleNumbers;
 for( sal_uInt8 nIndex = 0; pStyleMember->meNumberStyle != 
XML_TOKEN_INVALID; nIndex++, pStyleMember++ )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-23 Thread Caolán McNamara
 xmloff/source/text/txtparai.cxx |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 6ba5fc85224b8bb0b8e2a5c5013e83644c622e30
Author: Caolán McNamara 
Date:   Fri Feb 23 13:08:16 2018 +

forcepoint #5 null deref

Change-Id: I95b67f98b7028d7ca7c4a9d1c15100e42d359816
Reviewed-on: https://gerrit.libreoffice.org/50243
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 5708930cf798..d3595aac42cd 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1486,9 +1486,14 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
 
 XMLImpSpanContext_Impl::~XMLImpSpanContext_Impl()
 {
-if( pHint )
-pHint->SetEnd( GetImport().GetTextImport()
-->GetCursorAsRange()->getStart() );
+if (!pHint)
+return;
+
+Reference 
xCrsrRange(GetImport().GetTextImport()->GetCursorAsRange());
+if (!xCrsrRange.is())
+return; // Robust (defective file)
+
+pHint->SetEnd(xCrsrRange->getStart());
 }
 
 SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
@@ -1884,7 +1889,7 @@ XMLParaContext::~XMLParaContext()
 GetImport().GetTextImport());
 Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
 if( !xCrsrRange.is() )
-return; // Robust (defect file)
+return; // Robust (defective file)
 Reference < XTextRange > xEnd(xCrsrRange->getStart());
 
 // if we have an id set for this paragraph, get a cursor for this
@@ -1910,7 +1915,7 @@ XMLParaContext::~XMLParaContext()
 try {
 xAttrCursor = xTxtImport->GetText()->createTextCursorByRange( xStart );
 if( !xAttrCursor.is() )
-return; // Robust (defect file)
+return; // Robust (defective file)
 } catch (const uno::Exception &) {
 // createTextCursorByRange() likes to throw runtime exception, even
 // though it just means 'we were unable to create the cursor'
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-29 Thread Abhishek Shrivastava
 xmloff/source/table/XMLTableExport.cxx |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit fa3b7206f1b6f11dc3d133d06289d3e422fd
Author: Abhishek Shrivastava 
Date:   Tue Jan 23 12:49:10 2018 +0530

tdf#106780 Fix for invalid attribute in impress ODF

This patch fixes the invalid ODF generated in impress.
In tables now the attribute is shown as table:name="default"
instead of "text:style-name".

For strict XML version we only set table:name="default"

For Extended/Compatibility XML we set both text:style-name
and table:name

Change-Id: I894fd31f5f0eed3f77b216b3114b5da53acf1f9f
Reviewed-on: https://gerrit.libreoffice.org/48373
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit e3e2f6911d6231c706ce8c77e5cd675d6342)
Reviewed-on: https://gerrit.libreoffice.org/48812
(cherry picked from commit 5563f111d5700bb03884cd469288b09281e37dd1)
Reviewed-on: https://gerrit.libreoffice.org/48825

diff --git a/xmloff/source/table/XMLTableExport.cxx 
b/xmloff/source/table/XMLTableExport.cxx
index 7a291c0a2370..0971e6fa5d03 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -580,6 +580,8 @@ void XMLTableExport::exportTableTemplates()
 
 for( sal_Int32 nIndex = 0; nIndex < xTableFamily->getCount(); nIndex++ 
) try
 {
+SvtSaveOptions::ODFSaneDefaultVersion eVersion = 
mrExport.getSaneDefaultVersion();
+
 Reference< XStyle > xTableStyle( xTableFamily->getByIndex( nIndex 
), UNO_QUERY_THROW );
 if( !xTableStyle->isInUse() )
 continue;
@@ -606,7 +608,20 @@ void XMLTableExport::exportTableTemplates()
 }
 }
 else
-mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, 
GetExport().EncodeStyleName( xTableStyle->getName() ) );
+{
+// Below condition checks if any of the extended version of
+// XML are set
+if ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0)
+{
+mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, 
GetExport().EncodeStyleName( xTableStyle->getName() ) );
+mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, 
GetExport().EncodeStyleName( xTableStyle->getName() ) );
+}
+else
+{
+mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, 
GetExport().EncodeStyleName( xTableStyle->getName() ) );
+}
+
+}
 
  SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, 
XML_TABLE_TEMPLATE, true, true );
 
@@ -631,7 +646,6 @@ void XMLTableExport::exportTableTemplates()
 pElements++;
 }
 
-SvtSaveOptions::ODFSaneDefaultVersion eVersion = 
mrExport.getSaneDefaultVersion();
 if (mbWriter && ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 
0))
 {
 pElements = getWriterSpecificTableStyleMap();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-27 Thread Michael Stahl
 xmloff/source/text/txtparae.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f884e99aea2bf53a8cdc51a8de97cdb4d829576f
Author: Michael Stahl 
Date:   Fri Jan 26 14:24:02 2018 +0100

xmloff: ODF export: don't write LO_EXT attribute unless ODF extended

The loext namespace is not defined when exporting standard ODF
versions, which triggers an assert() in SvXMLNamespaceMap.

(regression from 4469b29faeb8dbf7793a5d81d9c5ddebacf3015f)

Change-Id: Ic93fb0ea8fe092463d3fd18a0fbf4429d8652642
(cherry picked from commit 55650f65de478bcee65fe1e1cf19f106e407f999)
Reviewed-on: https://gerrit.libreoffice.org/48694
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Michael Stahl 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 49f7ff0706ac..78472af3e1d9 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3117,7 +3117,10 @@ void XMLTextParagraphExport::_exportTextGraphic(
 // Add mimetype to make it easier for readers to get the base64 image type 
right, tdf#109202
 OUString aSourceMimeType = getMimeType(sOrigURL);
 if ( !aSourceMimeType.isEmpty() )
-GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", 
aSourceMimeType);
+if (GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012)
+{
+GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", 
aSourceMimeType);
+}
 
 {
 SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-13 Thread Michael Stahl
 xmloff/source/text/XMLIndexTemplateContext.cxx |2 +-
 xmloff/source/text/XMLSectionExport.cxx|   24 +++-
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 934ae5cd6fc2c676429c14834b929707fec9faa1
Author: Michael Stahl 
Date:   Fri Dec 8 13:47:11 2017 +0100

tdf#71737 xmloff: ODF 1.2 doesn't allow hyperlinks in ...

... text:illustration-index-entry-template, so store these elements
only in ODF 1.2 extended, and in loext namespace.

Change-Id: Icf919e91114f5c9aed2adc3f5359b9df61eb3433
Reviewed-on: https://gerrit.libreoffice.org/46088
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit a26c4448e6e5ffcd285cc691bfc4eb6c7edf76bc)
Reviewed-on: https://gerrit.libreoffice.org/46109
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit c5b7e99758553d8d4f1a149bcc3d0b2d5835d312)
Reviewed-on: https://gerrit.libreoffice.org/46219

diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx 
b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 9487cd539571..e6f01fbc8b45 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -217,7 +217,7 @@ SvXMLImportContext 
*XMLIndexTemplateContext::CreateChildContext(
 {
 SvXMLImportContext* pContext = nullptr;
 
-if (XML_NAMESPACE_TEXT == nPrefix)
+if (XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
 {
 TemplateTokenType nToken;
 if (SvXMLUnitConverter::convertEnum(nToken, rLocalName,
diff --git a/xmloff/source/text/XMLSectionExport.cxx 
b/xmloff/source/text/XMLSectionExport.cxx
index f276db392811..b42dd7562ef1 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -1256,6 +1256,7 @@ void XMLSectionExport::ExportIndexTemplateElement(
 
 // convert type to token (and check validity) ...
 XMLTokenEnum eElement(XML_TOKEN_INVALID);
+sal_uInt16 nNamespace(XML_NAMESPACE_TEXT);
 switch(nTokenType)
 {
 case TOK_TTYPE_ENTRY_TEXT:
@@ -1301,6 +1302,27 @@ void XMLSectionExport::ExportIndexTemplateElement(
 break;
 }
 
+if (eType != TEXT_SECTION_TYPE_TOC)
+{
+switch (nTokenType)
+{
+case TOK_TTYPE_HYPERLINK_START:
+case TOK_TTYPE_HYPERLINK_END:
+if (SvtSaveOptions::ODFVER_012 < aODFVersion)
+{
+assert(eType == TEXT_SECTION_TYPE_ILLUSTRATION);
+nNamespace = XML_NAMESPACE_LO_EXT;
+}
+else
+{
+eElement = XML_TOKEN_INVALID; // not allowed in ODF <= 1.2
+}
+break;
+default:
+break;
+}
+}
+
 //--->i90246
 //check the ODF version being exported
 if( aODFVersion == SvtSaveOptions::ODFVER_011
@@ -1455,7 +1477,7 @@ void XMLSectionExport::ExportIndexTemplateElement(
  OUString::number(nLevel));
 }
 // export template
-SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT,
+SvXMLElementExport aTemplateElement(GetExport(), nNamespace,
 GetXMLToken(eElement),
 true, false)
 ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-11 Thread Caolán McNamara
 xmloff/source/text/XMLIndexIllustrationSourceContext.cxx |2 +-
 xmloff/source/text/XMLIndexTemplateContext.cxx   |   12 
 xmloff/source/text/XMLIndexTemplateContext.hxx   |1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 267ef9428dd3713746f405a8a650defede3a4005
Author: Caolán McNamara 
Date:   Wed Dec 6 16:08:11 2017 +

tdf#71737: save allows links in illustration index, but load doesn't

since illustration index links were initially implemented by

commit 2c10d784deb86501b5488044a61d9fc2efc6321a
Date:   Tue Jul 16 15:49:44 2013 +0200

fdo#39904, n#825976: implement hyperlinks for Illustrations index

(cherry picked from commit 8bb2c7f1556c10508c8ac451c579539ccf5dacfb)

Change-Id: I679fb9c40cd5dc55a5d546ef7c533faf9de2e483
Reviewed-on: https://gerrit.libreoffice.org/45967
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 
(cherry picked from commit 523da0bfba2546552b4181e0268f41bc38a1903f)
Reviewed-on: https://gerrit.libreoffice.org/46108
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit f987cc2910ae90229ae7f76ed1dc9325b57b5cb6)
Reviewed-on: https://gerrit.libreoffice.org/46218

diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx 
b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
index b8e6a2f5dcd1..7da521bbc8a8 100644
--- a/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
+++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx
@@ -63,7 +63,7 @@ SvXMLImportContext* 
XMLIndexIllustrationSourceContext::CreateChildContext(
aLevelNameTableMap,
XML_TOKEN_INVALID, // no 
outline-level attr
aLevelStylePropNameTableMap,
-   aAllowedTokenTypesTable);
+   
aIllustrationAllowedTokenTypesTable);
 }
 else
 {
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx 
b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 1498c5be39ba..9487cd539571 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -432,6 +432,18 @@ const SvXMLEnumMapEntry* aLevelNameTableMap = 
nullptr;
 const sal_Char* aLevelStylePropNameTableMap[] =
 { nullptr, "ParaStyleLevel1", nullptr };
 
+const bool aIllustrationAllowedTokenTypesTable[] =
+{
+true,   // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
+true,   // XML_TOK_INDEX_TYPE_TAB_STOP,
+true,   // XML_TOK_INDEX_TYPE_TEXT,
+true,   // XML_TOK_INDEX_TYPE_PAGE_NUMBER,
+true,   // XML_TOK_INDEX_TYPE_CHAPTER,
+true,   // XML_TOK_INDEX_TYPE_LINK_START,
+true,   // XML_TOK_INDEX_TYPE_LINK_END,
+false   // XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
+};
+
 const bool aAllowedTokenTypesTable[] =
 {
 true,   // XML_TOK_INDEX_TYPE_ENTRY_TEXT =
diff --git a/xmloff/source/text/XMLIndexTemplateContext.hxx 
b/xmloff/source/text/XMLIndexTemplateContext.hxx
index 09e141105b41..00bdd6509331 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.hxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.hxx
@@ -56,6 +56,7 @@ extern const bool aAllowedTokenTypesBibliography[];
 // table, illustration and object tables:
 extern const SvXMLEnumMapEntry* aLevelNameTableMap; // NULL: no 
outline-level
 extern const sal_Char* aLevelStylePropNameTableMap[];
+extern const bool aIllustrationAllowedTokenTypesTable[];
 extern const bool aAllowedTokenTypesTable[];
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-24 Thread Michael Stahl
 xmloff/source/core/xmlexp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 89a5b2c31b4c9d5e068e9d1aef2eac50d70df80e
Author: Michael Stahl 
Date:   Tue Sep 19 21:43:23 2017 +0200

xmloff: fix stack-use-after-return in SvXMLExport::exportDoc()

PropertySetInfo(PropertyMapEntry const * pMap) stores the pointers,
and its lifetime is controlled by refcounting, so the lifetime
of aInfoMap can't be automatic.

ERROR: AddressSanitizer: stack-use-after-return on address ...
... is located in stack of thread T46
at offset 224 in frame SvXMLExport::exportDoc(xmloff::token::XMLTokenEnum)

This frame has 39 object(s):
  ...
  [224, 288) 'aInfoMap' <== Memory access at offset 224 is inside this 
variable

Change-Id: I4eaa9d38bab708b222d999b0982100d7ef97e95c
(cherry picked from commit ee599ea46365adc37f4d495d9ff9778c25c04c92)
Reviewed-on: https://gerrit.libreoffice.org/42504
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index bfb18b8e0853..6c38127b9462 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1284,7 +1284,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum 
::xmloff::token::XMLTokenEnum eClass )
 {
 try
 {
-::comphelper::PropertyMapEntry const aInfoMap[] =
+static ::comphelper::PropertyMapEntry const aInfoMap[] =
 {
 { OUString("Class"), 0,
 ::cppu::UnoType::get(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-05 Thread Michael Stahl
 xmloff/source/text/txtparai.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 0771ddbeb063be1e38ba9b409ec365910faef492
Author: Michael Stahl 
Date:   Thu Aug 31 15:15:41 2017 +0200

tdf#112122 xmloff: inserting index marks into editengine throws

Catch the exception, since that isn't even invalid input, editengine
just can't do it.

Change-Id: I362923889add4f1a1d3f8f18b0795993119d54b1
(cherry picked from commit 98552e46521b012e7694c056eca956ae4ee27a0c)
Reviewed-on: https://gerrit.libreoffice.org/41758
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index e911a4c38516..5708930cf798 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2068,8 +2068,15 @@ XMLParaContext::~XMLParaContext()
 Reference xMark(
 static_cast(pHint)->GetMark());
 Reference xContent(xMark, UNO_QUERY);
-xTxtImport->GetText()->insertTextContent(
-xAttrCursor, xContent, true );
+try
+{
+xTxtImport->GetText()->insertTextContent(
+xAttrCursor, xContent, true );
+}
+catch (uno::RuntimeException const& e)
+{
+SAL_INFO("xmloff.text", "could not insert index mark, 
presumably in editengine text " << e.Message);
+}
 }
 break;
 case XML_HINT_TEXT_FRAME:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-16 Thread Michael Stahl
 xmloff/source/text/txtparae.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit bcfb8c79768a2d3008bfe88b8c1f504f4030f957
Author: Michael Stahl 
Date:   Tue Aug 15 23:12:58 2017 +0200

xmloff: fix crash on exporting non-loadable external image URL

As seen on exporting rhbz739243-1.odt, the xGraphic is null in that case.

(regression from 4469b29faeb8dbf7793a5d81d9c5ddebacf3015f)

Change-Id: I535d67eeddc1b9bdf2562fc3b54a97e38ab0354c
(cherry picked from commit e026cf6e2f215cdf93a4cab331f0f1f292beb9d3)
Reviewed-on: https://gerrit.libreoffice.org/41188
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index c9b5acd0897c..49f7ff0706ac 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3044,9 +3044,12 @@ static OUString getMimeType(const OUString& sImageUrl)
 Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties 
) );
 
 OUString aSourceMimeType;
-Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW );
-if ( xGraphicPropertySet->getPropertyValue( "MimeType" ) >>= 
aSourceMimeType )
+Reference const xGraphicPropertySet(xGraphic, UNO_QUERY);
+if (xGraphicPropertySet.is() && // it's null if it's an external link
+(xGraphicPropertySet->getPropertyValue("MimeType") >>= 
aSourceMimeType))
+{
 return aSourceMimeType;
+}
 return OUString("");
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-20 Thread Samuel Mehrbrodt
 xmloff/source/draw/sdxmlexp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a1afdfa15ec0410a735fd7e969219bd6cc1f33dd
Author: Samuel Mehrbrodt 
Date:   Tue Jul 18 17:48:38 2017 +0200

Revert "tdf#108824 Save "Mouse pointer visible" property"

See tdf#108824 comment 4 for reasoning.

This reverts commit 89f6c41abffd2885b7083ab0ef94da89c8b2c770.

Change-Id: I3e9fcdd2c9cf6c3b0a0454a2a85799e4274e0bdd
Reviewed-on: https://gerrit.libreoffice.org/40145
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 8b670eec9aa6..ba792d13f128 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1986,9 +1986,9 @@ void SdXMLExport::exportPresentationSettings()
 }
 
 xPresProps->getPropertyValue("IsMouseVisible") >>= bTemp;
-if( bTemp )
+if( !bTemp )
 {
-AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, 
XML_TRUE );
+AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, 
XML_FALSE );
 bHasAttr = true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-16 Thread Michael Stahl
 xmloff/source/draw/shapeexport.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 753eb4b54c5ce2a1ce0f392505b5e18a1a10d905
Author: Michael Stahl 
Date:   Thu Jul 13 21:58:48 2017 +0200

xmloff: ODF export: fix redundant setting of GraphicStreamURL swapping

XMLShapeExport::ImpExportGraphicObjectShape() unnecessarily swaps out
the GraphicObject by calling setPropertyValue("GraphicStreamURL")
even if the URL didn't actually change from what was retrieved
just a couple lines earlier, incidentally swapping it in too.

Well actually it isn't really swapped out, it's marked as auto-swapped,
but nevertheless on getting the "ReplacementGraphicURL" property
its Graphic will be replaced by swapping it in again.

So don't do that, then it's only swapped in once.

This speeds up round-tripping the ML bugdoc from 3:20 to 3:00.

Change-Id: I65a211a0c225444c06d5516df9c6716360be46c0
(cherry picked from commit b3992ddcd13082a934246b717ae22f57394e6533)
Reviewed-on: https://gerrit.libreoffice.org/39966
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 0116c610a5c6..399544cae531 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2313,17 +2313,20 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
 // apply possible changed stream URL to embedded image 
object
 if ( bIsEmbeddedImageWithExistingStreamInPackage )
 {
-aStreamURL = sPackageURL;
+OUString newStreamURL = sPackageURL;
 if ( aStr[0] == '#' )
 {
-aStreamURL = aStreamURL.concat( aStr.copy( 1, 
aStr.getLength() - 1 ) );
+newStreamURL = newStreamURL.concat( aStr.copy( 1, 
aStr.getLength() - 1 ) );
 }
 else
 {
-aStreamURL = aStreamURL.concat( aStr );
+newStreamURL = newStreamURL.concat( aStr );
 }
 
-xPropSet->setPropertyValue( "GraphicStreamURL", 
uno::Any(aStreamURL) );
+if (newStreamURL != aStreamURL)
+{
+xPropSet->setPropertyValue("GraphicStreamURL", 
uno::Any(newStreamURL));
+}
 }
 
 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, 
XML_SIMPLE );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-14 Thread Samuel Mehrbrodt
 xmloff/source/draw/sdxmlexp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 89f6c41abffd2885b7083ab0ef94da89c8b2c770
Author: Samuel Mehrbrodt 
Date:   Fri Jul 14 10:03:58 2017 +0200

tdf#108824 Save "Mouse pointer visible" property

Change-Id: I6c5c9d885df7fa4032724861361957cb6981091c
Reviewed-on: https://gerrit.libreoffice.org/39942
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 

diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index ba792d13f128..8b670eec9aa6 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1986,9 +1986,9 @@ void SdXMLExport::exportPresentationSettings()
 }
 
 xPresProps->getPropertyValue("IsMouseVisible") >>= bTemp;
-if( !bTemp )
+if( bTemp )
 {
-AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, 
XML_FALSE );
+AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, 
XML_TRUE );
 bHasAttr = true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-20 Thread Eike Rathke
 xmloff/source/text/txtflde.cxx |   21 -
 1 file changed, 4 insertions(+), 17 deletions(-)

New commits:
commit a51022cebf8b515a7913d767a8c5f6886dc64720
Author: Eike Rathke 
Date:   Tue Jun 20 12:59:23 2017 +0200

Resolves: tdf#107438 write  for fields

Only in  context write 

Broken since

commit 5f8476c00f482ab5c8707de2ebdcd41faa4057fc
Date:   Fri Dec 13 23:21:46 2013 +0100

and

commit 49f9694e34d07468cff4a7e4de332f11be3e0dd8
Date:   Fri Dec 13 23:30:34 2013 +0100

Change-Id: I48b146b779878bf0faa5830a721559d8e864dd33
(cherry picked from commit 29f250c428953750ce89dec7ee961723478609c1)
Reviewed-on: https://gerrit.libreoffice.org/39011
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 11bdee3aeafb..959b2e75162b 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2221,23 +2221,10 @@ void XMLTextFieldExport::ExportElement(enum 
XMLTokenEnum eElementName,
 if (eElementName != XML_TOKEN_INVALID)
 {
 // Element
-if (eElementName == XML_SENDER_INITIALS)
-{
-if (SvtSaveOptions().GetODFDefaultVersion() > 
SvtSaveOptions::ODFVER_012)
-{
-SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT,
-eElementName, false, false );
-// export content
-GetExport().Characters(sContent);
-}
-}
-else
-{
-SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
-  eElementName, false, false );
-// export content
-GetExport().Characters(sContent);
-}
+SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+eElementName, false, false );
+// export content
+GetExport().Characters(sContent);
 } else {
 // always export content
 GetExport().Characters(sContent);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-30 Thread Michael Stahl
 xmloff/source/draw/shapeexport.cxx |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit d9ae5391e72b91f80d6915d2ff420e191fdc892f
Author: Michael Stahl 
Date:   Tue May 30 13:11:01 2017 +0200

tdf#108231 tdf#108109 xmloff: SvxUnoDrawingModel doesn't implement...

... XStyleFamiliesSupplier, so try to do without.  This is called from
sw in case SWTRANSFER_OBJECTTYPE_DRAWMODEL.

(regression from 9835a5823e0f559aabbc0e15ea126c82229c4bc7)

Change-Id: Ic99ad4bf0c8e6e24fc10da173ec480c9d29c0363
(cherry picked from commit db38e3f201517acf22c1773ae9fc4cb2514788b1)
Reviewed-on: https://gerrit.libreoffice.org/38213
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 13e8ef9decde..0116c610a5c6 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -389,11 +389,16 @@ void XMLShapeExport::collectShapeAutoStyles(const 
uno::Reference< drawing::XShap
 // Shapes with a Writer TextBox always have a parent style.
 // If there would be none, then just assign the first available.
 uno::Reference 
xStyleFamiliesSupplier(GetExport().GetModel(), uno::UNO_QUERY);
-uno::Reference xStyleFamilies = 
xStyleFamiliesSupplier->getStyleFamilies();
-uno::Reference xFrameStyles = 
xStyleFamilies->getByName("FrameStyles").get< 
uno::Reference >();
-uno::Sequence aFrameStyles = 
xFrameStyles->getElementNames();
-if (aFrameStyles.hasElements())
-aParentName = aFrameStyles[0];
+if (xStyleFamiliesSupplier.is()) // tdf#108231
+{
+uno::Reference xStyleFamilies = 
xStyleFamiliesSupplier->getStyleFamilies();
+uno::Reference xFrameStyles = 
xStyleFamilies->getByName("FrameStyles").get< 
uno::Reference >();
+uno::Sequence aFrameStyles = 
xFrameStyles->getElementNames();
+if (aFrameStyles.hasElements())
+{
+aParentName = aFrameStyles[0];
+}
+}
 }
 
 // filter propset
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits