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

lok::Document: add createView()

(cherry picked from commit 655c7877)

Conflicts:
	libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx

Change-Id: Ic871ec41992b611b10958799b2dc12375a91efe4
üst 477bd979
......@@ -53,6 +53,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/lokhelper.hxx>
#include <svx/svxids.hrc>
#include <vcl/svapp.hxx>
#include <vcl/svpforlokit.hxx>
......@@ -249,6 +250,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
static void doc_resetSelection (LibreOfficeKitDocument* pThis);
static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand);
static int doc_createView(LibreOfficeKitDocument* pThis);
LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) :
mxComponent( xComponent )
......@@ -280,6 +282,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->resetSelection = doc_resetSelection;
m_pDocumentClass->getCommandValues = doc_getCommandValues;
m_pDocumentClass->createView = doc_createView;
gDocumentClass = m_pDocumentClass;
}
pClass = m_pDocumentClass.get();
......@@ -1032,6 +1036,21 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
}
}
static int doc_createView(LibreOfficeKitDocument* pThis)
{
SolarMutexGuard aGuard;
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
return -1;
}
SfxViewShell* pViewShell = pDoc->getCurrentViewShell();
return SfxLokHelper::createView(pViewShell);
}
static char* lo_getError (LibreOfficeKit *pThis)
{
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
......
......@@ -162,6 +162,9 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document:getStyles
char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
/// @see lok::Document::createView().
int (*createView) (LibreOfficeKitDocument* pThis);
#endif // LOK_USE_UNSTABLE_API
};
......
......@@ -257,6 +257,16 @@ public:
{
return mpDoc->pClass->getCommandValues(mpDoc, pCommand);
}
/**
* Create a new view for an existing document.
* By default a loaded document has 1 view.
* @return the ID of the new view.
*/
int createView()
{
return mpDoc->pClass->createView(mpDoc);
}
#endif // LOK_USE_UNSTABLE_API
};
......
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