diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 21 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 5 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlrowi.cxx | 16 |
3 files changed, 42 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index ca24d77523b5..3be69b5ae4f0 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -76,6 +76,7 @@ #include "pivotsource.hxx" #include <unonames.hxx> #include <numformat.hxx> +#include <sizedev.hxx> #include <comphelper/base64.hxx> #include <comphelper/extract.hxx> @@ -1809,6 +1810,26 @@ void SAL_CALL ScXMLImport::endDocument() pDoc->SetStreamValid( nTab, true ); } } + + // There are rows with optimal height which need to be updated + if (!maRecalcRowRanges.empty()) + { + bool bLockHeight = pDoc->IsAdjustHeightLocked(); + if (bLockHeight) + { + pDoc->UnlockAdjustHeight(); + } + + ScSizeDeviceProvider aProv(static_cast<ScDocShell*>(pDoc->GetDocumentShell())); + ScDocRowHeightUpdater aUpdater(*pDoc, aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), &maRecalcRowRanges); + aUpdater.update(); + + if (bLockHeight) + { + pDoc->LockAdjustHeight(); + } + } + aTables.FixupOLEs(); } if (GetModel().is()) diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index 59b4fb1fce18..555835033747 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -31,6 +31,7 @@ #include <global.hxx> #include <formula/grammar.hxx> #include <compiler.hxx> +#include <dociter.hxx> #include "xmlstyle.hxx" #include <com/sun/star/sheet/ValidationAlertStyle.hpp> @@ -269,6 +270,8 @@ class ScXMLImport: public SvXMLImport ScMyTables aTables; + std::vector<ScDocRowHeightUpdater::TabRanges> maRecalcRowRanges; + std::unique_ptr<ScMyNamedExpressions> m_pMyNamedExpressions; SheetNamedExpMap m_SheetNamedExpressions; @@ -341,6 +344,8 @@ public: ScMyTables& GetTables() { return aTables; } + std::vector<ScDocRowHeightUpdater::TabRanges>& GetRecalcRowRanges() { return maRecalcRowRanges; } + bool IsStylesOnlyMode() const { return !bLoadDoc; } static sal_Int16 GetCellType(const char* rStrValue, const sal_Int32 nStrLength); diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index 7f958d459f4d..3093c33f0a8e 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -27,6 +27,7 @@ #include <olinetab.hxx> #include <sheetdata.hxx> #include <documentimport.hxx> +#include <unonames.hxx> #include <xmloff/xmltkmap.hxx> #include <xmloff/nmspmap.hxx> @@ -198,6 +199,21 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/) } if (bFiltered) xRowProperties->setPropertyValue(SC_ISFILTERED, uno::makeAny(bFiltered)); + + uno::Any any = xRowProperties->getPropertyValue(SC_UNONAME_OHEIGHT); + bool bOptionalHeight = false; + any >>= bOptionalHeight; + if (bOptionalHeight) + { + // Save this row for later height update + std::vector<ScDocRowHeightUpdater::TabRanges>& rRecalcRanges = rXMLImport.GetRecalcRowRanges(); + while (static_cast<SCTAB>(rRecalcRanges.size()) <= nSheet) + { + rRecalcRanges.emplace_back(0); + } + rRecalcRanges.at(nSheet).mnTab = nSheet; + rRecalcRanges.at(nSheet).mpRanges->setTrue(nFirstRow, nCurrentRow); + } } } } |