[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-08-15 Thread Akash Shetye
 sc/source/filter/inc/stylesbuffer.hxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit ad94a0ff3624d6507ab7f1ac4f891ec10b55b239
Author: Akash Shetye 
Date:   Thu Aug 15 20:07:01 2013 +0530

Iron out recent commit for code uniformity

Change-Id: I58667da96391ce570845b525a64b99502330a9e2

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index 9654159..fb6a67f 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -787,8 +787,9 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
 
 // 
 
-struct TableStyleElementModel{
-int maDxfId;
+struct TableStyleElementModel
+{
+sal_int32 maDxfId;
 OUString maStyleElementType;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-08-12 Thread Akash Shetye
 sc/source/filter/inc/stylesbuffer.hxx |8 
 sc/source/filter/oox/stylesbuffer.cxx |   30 ++
 2 files changed, 26 insertions(+), 12 deletions(-)

New commits:
commit 77aaa44c9f4f207b9176c5ac63c875be5ed8e4a5
Author: Akash Shetye 
Date:   Tue Aug 13 06:30:52 2013 +0530

Solves Dxf styles related to table formatting not being imported correctly.

Change-Id: Ifc0e27378b1e894e2ab4393100f295de101d009b

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index c3fa63e..9654159 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "oox/drawingml/color.hxx"
 #include "oox/helper/graphichelper.hxx"
 #include "oox/helper/refmap.hxx"
@@ -786,6 +787,11 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
 
 // 
 
+struct TableStyleElementModel{
+int maDxfId;
+OUString maStyleElementType;
+};
+
 /* Contains attributes for table styles from the  element */
 class TableStyle : public WorkbookHelper
 {
@@ -797,7 +803,9 @@ public:
 ScDBDataFormatting& getTableFormatting(); //not const since it will be 
edited and put in ScDBData objects
 private:
 typedef ::boost::shared_ptr< ::ScDBDataFormatting > TableFormattingRef;
+typedef std::vector< TableStyleElementModel > TableStyleElementModelVector;
 
+TableStyleElementModelVector maStyleElementVector;
 TableFormattingRef mxTableFormatting;
 };
 
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index b058ce3..82f9315 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2646,18 +2646,10 @@ void TableStyle::importTableStyleElement( const 
AttributeList& rAttribs )
 //Extract the Dxf Id and create such a style
 sal_Int32 aDxfId = static_cast< sal_Int32 >( rAttribs.getInteger( 
XML_dxfId, -1 ) );
 SAL_WARN_IF( (aDxfId == -1) ,"sc", "TableStyle::importTableStyleElement - 
DxfId not defined for table style element" );
-//Should I stop on finding this missing feild or keep going?
-OUString aDxfStyleName = getStyles().createDxfStyle( aDxfId );
-if( aStyleElementType.equals("firstColumnStripe") )
-mxTableFormatting->SetFirstColStripeStyle( aDxfStyleName );
-else if( aStyleElementType.equals("secondColumnStripe") )
-mxTableFormatting->SetSecondColStripeStyle( aDxfStyleName );
-else if( aStyleElementType.equals("firstRowStripe") )
-mxTableFormatting->SetFirstRowStripeStyle( aDxfStyleName );
-else if( aStyleElementType.equals("secondRowStripe") )
-mxTableFormatting->SetSecondRowStripeStyle( aDxfStyleName );
-//Though the Dxf styles are being imported, the bsckground color etc
-//is not showing up.
+TableStyleElementModel aTableStyleElementModel;
+aTableStyleElementModel.maDxfId = aDxfId;
+aTableStyleElementModel.maStyleElementType = aStyleElementType;
+maStyleElementVector.push_back( aTableStyleElementModel );
 }
 
 const OUString& TableStyle::getTableStyleName() const
@@ -2672,6 +2664,20 @@ ScDBDataFormatting& TableStyle::getTableFormatting()
 
 void TableStyle::finalizeImport()
 {
+//Iterate through each of the elements in maStyleElementVector
+for( TableStyleElementModelVector::iterator itr = 
maStyleElementVector.begin(); itr!=maStyleElementVector.end(); ++itr)
+{
+//Should I stop on finding this missing feild or keep going?
+OUString aDxfStyleName = getStyles().createDxfStyle( itr->maDxfId );
+if( itr->maStyleElementType.equals("firstColumnStripe") )
+mxTableFormatting->SetFirstColStripeStyle( aDxfStyleName );
+else if( itr->maStyleElementType.equals("secondColumnStripe") )
+mxTableFormatting->SetSecondColStripeStyle( aDxfStyleName );
+else if( itr->maStyleElementType.equals("firstRowStripe") )
+mxTableFormatting->SetFirstRowStripeStyle( aDxfStyleName );
+else if( itr->maStyleElementType.equals("secondRowStripe") )
+mxTableFormatting->SetSecondRowStripeStyle( aDxfStyleName );
+}
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-08-01 Thread Akash Shetye
 sc/source/filter/excel/xedbdata.cxx |   15 +++
 sc/source/filter/inc/xedbdata.hxx   |   12 
 2 files changed, 27 insertions(+)

New commits:
commit ab8bbaa201ccac63b2c17fc7d92b2dead8e68f53
Author: Akash Shetye 
Date:   Fri Aug 2 01:29:28 2013 +0530

Added Auto Filter export for DBData (tables) to xlsx

Change-Id: I302f492f9c5ba3e886fdca4e5e76aa8c5813aa94

diff --git a/sc/source/filter/excel/xedbdata.cxx 
b/sc/source/filter/excel/xedbdata.cxx
index a2e7c5e..d38cb95 100644
--- a/sc/source/filter/excel/xedbdata.cxx
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -84,6 +84,19 @@ void XclExpXmlDBDataColumns::SaveXml( XclExpXmlStream& rStrm 
)
 }
 
 // 
+XclExpXmlDBDataAutoFilter::XclExpXmlDBDataAutoFilter( const XclExpRoot& rRoot, 
ScRange& rRange )
+: XclExpRoot( rRoot ),
+  maRange( rRange )
+{
+}
+
+void XclExpXmlDBDataAutoFilter::SaveXml( XclExpXmlStream& rStrm )
+{
+sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
+rDBDataTable->singleElement( XML_autoFilter, XML_ref, 
XclXmlUtils::ToOString( maRange ).getStr(), FSEND);
+}
+
+// 
 XclExpXmlDBDataTable::XclExpXmlDBDataTable(const XclExpRoot& rRoot, ScDBData& 
rDBData, int nTableId )
 : XclExpRoot( rRoot ),
   mnTableId( nTableId )
@@ -96,11 +109,13 @@ XclExpXmlDBDataTable::XclExpXmlDBDataTable(const 
XclExpRoot& rRoot, ScDBData& rD
 mbTotalsRowShown = false; // Not supported yet in ScDBData
 rDBData.GetArea( maRange );
 maStyleInfo.reset( new XclExpXmlDBDataStyleInfo( rRoot, aDBFormatting) );
+maAutoFilter.reset( new XclExpXmlDBDataAutoFilter( rRoot, maRange ) );
 }
 void XclExpXmlDBDataTable::SaveXml( XclExpXmlStream& rStrm )
 {
 sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
 rDBDataTable->startElement( XML_table,  XML_id, OString::number( mnTableId 
).getStr(), XML_name, OUStringToOString( maName, RTL_TEXTENCODING_UTF8 
).getStr(), XML_displayName, OUStringToOString( maDisplayName, 
RTL_TEXTENCODING_UTF8 ).getStr(), XML_ref, XclXmlUtils::ToOString( maRange 
).getStr() ,FSEND);
+maAutoFilter->SaveXml( rStrm );
 maTableColumns->SaveXml( rStrm );
 maStyleInfo->SaveXml( rStrm );
 rDBDataTable->endElement( XML_table );
diff --git a/sc/source/filter/inc/xedbdata.hxx 
b/sc/source/filter/inc/xedbdata.hxx
index 1b23183..d3edd2a 100644
--- a/sc/source/filter/inc/xedbdata.hxx
+++ b/sc/source/filter/inc/xedbdata.hxx
@@ -61,6 +61,16 @@ private:
 };
 
 // 
+class XclExpXmlDBDataAutoFilter : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+XclExpXmlDBDataAutoFilter( const XclExpRoot& rRoot, ScRange& pRange );
+virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+ScRange maRange;
+};
+
+// 
 class XclExpXmlDBDataTable : public XclExpRecordBase, protected XclExpRoot
 {
 public:
@@ -69,8 +79,10 @@ public:
 private:
 typedef boost::scoped_ptr < XclExpXmlDBDataColumns > DBDataTableColumns;
 typedef boost::scoped_ptr < XclExpXmlDBDataStyleInfo > DBDataStyleInfo;
+typedef boost::scoped_ptr < XclExpXmlDBDataAutoFilter > DBDataAutoFilter;
 DBDataTableColumns maTableColumns;
 DBDataStyleInfo maStyleInfo;
+DBDataAutoFilter maAutoFilter;
 int mnTableId;
 OUString maName;
 OUString maDisplayName;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-08-01 Thread Akash Shetye
 sc/source/filter/excel/xedbdata.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit a50945b419c5748375681f10a9279519c1ddb60b
Author: Akash Shetye 
Date:   Fri Aug 2 00:46:04 2013 +0530

Minor tweak about using container.size

Change-Id: I0987646c007e5a94f7bf83398ef911a8fb9ec9d7

diff --git a/sc/source/filter/excel/xedbdata.cxx 
b/sc/source/filter/excel/xedbdata.cxx
index 3a9509b..a2e7c5e 100644
--- a/sc/source/filter/excel/xedbdata.cxx
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -64,7 +64,6 @@ XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const 
XclExpRoot& rRoot, ScDBDat
 aRange.GetVars( anCol1, anRow1, anTab1, anCol2, anRow2, anTab2 );
 anTotalCols = (anCol2 - anCol1) + 1; //addressing starts from 0
 // Needs special handling for different tab ranges
-//miCount = anTotalCols;
 OUString aColName = "Column";
 for( int i = 1; i <= anTotalCols; i++ )
 {
@@ -112,7 +111,6 @@ void XclExpXmlDBDataTable::SaveXml( XclExpXmlStream& rStrm )
 XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot )
 : XclExpRoot( rRoot )
 {
-int nCount = 0;
 ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection();
 if( pDBCollection )
 {
@@ -121,8 +119,7 @@ XclExpXmlDBDataTables::XclExpXmlDBDataTables( const 
XclExpRoot& rRoot )
 ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end();
 for(; itr!= itrEnd; ++itr)
 {
-++nCount;
-maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, 
*itr, nCount ) );
+maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, 
*itr, (maDBDataTableContainer.size() + 1) ) );// Tables are ID'ed 1 - based
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-08-01 Thread Akash Shetye
 sc/source/filter/excel/xedbdata.cxx |   12 ++--
 sc/source/filter/inc/xedbdata.hxx   |2 --
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 92049e8c51634a838d9dc7999415e5606a9dd3c5
Author: Akash Shetye 
Date:   Thu Aug 1 23:05:43 2013 +0530

Used container.size instead of a separate count member

Change-Id: I7715f865bc30aafd62b053f6f20f2fa3af9ae3ec

diff --git a/sc/source/filter/excel/xedbdata.cxx 
b/sc/source/filter/excel/xedbdata.cxx
index 0b178ac..3a9509b 100644
--- a/sc/source/filter/excel/xedbdata.cxx
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -64,7 +64,7 @@ XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const 
XclExpRoot& rRoot, ScDBDat
 aRange.GetVars( anCol1, anRow1, anTab1, anCol2, anRow2, anTab2 );
 anTotalCols = (anCol2 - anCol1) + 1; //addressing starts from 0
 // Needs special handling for different tab ranges
-miCount = anTotalCols;
+//miCount = anTotalCols;
 OUString aColName = "Column";
 for( int i = 1; i <= anTotalCols; i++ )
 {
@@ -76,7 +76,7 @@ XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const 
XclExpRoot& rRoot, ScDBDat
 void XclExpXmlDBDataColumns::SaveXml( XclExpXmlStream& rStrm )
 {
sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
-   rDBDataTable->startElement( XML_tableColumns, XML_count, OString::number( 
miCount ).getStr(), FSEND );
+   rDBDataTable->startElement( XML_tableColumns, XML_count, OString::number( 
maDBDataColumnContainer.size() ).getStr(), FSEND );
 for ( DBDataColumnContainer::iterator itr = 
maDBDataColumnContainer.begin(); itr != maDBDataColumnContainer.end(); ++itr )
 {
 itr->SaveXml( rStrm );
@@ -112,7 +112,7 @@ void XclExpXmlDBDataTable::SaveXml( XclExpXmlStream& rStrm )
 XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot )
 : XclExpRoot( rRoot )
 {
-miCount = 0;
+int nCount = 0;
 ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection();
 if( pDBCollection )
 {
@@ -121,8 +121,8 @@ XclExpXmlDBDataTables::XclExpXmlDBDataTables( const 
XclExpRoot& rRoot )
 ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end();
 for(; itr!= itrEnd; ++itr)
 {
-++miCount;
-maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, 
*itr, miCount ) );
+++nCount;
+maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, 
*itr, nCount ) );
 }
 }
 }
@@ -130,7 +130,7 @@ XclExpXmlDBDataTables::XclExpXmlDBDataTables( const 
XclExpRoot& rRoot )
 void XclExpXmlDBDataTables::SaveXml( XclExpXmlStream& rStrm )
 {
 // We only make the table folder is we do have any DB Data to write in
-if( miCount != 0 )
+if( maDBDataTableContainer.size() != 0 )
 {
 //Now parse through each of the DB Datas making an xml for each.
 int i = 1;
diff --git a/sc/source/filter/inc/xedbdata.hxx 
b/sc/source/filter/inc/xedbdata.hxx
index 187e8c3..1b23183 100644
--- a/sc/source/filter/inc/xedbdata.hxx
+++ b/sc/source/filter/inc/xedbdata.hxx
@@ -58,7 +58,6 @@ public:
 private:
 typedef boost::ptr_vector< XclExpXmlDBDataColumn > DBDataColumnContainer;
 DBDataColumnContainer maDBDataColumnContainer;
-int miCount;
 };
 
 // 
@@ -88,7 +87,6 @@ public:
 private:
 typedef boost::ptr_vector< XclExpXmlDBDataTable > DBDataTableContainer;
 DBDataTableContainer maDBDataTableContainer;
-int miCount;
 };
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-07-29 Thread Akash Shetye
 sc/source/filter/excel/xedbdata.cxx |   86 
 sc/source/filter/inc/xedbdata.hxx   |   81 +
 2 files changed, 167 insertions(+)

New commits:
commit fa3d3c870b4bbe9c20ab905f91a78840cc21
Author: Akash Shetye 
Date:   Tue Jul 30 08:08:13 2013 +0530

Part 1 of Adding DB Data export

Adding this skeleton for all the constructs for DB Data export

Change-Id: I7510358af5f2ac92bd7f2ec7d1af4170ec8f763c

diff --git a/sc/source/filter/excel/xedbdata.cxx 
b/sc/source/filter/excel/xedbdata.cxx
new file mode 100644
index 000..ebce789
--- /dev/null
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "xedbdata.hxx"
+#include "document.hxx"
+
+XclExpXmlDBDataStyleInfo::XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, 
ScDBDataFormatting& rDBDataFormatting )
+: XclExpRoot( rRoot )
+{
+}
+
+void XclExpXmlDBDataStyleInfo::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// 
+XclExpXmlDBDataColumn::XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int 
iID, OUString& rName )
+: XclExpRoot( rRoot )
+{
+}
+
+void XclExpXmlDBDataColumn::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// 
+XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const XclExpRoot& rRoot, 
ScDBData& rDBData )
+: XclExpRoot( rRoot )
+{
+}
+
+void XclExpXmlDBDataColumns::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// 
+XclExpXmlDBDataTable::XclExpXmlDBDataTable(const XclExpRoot& rRoot, ScDBData& 
rDBData )
+: XclExpRoot( rRoot )
+{
+maTableColumns.reset( new XclExpXmlDBDataColumns( rRoot, rDBData ) );
+ScDBDataFormatting aDBFormatting;
+rDBData.GetTableFormatting( aDBFormatting );
+maStyleInfo.reset( new XclExpXmlDBDataStyleInfo( rRoot, aDBFormatting) );
+}
+void XclExpXmlDBDataTable::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// 
=
+XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot )
+: XclExpRoot( rRoot )
+{
+ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection();
+if( pDBCollection )
+{
+ScDBCollection::NamedDBs& aNamedDBs = pDBCollection->getNamedDBs();
+ScDBCollection::NamedDBs::iterator itr = aNamedDBs.begin();
+ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end();
+for(; itr!= itrEnd; ++itr)
+{
+maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, 
*itr ) );
+++miCount;
+}
+}
+}
+
+void XclExpXmlDBDataTables::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+// 
=
diff --git a/sc/source/filter/inc/xedbdata.hxx 
b/sc/source/filter/inc/xedbdata.hxx
new file mode 100644
index 000..d05b683
--- /dev/null
+++ b/sc/source/filter/inc/xedbdata.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SC_XEDBDATA_HXX
+#define SC_ZEDBDATA_HXX
+
+#include 

[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-07-28 Thread Akash Shetye
 sc/source/filter/excel/xestyle.cxx |   20 ++--
 sc/source/filter/inc/xestyle.hxx   |1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 244821c0df2baca727d0e770ed9906be713b0be1
Author: Akash Shetye 
Date:   Sun Jul 28 17:53:04 2013 +0530

Patch adds check for ensuring atleast one table style exists

Earlier code just added a new style and did not perform any checks to 
ensure atleast one style was present, this stops excel from creating empty 
table style tags.

Change-Id: Ib83e8001410b65aa129fb22b032956c9bd7e1ddd

diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 11c3faf..2e0a74e 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3212,6 +3212,9 @@ void XclExpTableStyle::SaveXml( XclExpXmlStream& rStrm )
 XclExpTableStyles::XclExpTableStyles( const XclExpRoot& rRoot, XclExpDxfs& 
rDxfs )
 :XclExpRoot( rRoot )
 {
+//Set the has table styles member to false, for conditions when there is 
not
+//table style defined.
+mbHasTableStyles = false;
 //Search through the collection of ScDBData (Database Ranges)
 //checking for any table styles associated with them
 miCount = 0;
@@ -3232,10 +3235,12 @@ XclExpTableStyles::XclExpTableStyles( const XclExpRoot& 
rRoot, XclExpDxfs& rDxfs
 */
 ScDBDataFormatting aDBFormatting;
 (*itr).GetTableFormatting( aDBFormatting );
-if( &(aDBFormatting) )//Probably non-standard?
+if( &(aDBFormatting)!=NULL )//Probably non-standard?
 {
 miCount++;
 maStyleContainer.push_back( new XclExpTableStyle( rRoot, 
aDBFormatting, rDxfs ) );
+//We have atleast one style so mbHasTableStyles needs to be set
+mbHasTableStyles = true;
 }
 }
 }
@@ -3247,13 +3252,16 @@ XclExpTableStyles::~XclExpTableStyles()
 
 void XclExpTableStyles::SaveXml( XclExpXmlStream& rStrm )
 {
-sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
-rStyleSheet->startElement( XML_tableStyles, XML_count, 
OString::number(miCount).getStr(), FSEND );
-for ( StyleContainer::iterator itr = maStyleContainer.begin(); itr != 
maStyleContainer.end(); ++itr )
+if( mbHasTableStyles ) //If it has table styles only then start the element
 {
-itr->SaveXml( rStrm );
+sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+rStyleSheet->startElement( XML_tableStyles, XML_count, 
OString::number(miCount).getStr(), FSEND );
+for ( StyleContainer::iterator itr = maStyleContainer.begin(); itr != 
maStyleContainer.end(); ++itr )
+{
+itr->SaveXml( rStrm );
+}
+rStyleSheet->endElement( XML_tableStyles );
 }
-rStyleSheet->endElement( XML_tableStyles );
 }
 
 // 
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index a4e6017..d8d3031 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -804,6 +804,7 @@ private:
 typedef boost::ptr_vector< XclExpTableStyle > StyleContainer;
 StyleContainer maStyleContainer;
 int miCount;
+bool mbHasTableStyles;
 };
 
 // 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-07-22 Thread Akash Shetye
 sc/source/filter/excel/xeroot.cxx  |2 
 sc/source/filter/excel/xestyle.cxx |   92 ++---
 sc/source/filter/inc/xestyle.hxx   |   14 +++--
 3 files changed, 96 insertions(+), 12 deletions(-)

New commits:
commit 1f78fb99c4b36b5cc437b7008cc2e0c99bb5d28c
Author: Akash Shetye 
Date:   Tue Jul 23 01:55:56 2013 +0530

Completed the export of table formatting data to excel.

The patch has not yet been tested nicely, improvements will come soon. The 
basics are all in place though. Will be doing the export of DB Ranges as well.

Change-Id: I237b0311ed2247f8fd884545e9a5741c60ea9242

diff --git a/sc/source/filter/excel/xeroot.cxx 
b/sc/source/filter/excel/xeroot.cxx
index 9df6afe..31ad08b 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -212,7 +212,7 @@ void XclExpRoot::InitializeGlobals()
 // BIFF8: only one link manager for all sheets
 mrExpData.mxLocLinkMgr = mrExpData.mxGlobLinkMgr;
 mrExpData.mxDxfs.reset( new XclExpDxfs( GetRoot() ) );
-mrExpData.mxTableStyles.reset( new XclExpTableStyles( GetRoot() ) );
+mrExpData.mxTableStyles.reset( new XclExpTableStyles( GetRoot(), 
GetDxfs() ) );
 }
 
 if( GetOutput() == EXC_OUTPUT_XML_2007 )
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 9b52289..11c3faf 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3133,8 +3133,8 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
 XclExpTableStyleElement::XclExpTableStyleElement( const XclExpRoot& rRoot, 
OUString& rType, int iSize, int iDxfId )
 :XclExpRoot( rRoot),
 maType( rType ),
-maDxfId( iDxfId ),
-maSize( iSize )
+miSize( iSize ),
+miDxfId( iDxfId )
 {
 }
 
@@ -3142,16 +3142,54 @@ XclExpTableStyleElement::~XclExpTableStyleElement()
 {
 }
 
-void XclExpTableStyleElement::SaveXml( XclExpStream& rStrm )
+void XclExpTableStyleElement::SaveXml( XclExpXmlStream& rStrm )
 {
+sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+rStyleSheet->singleElement( XML_tableStyleElement,
+XML_type, OUStringToOString(maType, RTL_TEXTENCODING_UTF8 
).getStr(),
+XML_size, OString::number(miSize).getStr(),
+XML_dxfId, OString::number(miDxfId).getStr(),
+FSEND );
 }
 
 // 
 
-XclExpTableStyle::XclExpTableStyle( const XclExpRoot& rRoot, OUString& 
rTableStyleName )
+XclExpTableStyle::XclExpTableStyle( const XclExpRoot& rRoot, 
ScDBDataFormatting& rTableStyle, XclExpDxfs& rDxfs )
 :XclExpRoot( rRoot ),
-maTableStyleName( rTableStyleName )
+maTableStyle( rTableStyle )
 {
+//Get the table style name
+maTableStyleName = maTableStyle.GetTableStyleName();
+//Keep adding table style elements
+OUString aStyleString;
+OUString aElementType;
+int aiDxfId;
+if( !(aStyleString = maTableStyle.GetFirstRowStripeStyle()).isEmpty() )
+{
+//Resolve this string style sheet name to a dxf id
+aiDxfId = rDxfs.GetDxfId( aStyleString );
+aElementType = "firstRowStripe";
+maStyleElementContainer.push_back( new XclExpTableStyleElement( rRoot, 
aElementType, 1, aiDxfId ) );
+}
+if( !(aStyleString = maTableStyle.GetSecondRowStripeStyle()).isEmpty() )
+{
+aiDxfId = rDxfs.GetDxfId( aStyleString );
+aElementType = "secondRowStripe";
+maStyleElementContainer.push_back( new XclExpTableStyleElement( rRoot, 
aElementType, 1, aiDxfId ) );
+}
+if( !(aStyleString = maTableStyle.GetFirstColStripeStyle()).isEmpty() )
+{
+aiDxfId = rDxfs.GetDxfId( aStyleString );
+aElementType = "firstColumnStripe";
+maStyleElementContainer.push_back( new XclExpTableStyleElement( rRoot, 
aElementType, 1, aiDxfId ) );
+}
+if( !(aStyleString = maTableStyle.GetSecondColStripeStyle()).isEmpty() )
+{
+aiDxfId = rDxfs.GetDxfId( aStyleString );
+aElementType = "secondColumnStripe";
+maStyleElementContainer.push_back( new XclExpTableStyleElement( rRoot, 
aElementType, 1, aiDxfId ) );
+}
+miCount = maStyleElementContainer.size();
 }
 
 XclExpTableStyle::~XclExpTableStyle()
@@ -3160,13 +3198,47 @@ XclExpTableStyle::~XclExpTableStyle()
 
 void XclExpTableStyle::SaveXml( XclExpXmlStream& rStrm )
 {
+sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+rStyleSheet->startElement( XML_tableStyle,  XML_name, 
OUStringToOString(maTableStyleName, RTL_TEXTENCODING_UTF8 ).getStr(), 
XML_count, OString::number(miCount).getStr(), FSEND );
+for ( StyleElementContainer::iterator itr = 
maStyleElementContainer.begin(); itr != maStyleElementContainer.end(); ++itr )
+{
+itr->SaveXml( rStrm );
+}
+rStyleSheet->endElement( XML_tableStyle );
 }
 
 // 

[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-07-19 Thread Akash Shetye
 sc/source/filter/excel/xeroot.cxx  |8 ++
 sc/source/filter/excel/xestyle.cxx |   49 +
 sc/source/filter/inc/xeroot.hxx|5 +++
 sc/source/filter/inc/xestyle.hxx   |   38 
 4 files changed, 100 insertions(+)

New commits:
commit 7f2fe9e846f27fe4e0da089034e57ea6708f
Author: Akash Shetye 
Date:   Sat Jul 20 00:26:02 2013 +0530

Made the skeleton for Table Formatting information export.

Patch adds the classes and methods needed for exporting table style data, 
the methods are yet to be written.

Change-Id: I499551624139bc5f7fd6b392bb7733652d8e51c6

diff --git a/sc/source/filter/excel/xeroot.cxx 
b/sc/source/filter/excel/xeroot.cxx
index b72503f..9df6afe 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -161,6 +161,12 @@ XclExpDxfs& XclExpRoot::GetDxfs() const
 return *mrExpData.mxDxfs;
 }
 
+XclExpTableStyles& XclExpRoot::GetTableStyles() const
+{
+OSL_ENSURE( mrExpData.mxTableStyles, "XclExpRoot::GetTableStyles - missign 
object (wrong BIFF?)");
+return *mrExpData.mxTableStyles;
+}
+
 XclExpPivotTableManager& XclExpRoot::GetPivotTableManager() const
 {
 OSL_ENSURE( mrExpData.mxPTableMgr, "XclExpRoot::GetPivotTableManager - 
missing object (wrong BIFF?)" );
@@ -206,6 +212,7 @@ void XclExpRoot::InitializeGlobals()
 // BIFF8: only one link manager for all sheets
 mrExpData.mxLocLinkMgr = mrExpData.mxGlobLinkMgr;
 mrExpData.mxDxfs.reset( new XclExpDxfs( GetRoot() ) );
+mrExpData.mxTableStyles.reset( new XclExpTableStyles( GetRoot() ) );
 }
 
 if( GetOutput() == EXC_OUTPUT_XML_2007 )
@@ -283,6 +290,7 @@ XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId 
) const
 case EXC_ID_EXTERNSHEET:xRec = GetLocalLinkMgrRef();break;
 case EXC_ID_NAME:   xRec = mrExpData.mxNameMgr; break;
 case EXC_ID_DXFS:   xRec = mrExpData.mxDxfs;break;
+case EXC_ID_TABLESTYLES: xRec = mrExpData.mxTableStyles; break;
 }
 OSL_ENSURE( xRec, "XclExpRoot::CreateRecord - unknown record ID or missing 
object" );
 return xRec;
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 368cd2d..9b52289 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3130,6 +3130,55 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
 
 // 
 
+XclExpTableStyleElement::XclExpTableStyleElement( const XclExpRoot& rRoot, 
OUString& rType, int iSize, int iDxfId )
+:XclExpRoot( rRoot),
+maType( rType ),
+maDxfId( iDxfId ),
+maSize( iSize )
+{
+}
+
+XclExpTableStyleElement::~XclExpTableStyleElement()
+{
+}
+
+void XclExpTableStyleElement::SaveXml( XclExpStream& rStrm )
+{
+}
+
+// 
+
+XclExpTableStyle::XclExpTableStyle( const XclExpRoot& rRoot, OUString& 
rTableStyleName )
+:XclExpRoot( rRoot ),
+maTableStyleName( rTableStyleName )
+{
+}
+
+XclExpTableStyle::~XclExpTableStyle()
+{
+}
+
+void XclExpTableStyle::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// ===
+
+XclExpTableStyles::XclExpTableStyles( const XclExpRoot& rRoot )
+:XclExpRoot( rRoot )
+{
+}
+
+XclExpTableStyles::~XclExpTableStyles()
+{
+}
+
+void XclExpTableStyles::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
+// 
+
 XclExpXmlStyleSheet::XclExpXmlStyleSheet( const XclExpRoot& rRoot )
 : XclExpRoot( rRoot )
 {
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index a0978a7..44952f0 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -51,6 +51,7 @@ class XclExpObjectManager;
 class XclExpFilterManager;
 class XclExpPivotTableManager;
 class XclExpDxfs;
+class XclExpTableStyles;
 
 /** Stores global buffers and data needed for Excel export filter. */
 struct XclExpRootData : public XclRootData
@@ -71,6 +72,7 @@ struct XclExpRootData : public XclRootData
 typedef boost::shared_ptr< XclExpFilterManager >   XclExpFilterMgrRef;
 typedef boost::shared_ptr< XclExpPivotTableManager >   XclExpPTableMgrRef;
 typedef boost::shared_ptr< XclExpDxfs >XclExpDxfsRef;
+typedef boost::shared_ptr< XclExpTableStyles > 
XclExpTableStylesRef;
 
 XclExpTabInfoRefmxTabInfo;  /// Calc->Excel sheet index 
conversion.
 XclExpAddrConvRef   mxAddrConv; /// The address converter.
@@ -89,6 +91,7 @@ struct XclExpRootData : public XclRootData
 XclExpFilterMgrRef  mxFilterMgr;/// Manager for filtered areas in 
all sheets.
 XclExpPTableMgrRef  mxPTableMgr;/// All pivot tables and pivot 
caches.
 XclEx

[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-07-14 Thread Akash Shetye
 sc/source/filter/excel/xestyle.cxx |  107 ++---
 1 file changed, 100 insertions(+), 7 deletions(-)

New commits:
commit ade08f4f0c3e2ff2b7b9a356430efaa9ec10d443
Author: Akash Shetye 
Date:   Mon Jul 15 05:49:43 2013 +0530

Refactored Dxf export code to work with styles defined for table/DBRanges

Change-Id: I2f05e8572e55b3fa840740a65badc4fef40ea59a

diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 0623ae5..368cd2d 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -48,6 +48,7 @@
 #include "globstr.hrc"
 #include "xestring.hxx"
 #include "conditio.hxx"
+#include "dbdata.hxx"
 
 #include 
 #include 
@@ -2875,16 +2876,17 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 (*mpKeywordTable)[ NF_KEY_ ] = "";
 // Export the Thai T NatNum modifier.
 (*mpKeywordTable)[ NF_KEY_THAI_T ] = "T";
+sal_Int32 nIndex = 0;
 
 SCTAB nTables = rRoot.GetDoc().GetTableCount();
 for(SCTAB nTab = 0; nTab < nTables; ++nTab)
 {
 ScConditionalFormatList* pList = rRoot.GetDoc().GetCondFormList(nTab);
-if (pList)
+if (pList)//Yes found some conditional formats to look at
 {
-sal_Int32 nIndex = 0;
+nIndex = 0;
 for (ScConditionalFormatList::const_iterator itr = pList->begin();
-itr != pList->end(); ++itr)
+itr != pList->end(); ++itr)//Now iterate through each item 
in the list
 {
 size_t nEntryCount = itr->size();
 for (size_t nFormatEntry = 0; nFormatEntry < nEntryCount; 
++nFormatEntry)
@@ -2898,15 +2900,15 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 if(pFormatEntry->GetType() == condformat::CONDITION)
 {
 const ScCondFormatEntry* pEntry = static_cast(pFormatEntry);
-aStyleName= pEntry->GetStyle();
+aStyleName= pEntry->GetStyle();//getting the stylename 
in aStyleName
 }
 else
 {
 const ScCondDateFormatEntry* pEntry = 
static_cast(pFormatEntry);
 aStyleName = pEntry->GetStyleName();
-}
+}//here we finish with loading the concerned style names
 
-if (maStyleNameToDxfId.find(aStyleName) == 
maStyleNameToDxfId.end())
+if (maStyleNameToDxfId.find(aStyleName) == 
maStyleNameToDxfId.end())//If not already in
 {
 maStyleNameToDxfId.insert(std::pair(aStyleName, nIndex));
 
@@ -2914,7 +2916,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 if(!pStyle)
 continue;
 
-SfxItemSet& rSet = pStyle->GetItemSet();
+SfxItemSet& rSet = pStyle->GetItemSet();//Get each 
item set
 
 XclExpCellBorder* pBorder = new XclExpCellBorder;
 if (!pBorder->FillFromItemSet( rSet, GetPalette(), 
GetBiff()) )
@@ -2968,6 +2970,97 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 }
 }
 }
+}//Conditional Formatting ends
+//Add support for Dxf styles involved in ScDBDataFormatting.
+//Get the ScDBDataCollection
+ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection();
+//Now iterate through this collection gathering style names
+if( pDBCollection )
+{
+ScDBCollection::NamedDBs& aNamedDBs = pDBCollection->getNamedDBs();
+ScDBCollection::NamedDBs::iterator itr = aNamedDBs.begin();
+ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end();
+for(; itr!= itrEnd; ++itr)
+{
+ScDBDataFormatting aDBFormatting;
+(*itr).GetTableFormatting( aDBFormatting );
+//Load all referenced stylenames into a list
+std::vector  aStyleNameVector;
+OUString aFRStyleName = aDBFormatting.GetFirstRowStripeStyle();
+if( !aFRStyleName.isEmpty() )
+aStyleNameVector.push_back( aFRStyleName );
+OUString aSRStyleName = aDBFormatting.GetSecondRowStripeStyle();
+if( !aSRStyleName.isEmpty() )
+aStyleNameVector.push_back( aSRStyleName );
+OUString aFCStyleName = aDBFormatting.GetFirstColStripeStyle();
+if( !aFCStyleName.isEmpty() )
+aStyleNameVector.push_back( aFCStyleName );
+OUString aSCStyleName = aDBFormatting.GetSecondColStripeStyle();
+if( !aSCStyleName.isEmpty() )
+aStyleNameVector.push_back( aSCStyleName );
+//Now iterate through each of these names adding their dxf one by 
one
+for( std::vector::iterator vit = 
aStyleNameVector.begin(); vit != a

[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-06-26 Thread Akash Shetye
 sc/source/filter/inc/tablebuffer.hxx   |6 ++
 sc/source/filter/oox/tablebuffer.cxx   |   19 +++
 sc/source/filter/oox/tablefragment.cxx |4 
 3 files changed, 29 insertions(+)

New commits:
commit 13b1f5fd621af1f44899b4996bbdc21f91b51f2d
Author: Akash Shetye 
Date:   Thu Jun 27 00:55:56 2013 +0530

Code added for reading and processing  tag.

All that remains is somehow getting an ScDBData object from the 
XDatabaseRange object to call SetTableFormatting on it.

Change-Id: I7ea0a01da4bb96141851e5a6bb0057ef95799536

diff --git a/sc/source/filter/inc/tablebuffer.hxx 
b/sc/source/filter/inc/tablebuffer.hxx
index 9d4a2c7..de14de4 100644
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ b/sc/source/filter/inc/tablebuffer.hxx
@@ -35,11 +35,15 @@ struct TableModel
 maRange;/// Original (unchecked) range of 
the table.
 OUString maProgName; /// Programmatical name.
 OUString maDisplayName;  /// Display name.
+OUString maTableStyleName;   /// Name of associated table style
 sal_Int32   mnId;   /// Unique table identifier.
 sal_Int32   mnType; /// Table type (worksheet, query, 
etc.).
 sal_Int32   mnHeaderRows;   /// Number of header rows.
 sal_Int32   mnTotalsRows;   /// Number of totals rows.
 
+boolmbShowRowStripes;  ///  data banded 
rows
+boolmbShowColumnStripes;///  data banded 
columns
+
 explicitTableModel();
 };
 
@@ -52,6 +56,8 @@ public:
 
 /** Imports a table definition from the passed attributes. */
 voidimportTable( const AttributeList& rAttribs, sal_Int16 
nSheet );
+/**Imports the table style info from  tag. */
+voidimportTableStyleInfo( const AttributeList& rAttribs );
 /** Imports a table definition from a TABLE record. */
 voidimportTable( SequenceInputStream& rStrm, sal_Int16 
nSheet );
 /** Creates a new auto filter and stores it internally. */
diff --git a/sc/source/filter/oox/tablebuffer.cxx 
b/sc/source/filter/oox/tablebuffer.cxx
index 672e11c..c4580c6 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -25,6 +25,8 @@
 #include "oox/helper/propertyset.hxx"
 #include "oox/token/properties.hxx"
 #include "addressconverter.hxx"
+#include "dbdataformatting.hxx"
+#include "stylesbuffer.hxx"
 
 namespace oox {
 namespace xls {
@@ -79,6 +81,13 @@ void Table::importTable( SequenceInputStream& rStrm, 
sal_Int16 nSheet )
 maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
 }
 
+void Table::importTableStyleInfo( const AttributeList& rAttribs )
+{
+maModel.maTableStyleName = rAttribs.getXString( XML_name, OUString() );
+maModel.mbShowRowStripes = rAttribs.getBool( XML_showRowStripes, false );
+maModel.mbShowColumnStripes = rAttribs.getBool( XML_showColumnStripes, 
false );
+}
+
 void Table::finalizeImport()
 {
 // Create database range.  Note that Excel 2007 and later names database
@@ -99,6 +108,16 @@ void Table::finalizeImport()
 
 // filter settings
 maAutoFilters.finalizeImport( xDatabaseRange );
+
+//Setting the ScDBDataFormatting (Table style) attribute.
+ScDBDataFormatting aTableFormatting = getStyles().getTableStyle( 
maModel.maTableStyleName )->getTableFormatting(); //May fail in cases of 
malformed corrupt table/table#.xml where the maTableStyleName is messed up
+aTableFormatting.SetBandedRows( maModel.mbShowRowStripes );
+aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes );
+//Add this table formatting information to the ScDBData instance.
+//xDatabaseRange->SetTableFormatting( aTableFormatting );
+//Still figuring how to have an ScDBData object out of this
+//xDatabaseRange of type XDatabaseRange... all that needs to be
+//done is call the SetTableFormatting on that ScDBData object
 }
 catch( Exception& )
 {
diff --git a/sc/source/filter/oox/tablefragment.cxx 
b/sc/source/filter/oox/tablefragment.cxx
index 334f29c..d9398b4 100644
--- a/sc/source/filter/oox/tablefragment.cxx
+++ b/sc/source/filter/oox/tablefragment.cxx
@@ -53,6 +53,10 @@ ContextHandlerRef TableFragment::onCreateContext( sal_Int32 
nElement, const Attr
 case XLS_TOKEN( table ):
 if( nElement == XLS_TOKEN( autoFilter ) )
 return new AutoFilterContext( *this, 
mrTable.createAutoFilter() );
+if( nElement == XLS_TOKEN( tableStyleInfo ) )
+{
+mrTable.importTableStyleInfo( rAttribs );
+}
 break;
 }
 return 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-06-26 Thread Akash Shetye
 sc/source/filter/inc/stylesbuffer.hxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 23a858414fb781a39b521e55ce430d8b754bafea
Author: Akash Shetye 
Date:   Thu Jun 27 00:34:10 2013 +0530

Adds header file to commit 809154544ea1f49a1d7ef0f4b49b3378112f54d0.

Forgot to add header file stylesbuffer.cxx to commit.

Change-Id: I3541a7f584be3ef23b2ac1f22e6ae4309b5f2296

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index 10a18ab..a548327 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -795,6 +795,8 @@ public:
 explicitTableStyle( const WorkbookHelper& rHelper, const 
OUString& rTableStyleName );
 voidimportTableStyleElement( const AttributeList& rAttribs 
);
 voidfinalizeImport();
+const OUString& getTableStyleName() const;
+ScDBDataFormatting& getTableFormatting(); //not const since it will be 
edited and put in ScDBData objects
 private:
 typedef ::boost::shared_ptr< ::ScDBDataFormatting > TableFormattingRef;
 
@@ -1011,6 +1013,9 @@ public:
 voidwriteStyleXfToPropertySet( PropertySet& rPropSet, 
sal_Int32 nXfId ) const;
 
 boolhasBorder( sal_Int32 nBorderId ) const;
+/**Returns the TableStyleRef for given table style name*/
+TableStyleRef   getTableStyle( OUString& rTableStyleName );
+
 private:
 typedef RefVector< Font >   FontVector;
 typedef RefVector< Border > BorderVector;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-06-25 Thread Akash Shetye
 sc/source/filter/oox/stylesbuffer.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit 809154544ea1f49a1d7ef0f4b49b3378112f54d0
Author: Akash Shetye 
Date:   Tue Jun 25 18:06:08 2013 +0530

Add methods to get table name and Formatting and TableStyle.

Change-Id: Ifb9011a4734810ac1f6ea64b676cb52a3e251a8d

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 5428a34..502ceb7 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2677,6 +2677,16 @@ void TableStyle::importTableStyleElement( const 
AttributeList& rAttribs )
 //is not showing up.
 }
 
+const OUString& TableStyle::getTableStyleName() const
+{
+return mxTableFormatting->GetTableStyleName();
+}
+
+ScDBDataFormatting& TableStyle::getTableFormatting()
+{
+return (*mxTableFormatting);
+}
+
 void TableStyle::finalizeImport()
 {
 }
@@ -3444,6 +3454,18 @@ void StylesBuffer::writeStyleXfToPropertySet( 
PropertySet& rPropSet, sal_Int32 n
 pXf->writeToPropertySet( rPropSet );
 }
 
+TableStyleRef StylesBuffer::getTableStyle( OUString& rTableStyleName )
+{
+for( ::std::vector< TableStyleRef >::iterator i = maTableStyles.begin(); i 
< maTableStyles.end(); ++i)
+{
+if( ((*i)->getTableStyleName() ).equals(rTableStyleName) )
+{
+return(*i);
+}
+}
+return 0;
+}
+
 // 
 
 } // namespace xls
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

2013-06-24 Thread Akash Shetye
 sc/source/filter/inc/stylesbuffer.hxx   |   24 -
 sc/source/filter/inc/stylesfragment.hxx |   15 ++
 sc/source/filter/oox/stylesbuffer.cxx   |   45 
 sc/source/filter/oox/stylesfragment.cxx |   24 -
 4 files changed, 106 insertions(+), 2 deletions(-)

New commits:
commit c0801d4dbda418835ad30c89fce8f2185a5fffe5
Author: Akash Shetye 
Date:   Tue Jun 25 11:24:34 2013 +0530

Adds support for table style tag reading and filling in the formatting 
object

This patch contains the bulk of the style.xml parsing modifications to read 
the  and  tags and fill in the 
ScDBDataFormatting information.

Change-Id: Ic3981dcb29ee09b26940b51dd94d750603e1c4f4

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index 32b439c..10a18ab 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include "attarray.hxx"
+#include "dbdataformatting.hxx"
 #include 
 
 class ScMarkData;
@@ -787,6 +788,23 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
 
 // 
 
+/* Contains attributes for table styles from the  element */
+class TableStyle : public WorkbookHelper
+{
+public:
+explicitTableStyle( const WorkbookHelper& rHelper, const 
OUString& rTableStyleName );
+voidimportTableStyleElement( const AttributeList& rAttribs 
);
+voidfinalizeImport();
+private:
+typedef ::boost::shared_ptr< ::ScDBDataFormatting > TableFormattingRef;
+
+TableFormattingRef mxTableFormatting;
+};
+
+typedef ::boost::shared_ptr< TableStyle > TableStyleRef;
+
+// 
+
 /** Contains attributes of a cell style, e.g. from the cellStyle element. */
 struct CellStyleModel
 {
@@ -922,7 +940,9 @@ public:
 /** Creates a new empty differential formatting object.
 @param opnDxfId  (out-param) The identifier of the new DXF object. */
 DxfRef  createDxf( sal_Int32* opnDxfId = 0 );
-
+/** Creates a new TableStyle object for storing table formatting.
+@param opnTableStyleId (out-param) The identifier of the new 
TableStyle object. */
+TableStyleRef   createTableStyle(const OUString& rTableStyleName, 
sal_Int32* opnTableStyleId = 0 );
 /** Appends a new color to the color palette. */
 voidimportPaletteColor( const AttributeList& rAttribs );
 /** Inserts a new number format code. */
@@ -997,6 +1017,7 @@ private:
 typedef RefVector< Fill >   FillVector;
 typedef RefVector< Xf > XfVector;
 typedef RefVector< Dxf >DxfVector;
+typedef RefVector< TableStyle > TableStyleVector;
 typedef ::std::map< sal_Int32, OUString >DxfStyleMap;
 
 ColorPalettemaPalette;  /// Color palette.
@@ -1008,6 +1029,7 @@ private:
 XfVectormaStyleXfs; /// List of cell styles.
 CellStyleBuffer maCellStyles;   /// All built-in and user defined 
cell styles.
 DxfVector   maDxfs; /// List of differential cell 
styles.
+TableStyleVectormaTableStyles;/// List of Table styles for 
tables.
 mutable DxfStyleMap maDxfStyles;/// Maps DXF identifiers to Calc 
style sheet names.
 };
 
diff --git a/sc/source/filter/inc/stylesfragment.hxx 
b/sc/source/filter/inc/stylesfragment.hxx
index 5e8f177..43370af 100644
--- a/sc/source/filter/inc/stylesfragment.hxx
+++ b/sc/source/filter/inc/stylesfragment.hxx
@@ -124,6 +124,21 @@ private:
 
 // 
 
+class TableStyleContext : public WorkbookContextBase
+{
+public:
+template< typename ParentType >
+inline explicit TableStyleContext( ParentType& rParent, const 
TableStyleRef& rxTableStyle ) :
+WorkbookContextBase( rParent ), mxTableStyle( 
rxTableStyle ) {}
+protected:
+virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs );
+
+private:
+TableStyleRef   mxTableStyle;
+};
+
+// 
+
 class StylesFragment : public WorkbookFragmentBase
 {
 public:
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index cead31d..5428a34 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2649,6 +2649,41 @@ void Dxf::writeToPropertySet( PropertySet& rPropSet ) 
const
 
 // 
 
+TableStyle::TableStyle( const WorkbookHelper& rHelper, const OUString& 
rTableStyleName ) :
+Workbo