[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - 3930 commits - accessibility/bridge accessibility/source android/Bootstrap android/experimental android/sdremote animations/Library_animcore.mk animations/Module_animations.mk animations/source apache-commons/patches autodoc/Executable_autodoc.mk autodoc/inc autodoc/Makefile autodoc/Module_autodoc.mk autodoc/README autodoc/source autogen.sh avmedia/Library_avmediavlc.mk avmedia/Module_avmedia.mk avmedia/README avmedia/source basctl/AllLangResTarget_basctl.mk basctl/Library_basctl.mk basctl/Module_basctl.mk basctl/source basebmp/source basebmp/test basegfx/source basic/qa basic/source bean/native bean/qa binaryurp/source bin/count-todo-dialogs bin/distro-install-desktop-integration bin/distro-install-file-lists bin/distro-install-sdk bin/git-new-module-workdir bin/lo-commit-stat bin/lo-xlate-lang bin/module-deps.pl bin/moveglobalheaders.sh bin/striplanguagetags.sh bin/update_pch.sh boost/boost_1_44_0-gcc4.8.patc h boost/boost.transform_width.patch boost/boost.wconstexpr-not-const.patch.0 boost/boost.wdeprecated-register.patch.0 boost/boost.wuninitialized.patch boost/boost.wunused.patch boost/UnpackedTarball_boost.mk bridges/Library_cpp_uno.mk bridges/source cairo/cairo cairo/UnpackedTarball_cairo.mk canvas/Library_cairocanvas.mk canvas/Library_canvasfactory.mk canvas/Library_canvastools.mk canvas/Library_directx9canvas.mk canvas/Library_gdipluscanvas.mk canvas/Library_simplecanvas.mk canvas/Library_vclcanvas.mk canvas/Module_canvas.mk canvas/README canvas/source chart2/AllLangResTarget_chartcontroller.mk chart2/inc chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/qa chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk chart2/workbench cli_ure/Library_cli_uno.mk cli_ure/version clucene/patches clucene/UnpackedTarball_clucene.mk codemaker/source comphelper/source compilerplugins/clang compilerplugins/Makefile-clang.mk config_host/config_features.h.in config_host /config_gcc.h.in config_host/config_global.h.in config_host/config_lgpl.h.in config_host/config_mpl.h.in config_host/config_probes.h.in config_host.mk.in configmgr/source configure.ac connectivity/Configuration_firebird.mk connectivity/Library_dbtools.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_postgresql-sdbc-impl.mk connectivity/Module_connectivity.mk connectivity/registry connectivity/source connectivity/workben cosv/Makefile cosv/Module_cosv.mk cosv/README cosv/source cosv/StaticLibrary_cosv.mk cppcanvas/CppunitTest_cppcanvas_test.mk cppcanvas/Module_cppcanvas.mk cppcanvas/qa cppcanvas/README cppcanvas/source cppuhelper/source cppuhelper/test cppunit/ExternalProject_cppunit.mk cppunit/unxlngx6 cppu/source cpputools/Module_cpputools.mk cpputools/Package_bin.mk cpputools/source crashrep/CustomTarget_crashrep_res.mk cui/AllLangResTarget_cui.mk cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/AllLangResTarget_dbu.mk dbaccess/i nc dbaccess/Library_dba.mk dbaccess/Library_dbu.mk dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk dbaccess/util dbaccess/win32 desktop/Executable_officeloader.mk desktop/Executable_oosplash.mk desktop/Executable_sbase.mk desktop/Executable_scalc.mk desktop/Executable_sdraw.mk desktop/Executable_simpress.mk desktop/Executable_smath.mk desktop/Executable_soffice.mk desktop/Executable_sweb.mk desktop/Executable_swriter.mk desktop/Executable_unoinfo.mk desktop/Executable_unopkg.mk desktop/inc desktop/Module_desktop.mk desktop/Pagein_common.mk desktop/scripts desktop/source desktop/StaticLibrary_winextendloaderenv.mk desktop/StaticLibrary_winlauncher.mk desktop/test desktop/uiconfig desktop/unx desktop/win32 dictionaries distro-configs/LibreOfficeMinGW64.conf download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/source dtrans/Library_dnd.mk dtrans/Library_dtrans.mk dtrans/Library_ftransl.mk dtrans/Library_mcnttype.mk dtrans/L ibrary_sysdtrans.mk dtrans/Module_dtrans.mk dtrans/source dtrans/StaticLibrary_dtobj.mk editeng/CppunitTest_editeng_lookuptree.mk editeng/Library_editeng.mk editeng/qa editeng/source embeddedobj/source embedserv/source epm/epm-3.7.patch expat/StaticLibrary_expat.mk extensions/Library_npsoplugin.mk extensions/Library_pcr.mk extensions/Library_pl.mk extensions/source extensions/test external/CustomTarget_jawt.mk external/CustomTarget_wine.mk external/Module_external.mk external/Package_msvc_dlls_debug.mk external/Package_msvc_dlls.mk external/Package_wine.mk external/wine extras/CustomTarget_autocorr.mk extras/Gallery_arrows.mk extras/Gallery_diagrams.mk extras/Gallery_symbols.mk extras/Gallery_txtshapes.mk extras/Package_autocorr.mk extras/source fileaccess/source filter/AllLangResTarget_xsltdlg.mk filter/inc filter/Library_filterconfig.mk filter/Library_ips.mk filter/Library_placeware.mk filter/Library_xmlfa.mk filter/Library_xsltfilter.mk filter/qa filter/source filter/uico nfig filter/UIConfig_xsltdlg.mk firebird/ExternalPackage_firebird.mk firebird/ExternalProject_firebird.mk firebird/firebird-c++11.patch.1 firebird/firebird-cygwin-msvc.patch.1 firebird/firebird-icu.patch.1 firebird/firebird-macosx.patch.1 firebird/Makefile firebird/Module_firebird.mk firebird/UnpackedTarball_firebird.mk fontconfig/fontconfig-2.8.0.patch forms/source formula/source fpicker/Library_fps.mk fpicker/source framework/inc framework/Library_fwk.mk framework/Library_fwl.mk framework/qa framework/source framework/uiconfig framework/UIConfig_startmodule.mk framework/util g .gitignore helpcompiler/inc helpcompiler/Library_helplinker.mk helpcompiler/source helpcontent2 hsqldb/patches hsqldb/UnpackedTarball_hsqldb.mk hwpfilter/source i18nlangtag/source i18npool/CustomTarget_collator.mk i18npool/CustomTarget_localedata.mk i18npool/inc i18npool/Library_i18npool.mk i18npool/Library_localedata_others.mk i18npool/Module_i18npool.mk i18npool/qa i18npool/Rdb_saxparser.mk i18npoo l/source i18npool/util i18nutil/source icon-themes/crystal icon-themes/galaxy icon-themes/hicontrast icon-themes/human icon-themes/industrial icon-themes/oxygen icon-themes/README icon-themes/sifr icon-themes/tango icu/ExternalPackage_icu.mk icu/ExternalProject_icu.mk icu/icu4c.7601.Indic-ccmp.patch icu/icu4c.8198.revert.icu5431.patch icu/icu4c.9948.mlym-crash.patch icu/icu4c-build.patch icu/UnpackedTarball_icu.mk idlc/inc idlc/source idlc/test idl/Executable_svidl.mk idl/source include/basebmp include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cosv include/default.rc include/drawinglayer include/editeng include/filter include/formula include/i18nlangtag include/linguistic include/oox include/osl include/postwin.h include/premac.h include/prewin.h include/registry include/rtl include/sal include/sax include/sfx2 include/sot include/svl include/svtools include/svx include/systools include/test include/toolkit include/tools include/ucbhelper include/udm include/unotest include/unotools include/vbahelper include/vcl include/version.hrc include/wntgcci include/wntgccx include/xmloff instsetoo_native/CustomTarget_install.mk instsetoo_native/inc_openoffice instsetoo_native/util ios/experimental ios/iosremote io/source io/test javaunohelper/com jpeg/StaticLibrary_jpeg.mk jvmfwk/Module_jvmfwk.mk jvmfwk/plugins jvmfwk/source l10ntools/source languagetool/MessageBox-apichange.patch languagetool/UnpackedTarball_languagetool.mk lcms2/ExternalPackage_lcms2.mk lcms2/ExternalProject_lcms2.mk libatomic_ops/ExternalPackage_libatomic_ops.mk libatomic_ops/ExternalProject_libatomic_ops.mk libatomic_ops/Makefile libatomic_ops/Module_libatomic_ops.mk libatomic_ops/README libatomic_ops/UnpackedTarball_libatomic_ops.mk libcdr/libcdr-wpx_seek_end.patch.1 libcdr/UnpackedTarball_libcdr.mk libcmis/libcmis-0.3.0.patch libexttextcat/android.patch libexttextcat/ExternalProject_exttextcat.mk libexttextcat/unkown.patch.1 li bexttextcat/UnpackedTarball_exttextcat.mk liblangtag/ExternalProject_langtag.mk liblangtag/liblangtag-0.5.1-mingw.patch liblangtag/liblangtag-0.5.1-reg2xml-encoding-problem.patch liblangtag/liblangtag-0.5.1-vsnprintf.patch liblangtag/UnpackedTarball_langtag.mk libmariadb/StaticLibrary_mariadb.mk libmwaw/libmwaw-0.1.9.patch.1 libmwaw/UnpackedTarball_libmwaw.mk liborcus/ExternalProject_liborcus.mk Library_merged.mk librelogo/source libvisio/libvisio-0.0.30-msvc.patch.1 libvisio/libvisio-wpx_seek_end.patch.1 libvisio/UnpackedTarball_libvisio.mk libxmlsec/ExternalProject_xmlsec.mk libxmlsec/xmlsec1-mingw32.patch lingucomponent/source linguistic/JunitTest_linguistic_complex.mk linguistic/JunitTest_linguistic_unoapi.mk linguistic/Library_lng.mk linguistic/source lotuswordpro/source lo.xcent.in lpsolve/lp_solve_5.5.patch lpsolve/lp_solve_5.5-windows.patch lpsolve/Module_lpsolve.mk lpsolve/UnpackedTarball_lpsolve.mk m4/libo_externals.m4 Makefile.fetch Makefile.in mdds/0001-Avoid-cra sh-when-_GLIBCXX_DEBUG-is-defined.patch mdds/0001-Combine-these-two-calls.-There-is-no-reason-why-they.patch mdds/0001-Fix-it-here-too.patch mdds/0001-Workaround-for-an-old-gcc-bug.patch mdds/0001-Workaround-for-gcc-bug.patch mdds/mdds_0.7.0_unreachable_warning.patch.1 mdds/UnpackedTarball_mdds.mk mysqlcppconn/binding_config.h mysqlcppconn/config.h mysqlc/source mythes/mythes-1.2.0-vanilla-th-gen-idx.patch nlpsolver/Jar_EvolutionarySolver.mk nlpsolver/Jar_nlpsolver.mk nlpsolver/Module_nlpsolver.mk nss/ExternalProject_nss.mk nss/nss-3.13.3-build.patch.3 nss/nss.patch nss/nss.wheader-guard.patch.0 nss/UnpackedTarball_nss.mk o3tl/CppunitTest_o3tl_tests.mk o3tl/Module_o3tl.mk odk/config odk/CustomTarget_autodoc.mk odk/CustomTarget_check.mk odk/CustomTarget_classes.mk odk/CustomTarget_doxygen.mk odk/CustomTarget_html.mk odk/docs odk/examples odk/GeneratedPackage_cpp_docs.mk odk/GeneratedPackage_odk_doxygen.mk odk/GeneratedPackage_uno_loader_classes.mk odk/index.html odk/index_onl ine.html odk/Module_odk.mk odk/pack odk/Package_autodoc.mk odk/Package_bin.mk odk/Package_docs.mk odk/Package_html.mk odk/PackageSet_autodoc.mk odk/Package_settings.mk odk/Package_uno_loader_classes.mk odk/settings odk/source odk/util offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/registry oovbaapi/ooo oox/Library_oox.mk oox/README oox/source openssl/ExternalProject_openssl.mk package/inc package/source padmin/source poppler/ExternalPackage_poppler.mk poppler/ExternalProject_poppler.mk poppler/Makefile poppler/Module_poppler.mk poppler/poppler-mac-fake.patch.1 poppler/poppler-notests.patch.1 poppler/poppler-snprintf.patch.1 poppler/README poppler/UnpackedTarball_poppler.mk postprocess/CustomTarget_images.mk postprocess/CustomTarget_registry.mk postprocess/CustomTarget_signing.mk postprocess/Rdb_services.mk postprocess/signing psprint_config/Module_psprint_config.mk psprint_config/Package_fontunxppds. mk psprint_config/Package_fontunxpsprint.mk python3/ExternalPackage_python3.mk python3/ExternalProject_python3.mk pyuno/Executable_python_wrapper.mk pyuno/Library_pyuno_wrapper.mk pyuno/source pyuno/zipcore qadevOOo/objdsc qadevOOo/runner qadevOOo/testdocs qadevOOo/tests readlicense_oo/CustomTarget_readme.mk readlicense_oo/docs readlicense_oo/html readlicense_oo/odt readlicense_oo/txt redland/README registry/source registry/test registry/tools remotebridges/examples remotebridges/source reportbuilder/java reportbuilder/Module_reportbuilder.mk reportbuilder/Package_reportbuilder-templates.mk reportbuilder/registry reportbuilder/template reportdesign/AllLangResTarget_rpt.mk reportdesign/AllLangResTarget_rptui.mk reportdesign/inc reportdesign/JunitTest_reportdesign_complex.mk reportdesign/source reportdesign/uiconfig reportdesign/UIConfig_dbreport.mk RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_build.mk RepositoryModule_host.mk rhino/OfficeScriptInfo. java rsc/inc rsc/source sal/osl sal/qa sal/rtl sal/textenc sal/util sal/workben sax/CppunitTest_sax.mk sax/qa sax/source sax/test scaddins/AllLangResTarget_analysis.mk scaddins/AllLangResTarget_date.mk scaddins/AllLangResTarget_pricing.mk scaddins/Library_analysis.mk scaddins/Library_date.mk scaddins/Library_pricing.mk scaddins/Module_scaddins.mk scaddins/source sc/AllLangResTarget_sc.mk sccomp/AllLangResTarget_solver.mk sccomp/Library_solver.mk sccomp/Module_sccomp.mk sccomp/source sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/Library_scqahelper.mk sc/Library_vbaobj.mk sc/Module_sc.mk scp2/AutoInstallLibs_gnome.mk scp2/AutoInstallLibs_graphicfilter.mk scp2/AutoInstallLibs_kde.mk scp2/AutoInstallLibs_onlineupdate.mk scp2/AutoInstallLibs_ooo.mk scp2/AutoInstallLibs_tde.mk scp2/AutoInstallLibs_ure.mk scp2/AutoInstallLibs_writer .mk scp2/AutoInstall.mk scp2/inc scp2/InstallModule_base.mk scp2/InstallModule_calc.mk scp2/InstallModule_canvas.mk scp2/InstallModule_firebird.mk scp2/InstallModule_impress.mk scp2/InstallModule_math.mk scp2/InstallModule_onlineupdate.mk scp2/InstallModule_ooo.mk scp2/InstallModule_windows.mk scp2/InstallScript_setup_osl.mk scp2/macros scp2/Module_scp2.mk scp2/source sc/qa scripting/java scripting/Library_stringresource.mk scripting/source scripting/workben sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/util sc/workben sd/AllLangResTarget_sd.mk sd/CppunitTest_sd_uimpress.mk sdext/Executable_xpdfimport.mk sdext/source sd/inc sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/README sd/sdi sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk sd/util setup_native/CustomTarget_mac.mk setup_native/CustomTarget_scripts.mk setup_native/Library_getuid.mk setup_native/scripts setup_native/source sfx2/inc sfx2/Library_sfx.mk sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UICon fig_sfx.mk sfx2/util shell/CppunitTest_shell_zip.mk shell/CustomTarget_shlxthdl_res.mk shell/Executable_regsvrex.mk shell/inc shell/Module_shell.mk shell/Package_scripts.mk shell/qa shell/source slideshow/inc slideshow/Library_slideshow.mk slideshow/README slideshow/source slideshow/test smoketest/CppunitTest_smoketest.mk smoketest/data smoketest/libtest.cxx solenv/bin solenv/doc solenv/gbuild solenv/gcc-wrappers solenv/gdb solenv/inc soltools/cpp sot/Library_sot.mk sot/Module_sot.mk sot/qa sot/source starmath/AllLangResTarget_sm.mk starmath/inc starmath/qa starmath/sdi starmath/source starmath/uiconfig starmath/UIConfig_smath.mk stoc/source stoc/test store/source svgio/inc svgio/source svl/Library_fsstorage.mk svl/Library_passwordcontainer.mk svl/Library_svl.mk svl/README svl/source svl/unx svtools/AllLangResTarget_svt.mk svtools/inc svtools/langsupport svtools/Library_svt.mk svtools/source svtools/uiconfig svx/AllLangResTarget_svx.mk svx/AllLangResTarget_textconversiondlgs .mk svx/Executable_gengal.bin.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk svx/util svx/workben sw/AllLangResTarget_sw.mk sw/CppunitTest_sw_filters_test.mk swext/mediawiki sw/inc sw/Library_swui.mk sw/Library_vbaswobj.mk sw/PythonTest_sw_python.mk sw/qa sw/README sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sysui/CustomTarget_deb.mk sysui/CustomTarget_infoplist.mk sysui/CustomTarget_share.mk sysui/CustomTarget_slackware.mk sysui/desktop sysui/Module_sysui.mk sysui/Package_osxicons.mk sysui/productlist.mk test/source testtools/com testtools/qa testtools/source tomcat/ExternalProject_tomcat.mk tomcat/Package_tomcat.mk tomcat/UnpackedTarball_tomcat.mk toolkit/AllLangResTarget_tk.mk toolkit/JunitTest_toolkit_complex.mk toolkit/Library_tk.mk toolkit/Module_toolkit.mk toolkit/qa toolkit/source toolkit/util tools/inc tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/source ucb/workben udkap i/com udkapi/Module_udkapi.mk udkapi/UnoApi_udkapi.mk udm/Makefile udm/Module_udm.mk udm/README udm/source udm/StaticLibrary_udm.mk UnoControls/inc UnoControls/source unodevtools/source unoidl/source unotest/source unotools/source unoxml/source unusedcode.easy uui/Library_uui.mk uui/source uui/uiconfig vbahelper/Library_msforms.mk vbahelper/Library_vbahelper.mk vbahelper/source vcl/android vcl/aqua vcl/coretext vcl/CppunitTest_vcl_complextext.mk vcl/CustomTarget_kde4_moc.mk vcl/generic vcl/headless vcl/inc vcl/ios vcl/Library_desktop_detector.mk vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde.mk vcl/Library_vclplug_svp.mk vcl/Library_vclplug_tde.mk vcl/Module_vcl.mk vcl/qa vcl/README vcl/source vcl/StaticLibrary_headless.mk vcl/test vcl/unx vcl/win vcl/workben vigra/UnpackedTarball_vigra.mk vigra/vigra1.4.0-enumwarn.patch vigra/vigra1.4.0.patch vigra/vigra1.4.0-unused-parameters.patch vigra/vigra1.6 .0.patch vigra/vigra1.6.0-unused-parameters.patch wizards/AllLangResTarget_dbw.mk wizards/AllLangResTarget_eur.mk wizards/AllLangResTarget_imp.mk wizards/AllLangResTarget_tpl.mk wizards/AllLangResTarget_wzi.mk wizards/com wizards/Jar_commonwizards.mk wizards/Jar_form.mk wizards/Jar_query.mk wizards/Jar_reportbuilder.mk wizards/Jar_report.mk wizards/Jar_table.mk wizards/Jar_web.mk wizards/Module_wizards.mk wizards/Package_depot.mk wizards/Package_euro.mk wizards/Package_form.mk wizards/Package_gimmicks.mk wizards/Package_import.mk wizards/Package_share.mk wizards/Package_standard.mk wizards/Package_template.mk wizards/Package_tools.mk wizards/Package_tutorials.mk wizards/Package_usr.mk wizards/source writerfilter/CppunitTest_writerfilter_doctok.mk writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/CustomTarget_source.mk writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/Module_writerfilter.mk writerfilter/qa writerfilter/source writerperfect/source x 11_extensions/inc x11_extensions/README xmlhelp/Library_ucpchelp1.mk xmlhelp/source xmloff/dtd xmloff/inc xmloff/Library_xo.mk xmloff/source xmlreader/Library_xmlreader.mk xmlreader/Module_xmlreader.mk xmlreader/source xmlscript/Library_xmlscript.mk xmlscript/source xmlsecurity/AllLangResTarget_xsec.mk xmlsecurity/inc xmlsecurity/Library_xsec_fw.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig xpdf/ExternalPackage_xpdf.mk xpdf/ExternalProject_xpdf.mk xpdf/Makefile xpdf/Module_xpdf.mk xpdf/README xpdf/UnpackedTarball_xpdf.mk xpdf/xpdf-3.02-gfxColorMaxComps.patch xpdf/xpdf-3.02-ooopwd.patch xpdf/xpdf-3.02.patch xpdf/xpdf-no-writable-literals.patch

Kohei Yoshida kohei.yoshida at gmail.com
Mon Aug 5 13:13:06 PDT 2013


Rebased ref, commits from common ancestor:
commit 4567c4ec4c16f139b6a6f5310b4acf2262f09cb1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Aug 5 16:12:16 2013 -0400

    Fix the build.
    
    Change-Id: Ic92ff0c6a482125014457f8b309d9543c9f3823b

diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 9c02540..b058ce3 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -3463,7 +3463,7 @@ TableStyleRef StylesBuffer::getTableStyle( OUString& rTableStyleName )
     if(itr != maTableStyles.end())
         return *itr;
 
-    return 0;
+    return TableStyleRef();
 }
 
 
commit cc7451ccd3872efed61d02802fa15f849cfd9d8a
Author: Akash Shetye <shetyeakash at gmail.com>
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;
commit 1a86564bd9a9cc28e429bb7a7657eea89ed670e9
Author: Akash Shetye <shetyeakash at gmail.com>
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
         }
     }
 }
commit 9387d68fec054cbd74835fcf35f1dba915e2dc92
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Thu Aug 1 23:45:58 2013 +0530

    Corrected a redundant if statement to do what it should
    
    Not proud of this patch :D
    
    Change-Id: I9d08a48188d1bd086ae0135b1044cd56ee141951

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 89ed644..a87f72f 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -58,6 +58,7 @@ private:
     bool            bDoSize;
     bool            bKeepFmt;
     bool            bStripData;
+    bool            bHasFormatting;
 
     /// QueryParam
     bool            bIsAdvanced;        ///< true if created by advanced filter
@@ -107,6 +108,7 @@ public:
     void        SetKeepFmt(bool bSet)           { bKeepFmt = bSet; }
     bool        IsStripData() const             { return bStripData; }
     void        SetStripData(bool bSet)         { bStripData = bSet; }
+    bool        HasFormatting()                 { return bHasFormatting; }
 
     OUString GetSourceString() const;
     OUString GetOperations() const;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d7cff5d..ccddddb 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -71,7 +71,8 @@ ScDBData::ScDBData( const OUString& rName,
     bDBSelection(false),
     nIndex      (0),
     bAutoFilter (false),
-    bModified   (false)
+    bModified   (false),
+    bHasFormatting(false)
 {
     aUpper = ScGlobal::pCharClass->uppercase(aUpper);
 }
@@ -99,7 +100,8 @@ ScDBData::ScDBData( const ScDBData& rData ) :
     bDBSelection        (rData.bDBSelection),
     nIndex              (rData.nIndex),
     bAutoFilter         (rData.bAutoFilter),
-    bModified           (rData.bModified)
+    bModified           (rData.bModified),
+    bHasFormatting      (rData.bHasFormatting)
 {
 }
 
@@ -126,7 +128,8 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& rData ) :
     bDBSelection        (rData.bDBSelection),
     nIndex              (rData.nIndex),
     bAutoFilter         (rData.bAutoFilter),
-    bModified           (rData.bModified)
+    bModified           (rData.bModified),
+    bHasFormatting      (rData.bHasFormatting)
 {
     aUpper = ScGlobal::pCharClass->uppercase(aUpper);
 }
@@ -155,6 +158,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
     bDBSelection        = rData.bDBSelection;
     nIndex              = rData.nIndex;
     bAutoFilter         = rData.bAutoFilter;
+    bHasFormatting      = rData.bHasFormatting;
 
     return *this;
 }
@@ -410,6 +414,7 @@ void ScDBData::SetImportParam(const ScImportParam& rImportParam)
 //Methods to get and set ScDBDataFormatting instance
 void ScDBData::SetTableFormatting( const ScDBDataFormatting& rTableFormatData )
 {
+    bHasFormatting = true;
     mpTableFormatData.reset( new ScDBDataFormatting( rTableFormatData ) );
 }
 
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index a658733..c52ff30 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3235,8 +3235,7 @@ XclExpTableStyles::XclExpTableStyles( const XclExpRoot& rRoot, XclExpDxfs& rDxfs
             the named DBs for table style information.
             */
             ScDBDataFormatting aDBFormatting;
-            (*itr).GetTableFormatting( aDBFormatting );
-            if( &(aDBFormatting)!=NULL )//Probably non-standard?
+            if( (*itr).HasFormatting() )
             {
                 miCount++;
                 maStyleContainer.push_back( new XclExpTableStyle( rRoot, aDBFormatting, rDxfs ) );
commit d1ec73988405eeaae1e9f1019a7577e30e9d962d
Author: Akash Shetye <shetyeakash at gmail.com>
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
commit ee1a8cd42dc271f469b3d698627cabe565f59235
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Thu Aug 1 08:14:25 2013 +0530

    Completed the export of DBData ranges to xlsx.
    
    All tags covered except auto filter tag. Need to add code to decide which DBData need to be exported by looking only for the ones that implement table style instead of exporting each one of them.
    
    Change-Id: I2655b62a33b516c6ba5516cf90fcc2627604770e

diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 89b96ed..e14c48a 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -89,6 +89,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
 	sc/source/filter/excel/tokstack \
 	sc/source/filter/excel/xechart \
 	sc/source/filter/excel/xecontent \
+    sc/source/filter/excel/xedbdata \
 	sc/source/filter/excel/xeescher \
 	sc/source/filter/excel/xeextlst \
 	sc/source/filter/excel/xeformula \
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 89dcce8..b002f3c 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -68,6 +68,7 @@
 #include "xeescher.hxx"
 #include "xepivot.hxx"
 #include "XclExpChangeTrack.hxx"
+#include "xedbdata.hxx"
 
 #include <math.h>
 
@@ -313,6 +314,7 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
     if( GetOutput() != EXC_OUTPUT_BINARY )
     {
         aRecList.AppendNewRecord( new XclExpXmlStyleSheet( *this ) );
+        aRecList.AppendNewRecord( new XclExpXmlDBDataTables( *this ) );
     }
     else
     {
diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx
index ebce789..0b178ac 100644
--- a/sc/source/filter/excel/xedbdata.cxx
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -19,53 +19,100 @@
 
 #include "xedbdata.hxx"
 #include "document.hxx"
+#include "address.hxx"
+#include "globstr.hrc"
+
+#include <oox/token/tokens.hxx>
+
+using namespace oox;
 
 XclExpXmlDBDataStyleInfo::XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, ScDBDataFormatting& rDBDataFormatting )
-    : XclExpRoot( rRoot )
+    : XclExpRoot( rRoot ),
+    maDBDataFormatting( rDBDataFormatting )
 {
 }
 
 void XclExpXmlDBDataStyleInfo::SaveXml( XclExpXmlStream& rStrm )
 {
+   sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
+   rDBDataTable->singleElement( XML_tableStyleInfo, XML_name, OUStringToOString(maDBDataFormatting.GetTableStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(), XML_showFirstColumn, XclXmlUtils::ToPsz( false ), XML_showLastColumn, XclXmlUtils::ToPsz( false ), XML_showRowStripes, XclXmlUtils::ToPsz( maDBDataFormatting.GetBandedRows() ), XML_showColumnStripes, XclXmlUtils::ToPsz( maDBDataFormatting.GetBandedColumns() ),FSEND );// hardcoded two values for functions not supported yet
 }
 
 // ============================================================================
 XclExpXmlDBDataColumn::XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int iID, OUString& rName )
-    : XclExpRoot( rRoot )
+    : XclExpRoot( rRoot ),
+      maName( rName ),
+      miID( iID )
 {
 }
 
 void XclExpXmlDBDataColumn::SaveXml( XclExpXmlStream& rStrm )
 {
+   sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
+   rDBDataTable->singleElement( XML_tableColumn, XML_id, OString::number( miID ).getStr(), XML_name, OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ), FSEND );
 }
 
 // ============================================================================
 XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const XclExpRoot& rRoot, ScDBData& rDBData )
     : XclExpRoot( rRoot )
 {
+    ScRange aRange;
+    rDBData.GetArea( aRange );
+    SCROW anRow1, anRow2;
+    SCCOL anCol1, anCol2, anTotalCols;
+    SCTAB anTab1, anTab2;
+    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++ )
+    {
+        OUString aStri = aColName + OUString::number( i );
+        maDBDataColumnContainer.push_back( new XclExpXmlDBDataColumn( rRoot, i, aStri ) );
+    }
 }
 
 void XclExpXmlDBDataColumns::SaveXml( XclExpXmlStream& rStrm )
 {
+   sax_fastparser::FSHelperPtr& rDBDataTable = rStrm.GetCurrentStream();
+   rDBDataTable->startElement( XML_tableColumns, XML_count, OString::number( miCount ).getStr(), FSEND );
+    for ( DBDataColumnContainer::iterator itr = maDBDataColumnContainer.begin(); itr != maDBDataColumnContainer.end(); ++itr )
+    {
+        itr->SaveXml( rStrm );
+    }
+    rDBDataTable->endElement( XML_tableColumns );
 }
 
 // ============================================================================
-XclExpXmlDBDataTable::XclExpXmlDBDataTable(const XclExpRoot& rRoot, ScDBData& rDBData )
-    : XclExpRoot( rRoot )
+XclExpXmlDBDataTable::XclExpXmlDBDataTable(const XclExpRoot& rRoot, ScDBData& rDBData, int nTableId )
+    : XclExpRoot( rRoot ),
+      mnTableId( nTableId )
 {
     maTableColumns.reset( new XclExpXmlDBDataColumns( rRoot, rDBData ) );
     ScDBDataFormatting aDBFormatting;
     rDBData.GetTableFormatting( aDBFormatting );
+    maName = OUString("Table") + OUString::number( mnTableId );
+    maDisplayName = rDBData.GetName();
+    mbTotalsRowShown = false; // Not supported yet in ScDBData
+    rDBData.GetArea( maRange );
     maStyleInfo.reset( new XclExpXmlDBDataStyleInfo( rRoot, aDBFormatting) );
 }
 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);
+    maTableColumns->SaveXml( rStrm );
+    maStyleInfo->SaveXml( rStrm );
+    rDBDataTable->endElement( XML_table );
+
 }
 
 // =============================================================================
 XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot )
     : XclExpRoot( rRoot )
 {
+    miCount = 0;
     ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection();
     if( pDBCollection )
     {
@@ -74,13 +121,33 @@ XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot )
         ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end();
         for(; itr!= itrEnd; ++itr)
         {
-            maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, *itr ) );
             ++miCount;
+            maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, *itr, miCount ) );
         }
     }
 }
 
 void XclExpXmlDBDataTables::SaveXml( XclExpXmlStream& rStrm )
 {
+    // We only make the table folder is we do have any DB Data to write in
+    if( miCount != 0 )
+    {
+        //Now parse through each of the DB Datas making an xml for each.
+        int i = 1;
+        for ( DBDataTableContainer::iterator itr = maDBDataTableContainer.begin(); itr != maDBDataTableContainer.end(); ++itr)
+        {
+            sax_fastparser::FSHelperPtr aDBDataTable = rStrm.CreateOutputStream(
+                OUString( "xl/tables/table" )+ OUString::number( i ) + OUString(".xml" ),
+                OUString( "table" ) + OUString::number( i ) + OUString( ".xml" ),
+                rStrm.GetCurrentStream()->getOutputStream(),
+                "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
+                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" );// Last two parameters are a mystery
+            rStrm.PushStream( aDBDataTable );
+            //Now the table#.xml file is created, need to pass the stream to that table
+            itr->SaveXml( rStrm );
+            ++i;// increment counter
+            rStrm.PopStream();
+        }
+    }
 }
 // =============================================================================
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 31ad08b..74adc67 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -37,6 +37,7 @@
 #include "xename.hxx"
 #include "xepivot.hxx"
 #include "xestyle.hxx"
+#include "xedbdata.hxx"
 #include "xeroot.hxx"
 
 #include "excrecds.hxx"  // for filter manager
@@ -167,6 +168,12 @@ XclExpTableStyles& XclExpRoot::GetTableStyles() const
     return *mrExpData.mxTableStyles;
 }
 
+XclExpXmlDBDataTables& XclExpRoot::GetDBDataTables() const
+{
+    OSL_ENSURE( mrExpData.mxDBDataTables, "XclExpRoot::GetDBDataTables - missingobject (wrong BIFF)");
+    return *mrExpData.mxDBDataTables;
+}
+
 XclExpPivotTableManager& XclExpRoot::GetPivotTableManager() const
 {
     OSL_ENSURE( mrExpData.mxPTableMgr, "XclExpRoot::GetPivotTableManager - missing object (wrong BIFF?)" );
@@ -213,6 +220,7 @@ void XclExpRoot::InitializeGlobals()
         mrExpData.mxLocLinkMgr = mrExpData.mxGlobLinkMgr;
         mrExpData.mxDxfs.reset( new XclExpDxfs( GetRoot() ) );
         mrExpData.mxTableStyles.reset( new XclExpTableStyles( GetRoot(), GetDxfs() ) );
+        mrExpData.mxDBDataTables.reset( new XclExpXmlDBDataTables( GetRoot() ) );
     }
 
     if( GetOutput() == EXC_OUTPUT_XML_2007 )
@@ -291,6 +299,7 @@ XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId ) const
         case EXC_ID_NAME:           xRec = mrExpData.mxNameMgr;     break;
         case EXC_ID_DXFS:           xRec = mrExpData.mxDxfs;        break;
         case EXC_ID_TABLESTYLES:     xRec = mrExpData.mxTableStyles; break;
+        case EXC_ID_DBDATATABLES:   xRec = mrExpData.mxDBDataTables;break;
     }
     OSL_ENSURE( xRec, "XclExpRoot::CreateRecord - unknown record ID or missing object" );
     return xRec;
diff --git a/sc/source/filter/inc/xedbdata.hxx b/sc/source/filter/inc/xedbdata.hxx
index d05b683..187e8c3 100644
--- a/sc/source/filter/inc/xedbdata.hxx
+++ b/sc/source/filter/inc/xedbdata.hxx
@@ -23,15 +23,20 @@
 #include "dbdata.hxx"
 #include "xeroot.hxx"
 #include "xerecord.hxx"
+#include "address.hxx"
 #include <boost/shared_ptr.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 
+const sal_uInt16 EXC_ID_DBDATATABLES = 0x11A01;
+
 class XclExpXmlDBDataStyleInfo : public XclExpRecordBase, protected XclExpRoot
 {
 public:
     XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, ScDBDataFormatting& rDBDataFormatting );
     virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    ScDBDataFormatting maDBDataFormatting;
 };
 // ===========================================================================
 class XclExpXmlDBDataColumn : public XclExpRecordBase, protected XclExpRoot
@@ -39,6 +44,9 @@ class XclExpXmlDBDataColumn : public XclExpRecordBase, protected XclExpRoot
 public:
     XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int iID, OUString& rName );
     virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    OUString maName;
+    int miID;
 };
 
 // ===========================================================================
@@ -57,13 +65,18 @@ private:
 class XclExpXmlDBDataTable : public XclExpRecordBase, protected XclExpRoot
 {
 public:
-    XclExpXmlDBDataTable( const XclExpRoot& rRoot, ScDBData& rDBData );
+    XclExpXmlDBDataTable( const XclExpRoot& rRoot, ScDBData& rDBData, int nTableId );
     virtual void SaveXml( XclExpXmlStream& rStrm );
 private:
     typedef boost::scoped_ptr < XclExpXmlDBDataColumns > DBDataTableColumns;
     typedef boost::scoped_ptr < XclExpXmlDBDataStyleInfo > DBDataStyleInfo;
     DBDataTableColumns maTableColumns;
     DBDataStyleInfo maStyleInfo;
+    int mnTableId;
+    OUString maName;
+    OUString maDisplayName;
+    ScRange maRange;
+    bool mbTotalsRowShown;
 };
 
 // ============================================================================
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index 44952f0..205d0f0 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -52,6 +52,7 @@ class XclExpFilterManager;
 class XclExpPivotTableManager;
 class XclExpDxfs;
 class XclExpTableStyles;
+class XclExpXmlDBDataTables;
 
 /** Stores global buffers and data needed for Excel export filter. */
 struct XclExpRootData : public XclRootData
@@ -73,7 +74,7 @@ struct XclExpRootData : public XclRootData
     typedef boost::shared_ptr< XclExpPivotTableManager >   XclExpPTableMgrRef;
     typedef boost::shared_ptr< XclExpDxfs >                XclExpDxfsRef;
     typedef boost::shared_ptr< XclExpTableStyles >         XclExpTableStylesRef;
-
+    typedef boost::shared_ptr< XclExpXmlDBDataTables >     XclExpXmlDBDataTablesRef;
     XclExpTabInfoRef    mxTabInfo;          /// Calc->Excel sheet index conversion.
     XclExpAddrConvRef   mxAddrConv;         /// The address converter.
     XclExpFmlaCompRef   mxFmlaComp;         /// The formula compiler.
@@ -92,6 +93,7 @@ struct XclExpRootData : public XclRootData
     XclExpPTableMgrRef  mxPTableMgr;        /// All pivot tables and pivot caches.
     XclExpDxfsRef       mxDxfs;             /// All delta formatting entries
     XclExpTableStylesRef   mxTableStyles;      /// All table styles for table formatting
+    XclExpXmlDBDataTablesRef mxDBDataTables;    /// All DBData exported as tables
 
     ScCompiler::OpCodeMapPtr  mxOpCodeMap;  /// mapping between op-codes and names
 
@@ -150,6 +152,8 @@ public:
     XclExpDxfs&          GetDxfs() const;
     /** Returns the Table styles list*/
     XclExpTableStyles&  GetTableStyles() const;
+    /** Returns the tables i.e, DBData */
+    XclExpXmlDBDataTables& GetDBDataTables() const;
     /** Returns the op-code mapping */
     ScCompiler::OpCodeMapPtr  GetOpCodeMap() const;
 
commit d3fbf3bebfaf75d94f08a6560d5f916932440280
Author: Akash Shetye <shetyeakash at gmail.com>
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 0000000..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 0000000..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 "dbdata.hxx"
+#include "xeroot.hxx"
+#include "xerecord.hxx"
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class XclExpXmlDBDataStyleInfo : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, ScDBDataFormatting& rDBDataFormatting );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+};
+// ===========================================================================
+class XclExpXmlDBDataColumn : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int iID, OUString& rName );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+};
+
+// ===========================================================================
+class XclExpXmlDBDataColumns : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpXmlDBDataColumns( const XclExpRoot& rRoot, ScDBData& rDBData );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef boost::ptr_vector< XclExpXmlDBDataColumn > DBDataColumnContainer;
+    DBDataColumnContainer maDBDataColumnContainer;
+    int miCount;
+};
+
+// ============================================================================
+class XclExpXmlDBDataTable : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpXmlDBDataTable( const XclExpRoot& rRoot, ScDBData& rDBData );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef boost::scoped_ptr < XclExpXmlDBDataColumns > DBDataTableColumns;
+    typedef boost::scoped_ptr < XclExpXmlDBDataStyleInfo > DBDataStyleInfo;
+    DBDataTableColumns maTableColumns;
+    DBDataStyleInfo maStyleInfo;
+};
+
+// ============================================================================
+class XclExpXmlDBDataTables : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpXmlDBDataTables( const XclExpRoot& rRoot );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef boost::ptr_vector< XclExpXmlDBDataTable > DBDataTableContainer;
+    DBDataTableContainer maDBDataTableContainer;
+    int miCount;
+};
+
+#endif
commit ac4c81f7b9c4e927419f7d42307f684ef6174478
Author: Akash Shetye <shetyeakash at gmail.com>
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 028678c..a658733 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3213,6 +3213,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;
@@ -3233,10 +3236,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;
             }
         }
     }
@@ -3248,13 +3253,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;
 };
 
 // ============================================================================
commit 165114a4b0f17f38e9b90998891ac878e306e470
Author: Akash Shetye <shetyeakash at gmail.com>
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 a1a7341..028678c 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3134,8 +3134,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 )
 {
 }
 
@@ -3143,16 +3143,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()
@@ -3161,13 +3199,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 );
 }
 
 // ===========================================================================
 
-XclExpTableStyles::XclExpTableStyles( const XclExpRoot& rRoot )
+XclExpTableStyles::XclExpTableStyles( const XclExpRoot& rRoot, XclExpDxfs& rDxfs )
     :XclExpRoot( rRoot )
 {
+    //Search through the collection of ScDBData (Database Ranges)
+    //checking for any table styles associated with them
+    miCount = 0;
+    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)
+        {
+            /*Probably have an issue here..looks like the imported DB is
+            taken into the DBCollection as a named DB, but the DB Range
+            we define by Data->define range is not classified as a named DB.
+            I haven't investigated why yet. For now allow me to consider only
+            the named DBs for table style information.
+            */
+            ScDBDataFormatting aDBFormatting;
+            (*itr).GetTableFormatting( aDBFormatting );
+            if( &(aDBFormatting) )//Probably non-standard?
+            {
+                miCount++;
+                maStyleContainer.push_back( new XclExpTableStyle( rRoot, aDBFormatting, rDxfs ) );
+            }
+        }
+    }
 }
 
 XclExpTableStyles::~XclExpTableStyles()
@@ -3176,6 +3248,13 @@ 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 )
+    {
+        itr->SaveXml( rStrm );
+    }
+    rStyleSheet->endElement( XML_tableStyles );
 }
 
 // ============================================================================
@@ -3204,6 +3283,7 @@ void XclExpXmlStyleSheet::SaveXml( XclExpXmlStream& rStrm )
     CreateRecord( EXC_ID_XFLIST )->SaveXml( rStrm );
     CreateRecord( EXC_ID_DXFS )->SaveXml( rStrm );
     CreateRecord( EXC_ID_PALETTE )->SaveXml( rStrm );
+    CreateRecord( EXC_ID_TABLESTYLES )->SaveXml( rStrm );
 
     aStyleSheet->endElement( XML_styleSheet );
 
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 6f22449..a4e6017 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -30,6 +30,7 @@
 #include "xlstyle.hxx"
 #include "xeroot.hxx"
 #include "conditio.hxx"
+#include "dbdata.hxx"
 #include <boost/shared_ptr.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
@@ -772,34 +773,37 @@ class XclExpTableStyleElement : public XclExpRecordBase, protected XclExpRoot
 public:
     XclExpTableStyleElement( const XclExpRoot& rRoot, OUString& rType, int iSize, int iDxfId );
     virtual ~XclExpTableStyleElement();
-    virtual void SaveXml( XclExpStream& rStrm );
+    virtual void SaveXml( XclExpXmlStream& rStrm );
 private:
     OUString maType;
-    int maSize;
-    int maDxfId;
+    int miSize;
+    int miDxfId;
 };
 
 class XclExpTableStyle : public XclExpRecordBase, protected XclExpRoot
 {
 public:
-    XclExpTableStyle( const XclExpRoot& rRoot, OUString& rTableStyleName );
+    XclExpTableStyle( const XclExpRoot& rRoot, ScDBDataFormatting& rTableStyle, XclExpDxfs& rDxfs );
     virtual ~XclExpTableStyle();
     virtual void SaveXml( XclExpXmlStream& rStrm );
 private:
     typedef boost::ptr_vector< XclExpTableStyleElement > StyleElementContainer;
     StyleElementContainer maStyleElementContainer;
+    ScDBDataFormatting maTableStyle;
     OUString maTableStyleName;
+    int miCount;
 };
 
 class XclExpTableStyles : public XclExpRecordBase, protected XclExpRoot
 {
 public:
-    XclExpTableStyles( const XclExpRoot& rRoot );
+    XclExpTableStyles( const XclExpRoot& rRoot, XclExpDxfs& rDxfs );
     virtual ~XclExpTableStyles();
     virtual void SaveXml( XclExpXmlStream& rStrm );
 private:
     typedef boost::ptr_vector< XclExpTableStyle > StyleContainer;
     StyleContainer maStyleContainer;
+    int miCount;
 };
 
 // ============================================================================
commit b28688b74ad8ab8d3d4d11bab01d000c559811d2
Author: Akash Shetye <shetyeakash at gmail.com>
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 5e0e788..a1a7341 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3131,6 +3131,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;
 
     XclExpTabInfoRef    mxTabInfo;          /// 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.
     XclExpDxfsRef       mxDxfs;             /// All delta formatting entries
+    XclExpTableStylesRef   mxTableStyles;      /// All table styles for table formatting
 
     ScCompiler::OpCodeMapPtr  mxOpCodeMap;  /// mapping between op-codes and names
 
@@ -145,6 +148,8 @@ public:
     XclExpPivotTableManager& GetPivotTableManager() const;
     /** Returns the differential formatting list */
     XclExpDxfs&          GetDxfs() const;
+    /** Returns the Table styles list*/
+    XclExpTableStyles&  GetTableStyles() const;
     /** Returns the op-code mapping */
     ScCompiler::OpCodeMapPtr  GetOpCodeMap() const;
 
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index a0903bc..6f22449 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -42,6 +42,7 @@ const sal_uInt16 EXC_ID_FONTLIST    = 0x8031;   /// For internal use only.
 const sal_uInt16 EXC_ID_FORMATLIST  = 0x801E;   /// For internal use only.
 const sal_uInt16 EXC_ID_XFLIST      = 0x8043;   /// For internal use only.
 const sal_uInt16 EXC_ID_DXFS        = 0x9999;   /// For internal use only. TODO:moggi: find a better/correct value
+const sal_uInt16 EXC_ID_TABLESTYLES = 0x99BE;   /// Needs improvement.
 
 // PALETTE record - color information =========================================
 
@@ -766,6 +767,43 @@ private:
 
 // ============================================================================
 
+class XclExpTableStyleElement : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpTableStyleElement( const XclExpRoot& rRoot, OUString& rType, int iSize, int iDxfId );
+    virtual ~XclExpTableStyleElement();
+    virtual void SaveXml( XclExpStream& rStrm );
+private:
+    OUString maType;
+    int maSize;
+    int maDxfId;
+};
+
+class XclExpTableStyle : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpTableStyle( const XclExpRoot& rRoot, OUString& rTableStyleName );
+    virtual ~XclExpTableStyle();
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef boost::ptr_vector< XclExpTableStyleElement > StyleElementContainer;
+    StyleElementContainer maStyleElementContainer;
+    OUString maTableStyleName;
+};
+
+class XclExpTableStyles : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    XclExpTableStyles( const XclExpRoot& rRoot );
+    virtual ~XclExpTableStyles();
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef boost::ptr_vector< XclExpTableStyle > StyleContainer;
+    StyleContainer maStyleContainer;
+};
+
+// ============================================================================
+
 class XclExpXmlStyleSheet : public XclExpRecordBase, protected XclExpRoot
 {
 public:
commit 42b10065b3ba4f79487105feb9ee53a8d84e1e92
Author: Akash Shetye <shetyeakash at gmail.com>
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 8158af5..5e0e788 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 <oox/token/tokens.hxx>
 #include <boost/ptr_container/ptr_vector.hpp>
@@ -2876,16 +2877,17 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
     (*mpKeywordTable)[ NF_KEY_NNNN ] = "DDDD";
     // 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)
@@ -2899,15 +2901,15 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
                     if(pFormatEntry->GetType() == condformat::CONDITION)
                     {
                         const ScCondFormatEntry* pEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry);
-                        aStyleName= pEntry->GetStyle();
+                        aStyleName= pEntry->GetStyle();//getting the stylename in aStyleName
                     }
                     else
                     {
                         const ScCondDateFormatEntry* pEntry = static_cast<const ScCondDateFormatEntry*>(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<OUString, sal_Int32>(aStyleName, nIndex));
 
@@ -2915,7 +2917,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()) )
@@ -2969,6 +2971,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 <OUString> 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<OUString>::iterator vit = aStyleNameVector.begin(); vit != aStyleNameVector.end(); ++vit )
+            {
+                if (maStyleNameToDxfId.find(*vit) == maStyleNameToDxfId.end())//If not already in
+                {
+                    maStyleNameToDxfId.insert(std::pair<OUString, sal_Int32>(*vit, nIndex));
+
+                    SfxStyleSheetBase* pStyle = rRoot.GetDoc().GetStyleSheetPool()->Find( *vit );
+                    if(!pStyle)
+                        continue;
+
+                    SfxItemSet& rSet = pStyle->GetItemSet();//Get each item set
+
+                    XclExpCellBorder* pBorder = new XclExpCellBorder;
+                    if (!pBorder->FillFromItemSet( rSet, GetPalette(), GetBiff()) )
+                    {
+                        delete pBorder;
+                        pBorder = NULL;
+                    }
+
+                    XclExpCellAlign* pAlign = new XclExpCellAlign;
+                    if (!pAlign->FillFromItemSet( rSet, false, GetBiff()))
+                    {
+                        delete pAlign;
+                        pAlign = NULL;
+                    }
+
+                    XclExpCellProt* pCellProt = new XclExpCellProt;
+                    if (!pCellProt->FillFromItemSet( rSet ))
+                    {
+                        delete pCellProt;
+                        pCellProt = NULL;
+                    }
+
+                    XclExpColor* pColor = new XclExpColor();
+                    if(!pColor->FillFromItemSet( rSet ))
+                    {
+                        delete pColor;
+                        pColor = NULL;
+                    }
+
+                    XclExpFont* pFont = NULL;
+                    // check if non default font is set and only export then
+                    if (rSet.GetItemState(rSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT )) == SFX_ITEM_SET )
+                    {
+                        Font aFont = XclExpFontHelper::GetFontFromItemSet( GetRoot(), rSet, com::sun::star::i18n::ScriptType::WEAK );
+                        pFont = new XclExpFont( GetRoot(), XclFontData( aFont ), EXC_COLOR_CELLTEXT );
+                    }
+
+                    XclExpNumFmt* pNumFormat = NULL;
+                    const SfxPoolItem *pPoolItem = NULL;
+                    if( rSet.GetItemState( ATTR_VALUE_FORMAT, sal_True, &pPoolItem ) == SFX_ITEM_SET )
+                    {
+                        sal_uLong nScNumFmt = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
+                        sal_Int32 nXclNumFmt = GetRoot().GetNumFmtBuffer().Insert(nScNumFmt);
+                        pNumFormat = new XclExpNumFmt( nScNumFmt, nXclNumFmt, GetNumberFormatCode( *this, nScNumFmt, mxFormatter.get(), mpKeywordTable.get() ));
+                    }
+
+                    maDxf.push_back(new XclExpDxf( rRoot, pAlign, pBorder, pFont, pNumFormat, pCellProt, pColor ));
+                    ++nIndex;
+                }
+            }
+        }
     }
 }
 
commit 20fa2ce5d750dfdfd3de57b7ebf933b02db8f405
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 9 15:43:48 2013 +0200

    not every db range contains db formattings
    
    Change-Id: I13a54110bfa625d6495bcef36e93aa76d11fb99c

diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index 0fa9e03..b2c437e 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -110,9 +110,15 @@ void Table::finalizeImport()
         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
+        TableStyleRef pTableStyle = getStyles().getTableStyle( maModel.maTableStyleName );
+        if(!pTableStyle)
+        {
+            SAL_WARN("sc", "did not find Table style for: " << maModel.maTableStyleName);
+            return;
+        }
+
+        ScDBDataFormatting aTableFormatting = pTableStyle->getTableFormatting();
 
-        //can mess up if aTableFormatting is nothing. Need to handle that
         aTableFormatting.SetBandedRows( maModel.mbShowRowStripes );
         aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes );
         addDatabaseFormatting( maDBRangeName, aTableFormatting );
commit e11bdb3f32b140167107176296b48ee069e4734a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 8 21:59:27 2013 +0200

    use a functor and standard algorithms
    
    Change-Id: I0cb7b603b4495d78e217153fb0339a5ba2b71157

diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 854cdb3..9c02540 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -77,6 +77,8 @@
 #include "globstr.hrc"
 #include "xlconst.hxx"
 
+#include <algorithm>
+
 using ::com::sun::star::table::BorderLine2;
 namespace oox {
 namespace xls {
@@ -3435,19 +3437,35 @@ void StylesBuffer::writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 n
         pXf->writeToPropertySet( rPropSet );
 }
 
-TableStyleRef StylesBuffer::getTableStyle( OUString& rTableStyleName )
+namespace {
+
+struct FindTableStyleByName
 {
-    for( ::std::vector< TableStyleRef >::iterator i = maTableStyles.begin(); i < maTableStyles.end(); ++i)
+    FindTableStyleByName( const OUString& rName ):
+        mrName(rName) {}
+
+    bool operator()(const TableStyleRef& pStyle)
     {
-        if( ((*i)->getTableStyleName() ).equals(rTableStyleName) )
-        {
-            return(*i);
-        }
+        return mrName == pStyle->getTableStyleName();
     }
+
+private:
+    const OUString& mrName;
+};
+
+}
+
+TableStyleRef StylesBuffer::getTableStyle( OUString& rTableStyleName )
+{
+    std::vector< TableStyleRef >::const_iterator itr = std::find_if(
+            maTableStyles.begin(), maTableStyles.end(), FindTableStyleByName(rTableStyleName));
+
+    if(itr != maTableStyles.end())
+        return *itr;
+
     return 0;
 }
 
-// ============================================================================
 
 } // namespace xls
 } // namespace oox
commit c1ae4351ca8bd83161876c70f3cc1dcdfd40d66a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 8 21:45:05 2013 +0200

    we don't need this function
    
    actually the code was a bit wrong and was internally using the upper
    case search without converting the name to uppercase
    
    Change-Id: I3d7252cfc5022458be860613881bbeb9771a16cb

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 3522fdf..89ed644 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -237,7 +237,6 @@ public:
     const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
     ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
     ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab );
-    ScDBData* GetDBByName( const OUString& rName );
 
     void    DeleteOnTab( SCTAB nTab );
     void    UpdateReference(UpdateRefMode eUpdateRefMode,
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e2bcbb621..d7cff5d 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -923,11 +923,6 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
     return NULL;
 }
 
-ScDBData* ScDBCollection::GetDBByName( const OUString& rName )
-{
-   return maNamedDBs.findByUpperName( rName );
-}
-
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
 {
     FindByTable func(nTab);
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index cd2461a..7c094f6 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -467,9 +467,9 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString
 
 void WorkbookGlobals::addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting )
 {
-    //Is such smartness allowed? Or should catch objects and then call for each method call?
-    ScDBData* pDBRange = getScDocument().GetDBCollection()->GetDBByName( rName );
-    if( pDBRange != NULL )
+    ScDBData* pDBRange = getScDocument().GetDBCollection()->getNamedDBs().findByUpperName(
+            ScGlobal::pCharClass->uppercase(rName) );
+    if( pDBRange )
         pDBRange->SetTableFormatting( rDBDataFormatting );
 }
 
commit 7d6e550aff6e036ed9ea392796a56d3680ff9d2e
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Sun Jul 7 11:39:06 2013 +0530

    Done with adding the formatting information to ScDBData objects
    
    Change-Id: I6cf025ce11cbb3be6a45f7a637bc919c0485c9dc

diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index d0e01b5..a2562c2 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -23,7 +23,6 @@
 #include "global.hxx"
 #include "queryparam.hxx"
 #include "subtotalparam.hxx"
-#include "dbdataformatting.hxx"
 
 #include <com/sun/star/sheet/TableFilterField.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
@@ -625,7 +624,6 @@ public:
     virtual void SAL_CALL   addNewByName( const OUString& aName,
                                 const ::com::sun::star::table::CellRangeAddress& aRange )
                                     throw(::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL   addDatabaseRangeFormatting( const OUString& aName, const ScDBDataFormatting& rTableFormatData ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL   removeByName( const OUString& aName )
                                 throw(::com::sun::star::uno::RuntimeException);
 
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 89ed644..3522fdf 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -237,6 +237,7 @@ public:
     const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
     ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
     ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab );
+    ScDBData* GetDBByName( const OUString& rName );
 
     void    DeleteOnTab( SCTAB nTab );
     void    UpdateReference(UpdateRefMode eUpdateRefMode,
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d7cff5d..e2bcbb621 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -923,6 +923,11 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
     return NULL;
 }
 
+ScDBData* ScDBCollection::GetDBByName( const OUString& rName )
+{
+   return maNamedDBs.findByUpperName( rName );
+}
+
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
 {
     FindByTable func(nTab);
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index b1b930d..0fa9e03 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -116,11 +116,6 @@ void Table::finalizeImport()
         aTableFormatting.SetBandedRows( maModel.mbShowRowStripes );
         aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes );
         addDatabaseFormatting( maDBRangeName, aTableFormatting );
-        //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/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 0c60d85..cd2461a 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -467,10 +467,10 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString
 
 void WorkbookGlobals::addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting )
 {
-    PropertySet aDocProps( mxDoc );
-    Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
-    //xDatabaseRanges->addDatabaseRangeFormatting( rName, rDBDataFormatting );
-    //Need some way to add the formatting information. Stuck here major.
+    //Is such smartness allowed? Or should catch objects and then call for each method call?
+    ScDBData* pDBRange = getScDocument().GetDBCollection()->GetDBByName( rName );
+    if( pDBRange != NULL )
+        pDBRange->SetTableFormatting( rDBDataFormatting );
 }
 
 Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index c2746ee..23cf3da 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2285,18 +2285,6 @@ void SAL_CALL ScDatabaseRangesObj::addNewByName( const OUString& aName,
         throw uno::RuntimeException();      // no other exceptions specified
 }
 
-void SAL_CALL ScDatabaseRangesObj::addDatabaseRangeFormatting( const OUString& rName, const ScDBDataFormatting& rTableFormatData ) throw (uno::RuntimeException)
-{
-    bool bDone = false;
-    if( pDocShell )
-    {
-        ScDBDocFunc aFunc( *pDocShell );
-        bDone = (aFunc.AddDBFormatting( rName, rTableFormatData ));
-    }
-    if( !bDone )
-        throw uno::RuntimeException();
-}
-
 void SAL_CALL ScDatabaseRangesObj::removeByName( const OUString& aName )
                                         throw(uno::RuntimeException)
 {
commit 4a3b09cf9dbd07d01c4ba36c8c9f0031a5219ef8
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Wed Jul 3 22:14:22 2013 +0530

    Tried to add code for filling in formatting attribute in ScDBData failed
    
    The problem is with the use of XDatabaseRange in the filter import code. We do not deal directly with ScDBData objects. Since I cannot modify the XDatabaseRange definition we need to find a cleverer way to call SetTableFormatting on an ScDBData object. I am kinda stuck here. Please help.
    
    Change-Id: Ia64da4f4c161b88912b97c27ad9f52a86f3564ef

diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index a2562c2..d0e01b5 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -23,6 +23,7 @@
 #include "global.hxx"
 #include "queryparam.hxx"
 #include "subtotalparam.hxx"
+#include "dbdataformatting.hxx"
 
 #include <com/sun/star/sheet/TableFilterField.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
@@ -624,6 +625,7 @@ public:
     virtual void SAL_CALL   addNewByName( const OUString& aName,
                                 const ::com::sun::star::table::CellRangeAddress& aRange )
                                     throw(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL   addDatabaseRangeFormatting( const OUString& aName, const ScDBDataFormatting& rTableFormatData ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL   removeByName( const OUString& aName )
                                 throw(::com::sun::star::uno::RuntimeException);
 
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index f4ce1cc..1fb6116 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -26,6 +26,7 @@
 #include "oox/drawingml/chart/chartconverter.hxx"
 #include "biffhelper.hxx"
 #include "rangenam.hxx"
+#include "dbdataformatting.hxx"
 
 namespace com { namespace sun { namespace star {
     namespace container { class XNameAccess; }
@@ -199,6 +200,9 @@ public:
                             OUString& orName,
                             const ::com::sun::star::table::CellRangeAddress& rRangeAddr ) const;
 
+    /** Allows setting the table(database range) formatting attribute of ScDBData instances*/
+    void addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting );
+
     /** Creates and returns an unnamed database range on-the-fly in the Calc document.
         The range will not be buffered in the global table buffer. */
     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange >
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index c4580c6..b1b930d 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -111,8 +111,11 @@ void Table::finalizeImport()
 
         //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
+
+        //can mess up if aTableFormatting is nothing. Need to handle that
         aTableFormatting.SetBandedRows( maModel.mbShowRowStripes );
         aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes );
+        addDatabaseFormatting( maDBRangeName, aTableFormatting );
         //Add this table formatting information to the ScDBData instance.
         //xDatabaseRange->SetTableFormatting( aTableFormatting );
         //Still figuring how to have an ScDBData object out of this
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 37d5191..0c60d85 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -174,6 +174,8 @@ public:
     ScRangeData* createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const;
     /** Creates and returns a database range on-the-fly in the Calc document. */
     Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const;
+    /** Adds a DBData formatting object to a DB Range's formatting attribute*/
+    void addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting );
     /** Creates and returns an unnamed database range on-the-fly in the Calc document. */
     Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const;
     /** Creates and returns a com.sun.star.style.Style object for cells or pages. */
@@ -463,6 +465,14 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString
     return xDatabaseRange;
 }
 
+void WorkbookGlobals::addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting )
+{
+    PropertySet aDocProps( mxDoc );
+    Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
+    //xDatabaseRanges->addDatabaseRangeFormatting( rName, rDBDataFormatting );
+    //Need some way to add the formatting information. Stuck here major.
+}
+
 Reference< XDatabaseRange > WorkbookGlobals::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
 {
     // validate cell range
@@ -807,6 +817,11 @@ Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString&
     return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr );
 }
 
+void WorkbookHelper::addDatabaseFormatting( const OUString& rName, const ScDBDataFormatting& rDBDataFormatting )
+{
+    mrBookGlob.addDatabaseFormatting( rName, rDBDataFormatting );
+}
+
 Reference< XDatabaseRange > WorkbookHelper::createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const
 {
     return mrBookGlob.createUnnamedDatabaseRangeObject( rRangeAddr );
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 1c35fd6..fd0b74a 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -57,7 +57,6 @@ using namespace ::com::sun::star;
 
 bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, sal_Bool /* bApi */ )
 {
-
     ScDocShellModificator aModificator( rDocShell );
 
     ScDocument* pDoc = rDocShell.GetDocument();
@@ -191,6 +190,20 @@ bool ScDBDocFunc::RenameDBRange( const String& rOld, const String& rNew )
     return bDone;
 }
 
+bool ScDBDocFunc::AddDBFormatting( const OUString& rName, const ScDBDataFormatting& rDBFormatting )
+{
+    ScDocument* pDoc = rDocShell.GetDocument();
+    ScDBCollection* pDocColl = pDoc->GetDBCollection();
+    ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
+    ScDBData* pDBData = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rName));
+    if( pDBData )
+    {
+        pDBData->SetTableFormatting( rDBFormatting );
+        return true;
+    }
+    return false;
+}
+
 bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
 {
     bool bDone = false;
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index 10a38df..5b97dac 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -21,6 +21,7 @@
 #define SC_DBDOCFUN_HXX
 
 #include "address.hxx"
+#include "dbdataformatting.hxx"
 #include <tools/solar.h>
 #include <com/sun/star/uno/Sequence.hxx>
 
@@ -85,6 +86,7 @@ public:
     bool AddDBRange( const OUString& rName, const ScRange& rRange, sal_Bool bApi );
     bool DeleteDBRange( const OUString& rName );
     bool RenameDBRange( const String& rOld, const String& rNew );
+    bool AddDBFormatting( const OUString& rName, const ScDBDataFormatting& rDBFormatting );
     bool ModifyDBData( const ScDBData& rNewData );  // Name unveraendert
 
     bool RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bool bIsUnnamed=false, SCTAB aTab = 0);
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 23cf3da..c2746ee 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2285,6 +2285,18 @@ void SAL_CALL ScDatabaseRangesObj::addNewByName( const OUString& aName,
         throw uno::RuntimeException();      // no other exceptions specified
 }
 
+void SAL_CALL ScDatabaseRangesObj::addDatabaseRangeFormatting( const OUString& rName, const ScDBDataFormatting& rTableFormatData ) throw (uno::RuntimeException)
+{
+    bool bDone = false;
+    if( pDocShell )
+    {
+        ScDBDocFunc aFunc( *pDocShell );
+        bDone = (aFunc.AddDBFormatting( rName, rTableFormatData ));
+    }
+    if( !bDone )
+        throw uno::RuntimeException();
+}
+
 void SAL_CALL ScDatabaseRangesObj::removeByName( const OUString& aName )
                                         throw(uno::RuntimeException)
 {
commit 13989c3d07d24f192dc12eb4c665905d8728a473
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Thu Jun 27 00:55:56 2013 +0530

    Code added for reading and processing <tableStyleInfo> 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.
 
+    bool                mbShowRowStripes;  /// <tableStyleInfo> data banded rows
+    bool                mbShowColumnStripes;/// <tableStyleInfo> data banded columns
+
     explicit            TableModel();
 };
 
@@ -52,6 +56,8 @@ public:
 
     /** Imports a table definition from the passed attributes. */
     void                importTable( const AttributeList& rAttribs, sal_Int16 nSheet );
+    /**Imports the table style info from <tableStyleInfo> tag. */
+    void                importTableStyleInfo( const AttributeList& rAttribs );
     /** Imports a table definition from a TABLE record. */
     void                importTable( 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;
commit 16aab2ee8a9f30a7cd9bcabf8b0947b0c0a897cf
Author: Akash Shetye <shetyeakash at gmail.com>
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 c8c783d..c3fa63e 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -793,6 +793,8 @@ public:
     explicit            TableStyle( const WorkbookHelper& rHelper, const OUString& rTableStyleName );
     void                importTableStyleElement( const AttributeList& rAttribs );
     void                finalizeImport();
+    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;
 
@@ -1009,6 +1011,9 @@ public:
     void                writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const;
 
     bool                hasBorder( 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;
commit 9d29ba1b3c76cc9a88dd9f52aa79495dbcaeb38d
Author: Akash Shetye <shetyeakash at gmail.com>
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 218e000..854cdb3 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2658,6 +2658,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()
 {
 }
@@ -3425,6 +3435,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
commit f2dd5e1e3f43a2dc113ca2e7201878efa3fc451f
Author: Akash Shetye <shetyeakash at gmail.com>
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 <tableStyle> and <tableStyleElement> 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 cbedfb3..c8c783d 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -36,6 +36,7 @@
 #include <editeng/svxenum.hxx>
 #include <editeng/frmdir.hxx>
 #include "attarray.hxx"
+#include "dbdataformatting.hxx"
 #include <list>
 
 class ScMarkData;
@@ -785,6 +786,23 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
 
 // ============================================================================
 
+/* Contains attributes for table styles from the <tableStyle> element */
+class TableStyle : public WorkbookHelper
+{
+public:
+    explicit            TableStyle( const WorkbookHelper& rHelper, const OUString& rTableStyleName );
+    void                importTableStyleElement( const AttributeList& rAttribs );
+    void                finalizeImport();
+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
 {
@@ -920,7 +938,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. */
     void                importPaletteColor( const AttributeList& rAttribs );
     /** Inserts a new number format code. */
@@ -995,6 +1015,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;
 
     ColorPalette        maPalette;          /// Color palette.
@@ -1006,6 +1027,7 @@ private:
     XfVector            maStyleXfs;         /// List of cell styles.
     CellStyleBuffer     maCellStyles;       /// All built-in and user defined cell styles.
     DxfVector           maDxfs;             /// List of differential cell styles.
+    TableStyleVector    maTableStyles;        /// 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 e34080e..218e000 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2630,6 +2630,41 @@ void Dxf::writeToPropertySet( PropertySet& rPropSet ) const
 
 // ============================================================================
 
+TableStyle::TableStyle( const WorkbookHelper& rHelper, const OUString& rTableStyleName ) :
+    WorkbookHelper( rHelper )
+{
+    mxTableFormatting.reset( new ::ScDBDataFormatting() );
+    mxTableFormatting->SetTableStyleName( rTableStyleName );
+}
+
+void TableStyle::importTableStyleElement( const AttributeList& rAttribs )
+{
+    //Get the table Style element type.
+    OUString aStyleElementType = rAttribs.getXString( XML_type, OUString() );
+    //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.
+}
+
+void TableStyle::finalizeImport()
+{
+}
+
+
+// ============================================================================
+
 namespace {
 
 const sal_Char* const spcLegacyStyleNamePrefix = "Excel_BuiltIn_";
@@ -3086,6 +3121,14 @@ DxfRef StylesBuffer::createDxf( sal_Int32* opnDxfId )
     return xDxf;
 }
 
+TableStyleRef StylesBuffer::createTableStyle( const OUString& rTableStyleName, sal_Int32* opnTableStyleId ) // should I be using sal_Int32 here??
+{
+    if( opnTableStyleId ) *opnTableStyleId = static_cast< sal_Int32 >( maTableStyles.size() );
+    TableStyleRef xTableStyle( new TableStyle( *this, rTableStyleName ) );
+    maTableStyles.push_back( xTableStyle );
+    return xTableStyle;
+}
+
 void StylesBuffer::importPaletteColor( const AttributeList& rAttribs )
 {
     maPalette.importPaletteColor( rAttribs );
@@ -3136,6 +3179,8 @@ void StylesBuffer::finalizeImport()
     maCellStyles.finalizeImport();
     // differential formatting (for conditional formatting)
     maDxfs.forEachMem( &Dxf::finalizeImport );
+    // Table Styles
+    maTableStyles.forEachMem( &TableStyle::finalizeImport );
 }
 
 sal_Int32 StylesBuffer::getPaletteColor( sal_Int32 nPaletteIdx ) const
diff --git a/sc/source/filter/oox/stylesfragment.cxx b/sc/source/filter/oox/stylesfragment.cxx
index ee21b2a..2a6bb94 100644
--- a/sc/source/filter/oox/stylesfragment.cxx
+++ b/sc/source/filter/oox/stylesfragment.cxx
@@ -174,6 +174,23 @@ ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const Attribu
 
 // ============================================================================
 
+ContextHandlerRef TableStyleContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+    if( mxTableStyle.get() ) switch( getCurrentElement() )
+    {
+        case XLS_TOKEN( tableStyle ):
+            switch( nElement )
+            {
+                case XLS_TOKEN( tableStyleElement ):
+                    mxTableStyle->importTableStyleElement( rAttribs );
+                    break;
+            }
+    }
+    return 0;
+}
+
+// ============================================================================
+
 StylesFragment::StylesFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
     WorkbookFragmentBase( rHelper, rFragmentPath )
 {
@@ -198,7 +215,8 @@ ContextHandlerRef StylesFragment::onCreateContext( sal_Int32 nElement, const Att
                 case XLS_TOKEN( cellXfs ):
                 case XLS_TOKEN( cellStyleXfs ):
                 case XLS_TOKEN( dxfs ):
-                case XLS_TOKEN( cellStyles ):   return this;
+                case XLS_TOKEN( cellStyles ):
+                case XLS_TOKEN( tableStyles ):  return this;
             }
         break;
 
@@ -229,6 +247,10 @@ ContextHandlerRef StylesFragment::onCreateContext( sal_Int32 nElement, const Att
         case XLS_TOKEN( cellStyles ):
             if( nElement == XLS_TOKEN( cellStyle ) ) getStyles().importCellStyle( rAttribs );
         break;
+        case XLS_TOKEN( tableStyles ):
+            OUString aTableStyleName = rAttribs.getXString( XML_name, OUString() );
+            if( nElement == XLS_TOKEN( tableStyle ) ) return new TableStyleContext( *this, getStyles().createTableStyle( aTableStyleName ) );
+        break;
     }
     return 0;
 }
commit 5ee29a4969d52118d083468db728b53f5a466c06
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Tue Jun 25 11:14:31 2013 +0530

    Fixes commit f502c0ea6826fc0e915d8d4c302fe978a4d43a58 that breaks the build.
    
    Change-Id: Ib815dfb3679627c9d99ef747b7b0ef643b7e0cbb

diff --git a/sc/inc/dbdataformatting.hxx b/sc/inc/dbdataformatting.hxx
index ef8d5fd..50d62f5 100644
--- a/sc/inc/dbdataformatting.hxx
+++ b/sc/inc/dbdataformatting.hxx
@@ -33,7 +33,7 @@ class SC_DLLPUBLIC ScDBDataFormatting
         bool bBandedColumns;
     public:
         ScDBDataFormatting();
-        ScDBDataFormatting(const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle, bool bBRows, bool bBCols);
+        ScDBDataFormatting(const OUString& rTableStyleName, const OUString& rFirstRowStripeStyle, const OUString& rSecondRowStripeStyle, const OUString& rFirstColStripeStyle, const OUString& rSecondColStripeStyle, bool bBRows, bool bBCols);
         ScDBDataFormatting( const ScDBDataFormatting& rTableFormatData );
         void SetTableStyleName( const OUString& rTableStyleName );
         const OUString& GetTableStyleName();
diff --git a/sc/source/core/tool/dbdataformatting.cxx b/sc/source/core/tool/dbdataformatting.cxx
index fe6a8a2..24fde5e 100644
--- a/sc/source/core/tool/dbdataformatting.cxx
+++ b/sc/source/core/tool/dbdataformatting.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list