summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-12-03 09:56:29 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-12-03 10:11:44 +0100
commit15e9dc4e22283a7a828b9365ef55419213ad2644 (patch)
tree016a33f471e6346425966b5a61c13361b1b4878f
parentf5b6aa651537d8ef82318e6c92e5dba4e57a7d6d (diff)
WIP: allow building against libreoffice-5-0..libreoffice-5-1bisect
I.e. strip out all new features so that lokitclient can build against various core.git commits.
-rw-r--r--loolwsd/LOKitClient.cpp9
-rw-r--r--loolwsd/LOOLSession.cpp24
-rw-r--r--loolwsd/Png.hpp2
-rw-r--r--loolwsd/Util.cpp13
-rw-r--r--loolwsd/Util.hpp2
5 files changed, 20 insertions, 30 deletions
diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index afbc62d39..a6d0d3e96 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -38,8 +38,9 @@ using Poco::Util::Application;
extern "C"
{
- static void myCallback(int nType, const char* pPayload, void*)
+ static void myCallback(int /*nType*/, const char* /*pPayload*/, void*)
{
+#if 0
std::cout << "Callback: ";
switch ((LibreOfficeKitCallbackType) nType)
{
@@ -67,6 +68,7 @@ extern "C"
#undef CASE
}
std::cout << " payload: " << pPayload << std::endl;
+#endif
}
}
@@ -103,7 +105,7 @@ protected:
loKitDocument->pClass->registerCallback(loKitDocument, myCallback, NULL);
- loKitDocument->pClass->initializeForRendering(loKitDocument, nullptr);
+ loKitDocument->pClass->initializeForRendering(loKitDocument);
if (isatty(0))
{
@@ -166,8 +168,7 @@ protected:
continue;
std::vector<char> png;
- LibreOfficeKitTileMode mode = static_cast<LibreOfficeKitTileMode>(loKitDocument->pClass->getTileMode(loKitDocument));
- Util::encodePNGAndAppendToBuffer(pixmap.data(), canvasWidth, canvasHeight, png, mode);
+ Util::encodePNGAndAppendToBuffer(pixmap.data(), canvasWidth, canvasHeight, png);
TemporaryFile pngFile;
std::ofstream pngStream(pngFile.path(), std::ios::binary);
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 9708131b5..895271c53 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -979,15 +979,15 @@ extern "C"
case LOK_CALLBACK_GRAPHIC_SELECTION:
srv->sendTextFrame("graphicselection: " + std::string(pPayload));
break;
- case LOK_CALLBACK_CELL_CURSOR:
+ /*case LOK_CALLBACK_CELL_CURSOR:
srv->sendTextFrame("cellcursor: " + std::string(pPayload));
break;
case LOK_CALLBACK_CELL_FORMULA:
srv->sendTextFrame("cellformula: " + std::string(pPayload));
- break;
- case LOK_CALLBACK_MOUSE_POINTER:
+ break;*/
+ /*case LOK_CALLBACK_MOUSE_POINTER:
srv->sendTextFrame("mousepointer: " + std::string(pPayload));
- break;
+ break;*/
case LOK_CALLBACK_HYPERLINK_CLICKED:
srv->sendTextFrame("hyperlinkclicked: " + std::string(pPayload));
break;
@@ -1006,19 +1006,19 @@ extern "C"
case LOK_CALLBACK_SEARCH_NOT_FOUND:
srv->sendTextFrame("searchnotfound: " + std::string(pPayload));
break;
- case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
+ /*case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
srv->sendTextFrame("searchresultselection: " + std::string(pPayload));
- break;
- case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
+ break;*/
+ /*case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
srv->getStatus("", 0);
srv->getPartPageRectangles("", 0);
- break;
- case LOK_CALLBACK_SET_PART:
+ break;*/
+ /*case LOK_CALLBACK_SET_PART:
srv->sendTextFrame("setpart: " + std::string(pPayload));
break;
case LOK_CALLBACK_UNO_COMMAND_RESULT:
srv->sendTextFrame("unocommandresult: " + std::string(pPayload));
- break;
+ break;*/
}
}
}
@@ -1077,7 +1077,7 @@ bool ChildProcessSession::loadDocument(const char *buffer, int length, StringTok
renderingOptions = object->get("rendering").toString();
}
- _loKitDocument->pClass->initializeForRendering(_loKitDocument, (renderingOptions.empty() ? nullptr : renderingOptions.c_str()));
+ _loKitDocument->pClass->initializeForRendering(_loKitDocument);
if ( _docType != "text" && part != -1)
{
@@ -1317,7 +1317,7 @@ bool ChildProcessSession::paste(const char* /*buffer*/, int /*length*/, StringTo
data = Poco::cat(std::string(" "), tokens.begin() + 2, tokens.end()).substr(strlen("data="));
- _loKitDocument->pClass->paste(_loKitDocument, mimeType.c_str(), data.c_str(), std::strlen(data.c_str()));
+ //_loKitDocument->pClass->paste(_loKitDocument, mimeType.c_str(), data.c_str(), std::strlen(data.c_str()));
return true;
}
diff --git a/loolwsd/Png.hpp b/loolwsd/Png.hpp
index 23d86d4a9..976e174d2 100644
--- a/loolwsd/Png.hpp
+++ b/loolwsd/Png.hpp
@@ -37,7 +37,7 @@
*/
/* Unpremultiplies data and converts native endian ARGB => RGBA bytes */
-static void
+void
unpremultiply_data (png_structp /*png*/, png_row_infop row_info, png_bytep data)
{
unsigned int i;
diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 232e4258f..81fd02682 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -82,7 +82,7 @@ namespace Util
return false;
}
- bool encodePNGAndAppendToBuffer(unsigned char *pixmap, int width, int height, std::vector<char>& output, LibreOfficeKitTileMode mode)
+ bool encodePNGAndAppendToBuffer(unsigned char *pixmap, int width, int height, std::vector<char>& output)
{
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -101,17 +101,6 @@ namespace Util
png_write_info(png_ptr, info_ptr);
- switch (mode)
- {
- case LOK_TILEMODE_RGBA:
- break;
- case LOK_TILEMODE_BGRA:
- png_set_write_user_transform_fn (png_ptr, unpremultiply_data);
- break;
- default:
- assert(false);
- }
-
for (int y = 0; y < height; ++y)
png_write_row(png_ptr, pixmap + y * width * 4);
diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index 02a21d644..31f5ca21f 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -25,7 +25,7 @@ namespace Util
// Sadly, older libpng headers don't use const for the pixmap pointer parameter to
// png_write_row(), so can't use const here for pixmap.
- bool encodePNGAndAppendToBuffer(unsigned char *pixmap, int width, int height, std::vector<char>& output, LibreOfficeKitTileMode mode);
+ bool encodePNGAndAppendToBuffer(unsigned char *pixmap, int width, int height, std::vector<char>& output);
// Call WebSocket::shutdown() ignoring Poco::IOException
void shutdownWebSocket(Poco::Net::WebSocket& ws);