[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - 716 commits - accessibility/CustomTarget_bridge_inc.mk accessibility/inc android/Bootstrap android/experimental android/sdremote animations/source avmedia/source basctl/source basegfx/source basic/inc basic/qa basic/source binaryurp/source bin/fixincludeguards.sh bin/lo-generate-source-tarball bridges/Package_jnilib_java_uno.mk bridges/test canvas/source chart2/CppunitTest_chart2_import.mk chart2/qa chart2/source chart2/workbench cli_ure/CliNativeLibrary_cli_cppuhelper.mk cli_ure/Executable_climaker.mk cli_ure/Library_cli_cppuhelper_native.mk cli_ure/Library_cli_uno.mk cli_ure/Module_cli_ure.mk cli_ure/Package_cli_basetypes_copy.mk cli_ure/Package_config.mk cli_ure/Package_version.mk cli_ure/source comphelper/CppunitTest_comphelper_syntaxhighlight_test.mk comphelper/Library_comphelper.mk comphelper/Module_comphelper.mk comphelper/qa comphelper/source config_host.mk.in configmgr/source configure.ac connectivity/Pa ckage_postgresql-sdbc.mk connectivity/source cppcanvas/source cppuhelper/Module_cppuhelper.mk cppuhelper/Package_unorc.mk cppuhelper/source cppuhelper/test cppu/qa cpputools/source crashrep/CustomTarget_crashrep_res.mk cui/source cui/uiconfig dbaccess/JunitTest_dbaccess_complex.mk dbaccess/source desktop/Extension_test-passive.mk desktop/inc desktop/Module_desktop.mk desktop/Package_branding_custom.mk desktop/Package_branding.mk desktop/Package_desktop_install.mk desktop/Package_scripts_install.mk desktop/Package_scripts.mk desktop/Package_soffice_sh.mk desktop/source desktop/unx desktop/win32 desktop/WinResTarget_quickstart.mk desktop/WinResTarget_sofficebin.mk desktop/WinResTarget_soffice.mk dictionaries distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeMacOSX64.conf distro-configs/OxygenOfficeLinux.conf download.lst editeng/inc editeng/source embeddedobj/source embeddedobj/test embedserv/source eventattacher/source extensions/Library_ldapbe2.mk extensions/Pac kage_mdibundle.mk extensions/Package_OOoSpotlightImporter.mk extensions/source extensions/test external/afms external/apache-commons external/beanshell external/cairo external/cppunit external/ct2n external/curl external/epm external/firebird external/fontconfig external/freetype external/hsqldb external/hyphen external/icu external/jfreereport external/lcms2 external/libatomic_ops external/libexttextcat external/liblangtag external/libxml2 external/libxslt external/lpsolve external/mingw-externals external/more_fonts external/moz external/msc-externals extras/ExternalPackage_accessoriesgallerydrawspeople.mk extras/ExternalPackage_accessoriesgalleryelementsbullets2.mk extras/ExternalPackage_accessoriesgallery.mk extras/ExternalPackage_accessoriesgallerynonfree.mk extras/ExternalPackage_accessoriesgalleryphotosbuildings.mk extras/ExternalPackage_accessoriesgalleryphotoscelebration.mk extras/ExternalPackage_accessoriesgalleryphotoscities.mk extras/ExternalPackage_accessoriesga lleryphotosfauna.mk extras/ExternalPackage_accessoriesgalleryphotosflowers.mk extras/ExternalPackage_accessoriesgalleryphotosfoodsanddrinks.mk extras/ExternalPackage_accessoriesgalleryphotoshumans.mk extras/ExternalPackage_accessoriesgalleryphotoslandscapes.mk extras/ExternalPackage_accessoriesgalleryphotosobjects.mk extras/ExternalPackage_accessoriesgalleryphotosplants.mk extras/ExternalPackage_accessoriesgalleryphotosspace.mk extras/ExternalPackage_accessoriesgalleryphotosstatues.mk extras/ExternalPackage_accessoriesgalleryphotostravel.mk extras/ExternalPackage_accessoriestemplatescommoneducate.mk extras/ExternalPackage_accessoriestemplatescommonfinance.mk extras/ExternalPackage_accessoriestemplatescommonforms.mk extras/ExternalPackage_accessoriestemplatescommonlabels.mk extras/ExternalPackage_accessoriestemplatescommonlayout.mk extras/ExternalPackage_accessoriestemplatescommonmisc.mk extras/ExternalPackage_accessoriestemplatescommon.mk extras/ExternalPackage_accessorieste mplatescommonofficorr.mk extras/ExternalPackage_accessoriestemplatescommonoffimisc.mk extras/ExternalPackage_accessoriestemplatescommonpersonal.mk extras/ExternalPackage_accessoriestemplatescommonpresent.mk extras/ExternalPackage_extra_fonts.mk extras/Package_autocorr.mk extras/Package_autotextuser.mk extras/Package_cfgsrvbitmapunx.mk extras/Package_cfgsrvnolang.mk extras/Package_cfgusr.mk extras/Package_databasebiblio.mk extras/Package_database.mk extras/Package_extensions.mk extras/Package_fonts.mk extras/Package_gallbullets.mk extras/Package_gallhtmlexpo.mk extras/Package_gallmytheme.mk extras/Package_gallroot.mk extras/Package_gallsystem.mk extras/Package_gallwwwback.mk extras/Package_gallwwwgraf.mk extras/Package_glade.mk extras/Package_labels.mk extras/Package_newfiles.mk extras/Package_palettes.mk extras/Package_tpllayoutimpr.mk extras/Package_tplwizagenda.mk extras/Package_tplwizbitmap.mk extras/Package_tplwizdesktop.mk extras/Package_tplwizfax.mk extras/Package_tplw izletter.mk extras/Package_tplwizreport.mk extras/Package_tplwizstyles.mk extras/Package_wordbook.mk filter/Package_docbook.mk filter/Package_xhtml.mk filter/Package_xslt.mk filter/source forms/source formula/source fpicker/source framework/inc framework/Package_dtd.mk framework/source .gitignore helpcompiler/source helpcontent2 i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/Library_localedata_others.mk i18npool/qa i18npool/source icon-themes/sifr idlc/source include/avmedia include/basebmp include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppcanvas include/cppu include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/helpcompiler include/i18nlangtag include/i18nutil include/jvmfwk include/linguistic include/o3tl include/oox include/osl include/package include/postmac.h include/postx.h include/premac.h include/prex.h include/registry includ e/rsc include/rtl include/sal include/salhelper include/sax include/sfx2 include/shell include/sot include/store include/svl include/svtools include/svx include/systools include/test include/toolkit include/tools include/touch include/tubes include/typelib include/ucbhelper include/uno include/unotest include/unotools include/vbahelper include/vcl include/xmloff include/xmlscript instsetoo_native/CustomTarget_setup.mk instsetoo_native/Package_setup.mk instsetoo_native/util ios/CustomTarget_MobileLibreOffice_app.mk ios/experimental ios/iosremote ios/lo.xcconfig.in ios/MobileLibreOffice ios/Module_ios.mk io/source ios/shared io/test jurt/CustomTarget_test_urp.mk jvmfwk/Module_jvmfwk.mk jvmfwk/Package_jreproperties.mk jvmfwk/Package_jreproperties_solver.mk jvmfwk/Package_rcfiles.mk jvmfwk/Package_rcfiles_solver.mk jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/Module_l10ntools.mk l10ntools/Package_ulfconv.mk l10ntools/source languagetool/ExternalProject_languagetool.mk la nguagetool/JLanguageTool-1.7.0.patch languagetool/Package_languagetool.mk librelogo/Package_librelogo.mk librelogo/Package_librelogo_properties.mk librelogo/source libxmlsec/ExternalPackage_xmlsec.mk libxmlsec/ExternalProject_xmlsec.mk libxmlsec/xmlsec1-configure.patch lingucomponent/source linguistic/inc linguistic/source linguistic/workben lotuswordpro/source Makefile.fetch Makefile.in nlpsolver/Extension_nlpsolver.mk np_sdk/npsdk nss/ExternalPackage_nss.mk nss/ExternalProject_nss.mk nss/nss-config.in nss/README odk/CustomTarget_javadoc.mk odk/examples odk/Package_cli.mk offapi/com offapi/UnoApi_offapi.mk officecfg/Package_misc.mk officecfg/registry oovbaapi/UnoApi_oovbaapi.mk oox/source openldap/ExternalProject_openldap.mk openssl/ExternalPackage_openssl.mk package/Package_dtd.mk package/source padmin/Package_padmin.mk padmin/source postgresql/ExternalProject_postgresql.mk postprocess/Package_images.mk postprocess/Package_registry.mk psprint_config/Package_fontunxppds.mk psprint_config/Package_fontunxpsprint.mk python3/ExternalPackage_python3.mk python3/python-3.3.0-ssl.patch.1 pyuno/Package_python_scripts.mk pyuno/Package_python_shell.mk pyuno/Package_zipcore.mk qadevOOo/tests readlicense_oo/Package_files.mk readlicense_oo/Package_license.mk readlicense_oo/Package_readme.mk redland/ExternalPackage_raptor.mk redland/ExternalPackage_rasqal.mk redland/ExternalPackage_redland.mk redland/ExternalProject_rasqal.mk redland/ExternalProject_redland.mk reportbuilder/java reportbuilder/Package_reportbuilder-templates.mk reportdesign/source RepositoryExternal.mk RepositoryFixes.mk Repository.mk rhino/ExternalPackage_rhino.mk ridljar/CustomTarget_javamaker.mk rsc/source sal/osl sal/qa sal/rtl sax/qa sax/source sax/test scaddins/source sc/AllLangResTarget_sc.mk sccomp/source sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_opencl_test.mk sc/inc sc/Library_scfilt.mk sc/Library_scopencl.mk sc/Library_scqahelper.mk sc/Library_vbaobj.mk sc/Module_sc.mk scp 2/InstallModule_ooo.mk scp2/source sc/qa scripting/Package_java_jars.mk scripting/Package_java.mk scripting/Package_scriptbindinglib.mk scripting/Package_scriptproviderforpython.mk scripting/Package_ScriptsBeanShell.mk scripting/Package_ScriptsJavaScript.mk scripting/Package_ScriptsPython.mk scripting/source sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/util sc/workben sdext/Package_pdfimport_xpdfimport.mk sdext/source sd/inc sd/Package_opengl.mk sd/Package_web.mk sd/Package_xml.mk sd/qa sd/sdi sd/source sd/workben setup_native/Package_misc.mk setup_native/Package_packinfo.mk setup_native/Package_scripts_generated.mk setup_native/Package_scripts.mk setup_native/Package_ulf.mk setup_native/Package_wintools.mk setup_native/source sfx2/inc sfx2/source sfx2/uiconfig shell/CustomTarget_shlxthdl_res.mk shell/Library_ooofilt.mk shell/Library_ooofilt_x64.mk shell/Library_propertyhdl.mk shell/Library_propertyhdl_x64.mk shell/Library_shlxthdl.mk shell/Library_shlxthdl_x64.mk shell/Pac kage_scripts_gnome.mk shell/Package_scripts_kde.mk shell/Package_scripts.mk shell/Package_senddoc.mk shell/source shell/StaticLibrary_shlxthandler_common.mk shell/StaticLibrary_shlxthandler_common_x64.mk slideshow/source smoketest/Extension_TestExtension.mk solenv/bin solenv/CustomTarget_gdb.mk solenv/gbuild solenv/gdb solenv/Module_solenv.mk solenv/Package_gdb.mk sot/qa sot/source starmath/inc starmath/source stoc/source stoc/test svl/JunitTest_svl_complex.mk svl/qa svl/source svl/unx svtools/source svx/inc svx/Package_gengal.mk svx/source svx/workben sw/Executable_tiledrendering.mk swext/Extension_wiki-publisher.mk sw/inc sw/Library_msword.mk sw/Module_sw.mk sw/qa sw/source sw/uiconfig sw/UIConfig_qa.mk sysui/desktop sysui/Module_sysui.mk sysui/Package_desktop.mk sysui/Package_icons.mk sysui/Package_infoplist.mk sysui/Package_osxicons.mk sysui/Package_share.mk test/Package_unittest.mk test/source testtools/CustomTarget_bridgetest_climaker.mk testtools/CustomTarget_bridgete st.mk testtools/source tomcat/Module_tomcat.mk tomcat/Package_tomcat.mk toolkit/source tools/Library_tl.mk tools/source ucb/source ucb/workben udkapi/UnoApi_udkapi.mk unoidl/source unoil/CliUnoApi_oootypes.mk unoil/CustomTarget_climaker.mk unoil/CustomTarget_javamaker.mk unoil/Module_unoil.mk unoil/Package_climaker.mk unoil/Package_clioootypesversion.mk unotest/Jar_test.mk unotest/source unotools/source ure/Package_install.mk uui/source vbahelper/source vcl/aqua vcl/generic vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Package_osxres.mk vcl/source vcl/unx vcl/win wizards/com wizards/Package_access2base.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/inc writerfilter/Library_writerfilter.mk writerfilter/sou rce writerperfect/source xmlhelp/Module_xmlhelp.mk xmlhelp/Package_helpxsl.mk xmlhelp/Package_xsl.mk xmlhelp/source xmloff/inc xmloff/Package_dtd.mk xmloff/source xmlscript/Package_dtd.mk xmlscript/source xmlsecurity/source xsltml/ExternalPackage_xsltml.mk xsltml/Module_xsltml.mk

Kohei Yoshida kohei.yoshida at collabora.com
Wed Oct 30 21:13:07 CET 2013


Rebased ref, commits from common ancestor:
commit 45662786dcdd04695154196945873d66ec4a26d1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 22 23:08:43 2013 -0400

    Use ScDocumentImport to insert data table cells.
    
    This ensures that all cells get populated through ScDocumentImport, which
    keeps track of current cell positions in each column.
    
    Change-Id: I2ed10c91778e0b81959c8a436c4b2def5967e70f

diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index 25d4a03..d034292 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -24,6 +24,7 @@ class ScAddress;
 class ScTokenArray;
 class ScFormulaCell;
 struct ScSetStringParam;
+struct ScTabOpParam;
 struct ScDocumentImportImpl;
 
 /**
@@ -72,6 +73,8 @@ public:
     void setMatrixCells(
         const ScRange& rRange, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGrammar);
 
+    void setTableOpCells(const ScRange& rRange, const ScTabOpParam& rParam);
+
     void finalize();
 
 private:
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 99e9b36..323ccfb 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -17,6 +17,8 @@
 #include "mtvelements.hxx"
 #include "tokenarray.hxx"
 #include "stringutil.hxx"
+#include "compiler.hxx"
+#include "paramisc.hxx"
 
 #include "svl/sharedstringpool.hxx"
 
@@ -302,6 +304,95 @@ void ScDocumentImport::setMatrixCells(
     }
 }
 
+void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam& rParam)
+{
+    SCTAB nTab = rRange.aStart.Tab();
+    SCCOL nCol1 = rRange.aStart.Col();
+    SCROW nRow1 = rRange.aStart.Row();
+    SCCOL nCol2 = rRange.aEnd.Col();
+    SCROW nRow2 = rRange.aEnd.Row();
+
+    ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab);
+    if (!pTab)
+        return;
+
+    ScDocument* pDoc = &mpImpl->mrDoc;
+    ScRefAddress aRef;
+    OUStringBuffer aFormulaBuf('=');
+    aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocTableOp));
+    aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocOpen));
+
+    OUString aSep = ScCompiler::GetNativeSymbol(ocSep);
+    if (rParam.meMode == ScTabOpParam::Column) // column only
+    {
+        aRef.Set(rParam.aRefFormulaCell.GetAddress(), true, false, false);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aFormulaBuf.append(rParam.aRefColCell.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aRef.Set(nCol1, nRow1, nTab, false, true, true);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        nCol1++;
+        nCol2 = std::min( nCol2, (SCCOL)(rParam.aRefFormulaEnd.Col() -
+                    rParam.aRefFormulaCell.Col() + nCol1 + 1));
+    }
+    else if (rParam.meMode == ScTabOpParam::Row) // row only
+    {
+        aRef.Set(rParam.aRefFormulaCell.GetAddress(), false, true, false);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aFormulaBuf.append(rParam.aRefRowCell.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aRef.Set(nCol1, nRow1, nTab, true, false, true);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        ++nRow1;
+        nRow2 = std::min(
+            nRow2, rParam.aRefFormulaEnd.Row() - rParam.aRefFormulaCell.Row() + nRow1 + 1);
+    }
+    else // both
+    {
+        aFormulaBuf.append(rParam.aRefFormulaCell.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aFormulaBuf.append(rParam.aRefColCell.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aRef.Set(nCol1, nRow1 + 1, nTab, false, true, true);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aFormulaBuf.append(rParam.aRefRowCell.GetRefString(pDoc, nTab));
+        aFormulaBuf.append(aSep);
+        aRef.Set(nCol1 + 1, nRow1, nTab, true, false, true);
+        aFormulaBuf.append(aRef.GetRefString(pDoc, nTab));
+        ++nCol1;
+        ++nRow1;
+    }
+
+    aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocClose));
+
+    ScFormulaCell aRefCell(
+        pDoc, ScAddress(nCol1, nRow1, nTab), aFormulaBuf.makeStringAndClear(),
+        formula::FormulaGrammar::GRAM_NATIVE, MM_NONE);
+
+    for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+    {
+        sc::ColumnBlockPosition* pBlockPos =
+            mpImpl->maBlockPosSet.getBlockPosition(nTab, nCol);
+
+        if (!pBlockPos)
+            // Something went horribly wrong.
+            return;
+
+        sc::CellStoreType& rColCells = pTab->aCol[nCol].maCells;
+
+        for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+        {
+            ScAddress aPos(nCol, nRow, nTab);
+            ScFormulaCell* pCell = new ScFormulaCell(aRefCell, *pDoc, aPos);
+            pBlockPos->miCellPos =
+                rColCells.set(pBlockPos->miCellPos, nRow, pCell);
+        }
+    }
+}
+
 namespace {
 
 class CellTextAttrInitializer
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index ceb758b..b86ea72 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1152,11 +1152,9 @@ void ImportExcel::TableOp( void )
                 break;
             }
 
-            ScMarkData aMarkData;
-            aMarkData.SelectOneTable( nTab );
-            pD->InsertTableOp( aTabOpParam, static_cast<SCCOL>(nCol),
-                    static_cast<SCROW>(nRow), static_cast<SCCOL>(nLastCol),
-                    static_cast<SCROW>(nLastRow), aMarkData );
+            ScDocumentImport& rDoc = GetDocImport();
+            ScRange aTabOpRange(nCol, nRow, nTab, nLastCol, nLastRow, nTab);
+            rDoc.setTableOpCells(aTabOpRange, aTabOpParam);
         }
     }
     else
commit 60210fa98557407545003637e53479cff83ba6dc
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 22 22:16:20 2013 -0400

    Use enum for table op mode.
    
    Change-Id: I51e110fb0a2b72689f529d7094389cc3e20dfbe0

diff --git a/sc/inc/paramisc.hxx b/sc/inc/paramisc.hxx
index 425bb19..b5545a9 100644
--- a/sc/inc/paramisc.hxx
+++ b/sc/inc/paramisc.hxx
@@ -40,25 +40,27 @@ struct ScSolveParam
     sal_Bool        operator==  ( const ScSolveParam& r ) const;
 };
 
-struct ScTabOpParam
+/**
+ * Parameter for data table aka multiple operations.
+ */
+struct SC_DLLPUBLIC ScTabOpParam
 {
+    enum Mode { Column = 0, Row = 1, Both = 2 };
+
     ScRefAddress    aRefFormulaCell;
     ScRefAddress    aRefFormulaEnd;
     ScRefAddress    aRefRowCell;
     ScRefAddress    aRefColCell;
-    sal_uInt8           nMode;
+    Mode meMode;
 
-    ScTabOpParam() {};
+    ScTabOpParam();
     ScTabOpParam( const ScTabOpParam& r );
-    ScTabOpParam( const ScRefAddress& rFormulaCell,
-                  const ScRefAddress& rFormulaEnd,
-                  const ScRefAddress& rRowCell,
-                  const ScRefAddress& rColCell,
-                        sal_uInt8        nMd);
-    ~ScTabOpParam() {};
+    ScTabOpParam(
+        const ScRefAddress& rFormulaCell, const ScRefAddress& rFormulaEnd,
+        const ScRefAddress& rRowCell, const ScRefAddress& rColCell, Mode eMode );
 
     ScTabOpParam&   operator=       ( const ScTabOpParam& r );
-    sal_Bool        operator==      ( const ScTabOpParam& r ) const;
+    bool operator== ( const ScTabOpParam& r ) const;
 };
 
 #endif // SC_PARAMISC_HXX
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 590737c..65005bd 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -378,7 +378,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam,      // Mehrfachopera
     aForString.append(ScCompiler::GetNativeSymbol( ocOpen));
 
     const OUString& sSep = ScCompiler::GetNativeSymbol( ocSep);
-    if (rParam.nMode == 0)                          // nur Spalte
+    if (rParam.meMode == ScTabOpParam::Column) // column only
     {
         aRef.Set( rParam.aRefFormulaCell.GetAddress(), true, false, false );
         aForString.append(aRef.GetRefString(this, nTab1));
@@ -391,7 +391,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam,      // Mehrfachopera
         nCol2 = std::min( nCol2, (SCCOL)(rParam.aRefFormulaEnd.Col() -
                     rParam.aRefFormulaCell.Col() + nCol1 + 1));
     }
-    else if (rParam.nMode == 1)                 // nur zeilenweise
+    else if (rParam.meMode == ScTabOpParam::Row) // row only
     {
         aRef.Set( rParam.aRefFormulaCell.GetAddress(), false, true, false );
         aForString.append(aRef.GetRefString(this, nTab1));
@@ -404,7 +404,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam,      // Mehrfachopera
         nRow2 = std::min( nRow2, (SCROW)(rParam.aRefFormulaEnd.Row() -
                     rParam.aRefFormulaCell.Row() + nRow1 + 1));
     }
-    else                    // beides
+    else // both
     {
         aForString.append(rParam.aRefFormulaCell.GetRefString(this, nTab1));
         aForString.append(sSep);
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index 54b7c87..ae5bdf9 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -294,12 +294,14 @@ sal_Bool ScSolveParam::operator==( const ScSolveParam& r ) const
 //------------------------------------------------------------------------
 // struct ScTabOpParam
 
+ScTabOpParam::ScTabOpParam() : meMode(Column) {}
+
 ScTabOpParam::ScTabOpParam( const ScTabOpParam& r )
     :   aRefFormulaCell ( r.aRefFormulaCell ),
         aRefFormulaEnd  ( r.aRefFormulaEnd ),
         aRefRowCell     ( r.aRefRowCell ),
         aRefColCell     ( r.aRefColCell ),
-        nMode           ( r.nMode )
+    meMode(r.meMode)
 {
 }
 
@@ -309,12 +311,12 @@ ScTabOpParam::ScTabOpParam( const ScRefAddress& rFormulaCell,
                             const ScRefAddress& rFormulaEnd,
                             const ScRefAddress& rRowCell,
                             const ScRefAddress& rColCell,
-                                  sal_uInt8      nMd)
+                            Mode eMode )
     :   aRefFormulaCell ( rFormulaCell ),
         aRefFormulaEnd  ( rFormulaEnd ),
         aRefRowCell     ( rRowCell ),
         aRefColCell     ( rColCell ),
-        nMode           ( nMd )
+    meMode(eMode)
 {
 }
 
@@ -326,19 +328,19 @@ ScTabOpParam& ScTabOpParam::operator=( const ScTabOpParam& r )
     aRefFormulaEnd   = r.aRefFormulaEnd;
     aRefRowCell      = r.aRefRowCell;
     aRefColCell      = r.aRefColCell;
-    nMode            = r.nMode;
+    meMode = r.meMode;
     return *this;
 }
 
 //------------------------------------------------------------------------
 
-sal_Bool ScTabOpParam::operator==( const ScTabOpParam& r ) const
+bool ScTabOpParam::operator==( const ScTabOpParam& r ) const
 {
     return (        (aRefFormulaCell == r.aRefFormulaCell)
                  && (aRefFormulaEnd  == r.aRefFormulaEnd)
                  && (aRefRowCell     == r.aRefRowCell)
                  && (aRefColCell     == r.aRefColCell)
-                 && (nMode           == r.nMode) );
+                 && (meMode == r.meMode) );
 }
 
 OUString ScGlobal::GetAbsDocName( const OUString& rFileName,
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index e8caace..ceb758b 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1104,13 +1104,13 @@ void ImportExcel::TableOp( void )
         if( nFirstCol && nFirstRow )
         {
             ScTabOpParam aTabOpParam;
-            aTabOpParam.nMode = (nGrbit & EXC_TABLEOP_BOTH) ? 2 : ((nGrbit & EXC_TABLEOP_ROW) ? 1 : 0 );
+            aTabOpParam.meMode = (nGrbit & EXC_TABLEOP_BOTH) ? ScTabOpParam::Both : ((nGrbit & EXC_TABLEOP_ROW) ? ScTabOpParam::Row : ScTabOpParam::Column);
             sal_uInt16 nCol = nFirstCol - 1;
             sal_uInt16 nRow = nFirstRow - 1;
             SCTAB nTab = GetCurrScTab();
-            switch( aTabOpParam.nMode )
+            switch (aTabOpParam.meMode)
             {
-                case 0:     // COL
+                case ScTabOpParam::Column:
                     aTabOpParam.aRefFormulaCell.Set(
                             static_cast<SCCOL>(nFirstCol),
                             static_cast<SCROW>(nFirstRow - 1), nTab, false,
@@ -1124,7 +1124,7 @@ void ImportExcel::TableOp( void )
                             false );
                     nRow++;
                 break;
-                case 1:     // ROW
+                case ScTabOpParam::Row:
                     aTabOpParam.aRefFormulaCell.Set(
                             static_cast<SCCOL>(nFirstCol - 1),
                             static_cast<SCROW>(nFirstRow), nTab, false, false,
@@ -1138,7 +1138,7 @@ void ImportExcel::TableOp( void )
                             false );
                     nCol++;
                 break;
-                case 2:     // TWO-INPUT
+                case ScTabOpParam::Both:     // TWO-INPUT
                     aTabOpParam.aRefFormulaCell.Set(
                             static_cast<SCCOL>(nFirstCol - 1),
                             static_cast<SCROW>(nFirstRow - 1), nTab, false,
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 56008a2..0c7e82b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4156,7 +4156,7 @@ sal_Bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
                                      rParam.aRefFormulaEnd,
                                      rParam.aRefRowCell,
                                      rParam.aRefColCell,
-                                     rParam.nMode) );
+                                     rParam.meMode) );
         }
         pDoc->InsertTableOp(rParam, nStartCol, nStartRow, nEndCol, nEndRow, aMark);
         rDocShell.PostPaintGridAll();
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 129e35a..1b10216 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -24,6 +24,7 @@
 #include "viewutil.hxx"
 #include "spellparam.hxx"
 #include "cellmergeoption.hxx"
+#include "paramisc.hxx"
 
 #include <boost/shared_ptr.hpp>
 #include <boost/scoped_ptr.hpp>
@@ -527,7 +528,7 @@ public:
                                  const ScRefAddress& rFormulaEnd,
                                  const ScRefAddress& rRowCell,
                                  const ScRefAddress& rColCell,
-                                 sal_uInt8 nMode );
+                                 ScTabOpParam::Mode eMode );
     virtual         ~ScUndoTabOp();
 
     virtual void    Undo();
@@ -544,7 +545,7 @@ private:
     ScRefAddress    theFormulaEnd;
     ScRefAddress    theRowCell;
     ScRefAddress    theColCell;
-    sal_uInt8           nMode;
+    ScTabOpParam::Mode meMode;
 };
 
 
diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx
index 3a01e3d..abff708 100644
--- a/sc/source/ui/miscdlgs/tabopdlg.cxx
+++ b/sc/source/ui/miscdlgs/tabopdlg.cxx
@@ -243,7 +243,7 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, PushButton*, pBtn )
 {
     if ( pBtn == &aBtnOk )
     {
-        sal_uInt8 nMode = 3;
+        ScTabOpParam::Mode eMode = ScTabOpParam::Column;
         sal_uInt16 nError = 0;
 
         // Zu ueberpruefen:
@@ -274,7 +274,7 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, PushButton*, pBtn )
                         theFormulaCell.Col() != theFormulaEnd.Col())
                         nError = TABOPERR_NOCOLFORMULA;
                     else
-                        nMode = 1;
+                        eMode = ScTabOpParam::Row;
                 }
             }
             if (!aEdColCell.GetText().isEmpty())
@@ -284,16 +284,16 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, PushButton*, pBtn )
                     nError = TABOPERR_WRONGCOL;
                 else
                 {
-                    if (nMode == 1)                         // beides
+                    if (eMode == ScTabOpParam::Row)                         // beides
                     {
-                        nMode = 2;
+                        eMode = ScTabOpParam::Both;
                         ConvertSingleRef( pDoc, aEdFormulaRange.GetText(), nCurTab,
                                           theFormulaCell, eConv );
                     }
                     else if (theFormulaCell.Row() != theFormulaEnd.Row())
                         nError = TABOPERR_NOROWFORMULA;
                     else
-                        nMode = 0;
+                        eMode = ScTabOpParam::Column;
                 }
             }
         }
@@ -302,11 +302,7 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, PushButton*, pBtn )
             RaiseError( (ScTabOpErr) nError );
         else
         {
-            ScTabOpParam aOutParam( theFormulaCell,
-                                    theFormulaEnd,
-                                    theRowCell,
-                                    theColCell,
-                                    nMode );
+            ScTabOpParam aOutParam(theFormulaCell, theFormulaEnd, theRowCell, theColCell, eMode);
             ScTabOpItem  aOutItem( SID_TABOP, &aOutParam );
 
             SetDispatcherLock( false );
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 2037eb7..c3953c6 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -1086,7 +1086,7 @@ ScUndoTabOp::ScUndoTabOp( ScDocShell* pNewDocShell,
                 const ScRefAddress& rFormulaEnd,
                 const ScRefAddress& rRowCell,
                 const ScRefAddress& rColCell,
-                sal_uInt8 nMd )
+                ScTabOpParam::Mode eMode )
     :   ScSimpleUndo( pNewDocShell ),
         aRange          ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
         pUndoDoc        ( pNewUndoDoc ),
@@ -1094,7 +1094,7 @@ ScUndoTabOp::ScUndoTabOp( ScDocShell* pNewDocShell,
         theFormulaEnd   ( rFormulaEnd ),
         theRowCell      ( rRowCell ),
         theColCell      ( rColCell ),
-        nMode           ( nMd )
+        meMode(eMode)
 {
 }
 
@@ -1135,9 +1135,7 @@ void ScUndoTabOp::Redo()
 
     ScUndoUtil::MarkSimpleBlock( pDocShell, aRange );
 
-    ScTabOpParam aParam( theFormulaCell, theFormulaEnd,
-                         theRowCell,     theColCell,
-                         nMode );
+    ScTabOpParam aParam(theFormulaCell, theFormulaEnd, theRowCell, theColCell, meMode);
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 9d2b612..f128f66 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5342,7 +5342,7 @@ void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress&
     ScDocShell* pDocSh = GetDocShell();
     if (pDocSh)
     {
-        sal_Bool bError = false;
+        bool bError = false;
         ScTabOpParam aParam;
         aParam.aRefFormulaCell = ScRefAddress( (SCCOL)aFormulaRange.StartColumn,
                                               (SCROW)aFormulaRange.StartRow, aFormulaRange.Sheet,
@@ -5356,19 +5356,20 @@ void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress&
         aParam.aRefColCell     = ScRefAddress( (SCCOL)aColumnCell.Column,
                                               (SCROW)aColumnCell.Row, aColumnCell.Sheet,
                                               false, false, false );
+
         switch (nMode)
         {
             case sheet::TableOperationMode_COLUMN:
-                aParam.nMode = 0;
+                aParam.meMode = ScTabOpParam::Column;
                 break;
             case sheet::TableOperationMode_ROW:
-                aParam.nMode = 1;
+                aParam.meMode = ScTabOpParam::Row;
                 break;
             case sheet::TableOperationMode_BOTH:
-                aParam.nMode = 2;
+                aParam.meMode = ScTabOpParam::Both;
                 break;
             default:
-                bError = sal_True;
+                bError = true;
         }
 
         if (!bError)
commit 6461b9c9d28f1f46b6338c768c51a4eeb366ebab
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 30 14:02:12 2013 -0400

    Return false when no OpenCL device is detected.
    
    Change-Id: Ib4e3e432cb69c17cf1830bfd540d4f5335056879

diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index b629e53..046297f 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -2766,7 +2766,7 @@ bool switchOpenclDevice(const OUString* pDevice, bool bAutoSelect)
     {
         // we don't need to change anything
         // still the same device
-        return true;
+        return pDeviceId != NULL;
     }
 
     cl_platform_id platformId;
commit 781363934af5c0ff3401161c385c6c93c9352c2c
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Tue Oct 29 17:30:42 2013 +0100

    fdo#61002 add Excel 2010 functions VAR.P and VAR.S
    
    Change-Id: I23f286eaaef79d196a65e8079b62cf577539e9f1
    Reviewed-on: https://gerrit.libreoffice.org/6477
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index c6aec3a..3ec56c0 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -184,6 +184,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_VAR_A { Text = "VARA" ; };
     String SC_OPCODE_VAR_P { Text = "VARP" ; };
     String SC_OPCODE_VAR_P_A { Text = "VARPA" ; };
+    String SC_OPCODE_VAR_P_MS { Text = "COM.MICROSOFT.VAR.P" ; };
+    String SC_OPCODE_VAR_S { Text = "COM.MICROSOFT.VAR.S" ; };
     String SC_OPCODE_ST_DEV { Text = "STDEV" ; };
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
@@ -536,6 +538,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_VAR_A { Text = "VARA" ; };
     String SC_OPCODE_VAR_P { Text = "VARP" ; };
     String SC_OPCODE_VAR_P_A { Text = "VARPA" ; };
+    String SC_OPCODE_VAR_P_MS { Text = "VAR.P" ; };
+    String SC_OPCODE_VAR_S { Text = "VAR.S" ; };
     String SC_OPCODE_ST_DEV { Text = "STDEV" ; };
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
@@ -1295,6 +1299,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "VARPA" ;
     };
+    String SC_OPCODE_VAR_P_MS
+    {
+        Text [ en-US ] = "VAR.P" ;
+    };
+    String SC_OPCODE_VAR_S
+    {
+        Text [ en-US ] = "VAR.S" ;
+    };
     String SC_OPCODE_ST_DEV
     {
         Text [ en-US ] = "STDEV" ;
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index bb80900..b9b4f7a 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -412,8 +412,10 @@
 #define SC_OPCODE_COVARIANCE_P      414
 #define SC_OPCODE_ST_DEV_P_MS       415
 #define SC_OPCODE_ST_DEV_S          416
+#define SC_OPCODE_VAR_P_MS          417
+#define SC_OPCODE_VAR_S             418
 
-#define SC_OPCODE_STOP_2_PAR        417     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR        419     /* last function with two or more parameters' OpCode + 1 */
 #define SC_OPCODE_STOP_FUNCTION     SC_OPCODE_STOP_2_PAR            /* last function's OpCode + 1 */
 #define SC_OPCODE_LAST_OPCODE_ID    (SC_OPCODE_STOP_FUNCTION - 1)   /* last OpCode */
 
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 79b229c..6dd28d3 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -220,6 +220,8 @@ enum OpCodeEnum
         ocISPMT             = SC_OPCODE_ISPMT,
         ocVar               = SC_OPCODE_VAR,
         ocVarP              = SC_OPCODE_VAR_P,
+        ocVarP_MS           = SC_OPCODE_VAR_P_MS,
+        ocVarS              = SC_OPCODE_VAR_S,
         ocStDev             = SC_OPCODE_ST_DEV,
         ocStDevP            = SC_OPCODE_ST_DEV_P,
         ocStDevP_MS         = SC_OPCODE_ST_DEV_P_MS,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 30b8899..831e2d9 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -682,5 +682,7 @@
 #define HID_FUNC_COVARIANCE_S                                   "SC_HID_FUNC_COVARIANCE_S"
 #define HID_FUNC_ST_DEV_P_MS                                    "SC_HID_FUNC_ST_DEV_P_MS"
 #define HID_FUNC_ST_DEV_S                                       "SC_HID_FUNC_ST_DEV_S"
+#define HID_FUNC_VAR_P_MS                                       "SC_HID_FUNC_VAR_P_MS"
+#define HID_FUNC_VAR_S                                          "SC_HID_FUNC_VAR_S"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index db82ac4..90af819 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2436,6 +2436,8 @@ void Test::testFunctionLists()
         "TRIMMEAN",
         "TTEST",
         "VAR",
+        "VAR.P",
+        "VAR.S",
         "VARA",
         "VARP",
         "VARPA",
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 1a3e131..daa66c6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4009,9 +4009,11 @@ StackVar ScInterpreter::Interpret()
                 case ocAverageA         : ScAverage( true );            break;
                 case ocCount            : ScCount();                    break;
                 case ocCount2           : ScCount2();                   break;
-                case ocVar              : ScVar( false );               break;
+                case ocVar              :
+                case ocVarS             : ScVar( false );               break;
                 case ocVarA             : ScVar( true );                break;
-                case ocVarP             : ScVarP( false );              break;
+                case ocVarP             :
+                case ocVarP_MS          : ScVarP( false );              break;
                 case ocVarPA            : ScVarP( true );               break;
                 case ocStDev            :
                 case ocStDevS           : ScStDev( false );             break;
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 6b5888d..7f86e63 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -189,6 +189,8 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocVarA,            {{ Reference                                            }, 1 }},
     { ocVarP,            {{ Reference                                            }, 1 }},
     { ocVarPA,           {{ Reference                                            }, 1 }},
+    { ocVarP_MS,         {{ Reference                                            }, 1 }},
+    { ocVarS,            {{ Reference                                            }, 1 }},
     { ocVLookup,         {{ Value, Reference, Value, Value                       }, 0 }},
     { ocXor,             {{ Reference                                            }, 1 }},
     { ocZTest,           {{ Reference, Value, Value                              }, 0 }},
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index dc87d74..025827f 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -410,7 +410,9 @@ static const XclFunctionInfo saFuncTable_2010[] =
     EXC_FUNCENTRY_V_VA(         ocCovarianceP,   2,  2,  0,  "COVARIANCE.P" ),
     EXC_FUNCENTRY_V_VA(         ocCovarianceS,   2,  2,  0,  "COVARIANCE.S" ),
     EXC_FUNCENTRY_V_RX(         ocStDevP_MS,     1, MX,  0,  "STDEV.P" ),
-    EXC_FUNCENTRY_V_RX(         ocStDevS,        1, MX,  0,  "STDEV.S" )
+    EXC_FUNCENTRY_V_RX(         ocStDevS,        1, MX,  0,  "STDEV.S" ),
+    EXC_FUNCENTRY_V_RX(         ocVarP_MS,       1, MX,  0,  "VAR.P" ),
+    EXC_FUNCENTRY_V_RX(         ocVarS,          1, MX,  0,  "VAR.S" )
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 09ac066..794deff 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -749,7 +749,9 @@ static const FunctionData saFuncTable2010[] =
     { "COM.MICROSOFT.COVARIANCE.P",           "COVARIANCE.P",        NOID,    NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.COVARIANCE.S",           "COVARIANCE.S",        NOID,    NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.STDEV.P",                "STDEV.P",             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
-    { "COM.MICROSOFT.STDEV.S",                "STDEV.S",             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW }
+    { "COM.MICROSOFT.STDEV.S",                "STDEV.S",             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.VAR.P",                  "VAR.P"  ,             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.VAR.S",                  "VAR.S",               NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW }
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 64d14e3..b6d157f 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5087,6 +5087,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
         };
     };
+     // -=*# Resource for function VAR.S #*=-
+    Resource SC_OPCODE_VAR_S
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates the variance based on a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_VAR_S );
+            VAR_ARGS;   0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "number " ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
+        };
+    };
      // -=*# Resource for function VARIANZ #*=-
     Resource SC_OPCODE_VAR_A
     {
@@ -5135,6 +5159,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which represent a population." ;
         };
     };
+     // -=*# Resource for function VAR.P #*=-
+    Resource SC_OPCODE_VAR_P_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates variance based on the entire population." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_VAR_P_MS );
+            VAR_ARGS;   0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "number " ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which represent a population." ;
+        };
+    };
      // -=*# Resource for function VARIANZENA #*=-
     Resource SC_OPCODE_VAR_P_A
     {
commit 83397d0415f248bb61829b13eb7c6364d7a71508
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 30 18:22:29 2013 +0100

    -Werror,-Wmismatched-tags
    
    Change-Id: Iec4f78de9e52144b84baaa739d97681343ae5a27

diff --git a/sw/source/filter/ww8/docxtablestyleexport.hxx b/sw/source/filter/ww8/docxtablestyleexport.hxx
index c66372e..77e7036 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.hxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.hxx
@@ -18,7 +18,7 @@ class SwDoc;
 /// Handles DOCX export of table styles, based on InteropGrabBag.
 class DocxTableStyleExport
 {
-    class Impl;
+    struct Impl;
     boost::shared_ptr<Impl> m_pImpl;
 public:
     void TableStyles();
commit 2b01553fa5982ed50fd37f346a150d1aac8dcd6f
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Sat Oct 26 13:11:42 2013 -0200

    fdo#54938: Convert svx to use cppu::supportsService
    
    Change-Id: I3ab178924cb1c4240511f08625f244dac54e3913
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/formula/source/core/api/FormulaOpCodeMapperObj.cxx b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
index d7bbaf4..4439834 100644
--- a/formula/source/core/api/FormulaOpCodeMapperObj.cxx
+++ b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
@@ -19,21 +19,17 @@
 #include "formula/FormulaOpCodeMapperObj.hxx"
 #include "formula/opcode.hxx"
 #include <comphelper/sequence.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
-// =============================================================================
 namespace formula
 {
-// =============================================================================
-
     using namespace ::com::sun::star;
 
-    // -----------------------------------------------------------------------------
-// --------------------------------------------------------------------------------
 sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException)
 {
-    return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName, sal_True ).getLength() != 0;
+    return cppu::supportsService(this, _rServiceName);
 }
-//------------------------------------------------------------------------
+
 SAL_WNODEPRECATED_DECLARATIONS_PUSH
 FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler)
 : m_pCompiler(_pCompiler)
@@ -45,7 +41,6 @@ FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
 {
 }
 
-
 ::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
     throw (::com::sun::star::uno::RuntimeException)
 {
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index d2fbf32..712f351 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -30,6 +30,7 @@
 #include <unotools/ucbstreamhelper.hxx>
 
 #include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <sot/storinfo.hxx>
 
@@ -769,31 +770,19 @@ void SAL_CALL OLESimpleStorage::setClassInfo( const uno::Sequence< sal_Int8 >& /
     throw lang::NoSupportException();
 }
 
-//____________________________________________________________________________________________________
 //  XServiceInfo
-//____________________________________________________________________________________________________
-
-// --------------------------------------------------------------------------------
 OUString SAL_CALL OLESimpleStorage::getImplementationName()
     throw ( uno::RuntimeException )
 {
     return impl_staticGetImplementationName();
 }
 
-// --------------------------------------------------------------------------------
 sal_Bool SAL_CALL OLESimpleStorage::supportsService( const OUString& ServiceName )
     throw ( uno::RuntimeException )
 {
-    uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames();
-
-    for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
-        if ( ServiceName == aSeq[nInd] )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
-// --------------------------------------------------------------------------------
 uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getSupportedServiceNames()
         throw ( uno::RuntimeException )
 {
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
index 1a21e7c..64dd1d1 100644
--- a/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/awt/FocusChangeReason.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <osl/mutex.hxx>
@@ -552,50 +553,34 @@ void AccFrameSelector::removeAccessibleEventListener( const Reference< XAccessib
     }
 }
 
-// ----------------------------------------------------------------------------
-
 OUString AccFrameSelector::getImplementationName(  ) throw (RuntimeException)
 {
     return OUString("AccFrameSelector");
 }
 
-// ----------------------------------------------------------------------------
-
-const sal_Char sAccessible[]          = "Accessible";
-const sal_Char sAccessibleContext[]   = "AccessibleContext";
-const sal_Char sAccessibleComponent[] = "AccessibleComponent";
-
 sal_Bool AccFrameSelector::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );
+    return cppu::supportsService(this, rServiceName);
 }
 
-// ----------------------------------------------------------------------------
-
 Sequence< OUString > AccFrameSelector::getSupportedServiceNames(  )
     throw (RuntimeException)
 {
     Sequence< OUString > aRet(3);
     OUString* pArray = aRet.getArray();
-    pArray[0] = OUString( sAccessible );
-    pArray[1] = OUString( sAccessibleContext );
-    pArray[2] = OUString( sAccessibleComponent );
+    pArray[0] = OUString( "Accessible" );
+    pArray[1] = OUString( "AccessibleContext" );
+    pArray[2] = OUString( "AccessibleComponent" );
     return aRet;
 }
 
-// ----------------------------------------------------------------------------
-
 void AccFrameSelector::IsValid() throw (RuntimeException)
 {
     if(!mpFrameSel)
         throw RuntimeException();
 }
 
-// ----------------------------------------------------------------------------
-
 void    AccFrameSelector::NotifyFocusListeners(sal_Bool bGetFocus)
 {
     SolarMutexGuard aGuard;
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index df0d9f8..0b230a6 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
 #include <unotools/accessiblestatesethelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/svapp.hxx>
@@ -555,33 +556,16 @@ sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getBackground (void)
 
 
 //=====  XServiceInfo  ========================================================
-
 OUString SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationName( void ) throw( RuntimeException )
 {
     return OUString( "com.sun.star.comp.ui.SvxGraphCtrlAccessibleContext" );
 }
 
-//-----------------------------------------------------------------------------
-
 sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException )
 {
-    ::SolarMutexGuard aGuard;
-    //  Iterate over all supported service names and return true if on of them
-    //  matches the given name.
-    Sequence< OUString >    aSupportedServices( getSupportedServiceNames() );
-    int                     nLenght = aSupportedServices.getLength();
-
-    for( int i = 0 ; i < nLenght ; ++i )
-    {
-        if( sServiceName == aSupportedServices[ i ] )
-            return sal_True;
-    }
-
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
-//-----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL SvxGraphCtrlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException )
 {
     Sequence< OUString > aSNs( 3 );
@@ -594,7 +578,6 @@ Sequence< OUString > SAL_CALL SvxGraphCtrlAccessibleContext::getSupportedService
 }
 
 //=====  XTypeProvider  =======================================================
-
 Sequence<sal_Int8> SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationId( void ) throw( RuntimeException )
 {
     ::SolarMutexGuard aGuard;
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index da72392..66812ff 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -1019,7 +1019,6 @@ Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeE
 }
 
 //=====  XServiceInfo  ========================================================
-
 OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException )
 {
     return OUString( "com.sun.star.comp.ui.SvxRectCtlChildAccessibleContext" );
@@ -1027,18 +1026,7 @@ OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void
 
 sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException )
 {
-    //  Iterate over all supported service names and return true if on of them
-    //  matches the given name.
-    ::osl::MutexGuard   aGuard( maMutex );
-    Sequence< OUString > aSupportedServices ( getSupportedServiceNames() );
-    int                     nLength = aSupportedServices.getLength();
-    for( int i = 0 ; i < nLength; ++i )
-    {
-        if( sServiceName == aSupportedServices[ i ] )
-            return sal_True;
-    }
-
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
 Sequence< OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException )
@@ -1048,7 +1036,6 @@ Sequence< OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServ
 }
 
 //=====  XTypeProvider  =======================================================
-
 Sequence< sal_Int8 > SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationId( void ) throw( RuntimeException )
 {
     static OImplementationId*   pId = 0;
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 46bca87..bfaa791 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -42,24 +42,18 @@
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/tools/unotools.hxx>
 #include <com/sun/star/document/XActionLockable.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace css;
 using namespace css::uno;
 
-// ---------------------------
 // - EnhancedCustomShapeEngine -
-// ---------------------------
-
 OUString EnhancedCustomShapeEngine_getImplementationName()
     throw( RuntimeException )
 {
     return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
 }
-sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const OUString& ServiceName )
-    throw( RuntimeException )
-{
-    return ServiceName == "com.sun.star.drawing.CustomShapeEngine";
-}
+
 Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
     throw( RuntimeException )
 {
@@ -69,8 +63,6 @@ Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames
     return aRet;
 }
 
-// -----------------------------------------------------------------------------
-
 EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const Reference< lang::XMultiServiceFactory >& rxMgr ) :
     mxFact                  ( rxMgr ),
     mbForceGroupWithText    ( sal_False )
@@ -114,7 +106,6 @@ void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArg
 }
 
 // XServiceInfo ---------------------------------------------------------------
-
 OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
     throw( RuntimeException )
 {
@@ -123,7 +114,7 @@ OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
 sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rServiceName )
     throw( RuntimeException )
 {
-    return EnhancedCustomShapeEngine_supportsService( rServiceName );
+    return cppu::supportsService(this, rServiceName);
 }
 Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
     throw ( RuntimeException )
@@ -132,7 +123,6 @@ Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceName
 }
 
 // XCustomShapeEngine -----------------------------------------------------------
-
 SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
 {
     bool bHasText = pCustoObj->HasText();
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 358328b..939069f 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -51,6 +51,7 @@
 #include <comphelper/sequence.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/diagnose_ex.h>
@@ -408,24 +409,16 @@ Sequence<sal_Int8> SAL_CALL FmXGridControl::getImplementationId(  ) throw(Runtim
 }
 
 // XServiceInfo
-//------------------------------------------------------------------------------
 sal_Bool SAL_CALL FmXGridControl::supportsService(const OUString& ServiceName) throw()
 {
-    ::comphelper::StringSequence aSupported = getSupportedServiceNames();
-    const OUString * pArray = aSupported.getConstArray();
-    for( sal_Int32 i = 0; i < aSupported.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
-//------------------------------------------------------------------------------
 OUString SAL_CALL FmXGridControl::getImplementationName() throw()
 {
     return OUString("com.sun.star.form.FmXGridControl");
 }
 
-//------------------------------------------------------------------------------
 ::comphelper::StringSequence SAL_CALL FmXGridControl::getSupportedServiceNames() throw()
 {
     Sequence< OUString > aServiceNames(2);
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index dcd2b18..f4e5e00 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -75,6 +75,7 @@
 #include <comphelper/uno3.hxx>
 #include <comphelper/flagguard.hxx>
 #include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <connectivity/IParseContext.hxx>
 #include <toolkit/controls/unocontrol.hxx>
@@ -674,7 +675,6 @@ Sequence< sal_Int8 > SAL_CALL FormController::getImplementationId() throw( Runti
     return pId->getImplementationId();
 }
 
-//------------------------------------------------------------------------------
 Sequence< Type > SAL_CALL FormController::getTypes(  ) throw(RuntimeException)
 {
     return comphelper::concatSequences(
@@ -684,24 +684,16 @@ Sequence< Type > SAL_CALL FormController::getTypes(  ) throw(RuntimeException)
 }
 
 // XServiceInfo
-//------------------------------------------------------------------------------
 sal_Bool SAL_CALL FormController::supportsService(const OUString& ServiceName) throw( RuntimeException )
 {
-    Sequence< OUString> aSNL(getSupportedServiceNames());
-    const OUString * pArray = aSNL.getConstArray();
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
-//------------------------------------------------------------------------------
 OUString SAL_CALL FormController::getImplementationName() throw( RuntimeException )
 {
     return OUString("org.openoffice.comp.svx.FormController");
 }
 
-//------------------------------------------------------------------------------
 Sequence< OUString> SAL_CALL FormController::getSupportedServiceNames(void) throw( RuntimeException )
 {
     // service names which are supported only, but cannot be used to created an
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 6131c24..e340161 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -31,6 +31,7 @@
 #include <svtools/ctrlbox.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <memory>
 
@@ -277,14 +278,7 @@ void SAL_CALL FontHeightToolBoxControl::release() throw ()
 sal_Bool SAL_CALL FontHeightToolBoxControl::supportsService( const OUString& ServiceName )
 throw(uno::RuntimeException)
 {
-    const uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
 OUString SAL_CALL FontHeightToolBoxControl::getImplementationName()
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index f2558d9..e1bac23 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -23,6 +23,7 @@
 #include <svx/dialmgr.hxx>
 
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/i18n/TransliterationModules.hpp>
@@ -383,14 +384,7 @@ OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css:
 
 sal_Bool SAL_CALL FindTextToolbarController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException )
@@ -556,14 +550,7 @@ OUString SAL_CALL UpDownSearchToolboxController::getImplementationName() throw(
 
 sal_Bool SAL_CALL UpDownSearchToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL UpDownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
@@ -664,14 +651,7 @@ OUString SAL_CALL MatchCaseToolboxController::getImplementationName() throw( css
 
 sal_Bool SAL_CALL MatchCaseToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL MatchCaseToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
@@ -783,15 +763,7 @@ OUString SAL_CALL FindAllToolboxController::getImplementationName() throw( css::
 
 sal_Bool SAL_CALL FindAllToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
-
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL FindAllToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
@@ -886,15 +858,7 @@ OUString SAL_CALL ExitSearchToolboxController::getImplementationName() throw( cs
 
 sal_Bool SAL_CALL ExitSearchToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
-
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL ExitSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
@@ -1002,10 +966,7 @@ OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::Ru
 
 sal_Bool SAL_CALL FindbarDispatcher::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
 {
-    return (
-        ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.svx.FindbarDispatcher")) ||
-        ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.ProtocolHandler"))
-        );
+    return cppu::supportsService(this, ServiceName);
 }
 
 css::uno::Sequence< OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException )
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 5c8e11f..cff819f 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -28,21 +28,17 @@
 #include <vcl/msgbox.hxx>
 
 // header for class OImplementationId
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 
-//.............................................................................
 namespace textconversiondlgs
 {
-//.............................................................................
 using namespace ::com::sun::star;
 
-#define SERVICE_IMPLEMENTATION_NAME OUString("com.sun.star.comp.linguistic2.ChineseTranslationDialog")
-#define SERVICE_NAME OUString("com.sun.star.linguistic2.ChineseTranslationDialog")
-
 ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog( const uno::Reference< uno::XComponentContext >& xContext )
                     : m_xCC( xContext )
                     , m_xParentWindow( 0 )
@@ -70,9 +66,8 @@ void ChineseTranslation_UnoDialog::impl_DeleteDialog()
         m_pDialog = 0;
     }
 }
-//-------------------------------------------------------------------------
-// lang::XServiceInfo
 
+// lang::XServiceInfo
 OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( uno::RuntimeException )
 {
     return getImplementationName_Static();
@@ -80,19 +75,12 @@ OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( u
 
 OUString ChineseTranslation_UnoDialog::getImplementationName_Static()
 {
-    return SERVICE_IMPLEMENTATION_NAME;
+    return OUString("com.sun.star.comp.linguistic2.ChineseTranslationDialog");
 }
 
 sal_Bool SAL_CALL ChineseTranslation_UnoDialog::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
 {
-    uno::Sequence< OUString > aSNL = getSupportedServiceNames();
-    const OUString* pArray = aSNL.getArray();
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-    {
-        if( pArray[ i ] == ServiceName )
-            return sal_True;
-    }
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Sequence< OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedServiceNames() throw( uno::RuntimeException )
@@ -103,13 +91,11 @@ uno::Sequence< OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedSer
 uno::Sequence< OUString > ChineseTranslation_UnoDialog::getSupportedServiceNames_Static()
 {
     uno::Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[ 0 ] = SERVICE_NAME;
+    aSNS.getArray()[ 0 ] = OUString("com.sun.star.linguistic2.ChineseTranslationDialog");
     return aSNS;
 }
 
-//-------------------------------------------------------------------------
 // ui::dialogs::XExecutableDialog
-
 void SAL_CALL ChineseTranslation_UnoDialog::setTitle( const OUString& ) throw(uno::RuntimeException)
 {
     //not implemented - fell free to do so, if you do need this
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 21dcfd9..21a5560 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/drawing/GraphicFilterRequest.hpp>
 #include <com/sun/star/util/URL.hpp>
 #include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
 #include <vcl/metaact.hxx>
 #include <vcl/svapp.hxx>
@@ -1229,14 +1230,7 @@ OUString SAL_CALL GraphicExporter::getImplementationName(  )
 sal_Bool SAL_CALL GraphicExporter::supportsService( const OUString& ServiceName )
     throw(RuntimeException)
 {
-    Sequence< OUString > aSeq( GraphicExporter_getSupportedServiceNames() );
-    sal_Int32 nArgs = aSeq.getLength();
-    const OUString* pService = aSeq.getConstArray();
-    while( nArgs-- )
-        if( *pService++ == ServiceName )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 Sequence< OUString > SAL_CALL GraphicExporter::getSupportedServiceNames(  )
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
index c902f34..b696c29 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -23,6 +23,7 @@
 #include <svl/itemset.hxx>
 #include <svl/style.hxx>
 #include <comphelper/stl_types.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <svx/svdmodel.hxx>
 #include "UnoNameItemTable.hxx"
@@ -79,14 +80,7 @@ void SvxUnoNameItemTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw(
 
 sal_Bool SAL_CALL SvxUnoNameItemTable::supportsService( const  OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 void SAL_CALL SvxUnoNameItemTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement )
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index 7c4ac26..6c74a99 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -29,6 +29,7 @@
 #include <vcl/svapp.hxx>
 
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <svx/xdef.hxx>
 
 #include "svx/unoapi.hxx"
@@ -96,17 +97,7 @@ XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
 sal_Bool SAL_CALL SvxUnoXPropertyTable::supportsService( const  OUString& ServiceName )
     throw( uno::RuntimeException)
 {
-    const uno::Sequence< OUString > aServices( getSupportedServiceNames() );
-    const OUString* pServices = aServices.getConstArray();
-    const sal_Int32 nCount = aServices.getLength();
-    sal_Int32 i;
-    for( i = 0; i < nCount; i++ )
-    {
-        if( *pServices++ == ServiceName )
-            return sal_True;
-    }
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 // XNameContainer
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index e1da634..ce51832 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -28,17 +28,13 @@
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <vcl/svapp.hxx>
 
 #include <boost/scoped_ptr.hpp>
 #include <officecfg/Office/Recovery.hxx>
 
-
-#define IMPLEMENTATIONNAME_RECOVERYUI       OUString("com.sun.star.comp.svx.RecoveryUI")
-#define SERVICENAME_RECOVERYUI              OUString("com.sun.star.dialog.RecoveryUI")
-
-
 namespace svx
 {
 
@@ -47,7 +43,6 @@ namespace svxdr = ::svx::DocRecovery;
 using namespace ::rtl;
 using namespace ::osl;
 
-//===============================================
 RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext)
     : m_xContext     (xContext                 )
     , m_pParentWindow(0                        )
@@ -55,42 +50,28 @@ RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >&
 {
 }
 
-//===============================================
 RecoveryUI::~RecoveryUI()
 {
 }
 
-//===============================================
 OUString SAL_CALL RecoveryUI::getImplementationName()
     throw(css::uno::RuntimeException)
 {
     return RecoveryUI::st_getImplementationName();
 }
 
-//===============================================
 sal_Bool SAL_CALL RecoveryUI::supportsService(const OUString& sServiceName)
     throw(css::uno::RuntimeException)
 {
-    const css::uno::Sequence< OUString > lServices = RecoveryUI::st_getSupportedServiceNames();
-          sal_Int32                             c         = lServices.getLength();
-          sal_Int32                             i         = 0;
-    for (i=0; i<c; ++i)
-    {
-        const OUString& sSupportedService = lServices[i];
-        if (sSupportedService.equals(sServiceName))
-            return sal_True;
-    }
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
-//===============================================
 css::uno::Sequence< OUString > SAL_CALL RecoveryUI::getSupportedServiceNames()
     throw(css::uno::RuntimeException)
 {
     return RecoveryUI::st_getSupportedServiceNames();
 }
 
-//===============================================
 css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL& aURL,
                                                    const css::uno::Sequence< css::beans::PropertyValue >& )
     throw(css::uno::RuntimeException)
@@ -151,28 +132,24 @@ void SAL_CALL RecoveryUI::removeStatusListener(const css::uno::Reference< css::f
     OSL_FAIL("RecoveryUI::removeStatusListener()\nNot implemented yet!");
 }
 
-//===============================================
 OUString RecoveryUI::st_getImplementationName()
 {
-    return OUString(IMPLEMENTATIONNAME_RECOVERYUI);
+    return OUString("com.sun.star.comp.svx.RecoveryUI");
 }
 
-//===============================================
 css::uno::Sequence< OUString > RecoveryUI::st_getSupportedServiceNames()
 {
-    css::uno::Sequence< OUString > lServiceNames(1);    lServiceNames.getArray() [0] = SERVICENAME_RECOVERYUI;
+    css::uno::Sequence< OUString > lServiceNames(1);
+    lServiceNames.getArray() [0] = OUString("com.sun.star.dialog.RecoveryUI");
     return lServiceNames;
 }
 
-//===============================================
 css::uno::Reference< css::uno::XInterface > SAL_CALL RecoveryUI::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
 {
     RecoveryUI* pNew = new RecoveryUI(comphelper::getComponentContext(xSMGR));
     return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XServiceInfo* >(pNew));
 }
 
-//===============================================
-
 static OUString GetCrashConfigDir()
 {
 
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index 6ee8b68..2c7fef5 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -708,7 +708,7 @@ OUString SAL_CALL SvxUnoDrawPagesAccess::getImplementationName(  ) throw(uno::Ru
 
 sal_Bool SAL_CALL SvxUnoDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    return ServiceName == pSvxUnoDrawPagesAccessService;
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Sequence< OUString > SAL_CALL SvxUnoDrawPagesAccess::getSupportedServiceNames(  ) throw(uno::RuntimeException)
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index 5673056..76c3e1b 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -26,6 +26,7 @@
 #include <svl/style.hxx>
 
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <svl/itempool.hxx>
 #include <svl/itemset.hxx>
 #include <svl/lstner.hxx>
@@ -131,14 +132,7 @@ void SvxUnoMarkerTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 
 sal_Bool SAL_CALL SvxUnoMarkerTable::supportsService( const  OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 OUString SAL_CALL SvxUnoMarkerTable::getImplementationName() throw( uno::RuntimeException )
diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx
index 48dd8b4..8686e0a 100644
--- a/svx/source/unodraw/unopool.cxx
+++ b/svx/source/unodraw/unopool.cxx
@@ -22,6 +22,7 @@
 
 #include <comphelper/propertysetinfo.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include "svx/unopool.hxx"
@@ -393,17 +394,9 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawPool::getImplementationId()
 }
 
 // XServiceInfo
-
 sal_Bool SAL_CALL SvxUnoDrawPool::supportsService( const  OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 OUString SAL_CALL SvxUnoDrawPool::getImplementationName() throw( uno::RuntimeException )
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index f5f14a4..e580014 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/drawing/CircleKind.hpp>
@@ -3793,21 +3794,11 @@ uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
     return aSeq;
 }
 
-//----------------------------------------------------------------------
 sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
 {
-    Sequence< OUString > SupportedServices( getSupportedServiceNames() );
-    const OUString * pArray = SupportedServices.getConstArray();
-    const sal_Int32 nCount = SupportedServices.getLength();
-    sal_Int32 i;
-    for( i = 0; i < nCount; i++ )
-        if( *pArray++ == ServiceName )
-            return sal_True;
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
-//----------------------------------------------------------------------
-
 // XGluePointsSupplier
 uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
     throw(uno::RuntimeException)
diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
index 3eeba97..620ee9f 100644
--- a/svx/source/unogallery/unogalitem.cxx
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -29,6 +29,7 @@
 #include <svl/itemprop.hxx>
 #include <svl/itempool.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include "galobj.hxx"
 
 #include <com/sun/star/beans/PropertyState.hpp>
@@ -143,39 +144,24 @@ uno::Sequence< OUString > GalleryItem::getSupportedServiceNames_Static()
     return aSeq;
 }
 
-// ------------------------------------------------------------------------------
-
 OUString SAL_CALL GalleryItem::getImplementationName()
     throw( uno::RuntimeException )
 {
     return getImplementationName_Static();
 }
 
-// ------------------------------------------------------------------------------
-
 sal_Bool SAL_CALL GalleryItem::supportsService( const OUString& ServiceName )
     throw( uno::RuntimeException )
 {
-    uno::Sequence< OUString >    aSNL( getSupportedServiceNames() );
-    const OUString*              pArray = aSNL.getConstArray();
-
-    for( int i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< OUString > SAL_CALL GalleryItem::getSupportedServiceNames()
     throw( uno::RuntimeException )
 {
     return getSupportedServiceNames_Static();
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< uno::Type > SAL_CALL GalleryItem::getTypes()
     throw(uno::RuntimeException)
 {
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 42c9c21..b26c811 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
@@ -1017,14 +1018,13 @@ OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName()
         return SvXMLGraphicImportHelper_getImplementationName();
     return SvXMLGraphicExportHelper_getImplementationName();
 }
+
 ::sal_Bool SAL_CALL SvXMLGraphicImportExportHelper::supportsService( const OUString& ServiceName )
     throw (uno::RuntimeException)
 {
-    Sequence< OUString > aServiceNames( getSupportedServiceNames());
-    const OUString * pBegin = aServiceNames.getConstArray();
-    const OUString * pEnd = pBegin + aServiceNames.getLength();
-    return (::std::find( pBegin, pEnd, ServiceName ) != pEnd);
+    return cppu::supportsService(this, ServiceName);
 }
+
 Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServiceNames()
     throw (uno::RuntimeException)
 {
commit 9ab844c7fa907e2d1119a316c695198ef888a059
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 30 15:19:18 2013 +0100

    DOCX filter: roundtrip more table style properties
    
    Handle wordWrap, beforeLines, afterLines, beforeAutospacing,
    afterAutospacing, asciiTheme, hAnsiTheme, b, i, color, sz and vAlign.
    
    With this, the export filter is now in sync with the import one again.
    
    Change-Id: I7184447baf872374eaa69afdfcb149a7e6e45faa

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ffe9c62..5028733 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1470,6 +1470,12 @@ void Test::testCalendar1()
     // Table style lost its paragraph / run properties.
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:pPr/w:spacing", "lineRule", "auto");
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:rPr/w:lang", "eastAsia", "ja-JP");
+
+    // Table style lost its conditional table formatting properties.
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:pPr/w:wordWrap", 1);
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:rFonts", "hAnsiTheme", "minorHAnsi");
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tblPr", 1);
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:vAlign", "val", "bottom");
 }
 
 void Test::testSmartart()
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index db0608d..634368a 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -111,6 +111,22 @@ void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
     pSerializer->singleElementNS(XML_w, XML_shd, xAttributeList);
 }
 
+/// Export of w:color in a table style.
+void lcl_TableStyleRColor(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rColor)
+{
+    if (!rColor.hasElements())
+        return;
+
+    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
+    for (sal_Int32 i = 0; i < rColor.getLength(); ++i)
+    {
+        if (rColor[i].Name == "val")
+            pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rColor[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+    }
+    sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
+    pSerializer->singleElementNS(XML_w, XML_color, xAttributeList);
+}
+
 /// Export of w:lang in a table style.
 void lcl_TableStyleRLang(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rLang)
 {
@@ -138,6 +154,10 @@ void lcl_TableStyleRRFonts(sax_fastparser::FSHelperPtr pSerializer, uno::Sequenc
     {
         if (rRFonts[i].Name == "eastAsiaTheme")
             pAttributeList->add(FSNS(XML_w, XML_eastAsiaTheme), OUStringToOString(rRFonts[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rRFonts[i].Name == "asciiTheme")
+            pAttributeList->add(FSNS(XML_w, XML_asciiTheme), OUStringToOString(rRFonts[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rRFonts[i].Name == "hAnsiTheme")
+            pAttributeList->add(FSNS(XML_w, XML_hAnsiTheme), OUStringToOString(rRFonts[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
     }
     sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
     pSerializer->singleElementNS(XML_w, XML_rFonts, xAttributeList);
@@ -158,6 +178,14 @@ void lcl_TableStylePSpacing(sax_fastparser::FSHelperPtr pSerializer, uno::Sequen
             pAttributeList->add(FSNS(XML_w, XML_line), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
         else if (rSpacing[i].Name == "lineRule")
             pAttributeList->add(FSNS(XML_w, XML_lineRule), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rSpacing[i].Name == "beforeLines")
+            pAttributeList->add(FSNS(XML_w, XML_beforeLines), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rSpacing[i].Name == "beforeAutospacing")
+            pAttributeList->add(FSNS(XML_w, XML_beforeAutospacing), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rSpacing[i].Name == "afterLines")
+            pAttributeList->add(FSNS(XML_w, XML_afterLines), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+        else if (rSpacing[i].Name == "afterAutospacing")
+            pAttributeList->add(FSNS(XML_w, XML_afterAutospacing), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
     }
     sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
     pSerializer->singleElementNS(XML_w, XML_spacing, xAttributeList);
@@ -181,6 +209,17 @@ void lcl_TableStyleTblInd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence
     pSerializer->singleElementNS(XML_w, XML_tblInd, xAttributeList);
 }
 
+void lcl_handleBoolean(OUString aValue, sal_Int32 nToken, sax_fastparser::FSHelperPtr pSerializer)
+{
+    if (aValue.isEmpty())
+        return;
+    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
+    if (aValue != "1")
+        pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(aValue, RTL_TEXTENCODING_UTF8).getStr());
+    sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
+    pSerializer->singleElementNS(XML_w, nToken, xAttributeList);
+}
+
 /// Export of w:rPr in a table style.
 void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rRPr)
 {
@@ -189,16 +228,32 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
 
     pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
 
-    uno::Sequence<beans::PropertyValue> aRFonts, aLang;
+    uno::Sequence<beans::PropertyValue> aRFonts, aLang, aColor;
+    OUString aB, aI, aSz;
     for (sal_Int32 i = 0; i < rRPr.getLength(); ++i)
     {
         if (rRPr[i].Name == "rFonts")
             aRFonts = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
         else if (rRPr[i].Name == "lang")
             aLang = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+        else if (rRPr[i].Name == "b")
+            aB = rRPr[i].Value.get<OUString>();
+        else if (rRPr[i].Name == "i")
+            aI = rRPr[i].Value.get<OUString>();
+        else if (rRPr[i].Name == "color")
+            aColor = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+        else if (rRPr[i].Name == "sz")
+            aSz = rRPr[i].Value.get<OUString>();
     }
     lcl_TableStyleRRFonts(pSerializer, aRFonts);
     lcl_TableStyleRLang(pSerializer, aLang);
+    lcl_handleBoolean(aB, XML_b, pSerializer);
+    lcl_handleBoolean(aI, XML_i, pSerializer);
+    lcl_TableStyleRColor(pSerializer, aColor);
+    if (!aSz.isEmpty())
+        pSerializer->singleElementNS(XML_w, XML_sz,
+                FSNS(XML_w, XML_val), OUStringToOString(aSz, RTL_TEXTENCODING_UTF8).getStr(),
+                FSEND);
 
     pSerializer->endElementNS(XML_w, XML_rPr);
 }
@@ -212,11 +267,16 @@ void lcl_TableStylePPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
     pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
 
     uno::Sequence<beans::PropertyValue> aSpacing;
+    bool bWordWrap = false;
     for (sal_Int32 i = 0; i < rPPr.getLength(); ++i)
     {
         if (rPPr[i].Name == "spacing")
             aSpacing = rPPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+        if (rPPr[i].Name == "wordWrap")
+            bWordWrap = true;
     }
+    if (bWordWrap)
+        pSerializer->singleElementNS(XML_w, XML_wordWrap, FSEND);
     lcl_TableStylePSpacing(pSerializer, aSpacing);
 
     pSerializer->endElementNS(XML_w, XML_pPr);
@@ -266,12 +326,19 @@ void lcl_TableStyleTcPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<b
     pSerializer->startElementNS(XML_w, XML_tcPr, FSEND);
 
     uno::Sequence<beans::PropertyValue> aShd;
+    OUString aVAlign;
     for (sal_Int32 i = 0; i < rTcPr.getLength(); ++i)
     {
         if (rTcPr[i].Name == "shd")
             aShd = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+        else if (rTcPr[i].Name == "vAlign")
+            aVAlign = rTcPr[i].Value.get<OUString>();
     }
     lcl_TableStyleShd(pSerializer, aShd);
+    if (!aVAlign.isEmpty())
+        pSerializer->singleElementNS(XML_w, XML_vAlign,
+                FSNS(XML_w, XML_val), OUStringToOString(aVAlign, RTL_TEXTENCODING_UTF8).getStr(),
+                FSEND);
 
     pSerializer->endElementNS(XML_w, XML_tcPr);
 }
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 1139671..a0c4bef 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -948,13 +948,15 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
             break;
         case NS_ooxml::LN_CT_Fonts_asciiTheme:
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "asciiTheme", ThemeTable::getStringForTheme(nIntValue));
             if (m_pImpl->GetTopContext())
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) ));
             break;
         case NS_ooxml::LN_CT_Fonts_hAnsi:
             break;//unsupported
         case NS_ooxml::LN_CT_Fonts_hAnsiTheme:
-            break; //unsupported
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "hAnsiTheme", ThemeTable::getStringForTheme(nIntValue));
+            break;
         case NS_ooxml::LN_CT_Fonts_eastAsia:
             if (m_pImpl->GetTopContext())
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_ASIAN, uno::makeAny( sStringValue ));
@@ -978,6 +980,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
             break;
         case NS_ooxml::LN_CT_Spacing_beforeLines:
+                m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "beforeLines", OUString::number(nIntValue));
             break;
         case NS_ooxml::LN_CT_Spacing_after:
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "after", OUString::number(nIntValue));
@@ -986,6 +989,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
             break;
         case NS_ooxml::LN_CT_Spacing_afterLines:
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "afterLines", OUString::number(nIntValue));
             break;
         case NS_ooxml::LN_CT_Spacing_line: //91434
         case NS_ooxml::LN_CT_Spacing_lineRule: //91435
@@ -1173,12 +1177,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         break;
         // See SwWW8ImplReader::GetParagraphAutoSpace() on why these are 100 and 280
         case NS_ooxml::LN_CT_Spacing_beforeAutospacing:
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "beforeAutospacing", OUString::number(nIntValue));
             if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
                 m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(280) ) );
             else
                 m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) );
         break;
         case NS_ooxml::LN_CT_Spacing_afterAutospacing:
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "afterAutospacing", OUString::number(nIntValue));
             if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
                 m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(280) ) );
             else
commit e0f1ddca3f26df3e84d6fbf1cc373ec287396397
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 30 13:36:46 2013 +0100

    Factor out DocxTableStyleExport from DocxAttributeOutput
    
    Also add a docxhelper, that contains stuff that was local to
    DocxAttributeOutput till now, but required by DocxTableStyleExport.
    
    Change-Id: I24dcc62d11862078202244c214b317e3bc600567

diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk
index 93a43d1..069795b 100644
--- a/sw/Library_msword.mk
+++ b/sw/Library_msword.mk
@@ -78,6 +78,7 @@ $(eval $(call gb_Library_add_exception_objects,msword,\
     sw/source/filter/ww8/docxattributeoutput \
     sw/source/filter/ww8/docxexport \
     sw/source/filter/ww8/docxexportfilter \
+    sw/source/filter/ww8/docxtablestyleexport \
     sw/source/filter/ww8/rtfattributeoutput \
     sw/source/filter/ww8/rtfexport \
     sw/source/filter/ww8/rtfexportfilter \
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 91b95fb..8f1847e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "docxattributeoutput.hxx"
+#include "docxhelper.hxx"
 #include "docxexportfilter.hxx"
 #include "docxfootnotes.hxx"
 #include "writerwordglue.hxx"
@@ -2362,14 +2363,19 @@ void DocxAttributeOutput::StartStyles()
     LatentStyles();
 }
 
-namespace {
-struct StringTokenMap
+sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, OUString aName)
 {
-    const char* pToken;
-    sal_Int32 nToken;
-};
+    OString sName = OUStringToOString(aName, RTL_TEXTENCODING_UTF8);
+    while (pMap->pToken)
+    {
+        if (sName == pMap->pToken)
+            return pMap->nToken;
+        ++pMap;
+    }
+    return 0;
+}
 
-StringTokenMap const aDefaultTokens[] = {
+DocxStringTokenMap const aDefaultTokens[] = {
     {"defQFormat", XML_defQFormat},
     {"defUnhideWhenUsed", XML_defUnhideWhenUsed},
     {"defSemiHidden", XML_defSemiHidden},
@@ -2379,7 +2385,7 @@ StringTokenMap const aDefaultTokens[] = {
     {0, 0}
 };
 
-StringTokenMap const aExceptionTokens[] = {
+DocxStringTokenMap const aExceptionTokens[] = {
     {"name", XML_name},
     {"locked", XML_locked},
     {"uiPriority", XML_uiPriority},
@@ -2389,19 +2395,6 @@ StringTokenMap const aExceptionTokens[] = {
     {0, 0}
 };
 
-sal_Int32 lcl_getToken(StringTokenMap const * pMap, OUString aName)
-{
-    OString sName = OUStringToOString(aName, RTL_TEXTENCODING_UTF8);
-    while (pMap->pToken)
-    {
-        if (sName == pMap->pToken)
-            return pMap->nToken;
-        ++pMap;
-    }
-    return 0;
-}
-}
-
 void DocxAttributeOutput::LatentStyles()
 {
     // Do we have latent styles available?
@@ -2425,7 +2418,7 @@ void DocxAttributeOutput::LatentStyles()
     uno::Sequence<beans::PropertyValue> aLsdExceptions;
     for (sal_Int32 i = 0; i < aLatentStyles.getLength(); ++i)
     {
-        if (sal_Int32 nToken = lcl_getToken(aDefaultTokens, aLatentStyles[i].Name))
+        if (sal_Int32 nToken = DocxStringGetToken(aDefaultTokens, aLatentStyles[i].Name))
             pAttributeList->add(FSNS(XML_w, nToken), OUStringToOString(aLatentStyles[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
         else if (aLatentStyles[i].Name == "lsdExceptions")
             aLatentStyles[i].Value >>= aLsdExceptions;
@@ -2443,7 +2436,7 @@ void DocxAttributeOutput::LatentStyles()
         uno::Sequence<beans::PropertyValue> aAttributes;
         aLsdExceptions[i].Value >>= aAttributes;
         for (sal_Int32 j = 0; j < aAttributes.getLength(); ++j)
-            if (sal_Int32 nToken = lcl_getToken(aExceptionTokens, aAttributes[j].Name))
+            if (sal_Int32 nToken = DocxStringGetToken(aExceptionTokens, aAttributes[j].Name))
                 pAttributeList->add(FSNS(XML_w, nToken), OUStringToOString(aAttributes[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
 
         xAttributeList = pAttributeList;
@@ -2660,382 +2653,9 @@ void DocxAttributeOutput::DocDefaults( )
     m_pSerializer->endElementNS(XML_w, XML_docDefaults);
 }
 
-void DocxAttributeOutput::TableStyles()
-{
-    // Do we have table styles from InteropGrabBag available?
-    uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
-    uno::Sequence<beans::PropertyValue> aInteropGrabBag;
-    xPropertySet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag;
-    uno::Sequence<beans::PropertyValue> aTableStyles;
-    for (sal_Int32 i = 0; i < aInteropGrabBag.getLength(); ++i)
-    {
-        if (aInteropGrabBag[i].Name == "tableStyles")
-        {
-            aInteropGrabBag[i].Value >>= aTableStyles;
-            break;
-        }
-    }
-    if (!aTableStyles.getLength())
-        return;
-
-    for (sal_Int32 i = 0; i < aTableStyles.getLength(); ++i)
-    {
-        uno::Sequence<beans::PropertyValue> aTableStyle;
-        aTableStyles[i].Value >>= aTableStyle;
-        TableStyle(aTableStyle);
-    }
-}
-
-StringTokenMap const aTblCellMarTokens[] = {
-    {"left", XML_left},
-    {"right", XML_right},
-    {"start", XML_start},
-    {"end", XML_end},
-    {"top", XML_top},
-    {"bottom", XML_bottom},
-    {0, 0}
-};
-
-/// Export of w:tblCellMar in a table style.
-void lcl_TableStyleTblCellMar(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblCellMar)
-{
-    if (!rTblCellMar.hasElements())
-        return;
-
-    pSerializer->startElementNS(XML_w, XML_tblCellMar, FSEND);
-    for (sal_Int32 i = 0; i < rTblCellMar.getLength(); ++i)
-    {
-        if (sal_Int32 nToken = lcl_getToken(aTblCellMarTokens, rTblCellMar[i].Name))
-        {
-            comphelper::SequenceAsHashMap aMap(rTblCellMar[i].Value.get< uno::Sequence<beans::PropertyValue> >());
-            pSerializer->singleElementNS(XML_w, nToken,
-                    FSNS(XML_w, XML_w), OString::number(aMap["w"].get<sal_Int32>()),
-                    FSNS(XML_w, XML_type), OUStringToOString(aMap["type"].get<OUString>(), RTL_TEXTENCODING_UTF8).getStr(),
-                    FSEND);
-        }
-    }
-    pSerializer->endElementNS(XML_w, XML_tblCellMar);
-}
-
-/// Export of w:shd in a table style.
-void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rShd)
-{
-    if (!rShd.hasElements())
-        return;
-
-    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
-    for (sal_Int32 i = 0; i < rShd.getLength(); ++i)
-    {
-        if (rShd[i].Name == "val")
-            pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-        else if (rShd[i].Name == "color")
-            pAttributeList->add(FSNS(XML_w, XML_color), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true));
-        else if (rShd[i].Name == "fill")
-            pAttributeList->add(FSNS(XML_w, XML_fill), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true));
-    }
-    XFastAttributeListRef xAttributeList(pAttributeList);
-    pSerializer->singleElementNS(XML_w, XML_shd, xAttributeList);
-}
-
-/// Export of w:lang in a table style.
-void lcl_TableStyleRLang(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rLang)
-{
-    if (!rLang.hasElements())
-        return;
-
-    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
-    for (sal_Int32 i = 0; i < rLang.getLength(); ++i)
-    {
-        if (rLang[i].Name == "eastAsia")
-            pAttributeList->add(FSNS(XML_w, XML_eastAsia), OUStringToOString(rLang[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-    }
-    XFastAttributeListRef xAttributeList(pAttributeList);
-    pSerializer->singleElementNS(XML_w, XML_lang, xAttributeList);
-}
-
-/// Export of w:rFonts in a table style.
-void lcl_TableStyleRRFonts(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rRFonts)
-{
-    if (!rRFonts.hasElements())
-        return;
-
-    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
-    for (sal_Int32 i = 0; i < rRFonts.getLength(); ++i)
-    {
-        if (rRFonts[i].Name == "eastAsiaTheme")
-            pAttributeList->add(FSNS(XML_w, XML_eastAsiaTheme), OUStringToOString(rRFonts[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-    }
-    XFastAttributeListRef xAttributeList(pAttributeList);
-    pSerializer->singleElementNS(XML_w, XML_rFonts, xAttributeList);
-}
-
-/// Export of w:spacing in a table style.
-void lcl_TableStylePSpacing(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rSpacing)
-{
-    if (!rSpacing.hasElements())
-        return;
-
-    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
-    for (sal_Int32 i = 0; i < rSpacing.getLength(); ++i)
-    {
-        if (rSpacing[i].Name == "after")
-            pAttributeList->add(FSNS(XML_w, XML_after), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-        else if (rSpacing[i].Name == "line")
-            pAttributeList->add(FSNS(XML_w, XML_line), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-        else if (rSpacing[i].Name == "lineRule")
-            pAttributeList->add(FSNS(XML_w, XML_lineRule), OUStringToOString(rSpacing[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-    }
-    XFastAttributeListRef xAttributeList(pAttributeList);
-    pSerializer->singleElementNS(XML_w, XML_spacing, xAttributeList);
-}
-
-/// Export of w:tblInd in a table style.
-void lcl_TableStyleTblInd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblInd)
-{
-    if (!rTblInd.hasElements())
-        return;
-
-    sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
-    for (sal_Int32 i = 0; i < rTblInd.getLength(); ++i)
-    {
-        if (rTblInd[i].Name == "w")
-            pAttributeList->add(FSNS(XML_w, XML_w), OString::number(rTblInd[i].Value.get<sal_Int32>()));
-        else if (rTblInd[i].Name == "type")
-            pAttributeList->add(FSNS(XML_w, XML_type), OUStringToOString(rTblInd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-    }
-    XFastAttributeListRef xAttributeList(pAttributeList);
-    pSerializer->singleElementNS(XML_w, XML_tblInd, xAttributeList);
-}
-
-/// Export of w:rPr in a table style.
-void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rRPr)
-{
-    if (!rRPr.hasElements())
-        return;
-
-    pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
-
-    uno::Sequence<beans::PropertyValue> aRFonts, aLang;
-    for (sal_Int32 i = 0; i < rRPr.getLength(); ++i)
-    {
-        if (rRPr[i].Name == "rFonts")
-            aRFonts = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-        else if (rRPr[i].Name == "lang")
-            aLang = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-    }
-    lcl_TableStyleRRFonts(pSerializer, aRFonts);
-    lcl_TableStyleRLang(pSerializer, aLang);
-
-    pSerializer->endElementNS(XML_w, XML_rPr);
-}
-
-/// Export of w:pPr in a table style.
-void lcl_TableStylePPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rPPr)
-{
-    if (!rPPr.hasElements())
-        return;
-
-    pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
-
-    uno::Sequence<beans::PropertyValue> aSpacing;
-    for (sal_Int32 i = 0; i < rPPr.getLength(); ++i)
-    {
-        if (rPPr[i].Name == "spacing")
-            aSpacing = rPPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-    }
-    lcl_TableStylePSpacing(pSerializer, aSpacing);
-
-    pSerializer->endElementNS(XML_w, XML_pPr);
-}
-
-/// Export of w:tblPr in a table style.
-void lcl_TableStyleTblPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblPr)
-{
-    if (!rTblPr.hasElements())
-        return;
-
-    pSerializer->startElementNS(XML_w, XML_tblPr, FSEND);
-
-    uno::Sequence<beans::PropertyValue> aTblInd, aTblCellMar;
-    boost::optional<sal_Int32> oTblStyleRowBandSize, oTblStyleColBandSize;
-    for (sal_Int32 i = 0; i < rTblPr.getLength(); ++i)
-    {
-        if (rTblPr[i].Name == "tblStyleRowBandSize")
-            oTblStyleRowBandSize = rTblPr[i].Value.get<sal_Int32>();
-        else if (rTblPr[i].Name == "tblStyleColBandSize")
-            oTblStyleColBandSize = rTblPr[i].Value.get<sal_Int32>();
-        else if (rTblPr[i].Name == "tblInd")
-            aTblInd = rTblPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-        else if (rTblPr[i].Name == "tblCellMar")
-            aTblCellMar = rTblPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-    }
-    if (oTblStyleRowBandSize)
-        pSerializer->singleElementNS(XML_w, XML_tblStyleRowBandSize,
-                FSNS(XML_w, XML_val), OString::number(oTblStyleRowBandSize.get()),
-                FSEND);
-    if (oTblStyleColBandSize)
-        pSerializer->singleElementNS(XML_w, XML_tblStyleColBandSize,
-                FSNS(XML_w, XML_val), OString::number(oTblStyleColBandSize.get()),
-                FSEND);
-    lcl_TableStyleTblInd(pSerializer, aTblInd);
-    lcl_TableStyleTblCellMar(pSerializer, aTblCellMar);
-
-    pSerializer->endElementNS(XML_w, XML_tblPr);
-}
-
-/// Export of w:tcPr in a table style.
-void lcl_TableStyleTcPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTcPr)
-{
-    if (!rTcPr.hasElements())
-        return;
-
-    pSerializer->startElementNS(XML_w, XML_tcPr, FSEND);
-
-    uno::Sequence<beans::PropertyValue> aShd;
-    for (sal_Int32 i = 0; i < rTcPr.getLength(); ++i)
-    {
-        if (rTcPr[i].Name == "shd")
-            aShd = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-    }
-    lcl_TableStyleShd(pSerializer, aShd);
-
-    pSerializer->endElementNS(XML_w, XML_tcPr);
-}
-
-/// Export of w:tblStylePr in a table style.
-void lcl_TableStyleTblStylePr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblStylePr)
-{
-    if (!rTblStylePr.hasElements())
-        return;
-
-    OUString aType;
-    uno::Sequence<beans::PropertyValue> aPPr, aRPr, aTblPr, aTcPr;
-    for (sal_Int32 i = 0; i < rTblStylePr.getLength(); ++i)
-    {
-        if (rTblStylePr[i].Name == "type")
-            aType = rTblStylePr[i].Value.get<OUString>();
-        else if (rTblStylePr[i].Name == "pPr")
-            aPPr = rTblStylePr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
-        else if (rTblStylePr[i].Name == "rPr")
-            aRPr = rTblStylePr[i].Value.get< uno::Sequence<beans::PropertyValue> >();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list