Kaydet (Commit) ba42d726 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

dump the whole selection and not just one cell

Change-Id: I059b5547d07c5e8f042e22f9de34ce51ffe49c38
Reviewed-on: https://gerrit.libreoffice.org/36313Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst d89a4213
...@@ -12,5 +12,5 @@ Dumps the graphic objects and their position and size in pixel. ...@@ -12,5 +12,5 @@ Dumps the graphic objects and their position and size in pixel.
=== CTRL+SHIFT+F9 === === CTRL+SHIFT+F9 ===
Dumps the SfxItemSet representing the cell properties of the Dumps the SfxItemSet representing the cell properties' of the
current cell as a xml file. current selection as a xml file. The file will be named dump.xml
...@@ -67,20 +67,62 @@ void ScGridWindow::dumpColumnInformationHmm() ...@@ -67,20 +67,62 @@ void ScGridWindow::dumpColumnInformationHmm()
void ScGridWindow::dumpCellProperties() void ScGridWindow::dumpCellProperties()
{ {
ScDocument* pDoc = pViewData->GetDocument(); ScDocument* pDoc = pViewData->GetDocument();
const ScMarkData& rMark = pViewData->GetMarkData();
SCTAB nTab = pViewData->GetTabNo(); SCTAB nTab = pViewData->GetTabNo();
SCCOL nCol = pViewData->GetCurX();
SCROW nRow = pViewData->GetCurY(); ScRangeList aList;
const ScPatternAttr* pPatternAttr = pDoc->GetPattern(nCol,nRow,nTab); if (rMark.IsMultiMarked())
{
aList = rMark.GetMarkedRangesForTab(nTab);
}
else if (rMark.IsMarked())
{
ScRange aRange;
rMark.GetMarkArea(aRange);
aList.Join(aRange);
}
else
{
SCCOL nCol = pViewData->GetCurX();
SCROW nRow = pViewData->GetCurY();
ScRange aRange(nCol, nRow, nTab);
aList.Join(aRange, false);
}
OString aOutputFile("dump.xml"); OString aOutputFile("dump.xml");
xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 ); xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 );
xmlTextWriterSetIndent(writer,1); xmlTextWriterSetIndent(writer,1);
xmlTextWriterSetIndentString(writer, BAD_CAST(" ")); xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr ); xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
pPatternAttr->GetItemSet().dumpAsXml(writer); xmlTextWriterStartElement(writer, BAD_CAST("selection"));
for (size_t i = 0, n = aList.size(); i < n; ++i)
{
ScRange* pRange = aList[i];
if (!pRange)
continue;
for (SCCOL nCol = pRange->aStart.Col(); nCol <= pRange->aEnd.Col(); ++nCol)
{
for (SCROW nRow = pRange->aStart.Row(); nRow <= pRange->aEnd.Row(); ++nRow)
{
const ScPatternAttr* pPatternAttr = pDoc->GetPattern(nCol, nRow, nTab);
xmlTextWriterStartElement(writer, BAD_CAST("cell"));
xmlTextWriterWriteAttribute(writer, BAD_CAST("column"), BAD_CAST(OString::number(nCol).getStr()));
xmlTextWriterWriteAttribute(writer, BAD_CAST("row"), BAD_CAST(OString::number(nRow).getStr()));
xmlTextWriterWriteAttribute(writer, BAD_CAST("tab"), BAD_CAST(OString::number(nTab).getStr()));
pPatternAttr->GetItemSet().dumpAsXml(writer);
xmlTextWriterEndElement(writer);
}
}
}
xmlTextWriterEndElement(writer);
xmlTextWriterEndDocument( writer ); xmlTextWriterEndDocument( writer );
xmlFreeTextWriter (writer); xmlFreeTextWriter (writer);
......
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