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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 5 06:03:44 UTC 2019


 sc/source/filter/inc/sheetdatacontext.hxx  |   20 ++------
 sc/source/filter/oox/sheetdatacontext.cxx  |   17 +-----
 sc/source/ui/inc/AccessibleSpreadsheet.hxx |   71 ++++++++++++++---------------
 3 files changed, 44 insertions(+), 64 deletions(-)

New commits:
commit b24c50d3e2104408bd77a27155de1241b9d17116
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 4 10:04:52 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 5 07:02:17 2019 +0100

    clean up members in ScAccessibleSpreadsheet
    
    re-arrange them so the private/public sections are continuous.
    And make a bunch of public fields private, no-one seems to be touching
    them outside the class.
    
    Change-Id: I6378793fb01bc884961d19627a46f2a1e7eda79c
    Reviewed-on: https://gerrit.libreoffice.org/84448
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 5bcccacf8fbc..fe6070a191cc 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -55,10 +55,11 @@ class ScAccessibleCell;
         This base class provides an implementation of the
         <code>AccessibleTable</code> service.
 */
-class ScAccessibleSpreadsheet final
-    :   public  ScAccessibleTableBase
+class ScAccessibleSpreadsheet final : public  ScAccessibleTableBase
 {
 public:
+    typedef std::vector<ScMyAddress> VEC_MYADDR;
+
     ScAccessibleSpreadsheet(
         ScAccessibleDocument* pAccDoc,
         ScTabViewShell* pViewShell,
@@ -76,6 +77,14 @@ public:
 
     void BoundingBoxChanged();
     void VisAreaChanged();
+    void FireFirstCellFocus();
+
+    css::uno::Reference < css::accessibility::XAccessible > GetActiveCell();
+    bool IsScAddrFormulaSel (const ScAddress &addr) const;
+    bool IsFormulaMode();
+    ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex);
+    static bool CalcScRangeDifferenceMax(const ScRange & rSrc, const ScRange & rDest,int nMax,VEC_MYADDR &vecRet,int &nSize);
+    static bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet);
 
 private:
     ScAccessibleSpreadsheet(
@@ -200,7 +209,9 @@ private:
     virtual void SAL_CALL
         addAccessibleEventListener(
             const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
+
     //=====  XAccessibleTableSelection  ============================================
+
     virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) override;
     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) override;
     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) override;
@@ -212,17 +223,6 @@ private:
     /// Return the object's current bounding box relative to the parent object.
     virtual tools::Rectangle GetBoundingBox() const override;
 
-    ScTabViewShell* mpViewShell;
-    std::unique_ptr<ScRangeList>  mpMarkedRanges;
-    ScAccessibleDocument* mpAccDoc;
-    rtl::Reference<ScAccessibleCell> mpAccCell;
-    ScSplitPos      meSplitPos;
-    ScAddress       maActiveCell;
-    SCTAB           mnTab;
-    bool const      mbIsSpreadsheet;
-    bool            mbDelIns;
-    bool            mbIsFocusSend;
-
     bool IsDefunc(
         const css::uno::Reference<css::accessibility::XAccessibleStateSet>& rxParentStates);
     bool IsEditable();
@@ -232,16 +232,32 @@ private:
     void SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect);
 
     static ScDocument* GetDocument(ScTabViewShell* pViewShell);
-    typedef std::vector<ScMyAddress> VEC_MYADDR;
 
+    void RemoveSelection(const ScMarkData &refScMarkData);
+    void CommitFocusCell(const ScAddress &aNewCell);
+
+    sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; }
+    sal_uInt16  GetColAll() const { return m_nMaxX - m_nMinX + 1; }
+    void NotifyRefMode();
+    void RemoveFormulaSelection(bool bRemoveAll = false);
+    bool CheckChildIndex(sal_Int32) const;
+    ScAddress GetChildIndexAddress(sal_Int32) const;
+    sal_Int32 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn );
+    bool GetFormulaCurrentFocusCell(ScAddress &addr);
+
+    ScTabViewShell* mpViewShell;
+    std::unique_ptr<ScRangeList>  mpMarkedRanges;
+    ScAccessibleDocument* mpAccDoc;
+    rtl::Reference<ScAccessibleCell> mpAccCell;
+    ScSplitPos      meSplitPos;
+    ScAddress       maActiveCell;
+    SCTAB           mnTab;
+    bool const      mbIsSpreadsheet;
+    bool            mbDelIns;
+    bool            mbIsFocusSend;
     typedef std::map<ScMyAddress,css::uno::Reference< css::accessibility::XAccessible > >
         MAP_ADDR_XACC;
     MAP_ADDR_XACC m_mapSelectionSend;
-    void RemoveSelection(const ScMarkData &refScMarkData);
-    void CommitFocusCell(const ScAddress &aNewCell);
-public:
-    void FireFirstCellFocus();
-private:
     bool          m_bFormulaMode;
     bool          m_bFormulaLastMode;
     ScAddress     m_aFormulaActiveCell;
@@ -252,16 +268,6 @@ private:
     sal_uInt16    m_nMaxX;
     sal_Int32     m_nMinY;
     sal_Int32     m_nMaxY;
-
-    sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; }
-    sal_uInt16  GetColAll() const { return m_nMaxX - m_nMinX + 1; }
-    void NotifyRefMode();
-    void RemoveFormulaSelection(bool bRemoveAll = false);
-    bool CheckChildIndex(sal_Int32) const;
-    ScAddress GetChildIndexAddress(sal_Int32) const;
-    sal_Int32 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn );
-    bool GetFormulaCurrentFocusCell(ScAddress &addr);
-public:
     ScRange       m_aLastWithInMarkRange;
     OUString      m_strCurCellValue;
     ScRangeList   m_LastMarkedRanges;
@@ -271,13 +277,6 @@ public:
     typedef std::vector<PAIR_COL> VEC_COL;
     VEC_COL       m_vecTempCol;
     OUString      m_strOldTabName;
-
-    css::uno::Reference < css::accessibility::XAccessible > GetActiveCell();
-    bool IsScAddrFormulaSel (const ScAddress &addr) const;
-    bool IsFormulaMode();
-    ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex);
-    static bool CalcScRangeDifferenceMax(const ScRange & rSrc, const ScRange & rDest,int nMax,VEC_MYADDR &vecRet,int &nSize);
-    static bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet);
 };
 
 #endif
commit 9d0c1c51cefbe27c43afe1b6bec9abac8811907f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 4 15:03:02 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 5 07:02:00 2019 +0100

    loplugin:mergeclasses SheetDataContextBase with SheetDataContext
    
    Change-Id: I6d7d1affe13cf7284df911675f107069739fc79a
    Reviewed-on: https://gerrit.libreoffice.org/84432
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/sheetdatacontext.hxx b/sc/source/filter/inc/sheetdatacontext.hxx
index 5a9e6b778b41..8e746ef4fd80 100644
--- a/sc/source/filter/inc/sheetdatacontext.hxx
+++ b/sc/source/filter/inc/sheetdatacontext.hxx
@@ -32,10 +32,12 @@
 namespace oox {
 namespace xls {
 
-/** Used as base for sheet data context classes. Provides fast access to often
-    used converter objects and sheet index, to improve performance.
+/** This class implements importing the sheetData element.
+
+    The sheetData element contains all row settings and all cells in a single
+    sheet of a spreadsheet document.
  */
-struct SheetDataContextBase
+class SheetDataContext : public WorksheetContextBase
 {
     AddressConverter&   mrAddressConv;      /// The address converter.
     std::unique_ptr<FormulaParser> mxFormulaParser;    /// The formula parser, different one for each SheetDataContext
@@ -43,18 +45,6 @@ struct SheetDataContextBase
     CellModel           maCellData;         /// Position, contents, formatting of current imported cell.
     CellFormulaModel    maFmlaData;         /// Settings for a cell formula.
     sal_Int16 const           mnSheet;            /// Index of the current sheet.
-
-    explicit            SheetDataContextBase( const WorksheetHelper& rHelper );
-    virtual             ~SheetDataContextBase();
-};
-
-/** This class implements importing the sheetData element.
-
-    The sheetData element contains all row settings and all cells in a single
-    sheet of a spreadsheet document.
- */
-class SheetDataContext : public WorksheetContextBase, private SheetDataContextBase
-{
     // If we are doing threaded parsing, this SheetDataContext
     // forms the inner loop for bulk data parsing, and for the
     // duration of this we can drop the solar mutex.
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index 0a4892f61bdf..ce4d3816f61b 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -55,27 +55,18 @@ const sal_uInt8 BIFF12_ROW_SHOWPHONETIC     = 0x01;
 
 } // namespace
 
-SheetDataContextBase::SheetDataContextBase( const WorksheetHelper& rHelper ) :
-    mrAddressConv( rHelper.getAddressConverter() ),
-    mrSheetData( rHelper.getSheetData() ),
-    mnSheet( rHelper.getSheetIndex() )
-{
-    mxFormulaParser.reset(rHelper.createFormulaParser());
-}
-
-SheetDataContextBase::~SheetDataContextBase()
-{
-}
-
 SheetDataContext::SheetDataContext( WorksheetFragmentBase& rFragment ) :
     WorksheetContextBase( rFragment ),
-    SheetDataContextBase( rFragment ),
+    mrAddressConv( rFragment.getAddressConverter() ),
+    mrSheetData( rFragment.getSheetData() ),
+    mnSheet( rFragment.getSheetIndex() ),
     mbHasFormula( false ),
     mbValidRange( false ),
     mnRow( -1 ),
     mnCol( -1 )
 {
     SAL_INFO( "sc.filter",  "start safe sheet data context - unlock" );
+    mxFormulaParser.reset(rFragment.createFormulaParser());
 }
 
 SheetDataContext::~SheetDataContext()


More information about the Libreoffice-commits mailing list