diff options
author | Eike Rathke <erack@redhat.com> | 2018-02-28 23:00:43 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-02-28 23:04:21 +0100 |
commit | ed7cd31848201e8bc6d4ec69e397ff2e6e154b50 (patch) | |
tree | f26f7eba0b3131e8070d8f8acb5eafe57453c7a2 | |
parent | d09cc5fe73fc1de27e92dae38bc58ea0aadb4f27 (diff) |
Revert "Resolves: tdf#114555 check .xlsx col/row/tab overflow and display warning"
This reverts commit f2a4cea6c035e9a837942934068b5f80a996580a.
Some builds have problem with WarningBox not being declared. Will dig
into that later.
-rw-r--r-- | sc/source/filter/inc/addressconverter.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/excelfilter.cxx | 63 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 21 |
3 files changed, 6 insertions, 82 deletions
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index d1d53531e0f1..57f1f33cabcd 100644 --- a/sc/source/filter/inc/addressconverter.hxx +++ b/sc/source/filter/inc/addressconverter.hxx @@ -479,10 +479,6 @@ public: static css::uno::Sequence<css::table::CellRangeAddress> toApiSequence(const ScRangeList& orRanges); - bool isColOverflow() const { return mbColOverflow; } - bool isRowOverflow() const { return mbRowOverflow; } - bool isTabOverflow() const { return mbTabOverflow; } - private: void initializeMaxPos( sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow ); diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index b4e48dd6e030..989befcb6b51 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -30,13 +30,6 @@ #include <workbookfragment.hxx> #include <xestream.hxx> -#include <addressconverter.hxx> -#include <scerrors.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/vclptr.hxx> -#include <svtools/sfxecode.hxx> -#include <tools/urlobj.hxx> - namespace oox { namespace xls { @@ -104,61 +97,9 @@ bool ExcelFilter::importDocument() the class WorkbookHelper, and execute the import filter by constructing an instance of WorkbookFragment and loading the file. */ WorkbookGlobalsRef xBookGlob(WorkbookHelper::constructGlobals(*this)); - if (xBookGlob.get()) + if (xBookGlob.get() && importFragment(new WorkbookFragment(*xBookGlob, aWorkbookPath))) { - rtl::Reference<FragmentHandler> xWorkbookFragment( new WorkbookFragment(*xBookGlob, aWorkbookPath)); - bool bRet = importFragment( xWorkbookFragment); - if (bRet) - { - const AddressConverter& rAC = - static_cast<const WorkbookFragment*>(xWorkbookFragment.get())->getAddressConverter(); - if (rAC.isTabOverflow() || rAC.isColOverflow() || rAC.isRowOverflow()) - { - // Show data loss warning. - - INetURLObject aURL( getFileUrl()); - SfxErrorContext aContext( ERRCTX_SFX_OPENDOC, - aURL.getName( INetURLObject::LAST_SEGMENT, true, - INetURLObject::DecodeMechanism::WithCharset), - nullptr, RID_ERRCTX); - - OUString aWarning; - aContext.GetString( ERRCODE_NONE.MakeWarning(), aWarning); - aWarning += ":\n"; - - OUString aMsg; - if (rAC.isTabOverflow()) - { - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_SHEET_OVERFLOW, aMsg)) - aWarning += aMsg; - } - if (rAC.isColOverflow()) - { - if (!aMsg.isEmpty()) - aWarning += "\n"; - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_COLUMN_OVERFLOW, aMsg)) - aWarning += aMsg; - } - if (rAC.isRowOverflow()) - { - if (!aMsg.isEmpty()) - aWarning += "\n"; - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_ROW_OVERFLOW, aMsg)) - aWarning += aMsg; - } - - /* TODO: displaying a dialog here is ugly and should rather - * happen at UI level instead of at the filter level, but - * it seems there's no way to transport detailed - * information other than returning true or false at this - * point? */ - - ScopedVclPtrInstance<WarningBox> pBox( nullptr, - MessBoxStyle::Ok | MessBoxStyle::DefaultOk, aWarning); - pBox->Execute(); - } - } - return bRet; + return true; } } catch (...) diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 5f17d8c419b6..b221cb16a73b 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -273,7 +273,6 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) } else aModel.mnRow = ++mnRow; - mrAddressConv.checkRow( mnRow, true); mnCol = -1; aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 ); @@ -298,14 +297,8 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) ) { // OOXML uses 1-based integer column indexes, row model expects 0-based colspans - const sal_Int32 nCol1 = aColSpanToken.copy( 0, nSepPos ).toInt32() - 1; - const bool bValid1 = mrAddressConv.checkCol( nCol1, true); - if (bValid1) - { - const sal_Int32 nCol2 = aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1; - mrAddressConv.checkCol( nCol2, true); - aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, nMaxCol ))); - } + sal_Int32 nLastCol = ::std::min( aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1, nMaxCol ); + aModel.insertColSpan( ValueRange( aColSpanToken.copy( 0, nSepPos ).toInt32() - 1, nLastCol ) ); } } @@ -321,9 +314,7 @@ bool SheetDataContext::importCell( const AttributeList& rAttribs ) if (!p) { ++mnCol; - ScAddress aAddress( mnCol, mnRow, mnSheet ); - bValid = mrAddressConv.checkCellAddress( aAddress, true ); - maCellData.maCellAddr = aAddress; + maCellData.maCellAddr = ScAddress( mnCol, mnRow, mnSheet ); } else { @@ -383,7 +374,6 @@ void SheetDataContext::importRow( SequenceInputStream& rStrm ) nSpanCount = rStrm.readInt32(); maCurrPos.mnCol = 0; - mrAddressConv.checkRow( maCurrPos.mnRow, true); // row index is 0-based in BIFF12, but RowModel expects 1-based aModel.mnRow = maCurrPos.mnRow + 1; // row height is in twips in BIFF12, convert to points @@ -403,11 +393,8 @@ void SheetDataContext::importRow( SequenceInputStream& rStrm ) { sal_Int32 nFirstCol, nLastCol; nFirstCol = rStrm.readInt32(); - const bool bValid1 = mrAddressConv.checkCol( nFirstCol, true); nLastCol = rStrm.readInt32(); - mrAddressConv.checkCol( nLastCol, true); - if (bValid1) - aModel.insertColSpan( ValueRange( nFirstCol, ::std::min( nLastCol, nMaxCol ) ) ); + aModel.insertColSpan( ValueRange( nFirstCol, ::std::min( nLastCol, nMaxCol ) ) ); } // set row properties in the current sheet |