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 @@ ...@@ -53,6 +53,7 @@
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/msgpool.hxx> #include <sfx2/msgpool.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/lokhelper.hxx>
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/svpforlokit.hxx> #include <vcl/svpforlokit.hxx>
...@@ -249,6 +250,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, ...@@ -249,6 +250,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
static void doc_resetSelection (LibreOfficeKitDocument* pThis); static void doc_resetSelection (LibreOfficeKitDocument* pThis);
static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); 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) : LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) :
mxComponent( xComponent ) mxComponent( xComponent )
...@@ -280,6 +282,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone ...@@ -280,6 +282,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->resetSelection = doc_resetSelection; m_pDocumentClass->resetSelection = doc_resetSelection;
m_pDocumentClass->getCommandValues = doc_getCommandValues; m_pDocumentClass->getCommandValues = doc_getCommandValues;
m_pDocumentClass->createView = doc_createView;
gDocumentClass = m_pDocumentClass; gDocumentClass = m_pDocumentClass;
} }
pClass = m_pDocumentClass.get(); pClass = m_pDocumentClass.get();
...@@ -1032,6 +1036,21 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo ...@@ -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) static char* lo_getError (LibreOfficeKit *pThis)
{ {
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
......
...@@ -162,6 +162,9 @@ struct _LibreOfficeKitDocumentClass ...@@ -162,6 +162,9 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document:getStyles /// @see lok::Document:getStyles
char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand); char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* pCommand);
/// @see lok::Document::createView().
int (*createView) (LibreOfficeKitDocument* pThis);
#endif // LOK_USE_UNSTABLE_API #endif // LOK_USE_UNSTABLE_API
}; };
......
...@@ -257,6 +257,16 @@ public: ...@@ -257,6 +257,16 @@ public:
{ {
return mpDoc->pClass->getCommandValues(mpDoc, pCommand); 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 #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