diff --git a/OOXML/XlsxFormat/Workbook/CalcPr.cpp b/OOXML/XlsxFormat/Workbook/CalcPr.cpp index f63ac42d31..01c6c8cd80 100644 --- a/OOXML/XlsxFormat/Workbook/CalcPr.cpp +++ b/OOXML/XlsxFormat/Workbook/CalcPr.cpp @@ -87,19 +87,32 @@ namespace OOX auto ptr(new XLSB::CalcProp); XLS::BaseObjectPtr objectPtr(ptr); - ptr->recalcID = m_oCalcId->GetValue(); - ptr->fAutoRecalc = m_oCalcMode->GetValue(); - ptr->fFullCalcOnLoad = m_oFullCalcOnLoad->GetValue(); - ptr->fRefA1 = !m_oRefMode->GetValue(); - ptr->fIter = m_oIterate->GetValue(); - ptr->cCalcCount = m_oIterateCount->GetValue(); - ptr->xnumDelta.data.value = m_oIterateDelta->GetValue(); - ptr->fFullPrec = m_oFullPrecision->GetValue(); - ptr->fSomeUncalced = m_oCalcCompleted->GetValue(); - ptr->fSaveRecalc = m_oCalcOnSave->GetValue(); - ptr->fMTREnabled = m_oConcurrentCalc->GetValue(); - ptr->cUserThreadCount = m_oConcurrentManualCount->GetValue(); - ptr->fNoDeps = m_oForceFullCalc->GetValue(); + if(m_oCalcId.IsInit()) + ptr->recalcID = m_oCalcId->GetValue(); + if(m_oCalcMode.IsInit()) + ptr->fAutoRecalc = m_oCalcMode->GetValue(); + if(m_oFullCalcOnLoad.IsInit()) + ptr->fFullCalcOnLoad = m_oFullCalcOnLoad->GetValue(); + if(m_oRefMode.IsInit()) + ptr->fRefA1 = !m_oRefMode->GetValue(); + if(m_oIterate.IsInit()) + ptr->fIter = m_oIterate->GetValue(); + if(m_oIterateCount.IsInit()) + ptr->cCalcCount = m_oIterateCount->GetValue(); + if(m_oIterateDelta.IsInit()) + ptr->xnumDelta.data.value = m_oIterateDelta->GetValue(); + if(m_oFullPrecision.IsInit()) + ptr->fFullPrec = m_oFullPrecision->GetValue(); + if(m_oCalcCompleted.IsInit()) + ptr->fSomeUncalced = m_oCalcCompleted->GetValue(); + if(m_oCalcOnSave.IsInit()) + ptr->fSaveRecalc = m_oCalcOnSave->GetValue(); + if(m_oConcurrentCalc.IsInit()) + ptr->fMTREnabled = m_oConcurrentCalc->GetValue(); + if(m_oConcurrentManualCount.IsInit()) + ptr->cUserThreadCount = m_oConcurrentManualCount->GetValue(); + if(m_oForceFullCalc.IsInit()) + ptr->fNoDeps = m_oForceFullCalc->GetValue(); return objectPtr; } diff --git a/OOXML/XlsxFormat/Workbook/DefinedNames.cpp b/OOXML/XlsxFormat/Workbook/DefinedNames.cpp index 549742369b..123b50a443 100644 --- a/OOXML/XlsxFormat/Workbook/DefinedNames.cpp +++ b/OOXML/XlsxFormat/Workbook/DefinedNames.cpp @@ -77,24 +77,37 @@ namespace OOX auto ptr(new XLSB::Name); XLS::BaseObjectPtr objectPtr(ptr); + if(m_oComment.IsInit()) ptr->comment = m_oComment.get(); + if(m_oDescription.IsInit()) ptr->description = m_oDescription.get(); + if(m_oFunction.IsInit()) ptr->fFunc = m_oFunction->GetValue(); + if(m_oFunctionGroupId.IsInit()) ptr->fGrp = m_oFunctionGroupId->GetValue(); + if(m_oHelp.IsInit()) ptr->helpTopic = m_oHelp.get(); + if(m_oHidden.IsInit()) ptr->fHidden = m_oHidden->GetValue(); if (m_oLocalSheetId.IsInit()) ptr->itab = m_oLocalSheetId->GetValue(); + if (m_oName.IsInit()) ptr->name = m_oName.get(); + if (m_oPublishToServer.IsInit()) ptr->fPublished = m_oPublishToServer->GetValue(); + if (m_oShortcutKey.IsInit()) ptr->chKey = std::stoi(m_oShortcutKey.get()); + if (m_oVbProcedure.IsInit()) ptr->fOB = m_oVbProcedure->GetValue(); + if (m_oWorkbookParameter.IsInit()) ptr->fWorkbookParam = m_oWorkbookParameter->GetValue(); + if (m_oXlm.IsInit()) ptr->fFutureFunction = m_oXlm->GetValue(); + if (m_oRef.IsInit()) ptr->rgce = m_oRef.get(); return objectPtr; diff --git a/OOXML/XlsxFormat/Workbook/Workbook.cpp b/OOXML/XlsxFormat/Workbook/Workbook.cpp index 015217a2cc..91c3cedf14 100644 --- a/OOXML/XlsxFormat/Workbook/Workbook.cpp +++ b/OOXML/XlsxFormat/Workbook/Workbook.cpp @@ -91,7 +91,8 @@ namespace OOX auto ptr1(new XLSB::BeginPivotCacheID); ptr->m_BrtBeginPivotCacheID = XLS::BaseObjectPtr{ptr1}; - ptr1->idSx = m_oCacheId->GetValue(); + if(m_oCacheId.IsInit()) + ptr1->idSx = m_oCacheId->GetValue(); if(m_oRid.IsInit()) ptr1->irstcacheRelID.value = m_oRid->GetValue(); return objectPtr; diff --git a/OOXML/XlsxFormat/Workbook/WorkbookPr.cpp b/OOXML/XlsxFormat/Workbook/WorkbookPr.cpp index c113a44e7e..b5c8a37e53 100644 --- a/OOXML/XlsxFormat/Workbook/WorkbookPr.cpp +++ b/OOXML/XlsxFormat/Workbook/WorkbookPr.cpp @@ -94,23 +94,43 @@ namespace OOX auto ptr(new XLSB::WbProp); XLS::BaseObjectPtr objectPtr(ptr); - ptr->fNoSaveSup = m_oAllowRefreshQuery->GetValue(); + if(m_oAllowRefreshQuery.IsInit()) + ptr->fNoSaveSup = m_oAllowRefreshQuery->GetValue(); + if(m_oAutoCompressPictures.IsInit()) ptr->fAutoCompressPictures = m_oAutoCompressPictures->GetValue(); + if(m_oBackupFile.IsInit()) ptr->fBackup = m_oBackupFile->GetValue(); + if(m_oCheckCompatibility.IsInit()) ptr->fCheckCompat = m_oCheckCompatibility->GetValue(); - ptr->strName.value= m_oCodeName->GetValue(); + if(m_oCodeName.IsInit()) + ptr->strName.value = m_oCodeName->GetValue(); + else + ptr->strName.value = false; + if(m_oDate1904.IsInit()) ptr->f1904 = m_oDate1904->GetValue(); + if(m_oDateCompatibility.IsInit()) ptr->fNoSaveSup = m_oDateCompatibility->GetValue(); + if(m_oDefaultThemeVersion.IsInit()) ptr->dwThemeVersion = m_oDefaultThemeVersion->GetValue(); + if(m_oFilterPrivacy.IsInit()) ptr->fFilterPrivacy = m_oFilterPrivacy->GetValue(); + if(m_oHidePivotFieldList.IsInit()) ptr->fHidePivotTableFList = m_oHidePivotFieldList->GetValue(); + if(m_oPromptedSolutions.IsInit()) ptr->fBuggedUserAboutSolution = m_oPromptedSolutions->GetValue(); + if(m_oPublishItems.IsInit()) ptr->fPublishedBookItems = m_oPublishItems->GetValue(); + if(m_oRefreshAllConnections.IsInit()) ptr->fRefreshAll = m_oRefreshAllConnections->GetValue(); + if(m_oShowBorderUnselectedTables.IsInit()) ptr->fHideBorderUnselLists = m_oShowBorderUnselectedTables->GetValue(); + if(m_oShowInkAnnotation.IsInit()) ptr->fShowInkAnnotation = m_oShowInkAnnotation->GetValue(); + if(m_oShowObjects.IsInit()) ptr->mdDspObj = m_oShowObjects->GetValue() ? 1 : 2; + if(m_oShowPivotChartFilter.IsInit()) ptr->fShowPivotChartFilter = m_oShowPivotChartFilter->GetValue(); + if(m_oUpdateLinks.IsInit()) ptr->grbitUpdateLinks = m_oUpdateLinks->GetValue(); return objectPtr; @@ -218,44 +238,58 @@ namespace OOX ptr->ipdBookPasswordData.szAlgName = m_oWorkbookAlgorithmName->GetValue(); ptr->dwBookSpinCount = m_oWorkbookSpinCount->GetValue(); - auto len = 0; - auto bytes = ptr->ipdBookPasswordData.rgbHash.rgbData.data(); - std::string strData = {m_oWorkbookHashValue.get().begin(), m_oWorkbookHashValue.get().end()}; - NSFile::CBase64Converter::Decode(strData.c_str(), strData.size(), - bytes, len); - ptr->ipdBookPasswordData.rgbHash.cbLength = len; + if(m_oWorkbookHashValue.IsInit()) + { + auto len = 0; + auto bytes = ptr->ipdBookPasswordData.rgbHash.rgbData.data(); + std::string strData = {m_oWorkbookHashValue.get().begin(), m_oWorkbookHashValue.get().end()}; + NSFile::CBase64Converter::Decode(strData.c_str(), strData.size(), + bytes, len); + ptr->ipdBookPasswordData.rgbHash.cbLength = len; + } + if(m_oWorkbookSaltValue.IsInit()) + { + auto len1 = 0; + auto bytes1 = ptr->ipdBookPasswordData.rgbHash.rgbData.data(); + std::string strData1 = {m_oWorkbookSaltValue.get().begin(), m_oWorkbookSaltValue.get().end()}; + NSFile::CBase64Converter::Decode(strData1.c_str(), strData1.size(), + bytes1, len1); + ptr->ipdBookPasswordData.rgbSalt.cbLength = len1; + } + if(m_oRevisionsAlgorithmName.IsInit()) + ptr->ipdRevPasswordData.szAlgName = m_oRevisionsAlgorithmName->GetValue(); + if(m_oRevisionsSpinCount.IsInit()) + ptr->dwRevSpinCount = m_oRevisionsSpinCount->GetValue(); - auto len1 = 0; - auto bytes1 = ptr->ipdBookPasswordData.rgbHash.rgbData.data(); - std::string strData1 = {m_oWorkbookSaltValue.get().begin(), m_oWorkbookSaltValue.get().end()}; - NSFile::CBase64Converter::Decode(strData1.c_str(), strData1.size(), - bytes1, len1); - ptr->ipdBookPasswordData.rgbSalt.cbLength = len1; - - ptr->ipdRevPasswordData.szAlgName = m_oRevisionsAlgorithmName->GetValue(); - ptr->dwRevSpinCount = m_oRevisionsSpinCount->GetValue(); - - auto len2 = 0; - auto bytes2 = ptr->ipdRevPasswordData.rgbHash.rgbData.data(); - std::string strData2 = {m_oRevisionsHashValue.get().begin(), m_oRevisionsHashValue.get().end()}; - NSFile::CBase64Converter::Decode(strData2.c_str(), strData2.size(), - bytes2, len2); - ptr->ipdRevPasswordData.rgbHash.cbLength = len2; - - auto len3 = 0; - auto bytes3 = ptr->ipdRevPasswordData.rgbSalt.rgbData.data(); - std::string strData3 = {m_oRevisionsSaltValue.get().begin(), m_oRevisionsSaltValue.get().end()}; - NSFile::CBase64Converter::Decode(strData3.c_str(), strData3.size(), - bytes3, len3); - ptr->ipdRevPasswordData.rgbSalt.cbLength = len3; + if(m_oRevisionsHashValue.IsInit()) + { + auto len2 = 0; + auto bytes2 = ptr->ipdRevPasswordData.rgbHash.rgbData.data(); + std::string strData2 = {m_oRevisionsHashValue.get().begin(), m_oRevisionsHashValue.get().end()}; + NSFile::CBase64Converter::Decode(strData2.c_str(), strData2.size(), + bytes2, len2); + ptr->ipdRevPasswordData.rgbHash.cbLength = len2; + } + if(m_oRevisionsSaltValue.IsInit()) + { + auto len3 = 0; + auto bytes3 = ptr->ipdRevPasswordData.rgbSalt.rgbData.data(); + std::string strData3 = {m_oRevisionsSaltValue.get().begin(), m_oRevisionsSaltValue.get().end()}; + NSFile::CBase64Converter::Decode(strData3.c_str(), strData3.size(), + bytes3, len3); + ptr->ipdRevPasswordData.rgbSalt.cbLength = len3; + } } else { auto ptr(new XLSB::BookProtection); objectPtr = XLS::BaseObjectPtr{ptr}; + if(m_oLockRevision.IsInit()) ptr->wFlags.fLockRevision = m_oLockRevision->GetValue(); + if(m_oLockStructure.IsInit()) ptr->wFlags.fLockStructure = m_oLockStructure->GetValue(); + if(m_oLockWindows.IsInit()) ptr->wFlags.fLockWindow = m_oLockWindows->GetValue(); } return objectPtr; diff --git a/OOXML/XlsxFormat/Worksheets/WorksheetChildOther.cpp b/OOXML/XlsxFormat/Worksheets/WorksheetChildOther.cpp index 3fdf81143b..d45534798e 100644 --- a/OOXML/XlsxFormat/Worksheets/WorksheetChildOther.cpp +++ b/OOXML/XlsxFormat/Worksheets/WorksheetChildOther.cpp @@ -563,7 +563,7 @@ namespace OOX XLS::BaseObjectPtr objectPtr(ptr); if(m_oBlackAndWhite.IsInit()) ptr->fNoColor = m_oBlackAndWhite->m_eValue; - if (ptr->fNoColor) + if (ptr->fNoColor && m_oCellComments.IsInit()) { if (m_oCellComments == SimpleTypes::Spreadsheet::ECellComments::cellcommentsAtEnd) ptr->fNotes = true; @@ -571,14 +571,29 @@ namespace OOX ptr->fNotes = false; } - ptr->iCopies = m_oCopies->m_eValue; - ptr->fDraft = m_oDraft->m_eValue; - ptr->iErrors = m_oErrors->m_eValue; - ptr->iPageStart = m_oFirstPageNumber->m_eValue; - ptr->iFitHeight = m_oFitToHeight->m_eValue; - ptr->iFitWidth = m_oFitToWidth->m_eValue; - ptr->iRes = m_oHorizontalDpi->m_eValue; - ptr->szRelID = m_oRId->GetValue(); + if (m_oCopies.IsInit()) + ptr->iCopies = m_oCopies->m_eValue; + + if (m_oDraft.IsInit()) + ptr->fDraft = m_oDraft->m_eValue; + + if (m_oErrors.IsInit()) + ptr->iErrors = m_oErrors->m_eValue; + + if (m_oFirstPageNumber.IsInit()) + ptr->iPageStart = m_oFirstPageNumber->m_eValue; + + if (m_oFitToHeight.IsInit()) + ptr->iFitHeight = m_oFitToHeight->m_eValue; + + if (m_oFitToWidth.IsInit()) + ptr->iFitWidth = m_oFitToWidth->m_eValue; + + if (m_oHorizontalDpi.IsInit()) + ptr->iRes = m_oHorizontalDpi->m_eValue; + + if (m_oRId.IsInit()) + ptr->szRelID = m_oRId->GetValue(); if (m_oOrientation == SimpleTypes::EPageOrientation::pageorientLandscape) ptr->fLandscape = true; @@ -590,10 +605,17 @@ namespace OOX else ptr->fLeftToRight = false; - ptr->iPaperSize = m_oPaperSize->m_eValue; - ptr->iScale = m_oScale->m_eValue; - ptr->fUsePage = m_oUseFirstPageNumber->m_eValue; - ptr->iVRes = m_oVerticalDpi->m_eValue; + if (m_oPaperSize.IsInit()) + ptr->iPaperSize = m_oPaperSize->m_eValue; + + if (m_oScale.IsInit()) + ptr->iScale = m_oScale->m_eValue; + + if (m_oUseFirstPageNumber.IsInit()) + ptr->fUsePage = m_oUseFirstPageNumber->m_eValue; + + if (m_oVerticalDpi.IsInit()) + ptr->iVRes = m_oVerticalDpi->m_eValue; return objectPtr; } @@ -612,20 +634,37 @@ namespace OOX ptr->fNotes = false; } - ptr->iCopies = m_oCopies->m_eValue; - ptr->fDraft = m_oDraft->m_eValue; - ptr->iPageStart = m_oFirstPageNumber->m_eValue; - ptr->iRes = m_oHorizontalDpi->m_eValue; - ptr->szRelID = m_oRId->GetValue(); + if (m_oCopies.IsInit()) + ptr->iCopies = m_oCopies->m_eValue; - if (m_oOrientation == SimpleTypes::EPageOrientation::pageorientLandscape) - ptr->fLandscape = true; - else - ptr->fLandscape = false; + if (m_oDraft.IsInit()) + ptr->fDraft = m_oDraft->m_eValue; - ptr->iPaperSize = m_oPaperSize->m_eValue; - ptr->fUsePage = m_oUseFirstPageNumber->m_eValue; - ptr->iVRes = m_oVerticalDpi->m_eValue; + if (m_oFirstPageNumber.IsInit()) + ptr->iPageStart = m_oFirstPageNumber->m_eValue; + + if (m_oHorizontalDpi.IsInit()) + ptr->iRes = m_oHorizontalDpi->m_eValue; + + if (m_oRId.IsInit()) + ptr->szRelID = m_oRId->GetValue(); + + if (m_oOrientation.IsInit()) + { + if (m_oOrientation == SimpleTypes::EPageOrientation::pageorientLandscape) + ptr->fLandscape = true; + else + ptr->fLandscape = false; + } + + if (m_oPaperSize.IsInit()) + ptr->iPaperSize = m_oPaperSize->m_eValue; + + if (m_oUseFirstPageNumber.IsInit()) + ptr->fUsePage = m_oUseFirstPageNumber->m_eValue; + + if (m_oVerticalDpi.IsInit()) + ptr->iVRes = m_oVerticalDpi->m_eValue; return objectPtr; } } @@ -1215,33 +1254,55 @@ namespace OOX { auto pWsView(new XLSB::BeginWsView); XLS::BaseObjectPtr castedPtr(pWsView); - pWsView->icvHdr = m_oColorId->m_eValue; - pWsView->fDefaultHdr = m_oDefaultGridColor->m_eValue; - pWsView->fRightToLeft = m_oRightToLeft->m_eValue; - pWsView->fDspFmlaRt = m_oShowFormulas->m_eValue; - pWsView->fDspGridRt = m_oShowGridLines->m_eValue; - pWsView->fDspGuts = m_oShowOutlineSymbols->m_eValue; - pWsView->fDspRwColRt = m_oShowRowColHeaders->m_eValue; - pWsView->fDspRuler = m_oShowRuler->m_eValue; - pWsView->fWhitespaceHidden = m_oShowWhiteSpace->m_eValue; - pWsView->fDspZerosRt = m_oShowZeros->m_eValue; - pWsView->fSelected = m_oTabSelected->m_eValue; - pWsView->topLeftCell = m_oTopLeftCell.get(); - pWsView->xlView = m_oView->m_eValue; - pWsView->fWnProt = m_oWindowProtection->m_eValue; - pWsView->iWbkView = m_oWorkbookViewId->m_eValue; - pWsView->wScale = m_oZoomScale->m_eValue; - pWsView->wScaleNormal = m_oZoomScaleNormal->m_eValue; - pWsView->wScalePLV = m_oZoomScalePageLayoutView->m_eValue; - pWsView->wScaleSLV = m_oZoomScaleSheetLayoutView->m_eValue; + if (m_oColorId.IsInit()) + pWsView->icvHdr = m_oColorId->m_eValue; + if (m_oDefaultGridColor.IsInit()) + pWsView->fDefaultHdr = m_oDefaultGridColor->m_eValue; + if (m_oRightToLeft.IsInit()) + pWsView->fRightToLeft = m_oRightToLeft->m_eValue; + if (m_oShowFormulas.IsInit()) + pWsView->fDspFmlaRt = m_oShowFormulas->m_eValue; + if (m_oShowGridLines.IsInit()) + pWsView->fDspGridRt = m_oShowGridLines->m_eValue; + if (m_oShowOutlineSymbols.IsInit()) + pWsView->fDspGuts = m_oShowOutlineSymbols->m_eValue; + if (m_oShowRowColHeaders.IsInit()) + pWsView->fDspRwColRt = m_oShowRowColHeaders->m_eValue; + if (m_oShowRuler.IsInit()) + pWsView->fDspRuler = m_oShowRuler->m_eValue; + if (m_oShowWhiteSpace.IsInit()) + pWsView->fWhitespaceHidden = m_oShowWhiteSpace->m_eValue; + if (m_oShowZeros.IsInit()) + pWsView->fDspZerosRt = m_oShowZeros->m_eValue; + if (m_oTabSelected.IsInit()) + pWsView->fSelected = m_oTabSelected->m_eValue; + if(m_oTopLeftCell.IsInit()) + pWsView->topLeftCell = m_oTopLeftCell.get(); + if (m_oView.IsInit()) + pWsView->xlView = m_oView->m_eValue; + if (m_oWindowProtection.IsInit()) + pWsView->fWnProt = m_oWindowProtection->m_eValue; + if (m_oWorkbookViewId.IsInit()) + pWsView->iWbkView = m_oWorkbookViewId->m_eValue; + if (m_oZoomScale.IsInit()) + pWsView->wScale = m_oZoomScale->m_eValue; + if (m_oZoomScaleNormal.IsInit()) + pWsView->wScaleNormal = m_oZoomScaleNormal->m_eValue; + if (m_oZoomScalePageLayoutView.IsInit()) + pWsView->wScalePLV = m_oZoomScalePageLayoutView->m_eValue; + if (m_oZoomScaleSheetLayoutView.IsInit()) + pWsView->wScaleSLV = m_oZoomScaleSheetLayoutView->m_eValue; return castedPtr; } else { auto pWsView(new XLSB::BeginCsView); XLS::BaseObjectPtr castedPtr(pWsView); + if(m_oTabSelected.IsInit()) pWsView->fSelected = m_oTabSelected->m_eValue; + if(m_oWorkbookViewId.IsInit()) pWsView->iWbkView = m_oWorkbookViewId->m_eValue; + if(m_oZoomScale.IsInit()) pWsView->wScale = m_oZoomScale->m_eValue; return castedPtr; } @@ -1852,9 +1913,13 @@ namespace OOX auto castedBegin(new XLSB::BeginHeaderFooter); ptr->m_BrtBeginHeaderFooter = XLS::BaseObjectPtr{castedBegin}; + if(m_oAlignWithMargins.IsInit()) castedBegin->fHFAlignMargins = m_oAlignWithMargins->m_eValue; + if(m_oDifferentFirst.IsInit()) castedBegin->fHFDiffFirst = m_oDifferentFirst->m_eValue; + if(m_oDifferentOddEven.IsInit()) castedBegin->fHFDiffOddEven = m_oDifferentOddEven->m_eValue; + if(m_oScaleWithDoc.IsInit()) castedBegin->fHFScaleWithDoc = m_oScaleWithDoc->m_eValue; if(m_oOddHeader.IsInit()) @@ -2339,24 +2404,56 @@ namespace OOX auto ptr(new XLSB::SheetProtection); XLS::BaseObjectPtr castedPtr(ptr); - ptr->protpwd = std::stoul(m_oPassword.get()); - ptr->fAutoFilter = m_oAutoFilter->GetValue(); + if (m_oPassword.IsInit()) + ptr->protpwd = std::stoul(m_oPassword.get()); - ptr->fDeleteColumns = m_oDeleteColumns->GetValue(); - ptr->fDeleteRows = m_oDeleteRows->GetValue(); - ptr->fFormatCells = m_oFormatCells->GetValue(); - ptr->fFormatColumns = m_oFormatColumns->GetValue(); - ptr->fFormatRows = m_oFormatRows->GetValue(); - ptr->fInsertColumns = m_oInsertColumns->GetValue(); - ptr->fInsertHyperlinks = m_oInsertHyperlinks->GetValue(); - ptr->fInsertRows = m_oInsertRows->GetValue(); - ptr->fObjects = m_oObjects->GetValue(); - ptr->fPivotTables = m_oPivotTables->GetValue(); - ptr->fScenarios = m_oScenarios->GetValue(); - ptr->fSelLockedCells = m_oSelectLockedCells->GetValue(); - ptr->fSelUnlockedCells = m_oSelectUnlockedCells->GetValue(); - ptr->fLocked = m_oSheet->GetValue(); - ptr->fSort = m_oSort->GetValue(); + if (m_oAutoFilter.IsInit()) + ptr->fAutoFilter = m_oAutoFilter->GetValue(); + + if (m_oDeleteColumns.IsInit()) + ptr->fDeleteColumns = m_oDeleteColumns->GetValue(); + + if (m_oDeleteRows.IsInit()) + ptr->fDeleteRows = m_oDeleteRows->GetValue(); + + if (m_oFormatCells.IsInit()) + ptr->fFormatCells = m_oFormatCells->GetValue(); + + if (m_oFormatColumns.IsInit()) + ptr->fFormatColumns = m_oFormatColumns->GetValue(); + + if (m_oFormatRows.IsInit()) + ptr->fFormatRows = m_oFormatRows->GetValue(); + + if (m_oInsertColumns.IsInit()) + ptr->fInsertColumns = m_oInsertColumns->GetValue(); + + if (m_oInsertHyperlinks.IsInit()) + ptr->fInsertHyperlinks = m_oInsertHyperlinks->GetValue(); + + if (m_oInsertRows.IsInit()) + ptr->fInsertRows = m_oInsertRows->GetValue(); + + if (m_oObjects.IsInit()) + ptr->fObjects = m_oObjects->GetValue(); + + if (m_oPivotTables.IsInit()) + ptr->fPivotTables = m_oPivotTables->GetValue(); + + if (m_oScenarios.IsInit()) + ptr->fScenarios = m_oScenarios->GetValue(); + + if (m_oSelectLockedCells.IsInit()) + ptr->fSelLockedCells = m_oSelectLockedCells->GetValue(); + + if (m_oSelectUnlockedCells.IsInit()) + ptr->fSelUnlockedCells = m_oSelectUnlockedCells->GetValue(); + + if (m_oSheet.IsInit()) + ptr->fLocked = m_oSheet->GetValue(); + + if (m_oSort.IsInit()) + ptr->fSort = m_oSort->GetValue(); return castedPtr; } @@ -2364,38 +2461,76 @@ namespace OOX { auto ptr(new XLSB::SheetProtectionIso); XLS::BaseObjectPtr castedPtr(ptr); - - ptr->ipdPasswordData.szAlgName = m_oAlgorithmName->GetValue(); - ptr->dwSpinCount = m_oSpinCount->GetValue(); + if(m_oAlgorithmName.IsInit()) + ptr->ipdPasswordData.szAlgName = m_oAlgorithmName->GetValue(); + if(m_oSpinCount.IsInit()) + ptr->dwSpinCount = m_oSpinCount->GetValue(); + if(m_oHashValue.IsInit()) + { byte * temp = ptr->ipdPasswordData.rgbHash.rgbData.data(); auto tempSize = 0; NSFile::CBase64Converter::CBase64Converter::Decode(std::string{m_oHashValue.get().begin(), m_oHashValue.get().end()}.c_str(), m_oHashValue.get().size(), temp, tempSize); ptr->ipdPasswordData.rgbHash.cbLength = tempSize; + } - byte * temp2 = ptr->ipdPasswordData.rgbSalt.rgbData.data(); - auto tempSize2 = 0; - NSFile::CBase64Converter::Decode(std::string{m_oSaltValue.get().begin(), - m_oSaltValue.get().end()}.c_str(), m_oSaltValue.get().size(), temp2, tempSize2); - ptr->ipdPasswordData.rgbSalt.cbLength = tempSize2; + if(m_oSaltValue.IsInit()) + { + byte * temp2 = ptr->ipdPasswordData.rgbSalt.rgbData.data(); + auto tempSize2 = 0; + NSFile::CBase64Converter::Decode(std::string{m_oSaltValue.get().begin(), + m_oSaltValue.get().end()}.c_str(), m_oSaltValue.get().size(), temp2, tempSize2); + ptr->ipdPasswordData.rgbSalt.cbLength = tempSize2; + } + if(m_oAutoFilter.IsInit()) ptr->fAutoFilter = m_oAutoFilter->GetValue(); - ptr->fDeleteColumns = m_oDeleteColumns->GetValue(); - ptr->fDeleteRows = m_oDeleteRows->GetValue(); - ptr->fFormatCells = m_oFormatCells->GetValue(); - ptr->fFormatColumns = m_oFormatColumns->GetValue(); - ptr->fFormatRows = m_oFormatRows->GetValue(); - ptr->fInsertColumns = m_oInsertColumns->GetValue(); - ptr->fInsertHyperlinks = m_oInsertHyperlinks->GetValue(); - ptr->fInsertRows = m_oInsertRows->GetValue(); - ptr->fObjects = m_oObjects->GetValue(); - ptr->fPivotTables = m_oPivotTables->GetValue(); - ptr->fScenarios = m_oScenarios->GetValue(); - ptr->fSelLockedCells = m_oSelectLockedCells->GetValue(); - ptr->fSelUnlockedCells = m_oSelectUnlockedCells->GetValue(); - ptr->fLocked = m_oSheet->GetValue(); - ptr->fSort = m_oSort->GetValue(); + if (m_oDeleteColumns.IsInit()) + ptr->fDeleteColumns = m_oDeleteColumns->GetValue(); + + if (m_oDeleteRows.IsInit()) + ptr->fDeleteRows = m_oDeleteRows->GetValue(); + + if (m_oFormatCells.IsInit()) + ptr->fFormatCells = m_oFormatCells->GetValue(); + + if (m_oFormatColumns.IsInit()) + ptr->fFormatColumns = m_oFormatColumns->GetValue(); + + if (m_oFormatRows.IsInit()) + ptr->fFormatRows = m_oFormatRows->GetValue(); + + if (m_oInsertColumns.IsInit()) + ptr->fInsertColumns = m_oInsertColumns->GetValue(); + + if (m_oInsertHyperlinks.IsInit()) + ptr->fInsertHyperlinks = m_oInsertHyperlinks->GetValue(); + + if (m_oInsertRows.IsInit()) + ptr->fInsertRows = m_oInsertRows->GetValue(); + + if (m_oObjects.IsInit()) + ptr->fObjects = m_oObjects->GetValue(); + + if (m_oPivotTables.IsInit()) + ptr->fPivotTables = m_oPivotTables->GetValue(); + + if (m_oScenarios.IsInit()) + ptr->fScenarios = m_oScenarios->GetValue(); + + if (m_oSelectLockedCells.IsInit()) + ptr->fSelLockedCells = m_oSelectLockedCells->GetValue(); + + if (m_oSelectUnlockedCells.IsInit()) + ptr->fSelUnlockedCells = m_oSelectUnlockedCells->GetValue(); + + if (m_oSheet.IsInit()) + ptr->fLocked = m_oSheet->GetValue(); + + if (m_oSort.IsInit()) + ptr->fSort = m_oSort->GetValue(); + return castedPtr; } }