Problem with increase maximum height of the footer

2016-06-02 Thread Bartosz Kosiorek
Hello.

I would like to implement, increasing maximum footnote height, to resolve
issue:
https://bugs.documentfoundation.org/show_bug.cgi?id=73977

The footnote height could be set manually and with custom height.
Both are limited in theory by page height, but in practice there is some
magic number which limite footnote height

I found that most of the UI is implemented there:
https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/misc/pgfnote.cxx#n355

But there is nothing about maximum value, except:
 lMaxHeight *= 8;
 lMaxHeight /= 10;

 // set maximum values
 HeightModify(*m_pMaxHeightEdit);

Unfortunately it is only changes maximum UI values which could be set via
Format->Page...->Footnote...->Maximum footnote height.
It it not changing a maximum height of footnote at all.

In
https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/layout/pagechg.cxx#n173
If Height is set to 0 (for automatic footnote height mode), then height is
set to LONG_MAX


SetMaxFootnoteHeight( pPgDsc->GetFootnoteInfo().GetHeight() ?

 pPgDsc->GetFootnoteInfo().GetHeight() : LONG_MAX );


Is that mean that the limitiation of footnote height is set by
LONG_MAX (SwTwips ) type ?

I would like to resolve that issue, but currently I have stuck.
Does anyone knows some more details about that?

Thanks in advance
Bartosz
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-06-08 Thread Bartosz Kosiorek
 sc/source/filter/inc/defnamesbuffer.hxx |4 
 sc/source/filter/inc/workbookhelper.hxx |1 -
 sc/source/filter/oox/workbookhelper.cxx |2 --
 sc/source/filter/xml/xmlexprt.cxx   |2 --
 sc/source/filter/xml/xmlimprt.cxx   |2 --
 5 files changed, 11 deletions(-)

New commits:
commit e044eafc485ef29a68b3a8e0e7c75b372ebb1ac9
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Jun 6 23:26:27 2016 +0200

tdf#48140 Remove unused headers from xlsx import to improve build 
performance

Change-Id: Ie22dc56cceddcb91e946083c6bcf4c041545e75b
Reviewed-on: https://gerrit.libreoffice.org/26001
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/filter/inc/defnamesbuffer.hxx 
b/sc/source/filter/inc/defnamesbuffer.hxx
index b477359..7cf4fba 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -27,10 +27,6 @@
 
 class ScTokenArray;
 
-namespace com { namespace sun { namespace star {
-namespace sheet { class XNamedRange; }
-} } }
-
 namespace oox {
 namespace xls {
 
diff --git a/sc/source/filter/inc/workbookhelper.hxx 
b/sc/source/filter/inc/workbookhelper.hxx
index c314bf5..46d45fd 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -32,7 +32,6 @@ namespace com { namespace sun { namespace star {
 namespace container { class XNameContainer; }
 namespace lang { class XMultiServiceFactory; }
 namespace sheet { class XDatabaseRange; }
-namespace sheet { class XNamedRange; }
 namespace sheet { class XSpreadsheet; }
 namespace sheet { class XSpreadsheetDocument; }
 namespace sheet { struct FormulaToken; }
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index a12491f..346b452 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -25,8 +25,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index a92834e..38b168f 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -139,8 +139,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index ea8bacf..7021f81 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -87,9 +87,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-06-22 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/hidden-empty-rows.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   19 +++
 sc/source/filter/excel/xetable.cxx|   16 +---
 sc/source/filter/inc/xetable.hxx  |2 +-
 4 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 228c25fd17727660a3372307e3f73dbcff5e71d2
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jun 17 16:21:06 2016 +0200

tdf#98106 Preserving hidden and empty rows after xlsx export

Change-Id: I1ff2bab766eadac1dd5d483453af0e760634083d
Reviewed-on: https://gerrit.libreoffice.org/26421
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods
new file mode 100644
index 000..f3435ad
Binary files /dev/null and b/sc/qa/unit/data/ods/hidden-empty-rows.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 1e27fc7..28e518d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,8 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+void testHiddenEmptyRowsXLSX();
+
 void testInlineArrayXLS();
 void testEmbeddedChartXLS();
 void testCellAnchoredGroupXLS();
@@ -191,6 +193,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportODS);
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
+CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
 CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -469,6 +472,22 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testHiddenEmptyRowsXLSX()
+{
+//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to 
.XLSX
+ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", 
"false");
+}
+
 void ScExportTest::testDataBarExportXLSX()
 {
 ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index f539b92..2b9d45a 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1993,15 +1993,14 @@ sal_uInt16 XclExpRow::GetFirstFreeXclCol() const
 
 bool XclExpRow::IsDefaultable() const
 {
-const sal_uInt16 nAllowedFlags = EXC_ROW_DEFAULTFLAGS | EXC_ROW_HIDDEN | 
EXC_ROW_UNSYNCED;
-return !::get_flag( mnFlags, static_cast< sal_uInt16 >( ~nAllowedFlags ) ) 
&& IsEmpty();
+const sal_uInt16 nFlagsAlwaysMarkedAsDefault = EXC_ROW_DEFAULTFLAGS | 
EXC_ROW_UNSYNCED;
+return !::get_flag( mnFlags, static_cast< sal_uInt16 >( 
~nFlagsAlwaysMarkedAsDefault ) ) && IsEmpty();
 }
 
 void XclExpRow::DisableIfDefault( const XclExpDefaultRowData& rDefRowData )
 {
 mbEnabled = !IsDefaultable() ||
 (mnHeight != rDefRowData.mnHeight) ||
-(IsHidden() != rDefRowData.IsHidden()) ||
 (IsUnsynced() != rDefRowData.IsUnsynced());
 }
 
@@ -2172,6 +2171,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 XclExpDefaultRowData aMaxDefData;
 size_t nMaxDefCount = 0;
 // only look for default format in existing rows, if there are more than 
unused
+// if the row is hidden, then row xml must be created even if it not 
contain cells
 XclExpRow* pPrev = nullptr;
 typedef std::vector< XclExpRow* > XclRepeatedRows;
 XclRepeatedRows aRepeated;
@@ -2179,7 +2179,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 for (itr = itrBeg; itr != itrEnd; ++itr)
 {
 const RowRef& rRow = itr->second;
-if (rRow->IsDefaultable())
+if ( rRow->IsDefaultable() )
 {
 XclExpDefaultRowData aDefData( *rRow );
 size_t& rnDefCount = aDefRowMap[ aDefData ];
@@ -2192,7 +2192,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 }
 if ( pPrev )
 {
-if ( 

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

2016-07-12 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/outline.ods   |binary
 sc/qa/unit/subsequent_export-test.cxx |  107 --
 sc/source/filter/excel/xetable.cxx|   10 ++-
 3 files changed, 97 insertions(+), 20 deletions(-)

New commits:
commit b0d96a82a4f6a0832d03d185f4a53db669adcc99
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jul 8 10:08:00 2016 +0200

tdf#51524 Preserve hidden column width after saving into .xlsx and .xls

Change-Id: I7f69a1e8f8ef46d8b0ab889df30498ec54917230
Reviewed-on: https://gerrit.libreoffice.org/27035
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods
index 320e318..ac951b7 100644
Binary files a/sc/qa/unit/data/ods/outline.ods and 
b/sc/qa/unit/data/ods/outline.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 560db4d..3fca217 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -481,7 +481,8 @@ void ScExportTest::testFormatExportODS()
 
 void ScExportTest::testOutlineExportXLSX()
 {
-//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are 
lost
+//tdf#100347 FILESAVE FILEOPEN after exporting to .xlsx format grouping 
are lost
+//tdf#51524  FILESAVE .xlsx and.xls looses width information for 
hidden/collapsed grouped columns
 ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS);
 CPPUNIT_ASSERT(xShell.Is());
 
@@ -489,71 +490,143 @@ void ScExportTest::testOutlineExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
+// First XML node, creates two columns (from min=1 to max=2)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2");
+
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "3");
+
+// Column 4 has custom width and it is hidden. We need to make sure that 
it is created
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "4");
+
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "3");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "5");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "6");
+
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "4");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "false");
-ass

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

2016-08-07 Thread Bartosz Kosiorek
 sc/source/filter/excel/xetable.cxx |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 12408dad1b2af4055b91439e3cfbe46e0df52b41
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Aug 7 13:58:21 2016 +0200

tdf#101363 Fix precision of column width according to MS specification

In MS specification the output value is set with double precision after 
delimiter, according to formula:
 =Truncate(({width in pixels} - 5)/{Maximum Digit Width} * 100 + 0.5)/100

Explanation of magic numbers:
 - 5 number - are 4 pixels of margin padding (two on each side), plus 1 
pixel padding for the gridlines. It is still unknown if it should be applied 
during LibreOffice export
 - 100 number - used to limit precision to 0.01 with formula =Truncate( 
{value} * 100 ) / 100
 - 0.5 number (0.005 to output value) - used to increase value before 
truncating, to avoid situation when 2.997 will be truncated to 2.99 and not to 3

Benefits of limited precision:
- small .xlsx file size
- slightly better performance during .xlsx import
- easier to track column width changes, especially in unit tests
- according to MS Excel specification

Change-Id: I0537df5f9d04f5c715784c2b0c4e0d4472904dcc
Reviewed-on: https://gerrit.libreoffice.org/27932
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 81edb36..9cc6552 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1665,17 +1665,28 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
 if( nLastXclCol == static_cast< sal_uInt16 >( 
rStrm.GetRoot().GetMaxPos().Col() ) )
 ++nLastXclCol;
 
+const double nExcelColumnWidth = mnScWidth  / static_cast< double >( 
sc::TwipsToHMM( GetCharWidth() ) );
+
+// tdf#101363 In MS specification the output value is set with double 
precision after delimiter:
+// =Truncate(({width in pixels} - 5)/{Maximum Digit Width} * 100 + 0.5)/100
+// Explanation of magic numbers:
+// 5 number - are 4 pixels of margin padding (two on each side), plus 1 
pixel padding for the gridlines.
+//It is unknown if it should be applied during LibreOffice 
export
+// 100 number - used to limit precision to 0.01 with formula =Truncate( 
{value}*100+0.5 ) / 100
+// 0.5 number (0.005 to output value) - used to increase value before 
truncating,
+//to avoid situation when 2.997 will be truncated to 2.99 and 
not to 3.00
+const double nTruncatedExcelColumnWidth = std::trunc( nExcelColumnWidth * 
100.0 + 0.5 ) / 100.0;
 rStrm.GetCurrentStream()->singleElement( XML_col,
 // OOXTODO: XML_bestFit,
 XML_collapsed,  XclXmlUtils::ToPsz( ::get_flag( mnFlags, 
EXC_COLINFO_COLLAPSED ) ),
 XML_customWidth,XclXmlUtils::ToPsz( mbCustomWidth ),
 XML_hidden, XclXmlUtils::ToPsz( ::get_flag( mnFlags, 
EXC_COLINFO_HIDDEN ) ),
 XML_outlineLevel,   OString::number( mnOutlineLevel ).getStr(),
-XML_max,OString::number( (nLastXclCol + 1) ).getStr(),
-XML_min,OString::number( (mnFirstXclCol + 1) 
).getStr(),
+XML_max,OString::number( nLastXclCol + 1 ).getStr(),
+XML_min,OString::number( mnFirstXclCol + 1 ).getStr(),
 // OOXTODO: XML_phonetic,
 XML_style,  lcl_GetStyleId( rStrm, maXFId.mnXFIndex 
).getStr(),
-XML_width,  OString::number( (double) (mnScWidth / 
(double)sc::TwipsToHMM( GetCharWidth() )) ).getStr(),
+XML_width,  OString::number( nTruncatedExcelColumnWidth 
).getStr(),
 FSEND );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-07-03 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/hidden-empty-rows.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   17 +
 sc/source/filter/excel/xepage.cxx |5 -
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 46094ff4b0ea06931f2af3fc45d00fd38c3ebf26
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jul 2 03:29:26 2016 +0200

tdf#48767 Fix orientation issue after export to .xlsx

After save to .xlsx in usePrinterDefaults was added into PageSetup.
Due to bug in MS Excel, when usePrinterDefaults is present,
(no matter what value), the orientation of the Page is alway "portrait".
To resolve that issue, if usePrinterDefaults is set to default value,
then usePrinterDefaults XML field is not added during export to .xlsx

Change-Id: I3ab310babb278913bce3d66f7fae1192ed9727b9
Reviewed-on: https://gerrit.libreoffice.org/26871
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods
index f3435ad..1e3017e 100644
Binary files a/sc/qa/unit/data/ods/hidden-empty-rows.ods and 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 131069b..66ddef9 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -111,6 +111,7 @@ public:
 void testFormatExportODS();
 
 void testHiddenEmptyRowsXLSX();
+void testLandscapeOrientationXLSX();
 
 void testInlineArrayXLS();
 void testEmbeddedChartXLS();
@@ -195,6 +196,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
 CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -490,6 +492,21 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", 
"false");
 }
 
+void ScExportTest::testLandscapeOrientationXLSX()
+{
+//tdf#48767 - Landscape page orientation is not loaded from .xlsx format 
with MS Excel, after export with Libre Office
+ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// the usePrinterDefaults cannot be saved to allow opening sheets in 
Landscape mode via MS Excel
+assertXPathNoAttribute(pSheet, "/x:worksheet/x:pageSetup", 
"usePrinterDefaults");
+assertXPath(pSheet, "/x:worksheet/x:pageSetup", "orientation", 
"landscape");
+}
+
 void ScExportTest::testDataBarExportXLSX()
 {
 ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index 2895819..31c17b6 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -102,7 +102,10 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
 pAttrList->add( XML_fitToHeight,OString::number(  
mrData.mnFitToHeight ).getStr() );
 pAttrList->add( XML_pageOrder,  mrData.mbPrintInRows ? 
"overThenDown" : "downThenOver" );
 pAttrList->add( XML_orientation,mrData.mbPortrait ? "portrait" : 
"landscape" );   // OOXTODO: "default"?
-pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( 
!mrData.mbValid ) );
+// tdf#48767 if XML_usePrinterDefaults field is exist, then 
XML_orientation is always "portrait" in MS Excel
+// To resolve that import issue, if XML_usePrinterDefaults has default 
value (false) then XML_usePrinterDefaults is not added.
+if ( !mrData.mbValid )
+pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( 
!mrData.mbValid ) );
 pAttrList->add( XML_blackAndWhite,  XclXmlUtils::ToPsz( 
mrData.mbBlackWhite ) );
 pAttrList->add( XML_draft,  XclXmlUtils::ToPsz( 
mrData.mbDraftQuality ) );
 pAttrList->add( XML_cellComments,   mrData.mbPrintNotes ? "atEnd" : 
"none" ); // OOXTODO: "asDisplayed"?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-07-03 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/outline.ods   |binary
 sc/qa/unit/subsequent_export-test.cxx |   81 ++
 sc/source/filter/excel/xetable.cxx|   18 +--
 sc/source/filter/inc/xetable.hxx  |3 -
 4 files changed, 95 insertions(+), 7 deletions(-)

New commits:
commit cc503abb860c33a54a188640a5962dbdf7052284
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jun 24 02:10:25 2016 +0200

tdf#100347 Fix Outline export into XLSX format

In previous XLSX export implementation the outline
for column was not saved. Also rows without cell content
was not saved if it was collapsed or outline level was set.
This commit resolve all such issues

Change-Id: I401f23e97f4803209fcd31c7d93baca3bd2a2385
Reviewed-on: https://gerrit.libreoffice.org/26625
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods
index bca7d14..320e318 100644
Binary files a/sc/qa/unit/data/ods/outline.ods and 
b/sc/qa/unit/data/ods/outline.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 66ddef9..560db4d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,7 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testLandscapeOrientationXLSX();
 
@@ -195,6 +196,8 @@ public:
 CPPUNIT_TEST(testCellNoteExportODS);
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
+
+CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
@@ -476,6 +479,84 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testOutlineExportXLSX()
+{
+//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are 
lost
+ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "collapsed", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "outlineLevel", "1");
+assertXPath(pShe

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

2017-02-08 Thread Bartosz Kosiorek
 sc/inc/table.hxx   |   13 +++
 sc/source/core/data/table1.cxx |   47 ++---
 sc/source/core/data/table3.cxx |   14 ++--
 sc/source/core/data/table6.cxx |6 ++---
 4 files changed, 49 insertions(+), 31 deletions(-)

New commits:
commit b78c6d8efd9531243e62a388bffc3f071d9a56eb
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Jan 16 22:57:51 2017 +0100

tdf#50916 Introduce new column validation function

Change-Id: Ib8f7b3793732a113e764c4345c07803eb8bcbc3f
Reviewed-on: https://gerrit.libreoffice.org/33196
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 34f6e3f..3d446ad 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -265,6 +265,19 @@ public:
 boolIsStreamValid() const{ return 
bStreamValid; }
 voidSetStreamValid( bool bSet, bool bIgnoreLock = false );
 
+SAL_WARN_UNUSED_RESULT inline bool IsColValid( SCCOL nScCol ) const
+{
+return nScCol >= static_cast< SCCOL >( 0 ) && nScCol < aCol.size();
+}
+SAL_WARN_UNUSED_RESULT inline bool IsColRowValid( SCCOL nScCol, SCROW 
nScRow ) const
+{
+return IsColValid( nScCol ) && ValidRow( nScRow );
+}
+SAL_WARN_UNUSED_RESULT inline bool IsColRowTabValid( SCCOL nScCol, SCROW 
nScRow, SCTAB nScTab ) const
+{
+return IsColValid( nScCol ) && ValidRow( nScRow ) && ValidTab( nScTab 
);
+}
+
 boolIsPendingRowHeights() const  { return 
bPendingRowHeights; }
 voidSetPendingRowHeights( bool bSet );
 
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 289266b..bb899e5 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -328,7 +328,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const 
OUString& rNewName,
 }
 }
 
-for (SCCOL k=0; k<=MAXCOL; k++)
+for (SCCOL k=0; k < aCol.size(); k++)
 aCol[k].Init( k, nTab, pDocument, true );
 }
 
@@ -1039,13 +1039,10 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, 
SCCOL& rStartCol, SCROW& rS
 
 SCROW ScTable::GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const
 {
-if (!ValidCol(nCol1) || !ValidCol(nCol2))
+if ( !IsColValid( nCol1 ) || !ValidCol( nCol2 ) )
 return -1;
 
-if ( nCol1 >= aCol.size() )
-return -1;
-
-nCol2 = std::min( nCol2, aCol.size()-1 );
+nCol2 = std::min( nCol2, aCol.size() - 1 );
 
 SCROW nNewLastRow = 0;
 for (SCCOL i = nCol1; i <= nCol2; ++i)
@@ -1778,7 +1775,7 @@ void ScTable::SetTabNo(SCTAB nNewTab)
 void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2,
sc::UpdatedRangeNames& rIndexes) const
 {
-for (SCCOL i = nCol1; i <= nCol2 && ValidCol(i); i++)
+for (SCCOL i = nCol1; i <= nCol2 && IsColValid( i ); i++)
 aCol[i].FindRangeNamesInUse(nRow1, nRow2, rIndexes);
 }
 
@@ -2178,7 +2175,7 @@ sal_uLong ScTable::AddCondFormat( ScConditionalFormat* 
pNew )
 
 SvtScriptType ScTable::GetScriptType( SCCOL nCol, SCROW nRow ) const
 {
-if (!ValidCol(nCol))
+if ( !IsColValid( nCol ) )
 return SvtScriptType::NONE;
 
 return aCol[nCol].GetScriptType(nRow);
@@ -2195,7 +2192,7 @@ void ScTable::SetScriptType( SCCOL nCol, SCROW nRow, 
SvtScriptType nType )
 SvtScriptType ScTable::GetRangeScriptType(
 sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 )
 {
-if (!ValidCol(nCol))
+if ( !IsColValid( nCol ) )
 return SvtScriptType::NONE;
 
 sc::CellStoreType::iterator itr = aCol[nCol].maCells.begin();
@@ -2204,7 +2201,7 @@ SvtScriptType ScTable::GetRangeScriptType(
 
 size_t ScTable::GetFormulaHash( SCCOL nCol, SCROW nRow ) const
 {
-if (!ValidCol(nCol))
+if ( !IsColValid( nCol ) )
 return 0;
 
 return aCol[nCol].GetFormulaHash(nRow);
@@ -2212,7 +2209,7 @@ size_t ScTable::GetFormulaHash( SCCOL nCol, SCROW nRow ) 
const
 
 ScFormulaVectorState ScTable::GetFormulaVectorState( SCCOL nCol, SCROW nRow ) 
const
 {
-if (!ValidCol(nCol))
+if ( !IsColValid( nCol ) )
 return FormulaVectorUnknown;
 
 return aCol[nCol].GetFormulaVectorState(nRow);
@@ -2220,9 +2217,11 @@ ScFormulaVectorState ScTable::GetFormulaVectorState( 
SCCOL nCol, SCROW nRow ) co
 
 formula::FormulaTokenRef ScTable::ResolveStaticReference( SCCOL nCol, SCROW 
nRow )
 {
-if (!ValidCol(nCol) || !ValidRow(nRow))
+if ( !ValidCol( nCol ) || !ValidRow( nRow ) )
 return formula::FormulaTokenRef();
-
+if ( nCol >= aCol.size() )
+// Return a value of 0.0 if column not exists
+return formula::FormulaTokenRef(new formula::FormulaDoubleToken

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

2017-02-08 Thread Bartosz Kosiorek
 sc/source/core/data/table1.cxx |   16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 0e0fef10002b46965edad02b3f460a502d9f6595
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jan 28 15:18:08 2017 +0100

tdf#50916 Allow proper updating, deleting and inserting tabs

Change-Id: Ib318c3ff14970483fdcda1fdd6de9969f47ccbe8
Reviewed-on: https://gerrit.libreoffice.org/33647
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index bb899e5..1869808 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1692,7 +1692,7 @@ void ScTable::UpdateInsertTab( 
sc::RefUpdateInsertTabContext& rCxt )
 ScRange( 0, 0, rCxt.mnInsertPos, MAXCOL, MAXROW, MAXTAB),
 0, 0, rCxt.mnSheets);
 
-for (SCCOL i=0; i <= MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].UpdateInsertTab(rCxt);
 
 if (IsStreamValid())
@@ -1722,7 +1722,7 @@ void ScTable::UpdateDeleteTab( 
sc::RefUpdateDeleteTabContext& rCxt )
 ScRange( 0, 0, rCxt.mnDeletePos, MAXCOL, MAXROW, MAXTAB),
 0, 0, -rCxt.mnSheets);
 
-for (SCCOL i = 0; i <= MAXCOL; ++i)
+for (SCCOL i = 0; i < aCol.size(); ++i)
 aCol[i].UpdateDeleteTab(rCxt);
 
 if (IsStreamValid())
@@ -1747,7 +1747,7 @@ void ScTable::UpdateMoveTab(
 ScRange( 0, 0, rCxt.mnOldPos, MAXCOL, MAXROW, MAXTAB),
 0, 0, rCxt.mnNewPos - rCxt.mnOldPos);
 
-for ( SCCOL i=0; i <= MAXCOL; i++ )
+for ( SCCOL i=0; i < aCol.size(); i++ )
 {
 aCol[i].UpdateMoveTab(rCxt, nTabNo);
 if (pProgress)
@@ -1760,7 +1760,7 @@ void ScTable::UpdateMoveTab(
 
 void ScTable::UpdateCompile( bool bForceIfNameInUse )
 {
-for (SCCOL i=0; i <= MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 {
 aCol[i].UpdateCompile( bForceIfNameInUse );
 }
@@ -1769,7 +1769,8 @@ void ScTable::UpdateCompile( bool bForceIfNameInUse )
 void ScTable::SetTabNo(SCTAB nNewTab)
 {
 nTab = nNewTab;
-for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].SetTabNo(nNewTab);
+for (SCCOL i=0; i < aCol.size(); i++)
+aCol[i].SetTabNo(nNewTab);
 }
 
 void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2,
@@ -1809,6 +1810,11 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
 // These columns are visible.  Check for empty columns.
 for (SCCOL j = i; j <= nLastCol; ++j)
 {
+if ( j >= aCol.size() )
+{
+aSkipCols.setTrue( j, MAXCOL );
+break;
+}
 if (aCol[j].GetCellCount() == 0)
 // empty
 aSkipCols.setTrue(j,j);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-24 Thread Bartosz Kosiorek
 sc/inc/colcontainer.hxx  |2 ++
 sc/inc/table.hxx |   17 -
 sc/source/core/data/colcontainer.cxx |   10 +-
 sc/source/core/data/table2.cxx   |   35 +--
 4 files changed, 56 insertions(+), 8 deletions(-)

New commits:
commit a1b1ed766d1110acf843b807d554f9375963234c
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Jan 31 00:25:12 2017 +0100

tdf#50916 Allow dynamically increase number of columns according to needs

Change-Id: I08b1d70b6aafb01738bb5dec3f4eafd7b21e6bb5
Reviewed-on: https://gerrit.libreoffice.org/33724
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/inc/colcontainer.hxx b/sc/inc/colcontainer.hxx
index c3e0398..925104d 100644
--- a/sc/inc/colcontainer.hxx
+++ b/sc/inc/colcontainer.hxx
@@ -55,6 +55,8 @@ public:
 return static_cast( aCols.size() );
 }
 
+void resize( const size_t aNewSize );
+
 void Clear();
 
 const ScColumn& back() const
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 3d446ad..5f8711c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -241,6 +241,21 @@ public:
 
 ScOutlineTable* GetOutlineTable()   { return pOutlineTable; }
 
+ScColumn& CreateColumnIfNotExists( SCCOL nScCol )
+{
+if ( nScCol >= aCol.size() )
+{
+SCCOL aOldColSize = aCol.size();
+bool bUseEmptyAttrArray = false;
+if ( aOldColSize == 0 )
+bUseEmptyAttrArray = true;
+aCol.resize( static_cast< size_t >( nScCol + 1 ) );
+for (SCCOL i = aOldColSize; i <= nScCol; i++)
+aCol[i].Init( i, nTab, pDocument, bUseEmptyAttrArray );
+
+}
+return aCol[nScCol];
+}
 sal_uLong   GetCellCount() const;
 sal_uLong   GetWeightedCount() const;
 sal_uLong   GetCodeCount() const;   // RPN code in formula
@@ -544,7 +559,7 @@ public:
 
 FormulaErrorGetErrCode( const ScAddress& rPos ) const
 {
-return ValidColRow(rPos.Col(),rPos.Row()) ?
+return IsColRowValid(rPos.Col(),rPos.Row()) ?
 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
 FormulaError::NONE;
 }
diff --git a/sc/source/core/data/colcontainer.cxx 
b/sc/source/core/data/colcontainer.cxx
index 7433240..fa2a18f 100644
--- a/sc/source/core/data/colcontainer.cxx
+++ b/sc/source/core/data/colcontainer.cxx
@@ -35,7 +35,6 @@ ScColContainer::~ScColContainer()
 Clear();
 }
 
-
 void ScColContainer::Clear()
 {
 SCCOL nSize = size();
@@ -46,4 +45,13 @@ void ScColContainer::Clear()
 }
 aCols.clear();
 }
+
+void ScColContainer::resize( const size_t aNewColSize )
+{
+size_t aOldColSize = aCols.size();
+aCols.resize( aNewColSize );
+for ( size_t nCol = aOldColSize; nCol < aNewColSize; ++nCol )
+aCols[nCol] = new ScColumn;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d740767..f1f03f8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2509,7 +2509,8 @@ void ScTable::RemoveCondFormatData( const ScRangeList& 
rRange, sal_uInt32 nIndex
 void ScTable::ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet* rStyle )
 {
 if (ValidColRow(nCol,nRow))
-aCol[nCol].ApplyStyle( nRow, rStyle );
+// If column not exists then we need to create it
+CreateColumnIfNotExists( nCol ).ApplyStyle( nRow, rStyle );
 }
 
 void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, 
SCROW nEndRow, const ScStyleSheet& rStyle )
@@ -2518,8 +2519,28 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, S
 {
 PutInOrder(nStartCol, nEndCol);
 PutInOrder(nStartRow, nEndRow);
-for (SCCOL i = nStartCol; i <= nEndCol; i++)
-aCol[i].ApplyStyleArea(nStartRow, nEndRow, rStyle);
+if ( nEndCol == MAXCOL )
+{
+if ( nStartCol < aCol.size() )
+{
+// If we would like set all columns to specific style, then 
change only default style for not existing columns
+nEndCol = aCol.size() - 1;
+for (SCCOL i = nStartCol; i <= nEndCol; i++)
+aCol[i].ApplyStyleArea(nStartRow, nEndRow, rStyle);
+aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, 
const_cast<ScStyleSheet*>(  ) );
+}
+else
+{
+CreateColumnIfNotExists( nStartCol - 1 );
+aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, 
const_cast<ScStyleSheet*>(  ) );
+}
+}
+else
+

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

2017-01-15 Thread Bartosz Kosiorek
 sc/source/core/data/document.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 4f6d6d905ffe4e9962ea858d415273df4f5829fd
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jan 14 00:03:25 2017 +0100

tdf#50916 Make sure that we don't access aCol out of range

Change-Id: Ib41b474c6ae573ca68614aeff8ca2cda5fd52dbc
Reviewed-on: https://gerrit.libreoffice.org/33061
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index da23524..f486e28 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6420,11 +6420,16 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) 
const
 
 bool ScDocument::HasTabNotes(SCTAB nTab) const
 {
-bool hasNotes = false;
-for (SCCOL nCol=0; nColaCol.size(); nCol < nColSize; ++nCol)
+if ( HasColNotes(nCol, nTab) )
+return true;
+
+return false;
 }
 
 bool ScDocument::HasNotes() const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-19 Thread Bartosz Kosiorek
 sc/source/core/data/table2.cxx |   30 ++
 sc/source/core/data/table5.cxx |4 +++-
 2 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit e15fd1371567fd4b78dab37d843562ff676c52b8
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Jan 19 07:09:38 2017 +0100

tdf#50916 Allow ScTable work on dynamic ScColContainer

Change-Id: Ic39361383a3c2e869e48bccb4c47fc6bca1cb4ce
Reviewed-on: https://gerrit.libreoffice.org/33296
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c98f974..d740767 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -313,13 +313,13 @@ void ScTable::InsertCol(
 if ((nStartRow == 0) && (nEndRow == MAXROW))
 {
 for (SCSIZE i=0; i < nSize; i++)
-for (SCCOL nCol = MAXCOL; nCol > nStartCol; nCol--)
+for (SCCOL nCol = aCol.size() - 1; nCol > nStartCol; nCol--)
 aCol[nCol].SwapCol(aCol[nCol-1]);
 }
 else
 {
-for (SCSIZE i=0; static_cast(i+nSize)+nStartCol <= MAXCOL; i++)
-aCol[MAXCOL - nSize - i].MoveTo(nStartRow, nEndRow, aCol[MAXCOL - 
i]);
+for (SCSIZE i=0; static_cast(i+nSize)+nStartCol < aCol.size(); 
i++)
+aCol[aCol.size() - 1 - nSize - i].MoveTo(nStartRow, nEndRow, 
aCol[aCol.size() - 1 - i]);
 }
 
 std::vector aRegroupCols;
@@ -400,12 +400,12 @@ void ScTable::DeleteCol(
 if ((nStartRow == 0) && (nEndRow == MAXROW))
 {
 for (SCSIZE i=0; i < nSize; i++)
-for (SCCOL nCol = nStartCol; nCol < MAXCOL; nCol++)
+for (SCCOL nCol = nStartCol; nCol < aCol.size() - 1; nCol++)
 aCol[nCol].SwapCol(aCol[nCol+1]);
 }
 else
 {
-for (SCSIZE i=0; static_cast(i+nSize)+nStartCol <= MAXCOL; i++)
+for (SCSIZE i=0; static_cast(i+nSize)+nStartCol < aCol.size(); 
i++)
 aCol[nStartCol + nSize + i].MoveTo(nStartRow, nEndRow, 
aCol[nStartCol + i]);
 }
 
@@ -425,7 +425,7 @@ void ScTable::DeleteArea(
 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, InsertDeleteFlags 
nDelFlag,
 bool bBroadcast, sc::ColumnSpanSet* pBroadcastSpans )
 {
-if (nCol2 > MAXCOL) nCol2 = MAXCOL;
+if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
 if (nRow2 > MAXROW) nRow2 = MAXROW;
 if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
 {
@@ -458,7 +458,7 @@ void ScTable::DeleteSelection( InsertDeleteFlags nDelFlag, 
const ScMarkData& rMa
 {
 {   // scope for bulk broadcast
 ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), 
SfxHintId::ScDataChanged);
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].DeleteSelection(nDelFlag, rMark, bBroadcast);
 }
 
@@ -648,9 +648,8 @@ void ScTable::CopyFromClip(
 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2,
 SCsCOL nDx, SCsROW nDy, ScTable* pTable )
 {
-
-if (nCol2 > MAXCOL)
-nCol2 = MAXCOL;
+if (nCol2 > aCol.size() - 1)
+nCol2 = aCol.size() - 1;
 if (nRow2 > MAXROW)
 nRow2 = MAXROW;
 
@@ -1068,6 +1067,7 @@ void ScTable::DetachFormulaCells(
 void ScTable::SetDirtyFromClip(
 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& 
rBroadcastSpans )
 {
+if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
 if (nCol2 > MAXCOL) nCol2 = MAXCOL;
 if (nRow2 > MAXROW) nRow2 = MAXROW;
 if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
@@ -1079,6 +1079,7 @@ void ScTable::StartListeningFormulaCells(
 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt,
 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
 {
+if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
 if (nCol2 > MAXCOL) nCol2 = MAXCOL;
 if (nRow2 > MAXROW) nRow2 = MAXROW;
 if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
@@ -1591,7 +1592,7 @@ void ScTable::ForgetNoteCaptions( SCCOL nCol1, SCROW 
nRow1, SCCOL nCol2, SCROW n
 {
 if (!ValidCol(nCol1) || !ValidCol(nCol2))
 return;
-
+if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
 for (SCCOL i = nCol1; i <= nCol2; ++i)
 aCol[i].ForgetNoteCaptions(nRow1, nRow2, bPreserveData);
 }
@@ -1916,6 +1917,11 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL 
nCol, SCROW nStartRow, S
 
 bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, 
HasAttrFlags nMask ) const
 {
+if ( nCol1 >= aCol.size() )
+ return false;
+if ( nCol2 >= aCol.size() )
+ nCol2 = aCol.size() - 1; // Rows above range, doesn't contains flags
+
 boo

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

2016-08-18 Thread Bartosz Kosiorek
 sc/qa/unit/data/xlsx/xf_default_values.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx   |   26 +-
 sc/source/filter/oox/stylesbuffer.cxx   |   17 -
 3 files changed, 41 insertions(+), 2 deletions(-)

New commits:
commit 9b9bcef5ef1858c63c8708bfae2ecea3d398eeb8
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Aug 12 10:51:11 2016 +0200

tdf#70565 Set correct default values to "0" of xfId attribute

When xfId is not exist during .xlsx import
it must have values set to "0".
It is not impacts spreadsheets created with MS Excel,
as xfId attribute is always created during export to .xlsx
Not setting "0" value is causing wrong .xlsx import by LibreOffice,
for spreadsheets created by external applications (ex. SAP BI).

Change-Id: Ia4986236d5e902d0ff6f7a7a8da8f142b2c5061f
Reviewed-on: https://gerrit.libreoffice.org/28069
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/qa/unit/data/xlsx/xf_default_values.xlsx 
b/sc/qa/unit/data/xlsx/xf_default_values.xlsx
new file mode 100644
index 000..79aaea7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/xf_default_values.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 8cbb1fa..848fbb8 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -107,6 +107,7 @@ public:
 void testFormatExportODS();
 
 void testCustomColumnWidthExportXLSX();
+void testXfDefaultValuesXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testLandscapeOrientationXLSX();
@@ -193,6 +194,7 @@ public:
 CPPUNIT_TEST(testFormatExportODS);
 
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
+CPPUNIT_TEST(testXfDefaultValuesXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
@@ -471,7 +473,6 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
-
 void ScExportTest::testCustomColumnWidthExportXLSX()
 {
 //tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last 
saved by LO
@@ -564,6 +565,29 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customHeight", 
"false");
 }
 
+void ScExportTest::testXfDefaultValuesXLSX()
+{
+//tdf#70565 FORMATTING: User Defined Custom Formatting is not applied 
during importing XLSX documents
+ScDocShellRef xShell = loadDoc("xf_default_values.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// cellStyleXfs don't need xfId, so we need to make sure it is not saved
+assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]", 
"xfId");
+
+// Because numFmtId fontId fillId borderId xfId are not existing during 
import
+// it should be created during export, with values set to "0"
+assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]", "xfId", "0");
+assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]", "xfId", "0");
+assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]", "xfId", "0");
+assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]", "xfId", "0");
+
+// We expected that exactly 15 cellXfs:xf Nodes will be produced
+assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf", 14);
+}
 
 void ScExportTest::testOutlineExportXLSX()
 {
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 456e2a5..f6c765f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1982,12 +1982,27 @@ Xf::Xf( const WorkbookHelper& rHelper ) :
 void Xf::importXf( const AttributeList& rAttribs, bool bCellXf )
 {
 maModel.mbCellXf = bCellXf;
-maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
+// tdf#70565 Set proper default value to "0" of xfId attribute
+// When xfId is not exist during .xlsx import
+// it must have values set to "0".
+// Is is not impacts spreadsheets created with MS Excel,
+// as xfId attribute is always created during export to .xlsx
+// Not setting "0" value is causing wrong .xlsx import by LibreOffice,
+// for spreadsheets created by external applications (ex. SAP BI).
+if ( maModel.mbCellXf )
+{
+maModel.mnStyleXfId = rAttrib

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

2017-02-27 Thread Bartosz Kosiorek
 sc/source/filter/xml/xmlexprt.cxx |   42 --
 sc/source/filter/xml/xmlexprt.hxx |9 +++-
 2 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit b51bc85cd2ded95668cfcacdb8a2a4a388fe51f4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Feb 28 00:43:33 2017 +0100

tdf#48140 Replace CellRangeAddress with ScRange

Change-Id: I5aa1dabf938e1567d386fceb153e2986862f70a6
Reviewed-on: https://gerrit.libreoffice.org/34707
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 01e88a3..1108371 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -787,7 +787,7 @@ void ScXMLExport::CloseHeaderColumn()
 EndElement(XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, true);
 }
 
-void ScXMLExport::ExportColumns(const sal_Int32 nTable, const 
table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader)
+void ScXMLExport::ExportColumns(const sal_Int32 nTable, const ScRange& 
aColumnHeaderRange, const bool bHasColumnHeader)
 {
 sal_Int32 nColsRepeated (1);
 sal_Int32 nIndex;
@@ -803,7 +803,7 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, 
const table::CellRangeAd
 bool bIsVisible(true);
 nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumn, bIsVisible);
 
-const bool bIsHeader = bHasColumnHeader && 
(aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= 
aColumnHeaderRange.EndColumn);
+const bool bIsHeader = bHasColumnHeader && 
(aColumnHeaderRange.aStart.Col() <= nColumn) && (nColumn <= 
aColumnHeaderRange.aEnd.Col());
 if (bIsHeader != bWasHeader)
 {
 if (bIsHeader)
@@ -1394,13 +1394,13 @@ void ScXMLExport::OpenNewRow(
 if (bHasRowHeader && bRowHeaderOpen)
 OpenHeaderRows();
 }
-if (bHasRowHeader && !bRowHeaderOpen && nStartRow >= 
aRowHeaderRange.StartRow && nStartRow <= aRowHeaderRange.EndRow)
+if (bHasRowHeader && !bRowHeaderOpen && nStartRow >= 
aRowHeaderRange.aStart.Row() && nStartRow <= aRowHeaderRange.aEnd.Row())
 {
-if (nStartRow == aRowHeaderRange.StartRow)
+if (nStartRow == aRowHeaderRange.aStart.Row())
 OpenHeaderRows();
 sal_Int32 nEquals;
-if (aRowHeaderRange.EndRow < nStartRow + nEqualRows - 1)
-nEquals = aRowHeaderRange.EndRow - nStartRow + 1;
+if (aRowHeaderRange.aEnd.Row() < nStartRow + nEqualRows - 1)
+nEquals = aRowHeaderRange.aEnd.Row() - nStartRow + 1;
 else
 nEquals = nEqualRows;
 WriteRowStartTag(nIndex, nEquals, bHidden, bFiltered);
@@ -1471,7 +1471,7 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const 
sal_Int32 nStartRow, con
 bFiltered = rRowAttr.rowFiltered(nTable, nRow, 
nEndRowFiltered);
 }
 if (nIndex == nPrevIndex && bHidden == bPrevHidden && 
bFiltered == bPrevFiltered &&
-!(bHasRowHeader && ((nRow == aRowHeaderRange.StartRow) || 
(nRow - 1 == aRowHeaderRange.EndRow))) &&
+!(bHasRowHeader && ((nRow == aRowHeaderRange.aStart.Row()) 
|| (nRow - 1 == aRowHeaderRange.aEnd.Row( &&
 !(pGroupRows->IsGroupStart(nRow)) &&
 !(pGroupRows->IsGroupEnd(nRow - 1)))
 ++nEqualRows;
@@ -1517,7 +1517,7 @@ void ScXMLExport::CloseRow(const sal_Int32 nRow)
 if (nOpenRow > -1)
 {
 EndElement(sElemRow, true);
-if (bHasRowHeader && nRow == aRowHeaderRange.EndRow)
+if (bHasRowHeader && nRow == aRowHeaderRange.aEnd.Row())
 {
 CloseHeaderRows();
 bRowHeaderOpen = false;
@@ -1615,8 +1615,8 @@ void ScXMLExport::ExportFormatRanges(const sal_Int32 
nStartCol, const sal_Int32
 }
 }
 
-void ScXMLExport::GetColumnRowHeader(bool& rHasColumnHeader, 
table::CellRangeAddress& rColumnHeaderRange,
- bool& rHasRowHeader, 
table::CellRangeAddress& rRowHeaderRange,
+void ScXMLExport::GetColumnRowHeader(bool& rHasColumnHeader, ScRange& 
rColumnHeaderRange,
+ bool& rHasRowHeader, ScRange& 
rRowHeaderRange,
  OUString& rPrintRanges) const
 {
 uno::Reference  xPrintAreas (xCurrentTable, 
uno::UNO_QUERY);
@@ -1624,8 +1624,20 @@ void ScXMLExport::GetColumnRowHeader(bool& 
rHasColumnHeader, table::CellRangeAdd
 {
 rHasRowHeader = xPrintAreas->getPrintTitleRows();
 rHasColumnHead

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

2016-08-18 Thread Bartosz Kosiorek
 sc/source/filter/excel/xepage.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit dd99a9fd72f73c9d7c1b9ac6754f3d17568af81b
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Aug 12 14:27:40 2016 +0200

tdf#48767 Fix orientation issue after export to .xlsx (lo-5-2)

After save to .xlsx in usePrinterDefaults was added into PageSetup.
Due to bug in MS Excel, when usePrinterDefaults is present,
(no matter what value), the orientation of the Page is alway "portrait".
To resolve that issue, if usePrinterDefaults is set to default value,
then usePrinterDefaults XML field is not added during export to .xlsx

Change-Id: Ie165420420fb4bc42048c4ed90413ebf69d4152e
Reviewed-on: https://gerrit.libreoffice.org/28084
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index 2895819..31c17b6 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -102,7 +102,10 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
 pAttrList->add( XML_fitToHeight,OString::number(  
mrData.mnFitToHeight ).getStr() );
 pAttrList->add( XML_pageOrder,  mrData.mbPrintInRows ? 
"overThenDown" : "downThenOver" );
 pAttrList->add( XML_orientation,mrData.mbPortrait ? "portrait" : 
"landscape" );   // OOXTODO: "default"?
-pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( 
!mrData.mbValid ) );
+// tdf#48767 if XML_usePrinterDefaults field is exist, then 
XML_orientation is always "portrait" in MS Excel
+// To resolve that import issue, if XML_usePrinterDefaults has default 
value (false) then XML_usePrinterDefaults is not added.
+if ( !mrData.mbValid )
+pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( 
!mrData.mbValid ) );
 pAttrList->add( XML_blackAndWhite,  XclXmlUtils::ToPsz( 
mrData.mbBlackWhite ) );
 pAttrList->add( XML_draft,  XclXmlUtils::ToPsz( 
mrData.mbDraftQuality ) );
 pAttrList->add( XML_cellComments,   mrData.mbPrintNotes ? "atEnd" : 
"none" ); // OOXTODO: "asDisplayed"?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

2016-08-22 Thread Bartosz Kosiorek
 sc/source/filter/oox/stylesbuffer.cxx |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit fb37ba7df28ee9eb81c1dc21c55baabe56c474b3
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Aug 20 23:11:24 2016 +0200

tdf#70565 Set correct default values to "0" of xfId attribute

When xfId is not exist during .xlsx import
it must have values set to "0".
It is not impacts spreadsheets created with MS Excel,
as xfId attribute is always created during export to .xlsx
Not setting "0" value is causing wrong .xlsx import by LibreOffice,
for spreadsheets created by external applications (ex. SAP BI).

Change-Id: I1fb685f7ad38bcdb6cce78e6cf49e1825330f661
Reviewed-on: https://gerrit.libreoffice.org/28266
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 6b056a0..3f73c09 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2072,7 +2072,21 @@ Xf::Xf( const WorkbookHelper& rHelper ) :
 void Xf::importXf( const AttributeList& rAttribs, bool bCellXf )
 {
 maModel.mbCellXf = bCellXf;
-maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
+// tdf#70565 Set proper default value to "0" of xfId attribute
+// When xfId is not exist during .xlsx import
+// it must have values set to "0".
+// Is is not impacts spreadsheets created with MS Excel,
+// as xfId attribute is always created during export to .xlsx
+// Not setting "0" value is causing wrong .xlsx import by LibreOffice,
+// for spreadsheets created by external applications (ex. SAP BI).
+if ( maModel.mbCellXf )
+{
+maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, 0 );
+}
+else
+{
+maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
+}
 maModel.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
 maModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
 maModel.mnBorderId = rAttribs.getInteger( XML_borderId, -1 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-11 Thread Bartosz Kosiorek
 sc/source/filter/excel/xeview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0637d0f43d3dc5b41a1bbc5726d6a68b7c36a519
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Oct 20 10:50:31 2016 +0200

tdf#101042 Fix for frozen windows in Excel

Window protection is "not allowed to move and resize windows" in MS Excel,
it is definitely not Frozen Panes ( maData.mbFrozenPanes )

Change-Id: I04f0429738a6daecb26274f169c5118dba73e895
Reviewed-on: https://gerrit.libreoffice.org/30076
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/filter/excel/xeview.cxx 
b/sc/source/filter/excel/xeview.cxx
index 09fbbc1..550c9ed 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -414,7 +414,7 @@ void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm 
)
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
 rWorksheet->startElement( XML_sheetViews, FSEND );
 rWorksheet->startElement( XML_sheetView,
-XML_windowProtection,   XclXmlUtils::ToPsz( 
maData.mbFrozenPanes ),
+// OOXTODO: XML_windowProtection,
 XML_showFormulas,   XclXmlUtils::ToPsz( 
maData.mbShowFormulas ),
 XML_showGridLines,  XclXmlUtils::ToPsz( 
maData.mbShowGrid ),
 XML_showRowColHeaders,  XclXmlUtils::ToPsz( 
maData.mbShowHeadings ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

2016-11-11 Thread Bartosz Kosiorek
 sc/source/filter/excel/xeview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a6114042c590ff319e7d1877935e56e6c77bc3ee
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Oct 20 10:50:31 2016 +0200

tdf#101042 Fix for frozen windows in Excel

Window protection is "not allowed to move and resize windows" in MS Excel,
it is definitely not Frozen Panes ( maData.mbFrozenPanes )

Change-Id: I04f0429738a6daecb26274f169c5118dba73e895
Reviewed-on: https://gerrit.libreoffice.org/30076
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit 0637d0f43d3dc5b41a1bbc5726d6a68b7c36a519)
Reviewed-on: https://gerrit.libreoffice.org/30777
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/sc/source/filter/excel/xeview.cxx 
b/sc/source/filter/excel/xeview.cxx
index 09fbbc1..550c9ed 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -414,7 +414,7 @@ void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm 
)
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
 rWorksheet->startElement( XML_sheetViews, FSEND );
 rWorksheet->startElement( XML_sheetView,
-XML_windowProtection,   XclXmlUtils::ToPsz( 
maData.mbFrozenPanes ),
+// OOXTODO: XML_windowProtection,
 XML_showFormulas,   XclXmlUtils::ToPsz( 
maData.mbShowFormulas ),
 XML_showGridLines,  XclXmlUtils::ToPsz( 
maData.mbShowGrid ),
 XML_showRowColHeaders,  XclXmlUtils::ToPsz( 
maData.mbShowHeadings ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-22 Thread Bartosz Kosiorek
 sw/source/uibase/app/apphdl.cxx |7 ---
 sw/source/uibase/app/applab.cxx |1 
 sw/source/uibase/app/docsh2.cxx |1 
 sw/source/uibase/app/swmodule.cxx   |1 
 sw/source/uibase/config/usrpref.cxx |1 
 sw/source/uibase/dbui/dbmgr.cxx |4 -
 sw/source/uibase/dbui/dbtree.cxx|5 --
 sw/source/uibase/dbui/mmconfigitem.cxx  |4 -
 sw/source/uibase/dochdl/swdtflvr.cxx|1 
 sw/source/uibase/fldui/fldmgr.cxx   |2 
 sw/source/uibase/fldui/xfldui.cxx   |2 
 sw/source/uibase/frmdlg/frmmgr.cxx  |1 
 sw/source/uibase/inc/SwXFilterOptions.hxx   |1 
 sw/source/uibase/inc/cption.hxx |7 ---
 sw/source/uibase/inc/glossary.hxx   |7 ---
 sw/source/uibase/inc/labimp.hxx |   44 
 sw/source/uibase/inc/swrenamexnameddlg.hxx  |3 -
 sw/source/uibase/inc/uivwimp.hxx|1 
 sw/source/uibase/inc/unotools.hxx   |2 
 sw/source/uibase/inc/unotxvw.hxx|1 
 sw/source/uibase/inc/wrtsh.hxx  |1 
 sw/source/uibase/index/idxmrk.cxx   |3 -
 sw/source/uibase/lingu/hyp.cxx  |1 
 sw/source/uibase/lingu/olmenu.cxx   |5 --
 sw/source/uibase/lingu/sdrhhcwrap.cxx   |1 
 sw/source/uibase/shells/annotsh.cxx |2 
 sw/source/uibase/shells/drwtxtex.cxx|1 
 sw/source/uibase/shells/grfshex.cxx |3 -
 sw/source/uibase/shells/textsh1.cxx |2 
 sw/source/uibase/shells/textsh2.cxx |8 ---
 sw/source/uibase/sidebar/PageFooterPanel.cxx|3 -
 sw/source/uibase/sidebar/PageFooterPanel.hxx|1 
 sw/source/uibase/sidebar/PageFormatPanel.cxx|3 -
 sw/source/uibase/sidebar/PageFormatPanel.hxx|1 
 sw/source/uibase/sidebar/PageHeaderPanel.cxx|3 -
 sw/source/uibase/sidebar/PageHeaderPanel.hxx|1 
 sw/source/uibase/sidebar/PageOrientationControl.cxx |2 
 sw/source/uibase/sidebar/PageOrientationControl.hxx |2 
 sw/source/uibase/sidebar/PageStylesPanel.cxx|3 -
 sw/source/uibase/sidebar/PageStylesPanel.hxx|1 
 sw/source/uibase/sidebar/StylePresetsPanel.cxx  |4 -
 sw/source/uibase/sidebar/StylePresetsPanel.hxx  |1 
 sw/source/uibase/sidebar/ThemePanel.cxx |5 --
 sw/source/uibase/sidebar/ThemePanel.hxx |1 
 sw/source/uibase/table/chartins.cxx |4 -
 sw/source/uibase/uiview/srcview.cxx |2 
 sw/source/uibase/uiview/uivwimp.cxx |2 
 sw/source/uibase/uiview/view1.cxx   |1 
 sw/source/uibase/uiview/view2.cxx   |1 
 sw/source/uibase/uiview/viewling.cxx|1 
 sw/source/uibase/uiview/viewprt.cxx |1 
 sw/source/uibase/uno/dlelstnr.cxx   |2 
 sw/source/uibase/uno/unoatxt.cxx|1 
 sw/source/uibase/uno/unomailmerge.cxx   |2 
 sw/source/uibase/uno/unomod.cxx |1 
 sw/source/uibase/utlui/numfmtlb.cxx |1 
 sw/source/uibase/wrtsh/wrtsh1.cxx   |1 
 57 files changed, 3 insertions(+), 171 deletions(-)

New commits:
commit 9b2e69abfc6386578fe3313362f1bbfe74c36a14
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed Nov 23 02:45:38 2016 +0100

tdf#42949 Remove unused uno headers from /sw/source/uibase

Change-Id: Iec10c5411814008f873868382faf245f38eeae1f
Reviewed-on: https://gerrit.libreoffice.org/31097
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 00a9f81..270711f 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -86,14 +86,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index c15fa2e..5d6d523 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 21c1b48..c1f8a65 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -20,7 +20,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/sw/source/uibase/app/swmodule.cxx 

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

2016-11-22 Thread Bartosz Kosiorek
 sw/source/core/access/accdoc.cxx  |1 
 sw/source/core/access/accdoc.hxx  |1 
 sw/source/core/access/accfootnote.cxx |1 
 sw/source/core/access/accheaderfooter.cxx |1 
 sw/source/core/access/acchyperlink.cxx|1 
 sw/source/core/access/accmap.cxx  |1 
 sw/source/core/access/accnotextframe.cxx  |3 --
 sw/source/core/access/accpara.cxx |2 -
 sw/source/core/access/accportions.cxx |2 -
 sw/source/core/access/accselectionhelper.hxx  |1 
 sw/source/core/access/acctextframe.cxx|1 
 sw/source/core/attr/format.cxx|1 
 sw/source/core/bastyp/breakit.cxx |1 
 sw/source/core/bastyp/calc.cxx|1 
 sw/source/core/bastyp/init.cxx|2 -
 sw/source/core/crsr/swcrsr.cxx|1 
 sw/source/core/doc/doc.cxx|7 -
 sw/source/core/doc/doclay.cxx |2 -
 sw/source/core/doc/docnew.cxx |3 --
 sw/source/core/doc/docsort.cxx|2 -
 sw/source/core/doc/docxforms.cxx  |1 
 sw/source/core/doc/tblrwcl.cxx|1 
 sw/source/core/docnode/finalthreadmanager.cxx |1 
 sw/source/core/docnode/ndtbl.cxx  |1 
 sw/source/core/draw/drawdoc.cxx   |1 
 sw/source/core/edit/edfldexp.cxx  |2 -
 sw/source/core/edit/edlingu.cxx   |1 
 sw/source/core/edit/edtab.cxx |1 
 sw/source/core/fields/docufld.cxx |9 --
 sw/source/core/fields/macrofld.cxx|1 
 sw/source/core/fields/reffld.cxx  |1 
 sw/source/core/frmedt/feflyole.cxx|1 
 sw/source/core/graphic/grfatr.cxx |   12 
-
 sw/source/core/graphic/ndgrf.cxx  |2 -
 sw/source/core/inc/retrieveinputstream.hxx|1 
 sw/source/core/inc/unofootnote.hxx|1 
 sw/source/core/inc/unoparaframeenum.hxx   |3 --
 sw/source/core/inc/unosection.hxx |1 
 sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx |1 
 sw/source/core/ole/ndole.cxx  |4 ---
 sw/source/core/para/paratr.cxx|   13 
--
 sw/source/core/text/itradj.cxx|1 
 sw/source/core/text/itratr.cxx|1 
 sw/source/core/text/pormulti.cxx  |1 
 sw/source/core/tox/toxhlp.cxx |1 
 sw/source/core/txtnode/txtedt.cxx |1 
 sw/source/core/view/vprint.cxx|1 
 47 files changed, 100 deletions(-)

New commits:
commit c840c49b62b919ec4d0d947fe8cd530a785cf80d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed Nov 23 01:45:47 2016 +0100

tdf#42949 Remove unused uno headers from /sw/source/core

Change-Id: I0029144d049ad1c5ee3ff4d188ff969b6881712f
Reviewed-on: https://gerrit.libreoffice.org/31095
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 06b9c5b..93c17f0 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -22,7 +22,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index 47caf4c..6075e5b 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -22,7 +22,6 @@
 
 #include "acccontext.hxx"
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/access/accfootnote.cxx 
b/sw/source/core/access/accfootnote.cxx
index 7c16cab..a2ec4ce 100644
--- a/sw/source/core/access/accfootnote.cxx
+++ b/sw/source/core/access/accfootnote.cxx
@@ -19,7 +19,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/access/accheader

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

2016-11-22 Thread Bartosz Kosiorek
 sd/source/core/CustomAnimationCloner.cxx |7 +--
 sd/source/core/CustomAnimationEffect.cxx |1 -
 sd/source/core/EffectMigration.cxx   |3 ---
 sd/source/core/TransitionPreset.cxx  |1 -
 sd/source/core/annotations/AnnotationEnumeration.cxx |1 -
 sd/source/core/drawdoc.cxx   |2 --
 sd/source/core/drawdoc2.cxx  |2 --
 sd/source/core/drawdoc3.cxx  |2 --
 sd/source/core/drawdoc4.cxx  |2 --
 sd/source/core/sdpage_animations.cxx |1 -
 10 files changed, 1 insertion(+), 21 deletions(-)

New commits:
commit 741b56fc09e8c9c4361baa7a876fe3c8b81710db
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed Nov 23 03:21:04 2016 +0100

tdf#42949 Remove unused uno headers from /sd/source/core

Change-Id: Idab4a8c35474a973ee98e060b99a5ed679dc14ea
Reviewed-on: https://gerrit.libreoffice.org/31098
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/core/CustomAnimationCloner.cxx 
b/sd/source/core/CustomAnimationCloner.cxx
index 6fcb46e..a8d2d24 100644
--- a/sd/source/core/CustomAnimationCloner.cxx
+++ b/sd/source/core/CustomAnimationCloner.cxx
@@ -17,19 +17,14 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/CustomAnimationEffect.cxx 
b/sd/source/core/CustomAnimationEffect.cxx
index 74d842b..469e06e 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/EffectMigration.cxx 
b/sd/source/core/EffectMigration.cxx
index 607f798..2348381 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -21,9 +21,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/TransitionPreset.cxx 
b/sd/source/core/TransitionPreset.cxx
index b4dda7d..b9e9a91 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/annotations/AnnotationEnumeration.cxx 
b/sd/source/core/annotations/AnnotationEnumeration.cxx
index 07d7ad6..842cbd5 100644
--- a/sd/source/core/annotations/AnnotationEnumeration.cxx
+++ b/sd/source/core/annotations/AnnotationEnumeration.cxx
@@ -21,7 +21,6 @@
 
 #include 
 
-#include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/office/XAnnotationEnumeration.hpp"
 
 #include "AnnotationEnumeration.hxx"
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index f11fce1..df8afd1 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -20,7 +20,6 @@
 #include 
 
 #include "PageListWatcher.hxx"
-#include 
 #include 
 #include 
 #include 
@@ -74,7 +73,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 8c7cdba..747d316 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
 #include 
 #include 
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 62754d3..e20c8d0 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
 
 #include "comphelper/anytostring.hxx"
 #include "cppuhelper/exc_hlp.hxx"
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 9d27b77..9787754 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -89,7 +88,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sd/source/core/sdpage_animations.cxx 
b/sd/source/core/sdpage_animations.cxx
index f58c704..2877ea5 100644
--- a/sd/source/core/sdpage_animations.cxx
+++ b/sd/source/core/sdpage_animations.cxx
@@ -18,7 +18,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-22 Thread Bartosz Kosiorek
 sw/source/filter/basflt/fltini.cxx|2 --
 sw/source/filter/html/SwAppletImpl.cxx|1 -
 sw/source/filter/html/htmlplug.cxx|1 -
 sw/source/filter/html/htmltabw.cxx|7 ---
 sw/source/filter/html/wrthtml.cxx |7 ---
 sw/source/filter/inc/fltshell.hxx |3 ---
 sw/source/filter/ww8/docxexportfilter.hxx |1 -
 sw/source/filter/ww8/writerhelper.cxx |1 -
 sw/source/filter/ww8/wrtw8esh.cxx |2 --
 sw/source/filter/ww8/ww8par3.cxx  |   16 +---
 sw/source/filter/ww8/ww8par5.cxx  |1 -
 sw/source/filter/ww8/ww8toolbar.cxx   |3 ---
 sw/source/filter/xml/swxml.cxx|2 --
 sw/source/filter/xml/wrtxml.cxx   |4 +---
 sw/source/filter/xml/wrtxml.hxx   |1 +
 sw/source/filter/xml/xmlbrsh.cxx  |1 -
 sw/source/filter/xml/xmlexp.cxx   |1 -
 sw/source/filter/xml/xmlfmte.cxx  |1 -
 sw/source/filter/xml/xmlfonte.cxx |1 -
 sw/source/filter/xml/xmlimp.cxx   |2 --
 sw/source/filter/xml/xmlmeta.cxx  |2 --
 sw/source/filter/xml/xmltexte.cxx |5 -
 sw/source/filter/xml/xmltexti.cxx |3 ---
 23 files changed, 3 insertions(+), 65 deletions(-)

New commits:
commit 45c7ba7ad6befdc4c212c376ef9399976f6695e1
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Nov 22 21:11:04 2016 +0100

tdf#42949 Remove unnecessary headers from sw/source/filters

Change-Id: I5f4d3fed6e8fd484ba5da835e2954f3c2042f33b
Reviewed-on: https://gerrit.libreoffice.org/31087
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/filter/basflt/fltini.cxx 
b/sw/source/filter/basflt/fltini.cxx
index 071751b..3b896eb 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -54,8 +54,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 using namespace utl;
diff --git a/sw/source/filter/html/SwAppletImpl.cxx 
b/sw/source/filter/html/SwAppletImpl.cxx
index bfeb6e8..fc8fb91 100644
--- a/sw/source/filter/html/SwAppletImpl.cxx
+++ b/sw/source/filter/html/SwAppletImpl.cxx
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index 468ba55..cedeafd 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -55,7 +55,6 @@
 #include "swcss1.hxx"
 #include "unoframe.hxx"
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index 3becd8c..d536ff0 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -27,13 +27,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 147d175..b3034c7 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -43,13 +43,6 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/filter/inc/fltshell.hxx 
b/sw/source/filter/inc/fltshell.hxx
index bd669dd..702e12f 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -19,9 +19,6 @@
 #ifndef INCLUDED_SW_SOURCE_FILTER_INC_FLTSHELL_HXX
 #define INCLUDED_SW_SOURCE_FILTER_INC_FLTSHELL_HXX
 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/filter/ww8/docxexportfilter.hxx 
b/sw/source/filter/ww8/docxexportfilter.hxx
index 0c4b859..983c8d7 100644
--- a/sw/source/filter/ww8/docxexportfilter.hxx
+++ b/sw/source/filter/ww8/docxexportfilter.hxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 
-#include 
 
 /// The physical access to the DOCX document (for writing).
 class DocxExportFilter : public oox::core::XmlFilterBase
diff --git a/sw/source/filter/ww8/writerhelper.cxx 
b/sw/source/filter/ww8/writerhelper.cxx
index 4c1ef18..5d38ce1 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -23,7 +23,6 @@
 #include "writerhelper.hxx"
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 9fc4425..b654cdb 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -85,9 +85,7 @@
 #include "escher.hxx"
 #include 
 #include "WW8FFData.hxx"
-#include 
 #include 
-#include 
 #include 
 #include "docsh.hxx"
 #include "IDocumentStylePoolAccess.hxx"
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8

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

2016-11-23 Thread Bartosz Kosiorek
 sc/source/filter/xml/XMLDetectiveContext.hxx |1 
 sc/source/filter/xml/XMLExportIterator.cxx   |  102 +++
 sc/source/filter/xml/XMLExportIterator.hxx   |   12 ---
 sc/source/filter/xml/xmlexprt.cxx|   12 +--
 4 files changed, 37 insertions(+), 90 deletions(-)

New commits:
commit 50106435e9a5bbc067e9beeabc5147ed9f305286
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Nov 24 00:02:45 2016 +0100

tdf#48140 Change types of variables and remove uneeded code

Change-Id: I9a82c7aca3433c474653d8847b6e24ed2249db58
Reviewed-on: https://gerrit.libreoffice.org/31138
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/xml/XMLDetectiveContext.hxx 
b/sc/source/filter/xml/XMLDetectiveContext.hxx
index fc98754..22ddc9b 100644
--- a/sc/source/filter/xml/XMLDetectiveContext.hxx
+++ b/sc/source/filter/xml/XMLDetectiveContext.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLDETECTIVECONTEXT_HXX
 
 #include 
-#include 
 #include "detfunc.hxx"
 #include "detdata.hxx"
 #include "xmlimprt.hxx"
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx 
b/sc/source/filter/xml/XMLExportIterator.cxx
index b0660c9..b680dd9 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -50,14 +50,9 @@ void ScMyIteratorBase::UpdateAddress( ScAddress& 
rCellAddress )
 }
 }
 
-bool ScMyShape::operator<(const ScMyShape& aShape) const
+inline bool ScMyShape::operator<(const ScMyShape& aShape) const
 {
-if( aAddress.Tab() != aShape.aAddress.Tab() )
-return ( aAddress.Tab() < aShape.aAddress.Tab() );
-else if( aAddress.Row() != aShape.aAddress.Row() )
-return ( aAddress.Row() < aShape.aAddress.Row( ));
-else
-return ( aAddress.Col() < aShape.aAddress.Col() );
+return ( aAddress < aShape.aAddress );
 }
 
 ScMyShapesContainer::ScMyShapesContainer()
@@ -76,7 +71,7 @@ void ScMyShapesContainer::AddNewShape( const ScMyShape& 
aShape )
 
 bool ScMyShapesContainer::GetFirstAddress( ScAddress& rCellAddress )
 {
-sal_Int32 nTable( rCellAddress.Tab() );
+SCTAB nTable( rCellAddress.Tab() );
 if( !aShapeList.empty() )
 {
 rCellAddress = aShapeList.begin()->aAddress;
@@ -111,14 +106,9 @@ void ScMyShapesContainer::Sort()
 aShapeList.sort();
 }
 
-bool ScMyNoteShape::operator<(const ScMyNoteShape& aNote) const
+inline bool ScMyNoteShape::operator<(const ScMyNoteShape& aNote) const
 {
-if( aPos.Tab() != aNote.aPos.Tab() )
-return ( aPos.Tab() < aNote.aPos.Tab() );
-else if( aPos.Row() != aNote.aPos.Row() )
-return ( aPos.Row() < aNote.aPos.Row() );
-else
-return ( aPos.Col() < aNote.aPos.Col() );
+return ( aPos < aNote.aPos );
 }
 
 ScMyNoteShapesContainer::ScMyNoteShapesContainer()
@@ -137,7 +127,7 @@ void ScMyNoteShapesContainer::AddNewNote( const 
ScMyNoteShape& aNote )
 
 bool ScMyNoteShapesContainer::GetFirstAddress( ScAddress& rCellAddress )
 {
-sal_Int16 nTable = rCellAddress.Tab();
+SCTAB nTable = rCellAddress.Tab();
 if( !aNoteShapeList.empty() )
 {
 rCellAddress = aNoteShapeList.begin()->aPos;
@@ -167,14 +157,9 @@ void ScMyNoteShapesContainer::Sort()
 aNoteShapeList.sort();
 }
 
-bool ScMyMergedRange::operator<(const ScMyMergedRange& aRange) const
+inline bool ScMyMergedRange::operator<(const ScMyMergedRange& aRange) const
 {
-if( aCellRange.aStart.Tab() != aRange.aCellRange.aStart.Tab() )
-return ( aCellRange.aStart.Tab() < aRange.aCellRange.aStart.Tab() );
-else if( aCellRange.aStart.Row() != aRange.aCellRange.aStart.Row() )
-return ( aCellRange.aStart.Row() < aRange.aCellRange.aStart.Row() );
-else
-return ( aCellRange.aStart.Col() < aRange.aCellRange.aStart.Col() );
+return ( aCellRange.aStart < aRange.aCellRange.aStart );
 }
 
 ScMyMergedRangesContainer::ScMyMergedRangesContainer()
@@ -188,8 +173,8 @@ ScMyMergedRangesContainer::~ScMyMergedRangesContainer()
 
 void ScMyMergedRangesContainer::AddRange(const ScRange& rMergedRange)
 {
-sal_Int32 nStartRow( rMergedRange.aStart.Row() );
-sal_Int32 nEndRow( rMergedRange.aEnd.Row() );
+SCROW nStartRow( rMergedRange.aStart.Row() );
+SCROW nEndRow( rMergedRange.aEnd.Row() );
 
 ScMyMergedRange aRange;
 aRange.bIsFirst = true;
@@ -202,7 +187,7 @@ void ScMyMergedRangesContainer::AddRange(const ScRange& 
rMergedRange)
 
 aRange.bIsFirst = false;
 aRange.nRows = 0;
-for( sal_Int32 nRow = nStartRow + 1; nRow <= nEndRow; ++nRow )
+for( SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow )
 {
 aRange.aCellRange.aStart.SetRow( nRow );
 aRange.aCellRange.aEnd.SetRow( nRow );
@@ -212,7 +197,7 @@ void Sc

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

2016-11-26 Thread Bartosz Kosiorek
 sc/source/filter/xml/XMLStylesExportHelper.cxx |   11 ++-
 sc/source/filter/xml/XMLStylesExportHelper.hxx |7 ---
 sc/source/filter/xml/xmldrani.cxx  |4 +---
 sc/source/filter/xml/xmldrani.hxx  |7 +++
 sc/source/filter/xml/xmlfilti.cxx  |2 +-
 sc/source/filter/xml/xmlfilti.hxx  |3 +--
 6 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit b0c3665b2a74256e8dca9743073c668df30839b4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 25 00:53:22 2016 +0100

tdf#48140 Replace uno with direct calls

Change-Id: I38af8d3e4dfbd42f025734ba14de409e8bd97393
Reviewed-on: https://gerrit.libreoffice.org/31179
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx 
b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 06dd75f..5b1b82f 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -68,9 +68,9 @@ bool ScMyValidation::IsEqual(const ScMyValidation& aVal) const
 if (aVal.bIgnoreBlanks == bIgnoreBlanks &&
 aVal.bShowImputMessage == bShowImputMessage &&
 aVal.bShowErrorMessage == bShowErrorMessage &&
-aVal.aBaseCell.Sheet == aBaseCell.Sheet &&
-aVal.aBaseCell.Column == aBaseCell.Column &&
-aVal.aBaseCell.Row == aBaseCell.Row &&
+aVal.aBaseCell.Tab() == aBaseCell.Tab() &&
+aVal.aBaseCell.Col() == aBaseCell.Col() &&
+aVal.aBaseCell.Row() == aBaseCell.Row() &&
 aVal.aAlertStyle == aAlertStyle &&
 aVal.aValidationType == aValidationType &&
 aVal.aOperator == aOperator &&
@@ -143,7 +143,8 @@ void ScMyValidationsContainer::AddValidation(const 
uno::Any& aTempAny,
 aValidation.sFormula1 = xCondition->getFormula1();
 aValidation.sFormula2 = xCondition->getFormula2();
 aValidation.aOperator = xCondition->getOperator();
-aValidation.aBaseCell = xCondition->getSourcePosition();
+table::CellAddress aCellAddress= 
xCondition->getSourcePosition();
+aValidation.aBaseCell = ScAddress( 
static_cast(aCellAddress.Column), static_cast(aCellAddress.Row), 
aCellAddress.Sheet );
 }
 //ScMyValidationRange aValidationRange;
 bool bEqualFound(false);
@@ -286,7 +287,7 @@ OUString 
ScMyValidationsContainer::GetCondition(ScXMLExport& rExport, const ScMy
 return sCondition;
 }
 
-OUString ScMyValidationsContainer::GetBaseCellAddress(ScDocument* pDoc, const 
table::CellAddress& aCell)
+OUString ScMyValidationsContainer::GetBaseCellAddress(ScDocument* pDoc, const 
ScAddress& aCell)
 {
 OUString sAddress;
 ScRangeStringConverter::GetStringFromAddress( sAddress, aCell, pDoc, 
::formula::FormulaGrammar::CONV_OOO );
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx 
b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index 2d385d5..6736212 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -23,9 +23,10 @@
 #include 
 #include 
 #include 
+
+#include "address.hxx"
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -44,7 +45,7 @@ struct ScMyValidation
 OUString   sImputTitle;
 OUString   sFormula1;
 OUString   sFormula2;
-css::table::CellAddress  aBaseCell;
+ScAddress  aBaseCell;
 css::sheet::ValidationAlertStyle aAlertStyle;
 css::sheet::ValidationType   aValidationType;
 css::sheet::ConditionOperatoraOperator;
@@ -83,7 +84,7 @@ public:
 void   AddValidation(const css::uno::Any& aAny,
 sal_Int32& nValidationIndex);
 static OUStringGetCondition(ScXMLExport& rExport, const 
ScMyValidation& aValidation);
-static OUStringGetBaseCellAddress(ScDocument* pDoc, const 
css::table::CellAddress& aCell);
+static OUStringGetBaseCellAddress(ScDocument* pDoc, const 
ScAddress& aCell);
 static voidWriteMessage(ScXMLExport& rExport,
 const OUString& sTitle, const OUString& 
sMessage,
 const bool bShowMessage, const bool 
bIsHelpMessage);
diff --git a/sc/source/filter/xml/xmldrani.cxx 
b/sc/source/filter/xml/xmldrani.cxx
index c525b04..7f81c22 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -288,9 +288,7 @@ std::unique_ptr 
ScXMLDatabaseRangeContext::ConvertToDBData(const OUStr
 
 if (bFilterConditionSourceRange)
 {
- 

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

2016-11-21 Thread Bartosz Kosiorek
 sc/source/filter/inc/viewsettings.hxx|3 -
 sc/source/filter/inc/worksheethelper.hxx |6 --
 sc/source/filter/oox/viewsettings.cxx|   11 ++-
 sc/source/filter/oox/workbookhelper.cxx  |4 -
 sc/source/filter/oox/worksheethelper.cxx |   93 +++
 5 files changed, 59 insertions(+), 58 deletions(-)

New commits:
commit 597f7b1f02be79f2443230c963b6d1bb594cffa0
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Nov 20 02:21:56 2016 +0100

tdf#48140 Replace uno call from worksheethelper.cxx

Change-Id: Ibf738d67af6536e9300e11f8d4fa3fe79ab7099b
Reviewed-on: https://gerrit.libreoffice.org/31006
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/inc/viewsettings.hxx 
b/sc/source/filter/inc/viewsettings.hxx
index c7d3ec5..c7f343a 100644
--- a/sc/source/filter/inc/viewsettings.hxx
+++ b/sc/source/filter/inc/viewsettings.hxx
@@ -163,8 +163,7 @@ public:
 const SheetViewModelRef& rxSheetView,
 const css::uno::Any& rProperties );
 /** Stores the used area for a specific worksheet. */
-voidsetSheetUsedArea(
-const css::table::CellRangeAddress& rUsedArea );
+voidsetSheetUsedArea( const ScRange& rUsedArea );
 
 /** Converts all imported document view settings. */
 voidfinalizeImport();
diff --git a/sc/source/filter/inc/worksheethelper.hxx 
b/sc/source/filter/inc/worksheethelper.hxx
index 9623059..6111a60 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -33,13 +33,10 @@ namespace com { namespace sun { namespace star {
 namespace awt { struct Rectangle; }
 namespace awt { struct Size; }
 namespace drawing { class XDrawPage; }
-namespace sheet { class XSheetCellRanges; }
 namespace sheet { class XSpreadsheet; }
 namespace table { class XCell; }
 namespace table { class XCell2; }
 namespace table { class XCellRange; }
-namespace table { class XTableColumns; }
-namespace table { class XTableRows; }
 } } }
 
 namespace oox {
@@ -191,7 +188,7 @@ public:
 /** Returns the type of this sheet. */
 WorksheetType   getSheetType() const;
 /** Returns the index of the current sheet. */
-sal_Int32   getSheetIndex() const;
+SCTAB   getSheetIndex() const;
 /** Returns the XSpreadsheet interface of the current sheet. */
 const css::uno::Reference< css::sheet::XSpreadsheet >&
 getSheet() const;
@@ -252,6 +249,7 @@ public:
 /** Extends the used area of this sheet by the passed cell position. */
 voidextendUsedArea( const ScAddress& rAddress );
 /** Extends the used area of this sheet by the passed cell range. */
+voidextendUsedArea( const ScRange& rRange );
 voidextendUsedArea( const css::table::CellRangeAddress& 
rRange );
 /** Extends the shape bounding box by the position and size of the passed 
rectangle (in 1/100 mm). */
 voidextendShapeBoundingBox( const css::awt::Rectangle& 
rShapeRect );
diff --git a/sc/source/filter/oox/viewsettings.cxx 
b/sc/source/filter/oox/viewsettings.cxx
index 8a4dcaa..99f7c4a 100644
--- a/sc/source/filter/oox/viewsettings.cxx
+++ b/sc/source/filter/oox/viewsettings.cxx
@@ -533,9 +533,14 @@ void ViewSettings::setSheetViewSettings( sal_Int16 nSheet, 
const SheetViewModelR
 maSheetProps[ nSheet ] = rProperties;
 }
 
-void ViewSettings::setSheetUsedArea( const CellRangeAddress& rUsedArea )
-{
-maSheetUsedAreas[ rUsedArea.Sheet ] = rUsedArea;
+void ViewSettings::setSheetUsedArea( const ScRange& rUsedArea )
+{
+assert( rUsedArea.IsValid() );
+assert( rUsedArea.aStart.Col() <= MAXCOLCOUNT );
+assert( rUsedArea.aStart.Row() <= MAXROWCOUNT );
+maSheetUsedAreas[ rUsedArea.aStart.Tab() ] = CellRangeAddress( 
rUsedArea.aStart.Tab(),
+   
rUsedArea.aStart.Col(), rUsedArea.aStart.Row(),
+   
rUsedArea.aEnd.Col(), rUsedArea.aEnd.Row() );
 }
 
 void ViewSettings::finalizeImport()
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 8cd46ed..73cc67c 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -133,7 +133,7 @@ public:
 /** Sets the VBA project storage used to import VBA source code and forms. 
*/
 inline void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) 
{ mxVbaPrjStrg = rxVbaPrjStrg; }
 /** Sets the index of the current Calc sheet, if filter currently 
processes a sheet. */
-inline

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

2016-11-21 Thread Bartosz Kosiorek
 sc/source/filter/inc/drawingbase.hxx   |2 --
 sc/source/filter/inc/drawingfragment.hxx   |1 -
 sc/source/filter/inc/formulabuffer.hxx |3 ---
 sc/source/filter/inc/ooxformulaparser.hxx  |1 -
 sc/source/filter/inc/pivotcachebuffer.hxx  |1 -
 sc/source/filter/inc/scenariobuffer.hxx|1 -
 sc/source/filter/inc/stylesbuffer.hxx  |1 -
 sc/source/filter/inc/viewsettings.hxx  |1 -
 sc/source/filter/inc/xlstyle.hxx   |1 -
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |1 -
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx   |4 
 sc/source/filter/xml/XMLTableShapeResizer.cxx  |2 --
 sc/source/filter/xml/XMLTableShapesContext.cxx |1 -
 sc/source/filter/xml/xmlbodyi.cxx  |1 -
 sc/source/filter/xml/xmlcoli.cxx   |1 -
 sc/source/filter/xml/xmldrani.cxx  |6 --
 sc/source/filter/xml/xmlexprt.cxx  |9 -
 sc/source/filter/xml/xmlimprt.cxx  |5 -
 sc/source/filter/xml/xmlstyle.cxx  |1 -
 sc/source/filter/xml/xmlsubti.cxx  |7 ---
 sc/source/filter/xml/xmlwrap.cxx   |8 
 21 files changed, 58 deletions(-)

New commits:
commit 069445f9cdf4d3f48cbfcf7cb4bf02d16f74956e
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Nov 21 15:44:20 2016 +0100

tdf#42949 Remove not needed uno headers from filters/xml

Change-Id: I5be5150a41906aa550e1fe00aa1647d79315172d
Reviewed-on: https://gerrit.libreoffice.org/31043
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/inc/drawingbase.hxx 
b/sc/source/filter/inc/drawingbase.hxx
index 16e258f..c0682da 100644
--- a/sc/source/filter/inc/drawingbase.hxx
+++ b/sc/source/filter/inc/drawingbase.hxx
@@ -23,8 +23,6 @@
 #include 
 #include "worksheethelper.hxx"
 
-#include 
-#include 
 
 namespace oox {
 namespace xls {
diff --git a/sc/source/filter/inc/drawingfragment.hxx 
b/sc/source/filter/inc/drawingfragment.hxx
index 6c52a4e..e9a29d2 100644
--- a/sc/source/filter/inc/drawingfragment.hxx
+++ b/sc/source/filter/inc/drawingfragment.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/inc/formulabuffer.hxx 
b/sc/source/filter/inc/formulabuffer.hxx
index d52f2d6..1d1bc77 100644
--- a/sc/source/filter/inc/formulabuffer.hxx
+++ b/sc/source/filter/inc/formulabuffer.hxx
@@ -18,9 +18,6 @@
 #include "workbookhelper.hxx"
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include "worksheethelper.hxx"
diff --git a/sc/source/filter/inc/ooxformulaparser.hxx 
b/sc/source/filter/inc/ooxformulaparser.hxx
index c5b1d31..eaf1a11 100644
--- a/sc/source/filter/inc/ooxformulaparser.hxx
+++ b/sc/source/filter/inc/ooxformulaparser.hxx
@@ -22,7 +22,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx 
b/sc/source/filter/inc/pivotcachebuffer.hxx
index a45e09c..2add88c 100644
--- a/sc/source/filter/inc/pivotcachebuffer.hxx
+++ b/sc/source/filter/inc/pivotcachebuffer.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX
 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/inc/scenariobuffer.hxx 
b/sc/source/filter/inc/scenariobuffer.hxx
index d0c117f..cfe18f7 100644
--- a/sc/source/filter/inc/scenariobuffer.hxx
+++ b/sc/source/filter/inc/scenariobuffer.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
 
-#include 
 #include 
 #include 
 #include "workbookhelper.hxx"
diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index d284fbc..2bc7598 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/inc/viewsettings.hxx 
b/sc/source/filter/inc/viewsettings.hxx
index 951e0e2..c7d3ec5 100644
--- a/sc/source/filter/inc/viewsettings.hxx
+++ b/sc/source/filter/inc/viewsettings.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_VIEWSETTINGS_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_VIEWSETTINGS_HXX
 
-#include 
 #include 
 #include "addressconverter.hxx"
 #include "stylesbuffer.hxx"
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index b83a646..339002d 100644

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

2016-11-23 Thread Bartosz Kosiorek
 sc/inc/address.hxx  |   26 --
 sc/source/core/tool/address.cxx |   10 +-
 sc/source/filter/excel/xestream.cxx |6 --
 sc/source/filter/excel/xetable.cxx  |5 -
 sc/source/filter/inc/xestream.hxx   |2 +-
 5 files changed, 38 insertions(+), 11 deletions(-)

New commits:
commit 71862564df1422f84340e421bbef9060c4e41a71
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 18 12:36:21 2016 +0100

OOXML: Write dimension range in full address notation

In every sheet.xml there is information about dimensions, like:
. During export by LibreOffice to .xlsx,
when row or column has maximum value, the dimension was
truncated. For example given "A1:AMJ177" it's saves .
It was caused problems with Office 2007 import.
This patch is fixing that by always using full address notation
for dimension range,  and allow open documents exported by LO
properly by MS Office.

Change-Id: Idda1455d1f9db08ade0871110fe40be2667c176c
Reviewed-on: https://gerrit.libreoffice.org/30960
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 63d8371..d801d05 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -542,8 +542,30 @@ public:
 const 
css::uno::Sequence* pExternalLinks = nullptr,
 const OUString* pErrRef = nullptr );
 
-SC_DLLPUBLIC OUString Format(ScRefFlags nFlags = ScRefFlags::ZERO, const 
ScDocument* pDocument = nullptr,
- const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1) const;
+/** Returns string with formatted cell range from aStart to aEnd,
+according to provided address convention.
+@param nFlags
+Cell reference flags
+@param pDocument
+Pointer to document which is used for example to get tab names.
+@param rDetails
+Provide information about required address convention.
+Supported address conventions are:
+CONV_OOO  'doc'#sheet.A1:sheet2.B2
+CONV_XL_A1,   [doc]sheet:sheet2!A1:B2
+CONV_XL_OOX,  [#]sheet:sheet2!A1:B2
+CONV_XL_R1C1, [doc]sheet:sheet2!R1C1:R2C2
+@param bFullAddressNotation
+If TRUE, the full address notation will be used.
+For example in case all columns are used, "A1:AMJ177" is full 
address notation
+and "1:177" is shortened address notation.
+@returns
+String contains formatted cell range in address convention
+ */
+SC_DLLPUBLIC OUString Format( ScRefFlags nFlags = ScRefFlags::ZERO,
+  const ScDocument* pDocument = nullptr,
+  const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1,
+  bool bFullAddressNotation = false ) const;
 
 inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1,
  SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index bb2c9e2..0a7a2a9 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2197,7 +2197,7 @@ static inline bool lcl_RowAbsFlagDiffer(const ScRefFlags 
nFlags)
 }
 
 OUString ScRange::Format( ScRefFlags nFlags, const ScDocument* pDoc,
-  const ScAddress::Details& rDetails ) const
+  const ScAddress::Details& rDetails, bool 
bFullAddressNotation ) const
 {
 if( !( nFlags & ScRefFlags::VALID ) )
 {
@@ -2232,14 +2232,14 @@ OUString ScRange::Format( ScRefFlags nFlags, const 
ScDocument* pDoc,
 case formula::FormulaGrammar::CONV_XL_A1:
 case formula::FormulaGrammar::CONV_XL_OOX:
 lcl_ScRange_Format_XL_Header( r, *this, nFlags, pDoc, rDetails );
-if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL )
+if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL && !bFullAddressNotation 
)
 {
 // Full col refs always require 2 rows (2:2)
 lcl_a1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) 
!= ScRefFlags::ZERO );
 r.append(":");
 lcl_a1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != 
ScRefFlags::ZERO );
 }
-else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW )
+else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW && 
!bFullAddressNotation )
 {
 // Full row refs always require 2 cols (A:A)
 lcl_a1_append_c( r, aStart.Col(), (nFlags & ScRefFlags::

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/inc sc/source

2016-11-23 Thread Bartosz Kosiorek
 sc/inc/address.hxx  |   26 --
 sc/source/core/tool/address.cxx |   10 +-
 sc/source/filter/excel/xestream.cxx |6 --
 sc/source/filter/excel/xetable.cxx  |5 -
 sc/source/filter/inc/xestream.hxx   |2 +-
 5 files changed, 38 insertions(+), 11 deletions(-)

New commits:
commit 342fc09784f01c1068d00a28af0ba196692e856b
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 18 12:36:21 2016 +0100

OOXML: Write dimension range in full address notation

In every sheet.xml there is information about dimensions, like:
. During export by LibreOffice to .xlsx,
when row or column has maximum value, the dimension was
truncated. For example given "A1:AMJ177" it's saves .
It was caused problems with Office 2007 import.
This patch is fixing that by always using full address notation
for dimension range,  and allow open documents exported by LO
properly by MS Office.

Change-Id: Idda1455d1f9db08ade0871110fe40be2667c176c
Reviewed-on: https://gerrit.libreoffice.org/30960
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 71862564df1422f84340e421bbef9060c4e41a71)
Reviewed-on: https://gerrit.libreoffice.org/31112
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 63d8371..d801d05 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -542,8 +542,30 @@ public:
 const 
css::uno::Sequence* pExternalLinks = nullptr,
 const OUString* pErrRef = nullptr );
 
-SC_DLLPUBLIC OUString Format(ScRefFlags nFlags = ScRefFlags::ZERO, const 
ScDocument* pDocument = nullptr,
- const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1) const;
+/** Returns string with formatted cell range from aStart to aEnd,
+according to provided address convention.
+@param nFlags
+Cell reference flags
+@param pDocument
+Pointer to document which is used for example to get tab names.
+@param rDetails
+Provide information about required address convention.
+Supported address conventions are:
+CONV_OOO  'doc'#sheet.A1:sheet2.B2
+CONV_XL_A1,   [doc]sheet:sheet2!A1:B2
+CONV_XL_OOX,  [#]sheet:sheet2!A1:B2
+CONV_XL_R1C1, [doc]sheet:sheet2!R1C1:R2C2
+@param bFullAddressNotation
+If TRUE, the full address notation will be used.
+For example in case all columns are used, "A1:AMJ177" is full 
address notation
+and "1:177" is shortened address notation.
+@returns
+String contains formatted cell range in address convention
+ */
+SC_DLLPUBLIC OUString Format( ScRefFlags nFlags = ScRefFlags::ZERO,
+  const ScDocument* pDocument = nullptr,
+  const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1,
+  bool bFullAddressNotation = false ) const;
 
 inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1,
  SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index bb2c9e2..0a7a2a9 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2197,7 +2197,7 @@ static inline bool lcl_RowAbsFlagDiffer(const ScRefFlags 
nFlags)
 }
 
 OUString ScRange::Format( ScRefFlags nFlags, const ScDocument* pDoc,
-  const ScAddress::Details& rDetails ) const
+  const ScAddress::Details& rDetails, bool 
bFullAddressNotation ) const
 {
 if( !( nFlags & ScRefFlags::VALID ) )
 {
@@ -2232,14 +2232,14 @@ OUString ScRange::Format( ScRefFlags nFlags, const 
ScDocument* pDoc,
 case formula::FormulaGrammar::CONV_XL_A1:
 case formula::FormulaGrammar::CONV_XL_OOX:
 lcl_ScRange_Format_XL_Header( r, *this, nFlags, pDoc, rDetails );
-if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL )
+if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL && !bFullAddressNotation 
)
 {
 // Full col refs always require 2 rows (2:2)
 lcl_a1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) 
!= ScRefFlags::ZERO );
 r.append(":");
 lcl_a1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != 
ScRefFlags::ZERO );
 }
-else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW )
+else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW &

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

2016-11-21 Thread Bartosz Kosiorek
 sc/source/core/data/attrib.cxx|3 ---
 sc/source/core/data/documen5.cxx  |1 -
 sc/source/core/data/documen6.cxx  |1 -
 sc/source/core/data/dpgroup.cxx   |2 --
 sc/source/core/data/dpoutput.cxx  |1 -
 sc/source/core/data/dpsave.cxx|3 ---
 sc/source/core/data/dpshttab.cxx  |1 -
 sc/source/core/data/dptabdat.cxx  |1 -
 sc/source/core/data/dptabres.cxx  |1 -
 sc/source/core/data/dptabsrc.cxx  |1 -
 sc/source/core/data/drwlayer.cxx  |6 --
 sc/source/core/data/global.cxx|1 -
 sc/source/core/data/globalx.cxx   |1 -
 sc/source/core/data/table3.cxx|1 -
 sc/source/core/tool/address.cxx   |1 -
 sc/source/core/tool/compiler.cxx  |1 -
 sc/source/core/tool/formulaparserpool.cxx |1 -
 17 files changed, 27 deletions(-)

New commits:
commit 5a4e106be6778f7e96fa36d2076ef4e7a90f81d9
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Nov 21 19:32:34 2016 +0100

tdf#42949 Remove not needed uno headers from sc/source/core

Change-Id: I1fd2b647caaa947390443ec41591a7ea050c4819
Reviewed-on: https://gerrit.libreoffice.org/31046
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index fe42b62..9da8293 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -18,9 +18,6 @@
  */
 
 #include 
-#include 
-#include 
-#include 
 
 #include "scitems.hxx"
 #include 
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index f5f9f0c..5959618 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index e7713e1..03dee37 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -22,7 +22,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include "document.hxx"
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index 50aeeb6..cf3cfbf 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -33,8 +33,6 @@
 #include 
 
 #include 
-#include 
-#include 
 
 #include 
 #include 
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 7124b51..39227bf 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -50,7 +50,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 320be4d..a3fae76 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -39,15 +39,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
-#include 
 
 #include 
 #include 
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 3fc321a..c65eb98 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -29,7 +29,6 @@
 #include "rangenam.hxx"
 #include "queryentry.hxx"
 
-#include 
 #include 
 
 #include 
diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index 634e7eb..4b99682 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 
-#include 
 
 using namespace ::com::sun::star;
 using ::std::vector;
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 9f2b53d..6747347 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -48,7 +48,6 @@
 #include 
 #include 
 #include 
-#include 
 
 using namespace com::sun::star;
 using ::std::vector;
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 2454bdf..cc024ac 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -54,7 +54,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index e577290..f2e93dd 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -20,13 +20,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 
 #include "scitems.hxx"
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 50c5ba4..68d1d83 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -53,7 +53,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include

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

2016-11-19 Thread Bartosz Kosiorek
 sc/source/filter/inc/formulabuffer.hxx|1 -
 sc/source/filter/oox/condformatbuffer.cxx |1 -
 sc/source/filter/oox/defnamesbuffer.cxx   |1 -
 sc/source/filter/oox/formulabuffer.cxx|5 -
 sc/source/filter/oox/sheetdatabuffer.cxx  |1 -
 sc/source/filter/oox/workbookfragment.cxx |1 -
 sc/source/filter/oox/workbookhelper.cxx   |4 
 sc/source/filter/oox/worksheethelper.cxx  |4 
 sc/source/filter/xcl97/xcl97rec.cxx   |2 --
 sc/source/filter/xml/XMLTableShapeResizer.hxx |2 --
 sc/source/filter/xml/xmlcelli.cxx |   15 ---
 sc/source/filter/xml/xmldrani.hxx |3 ---
 sc/source/filter/xml/xmlexprt.hxx |2 --
 sc/source/filter/xml/xmlimprt.hxx |1 -
 sc/source/filter/xml/xmlrowi.cxx  |3 ---
 sc/source/filter/xml/xmlsubti.hxx |3 ---
 sc/source/filter/xml/xmltabi.cxx  |6 --
 sc/source/ui/unoobj/datauno.cxx   |2 +-
 18 files changed, 1 insertion(+), 56 deletions(-)

New commits:
commit dfee3a97a0bd30e461974af4ecb09f67bded584d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 18 15:44:39 2016 +0100

tdf#48140 Remove not used UNO headers from filters

Change-Id: I66e775b60343fe8ac772d8c0287ca19be58a7236
Reviewed-on: https://gerrit.libreoffice.org/30966
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/inc/formulabuffer.hxx 
b/sc/source/filter/inc/formulabuffer.hxx
index 692fff2..d52f2d6 100644
--- a/sc/source/filter/inc/formulabuffer.hxx
+++ b/sc/source/filter/inc/formulabuffer.hxx
@@ -25,7 +25,6 @@
 #include 
 #include "worksheethelper.hxx"
 #include "sheetdatabuffer.hxx"
-#include 
 
 namespace oox { namespace xls {
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index f08f8b6..1d0dd13 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -20,7 +20,6 @@
 #include "condformatbuffer.hxx"
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx 
b/sc/source/filter/oox/defnamesbuffer.cxx
index 18c0aeb..79457ab 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/oox/formulabuffer.cxx 
b/sc/source/filter/oox/formulabuffer.cxx
index f2aff25..003d0b9 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -10,11 +10,6 @@
 #include "formulabuffer.hxx"
 #include "formulaparser.hxx"
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include "formulacell.hxx"
 #include "document.hxx"
 #include "documentimport.hxx"
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index fd4c9f1..44a0e02 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/oox/workbookfragment.cxx 
b/sc/source/filter/oox/workbookfragment.cxx
index 78b7686..53ae02f 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -19,7 +19,6 @@
 
 #include "workbookfragment.hxx"
 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 580b430..8cd46ed 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -21,17 +21,13 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index 5d20156..450283a 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -25,14 +25,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -40,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 991355d..85f8067 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -69,8 +69,6 @@
 #include "patattr.hxx"
 #include "tabprotection.hxx"
 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --gi

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

2016-11-19 Thread Bartosz Kosiorek
 sc/source/filter/xml/XMLTableShapeImportHelper.cxx |6 ++
 sc/source/filter/xml/XMLTableShapeImportHelper.hxx |6 +++---
 sc/source/filter/xml/xmlcelli.cxx  |5 +
 sc/source/filter/xml/xmlfilti.cxx  |8 
 sc/source/filter/xml/xmlfilti.hxx  |5 +
 5 files changed, 11 insertions(+), 19 deletions(-)

New commits:
commit e1078f21d6e0faf93b22cb8e8af2a91c0b16071d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 19 16:00:29 2016 +0100

tdf#48140 Replace CellAddress uno calls with direct access

Change-Id: I4c8b36eaa29241f886810f9bff88ed9ca9d3192f
Reviewed-on: https://gerrit.libreoffice.org/30979
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx 
b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
index 239e8bc..83751e0 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
@@ -88,14 +88,13 @@ void XMLTableShapeImportHelper::finishShape(
 if (!pAnnotationContext)
 {
 ScDrawObjData aAnchor;
-aAnchor.maStart = ScAddress(aStartCell.Column, aStartCell.Row, 
aStartCell.Sheet);
+aAnchor.maStart = aStartCell;
 awt::Point aStartPoint(rShape->getPosition());
 aAnchor.maStartOffset = Point(aStartPoint.X, aStartPoint.Y);
 
 sal_Int32 nEndX(-1);
 sal_Int32 nEndY(-1);
 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-table::CellAddress aEndCell;
 std::unique_ptr xRangeList;
 sal_Int16 nLayerID(-1);
 for( sal_Int16 i=0; i < nAttrCount; ++i )
@@ -112,8 +111,7 @@ void XMLTableShapeImportHelper::finishShape(
 if (IsXMLToken(aLocalName, XML_END_CELL_ADDRESS))
 {
 sal_Int32 nOffset(0);
-ScRangeStringConverter::GetAddressFromString(aEndCell, 
rValue, static_cast<ScXMLImport&>(mrImporter).GetDocument(), 
::formula::FormulaGrammar::CONV_OOO, nOffset);
-aAnchor.maEnd = ScAddress(aEndCell.Column, 
aEndCell.Row, aEndCell.Sheet);
+
ScRangeStringConverter::GetAddressFromString(aAnchor.maEnd, rValue, 
static_cast<ScXMLImport&>(mrImporter).GetDocument(), 
::formula::FormulaGrammar::CONV_OOO, nOffset);
 }
 else if (IsXMLToken(aLocalName, XML_END_X))
 {
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx 
b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
index 1bb7d70..397f07d 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
@@ -21,14 +21,14 @@
 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLTABLESHAPEIMPORTHELPER_HXX
 
 #include 
-#include 
+#include "address.hxx"
 
 class ScXMLImport;
 class ScXMLAnnotationContext;
 
 class XMLTableShapeImportHelper : public XMLShapeImportHelper
 {
-css::table::CellAddress aStartCell;
+ScAddress aStartCell;
 ScXMLAnnotationContext* pAnnotationContext;
 bool bOnTable;
 
@@ -42,7 +42,7 @@ public:
 const css::uno::Reference< css::xml::sax::XAttributeList >& 
xAttrList,
 css::uno::Reference< css::drawing::XShapes >& rShapes) override;
 
-void SetCell (const css::table::CellAddress& rAddress) { aStartCell = 
rAddress; }
+void SetCell (const ScAddress& rAddress) { aStartCell = rAddress; }
 void SetOnTable (const bool bTempOnTable) { bOnTable = bTempOnTable; }
 void SetAnnotation(ScXMLAnnotationContext* pAnnotation) { 
pAnnotationContext = pAnnotation; }
 
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 851101e..ddd8543 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -91,7 +91,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -710,9 +709,7 @@ SvXMLImportContext 
*ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
 XMLTableShapeImportHelper* pTableShapeImport =
 static_cast< XMLTableShapeImportHelper* >( 
rXMLImport.GetShapeImport().get() );
 pTableShapeImport->SetOnTable(false);
-css::table::CellAddress aCellAddress;
-ScUnoConversion::FillApiAddress( aCellAddress, aCellPos );
-pTableShapeImport->SetCell(aCellAddress);
+pTableShapeImport->SetCell(aCellPos);
 pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
 rXMLImport, nPrefix, rLName, xAttrList, xShapes);
 if (pContext)
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfil

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

2016-11-20 Thread Bartosz Kosiorek
 sc/source/filter/xml/XMLExportIterator.cxx |  231 ++---
 sc/source/filter/xml/XMLExportIterator.hxx |   51 +++---
 sc/source/filter/xml/xmlexprt.cxx  |   39 ++--
 sc/source/filter/xml/xmlexprt.hxx  |2 
 4 files changed, 160 insertions(+), 163 deletions(-)

New commits:
commit f6e6a6139e90d6e88fb65308e8592193ac602a8a
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 19 23:28:34 2016 +0100

tdf#48140 Replace uno CellRangeAddress and CellAddress with direct calls

Change-Id: I43c5c1274c9ed45c929a2d5a8596d54626b5e4f6
Reviewed-on: https://gerrit.libreoffice.org/30994
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/xml/XMLExportIterator.cxx 
b/sc/source/filter/xml/XMLExportIterator.cxx
index 188770e..b0660c9 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -18,11 +18,6 @@
  */
 
 #include "XMLExportIterator.hxx"
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include "dociter.hxx"
 #include "convuno.hxx"
@@ -43,14 +38,14 @@ ScMyIteratorBase::~ScMyIteratorBase()
 {
 }
 
-void ScMyIteratorBase::UpdateAddress( table::CellAddress& rCellAddress )
+void ScMyIteratorBase::UpdateAddress( ScAddress& rCellAddress )
 {
-table::CellAddress aNewAddr( rCellAddress );
+ScAddress aNewAddr( rCellAddress );
 if( GetFirstAddress( aNewAddr ) )
 {
-if( (aNewAddr.Sheet == rCellAddress.Sheet) &&
-((aNewAddr.Row < rCellAddress.Row) ||
-((aNewAddr.Row == rCellAddress.Row) && (aNewAddr.Column < 
rCellAddress.Column))) )
+if( ( aNewAddr.Tab() == rCellAddress.Tab() ) &&
+( ( aNewAddr.Row() < rCellAddress.Row() ) ||
+( ( aNewAddr.Row() == rCellAddress.Row() ) && ( aNewAddr.Col() < 
rCellAddress.Col() ) ) ) )
 rCellAddress = aNewAddr;
 }
 }
@@ -58,11 +53,11 @@ void ScMyIteratorBase::UpdateAddress( table::CellAddress& 
rCellAddress )
 bool ScMyShape::operator<(const ScMyShape& aShape) const
 {
 if( aAddress.Tab() != aShape.aAddress.Tab() )
-return (aAddress.Tab() < aShape.aAddress.Tab());
+return ( aAddress.Tab() < aShape.aAddress.Tab() );
 else if( aAddress.Row() != aShape.aAddress.Row() )
-return (aAddress.Row() < aShape.aAddress.Row());
+return ( aAddress.Row() < aShape.aAddress.Row( ));
 else
-return (aAddress.Col() < aShape.aAddress.Col());
+return ( aAddress.Col() < aShape.aAddress.Col() );
 }
 
 ScMyShapesContainer::ScMyShapesContainer()
@@ -79,13 +74,13 @@ void ScMyShapesContainer::AddNewShape( const ScMyShape& 
aShape )
 aShapeList.push_back(aShape);
 }
 
-bool ScMyShapesContainer::GetFirstAddress( table::CellAddress& rCellAddress )
+bool ScMyShapesContainer::GetFirstAddress( ScAddress& rCellAddress )
 {
-sal_Int32 nTable(rCellAddress.Sheet);
+sal_Int32 nTable( rCellAddress.Tab() );
 if( !aShapeList.empty() )
 {
-ScUnoConversion::FillApiAddress( rCellAddress, 
aShapeList.begin()->aAddress );
-return (nTable == rCellAddress.Sheet);
+rCellAddress = aShapeList.begin()->aAddress;
+return ( nTable == rCellAddress.Tab() );
 }
 return false;
 }
@@ -107,7 +102,7 @@ void ScMyShapesContainer::SetCellData( ScMyCell& rMyCell )
 void ScMyShapesContainer::SkipTable(SCTAB nSkip)
 {
 ScMyShapeList::iterator aItr = aShapeList.begin();
-while( (aItr != aShapeList.end()) && (aItr->aAddress.Tab() == nSkip) )
+while( ( aItr != aShapeList.end() ) && ( aItr->aAddress.Tab() == nSkip ) )
 aItr = aShapeList.erase(aItr);
 }
 
@@ -119,11 +114,11 @@ void ScMyShapesContainer::Sort()
 bool ScMyNoteShape::operator<(const ScMyNoteShape& aNote) const
 {
 if( aPos.Tab() != aNote.aPos.Tab() )
-return (aPos.Tab() < aNote.aPos.Tab());
+return ( aPos.Tab() < aNote.aPos.Tab() );
 else if( aPos.Row() != aNote.aPos.Row() )
-return (aPos.Row() < aNote.aPos.Row());
+return ( aPos.Row() < aNote.aPos.Row() );
 else
-return (aPos.Col() < aNote.aPos.Col());
+return ( aPos.Col() < aNote.aPos.Col() );
 }
 
 ScMyNoteShapesContainer::ScMyNoteShapesContainer()
@@ -140,13 +135,13 @@ void ScMyNoteShapesContainer::AddNewNote( const 
ScMyNoteShape& aNote )
 aNoteShapeList.push_back(aNote);
 }
 
-bool ScMyNoteShapesContainer::GetFirstAddress( table::CellAddress& 
rCellAddress )
+bool ScMyNoteShapesContainer::GetFirstAddress( ScAddress& rCellAddress )
 {
-sal_Int16 nTable = rCellAddress.Sheet;
+sal_Int16 nTable = rCellAddress.Tab();
 if( !aNoteShapeList.empty()

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

2016-10-13 Thread Bartosz Kosiorek
 oox/source/docprop/docprophandler.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 7d5d5e6e9b67807560a7db4123e8b41cc0f70a32
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed Oct 12 06:44:41 2016 +0200

tdf#103143 Fix importing number of characters from docx files

Change-Id: I45429626f7299f84fda2969dd6000c8aa8d23982
Reviewed-on: https://gerrit.libreoffice.org/29721
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/oox/source/docprop/docprophandler.cxx 
b/oox/source/docprop/docprophandler.cxx
index 773a6e5..d7a1e31 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -216,6 +216,10 @@ void OOXMLDocPropHandler::UpdateDocStatistic( const 
OUString& aChars )
 switch( m_nBlock )
 {
 case EXTPR_TOKEN( Characters ):
+aName = "NonWhitespaceCharacterCount";
+break;
+
+case EXTPR_TOKEN( CharactersWithSpaces ):
 aName = "CharacterCount";
 break;
 
@@ -513,6 +517,7 @@ void SAL_CALL OOXMLDocPropHandler::characters( const 
OUString& aChars )
 break;
 
 case EXTPR_TOKEN( Characters ):
+case EXTPR_TOKEN( CharactersWithSpaces ):
 case EXTPR_TOKEN( Pages ):
 case EXTPR_TOKEN( Words ):
 case EXTPR_TOKEN( Paragraphs ):
@@ -589,7 +594,6 @@ void SAL_CALL OOXMLDocPropHandler::characters( const 
OUString& aChars )
 AddCustomProperty( uno::makeAny( aChars ) ); // the 
property has string type
 break;
 
-case EXTPR_TOKEN( CharactersWithSpaces ):
 case EXTPR_TOKEN( Lines ):
 case EXTPR_TOKEN( DigSig ):
 case EXTPR_TOKEN( HeadingPairs ):
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-10-16 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/empty_cells_with_background.ods |binary
 sc/qa/unit/subsequent_export-test.cxx   |   28 
 sc/source/core/data/attarray.cxx|   11 +--
 3 files changed, 35 insertions(+), 4 deletions(-)

New commits:
commit 5239cefff56875c7bb45c046977f1724aace0cfb
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Oct 15 14:36:28 2016 +0200

tdf#46738 Fix exporting .xlsx of coloured empty cells

When spreadsheet contains more that 84 cells, and these
cells are empty, but contains additional data (border color,
text color, specific formatting), the remaining rows are
ignored during export to .xlsx and .xls
As a result such empty rows are not saved during export.
This patch is fixing most cases and make sure that at least
first 84 empty cells will be preserved.
It is not impacting the performance as it is still notchecking
next columns when the visible cells are more that 84 characters.
This patch improve exporting empty cells, but not impacts
performance.

Change-Id: Ia7027e2c8a2fd48ab4a0e840f970d57167454451
Reviewed-on: https://gerrit.libreoffice.org/29899
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/qa/unit/data/ods/empty_cells_with_background.ods 
b/sc/qa/unit/data/ods/empty_cells_with_background.ods
new file mode 100644
index 000..1301bca
Binary files /dev/null and 
b/sc/qa/unit/data/ods/empty_cells_with_background.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 9c45175..693990d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -111,6 +111,7 @@ public:
 void testXfDefaultValuesXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
+void testEmptyRowsWithBackgroundColorXLSX();
 void testLandscapeOrientationXLSX();
 
 void testInlineArrayXLS();
@@ -202,6 +203,7 @@ public:
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testEmptyRowsWithBackgroundColorXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
@@ -753,6 +755,32 @@ void ScExportTest::testOutlineExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 30);
 }
 
+void ScExportTest::testEmptyRowsWithBackgroundColorXLSX()
+{
+// tdf#46738 FILESAVE:  Cell background and border color formatting 
information of empty cells
+// lost in particular document after FILESAVE as xls and xlsx
+ScDocShellRef xShell = loadDoc("empty_cells_with_background.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// Check if all 100 rows are saved into .xlsx file,
+// as it contains information about background color information (style)
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "1");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "2");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "3");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]", "r", "100");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 100);
+
+// Check if all 4 column were created
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[1]", "r", 
"A100");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[2]", "r", 
"B100");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[3]", "r", 
"C100");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[4]", "r", 
"D100");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c", 4);
+}
 
 void ScExportTest::testHiddenEmptyRowsXLSX()
 {
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index fb90fb4..cf54262 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1815,7 +1815,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW& rFirstRow ) 
const
 return bFound;
 }
 
-// size (rows) of a range of attributes after cell content where the search is 
stopped
+// Number of rows after the search will be stopped
 // (more than a default page size, 2*42 because it's as good as any number)
 
 const SCROW SC_VISATTR_STOP = 84;
@@ -1860,13 +1860

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

2016-11-29 Thread Bartosz Kosiorek
 sc/source/filter/inc/addressconverter.hxx |   14 ++
 sc/source/filter/inc/externallinkfragment.hxx |2 
 sc/source/filter/inc/pivotcachebuffer.hxx |5 --
 sc/source/filter/inc/tablebuffer.hxx  |   19 +++--
 sc/source/filter/oox/addressconverter.cxx |   38 ++
 sc/source/filter/oox/formulaparser.cxx|2 
 sc/source/filter/oox/pivotcachebuffer.cxx |   53 +-
 sc/source/filter/oox/pivotcachefragment.cxx   |2 
 sc/source/filter/oox/pivottablebuffer.cxx |6 ++
 sc/source/filter/oox/tablebuffer.cxx  |   11 -
 sc/source/filter/oox/worksheethelper.cxx  |6 +-
 11 files changed, 110 insertions(+), 48 deletions(-)

New commits:
commit ad129cda465d7d16130469eb9e232e9e8ce53d58
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 25 13:33:46 2016 +0100

tdf#48140 Replace uno with direct calls

Change-Id: I63e30c4bb32837b28401474a4ab7627ad2863c5b
Reviewed-on: https://gerrit.libreoffice.org/31219
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/inc/addressconverter.hxx 
b/sc/source/filter/inc/addressconverter.hxx
index add5401..f1afeb2d 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -366,6 +366,10 @@ public:
 const css::table::CellRangeAddress& rRange,
 bool bAllowOverflow, bool bTrackOverflow );
 
+boolcheckCellRange(
+const ScRange& rRange,
+bool bAllowOverflow, bool bTrackOverflow );
+
 /** Checks the passed cell range, may try to fit it to current sheet 
limits.
 
 First, this function reorders the column and row indexes so that the
@@ -409,6 +413,11 @@ public:
 const OUString& rString,
 sal_Int16 nSheet );
 
+static bool convertToCellRangeUnchecked(
+ScRange& orRange,
+const OUString& rString,
+sal_Int16 nSheet );
+
 /** Tries to convert the passed string to a cell range address.
 
 @param orRange  (out-parameter) Returns the converted cell range
@@ -451,6 +460,11 @@ public:
 const BinRange& rBinRange,
 sal_Int16 nSheet );
 
+static void convertToCellRangeUnchecked(
+ScRange& orRange,
+const BinRange& rBinRange,
+sal_Int16 nSheet );
+
 /** Tries to convert the passed range to a cell range address.
 
 @param orRange  (out-parameter) Returns the converted cell range
diff --git a/sc/source/filter/inc/externallinkfragment.hxx 
b/sc/source/filter/inc/externallinkfragment.hxx
index 1d5f5c3..ec82be8 100644
--- a/sc/source/filter/inc/externallinkfragment.hxx
+++ b/sc/source/filter/inc/externallinkfragment.hxx
@@ -67,7 +67,7 @@ private:
 private:
 css::uno::Reference< css::sheet::XExternalSheetCache >
 mxSheetCache;   /// The sheet cache used 
to store external cell values.
-ScAddress   maCurrPos; /// Position of current cell.
+ScAddress   maCurrPos;  /// Position of current 
cell.
 sal_Int32   mnCurrType; /// Data type of current 
cell.
 };
 
diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx 
b/sc/source/filter/inc/pivotcachebuffer.hxx
index 2add88c..4ff96f0 100644
--- a/sc/source/filter/inc/pivotcachebuffer.hxx
+++ b/sc/source/filter/inc/pivotcachebuffer.hxx
@@ -337,8 +337,7 @@ struct PCWorksheetSourceModel
 OUString maRelId;/// Relation identifier for an external 
document URL.
 OUString maSheet;/// Sheet name for cell range or 
sheet-local defined names.
 OUString maDefName;  /// Defined name containing a cell range 
if present.
-css::table::CellRangeAddress
- maRange;/// Source cell range of the data.
+ScRange  maRange;/// Source cell range of the data.
 
 explicitPCWorksheetSourceModel();
 };
@@ -373,7 +372,7 @@ public:
 /** Returns true, if the pivot cache is based on a dummy sheet created in 
finalizeImport. */
 inline bool isBasedOnDummySheet() const { return mbDummySheet; }
 /** Returns the internal cell range the cache is based on. */
-inline const css::table::CellRangeAddress&
+inline const ScRange&
 getSourceRange() const { return 
maSheetSrcModel.maRange; }
 /** Returns the relation identifier of the pivot cache records fragment. */
 inline const OUString& getRecordsRelId() const { return 
maDefMode

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

2017-01-12 Thread Bartosz Kosiorek
 sc/source/core/data/table2.cxx |   69 -
 sc/source/core/data/table4.cxx |8 ++--
 sc/source/core/data/table6.cxx |   23 -
 sc/source/core/data/table7.cxx |6 +--
 4 files changed, 57 insertions(+), 49 deletions(-)

New commits:
commit 5e223be2102a171c857be8db1327f23faea0ef78
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Jan 3 23:25:51 2017 +0100

tdf#50916 Use aCol.size() instead of MAXCOL to increase max number of column

Currently when we are increasing MAXCOL variable, the memory usage and
performance are increase dramatically. To resolve that, columns
needs to be created dynamically according to needs.
This patch replace hardcoded MAXCOL with aCol.size().
It is next step to make creation of columns dynamic.

Change-Id: Ic7b7a76863e063a607165629bdf82699eaa847b3
Reviewed-on: https://gerrit.libreoffice.org/32708
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f94e732..9814b65 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -716,7 +716,7 @@ void ScTable::MixMarked(
 sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
 bool bSkipEmpty, const ScTable* pSrcTab )
 {
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].MixMarked(rCxt, rMark, nFunction, bSkipEmpty, 
pSrcTab->aCol[i]);
 }
 
@@ -1036,7 +1036,7 @@ void ScTable::StartListeners( sc::StartListeningContext& 
rCxt, bool bAll )
 std::shared_ptr pColSet = rCxt.getColumnSet();
 if (!pColSet)
 {
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].StartListeners(rCxt, bAll);
 }
 else if (pColSet->hasTab( nTab))
@@ -1045,7 +1045,7 @@ void ScTable::StartListeners( sc::StartListeningContext& 
rCxt, bool bAll )
 pColSet->getColumns( nTab, aColumns);
 for (auto i : aColumns)
 {
-if (0 <= i && i <= MAXCOL)
+if (0 <= i && i < aCol.size())
 aCol[i].StartListeners(rCxt, bAll);
 }
 }
@@ -1238,7 +1238,7 @@ void ScTable::UndoToTable(
 bool bWidth  = (nRow1==0 && nRow2==MAXROW && pColWidth && 
pDestTab->pColWidth);
 bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && 
pDestTab->mpRowHeights);
 
-for ( SCCOL i = 0; i <= MAXCOL; i++)
+for ( SCCOL i = 0; i < aCol.size(); i++)
 {
 if ( i >= nCol1 && i <= nCol2 )
 aCol[i].UndoToColumn(rCxt, nRow1, nRow2, nFlags, bMarked, 
pDestTab->aCol[i]);
@@ -1268,7 +1268,7 @@ void ScTable::UndoToTable(
 
 void ScTable::CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const
 {
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].CopyUpdated( pPosTab->aCol[i], pDestTab->aCol[i] );
 }
 
@@ -1286,7 +1286,7 @@ void ScTable::CopyScenarioTo( ScTable* pDestTab ) const
 {
 OSL_ENSURE( bScenario, "bScenario == FALSE" );
 
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].CopyScenarioTo( pDestTab->aCol[i] );
 }
 
@@ -1294,7 +1294,7 @@ void ScTable::CopyScenarioFrom( const ScTable* pSrcTab )
 {
 OSL_ENSURE( bScenario, "bScenario == FALSE" );
 
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].CopyScenarioFrom( pSrcTab->aCol[i] );
 }
 
@@ -1305,7 +1305,7 @@ void ScTable::MarkScenarioIn( ScMarkData& rDestMark, 
ScScenarioFlags nNeededBits
 if ( ( nScenarioFlags & nNeededBits ) != nNeededBits )  // Are all Bits 
set?
 return;
 
-for (SCCOL i=0; i<=MAXCOL; i++)
+for (SCCOL i=0; i < aCol.size(); i++)
 aCol[i].MarkScenarioIn( rDestMark );
 }
 
@@ -1360,7 +1360,7 @@ bool ScTable::TestCopyScenarioTo( const ScTable* pDestTab 
) const
 return true;
 
 bool bOk = true;
-for (SCCOL i=0; i<=MAXCOL && bOk; i++)
+for (SCCOL i=0; i < aCol.size() && bOk; i++)
 bOk = aCol[i].TestCopyScenarioTo( pDestTab->aCol[i] );
 return bOk;
 }
@@ -1583,7 +1583,7 @@ SCROW ScTable::GetNotePosition( SCCOL nCol, size_t nIndex 
) const
 
 void ScTable::CreateAllNoteCaptions()
 {
-for (SCCOL i = 0; i <= MAXCOL; ++i)
+for (SCCOL i = 0; i < aCol.size(); ++i)
 aCol[i].CreateAllNoteCaptions();
 }
 
@@ -1598,7 +1598,7 @@ void ScTable::ForgetNoteCaptions( SCCOL nCol1, SCROW 
nRow1, SCCOL nCol2, SCROW n
 
 void ScTable::GetAllNoteEntries( std::vector& rNotes ) const
 {
-for (SCCOL nCol = 0; nCol < MAXCOLCOUNT; 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/inc sc/source

2016-12-02 Thread Bartosz Kosiorek
 sc/inc/address.hxx  |   26 --
 sc/source/core/tool/address.cxx |   10 +-
 sc/source/filter/excel/xestream.cxx |6 --
 sc/source/filter/excel/xetable.cxx  |5 -
 sc/source/filter/inc/xestream.hxx   |2 +-
 5 files changed, 38 insertions(+), 11 deletions(-)

New commits:
commit 3cd0184306825c52da237815a8e782ce4c80253a
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 18 12:36:21 2016 +0100

OOXML: Write dimension range in full address notation

In every sheet.xml there is information about dimensions, like:
. During export by LibreOffice to .xlsx,
when row or column has maximum value, the dimension was
truncated. For example given "A1:AMJ177" it's saves .
It was caused problems with Office 2007 import.
This patch is fixing that by always using full address notation
for dimension range,  and allow open documents exported by LO
properly by MS Office.

Change-Id: Idda1455d1f9db08ade0871110fe40be2667c176c
Reviewed-on: https://gerrit.libreoffice.org/30960
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 71862564df1422f84340e421bbef9060c4e41a71)
Reviewed-on: https://gerrit.libreoffice.org/31526
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
Reviewed-by: Justin Luth <justin_l...@sil.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index b2c41cc..52d6505 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -543,8 +543,30 @@ public:
 const 
css::uno::Sequence* pExternalLinks = nullptr,
 const OUString* pErrRef = nullptr );
 
-SC_DLLPUBLIC OUString Format(ScRefFlags nFlags = ScRefFlags::ZERO, const 
ScDocument* pDocument = nullptr,
- const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1) const;
+/** Returns string with formatted cell range from aStart to aEnd,
+according to provided address convention.
+@param nFlags
+Cell reference flags
+@param pDocument
+Pointer to document which is used for example to get tab names.
+@param rDetails
+Provide information about required address convention.
+Supported address conventions are:
+CONV_OOO  'doc'#sheet.A1:sheet2.B2
+CONV_XL_A1,   [doc]sheet:sheet2!A1:B2
+CONV_XL_OOX,  [#]sheet:sheet2!A1:B2
+CONV_XL_R1C1, [doc]sheet:sheet2!R1C1:R2C2
+@param bFullAddressNotation
+If TRUE, the full address notation will be used.
+For example in case all columns are used, "A1:AMJ177" is full 
address notation
+and "1:177" is shortened address notation.
+@returns
+String contains formatted cell range in address convention
+ */
+SC_DLLPUBLIC OUString Format( ScRefFlags nFlags = ScRefFlags::ZERO,
+  const ScDocument* pDocument = nullptr,
+  const ScAddress::Details& rDetails = 
ScAddress::detailsOOOa1,
+  bool bFullAddressNotation = false ) const;
 
 inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1,
  SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 134067c..62ad16e 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2166,7 +2166,7 @@ static inline bool lcl_RowAbsFlagDiffer(const ScRefFlags 
nFlags)
 }
 
 OUString ScRange::Format( ScRefFlags nFlags, const ScDocument* pDoc,
-  const ScAddress::Details& rDetails ) const
+  const ScAddress::Details& rDetails, bool 
bFullAddressNotation ) const
 {
 if( !( nFlags & ScRefFlags::VALID ) )
 {
@@ -2201,14 +2201,14 @@ OUString ScRange::Format( ScRefFlags nFlags, const 
ScDocument* pDoc,
 case formula::FormulaGrammar::CONV_XL_A1:
 case formula::FormulaGrammar::CONV_XL_OOX:
 lcl_ScRange_Format_XL_Header( r, *this, nFlags, pDoc, rDetails );
-if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL )
+if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL && !bFullAddressNotation 
)
 {
 // Full col refs always require 2 rows (2:2)
 lcl_a1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) 
!= ScRefFlags::ZERO );
 r.append(":");
 lcl_a1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != 
ScRefFlags::ZERO );
 }
-else if( aStart.Row() == 0 &am

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/hidden-empty-rows.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   19 +++
 sc/source/filter/excel/xetable.cxx|   16 +---
 sc/source/filter/inc/xetable.hxx  |2 +-
 4 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 7dd19273530730478b5ed24b79f42ac480c7ae43
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jun 17 16:21:06 2016 +0200

tdf#98106 Preserving hidden and empty rows after xlsx export

Change-Id: I1ff2bab766eadac1dd5d483453af0e760634083d
Reviewed-on: https://gerrit.libreoffice.org/26421
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 228c25fd17727660a3372307e3f73dbcff5e71d2)
Reviewed-on: https://gerrit.libreoffice.org/31640
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods
new file mode 100644
index 000..f3435ad
Binary files /dev/null and b/sc/qa/unit/data/ods/hidden-empty-rows.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 163c2b9..5055dcb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,8 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+void testHiddenEmptyRowsXLSX();
+
 void testInlineArrayXLS();
 void testEmbeddedChartXLS();
 void testCellAnchoredGroupXLS();
@@ -191,6 +193,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportODS);
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
+CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
 CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -469,6 +472,22 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testHiddenEmptyRowsXLSX()
+{
+//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to 
.XLSX
+ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", 
"false");
+}
+
 void ScExportTest::testDataBarExportXLSX()
 {
 ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 24b3230..b668eb8 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1997,15 +1997,14 @@ sal_uInt16 XclExpRow::GetFirstFreeXclCol() const
 
 bool XclExpRow::IsDefaultable() const
 {
-const sal_uInt16 nAllowedFlags = EXC_ROW_DEFAULTFLAGS | EXC_ROW_HIDDEN | 
EXC_ROW_UNSYNCED;
-return !::get_flag( mnFlags, static_cast< sal_uInt16 >( ~nAllowedFlags ) ) 
&& IsEmpty();
+const sal_uInt16 nFlagsAlwaysMarkedAsDefault = EXC_ROW_DEFAULTFLAGS | 
EXC_ROW_UNSYNCED;
+return !::get_flag( mnFlags, static_cast< sal_uInt16 >( 
~nFlagsAlwaysMarkedAsDefault ) ) && IsEmpty();
 }
 
 void XclExpRow::DisableIfDefault( const XclExpDefaultRowData& rDefRowData )
 {
 mbEnabled = !IsDefaultable() ||
 (mnHeight != rDefRowData.mnHeight) ||
-(IsHidden() != rDefRowData.IsHidden()) ||
 (IsUnsynced() != rDefRowData.IsUnsynced());
 }
 
@@ -2176,6 +2175,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 XclExpDefaultRowData aMaxDefData;
 size_t nMaxDefCount = 0;
 // only look for default format in existing rows, if there are more than 
unused
+// if the row is hidden, then row xml must be created even if it not 
contain cells
 XclExpRow* pPrev = nullptr;
 typedef std::vector< XclExpRow* > XclRepeatedRows;
 XclRepeatedRows aRepeated;
@@ -2183,7 +2183,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 for (itr = itrBeg; itr != itrEnd; ++itr)
 {
 const RowRef& rRow = itr->second;
-if (rRow->IsDefaultable())
+if ( rRow->IsDefaultable() )
 {
 XclExpDefaultRowData aDefData( *rRow )

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/hidden-empty-rows.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   17 +
 2 files changed, 17 insertions(+)

New commits:
commit 91328bab6f47dc9659a2124a73d88ff3d7ba4279
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jul 2 03:29:26 2016 +0200

tdf#48767 Fix orientation issue after export to .xlsx

After save to .xlsx in usePrinterDefaults was added into PageSetup.
Due to bug in MS Excel, when usePrinterDefaults is present,
(no matter what value), the orientation of the Page is alway "portrait".
To resolve that issue, if usePrinterDefaults is set to default value,
then usePrinterDefaults XML field is not added during export to .xlsx

Change-Id: I3ab310babb278913bce3d66f7fae1192ed9727b9
Reviewed-on: https://gerrit.libreoffice.org/26871
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 46094ff4b0ea06931f2af3fc45d00fd38c3ebf26)
Reviewed-on: https://gerrit.libreoffice.org/31641
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods
index f3435ad..1e3017e 100644
Binary files a/sc/qa/unit/data/ods/hidden-empty-rows.ods and 
b/sc/qa/unit/data/ods/hidden-empty-rows.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 5055dcb..f9059ee 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -111,6 +111,7 @@ public:
 void testFormatExportODS();
 
 void testHiddenEmptyRowsXLSX();
+void testLandscapeOrientationXLSX();
 
 void testInlineArrayXLS();
 void testEmbeddedChartXLS();
@@ -194,6 +195,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
 CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -488,6 +490,21 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", 
"false");
 }
 
+void ScExportTest::testLandscapeOrientationXLSX()
+{
+//tdf#48767 - Landscape page orientation is not loaded from .xlsx format 
with MS Excel, after export with Libre Office
+ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// the usePrinterDefaults cannot be saved to allow opening sheets in 
Landscape mode via MS Excel
+assertXPathNoAttribute(pSheet, "/x:worksheet/x:pageSetup", 
"usePrinterDefaults");
+assertXPath(pSheet, "/x:worksheet/x:pageSetup", "orientation", 
"landscape");
+}
+
 void ScExportTest::testDataBarExportXLSX()
 {
 ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/outline.ods   |binary
 sc/qa/unit/subsequent_export-test.cxx |  107 --
 sc/source/filter/excel/xetable.cxx|   10 ++-
 3 files changed, 97 insertions(+), 20 deletions(-)

New commits:
commit 740f369a90a7e524bfd2f82ba9cb350c190fe282
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jul 8 10:08:00 2016 +0200

tdf#51524 Preserve hidden column width after saving into .xlsx and .xls

Change-Id: I7f69a1e8f8ef46d8b0ab889df30498ec54917230
Reviewed-on: https://gerrit.libreoffice.org/27035
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit b0d96a82a4f6a0832d03d185f4a53db669adcc99)
Reviewed-on: https://gerrit.libreoffice.org/31643

diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods
index 320e318..ac951b7 100644
Binary files a/sc/qa/unit/data/ods/outline.ods and 
b/sc/qa/unit/data/ods/outline.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index cf94ac5..ddd2b99 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -479,7 +479,8 @@ void ScExportTest::testFormatExportODS()
 
 void ScExportTest::testOutlineExportXLSX()
 {
-//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are 
lost
+//tdf#100347 FILESAVE FILEOPEN after exporting to .xlsx format grouping 
are lost
+//tdf#51524  FILESAVE .xlsx and.xls looses width information for 
hidden/collapsed grouped columns
 ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS);
 CPPUNIT_ASSERT(xShell.Is());
 
@@ -487,71 +488,143 @@ void ScExportTest::testOutlineExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
+// First XML node, creates two columns (from min=1 to max=2)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2");
+
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "3");
+
+// Column 4 has custom width and it is hidden. We need to make sure that 
it is created
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "4");
+
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "3");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "5");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "6");
+
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "4");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/custom_column_width.ods |binary
 sc/qa/unit/subsequent_export-test.cxx   |   96 
 sc/qa/unit/subsequent_filters-test.cxx  |2 
 sc/source/filter/excel/xetable.cxx  |   19 -
 sc/source/filter/excel/xltools.cxx  |5 -
 sc/source/filter/inc/xetable.hxx|4 +
 sc/source/filter/inc/xltools.hxx|1 
 sc/source/filter/oox/worksheethelper.cxx|3 
 8 files changed, 122 insertions(+), 8 deletions(-)

New commits:
commit 02d93c7a53f55f0416d321b3cddfb8b6fc9e6c59
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Jul 19 00:26:54 2016 +0200

tdf#100946 Fix width calculation and add customWidth support (.xlsx)

On some MS Excel version (OS X), the column "width" is
not applied, if "customWidth" key (in "col") is not set to "true".
It means that in case of .xlsx files, exported by LibreOffice,
all columns have default width. To resolve that "customWidth"
key was added during export into .xlsx file format.
During development it appears that Default Column Width is wrongly
calculated, and it was done not according to MS documentation.
This issue was also fixed. After fix default column width is
properly set.
MS documentation:

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column.aspx

Change-Id: I0d1944081a5ea445d1e4284db62e9b4d504bf1c0
(cherry picked from commit 40d892a2db4d750aaf0562c63004e693c028273c)
Reviewed-on: https://gerrit.libreoffice.org/31645
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/data/ods/custom_column_width.ods 
b/sc/qa/unit/data/ods/custom_column_width.ods
new file mode 100644
index 000..cab589b
Binary files /dev/null and b/sc/qa/unit/data/ods/custom_column_width.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ddd2b99..eb4f61d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,7 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+void testCustomColumnWidthExportXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testLandscapeOrientationXLSX();
@@ -196,6 +197,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
 
+CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
@@ -477,6 +479,100 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+
+void ScExportTest::testCustomColumnWidthExportXLSX()
+{
+//tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last 
saved by LO
+ScDocShellRef xShell = loadDoc("custom_column_width.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// First column, has everything default
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", 
"false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1");
+
+// Second column, has custom width
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "2");
+
+// Third column, has everything default
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/outline.ods   |binary
 sc/qa/unit/subsequent_export-test.cxx |   81 ++
 sc/source/filter/excel/xetable.cxx|   18 +--
 sc/source/filter/inc/xetable.hxx  |3 -
 4 files changed, 95 insertions(+), 7 deletions(-)

New commits:
commit 21d340948d564c819e24edd96051c42a9ca2c78e
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Jun 24 02:10:25 2016 +0200

tdf#100347 Fix Outline export into XLSX format

In previous XLSX export implementation the outline
for column was not saved. Also rows without cell content
was not saved if it was collapsed or outline level was set.
This commit resolve all such issues

Change-Id: I401f23e97f4803209fcd31c7d93baca3bd2a2385
Reviewed-on: https://gerrit.libreoffice.org/26625
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit cc503abb860c33a54a188640a5962dbdf7052284)
Reviewed-on: https://gerrit.libreoffice.org/31642
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods
index bca7d14..320e318 100644
Binary files a/sc/qa/unit/data/ods/outline.ods and 
b/sc/qa/unit/data/ods/outline.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index f9059ee..cf94ac5 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,7 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testLandscapeOrientationXLSX();
 
@@ -194,6 +195,8 @@ public:
 CPPUNIT_TEST(testCellNoteExportODS);
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
+
+CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
@@ -474,6 +477,84 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testOutlineExportXLSX()
+{
+//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are 
lost
+ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "collapsed", "true");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "hidden", "false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "outlineLevel", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "collapsed", "false");
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/source/filter/excel/xetable.cxx |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 8ec7c5e332c30d807a0ed0b765e44559181c91a2
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Aug 7 13:58:21 2016 +0200

tdf#101363 Fix precision of column width according to MS specification

In MS specification the output value is set with double precision after 
delimiter, according to formula:
 =Truncate(({width in pixels} - 5)/{Maximum Digit Width} * 100 + 0.5)/100

Explanation of magic numbers:
 - 5 number - are 4 pixels of margin padding (two on each side), plus 1 
pixel padding for the gridlines. It is still unknown if it should be applied 
during LibreOffice export
 - 100 number - used to limit precision to 0.01 with formula =Truncate( 
{value} * 100 ) / 100
 - 0.5 number (0.005 to output value) - used to increase value before 
truncating, to avoid situation when 2.997 will be truncated to 2.99 and not to 3

Benefits of limited precision:
- small .xlsx file size
- slightly better performance during .xlsx import
- easier to track column width changes, especially in unit tests
- according to MS Excel specification

Change-Id: I0537df5f9d04f5c715784c2b0c4e0d4472904dcc
Reviewed-on: https://gerrit.libreoffice.org/27932
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 12408dad1b2af4055b91439e3cfbe46e0df52b41)
Reviewed-on: https://gerrit.libreoffice.org/31646
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index fb3f7f7..fc15a63 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1669,17 +1669,28 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
 if( nLastXclCol == static_cast< sal_uInt16 >( 
rStrm.GetRoot().GetMaxPos().Col() ) )
 ++nLastXclCol;
 
+const double nExcelColumnWidth = mnScWidth  / static_cast< double >( 
sc::TwipsToHMM( GetCharWidth() ) );
+
+// tdf#101363 In MS specification the output value is set with double 
precision after delimiter:
+// =Truncate(({width in pixels} - 5)/{Maximum Digit Width} * 100 + 0.5)/100
+// Explanation of magic numbers:
+// 5 number - are 4 pixels of margin padding (two on each side), plus 1 
pixel padding for the gridlines.
+//It is unknown if it should be applied during LibreOffice 
export
+// 100 number - used to limit precision to 0.01 with formula =Truncate( 
{value}*100+0.5 ) / 100
+// 0.5 number (0.005 to output value) - used to increase value before 
truncating,
+//to avoid situation when 2.997 will be truncated to 2.99 and 
not to 3.00
+const double nTruncatedExcelColumnWidth = std::trunc( nExcelColumnWidth * 
100.0 + 0.5 ) / 100.0;
 rStrm.GetCurrentStream()->singleElement( XML_col,
 // OOXTODO: XML_bestFit,
 XML_collapsed,  XclXmlUtils::ToPsz( ::get_flag( mnFlags, 
EXC_COLINFO_COLLAPSED ) ),
 XML_customWidth,XclXmlUtils::ToPsz( mbCustomWidth ),
 XML_hidden, XclXmlUtils::ToPsz( ::get_flag( mnFlags, 
EXC_COLINFO_HIDDEN ) ),
 XML_outlineLevel,   OString::number( mnOutlineLevel ).getStr(),
-XML_max,OString::number( (nLastXclCol + 1) ).getStr(),
-XML_min,OString::number( (mnFirstXclCol + 1) 
).getStr(),
+XML_max,OString::number( nLastXclCol + 1 ).getStr(),
+XML_min,OString::number( mnFirstXclCol + 1 ).getStr(),
 // OOXTODO: XML_phonetic,
 XML_style,  lcl_GetStyleId( rStrm, maXFId.mnXFIndex 
).getStr(),
-XML_width,  OString::number( (double) (mnScWidth / 
(double)sc::TwipsToHMM( GetCharWidth() )) ).getStr(),
+XML_width,  OString::number( nTruncatedExcelColumnWidth 
).getStr(),
 FSEND );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/subsequent_export-test.cxx  |5 +
 sc/source/filter/excel/xetable.cxx |   27 ---
 sc/source/filter/inc/xetable.hxx   |6 +-
 sc/source/filter/oox/worksheetfragment.cxx |5 +
 4 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 517eddcbfd8dd5d6da50210a12ba917998897bbf
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Jul 26 18:14:30 2016 +0200

tdf#101135 FILESAVE .xlsx Save XML_outlineLevelRow, XML_outlineLevelCol keys

In .xlsx, the XML_outlineLevelRow and XML_outlineLevelCol keys
are required for Microsoft Office365 application
to properly displaying Outline values.

Change-Id: If4184ddc4fbfaa409732ddb0fb4ca85b4a27b024
(cherry picked from commit ad121df71ad463bed8caf147d27f020b548f0862)
Reviewed-on: https://gerrit.libreoffice.org/31644
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index eb4f61d..75ac9d3 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -584,6 +584,11 @@ void ScExportTest::testOutlineExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
+// Maximum Outline Row is 4 for this document
+assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelRow", 
"4");
+// Maximum Outline Column is 4 for this document
+assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelCol", 
"4");
+
 // First XML node, creates two columns (from min=1 to max=2)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index fc15a63..287024a 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1697,7 +1697,8 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
 XclExpColinfoBuffer::XclExpColinfoBuffer( const XclExpRoot& rRoot ) :
 XclExpRoot( rRoot ),
 maDefcolwidth( rRoot ),
-maOutlineBfr( rRoot )
+maOutlineBfr( rRoot ),
+maHighestOutlineLevel( 0 )
 {
 }
 
@@ -1705,7 +1706,13 @@ void XclExpColinfoBuffer::Initialize( SCROW nLastScRow )
 {
 
 for( sal_uInt16 nScCol = 0, nLastScCol = GetMaxPos().Col(); nScCol <= 
nLastScCol; ++nScCol )
+{
 maColInfos.AppendNewRecord( new XclExpColinfo( GetRoot(), nScCol, 
nLastScRow, maOutlineBfr ) );
+if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
+{
+   maHighestOutlineLevel = maOutlineBfr.GetLevel();
+}
+}
 }
 
 void XclExpColinfoBuffer::Finalize( ScfUInt16Vec& rXFIndexes )
@@ -2122,7 +2129,8 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm )
 XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) :
 XclExpRoot( rRoot ),
 maOutlineBfr( rRoot ),
-maDimensions( rRoot )
+maDimensions( rRoot ),
+maHighestOutlineLevel( 0 )
 {
 }
 
@@ -2368,6 +2376,10 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 
nXclRow, bool bRowAlwaysE
  ( maOutlineBfr.GetLevel() != 0 ) ||
  ( rDoc.RowHidden(nFrom, nScTab) ) )
 {
+if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
+{
+maHighestOutlineLevel = maOutlineBfr.GetLevel();
+}
 RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, 
bRowAlwaysEmpty));
 maRowMap.insert(RowMap::value_type(nFrom, p));
 }
@@ -2652,7 +2664,16 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm )
 XclExpDefaultRowData& rDefData = mxDefrowheight->GetDefaultData();
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
 rWorksheet->startElement( XML_sheetFormatPr,
-XML_defaultRowHeight, OString::number( (double) rDefData.mnHeight / 
20.0 ).getStr(), FSEND );
+// OOXTODO: XML_baseColWidth
+// OOXTODO: XML_defaultColWidth
+// OOXTODO: XML_customHeight
+// OOXTODO: XML_zeroHeight
+// OOXTODO: XML_thickTop
+// OOXTODO: XML_thickBottom
+XML_defaultRowHeight, OString::number( static_cast< double> ( 
rDefData.mnHeight ) / 20.0 ).getStr(),
+XML_outlineLevelRow, OString::number( 
maRowBfr.GetHighestOutlineLevel() ).getStr(),
+XML_outlineLevelCol, OString::number( 
maColInfoBfr.GetHighestOutlineLevel() ).getStr(),
+FSEND );
 rWorksheet->endElement( XML_sheetFormatPr

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - 2 commits - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/different-column-width.ods |binary
 sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx |binary
 sc/qa/unit/data/xlsx/xf_default_values.xlsx|binary
 sc/qa/unit/subsequent_export-test.cxx  |  138 -
 sc/source/filter/oox/stylesbuffer.cxx  |1 
 sc/source/filter/oox/worksheethelper.cxx   |   22 --
 6 files changed, 137 insertions(+), 24 deletions(-)

New commits:
commit 962b53a3a36c388d7fa9706541e3d630292861c4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Aug 8 01:13:05 2016 +0200

tdf#91475 Fix column width during .xlsx export

With commit 16726a1b37df8bdcae02b3c7699df814977222bd the new import 
algorithm
was introduced. Unfortunately it looks like that some specific column width
are improved, but for other widths it is worse.
More information is available at:
https://bugs.documentfoundation.org/show_bug.cgi?id=91475#c29

In this commit I added unit tests which prooves proper working of old
algorithm and I have switched to old algorithm.
Unit test which was done:
 1. After resave .xlsx file, the column width values did not change
 2. After export .ods to .xlsx displayed column width did not change
 3. After save .xlsx to .ods displayed column width did not change

This commit resolve column width after exporting to .xlsx, and
correctly preserve column width for LibreOffice.

Reviewed-on: https://gerrit.libreoffice.org/27943
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit f2a75fecdfb5d92d27074312f29dc7dc4afb16ec)

 Conflicts:
sc/source/filter/oox/worksheethelper.cxx

Change-Id: I26d074b203d08a4bf4e9e31e52dbfd7ca7d3beb1
Reviewed-on: https://gerrit.libreoffice.org/31648
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/data/ods/different-column-width.ods 
b/sc/qa/unit/data/ods/different-column-width.ods
new file mode 100644
index 000..3f2e34c
Binary files /dev/null and b/sc/qa/unit/data/ods/different-column-width.ods 
differ
diff --git a/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx
new file mode 100644
index 000..93f133f
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 758c86b..efcb38f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -112,6 +112,8 @@ public:
 
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
+void testColumnWidthResaveXLSX();
+void testColumnWidthExportFromODStoXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testLandscapeOrientationXLSX();
@@ -200,6 +202,8 @@ public:
 
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
+CPPUNIT_TEST(testColumnWidthResaveXLSX);
+CPPUNIT_TEST(testColumnWidthExportFromODStoXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
@@ -491,7 +495,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
-// First column, has everything default
+// First column, has everything default (width in Calc: 1280)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", 
"false");
@@ -499,7 +503,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1");
 
-// Second column, has custom width
+// Second column, has custom width (width in Calc: 1225)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true");
@@ -507,7 +511,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPat

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

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/different-column-width.ods |binary
 sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |  112 -
 sc/source/filter/oox/worksheethelper.cxx   |   22 --
 4 files changed, 111 insertions(+), 23 deletions(-)

New commits:
commit f2a75fecdfb5d92d27074312f29dc7dc4afb16ec
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Aug 8 01:13:05 2016 +0200

tdf#91475 Fix column width during .xlsx export

With commit 16726a1b37df8bdcae02b3c7699df814977222bd the new import 
algorithm
was introduced. Unfortunately it looks like that some specific column width
are improved, but for other widths it is worse.
More information is available at:
https://bugs.documentfoundation.org/show_bug.cgi?id=91475#c29

In this commit I added unit tests which prooves proper working of old
algorithm and I have switched to old algorithm.
Unit test which was done:
 1. After resave .xlsx file, the column width values did not change
 2. After export .ods to .xlsx displayed column width did not change
 3. After save .xlsx to .ods displayed column width did not change

This commit resolve column width after exporting to .xlsx, and
correctly preserve column width for LibreOffice.

Change-Id: I26d074b203d08a4bf4e9e31e52dbfd7ca7d3beb1
Reviewed-on: https://gerrit.libreoffice.org/27943
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/different-column-width.ods 
b/sc/qa/unit/data/ods/different-column-width.ods
new file mode 100644
index 000..3f2e34c
Binary files /dev/null and b/sc/qa/unit/data/ods/different-column-width.ods 
differ
diff --git a/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx
new file mode 100644
index 000..93f133f
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ab80b09..50bb2a6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,8 @@ public:
 
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
+void testColumnWidthResaveXLSX();
+void testColumnWidthExportFromODStoXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testEmptyRowsWithBackgroundColorXLSX();
@@ -209,6 +211,8 @@ public:
 
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
+CPPUNIT_TEST(testColumnWidthResaveXLSX);
+CPPUNIT_TEST(testColumnWidthExportFromODStoXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testEmptyRowsWithBackgroundColorXLSX);
@@ -505,7 +509,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
-// First column, has everything default
+// First column, has everything default (width in Calc: 1280)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", 
"false");
@@ -513,7 +517,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1");
 
-// Second column, has custom width
+// Second column, has custom width (width in Calc: 1225)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true");
@@ -521,7 +525,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "2");
 
-// Third column, has everything default
+// Third column, has everything default (width in Calc: 1280)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", &

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/qa sc/source

2016-12-05 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/different-column-width.ods |binary
 sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |  112 -
 sc/source/filter/oox/worksheethelper.cxx   |   22 --
 4 files changed, 111 insertions(+), 23 deletions(-)

New commits:
commit 8a92f539bae8e2253f1e926a38bf0d669384c13d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Aug 8 01:13:05 2016 +0200

tdf#91475 Fix column width during .xlsx export

With commit 16726a1b37df8bdcae02b3c7699df814977222bd the new import 
algorithm
was introduced. Unfortunately it looks like that some specific column width
are improved, but for other widths it is worse.
More information is available at:
https://bugs.documentfoundation.org/show_bug.cgi?id=91475#c29

In this commit I added unit tests which prooves proper working of old
algorithm and I have switched to old algorithm.
Unit test which was done:
 1. After resave .xlsx file, the column width values did not change
 2. After export .ods to .xlsx displayed column width did not change
 3. After save .xlsx to .ods displayed column width did not change

This commit resolve column width after exporting to .xlsx, and
correctly preserve column width for LibreOffice.

Change-Id: I26d074b203d08a4bf4e9e31e52dbfd7ca7d3beb1
Reviewed-on: https://gerrit.libreoffice.org/27943
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit f2a75fecdfb5d92d27074312f29dc7dc4afb16ec)
Reviewed-on: https://gerrit.libreoffice.org/31625

diff --git a/sc/qa/unit/data/ods/different-column-width.ods 
b/sc/qa/unit/data/ods/different-column-width.ods
new file mode 100644
index 000..3f2e34c
Binary files /dev/null and b/sc/qa/unit/data/ods/different-column-width.ods 
differ
diff --git a/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx
new file mode 100644
index 000..93f133f
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/different-column-width-excel2010.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ab80b09..50bb2a6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -110,6 +110,8 @@ public:
 
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
+void testColumnWidthResaveXLSX();
+void testColumnWidthExportFromODStoXLSX();
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
 void testEmptyRowsWithBackgroundColorXLSX();
@@ -209,6 +211,8 @@ public:
 
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
+CPPUNIT_TEST(testColumnWidthResaveXLSX);
+CPPUNIT_TEST(testColumnWidthExportFromODStoXLSX);
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
 CPPUNIT_TEST(testEmptyRowsWithBackgroundColorXLSX);
@@ -505,7 +509,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
-// First column, has everything default
+// First column, has everything default (width in Calc: 1280)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", 
"false");
@@ -513,7 +517,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1");
 
-// Second column, has custom width
+// Second column, has custom width (width in Calc: 1225)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true");
@@ -521,7 +525,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "2");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "2");
 
-// Third column, has everything default
+// Third column, has everything default (width in Calc: 1280)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[

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

2017-01-03 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/comment.ods   |binary
 sc/qa/unit/subsequent_export-test.cxx |   21 +
 sc/source/filter/excel/xeescher.cxx   |3 +++
 3 files changed, 24 insertions(+)

New commits:
commit 36cdf3c35459df63ce137e550a6840a61865c0ca
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Dec 17 10:53:12 2016 +0100

tdf#104729 FILESAVE Save author name in comment during export to .xlsx

Change-Id: I59d46f6a713e4f252844cda0f631ace239d73cdb
Reviewed-on: https://gerrit.libreoffice.org/32115
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/ods/comment.ods b/sc/qa/unit/data/ods/comment.ods
new file mode 100644
index 000..b772a6f
Binary files /dev/null and b/sc/qa/unit/data/ods/comment.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 67b77fb..56c749c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -108,6 +108,8 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
+
+void testCommentExportXLSX();
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
 void testColumnWidthResaveXLSX();
@@ -208,6 +210,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
 
+CPPUNIT_TEST(testCommentExportXLSX);
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
 CPPUNIT_TEST(testColumnWidthResaveXLSX);
@@ -497,6 +500,24 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+
+void ScExportTest::testCommentExportXLSX()
+{
+//tdf#104729 FILESAVE OpenOffice do not save author of the comment during 
export to .xlsx
+ScDocShellRef xShell = loadDoc("comment.", FORMAT_ODS);
+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);
+
+assertXPath(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
+assertXPath(pSheet, "/x:comments/x:authors/x:author", 1);
+
+assertXPath(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", 
"Komentarz");
+
+}
+
 void ScExportTest::testCustomColumnWidthExportXLSX()
 {
 //tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last 
saved by LO
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 3e179d2..35fe29f 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1190,6 +1190,7 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const 
ScAddress& rScPos,
 {
 // TODO: additional text
 if( pScNote )
+{
 if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( 
maScPos ) )
 {
 lcl_GetFromTo( rRoot, pCaption->GetLogicRect(), 
maScPos.Tab(), maCommentFrom, maCommentTo );
@@ -1208,6 +1209,8 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const 
ScAddress& rScPos,
 mbRowHidden = 
(rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab()));
 mbColHidden = 
(rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab()));
 }
+maAuthor = XclExpString( pScNote->GetAuthor() );
+}
 
 SetRecSize( 9 + maAuthor.GetSize() );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-01 Thread Bartosz Kosiorek
 vcl/source/filter/wmf/enhwmf.cxx |   45 ++-
 1 file changed, 30 insertions(+), 15 deletions(-)

New commits:
commit 56ee0a940915e882c9eaa5c365c10231f328ff93
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Mar 31 22:30:33 2017 +0200

Get rid of magic numbers

Change-Id: Ia9ccacc3a21c837e69e3901e262cdd052e4be3f3
Reviewed-on: https://gerrit.libreoffice.org/35982
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index d07e96fe394e..0d8a9b0d1cd1 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -104,7 +104,12 @@ using namespace std;
 #define EMR_SELECTCLIPPATH  67
 #define EMR_ABORTPATH   68
 
-#define EMR_GDICOMMENT  70
+#define EMR_COMMENT 70  // Contains arbitrary 
private data.
+// Comment Identifiers:
+#define EMR_COMMENT_EMFPLUS 0x2B464D45  // Contains embedded EMF+ 
records.
+#define EMR_COMMENT_EMFSPOOL0x  // Contains embedded 
EMFSPOOL records.
+#define EMR_COMMENT_PUBLIC  0x43494447  // Specify extensions to 
EMF processing.
+
 #define EMR_FILLRGN 71
 #define EMR_FRAMERGN72
 #define EMR_INVERTRGN   73
@@ -240,7 +245,7 @@ record_type_name(sal_uInt32 nRecType)
 case EMR_WIDENPATH: return "WIDENPATH";
 case EMR_SELECTCLIPPATH: return "SELECTCLIPPATH";
 case EMR_ABORTPATH: return "ABORTPATH";
-case EMR_GDICOMMENT: return "GDICOMMENT";
+case EMR_COMMENT: return "COMMENT";
 case EMR_FILLRGN: return "FILLRGN";
 case EMR_FRAMERGN: return "FRAMERGN";
 case EMR_INVERTRGN: return "INVERTRGN";
@@ -454,8 +459,10 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, 
bool& bHaveDC)
 
 SAL_INFO ("vcl.emf", "\t\tEMF+ record type: " << std::hex << type << 
std::dec);
 
-// GetDC
-if( type == 16388 ) {
+// Get Device Context
+// TODO We should use  EmfPlusRecordType::GetDC instead
+if( type == 0x4004 )
+{
 bHaveDC = true;
 SAL_INFO ("vcl.emf", "\t\tEMF+ lock DC (device context)");
 }
@@ -675,7 +682,7 @@ bool EnhWMFReader::ReadEnhWMF()
 
 SAL_INFO ("vcl.emf", "0x" << std::hex << (nNextPos - nRecSize) <<  
"-0x" << nNextPos << " " << record_type_name(nRecType) << " size: " <<  
nRecSize << std::dec);
 
-if( bEnableEMFPlus && nRecType == EMR_GDICOMMENT ) {
+if( bEnableEMFPlus && nRecType == EMR_COMMENT ) {
 sal_uInt32 length;
 
 pWMF->ReadUInt32( length );
@@ -683,22 +690,30 @@ bool EnhWMFReader::ReadEnhWMF()
 SAL_INFO("vcl.emf", "\tGDI comment, length: " << length);
 
 if( pWMF->good() && length >= 4 && length <= pWMF->remainingSize() 
) {
-sal_uInt32 id;
+sal_uInt32 nCommentId;
 
-pWMF->ReadUInt32( id );
+pWMF->ReadUInt32( nCommentId );
 
-SAL_INFO ("vcl.emf", "\t\tbegin " << (char)(id & 0xff) << 
(char)((id & 0xff00) >> 8) << (char)((id & 0xff) >> 16) << (char)((id & 
0xff00) >> 24) << " id: 0x" << std::hex << id << std::dec);
+SAL_INFO ("vcl.emf", "\t\tbegin " << (char)(nCommentId & 0xff) 
<< (char)((nCommentId & 0xff00) >> 8) << (char)((nCommentId & 0xff) >> 16) 
<< (char)((nCommentId & 0xff00) >> 24) << " id: 0x" << std::hex << 
nCommentId << std::dec);
 
-// EMF+ comment (FIXME: BE?)
-if( id == 0x2B464D45 && nRecSize >= 12 )
+if( nCommentId == EMR_COMMENT_EMFPLUS && nRecSize >= 12 )
+{
 // [MS-EMF] 2.3.3: DataSize includes both 
CommentIdentifier and CommentRecordParm fields.
 // We have already read 4-byte CommentIdentifier, so 
reduce length appropriately
 ReadEMFPlusComment( length-4, bHaveDC );
-// GDIC comment, doesn't do anything useful yet
-else if( id == 0x43494447 && nRecSize >= 12 ) {
+}
+else if( nCommentId == EMR_COMMENT_PUBLIC && nRecSize >= 12 )
+{
 // TODO: ReadGDIComment(

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

2017-04-06 Thread Bartosz Kosiorek
 sc/qa/unit/data/ods/ceiling-floor.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   18 ++
 2 files changed, 18 insertions(+)

New commits:
commit d5215e0e58febf582b18ad38f5745f8ae924cc1f
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Mar 23 00:24:34 2017 +0100

unit test for CEILING and FLOOR .xlsx export, tdf#100011

Change-Id: I2ce45db4ae905dedf7c3dc8fb0fd9519ace6c3aa
Reviewed-on: https://gerrit.libreoffice.org/35549
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/data/ods/ceiling-floor.ods 
b/sc/qa/unit/data/ods/ceiling-floor.ods
new file mode 100644
index ..051518b6fc4a
Binary files /dev/null and b/sc/qa/unit/data/ods/ceiling-floor.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ffb3bbf15157..6cc4bbb407a1 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -144,9 +144,11 @@ public:
 
 void testCeilingFloor( sal_uLong nFormatType );
 void testCeilingFloorXLSX();
+void testCeilingFloorODSToXLSX();
 void testCeilingFloorXLS();
 void testCeilingFloorODS();
 
+
 #if !defined _WIN32
 void testRelativePathsODS();
 #endif
@@ -239,6 +241,7 @@ public:
 CPPUNIT_TEST(testFunctionsExcel2010XLS);
 CPPUNIT_TEST(testFunctionsExcel2010ODS);
 CPPUNIT_TEST(testCeilingFloorXLSX);
+CPPUNIT_TEST(testCeilingFloorODSToXLSX);
 CPPUNIT_TEST(testCeilingFloorXLS);
 CPPUNIT_TEST(testCeilingFloorODS);
 #if !defined(_WIN32)
@@ -2723,6 +2726,20 @@ void ScExportTest::testCeilingFloorXLSX()
 testCeilingFloor(FORMAT_XLSX);
 }
 
+void ScExportTest::testCeilingFloorODSToXLSX()
+{
+// tdf#100011 - Cannot open sheet containg FLOOR/CEILING functions by MS 
Excel, after export to .xlsx
+ScDocShellRef xShell = loadDoc("ceiling-floor.", FORMAT_ODS);
+CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/workbook.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// there shouldn't be any defined names during export of FLOOR and CEILING 
functions to .xlsx
+assertXPath(pSheet, "/x:workbook/x:definedNames", 0);
+}
+
 void ScExportTest::testCeilingFloorXLS()
 {
 testCeilingFloor(FORMAT_XLS);
@@ -2733,6 +2750,7 @@ void ScExportTest::testCeilingFloorODS()
 testCeilingFloor(FORMAT_ODS);
 }
 
+
 #if !defined _WIN32
 void ScExportTest::testRelativePathsODS()
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-11 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   63 +++
 1 file changed, 32 insertions(+), 31 deletions(-)

New commits:
commit a45feba83e5fb35eee1884887e8dbe795ebacde5
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 14:43:44 2017 +0200

tdf#107016 EMF+ Add support of import EmfPlusRecordTypeDrawRects record

EmfPlusDrawRectss record defines the pen strokes for drawing a series of 
rectangles.

Change-Id: Iaa061f8502fb51de44d2e65a1c92daf297b79d2b
Reviewed-on: https://gerrit.libreoffice.org/36261
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index f242e31eed62..7c33b28c213d 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -68,6 +68,7 @@ namespace
 #define EmfPlusRecordTypeObject 0x4008
 //TODO EmfPlusRecordTypeClear 0x4009
 #define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeDrawRects 0x400B
 #define EmfPlusRecordTypeFillPolygon 0x400C
 #define EmfPlusRecordTypeDrawLines 0x400D
 #define EmfPlusRecordTypeFillEllipse 0x400E
@@ -100,6 +101,7 @@ namespace
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeTranslateWorldTransform 0x402D
 //TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
@@ -145,6 +147,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeGetDC: return "EmfPlusRecordTypeGetDC";
 case EmfPlusRecordTypeObject: return "EmfPlusRecordTypeObject";
 case EmfPlusRecordTypeFillRects: return "EmfPlusRecordTypeFillRects";
+case EmfPlusRecordTypeDrawRects: return "EmfPlusRecordTypeDrawRects";
 case EmfPlusRecordTypeFillPolygon: return 
"EmfPlusRecordTypeFillPolygon";
 case EmfPlusRecordTypeDrawLines: return "EmfPlusRecordTypeDrawLines";
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
@@ -970,48 +973,46 @@ namespace cppcanvas
 }
 break;
 case EmfPlusRecordTypeFillRects:
+case EmfPlusRecordTypeDrawRects:
 {
-SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
-
-sal_uInt32 brushIndexOrColor;
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 sal_Int32 rectangles;
 bool isColor = (flags & 0x8000);
 ::basegfx::B2DPolygon polygon;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadInt32( 
rectangles );
+if ( type == EmfPlusRecordTypeFillRects )
+{
+SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+\t" << (isColor 
? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor << 
std::dec);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawRects");
+}
 
-SAL_INFO("cppcanvas.emf", "EMF+\t" << ((flags & 
0x8000) ? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor 
<< std::dec);
+rMF.ReadInt32( rectangles );
 
 for (int i=0; i < rectangles; i++) {
-if (flags & 0x4000) {
-/* 16bit integers */
-sal_Int16 x, y, width, height;
+float x, y, width, height;
+ReadRectangle (rMF, x, y, width, height, 
bool(flags & 0x4000));
 
-rMF.ReadInt16( x ).ReadInt16( y 
).ReadInt16( width ).ReadInt16( height );
+polygon.append (Map (x, y));
+polygon.append (Map (x + width, y));
+polygon.append (Map (x + width, y + height));
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   33 +++
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 9bd87273788216260ffb394889cf9a05540688f1
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 8 01:10:05 2017 +0200

tdf#107034 EMF+ Add support for import EmfPlusDrawPie record

The EmfPlusDrawPie record specifies drawing a section of the interior of an 
ellipse.

Change-Id: Icd9d64117cc612d348c531932931f31e4d04e567
Reviewed-on: https://gerrit.libreoffice.org/36286
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 2e7c94f5054dec4ab19c44209136c886793f0acb)
Reviewed-on: https://gerrit.libreoffice.org/36531

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 7ab9819026e0..a23de4d60a5b 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -65,7 +65,7 @@ namespace
 #define EmfPlusRecordTypeFillEllipse 0x400E
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
-//TODO EmfPlusRecordTypeDrawPie 0x4011
+#define EmfPlusRecordTypeDrawPie 0x4011
 //TODO EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
@@ -220,6 +220,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
+case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
@@ -1904,19 +1905,29 @@ namespace cppcanvas
 processObjectRecord (rMF, flags, dataSize);
 break;
 case EmfPlusRecordTypeFillPie:
+case EmfPlusRecordTypeDrawPie:
 {
-sal_uInt32 brushIndexOrColor;
 float startAngle, sweepAngle;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadFloat( 
startAngle ).ReadFloat( sweepAngle );
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 
-SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor << " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
+if ( type == EmfPlusRecordTypeFillPie )
+{
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
+}
+rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
 
 ReadRectangle (rMF, dx, dy, dw, dh, bool(flags & 
0x4000));
 
-SAL_INFO("cppcanvas.emf", "EMF+ RectData: " << dx 
<< "," << dy << " " << dw << "x" << dh);
+SAL_INFO("cppcanvas.emf", "EMF+\t RectData: " << 
dx << "," << dy << " " << dw << "x" << dh);
 
 startAngle = 2*M_PI*startAngle/360;
 sweepAngle = 2*M_PI*sweepAngle/360;
@@ -1935,15 +1946,21 @@ namespace cppcanvas
 if (sweepAngle < 0)
 std::swap (endAngle, startAngle);
 
-SAL_INFO("cppcanvas.emf", "EMF+ adjusted angles: 
start " <<
- (360.0*startAngle/M_PI) << ", end: " << 
(360.0*endAngle/M_PI));
+SAL_INFO("cppcanvas.emf", "EMF+\t adjusted angles: 
start " <<
+ (360.0*startAngle/M_PI) << ", end: " << 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   63 +++
 1 file changed, 32 insertions(+), 31 deletions(-)

New commits:
commit e3f09dcbd5e6aafe42d02c7b51497007abcdf1f7
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 14:43:44 2017 +0200

tdf#107016 EMF+ Add support of import EmfPlusRecordTypeDrawRects record

EmfPlusDrawRectss record defines the pen strokes for drawing a series of 
rectangles.

Change-Id: Iaa061f8502fb51de44d2e65a1c92daf297b79d2b
Reviewed-on: https://gerrit.libreoffice.org/36261
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit a45feba83e5fb35eee1884887e8dbe795ebacde5)
Reviewed-on: https://gerrit.libreoffice.org/36529

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index a23de4d60a5b..6ad240ba6832 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -60,6 +60,7 @@ namespace
 #define EmfPlusRecordTypeObject 0x4008
 //TODO EmfPlusRecordTypeClear 0x4009
 #define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeDrawRects 0x400B
 #define EmfPlusRecordTypeFillPolygon 0x400C
 #define EmfPlusRecordTypeDrawLines 0x400D
 #define EmfPlusRecordTypeFillEllipse 0x400E
@@ -92,6 +93,7 @@ namespace
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeTranslateWorldTransform 0x402D
 //TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
@@ -215,6 +217,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeGetDC: return "EmfPlusRecordTypeGetDC";
 case EmfPlusRecordTypeObject: return "EmfPlusRecordTypeObject";
 case EmfPlusRecordTypeFillRects: return "EmfPlusRecordTypeFillRects";
+case EmfPlusRecordTypeDrawRects: return "EmfPlusRecordTypeDrawRects";
 case EmfPlusRecordTypeFillPolygon: return 
"EmfPlusRecordTypeFillPolygon";
 case EmfPlusRecordTypeDrawLines: return "EmfPlusRecordTypeDrawLines";
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
@@ -2008,48 +2011,46 @@ namespace cppcanvas
 }
 break;
 case EmfPlusRecordTypeFillRects:
+case EmfPlusRecordTypeDrawRects:
 {
-SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
-
-sal_uInt32 brushIndexOrColor;
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 sal_Int32 rectangles;
 bool isColor = (flags & 0x8000);
 ::basegfx::B2DPolygon polygon;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadInt32( 
rectangles );
+if ( type == EmfPlusRecordTypeFillRects )
+{
+SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+\t" << (isColor 
? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor << 
std::dec);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawRects");
+}
 
-SAL_INFO("cppcanvas.emf", "EMF+\t" << ((flags & 
0x8000) ? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor 
<< std::dec);
+rMF.ReadInt32( rectangles );
 
 for (int i=0; i < rectangles; i++) {
-if (flags & 0x4000) {
-/* 16bit integers */
-sal_Int16 x, y, width, height;
-
-rMF.ReadInt16( x ).ReadInt16( y 
).ReadInt16( width ).ReadInt16( height );
-
-polygon.append (Map (x, y));
-polygon.append (Map (x + width, y));
-polygon.append (Map (x + width, y + 
height));
-  

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   50 ++-
 1 file changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 5eaa4feece4b3d0fba26cfe76d2be26e0f15c128
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 19:50:26 2017 +0200

tdf#107019 EMF+ Add support for import EmfPlusRecordTypeDrawBeziers record

EmfPlusDrawBeziers record defines the pen strokes for drawing a Bezier 
spline.

Change-Id: I6ae08a861bcbadd373741781af0011528947243e
Reviewed-on: https://gerrit.libreoffice.org/36280
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 9b693d896bf9a08cd8987e483f5269d6f2be1fd3)
Reviewed-on: https://gerrit.libreoffice.org/36533

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 6ad240ba6832..993d5c762c49 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -74,7 +75,7 @@ namespace
 //TODO EmfPlusRecordTypeFillClosedCurve 0x4016
 //TODO EmfPlusRecordTypeDrawClosedCurve 0x4017
 //TODO EmfPlusRecordTypeDrawCurve 0x4018
-//TODO EmfPlusRecordTypeDrawBeziers 0x4019
+#define EmfPlusRecordTypeDrawBeziers 0x4019
 #define EmfPlusRecordTypeDrawImage 0x401A
 #define EmfPlusRecordTypeDrawImagePoints 0x401B
 #define EmfPlusRecordTypeDrawString 0x401C
@@ -226,6 +227,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
+case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
 case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
 case EmfPlusRecordTypeDrawImagePoints: return 
"EmfPlusRecordTypeDrawImagePoints";
 case EmfPlusRecordTypeDrawString: return "EmfPlusRecordTypeDrawString";
@@ -2104,6 +2106,52 @@ namespace cppcanvas
 
 break;
 }
+case EmfPlusRecordTypeDrawBeziers:
+{
+sal_uInt32 aCount;
+float x1, y1, x2, y2, x3, y3, x4, y4;
+::basegfx::B2DPoint aStartPoint, aControlPointA, 
aControlPointB, aEndPoint;
+::basegfx::B2DPolygon aPolygon;
+rMF.ReadUInt32( aCount );
+
+SAL_INFO("cppcanvas.emf", "EMF+ DrawBeziers slot: 
" << (flags & 0xff) << "Number of points: " << aCount);
+
+SAL_WARN_IF( ( aCount - 1 ) % 3 != 0, 
"cppcanvas.emf", "EMF+\t Bezier Draw not support number of points other than 4, 
7, 10, 13, 16...");
+
+if( aCount < 4 )
+{
+SAL_WARN("cppcanvas.emf", "EMF+\t Bezier Draw 
does not support less than 4 points. Number of points: " << aCount);
+break;
+}
+
+ReadPoint (rMF, x1, y1, flags);
+// We need to add first starting point
+aStartPoint = Map (x1, y1);
+aPolygon.append( aStartPoint );
+
+for( sal_uInt32 i = 4; i <= aCount; i += 3 )
+{
+ReadPoint (rMF, x2, y2, flags);
+ReadPoint (rMF, x3, y3, flags);
+ReadPoint (rMF, x4, y4, flags);
+
+SAL_INFO("cppcanvas.emf", "EMF+\t Bezier 
points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << 
y3 << " " << x4 << "," << y4);
+
+aStartPoint = Map (x1, y1);
+aControlPointA = Map (x2, y2);
+aControlPointB = Map (x3, y3);
+aEndPoint = Map (x4, y4);
+
+::basegfx::B2DCubicBezier cubicBezier( 
aStartPoint, aControlPointA, aControlPointB, aEndPoint );
+cubicBezier.adaptiveSubdivideByDistance( 
aPolygon, 10.0 );
+EMFPPlusDrawPolygon( 
::basegfx::B2DPolyPolygon( aPolygon ),

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

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   33 +++
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 2e7c94f5054dec4ab19c44209136c886793f0acb
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 8 01:10:05 2017 +0200

tdf#107034 EMF+ Add support for import EmfPlusDrawPie record

The EmfPlusDrawPie record specifies drawing a section of the interior of an 
ellipse.

Change-Id: Icd9d64117cc612d348c531932931f31e4d04e567
Reviewed-on: https://gerrit.libreoffice.org/36286
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 73c488c2abba..618eddfa7915 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -75,7 +75,7 @@ namespace
 #define EmfPlusRecordTypeFillEllipse 0x400E
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
-//TODO EmfPlusRecordTypeDrawPie 0x4011
+#define EmfPlusRecordTypeDrawPie 0x4011
 //TODO EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
@@ -154,6 +154,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
+case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
@@ -888,19 +889,29 @@ namespace cppcanvas
 processObjectRecord (rMF, flags, dataSize);
 break;
 case EmfPlusRecordTypeFillPie:
+case EmfPlusRecordTypeDrawPie:
 {
-sal_uInt32 brushIndexOrColor;
 float startAngle, sweepAngle;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadFloat( 
startAngle ).ReadFloat( sweepAngle );
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 
-SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor << " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
+if ( type == EmfPlusRecordTypeFillPie )
+{
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
+}
+rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
 
 ReadRectangle (rMF, dx, dy, dw, dh, bool(flags & 
0x4000));
 
-SAL_INFO("cppcanvas.emf", "EMF+ RectData: " << dx 
<< "," << dy << " " << dw << "x" << dh);
+SAL_INFO("cppcanvas.emf", "EMF+\t RectData: " << 
dx << "," << dy << " " << dw << "x" << dh);
 
 startAngle = 2*M_PI*startAngle/360;
 sweepAngle = 2*M_PI*sweepAngle/360;
@@ -919,15 +930,21 @@ namespace cppcanvas
 if (sweepAngle < 0)
 std::swap (endAngle, startAngle);
 
-SAL_INFO("cppcanvas.emf", "EMF+ adjusted angles: 
start " <<
- (360.0*startAngle/M_PI) << ", end: " << 
(360.0*endAngle/M_PI));
+SAL_INFO("cppcanvas.emf", "EMF+\t adjusted angles: 
start " <<
+ (360.0*startAngle/M_PI) << ", end: " << 
(360.0*endAngle/M_PI) <<
+ " startAngle: " << startAngle << " 

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

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   50 ++-
 1 file changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 9b693d896bf9a08cd8987e483f5269d6f2be1fd3
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 19:50:26 2017 +0200

tdf#107019 EMF+ Add support for import EmfPlusRecordTypeDrawBeziers record

EmfPlusDrawBeziers record defines the pen strokes for drawing a Bezier 
spline.

Change-Id: I6ae08a861bcbadd373741781af0011528947243e
Reviewed-on: https://gerrit.libreoffice.org/36280
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 7c33b28c213d..73c488c2abba 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -82,7 +83,7 @@ namespace
 //TODO EmfPlusRecordTypeFillClosedCurve 0x4016
 //TODO EmfPlusRecordTypeDrawClosedCurve 0x4017
 //TODO EmfPlusRecordTypeDrawCurve 0x4018
-//TODO EmfPlusRecordTypeDrawBeziers 0x4019
+#define EmfPlusRecordTypeDrawBeziers 0x4019
 #define EmfPlusRecordTypeDrawImage 0x401A
 #define EmfPlusRecordTypeDrawImagePoints 0x401B
 #define EmfPlusRecordTypeDrawString 0x401C
@@ -155,6 +156,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
+case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
 case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
 case EmfPlusRecordTypeDrawImagePoints: return 
"EmfPlusRecordTypeDrawImagePoints";
 case EmfPlusRecordTypeDrawString: return "EmfPlusRecordTypeDrawString";
@@ -1066,6 +1068,52 @@ namespace cppcanvas
 
 break;
 }
+case EmfPlusRecordTypeDrawBeziers:
+{
+sal_uInt32 aCount;
+float x1, y1, x2, y2, x3, y3, x4, y4;
+::basegfx::B2DPoint aStartPoint, aControlPointA, 
aControlPointB, aEndPoint;
+::basegfx::B2DPolygon aPolygon;
+rMF.ReadUInt32( aCount );
+
+SAL_INFO("cppcanvas.emf", "EMF+ DrawBeziers slot: 
" << (flags & 0xff) << "Number of points: " << aCount);
+
+SAL_WARN_IF( ( aCount - 1 ) % 3 != 0, 
"cppcanvas.emf", "EMF+\t Bezier Draw not support number of points other than 4, 
7, 10, 13, 16...");
+
+if( aCount < 4 )
+{
+SAL_WARN("cppcanvas.emf", "EMF+\t Bezier Draw 
does not support less than 4 points. Number of points: " << aCount);
+break;
+}
+
+ReadPoint (rMF, x1, y1, flags);
+// We need to add first starting point
+aStartPoint = Map (x1, y1);
+aPolygon.append( aStartPoint );
+
+for( sal_uInt32 i = 4; i <= aCount; i += 3 )
+{
+ReadPoint (rMF, x2, y2, flags);
+ReadPoint (rMF, x3, y3, flags);
+ReadPoint (rMF, x4, y4, flags);
+
+SAL_INFO("cppcanvas.emf", "EMF+\t Bezier 
points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << 
y3 << " " << x4 << "," << y4);
+
+aStartPoint = Map (x1, y1);
+aControlPointA = Map (x2, y2);
+aControlPointB = Map (x3, y3);
+aEndPoint = Map (x4, y4);
+
+::basegfx::B2DCubicBezier cubicBezier( 
aStartPoint, aControlPointA, aControlPointB, aEndPoint );
+cubicBezier.adaptiveSubdivideByDistance( 
aPolygon, 10.0 );
+EMFPPlusDrawPolygon( 
::basegfx::B2DPolyPolygon( aPolygon ), rFactoryParms,
+ rState, rCanvas, flags & 
0xff );
+

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

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/inc/implrenderer.hxx|   33 +--
 cppcanvas/source/mtfrenderer/emfplus.cxx |   27 -
 2 files changed, 49 insertions(+), 11 deletions(-)

New commits:
commit fcb32f1cbc335a953cea62f66b9f50170263fb56
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 8 02:35:34 2017 +0200

tdf#106084 EMF+ Add support for EmfPlusTranslateWorldTransform record

The EmfPlusTranslateWorldTransform record performs a translation
on the current world space transform.

Change-Id: I3e5744060c8a6d758bcc2804c6798e0208d2191f
Reviewed-on: https://gerrit.libreoffice.org/36287
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index 0b584fad9a85..033882d15620 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -76,19 +76,26 @@ namespace cppcanvas
 };
 
 // EMF+
-// TODO: replace?
+// Transformation matrix (used for Affine Transformation)
+//  [ eM11, eM12, eDx ]
+//  [ eM21, eM22, eDy ]
+//  [ 0,0,1   ]
+// that consists of a linear map (eM11, eM12, eM21, eM22)
+// More info: https://en.wikipedia.org/wiki/Linear_map
+// followed by a translation (eDx, eDy)
+
 struct XForm
 {
-float   eM11;
-float   eM12;
-float   eM21;
-float   eM22;
-float   eDx;
-float   eDy;
+float   eM11; // M1,1 value in the matrix. Increases or decreases 
the size of the pixels horizontally.
+float   eM12; // M1,2 value in the matrix. This effectively angles 
the X axis up or down.
+float   eM21; // M2,1 value in the matrix. This effectively angles 
the Y axis left or right.
+float   eM22; // M2,2 value in the matrix. Increases or decreases 
the size of the pixels vertically.
+float   eDx;  // Delta x (Dx) value in the matrix. Moves the whole 
coordinate system horizontally.
+float   eDy;  // Delta y (Dy) value in the matrix. Moves the whole 
coordinate system vertically.
 XForm()
 {
 SetIdentity ();
-};
+}
 
 void SetIdentity ()
 {
@@ -106,14 +113,20 @@ namespace cppcanvas
 eDy  = f.eDy;
 }
 
+// Multiple two square matrices
+//  [ eM11, eM12, eDx ]   [ f.eM11, f.eM12, f.eDx ]
+//  [ eM21, eM22, eDy ] x [ f.eM21, f.eM22, f.eDy ]
+//  [ 0,0,1   ]   [ 0,  0,  1 ]
+// More information: 
https://en.wikipedia.org/wiki/Matrix_multiplication#Square_matrices
+// FIXME We shouldn't modify source matrix during computation
 void Multiply (const XForm& f)
 {
 eM11 = eM11*f.eM11 + eM12*f.eM21;
 eM12 = eM11*f.eM12 + eM12*f.eM22;
 eM21 = eM21*f.eM11 + eM22*f.eM21;
 eM22 = eM21*f.eM12 + eM22*f.eM22;
-eDx *= eDx*f.eM11  + eDy*f.eM21 + f.eDx;
-eDy *= eDx*f.eM12  + eDy*f.eM22 + f.eDy;
+eDx  = eDx*f.eM11  + eDy*f.eM21 + f.eDx;
+eDy  = eDx*f.eM12  + eDy*f.eM22 + f.eDy;
 }
 
 #ifdef OSL_BIGENDIAN
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 618eddfa7915..97f3a59928f3 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -102,7 +102,7 @@ namespace
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
-//TODO EmfPlusRecordTypeTranslateWorldTransform 0x402D
+#define EmfPlusRecordTypeTranslateWorldTransform 0x402D
 //TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
@@ -174,6 +174,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeSetWorldTransform: return 
"EmfPlusRecordTypeSetWorldTransform";
 case EmfPlusRecordTypeResetWorldTransform: return 
"EmfPlusRecordTypeResetWorldTransform";
 case EmfPlusRecordTypeMultiplyWorldTransform: return 
"EmfPlusRecordTypeMultiplyWorldTransform";
+case EmfPlusRecordTypeTranslateWorldTransform: return 
"EmfPlusRecordTypeTranslateWorldTransform";
 case EmfPlusRecordTypeSetPageTransform: return 
"EmfPlusRecordTypeSetPageTransform";
 case EmfPlusRecordTypeSetClipRect: return 
"EmfPlusRecordTypeSetClipRect";
 case EmfPlusRecordTypeSetClipPath: 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   88 +++
 1 file changed, 55 insertions(+), 33 deletions(-)

New commits:
commit 0b8263c8efd7851eb0c9d2a12436adc96c78fcd5
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 13:24:41 2017 +0200

Replace EmfPlusRecordType decimal value with hex

Change-Id: Ia5f248282e663e86b76a8c90fb5dd55d112f6912
Reviewed-on: https://gerrit.libreoffice.org/36260
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 723ee43cf65f85d7b586ae8c98529a22621054a3)
Reviewed-on: https://gerrit.libreoffice.org/36523

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 0b31a3a96a87..7ab9819026e0 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -50,39 +50,61 @@
 namespace
 {
 
-#define EmfPlusRecordTypeHeader 16385
-#define EmfPlusRecordTypeEndOfFile 16386
-#define EmfPlusRecordTypeGetDC 16388
-#define EmfPlusRecordTypeObject 16392
-#define EmfPlusRecordTypeFillRects 16394
-#define EmfPlusRecordTypeFillPolygon 16396
-#define EmfPlusRecordTypeDrawLines 16397
-#define EmfPlusRecordTypeFillEllipse 16398
-#define EmfPlusRecordTypeDrawEllipse 16399
-#define EmfPlusRecordTypeFillPie 16400
-#define EmfPlusRecordTypeFillPath 16404
-#define EmfPlusRecordTypeDrawPath 16405
-#define EmfPlusRecordTypeDrawImage 16410
-#define EmfPlusRecordTypeDrawImagePoints 16411
-#define EmfPlusRecordTypeDrawString 16412
-#define EmfPlusRecordTypeSetRenderingOrigin 16413
-#define EmfPlusRecordTypeSetAntiAliasMode 16414
-#define EmfPlusRecordTypeSetTextRenderingHint 16415
-#define EmfPlusRecordTypeSetInterpolationMode 16417
-#define EmfPlusRecordTypeSetPixelOffsetMode 16418
-#define EmfPlusRecordTypeSetCompositingQuality 16420
-#define EmfPlusRecordTypeSave 16421
-#define EmfPlusRecordTypeRestore 16422
-#define EmfPlusRecordTypeBeginContainerNoParams 16424
-#define EmfPlusRecordTypeEndContainer 16425
-#define EmfPlusRecordTypeSetWorldTransform 16426
-#define EmfPlusRecordTypeResetWorldTransform 16427
-#define EmfPlusRecordTypeMultiplyWorldTransform 16428
-#define EmfPlusRecordTypeSetPageTransform 16432
-#define EmfPlusRecordTypeSetClipRect 16434
-#define EmfPlusRecordTypeSetClipPath 16435
-#define EmfPlusRecordTypeSetClipRegion 16436
-#define EmfPlusRecordTypeDrawDriverString 16438
+#define EmfPlusRecordTypeHeader 0x4001
+#define EmfPlusRecordTypeEndOfFile 0x4002
+//TODO EmfPlusRecordTypeComment 0x4003
+#define EmfPlusRecordTypeGetDC 0x4004
+//TODO EmfPlusRecordTypeMultiFormatStart 0x4005
+//TODO EmfPlusRecordTypeMultiFormatSection 0x4006
+//TODO EmfPlusRecordTypeMultiFormatEnd 0x4007
+#define EmfPlusRecordTypeObject 0x4008
+//TODO EmfPlusRecordTypeClear 0x4009
+#define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeFillPolygon 0x400C
+#define EmfPlusRecordTypeDrawLines 0x400D
+#define EmfPlusRecordTypeFillEllipse 0x400E
+#define EmfPlusRecordTypeDrawEllipse 0x400F
+#define EmfPlusRecordTypeFillPie 0x4010
+//TODO EmfPlusRecordTypeDrawPie 0x4011
+//TODO EmfPlusRecordTypeDrawArc 0x4012
+//TODO EmfPlusRecordTypeFillRegion 0x4013
+#define EmfPlusRecordTypeFillPath 0x4014
+#define EmfPlusRecordTypeDrawPath 0x4015
+//TODO EmfPlusRecordTypeFillClosedCurve 0x4016
+//TODO EmfPlusRecordTypeDrawClosedCurve 0x4017
+//TODO EmfPlusRecordTypeDrawCurve 0x4018
+//TODO EmfPlusRecordTypeDrawBeziers 0x4019
+#define EmfPlusRecordTypeDrawImage 0x401A
+#define EmfPlusRecordTypeDrawImagePoints 0x401B
+#define EmfPlusRecordTypeDrawString 0x401C
+#define EmfPlusRecordTypeSetRenderingOrigin 0x401D
+#define EmfPlusRecordTypeSetAntiAliasMode 0x401E
+#define EmfPlusRecordTypeSetTextRenderingHint 0x401F
+#define EmfPlusRecordTypeSetInterpolationMode 0x4021
+#define EmfPlusRecordTypeSetPixelOffsetMode 0x4022
+//TODO EmfPlusRecordTypeSetCompositingMode 0x4023
+#define EmfPlusRecordTypeSetCompositingQuality 0x4024
+#define EmfPlusRecordTypeSave 0x4025
+#define EmfPlusRecordTypeRestore 0x4026
+//TODO EmfPlusRecordTypeBeginContainer 0x4027
+#define EmfPlusRecordTypeBeginContainerNoParams 0x4028
+#define EmfPlusRecordTypeEndContainer 0x4027
+#define EmfPlusRecordTypeSetWorldTransform 0x402A
+#define EmfPlusRecordTypeResetWorldTransform 0x402B
+#define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
+//TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
+#define EmfPlusRecordTypeSetPageTransform 0x4030
+//TODO EmfPlusRecordTypeResetClip 0x4031
+#define EmfPlusRecordTypeSetClipRect 0x4032
+#define EmfPlusRecordTypeSetClipPath 0x4033
+#define EmfPlusRecordTypeSetClipRegion 0x4034
+//TODO EmfPlusRecordTypeOffsetClip 0x4035
+#define EmfPlusRecordTypeDrawDriverString 0x4036
+//TODO EmfPlusRecordTypeStrokeFillPath 0x4037
+//TODO EmfPlusRecordTypeSerializableObject 0x4038
+//TODO EmfPlusRecordTypeSetTSGraphics 0x4039
+//TODO EmfPlusR

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cppcanvas/source

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   88 +++
 1 file changed, 55 insertions(+), 33 deletions(-)

New commits:
commit 42bf09876a8cb7faef0c2490ff3e7531de4fec8f
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 13:24:41 2017 +0200

Replace EmfPlusRecordType decimal valuse with hex

Change-Id: Ia5f248282e663e86b76a8c90fb5dd55d112f6912
Reviewed-on: https://gerrit.libreoffice.org/36260
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 723ee43cf65f85d7b586ae8c98529a22621054a3)
Reviewed-on: https://gerrit.libreoffice.org/36522

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index d05dd2f04e67..a03b02d2b8b3 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -50,39 +50,61 @@
 namespace
 {
 
-#define EmfPlusRecordTypeHeader 16385
-#define EmfPlusRecordTypeEndOfFile 16386
-#define EmfPlusRecordTypeGetDC 16388
-#define EmfPlusRecordTypeObject 16392
-#define EmfPlusRecordTypeFillRects 16394
-#define EmfPlusRecordTypeFillPolygon 16396
-#define EmfPlusRecordTypeDrawLines 16397
-#define EmfPlusRecordTypeFillEllipse 16398
-#define EmfPlusRecordTypeDrawEllipse 16399
-#define EmfPlusRecordTypeFillPie 16400
-#define EmfPlusRecordTypeFillPath 16404
-#define EmfPlusRecordTypeDrawPath 16405
-#define EmfPlusRecordTypeDrawImage 16410
-#define EmfPlusRecordTypeDrawImagePoints 16411
-#define EmfPlusRecordTypeDrawString 16412
-#define EmfPlusRecordTypeSetRenderingOrigin 16413
-#define EmfPlusRecordTypeSetAntiAliasMode 16414
-#define EmfPlusRecordTypeSetTextRenderingHint 16415
-#define EmfPlusRecordTypeSetInterpolationMode 16417
-#define EmfPlusRecordTypeSetPixelOffsetMode 16418
-#define EmfPlusRecordTypeSetCompositingQuality 16420
-#define EmfPlusRecordTypeSave 16421
-#define EmfPlusRecordTypeRestore 16422
-#define EmfPlusRecordTypeBeginContainerNoParams 16424
-#define EmfPlusRecordTypeEndContainer 16425
-#define EmfPlusRecordTypeSetWorldTransform 16426
-#define EmfPlusRecordTypeResetWorldTransform 16427
-#define EmfPlusRecordTypeMultiplyWorldTransform 16428
-#define EmfPlusRecordTypeSetPageTransform 16432
-#define EmfPlusRecordTypeSetClipRect 16434
-#define EmfPlusRecordTypeSetClipPath 16435
-#define EmfPlusRecordTypeSetClipRegion 16436
-#define EmfPlusRecordTypeDrawDriverString 16438
+#define EmfPlusRecordTypeHeader 0x4001
+#define EmfPlusRecordTypeEndOfFile 0x4002
+//TODO EmfPlusRecordTypeComment 0x4003
+#define EmfPlusRecordTypeGetDC 0x4004
+//TODO EmfPlusRecordTypeMultiFormatStart 0x4005
+//TODO EmfPlusRecordTypeMultiFormatSection 0x4006
+//TODO EmfPlusRecordTypeMultiFormatEnd 0x4007
+#define EmfPlusRecordTypeObject 0x4008
+//TODO EmfPlusRecordTypeClear 0x4009
+#define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeFillPolygon 0x400C
+#define EmfPlusRecordTypeDrawLines 0x400D
+#define EmfPlusRecordTypeFillEllipse 0x400E
+#define EmfPlusRecordTypeDrawEllipse 0x400F
+#define EmfPlusRecordTypeFillPie 0x4010
+//TODO EmfPlusRecordTypeDrawPie 0x4011
+//TODO EmfPlusRecordTypeDrawArc 0x4012
+//TODO EmfPlusRecordTypeFillRegion 0x4013
+#define EmfPlusRecordTypeFillPath 0x4014
+#define EmfPlusRecordTypeDrawPath 0x4015
+//TODO EmfPlusRecordTypeFillClosedCurve 0x4016
+//TODO EmfPlusRecordTypeDrawClosedCurve 0x4017
+//TODO EmfPlusRecordTypeDrawCurve 0x4018
+//TODO EmfPlusRecordTypeDrawBeziers 0x4019
+#define EmfPlusRecordTypeDrawImage 0x401A
+#define EmfPlusRecordTypeDrawImagePoints 0x401B
+#define EmfPlusRecordTypeDrawString 0x401C
+#define EmfPlusRecordTypeSetRenderingOrigin 0x401D
+#define EmfPlusRecordTypeSetAntiAliasMode 0x401E
+#define EmfPlusRecordTypeSetTextRenderingHint 0x401F
+#define EmfPlusRecordTypeSetInterpolationMode 0x4021
+#define EmfPlusRecordTypeSetPixelOffsetMode 0x4022
+//TODO EmfPlusRecordTypeSetCompositingMode 0x4023
+#define EmfPlusRecordTypeSetCompositingQuality 0x4024
+#define EmfPlusRecordTypeSave 0x4025
+#define EmfPlusRecordTypeRestore 0x4026
+//TODO EmfPlusRecordTypeBeginContainer 0x4027
+#define EmfPlusRecordTypeBeginContainerNoParams 0x4028
+#define EmfPlusRecordTypeEndContainer 0x4027
+#define EmfPlusRecordTypeSetWorldTransform 0x402A
+#define EmfPlusRecordTypeResetWorldTransform 0x402B
+#define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
+//TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
+#define EmfPlusRecordTypeSetPageTransform 0x4030
+//TODO EmfPlusRecordTypeResetClip 0x4031
+#define EmfPlusRecordTypeSetClipRect 0x4032
+#define EmfPlusRecordTypeSetClipPath 0x4033
+#define EmfPlusRecordTypeSetClipRegion 0x4034
+//TODO EmfPlusRecordTypeOffsetClip 0x4035
+#define EmfPlusRecordTypeDrawDriverString 0x4036
+//TODO EmfPlusRecordTypeStrokeFillPath 0x4037
+//TODO EmfPlusRecordTypeSerializableObject 0x4038
+//TODO EmfPlusRecordTypeSetTSGraphics 0x4039
+//TODO EmfPlusR

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

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx  |4 +++-
 cppcanvas/source/mtfrenderer/emfppath.cxx |   10 --
 cppcanvas/source/mtfrenderer/emfppath.hxx |2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 572663345531f8485b783f7d80bf51836550b8c4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Apr 9 19:09:35 2017 +0200

tdf#39053 EMF+ Draw an extra line between the last point and the first 
point.

The EmfPlusDrawlLines record specifies drawing a series of connected lines.
Bit 0x2000 indicates whether to draw an extra line between the last point
and the first point, to close the shape.
In this commit support of additional line which close shape was added.

Change-Id: I47ae3d8003cbfdd5b8ff5ba78e1ebe10f97af04b
Reviewed-on: https://gerrit.libreoffice.org/36317
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 97f3a59928f3..924e5a220ff4 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1066,7 +1066,9 @@ namespace cppcanvas
 EMFPPath path (points, true);
 path.Read (rMF, flags, *this);
 
-EMFPPlusDrawPolygon (path.GetPolygon (*this), 
rFactoryParms, rState, rCanvas, flags);
+// 0x2000 bit indicates whether to draw an extra 
line between the last point
+// and the first point, to close the shape.
+EMFPPlusDrawPolygon (path.GetPolygon (*this, true, 
(flags & 0x2000)), rFactoryParms, rState, rCanvas, flags);
 
 break;
 }
diff --git a/cppcanvas/source/mtfrenderer/emfppath.cxx 
b/cppcanvas/source/mtfrenderer/emfppath.cxx
index 54de41b06091..0a7231071d85 100644
--- a/cppcanvas/source/mtfrenderer/emfppath.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppath.cxx
@@ -105,7 +105,7 @@ namespace cppcanvas
 #endif
 }
 
-::basegfx::B2DPolyPolygon& EMFPPath::GetPolygon (ImplRenderer& rR, 
bool bMapIt)
+::basegfx::B2DPolyPolygon& EMFPPath::GetPolygon (ImplRenderer& rR, 
bool bMapIt, bool bAddLineToCloseShape)
 {
 ::basegfx::B2DPolygon polygon;
 
@@ -157,7 +157,13 @@ namespace cppcanvas
 polygon.clear ();
 }
 }
-
+// Draw an extra line between the last point and the first point, 
to close the shape.
+if (bAddLineToCloseShape) {
+if (bMapIt)
+polygon.append (rR.Map (pPoints [0], pPoints [1]) );
+else
+polygon.append (::basegfx::B2DPoint (pPoints [0], pPoints 
[1]) );
+}
 if (polygon.count ()) {
 aPolygon.append (polygon);
 
diff --git a/cppcanvas/source/mtfrenderer/emfppath.hxx 
b/cppcanvas/source/mtfrenderer/emfppath.hxx
index ace3e83ad04d..f86af4806b04 100644
--- a/cppcanvas/source/mtfrenderer/emfppath.hxx
+++ b/cppcanvas/source/mtfrenderer/emfppath.hxx
@@ -38,7 +38,7 @@ namespace cppcanvas
 // TODO: remove rR argument when debug code is not longer needed
 void Read(SvStream& s, sal_uInt32 pathFlags, ImplRenderer& rR);
 
-::basegfx::B2DPolyPolygon& GetPolygon(ImplRenderer& rR, bool 
bMapIt = true);
+::basegfx::B2DPolyPolygon& GetPolygon(ImplRenderer& rR, bool 
bMapIt = true, bool bAddLineToCloseShape = false);
 };
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-13 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

New commits:
commit fe62003caabf7665d41085c5d16f177f8186fce4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Apr 10 00:31:00 2017 +0200

tdf#106084 EMF+ Add support for EmfPlusScaleWorldTransform record

The EmfPlusScaleWorldTransform record performs a scaling on the current 
world space transform.

Change-Id: I03717b28a88d574d597174c6ca3446f937c96a15
Reviewed-on: https://gerrit.libreoffice.org/36320
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 924e5a220ff4..f1e2f4f7f401 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -103,7 +103,7 @@ namespace
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
 #define EmfPlusRecordTypeTranslateWorldTransform 0x402D
-//TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
+#define EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
 //TODO EmfPlusRecordTypeResetClip 0x4031
@@ -175,6 +175,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeResetWorldTransform: return 
"EmfPlusRecordTypeResetWorldTransform";
 case EmfPlusRecordTypeMultiplyWorldTransform: return 
"EmfPlusRecordTypeMultiplyWorldTransform";
 case EmfPlusRecordTypeTranslateWorldTransform: return 
"EmfPlusRecordTypeTranslateWorldTransform";
+case EmfPlusRecordTypeScaleWorldTransform: return 
"EmfPlusRecordTypeScaleWorldTransform";
 case EmfPlusRecordTypeSetPageTransform: return 
"EmfPlusRecordTypeSetPageTransform";
 case EmfPlusRecordTypeSetClipRect: return 
"EmfPlusRecordTypeSetClipRect";
 case EmfPlusRecordTypeSetClipPath: return 
"EmfPlusRecordTypeSetClipPath";
@@ -1420,6 +1421,29 @@ namespace cppcanvas
  "EMF+\t dx: "  << aWorldTransform.eDx  << 
", dy: "  << aWorldTransform.eDy);
 break;
 }
+case EmfPlusRecordTypeScaleWorldTransform:
+{
+XForm transform = XForm();
+rMF.ReadFloat( transform.eM11 ).ReadFloat( 
transform.eM22 );
+SAL_INFO("cppcanvas.emf", "EMF+ 
ScaleWorldTransform Sx: " << transform.eM11 << " Sy: " << transform.eM22);
+
+SAL_INFO("cppcanvas.emf",
+ "EMF+\t m11: " << aWorldTransform.eM11 << 
", m12: " << aWorldTransform.eM12 <<
+ "EMF+\t m21: " << aWorldTransform.eM21 << 
", m22: " << aWorldTransform.eM22 <<
+ "EMF+\t dx: "  << aWorldTransform.eDx  << 
", dy: "  << aWorldTransform.eDy);
+
+if (flags & 0x2000)  // post multiply
+aWorldTransform.Multiply (transform);
+else {   // pre multiply
+transform.Multiply (aWorldTransform);
+aWorldTransform.Set (transform);
+}
+SAL_INFO("cppcanvas.emf",
+ "EMF+\t m11: " << aWorldTransform.eM11 << 
", m12: " << aWorldTransform.eM12 <<
+ "EMF+\t m21: " << aWorldTransform.eM21 << 
", m22: " << aWorldTransform.eM22 <<
+ "EMF+\t dx: "  << aWorldTransform.eDx  << 
", dy: "  << aWorldTransform.eDy);
+break;
+}
 case EmfPlusRecordTypeSetClipRect:
 {
 int combineMode = (flags >> 8) & 0xf;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-16 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 715df6e9f8926e511dbdee52367ec08676f71952
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 14 00:04:57 2017 +0200

tdf#107159 EMF+ Add support for EmfPlusDrawArc record

EmfPlusDrawArc record specifies drawing the arc of an ellipse.

Change-Id: I87788a9b14f518a383cbc5b804af635427e4c395
Reviewed-on: https://gerrit.libreoffice.org/36537
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index f1e2f4f7f401..6b2d8d84db06 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -76,7 +76,7 @@ namespace
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
 #define EmfPlusRecordTypeDrawPie 0x4011
-//TODO EmfPlusRecordTypeDrawArc 0x4012
+#define EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
 #define EmfPlusRecordTypeDrawPath 0x4015
@@ -155,6 +155,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
 case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
+case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
@@ -892,6 +893,7 @@ namespace cppcanvas
 break;
 case EmfPlusRecordTypeFillPie:
 case EmfPlusRecordTypeDrawPie:
+case EmfPlusRecordTypeDrawArc:
 {
 float startAngle, sweepAngle;
 
@@ -903,10 +905,14 @@ namespace cppcanvas
 rMF.ReadUInt32( brushIndexOrColor );
 SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
 }
-else
+else if ( type == EmfPlusRecordTypeDrawPie )
 {
 SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
 }
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawArc");
+}
 rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
@@ -937,8 +943,11 @@ namespace cppcanvas
  " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
 
 B2DPolygon polygon = 
basegfx::tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX 
(), mappedSize.getY (), startAngle, endAngle);
-polygon.append (mappedCenter);
-polygon.setClosed (true);
+if ( type != EmfPlusRecordTypeDrawArc )
+{
+polygon.append (mappedCenter);
+polygon.setClosed (true);
+}
 
 B2DPolyPolygon polyPolygon (polygon);
 if ( type == EmfPlusRecordTypeFillPie )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-07 Thread Bartosz Kosiorek
 sc/inc/attarray.hxx  |2 +-
 sc/inc/table.hxx |3 ++-
 sc/source/core/data/attarray.cxx |   12 ++--
 sc/source/core/data/column.cxx   |6 +++---
 sc/source/core/data/table1.cxx   |2 +-
 sc/source/core/data/table2.cxx   |6 +++---
 6 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit e1e2defb2cd9b572747b964e5ec97d289029af8c
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Feb 28 02:48:32 2017 +0100

tdf#50916 Simplify and refactor source code

Change-Id: Ibcb3068318180f2adfdc41aac5d75299c1ffaffc
Reviewed-on: https://gerrit.libreoffice.org/34711
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 49626ea..a78d774 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -106,7 +106,7 @@ friend class ScHorizontalAttrIterator;
 ScAttrArray& operator=(const ScAttrArray&) = delete;
 
 public:
-ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, 
ScAttrArray* pNextColAttrArray = nullptr, bool bCreateEmpty = false );
+ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, 
ScAttrArray* pNextColAttrArray = nullptr );
 ~ScAttrArray();
 
 voidSetTab(SCTAB nNewTab)   { nTab = nNewTab; }
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0358a76..12517c6 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -207,7 +207,8 @@ private:
 boolmbPageBreaksValid:1;
 boolmbForceBreaks:1;
 
-ScAttrArray aNextColAttrArray;
+// Default attributes for the unallocated columns.
+ScAttrArray aDefaultColAttrArray;
 
 friend class ScDocument;// for FillInfo
 friend class ScColumn;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index eb530ed..cfbb1c0 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -49,7 +49,7 @@
 
 using ::editeng::SvxBorderLine;
 
-ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, 
ScAttrArray* pNextColAttrArray, bool bCreateEmpty ) :
+ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, 
ScAttrArray* pDefaultColAttrArray ) :
 nCol( nNewCol ),
 nTab( nNewTab ),
 pDocument( pDoc ),
@@ -57,10 +57,10 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, 
ScDocument* pDoc, ScAttr
 nLimit(0),
 pData(nullptr)
 {
-if ( nCol != -1 && !bCreateEmpty && pNextColAttrArray )
+if ( nCol != -1 && pDefaultColAttrArray )
 {
-nCount = pNextColAttrArray->nCount;
-nLimit = pNextColAttrArray->nCount;
+nCount = pDefaultColAttrArray->nCount;
+nLimit = pDefaultColAttrArray->nCount;
 if ( nCount )
 {
 bool bNumFormatChanged;
@@ -69,8 +69,8 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, 
ScDocument* pDoc, ScAttr
 pData = new ScAttrEntry[nCount];
 for ( size_t nIdx = 0; nIdx < nCount; ++nIdx )
 {
-pData[nIdx].nRow = pNextColAttrArray->pData[nIdx].nRow;
-ScPatternAttr aNewPattern( 
*(pNextColAttrArray->pData[nIdx].pPattern) );
+pData[nIdx].nRow = pDefaultColAttrArray->pData[nIdx].nRow;
+ScPatternAttr aNewPattern( 
*(pDefaultColAttrArray->pData[nIdx].pPattern) );
 pData[nIdx].pPattern = static_cast( 
>GetPool()->Put( aNewPattern ) );
 bNumFormatChanged = false;
 if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged,
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index af35e8c..bb8d378 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -108,10 +108,10 @@ void ScColumn::Init(SCCOL nNewCol, SCTAB nNewTab, 
ScDocument* pDoc, bool bEmptyA
 nCol = nNewCol;
 nTab = nNewTab;
 pDocument = pDoc;
-if ( !bEmptyAttrArray )
-pAttrArray = new ScAttrArray( nCol, nTab, pDocument, 
>maTabs[nTab]->aNextColAttrArray, bEmptyAttrArray );
+if ( bEmptyAttrArray )
+pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr );
 else
-pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr, true );
+pAttrArray = new ScAttrArray( nCol, nTab, pDocument, 
>maTabs[nTab]->aDefaultColAttrArray );
 }
 
 SCsROW ScColumn::GetNextUnprotected( SCROW nRow, bool bUp ) const
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index b2ff54d..8eb4648 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -288,7 +288,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const 
OUString& rNewName,
 bActiveScenario(false),
 mbPageBreaksValid(false),
 mbForceBreaks(false),
-aNe

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

2017-04-07 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   88 +++
 1 file changed, 55 insertions(+), 33 deletions(-)

New commits:
commit 723ee43cf65f85d7b586ae8c98529a22621054a3
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 13:24:41 2017 +0200

Replace EmfPlusRecordType decimal valuse with hex

Change-Id: Ia5f248282e663e86b76a8c90fb5dd55d112f6912
Reviewed-on: https://gerrit.libreoffice.org/36260
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 20142396e4e9..f242e31eed62 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -58,39 +58,61 @@
 namespace
 {
 
-#define EmfPlusRecordTypeHeader 16385
-#define EmfPlusRecordTypeEndOfFile 16386
-#define EmfPlusRecordTypeGetDC 16388
-#define EmfPlusRecordTypeObject 16392
-#define EmfPlusRecordTypeFillRects 16394
-#define EmfPlusRecordTypeFillPolygon 16396
-#define EmfPlusRecordTypeDrawLines 16397
-#define EmfPlusRecordTypeFillEllipse 16398
-#define EmfPlusRecordTypeDrawEllipse 16399
-#define EmfPlusRecordTypeFillPie 16400
-#define EmfPlusRecordTypeFillPath 16404
-#define EmfPlusRecordTypeDrawPath 16405
-#define EmfPlusRecordTypeDrawImage 16410
-#define EmfPlusRecordTypeDrawImagePoints 16411
-#define EmfPlusRecordTypeDrawString 16412
-#define EmfPlusRecordTypeSetRenderingOrigin 16413
-#define EmfPlusRecordTypeSetAntiAliasMode 16414
-#define EmfPlusRecordTypeSetTextRenderingHint 16415
-#define EmfPlusRecordTypeSetInterpolationMode 16417
-#define EmfPlusRecordTypeSetPixelOffsetMode 16418
-#define EmfPlusRecordTypeSetCompositingQuality 16420
-#define EmfPlusRecordTypeSave 16421
-#define EmfPlusRecordTypeRestore 16422
-#define EmfPlusRecordTypeBeginContainerNoParams 16424
-#define EmfPlusRecordTypeEndContainer 16425
-#define EmfPlusRecordTypeSetWorldTransform 16426
-#define EmfPlusRecordTypeResetWorldTransform 16427
-#define EmfPlusRecordTypeMultiplyWorldTransform 16428
-#define EmfPlusRecordTypeSetPageTransform 16432
-#define EmfPlusRecordTypeSetClipRect 16434
-#define EmfPlusRecordTypeSetClipPath 16435
-#define EmfPlusRecordTypeSetClipRegion 16436
-#define EmfPlusRecordTypeDrawDriverString 16438
+#define EmfPlusRecordTypeHeader 0x4001
+#define EmfPlusRecordTypeEndOfFile 0x4002
+//TODO EmfPlusRecordTypeComment 0x4003
+#define EmfPlusRecordTypeGetDC 0x4004
+//TODO EmfPlusRecordTypeMultiFormatStart 0x4005
+//TODO EmfPlusRecordTypeMultiFormatSection 0x4006
+//TODO EmfPlusRecordTypeMultiFormatEnd 0x4007
+#define EmfPlusRecordTypeObject 0x4008
+//TODO EmfPlusRecordTypeClear 0x4009
+#define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeFillPolygon 0x400C
+#define EmfPlusRecordTypeDrawLines 0x400D
+#define EmfPlusRecordTypeFillEllipse 0x400E
+#define EmfPlusRecordTypeDrawEllipse 0x400F
+#define EmfPlusRecordTypeFillPie 0x4010
+//TODO EmfPlusRecordTypeDrawPie 0x4011
+//TODO EmfPlusRecordTypeDrawArc 0x4012
+//TODO EmfPlusRecordTypeFillRegion 0x4013
+#define EmfPlusRecordTypeFillPath 0x4014
+#define EmfPlusRecordTypeDrawPath 0x4015
+//TODO EmfPlusRecordTypeFillClosedCurve 0x4016
+//TODO EmfPlusRecordTypeDrawClosedCurve 0x4017
+//TODO EmfPlusRecordTypeDrawCurve 0x4018
+//TODO EmfPlusRecordTypeDrawBeziers 0x4019
+#define EmfPlusRecordTypeDrawImage 0x401A
+#define EmfPlusRecordTypeDrawImagePoints 0x401B
+#define EmfPlusRecordTypeDrawString 0x401C
+#define EmfPlusRecordTypeSetRenderingOrigin 0x401D
+#define EmfPlusRecordTypeSetAntiAliasMode 0x401E
+#define EmfPlusRecordTypeSetTextRenderingHint 0x401F
+#define EmfPlusRecordTypeSetInterpolationMode 0x4021
+#define EmfPlusRecordTypeSetPixelOffsetMode 0x4022
+//TODO EmfPlusRecordTypeSetCompositingMode 0x4023
+#define EmfPlusRecordTypeSetCompositingQuality 0x4024
+#define EmfPlusRecordTypeSave 0x4025
+#define EmfPlusRecordTypeRestore 0x4026
+//TODO EmfPlusRecordTypeBeginContainer 0x4027
+#define EmfPlusRecordTypeBeginContainerNoParams 0x4028
+#define EmfPlusRecordTypeEndContainer 0x4027
+#define EmfPlusRecordTypeSetWorldTransform 0x402A
+#define EmfPlusRecordTypeResetWorldTransform 0x402B
+#define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
+//TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
+#define EmfPlusRecordTypeSetPageTransform 0x4030
+//TODO EmfPlusRecordTypeResetClip 0x4031
+#define EmfPlusRecordTypeSetClipRect 0x4032
+#define EmfPlusRecordTypeSetClipPath 0x4033
+#define EmfPlusRecordTypeSetClipRegion 0x4034
+//TODO EmfPlusRecordTypeOffsetClip 0x4035
+#define EmfPlusRecordTypeDrawDriverString 0x4036
+//TODO EmfPlusRecordTypeStrokeFillPath 0x4037
+//TODO EmfPlusRecordTypeSerializableObject 0x4038
+//TODO EmfPlusRecordTypeSetTSGraphics 0x4039
+//TODO EmfPlusRecordTypeSetTSClip 0x403A
 
 #define EmfPlusObjectTypeBrush 0x100
 #define EmfPlusO

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

2017-04-07 Thread Bartosz Kosiorek
 vcl/source/filter/wmf/enhwmf.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 92a5c6d2c0d0ec4ec4df689f96065574b83a3657
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon Apr 3 01:09:10 2017 +0200

Read number of polylines as UInt32 according to documentation

Change-Id: I7ef8c66485044e2543dc8d9a9e589537eb36f70f
Reviewed-on: https://gerrit.libreoffice.org/36025
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 0d8a9b0d1cd1..75089260335d 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -541,27 +541,27 @@ template 
 void EnhWMFReader::ReadAndDrawPolyLine()
 {
 sal_uInt32  nPoints;
-sal_Int32   i, nPoly(0), nGesPoints(0);
-pWMF->SeekRel( 0x10 );
-// Number of Polygons:
-pWMF->ReadInt32( nPoly ).ReadInt32( nGesPoints );
+sal_uInt32  i, nNumberOfPolylines( 0 ), nCount( 0 );
+pWMF->SeekRel( 0x10 ); // TODO Skipping Bounds. A 128-bit WMF RectL object 
(specifies the bounding rectangle in device units.)
+pWMF->ReadUInt32( nNumberOfPolylines );
+pWMF->ReadUInt32( nCount ); // total number of points in all polylines
 
 // taking the amount of points of each polygon, retrieving the total 
number of points
 if ( pWMF->good() &&
- ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / 
sizeof(sal_uInt16) ) &&
- ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( 
nEndPos - pWMF->Tell() )
+ ( nNumberOfPolylines < SAL_MAX_UINT32 / sizeof( sal_uInt16 ) ) &&
+ ( nNumberOfPolylines * sizeof( sal_uInt16 ) ) <= ( nEndPos - 
pWMF->Tell() )
)
 {
-std::unique_ptr<sal_uInt16[]> pnPoints(new sal_uInt16[ nPoly ]);
-for ( i = 0; i < nPoly && pWMF->good(); i++ )
+std::unique_ptr< sal_uInt32[] > pnPolylinePointCount( new sal_uInt32[ 
nNumberOfPolylines ] );
+for ( i = 0; i < nNumberOfPolylines && pWMF->good(); i++ )
 {
 pWMF->ReadUInt32( nPoints );
-pnPoints[ i ] = (sal_uInt16)nPoints;
+pnPolylinePointCount[ i ] = nPoints;
 }
-// Get polygon points:
-for ( i = 0; ( i < nPoly ) && pWMF->good(); i++ )
+// Get polyline points:
+for ( i = 0; ( i < nNumberOfPolylines ) && pWMF->good(); i++ )
 {
-tools::Polygon aPolygon = ReadPolygon(0, pnPoints[i]);
+tools::Polygon aPolygon = ReadPolygon< T >( 0, 
pnPolylinePointCount[ i ] );
 pOut->DrawPolyLine( aPolygon, false, bRecordPath );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-10 Thread Bartosz Kosiorek
 sc/qa/unit/data/xlsx/pivot.xlsx   |binary
 sc/qa/unit/subsequent_export-test.cxx |   61 +-
 sc/source/filter/excel/xepivotxml.cxx |   79 +++---
 3 files changed, 123 insertions(+), 17 deletions(-)

New commits:
commit 084a1fc85f2e9099b89b7a0bc519a8d482645155
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Aug 1 05:40:34 2017 +0200

tdf#89139 tdf#109016 Fix PivotCache fields according to OOXML specification

Apply changes to fields:
 - XML_containsInteger
 - XML_containsBlank
 - XML_containsMixedTypes
 - XML_containsSemiMixedTypes
 - XML_count
According to OOXML specification

https://technet.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.shareditems.aspx

Generally OOXML specification allows listing items for mixed items 
(example: STRING + NUMBERS).
This patch is fixing that.
Example of mixed types:









Cherry-picked from Change-Id: I02b07c79bea60890e3c995dd70cb5c72901a3d4a

Change-Id: I384629de7dc64dd1c62e1fab24df5595b8d6f03e
Reviewed-on: https://gerrit.libreoffice.org/40970
Reviewed-by: Andras Timar <andras.ti...@collabora.com>
Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sc/qa/unit/data/xlsx/pivot.xlsx b/sc/qa/unit/data/xlsx/pivot.xlsx
new file mode 100644
index ..e6297a91777b
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 9deb04ba8be0..514f08c68a54 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -108,7 +108,7 @@ public:
 void testCellNoteExportXLS();
 void testFormatExportODS();
 
-
+void testPivotExportXLSX();
 void testCommentExportXLSX();
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
@@ -212,6 +212,7 @@ public:
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
 
+CPPUNIT_TEST(testPivotExportXLSX);
 CPPUNIT_TEST(testCommentExportXLSX);
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
@@ -504,6 +505,64 @@ void ScExportTest::testFormatExportODS()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testPivotExportXLSX()
+{
+//tdf#89139 FILESAVE  xlsx pivot table corrupted after save with LO and 
re-open with MS Office
+ScDocShellRef xShell = loadDoc("pivot.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 
5);
+
+// Four strings and one empty field
+assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", 
"imieinazwisko");
+assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsBlank", "1");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsMixedTypes");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsSemiMixedTypes");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsString");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsNumber");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsInteger");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"minValue");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"maxValue");
+assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "count", 
"5");
+
+// Two integers and one empty field
+assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "wartosc");
+assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", 
"containsBlank", "1");
+assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x

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

2017-07-21 Thread Bartosz Kosiorek
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx |7 +++
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx |1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4a169551433a0897ca9b1baccbfce134059aef05
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jun 3 12:31:32 2017 +0200

tdf#73873 Fix missing embeddings in word/embeddings directory

In commit:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ad90e22f1970d019e1f2a1e8ba8020c0f0cb36c4
the refactor was made. Unorfunately due to mistake
the embedding was always resetting.
As a result only one embedding document was added,
and the OOXML files were pernamentely corrupted.
This simple fix is resolving mentioned issue.

Change-Id: Ie268b1bf8906ac7b8e061526a9186b3b4b46bef6
Reviewed-on: https://gerrit.libreoffice.org/38369
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
Reviewed-on: https://gerrit.libreoffice.org/40127
Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index abb7c522e586..c104d6d43438 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -721,7 +721,6 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 uno::Reference xRelationshipAccess;
 
xRelationshipAccess.set((dynamic_cast<OOXMLStreamImpl&>(*pStream.get())).accessDocumentStream(),
 uno::UNO_QUERY);
-std::vector aEmbeddings;
 if (xRelationshipAccess.is())
 {
 OUString 
sChartType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart;);
@@ -796,7 +795,7 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 embeddingsTemp.Name = embeddingsTarget;
 embeddingsTemp.Value <<= mxEmbeddings;
-aEmbeddings.push_back(embeddingsTemp);
+maEmbedding.push_back(embeddingsTemp);
 mxEmbeddings.clear();
 }
 }
@@ -805,8 +804,8 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 }
 }
 }
-if (!aEmbeddings.empty())
-mxEmbeddingsList = comphelper::containerToSequence(aEmbeddings);
+if (!maEmbedding.empty())
+mxEmbeddingsList = comphelper::containerToSequence(maEmbedding);
 }
 
 void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream)
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index 17fde7c89079..b32882aa3ca5 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -55,6 +55,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Reference mxActiveXBin;
 css::uno::Reference mxEmbeddings;
 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
+std::vector maEmbedding;
 bool mbIsSubstream;
 bool mbSkipImages;
 /// How many paragraphs equal to 1 percent?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-21 Thread Bartosz Kosiorek
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx |7 +++
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx |1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit d20d5aad44118187feee51d4b0f38e4586f3
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jun 3 12:31:32 2017 +0200

tdf#73873 Fix missing embeddings in word/embeddings directory

In commit:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ad90e22f1970d019e1f2a1e8ba8020c0f0cb36c4
the refactor was made. Unorfunately due to mistake
the embedding was always resetting.
As a result only one embedding document was added,
and the OOXML files were pernamentely corrupted.
This simple fix is resolving mentioned issue.

Change-Id: Ie268b1bf8906ac7b8e061526a9186b3b4b46bef6
Reviewed-on: https://gerrit.libreoffice.org/38369
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
Reviewed-on: https://gerrit.libreoffice.org/39787
Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>
Reviewed-by: Michael Meeks <michael.me...@collabora.com>
Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 089c0e2a8f26..8a2feecc0e33 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -720,7 +720,6 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 uno::Reference xRelationshipAccess;
 
xRelationshipAccess.set((dynamic_cast<OOXMLStreamImpl&>(*pStream.get())).accessDocumentStream(),
 uno::UNO_QUERY);
-std::vector aEmbeddings;
 if (xRelationshipAccess.is())
 {
 OUString 
sChartType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart;);
@@ -795,7 +794,7 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 embeddingsTemp.Name = embeddingsTarget;
 embeddingsTemp.Value <<= mxEmbeddings;
-aEmbeddings.push_back(embeddingsTemp);
+maEmbedding.push_back(embeddingsTemp);
 mxEmbeddings.clear();
 }
 }
@@ -804,8 +803,8 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 }
 }
 }
-if (!aEmbeddings.empty())
-mxEmbeddingsList = comphelper::containerToSequence(aEmbeddings);
+if (!maEmbedding.empty())
+mxEmbeddingsList = comphelper::containerToSequence(maEmbedding);
 }
 
 void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream)
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index 43bdeb651d78..32ed9f04d218 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -53,6 +53,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Reference mxActiveXBin;
 css::uno::Reference mxEmbeddings;
 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
+std::vector maEmbedding;
 bool mbIsSubstream;
 bool mbSkipImages;
 /// How many paragraphs equal to 1 percent?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-27 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit e31c535b574fc37e6961c5ce7bd507a30e6abff1
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Apr 27 01:52:00 2017 +0200

tdf#47243 tdf#39327 tdf#103639 Proper scaling of SetPageTransform

The EmfPlusSetPageTransform record specifies scaling factors and units for 
converting page space
coordinates to device space coordinates.
In previous implementation I made scaling after translating page scaling.
For some images it was working correctly (if there wasn't translating).
WIth this commit I fixed this issue.

Change-Id: I1e9e78ecdab663328f86a960d8547ad0a7fc1314
Reviewed-on: https://gerrit.libreoffice.org/37010
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 631dde57d687..bd13102eb6a6 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -771,8 +771,6 @@ namespace cppcanvas
 EMFPStringFormat *stringFormat;
 aObjects [index] = stringFormat = new EMFPStringFormat();
 stringFormat->Read (rObjectStream);
-
-SAL_INFO("cppcanvas.emf", "EMF+\t Object type 'string 
format' not yet implemented");
 break;
 }
 case EmfPlusObjectTypeImageAttributes:
@@ -1285,6 +1283,7 @@ namespace cppcanvas
 LanguageTag aLanguageTag( static_cast< 
LanguageType >( stringFormat->language ) );
 aFontRequest.Locale = aLanguageTag.getLocale( 
false );
 SAL_INFO("cppcanvas.emf", "EMF+\t\t Font 
locale, Country:" << aLanguageTag.getCountry() <<" Language:" << 
aLanguageTag.getLanguage() );
+SAL_INFO("cppcanvas.emf", "EMF+\t\t TODO Use 
all string formatting attributes during drawing");
 
 double cellSize = setFont (aFontRequest, flags 
& 0xff, rFactoryParms, rState);
 rState.textColor = COLOR( brushId );
@@ -1335,17 +1334,11 @@ namespace cppcanvas
 
 if (flags != UnitTypePixel)
 SAL_WARN("cppcanvas.emf", "EMF+\t TODO Only 
UnitTypePixel is supported. ");
-
-XForm transform = XForm();
-transform.eM11 = fPageScale;
-transform.eM22 = fPageScale;
-
-SAL_INFO("cppcanvas.emf",
- "EMF+\t m11: " << aBaseTransform.eM11 << 
", m12: " << aBaseTransform.eM12 <<
- "EMF+\t m21: " << aBaseTransform.eM21 << 
", m22: " << aBaseTransform.eM22 <<
- "EMF+\t dx: "  << aBaseTransform.eDx  << 
", dy: "  << aBaseTransform.eDy);
-
-aBaseTransform.Multiply (transform);
+else
+{
+nMmX *= fPageScale;
+nMmY *= fPageScale;
+}
 }
 break;
 case EmfPlusRecordTypeSetRenderingOrigin:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppcanvas/Library_cppcanvas.mk cppcanvas/source

2017-04-24 Thread Bartosz Kosiorek
 cppcanvas/Library_cppcanvas.mk|1 
 cppcanvas/source/inc/implrenderer.hxx |5 +
 cppcanvas/source/mtfrenderer/emfplus.cxx  |   38 ++--
 cppcanvas/source/mtfrenderer/emfpstringformat.cxx |   65 ++
 cppcanvas/source/mtfrenderer/emfpstringformat.hxx |   54 ++
 5 files changed, 155 insertions(+), 8 deletions(-)

New commits:
commit f9af0abce2c266a53f536a207a62bc691213f6a0
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 15 01:44:46 2017 +0200

EMF+ Add initial support for EmfPlusStringFormat Object

The EmfPlusStringFormat object specifies text layout, display manipulations,
and language identification. With this commit the support for font language
and country was added. Also Bold style is applied,
for strings which needs that.

Change-Id: Id9735a9ddb959aebd20d6d4d1bb5da0fa9c1fb85
Reviewed-on: https://gerrit.libreoffice.org/36555
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/Library_cppcanvas.mk b/cppcanvas/Library_cppcanvas.mk
index 5b184296f2f7..62611a4ee808 100644
--- a/cppcanvas/Library_cppcanvas.mk
+++ b/cppcanvas/Library_cppcanvas.mk
@@ -62,6 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,cppcanvas,\
cppcanvas/source/mtfrenderer/mtftools \
cppcanvas/source/mtfrenderer/pointaction \
cppcanvas/source/mtfrenderer/polypolyaction \
+   cppcanvas/source/mtfrenderer/emfpstringformat \
cppcanvas/source/mtfrenderer/textaction \
cppcanvas/source/mtfrenderer/transparencygroupaction \
cppcanvas/source/tools/canvasgraphichelper \
diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index 033882d15620..75b091d3f6c4 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -28,6 +28,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 
 #include 
@@ -274,7 +277,7 @@ static float GetSwapFloat( SvStream& rSt )
 
 /* EMF+ */
 void processEMFPlus( MetaCommentAction* pAct, const 
ActionFactoryParameters& rFactoryParms, OutDevState& rState, const 
CanvasSharedPtr& rCanvas );
-double setFont( sal_uInt8 objectId, const ActionFactoryParameters& 
rParms, OutDevState& rState );
+double setFont(css::rendering::FontRequest& aFontRequest, 
sal_uInt8 fontObjectId, const ActionFactoryParameters& rParms, OutDevState& 
rState );
 
 /// Render LineCap, like the start or end arrow of a polygon.
 /// @return how much we should shorten the original polygon.
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 6b2d8d84db06..368450d9e6ab 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -36,9 +36,9 @@
 #include 
 #include 
 #include 
+#include 
 
-#include 
-#include 
+#include 
 #include 
 #include 
 
@@ -55,6 +55,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -139,6 +140,15 @@ enum EmfPlusCombineMode
 EmfPlusCombineModeComplement = 0x0005
 };
 
+enum EmfPlusFontStyle
+{
+FontStyleBold = 0x0001,
+FontStyleItalic = 0x0002,
+FontStyleUnderline = 0x0004,
+FontStyleStrikeout = 0x0008
+};
+
+
 const char* emfTypeToName(sal_uInt16 type)
 {
 switch(type)
@@ -747,6 +757,10 @@ namespace cppcanvas
 }
 case EmfPlusObjectTypeStringFormat:
 {
+EMFPStringFormat *stringFormat;
+aObjects [index] = stringFormat = new EMFPStringFormat();
+stringFormat->Read (rObjectStream);
+
 SAL_INFO("cppcanvas.emf", "EMF+\t Object type 'string 
format' not yet implemented");
 break;
 }
@@ -766,13 +780,16 @@ namespace cppcanvas
 }
 }
 
-double ImplRenderer::setFont (sal_uInt8 objectId, const 
ActionFactoryParameters& rParms, OutDevState& rState)
+double ImplRenderer::setFont (css::rendering::FontRequest& 
aFontRequest, sal_uInt8 fontObjectId, const ActionFactoryParameters& rParms, 
OutDevState& rState)
 {
-EMFPFont *font = static_cast<EMFPFont*>( aObjects[ objectId ] );
+EMFPFont *font = static_cast< EMFPFont* >( aObjects[ fontObjectId 
] );
 
-rendering::FontRequest aFontRequest;
 aFontRequest.FontDescription.FamilyName = font->family;
 double cellSize = font->emSize;
+if( font->fontFlags & FontStyleBold )
+{
+aFontRequest.FontDescription.FontDescription.Weight = 
rendering::PanoseWeight::BOLD;
+}
 aFontRequest.Cell

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

2017-04-24 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   34 +++
 1 file changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 78a3a304871eb3eb861a49ed00345b54fba01114
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu Apr 20 15:58:41 2017 +0200

tdf#47243 tdf#39327 Add support for SetPageTransform

Change-Id: Iea78cf1e9ca99c97814d9eaa4a65ad4b83a2bbe2
Reviewed-on: https://gerrit.libreoffice.org/36749
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 368450d9e6ab..d5c497a3f5bd 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -148,6 +148,16 @@ enum EmfPlusFontStyle
 FontStyleStrikeout = 0x0008
 };
 
+enum UnitType
+{
+UnitTypeWorld = 0x00,
+UnitTypeDisplay = 0x01,
+UnitTypePixel = 0x02,
+UnitTypePoint = 0x03,
+UnitTypeInch = 0x04,
+UnitTypeDocument = 0x05,
+UnitTypeMillimeter = 0x06
+};
 
 const char* emfTypeToName(sal_uInt16 type)
 {
@@ -1314,12 +1324,28 @@ namespace cppcanvas
 }
 }
 break;
+
 case EmfPlusRecordTypeSetPageTransform:
-rMF.ReadFloat( fPageScale );
+{
+rMF.ReadFloat( fPageScale );
 
-SAL_INFO("cppcanvas.emf", "EMF+ SetPageTransform");
-SAL_INFO("cppcanvas.emf", "EMF+\tscale: " << 
fPageScale << " unit: " << flags);
-SAL_INFO("cppcanvas.emf", "EMF+\tTODO");
+SAL_INFO("cppcanvas.emf", "EMF+ SetPageTransform");
+SAL_INFO("cppcanvas.emf", "EMF+\tscale: " << 
fPageScale << " unit: " << flags);
+
+if (flags != UnitTypePixel)
+SAL_WARN("cppcanvas.emf", "EMF+\t TODO Only 
UnitTypePixel is supported. ");
+
+XForm transform = XForm();
+transform.eM11 = fPageScale;
+transform.eM22 = fPageScale;
+
+SAL_INFO("cppcanvas.emf",
+ "EMF+\t m11: " << aBaseTransform.eM11 << 
", m12: " << aBaseTransform.eM12 <<
+ "EMF+\t m21: " << aBaseTransform.eM21 << 
", m22: " << aBaseTransform.eM22 <<
+ "EMF+\t dx: "  << aBaseTransform.eDx  << 
", dy: "  << aBaseTransform.eDy);
+
+aBaseTransform.Multiply (transform);
+}
 break;
 case EmfPlusRecordTypeSetRenderingOrigin:
 rMF.ReadInt32( nOriginX ).ReadInt32( nOriginY );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

2017-04-25 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 10182700091869e869475fddcac02753076f
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 14 00:04:57 2017 +0200

tdf#107159 EMF+ Add support for EmfPlusDrawArc record

EmfPlusDrawArc record specifies drawing the arc of an ellipse.

Change-Id: I87788a9b14f518a383cbc5b804af635427e4c395
Reviewed-on: https://gerrit.libreoffice.org/36537
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 715df6e9f8926e511dbdee52367ec08676f71952)
Reviewed-on: https://gerrit.libreoffice.org/36587
Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 993d5c762c49..9154f92b92bf 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -68,7 +68,7 @@ namespace
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
 #define EmfPlusRecordTypeDrawPie 0x4011
-//TODO EmfPlusRecordTypeDrawArc 0x4012
+#define EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
 #define EmfPlusRecordTypeDrawPath 0x4015
@@ -225,6 +225,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
 case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
+case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
@@ -1911,6 +1912,7 @@ namespace cppcanvas
 break;
 case EmfPlusRecordTypeFillPie:
 case EmfPlusRecordTypeDrawPie:
+case EmfPlusRecordTypeDrawArc:
 {
 float startAngle, sweepAngle;
 
@@ -1922,10 +1924,14 @@ namespace cppcanvas
 rMF.ReadUInt32( brushIndexOrColor );
 SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
 }
-else
+else if ( type == EmfPlusRecordTypeDrawPie )
 {
 SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
 }
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawArc");
+}
 rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
@@ -1956,8 +1962,11 @@ namespace cppcanvas
  " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
 
 B2DPolygon polygon = 
basegfx::tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX 
(), mappedSize.getY (), startAngle, endAngle);
-polygon.append (mappedCenter);
-polygon.setClosed (true);
+if ( type != EmfPlusRecordTypeDrawArc )
+{
+polygon.append (mappedCenter);
+polygon.setClosed (true);
+}
 
 B2DPolyPolygon polyPolygon (polygon);
 if ( type == EmfPlusRecordTypeFillPie )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cppcanvas/source

2017-04-28 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   33 +++
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit bafb6b59cf590f939753fc0009b8328c280837a9
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 8 01:10:05 2017 +0200

tdf#107034 EMF+ Add support for import EmfPlusDrawPie record

The EmfPlusDrawPie record specifies drawing a section of the interior of an 
ellipse.

Change-Id: Icd9d64117cc612d348c531932931f31e4d04e567
Reviewed-on: https://gerrit.libreoffice.org/36286
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 2e7c94f5054dec4ab19c44209136c886793f0acb)
Reviewed-on: https://gerrit.libreoffice.org/36530
Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index a03b02d2b8b3..888b40a30431 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -65,7 +65,7 @@ namespace
 #define EmfPlusRecordTypeFillEllipse 0x400E
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
-//TODO EmfPlusRecordTypeDrawPie 0x4011
+#define EmfPlusRecordTypeDrawPie 0x4011
 //TODO EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
@@ -220,6 +220,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
+case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
@@ -1898,19 +1899,29 @@ namespace cppcanvas
 processObjectRecord (rMF, flags, dataSize);
 break;
 case EmfPlusRecordTypeFillPie:
+case EmfPlusRecordTypeDrawPie:
 {
-sal_uInt32 brushIndexOrColor;
 float startAngle, sweepAngle;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadFloat( 
startAngle ).ReadFloat( sweepAngle );
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 
-SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor << " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
+if ( type == EmfPlusRecordTypeFillPie )
+{
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
+}
+rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
 
 ReadRectangle (rMF, dx, dy, dw, dh, bool(flags & 
0x4000));
 
-SAL_INFO("cppcanvas.emf", "EMF+ RectData: " << dx 
<< "," << dy << " " << dw << "x" << dh);
+SAL_INFO("cppcanvas.emf", "EMF+\t RectData: " << 
dx << "," << dy << " " << dw << "x" << dh);
 
 startAngle = 2*M_PI*startAngle/360;
 sweepAngle = 2*M_PI*sweepAngle/360;
@@ -1929,15 +1940,21 @@ namespace cppcanvas
 if (sweepAngle < 0)
 std::swap (endAngle, startAngle);
 
-SAL_INFO("cppcanvas.emf", "EMF+ adjusted angles: 
start " <<
- (360.0*startAngle/M_PI) << ", end: " << 
(360.0*endAngle/M_PI));
+SAL_INFO("cppcanvas.emf", "EMF+\t adjusted angles: 
start " <<
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cppcanvas/source

2017-04-28 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   63 +++
 1 file changed, 32 insertions(+), 31 deletions(-)

New commits:
commit 08fe3b0f1c1e72f15db1cd70d85effa3d63db276
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 7 14:43:44 2017 +0200

tdf#107016 EMF+ Add support of import EmfPlusRecordTypeDrawRects record

EmfPlusDrawRectss record defines the pen strokes for drawing a series of 
rectangles.

Change-Id: Iaa061f8502fb51de44d2e65a1c92daf297b79d2b
Reviewed-on: https://gerrit.libreoffice.org/36261
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit a45feba83e5fb35eee1884887e8dbe795ebacde5)
Reviewed-on: https://gerrit.libreoffice.org/36528
Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 888b40a30431..341e29e3943c 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -60,6 +60,7 @@ namespace
 #define EmfPlusRecordTypeObject 0x4008
 //TODO EmfPlusRecordTypeClear 0x4009
 #define EmfPlusRecordTypeFillRects 0x400A
+#define EmfPlusRecordTypeDrawRects 0x400B
 #define EmfPlusRecordTypeFillPolygon 0x400C
 #define EmfPlusRecordTypeDrawLines 0x400D
 #define EmfPlusRecordTypeFillEllipse 0x400E
@@ -92,6 +93,7 @@ namespace
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
+//TODO EmfPlusRecordTypeTranslateWorldTransform 0x402D
 //TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
@@ -215,6 +217,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeGetDC: return "EmfPlusRecordTypeGetDC";
 case EmfPlusRecordTypeObject: return "EmfPlusRecordTypeObject";
 case EmfPlusRecordTypeFillRects: return "EmfPlusRecordTypeFillRects";
+case EmfPlusRecordTypeDrawRects: return "EmfPlusRecordTypeDrawRects";
 case EmfPlusRecordTypeFillPolygon: return 
"EmfPlusRecordTypeFillPolygon";
 case EmfPlusRecordTypeDrawLines: return "EmfPlusRecordTypeDrawLines";
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
@@ -2002,48 +2005,46 @@ namespace cppcanvas
 }
 break;
 case EmfPlusRecordTypeFillRects:
+case EmfPlusRecordTypeDrawRects:
 {
-SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
-
-sal_uInt32 brushIndexOrColor;
+// Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
+sal_uInt32 brushIndexOrColor = 999;
 sal_Int32 rectangles;
 bool isColor = (flags & 0x8000);
 ::basegfx::B2DPolygon polygon;
 
-rMF.ReadUInt32( brushIndexOrColor ).ReadInt32( 
rectangles );
+if ( type == EmfPlusRecordTypeFillRects )
+{
+SAL_INFO("cppcanvas.emf", "EMF+ FillRects");
+rMF.ReadUInt32( brushIndexOrColor );
+SAL_INFO("cppcanvas.emf", "EMF+\t" << (isColor 
? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor << 
std::dec);
+}
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawRects");
+}
 
-SAL_INFO("cppcanvas.emf", "EMF+\t" << ((flags & 
0x8000) ? "color" : "brush index") << ": 0x" << std::hex << brushIndexOrColor 
<< std::dec);
+rMF.ReadInt32( rectangles );
 
 for (int i=0; i < rectangles; i++) {
-if (flags & 0x4000) {
-/* 16bit integers */
-sal_Int16 x, y, width, height;
-
-rMF.ReadInt16( x ).ReadInt16( y 
).ReadInt16( width ).ReadInt16( height );
-
-polygon.append (Map (x, y));
-polygon.append (Map (x + width, y));
-polygon.ap

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cppcanvas/source

2017-04-29 Thread Bartosz Kosiorek
 cppcanvas/source/inc/implrenderer.hxx|   33 +--
 cppcanvas/source/mtfrenderer/emfplus.cxx |   27 -
 2 files changed, 49 insertions(+), 11 deletions(-)

New commits:
commit cb2f3e524919444d84974fe3216edd8fafc28e10
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Apr 8 02:35:34 2017 +0200

tdf#106084 EMF+ Add support for EmfPlusTranslateWorldTransform record

The EmfPlusTranslateWorldTransform record performs a translation
on the current world space transform.

Change-Id: I3e5744060c8a6d758bcc2804c6798e0208d2191f
Reviewed-on: https://gerrit.libreoffice.org/36287
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit fcb32f1cbc335a953cea62f66b9f50170263fb56)
Reviewed-on: https://gerrit.libreoffice.org/37090
Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index b9babf1df753..b81e8908d5be 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -76,19 +76,26 @@ namespace cppcanvas
 };
 
 // EMF+
-// TODO: replace?
+// Transformation matrix (used for Affine Transformation)
+//  [ eM11, eM12, eDx ]
+//  [ eM21, eM22, eDy ]
+//  [ 0,0,1   ]
+// that consists of a linear map (eM11, eM12, eM21, eM22)
+// More info: https://en.wikipedia.org/wiki/Linear_map
+// followed by a translation (eDx, eDy)
+
 struct XForm
 {
-float   eM11;
-float   eM12;
-float   eM21;
-float   eM22;
-float   eDx;
-float   eDy;
+float   eM11; // M1,1 value in the matrix. Increases or decreases 
the size of the pixels horizontally.
+float   eM12; // M1,2 value in the matrix. This effectively angles 
the X axis up or down.
+float   eM21; // M2,1 value in the matrix. This effectively angles 
the Y axis left or right.
+float   eM22; // M2,2 value in the matrix. Increases or decreases 
the size of the pixels vertically.
+float   eDx;  // Delta x (Dx) value in the matrix. Moves the whole 
coordinate system horizontally.
+float   eDy;  // Delta y (Dy) value in the matrix. Moves the whole 
coordinate system vertically.
 XForm()
 {
 SetIdentity ();
-};
+}
 
 void SetIdentity ()
 {
@@ -106,14 +113,20 @@ namespace cppcanvas
 eDy  = f.eDy;
 }
 
+// Multiple two square matrices
+//  [ eM11, eM12, eDx ]   [ f.eM11, f.eM12, f.eDx ]
+//  [ eM21, eM22, eDy ] x [ f.eM21, f.eM22, f.eDy ]
+//  [ 0,0,1   ]   [ 0,  0,  1 ]
+// More information: 
https://en.wikipedia.org/wiki/Matrix_multiplication#Square_matrices
+// FIXME We shouldn't modify source matrix during computation
 void Multiply (const XForm& f)
 {
 eM11 = eM11*f.eM11 + eM12*f.eM21;
 eM12 = eM11*f.eM12 + eM12*f.eM22;
 eM21 = eM21*f.eM11 + eM22*f.eM21;
 eM22 = eM21*f.eM12 + eM22*f.eM22;
-eDx *= eDx*f.eM11  + eDy*f.eM21 + f.eDx;
-eDy *= eDx*f.eM12  + eDy*f.eM22 + f.eDy;
+eDx  = eDx*f.eM11  + eDy*f.eM21 + f.eDx;
+eDy  = eDx*f.eM12  + eDy*f.eM22 + f.eDy;
 }
 
 #ifdef OSL_BIGENDIAN
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index bf9e3b89099d..76cdd7ee8a54 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -93,7 +93,7 @@ namespace
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
-//TODO EmfPlusRecordTypeTranslateWorldTransform 0x402D
+#define EmfPlusRecordTypeTranslateWorldTransform 0x402D
 //TODO EmfPlusRecordTypeScaleWorldTransform 0x402E
 //TODO EmfPlusRecordTypeRotateWorldTransform 0x402F
 #define EmfPlusRecordTypeSetPageTransform 0x4030
@@ -243,6 +243,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeSetWorldTransform: return 
"EmfPlusRecordTypeSetWorldTransform";
 case EmfPlusRecordTypeResetWorldTransform: return 
"EmfPlusRecordTypeResetWorldTransform";
 case EmfPlusRecordTypeMultiplyWorldTransform: return 
"EmfPlusRecordTypeMultiplyWorldTransform";
+case EmfPlusRecordTypeTranslateWorldTransform: return 
"EmfPlusRecordTypeTranslateWorldTransform";
 case EmfPlusRecordTypeSetPageTransform: return 
"EmfPl

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cppcanvas/source

2017-04-29 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 0adc3c002ddd7ccea6a184d9274e4695b1a857b4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Apr 14 00:04:57 2017 +0200

tdf#107159 EMF+ Add support for EmfPlusDrawArc record

EmfPlusDrawArc record specifies drawing the arc of an ellipse.

Change-Id: I87788a9b14f518a383cbc5b804af635427e4c395
Reviewed-on: https://gerrit.libreoffice.org/36537
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
(cherry picked from commit 715df6e9f8926e511dbdee52367ec08676f71952)
Reviewed-on: https://gerrit.libreoffice.org/37092
Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 341e29e3943c..bf9e3b89099d 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -67,7 +67,7 @@ namespace
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
 #define EmfPlusRecordTypeDrawPie 0x4011
-//TODO EmfPlusRecordTypeDrawArc 0x4012
+#define EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
 #define EmfPlusRecordTypeDrawPath 0x4015
@@ -224,6 +224,7 @@ const char* emfTypeToName(sal_uInt16 type)
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
 case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
+case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
@@ -1903,6 +1904,7 @@ namespace cppcanvas
 break;
 case EmfPlusRecordTypeFillPie:
 case EmfPlusRecordTypeDrawPie:
+case EmfPlusRecordTypeDrawArc:
 {
 float startAngle, sweepAngle;
 
@@ -1914,10 +1916,14 @@ namespace cppcanvas
 rMF.ReadUInt32( brushIndexOrColor );
 SAL_INFO("cppcanvas.emf", "EMF+ FillPie 
colorOrIndex: " << brushIndexOrColor);
 }
-else
+else if ( type == EmfPlusRecordTypeDrawPie )
 {
 SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
 }
+else
+{
+SAL_INFO("cppcanvas.emf", "EMF+ DrawArc");
+}
 rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle 
);
 
 float dx, dy, dw, dh;
@@ -1948,8 +1954,11 @@ namespace cppcanvas
  " startAngle: " << startAngle << " 
sweepAngle: " << sweepAngle);
 
 B2DPolygon polygon = 
basegfx::tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX 
(), mappedSize.getY (), startAngle, endAngle);
-polygon.append (mappedCenter);
-polygon.setClosed (true);
+if ( type != EmfPlusRecordTypeDrawArc )
+{
+polygon.append (mappedCenter);
+polygon.setClosed (true);
+}
 
 B2DPolyPolygon polyPolygon (polygon);
 if ( type == EmfPlusRecordTypeFillPie )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-12 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfpbrush.cxx |  112 +++--
 cppcanvas/source/mtfrenderer/emfpbrush.hxx |9 ++
 cppcanvas/source/mtfrenderer/emfplus.cxx   |   34 
 3 files changed, 87 insertions(+), 68 deletions(-)

New commits:
commit 43f5268c6fa394b0d219f8653ef827bdd531b4e4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Thu May 11 22:58:06 2017 +0200

EMF+ tdf#31814 Add support of reading EmfPlusBoundaryPointData

The EmfPlusBoundaryPointData object specifies a closed cardinal spline 
boundary for a gradient brush.
This data is starting point for displaying correctly gradients.

Change-Id: I91b01417c6dc00a04dabfc5a035afe9085999240
Reviewed-on: https://gerrit.libreoffice.org/37519
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfpbrush.cxx 
b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
index 72bbc7131d56..051859d33549 100755
--- a/cppcanvas/source/mtfrenderer/emfpbrush.cxx
+++ b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
@@ -43,16 +43,6 @@ namespace cppcanvas
 {
 namespace internal
 {
-
-enum EmfPlusBrushType
-{
-BrushTypeSolidColor = 0x,
-BrushTypeHatchFill = 0x0001,
-BrushTypeTextureFill = 0x0002,
-BrushTypePathGradient = 0x0003,
-BrushTypeLinearGradient = 0x0004
-};
-
 EMFPBrush::EMFPBrush()
 : type(0)
 , additionalFlags(0)
@@ -154,7 +144,7 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+\tcenter point: " << areaX << 
"," << areaY);
 
 s.ReadInt32(surroundColorsNumber);
-SAL_INFO("cppcanvas.emf", "EMF+\tsurround colors: " << 
surroundColorsNumber);
+SAL_INFO("cppcanvas.emf", "EMF+\t number of surround colors: " 
<< surroundColorsNumber);
 
 if (surroundColorsNumber<0 || 
sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32 / sizeof(::Color))
 surroundColorsNumber = SAL_MAX_INT32 / sizeof(::Color);
@@ -191,57 +181,73 @@ namespace cppcanvas
 const ::basegfx::B2DRectangle 
aBounds(::basegfx::tools::getRange(path->GetPolygon(rR, false)));
 areaWidth = aBounds.getWidth();
 areaHeight = aBounds.getHeight();
+SAL_INFO("cppcanvas.emf", "EMF+\t polygon bounding box: " 
<< aBounds.getMinX() << "," << aBounds.getMinY() << " " << aBounds.getWidth() 
<< "x" << aBounds.getHeight());
+}
+else
+{
+sal_Int32 boundaryPointCount;
+s.ReadInt32(boundaryPointCount);
+
+sal_uInt64 const pos = s.Tell();
+SAL_INFO("cppcanvas.emf", "EMF+\t use boundary, points: " 
<< boundaryPointCount);
+path = new EMFPPath(boundaryPointCount);
+path->Read(s, 0x0, rR);
 
-SAL_INFO("cppcanvas.emf", "EMF+\tpolygon bounding box: " 
<< aBounds.getMinX() << "," << aBounds.getMinY() << " " << aBounds.getWidth() 
<< "x" << aBounds.getHeight());
+s.Seek(pos + 8 * boundaryPointCount);
 
+const ::basegfx::B2DRectangle 
aBounds(::basegfx::tools::getRange(path->GetPolygon(rR, false)));
+areaWidth = aBounds.getWidth();
+areaHeight = aBounds.getHeight();
+SAL_INFO("cppcanvas.emf", "EMF+\t polygon bounding box: " 
<< aBounds.getMinX() << "," << aBounds.getMinY() << " " << aBounds.getWidth() 
<< "x" << aBounds.getHeight());
+}
 
-if (additionalFlags & 0x02) {
-SAL_INFO("cppcanvas.emf", "EMF+\tuse transformation");
-ReadXForm(s, brush_transformation);
-hasTransformation = true;
-SAL_INFO("cppcanvas.emf",
-"EMF+\tm11: " << brush_transformation.eM11 << " 
m12: " << brush_transformation.eM12 <<
-"\nEMF+\tm21: " << brush_transformation.eM21 << " 
m22: " << brush_transformation.eM22 <<
-"\nEMF+\tdx: " << brush_transformation.eDx << " 
dy: " << brush_transformation.eDy)

[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 <gan...@poczta.onet.pl>
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 <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

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(&

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 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 edf5dcda53e9af586e9f9f28d29bd0c3c778b474
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
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 <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
Reviewed-on: https://gerrit.libreoffice.org/38276
Reviewed-by: Andras Timar <andras.ti...@collabora.com>
Tested-by: Andras Timar <andras.ti...@collabora.com>

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 d9bc62d5f8f0..c8d148aeb1c2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1398,24 +1398,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 e6e1e87f710b..9deb04ba8be0 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3428,16 +3428,24 @@ void ScExportTest::testSheetCondensedCharacterSpace()
 
 void ScExportTest::testTextUnderlineColor()
 {
-
 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]/

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

2017-06-03 Thread Bartosz Kosiorek
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx |1 -
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx |1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4e547d147d6df7042db58bfa3060140c849493f4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Jun 3 12:31:32 2017 +0200

tdf#73873 Fix missing embeddings in word/embeddings directory

In commit:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ad90e22f1970d019e1f2a1e8ba8020c0f0cb36c4
the refactor was made. Unorfunately due to mistake
the embedding was always resetting.
As a result only one embedding document was added.

Change-Id: Ie268b1bf8906ac7b8e061526a9186b3b4b46bef6
Reviewed-on: https://gerrit.libreoffice.org/38369
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 550820be018e..5eb517810957 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -724,7 +724,6 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 uno::Reference xRelationshipAccess;
 
xRelationshipAccess.set((dynamic_cast<OOXMLStreamImpl&>(*pStream.get())).accessDocumentStream(),
 uno::UNO_QUERY);
-std::vector aEmbeddings;
 if (xRelationshipAccess.is())
 {
 OUString 
sChartType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart;);
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index c4245cae7b02..1922e225e168 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -53,6 +53,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Reference mxActiveXBin;
 css::uno::Reference mxEmbeddings;
 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
+std::vector aEmbeddings;
 /// List of VBA-related streams.
 css::uno::Sequence maVBA;
 bool mbIsSubstream;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-01 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 0b0cc6a3306a03798fdbe766976480160d0d5c22
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
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 <c...@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
(cherry picked from commit 8129ad7b22dceeb2fef13741aa509c2229cf03de)
Reviewed-on: https://gerrit.libreoffice.org/38285
Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>

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 94c70ffdb642..1b05c1d8fb2a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1410,24 +1410,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

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

2017-05-07 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfppen.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit ff7f5e1bbd4a9a3e3fa3e4ddb349c97605dc8a01
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun May 7 02:57:26 2017 +0200

tdf#31814 Introduce minimal value of line width to fix EMF+ import issues

Based on observation of different EMF+ files (eg. exported by ChemDraw),
there is minimal value of line width.
This commit is fixing all such import issues.

Change-Id: I5c26a1b511363eb1e429bf770ad0f482b124ecb5
Reviewed-on: https://gerrit.libreoffice.org/37319
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfppen.cxx 
b/cppcanvas/source/mtfrenderer/emfppen.cxx
index 03014b37b7a7..b3b0c97dcb8a 100755
--- a/cppcanvas/source/mtfrenderer/emfppen.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppen.cxx
@@ -103,12 +103,16 @@ namespace cppcanvas
 
 void EMFPPen::SetStrokeWidth(rendering::StrokeAttributes& 
rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
 {
-#if OSL_DEBUG_LEVEL > 1
-if (penWidth == 0.0) {
-SAL_INFO("cppcanvas.emf", "TODO: pen with zero width - using 
minimal which might not be correct");
-}
-#endif
+// If a zero width is specified, a minimum value is used, which is 
determined by the units.
+//TODO Add support for other units than Pixel
 rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * 
rR.MapSize(penWidth == 0.0 ? 0.05 : penWidth, 0)).getLength());
+
+// tdf#31814 Based on observation of different EMF+ files (eg. 
exported by ChemDraw),
+// there is minimal value of line width
+if (rStrokeAttributes.StrokeWidth < 1.0)
+{
+rStrokeAttributes.StrokeWidth = 1.0;
+}
 }
 
 /// Convert stroke caps between EMF+ and rendering API
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-08 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx  |6 ++
 cppcanvas/source/mtfrenderer/emfppath.cxx |   17 +
 2 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 4c40aeeaf37bb3c0b780e7b0c2f9afe8c06091f5
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Mon May 8 23:10:42 2017 +0200

tdf#31814 EMF+ Fix an issue when not all elements were displayed

On on EMF+ images generated by ChemDraw, some elements were not displayed.
After investigation, occurs that position of points was not read
properly in same cases. This commit fixes such cases.

Change-Id: I1d01d8defc41f4e437a669ef1268b8e33823cfc1
Reviewed-on: https://gerrit.libreoffice.org/37406
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
    Tested-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 4d4bfb528d61..9db632d19413 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -233,6 +233,12 @@ namespace cppcanvas
 
 void ImplRenderer::ReadPoint (SvStream& s, float& x, float& y, 
sal_uInt32 flags)
 {
+if (flags & 0x800) {
+// specifies a location in the coordinate space that is 
relative to
+// the location specified by the previous element in the 
array. In the case of the first element in
+// PointData, a previous location at coordinates (0,0) is 
assumed.
+SAL_WARN("cppcanvas.emf", "EMF+\t\t TODO Relative coordinates 
bit detected. Implement parse EMFPlusPointR");
+}
 if (flags & 0x4000) {
 sal_Int16 ix, iy;
 
diff --git a/cppcanvas/source/mtfrenderer/emfppath.cxx 
b/cppcanvas/source/mtfrenderer/emfppath.cxx
index 034e6419ccd7..d924ce61d816 100644
--- a/cppcanvas/source/mtfrenderer/emfppath.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppath.cxx
@@ -67,22 +67,23 @@ namespace cppcanvas
 void EMFPPath::Read (SvStream& s, sal_uInt32 pathFlags, ImplRenderer& 
rR)
 {
 for (int i = 0; i < nPoints; i ++) {
-if (pathFlags & 0x4000) {
+if (pathFlags & 0x800) {
+// EMFPlusPointR: points are stored in EMFPlusInteger7 or
+// EMFPlusInteger15 objects, see section 2.2.2.21/22
+// If 0x800 bit is set, the 0x4000 bit is undefined and 
must be ignored
+SAL_WARN("cppcanvas.emf", "EMF+\t\t TODO - parse 
EMFPlusPointR object (section 2.2.1.6)");
+} else if (pathFlags & 0x4000) {
 // EMFPlusPoint: stored in signed short 16bit integer 
format
 sal_Int16 x, y;
 
 s.ReadInt16( x ).ReadInt16( y );
-SAL_INFO ("cppcanvas.emf", "EMF+\tEMFPlusPoint [x,y]: " << 
x << "," << y);
+SAL_INFO ("cppcanvas.emf", "EMF+\t EMFPlusPoint [x,y]: " 
<< x << "," << y);
 pPoints [i*2] = x;
 pPoints [i*2 + 1] = y;
-} else if (!(pathFlags & 0xC000)) {
+} else {
 // EMFPlusPointF: stored in Single (float) format
 s.ReadFloat( pPoints [i*2] ).ReadFloat( pPoints [i*2 + 1] 
);
-SAL_INFO ("cppcanvas.emf", "EMF+\tEMFPlusPointF [x,y]: " 
<< pPoints [i*2] << "," << pPoints [i*2 + 1]);
-} else { //if (pathFlags & 0x8000)
-// EMFPlusPointR: points are stored in EMFPlusInteger7 or
-// EMFPlusInteger15 objects, see section 2.2.2.21/22
-SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - parse 
EMFPlusPointR object (section 2.2.1.6)");
+SAL_INFO ("cppcanvas.emf", "EMF+\t EMFPlusPointF [x,y]: " 
<< pPoints [i*2] << "," << pPoints [i*2 + 1]);
 }
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-06 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfpbrush.cxx |   25 +---
 cppcanvas/source/mtfrenderer/emfppen.cxx   |   58 +++--
 cppcanvas/source/mtfrenderer/emfppen.hxx   |2 -
 3 files changed, 58 insertions(+), 27 deletions(-)

New commits:
commit 420d20d3ef080789153b59b22da63f58e5099b94
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri May 5 00:55:00 2017 +0200

EMF Replace magic numbers of pen and brush objects

Change-Id: Ia3b6208b3d42b46fbdc9d61bbdea1c790aaf3ba0
Reviewed-on: https://gerrit.libreoffice.org/37268
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfpbrush.cxx 
b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
index 9de0f4c3432c..72bbc7131d56 100755
--- a/cppcanvas/source/mtfrenderer/emfpbrush.cxx
+++ b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
@@ -43,6 +43,16 @@ namespace cppcanvas
 {
 namespace internal
 {
+
+enum EmfPlusBrushType
+{
+BrushTypeSolidColor = 0x,
+BrushTypeHatchFill = 0x0001,
+BrushTypeTextureFill = 0x0002,
+BrushTypePathGradient = 0x0003,
+BrushTypeLinearGradient = 0x0004
+};
+
 EMFPBrush::EMFPBrush()
 : type(0)
 , additionalFlags(0)
@@ -99,7 +109,7 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header 
<< " type: " << type << std::dec);
 
 switch (type) {
-case 0:
+case BrushTypeSolidColor:
 {
 sal_uInt32 color;
 
@@ -108,7 +118,7 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+\tsolid color: 0x" << std::hex 
<< color << std::dec);
 break;
 }
-case 1:
+case BrushTypeHatchFill:
 {
 sal_uInt32 style;
 sal_uInt32 foregroundColor;
@@ -123,8 +133,12 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+\thatch style " << style << " 
foregroundcolor: 0x" << solidColor.AsRGBHexString() << " background 0x" << 
secondColor.AsRGBHexString());
 break;
 }
-// path gradient
-case 3:
+case BrushTypeTextureFill:
+{
+SAL_WARN("cppcanvas.emf", "EMF+\tTODO: implement 
BrushTypeTextureFill brush");
+break;
+}
+case BrushTypePathGradient:
 {
 s.ReadUInt32(additionalFlags).ReadInt32(wrapMode);
 
@@ -230,8 +244,7 @@ namespace cppcanvas
 }
 break;
 }
-// linear gradient
-case 4:
+case BrushTypeLinearGradient:
 {
 s.ReadUInt32(additionalFlags).ReadInt32(wrapMode);
 
diff --git a/cppcanvas/source/mtfrenderer/emfppen.cxx 
b/cppcanvas/source/mtfrenderer/emfppen.cxx
index b74f3a289e29..03014b37b7a7 100755
--- a/cppcanvas/source/mtfrenderer/emfppen.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppen.cxx
@@ -46,6 +46,24 @@ namespace cppcanvas
 {
 namespace internal
 {
+
+enum EmfPlusPenData
+{
+PenDataTransform= 0x0001,
+PenDataStartCap = 0x0002,
+PenDataEndCap   = 0x0004,
+PenDataJoin = 0x0008,
+PenDataMiterLimit   = 0x0010,
+PenDataLineStyle= 0x0020,
+PenDataDashedLineCap= 0x0040,
+PenDataDashedLineOffset = 0x0080,
+PenDataDashedLine   = 0x0100,
+PenDataNonCenter= 0x0200,
+PenDataCompoundLine = 0x0400,
+PenDataCustomStartCap   = 0x0800,
+PenDataCustomEndCap = 0x1000
+};
+
 const sal_Int32 EmfPlusLineStyleSolid = 0x;
 const sal_Int32 EmfPlusLineStyleDash = 0x0001;
 const sal_Int32 EmfPlusLineStyleDot = 0x0002;
@@ -55,7 +73,7 @@ namespace cppcanvas
 
 EMFPPen::EMFPPen()
 : EMFPBrush()
-, width(0.0)
+, penWidth(0.0)
 , startCap(0)
 , endCap(0)
 , lineJoin(0)
@@ -86,11 +104,11 @@ namespace cppcanvas
 void EMFPPen::SetStrokeWidth(rendering::StrokeAttributes& 
rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
 {
 #if OSL_DEBUG_LEVEL > 1
-if (width == 0.0) {
+if (penWidth == 0.0) {
 SAL_INFO("cppcanvas.emf", "TODO: pen with zero width - using 
minimal which might not be correct");
  

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

2017-05-04 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a2c14edcc5cbf87c3c229361e02415bcedcd7b87
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed May 3 21:43:19 2017 +0200

Fix number of EmfPlusEndContainer record

EmfPlusEndContainer record closes a graphics state container
that was previously opened by a begin container operation.

Change-Id: I80d977ba53b98ef87b70e0dca2008c1980f901f9
Reviewed-on: https://gerrit.libreoffice.org/37217
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index fdcd7e031f4d..4d4bfb528d61 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -100,7 +100,7 @@ namespace
 #define EmfPlusRecordTypeRestore 0x4026
 //TODO EmfPlusRecordTypeBeginContainer 0x4027
 #define EmfPlusRecordTypeBeginContainerNoParams 0x4028
-#define EmfPlusRecordTypeEndContainer 0x4027
+#define EmfPlusRecordTypeEndContainer 0x4029
 #define EmfPlusRecordTypeSetWorldTransform 0x402A
 #define EmfPlusRecordTypeResetWorldTransform 0x402B
 #define EmfPlusRecordTypeMultiplyWorldTransform 0x402C
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-08 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit ac528503b4c172dd322841681b7aa9180a95721d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue May 9 00:14:00 2017 +0200

EMF+ We already implemented most used EMF+ records.

Now it's time to enable warnings, to track not implemented cases,
to have clear notification what is wrong with imported image.

Change-Id: Ic880a5b7df03e4a98d4700bebb3d0f6d77980505
Reviewed-on: https://gerrit.libreoffice.org/37407
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 9db632d19413..6b4cf6eb4240 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1257,10 +1257,10 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+ 
warning: empty bitmap");
 }
 } else {
-SAL_INFO("cppcanvas.emf", "EMF+ 
DrawImage(Points) TODO (fixme)");
+SAL_WARN("cppcanvas.emf", "EMF+ 
DrawImage(Points) TODO (fixme)");
 }
 } else {
-SAL_INFO("cppcanvas.emf", "EMF+ 
DrawImage(Points) TODO (fixme) - possibly unsupported source units for crop 
rectangle");
+SAL_WARN("cppcanvas.emf", "EMF+ 
DrawImage(Points) TODO (fixme) - possibly unsupported source units for crop 
rectangle");
 }
 break;
 }
@@ -1329,7 +1329,7 @@ namespace cppcanvas
 rFactoryParms.mrCurrActionIndex += 
pTextAction->getActionCount()-1;
 }
 } else {
-SAL_INFO("cppcanvas.emf", "EMF+ DrawString 
TODO - drawing with brush not yet supported");
+SAL_WARN("cppcanvas.emf", "EMF+ DrawString 
TODO - drawing with brush not yet supported");
 }
 }
 break;
@@ -1645,14 +1645,13 @@ namespace cppcanvas
 rFactoryParms.mrCurrActionIndex += 
pTextAction->getActionCount()-1;
 }
 } else {
-SAL_INFO("cppcanvas.emf", "EMF+\tTODO: fonts 
(non-unicode glyphs chars)");
+SAL_WARN("cppcanvas.emf", "EMF+\tTODO: fonts 
(non-unicode glyphs chars)");
 }
 
 break;
 }
 default:
-SAL_INFO("cppcanvas.emf", "EMF+ unhandled record type: 
0x" << std::hex << type << std::dec);
-SAL_INFO("cppcanvas.emf", "EMF+\tTODO");
+SAL_WARN("cppcanvas.emf", "EMF+ TODO unhandled record 
type: 0x" << std::hex << type << std::dec);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppcanvas/source drawinglayer/source

2017-10-16 Thread Bartosz Kosiorek
 cppcanvas/source/mtfrenderer/emfplus.cxx |   62 +
 drawinglayer/source/tools/emfphelperdata.cxx |   79 +--
 2 files changed, 69 insertions(+), 72 deletions(-)

New commits:
commit f2410ad4d0f1e93c7f12ee51da9e1a1a90f0f5a4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Oct 15 18:13:29 2017 +0200

tdf#31814 Resolve TODO from EMF+ DrawImage and DrawImagePoints

Change-Id: I1b128aa467286b5ae5e0d3cc298ee59f3e6ec12d
Reviewed-on: https://gerrit.libreoffice.org/43408
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Patrick Jaap <patrick.j...@tu-dresden.de>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index acc0b3f58573..47e1b1d48d3f 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1181,10 +1181,10 @@ namespace cppcanvas
 SAL_INFO("cppcanvas.emf", "EMF+ " << (type == 
EmfPlusRecordTypeDrawImagePoints ? "DrawImagePoints" : "DrawImage") << 
"attributes index: " << attrIndex << "source unit: " << sourceUnit);
 SAL_INFO("cppcanvas.emf", "EMF+\tTODO: use image 
attributes");
 
-if (sourceUnit == 2 && aObjects [flags & 0xff]) { 
// we handle only GraphicsUnit.Pixel now
+// For DrawImage and DrawImagePoints, source unit 
of measurement type must be 1 pixel
+if (sourceUnit == UnitTypePixel && aObjects [flags 
& 0xff]) {
 EMFPImage& image = *static_cast( 
aObjects [flags & 0xff].get());
 float sx, sy, sw, sh;
-sal_Int32 aCount;
 
 ReadRectangle (rMF, sx, sy, sw, sh);
 ::tools::Rectangle aSource(Point(sx, sy), 
Size(sw, sh));
@@ -1193,12 +1193,13 @@ namespace cppcanvas
 
 ::basegfx::B2DPoint aDstPoint;
 ::basegfx::B2DSize aDstSize;
-bool bValid = false;
 
 if (type == EmfPlusRecordTypeDrawImagePoints) {
+sal_Int32 aCount;
 rMF.ReadInt32( aCount );
 
-if( aCount == 3) { // TODO: now that we 
now that this value is count we should support it better
+// Number of points used by 
DrawImagePoints. Exactly 3 points must be specified.
+if( aCount == 3 ) {
 float x1, y1, x2, y2, x3, y3;
 
 ReadPoint (rMF, x1, y1, flags);
@@ -1210,8 +1211,9 @@ namespace cppcanvas
 
 aDstPoint = Map (x1, y1);
 aDstSize = MapSize(x2 - x1, y3 - y1);
-
-bValid = true;
+} else {
+SAL_WARN("cppcanvas.emf", "EMF+ 
DrawImagePoints Wrong EMF+ file. Expected 3 points, received: "<< aCount);
+break;
 }
 } else if (type == EmfPlusRecordTypeDrawImage) 
{
 float dx, dy, dw, dh;
@@ -1222,39 +1224,33 @@ namespace cppcanvas
 
 aDstPoint = Map (dx, dy);
 aDstSize = MapSize(dw, dh);
-
-bValid = true;
 }
 
-if (bValid) {
-BitmapEx aBmp( image.graphic.GetBitmapEx 
() );
-aBmp.Crop( aSource );
-
-Size aSize( aBmp.GetSizePixel() );
-SAL_INFO("cppcanvas.emf", "EMF+ bitmap 
size: " << aSize.Width() << "x" << aSize.Height());
-if( aSize.Width() > 0 && aSize.Height() > 
0 ) {
-std::shared_ptr pBmpAction (
-
internal::BitmapActionFactory::createBitmapAction (
-aBmp,
-rState.mapModeTransform * 
aDstPoint,
-rState.mapModeTransform * 
aDstSize,
-   

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

2017-08-31 Thread Bartosz Kosiorek
 dev/null  |binary
 sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |  132 
++
 sc/source/filter/excel/xepivotxml.cxx |   64 

 4 files changed, 138 insertions(+), 58 deletions(-)

New commits:
commit baed960b8ce55370a040d0c0f49bd3fdc16bdf84
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Aug 15 07:35:35 2017 +0200

tdf#89139 Fix exporting of DateTime to CacheDefinition according to ISO 8601

With this commit, the date is saved in Excel format, like:
"2009-07-06T10:53:02"

We are now exporting attributes:
  "minDate"
  "maxDate"
  "containsDate"

This is necessary to export properly .xlsx file. Without that MS Office 365
is displaying error, and it is not even trying displaying .xslx file content
Change-Id: I1239f5582173afe99bf9178fd4edd1dc5ca28e8e
Reviewed-on: https://gerrit.libreoffice.org/41162
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git 
a/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx 
b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx
new file mode 100644
index ..f343b51f98be
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx differ
diff --git a/sc/qa/unit/data/xlsx/pivot.xlsx b/sc/qa/unit/data/xlsx/pivot.xlsx
deleted file mode 100644
index e6297a91777b..
Binary files a/sc/qa/unit/data/xlsx/pivot.xlsx and /dev/null differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 79221e9c85f4..5e0066365156 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -119,7 +119,8 @@ public:
 void testFormatExportODS();
 
 void testPivotTableExportXLSX();
-void testPivotExportXLSX();
+void testPivotCacheExportXLSX();
+
 void testCommentExportXLSX();
 #if HAVE_MORE_FONTS
 void testCustomColumnWidthExportXLSX();
@@ -234,7 +235,8 @@ public:
 CPPUNIT_TEST(testFormatExportODS);
 
 CPPUNIT_TEST(testPivotTableExportXLSX);
-CPPUNIT_TEST(testPivotExportXLSX);
+CPPUNIT_TEST(testPivotCacheExportXLSX);
+
 CPPUNIT_TEST(testCommentExportXLSX);
 #if HAVE_MORE_FONTS
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
@@ -588,7 +590,7 @@ void ScExportTest::testPivotTableExportXLSX()
 assertXPath(pTable, 
"/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", "h", 
"1");
 }
 
-void ScExportTest::testPivotExportXLSX()
+void ScExportTest::testPivotCacheExportXLSX()
 {
 // tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and 
re-open with MS Office
 // MS Excel is very sensitive for proper values of fields:
@@ -597,62 +599,98 @@ void ScExportTest::testPivotExportXLSX()
 // This test case ensures, that such values are properly set according to 
documentation:
 // 
https://technet.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.shareditems.aspx
 
-ScDocShellRef xShell = loadDoc("pivot.", FORMAT_XLSX);
+ScDocShellRef xShell = 
loadDoc("pivot-table/with-strings-integers-and-dates.", FORMAT_XLSX);
 CPPUNIT_ASSERT(xShell.is());
 
 std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml");
-CPPUNIT_ASSERT(pSheet);
+xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pCacheDef);
 
-assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 
5);
+assertXPath(pCacheDef, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5);
 
 // Four strings and one empty field
-assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", 
"imieinazwisko");
-assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsBlank", "1");
-assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsMixedTypes");
-assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsSemiMixedTypes");
-assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsString");
-assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefi

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

2017-09-03 Thread Bartosz Kosiorek
 dev/null  |binary
 sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |  138 
++
 sc/source/filter/excel/xepivotxml.cxx |   65 
+++-
 4 files changed, 146 insertions(+), 57 deletions(-)

New commits:
commit 0c457ee0f069b5a53dbcf4480069568fdf201bd7
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Aug 15 07:35:35 2017 +0200

tdf#89139 Fix exporting of DateTime to CacheDefinition according to ISO 8601

With this commit, the date is saved in Excel format, like:
"2009-07-06T10:53:02"

We are now exporting attributes:
  "minDate"
  "maxDate"
  "containsDate"

This is necessary to export properly .xlsx file. Without that MS Office 365
is displaying error, and it is not even trying displaying .xslx file content
Reviewed-on: https://gerrit.libreoffice.org/41162
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

Change-Id: I1239f5582173afe99bf9178fd4edd1dc5ca28e8e
Reviewed-on: https://gerrit.libreoffice.org/41871
Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
Tested-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git 
a/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx 
b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx
new file mode 100644
index ..f343b51f98be
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx differ
diff --git a/sc/qa/unit/data/xlsx/pivot.xlsx b/sc/qa/unit/data/xlsx/pivot.xlsx
deleted file mode 100644
index e6297a91777b..
Binary files a/sc/qa/unit/data/xlsx/pivot.xlsx and /dev/null differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index b5965bcd5aa6..b76a69dc92e0 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -113,7 +113,8 @@ public:
 void testFormatExportODS();
 
 void testPivotTableExportXLSX();
-void testPivotExportXLSX();
+void testPivotCacheExportXLSX();
+
 void testCommentExportXLSX();
 void testCustomColumnWidthExportXLSX();
 void testXfDefaultValuesXLSX();
@@ -221,7 +222,8 @@ public:
 CPPUNIT_TEST(testFormatExportODS);
 
 CPPUNIT_TEST(testPivotTableExportXLSX);
-CPPUNIT_TEST(testPivotExportXLSX);
+CPPUNIT_TEST(testPivotCacheExportXLSX);
+
 CPPUNIT_TEST(testCommentExportXLSX);
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 CPPUNIT_TEST(testXfDefaultValuesXLSX);
@@ -552,63 +554,107 @@ void ScExportTest::testPivotTableExportXLSX()
 assertXPath(pTable, 
"/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", "h", 
"1");
 }
 
-void ScExportTest::testPivotExportXLSX()
+void ScExportTest::testPivotCacheExportXLSX()
 {
-//tdf#89139 FILESAVE  xlsx pivot table corrupted after save with LO and 
re-open with MS Office
-ScDocShellRef xShell = loadDoc("pivot.", FORMAT_XLSX);
+// tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and 
re-open with MS Office
+// MS Excel is very sensitive for proper values of fields:
+// containsMixedTypes, containsSemiMixedTypes, containsInteger, 
containsBlank
+// If it is not properly set, then Excel is not opening spreadsheet 
properly.
+// This test case ensures, that such values are properly set according to 
documentation:
+// 
https://technet.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.shareditems.aspx
+
+ScDocShellRef xShell = 
loadDoc("pivot-table/with-strings-integers-and-dates.", FORMAT_XLSX);
 CPPUNIT_ASSERT(xShell.Is());
 
 std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml");
-CPPUNIT_ASSERT(pSheet);
+xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pCacheDef);
 
-assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 
5);
+assertXPath(pCacheDef, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5);
 
 // Four strings and one empty field
-assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", 
"imieinazwisko");
-assertXPath(pSheet, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", 
"containsBlank", "1");
-assertXPathNoAttribute(pSheet, 
"/x:pivotCacheDefinition/x:cacheFiel

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

2017-11-28 Thread Bartosz Kosiorek
 sc/source/filter/oox/stylesbuffer.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 51a1fb0beb813624b5bc3255a889f9d630ccb0d4
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 25 09:51:58 2017 +0100

tdf#113271 Fix order of color's attributes import.

The order of import color is very important in case of more than one color 
attributes was provided.
This order (theme -> rgb -> indexed -> auto) is not documented
and was gathered experimentally based on MS Excel 2013.

Information about :

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.fonts(v=office.14).aspx

Information about font:
https://msdn.microsoft.com/en-us/library/ff531892(v=office.12).aspx

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.font(v=office.14).aspx

More information about color class:

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.color(v=office.14).aspx
https://msdn.microsoft.com/en-us/library/ff532831(v=office.12).aspx

Example:
With indexed auto, colour, rgb and them,


The priority is as follows:
1. theme
2. rgb
3. indexed
4. auto

Change-Id: I7bb5ab7d7b7a52091f0130fd6f21bac44eca7408
Reviewed-on: https://gerrit.libreoffice.org/45266
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 7a33511ee449..15f1093b03a6 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -266,14 +266,16 @@ void Color::setIndexed( sal_Int32 nPaletteIdx, double 
fTint )
 
 void Color::importColor( const AttributeList& rAttribs )
 {
-if( rAttribs.getBool( XML_auto, false ) )
-setAuto();
+// tdf#113271 The order of import color is very important in case of more 
than one color attributes was provided.
+// This order (theme -> rgb -> indexed -> auto) is not documented and was 
gathered experimentally based on MS Excel 2013.
+if( rAttribs.hasAttribute( XML_theme ) )
+setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_rgb ) )
 setRgb( rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
-else if( rAttribs.hasAttribute( XML_theme ) )
-setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_indexed ) )
 setIndexed( rAttribs.getInteger( XML_indexed, -1 ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
+else if( rAttribs.getBool( XML_auto, false ) )
+setAuto();
 else
 {
 OSL_FAIL( "Color::importColor - unknown color type" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-28 Thread Bartosz Kosiorek
 sc/source/filter/oox/stylesbuffer.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 3278c8f9bb040cddd15d9e7eb4991d0447cbc964
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 25 09:51:58 2017 +0100

tdf#113271 Fix order of color's attributes import.

The order of import color is very important in case of more than one color 
attributes was provided.
This order (theme -> rgb -> indexed -> auto) is not documented
and was gathered experimentally based on MS Excel 2013.

Information about :

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.fonts(v=office.14).aspx

Information about font:
https://msdn.microsoft.com/en-us/library/ff531892(v=office.12).aspx

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.font(v=office.14).aspx

More information about color class:

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.color(v=office.14).aspx
https://msdn.microsoft.com/en-us/library/ff532831(v=office.12).aspx

Example:
With indexed auto, colour, rgb and them,


The priority is as follows:
1. theme
2. rgb
3. indexed
4. auto

Change-Id: I7bb5ab7d7b7a52091f0130fd6f21bac44eca7408
Reviewed-on: https://gerrit.libreoffice.org/45278
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 25fca16c643e..2711df0ad34f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -266,14 +266,16 @@ void Color::setIndexed( sal_Int32 nPaletteIdx, double 
fTint )
 
 void Color::importColor( const AttributeList& rAttribs )
 {
-if( rAttribs.getBool( XML_auto, false ) )
-setAuto();
+// tdf#113271 The order of import color is very important in case of more 
than one color attributes was provided.
+// This order (theme -> rgb -> indexed -> auto) is not documented and was 
gathered experimentally based on MS Excel 2013.
+if( rAttribs.hasAttribute( XML_theme ) )
+setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_rgb ) )
 setRgb( rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
-else if( rAttribs.hasAttribute( XML_theme ) )
-setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_indexed ) )
 setIndexed( rAttribs.getInteger( XML_indexed, -1 ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
+else if( rAttribs.getBool( XML_auto, false ) )
+setAuto();
 else
 {
 OSL_FAIL( "Color::importColor - unknown color type" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/source

2017-11-30 Thread Bartosz Kosiorek
 sc/source/filter/oox/stylesbuffer.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 5930033f050e933a134a1ff11974b8601d8a7f9a
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 25 09:51:58 2017 +0100

tdf#113271 Fix order of color's attributes import.

The order of import color is very important in case of more than one color 
attributes was provided.
This order (theme -> rgb -> indexed -> auto) is not documented
and was gathered experimentally based on MS Excel 2013.

Information about :

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.fonts(v=office.14).aspx

Information about font:
https://msdn.microsoft.com/en-us/library/ff531892(v=office.12).aspx

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.font(v=office.14).aspx

More information about color class:

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.color(v=office.14).aspx
https://msdn.microsoft.com/en-us/library/ff532831(v=office.12).aspx

Example:
With indexed auto, colour, rgb and them,


The priority is as follows:
1. theme
2. rgb
3. indexed
4. auto

Change-Id: I7bb5ab7d7b7a52091f0130fd6f21bac44eca7408
Reviewed-on: https://gerrit.libreoffice.org/45281
Reviewed-by: Eike Rathke <er...@redhat.com>
Reviewed-by: Caolán McNamara <caol...@redhat.com>
Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 7a33511ee449..15f1093b03a6 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -266,14 +266,16 @@ void Color::setIndexed( sal_Int32 nPaletteIdx, double 
fTint )
 
 void Color::importColor( const AttributeList& rAttribs )
 {
-if( rAttribs.getBool( XML_auto, false ) )
-setAuto();
+// tdf#113271 The order of import color is very important in case of more 
than one color attributes was provided.
+// This order (theme -> rgb -> indexed -> auto) is not documented and was 
gathered experimentally based on MS Excel 2013.
+if( rAttribs.hasAttribute( XML_theme ) )
+setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_rgb ) )
 setRgb( rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
-else if( rAttribs.hasAttribute( XML_theme ) )
-setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_indexed ) )
 setIndexed( rAttribs.getInteger( XML_indexed, -1 ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
+else if( rAttribs.getBool( XML_auto, false ) )
+setAuto();
 else
 {
 OSL_FAIL( "Color::importColor - unknown color type" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-17 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |   25 +
 1 file changed, 9 insertions(+), 16 deletions(-)

New commits:
commit 262bc4387970106f4fa9bf0b85cf82cbf645bcf8
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 17 01:23:23 2017 +0100

tdf#113451 Fix misplacing of lines by adding mappingChanged

Change-Id: I9b381f456d4c96369fdf7e94f161fde2723ebead
Reviewed-on: https://gerrit.libreoffice.org/44842
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index d9accffe80af..b9b60d021504 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -324,16 +324,11 @@ namespace emfplushelper
 
 if ( iter != map.end() )
 {
-wmfemfhelper::PropertyHolder state = iter->second;
 map.erase( iter );
-
 SAL_INFO("drawinglayer", "stack index: " << index << " found and 
erased");
 }
 
-wmfemfhelper::PropertyHolder state;
-
-state = mrPropertyHolders.Current();
-
+wmfemfhelper::PropertyHolder state = mrPropertyHolders.Current();
 map[ index ] = state;
 }
 
@@ -343,12 +338,12 @@ namespace emfplushelper
 
 if ( iter != map.end() )
 {
-SAL_INFO("drawinglayer", "stack index: " << index << " found");
-
 wmfemfhelper::PropertyHolder state = iter->second;
 
 maWorldTransform = state.getTransformation();
 rState.setClipPolyPolygon( state.getClipPolyPolygon() );
+mappingChanged();
+SAL_INFO("drawinglayer", "stack index: " << index << " found, 
maWorldTransform: " << maWorldTransform);
 }
 }
 
@@ -382,7 +377,7 @@ namespace emfplushelper
 }
 
 // transform and compare to 5 (the value 5 is determined by 
comparison to MSO)
-const double transformedPenWidth = std::max( 
MapSize(adjustedPenWidth,0).getX() , 5.);
+const double transformedPenWidth = std::max( 
MapSize(adjustedPenWidth, 0).getX(), 5.);
 drawinglayer::attribute::LineAttribute 
lineAttribute(pen->GetColor().getBColor(),
 
transformedPenWidth,
 lineJoin,
@@ -627,7 +622,7 @@ namespace emfplushelper
 {
 basegfx::B2DPoint aStartPoint = 
Map(brush->areaX,brush->areaY);
 aStartPoint = aPolygonTransformation * aStartPoint;
-basegfx::B2DPoint aEndPoint = Map(brush->areaX + 
brush->areaWidth ,brush->areaY + brush->areaHeight);
+basegfx::B2DPoint aEndPoint = Map(brush->areaX + 
brush->areaWidth, brush->areaY + brush->areaHeight);
 aEndPoint = aPolygonTransformation * aEndPoint;
 
 // create the same one used for SVG
@@ -1234,7 +1229,7 @@ namespace emfplushelper
 {
 break;
 }
-
mrPropertyHolders.Current().setFont(vcl::Font(font->family , 
Size(font->emSize,font->emSize)));
+
mrPropertyHolders.Current().setFont(vcl::Font(font->family, Size(font->emSize, 
font->emSize)));
 // done reading
 
 // transform to TextSimplePortionPrimitive2D
@@ -1461,8 +1456,8 @@ namespace emfplushelper
 transform.set(0, 0, eSx);
 transform.set(1, 1, eSy);
 
-SAL_INFO("drawinglayer", "EMF+ ScaleWorldTransform Sx: 
" << transform.get(0,0) <<
- " Sy: " << transform.get(1,1) << ", Post 
multiply:" << (flags & 0x2000));
+SAL_INFO("drawinglayer", "EMF+ ScaleWorldTransform Sx: 
" << eSx <<
+ " Sy: " << eSy << ", Post multiply:" << 
(flags & 0x2000));
 SAL_INFO("drawinglayer",
  "EMF+\t World transform matrix: " << 
maWorldTransform);
 
@@ -1613,9 +1608,7 @@ namespace emfplushelper
 if (hasMatrix)
 {
 readXForm(rMS, transform);
-SAL_INFO("drawinglayer", "EMF+\tmatrix: " << 
transform.get(0,0) <

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

2017-11-17 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfpbrush.cxx |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit c1c868003e129ff286ccd787e22f1a64a75de58a
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 17 09:56:00 2017 +0100

tdf#111486 Use buildin methods for displaying matrix

Change-Id: I0f40f7178be126229c8963b56e6a15313acc19a7
Reviewed-on: https://gerrit.libreoffice.org/44868
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfpbrush.cxx 
b/drawinglayer/source/tools/emfpbrush.cxx
index 4d743d10b684..68ec151a6fe8 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -210,14 +210,9 @@ namespace emfplushelper
 
 if (additionalFlags & 0x02)
 {
-SAL_INFO("drawinglayer", "EMF+\tuse transformation");
 EmfPlusHelperData::readXForm(s, brush_transformation);
 hasTransformation = true;
-SAL_INFO("drawinglayer",
-"EMF+\tm11: " << brush_transformation.get(0,0) 
<< " m12: " << brush_transformation.get(1,0) <<
-"\nEMF+\tm21: " << 
brush_transformation.get(0,1) << " m22: " << brush_transformation.get(1,1) <<
-"\nEMF+\tdx: " << 
brush_transformation.get(0,2) << " dy: " << brush_transformation.get(1,2));
-
+SAL_INFO("drawinglayer", "EMF+\tuse brush transformation: 
" << brush_transformation);
 }
 
 if (additionalFlags & 0x08)
@@ -296,13 +291,9 @@ namespace emfplushelper
 
 if (additionalFlags & 0x02)
 {
-SAL_INFO("drawinglayer", "EMF+\tuse transformation");
 EmfPlusHelperData::readXForm(s, brush_transformation);
 hasTransformation = true;
-SAL_INFO("drawinglayer",
-"EMF+\tm11: " << brush_transformation.get(0,0) << " 
m12: " << brush_transformation.get(1,0) <<
-"\nEMF+\tm21: " << brush_transformation.get(0,1) << " 
m22: " << brush_transformation.get(1,1) <<
-"\nEMF+\tdx: " << brush_transformation.get(0,2) << " 
dy: " << brush_transformation.get(1,2));
+SAL_INFO("drawinglayer", "EMF+\tuse brush transformation: 
" << brush_transformation);
 }
 
 if (additionalFlags & 0x08)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-13 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 2796b7e298b7c536a87fdf9502e1a6093a041e93
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Tue Nov 14 00:10:47 2017 +0100

tdf#113758 EMF+ Add mapping of clipped region to the world space.

OffsetClip record applies a translation transform
on the current clipping region for the world space.

Change-Id: I5d23f6aac944e4f23ea7c51e47fb551a20166446
Reviewed-on: https://gerrit.libreoffice.org/44699
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Mark Page <aptit...@btconnect.com>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index a1cdab8559d5..6d9a8a499f8c 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1593,13 +1593,20 @@ namespace emfplushelper
 
 basegfx::B2DPolyPolygon aPolyPolygon(
 
mrPropertyHolders.Current().getClipPolyPolygon());
+
+SAL_INFO("drawinglayer",
+ "EMF+\t PolyPolygon before translate: " << 
aPolyPolygon);
+
+basegfx::B2DPoint aOffset = Map(dx, dy);
 basegfx::B2DHomMatrix transformMatrix;
-transformMatrix.set(0, 2, dx);
-transformMatrix.set(1, 2, dy);
+transformMatrix.set(0, 2, aOffset.getX());
+transformMatrix.set(1, 2, aOffset.getY());
 aPolyPolygon.transform(transformMatrix);
 
+SAL_INFO("drawinglayer",
+ "EMF+\t PolyPolygon after translate: " << 
aPolyPolygon <<
+ ", mapped offset x" << aOffset.getX() << ", 
mapped offset y" << aOffset.getY());
 HandleNewClipRegion(aPolyPolygon, mrTargetHolders, 
mrPropertyHolders);
-
 break;
 }
 case EmfPlusRecordTypeDrawDriverString:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-13 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |   22 --
 drawinglayer/source/tools/emfphelperdata.hxx |2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit 6db0267156030ca24163efd9b66278f54bf28d73
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 10 14:08:38 2017 +0100

tdf#113758 EMF+ Add support to OffsetClip record

OffsetClip record applies a translation transform
on the current clipping region for the world space.

Change-Id: Iac024a3c2eaba58edc5bb59d817796b6022f559f
Reviewed-on: https://gerrit.libreoffice.org/44597
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Mark Page <aptit...@btconnect.com>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index d791eb034309..a1cdab8559d5 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -89,6 +89,7 @@ namespace emfplushelper
 case EmfPlusRecordTypeSetClipRect: return 
"EmfPlusRecordTypeSetClipRect";
 case EmfPlusRecordTypeSetClipPath: return 
"EmfPlusRecordTypeSetClipPath";
 case EmfPlusRecordTypeSetClipRegion: return 
"EmfPlusRecordTypeSetClipRegion";
+case EmfPlusRecordTypeOffsetClip: return 
"EmfPlusRecordTypeOffsetClip";
 case EmfPlusRecordTypeDrawDriverString: return 
"EmfPlusRecordTypeDrawDriverString";
 }
 return "";
@@ -1506,7 +1507,7 @@ namespace emfplushelper
 float eAngle;
 rMS.ReadFloat(eAngle);
 
-SAL_INFO("drawinglayer", "EMF+ 
EmfPlusRecordTypeRotateWorldTransform Angle: " << eAngle <<
+SAL_INFO("drawinglayer", "EMF+ RotateWorldTransform 
Angle: " << eAngle <<
  ", post multiply: " << (flags & 0x2000));
 // Skipping flags & 0x2000
 // For rotation transformation there is no difference 
between post and pre multiply
@@ -1519,7 +1520,7 @@ namespace emfplushelper
 }
 case EmfPlusRecordTypeResetClip:
 {
-SAL_INFO("drawinglayer", "EMF+ 
EmfPlusRecordTypeResetClip");
+SAL_INFO("drawinglayer", "EMF+ ResetClip");
 // We don't need to read anything more, as Size needs 
to be set 0x000C
 // and DataSize must be set to 0.
 
@@ -1584,6 +1585,23 @@ namespace emfplushelper
 }
 break;
 }
+case EmfPlusRecordTypeOffsetClip:
+{
+float dx, dy;
+rMS.ReadFloat(dx).ReadFloat(dy);
+SAL_INFO("drawinglayer", "EMF+ OffsetClip, Offset x:" 
<< dx << ", y:" << dy);
+
+basegfx::B2DPolyPolygon aPolyPolygon(
+
mrPropertyHolders.Current().getClipPolyPolygon());
+basegfx::B2DHomMatrix transformMatrix;
+transformMatrix.set(0, 2, dx);
+transformMatrix.set(1, 2, dy);
+aPolyPolygon.transform(transformMatrix);
+
+HandleNewClipRegion(aPolyPolygon, mrTargetHolders, 
mrPropertyHolders);
+
+break;
+}
 case EmfPlusRecordTypeDrawDriverString:
 {
 SAL_INFO("drawinglayer", "EMF+ DrawDriverString, 
flags: 0x" << std::hex << flags << std::dec);
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx 
b/drawinglayer/source/tools/emfphelperdata.hxx
index 71aa0758544f..8c91e4edadb0 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -86,7 +86,7 @@ namespace emfplushelper
 #define EmfPlusRecordTypeSetClipRect 0x4032
 #define EmfPlusRecordTypeSetClipPath 0x4033
 #define EmfPlusRecordTypeSetClipRegion 0x4034
-//TODO EmfPlusRecordTypeOffsetClip 0x4035
+#define EmfPlusRecordTypeOffsetClip 0x4035
 #define EmfPlusRecordTypeDrawDriverString 0x4036
 //TODO EmfPlusRecordTypeStrokeFillPath 0x4037
 //TODO EmfPlusRecordTypeSerializableObject 0x4038
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-21 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 7c1577ae16cd7ae402d1f61d831232c783bb9df6
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sat Nov 18 23:47:03 2017 +0100

tdf#112500 Store world transform during graphic save

Change-Id: Iefa51dcca6d6b896fbd41cefc0a115c501c45675
Reviewed-on: https://gerrit.libreoffice.org/44923
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Patrick Jaap <patrick.j...@tu-dresden.de>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index d3c7fbc98718..bd1f9e9b071a 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -329,6 +329,8 @@ namespace emfplushelper
 }
 
 wmfemfhelper::PropertyHolder state = mrPropertyHolders.Current();
+// tdf#112500 We need to save world transform somehow, during graphic 
state push
+state.setTransformation(maWorldTransform);
 map[ index ] = state;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-18 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 63bd6ee2c49f2d0c77c542778fc43ad476f6451b
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Fri Nov 17 10:49:01 2017 +0100

tdf#111486 Multiply by whole base transformation, and not only by scale of 
it

Change-Id: Ib50fa1ac36f06dbd7e5e921f9c13c5d5ac8bb138
Reviewed-on: https://gerrit.libreoffice.org/44869
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index b9b60d021504..d3c7fbc98718 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -285,7 +285,7 @@ namespace emfplushelper
 maMapTransform = maWorldTransform;
 maMapTransform *= basegfx::utils::createScaleB2DHomMatrix(100.0 * 
mnMmX / mnPixX, 100.0 * mnMmY / mnPixY);
 maMapTransform *= 
basegfx::utils::createTranslateB2DHomMatrix(double(-mnFrameLeft), 
double(-mnFrameTop));
-maMapTransform *= 
basegfx::utils::createScaleB2DHomMatrix(maBaseTransform.get(0, 0), 
maBaseTransform.get(1, 1));
+maMapTransform *= maBaseTransform;
 }
 
 ::basegfx::B2DPoint EmfPlusHelperData::Map(double ix, double iy) const
@@ -689,6 +689,7 @@ namespace emfplushelper
 
rMS.ReadInt32(mnPixX).ReadInt32(mnPixY).ReadInt32(mnMmX).ReadInt32(mnMmY);
 SAL_INFO("drawinglayer", "EMF+ ref device pixel size: " << mnPixX << 
"x" << mnPixY << " mm size: " << mnMmX << "x" << mnMmY);
 readXForm(rMS, maBaseTransform);
+SAL_INFO("drawinglayer", "EMF+ base transform: " << maBaseTransform);
 mappingChanged();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-16 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfpbrush.cxx |4 
 drawinglayer/source/tools/emfpcustomlinecap.cxx |2 
 drawinglayer/source/tools/emfphelperdata.cxx|   68 +++-
 drawinglayer/source/tools/emfphelperdata.hxx|5 
 drawinglayer/source/tools/emfppath.cxx  |   32 -
 drawinglayer/source/tools/emfppath.hxx  |4 
 drawinglayer/source/tools/emfpregion.cxx|  133 
 drawinglayer/source/tools/emfpregion.hxx|   21 ++-
 8 files changed, 131 insertions(+), 138 deletions(-)

New commits:
commit d0c4cee7e5ad00363d264aec0011a4b07983b19d
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Sun Nov 5 00:02:49 2017 +0100

tdf#113704 Implement proper reading of the EmfPlusRegionNode

Regions are specified as a binary tree of region nodes, and each node must
either be a terminal node or specify one or two child nodes.

Nodes contains two child nodes:
  RegionNodeDataTypeAnd = 0x0001,
  RegionNodeDataTypeOr = 0x0002,
  RegionNodeDataTypeXor = 0x0003,
  RegionNodeDataTypeExclude = 0x0004,
  RegionNodeDataTypeComplement = 0x0005,

Terminal nodes:
  RegionNodeDataTypeRect = 0x1000,
  RegionNodeDataTypePath = 0x1001,
  RegionNodeDataTypeEmpty = 0x1002,
  RegionNodeDataTypeInfinite = 0x1003

RegionNode must contain at least one element.

Change-Id: I668e5892701b979f09bcf5bbce44a43226676192
Reviewed-on: https://gerrit.libreoffice.org/44324
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
    Tested-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfpbrush.cxx 
b/drawinglayer/source/tools/emfpbrush.cxx
index c6444631e1af..4d743d10b684 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -181,7 +181,7 @@ namespace emfplushelper
 SAL_INFO("drawinglayer", "EMF+\theader: 0x" << std::hex << 
pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" 
<< std::hex << pathFlags << std::dec);
 
 path = new EMFPPath(pathPoints);
-path->Read(s, pathFlags, rR);
+path->Read(s, pathFlags);
 
 s.Seek(pos + pathLength);
 
@@ -198,7 +198,7 @@ namespace emfplushelper
 sal_uInt64 const pos = s.Tell();
 SAL_INFO("drawinglayer", "EMF+\t use boundary, points: " 
<< boundaryPointCount);
 path = new EMFPPath(boundaryPointCount);
-path->Read(s, 0x0, rR);
+path->Read(s, 0x0);
 
 s.Seek(pos + 8 * boundaryPointCount);
 
diff --git a/drawinglayer/source/tools/emfpcustomlinecap.cxx 
b/drawinglayer/source/tools/emfpcustomlinecap.cxx
index 4357276a18f8..91eeb4ea8c52 100644
--- a/drawinglayer/source/tools/emfpcustomlinecap.cxx
+++ b/drawinglayer/source/tools/emfpcustomlinecap.cxx
@@ -81,7 +81,7 @@ namespace emfplushelper
 SAL_INFO("drawinglayer", "EMF+\t\theader: 0x" << std::hex << 
pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" 
<< std::hex << pathFlags << std::dec);
 
 EMFPPath path(pathPoints);
-path.Read(s, pathFlags, rR);
+path.Read(s, pathFlags);
 polygon = path.GetPolygon(rR, false);
 mbIsFilled = bFill;
 
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 6d9a8a499f8c..9d2c7db10008 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -138,14 +138,14 @@ namespace emfplushelper
 SAL_INFO("drawinglayer", "EMF+\theader: 0x" << std::hex << 
header << " points: " << std::dec << points << " additional flags: 0x" << 
std::hex << pathFlags << std::dec);
 EMFPPath *path;
 maEMFPObjects[index].reset(path = new EMFPPath(points));
-path->Read(rObjectStream, pathFlags, *this);
+path->Read(rObjectStream, pathFlags);
 break;
 }
 case EmfPlusObjectTypeRegion:
 {
 EMFPRegion *region;
 maEMFPObjects[index].reset(region = new EMFPRegion());
-region->Read(rObjectStream);
+region->ReadRegion(rObjectStream, *this);
 break;
 }
 case EmfPlusObjectTypeImage:
@@ -700,74 +700,52 @@ namespace emfplushelper
 {
 }
 
-void EmfPlusHelperData::combineClip(int comb

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

2017-11-16 Thread Bartosz Kosiorek
 drawinglayer/source/tools/emfphelperdata.cxx |   39 +++
 drawinglayer/source/tools/emfphelperdata.hxx |2 -
 2 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit d552f67f5ee508ac6fbe03d16e6ba3ac429c3a48
Author: Bartosz Kosiorek <gan...@poczta.onet.pl>
Date:   Wed Nov 15 23:04:53 2017 +0100

tdf#113704 EMF+ Add support for EmfPlusRecordTypeFillRegion record

Change-Id: I60366d4a27fdf5a3cc020ca54f4a2aa9b974db5e
Reviewed-on: https://gerrit.libreoffice.org/44795
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 9d2c7db10008..d9accffe80af 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -63,6 +63,7 @@ namespace emfplushelper
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
 case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
 case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
+case EmfPlusRecordTypeFillRegion: return 
"EmfPlusRecordTypeFillRegion";
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
@@ -179,17 +180,17 @@ namespace emfplushelper
 }
 case EmfPlusObjectTypeImageAttributes:
 {
-SAL_INFO("drawinglayer", "EMF+\t Object type 'image 
attributes' not yet implemented");
+SAL_WARN("drawinglayer", "EMF+\t TODO Object type 'image 
attributes' not yet implemented");
 break;
 }
 case EmfPlusObjectTypeCustomLineCap:
 {
-SAL_INFO("drawinglayer", "EMF+\t Object type 'custom line cap' 
not yet implemented");
+SAL_WARN("drawinglayer", "EMF+\t TODO Object type 'custom line 
cap' not yet implemented");
 break;
 }
 default:
 {
-SAL_INFO("drawinglayer", "EMF+\tObject unhandled flags: 0x" << 
std::hex << (flags & 0xff00) << std::dec);
+SAL_WARN("drawinglayer", "EMF+\t TODO Object unhandled flags: 
0x" << std::hex << (flags & 0xff00) << std::dec);
 }
 }
 }
@@ -459,9 +460,9 @@ namespace emfplushelper
 if (!polygon.count())
   return;
 
-SAL_INFO("drawinglayer", "EMF+\tfill polygon");
 if (isColor) // use Color
 {
+SAL_INFO("drawinglayer", "EMF+\t Fill polygon, ARGB color: 0x" << 
std::hex << brushIndexOrColor << std::dec);
 mrTargetHolders.Current().append(
 
o3tl::make_unique(
 polygon,
@@ -474,7 +475,7 @@ namespace emfplushelper
 else // use Brush
 {
 EMFPBrush* brush = static_cast<EMFPBrush*>( 
maEMFPObjects[brushIndexOrColor & 0xff].get() );
-SAL_INFO("drawinglayer", "EMF+\tbrush fill slot: " << 
brushIndexOrColor << " (type: " << (brush ? brush->GetType() : -1) << ")");
+SAL_INFO("drawinglayer", "EMF+\t Fill polygon, brush slot: " << 
brushIndexOrColor << " (brush type: " << (brush ? brush->GetType() : -1) << 
")");
 
 // give up in case something wrong happened
 if( !brush )
@@ -942,6 +943,16 @@ namespace emfplushelper
 
EMFPPlusFillPolygon(static_cast<EMFPPath*>(maEMFPObjects[index].get())->GetPolygon(*this),
 flags & 0x8000, brushIndexOrColor);
 }
 break;
+case EmfPlusRecordTypeFillRegion:
+{
+sal_uInt32 index = flags & 0xff;
+sal_uInt32 brushIndexOrColor;
+rMS.ReadUInt32(brushIndexOrColor);
+SAL_INFO("drawinglayer", "EMF+ FillRegion slot: " << 
index);
+
+
EMFPPlusFillPolygon(static_cast<EMFPRegion*>(maEMFPObjects[flags & 
0xff].get())->regionPolyPolygon, flags & 0x8000, brushIndexOrColor);
+}
+break;
 case EmfPlusRecordTypeDrawEllipse:
 case EmfPlusRecordTypeFillEllipse:

  1   2   3   >