! returns a pointer to a \c Spreadsheet object, if the currently active Mdi-Subwindow or if the currently selected tab in a \c WorkbookView is a \c SpreadsheetView Otherwise returns \c 0. */
| 2034 | Otherwise returns \c 0. |
| 2035 | */ |
| 2036 | Spreadsheet* MainWin::activeSpreadsheet() const { |
| 2037 | // if (dynamic_cast<QQuickWidget*>(centralWidget())) |
| 2038 | // return nullptr; |
| 2039 | |
| 2040 | if (!m_currentAspect) |
| 2041 | return nullptr; |
| 2042 | |
| 2043 | Spreadsheet* spreadsheet = nullptr; |
| 2044 | if (m_currentAspect->type() == AspectType::Spreadsheet) |
| 2045 | spreadsheet = dynamic_cast<Spreadsheet*>(m_currentAspect); |
| 2046 | else { |
| 2047 | // check whether one of spreadsheet columns is selected and determine the spreadsheet |
| 2048 | auto* parent = m_currentAspect->parentAspect(); |
| 2049 | if (parent && parent->type() == AspectType::Spreadsheet) |
| 2050 | spreadsheet = dynamic_cast<Spreadsheet*>(parent); |
| 2051 | } |
| 2052 | |
| 2053 | return spreadsheet; |
| 2054 | } |
| 2055 | |
| 2056 | #ifdef HAVE_CANTOR_LIBS |
| 2057 | /* |
no test coverage detected