Kaydet (Commit) dc1656a7 authored tarafından Miklos Vajna's avatar Miklos Vajna

LOK: initial Document::getCommandValues() for RowColumnHeaders

Only the row info and for the entire tiled rendering area as a start.

(cherry picked from commit a7ce5f83)

Conflicts:
	sc/inc/docuno.hxx

Change-Id: Idbccd805b355e8d151ab7025ac1cf0c686cb237b
üst 155044c7
...@@ -1221,7 +1221,23 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo ...@@ -1221,7 +1221,23 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
{ {
return getStyles(pThis, pCommand); return getStyles(pThis, pCommand);
} }
else { else if (OString(pCommand) == ".uno:ViewRowColumnHeaders")
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
return 0;
}
OUString aHeaders = pDoc->getRowColumnHeaders();
OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
strcpy(pMemory, aString.getStr());
return pMemory;
}
else
{
gImpl->maLastExceptionMsg = "Unknown command, no values returned"; gImpl->maLastExceptionMsg = "Unknown command, no values returned";
return NULL; return NULL;
} }
......
...@@ -148,6 +148,14 @@ public: ...@@ -148,6 +148,14 @@ public:
return OUString(); return OUString();
} }
/**
* Get position and content of row/column headers of Calc documents.
*/
virtual OUString getRowColumnHeaders()
{
return OUString();
}
/// Sets the clipboard of the component. /// Sets the clipboard of the component.
virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0; virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0;
......
...@@ -421,6 +421,9 @@ public: ...@@ -421,6 +421,9 @@ public:
/// @see vcl::ITiledRenderable::isMimeTypeSupported(). /// @see vcl::ITiledRenderable::isMimeTypeSupported().
virtual bool isMimeTypeSupported() SAL_OVERRIDE; virtual bool isMimeTypeSupported() SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::getRowColumnHeaders().
virtual OUString getRowColumnHeaders() SAL_OVERRIDE;
}; };
class ScDrawPagesObj : public cppu::WeakImplHelper2< class ScDrawPagesObj : public cppu::WeakImplHelper2<
......
...@@ -520,6 +520,8 @@ public: ...@@ -520,6 +520,8 @@ public:
void EnableAutoSpell( bool bEnable ); void EnableAutoSpell( bool bEnable );
void ResetAutoSpell(); void ResetAutoSpell();
void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges ); void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
/// @see ScModelObj::getRowColumnHeaders().
OUString getRowColumnHeaders();
}; };
#endif #endif
......
...@@ -855,6 +855,19 @@ bool ScModelObj::isMimeTypeSupported() ...@@ -855,6 +855,19 @@ bool ScModelObj::isMimeTypeSupported()
return EditEngine::HasValidData(aDataHelper.GetTransferable()); 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() void ScModelObj::initializeForTiledRendering()
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <boost/property_tree/json_parser.hpp>
#include <basegfx/tools/zoomtools.hxx> #include <basegfx/tools/zoomtools.hxx>
...@@ -2302,4 +2303,32 @@ void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<ed ...@@ -2302,4 +2303,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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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