[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - writerfilter/source

2017-11-08 Thread Mike Kaganski
 writerfilter/source/dmapper/GraphicHelpers.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 9352932ec8f0582cc91f9d3b016555244d4c980d
Author: Mike Kaganski 
Date:   Mon May 8 16:42:55 2017 +0300

tdf#105688: findZOrder: catch exceptions from getPropertyValue

For some reason, sometimes items in GraphicZOrderHelper don't
have ZOrder property value, and so throw in getPropertyValue.
E.g., SwXFrame::getPropertyValue throws uno::RuntimeException
when its GetFrameFormat() returns nullptr.

The patch catches these to allow to proceed with fallback z-order.

Change-Id: I96140195f45364bccee7c5547d373158e2b49154
Reviewed-on: https://gerrit.libreoffice.org/37392
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
Reviewed-by: Mike Kaganski 
(cherry picked from commit f66b76a4d20719e4c13bd755c49f8140a0e72816)
Reviewed-on: https://gerrit.libreoffice.org/44463
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx 
b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 8c4dd9c5aed8..6674af5132f4 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -273,20 +273,23 @@ sal_Int32 GraphicZOrderHelper::findZOrder( sal_Int32 
relativeHeight, bool bOldSt
 else
 ++it;
 }
+sal_Int32 itemZOrderOffset(0); // before the item
 if( it == items.end()) // we're topmost
 {
 if( items.empty())
 return 0;
-sal_Int32 itemZOrder(0);
 --it;
-if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= 
itemZOrder )
-return itemZOrder + 1; // after the topmost
+itemZOrderOffset = 1; // after the topmost
 }
-else
-{
+// SwXFrame::getPropertyValue throws uno::RuntimeException
+// when its GetFrameFormat() returns nullptr
+try {
 sal_Int32 itemZOrder(0);
 if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= 
itemZOrder )
-return itemZOrder; // before the item
+return itemZOrder + itemZOrderOffset;
+}
+catch (const uno::RuntimeException&) {
+SAL_WARN("writerfilter", "Exception when getting item z-order");
 }
 SAL_WARN( "writerfilter", "findZOrder() didn't find item z-order" );
 return 0; // this should not(?) happen
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - writerfilter/source

2017-08-09 Thread Mike Kaganski
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |8 ---
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |4 ---
 writerfilter/source/ooxml/factoryimpl_ns.py   |3 --
 writerfilter/source/ooxml/model.xml   |   20 --
 4 files changed, 35 deletions(-)

New commits:
commit 6dc49cee20750827aad6e20ec1877530459bf624
Author: Mike Kaganski 
Date:   Thu Aug 10 06:21:18 2017 +0200

Revert "A temporary workaround for out-of-order (in-paragraph) tbl on OOXML"

A better fix follows
This reverts commit 0eb0c7308ad57f4a20b5691d450b5185e52475f6.

Change-Id: If36f73c580d96445086d8ab3d87fff6a76cd8b6a
Reviewed-on: https://gerrit.libreoffice.org/40948
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 29843a64a7af..bb59ed9bebdc 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1614,14 +1614,6 @@ void OOXMLFastContextHandlerTextTable::lcl_endFastElement
 mpParserState->endTable();
 }
 
-void OOXMLFastContextHandlerTextTable::start_P_Tbl()
-{
-}
-
-void OOXMLFastContextHandlerTextTable::end_P_Tbl()
-{
-}
-
 /*
   class OOXMLFastContextHandlerShape
  */
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 8a9c10c74ca0..eaf40e27f47b 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -433,10 +433,6 @@ public:
 
 virtual std::string getType() const override { return "TextTable"; }
 
-// when  appears as direct child of , we need to rearrange 
this paragraph
-// to merge with the table's first paragraph (that's what Word does in 
this case)
-void start_P_Tbl();
-void end_P_Tbl();
 protected:
 virtual void lcl_startFastElement(Token_t Element, const 
css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
 throw (css::uno::RuntimeException, css::xml::sax::SAXException, 
std::exception) override;
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py 
b/writerfilter/source/ooxml/factoryimpl_ns.py
index b37a468b5330..74ee6e8e3d25 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -442,9 +442,6 @@ def factoryChooseAction(actionNode):
 elif actionNode.getAttribute("action") == "handleGridBefore" or 
actionNode.getAttribute("action") == "handleGridAfter":
 ret.append("%sif (OOXMLFastContextHandlerTextTableRow* 
pTextTableRow = dynamic_cast(pHandler))" 
% extra_space)
 ret.append("%spTextTableRow->%s();" % (extra_space, 
actionNode.getAttribute("action")))
-elif actionNode.getAttribute("action") in ("start_P_Tbl", "end_P_Tbl"):
-ret.append("%sif (OOXMLFastContextHandlerTextTable* pTextTable = 
dynamic_cast(pHandler))" % extra_space)
-ret.append("%spTextTable->%s();" % (extra_space, 
actionNode.getAttribute("action")))
 elif actionNode.getAttribute("action") in ("sendProperty", 
"handleHyperlink"):
 ret.append("%sif (OOXMLFastContextHandlerStream* pStream = 
dynamic_cast(pHandler))" % extra_space)
 ret.append("%spStream->%s();" % (extra_space, 
actionNode.getAttribute("action")))
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 05a7ff6d2a70..98e80b8eff2b 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -14191,10 +14191,6 @@
   
 
 
-
-
-  
-
   
   
 
@@ -14708,17 +14704,6 @@
 
 
   
-  
-  
-
-
-  
-
-
-  
-
-
-  
   
 
   
@@ -18453,11 +18438,6 @@
 
 
 
-
-
-  
-  
-
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - writerfilter/source

2017-07-18 Thread Mike Kaganski
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |8 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |4 +++
 writerfilter/source/ooxml/factoryimpl_ns.py   |3 ++
 writerfilter/source/ooxml/model.xml   |   20 ++
 4 files changed, 35 insertions(+)

New commits:
commit 0eb0c7308ad57f4a20b5691d450b5185e52475f6
Author: Mike Kaganski 
Date:   Thu Jul 13 09:08:56 2017 +0300

A temporary workaround for out-of-order (in-paragraph) tbl on OOXML

This allows for import the data in such tables (previously, this text
was simply dropped, causing dataloss). Layout problems are not fixed
yet.

Change-Id: Id7422adfe0998d1e2adcd4bf0b0e0a1dd7ed37bf
Reviewed-on: https://gerrit.libreoffice.org/40105
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index bb59ed9bebdc..29843a64a7af 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1614,6 +1614,14 @@ void OOXMLFastContextHandlerTextTable::lcl_endFastElement
 mpParserState->endTable();
 }
 
+void OOXMLFastContextHandlerTextTable::start_P_Tbl()
+{
+}
+
+void OOXMLFastContextHandlerTextTable::end_P_Tbl()
+{
+}
+
 /*
   class OOXMLFastContextHandlerShape
  */
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index eaf40e27f47b..8a9c10c74ca0 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -433,6 +433,10 @@ public:
 
 virtual std::string getType() const override { return "TextTable"; }
 
+// when  appears as direct child of , we need to rearrange 
this paragraph
+// to merge with the table's first paragraph (that's what Word does in 
this case)
+void start_P_Tbl();
+void end_P_Tbl();
 protected:
 virtual void lcl_startFastElement(Token_t Element, const 
css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
 throw (css::uno::RuntimeException, css::xml::sax::SAXException, 
std::exception) override;
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py 
b/writerfilter/source/ooxml/factoryimpl_ns.py
index 74ee6e8e3d25..b37a468b5330 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -442,6 +442,9 @@ def factoryChooseAction(actionNode):
 elif actionNode.getAttribute("action") == "handleGridBefore" or 
actionNode.getAttribute("action") == "handleGridAfter":
 ret.append("%sif (OOXMLFastContextHandlerTextTableRow* 
pTextTableRow = dynamic_cast(pHandler))" 
% extra_space)
 ret.append("%spTextTableRow->%s();" % (extra_space, 
actionNode.getAttribute("action")))
+elif actionNode.getAttribute("action") in ("start_P_Tbl", "end_P_Tbl"):
+ret.append("%sif (OOXMLFastContextHandlerTextTable* pTextTable = 
dynamic_cast(pHandler))" % extra_space)
+ret.append("%spTextTable->%s();" % (extra_space, 
actionNode.getAttribute("action")))
 elif actionNode.getAttribute("action") in ("sendProperty", 
"handleHyperlink"):
 ret.append("%sif (OOXMLFastContextHandlerStream* pStream = 
dynamic_cast(pHandler))" % extra_space)
 ret.append("%spStream->%s();" % (extra_space, 
actionNode.getAttribute("action")))
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 56aff376c8f9..a5c9a8afabc9 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -14183,6 +14183,10 @@
   
 
 
+
+
+  
+
   
   
 
@@ -14696,6 +14700,17 @@
 
 
   
+  
+  
+
+
+  
+
+
+  
+
+
+  
   
 
   
@@ -18426,6 +18441,11 @@
 
 
 
+
+
+  
+  
+
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - writerfilter/source

2017-07-11 Thread Szymon Kłos
 writerfilter/source/dmapper/OLEHandler.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 2b954c3cbd81ef62e8856f315c7e4a2c3a084fce
Author: Szymon Kłos 
Date:   Fri Jul 7 12:58:42 2017 +0200

tdf#108544 edit in window (XLSX inside DOCX)

Change-Id: If1dd46643dc2ae9cc74ba94038609ae3445a416c
Reviewed-on: https://gerrit.libreoffice.org/39706
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
(cherry picked from commit 505ce3a2ba3adeef46daecbf9b14c42cea211408)
Reviewed-on: https://gerrit.libreoffice.org/39715
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/OLEHandler.cxx 
b/writerfilter/source/dmapper/OLEHandler.cxx
index 194d1d3b1113..317fe5c80239 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -191,6 +191,8 @@ void OLEHandler::importStream(const 
uno::Reference& xCom
 OUString aFilterService;
 if (m_sProgId == "Word.Document.12")
 aFilterService = "com.sun.star.comp.Writer.WriterFilter";
+else if (m_sProgId == "Excel.Sheet.12")
+aFilterService = "com.sun.star.comp.oox.xls.ExcelFilter";
 else if (m_sProgId == "Equation.3")
 aFilterService = "com.sun.star.comp.Math.MathTypeFilter";
 else
@@ -233,6 +235,11 @@ OUString OLEHandler::getCLSID(const 
uno::Reference& xCom
 if 
(officecfg::Office::Common::Filter::Microsoft::Import::WinWordToWriter::get(xComponentContext))
 aRet = "8BC6B165-B1B2-4EDD-aa47-dae2ee689dd6";
 }
+else if (m_sProgId == "Excel.Sheet.12")
+{
+if 
(officecfg::Office::Common::Filter::Microsoft::Import::ExcelToCalc::get(xComponentContext))
+aRet = "47BBB4CB-CE4C-4E80-A591-42D9AE74950F";
+}
 else if (m_sProgId == "Equation.3")
 {
 if 
(officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath::get(xComponentContext))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - writerfilter/source

2017-06-10 Thread Stephan Bergmann
 writerfilter/source/ooxml/OOXMLPropertySet.cxx |   12 ++--
 writerfilter/source/ooxml/OOXMLPropertySet.hxx |2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 9db9c8e04958a30a954e7176ab3556a8cb397fca
Author: Stephan Bergmann 
Date:   Fri Jun 9 10:02:52 2017 +0200

Avoid UBSan warning about negative double -> sal_uInt32 conversion

Since ea890b1d4bcd6dd59db9f52dce1609c020804e24 "tdf#108408: support unit
specifications for ST_HpsMeasure", the OOXMLUniversalMeasureValue ctor is
converting textual data to mnValue via intermediary double instead of 
sal_Int32,
so textual data representing negative values now triggers UBSan warnings 
(e.g.,
"writerfilter/source/ooxml/OOXMLPropertySet.cxx:630:43: runtime error: -70 
is
outside the range of representable values of type 'unsigned int'" during
CppunitTest_chart2_export; it appears that, while HpsMeasure may be 
documented
to only cover positive values, TwipsMeasure may be negative).

But OOXMLUniversalMeasureValue::mnValue is apparently only used in
OOXMLUniversalMeasureValue::getInt, to return an int value, so just change 
its
type.

Change-Id: I44eabb78f09100c05cc9d1e79a739648f34ea743
(cherry picked from commit 600ec501bafc691d37078a0ed5b4ca8bf32340f1)
Reviewed-on: https://gerrit.libreoffice.org/38632
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index 3ef7a30b11ff..0b353dfb8039 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -599,35 +599,35 @@ 
OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const char * pValue, sal_
 pValue[nLen-2] == 'p' &&
 pValue[nLen-1] == 't')
 {
-mnValue = static_cast(val * npPt);
+mnValue = static_cast(val * npPt);
 }
 else if (nLen > 2 &&
 pValue[nLen - 2] == 'c' &&
 pValue[nLen - 1] == 'm')
 {
-mnValue = static_cast(val * npPt * 72 / 2.54);
+mnValue = static_cast(val * npPt * 72 / 2.54);
 }
 else if (nLen > 2 &&
 pValue[nLen - 2] == 'm' &&
 pValue[nLen - 1] == 'm')
 {
-mnValue = static_cast(val * npPt * 72 / 25.4);
+mnValue = static_cast(val * npPt * 72 / 25.4);
 }
 else if (nLen > 2 &&
 pValue[nLen - 2] == 'i' &&
 pValue[nLen - 1] == 'n')
 {
-mnValue = static_cast(val * npPt * 72);
+mnValue = static_cast(val * npPt * 72);
 }
 else if (nLen > 2 &&
 pValue[nLen - 2] == 'p' &&
 ( pValue[nLen - 1] == 'c' || pValue[nLen - 1] == 'i' ))
 {
-mnValue = static_cast(val * npPt * 12);
+mnValue = static_cast(val * npPt * 12);
 }
 else
 {
-mnValue = static_cast(val);
+mnValue = static_cast(val);
 }
 }
 
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
index 73889a4abb9b..45aba15e2ccc 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
@@ -232,7 +232,7 @@ public:
 class OOXMLUniversalMeasureValue : public OOXMLValue
 {
 private:
-sal_uInt32 mnValue;
+int mnValue;
 public:
 OOXMLUniversalMeasureValue(const char * pValue, sal_uInt32 npPt);
 virtual ~OOXMLUniversalMeasureValue() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits