diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-09 03:49:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-09 16:56:00 +0200 |
commit | ba42d726d7c2b80341b3942ef8c44cce3e44b812 (patch) | |
tree | 8e83f2e443460295d73ce6d090ef67da17dd0eb5 | |
parent | d89a4213520996b73fdb74685f24647a37536f4d (diff) |
dump the whole selection and not just one cell
Change-Id: I059b5547d07c5e8f042e22f9de34ce51ffe49c38
Reviewed-on: https://gerrit.libreoffice.org/36313
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/README | 4 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin_dbgutil.cxx | 54 |
2 files changed, 50 insertions, 8 deletions
diff --git a/sc/README b/sc/README index 7c3bcfe1d539..8dfb5ec613d7 100644 --- a/sc/README +++ b/sc/README @@ -12,5 +12,5 @@ Dumps the graphic objects and their position and size in pixel. === CTRL+SHIFT+F9 === -Dumps the SfxItemSet representing the cell properties of the -current cell as a xml file. +Dumps the SfxItemSet representing the cell properties' of the +current selection as a xml file. The file will be named dump.xml diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index 36e7f85faa01..70a594e65475 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -67,20 +67,62 @@ void ScGridWindow::dumpColumnInformationHmm() void ScGridWindow::dumpCellProperties() { ScDocument* pDoc = pViewData->GetDocument(); - + const ScMarkData& rMark = pViewData->GetMarkData(); SCTAB nTab = pViewData->GetTabNo(); - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - const ScPatternAttr* pPatternAttr = pDoc->GetPattern(nCol,nRow,nTab); + + ScRangeList aList; + 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"); xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 ); xmlTextWriterSetIndent(writer,1); - xmlTextWriterSetIndentString(writer, BAD_CAST(" ")); + xmlTextWriterSetIndentString(writer, BAD_CAST(" ")); 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 ); xmlFreeTextWriter (writer); |