[Libreoffice-commits] core.git: Branch 'feature/pivot_median' - 1635 commits - accessibility/inc accessibility/source android/mobile-config.py android/source avmedia/Module_avmedia.mk avmedia/source basctl/qa basctl/source basctl/uiconfig basegfx/source basic/inc basic/qa basic/source bean/native binaryurp/source bin/convwatch.py bin/lo-pack-sources bin/test-hid-vs-ui.py bin/upload_symbols.py bridges/inc bridges/source canvas/source chart2/inc chart2/qa chart2/source chart2/uiconfig chart2/workbench codemaker/source comphelper/source compilerplugins/clang config_host/config_graphite.h.in config_host/config_options_calc.h.in config_host.mk.in configmgr/source configure.ac connectivity/source cppcanvas/source cppuhelper/source cppu/Library_cppu.mk cppu/source cui/qa cui/source cui/uiconfig dbaccess/inc dbaccess/Library_dbu.mk dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbapp.mk dbaccess/UIConfig_dbbrowser.mk dbaccess/UIConfig_dbtdata.mk dbaccess/util dbaccess/win32 desktop/Cppun itTest_desktop_app.mk desktop/inc desktop/qa desktop/scripts desktop/source desktop/test desktop/uiconfig desktop/win32 dictionaries distro-configs/Jenkins download.lst drawinglayer/qa drawinglayer/source dtrans/Library_dnd.mk dtrans/source editeng/source embeddedobj/source embedserv/source extensions/source extensions/test extensions/uiconfig external/cairo external/coinmp external/curl external/firebird external/glm external/glyphy external/graphite external/harfbuzz external/hyphen external/icu external/jpeg external/jpeg-turbo external/libatomic_ops external/libcmis external/liblangtag external/liborcus external/libpng external/libwps external/libxmlsec external/libzmf external/Module_external.mk external/nss external/openldap external/openssl external/poppler external/postgresql external/python3 external/python33 external/redland external/zlib extras/Package_tplpresnt.mk extras/source filter/qa filter/source filter/uiconfig forms/source formula/Module_formula.mk formula/qa form ula/source formula/uiconfig fpicker/Library_fps.mk fpicker/Module_fpicker.mk fpicker/qa fpicker/source framework/inc framework/Library_fwi.mk framework/source framework/uiconfig .gitignore helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/galaxy icon-themes/hicontrast icon-themes/human icon-themes/industrial icon-themes/tango idlc/inc idlc/source idl/inc idl/source include/avmedia include/basegfx include/basic include/canvas include/codemaker include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/i18nlangtag include/jvmaccess include/LibreOfficeKit include/oox include/opencl include/postwin.h include/rsc include/rtl include/sal include/sax include/sfx2 include/sot include/svl inclu de/svtools include/svx include/test include/toolkit include/tools include/tubes include/ucbhelper include/unoidl include/unotools include/vbahelper include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk jurt/Library_jpipe.mk jurt/source jvmfwk/distributions jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source Library_merged.mk librelogo/source libreofficekit/Package_selectionhandles.mk libreofficekit/source linguistic/inc linguistic/source lotuswordpro/source Makefile.fetch Makefile.in mysqlc/source nlpsolver/help odk/examples odk/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/registry oox/inc oox/source opencl/inc opencl/source osx/soffice.xcodeproj package/inc package/source postprocess/CustomTarget_images.mk postprocess/Rdb_services.mk pyuno/demo pyuno/source pyuno/zipcore qadevOOo/tests readlicense_oo/license reportdesign/inc reportdesign/qa reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk rsc/inc rsc/sour ce salhelper/qa sal/osl sal/qa sax/source scaddins/source sc/AllLangResTarget_sc.mk sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_check_data_pilot_field.mk sc/CppunitTest_sc_check_data_pilot_table.mk sc/CppunitTest_sc_check_xcell_ranges_query.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_viewpaneobj.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk scp2/AutoInstall.mk scp2/inc scp2/InstallScript_setup_osl.mk scp2/source sc/qa sc/res scripting/java scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sdext/source sd/inc sd/Library_sd.mk sd/qa sd/README sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk setup_native/source sfx2/classification sfx2/Library_sfx.mk sfx2/Package_classification.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/inc shell/qa shell/source slideshow/Library_OGLTrans.mk slideshow /source solenv/bin solenv/CompilerTest_compilerplugins_clang.mk solenv/CustomTarget_gbuildtesttools.mk solenv/Executable_gbuildtojson.mk solenv/gbuild solenv/gbuildtojson solenv/gcc-wrappers solenv/gdb solenv/Module_solenv.mk solenv/PythonTest_solenv_python.mk solenv/qa sot/qa sot/source starmath/inc starmath/Library_sm.mk starmath/qa starmath/source starmath/uiconfig stoc/Library_javavm.mk stoc/source stoc/test store/source svgio/inc svgio/source svl/Library_svl.mk svl/qa svl/source svtools/inc svtools/qa svtools/source svx/AllLangResTarget_svx.mk svx/inc svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk svx/util sw/CppunitTest_sw_dialogs_test.mk sw/CppunitTest_sw_ww8export2.mk sw/inc sw/Library_sw.mk sw/Module_sw.mk sw/qa sw/sdi sw/source sw/uiconfig sysui/desktop TEMPLATE.SOURCECODE.HEADER test/README.vars test/source toolkit/source tools/qa tools/source translations tubes/qa tubes/source ucbhelper/source ucb/qa ucb/source uitest/calc_tests uitest/demo_ui uitest/impress_ tests uitest/libreoffice uitest/math_tests uitest/test_main.py uitest/uitest uitest/writer_tests UnoControls/inc UnoControls/source unodevtools/source unotest/source unotools/Library_utl.mk unotools/source unoxml/source uui/qa uui/source vbahelper/source vcl/android vcl/CppunitTest_vcl_wmf_test.mk vcl/glyphy vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/null vcl/opengl vcl/osx vcl/Package_opengl.mk vcl/qa vcl/quartz vcl/README.vars vcl/source vcl/unx vcl/win vcl/workben winaccessibility/inc winaccessibility/source wizards/source writerfilter/source writerperfect/CppunitTest_writerperfect_draw.mk writerperfect/Library_wpftcalc.mk writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftwriter.mk writerperfect/source xmlhelp/source xmloff/inc xmloff/source xmlscript/source xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/Executable_pdfverify.mk xmlsecurity/inc xmlsecurity/Library_xmlsecurity.mk xml security/Module_xmlsecurity.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig

Tamás Zolnai zolnaitamas2000 at gmail.com
Sat Nov 19 21:22:48 UTC 2016


Rebased ref, commits from common ancestor:
commit 7a3c1ea26ba7211aa3b7c4c9f2712a1fdbbc3fff
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Sat Nov 19 21:34:16 2016 +0100

    PivotMedian: ODS import / export of pivot table median
    
    Change-Id: I3b018f5a76bb3d89bcb6cbc34e4cb2f2057248d5

diff --git a/sc/qa/unit/data/ods/pivot-table-median.ods b/sc/qa/unit/data/ods/pivot-table-median.ods
new file mode 100755
index 0000000..bb88170
Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-median.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index dbab3cc..8d8183b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -149,6 +149,7 @@ public:
 
     void testPivotTableXLSX();
     void testPivotTableTwoDataFieldsXLSX();
+    void testPivotTableMedian();
 
     void testSwappedOutImageExport();
     void testLinkedGraphicRT();
@@ -238,6 +239,7 @@ public:
     CPPUNIT_TEST(testSheetProtection);
     CPPUNIT_TEST(testPivotTableXLSX);
     CPPUNIT_TEST(testPivotTableTwoDataFieldsXLSX);
+    CPPUNIT_TEST(testPivotTableMedian);
 #if !defined(_WIN32)
     CPPUNIT_TEST(testSupBookVirtualPath);
 #endif
@@ -2936,6 +2938,41 @@ void ScExportTest::testPivotTableTwoDataFieldsXLSX()
     xDocSh2->DoClose();
 }
 
+void ScExportTest::testPivotTableMedian()
+{
+    ScDocShellRef xDocSh = loadDoc("pivot-table-median.", FORMAT_ODS);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load test document.", xDocSh.Is());
+
+    // Export the document and import again for a check
+    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    xDocSh->DoClose();
+
+    // Check sheet
+    ScDocument& rDoc = xDocSh2->GetDocument();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one sheet.", sal_Int16(1), rDoc.GetTableCount());
+
+    // Check pivot table
+    ScDPCollection* pDPs = rDoc.GetDPCollection();
+    CPPUNIT_ASSERT_MESSAGE("Failed to get a live ScDPCollection instance.", pDPs);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one pivot table instance.", size_t(1), pDPs->GetCount());
+    const ScDPObject* pDPObj = &(*pDPs)[0];
+    CPPUNIT_ASSERT_MESSAGE("Failed to get pivot table object.", pDPObj);
+    const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+    CPPUNIT_ASSERT_MESSAGE("Failed to get ScDPSaveData instance.", pSaveData);
+
+    // Check the data field function.
+    std::vector<const ScDPSaveDimension*> aDims;
+    pSaveData->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_DATA, aDims);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(
+        "There should be exactly 1 data field.",
+        std::vector<ScDPSaveDimension const *>::size_type(1), aDims.size());
+
+    const ScDPSaveDimension* pDim = aDims.back();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(
+        "Function for the data field should be COUNT.",
+        sal_uInt16(sheet::GeneralFunction_MEDIAN), pDim->GetFunction());
+}
+
 void ScExportTest::testFunctionsExcel2010ODS()
 {
     //testFunctionsExcel2010(FORMAT_ODS);
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx
index 5a5c529..2ea2bb6 100644
--- a/sc/source/filter/xml/XMLConverter.cxx
+++ b/sc/source/filter/xml/XMLConverter.cxx
@@ -56,6 +56,8 @@ sheet::GeneralFunction ScXMLConverter::GetFunctionFromString( const OUString& sF
         return sheet::GeneralFunction_PRODUCT;
     if( IsXMLToken(sFunction, XML_AVERAGE ) )
         return sheet::GeneralFunction_AVERAGE;
+    if( IsXMLToken(sFunction, XML_MEDIAN ) )
+        return sheet::GeneralFunction_MEDIAN;
     if( IsXMLToken(sFunction, XML_MAX ) )
         return sheet::GeneralFunction_MAX;
     if( IsXMLToken(sFunction, XML_MIN ) )
@@ -107,6 +109,7 @@ void ScXMLConverter::GetStringFromFunction(
     {
         case sheet::GeneralFunction_AUTO:       sFuncStr = GetXMLToken( XML_AUTO );         break;
         case sheet::GeneralFunction_AVERAGE:    sFuncStr = GetXMLToken( XML_AVERAGE );      break;
+        case sheet::GeneralFunction_MEDIAN:     sFuncStr = GetXMLToken( XML_MEDIAN );       break;
         case sheet::GeneralFunction_COUNT:      sFuncStr = GetXMLToken( XML_COUNT );        break;
         case sheet::GeneralFunction_COUNTNUMS:  sFuncStr = GetXMLToken( XML_COUNTNUMS );    break;
         case sheet::GeneralFunction_MAX:        sFuncStr = GetXMLToken( XML_MAX );          break;
@@ -120,7 +123,7 @@ void ScXMLConverter::GetStringFromFunction(
         case sheet::GeneralFunction_VARP:       sFuncStr = GetXMLToken( XML_VARP );         break;
         default:
         {
-            // added to avoid warnings
+            assert(false);
         }
     }
     ScRangeStringConverter::AssignString( rString, sFuncStr, false );
commit add16c3881277042e93ab694a335f0312c8c9dc6
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Sat Nov 19 21:33:19 2016 +0100

    PivotMedian: Implement median as a new pivot table function
    
    Change-Id: Ife90c8f1c36980254de3cec6e395a6ba94d99fea

diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index 7c82541..295af86 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -27,18 +27,19 @@ enum class PivotFunc {
     Sum          = 0x0001,
     Count        = 0x0002,
     Average      = 0x0004,
-    Max          = 0x0008,
-    Min          = 0x0010,
-    Product      = 0x0020,
-    CountNum     = 0x0040,
-    StdDev       = 0x0080,
-    StdDevP      = 0x0100,
-    StdVar       = 0x0200,
-    StdVarP      = 0x0400,
+    Median       = 0x0008,
+    Max          = 0x0010,
+    Min          = 0x0020,
+    Product      = 0x0040,
+    CountNum     = 0x0080,
+    StdDev       = 0x0100,
+    StdDevP      = 0x0200,
+    StdVar       = 0x0400,
+    StdVarP      = 0x0800,
     Auto         = 0x1000
 };
 namespace o3tl {
-    template<> struct typed_flags<PivotFunc> : is_typed_flags<PivotFunc, 0x17ff> {};
+    template<> struct typed_flags<PivotFunc> : is_typed_flags<PivotFunc, 0x11ff> {};
 }
 
 struct ScDPValue
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 05efe99..65dbf5d 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -160,6 +160,7 @@ private:
     double          fAux;
     long            nCount;
     ScDPAggData*    pChild;
+    std::vector<double> mSortedValues;
 
 public:
             ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(nullptr) {}
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index a94b855..429a867 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -851,7 +851,8 @@ enum ScSubTotalFunc
         SUBTOTAL_FUNC_SUM   = 9,
         SUBTOTAL_FUNC_VAR   = 10,
         SUBTOTAL_FUNC_VARP  = 11,
-        SUBTOTAL_FUNC_SELECTION_COUNT = 12
+        SUBTOTAL_FUNC_MED   = 12,
+        SUBTOTAL_FUNC_SELECTION_COUNT = 13
     };
 
 enum ScAggregateFunc
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 5833436..e06d921 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -149,6 +149,7 @@
 #define STR_FUN_TEXT_SUM            108
 #define STR_FUN_TEXT_COUNT          109
 #define STR_FUN_TEXT_AVG            110
+#define STR_FUN_TEXT_MEDIAN         544
 #define STR_FUN_TEXT_MAX            111
 #define STR_FUN_TEXT_MIN            112
 #define STR_FUN_TEXT_PRODUCT        113
@@ -709,7 +710,7 @@
 #define STR_BOOLEAN_VALUE               542
 #define STR_TEXT                        543
 
-#define SC_GLOBSTR_STR_COUNT            544     /**< the count of permanently resident strings */
+#define SC_GLOBSTR_STR_COUNT            545     /**< the count of permanently resident strings */
 
 #endif
 
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index ff6c2da..7124b51 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -1548,6 +1548,7 @@ OUString lcl_GetDataFieldName( const OUString& rSourceName, sheet::GeneralFuncti
         case sheet::GeneralFunction_COUNT:
         case sheet::GeneralFunction_COUNTNUMS:  nStrId = STR_FUN_TEXT_COUNT;    break;
         case sheet::GeneralFunction_AVERAGE:    nStrId = STR_FUN_TEXT_AVG;      break;
+        case sheet::GeneralFunction_MEDIAN:     nStrId = STR_FUN_TEXT_MEDIAN;   break;
         case sheet::GeneralFunction_MAX:        nStrId = STR_FUN_TEXT_MAX;      break;
         case sheet::GeneralFunction_MIN:        nStrId = STR_FUN_TEXT_MIN;      break;
         case sheet::GeneralFunction_PRODUCT:    nStrId = STR_FUN_TEXT_PRODUCT;  break;
@@ -1556,10 +1557,10 @@ OUString lcl_GetDataFieldName( const OUString& rSourceName, sheet::GeneralFuncti
         case sheet::GeneralFunction_VAR:
         case sheet::GeneralFunction_VARP:       nStrId = STR_FUN_TEXT_VAR;      break;
         case sheet::GeneralFunction_NONE:
-        case sheet::GeneralFunction_AUTO:
+        case sheet::GeneralFunction_AUTO:                                       break;
         default:
         {
-            OSL_FAIL("wrong function");
+            assert(false);
         }
     }
     if ( !nStrId )
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index cba41fd..b9dcdf4 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -57,7 +57,7 @@ using ::com::sun::star::uno::Sequence;
 
 namespace {
 
-sal_uInt16 nFuncStrIds[12] =     // matching enum ScSubTotalFunc
+sal_uInt16 nFuncStrIds[] =     // matching enum ScSubTotalFunc
 {
     0,                              // SUBTOTAL_FUNC_NONE
     STR_FUN_TEXT_AVG,               // SUBTOTAL_FUNC_AVE
@@ -70,7 +70,9 @@ sal_uInt16 nFuncStrIds[12] =     // matching enum ScSubTotalFunc
     STR_FUN_TEXT_STDDEV,            // SUBTOTAL_FUNC_STDP
     STR_FUN_TEXT_SUM,               // SUBTOTAL_FUNC_SUM
     STR_FUN_TEXT_VAR,               // SUBTOTAL_FUNC_VAR
-    STR_FUN_TEXT_VAR                // SUBTOTAL_FUNC_VARP
+    STR_FUN_TEXT_VAR,               // SUBTOTAL_FUNC_VARP
+    0,                              // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table
+    STR_FUN_TEXT_MEDIAN             // SUBTOTAL_FUNC_MED
 };
 
 bool lcl_SearchMember( const std::vector <ScDPResultMember *>& list, SCROW nOrder, SCROW& rIndex)
@@ -439,6 +441,15 @@ void ScDPAggData::Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const Sc
                     nCount = -1;                            // -1 for error
             }
             break;
+        case SUBTOTAL_FUNC_MED:
+            {
+                auto aIter = std::upper_bound(mSortedValues.begin(), mSortedValues.end(), rNext.mfValue);
+                if (aIter == mSortedValues.end())
+                    mSortedValues.push_back(rNext.mfValue);
+                else
+                    mSortedValues.insert(aIter, rNext.mfValue);
+            }
+            break;
         default:
             OSL_FAIL("invalid function");
     }
@@ -475,6 +486,7 @@ void ScDPAggData::Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSub
             break;
 
         case SUBTOTAL_FUNC_AVE:
+        case SUBTOTAL_FUNC_MED:
         case SUBTOTAL_FUNC_MAX:
         case SUBTOTAL_FUNC_MIN:
         case SUBTOTAL_FUNC_STDP:
@@ -534,6 +546,16 @@ void ScDPAggData::Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSub
                 if ( nCount > 0 )
                     fResult = (fAux - fVal*fVal/(double)(nCount)) / (double)nCount;
                 break;
+            case SUBTOTAL_FUNC_MED:
+                if (mSortedValues.size() > 0)
+                {
+                    assert(mSortedValues.size() == static_cast<size_t>(nCount));
+                    if ((nCount % 2) == 1)
+                        fResult = mSortedValues[mSortedValues.size() / 2];
+                    else
+                        fResult = (mSortedValues[mSortedValues.size() / 2 - 1] + mSortedValues[mSortedValues.size() / 2]) / 2.0;
+                }
+                break;
             default:
                 OSL_FAIL("invalid function");
         }
@@ -816,6 +838,7 @@ OUString ScDPResultData::GetMeasureString(long nMeasure, bool bForce, ScSubTotal
     {
         //  for user-specified subtotal function with all measures,
         //  display only function name
+        assert(eForceFunc < SAL_N_ELEMENTS(nFuncStrIds));
         if ( eForceFunc != SUBTOTAL_FUNC_NONE )
             return ScGlobal::GetRscString(nFuncStrIds[eForceFunc]);
 
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 93d79ed..f614d42 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -367,7 +367,7 @@ sal_Int32 ScDPUtil::getDatePartValue(
 
 namespace {
 
-sal_uInt16 nFuncStrIds[12] = {
+sal_uInt16 nFuncStrIds[] = {
     0,                              // SUBTOTAL_FUNC_NONE
     STR_FUN_TEXT_AVG,               // SUBTOTAL_FUNC_AVE
     STR_FUN_TEXT_COUNT,             // SUBTOTAL_FUNC_CNT
@@ -379,7 +379,9 @@ sal_uInt16 nFuncStrIds[12] = {
     STR_FUN_TEXT_STDDEV,            // SUBTOTAL_FUNC_STDP
     STR_FUN_TEXT_SUM,               // SUBTOTAL_FUNC_SUM
     STR_FUN_TEXT_VAR,               // SUBTOTAL_FUNC_VAR
-    STR_FUN_TEXT_VAR                // SUBTOTAL_FUNC_VARP
+    STR_FUN_TEXT_VAR,               // SUBTOTAL_FUNC_VARP
+    0,                              // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table
+    STR_FUN_TEXT_MEDIAN             // SUBTOTAL_FUNC_MED
 };
 
 }
@@ -387,6 +389,7 @@ sal_uInt16 nFuncStrIds[12] = {
 OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc)
 {
     OUStringBuffer aRet;
+    assert(eFunc < SAL_N_ELEMENTS(nFuncStrIds));
     sal_uInt16 nId = nFuncStrIds[eFunc];
     if (nId)
     {
@@ -400,13 +403,14 @@ OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc
 
 ScSubTotalFunc ScDPUtil::toSubTotalFunc(css::sheet::GeneralFunction eGenFunc)
 {
-    ScSubTotalFunc eSubTotal;
+    ScSubTotalFunc eSubTotal = SUBTOTAL_FUNC_NONE;
     switch (eGenFunc)
     {
         case sheet::GeneralFunction_NONE:       eSubTotal = SUBTOTAL_FUNC_NONE; break;
         case sheet::GeneralFunction_SUM:        eSubTotal = SUBTOTAL_FUNC_SUM;  break;
         case sheet::GeneralFunction_COUNT:      eSubTotal = SUBTOTAL_FUNC_CNT2; break;
         case sheet::GeneralFunction_AVERAGE:    eSubTotal = SUBTOTAL_FUNC_AVE;  break;
+        case sheet::GeneralFunction_MEDIAN:     eSubTotal = SUBTOTAL_FUNC_MED;  break;
         case sheet::GeneralFunction_MAX:        eSubTotal = SUBTOTAL_FUNC_MAX;  break;
         case sheet::GeneralFunction_MIN:        eSubTotal = SUBTOTAL_FUNC_MIN;  break;
         case sheet::GeneralFunction_PRODUCT:    eSubTotal = SUBTOTAL_FUNC_PROD; break;
@@ -415,9 +419,9 @@ ScSubTotalFunc ScDPUtil::toSubTotalFunc(css::sheet::GeneralFunction eGenFunc)
         case sheet::GeneralFunction_STDEVP:     eSubTotal = SUBTOTAL_FUNC_STDP; break;
         case sheet::GeneralFunction_VAR:        eSubTotal = SUBTOTAL_FUNC_VAR;  break;
         case sheet::GeneralFunction_VARP:       eSubTotal = SUBTOTAL_FUNC_VARP; break;
-        case sheet::GeneralFunction_AUTO:
+        case sheet::GeneralFunction_AUTO:       eSubTotal = SUBTOTAL_FUNC_NONE; break;
         default:
-            eSubTotal = SUBTOTAL_FUNC_NONE;
+            assert(false);
     }
     return eSubTotal;
 }
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 401fa81..8eae041 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -35,6 +35,7 @@ OUString lclGetFunctionMaskName(const PivotFunc nFunctionMask)
         case PivotFunc::Sum:        nStrId = STR_FUN_TEXT_SUM;      break;
         case PivotFunc::Count:      nStrId = STR_FUN_TEXT_COUNT;    break;
         case PivotFunc::Average:    nStrId = STR_FUN_TEXT_AVG;      break;
+        case PivotFunc::Median:     nStrId = STR_FUN_TEXT_MEDIAN;   break;
         case PivotFunc::Max:        nStrId = STR_FUN_TEXT_MAX;      break;
         case PivotFunc::Min:        nStrId = STR_FUN_TEXT_MIN;      break;
         case PivotFunc::Product:    nStrId = STR_FUN_TEXT_PRODUCT;  break;
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index d947b51..5a9ad2b 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -100,6 +100,7 @@ static const PivotFunc spnFunctions[] =
     PivotFunc::Sum,
     PivotFunc::Count,
     PivotFunc::Average,
+    PivotFunc::Median,
     PivotFunc::Max,
     PivotFunc::Min,
     PivotFunc::Product,
@@ -189,6 +190,7 @@ void ScDPFunctionListBox::FillFunctionNames()
     ResStringArray aArr( ScResId( SCSTR_DPFUNCLISTBOX ) );
     for( sal_uInt16 nIndex = 0, nCount = sal::static_int_cast<sal_uInt16>(aArr.Count()); nIndex < nCount; ++nIndex )
         InsertEntry( aArr.GetString( nIndex ) );
+    assert(GetEntryCount() == SAL_N_ELEMENTS(spnFunctions));
 }
 
 ScDPFunctionDlg::ScDPFunctionDlg(
diff --git a/sc/source/ui/dbgui/pvfundlg.src b/sc/source/ui/dbgui/pvfundlg.src
index fe33cf8..0de9461 100644
--- a/sc/source/ui/dbgui/pvfundlg.src
+++ b/sc/source/ui/dbgui/pvfundlg.src
@@ -26,6 +26,7 @@ StringArray SCSTR_DPFUNCLISTBOX
         < "Sum" ; Default ; > ;
         < "Count" ; Default ; > ;
         < "Average" ; Default ; > ;
+        < "Median" ; Default ; > ;
         < "Max" ; Default ; > ;
         < "Min" ; Default ; > ;
         < "Product" ; Default ; > ;
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 241254b..0827a6a 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -658,6 +658,10 @@ Resource RID_GLOBSTR
     {
         Text [ en-US ] = "Average" ;
     };
+    String STR_FUN_TEXT_MEDIAN
+    {
+        Text [ en-US ] = "Median" ;
+    };
     String STR_FUN_TEXT_MAX
     {
         Text [ en-US ] = "Max" ;
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index a6f7f58..fe2590b 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -184,6 +184,7 @@ GeneralFunction ScDataPilotConversion::FirstFunc( PivotFunc nBits )
     if ( nBits & PivotFunc::Sum )       return GeneralFunction_SUM;
     if ( nBits & PivotFunc::Count )     return GeneralFunction_COUNT;
     if ( nBits & PivotFunc::Average )   return GeneralFunction_AVERAGE;
+    if ( nBits & PivotFunc::Median )    return GeneralFunction_MEDIAN;
     if ( nBits & PivotFunc::Max )       return GeneralFunction_MAX;
     if ( nBits & PivotFunc::Min )       return GeneralFunction_MIN;
     if ( nBits & PivotFunc::Product )   return GeneralFunction_PRODUCT;
@@ -204,6 +205,7 @@ PivotFunc ScDataPilotConversion::FunctionBit( GeneralFunction eFunc )
         case GeneralFunction_SUM:       nRet = PivotFunc::Sum;       break;
         case GeneralFunction_COUNT:     nRet = PivotFunc::Count;     break;
         case GeneralFunction_AVERAGE:   nRet = PivotFunc::Average;   break;
+        case GeneralFunction_MEDIAN:    nRet = PivotFunc::Median;    break;
         case GeneralFunction_MAX:       nRet = PivotFunc::Max;       break;
         case GeneralFunction_MIN:       nRet = PivotFunc::Min;       break;
         case GeneralFunction_PRODUCT:   nRet = PivotFunc::Product;   break;
@@ -215,7 +217,7 @@ PivotFunc ScDataPilotConversion::FunctionBit( GeneralFunction eFunc )
         case GeneralFunction_AUTO:      nRet = PivotFunc::Auto;      break;
         default:
         {
-            // added to avoid warnings
+            assert(false);
         }
     }
     return nRet;
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 718af05..403bb6a4 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -144,6 +144,7 @@ sheet::GeneralFunction  ScDataUnoConversion::SubTotalToGeneral( ScSubTotalFunc e
         case SUBTOTAL_FUNC_AVE:  eGeneral = sheet::GeneralFunction_AVERAGE;   break;
         case SUBTOTAL_FUNC_CNT:  eGeneral = sheet::GeneralFunction_COUNTNUMS; break;
         case SUBTOTAL_FUNC_CNT2: eGeneral = sheet::GeneralFunction_COUNT;     break;
+        case SUBTOTAL_FUNC_MED:  eGeneral = sheet::GeneralFunction_MEDIAN;    break;
         case SUBTOTAL_FUNC_MAX:  eGeneral = sheet::GeneralFunction_MAX;       break;
         case SUBTOTAL_FUNC_MIN:  eGeneral = sheet::GeneralFunction_MIN;       break;
         case SUBTOTAL_FUNC_PROD: eGeneral = sheet::GeneralFunction_PRODUCT;   break;
commit 15d1691e38acdda8cb6e792a3d98d5c17bc91769
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Sat Nov 19 21:32:26 2016 +0100

    PivotMedian: Add median to pivot table function type
    
    Change-Id: I675e81b5c13832ac0ff893a6e080241e6f1c8fd5

diff --git a/offapi/com/sun/star/sheet/GeneralFunction.idl b/offapi/com/sun/star/sheet/GeneralFunction.idl
index ff9615c..d0463d9 100644
--- a/offapi/com/sun/star/sheet/GeneralFunction.idl
+++ b/offapi/com/sun/star/sheet/GeneralFunction.idl
@@ -56,6 +56,13 @@ published enum GeneralFunction
     AVERAGE,
 
 
+    /**
+    *   median of all numerical values is calculated.
+    *   @since LibreOffice 5.3
+    */
+    MEDIAN,
+
+
     /** maximum value of all numerical values is calculated.
      */
     MAX,
@@ -94,7 +101,6 @@ published enum GeneralFunction
     /** variance is calculated based on the entire population.
      */
     VARP
-
 };
 
 
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index 1785f24..b939b24 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -11484,14 +11484,15 @@ module com {
      SUM = 2,
      COUNT = 3,
      AVERAGE = 4,
-     MAX = 5,
-     MIN = 6,
-     PRODUCT = 7,
-     COUNTNUMS = 8,
-     STDEV = 9,
-     STDEVP = 10,
-     VAR = 11,
-     VARP = 12
+     MEDIAN = 5,
+     MAX = 6,
+     MIN = 7,
+     PRODUCT = 8,
+     COUNTNUMS = 9,
+     STDEV = 10,
+     STDEVP = 11,
+     VAR = 12,
+     VARP = 13
     };
     /** @deprecated */ published interface XConsolidationDescriptor {
      interface ::com::sun::star::uno::XInterface;
commit d64681afeece5b9b6f91abfdae96c93330e1c3e9
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Thu Nov 3 11:33:24 2016 +0100

    Display localized function names in Pivot Layout dialog
    
    Same names which are displayed for pivot table
    placed on a sheet.
    
    Change-Id: Ic05d0dddea7d17101f253874dff15b8a49b87287

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 85f04c5..401fa81 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -16,6 +16,7 @@
 #include <svtools/treelistentry.hxx>
 #include "pivot.hxx"
 #include "scabstdlg.hxx"
+#include "globstr.hrc"
 
 using namespace std;
 
@@ -28,23 +29,28 @@ namespace
 
 OUString lclGetFunctionMaskName(const PivotFunc nFunctionMask)
 {
+    sal_uInt16 nStrId = 0;
     switch (nFunctionMask)
     {
-        case PivotFunc::Sum:       return OUString("Sum");
-        case PivotFunc::Count:     return OUString("Count");
-        case PivotFunc::Average:   return OUString("Mean");
-        case PivotFunc::Max:       return OUString("Max");
-        case PivotFunc::Min:       return OUString("Min");
-        case PivotFunc::Product:   return OUString("Product");
-        case PivotFunc::CountNum: return OUString("Count");
-        case PivotFunc::StdDev:   return OUString("StDev");
-        case PivotFunc::StdDevP:  return OUString("StDevP");
-        case PivotFunc::StdVar:   return OUString("Var");
-        case PivotFunc::StdVarP:  return OUString("VarP");
+        case PivotFunc::Sum:        nStrId = STR_FUN_TEXT_SUM;      break;
+        case PivotFunc::Count:      nStrId = STR_FUN_TEXT_COUNT;    break;
+        case PivotFunc::Average:    nStrId = STR_FUN_TEXT_AVG;      break;
+        case PivotFunc::Max:        nStrId = STR_FUN_TEXT_MAX;      break;
+        case PivotFunc::Min:        nStrId = STR_FUN_TEXT_MIN;      break;
+        case PivotFunc::Product:    nStrId = STR_FUN_TEXT_PRODUCT;  break;
+        case PivotFunc::CountNum:   nStrId = STR_FUN_TEXT_COUNT;    break;
+        case PivotFunc::StdDev:     nStrId = STR_FUN_TEXT_STDDEV;   break;
+        case PivotFunc::StdDevP:    nStrId = STR_FUN_TEXT_STDDEV;   break;
+        case PivotFunc::StdVar:     nStrId = STR_FUN_TEXT_VAR;      break;
+        case PivotFunc::StdVarP:    nStrId = STR_FUN_TEXT_VAR;      break;
         default:
+            assert(false);
             break;
     }
-    return OUString();
+    if (nStrId != 0)
+        return ScGlobal::GetRscString(nStrId);
+    else
+        return OUString();
 }
 
 OUString lclCreateDataItemName(const PivotFunc nFunctionMask, const OUString& rName, const sal_uInt8 nDuplicationCount)
commit 8609e8113520ea1130a2f5a97b383e8040301ecf
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Thu Nov 3 11:32:25 2016 +0100

    Remove some unused resource strings
    
    Change-Id: I8529aa491d37aef5e732909357ddf93372dde6d2

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 9c94a7c..5833436 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -106,17 +106,6 @@
 #define STR_BOX_YNI                 66
 #define STR_NO_REF_TABLE            67
 
-#define STR_PIVOTFUNC_SUM           68  // pivot.cxx
-#define STR_PIVOTFUNC_COUNT         69
-#define STR_PIVOTFUNC_AVG           70
-#define STR_PIVOTFUNC_MAX           71
-#define STR_PIVOTFUNC_MIN           72
-#define STR_PIVOTFUNC_PROD          73
-#define STR_PIVOTFUNC_COUNT2        74
-#define STR_PIVOTFUNC_STDDEV        75
-#define STR_PIVOTFUNC_STDDEV2       76
-#define STR_PIVOTFUNC_VAR           77
-#define STR_PIVOTFUNC_VAR2          78
 #define STR_PIVOT_TOTAL             79
 #define STR_PIVOT_DATA              80
 
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 27ef036..241254b 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -533,50 +533,6 @@ Resource RID_GLOBSTR
     {
         Text [ en-US ] = "Group" ;
     };
-    String STR_PIVOTFUNC_SUM
-    {
-        Text [ en-US ] = "SUM" ;
-    };
-    String STR_PIVOTFUNC_COUNT
-    {
-        Text [ en-US ] = "COUNT" ;
-    };
-    String STR_PIVOTFUNC_AVG
-    {
-        Text [ en-US ] = "AVERAGE" ;
-    };
-    String STR_PIVOTFUNC_MAX
-    {
-        Text [ en-US ] = "MAX" ;
-    };
-    String STR_PIVOTFUNC_MIN
-    {
-        Text [ en-US ] = "MIN" ;
-    };
-    String STR_PIVOTFUNC_PROD
-    {
-        Text [ en-US ] = "PRODUCT" ;
-    };
-    String STR_PIVOTFUNC_COUNT2
-    {
-        Text [ en-US ] = "COUNTA" ;
-    };
-    String STR_PIVOTFUNC_STDDEV
-    {
-        Text [ en-US ] = "STDEV" ;
-    };
-    String STR_PIVOTFUNC_STDDEV2
-    {
-        Text [ en-US ] = "STDEVP" ;
-    };
-    String STR_PIVOTFUNC_VAR
-    {
-        Text [ en-US ] = "VAR" ;
-    };
-    String STR_PIVOTFUNC_VAR2
-    {
-        Text [ en-US ] = "VARP" ;
-    };
     String STR_TABLE
     {
         Text [ en-US ] = "Sheet" ;
commit 1b3504d6a3bedf421923e4860a3c04adb148375b
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Thu Nov 3 02:05:46 2016 +0100

    Remove unused macro
    
    Change-Id: I407217703d285fc858208cbcdfae0fe84a30fcee

diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index e6ca2c2..7c82541 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -22,8 +22,6 @@
 
 #include <o3tl/typed_flags_set.hxx>
 
-#define     PIVOT_MAXFUNC           11
-
 enum class PivotFunc {
     NONE         = 0x0000,
     Sum          = 0x0001,
commit 4d73205ae4227a90d2087153c6fc82a51ea513ae
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Nov 19 19:32:04 2016 +0100

    strip now obsolete comment part
    
    ... but keep the SdrDelayBroadcastObjectChange as it still serves during
    copying notes/captions.
    
    Change-Id: I8cf6a8045238af8d196a304ca4dfe20d4e407624

diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 623a199..27dfb65 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -640,9 +640,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
             ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData );
             if( maNoteData.mpCaption )
             {
-                // Prevent triple change broadcasts of the same object, which
-                // during Save triggered by ScDocument::CreateAllNoteCaptions()
-                // creates a major performance bottleneck.
+                // Prevent triple change broadcasts of the same object.
                 SdrDelayBroadcastObjectChange aDelayChange( *maNoteData.mpCaption);
 
                 ScCaptionInitData& rInitData = *maNoteData.mxInitData;
commit 190495509e7830a5df12d002c56222209edc348d
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Nov 19 19:28:14 2016 +0100

    sc-perf: lock drawing layer during creation of captions for Save
    
    This gives an extra boost compared to commit
    451c4cccc7e3ec3f1e046d3232cb52f6fc443f59 (see there for further details)
    as it eliminates broadcasts to accessibility and thus obtaining text forwarders
    and what not.
    
    ScPostIt::CreateCaptionFromInitData() compared to that commit
    from 145,055,889,118
    to    63,386,691,509
    
    Overall ScDocShell::SaveXML() from original state before that commit
    Before: 370,433,720,090
     After: 107,468,180,524
    
    Reduced to 29% or speed-up by factor 3.45
    
    Change-Id: Ife86476c9654739ed9adf25e775f7568ea9934c2

diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 7aa54c0..f170f31 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -719,8 +719,22 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC
 
 bool ScXMLImportWrapper::Export(bool bStylesOnly)
 {
+    // Prevent all broadcasting and repaints and notification of accessibility
+    // during mass creation of captions, which is a major bottleneck and not
+    // needed during Save.
+    ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+    bool bOldLock = bool();
+    if (pDrawLayer)
+    {
+        bOldLock = pDrawLayer->isLocked();
+        pDrawLayer->setLock(true);
+    }
+
     rDoc.CreateAllNoteCaptions();
 
+    if (pDrawLayer)
+        pDrawLayer->setLock(bOldLock);
+
     uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
 
     uno::Reference<xml::sax::XWriter> xWriter = xml::sax::Writer::create(xContext);
commit 4c46c3046fb922f65b562e893e59d6b67ea5b2c2
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sat Nov 19 19:58:42 2016 +0200

    We don’t use this with the new layout engine
    
    Don’t wast time parsing GSUB table to populate a vector that we won’t
    use.
    
    Change-Id: I74dbb0f4d679cf06f22c1667899bcd3cae22c1d8

diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 7ef42b8..e398257 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -508,7 +508,8 @@ FreetypeFont::FreetypeFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI
 
     mbFaceOk = true;
 
-    ApplyGSUB( rFSD );
+    if (!SalLayout::UseCommonLayout())
+        ApplyGSUB( rFSD );
 
     // TODO: query GASP table for load flags
     mnLoadFlags = FT_LOAD_DEFAULT;
commit afc37372c1e1e8a865a4ad91a4b998e861ad9f02
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Nov 19 10:56:40 2016 +0800

    tdf#92076 oox - export PolyPolygonShape and PolyLineShape.
    
    1. Export PolyPolygonShape and PolyLineShape.
    2. Rename WriteBezierShape to WritePolyPolygonShape because
    ClosedBezierShape, OpenBezierShape, PolyPolygonShape,and
    PolyLineShape share the function and all use
    EscherPropertyContainer::GetPolyPolygon to get PolyPolygon
    structure and use WritePolyPolygon to write xml tags.
    
    Change-Id: I9ffdc26cf1f6fe8ea3b91b7b218d67f9e5585617
    Reviewed-on: https://gerrit.libreoffice.org/30972
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index d6ae615..fad3664 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -134,9 +134,9 @@ public:
     static bool         NonEmptyText( const css::uno::Reference< css::uno::XInterface >& xIface );
 
     ShapeExport&
-                        WriteBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
+                        WritePolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
     ShapeExport&
-                        WriteClosedBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+                        WriteClosedPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
                         WriteConnectorShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
@@ -154,7 +154,7 @@ public:
     virtual ShapeExport&
                         WriteNonVisualProperties( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
-                        WriteOpenBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+                        WriteOpenPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
                         WriteRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape );
 
@@ -171,12 +171,14 @@ public:
      *
      * <table>
      *   <tr><th>Shape Type</th><th>Method</th></tr>
-     *   <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td>    <td>ShapeExport::WriteClosedBezierShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td>    <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td>          <td>ShapeExport::WriteCustomShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td>         <td>ShapeExport::WriteEllipseShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td>   <td>ShapeExport::WriteGraphicObjectShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.LineShape</tt></td>            <td>ShapeExport::WriteLineShape</td></tr>
-     *   <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td>      <td>ShapeExport::WriteOpenBezierShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td>      <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.PolyPolygonShape</tt></td>      <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.PolyLineShape</tt></td>      <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td>       <td>ShapeExport::WriteRectangleShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.TableShape</tt></td>           <td>ShapeExport::WriteTableShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.TextShape</tt></td>            <td>ShapeExport::WriteTextShape</td></tr>
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c9d693c..820cb4c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -428,9 +428,9 @@ bool ShapeExport::NonEmptyText( const Reference< XInterface >& xIface )
     return false;
 }
 
-ShapeExport& ShapeExport::WriteBezierShape( const Reference< XShape >& xShape, bool bClosed )
+ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& xShape, bool bClosed )
 {
-    SAL_INFO("oox.shape", "write open bezier shape");
+    SAL_INFO("oox.shape", "write polypolygon shape");
 
     FSHelperPtr pFS = GetFS();
     pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
@@ -481,14 +481,14 @@ ShapeExport& ShapeExport::WriteBezierShape( const Reference< XShape >& xShape, b
     return *this;
 }
 
-ShapeExport& ShapeExport::WriteClosedBezierShape( const Reference< XShape >& xShape )
+ShapeExport& ShapeExport::WriteClosedPolyPolygonShape( const Reference< XShape >& xShape )
 {
-    return WriteBezierShape( xShape, true );
+    return WritePolyPolygonShape( xShape, true );
 }
 
-ShapeExport& ShapeExport::WriteOpenBezierShape( const Reference< XShape >& xShape )
+ShapeExport& ShapeExport::WriteOpenPolyPolygonShape( const Reference< XShape >& xShape )
 {
-    return WriteBezierShape( xShape, false );
+    return WritePolyPolygonShape( xShape, false );
 }
 
 ShapeExport& ShapeExport::WriteGroupShape(const uno::Reference<drawing::XShape>& xShape)
@@ -1388,13 +1388,15 @@ static const NameToConvertMapType& lcl_GetConverters(DocumentType eDocumentType)
         return shape_converters;
     }
 
-    shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ]        = &ShapeExport::WriteClosedBezierShape;
+    shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ]        = &ShapeExport::WriteClosedPolyPolygonShape;
     shape_converters[ "com.sun.star.drawing.ConnectorShape" ]           = &ShapeExport::WriteConnectorShape;
     shape_converters[ "com.sun.star.drawing.CustomShape" ]              = &ShapeExport::WriteCustomShape;
     shape_converters[ "com.sun.star.drawing.EllipseShape" ]             = &ShapeExport::WriteEllipseShape;
     shape_converters[ "com.sun.star.drawing.GraphicObjectShape" ]       = &ShapeExport::WriteGraphicObjectShape;
     shape_converters[ "com.sun.star.drawing.LineShape" ]                = &ShapeExport::WriteLineShape;
-    shape_converters[ "com.sun.star.drawing.OpenBezierShape" ]          = &ShapeExport::WriteOpenBezierShape;
+    shape_converters[ "com.sun.star.drawing.OpenBezierShape" ]          = &ShapeExport::WriteOpenPolyPolygonShape;
+    shape_converters[ "com.sun.star.drawing.PolyPolygonShape" ]          = &ShapeExport::WriteClosedPolyPolygonShape;
+    shape_converters[ "com.sun.star.drawing.PolyLineShape" ]          = &ShapeExport::WriteClosedPolyPolygonShape;
     shape_converters[ "com.sun.star.drawing.RectangleShape" ]           = &ShapeExport::WriteRectangleShape;
     shape_converters[ "com.sun.star.drawing.OLE2Shape" ]                = &ShapeExport::WriteOLE2Shape;
     shape_converters[ "com.sun.star.drawing.TableShape" ]               = &ShapeExport::WriteTableShape;
diff --git a/sd/qa/unit/data/odp/tdf92076.odp b/sd/qa/unit/data/odp/tdf92076.odp
new file mode 100755
index 0000000..ab0a20b
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf92076.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 03cff30..26e5685 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -101,6 +101,7 @@ public:
     void testExtFileField();
     void testAuthorField();
     void testTdf99224();
+    void testTdf92076();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -125,6 +126,7 @@ public:
     CPPUNIT_TEST(testExtFileField);
     CPPUNIT_TEST(testAuthorField);
     CPPUNIT_TEST(testTdf99224);
+    CPPUNIT_TEST(testTdf92076);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -736,6 +738,15 @@ void SdOOXMLExportTest2::testTdf99224()
     xShell->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf92076()
+{
+    sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf92076.odp"), ODP);
+    xShell = saveAndReload(xShell.get(), PPTX);
+    uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xPage->getCount());
+    xShell->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit dfee3a97a0bd30e461974af4ecb09f67bded584d
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Fri Nov 18 15:44:39 2016 +0100

    tdf#48140 Remove not used UNO headers from filters
    
    Change-Id: I66e775b60343fe8ac772d8c0287ca19be58a7236
    Reviewed-on: https://gerrit.libreoffice.org/30966
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/inc/formulabuffer.hxx b/sc/source/filter/inc/formulabuffer.hxx
index 692fff2..d52f2d6 100644
--- a/sc/source/filter/inc/formulabuffer.hxx
+++ b/sc/source/filter/inc/formulabuffer.hxx
@@ -25,7 +25,6 @@
 #include <vector>
 #include "worksheethelper.hxx"
 #include "sheetdatabuffer.hxx"
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
 
 namespace oox { namespace xls {
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index f08f8b6..1d0dd13 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -20,7 +20,6 @@
 #include "condformatbuffer.hxx"
 
 #include <com/sun/star/sheet/ConditionOperator2.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/table/CellRangeAddress.hpp>
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 18c0aeb..79457ab 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -24,7 +24,6 @@
 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
 #include <com/sun/star/sheet/ReferenceFlags.hpp>
 #include <com/sun/star/sheet/SingleReference.hpp>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
 #include <com/sun/star/sheet/XPrintAreas.hpp>
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index f2aff25..003d0b9 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -10,11 +10,6 @@
 #include "formulabuffer.hxx"
 #include "formulaparser.hxx"
 #include <externallinkbuffer.hxx>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/table/XCell2.hpp>
 #include "formulacell.hxx"
 #include "document.hxx"
 #include "documentimport.hxx"
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index fd4c9f1..44a0e02 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -22,7 +22,6 @@
 #include <algorithm>
 #include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
 #include <com/sun/star/sheet/XCellRangeData.hpp>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
 #include <com/sun/star/sheet/XMultipleOperation.hpp>
 #include <com/sun/star/table/XCell.hpp>
 #include <com/sun/star/text/XText.hpp>
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 78b7686..53ae02f 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -19,7 +19,6 @@
 
 #include "workbookfragment.hxx"
 
-#include <com/sun/star/table/CellAddress.hpp>
 #include <oox/core/filterbase.hxx>
 #include <oox/core/xmlfilterbase.hxx>
 #include <oox/drawingml/themefragmenthandler.hxx>
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 580b430..8cd46ed 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -21,17 +21,13 @@
 
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/document/XActionLockable.hpp>
 #include <com/sun/star/sheet/XDatabaseRange.hpp>
 #include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
 #include <com/sun/star/style/XStyle.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <osl/thread.h>
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 5d20156..450283a 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -25,14 +25,11 @@
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/sheet/TableValidationVisibility.hpp>
 #include <com/sun/star/sheet/ValidationType.hpp>
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/XCellAddressable.hpp>
 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
 #include <com/sun/star/sheet/XSheetCondition2.hpp>
@@ -40,7 +37,6 @@
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/table/XColumnRowRange.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
-#include <com/sun/star/text/XText.hpp>
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
 #include <oox/core/filterbase.hxx>
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 991355d..85f8067 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -69,8 +69,6 @@
 #include "patattr.hxx"
 #include "tabprotection.hxx"
 
-#include <com/sun/star/sheet/XCellAddressable.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
 #include <com/sun/star/embed/Aspects.hpp>
 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.hxx b/sc/source/filter/xml/XMLTableShapeResizer.hxx
index bead339..f154bb3 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.hxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.hxx
@@ -21,8 +21,6 @@
 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLTABLESHAPERESIZER_HXX
 
 #include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <list>
 
 class ScXMLImport;
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 6ac6a4c..851101e 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -91,27 +91,12 @@
 #include <svtools/miscopt.hxx>
 #include <sax/tools/converter.hxx>
 
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-
-#include <com/sun/star/sheet/XSheetCondition.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
 #include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/util/NumberFormat.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormatTypes.hpp>
 #include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/text/ControlCharacter.hpp>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/document/XActionLockable.hpp>
 
 #include <com/sun/star/sheet/ValidationType.hpp>
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-#include <com/sun/star/sheet/ConditionOperator.hpp>
 
 #include <rtl/ustrbuf.hxx>
 #include <tools/date.hxx>
diff --git a/sc/source/filter/xml/xmldrani.hxx b/sc/source/filter/xml/xmldrani.hxx
index 8c47371..a22339a 100644
--- a/sc/source/filter/xml/xmldrani.hxx
+++ b/sc/source/filter/xml/xmldrani.hxx
@@ -23,10 +23,7 @@
 #include <xmloff/xmlimp.hxx>
 #include <com/sun/star/sheet/DataImportMode.hpp>
 #include <com/sun/star/sheet/SubTotalColumn.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/sheet/TableFilterField2.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/table/CellRangeAddress.hpp>
 #include <com/sun/star/table/TableOrientation.hpp>
 
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 7e40ae1..90ef0ff 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -23,8 +23,6 @@
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 
 #include "address.hxx"
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index b2eec2a..317fad7 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -37,7 +37,6 @@
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/ValidationType.hpp>
 #include <com/sun/star/sheet/ConditionOperator.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 723b1f1..2a66bde 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -33,13 +33,10 @@
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/families.hxx>
 #include <xmloff/xmltoken.hxx>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/table/XColumnRowRange.hpp>
 #include <com/sun/star/sheet/XPrintAreas.hpp>
 
-#include <com/sun/star/table/CellAddress.hpp>
-
 #define SC_ISFILTERED "IsFiltered"
 
 using namespace com::sun::star;
diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx
index 83a93b7..48f7a92 100644
--- a/sc/source/filter/xml/xmlsubti.hxx
+++ b/sc/source/filter/xml/xmlsubti.hxx
@@ -23,10 +23,7 @@
 #include <xmloff/xmlimp.hxx>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/frame/XModel.hpp>
 
 #include "XMLTableShapeResizer.hxx"
 #include <formula/grammar.hxx>
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 98837dd..162bacd 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -43,12 +43,6 @@
 
 #include <tools/urlobj.hxx>
 
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XPrintAreas.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-
 using namespace com::sun::star;
 using namespace xmloff::token;
 using ::com::sun::star::uno::Reference;
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 6af4446..718af05 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1640,7 +1640,7 @@ void ScDatabaseRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     }
 }
 
-// Hilfsfuntionen
+// Help functions
 
 ScDBData* ScDatabaseRangeObj::GetDBData_Impl() const
 {
commit 7a072614b234529d24515464c3f6575bb33480e5
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sat Nov 19 15:35:59 2016 +0200

    Typos
    
    Change-Id: Iff293841047a945107033ed81d4e81fb8bbe67b8

diff --git a/extras/source/truetype/symbol/README b/extras/source/truetype/symbol/README
index b69b721..80d8975 100644
--- a/extras/source/truetype/symbol/README
+++ b/extras/source/truetype/symbol/README
@@ -9,7 +9,7 @@ important so that when two versions of the font are installed, e.g.  one
 bundled inside the office installation, and one already installed on the system
 that the most recent font can be detected and favoured.
 
-Bumping the font version is easiest done manually by bumping the the place in
+Bumping the font version is easiest done manually by bumping the place in
 the .sfd where the version is mentioned, e.g.
 
 -Version: 102.3
@@ -21,5 +21,5 @@ The glyph names in the font should follow Adobe Glyph list for new fonts
 
 Fragments of OpenSymbol are mapped internally to a number of other
 fonts for interoperability purposes. See
-unotools/source/misc/fontcvt.cxx pwrt.  the StarSymbol conversion
-tables.
\ No newline at end of file
+unotools/source/misc/fontcvt.cxx pwrt, the StarSymbol conversion
+tables.
commit d35b5c8db00afb0316b7ae4c43126a5dad194cbb
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sat Nov 19 15:07:03 2016 +0200

    tdf#103891: Fix DX array calculation
    
    This partially reverts:
    
    commit c49d5dea164b09b05a898495fa2dd48b7ca4f0e4
    Author: Khaled Hosny <khaledhosny at eglug.org>
    Date:   Fri Nov 11 18:24:11 2016 +0200
    
        tdf#103765: Minimize the effect of rounding to int
    
        Instead of scaling the relative coordinates and accumulating rounding
        errors, scale the absolute coordinates. Also round to int instead of
        truncating.
    
    as it results in OutputDevice::GetTextArray() calculating wrong absolute
    DX array. Again the whole DX array thing is brain dead.
    
    Change-Id: Ia257b73062315b797b5ed52e434562fad3b3fb90

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 9ad1967..b9240e7 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -595,11 +595,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
                     nYOffset = -pHbPositions[i].y_offset;
                 }
 
-                Point aNewPos(lround((aCurrPos.X() + nXOffset) * nXScale),
-                              lround((aCurrPos.Y() + nYOffset) * nYScale));
+                nAdvance *= nXScale;
+                nXOffset *= nXScale;
+                nYOffset *= nYScale;
+
+                Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + nYOffset);
                 const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags,
-                                    lround(nAdvance * nXScale),
-                                    lround(nXOffset * nXScale));
+                                    nAdvance, nXOffset);
                 AppendGlyph(aGI);
 
                 aCurrPos.X() += nAdvance;
commit 9ead6f58501f29ee690cc44195fd5bf229dfbb7d
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Fri Nov 18 17:58:26 2016 +0100

    LOK - Calc: unit test for invalidation on row insert
    
    Change-Id: I999bcef29b90fafcd803243a967fcb8109e61db8
    Reviewed-on: https://gerrit.libreoffice.org/30978
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 0ea0431..b6e8b40 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -69,6 +69,7 @@ public:
     void testAutoSum();
     void testHideColRow();
     void testInvalidateOnCopyPasteCells();
+    void testInvalidateOnInserRowCol();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -89,6 +90,7 @@ public:
     CPPUNIT_TEST(testAutoSum);
     CPPUNIT_TEST(testHideColRow);
     CPPUNIT_TEST(testInvalidateOnCopyPasteCells);
+    CPPUNIT_TEST(testInvalidateOnInserRowCol);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -939,6 +941,7 @@ void ScTiledRenderingTest::testHideColRow()
     mxComponent.clear();
     comphelper::LibreOfficeKit::setActive(false);
 }
+
 void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
 {
     // Load a document
@@ -950,7 +953,6 @@ void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
     ViewCallback aView;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
 
-    aView.m_bInvalidateTiles = false;
     uno::Sequence<beans::PropertyValue> aArgs;
     // select and copy cells
     pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_HOME | KEY_MOD1);
@@ -981,6 +983,52 @@ void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
     mxComponent.clear();
     comphelper::LibreOfficeKit::setActive(false);
 }
+
+void ScTiledRenderingTest::testInvalidateOnInserRowCol()
+{
+    // Load a document
+    comphelper::LibreOfficeKit::setActive();
+    ScModelObj* pModelObj = createDoc("small.ods");
+    CPPUNIT_ASSERT(pModelObj);
+
+    // view
+    ViewCallback aView;
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
+
+    uno::Sequence<beans::PropertyValue> aArgs;
+    // move downward
+    for (int i = 0; i < 200; ++i)
+    {
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN);
+    }
+    Scheduler::ProcessEventsToIdle();
+
+    // insert row
+    aView.m_bInvalidateTiles = false;
+    comphelper::dispatchCommand(".uno:InsertRows", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
+
+    // move on the right
+    for (int i = 0; i < 200; ++i)
+    {
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_RIGHT);
+    }
+    Scheduler::ProcessEventsToIdle();
+
+    // insert column
+    aView.m_bInvalidateTiles = false;
+    comphelper::dispatchCommand(".uno:InsertColumns", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
commit 451c4cccc7e3ec3f1e046d3232cb52f6fc443f59
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Nov 19 01:11:21 2016 +0100

    sc-perf: bundle SdrObject::BroadcastObjectChange() calls during Save
    
    Test doc https://bugs.documentfoundation.org/attachment.cgi?id=128252 from
    https://bugs.documentfoundation.org/show_bug.cgi?id=103493
    
    ScPostIt::CreateCaptionFromInitData() called through
    ScDocument::CreateAllNoteCaptions()
    
              Incl.     Self  Called
    Before:
    326,418,830,114  487,308   6,645
    After:
    145,055,889,118  511,681   6,645
    
    Reduced to 44% or speed-up by factor 2.25
    
    Overall ScDocShell::SaveXML()
    Before: 370,433,720,090
     After: 189,120,982,786
    
    Reduced to 51% or speed-up by factor 1.96
    
    There's still too much broadcasting to accessibility going on though..
    
    Change-Id: I50555fd9751ac24006cc96b2fa8e82b32aba0748

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 4855868..b398a19 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -295,6 +295,7 @@ private:
     friend class                SdrObjListIter;
     friend class                SdrVirtObj;
     friend class                SdrRectObj;
+    friend class                SdrDelayBroadcastObjectChange;
 
 protected:
     Rectangle                   aOutRect;     // surrounding rectangle for Paint (incl. LineWdt, ...)
@@ -351,6 +352,11 @@ protected:
     // #i25616#
     bool                        mbSupportTextIndentingOnLineWidthChange : 1;
 
+private:
+    bool                        mbDelayBroadcastObjectChange : 1;
+    mutable bool                mbBroadcastObjectChangePending : 1;
+
+protected:
     // on import of OLE object from MS documents the BLIP size might be retrieved,
     // in this case the following member is initialized as nonempty rectangle
     Rectangle                   maBLIPSizeRectangle;
@@ -968,6 +974,20 @@ private:
     bool mbDoNotInsertIntoPageAutomatically;
 };
 
+/** Suppress BroadcastObjectChange() until destruction of the (last) instance.
+    Prevents multiple broadcasts for a sequence of calls that would trigger a
+    broadcast each. Instances may be nested in levels, the outer instance will
+    trigger the final broadcast.
+ */
+class SVX_DLLPUBLIC SdrDelayBroadcastObjectChange
+{
+    SdrObject&  mrObj;
+    bool        mbOldDelayBroadcastObjectChange;
+public:
+    SdrDelayBroadcastObjectChange( SdrObject& rObj );
+    ~SdrDelayBroadcastObjectChange();
+};
+
 struct SdrObjCreatorParams
 {
     sal_uInt32 nInventor;
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 18da0ce..623a199 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -640,6 +640,11 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
             ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData );
             if( maNoteData.mpCaption )
             {
+                // Prevent triple change broadcasts of the same object, which
+                // during Save triggered by ScDocument::CreateAllNoteCaptions()
+                // creates a major performance bottleneck.
+                SdrDelayBroadcastObjectChange aDelayChange( *maNoteData.mpCaption);
+
                 ScCaptionInitData& rInitData = *maNoteData.mxInitData;
 
                 // transfer ownership of outliner object to caption, or set simple text
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f87ecd1..0f3de29 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -302,6 +302,8 @@ SdrObject::SdrObject() :
     ,pGrabBagItem(nullptr)
     ,mnNavigationPosition(SAL_MAX_UINT32)
     ,mnLayerID(0)
+    ,mbDelayBroadcastObjectChange(false)
+    ,mbBroadcastObjectChangePending(false)
     ,mpSvxShape( nullptr )
     ,maWeakUnoShape()
     ,mbDoNotInsertIntoPageAutomatically(false)
@@ -880,6 +882,12 @@ void SdrObject::BroadcastObjectChange() const
     if( pModel && pModel->isLocked() )
         return;
 
+    if (mbDelayBroadcastObjectChange)
+    {
+        mbBroadcastObjectChangePending = true;
+        return;
+    }
+
     bool bPlusDataBroadcast(pPlusData && pPlusData->pBroadcast);
     bool bObjectChange(IsInserted() && pModel);
 
@@ -3092,6 +3100,27 @@ bool SdrObject::HasText() const
     return false;
 }
 
+
+SdrDelayBroadcastObjectChange::SdrDelayBroadcastObjectChange( SdrObject& rObj ) :
+    mrObj(rObj), mbOldDelayBroadcastObjectChange( rObj.mbDelayBroadcastObjectChange)
+{
+    mrObj.mbDelayBroadcastObjectChange = true;
+}
+
+SdrDelayBroadcastObjectChange::~SdrDelayBroadcastObjectChange()
+{
+    if (!mbOldDelayBroadcastObjectChange)
+    {
+        mrObj.mbDelayBroadcastObjectChange = false;
+        if (mrObj.mbBroadcastObjectChangePending)
+        {
+            mrObj.mbBroadcastObjectChangePending = false;
+            mrObj.BroadcastObjectChange();
+        }
+    }
+}
+
+
 SdrObject* SdrObjFactory::CreateObjectFromFactory( sal_uInt32 nInventor, sal_uInt16 nObjIdentifier, SdrPage* , SdrModel*  )
 {
     SdrObjCreatorParams aParams { nInventor, nObjIdentifier };
commit 87c67a4ad344cf1b7c7c9f89f2362cc82901aec3
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu Nov 17 22:03:34 2016 +0100

    LOK - Calc: unit test for invalidation on copy/paste to the doc bottom
    
    Change-Id: I92b6a3f1c3b3c6c260b25b046bd19b249be0db0b
    Reviewed-on: https://gerrit.libreoffice.org/30977
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 9aa5115..0ea0431 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -68,6 +68,7 @@ public:
     void testGraphicInvalidate();
     void testAutoSum();
     void testHideColRow();
+    void testInvalidateOnCopyPasteCells();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -87,6 +88,7 @@ public:
     CPPUNIT_TEST(testGraphicInvalidate);
     CPPUNIT_TEST(testAutoSum);
     CPPUNIT_TEST(testHideColRow);
+    CPPUNIT_TEST(testInvalidateOnCopyPasteCells);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -937,6 +939,48 @@ void ScTiledRenderingTest::testHideColRow()
     mxComponent.clear();
     comphelper::LibreOfficeKit::setActive(false);
 }
+void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
+{
+    // Load a document
+    comphelper::LibreOfficeKit::setActive();
+    ScModelObj* pModelObj = createDoc("small.ods");
+    CPPUNIT_ASSERT(pModelObj);
+
+    // view
+    ViewCallback aView;
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
+
+    aView.m_bInvalidateTiles = false;
+    uno::Sequence<beans::PropertyValue> aArgs;
+    // select and copy cells
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_HOME | KEY_MOD1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_HOME | KEY_MOD1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_SHIFT);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_SHIFT);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT | KEY_SHIFT);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_RIGHT | KEY_SHIFT);
+    Scheduler::ProcessEventsToIdle();
+    comphelper::dispatchCommand(".uno:Copy", aArgs);
+
+    // move to destination cell
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_MOD1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_MOD1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_UP);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_UP);
+    Scheduler::ProcessEventsToIdle();
+
+    // paste cells
+    aView.m_bInvalidateTiles = false;
+    comphelper::dispatchCommand(".uno:Paste", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
commit 580c2072923f7d29ce27595543f2d2749af83cf9
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu Nov 17 12:50:19 2016 +0100

    LOK - Calc: use the tiled rendering area as visible area in PaintArea
    
    This workaround is needed since the visible area in core is not the
    same which is used in the client.
    
    Change-Id: I82b23e689000c4d8106ffa01ed082ae3d629b1be
    Reviewed-on: https://gerrit.libreoffice.org/30976
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 41a0679..d73c9bd 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2220,24 +2220,38 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
         nCol2 = nEndCol;
         nRow2 = nEndRow;
 
-        SCCOL nScrX = aViewData.GetPosX( eHWhich );
-        SCROW nScrY = aViewData.GetPosY( eVWhich );
-        if (nCol1 < nScrX)
-            nCol1 = nScrX;
-        if (nCol2 < nScrX)
+        SCCOL nLastX = 0;
+        SCROW nLastY = 0;
+
+        if (comphelper::LibreOfficeKit::isActive())
         {
-            if ( eMode == SC_UPDATE_ALL )   // for UPDATE_ALL, paint anyway
-                nCol2 = nScrX;              // (because of extending strings to the right)
-            else
-                bOut = true;                // completely outside the window
+            nLastX = aViewData.GetMaxTiledCol();
+            nLastY = aViewData.GetMaxTiledRow();
+        }
+        else
+        {
+
+            SCCOL nScrX = aViewData.GetPosX( eHWhich );
+            SCROW nScrY = aViewData.GetPosY( eVWhich );
+
+            if (nCol1 < nScrX)
+                nCol1 = nScrX;
+            if (nCol2 < nScrX)
+            {
+                if ( eMode == SC_UPDATE_ALL )   // for UPDATE_ALL, paint anyway
+                    nCol2 = nScrX;              // (because of extending strings to the right)
+                else
+                    bOut = true;                // completely outside the window
+            }
+            if (nRow1 < nScrY)
+                nRow1 = nScrY;
+            if (nRow2 < nScrY)
+                bOut = true;
+
+            nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
+            nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
         }
-        if (nRow1 < nScrY)
-            nRow1 = nScrY;
-        if (nRow2 < nScrY)
-            bOut = true;
 
-        SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
-        SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
         if (nCol1 > nLastX)
             bOut = true;
         if (nCol2 > nLastX)
commit 6a1f0ec26cf5ff2cbd83a074774d324c9f751217
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu Nov 17 12:42:34 2016 +0100

    LOK - calc: now PgUp/PgDn offset is used only when PgUp/PgDn are pressed
    
    Change-Id: I340d747021bc794361d6b8eff76335345b60010c
    Reviewed-on: https://gerrit.libreoffice.org/30975
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 9323dad..1a62a90 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -434,6 +434,7 @@ public:
 
     /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
     void ForcePageUpDownOffset(long nTwips) { m_nLOKPageUpDownOffset = nTwips; }
+    long GetPageUpDownOffset() { return m_nLOKPageUpDownOffset; }
 
     void            KillEditView();
     void            ResetEditView();
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 275002c..16ad080 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -45,6 +45,7 @@
 #include "tabprotection.hxx"
 #include "markdata.hxx"
 #include "inputopt.hxx"
+#include <comphelper/lok.hxx>
 
 namespace {
 
@@ -628,6 +629,11 @@ void ScTabView::GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPage
     ScHSplitPos eWhichX = WhichH( eWhich );
     ScVSplitPos eWhichY = WhichV( eWhich );
 
+    sal_uInt16 nScrSizeY = SC_SIZE_NONE;
+    if (comphelper::LibreOfficeKit::isActive() && aViewData.GetPageUpDownOffset() > 0) {
+        nScrSizeY = ScViewData::ToPixel( aViewData.GetPageUpDownOffset(), aViewData.GetPPTX() );
+    }
+
     SCsCOL nPageX;
     SCsROW nPageY;
     if (nMovX >= 0)
@@ -636,9 +642,9 @@ void ScTabView::GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPage
         nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, -1, eWhichX )) * nMovX;
 
     if (nMovY >= 0)
-        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY )) * nMovY;
+        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY, nScrSizeY )) * nMovY;
     else
-        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY )) * nMovY;
+        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY, nScrSizeY )) * nMovY;
 
     if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
     if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index b37af92..c611191 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1763,11 +1763,6 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_
 
     if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height();
 
-    if (comphelper::LibreOfficeKit::isActive() && m_nLOKPageUpDownOffset > 0)
-    {
-        nScrSizeY = ToPixel( m_nLOKPageUpDownOffset, nPPTY );
-    }
-
     SCROW nY;
 
     if (nDir==1)
commit f533b3f39956fe8028c1f7f7cc3c37b0feed8b57
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Nov 18 17:10:44 2016 +0900

    tdf#103500 Import stretchy integral symbol from MathML
    
    as "intd".
    
    Change-Id: Ic8a4feef7a3a19c8ed5bca2f09f80901e2b6d343
    Reviewed-on: https://gerrit.libreoffice.org/30953
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/qa/extras/data/tdf103500.mml b/starmath/qa/extras/data/tdf103500.mml
new file mode 100644
index 0000000..7c49669
--- /dev/null
+++ b/starmath/qa/extras/data/tdf103500.mml
@@ -0,0 +1,41 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+  <mrow>
+    <mrow>
+      <munderover>
+        <mo stretchy="false">∫</mo>
+        <mi>a</mi>
+        <mi>b</mi>
+      </munderover>
+      <mrow>
+        <mfrac>
+          <mn>1</mn>
+          <mi>x</mi>
+        </mfrac>
+        <mspace width="0.5em"/>
+        <mstyle mathvariant="normal">
+          <mi mathvariant="normal">d</mi>
+        </mstyle>
+        <mi>x</mi>
+      </mrow>
+    </mrow>
+    <mo stretchy="false">=</mo>
+    <mrow>
+      <munderover>
+        <mo stretchy="true">∫</mo>
+        <mi>a</mi>
+        <mi>b</mi>
+      </munderover>
+      <mrow>
+        <mfrac>
+          <mn>1</mn>
+          <mi>y</mi>
+        </mfrac>
+        <mspace width="0.5em"/>
+        <mstyle mathvariant="normal">
+          <mi mathvariant="normal">d</mi>
+        </mstyle>
+        <mi>y</mi>
+      </mrow>
+    </mrow>
+  </mrow>
+</math>
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index 9bbc08a..3db697f 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -34,6 +34,7 @@ public:
     void testMaction();
     void testMspace();
     void testtdf99556();
+    void testTdf103500();
 
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testSimple);
@@ -41,6 +42,7 @@ public:
     CPPUNIT_TEST(testMaction);
     CPPUNIT_TEST(testMspace);
     CPPUNIT_TEST(testtdf99556);
+    CPPUNIT_TEST(testTdf103500);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -120,6 +122,13 @@ void Test::testtdf99556()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
 }
 
+void Test::testTdf103500()
+{
+    loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103500.mml"));
+    CPPUNIT_ASSERT_EQUAL(OUString("{{ int csub a csup b {1 over x ` d x}} = {intd csub a csup b {1 over y ` d y}}}"),
+                         mxDocShell->GetText());
+}
+
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 3db53a9..fe84e55 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2447,7 +2447,11 @@ void SmMathSymbolNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
 void SmMathSymbolNode::CreateTextFromNode(OUString &rText)
 {
     OUString sStr;
-    MathType::LookupChar(GetToken().cMathChar, sStr, 3);
+    sal_Unicode cChar = GetToken().cMathChar;
+    if (cChar == MS_INT && GetScaleMode() == SCALE_HEIGHT)
+        sStr = "intd ";
+    else
+        MathType::LookupChar(cChar, sStr, 3);
     rText += sStr;
 }
 
commit 8d613870b2cd2e3e4396b4fa97dbd8080fda8f52
Author: Tamás Zolnai <zolnaitamas2000 at gmail.com>
Date:   Fri Nov 18 22:57:29 2016 +0000

    tdf#104015: PPTX import: Title shape does not inherit fill properties
    
    ...from slide master.
    The problem caused by that PPTX files contains not a
    one-level master slide set, but has two levels: one
    called slide master, other called slide layout.
    Slide layout inherit properties from slide master and
    normal slide inherit propetries from slide layout.
    Bug appeared because, slide layout inherited properties
    were not forwarded to the normal slide.
    
    Change-Id: I587582498cf4315087f9a576c1b7fc41ee23e2fd
    Reviewed-on: https://gerrit.libreoffice.org/30969
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 978b71b..67f9a9b 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -125,7 +125,7 @@ public:
 
     table::TablePropertiesPtr const & getTableProperties();
 
-    EffectProperties&               getEffectProperties() { return *mpEffectPropertiesPtr; }
+    EffectProperties&               getEffectProperties() const { return *mpEffectPropertiesPtr; }
 
     void                            setChildPosition( css::awt::Point nPosition ){ maChPosition = nPosition; }
     void                            setChildSize( css::awt::Size aSize ){ maChSize = aSize; }
@@ -258,6 +258,10 @@ protected:
     void                putPropertiesToGrabBag(
                             const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
 
+    FillProperties      getActualFillProperties(const Theme* pTheme, const FillProperties* pParentShapeFillProps) const;
+    LineProperties      getActualLineProperties(const Theme* pTheme) const;
+    EffectProperties    getActualEffectProperties(const Theme* pTheme) const;
+
     std::vector< ShapePtr >     maChildren;               // only used for group shapes
     css::awt::Size   maChSize;                 // only used for group shapes
     css::awt::Point  maChPosition;             // only used for group shapes
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f027cd1..0ee6cef 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -303,11 +303,11 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
     else
         mpTextBody.reset();
     maShapeProperties = rReferencedShape.maShapeProperties;
-    mpShapeRefLinePropPtr = std::make_shared<LineProperties>( *rReferencedShape.mpLinePropertiesPtr.get() );
-    mpShapeRefFillPropPtr = std::make_shared<FillProperties>( *rReferencedShape.mpFillPropertiesPtr.get() );
+    mpShapeRefLinePropPtr = std::make_shared<LineProperties>( rReferencedShape.getActualLineProperties(nullptr) );
+    mpShapeRefFillPropPtr = std::make_shared<FillProperties>( rReferencedShape.getActualFillProperties(nullptr, nullptr) );
     mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr.get() );
     mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : nullptr );
-    mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( *rReferencedShape.mpEffectPropertiesPtr.get() );
+    mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( rReferencedShape.getActualEffectProperties(nullptr) );
     mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle.get() );
     maSize = rReferencedShape.maSize;
     maPosition = rReferencedShape.maPosition;
@@ -654,25 +654,17 @@ Reference< XShape > const & Shape::createAndInsert(
 
         const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
 
-        LineProperties aLineProperties;
-        aLineProperties.maLineFill.moFillType = XML_noFill;
         sal_Int32 nLinePhClr = -1;
-        FillProperties aFillProperties;
-        aFillProperties.moFillType = XML_noFill;
         sal_Int32 nFillPhClr = -1;
-        EffectProperties aEffectProperties;
         // TODO: use ph color when applying effect properties
         //sal_Int32 nEffectPhClr = -1;
 
-        // First apply reference shape's properties (shape on the master slide)
-        aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
-        aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
-        aEffectProperties.assignUsed( *mpShapeRefEffectPropPtr );
-
         if( pTheme )
         {
             if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
             {
+                LineProperties aLineProperties;
+                aLineProperties.maLineFill.moFillType = XML_noFill;
                 if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
                     aLineProperties.assignUsed( *pLineProps );
                 nLinePhClr = pLineRef->maPhClr.getColor( rGraphicHelper );
@@ -690,8 +682,6 @@ Reference< XShape > const & Shape::createAndInsert(
             }
             if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
             {
-                if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
-                    aFillProperties.assignUsed( *pFillProps );
                 nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper );
 
                 OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
@@ -708,8 +698,6 @@ Reference< XShape > const & Shape::createAndInsert(
             }
             if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
             {
-                if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
-                    aEffectProperties.assignUsed( *pEffectProps );
                 // TODO: use ph color when applying effect properties
                 // nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
 
@@ -721,15 +709,6 @@ Reference< XShape > const & Shape::createAndInsert(
                 putPropertyToGrabBag( "StyleEffectRef", Any( aProperties ) );
             }
         }
-
-        aLineProperties.assignUsed( getLineProperties() );
-
-        // group fill inherits from parent
-        if ( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
-            getFillProperties().assignUsed( rShapeOrParentShapeFillProps );
-        aFillProperties.assignUsed( getFillProperties() );
-        aEffectProperties.assignUsed ( getEffectProperties() );
-
         ShapePropertyMap aShapeProps( rFilterBase.getModelObjectHelper() );
 
         // add properties from textbody to shape properties
@@ -749,8 +728,12 @@ Reference< XShape > const & Shape::createAndInsert(
             mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper );
         if ( mpTablePropertiesPtr.get() && aServiceName == "com.sun.star.drawing.TableShape" )
             mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
+
+        FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps);
         aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV );
+        LineProperties aLineProperties = getActualLineProperties(pTheme);
         aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr );
+        EffectProperties aEffectProperties = getActualEffectProperties(pTheme);
         // TODO: use ph color when applying effect properties
         aEffectProperties.pushToPropMap( aShapeProps, rGraphicHelper );
 
@@ -1461,6 +1444,82 @@ void Shape::putPropertiesToGrabBag( const Sequence< PropertyValue >& aProperties
     }
 }
 
+FillProperties Shape::getActualFillProperties(const Theme* pTheme, const FillProperties* pParentShapeFillProps) const
+{
+    FillProperties aFillProperties;
+    aFillProperties.moFillType = XML_noFill;
+
+    // Reference shape properties
+    aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
+
+    // Theme
+    if( pTheme != nullptr )
+    {
+        if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
+        {
+            if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
+                aFillProperties.assignUsed( *pFillProps );
+        }
+    }
+
+    // Parent shape's properties
+    if ( pParentShapeFillProps != nullptr)
+        if( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
+            aFillProperties.assignUsed( *pParentShapeFillProps );
+
+    // Properties specified directly for this shape
+    aFillProperties.assignUsed( getFillProperties() );
+
+    return aFillProperties;
+}
+
+LineProperties Shape::getActualLineProperties(const Theme* pTheme) const
+{
+    LineProperties aLineProperties;
+    aLineProperties.maLineFill.moFillType = XML_noFill;
+
+    // Reference shape properties
+    aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
+
+    // Theme
+    if( pTheme != nullptr )
+    {
+        if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
+        {
+            if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
+                aLineProperties.assignUsed( *pLineProps );
+        }
+    }
+
+    // Properties specified directly for this shape
+    aLineProperties.assignUsed( getLineProperties() );
+
+    return aLineProperties;
+}
+
+EffectProperties Shape::getActualEffectProperties(const Theme* pTheme) const
+{
+    EffectProperties aEffectProperties;
+
+    // Reference shape properties
+    aEffectProperties.assignUsed( *mpShapeRefEffectPropPtr );
+
+    // Theme
+    if( pTheme != nullptr )
+    {
+        if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
+        {
+            if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
+                aEffectProperties.assignUsed( *pEffectProps );
+        }
+    }
+
+    // Properties specified directly for this shape
+    aEffectProperties.assignUsed ( getEffectProperties() );
+
+    return aEffectProperties;
+}
+
 uno::Sequence< uno::Sequence< uno::Any > >  Shape::resolveRelationshipsOfTypeFromOfficeDoc(core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType )
 {
     uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp;
diff --git a/sd/qa/unit/data/pptx/tdf104015.pptx b/sd/qa/unit/data/pptx/tdf104015.pptx
new file mode 100644
index 0000000..f3675f9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104015.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index f9f40cc..6c14bd5 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -129,6 +129,7 @@ public:
     void testTdf103473();
     void testTdf103792();
     void testTdf103876();
+    void testTdf104015();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -183,6 +184,7 @@ public:
     CPPUNIT_TEST(testTdf103473);
     CPPUNIT_TEST(testTdf103792);
     CPPUNIT_TEST(testTdf103876);
+    CPPUNIT_TEST(testTdf104015);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1545,6 +1547,44 @@ void SdImportTest::testTdf103876()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf104015()
+{
+    // Shape fill, line and effect properties were not inherited from master slide shape
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104015.pptx"), PPTX);
+
+    const SdrPage *pPage = GetPage( 1, xDocShRef );
+    CPPUNIT_ASSERT_MESSAGE("No page found", pPage != nullptr);
+    SdrObject *const pObj = pPage->GetObj(0);
+    CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj != nullptr);
+    // Should have a red fill color
+    {
+        const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+                pObj->GetMergedItem(XATTR_FILLSTYLE));
+        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
+        const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+                pObj->GetMergedItem(XATTR_FILLCOLOR));
+        CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
+    }
+    // Should have a blue line
+    {
+        const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+                pObj->GetMergedItem(XATTR_LINESTYLE));
+        CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, rStyleItem.GetValue());
+
+        const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+                pObj->GetMergedItem(XATTR_LINECOLOR));
+        CPPUNIT_ASSERT_EQUAL(ColorData(0x0000FF), rColorItem.GetColorValue().GetColor());
+    }
+    // Should have some shadow
+    {
+        const SdrOnOffItem& rShadowItem = dynamic_cast<const SdrOnOffItem&>(
+                pObj->GetMergedItem(SDRATTR_SHADOW));
+        CPPUNIT_ASSERT(rShadowItem.GetValue());
+    }
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 9745d29227e471ce40e9992fefd92e10a48696fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 18 21:13:01 2016 +0000

    coverity#1394416 ensure there's enough data to read
    
    Change-Id: I9d2cf2e566dd10243a0ca72e6a9278bd2eaed57b

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 7602977..70baffd 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2550,7 +2550,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(const WW8Fib& rFib, SvStream* pSt,
                          of the new data
                         */
                         bool bExpand = IsExpandableSprm(nSpId);
-                        if (IsReplaceAllSprm(nSpId) || bExpand)
+                        if ((IsReplaceAllSprm(nSpId) || bExpand) && aEntry.mnLen >= sizeof(sal_uInt32) + 2)
                         {
                             sal_uInt32 nCurr = pDataSt->Tell();
                             sal_uInt32 nPos = SVBT32ToUInt32(aEntry.mpData + 2);
commit 2345e4657001d6239b6408e14ee49518a2036b13
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Nov 18 22:00:11 2016 +0100

    sd: assert SfxPoolItem::operator==
    
    Remove the defensive programming here.
    
    Change-Id: I27e89fe6e28ee3c0c2821083d825859d10f79bb0

diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index f360981..b13b7ec 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -304,9 +304,8 @@ SfxPoolItem* SdOptionsLayoutItem::Clone( SfxItemPool* ) const
 
 bool SdOptionsLayoutItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const bool bSameType = SfxPoolItem::operator==( rAttr );
-    DBG_ASSERT( bSameType, "SdOptionsLayoutItem::operator==(), different pool item type!" );
-    return bSameType && ( maOptionsLayout == static_cast< const SdOptionsLayoutItem& >( rAttr ).maOptionsLayout );
+    assert(SfxPoolItem::operator==(rAttr));
+    return maOptionsLayout == static_cast<const SdOptionsLayoutItem&>(rAttr).maOptionsLayout;
 }
 
 void SdOptionsLayoutItem::SetOptions( SdOptions* pOpts ) const
@@ -393,9 +392,8 @@ SfxPoolItem* SdOptionsContentsItem::Clone( SfxItemPool* ) const
 
 bool SdOptionsContentsItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const bool bSameType = SfxPoolItem::operator==(rAttr);
-    DBG_ASSERT( bSameType, "SdOptionsContentsItem::operator==(), different pool item type!" );
-    return bSameType && ( maOptionsContents == static_cast<const SdOptionsContentsItem&>( rAttr ).maOptionsContents );
+    assert(SfxPoolItem::operator==(rAttr));
+    return maOptionsContents == static_cast<const SdOptionsContentsItem&>(rAttr).maOptionsContents;
 }
 
 /*************************************************************************
@@ -703,9 +701,8 @@ SfxPoolItem* SdOptionsMiscItem::Clone( SfxItemPool* ) const
 
 bool SdOptionsMiscItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const bool bSameType = SfxPoolItem::operator==(rAttr);
-    DBG_ASSERT( bSameType, "SdOptionsMiscItem::operator==(), different pool item type!" );
-    return bSameType && ( maOptionsMisc == static_cast< const SdOptionsMiscItem& >(rAttr).maOptionsMisc );
+    assert(SfxPoolItem::operator==(rAttr));
+    return maOptionsMisc == static_cast<const SdOptionsMiscItem&>(rAttr).maOptionsMisc;
 }
 
 void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
@@ -889,9 +886,8 @@ SfxPoolItem* SdOptionsSnapItem::Clone( SfxItemPool* ) const
 
 bool SdOptionsSnapItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const bool bSameType = SfxPoolItem::operator==(rAttr);
-    DBG_ASSERT( bSameType, "SdOptionsSnapItem::operator==(), different pool item type!" );
-    return bSameType && ( maOptionsSnap == static_cast< const SdOptionsSnapItem& >(rAttr).maOptionsSnap );
+    assert(SfxPoolItem::operator==(rAttr));
+    return maOptionsSnap == static_cast<const SdOptionsSnapItem&>(rAttr).maOptionsSnap;
 }
 
 void SdOptionsSnapItem::SetOptions( SdOptions* pOpts ) const
@@ -1343,9 +1339,8 @@ SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const
 
 bool SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const bool bSameType = SfxPoolItem::operator==(rAttr);
-    DBG_ASSERT( bSameType, "SdOptionsPrintItem::operator==(), different pool item type!" );
-    return bSameType && ( maOptionsPrint == static_cast< const SdOptionsPrintItem& >( rAttr ).maOptionsPrint );
+    assert(SfxPoolItem::operator==(rAttr));
+    return maOptionsPrint == static_cast<const SdOptionsPrintItem&>(rAttr).maOptionsPrint;
 }
 
 void SdOptionsPrintItem::SetOptions( SdOptions* pOpts ) const
commit 3662061633f5651ad7f01543a3ce8807cdd966fe
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Nov 18 21:57:42 2016 +0100

    editeng: assert SfxPoolItem::operator==
    
    Change-Id: Ia6c6f4f5af1e3a803b464ab410558984c3861a65

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 11309d4..30e742b 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -340,7 +340,7 @@ SvStream& SvxFieldItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) co
 
 bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
+    assert(SfxPoolItem::operator==(rItem));
 
     const SvxFieldData* pOtherFld = static_cast<const SvxFieldItem&>(rItem).GetField();
     if( pField == pOtherFld )
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index dc659e9..501dd71 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -307,7 +307,7 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) :
 
 bool SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     return ( aSize == static_cast<const SvxSizeItem&>( rAttr ).GetSize() );
 }
@@ -569,7 +569,7 @@ void SvxLRSpaceItem::AdjustLeft()
 
 bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxLRSpaceItem& rOther = static_cast<const SvxLRSpaceItem&>(rAttr);
 
@@ -953,7 +953,7 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
 bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxULSpaceItem& rSpaceItem = static_cast<const SvxULSpaceItem&>( rAttr );
     return ( nUpper == rSpaceItem.nUpper &&
@@ -1177,7 +1177,7 @@ bool SvxOpaqueItem::GetPresentation
 
 bool SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxProtectItem& rItem = static_cast<const SvxProtectItem&>(rAttr);
     return ( bCntnt == rItem.bCntnt &&
@@ -1402,7 +1402,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
 bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxShadowItem& rItem = static_cast<const SvxShadowItem&>(rAttr);
     return ( ( aShadowColor == rItem.aShadowColor ) &&
@@ -1650,7 +1650,7 @@ inline bool CmpBrdLn( const SvxBorderLine* pBrd1, const SvxBorderLine* pBrd2 )
 
 bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxBoxItem& rBoxItem = static_cast<const SvxBoxItem&>(rAttr);
     return (
@@ -2545,9 +2545,9 @@ SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy )
 
 bool SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    const SvxBoxInfoItem& rBoxInfo = static_cast<const SvxBoxInfoItem&>(rAttr);
+    assert(SfxPoolItem::operator==(rAttr));
 
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    const SvxBoxInfoItem& rBoxInfo = static_cast<const SvxBoxInfoItem&>(rAttr);
 
     return (   mbEnableHor               == rBoxInfo.mbEnableHor
             && mbEnableVer               == rBoxInfo.mbEnableVer
@@ -2919,7 +2919,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
 bool SvxFormatBreakItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     return GetValue() == static_cast<const SvxFormatBreakItem&>( rAttr ).GetValue();
 }
@@ -3105,7 +3105,7 @@ SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine )
 
 bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     return CmpBrdLn( pLine, static_cast<const SvxLineItem&>(rAttr).GetLine() );
 }
@@ -3716,7 +3716,7 @@ SvxBrushItem& SvxBrushItem::operator=(SvxBrushItem&& rItem)
 
 bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+    assert(SfxPoolItem::operator==(rAttr));
 
     const SvxBrushItem& rCmp = static_cast<const SvxBrushItem&>(rAttr);
     bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos &&
@@ -4059,7 +4059,7 @@ SvxFrameDirectionItem::~SvxFrameDirectionItem()
 
 bool SvxFrameDirectionItem::operator==( const SfxPoolItem& rCmp ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
+    assert(SfxPoolItem::operator==(rCmp));
 
     return GetValue() == static_cast<const SvxFrameDirectionItem&>(rCmp).GetValue();
 }
diff --git a/editeng/source/items/optitems.cxx b/editeng/source/items/optitems.cxx
index 8d89d23..f4ab203 100644
--- a/editeng/source/items/optitems.cxx
+++ b/editeng/source/items/optitems.cxx
@@ -71,7 +71,7 @@ SfxPoolItem* SfxSpellCheckItem::Clone( SfxItemPool* ) const
 
 bool SfxSpellCheckItem::operator==( const SfxPoolItem& rItem ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rItem), "unequal types" );
+    assert(SfxPoolItem::operator==(rItem));
     return ( xSpellCheck == static_cast<const SfxSpellCheckItem&>( rItem ).GetXSpellChecker() );
 }
 
@@ -97,7 +97,7 @@ SfxHyphenRegionItem::SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem ) :
 
 bool SfxHyphenRegionItem::operator==( const SfxPoolItem& rAttr ) const
 {
-    DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list