comphelper: enable LibreOfficeKit::isViewCallback() by default
This requires porting the sw/sd/sc_tiledrendering test code to the new internal API, as only the public LOK API is unchanged. Change-Id: Ic6a2f96421da4a16bdee7d0cbb3f6e35bc6ddff9 Reviewed-on: https://gerrit.libreoffice.org/26379 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
@@ -17,7 +17,7 @@ namespace LibreOfficeKit
|
||||
|
||||
static bool g_bActive(false);
|
||||
|
||||
static bool g_bViewCallback(false);
|
||||
static bool g_bViewCallback(true);
|
||||
|
||||
void setActive(bool bActive)
|
||||
{
|
||||
|
@@ -13,4 +13,4 @@ LibreOfficeKit
|
||||
--------------
|
||||
|
||||
LOK_DEBUG - Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins.
|
||||
LOK_VIEW_CALLBACK - Use incomplete per-view callbacks instead of a single one.
|
||||
LOK_MODEL_CALLBACK - Use old document-global callback instead of multiple per-view ones.
|
||||
|
@@ -2136,7 +2136,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
|
||||
if (eStage != SECOND_INIT)
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
|
||||
static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
|
||||
static bool bViewCallback = !getenv("LOK_MODEL_CALLBACK");
|
||||
comphelper::LibreOfficeKit::setViewCallback(bViewCallback);
|
||||
|
||||
if (eStage != PRE_INIT)
|
||||
|
@@ -1314,7 +1314,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow)
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pUnoCmdDebugger, -1);
|
||||
g_signal_connect(G_OBJECT(pUnoCmdDebugger), "clicked", G_CALLBACK(unoCommandDebugger), nullptr);
|
||||
|
||||
static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
|
||||
static bool bViewCallback = !getenv("LOK_MODEL_CALLBACK");
|
||||
if (bViewCallback)
|
||||
{
|
||||
GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr);
|
||||
|
@@ -308,19 +308,19 @@ void ScTiledRenderingTest::testDocumentSize()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
ScModelObj* pModelObj = createDoc("sort-range.ods");
|
||||
pModelObj->registerCallback(&ScTiledRenderingTest::callback, this);
|
||||
|
||||
// check initial document size
|
||||
Size aDocSize = pModelObj->getDocumentSize();
|
||||
CPPUNIT_ASSERT(aDocSize.Width() > 0);
|
||||
CPPUNIT_ASSERT(aDocSize.Height() > 0);
|
||||
|
||||
ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
|
||||
CPPUNIT_ASSERT(pDocSh);
|
||||
|
||||
ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
|
||||
CPPUNIT_ASSERT(pViewShell);
|
||||
|
||||
pViewShell->registerLibreOfficeKitViewCallback(&ScTiledRenderingTest::callback, this);
|
||||
|
||||
// check initial document size
|
||||
Size aDocSize = pModelObj->getDocumentSize();
|
||||
CPPUNIT_ASSERT(aDocSize.Width() > 0);
|
||||
CPPUNIT_ASSERT(aDocSize.Height() > 0);
|
||||
|
||||
// Set cursor column
|
||||
pViewShell->SetCursor(100, 0);
|
||||
// 2 seconds
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <svx/svdotable.hxx>
|
||||
|
||||
#include <DrawDocShell.hxx>
|
||||
#include <ViewShellBase.hxx>
|
||||
#include <ViewShell.hxx>
|
||||
#include <sdpage.hxx>
|
||||
#include <unomodel.hxx>
|
||||
@@ -258,8 +259,8 @@ xmlDocPtr SdTiledRenderingTest::parseXmlDump()
|
||||
void SdTiledRenderingTest::testRegisterCallback()
|
||||
{
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
// Start text edit of the empty title shape.
|
||||
SdPage* pActualPage = pViewShell->GetActualPage();
|
||||
@@ -443,14 +444,14 @@ void SdTiledRenderingTest::testSearch()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
||||
uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
|
||||
xShape->setString("Aaa bbb.");
|
||||
|
||||
lcl_search("bbb");
|
||||
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
SdrView* pView = pViewShell->GetView();
|
||||
EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
|
||||
// Did we indeed manage to select the second word?
|
||||
@@ -478,7 +479,8 @@ void SdTiledRenderingTest::testSearchAll()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
lcl_search("match", /*bFindAll=*/true);
|
||||
|
||||
@@ -498,7 +500,8 @@ void SdTiledRenderingTest::testSearchAllSelections()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
lcl_search("third", /*bFindAll=*/true);
|
||||
// Make sure this is found on the 3rd slide.
|
||||
@@ -512,7 +515,8 @@ void SdTiledRenderingTest::testSearchAllNotifications()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
lcl_search("third", /*bFindAll=*/true);
|
||||
// Make sure that we get no notifications about selection changes during search.
|
||||
@@ -526,7 +530,8 @@ void SdTiledRenderingTest::testSearchAllFollowedBySearch()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
lcl_search("third", /*bFindAll=*/true);
|
||||
lcl_search("match" /*,bFindAll=false*/);
|
||||
@@ -559,7 +564,8 @@ void SdTiledRenderingTest::testInsertDeletePage()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("insert-delete.odp");
|
||||
pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
|
||||
|
||||
SdDrawDocument* pDoc = pXImpressDocument->GetDocShell()->GetDoc();
|
||||
CPPUNIT_ASSERT(pDoc);
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <drawdoc.hxx>
|
||||
#include <ndtxt.hxx>
|
||||
#include <wrtsh.hxx>
|
||||
#include <sfx2/viewsh.hxx>
|
||||
|
||||
static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
|
||||
|
||||
@@ -169,8 +170,8 @@ void SwTiledRenderingTest::testRegisterCallback()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
// Insert a character at the beginning of the document.
|
||||
pWrtShell->Insert("x");
|
||||
|
||||
@@ -339,8 +340,8 @@ void SwTiledRenderingTest::testSearch()
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
|
||||
SwXTextDocument* pXTextDocument = createDoc("search.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
std::size_t nNode = pWrtShell->getShellCursor(false)->Start()->nNode.GetNode().GetIndex();
|
||||
|
||||
// First hit, in the second paragraph, before the shape.
|
||||
@@ -408,7 +409,8 @@ void SwTiledRenderingTest::testSearchTextFrame()
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
|
||||
SwXTextDocument* pXTextDocument = createDoc("search.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
|
||||
{
|
||||
{"SearchItem.SearchString", uno::makeAny(OUString("TextFrame"))},
|
||||
@@ -424,7 +426,8 @@ void SwTiledRenderingTest::testSearchTextFrame()
|
||||
void SwTiledRenderingTest::testSearchTextFrameWrapAround()
|
||||
{
|
||||
SwXTextDocument* pXTextDocument = createDoc("search.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
|
||||
{
|
||||
{"SearchItem.SearchString", uno::makeAny(OUString("TextFrame"))},
|
||||
@@ -442,8 +445,8 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
// Get the current document size.
|
||||
SwXTextDocument* pXTextDocument = createDoc("2-pages.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
Size aSize = pXTextDocument->getDocumentSize();
|
||||
|
||||
// Delete the second page and see how the size changes.
|
||||
@@ -461,7 +464,8 @@ void SwTiledRenderingTest::testSearchAll()
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
|
||||
SwXTextDocument* pXTextDocument = createDoc("search.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
|
||||
{
|
||||
{"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
|
||||
@@ -481,7 +485,8 @@ void SwTiledRenderingTest::testSearchAllNotifications()
|
||||
{
|
||||
comphelper::LibreOfficeKit::setActive();
|
||||
SwXTextDocument* pXTextDocument = createDoc("search.odt");
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
|
||||
{
|
||||
{"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
|
||||
@@ -509,7 +514,8 @@ void SwTiledRenderingTest::testPageDownInvalidation()
|
||||
{".uno:HideWhitespace", uno::makeAny(true)},
|
||||
}));
|
||||
pXTextDocument->initializeForTiledRendering(aPropertyValues);
|
||||
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
|
||||
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
|
||||
pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
|
||||
comphelper::dispatchCommand(".uno:PageDown", uno::Sequence<beans::PropertyValue>());
|
||||
|
||||
// This was 2.
|
||||
|
Reference in New Issue
Block a user