diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-30 11:18:19 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-30 12:35:56 +0100 |
commit | a7ce5f83343f8f6ba8a59b05820b3a2066c0ce9a (patch) | |
tree | 1696769691eb0b0acba8d1c0eb02badac9a61599 /sc/source | |
parent | 5aee8e8cf48cf6c5fe5a4065554e96597e39e73d (diff) |
LOK: initial Document::getCommandValues() for RowColumnHeaders
Only the row info and for the entire tiled rendering area as a start.
Change-Id: Idbccd805b355e8d151ab7025ac1cf0c686cb237b
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 29 |
3 files changed, 44 insertions, 0 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 24be8c0c43b4..51cb7c1c82fe 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -517,6 +517,8 @@ public: void EnableAutoSpell( bool bEnable ); void ResetAutoSpell(); void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges ); + /// @see ScModelObj::getRowColumnHeaders(). + OUString getRowColumnHeaders(); }; #endif diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c6070f1dfe82..27fe63882596 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -869,6 +869,19 @@ bool ScModelObj::isMimeTypeSupported() return EditEngine::HasValidData(aDataHelper.GetTransferable()); } +OUString ScModelObj::getRowColumnHeaders() +{ + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + return OUString(); + + ScTabView* pTabView = pViewData->GetView(); + if (!pTabView) + return OUString(); + + return pTabView->getRowColumnHeaders(); +} + void ScModelObj::initializeForTiledRendering() { SolarMutexGuard aGuard; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 6e390531885c..aa50aafed23b 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -50,6 +50,7 @@ #include <string> #include <algorithm> +#include <boost/property_tree/json_parser.hpp> #include <basegfx/tools/zoomtools.hxx> @@ -2278,4 +2279,32 @@ void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<ed } } +OUString ScTabView::getRowColumnHeaders() +{ + ScDocument* pDoc = aViewData.GetDocument(); + if (!pDoc) + return OUString(); + + SCCOL nEndCol = 0; + SCROW nEndRow = 0; + pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); + + boost::property_tree::ptree aRows; + for (SCROW nRow = 0; nRow < nEndRow; ++nRow) + { + boost::property_tree::ptree aRow; + sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow); + aRow.put("size", OString::number(nSize).getStr()); + OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow); + aRow.put("text", aText.toUtf8().getStr()); + aRows.push_back(std::make_pair("", aRow)); + } + + boost::property_tree::ptree aTree; + aTree.add_child("rows", aRows); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + return OUString::fromUtf8(aStream.str().c_str()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |