[Libreoffice-commits] core.git: oox/source sc/qa

2023-04-25 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx|3 ++-
 sc/qa/unit/data/xlsx/tdf91332.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |   19 +++
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 2ef83c8782ed947b47f9292a12355fc3bb078078
Author: Tünde Tóth 
AuthorDate: Wed Apr 19 14:48:33 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 25 15:04:09 2023 +0200

tdf#91332 XLSX export: fix missing solidFill

Background color of shape inherited from theme
lost after export.

Regression from commit bc0a9076aa43a0782bcf81e55d3f84f6af0f68e8
"ooxml: Preserve shape theme attribute for solid fill".

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 60a5cdd62d7e..77c4c1b02186 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -530,7 +530,8 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xff), 
nAlpha);
 }
 }
-else if ( !sColorFillScheme.isEmpty() )
+// tdf#91332 LO doesn't export the actual theme.xml in XLSX.
+else if ( !sColorFillScheme.isEmpty() && GetDocumentType() != 
DOCUMENT_XLSX )
 {
 // the shape had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations, nAlpha );
diff --git a/sc/qa/unit/data/xlsx/tdf91332.xlsx 
b/sc/qa/unit/data/xlsx/tdf91332.xlsx
new file mode 100644
index ..5f1d119e8ee7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf91332.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 7a9579f3dfa0..403bffc3112f 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1224,6 +1224,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX)
 assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", 
"TargetMode", "External");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332)
+{
+createScDoc("xlsx/tdf91332.xlsx");
+saveAndReload("Calc Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: rgba[90cf47ff]
+// - Actual  : rgba[]
+// i.e. fill color inherited from theme lost after export.
+Color nColor;
+xShapeProps->getPropertyValue("FillColor") >>= nColor;
+CPPUNIT_ASSERT_EQUAL(Color(0x90cf47), nColor);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: oox/source sc/qa

2023-04-25 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx|7 +--
 sc/qa/unit/data/xlsx/tdf119565.xlsx|binary
 sc/qa/unit/subsequent_export_test4.cxx |   26 ++
 3 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 5ee52d401e2086f79f794a4ec1a1d7beec8aa582
Author: Tünde Tóth 
AuthorDate: Tue Apr 18 12:01:18 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 25 14:52:02 2023 +0200

tdf#119565 XLSX export: fix lost line properties inherited from theme

Line properties (LineWidth and LineJoint) of shape
inherited from theme lost after export.

Perhaps regression from commit 5391d4872e71d1edba7acc4ad2d2e3b5b97e1723
"ooxml: Preserve shape style and theme attributes for line".

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aaad66b4d083..60a5cdd62d7e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1263,7 +1263,8 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 mpFS->startElementNS( XML_a, XML_ln,
   XML_cap, cap,
   XML_w, 
sax_fastparser::UseIf(OString::number(nEmuLineWidth),
-  nLineWidth == 0 || (nLineWidth > 1 && 
nStyleLineWidth != nLineWidth)) );
+  nLineWidth == 0 || GetDocumentType() == 
DOCUMENT_XLSX// tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+  || (nLineWidth > 1 && nStyleLineWidth != 
nLineWidth)));
 
 if( bColorSet )
 {
@@ -1431,7 +1432,9 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 {
 LineJoint eLineJoint = mAny.get();
 
-if( aStyleLineJoint == LineJoint_NONE || aStyleLineJoint != eLineJoint 
)
+// tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+if (aStyleLineJoint == LineJoint_NONE || GetDocumentType() == 
DOCUMENT_XLSX
+|| aStyleLineJoint != eLineJoint)
 {
 // style-defined line joint does not exist, or is different from 
the shape's joint
 switch( eLineJoint )
diff --git a/sc/qa/unit/data/xlsx/tdf119565.xlsx 
b/sc/qa/unit/data/xlsx/tdf119565.xlsx
new file mode 100644
index ..de530c0131f2
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf119565.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 8cb9a73a5f4e..79b5441c8f17 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1612,6 +1613,31 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf119565)
+{
+createScDoc("xlsx/tdf119565.xlsx");
+saveAndReload("Calc Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 35
+// - Actual  : 0
+// i.e. line width inherited from theme lost after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(35),
+ 
xShapeProps->getPropertyValue("LineWidth").get());
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 3
+// - Actual  : 4
+// i.e. line joint inherited from theme lost after export.
+CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_MITER,
+ 
xShapeProps->getPropertyValue("LineJoint").get());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: oox/source sc/qa sc/source

2023-01-23 Thread Justin Luth (via logerrit)
 oox/source/export/vmlexport.cxx|   18 +++---
 sc/qa/unit/subsequent_export_test2.cxx |5 -
 sc/source/filter/excel/xeescher.cxx|9 -
 3 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 245912dc42bfc13cbf0db3f04f2411f3dede9615
Author: Justin Luth 
AuthorDate: Sat Jan 21 17:00:26 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Jan 24 02:09:55 2023 +

tdf#117266 tdf#120374 sc oox: export correct vml button name #2

So the actual name is more important than I knew.
For example, VBA maps click macros based on the button name.
So use the MS-provided name and use the SPID to connect to the shape id.

Of the existing unit tests that were affected by this:
-macro-button-form-control.xlsm: button now launches hello macro
-tdf117266_macroButton.xlsm - same file as ^^^
-button-form-control.xls nearly same file as ^^^
-tdf134769.xlsx - checkbox still exists on round-trip
-tdf106181.ods - checkbox still exists, but link to cell still lost.
-checkbox-form-control.xlsx - nearly same as ^^^

All looks good.

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

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 339187fbe4d2..6da57bdd8be8 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -187,20 +187,24 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, 
ShapeFlag nShapeFlags, sal_uInt
 m_nShapeFlags = nShapeFlags;
 
 m_sShapeId = ShapeIdString( nShapeId );
-// If shape is a watermark object - should keep the original shape's name
-// because Microsoft detects if it is a watermark by the actual name
-if (!IsWaterMarkShape(m_pSdrObject->GetName()))
+if (m_sShapeId.startsWith("_x_"))
 {
-// Not a watermark object
-m_pShapeAttrList->add( XML_id, m_sShapeId );
+// xml_id must be set elsewhere. The id is critical for matching VBA 
macros etc,
+// and the spid is critical to link to the shape number elsewhere.
+m_pShapeAttrList->addNS( XML_o, XML_spid, m_sShapeId );
 }
-else
+else if (IsWaterMarkShape(m_pSdrObject->GetName()))
 {
-// A watermark object - store the optional shape ID
+// Shape is a watermark object - keep the original shape's name
+// because Microsoft detects if it is a watermark by the actual name
 m_pShapeAttrList->add( XML_id, m_pSdrObject->GetName() );
 // also ('o:spid')
 m_pShapeAttrList->addNS( XML_o, XML_spid, m_sShapeId );
 }
+else
+{
+m_pShapeAttrList->add(XML_id, m_sShapeId);
+}
 }
 
 bool VMLExport::IsWaterMarkShape(std::u16string_view rStr)
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 16188c90bbfa..3093e63500dd 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -542,7 +542,10 @@ void ScExportTest2::testTdf117266()
 xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml");
 
 OUString sName = getXPath(pVmlDrawing, "/xml/v:shape", "id");
-CPPUNIT_ASSERT(sName.startsWith("_x_s"));
+CPPUNIT_ASSERT_EQUAL(OUString("Button 1001"), sName);
+
+OUString sSpid = getXPath(pVmlDrawing, "/xml/v:shape", "spid");
+CPPUNIT_ASSERT(sSpid.startsWith("_x_s"));
 
 assertXPathContent(pVmlDrawing, "/xml/v:shape/v:textbox/div/font", "Button 
1 \"y\" z");
 // Why the xx:, I have no idea..., but it certainly doesn't work with just 
x:.
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 00b1b53a76a1..c0c15fda599a 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1093,12 +1093,14 @@ class VmlFormControlExporter : public 
oox::vml::VMLExport
 sal_uInt16 m_nObjType;
 tools::Rectangle m_aAreaFrom;
 tools::Rectangle m_aAreaTo;
+OUString m_sControlName;
 OUString m_aLabel;
 OUString m_aMacroName;
 
 public:
 VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, sal_uInt16 
nObjType,
const tools::Rectangle& rAreaFrom, const 
tools::Rectangle& rAreaTo,
+   const OUString& sControlName,
OUString aLabel, OUString aMacroName);
 
 protected:
@@ -1112,11 +1114,13 @@ VmlFormControlExporter::VmlFormControlExporter(const 
sax_fastparser::FSHelperPtr
sal_uInt16 nObjType,
const tools::Rectangle& 
rAreaFrom,
const tools::Rectangle& rAreaTo,
+   const OUString& sControlName,

[Libreoffice-commits] core.git: oox/source sc/qa sc/subsequent_setup.mk

2022-10-25 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/shape.cxx  |7 
 sc/qa/unit/subsequent_filters_test2.cxx |   48 
 sc/subsequent_setup.mk  |1 
 3 files changed, 56 insertions(+)

New commits:
commit 17dfc9a9da009cc23de3fb4e2cef9c97d581
Author: Regina Henschel 
AuthorDate: Tue Oct 25 17:37:04 2022 +0200
Commit: Regina Henschel 
CommitDate: Wed Oct 26 00:40:00 2022 +0200

tdf#83671 SmartArt: preserve pos and size for metafile

Import of a SmartArt creates a group with a background shape and then
the SmartArt shapes. The background shape determines the position and
size of the group.

The method Shape::convertSmartArtToMetafile() replaces the existing
SmartArt shapes with a metafile object and thereby throws away the
background shape. Thus the group takes it size from the metafile object,
which has default size 100x100 (Hmm) and position 0|0.
The patch remembers the original size and position from the background
shape and applies it then to the metafile shape.

Change-Id: Id7b1ccd20b2597c5e2adca7294a994fd2e0e066f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141830
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index e43b6b9ed5b0..7357e36f0481 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1966,9 +1966,16 @@ void Shape::convertSmartArtToMetafile(XmlFilterBase 
const & rFilterBase)
 // from them
 Reference xShape(renderDiagramToGraphic(rFilterBase));
 Reference xShapes(mxShape, UNO_QUERY_THROW);
+tools::Rectangle aBackgroundRect
+= SdrObject::getSdrObjectFromXShape(
+  Reference(xShapes->getByIndex(0), UNO_QUERY_THROW))
+  ->GetLogicRect();
 while (xShapes->hasElements())
 xShapes->remove(Reference(xShapes->getByIndex(0), 
UNO_QUERY_THROW));
 xShapes->add(xShape);
+SdrObject::getSdrObjectFromXShape(
+Reference(xShapes->getByIndex(0), UNO_QUERY_THROW))
+->NbcSetLogicRect(aBackgroundRect);
 }
 catch (const Exception&)
 {
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index 1ce547a23373..8ae23af8048c 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -187,6 +187,7 @@ public:
 void testInvalidBareBiff5();
 void testTooManyColsRows();
 void testTdf83671_SmartArt_import();
+void testTdf83671_SmartArt_import2();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest2);
 
@@ -304,6 +305,7 @@ public:
 CPPUNIT_TEST(testInvalidBareBiff5);
 CPPUNIT_TEST(testTooManyColsRows);
 CPPUNIT_TEST(testTdf83671_SmartArt_import);
+CPPUNIT_TEST(testTdf83671_SmartArt_import2);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3089,6 +3091,52 @@ void ScFiltersTest2::testTdf83671_SmartArt_import()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest2::testTdf83671_SmartArt_import2()
+{
+// The example doc contains a diagram (SmartArt). Such should be imported 
as group object.
+// With conversion enabled, the group contains only a graphic. Error was, 
that the shape
+// had size 100x100 Hmm and position 0|0.
+
+// Make sure SmartArt is loaded with converting to metafile
+bool bUseGroup = 
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get();
+if (bUseGroup)
+{
+std::shared_ptr pChange(
+comphelper::ConfigurationChanges::create());
+
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(false,
 pChange);
+pChange->commit();
+}
+
+// Get document and shape
+ScDocShellRef xDocSh = loadDoc(u"tdf83671_SmartArt_import.", FORMAT_XLSX);
+ScDocument& rDoc = xDocSh->GetDocument();
+ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+SdrPage* pPage = pDrawLayer->GetPage(0);
+SdrObject* pObj = pPage->GetObj(0);
+
+// Check that it is a group shape with 1 child
+CPPUNIT_ASSERT(pObj->IsGroupObject());
+SdrObjList* pChildren = pObj->getChildrenOfSdrObject();
+CPPUNIT_ASSERT_EQUAL(size_t(1), pChildren->GetObjCount());
+
+// The child shape should have about 60mm x 42mm size and position 
1164|1270.
+// Without fix its size was 100x100 and position 0|0.
+tools::Rectangle aBackground = pChildren->GetObj(0)->GetLogicRect();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(6000), aBackground.getOpenWidth(), 
10);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(4200), aBackground.getOpenHeight(), 
10);
+CPPUNIT_ASSERT_EQUAL(Point(1164, 1270), aBackground.GetPos());
+
+if (bUseGroup)
+{
+std::shared_ptr pChange(
+comphelper::ConfigurationChanges::create());
+
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true,
 pChange);
+pChange->commit();
+ 

[Libreoffice-commits] core.git: oox/source sc/qa sc/source

2021-07-01 Thread Miklos Vajna (via logerrit)
 oox/source/token/tokens.txt   |5 ++
 sc/qa/unit/data/xlsx/button-form-control.xlsx |binary
 sc/qa/unit/subsequent_export-test2.cxx|   25 ++
 sc/source/filter/excel/xeescher.cxx   |   63 +-
 sc/source/filter/xcl97/xcl97rec.cxx   |1 
 5 files changed, 93 insertions(+), 1 deletion(-)

New commits:
commit 1e3263a677b61c718d0fd1be15c066b933f7de18
Author: Miklos Vajna 
AuthorDate: Thu Jul 1 12:34:52 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 1 17:15:30 2021 +0200

XLSX export: handle button form controls

This builds on top of commit 94678a7b9c6b7e577c15adacc885e03551bcf17b
(XLSX export: improve handling of checkbox (form controls), 2021-06-30),
so now both checkboxes and buttons are handled during export.

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

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 4d2fb881f0bc..997b3e8b3b25 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -713,6 +713,7 @@ autoLoad
 autoNoTable
 autoPage
 autoPageBreaks
+autoPict
 autoRecover
 autoRedefine
 autoRepublish
@@ -1403,6 +1404,7 @@ contributors
 control
 control1
 control2
+controlPr
 controls
 convMailMergeEsc
 convex
@@ -2372,6 +2374,7 @@ forcedash
 foredepth
 forestGreen
 forgetLastTabAlignment
+formControlPr
 formFld
 formLetters
 formProt
@@ -3179,6 +3182,7 @@ location
 lock
 lockRevision
 lockStructure
+lockText
 lockWindows
 locked
 lockedCanvas
@@ -3661,6 +3665,7 @@ objOverTx
 objTx
 object
 objectDefaults
+objectType
 objects
 obliqueBottom
 obliqueBottomLeft
diff --git a/sc/qa/unit/data/xlsx/button-form-control.xlsx 
b/sc/qa/unit/data/xlsx/button-form-control.xlsx
new file mode 100644
index ..c5e9fe65a245
Binary files /dev/null and b/sc/qa/unit/data/xlsx/button-form-control.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx 
b/sc/qa/unit/subsequent_export-test2.cxx
index 6036bddd8369..d23145c67cf2 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -188,6 +188,7 @@ public:
 void testTdf126541_SheetVisibilityImportXlsx();
 void testTdf140431();
 void testCheckboxFormControlXlsxExport();
+void testButtonFormControlXlsxExport();
 
 CPPUNIT_TEST_SUITE(ScExportTest2);
 
@@ -284,6 +285,7 @@ public:
 CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx);
 CPPUNIT_TEST(testTdf140431);
 CPPUNIT_TEST(testCheckboxFormControlXlsxExport);
+CPPUNIT_TEST(testButtonFormControlXlsxExport);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2323,6 +2325,29 @@ void ScExportTest2::testCheckboxFormControlXlsxExport()
 assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", "1, 22, 
3, 3, 3, 30, 6, 1");
 }
 
+void ScExportTest2::testButtonFormControlXlsxExport()
+{
+// Given a document that has a checkbox form control:
+ScDocShellRef xShell = loadDoc(u"button-form-control.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.is());
+
+// When exporting to XLSX:
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+
+// Then make sure its control markup is written and it has a correct 
position + size:
+xmlDocUniquePtr pDoc
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+// Without the fix in place, this test would have failed with:
+// - XPath '//x:anchor/x:from/xdr:col' not found
+// i.e. the control markup was missing, the button was lost on export.
+assertXPathContent(pDoc, "//x:anchor/x:from/xdr:col", "1");
+assertXPathContent(pDoc, "//x:anchor/x:from/xdr:row", "3");
+assertXPathContent(pDoc, "//x:anchor/x:to/xdr:col", "3");
+assertXPathContent(pDoc, "//x:anchor/x:to/xdr:row", "7");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 2f1253c0a16e..fcffbd7534b2 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1144,6 +1144,9 @@ void VmlFormControlExporter::EndShape(sal_Int32 
nShapeElement)
 case EXC_OBJTYPE_CHECKBOX:
 aObjectType = "Checkbox";
 break;
+case EXC_OBJTYPE_BUTTON:
+aObjectType = "Button";
+break;
 }
 pVmlDrawing->startElement(FSNS(XML_x, XML_ClientData), XML_ObjectType, 
aObjectType);
 OString aAnchor = OString::number(m_aAreaFrom.Left());
@@ -1156,7 +1159,11 @@ void VmlFormControlExporter::EndShape(sal_Int32 
nShapeElement)
 aAnchor += ", " + OString::number(m_aAreaTo.Bottom());
 XclXmlUtils::WriteElement(pVmlDrawing, FSNS(XML_x, XML_Anchor), aAnchor);
 
-// XclExpOcxControlObj::WriteSubRecs() has the same 

[Libreoffice-commits] core.git: oox/source sc/qa

2021-05-25 Thread Szabolcs Toth (via logerrit)
 oox/source/drawingml/shape.cxx |   12 ++--
 sc/qa/unit/data/xlsx/tdf141644.xlsx|binary
 sc/qa/unit/subsequent_export-test.cxx  |4 ++--
 sc/qa/unit/subsequent_filters-test.cxx |   27 +++
 4 files changed, 35 insertions(+), 8 deletions(-)

New commits:
commit b2190523e0b226bcae19cc8c3ce8a83855c7f009
Author: Szabolcs Toth 
AuthorDate: Wed May 19 08:42:29 2021 +0200
Commit: László Németh 
CommitDate: Tue May 25 13:41:29 2021 +0200

tdf#141644 OOXML shape import: fix upright text rotate angle

Text rotate angle was not imported correctly with
"upright" setting, e.g. resulting horizontal text
in shapes of XLSX documents instead of vertical.

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

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ed26e2313941..b0e2ddef30e7 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1507,6 +1507,9 @@ Reference< XShape > const & Shape::createAndInsert(
 sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( 
getTextBody()->getTextProperties().moRotation.get( 0 ) );
 
 nTextRotateAngle -= mnDiagramRotation;
+/* OOX measures text rotation clockwise in 1/6th degrees,
+   relative to the containing shape. setTextRotateAngle wants 
degrees anticlockwise. */
+nTextRotateAngle = -1 * nTextRotateAngle / 6;
 
 if (getTextBody()->getTextProperties().moUpright)
 {
@@ -1515,18 +1518,15 @@ Reference< XShape > const & Shape::createAndInsert(
 // shape containing it is rotated.
 // Hence, we rotate the text into the opposite direction of
 // the rotation of the shape, by as much as the shape was 
rotated.
-mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation 
/ 6);
+mpCustomShapePropertiesPtr->setTextRotateAngle((mnRotation 
/ 6) + nTextRotateAngle);
 // Also put the initial angles away in a GrabBag.
 putPropertyToGrabBag("Upright", Any(true));
 putPropertyToGrabBag("nShapeRotationAtImport", 
Any(mnRotation / 6));
-putPropertyToGrabBag("nTextRotationAtImport", 
Any(mnRotation / 6));
+putPropertyToGrabBag("nTextRotationAtImport", 
Any(nTextRotateAngle));
 }
 else
 {
-/* OOX measures text rotation clockwise in 1/6th 
degrees,
-   relative to the containing shape. setTextRotateAngle 
wants
-   degrees anticlockwise. */
-mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * 
nTextRotateAngle / 6);
+
mpCustomShapePropertiesPtr->setTextRotateAngle(nTextRotateAngle);
 }
 
 auto sHorzOverflow = 
getTextBody()->getTextProperties().msHorzOverflow;
diff --git a/sc/qa/unit/data/xlsx/tdf141644.xlsx 
b/sc/qa/unit/data/xlsx/tdf141644.xlsx
new file mode 100644
index ..61599d53fd62
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf141644.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 6d1b927e931a..7a74e6ebf1f6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5856,8 +5856,8 @@ void ScExportTest::testTdf137000_handle_upright()
 = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
 CPPUNIT_ASSERT(pDrawing);
 
-assertXPathNoAttribute(pDrawing, 
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr",
-   "rot");
+assertXPath(pDrawing, 
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr",
+   "rot", "-540");
 }
 
 void ScExportTest::testTdf126305_DataValidatyErrorAlert()
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 078bd9d3686a..0aed0e30c4b2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -311,6 +311,7 @@ public:
 void testShapeRotationImport();
 void testShapeDisplacementOnRotationImport();
 void testTextBoxBodyUpright();
+void testTextBoxBodyRotateAngle();
 void testTextLengthDataValidityXLSX();
 void testDeleteCircles();
 void testDrawCircleInMergeCells();
@@ -512,6 +513,7 @@ public:
 CPPUNIT_TEST(testShapeRotationImport);
 CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
 CPPUNIT_TEST(testTextBoxBodyUpright);
+CPPUNIT_TEST(testTextBoxBodyRotateAngle);
 CPPUNIT_TEST(testTextLengthDataValidityXLSX);
 

[Libreoffice-commits] core.git: oox/source sc/qa

2020-10-06 Thread Szabolcs Toth (via logerrit)
 oox/source/drawingml/shape.cxx |9 ++---
 oox/source/export/drawingml.cxx|   37 +++--
 sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |   22 
 4 files changed, 61 insertions(+), 7 deletions(-)

New commits:
commit ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67
Author: Szabolcs Toth 
AuthorDate: Thu Sep 17 11:22:09 2020 +0200
Commit: László Németh 
CommitDate: Tue Oct 6 09:45:51 2020 +0200

tdf#137000 XLSX shape export: fix upright

Upright is an XML attribute of xdr:txBody/a:bodyPr. It is set
in MSO when in a textbox menu we choose "Do not rotate this element".
LO import uses a text rotation opposite shape rotation to create
upright text, but when exporting the attribute "upright" we must
make sure that the text rotation in bodyPr is 0, not the temporary
opposite value. Otherwise MSO rotates the text.

Note: integer precision of rotation is enough for interoperability,
because it's possible to rotate the shapes only by whole degrees
in MSO.

Follow-up of commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b
(tdf#106197 XLSX shape import: keep text upright).

Co-authored-by: Balázs Regényi

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

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f8f65d09f59f..c9ade16f7a1d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1410,8 +1410,7 @@ Reference< XShape > const & Shape::createAndInsert(
 
 nTextRotateAngle -= mnDiagramRotation;
 
-bool isUpright = getTextBody()->getTextProperties().moUpright;
-if (isUpright)
+if (getTextBody()->getTextProperties().moUpright)
 {
 // When upright is set, we want the text without any 
rotation.
 // But if we set 0 here, the text is still rotated if the
@@ -1419,8 +1418,10 @@ Reference< XShape > const & Shape::createAndInsert(
 // Hence, we rotate the text into the opposite direction of
 // the rotation of the shape, by as much as the shape was 
rotated.
 mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation 
/ 6);
-// Also put this away in a GrabBag.
-putPropertyToGrabBag("Upright", Any(isUpright));
+// Also put the initial angles away in a GrabBag.
+putPropertyToGrabBag("Upright", Any(true));
+putPropertyToGrabBag("nShapeRotationAtImport", 
Any(mnRotation / 6));
+putPropertyToGrabBag("nTextRotationAtImport", 
Any(mnRotation / 6));
 }
 else
 {
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 01f926c0c90c..4a9ac9f69014 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2954,20 +2954,31 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 pWrap = "square";
 }
 
-bool isUpright = false;
 std::optional sHorzOverflow;
 std::optional sVertOverflow;
+sal_Int32 nShapeRotateAngle = 0;
+if (GetProperty(rXPropSet, "RotateAngle"))
+nShapeRotateAngle = 
rXPropSet->getPropertyValue("RotateAngle").get() / 300;
+Reference< XPropertySet > xTextSet(xXText, UNO_QUERY);
+sal_Int32 nShapeTextRotateAngle = 0;
+if (GetProperty(xTextSet, "RotateAngle"))
+nShapeTextRotateAngle = 
rXPropSet->getPropertyValue("RotateAngle").get() / 300;
+std::optional isUpright;
 if (GetProperty(rXPropSet, "InteropGrabBag"))
 {
 if 
(rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
 {
+bool bUpright = false;
+sal_Int32 nOldShapeRotation = 0;
+sal_Int32 nOldTextRotation = 0;
 uno::Sequence aGrabBag;
 rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
 for (const auto& aProp : std::as_const(aGrabBag))
 {
 if (aProp.Name == "Upright")
 {
-aProp.Value >>= isUpright;
+aProp.Value >>= bUpright;
+isUpright = OString(bUpright ? "1" : "0");
 }
 else if (aProp.Name == "horzOverflow")
 {
@@ -2982,6 +2993,26 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 sVertOverflow = sValue;
 }
 }
+

[Libreoffice-commits] core.git: oox/source sc/qa

2019-10-30 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlinputstream.cxx   |6 ++
 sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx |binary
 2 files changed, 6 insertions(+)

New commits:
commit 32efd4529aba776eca9456e96656d542267874f3
Author: Justin Luth 
AuthorDate: Wed Oct 30 11:11:45 2019 +0300
Commit: Justin Luth 
CommitDate: Thu Oct 31 04:32:49 2019 +0100

tdf#128447 sc/vml: accept  xml prolog

... or processing instruction, or text directive.

The inability to parse this was exposed in LO 6.2
with commit 2cae2ecfef47d8dd10647c10f9577392c1887d3a

I added 
to the top of vmlDrawing1.vml from the unit test,
which invalidates the entire .vml file and the two
controls are lost without this fix.

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

diff --git a/oox/source/vml/vmlinputstream.cxx 
b/oox/source/vml/vmlinputstream.cxx
index 215eff35f621..2fc17ee84ea7 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -169,6 +169,12 @@ void lclProcessElement( OStringBuffer& rBuffer, const 
OString& rElement )
 // do nothing
 }
 
+// just append any xml prolog (text directive) or processing instructions: 

+else if( (nElementLen >= 4) && (pcOpen[ 1 ] == '?') && (pcClose[ -1 ] == 
'?') )
+{
+rBuffer.append( rElement );
+}
+
 // replace '' element with newline
 else if( (nElementLen >= 4) && (pcOpen[ 1 ] == 'b') && (pcOpen[ 2 ] == 
'r') && (lclFindNonWhiteSpace( pcOpen + 3, pcClose ) == pcClose) )
 {
diff --git a/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx
index 0677a0cf2eb2..b28c4dd71643 100644
Binary files a/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx and 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: oox/source sc/qa

2019-05-10 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx   |   20 ++--
 sc/qa/unit/data/ods/text_box_hyperlink.ods |binary
 sc/qa/unit/subsequent_export-test.cxx  |   18 ++
 3 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 5ddaaa0c86a9c7851d2277d56b379a3412b1fff3
Author: Tünde Tóth 
AuthorDate: Thu May 9 11:00:36 2019 +0200
Commit: László Németh 
CommitDate: Fri May 10 13:37:01 2019 +0200

tdf#125173 fix hyperlink inserted to text box

Hyperlink inserted to text box lost after export.

Change-Id: I796e54339292cb4a5e98de1ead6558d66587d353
Reviewed-on: https://gerrit.libreoffice.org/72033
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7302682b02b0..3cb71aeacf8c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1793,14 +1793,30 @@ ShapeExport& ShapeExport::WriteTableShape( const 
Reference< XShape >& xShape )
 ShapeExport& ShapeExport::WriteTextShape( const Reference< XShape >& xShape )
 {
 FSHelperPtr pFS = GetFS();
-
+Reference xShapeProps(xShape, UNO_QUERY);
 pFS->startElementNS(mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? 
XML_sp : XML_wsp));
 
 // non visual shape properties
 if (GetDocumentType() != DOCUMENT_DOCX)
 {
 pFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
-WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
+pFS->startElementNS(mnXmlNamespace, XML_cNvPr,
+  XML_id, OString::number(GetNewShapeID(xShape)),
+  XML_name, IDS(TextShape));
+OUString sURL;
+if (GetProperty(xShapeProps, "URL"))
+mAny >>= sURL;
+
+if (!sURL.isEmpty())
+{
+OUString sRelId = mpFB->addRelation(mpFS->getOutputStream(),
+oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
+
+mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), 
sRelId.toUtf8());
+}
+pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
 }
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1");
 if (GetDocumentType() != DOCUMENT_DOCX)
diff --git a/sc/qa/unit/data/ods/text_box_hyperlink.ods 
b/sc/qa/unit/data/ods/text_box_hyperlink.ods
new file mode 100644
index ..8e99818b
Binary files /dev/null and b/sc/qa/unit/data/ods/text_box_hyperlink.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index bc8545ca182e..1879924d705a 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -221,6 +221,7 @@ public:
 void testTdf115159();
 void testTdf112567();
 void testTdf123645XLSX();
+void testTdf125173XLSX();
 
 void testXltxExport();
 
@@ -347,6 +348,7 @@ public:
 CPPUNIT_TEST(testTdf115159);
 CPPUNIT_TEST(testTdf112567);
 CPPUNIT_TEST(testTdf123645XLSX);
+CPPUNIT_TEST(testTdf125173XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4352,6 +4354,22 @@ void ScExportTest::testTdf123645XLSX()
 assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId5']", 
"Target", "https://bugs.documentfoundation.org/show_bug.cgi?id=123645;);
 }
 
+void ScExportTest::testTdf125173XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("text_box_hyperlink.", FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+
+xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, 
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr/a:hlinkClick", 1);
+
+xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/_rels/drawing1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"Target", "http://www.google.com/;);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"TargetMode", "External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: oox/source sc/qa

2019-04-06 Thread tundet (via logerrit)
 oox/source/export/shapes.cxx  |   19 +++
 sc/qa/unit/data/xlsx/image_hyperlink.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   18 ++
 3 files changed, 33 insertions(+), 4 deletions(-)

New commits:
commit 6a9cf9ba2d37fee9b7c2f190b347e0d7c4a2676a
Author: tundet 
AuthorDate: Thu Apr 4 12:25:33 2019 +0200
Commit: Katarina Behrens 
CommitDate: Sat Apr 6 09:27:29 2019 +0200

tdf#91634 XLSX export: fix hyperlink inserted to image

Hyperlink inserted to image lost after export.

image_hyperlink.xlsx: Test file from Excel.

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

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d615d2ec32da..0b28f58003a7 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1133,13 +1133,15 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 
 pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND );
 
-OUString sName, sDescr;
-bool bHaveName, bHaveDesc;
+OUString sName, sDescr, sURL;
+bool bHaveName, bHaveDesc, bHaveURL;
 
 if ( ( bHaveName= GetProperty( xShapeProps, "Name" ) ) )
 mAny >>= sName;
 if ( ( bHaveDesc = GetProperty( xShapeProps, "Description" ) ) )
 mAny >>= sDescr;
+if ( ( bHaveURL = GetProperty( xShapeProps, "URL" ) ) )
+mAny >>= sURL;
 
 pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
   XML_id, I32S( GetNewShapeID( xShape ) ),
@@ -1149,19 +1151,28 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
   XML_descr,  bHaveDesc ? sDescr.toUtf8().getStr() : 
nullptr,
   FSEND );
 
-// OOXTODO: //cNvPr children: XML_extLst, XML_hlinkClick, XML_hlinkHover
+// OOXTODO: //cNvPr children: XML_extLst, XML_hlinkHover
 if (bHasMediaURL)
 pFS->singleElementNS(XML_a, XML_hlinkClick,
  FSNS(XML_r, XML_id), "",
  XML_action, "ppaction://media",
  FSEND);
+if( !sURL.isEmpty() )
+{
+OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(),
+oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
 
+mpFS->singleElementNS( XML_a, XML_hlinkClick,
+FSNS( XML_r,XML_id ), USS( sRelId ),
+FSEND );
+}
 pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
 
 pFS->singleElementNS( mnXmlNamespace, XML_cNvPicPr,
   // OOXTODO: XML_preferRelativeSize
   FSEND );
-
 if (bHasMediaURL)
 WriteMediaNonVisualProperties(xShape);
 else
diff --git a/sc/qa/unit/data/xlsx/image_hyperlink.xlsx 
b/sc/qa/unit/data/xlsx/image_hyperlink.xlsx
new file mode 100644
index ..dd7afe725adb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/image_hyperlink.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 9ce85f021ccb..159152871adf 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -212,6 +212,7 @@ public:
 void testPivotCacheAfterExportXLSX();
 void testTdf114969XLSX();
 void testTdf115192XLSX();
+void testTdf91634XLSX();
 
 void testXltxExport();
 
@@ -331,6 +332,7 @@ public:
 CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
 CPPUNIT_TEST(testTdf114969XLSX);
 CPPUNIT_TEST(testTdf115192XLSX);
+CPPUNIT_TEST(testTdf91634XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4186,6 +4188,22 @@ void ScExportTest::testTdf115192XLSX()
 assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId3']", 
"TargetMode", "External");
 }
 
+void ScExportTest::testTdf91634XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("image_hyperlink.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+
+xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, 
"/xdr:wsDr/xdr:twoCellAnchor/xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick", 1);
+
+xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/_rels/drawing1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"Target", "https://www.google.com/;);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"TargetMode", "External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing 

[Libreoffice-commits] core.git: oox/source sc/qa sc/source

2018-10-11 Thread Libreoffice Gerrit user
 oox/source/ole/axcontrol.cxx |9 +
 oox/source/vml/vmldrawing.cxx|   55 +++
 sc/qa/unit/subsequent_filters-test.cxx   |   27 +++
 sc/source/filter/oox/drawingfragment.cxx |3 +
 4 files changed, 86 insertions(+), 8 deletions(-)

New commits:
commit 048b8e45813f6a19a4ff56e1d676fe9450325cd2
Author: Justin Luth 
AuthorDate: Sat Sep 29 14:38:31 2018 +0300
Commit: Miklos Vajna 
CommitDate: Thu Oct 11 09:48:03 2018 +0200

tdf#111980 oox optionbutton autoGroup inside GroupBox

The area of a GroupBox indicates which radio buttons
are considered to be part of the same group. The
button needs to be fully inside of the groupbox
in order to participate. This patch resolves the last
worry of commit 9f969799629fe6bdf8b922d8cb922846aa646ece

Change-Id: Ie6057337c63bf9eb173a0615e30c8d4e4d0c7a19
Reviewed-on: https://gerrit.libreoffice.org/61131
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 350fe0e315f9..563cf06e5a54 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1555,13 +1555,8 @@ void AxMorphDataModelBase::convertProperties( 
PropertyMap& rPropMap, const Contr
 rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
 if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
 {
-// Form Radio Controls (non-ActiveX) have no group name, but autoGroup
-// with their group box, or frame, or sheet, or document.
-// So ensure that SOME name is given for a group name
-// TODO: ActiveX controls without a Group name shouldn't autogroup
-//with non-ActiveX option buttons.
-// TODO: each application should test if control's area is fully inside
-//a GroupBox, and give those a separate group name.
+// If unspecified, radio buttons autoGroup in the same document/sheet
+// NOTE: form controls should not autoGroup with ActiveX controls - 
see drawingfragment.cxx
 OUString sGroupName = !maGroupName.isEmpty() ? maGroupName : 
"autoGroup_";
 rPropMap.setProperty( PROP_GroupName, sGroupName );
 }
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index ab2a9f8a42d5..0d5698eab0c9 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace oox {
 namespace vml {
@@ -146,6 +148,59 @@ void Drawing::convertAndInsert() const
 {
 Reference< XShapes > xShapes( mxDrawPage, UNO_QUERY );
 mxShapes->convertAndInsert( xShapes );
+
+// Group together form control radio buttons that are in the same groupBox
+std::map GroupBoxMap;
+std::map, tools::Rectangle> RadioButtonMap;
+for ( sal_Int32 i = 0; i < xShapes->getCount(); ++i )
+{
+try
+{
+Reference< XControlShape > xCtrlShape( xShapes->getByIndex(i), 
UNO_QUERY_THROW );
+Reference< XControlModel > xCtrlModel( xCtrlShape->getControl(), 
UNO_SET_THROW );
+Reference< XServiceInfo > xModelSI (xCtrlModel, UNO_QUERY_THROW );
+Reference< XPropertySet >  aProps( xCtrlModel, UNO_QUERY_THROW );
+
+OUString sName;
+aProps->getPropertyValue("Name") >>= sName;
+const ::Point aPoint( xCtrlShape->getPosition().X, 
xCtrlShape->getPosition().Y );
+const ::Size aSize( xCtrlShape->getSize().Width, 
xCtrlShape->getSize().Height );
+const tools::Rectangle aRect( aPoint, aSize );
+if ( !sName.isEmpty()
+ && 
xModelSI->supportsService("com.sun.star.awt.UnoControlGroupBoxModel") )
+{
+GroupBoxMap[sName] = aRect;
+}
+else if ( 
xModelSI->supportsService("com.sun.star.awt.UnoControlRadioButtonModel") )
+{
+OUString sGroupName;
+aProps->getPropertyValue("GroupName") >>= sGroupName;
+// only Form Controls are affected by Group Boxes - see 
drawingfragment.cxx
+if ( sGroupName == "autoGroup_formControl" )
+RadioButtonMap[aProps] = aRect;
+}
+}
+catch (uno::Exception&)
+{
+DBG_UNHANDLED_EXCEPTION("oox.vml");
+}
+}
+for ( auto& BoxItr : GroupBoxMap )
+{
+const uno::Any aGroup( OUString("autoGroup_").concat(BoxItr.first) );
+for ( auto RadioItr = RadioButtonMap.begin(); RadioItr != 
RadioButtonMap.end(); )
+{
+if ( BoxItr.second.IsInside(RadioItr->second) )
+{
+RadioItr->first->setPropertyValue("GroupName", aGroup );
+// If conflict, first created GroupBox wins
+RadioButtonMap.erase( RadioItr++ );
+}
+else
+

[Libreoffice-commits] core.git: oox/source sc/qa

2018-10-04 Thread Libreoffice Gerrit user
 oox/source/vml/vmlinputstream.cxx   |2 +-
 sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx  |   19 +++
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 2cae2ecfef47d8dd10647c10f9577392c1887d3a
Author: Justin Luth 
AuthorDate: Thu Oct 4 17:55:42 2018 +0300
Commit: Justin Luth 
CommitDate: Thu Oct 4 21:29:23 2018 +0200

tdf#120301 oox: lclIsWhiteSpace should return true for a space

Change-Id: I72c79c1fed4d9a91bf02024eef23cd3b1a58632e
Reviewed-on: https://gerrit.libreoffice.org/61388
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/vml/vmlinputstream.cxx 
b/oox/source/vml/vmlinputstream.cxx
index 0dcb588bf931..e33c66a87f21 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -43,7 +43,7 @@ inline const sal_Char* lclFindCharacter( const sal_Char* 
pcBeg, const sal_Char*
 
 inline bool lclIsWhiteSpace( sal_Char cChar )
 {
-return cChar < 32;
+return cChar <= 32;
 }
 
 const sal_Char* lclFindWhiteSpace( const sal_Char* pcBeg, const sal_Char* 
pcEnd )
diff --git a/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx
new file mode 100644
index ..0677a0cf2eb2
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 0b0406127e82..188a957f5440 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -234,6 +234,7 @@ public:
 
 void testPageScalingXLSX();
 void testActiveXCheckboxXLSX();
+void testtdf120301_xmlSpaceParsingXLSX();
 #ifdef UNX
 void testUnicodeFileNameGnumeric();
 #endif
@@ -371,6 +372,7 @@ public:
 
 CPPUNIT_TEST(testPageScalingXLSX);
 CPPUNIT_TEST(testActiveXCheckboxXLSX);
+CPPUNIT_TEST(testtdf120301_xmlSpaceParsingXLSX);
 #ifdef UNX
 CPPUNIT_TEST(testUnicodeFileNameGnumeric);
 #endif
@@ -4140,6 +4142,23 @@ void ScFiltersTest::testActiveXCheckboxXLSX()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testtdf120301_xmlSpaceParsingXLSX()
+{
+ScDocShellRef xDocSh = loadDoc("tdf120301_xmlSpaceParsing.", FORMAT_XLSX);
+uno::Reference< frame::XModel > xModel = xDocSh->GetModel();
+uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, 
UNO_QUERY_THROW);
+uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
+uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( 
xIA->getByIndex(0), UNO_QUERY_THROW);
+uno::Reference< container::XIndexAccess > 
xIA_DrawPage(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+
+uno::Reference< drawing::XControlShape > 
xControlShape(xIA_DrawPage->getByIndex(0), UNO_QUERY_THROW);
+uno::Reference< beans::XPropertySet > XPropSet( 
xControlShape->getControl(), uno::UNO_QUERY_THROW );
+OUString sCaption;
+XPropSet->getPropertyValue("Label") >>= sCaption;
+CPPUNIT_ASSERT_EQUAL(OUString("Check Box 1"), sCaption);
+xDocSh->DoClose();
+}
+
 namespace {
 
 struct PaintListener : public SfxListener
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2018-09-28 Thread Libreoffice Gerrit user
 oox/source/ole/axcontrol.cxx |   12 +++-
 sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx   |   32 +++
 3 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 9f969799629fe6bdf8b922d8cb922846aa646ece
Author: Justin Luth 
AuthorDate: Thu Sep 27 21:46:18 2018 +0300
Commit: Michael Meeks 
CommitDate: Fri Sep 28 09:57:28 2018 +0200

tdf#111980 oox: connect empty radio groups

affects doc, docx, xls, xlsx (at least). Handling optionbutton
groups is new since 2017, so incremental enhancements are OK.

In LO, if an option button with an empty groupName (like any form
control which has no groupName option), then it stands alone,
which is a ridiculous position to be in for a radio button.
So, lets put them all together into an automatic group.

In MSO, buttons without any explicit group stick together,
so the effective group is the entire document, or entire sheet.

One complication is that ActiveX radio buttons don't
interact with Form radio buttons, even if all of them
have no group name. That situation is not handled by
this patch (and not very likely to happen since ActiveX
defaults the group name to the sheet name).

(A Group Box can also be used, which automatically groups
all buttons fully within its area. That will be much harder
to implement since every object will need to first be
categorized as groupbox or optionControl - meaning that everything
must first be imported. That implies a function call from every
application doing the import.)

Change-Id: I204adaea75ce9a16c0cc4e9c3b8b08da9433
Reviewed-on: https://gerrit.libreoffice.org/61064
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 2eab7a0fa861..350fe0e315f9 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1554,7 +1554,17 @@ void AxMorphDataModelBase::convertProperties( 
PropertyMap& rPropMap, const Contr
 rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
 rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
 if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
-rPropMap.setProperty( PROP_GroupName, maGroupName );
+{
+// Form Radio Controls (non-ActiveX) have no group name, but autoGroup
+// with their group box, or frame, or sheet, or document.
+// So ensure that SOME name is given for a group name
+// TODO: ActiveX controls without a Group name shouldn't autogroup
+//with non-ActiveX option buttons.
+// TODO: each application should test if control's area is fully inside
+//a GroupBox, and give those a separate group name.
+OUString sGroupName = !maGroupName.isEmpty() ? maGroupName : 
"autoGroup_";
+rPropMap.setProperty( PROP_GroupName, sGroupName );
+}
 AxFontDataModel::convertProperties( rPropMap, rConv );
 }
 
diff --git a/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx 
b/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx
new file mode 100644
index ..9f97d9e00a48
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index b896d3e47370..ef2b5ee22aef 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -177,6 +177,7 @@ public:
 
 //test shape import
 void testControlImport();
+void testActiveXOptionButtonGroup();
 void testChartImportODS();
 #if HAVE_MORE_FONTS
 void testChartImportXLS();
@@ -290,6 +291,7 @@ public:
 CPPUNIT_TEST(testCellValueXLSX);
 CPPUNIT_TEST(testRowIndex1BasedXLSX);
 CPPUNIT_TEST(testControlImport);
+CPPUNIT_TEST(testActiveXOptionButtonGroup);
 CPPUNIT_TEST(testChartImportODS);
 #if HAVE_MORE_FONTS
 CPPUNIT_TEST(testChartImportXLS);
@@ -1676,6 +1678,36 @@ void ScFiltersTest::testControlImport()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testActiveXOptionButtonGroup()
+{
+ScDocShellRef xDocSh = loadDoc("tdf111980_radioButtons.", FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load singlecontrol.xlsx", xDocSh.is());
+uno::Reference< frame::XModel > xModel = xDocSh->GetModel();
+uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, 
UNO_QUERY_THROW);
+uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
+uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( 
xIA->getByIndex(0), UNO_QUERY_THROW);
+uno::Reference< container::XIndexAccess > 
xIA_DrawPage(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+
+OUString sGroupName;
+uno::Reference< drawing::XControlShape > 
xControlShape(xIA_DrawPage->getByIndex(0), 

[Libreoffice-commits] core.git: oox/source sc/qa

2018-08-30 Thread Libreoffice Gerrit user
 oox/source/export/drawingml.cxx|2 +-
 sc/qa/unit/data/xlsx/testShapeAutofit.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |   16 
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 7626dc2d81dc5eb647d6f8937cc1d220a8b8ef4b
Author: Balazs Varga 
AuthorDate: Wed Aug 29 19:14:56 2018 +0200
Commit: Tamás Zolnai 
CommitDate: Thu Aug 30 13:03:03 2018 +0200

tdf#119562 Fix export of AutoFit property of shapes to XLSX

With this patch the "Resize shape to fit text" property
(TextAutoGrowHeight) will be exported correctly to XLSX format.

Change-Id: I488ceead452aef9096e7766f957de425c8486f85
Reviewed-on: https://gerrit.libreoffice.org/59778
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2b74cb83ce85..c42a74a95267 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2423,7 +2423,7 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst, 
presetWarp.toUtf8().getStr(),
 FSEND );
 }
-if (GetDocumentType() == DOCUMENT_DOCX)
+if (GetDocumentType() == DOCUMENT_DOCX || GetDocumentType() == 
DOCUMENT_XLSX)
 {
 bool bTextAutoGrowHeight = false;
 GET(bTextAutoGrowHeight, TextAutoGrowHeight);
diff --git a/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx 
b/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx
new file mode 100755
index ..d5742cd1c854
Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 56546a588789..596cfe751e20 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -188,6 +188,7 @@ public:
 void testTextUnderlineColorXLSX();
 void testSheetRunParagraphPropertyXLSX();
 void testHiddenShapeXLSX();
+void testShapeAutofitXLSX();
 void testHyperlinkXLSX();
 void testMoveCellAnchoredShapesODS();
 void testMatrixMultiplicationXLSX();
@@ -301,6 +302,7 @@ public:
 CPPUNIT_TEST(testTextUnderlineColorXLSX);
 CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX);
 CPPUNIT_TEST(testHiddenShapeXLSX);
+CPPUNIT_TEST(testShapeAutofitXLSX);
 CPPUNIT_TEST(testHyperlinkXLSX);
 CPPUNIT_TEST(testMoveCellAnchoredShapesODS);
 CPPUNIT_TEST(testMatrixMultiplicationXLSX);
@@ -3549,6 +3551,20 @@ void ScExportTest::testHiddenShapeXLSX()
 assertXPath(pDoc, 
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1");
 }
 
+void ScExportTest::testShapeAutofitXLSX()
+{
+ScDocShellRef xDocSh = loadDoc("testShapeAutofit.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/drawings/drawing1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+// TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit 
text" --> true
+assertXPath(pDoc, 
"/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp/xdr:txBody/a:bodyPr/a:spAutoFit", 1);
+// TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit 
text" --> false
+assertXPath(pDoc, 
"/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp/xdr:txBody/a:bodyPr/a:noAutofit", 1);
+}
+
 void ScExportTest::testHyperlinkXLSX()
 {
 ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2018-03-20 Thread Caolán McNamara
 oox/source/drawingml/drawingmltypes.cxx |   10 +++---
 sc/qa/unit/subsequent_export-test.cxx   |4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit dfc2e9be0948ca72f858197392921f5bb27f605b
Author: Caolán McNamara 
Date:   Mon Mar 19 16:31:38 2018 +

ofz#7012 Integer-overflow

and fix negative rounding code, which results in changing tet
of from -996 to -1002 which is closer to the original -1000

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

diff --git a/oox/source/drawingml/drawingmltypes.cxx 
b/oox/source/drawingml/drawingmltypes.cxx
index cda9c1c61817..93c7c423330f 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -90,14 +90,18 @@ float GetTextSize( const OUString& sValue )
 sal_Int32 GetTextSpacingPoint( const OUString& sValue )
 {
 sal_Int32 nRet;
-if( ::sax::Converter::convertNumber( nRet, sValue ) )
+if( ::sax::Converter::convertNumber( nRet, sValue, (SAL_MIN_INT32 + 360) / 
254, (SAL_MAX_INT32 - 360) / 254 ) )
 nRet = GetTextSpacingPoint( nRet );
 return nRet;
 }
 
-sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue )
+sal_Int32 GetTextSpacingPoint(sal_Int32 nValue)
 {
-return ( nValue * 254 + 360 ) / 720;
+if (nValue > 0)
+nValue = (nValue * 254 + 360);
+else if (nValue < 0)
+nValue = (nValue * 254 - 360);
+return nValue / 720;
 }
 
 float GetFontHeight( sal_Int32 nHeight )
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 26b925d14a16..fcef9a057c68 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3415,8 +3415,8 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX()
 OUString CondensedCharSpace = getXPath(pDoc,
 
"/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]","spc");
 
-// make sure that the CondensedCharSpace is -996.
-CPPUNIT_ASSERT_EQUAL(OUString("-996"), CondensedCharSpace);
+// make sure that the CondensedCharSpace is -1002.
+CPPUNIT_ASSERT_EQUAL(OUString("-1002"), CondensedCharSpace);
 
 xDocSh->DoClose();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2018-02-07 Thread Bartosz Kosiorek
 oox/source/export/preset-definitions-to-shape-types.pl |3 +-
 sc/qa/unit/subsequent_export-test.cxx  |   21 -
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit ea7274259a211170ee9f5a8714a2f9acd8bed6d8
Author: Bartosz Kosiorek 
Date:   Fri Jan 12 17:12:18 2018 +0100

tdf#114842 Fix comment shape export for Calc

When we have shape definition for commend, eg.:
   







After that fix, comments are displayed correctly.
I also added unit test, to make sure that shape is using already defined 
"shapetype".

Change-Id: I8faf1befe7573aa33ee8a294eb192e5e255f37a1
Reviewed-on: https://gerrit.libreoffice.org/47821
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

diff --git a/oox/source/export/preset-definitions-to-shape-types.pl 
b/oox/source/export/preset-definitions-to-shape-types.pl
index b41dd58953e8..e36e97a808a9 100644
--- a/oox/source/export/preset-definitions-to-shape-types.pl
+++ b/oox/source/export/preset-definitions-to-shape-types.pl
@@ -1187,8 +1187,9 @@ parse( $file );
 close( $file );
 
 if ( !defined( $result_shapes{'textBox'} ) ) {
+# tdf#114842 shapetype id of the textbox, must be the same as defined
 $result_shapes{'textBox'} =
-"\n" .
 "\n" .
 "\n" .
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index aaf82ae88c88..6865897d0318 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -564,14 +564,25 @@ void ScExportTest::testCommentExportXLSX()
 CPPUNIT_ASSERT(xShell.is());
 
 std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/comments1.xml");
-CPPUNIT_ASSERT(pSheet);
+const xmlDocPtr pComments = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "xl/comments1.xml");
+CPPUNIT_ASSERT(pComments);
+
+assertXPath(pComments, "/x:comments/x:authors/x:author[1]", "BAKO");
+assertXPath(pComments, "/x:comments/x:authors/x:author", 1);
+
+assertXPath(pComments, 
"/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
 
-assertXPath(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
-assertXPath(pSheet, "/x:comments/x:authors/x:author", 1);
+const xmlDocPtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "xl/drawings/vmlDrawing1.vml");
+CPPUNIT_ASSERT(pVmlDrawing);
 
-assertXPath(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", 
"Komentarz");
+//assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600");
+assertXPath(pVmlDrawing, "/xml/v:shapetype", "spt", "202");
+assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke", "joinstyle", 
"miter");
+const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, 
"/xml/v:shapetype", "id");
 
+assertXPath(pVmlDrawing, "/xml/v:shape", "type", sShapeTypeId);
+assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "color", "black");
+assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t");
 }
 
 #if HAVE_MORE_FONTS
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2017-08-08 Thread Miklos Vajna
 oox/source/drawingml/shapegroupcontext.cxx |2 +-
 sc/qa/unit/data/xlsx/tdf110440.xlsx|binary
 sc/qa/unit/subsequent_filters-test.cxx |   21 +
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit a3c695c12386c2708a0c06ec0ccd42ee2b8aeb98
Author: Miklos Vajna 
Date:   Mon Aug 7 21:28:30 2017 +0200

tdf#110440 drawingML import: fix handling of group shape properties

The handler for nvGrpSpPr is "this class", not "no class".

Change-Id: I7fc40681d77f94b7473d2f677d813d2ae246f6ac
Reviewed-on: https://gerrit.libreoffice.org/40854
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/drawingml/shapegroupcontext.cxx 
b/oox/source/drawingml/shapegroupcontext.cxx
index dae4ea67045a..7f10ec32a503 100644
--- a/oox/source/drawingml/shapegroupcontext.cxx
+++ b/oox/source/drawingml/shapegroupcontext.cxx
@@ -79,7 +79,7 @@ ContextHandlerRef ShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken, c
 case XML_grpSpPr:
 return new ShapePropertiesContext( *this, *mpGroupShapePtr );
 case XML_nvGrpSpPr:
-return nullptr;
+return this;
 case XML_spPr:
 return new ShapePropertiesContext( *this, *mpGroupShapePtr );
 /*
diff --git a/sc/qa/unit/data/xlsx/tdf110440.xlsx 
b/sc/qa/unit/data/xlsx/tdf110440.xlsx
new file mode 100644
index ..da849d0bd310
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf110440.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 1e136675b2e5..1fdec5f26079 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -240,6 +240,7 @@ public:
 void testTdf100458();
 void testTdf100709XLSX();
 void testTdf97598XLSX();
+void testTdf110440XLSX();
 
 void testPageScalingXLSX();
 void testActiveXCheckboxXLSX();
@@ -367,6 +368,7 @@ public:
 CPPUNIT_TEST(testTdf100458);
 CPPUNIT_TEST(testTdf100709XLSX);
 CPPUNIT_TEST(testTdf97598XLSX);
+CPPUNIT_TEST(testTdf110440XLSX);
 
 CPPUNIT_TEST(testPageScalingXLSX);
 CPPUNIT_TEST(testActiveXCheckboxXLSX);
@@ -3790,6 +3792,25 @@ void ScFiltersTest::testColumnStyle2XLSX()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf110440XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("tdf110440.", FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
+
+uno::Reference xModel = xDocSh->GetModel();
+uno::Reference xDoc(xModel, 
uno::UNO_QUERY_THROW);
+uno::Reference xIA(xDoc->getSheets(), 
uno::UNO_QUERY_THROW);
+uno::Reference 
xDrawPageSupplier(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
+xIA.set(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW);
+uno::Reference xShape(xIA->getByIndex(0), 
uno::UNO_QUERY_THROW);
+bool bVisible = true;
+xShape->getPropertyValue("Visible") >>= bVisible;
+// This failed: group shape's hidden property was lost on import.
+CPPUNIT_ASSERT(!bVisible);
+
+xDocSh->DoClose();
+}
+
 void ScFiltersTest::testBnc762542()
 {
 ScDocShellRef xDocSh = loadDoc("bnc762542.", FORMAT_XLSX);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2017-05-31 Thread Bartosz Kosiorek
 oox/source/drawingml/textcharacterproperties.cxx |1 
 oox/source/export/drawingml.cxx  |   30 +--
 sc/qa/unit/data/xlsx/underlineColor.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx|   18 +
 4 files changed, 32 insertions(+), 17 deletions(-)

New commits:
commit 8129ad7b22dceeb2fef13741aa509c2229cf03de
Author: Bartosz Kosiorek 
Date:   Wed May 24 01:13:26 2017 +0200

tdf#104219 Don't export color information when color is automatic

In LibreOffice and MS Office, there are two types of colors:
 - Automatic (which is taken from settings) and Fixed (which is set by RGB 
value).
OOXML is setting automatic color by default, by not providing any RGB color.
To preserve automatic color we need to not export
RGB color during OOXML export.

Change-Id: I8895230c4fffc9d8741f3eff37e64c4823d71da8
Reviewed-on: https://gerrit.libreoffice.org/37970
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index d45e59ddc9c7..71046841c60c 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -152,6 +152,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 rPropMap.setProperty( PROP_CharUnderlineHasColor, true);
 rPropMap.setProperty( PROP_CharUnderlineColor, 
maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
 }
+// TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
 }
 
 void pushToGrabBag( PropertySet& rPropSet, const std::vector& 
aVectorOfProperyValues )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 90f457d351db..88fac6520b0b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1409,24 +1409,30 @@ void DrawingML::WriteRunProperties( const Reference< 
XPropertySet >& rRun, bool
 sal_uInt32 color = *o3tl::doAccess(mAny);
 SAL_INFO("oox.shape", "run color: " << color << " auto: " << COL_AUTO);
 
-if( color == COL_AUTO )  // nCharColor depends to the background color
+// tdf#104219 In LibreOffice and MS Office, there are two types of 
colors:
+// Automatic and Fixed. OOXML is setting automatic color, by not 
providing color.
+if( color != COL_AUTO )
 {
-color = mbIsBackgroundDark ? 0xff : 0x00;
+color &= 0xff;
+// TODO: special handle embossed/engraved
+WriteSolidFill( color );
 }
-color &= 0xff;
-
-// TODO: special handle embossed/engraved
-
-WriteSolidFill( color );
 }
 
-if( CGETAD( CharUnderlineColor ) )
+if( ( underline != nullptr ) && CGETAD( CharUnderlineColor ) )
 {
 sal_uInt32 color = *o3tl::doAccess(mAny);
-
-mpFS->startElementNS( XML_a, XML_uFill,FSEND);
-WriteSolidFill( color );
-mpFS->endElementNS( XML_a, XML_uFill );
+// if color is automatic, then we shouldn't write information about 
color but to take color from character
+if( color != COL_AUTO )
+{
+mpFS->startElementNS( XML_a, XML_uFill, FSEND);
+WriteSolidFill( color );
+mpFS->endElementNS( XML_a, XML_uFill );
+}
+else
+{
+mpFS->singleElementNS( XML_a, XML_uFillTx, FSEND );
+}
 }
 
 if( GETA( CharFontName ) )
diff --git a/sc/qa/unit/data/xlsx/underlineColor.xlsx 
b/sc/qa/unit/data/xlsx/underlineColor.xlsx
index 30346ce733db..124391b3bc11 100644
Binary files a/sc/qa/unit/data/xlsx/underlineColor.xlsx and 
b/sc/qa/unit/data/xlsx/underlineColor.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 253134d5d29f..fb4d496243bf 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3452,16 +3452,24 @@ void 
ScExportTest::testSheetCondensedCharacterSpaceXLSX()
 
 void ScExportTest::testTextUnderlineColorXLSX()
 {
-
 ScDocShellRef xDocSh = loadDoc("underlineColor.", FORMAT_XLSX);
 CPPUNIT_ASSERT(xDocSh.is());
 
 xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, 
"xl/drawings/drawing1.xml", FORMAT_XLSX);
 CPPUNIT_ASSERT(pDoc);
-OUString color = getXPath(pDoc,
-
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/a:solidFill/a:srgbClr",
 "val");
-// make sure that the underline color is RED
-CPPUNIT_ASSERT_EQUAL(OUString("ff"), color);
+// Make sure the underline type is double line
+assertXPath(pDoc, 

[Libreoffice-commits] core.git: oox/source sc/qa sc/source

2016-12-01 Thread Mike Kaganski
 oox/source/core/fragmenthandler2.cxx   |1 
 oox/source/core/xmlfilterbase.cxx  |5 +
 oox/source/token/namespaces-strict.txt |1 
 oox/source/token/namespaces.hxx.tail   |1 
 oox/source/token/namespaces.txt|1 
 oox/source/token/tokens.txt|1 
 sc/qa/unit/bugfix-test.cxx |   50 +-
 sc/qa/unit/data/xlsx/tdf104310-2.xlsx  |binary
 sc/source/filter/inc/worksheetfragment.hxx |   41 +++
 sc/source/filter/oox/worksheetfragment.cxx |   77 +
 10 files changed, 155 insertions(+), 23 deletions(-)

New commits:
commit ce17ebb69500530c978767b1389c9e8341acb9bf
Author: Mike Kaganski 
Date:   Fri Dec 2 03:31:22 2016 +0300

tdf#104310: Accept x12ac lists and fallbacks in dataValidations

Change-Id: I42cf20fcfe3ec03ebd09923be509a9d11e0b40da
Reviewed-on: https://gerrit.libreoffice.org/31516
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 

diff --git a/oox/source/core/fragmenthandler2.cxx 
b/oox/source/core/fragmenthandler2.cxx
index 9a708d5..ba3f880 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -76,6 +76,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, 
const AttributeLis
 {
 "p14",
 "p15",
+"x12ac",
 };
 
 if (std::find(aSupportedNS.begin(), aSupportedNS.end(), 
aRequires) != aSupportedNS.end())
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index fae720f..952bf5e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -146,7 +146,10 @@ struct NamespaceIds: public rtl::StaticWithInit<
 {"http://schemas.microsoft.com/office/powerpoint/2010/main;,
  NMSP_p14},
 {"http://schemas.microsoft.com/office/powerpoint/2012/main;,
- NMSP_p15}};
+ NMSP_p15},
+{"http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac;,
+ NMSP_x12ac},
+};
 }
 };
 
diff --git a/oox/source/token/namespaces-strict.txt 
b/oox/source/token/namespaces-strict.txt
index f9a4633..0f606f7 100644
--- a/oox/source/token/namespaces-strict.txt
+++ b/oox/source/token/namespaces-strict.txt
@@ -83,6 +83,7 @@ p14 
http://schemas.microsoft.com/office/powerpoint/2010/main
 # MSO 2012/2013 extensions 
-
 
 p15 
http://schemas.microsoft.com/office/powerpoint/2012/main
+x12ac   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 
 # extlst namespaces
 
diff --git a/oox/source/token/namespaces.hxx.tail 
b/oox/source/token/namespaces.hxx.tail
index 89f8c1c..17770dc 100644
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@ -46,6 +46,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return 
nToken & NMSP_MASK; }
 #define R_TOKEN( token )OOX_TOKEN( officeRel, token )
 #define VML_TOKEN( token )  OOX_TOKEN( vml, token )
 #define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token )
+#define X12AC_TOKEN( token )OOX_TOKEN( x12ac, token )
 #define XDR_TOKEN( token )  OOX_TOKEN( dmlSpreadDr, token )
 #define XLS_TOKEN( token )  OOX_TOKEN( xls, token )
 #define XLS14_TOKEN( token )OOX_TOKEN( xls14Lst, token )
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index 7920572..4b6f49a 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -83,6 +83,7 @@ p14 
http://schemas.microsoft.com/office/powerpoint/2010/main
 # MSO 2012/2013 extensions 
-
 
 p15 
http://schemas.microsoft.com/office/powerpoint/2012/main
+x12ac   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 
 # extlst namespaces
 
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index b113c84..6d4fcb8 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -5781,6 +5781,7 @@ writeProtection
 wsDr
 wsp
 x
+x12ac
 x14
 xAlign
 xIllusions
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 9b7f2b7..3499109 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -242,20 +242,42 @@ void ScFiltersTest::testRhbz1390776()
 
 void ScFiltersTest::testTdf104310()
 {
-ScDocShellRef xDocSh = loadDoc("tdf104310.", FORMAT_XLSX);
-ScDocument& rDoc = xDocSh->GetDocument();
-
-const ScValidationData* pData = rDoc.GetValidationEntry(1);
-CPPUNIT_ASSERT(pData);
-
-// Make sure the list is correct.
-std::vector aList;
-pData->FillSelectionList(aList, ScAddress(0, 1, 0));
-

[Libreoffice-commits] core.git: oox/source sc/qa

2015-05-15 Thread PriyankaGaikwad
 oox/source/export/shapes.cxx  |6 ++
 sc/qa/unit/data/xlsx/hiddenShape.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   12 
 3 files changed, 18 insertions(+)

New commits:
commit ccf91b9f823c28f2cb08784e4be4157bad40837e
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Thu May 7 16:19:38 2015 +0530

tdf#74932 FILESAVE: Shapes appear when saving a .XLSX file with filter

Problem Description
If the attribute hidden is set and then after exporting it to .xlsx, the 
shape does not remain hidden.

XML Difference
Original :
xdr:cNvPr id=2 name=Rectangle 1 hidden=1/

Roundtrip :
xdr:cNvPr id=0 name=CustomShape 1/xdr:cNvPr

Change-Id: I2e87a484ea984b56415891fd157995cb49453f76
Reviewed-on: https://gerrit.libreoffice.org/15662
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 87c0190..76d57fd 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -419,10 +419,16 @@ ShapeExport ShapeExport::WriteCustomShape( Reference 
XShape  xShape )
 // non visual shape properties
 if (GetDocumentType() != DOCUMENT_DOCX)
 {
+bool isVisible = true ;
+if( GETA (Visible))
+{
+mAny = isVisible;
+}
 pFS-startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
 pFS-startElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, I32S( GetNewShapeID( xShape ) ),
 XML_name, IDS( CustomShape ),
+XML_hidden, isVisible ? NULL : 1,
 FSEND );
 
 if( GETA( URL ) )
diff --git a/sc/qa/unit/data/xlsx/hiddenShape.xlsx 
b/sc/qa/unit/data/xlsx/hiddenShape.xlsx
new file mode 100644
index 000..3f38909
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hiddenShape.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index d42e29e..60b4b5c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -143,6 +143,7 @@ public:
 void testSheetCondensedCharacterSpace();
 void testTextUnderlineColor();
 void testSheetRunParagraphProperty();
+void testHiddenShape();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -196,6 +197,7 @@ public:
 CPPUNIT_TEST(testSheetCondensedCharacterSpace);
 CPPUNIT_TEST(testTextUnderlineColor);
 CPPUNIT_TEST(testSheetRunParagraphProperty);
+CPPUNIT_TEST(testHiddenShape);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2630,6 +2632,16 @@ void ScExportTest::testSheetRunParagraphProperty()
 xDocSh-DoClose();
 }
 
+void ScExportTest::testHiddenShape()
+{
+ScDocShellRef xDocSh = loadDoc(hiddenShape., XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, 
/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr, hidden, 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2015-05-09 Thread PriyankaGaikwad
 oox/source/export/drawingml.cxx  |9 +
 sc/qa/unit/data/xlsx/underlineColor.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx|   17 +
 3 files changed, 26 insertions(+)

New commits:
commit 24be7ef5887ec3598b3b34cb4fccff17ed6e1106
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Fri Apr 24 18:25:11 2015 +0530

tdf#90828 FILESAVE:XLSX export of underline color for text inside textbox

Problem Description:
Unable to save .xlsx with underline color for text inside textbox.

Current behavior:
After RT text underline color was not exported

Expected behaviour:
After RT text underline color should export

Added export support for a:uFill

Change-Id: If8ffeb07f2f5e0b768689647e480792ea9c8540a
Reviewed-on: https://gerrit.libreoffice.org/15514
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9ede463..d2691cc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1362,6 +1362,15 @@ void DrawingML::WriteRunProperties( Reference 
XPropertySet  rRun, bool bIsFiel
 WriteSolidFill( color );
 }
 
+if( GETAD( CharUnderlineColor ) )
+{
+sal_uInt32 color = *static_castsal_uInt32 const *(mAny.getValue());
+
+mpFS-startElementNS( XML_a, XML_uFill,FSEND);
+WriteSolidFill( color );
+mpFS-endElementNS( XML_a, XML_uFill );
+}
+
 if( GETA( CharFontName ) )
 {
 const char* pitch = NULL;
diff --git a/sc/qa/unit/data/xlsx/underlineColor.xlsx 
b/sc/qa/unit/data/xlsx/underlineColor.xlsx
new file mode 100644
index 000..30346ce
Binary files /dev/null and b/sc/qa/unit/data/xlsx/underlineColor.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 4924adc..4256253 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -141,6 +141,7 @@ public:
 void testFontSize();
 void testSheetCharacterKerningSpace();
 void testSheetCondensedCharacterSpace();
+void testTextUnderlineColor();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -192,6 +193,7 @@ public:
 CPPUNIT_TEST(testFontSize);
 CPPUNIT_TEST(testSheetCharacterKerningSpace);
 CPPUNIT_TEST(testSheetCondensedCharacterSpace);
+CPPUNIT_TEST(testTextUnderlineColor);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2595,6 +2597,21 @@ void ScExportTest::testSheetCondensedCharacterSpace()
 xDocSh-DoClose();
 }
 
+void ScExportTest::testTextUnderlineColor()
+{
+
+ScDocShellRef xDocSh = loadDoc(underlineColor., XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+OUString color = getXPath(pDoc,
+
/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/a:solidFill/a:srgbClr,
 val);
+// make sure that the underline color is RED
+CPPUNIT_ASSERT(color.equals(ff));
+}
+
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2015-05-07 Thread yogesh . bharate001
 oox/source/export/drawingml.cxx   |3 +-
 sc/qa/unit/data/xlsx/textbox-CondensedCharacterSpace.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   21 ++
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 3ffed8635acd55a5989bf9a0f4bc9c20b0acd945
Author: yogesh.bharate001 yogesh.bhar...@synerzip.com
Date:   Mon May 4 17:49:12 2015 +0530

tdf#91066: Condensed Character Spacing i.e spc(negative value) is not 
exported after RT.

Problem Description:
- Condensed character spacing i.e Spacing between characters/letters 
(negative value)
is not preserved after roundtrip.

XML Difference:
XML Difference :
Original:
a:rPr lang=en-IN sz=6000 b=1 kern=0 spc=-1000 baseline=0

After Roundtrip:
a:rPr b=1 lang=en-IN sz=6000 strike=noStrike

spc=-1000 is missing in roundtripped file.

Change-Id: I02edbb31375c2406a6e39873b7b886f4786a3758
Solution: Added support for Condensed Character Spacing.
Reviewed-on: https://gerrit.libreoffice.org/15635
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index da55e0f..9ede463 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1335,7 +1335,8 @@ void DrawingML::WriteRunProperties( Reference 
XPropertySet  rRun, bool bIsFiel
   XML_i, italic,
   XML_lang, usLanguage.isEmpty() ? NULL : USS( 
usLanguage ),
   XML_sz, IS( nSize ),
-  XML_spc, nCharKerning  0 ? IS(nCharKerning) : NULL,
+// For Condensed character spacing spc value is negative.
+  XML_spc, nCharKerning ? IS(nCharKerning) : NULL,
   XML_strike, strikeout,
   XML_u, underline,
   XML_baseline, nCharEscapement == 0 ? NULL : IS( 
nCharEscapement*1000 ),
diff --git a/sc/qa/unit/data/xlsx/textbox-CondensedCharacterSpace.xlsx 
b/sc/qa/unit/data/xlsx/textbox-CondensedCharacterSpace.xlsx
new file mode 100644
index 000..fb46fef
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/textbox-CondensedCharacterSpace.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 5271095..4924adc 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -140,6 +140,7 @@ public:
 void testSheetTextBoxHyperlink();
 void testFontSize();
 void testSheetCharacterKerningSpace();
+void testSheetCondensedCharacterSpace();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -190,6 +191,7 @@ public:
 CPPUNIT_TEST(testSheetTextBoxHyperlink);
 CPPUNIT_TEST(testFontSize);
 CPPUNIT_TEST(testSheetCharacterKerningSpace);
+CPPUNIT_TEST(testSheetCondensedCharacterSpace);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2573,6 +2575,25 @@ void ScExportTest::testSheetCharacterKerningSpace()
 xDocSh-DoClose();
 }
 
+void ScExportTest::testSheetCondensedCharacterSpace()
+{
+ScDocShellRef xShell = loadDoc(textbox-CondensedCharacterSpace., XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+ScDocShellRef xDocSh = saveAndReload((*xShell), XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+OUString CondensedCharSpace = getXPath(pDoc,
+
/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1],spc);
+
+// make sure that the CondensedCharSpace is -996.
+CPPUNIT_ASSERT_EQUAL(OUString(-996), CondensedCharSpace);
+
+xDocSh-DoClose();
+}
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2015-04-30 Thread yogesh . bharate001
 oox/source/export/drawingml.cxx|   12 ++
 sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |   23 +
 3 files changed, 35 insertions(+)

New commits:
commit b29483560306e6a6fec8dfe2c8622060b0ef2cd1
Author: yogesh.bharate001 yogesh.bhar...@synerzip.com
Date:   Thu Apr 30 16:17:31 2015 +0530

tdf#90955: CharKerning i.e spc is not exported after RT.

Problem Description:
- CharKerning i.e spacing between characters/letter is not exported
after roundtrip.

XML Difference:
Original:
a:rPr lang=en-IN sz=6000 b=1 kern=0 spc=2000 baseline=0

After Roundtrip:
a:rPr b=1 lang=en-IN sz=6000 strike=noStrike

spc is missing after RT.

Change-Id: I8bcefd6f0d0e3a1825618bece6f563792633a272
Solution: added support for spc.
Reviewed-on: https://gerrit.libreoffice.org/15575
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7862bf8..484c90b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1183,10 +1183,21 @@ void DrawingML::WriteRunProperties( Reference 
XPropertySet  rRun, bool bIsFiel
 const char* cap = NULL;
 sal_Int32 nSize = 1800;
 sal_Int32 nCharEscapement = 0;
+sal_Int32 nCharKerning = 0;
 
 if( GETA( CharHeight ) )
 nSize = (sal_Int32) (100*(*static_castfloat const 
*(mAny.getValue(;
 
+ if( GETA( CharKerning ) )
+nCharKerning = (sal_Int32)(*static_castshort const 
*(mAny.getValue()));
+/**  While setting values in propertymap,
+*CharKerning converted using GetTextSpacingPoint
+*i.e set @ 
http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textcharacterproperties.cxx#129
+*therefore to get original value CharKerning need to be convert.
+*
http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/drawingmltypes.cxx#95
+**/
+nCharKerning = ((nCharKerning * 720)-360) / 254;
+
 if ( ( bComplex  GETA( CharWeightComplex ) ) || GETA( CharWeight ) )
 {
 if ( *static_castfloat const *(mAny.getValue()) = 
awt::FontWeight::SEMIBOLD )
@@ -1324,6 +1335,7 @@ void DrawingML::WriteRunProperties( Reference 
XPropertySet  rRun, bool bIsFiel
   XML_i, italic,
   XML_lang, usLanguage.isEmpty() ? NULL : USS( 
usLanguage ),
   XML_sz, IS( nSize ),
+  XML_spc, nCharKerning  0 ? IS(nCharKerning) : NULL,
   XML_strike, strikeout,
   XML_u, underline,
   XML_baseline, nCharEscapement == 0 ? NULL : IS( 
nCharEscapement*1000 ),
diff --git a/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx 
b/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx
new file mode 100644
index 000..64b6856
Binary files /dev/null and b/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index cd3e07b..4494755 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -139,6 +139,7 @@ public:
 void testSheetLocalRangeNameXLS();
 void testSheetTextBoxHyperlink();
 void testFontSize();
+void testSheetCharacterKerningSpace();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -188,6 +189,7 @@ public:
 CPPUNIT_TEST(testSheetLocalRangeNameXLS);
 CPPUNIT_TEST(testSheetTextBoxHyperlink);
 CPPUNIT_TEST(testFontSize);
+CPPUNIT_TEST(testSheetCharacterKerningSpace);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2551,6 +2553,27 @@ void ScExportTest::testFontSize()
 CPPUNIT_ASSERT_EQUAL(OUString(1800), fontSize);
 }
 
+void ScExportTest::testSheetCharacterKerningSpace()
+{
+ScDocShellRef xShell = loadDoc(textbox-CharKerningSpace., XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+ScDocShellRef xDocSh = saveAndReload((*xShell), XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+OUString CharKerningSpace = getXPath(pDoc,
+
/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1],spc);
+
+// make sure that the CharKerning is 1997.
+CPPUNIT_ASSERT_EQUAL(OUString(1997), CharKerningSpace);
+
+xDocSh-DoClose();
+}
+
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2015-04-29 Thread PriyankaGaikwad
 oox/source/export/drawingml.cxx   |2 +-
 sc/qa/unit/data/xlsx/fontSize.xlsx|binary
 sc/qa/unit/subsequent_export-test.cxx |   15 +++
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 0d341d28f73603670e3b8c639c583229d3c723a6
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Tue Apr 28 18:09:50 2015 +0530

tdf#90908 : FILESAVE: XLSX wrong export of font size 18

After roundtrip is font size changed from 18 to 11

Current behavior:
The 'sz' tag was not exported
Expected behaviour:
After RT 'sz' tag should export with value 18

XML Difference :
Original
 a:rPr lang=en-IN sz=1800 b=1 i=1 u=sng/
Roundtrip
 a:rPr b=1 i=1 lang=en-IN strike=noStrike u=sng

Change-Id: I7955f89a8db9c18c11546f4c60aa130a0be14bb5
Reviewed-on: https://gerrit.libreoffice.org/15565
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 4f0621d..e8673d2d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1322,7 +1322,7 @@ void DrawingML::WriteRunProperties( Reference 
XPropertySet  rRun, bool bIsFiel
   XML_b, bold,
   XML_i, italic,
   XML_lang, usLanguage.isEmpty() ? NULL : USS( 
usLanguage ),
-  XML_sz, nSize == 1800 ? NULL : IS( nSize ),
+  XML_sz, IS( nSize ),
   XML_strike, strikeout,
   XML_u, underline,
   XML_baseline, nCharEscapement == 0 ? NULL : IS( 
nCharEscapement*1000 ),
diff --git a/sc/qa/unit/data/xlsx/fontSize.xlsx 
b/sc/qa/unit/data/xlsx/fontSize.xlsx
new file mode 100644
index 000..8811df7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/fontSize.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ecf39bd..cd3e07b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -138,6 +138,7 @@ public:
 void testSupBookVirtualPath();
 void testSheetLocalRangeNameXLS();
 void testSheetTextBoxHyperlink();
+void testFontSize();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -186,6 +187,7 @@ public:
 CPPUNIT_TEST(testImageWithSpecialID);
 CPPUNIT_TEST(testSheetLocalRangeNameXLS);
 CPPUNIT_TEST(testSheetTextBoxHyperlink);
+CPPUNIT_TEST(testFontSize);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2536,6 +2538,19 @@ void ScExportTest::testSheetTextBoxHyperlink()
 xDocSh-DoClose();
 }
 
+void ScExportTest::testFontSize()
+{
+ScDocShellRef xDocSh = loadDoc(fontSize., XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+OUString fontSize = getXPath(pDoc,
+
/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr, sz);
+// make sure that the font size is 18
+CPPUNIT_ASSERT_EQUAL(OUString(1800), fontSize);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/qa

2015-04-28 Thread yogesh . bharate001
 oox/source/export/shapes.cxx|   18 +-
 sc/qa/unit/data/xlsx/textbox-hyperlink.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx   |   21 -
 3 files changed, 37 insertions(+), 2 deletions(-)

New commits:
commit a7d843b6112250d1a41c2a56d8e083ccf6538bca
Author: yogesh.bharate001 yogesh.bhar...@synerzip.com
Date:   Mon Apr 27 19:28:54 2015 +0530

tdf#90890: hyperlink inside textbox is not exported after roundtrip.

Problem Description:
- Text box hyperlink is not exported after roundtrip.

XML Difference: in drawing1.xml
Original file:
xdr:cNvPr id=2 name=TextBox 1
a:hlinkClick 
xmlns:r=http://schemas.openxmlformats.org/officeDocument/2006/relationships; 
r:id=rId1 tooltip=text123/
/xdr:cNvPr

After RT:
xdr:cNvPr id=0 name=CustomShape 1/
a:hlinkClick is missing.

Change-Id: I01082de5d7d2e1a9323e84f54c97d5444cab13cd
Solution: Added support for hyperlink in text box.
Reviewed-on: https://gerrit.libreoffice.org/1
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7caf3e9..349f398 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -419,10 +419,26 @@ ShapeExport ShapeExport::WriteCustomShape( Reference 
XShape  xShape )
 if (GetDocumentType() != DOCUMENT_DOCX)
 {
 pFS-startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
-pFS-singleElementNS( mnXmlNamespace, XML_cNvPr,
+pFS-startElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, I32S( GetNewShapeID( xShape ) ),
 XML_name, IDS( CustomShape ),
 FSEND );
+
+if( GETA( URL ) )
+{
+OUString sURL;
+mAny = sURL;
+if( !sURL.isEmpty() ) {
+OUString sRelId = mpFB-addRelation( 
mpFS-getOutputStream(),
+
http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink;,
+sURL, true );
+
+mpFS-singleElementNS( XML_a, XML_hlinkClick,
+FSNS( XML_r,XML_id ), USS( sRelId ),
+FSEND );
+ }
+}
+pFS-endElementNS(mnXmlNamespace, XML_cNvPr);
 pFS-singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
 WriteNonVisualProperties( xShape );
 pFS-endElementNS( mnXmlNamespace, XML_nvSpPr );
diff --git a/sc/qa/unit/data/xlsx/textbox-hyperlink.xlsx 
b/sc/qa/unit/data/xlsx/textbox-hyperlink.xlsx
new file mode 100644
index 000..bbebca9
Binary files /dev/null and b/sc/qa/unit/data/xlsx/textbox-hyperlink.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index f8b5344..ecf39bd 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -137,6 +137,7 @@ public:
 
 void testSupBookVirtualPath();
 void testSheetLocalRangeNameXLS();
+void testSheetTextBoxHyperlink();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -184,6 +185,7 @@ public:
 CPPUNIT_TEST(testLinkedGraphicRT);
 CPPUNIT_TEST(testImageWithSpecialID);
 CPPUNIT_TEST(testSheetLocalRangeNameXLS);
+CPPUNIT_TEST(testSheetTextBoxHyperlink);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -209,7 +211,8 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr 
pXmlXPathCtx)
 { BAD_CAST(office), 
BAD_CAST(urn:oasis:names:tc:opendocument:xmlns:office:1.0) },
 { BAD_CAST(table), 
BAD_CAST(urn:oasis:names:tc:opendocument:xmlns:table:1.0) },
 { BAD_CAST(text), 
BAD_CAST(urn:oasis:names:tc:opendocument:xmlns:text:1.0) },
-{ BAD_CAST(xlink), BAD_CAST(http://www.w3c.org/1999/xlink;) }
+{ BAD_CAST(xlink), BAD_CAST(http://www.w3c.org/1999/xlink;) },
+{ BAD_CAST(xdr), 
BAD_CAST(http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing;) 
}
 };
 for(size_t i = 0; i  SAL_N_ELEMENTS(aNamespaces); ++i)
 {
@@ -2517,6 +2520,22 @@ void ScExportTest::testSheetLocalRangeNameXLS()
 xDocSh2-DoClose();
 }
 
+void ScExportTest::testSheetTextBoxHyperlink()
+{
+ScDocShellRef xShell = loadDoc(textbox-hyperlink., XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+ScDocShellRef xDocSh = saveAndReload((*xShell), XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport((*xDocSh), m_xSFactory, 
xl/drawings/drawing1.xml, XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+assertXPath(pDoc, 
/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:nvSpPr[1]/xdr:cNvPr[1]/a:hlinkClick[1],
 1);
+
+xDocSh-DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list