Kaydet (Commit) 4b363760 authored tarafından Noel Grandin's avatar Noel Grandin

don't leave empty slots in array in ScXMLExport::GetViewSettings

the code was creating 4 entries in the array, but potentially not
putting anything there

Change-Id: Ia44aea42b3939842f921d30996c5f10e595fd768
Reviewed-on: https://gerrit.libreoffice.org/62894
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 347f3475
......@@ -5116,73 +5116,65 @@ void ScXMLExport::GetChangeTrackViewSettings(uno::Sequence<beans::PropertyValue>
sal_Int32 nChangePos(rProps.getLength());
rProps.realloc(nChangePos + 1);
beans::PropertyValue* pProps(rProps.getArray());
if (pProps)
{
uno::Sequence<beans::PropertyValue> aChangeProps(SC_VIEWCHANGES_COUNT);
beans::PropertyValue* pChangeProps(aChangeProps.getArray());
if (pChangeProps)
{
pChangeProps[SC_SHOW_CHANGES].Name = "ShowChanges";
pChangeProps[SC_SHOW_CHANGES].Value <<= pViewSettings->ShowChanges();
pChangeProps[SC_SHOW_ACCEPTED_CHANGES].Name = "ShowAcceptedChanges";
pChangeProps[SC_SHOW_ACCEPTED_CHANGES].Value <<= pViewSettings->IsShowAccepted();
pChangeProps[SC_SHOW_REJECTED_CHANGES].Name = "ShowRejectedChanges";
pChangeProps[SC_SHOW_REJECTED_CHANGES].Value <<= pViewSettings->IsShowRejected();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME].Name = "ShowChangesByDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME].Value <<= pViewSettings->HasDate();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_MODE].Name = "ShowChangesByDatetimeMode";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_MODE].Value <<= static_cast<sal_Int16>(pViewSettings->GetTheDateMode());
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME].Name = "ShowChangesByDatetimeFirstDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME].Value <<= pViewSettings->GetTheFirstDateTime().GetUNODateTime();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME].Name = "ShowChangesByDatetimeSecondDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME].Value <<= pViewSettings->GetTheLastDateTime().GetUNODateTime();
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR].Name = "ShowChangesByAuthor";
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR].Value <<= pViewSettings->HasAuthor();
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR_NAME].Name = "ShowChangesByAuthorName";
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR_NAME].Value <<= pViewSettings->GetTheAuthorToShow();
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT].Name = "ShowChangesByComment";
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT].Value <<= pViewSettings->HasComment();
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT_TEXT].Name = "ShowChangesByCommentText";
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT_TEXT].Value <<= pViewSettings->GetTheComment();
pChangeProps[SC_SHOW_CHANGES_BY_RANGES].Name = "ShowChangesByRanges";
pChangeProps[SC_SHOW_CHANGES_BY_RANGES].Value <<= pViewSettings->HasRange();
OUString sRangeList;
ScRangeStringConverter::GetStringFromRangeList(sRangeList, &(pViewSettings->GetTheRangeList()), GetDocument(), FormulaGrammar::CONV_OOO);
pChangeProps[SC_SHOW_CHANGES_BY_RANGES_LIST].Name = "ShowChangesByRangesList";
pChangeProps[SC_SHOW_CHANGES_BY_RANGES_LIST].Value <<= sRangeList;
pProps[nChangePos].Name = "TrackedChangesViewSettings";
pProps[nChangePos].Value <<= aChangeProps;
}
}
uno::Sequence<beans::PropertyValue> aChangeProps(SC_VIEWCHANGES_COUNT);
beans::PropertyValue* pChangeProps(aChangeProps.getArray());
pChangeProps[SC_SHOW_CHANGES].Name = "ShowChanges";
pChangeProps[SC_SHOW_CHANGES].Value <<= pViewSettings->ShowChanges();
pChangeProps[SC_SHOW_ACCEPTED_CHANGES].Name = "ShowAcceptedChanges";
pChangeProps[SC_SHOW_ACCEPTED_CHANGES].Value <<= pViewSettings->IsShowAccepted();
pChangeProps[SC_SHOW_REJECTED_CHANGES].Name = "ShowRejectedChanges";
pChangeProps[SC_SHOW_REJECTED_CHANGES].Value <<= pViewSettings->IsShowRejected();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME].Name = "ShowChangesByDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME].Value <<= pViewSettings->HasDate();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_MODE].Name = "ShowChangesByDatetimeMode";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_MODE].Value <<= static_cast<sal_Int16>(pViewSettings->GetTheDateMode());
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME].Name = "ShowChangesByDatetimeFirstDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME].Value <<= pViewSettings->GetTheFirstDateTime().GetUNODateTime();
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME].Name = "ShowChangesByDatetimeSecondDatetime";
pChangeProps[SC_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME].Value <<= pViewSettings->GetTheLastDateTime().GetUNODateTime();
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR].Name = "ShowChangesByAuthor";
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR].Value <<= pViewSettings->HasAuthor();
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR_NAME].Name = "ShowChangesByAuthorName";
pChangeProps[SC_SHOW_CHANGES_BY_AUTHOR_NAME].Value <<= pViewSettings->GetTheAuthorToShow();
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT].Name = "ShowChangesByComment";
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT].Value <<= pViewSettings->HasComment();
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT_TEXT].Name = "ShowChangesByCommentText";
pChangeProps[SC_SHOW_CHANGES_BY_COMMENT_TEXT].Value <<= pViewSettings->GetTheComment();
pChangeProps[SC_SHOW_CHANGES_BY_RANGES].Name = "ShowChangesByRanges";
pChangeProps[SC_SHOW_CHANGES_BY_RANGES].Value <<= pViewSettings->HasRange();
OUString sRangeList;
ScRangeStringConverter::GetStringFromRangeList(sRangeList, &(pViewSettings->GetTheRangeList()), GetDocument(), FormulaGrammar::CONV_OOO);
pChangeProps[SC_SHOW_CHANGES_BY_RANGES_LIST].Name = "ShowChangesByRangesList";
pChangeProps[SC_SHOW_CHANGES_BY_RANGES_LIST].Value <<= sRangeList;
pProps[nChangePos].Name = "TrackedChangesViewSettings";
pProps[nChangePos].Value <<= aChangeProps;
}
}
void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
{
rProps.realloc(4);
beans::PropertyValue* pProps(rProps.getArray());
if(pProps)
if (GetModel().is())
{
if (GetModel().is())
rProps.realloc(4);
beans::PropertyValue* pProps(rProps.getArray());
ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
if (pDocObj)
{
ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
if (pDocObj)
SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
if (pEmbeddedObj)
{
SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
if (pEmbeddedObj)
{
tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
sal_uInt16 i(0);
pProps[i].Name = "VisibleAreaTop";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getY());
pProps[++i].Name = "VisibleAreaLeft";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getX());
pProps[++i].Name = "VisibleAreaWidth";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getWidth());
pProps[++i].Name = "VisibleAreaHeight";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getHeight());
}
tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
sal_uInt16 i(0);
pProps[i].Name = "VisibleAreaTop";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getY());
pProps[++i].Name = "VisibleAreaLeft";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getX());
pProps[++i].Name = "VisibleAreaWidth";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getWidth());
pProps[++i].Name = "VisibleAreaHeight";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getHeight());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment