[Libreoffice-commits] core.git: sc/README sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Apr 9 14:56:23 UTC 2017


 sc/README                             |    4 +-
 sc/source/ui/view/gridwin_dbgutil.cxx |   54 ++++++++++++++++++++++++++++++----
 2 files changed, 50 insertions(+), 8 deletions(-)

New commits:
commit ba42d726d7c2b80341b3942ef8c44cce3e44b812
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 9 03:49:47 2017 +0200

    dump the whole selection and not just one cell
    
    Change-Id: I059b5547d07c5e8f042e22f9de34ce51ffe49c38
    Reviewed-on: https://gerrit.libreoffice.org/36313
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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);


More information about the Libreoffice-commits mailing list