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

Stephan Bergmann sbergman at redhat.com
Wed Aug 26 09:14:48 PDT 2015


 include/vcl/menu.hxx                |    2 +-
 sc/qa/unit/ucalc_formula.cxx        |   33 ---------------------------------
 sc/source/core/tool/address.cxx     |    2 +-
 vcl/source/window/menu.cxx          |    4 ++--
 vcl/source/window/menubarwindow.cxx |    4 +---
 vcl/source/window/menubarwindow.hxx |    2 +-
 vcl/source/window/menuwindow.hxx    |    2 +-
 7 files changed, 7 insertions(+), 42 deletions(-)

New commits:
commit a5ef818b4aa3f38600105896a65ba97fdd426d29
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 26 18:10:04 2015 +0200

    Remove unused AddMenuBarButton parameter
    
    ...which had apparently been unused ever since the function's introduction in
    86ef4422bc62f912f72c0bedda47ce0e6e2722e4 "INTEGRATION: CWS onlineupdate3," even
    though the function's code had always been careful to clip the value to
    m_aAddButtons.size() (which was now detected by clang-tidy's
    clang-analyzer-deadcode.DeadStores)
    
    Change-Id: Ic3542aaef04d059125d997cdc5e199d5edb1184a

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 9daae73..6fc495f 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -489,7 +489,7 @@ public:
     // add an arbitrary button to the menubar (will appear next to closer)
     // passed link will be call with a MenuBarButtonCallbackArg on press
     // passed string will be set as tooltip
-    sal_uInt16 AddMenuBarButton( const Image&, const Link<>&, const OUString&, sal_uInt16 nPos = 0 );
+    sal_uInt16 AddMenuBarButton( const Image&, const Link<>&, const OUString& );
     // set the highlight link for additional button with ID nId
     // highlight link will be called with a MenuBarButtonHighlightArg
     // the bHighlight member of that struct shall contain the new state
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 69d7135..62ec00b 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2734,10 +2734,10 @@ bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId )
         return false;
 }
 
-sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip, sal_uInt16 i_nPos )
+sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip )
 {
     IMenuBarWindow* pMenuWin = getMenuBarWindow();
-    return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip, i_nPos) : 0;
+    return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip) : 0;
 }
 
 void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink )
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 3a34682..d3ac8d6 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -1139,13 +1139,11 @@ css::uno::Reference<css::accessibility::XAccessible> MenuBarWindow::CreateAccess
     return xAcc;
 }
 
-sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip, sal_uInt16 i_nPos )
+sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip )
 {
     // find first free button id
     sal_uInt16 nId = IID_DOCUMENTCLOSE;
     std::map< sal_uInt16, AddButtonEntry >::const_iterator it;
-    if( i_nPos > m_aAddButtons.size() )
-        i_nPos = static_cast<sal_uInt16>(m_aAddButtons.size());
     do
     {
         nId++;
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index 269651d..781ab5c 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -144,7 +144,7 @@ public:
     Size            MinCloseButtonSize();
 
     /// Add an arbitrary button to the menubar that will appear next to the close button.
-    virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&, sal_uInt16 nPos) SAL_OVERRIDE;
+    virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) SAL_OVERRIDE;
     virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) SAL_OVERRIDE;
     virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) SAL_OVERRIDE;
     virtual void RemoveMenuBarButton(sal_uInt16 nId) SAL_OVERRIDE;
diff --git a/vcl/source/window/menuwindow.hxx b/vcl/source/window/menuwindow.hxx
index 37da819..7513f70 100644
--- a/vcl/source/window/menuwindow.hxx
+++ b/vcl/source/window/menuwindow.hxx
@@ -81,7 +81,7 @@ public:
     virtual void KillActivePopup() = 0;
 
     /// Add an arbitrary button to the menubar that will appear next to the close button.
-    virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&, sal_uInt16 nPos) = 0;
+    virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) = 0;
     virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) = 0;
     virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) = 0;
     virtual void RemoveMenuBarButton(sal_uInt16 nId) = 0;
commit 4944bd81ed056b5002ea36718ab4e953ba77c171
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 26 18:07:10 2015 +0200

    Revert "do not parse range fragments as valid ranges"
    
    This reverts commit ed6209f572bad38bdb066be668163fe8acf52056, plus follow-up
    18a2a642c4a8848e2a2cb0df29c6463db8428ef9 "unit test that parsing range fragments
    should fail."
    
    Breaks CppunitTest_sc_subsequent_filters_test
    
    Change-Id: Ic4663d79bf4bc017094bc37779f74f30630d79bd

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 0e379f1..8a5d766 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -321,39 +321,6 @@ void Test::testFormulaParseReference()
     CPPUNIT_ASSERT_MESSAGE("This is not an external address.", !aExtInfo.mbExternal);
 
     ScRange aRange;
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse(":B", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse("B:", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse(":B2", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse("B2:", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse(":2", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse("2:", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse(":2B", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
-    aRange.aStart.SetTab(0);
-    nRes = aRange.Parse("2B:", m_pDoc, formula::FormulaGrammar::CONV_OOO);
-    CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0);
-
     aRange.aStart.SetTab(0);
     nRes = aRange.Parse("B:B", m_pDoc, formula::FormulaGrammar::CONV_OOO);
     CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0);
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index da7a195..81e4047 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1505,7 +1505,7 @@ static sal_uInt16 lcl_ScRange_Parse_OOo( ScRange& rRange,
                     nRes2 |= SCA_COL_ABSOLUTE;
                 }
             }
-            if ((nRes1 & SCA_VALID) && (nRes2 & SCA_VALID))
+            if (nRes1 && nRes2)
             {
                 // PutInOrder / Justify
                 sal_uInt16 nMask, nBits1, nBits2;


More information about the Libreoffice-commits mailing list