[Libreoffice-commits] core.git: sot/source starmath/inc starmath/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Oct 27 11:38:45 UTC 2016


 sot/source/sdstor/stgcache.cxx            |    2 +-
 sot/source/sdstor/stgcache.hxx            |    1 -
 starmath/inc/ElementsDockingWindow.hxx    |    2 --
 starmath/inc/dialog.hxx                   |    1 -
 starmath/inc/rect.hxx                     |    2 --
 starmath/inc/utility.hxx                  |    1 -
 starmath/source/ElementsDockingWindow.cxx |    7 +------
 starmath/source/cfgitem.cxx               |   10 ++--------
 starmath/source/cfgitem.hxx               |    1 -
 starmath/source/dialog.cxx                |    2 +-
 starmath/source/mathmlimport.cxx          |    2 +-
 starmath/source/mathmlimport.hxx          |    4 ----
 starmath/source/rect.cxx                  |   10 ++--------
 starmath/source/utility.cxx               |   19 +++++++------------
 14 files changed, 15 insertions(+), 49 deletions(-)

New commits:
commit 618171552e1bcddb07660167d9df4512435269b0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Oct 27 10:50:45 2016 +0200

    loplugin:expandablemethods in sot..starmath
    
    Change-Id: I5b718bbda9ceca5bbfd1e6482ebd215e15884956
    Reviewed-on: https://gerrit.libreoffice.org/30318
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 55f91f12..2ee2c28 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -274,7 +274,7 @@ void StgCache::SetStrm( UCBStorageStream* pStgStream )
 
 void StgCache::SetDirty( const rtl::Reference< StgPage > &rPage )
 {
-    assert( IsWritable() );
+    assert( m_pStrm && m_pStrm->IsWritable() );
     maDirtyPages[ rPage->GetPage() ] = rPage;
 }
 
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 0fafeba..5a1ec38 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -70,7 +70,6 @@ public:
     SvStream* GetStrm()                     { return m_pStrm;     }
     void  SetStrm( SvStream*, bool );
     void  SetStrm( UCBStorageStream* );
-    bool  IsWritable() const                { return ( m_pStrm && m_pStrm->IsWritable() ); }
     bool  Good() const                      { return m_nError == SVSTREAM_OK; }
     ErrCode GetError()                      { return m_nError;    }
     void  MoveError( StorageBase& );
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 15ca546..50b1648 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -106,8 +106,6 @@ class SmElementsControl : public Control
 
     void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size);
 
-    void addSeparator();
-
     void build();
 
     //if pContext is not NULL, then draw, otherwise
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 047f115..79bc363 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -379,7 +379,6 @@ public:
 
     bool    SelectSymbolSet(const OUString &rSymbolSetName);
     void    SelectSymbol(sal_uInt16 nSymbolPos);
-    sal_uInt16  GetSelectedSymbol() const   { return m_pSymbolSetDisplay->GetSelectSymbol(); }
 };
 
 
diff --git a/starmath/inc/rect.hxx b/starmath/inc/rect.hxx
index c28e1d2..5f20fda 100644
--- a/starmath/inc/rect.hxx
+++ b/starmath/inc/rect.hxx
@@ -111,8 +111,6 @@ class SmRect
 protected:
             void BuildRect (const OutputDevice &rDev, const SmFormat *pFormat,
                             const OUString &rText, sal_uInt16 nBorderWidth);
-            void Init(const OutputDevice &rDev, const SmFormat *pFormat,
-                      const OUString &rText, sal_uInt16 nBorderWidth);
 
     inline  void CopyMBL(const SmRect& rRect);
             void CopyAlignInfo(const SmRect& rRect);
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index be4c84d..7920fc8 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -122,7 +122,6 @@ public:
     virtual ~SmFontPickList() { Clear(); }
 
     virtual void    Insert(const vcl::Font &rFont);
-    void            Remove(const vcl::Font &rFont);
 
     void            Clear();
     vcl::Font       Get(sal_uInt16 nPos = 0) const;
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index fe517fb..4721e51 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -502,11 +502,6 @@ void SmElementsControl::DoScroll(long nDelta)
     Invalidate();
 }
 
-void SmElementsControl::addSeparator()
-{
-    maElementList.push_back(o3tl::make_unique<SmElementSeparator>());
-}
-
 void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText)
 {
     std::unique_ptr<SmNode> pNode(SmParser().ParseExpression(aElementVisual));
@@ -541,7 +536,7 @@ void SmElementsControl::addElements(const sal_uInt16 aElementsArray[][2], sal_uI
         sal_uInt16 aElementId = aElementsArray[i][0];
         sal_uInt16 aElementIdHelp = aElementsArray[i][1];
         if (aElementId == 0xFFFF) {
-            addSeparator();
+            maElementList.push_back(o3tl::make_unique<SmElementSeparator>());
         } else {
             if (aElementId == RID_NEWLINE)
                 addElement(OUString( "\xe2\x86\xb5", 3, RTL_TEXTENCODING_UTF8 ), SM_RESSTR(aElementId), SM_RESSTR(aElementIdHelp));
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 1daf41e..4b1bd12 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -361,13 +361,6 @@ void SmMathConfig::SetFormatModified( bool bVal )
 }
 
 
-void SmMathConfig::SetFontFormatListModified( bool bVal )
-{
-    if (pFontFormatList)
-        pFontFormatList->SetModified( bVal );
-}
-
-
 void SmMathConfig::ReadSymbol( SmSym &rSymbol,
                         const OUString &rSymbolName,
                         const OUString &rBaseNode ) const
@@ -974,7 +967,8 @@ void SmMathConfig::SetStandardFormat( const SmFormat &rFormat, bool bSaveFontFor
         if (bSaveFontFormatList)
         {
             // needed for SmFontTypeDialog's DefaultButtonClickHdl
-            SetFontFormatListModified( true );
+            if (pFontFormatList)
+                pFontFormatList->SetModified( true );
             SaveFontFormatList();
         }
     }
diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx
index c4c1105..1bb91e3 100644
--- a/starmath/source/cfgitem.hxx
+++ b/starmath/source/cfgitem.hxx
@@ -130,7 +130,6 @@ protected:
     inline bool IsOtherModified() const     { return bIsOtherModified; }
     void        SetFormatModified( bool bVal );
     inline bool IsFormatModified() const    { return bIsFormatModified; }
-    void        SetFontFormatListModified( bool bVal );
 
     SmFontFormatList &          GetFontFormatList();
     const SmFontFormatList &    GetFontFormatList() const
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 7421c1e..d4f3192 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1466,7 +1466,7 @@ IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl, Button*, void)
     // remember old SymbolSet
     OUString  aOldSymbolSet (m_pSymbolSets->GetSelectEntry());
 
-    sal_uInt16 nSymPos = GetSelectedSymbol();
+    sal_uInt16 nSymPos = m_pSymbolSetDisplay->GetSelectSymbol();
 
     // adapt dialog to data of the SymbolSet manager, which might have changed
     if (pDialog->Execute() == RET_OK  &&  rSymbolMgr.IsModified())
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 60f8891..b318406 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -484,7 +484,7 @@ void SmXMLImport::endDocument()
     throw(xml::sax::SAXException, uno::RuntimeException, std::exception)
 {
     //Set the resulted tree into the SmDocShell where it belongs
-    SmNode *pTree = GetTree();
+    SmNode *pTree = popOrZero(aNodeStack);
     if (pTree && pTree->GetType() == NTABLE)
     {
         uno::Reference <frame::XModel> xModel = GetModel();
diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx
index 8031ed4..04d49c8 100644
--- a/starmath/source/mathmlimport.hxx
+++ b/starmath/source/mathmlimport.hxx
@@ -238,10 +238,6 @@ public:
     const SvXMLTokenMap &GetActionAttrTokenMap();
 
     SmNodeStack & GetNodeStack()    { return aNodeStack; }
-    SmNode *GetTree()
-    {
-        return popOrZero(aNodeStack);
-    }
 
     bool GetSuccess()              { return bSuccess; }
     SAL_WARN_UNUSED_RESULT const OUString& GetText() { return aText; }
diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx
index 63798c6..6252e55 100644
--- a/starmath/source/rect.cxx
+++ b/starmath/source/rect.cxx
@@ -215,13 +215,6 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat,
 }
 
 
-void SmRect::Init(const OutputDevice &rDev, const SmFormat *pFormat,
-                  const OUString &rText, sal_uInt16 nEBorderWidth)
-    // get rectangle fitting for drawing 'rText' on OutputDevice 'rDev'
-{
-    BuildRect(rDev, pFormat, rText, nEBorderWidth);
-}
-
 
 SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat,
                const OUString &rText, long nEBorderWidth)
@@ -229,7 +222,8 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat,
     OSL_ENSURE( nEBorderWidth >= 0, "BorderWidth is negative" );
     if (nEBorderWidth < 0)
         nEBorderWidth = 0;
-    Init(rDev, pFormat, rText, sal::static_int_cast<sal_uInt16>(nEBorderWidth));
+    // get rectangle fitting for drawing 'rText' on OutputDevice 'rDev'
+    BuildRect(rDev, pFormat, rText, sal::static_int_cast<sal_uInt16>(nEBorderWidth));
 }
 
 
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 34a4de5..cadb88e 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -88,25 +88,20 @@ OUString SmFontPickList::GetStringItem(const vcl::Font &rFont)
 
 void SmFontPickList::Insert(const vcl::Font &rFont)
 {
-    Remove(rFont);
-    aFontVec.push_front( rFont );
-
-    if (aFontVec.size() > nMaxItems)
-    {
-        aFontVec.pop_back();
-    }
-}
-
-void SmFontPickList::Remove(const vcl::Font &rFont)
-{
     for (size_t nPos = 0; nPos < aFontVec.size(); nPos++)
         if (CompareItem( aFontVec[nPos], rFont))
         {
             aFontVec.erase( aFontVec.begin() + nPos );
             break;
         }
-}
 
+    aFontVec.push_front( rFont );
+
+    if (aFontVec.size() > nMaxItems)
+    {
+        aFontVec.pop_back();
+    }
+}
 
 void SmFontPickList::ReadFrom(const SmFontDialog& rDialog)
 {


More information about the Libreoffice-commits mailing list